diff --git a/Pages/index/index.json b/Pages/index/index.json index 6d4b887..f5a6c38 100644 --- a/Pages/index/index.json +++ b/Pages/index/index.json @@ -3,6 +3,7 @@ "usingComponents": { "t-image": "tdesign-miniprogram/image/image", "van-overlay": "@vant/weapp/overlay/index", + "van-icon": "@vant/weapp/icon/index", "van-dialog": "@vant/weapp/dialog/index" } } \ No newline at end of file diff --git a/Pages/yishi/index/index.js b/Pages/yishi/index/index.js index db0b2ef..8bf4f85 100644 --- a/Pages/yishi/index/index.js +++ b/Pages/yishi/index/index.js @@ -22,6 +22,7 @@ Page({ avg_response_time: 0, number_of_fans: 0, avatar: api.getStaticHost()+"/applet/doctor/static/images/default_photo.png", + introduction_status:'', reject_prescription_number: false,//处方管理小红点 }, static_host: api.getStaticHost(), @@ -241,7 +242,7 @@ Page({ this.getMenuButtonBound(); api.yiShiIndex().then(response => { - // console.log(response); + console.log(response); let avatar = response.data.info.avatar; this.setData({ "info.user_name": response.data.info.user_name, @@ -249,6 +250,7 @@ Page({ "info.accepting_inquiry_num": response.data.info.accepting_inquiry_num, "info.praise_rate": response.data.info.praise_rate, "info.avg_response_time": response.data.info.avg_response_time, + "info.introduction_status":response.data.info.introduction_status, "info.number_of_fans": response.data.info.number_of_fans, doctor_inquiry_config:response.data.doctor_inquiry_config }) diff --git a/Pages/yishi/index/index.json b/Pages/yishi/index/index.json index 4f5607b..04197ae 100644 --- a/Pages/yishi/index/index.json +++ b/Pages/yishi/index/index.json @@ -5,6 +5,7 @@ "van-button": "@vant/weapp/button/index", "t-badge": "tdesign-miniprogram/badge/badge", "t-dialog": "tdesign-miniprogram/dialog/dialog", + "van-icon": "@vant/weapp/icon/index", "van-image": "@vant/weapp/image/index", "t-skeleton": "tdesign-miniprogram/skeleton/skeleton", "van-overlay": "@vant/weapp/overlay/index" diff --git a/Pages/yishi/index/index.wxml b/Pages/yishi/index/index.wxml index 84d47eb..8a80fec 100644 --- a/Pages/yishi/index/index.wxml +++ b/Pages/yishi/index/index.wxml @@ -113,6 +113,7 @@ src="{{static_host}}/applet/doctor/static/images/yishi/jianjie.png" /> 个人简介管理 + ! {{item.message_send_time}} - {{item.last_message_content.Text}} + + {{item.custommessagetype==13?'[附赠回复]':item.last_message_content.Text}} {{ item.inquiry_status==1?'待支付':item.inquiry_status==2?'待分配':item.inquiry_status==3?'待接诊':item.inquiry_status==4?'接诊中':item.inquiry_status==5?'已完成':item.inquiry_status==6?'已结束':item.inquiry_status==7?'已取消':'其他' }} diff --git a/TUICallKit/TUICallKit/TUICallKit.js b/TUICallKit/TUICallKit/TUICallKit.js index 4786a11..b925821 100644 --- a/TUICallKit/TUICallKit/TUICallKit.js +++ b/TUICallKit/TUICallKit/TUICallKit.js @@ -46,9 +46,9 @@ Component({ if(value=='idle'){ this.sendCustom(); } - console.log("通话状态该笔:"+value); - console.log(this.data.callerUserInfo); - console.log(this.data.localUserInfo); + // console.log("通话状态该笔:"+value); + // console.log(this.data.callerUserInfo); + // console.log(this.data.localUserInfo); }, //纠正音视频电话不能携带自定义消息,结束后,主动发条消息 sendCustom(){ @@ -56,11 +56,12 @@ Component({ let {timer}=this.data; if(timer){ clearTimeout(timer); - } + return false; + }; wx.getStorage({ key: 'patientInfo', success (res) { - let patientInfo=JSON.parse(res.data); + let patientInfo=res.data; let chat=TUICallKitServer.getTim(); let message = chat.createCustomMessage({ to:patientInfo.patient_user_id, @@ -73,12 +74,12 @@ Component({ cloudCustomData:JSON.stringify(patientInfo) }); let time=setTimeout(()=>{ - let promise = chat.sendMessage(message,{ - messageControlInfo: { - excludedFromUnreadCount: true, // 消息不更新会话 unreadCount(消息存漫游) - } - }); - promise.then(function(imResponse) { + let promise = chat.sendMessage(message, { + messageControlInfo: { + excludedFromUnreadCount: true, // 消息不更新会话 unreadCount(消息存漫游) + } + }); + promise.then((imResponse)=>{ console.log('发送成功'); console.log(imResponse); }).catch(function(imError) { @@ -245,6 +246,7 @@ Component({ [PUSHER]: this.handlePusherChange.bind(that), [PLAYER]: this.handlePlayerListChange.bind(that), }); + await TUICallKitServer.reject(); }, }, }); diff --git a/TUICallKit/TUICallKit/component/SingleCall/SingleCall.js b/TUICallKit/TUICallKit/component/SingleCall/SingleCall.js index a4239c1..f61a180 100644 --- a/TUICallKit/TUICallKit/component/SingleCall/SingleCall.js +++ b/TUICallKit/TUICallKit/component/SingleCall/SingleCall.js @@ -10,6 +10,9 @@ Component({ type: String, observer(callStatus) { console.log("改编状态:"+callStatus); + if(callStatus=='CONNECTED'){ + TUICallKitServer.enableMuteMode(false); + } } }, callMediaType: { @@ -37,18 +40,23 @@ Component({ type: Boolean } }, - pageLifetimes: { - show: function() { - // 页面被展示 + lifetimes: { + moved(){ + //console.log('moved') }, - hide: function() { - // 页面被隐藏 - this.hangup() - }, - resize: function(size) { - // 页面尺寸变化 + detached(){ + //console.log('detached') + this.hangup() } }, + pageLifetimes: { + show() { + + }, + hide() { + this.hangup() + }, + }, data:{ IMG_DEFAULT_AVATAR:`${PATH}/default_avatar.png`, IMG_HANGUP:`${PATH}/hangup.png`, @@ -73,7 +81,7 @@ Component({ }, async reject() { await TUICallKitServer.reject(); - console.log(this.data.remoteUserInfoList) + //console.log(this.data.remoteUserInfoList) }, async switchCamera() { await TUICallKitServer.switchCamera(); diff --git a/TUICallKit/TUICallService/CallService/bellContext.ts b/TUICallKit/TUICallService/CallService/bellContext.ts new file mode 100644 index 0000000..39534c7 --- /dev/null +++ b/TUICallKit/TUICallService/CallService/bellContext.ts @@ -0,0 +1,86 @@ +import { CallStatus, NAME, CallRole } from '../const/index'; +import { IBellParams } from '../interface/index'; +import { isUndefined } from '../utils/common-utils'; +const DEFAULT_CALLER_BELL_FILEPATH = '/TUICallKit/static/phone_dialing.mp3'; +const DEFAULT_CALLEE_BELL_FILEPATH = '/TUICallKit/static/phone_ringing.mp3'; + +export class BellContext { + private _bellContext: any = null; + private _isMuteBell: boolean = false; + private _calleeBellFilePath: string = DEFAULT_CALLEE_BELL_FILEPATH; + private _callRole: string = CallRole.UNKNOWN; + private _callStatus: string = CallStatus.IDLE; + + constructor() { + // @ts-ignore + this._bellContext = wx.createInnerAudioContext(); + this._bellContext.loop = true; + } + + setBellSrc() { + // @ts-ignore + const fs = wx.getFileSystemManager(); + try { + let playBellFilePath = DEFAULT_CALLER_BELL_FILEPATH; + if (this._callRole === CallRole.CALLEE) { + playBellFilePath = this._calleeBellFilePath || DEFAULT_CALLEE_BELL_FILEPATH; + } + fs.readFileSync(playBellFilePath, 'utf8', 0); + this._bellContext.src = playBellFilePath; + } catch (error) { + console.warn(`${NAME.PREFIX}Failed to setBellSrc, ${error}`); + } + } + setBellProperties(bellParams: IBellParams) { + this._callRole = bellParams.callRole || this._callRole; + this._callStatus = bellParams.callStatus || this._callStatus; + this._calleeBellFilePath = bellParams.calleeBellFilePath || this._calleeBellFilePath; + // undefined/false || isMuteBell => isMuteBell (不符合预期) + this._isMuteBell = isUndefined(bellParams.isMuteBell) ? this._isMuteBell : bellParams.isMuteBell; + } + async play() { + try { + if (this._callStatus !== CallStatus.CALLING) { + return ; + } + this.setBellSrc(); + if (this._callRole === CallRole.CALLEE && !this._isMuteBell) { + await this._bellContext.play(); + } + if (this._callRole === CallRole.CALLER) { + await this._bellContext.play(); + } + } catch (error) { + console.warn(`${NAME.PREFIX}Failed to play audio file, ${error}`); + } + } + async stop() { + try { + this._bellContext.stop(); + } catch (error) { + console.warn(`${NAME.PREFIX}Failed to stop audio file, ${error}`); + } + } + async setBellMute(enable: boolean) { + if (this._callStatus !== CallStatus.CALLING && this._callRole !== CallRole.CALLEE) { + return; + } + if (enable) { + await this.stop(); + } else { + await this.play(); + } + } + destroy() { + try { + this._isMuteBell = false; + this._calleeBellFilePath = ''; + this._callRole = CallRole.UNKNOWN; + this._callStatus = CallStatus.IDLE; + this._bellContext.destroy(); + this._bellContext = null; + } catch (error) { + console.warn(`${NAME.PREFIX}Failed to destroy, ${error}`); + } + } +} diff --git a/TUICallKit/TUICallService/CallService/index.d.ts b/TUICallKit/TUICallService/CallService/index.d.ts index c5872c6..1d378ff 100644 --- a/TUICallKit/TUICallService/CallService/index.d.ts +++ b/TUICallKit/TUICallService/CallService/index.d.ts @@ -11,7 +11,9 @@ export default class TUICallService implements ITUICallService { private _tim; private _TUICore; private _timerId; + private _startTimeStamp; private _bellContext; + private _defaultOfflinePushInfo; constructor(); static getInstance(): TUICallService; init(params: IInitParams): Promise; diff --git a/TUICallKit/TUICallService/CallService/index.js b/TUICallKit/TUICallService/CallService/index.js index c814fab..21ae0cb 100644 --- a/TUICallKit/TUICallService/CallService/index.js +++ b/TUICallKit/TUICallService/CallService/index.js @@ -34,9 +34,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.TUIStore = exports.TUIGlobal = void 0; const tui_core_1 = require("../../min-npm/@tencentcloud/tui-core/index"); +//const tui_core_1 = require("@tencentcloud/tui-core"); const index_1 = require("../const/index"); // @ts-ignore const tuicall_engine_wx_1 = require("../../min-npm/tuicall-engine-wx/index"); +//const tuicall_engine_wx_1 = require("tuicall-engine-wx"); const index_2 = require("../locales/index"); const miniProgram_1 = require("./miniProgram"); const bellContext_1 = require("./bellContext"); @@ -56,7 +58,12 @@ class TUICallService { this._tim = null; this._TUICore = null; this._timerId = -1; + this._startTimeStamp = (0, common_utils_1.performanceNow)(); this._bellContext = null; + this._defaultOfflinePushInfo = { + title: '', + description: (0, index_2.t)('you have a new call'), + }; // =========================【监听 TUIStore 中的状态】========================= this._handleCallStatusChange = (value) => __awaiter(this, void 0, void 0, function* () { var _a, _b; @@ -76,6 +83,7 @@ class TUICallService { const callMediaType = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_MEDIA_TYPE); const remoteUserInfoList = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST); const oldStatus = isGroup ? index_1.StatusChange.DIALING_GROUP : index_1.StatusChange.DIALING_C2C; + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.CALL_TIPS, ''); this.statusChanged && this.statusChanged({ oldStatus, newStatus: (0, utils_1.generateStatusChangeText)(TUIStore) }); if (!isGroup && callMediaType === index_1.CallMediaType.VIDEO) { this.switchScreen(remoteUserInfoList[0].domId); @@ -124,6 +132,7 @@ class TUICallService { }); this._addListenTuiCallEngineEvent(); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, { userId: userID }); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { userId: userID }); yield this._tuiCallEngine.login({ userID, userSig, assetsPath: '' }); // web && mini } catch (error) { @@ -156,11 +165,12 @@ class TUICallService { call(callParams) { return __awaiter(this, void 0, void 0, function* () { try { - const { type, userID } = callParams; + const { type, userID, offlinePushInfo } = callParams; if (TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_STATUS) !== index_1.CallStatus.IDLE) return; yield this._updateCallStoreBeforeCall(type, [{ userId: userID }]); this._executeExternalBeforeCalling(); // 执行外部传入的 beforeCall 方法 + callParams.offlinePushInfo = Object.assign(Object.assign({}, this._defaultOfflinePushInfo), offlinePushInfo); const response = yield this._tuiCallEngine.call(callParams); yield this._updateCallStoreAfterCall([userID], response); } @@ -173,12 +183,13 @@ class TUICallService { groupCall(groupCallParams) { return __awaiter(this, void 0, void 0, function* () { try { - const { userIDList, type, groupID } = groupCallParams; + const { userIDList, type, groupID, offlinePushInfo } = groupCallParams; if (TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_STATUS) !== index_1.CallStatus.IDLE) return; const remoteUserInfoList = userIDList.map(userId => ({ userId })); yield this._updateCallStoreBeforeCall(type, remoteUserInfoList, groupID); this._executeExternalBeforeCalling(); + groupCallParams.offlinePushInfo = Object.assign(Object.assign({}, this._defaultOfflinePushInfo), offlinePushInfo); const response = yield this._tuiCallEngine.groupCall(groupCallParams); yield this._updateCallStoreAfterCall(userIDList, response); } @@ -194,6 +205,7 @@ class TUICallService { let inviteUserInfoList = yield (0, utils_1.getRemoteUserProfile)(userIDList, this.getTim(), TUIStore); const remoteUserInfoList = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, [...remoteUserInfoList, ...inviteUserInfoList]); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, [...remoteUserInfoList, ...inviteUserInfoList]); this._tuiCallEngine && (yield this._tuiCallEngine.inviteUser(params)); } catch (error) { @@ -223,6 +235,7 @@ class TUICallService { this.setSoundMode(params.type === index_1.CallMediaType.AUDIO ? index_1.AudioPlayBackDevice.EAR : index_1.AudioPlayBackDevice.SPEAKER); const localUserInfo = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); this._setLocalUserInfoAudioVideoAvailable(true, index_1.NAME.AUDIO); } catch (error) { @@ -301,6 +314,7 @@ class TUICallService { this.setSoundMode(callMediaType === index_1.CallMediaType.AUDIO ? index_1.AudioPlayBackDevice.EAR : index_1.AudioPlayBackDevice.SPEAKER); const localUserInfo = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); this._setLocalUserInfoAudioVideoAvailable(true, index_1.NAME.AUDIO); // web && mini default open audio } } @@ -422,8 +436,11 @@ class TUICallService { } switchCamera() { return __awaiter(this, void 0, void 0, function* () { + const currentPosition = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CAMERA_POSITION); + const targetPosition = currentPosition === index_1.CameraPosition.BACK ? index_1.CameraPosition.FRONT : index_1.CameraPosition.BACK; try { - yield this._tuiCallEngine.switchCamera(); + yield this._tuiCallEngine.switchCamera(targetPosition); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.CAMERA_POSITION, targetPosition); } catch (error) { console.error(`${index_1.NAME.PREFIX}_switchCamera failed, error: ${error}.`); @@ -541,16 +558,19 @@ class TUICallService { const [userInfo] = remoteUserInfoList.filter((userInfo) => userInfo.userId === sponsor); remoteUserInfoList.length > 0 && TUIStore.updateStore({ [index_1.NAME.REMOTE_USER_INFO_LIST]: remoteUserInfoList, + [index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: remoteUserInfoList, [index_1.NAME.CALLER_USER_INFO]: { userId: sponsor, nick: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.nick) || '', avatar: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) || '', + displayUserInfo: (userInfo === null || userInfo === void 0 ? void 0 : userInfo.remark) || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.nick) || sponsor, }, }, index_1.StoreName.CALL); }); } _handleUserAccept(event) { this._callerChangeToConnected(); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.TOAST_INFO, (0, index_2.t)('answered')); console.log(`${index_1.NAME.PREFIX}accept event data: ${JSON.stringify(event)}.`); } _handleUserEnter(event) { @@ -562,7 +582,10 @@ class TUICallService { const isInRemoteUserList = remoteUserInfoList.find(item => (item === null || item === void 0 ? void 0 : item.userId) === userId); if (!isInRemoteUserList) { remoteUserInfoList.push({ userId }); - remoteUserInfoList.length > 0 && TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + if (remoteUserInfoList.length > 0) { + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); + } const [userInfo] = yield (0, utils_1.getRemoteUserProfile)([userId], this.getTim(), TUIStore); remoteUserInfoList = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST); remoteUserInfoList.forEach((obj) => { @@ -576,7 +599,10 @@ class TUICallService { obj.isEnter = true; return obj; }); - remoteUserInfoList.length > 0 && TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + if (remoteUserInfoList.length > 0) { + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); + } console.log(`${index_1.NAME.PREFIX}userEnter event data: ${JSON.stringify(event)}.`); }); } @@ -660,8 +686,10 @@ class TUICallService { _handleSDKReady(event) { return __awaiter(this, void 0, void 0, function* () { let localUserInfo = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); - localUserInfo = yield (0, utils_1.getMyProfile)(localUserInfo.userId, this.getTim(), TUIStore); // 方法里已经 try...catch 了 + localUserInfo = yield (0, utils_1.getMyProfile)(localUserInfo.userId, this.getTim(), TUIStore); + this._defaultOfflinePushInfo.title = localUserInfo === null || localUserInfo === void 0 ? void 0 : localUserInfo.displayUserInfo; TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, localUserInfo); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, localUserInfo); }); } _handleKickedOut(event) { @@ -757,15 +785,18 @@ class TUICallService { localUserInfo = Object.assign(Object.assign({}, localUserInfo), { isVideoAvailable: isAvailable }); } TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, localUserInfo); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, localUserInfo); } _updateCallStoreBeforeCall(type, remoteUserInfoList, groupID) { return __awaiter(this, void 0, void 0, function* () { + const callTips = groupID || TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.IS_MINIMIZED) ? index_2.CallTips.CALLER_GROUP_CALLING_MSG : index_2.CallTips.CALLER_CALLING_MSG; let updateStoreParams = { [index_1.NAME.CALL_MEDIA_TYPE]: type, [index_1.NAME.CALL_ROLE]: index_1.CallRole.CALLER, [index_1.NAME.REMOTE_USER_INFO_LIST]: remoteUserInfoList, + [index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: remoteUserInfoList, [index_1.NAME.IS_GROUP]: !!groupID, - [index_1.NAME.CALL_TIPS]: (0, index_2.t)(index_2.CallTips.CALLER_CALLING_MSG), + [index_1.NAME.CALL_TIPS]: (0, index_2.t)(callTips), [index_1.NAME.GROUP_ID]: groupID }; const pusher = { enableCamera: type === index_1.CallMediaType.VIDEO, enableMic: true }; // mini 默认打开麦克风 @@ -775,7 +806,10 @@ class TUICallService { console.log(`${index_1.NAME.PREFIX}mini beforeCall return callStatus: ${callStatus}.`); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.CALL_STATUS, callStatus); const remoteUserInfoLists = yield (0, utils_1.getRemoteUserProfile)(remoteUserInfoList.map(obj => obj.userId), this.getTim(), TUIStore); - remoteUserInfoLists.length > 0 && TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoLists); + if (remoteUserInfoLists.length > 0) { + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoLists); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoLists); + } }); } _updateCallStoreAfterCall(userIdList, response) { @@ -792,6 +826,7 @@ class TUICallService { TUIStore.update(index_1.StoreName.CALL, index_1.NAME.CALL_STATUS, index_1.CallStatus.CALLING); // 小程序未授权时, 此时状态为 idle; web 直接设置为 calling const localUserInfo = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, Object.assign(Object.assign({}, localUserInfo), { isEnter: true })); this._setLocalUserInfoAudioVideoAvailable(true, index_1.NAME.AUDIO); // web && mini, default open audio } else { @@ -800,9 +835,13 @@ class TUICallService { }); } _resetCurrentDevice() { - // 挂断后,重置当前摄像头和麦克风为默认设备 - const { cameraList, microphoneList } = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.DEVICE_LIST); - TUIStore.update(index_1.StoreName.CALL, index_1.NAME.DEVICE_LIST, { microphoneList, cameraList, currentCamera: (cameraList === null || cameraList === void 0 ? void 0 : cameraList[0]) || {}, currentMicrophone: (microphoneList === null || microphoneList === void 0 ? void 0 : microphoneList[0]) || {} }); + // 挂断后,重置当前摄像头,麦克风和扬声器为默认设备 + const { cameraList, microphoneList, speakerList } = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.DEVICE_LIST); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.DEVICE_LIST, { microphoneList, cameraList, speakerList, + currentCamera: (cameraList === null || cameraList === void 0 ? void 0 : cameraList[0]) || {}, + currentMicrophone: (microphoneList === null || microphoneList === void 0 ? void 0 : microphoneList[0]) || {}, + currentSpeaker: (speakerList === null || speakerList === void 0 ? void 0 : speakerList[0]) || {} + }); } _resetCallStore() { const oldStatusStr = (0, utils_1.generateStatusChangeText)(TUIStore); @@ -820,7 +859,8 @@ class TUICallService { case index_1.NAME.DISPLAY_MODE: case index_1.NAME.VIDEO_RESOLUTION: case index_1.NAME.ENABLE_FLOAT_WINDOW: - case index_1.NAME.LOCAL_USER_INFO: { + case index_1.NAME.LOCAL_USER_INFO: + case index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN: { return false; } default: { @@ -835,6 +875,9 @@ class TUICallService { TUIStore.reset(index_1.StoreName.CALL, [index_1.NAME.IS_MINIMIZED], true); // isMinimized reset need notify TUIStore.reset(index_1.StoreName.CALL, [index_1.NAME.IS_EAR_PHONE], true); // isEarPhone reset need notify TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO, Object.assign(Object.assign({}, TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO)), { isVideoAvailable: false, isAudioAvailable: false })); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, Object.assign(Object.assign({}, TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN)), { isVideoAvailable: false, isAudioAvailable: false })); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, []); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, []); this._resetCurrentDevice(); const newStatusStr = (0, utils_1.generateStatusChangeText)(TUIStore); if (oldStatusStr !== newStatusStr) { @@ -857,13 +900,13 @@ class TUICallService { // 通话时长更新 _startTimer() { if (this._timerId === -1) { + this._startTimeStamp = (0, common_utils_1.performanceNow)(); this._timerId = timer_1.default.run(index_1.NAME.TIMEOUT, this._updateCallDuration.bind(this), { delay: 1000 }); } } _updateCallDuration() { - let callDurationStr = TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.CALL_DURATION); - const callDurationNum = (0, common_utils_1.formatTimeInverse)(callDurationStr); - callDurationStr = (0, common_utils_1.formatTime)(callDurationNum + 1); + const callDurationNum = Math.round(((0, common_utils_1.performanceNow)() - this._startTimeStamp) / 1000); // miniProgram stop timer when background + const callDurationStr = (0, common_utils_1.formatTime)(callDurationNum); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.CALL_DURATION, callDurationStr); } _stopTimer() { @@ -880,6 +923,7 @@ class TUICallService { remoteUserInfoList = remoteUserInfoList.filter((obj) => obj.userId !== userId); }); TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(index_1.StoreName.CALL, index_1.NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); } _analyzeEventData(event) { return (event === null || event === void 0 ? void 0 : event.data) || {}; // mini INVITED diff --git a/TUICallKit/TUICallService/CallService/index.ts b/TUICallKit/TUICallService/CallService/index.ts new file mode 100644 index 0000000..cbaa8cd --- /dev/null +++ b/TUICallKit/TUICallService/CallService/index.ts @@ -0,0 +1,991 @@ +import { TUICore, TUILogin, TUIConstants, ExtensionInfo } from '@tencentcloud/tui-core'; +import { + ITUICallService, + ICallParams, + IGroupCallParams, + IUserInfo, + ICallbackParam, + ISelfInfoParams, + IBellParams, + IInviteUserParams, + IJoinInGroupCallParams, + IInitParams, +} from '../interface/ICallService'; +import { + StoreName, + CallStatus, + CallMediaType, + NAME, + CALL_DATA_KEY, + LanguageType, + CallRole, + LOG_LEVEL, + VideoDisplayMode, + VideoResolution, + StatusChange, + AudioCallIcon, + VideoCallIcon, + ErrorCode, + ErrorMessage, + AudioPlayBackDevice, + CameraPosition, +} from '../const/index'; +// @ts-ignore +import { TUICallEngine, EVENT as TUICallEvent } from 'tuicall-engine-wx'; +import { CallTips, t } from '../locales/index'; +import { initAndCheckRunEnv, beforeCall, handlePackageError } from './miniProgram'; +import { BellContext } from './bellContext'; +import { VALIDATE_PARAMS, avoidRepeatedCall, paramValidate } from '../utils/validate/index'; +import { handleRepeatedCallError, handleNoDevicePermissionError, formatTime, performanceNow } from '../utils/common-utils'; +import { getMyProfile, getRemoteUserProfile, generateText, generateStatusChangeText, getGroupMemberList, getGroupProfile } from './utils'; +import timer from '../utils/timer'; +import { ITUIGlobal } from '../interface/ITUIGlobal'; +import { ITUIStore } from '../interface/ITUIStore'; +import TuiGlobal from '../TUIGlobal/tuiGlobal'; +import TuiStore from '../TUIStore/tuiStore'; +const TUIGlobal: ITUIGlobal = TuiGlobal.getInstance(); +const TUIStore: ITUIStore = TuiStore.getInstance(); +const version = '2.1.1'; +export { TUIGlobal, TUIStore }; + +export default class TUICallService implements ITUICallService { + static instance: TUICallService; + public _tuiCallEngine: any; + private _tim: any = null; + private _TUICore: any = null; + private _timerId: number = -1; + private _startTimeStamp: number = performanceNow(); + private _bellContext: any = null; + private _defaultOfflinePushInfo = { + title: '', + description: t('you have a new call'), + }; + constructor() { + console.log(`${NAME.PREFIX}version: ${version}`); + this._watchTUIStore(); + this._bellContext = new BellContext(); + // 下面:TUICore注册事件,注册组件服务,注册界面拓展 + TUICore.registerEvent(TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED, TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS, this); + TUICore.registerService(TUIConstants.TUICalling.SERVICE.NAME, this); + TUICore.registerExtension(TUIConstants.TUIChat.EXTENSION.INPUT_MORE.EXT_ID, this); + } + static getInstance() { + if (!TUICallService.instance) { + TUICallService.instance = new TUICallService(); + } + return TUICallService.instance; + } + @avoidRepeatedCall() + @paramValidate(VALIDATE_PARAMS.init) + public async init(params: IInitParams) { + try { + if (this._tuiCallEngine) return; + // @ts-ignore + let { userID, tim, userSig, sdkAppID, SDKAppID, isFromChat } = params; + if (this._TUICore) { + sdkAppID = this._TUICore.SDKAppID; + tim = this._TUICore.tim; + } + this._tim = tim; + console.log(`${NAME.PREFIX}init sdkAppId: ${sdkAppID || SDKAppID}, userId: ${userID}`); + this._tuiCallEngine = TUICallEngine.createInstance({ + tim, + // @ts-ignore + sdkAppID: sdkAppID || SDKAppID, // 兼容传入 SDKAppID 的问题 + callkitVersion: version, + chat: isFromChat || false, + }); + this._addListenTuiCallEngineEvent(); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, { userId: userID }); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { userId: userID }); + await this._tuiCallEngine.login({ userID, userSig, assetsPath: '' }); // web && mini + } catch (error) { + console.error(`${NAME.PREFIX}init failed, error: ${error}.`); + throw error; + } + } + // component destroy + public async destroyed() { + try { + const currentCallStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); + if (currentCallStatus !== CallStatus.IDLE) { + throw new Error(`please destroyed when status is idle, current status: ${currentCallStatus}`); + } + if (this._tuiCallEngine) { + this._removeListenTuiCallEngineEvent(); + await this._tuiCallEngine.destroyInstance(); + this._tuiCallEngine = null; + } + } catch (error) { + console.error(`${NAME.PREFIX}destroyed failed, error: ${error}.`); + throw error; + } + } + // ===============================【通话操作】=============================== + @avoidRepeatedCall() + @paramValidate(VALIDATE_PARAMS.call) + public async call(callParams: ICallParams) { + try { + const { type, userID, offlinePushInfo } = callParams; + if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) return; + await this._updateCallStoreBeforeCall(type, [{ userId: userID }]); + this._executeExternalBeforeCalling(); // 执行外部传入的 beforeCall 方法 + callParams.offlinePushInfo = { ...this._defaultOfflinePushInfo, ...offlinePushInfo }; + const response = await this._tuiCallEngine.call(callParams); + await this._updateCallStoreAfterCall([userID], response); + } catch (error: any) { + this._handleCallError(error, 'call'); + } + }; + @avoidRepeatedCall() + @paramValidate(VALIDATE_PARAMS.groupCall) + public async groupCall(groupCallParams: IGroupCallParams) { + try { + const { userIDList, type, groupID, offlinePushInfo } = groupCallParams; + if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) return; + const remoteUserInfoList = userIDList.map(userId => ({ userId })); + await this._updateCallStoreBeforeCall(type, remoteUserInfoList, groupID); + this._executeExternalBeforeCalling(); + groupCallParams.offlinePushInfo = { ...this._defaultOfflinePushInfo, ...offlinePushInfo }; + const response = await this._tuiCallEngine.groupCall(groupCallParams); + await this._updateCallStoreAfterCall(userIDList, response); + } catch (error: any) { + this._handleCallError(error, 'groupCall'); + } + } + @avoidRepeatedCall() + @paramValidate(VALIDATE_PARAMS.inviteUser) + public async inviteUser(params: IInviteUserParams) { + try { + const { userIDList } = params; + let inviteUserInfoList = await getRemoteUserProfile(userIDList, this.getTim(), TUIStore); + const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, [...remoteUserInfoList, ...inviteUserInfoList]); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, [...remoteUserInfoList, ...inviteUserInfoList]); + this._tuiCallEngine && await this._tuiCallEngine.inviteUser(params); + } catch (error: any) { + console.error(`${NAME.PREFIX}inviteUser failed, error: ${error}.`); + this._resetCallStore(); + throw error; + } + } + @avoidRepeatedCall() + @paramValidate(VALIDATE_PARAMS.joinInGroupCall) + public async joinInGroupCall(params: IJoinInGroupCallParams) { + try { + const updateStoreParams = { + [NAME.CALL_ROLE]: CallRole.CALLEE, + [NAME.IS_GROUP]: true, + [NAME.CALL_STATUS]: CallStatus.CONNECTED, + [NAME.CALL_MEDIA_TYPE]: params.type, + [NAME.GROUP_ID]: params.groupID, + [NAME.ROOM_ID]: params.roomID, + }; + TUIStore.updateStore(updateStoreParams, StoreName.CALL); + const response = await this._tuiCallEngine.joinInGroupCall(params); + (params.type === CallMediaType.VIDEO) && await this.openCamera(NAME.LOCAL_VIDEO); + TUIStore.update(StoreName.CALL, NAME.IS_CLICKABLE, true); + this._startTimer(); + TUIStore.update(StoreName.CALL, NAME.PUSHER, response); + this.setSoundMode(params.type === CallMediaType.AUDIO ? AudioPlayBackDevice.EAR : AudioPlayBackDevice.SPEAKER); + const localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, { ...localUserInfo, isEnter: true }); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...localUserInfo, isEnter: true }); + this._setLocalUserInfoAudioVideoAvailable(true, NAME.AUDIO); + } catch (error) { + console.error(`${NAME.PREFIX}joinInGroupCall failed, error: ${error}.`); + this._resetCallStore(); + throw error; + } + } + // ===============================【其它对外接口】=============================== + public getTUICallEngineInstance(): any { + return this?._tuiCallEngine || null; + } + public setLogLevel(level: LOG_LEVEL) { + this?._tuiCallEngine?.setLogLevel(level); + } + @paramValidate(VALIDATE_PARAMS.setLanguage) + public setLanguage(language: LanguageType) { + if (language && Object.values(LanguageType).includes(language)) { + TUIStore.update(StoreName.CALL, NAME.LANGUAGE, language); + } + } + @paramValidate(VALIDATE_PARAMS.enableFloatWindow) + public enableFloatWindow(enable: boolean) { + TUIStore.update(StoreName.CALL, NAME.ENABLE_FLOAT_WINDOW, enable); + } + @paramValidate(VALIDATE_PARAMS.setSelfInfo) + public async setSelfInfo(params: ISelfInfoParams) { + const { nickName, avatar } = params; + try { + await this._tuiCallEngine.setSelfInfo(nickName, avatar); + } catch (error) { + console.error(`${NAME.PREFIX}setSelfInfo failed, error: ${error}.`); + } + } + // 修改默认铃声:只支持本地铃声文件,不支持在线铃声文件;修改铃声修改的是被叫的铃声 + @paramValidate(VALIDATE_PARAMS.setCallingBell) + public async setCallingBell(filePath?: string) { + let isCheckFileExist: boolean = true; + if (!isCheckFileExist) { + console.warn(`${NAME.PREFIX}setCallingBell failed, filePath: ${filePath}.`); + return ; + } + const bellParams: IBellParams = { calleeBellFilePath: filePath }; + this._bellContext.setBellProperties(bellParams); + } + @paramValidate(VALIDATE_PARAMS.enableMuteMode) + public async enableMuteMode(enable: boolean) { + try { + const bellParams: IBellParams = { isMuteBell: enable }; + this._bellContext.setBellProperties(bellParams); + await this._bellContext.setBellMute(enable); + } catch (error) { + console.warn(`${NAME.PREFIX}enableMuteMode failed, error: ${error}.`); + } + } + // =============================【内部按钮操作方法】============================= + @avoidRepeatedCall() + public async accept() { + try { + const response = await this._tuiCallEngine.accept(); + if (response) { + // 小程序接通时会进行授权弹框, 状态需要放在 accept 后, 否则先接通后再拉起权限设置 + TUIStore.update(StoreName.CALL, NAME.CALL_STATUS, CallStatus.CONNECTED); + this._callTUIService({ message: response?.data?.message }); + TUIStore.update(StoreName.CALL, NAME.IS_CLICKABLE, true); + this._startTimer(); + const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); + (callMediaType === CallMediaType.VIDEO) && await this.openCamera(NAME.LOCAL_VIDEO); + response.pusher && TUIStore.update(StoreName.CALL, NAME.PUSHER, response.pusher); + this.setSoundMode(callMediaType === CallMediaType.AUDIO ? AudioPlayBackDevice.EAR : AudioPlayBackDevice.SPEAKER); + const localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, { ...localUserInfo, isEnter: true }); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...localUserInfo, isEnter: true }); + this._setLocalUserInfoAudioVideoAvailable(true, NAME.AUDIO); // web && mini default open audio + } + } catch (error) { + if (handleRepeatedCallError(error)) return; + this._noDevicePermissionToast(error, CallMediaType.AUDIO); + this._resetCallStore(); + } + } + @avoidRepeatedCall() + public async hangup() { + try { + const response = await this._tuiCallEngine.hangup(); + response?.forEach((item) => { + if (item?.code === 0) { + this._callTUIService({ message: item?.data?.message }); + } + }); + } catch (error) { + console.debug(error); + } + this._resetCallStore(); + } + @avoidRepeatedCall() + public async reject() { + try { + const response = await this._tuiCallEngine.reject(); + if (response?.code === 0) { + this._callTUIService({ message: response?.data?.message }); + } + } catch (error) { + console.debug(error); + } + this._resetCallStore(); + } + @avoidRepeatedCall() + public async openCamera(videoViewDomID: string) { + try { + await this._tuiCallEngine.openCamera(); + this._setLocalUserInfoAudioVideoAvailable(true, NAME.VIDEO); + } catch (error: any) { + this._noDevicePermissionToast(error, CallMediaType.VIDEO); + console.error(`${NAME.PREFIX}openCamera error: ${error}.`); + } + } + @avoidRepeatedCall() + public async closeCamera() { + try { + await this._tuiCallEngine.closeCamera(); + this._setLocalUserInfoAudioVideoAvailable(false, NAME.VIDEO); + } catch (error: any) { + console.error(`${NAME.PREFIX}closeCamera error: ${error}.`); + } + } + @avoidRepeatedCall() + public async openMicrophone() { + try { + await this._tuiCallEngine.openMicrophone(); + this._setLocalUserInfoAudioVideoAvailable(true, NAME.AUDIO); + } catch (error: any) { + console.error(`${NAME.PREFIX}openMicrophone failed, error: ${error}.`); + } + } + @avoidRepeatedCall() + public async closeMicrophone() { + try { + await this._tuiCallEngine.closeMicrophone(); + this._setLocalUserInfoAudioVideoAvailable(false, NAME.AUDIO); + } catch (error: any) { + console.error(`${NAME.PREFIX}closeMicrophone failed, error: ${error}.`); + } + } + @avoidRepeatedCall() + public switchScreen(userId: string) { + if(!userId) return; + TUIStore.update(StoreName.CALL, NAME.BIG_SCREEN_USER_ID, userId); + } + // support video to audio; not support audio to video + @avoidRepeatedCall() + public async switchCallMediaType() { + try { + const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); + if (callMediaType === CallMediaType.AUDIO) { + console.warn(`${NAME.PREFIX}switchCallMediaType failed, ${callMediaType} not support.`); + return; + } + const response = await this._tuiCallEngine.switchCallMediaType(CallMediaType.AUDIO); + if (response?.code === 0) { + this._callTUIService({ message: response?.data?.message }); + } + TUIStore.update(StoreName.CALL, NAME.CALL_MEDIA_TYPE, CallMediaType.AUDIO); + const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); + const oldStatus = isGroup ? StatusChange.CALLING_GROUP_VIDEO : StatusChange.CALLING_C2C_VIDEO; + const newStatus = generateStatusChangeText(TUIStore); + this.statusChanged && this.statusChanged({ oldStatus, newStatus }); + this.setSoundMode(AudioPlayBackDevice.EAR); + } catch (error: any) { + console.error(`${NAME.PREFIX}switchCallMediaType failed, error: ${error}.`); + } + } + @avoidRepeatedCall() + public async switchCamera() { + const currentPosition = TUIStore.getData(StoreName.CALL, NAME.CAMERA_POSITION); + const targetPosition = currentPosition === CameraPosition.BACK ? CameraPosition.FRONT : CameraPosition.BACK; + try { + await this._tuiCallEngine.switchCamera(targetPosition); + TUIStore.update(StoreName.CALL, NAME.CAMERA_POSITION, targetPosition); + } catch (error) { + console.error(`${NAME.PREFIX}_switchCamera failed, error: ${error}.`); + } + } + @avoidRepeatedCall() + public setSoundMode(type?: string): void { + try { + let isEarPhone = TUIStore.getData(StoreName.CALL, NAME.IS_EAR_PHONE); + const soundMode = type || (isEarPhone ? AudioPlayBackDevice.SPEAKER : AudioPlayBackDevice.EAR); // UI 层切换时传参数 + this._tuiCallEngine?.selectAudioPlaybackDevice(soundMode); + if (type) { + isEarPhone = type === AudioPlayBackDevice.EAR; + } else { + isEarPhone = !isEarPhone; + } + TUIStore.update(StoreName.CALL, NAME.IS_EAR_PHONE, isEarPhone); + } catch (error) { + console.error(`${NAME.PREFIX}setSoundMode failed, error: ${error}.`); + } + } + // 切前后置 miniProgram, 切扬声器 + public getTim() { + if (this._tim) return this._tim; + if (!this._tuiCallEngine) { + console.warn(`${NAME.PREFIX}getTim warning: _tuiCallEngine Instance is not available.`); + return null; + } + return this._tuiCallEngine?.tim || this._tuiCallEngine?.getTim(); // mini support getTim interface + } + // ==========================【TUICallEngine 事件处理】========================== + private _addListenTuiCallEngineEvent() { + if (!this._tuiCallEngine) { + console.warn(`${NAME.PREFIX}add engine event listener failed, engine is empty.`); + return; + } + this._tuiCallEngine.on(TUICallEvent.ERROR, this._handleError, this); + this._tuiCallEngine.on(TUICallEvent.INVITED, this._handleNewInvitationReceived, this); // 收到邀请事件 + this._tuiCallEngine.on(TUICallEvent.USER_ACCEPT, this._handleUserAccept, this); // 主叫收到被叫接通事件 + this._tuiCallEngine.on(TUICallEvent.USER_ENTER, this._handleUserEnter, this); // 有用户进房事件 + this._tuiCallEngine.on(TUICallEvent.USER_LEAVE, this._handleUserLeave, this); // 有用户离开通话事件 + this._tuiCallEngine.on(TUICallEvent.REJECT, this._handleInviteeReject, this); // 主叫收到被叫的拒绝通话事件 + this._tuiCallEngine.on(TUICallEvent.NO_RESP, this._handleNoResponse, this); // 主叫收到被叫的无应答事件 + this._tuiCallEngine.on(TUICallEvent.LINE_BUSY, this._handleLineBusy, this); // 主叫收到被叫的忙线事件 + this._tuiCallEngine.on(TUICallEvent.CALLING_CANCEL, this._handleCallingCancel, this); // 主被叫在通话未建立时, 收到的取消事件 + this._tuiCallEngine.on(TUICallEvent.SDK_READY, this._handleSDKReady, this); // SDK Ready 回调 + this._tuiCallEngine.on(TUICallEvent.KICKED_OUT, this._handleKickedOut, this); // 未开启多端登录时, 多端登录收到的被踢事件 + this._tuiCallEngine.on(TUICallEvent.MESSAGE_SENT_BY_ME, this._messageSentByMe, this); + this._tuiCallEngine.on(TUICallEvent.CALL_END, this._handleCallingEnd, this); // 主被叫在通话结束时, 收到的通话结束事件 + // @ts-ignore + this._tuiCallEngine.on(TUICallEvent.CALL_MODE, this._handleCallTypeChange, this); + // @ts-ignore + this._tuiCallEngine.on(TUICallEvent.USER_UPDATE, this._handleUserUpdate, this); // mini: user data update + } + private _removeListenTuiCallEngineEvent() { + this._tuiCallEngine.off(TUICallEvent.ERROR, this._handleError); + this._tuiCallEngine.off(TUICallEvent.INVITED, this._handleNewInvitationReceived); + this._tuiCallEngine.off(TUICallEvent.USER_ACCEPT, this._handleUserAccept); + this._tuiCallEngine.off(TUICallEvent.USER_ENTER, this._handleUserEnter); + this._tuiCallEngine.off(TUICallEvent.USER_LEAVE, this._handleUserLeave); + this._tuiCallEngine.off(TUICallEvent.REJECT, this._handleInviteeReject); + this._tuiCallEngine.off(TUICallEvent.NO_RESP, this._handleNoResponse); + this._tuiCallEngine.off(TUICallEvent.LINE_BUSY, this._handleLineBusy); + this._tuiCallEngine.off(TUICallEvent.CALLING_CANCEL, this._handleCallingCancel); + this._tuiCallEngine.off(TUICallEvent.SDK_READY, this._handleSDKReady); + this._tuiCallEngine.off(TUICallEvent.KICKED_OUT, this._handleKickedOut); + this._tuiCallEngine.off(TUICallEvent.MESSAGE_SENT_BY_ME, this._messageSentByMe); + this._tuiCallEngine.off(TUICallEvent.CALL_END, this._handleCallingEnd); + // @ts-ignore + this._tuiCallEngine.off(TUICallEvent.CALL_MODE, this._handleCallTypeChange); // 切换通话事件 miniProgram CALL_MODE + // @ts-ignore + this._tuiCallEngine.off(TUICallEvent.USER_UPDATE, this._handleUserUpdate); // mini: user data update + } + private _handleError(event: any): void { + const { code, message } = event || {}; + const index = Object.values(ErrorCode).indexOf(code); + let callTips = ''; + if (index !== -1) { + const key = Object.keys(ErrorCode)[index]; + callTips = t(ErrorMessage[key]); + callTips && TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text: callTips, type: NAME.ERROR }); + } + this._executeExternalAfterCalling(); + console.error(`${NAME.PREFIX}_handleError, errorCode: ${code}; errorMessage: ${callTips || message}.`); + } + private async _handleNewInvitationReceived(event: any) { + console.log(`${NAME.PREFIX}onCallReceived event data: ${JSON.stringify(event)}.`); + const { sponsor = '', isFromGroup, callMediaType, inviteData = {}, calleeIdList = [], groupID = '' } = this._analyzeEventData(event); + const currentUserInfo: IUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + const remoteUserIdList: string[] = [sponsor, ...calleeIdList.filter((userId: string) => userId !== currentUserInfo.userId)]; + const type = callMediaType || inviteData.callType; + const callTipsKey = type === CallMediaType.AUDIO ? CallTips.CALLEE_CALLING_AUDIO_MSG : CallTips.CALLEE_CALLING_VIDEO_MSG; + let updateStoreParams = { + [NAME.CALL_ROLE]: CallRole.CALLEE, + [NAME.IS_GROUP]: isFromGroup, + [NAME.CALL_STATUS]: CallStatus.CALLING, + [NAME.CALL_MEDIA_TYPE]: type, + [NAME.CALL_TIPS]: t(callTipsKey), + [NAME.CALLER_USER_INFO]: { userId: sponsor }, + [NAME.GROUP_ID]: groupID, + }; + initAndCheckRunEnv(); + const pusher = { enableCamera: type === CallMediaType.VIDEO, enableMic: true }; // mini 默认打开麦克风 + updateStoreParams = { ...updateStoreParams, [NAME.PUSHER]: pusher }; + TUIStore.updateStore(updateStoreParams, StoreName.CALL); + this._executeExternalBeforeCalling(); + this.statusChanged && this.statusChanged({ oldStatus: StatusChange.IDLE, newStatus: StatusChange.BE_INVITED }); + + const remoteUserInfoList = await getRemoteUserProfile(remoteUserIdList, this.getTim(), TUIStore); + const [userInfo] = remoteUserInfoList.filter((userInfo: IUserInfo) => userInfo.userId === sponsor); + remoteUserInfoList.length > 0 && TUIStore.updateStore({ + [NAME.REMOTE_USER_INFO_LIST]: remoteUserInfoList, + [NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: remoteUserInfoList, + [NAME.CALLER_USER_INFO]: { + userId: sponsor, + nick: userInfo?.nick || '', + avatar: userInfo?.avatar || '', + displayUserInfo: userInfo?.remark || userInfo?.nick || sponsor, + }, + }, StoreName.CALL); + } + private _handleUserAccept(event: any): void { + this._callerChangeToConnected(); + TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, t('answered')); + console.log(`${NAME.PREFIX}accept event data: ${JSON.stringify(event)}.`); + } + private async _handleUserEnter(event: any): Promise { + this._callerChangeToConnected(); + const { userID: userId, data } = this._analyzeEventData(event); + data?.playerList && TUIStore.update(StoreName.CALL, NAME.PLAYER, data.playerList); + let remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + const isInRemoteUserList = remoteUserInfoList.find(item => item?.userId === userId); + if (!isInRemoteUserList) { + remoteUserInfoList.push({ userId }); + + if (remoteUserInfoList.length > 0) { + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); + } + const [userInfo] = await getRemoteUserProfile([userId], this.getTim(), TUIStore); + remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + remoteUserInfoList.forEach((obj) => { + if (obj?.userId === userId) { + obj = Object.assign(obj, userInfo); + } + }); + } + remoteUserInfoList = remoteUserInfoList.map((obj: IUserInfo) => { + if (obj.userId === userId) obj.isEnter = true; + return obj; + }); + + if (remoteUserInfoList.length > 0) { + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); + } + console.log(`${NAME.PREFIX}userEnter event data: ${JSON.stringify(event)}.`); + } + private _callerChangeToConnected() { + const callRole = TUIStore.getData(StoreName.CALL, NAME.CALL_ROLE); + const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); + if (callStatus === CallStatus.CALLING && callRole === CallRole.CALLER) { + TUIStore.update(StoreName.CALL, NAME.CALL_STATUS, CallStatus.CONNECTED); + this._startTimer(); + } + } + private _handleUserLeave(event: any): void { + console.log(`${NAME.PREFIX}userLeave event data: ${JSON.stringify(event)}.`); + const { data, userID: userId } = this._analyzeEventData(event); + data?.playerList && TUIStore.update(StoreName.CALL, NAME.PLAYER, data.playerList); + if (TUIStore.getData(StoreName.CALL, NAME.IS_GROUP)) { + const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + const prefix: string = (remoteUserInfoList.find(obj => obj.userId === userId) || {}).displayUserInfo || userId; + const text = generateText(TUIStore, CallTips.END_CALL, prefix); + TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); + } + userId && this._deleteRemoteUser([userId]); + } + private _unNormalEventsManager(event: any, eventName: TUICallEvent): void { + console.log(`${NAME.PREFIX}${eventName} event data: ${JSON.stringify(event)}.`); + const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); + const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + switch (eventName) { + case TUICallEvent.REJECT: + case TUICallEvent.LINE_BUSY: { + const { userID: userId } = this._analyzeEventData(event); + let callTipsKey = eventName === TUICallEvent.REJECT ? CallTips.OTHER_SIDE_REJECT_CALL : CallTips.OTHER_SIDE_LINE_BUSY; + let text = generateText(TUIStore, callTipsKey); + if (isGroup) { + const prefix: string = (remoteUserInfoList.find(obj => obj.userId === userId) || {}).displayUserInfo || userId; + callTipsKey = eventName === TUICallEvent.REJECT ? CallTips.REJECT_CALL : CallTips.IN_BUSY; + text = generateText(TUIStore, callTipsKey, prefix); + } + TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); + userId && this._deleteRemoteUser([userId]); + break; + } + case TUICallEvent.NO_RESP: { + const { userIDList = [] } = this._analyzeEventData(event); + const callTipsKey = isGroup ? CallTips.TIMEOUT : CallTips.CALL_TIMEOUT; + const userInfoList: string[] = userIDList.map(userId => { + const userInfo: IUserInfo = remoteUserInfoList.find(obj => obj.userId === userId) || {}; + return userInfo.displayUserInfo || userId; + }); + const text = isGroup ? generateText(TUIStore, callTipsKey, userInfoList.join()) : generateText(TUIStore, callTipsKey); + TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text }); + userIDList.length > 0 && this._deleteRemoteUser(userIDList); + break; + } + case TUICallEvent.CALLING_CANCEL: { + // TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text: generateText(TUIStore, CallTips.CANCEL) }); + this._resetCallStore(); + break; + } + } + } + private _handleInviteeReject(event: any): void { + this._unNormalEventsManager(event, TUICallEvent.REJECT); + } + private _handleNoResponse(event: any): void { + this._unNormalEventsManager(event, TUICallEvent.NO_RESP); + } + private _handleLineBusy(event: any): void { + this._unNormalEventsManager(event, TUICallEvent.LINE_BUSY); + } + private _handleCallingCancel(event: any): void { + this._executeExternalAfterCalling(); + this._unNormalEventsManager(event, TUICallEvent.CALLING_CANCEL); + } + private _handleCallingEnd(event: any): void { + console.log(`${NAME.PREFIX}callEnd event data: ${JSON.stringify(event)}.`); + this._executeExternalAfterCalling(); + this._resetCallStore(); + } + // SDK_READY 后才能调用 tim 接口, 否则登录后立刻获取导致调用接口失败. v2.27.4+、v3 接口 login 后会抛出 SDK_READY + private async _handleSDKReady(event: any): Promise { + let localUserInfo: IUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + localUserInfo = await getMyProfile(localUserInfo.userId, this.getTim(), TUIStore); + this._defaultOfflinePushInfo.title = localUserInfo?.displayUserInfo; + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, localUserInfo); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, localUserInfo); + } + private _handleKickedOut(event: any): void { + console.log(`${NAME.PREFIX}kickOut event data: ${JSON.stringify(event)}.`); + this.kickedOut && this.kickedOut(event); + TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, generateText(TUIStore, CallTips.KICK_OUT)); + this._resetCallStore(); + } + private _handleCallTypeChange(event: any): void { + const { newCallType, type } = this._analyzeEventData(event); + TUIStore.update(StoreName.CALL, NAME.CALL_MEDIA_TYPE, newCallType || type); + this.setSoundMode(AudioPlayBackDevice.EAR); + } + private _messageSentByMe(event: any): void { + const message = event?.data; + this.onMessageSentByMe && this.onMessageSentByMe(message); + } + // ==========================【 miniProgram 私有事件】========================== + private _handleUserUpdate(event: any): void { + const data = this._analyzeEventData(event); + data?.pusher && TUIStore.update(StoreName.CALL, NAME.PUSHER, data.pusher); + data?.playerList && TUIStore.update(StoreName.CALL, NAME.PLAYER, data.playerList); + } + // 处理 “呼叫” 抛出的异常 + private _handleCallError(error: any, methodName?: string) { + if (handleRepeatedCallError(error)) return; + handlePackageError(error); // 无套餐提示, 小程序 engine 不抛出 onError + this._noDevicePermissionToast(error, CallMediaType.AUDIO); + console.error(`${NAME.PREFIX}${methodName} failed, error: ${error}.`); + this._resetCallStore(); + throw error; + } + // ========================【原 Web CallKit 提供的方法】======================== + public beforeCalling: ((...args: any[]) => void) | undefined; // 原来 + public afterCalling: ((...args: any[]) => void) | undefined; + public onMinimized: ((...args: any[]) => void) | undefined; + public onMessageSentByMe: ((...args: any[]) => void) | undefined; + public kickedOut: ((...args: any[]) => void) | undefined; + public statusChanged: ((...args: any[]) => void) | undefined; + public setCallback(params: ICallbackParam) { + const { beforeCalling, afterCalling, onMinimized, onMessageSentByMe, kickedOut, statusChanged } = params; + beforeCalling && (this.beforeCalling = beforeCalling); + afterCalling && (this.afterCalling = afterCalling); + onMinimized && (this.onMinimized = onMinimized); + onMessageSentByMe && (this.onMessageSentByMe = onMessageSentByMe); + kickedOut && (this.kickedOut = kickedOut); + statusChanged && (this.statusChanged = statusChanged); + } + + public toggleMinimize() { + const isMinimized = TUIStore.getData(StoreName.CALL, NAME.IS_MINIMIZED); + TUIStore.update(StoreName.CALL, NAME.IS_MINIMIZED, !isMinimized); + console.log(`${NAME.PREFIX}toggleMinimize: ${isMinimized} -> ${!isMinimized}.`); + this.onMinimized && this.onMinimized(isMinimized, !isMinimized); + } + private _executeExternalBeforeCalling(): void { + this.beforeCalling && this.beforeCalling(); + } + private _executeExternalAfterCalling(): void { + this.afterCalling && this.afterCalling(); + } + // ========================【TUICallKit 组件属性设置方法】======================== + @paramValidate(VALIDATE_PARAMS.setVideoDisplayMode) + public setVideoDisplayMode(displayMode: VideoDisplayMode) { + TUIStore.update(StoreName.CALL, NAME.DISPLAY_MODE, displayMode); + } + @paramValidate(VALIDATE_PARAMS.setVideoResolution) + public async setVideoResolution(resolution: VideoResolution) { + try { + if (!resolution) return; + TUIStore.update(StoreName.CALL, NAME.VIDEO_RESOLUTION, resolution); + await this._tuiCallEngine.setVideoQuality(resolution); + } catch (error) { + console.warn(`${NAME.PREFIX}setVideoResolution failed, error: ${error}.`); + } + } + // =========================【 miniProgram 私有公共方法】========================= + // 处理用户异常退出的情况,处理了右滑退出,以及返回退出的情况。 + private async _handleExceptionExit() { + const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); + const callRole = TUIStore.getData(StoreName.CALL, NAME.CALL_ROLE); + // 在呼叫状态下, 被叫调用 reject,主叫调用 hangup + if (callStatus === CallStatus.CALLING) { + callRole === CallRole.CALLER && await this.hangup(); + callRole === CallRole.CALLEE && await this.reject(); + } + // 在通话状态下, 统一调用 hangup 接口 + callStatus === CallStatus.CONNECTED && await this.hangup(); + } + private _setLocalUserInfoAudioVideoAvailable(isAvailable: boolean, type: string) { + let localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + if (type === NAME.AUDIO) { + localUserInfo = { ...localUserInfo, isAudioAvailable: isAvailable }; + } + if (type === NAME.VIDEO) { + localUserInfo = { ...localUserInfo, isVideoAvailable: isAvailable }; + } + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, localUserInfo); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, localUserInfo); + } + private async _updateCallStoreBeforeCall(type: number, remoteUserInfoList: IUserInfo[], groupID?: string): Promise { + const callTips = groupID || TUIStore.getData(StoreName.CALL, NAME.IS_MINIMIZED) ? CallTips.CALLER_GROUP_CALLING_MSG : CallTips.CALLER_CALLING_MSG; + let updateStoreParams: any = { + [NAME.CALL_MEDIA_TYPE]: type, + [NAME.CALL_ROLE]: CallRole.CALLER, + [NAME.REMOTE_USER_INFO_LIST]: remoteUserInfoList, + [NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: remoteUserInfoList, + [NAME.IS_GROUP]: !!groupID, + [NAME.CALL_TIPS]: t(callTips), + [NAME.GROUP_ID]: groupID + }; + const pusher = { enableCamera: type === CallMediaType.VIDEO, enableMic: true }; // mini 默认打开麦克风 + updateStoreParams = { ...updateStoreParams, [NAME.PUSHER]: pusher }; + TUIStore.updateStore(updateStoreParams, StoreName.CALL); + const callStatus = await beforeCall(type, this); // 如果没有权限, 此时为 false. 因此需要在 call 后设置为 calling. 和 web 存在差异 + console.log(`${NAME.PREFIX}mini beforeCall return callStatus: ${callStatus}.`); + TUIStore.update(StoreName.CALL, NAME.CALL_STATUS, callStatus); + const remoteUserInfoLists = await getRemoteUserProfile(remoteUserInfoList.map(obj => obj.userId), this.getTim(), TUIStore); + + if (remoteUserInfoLists.length > 0) { + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoLists); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoLists); + } + } + private async _updateCallStoreAfterCall(userIdList: string[], response: any) { + if (response) { + TUIStore.update(StoreName.CALL, NAME.IS_CLICKABLE, true); + TUIStore.update(StoreName.CALL, NAME.ROOM_ID, response.roomID); + this._callTUIService({ message: response?.data?.message }); + response.pusher && TUIStore.update(StoreName.CALL, NAME.PUSHER, response.pusher); + const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); + (callMediaType === CallMediaType.VIDEO) && await this.openCamera(NAME.LOCAL_VIDEO); + this.setSoundMode(callMediaType === CallMediaType.AUDIO ? AudioPlayBackDevice.EAR : AudioPlayBackDevice.SPEAKER); + TUIStore.update(StoreName.CALL, NAME.CALL_STATUS, CallStatus.CALLING); // 小程序未授权时, 此时状态为 idle; web 直接设置为 calling + const localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, { ...localUserInfo, isEnter: true }); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...localUserInfo, isEnter: true }); + this._setLocalUserInfoAudioVideoAvailable(true, NAME.AUDIO); // web && mini, default open audio + } else { + this._resetCallStore(); + } + } + private _resetCurrentDevice() { + // 挂断后,重置当前摄像头,麦克风和扬声器为默认设备 + const { cameraList, microphoneList, speakerList } = TUIStore.getData(StoreName.CALL, NAME.DEVICE_LIST); + TUIStore.update( + StoreName.CALL, + NAME.DEVICE_LIST, + { microphoneList, cameraList, speakerList, + currentCamera: cameraList?.[0] || {}, + currentMicrophone: microphoneList?.[0] || {}, + currentSpeaker: speakerList?.[0] || {} + }, + ); + } + private _resetCallStore() { + const oldStatusStr = generateStatusChangeText(TUIStore); + this._stopTimer(); + // localUserInfo, language 在通话结束后不需要清除 + // callStatus 清除需要通知; isMinimized 也需要通知(basic-vue3 中切小窗关闭后, 再呼叫还是小窗, 因此需要通知到组件侧) + // isGroup 也不清除(engine 先抛 cancel 事件, 再抛 reject 事件) + // displayMode、videoResolution 也不能清除, 组件不卸载, 这些属性也需保留, 否则采用默认值. + // enableFloatWindow 不清除:开启/关闭悬浮窗功能。 + let notResetOrNotifyKeys = Object.keys(CALL_DATA_KEY).filter((key) => { + switch (CALL_DATA_KEY[key]) { + case NAME.CALL_STATUS: + case NAME.LANGUAGE: + case NAME.IS_GROUP: + case NAME.DISPLAY_MODE: + case NAME.VIDEO_RESOLUTION: + case NAME.ENABLE_FLOAT_WINDOW: + case NAME.LOCAL_USER_INFO: + case NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN: { + return false; + } + default: { + return true; + } + } + }); + notResetOrNotifyKeys = notResetOrNotifyKeys.map(key => CALL_DATA_KEY[key]); + TUIStore.reset(StoreName.CALL, notResetOrNotifyKeys); + const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); + callStatus !== CallStatus.IDLE && TUIStore.reset(StoreName.CALL, [NAME.CALL_STATUS], true); // callStatus reset need notify + TUIStore.reset(StoreName.CALL, [NAME.IS_MINIMIZED], true); // isMinimized reset need notify + TUIStore.reset(StoreName.CALL, [NAME.IS_EAR_PHONE], true); // isEarPhone reset need notify + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO, { + ...TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO), + isVideoAvailable: false, + isAudioAvailable: false, + }); + TUIStore.update(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { + ...TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO_EXCLUDE_VOLUMN), + isVideoAvailable: false, + isAudioAvailable: false, + }); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, []); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, []); + this._resetCurrentDevice(); + const newStatusStr = generateStatusChangeText(TUIStore); + if (oldStatusStr !== newStatusStr) { + this.statusChanged && this.statusChanged({ oldStatus: oldStatusStr, newStatus: newStatusStr }); + } + } + private _noDevicePermissionToast(error: any, type: CallMediaType): void { + if (handleNoDevicePermissionError(error)) { + let text = ''; + if (type === CallMediaType.AUDIO) { + text = generateText(TUIStore, CallTips.NO_MICROPHONE_DEVICE_PERMISSION); + } + if (type === CallMediaType.VIDEO) { + text = generateText(TUIStore, CallTips.NO_CAMERA_DEVICE_PERMISSION); + } + + + text && TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { text, type: NAME.ERROR }); + console.error(`${NAME.PREFIX}call failed, error: ${error.message}.`); + } + } + // 通话时长更新 + private _startTimer(): void { + if (this._timerId === -1) { + this._startTimeStamp = performanceNow(); + this._timerId = timer.run(NAME.TIMEOUT, this._updateCallDuration.bind(this), { delay: 1000 }); + } + } + private _updateCallDuration(): void { + const callDurationNum = Math.round((performanceNow() - this._startTimeStamp) / 1000); // miniProgram stop timer when background + const callDurationStr = formatTime(callDurationNum); + TUIStore.update(StoreName.CALL, NAME.CALL_DURATION, callDurationStr); + } + private _stopTimer(): void { + if (this._timerId !== -1) { + timer.clearTask(this._timerId); + this._timerId = -1; + } + } + private _deleteRemoteUser(userIdList: string[]): void { + if (userIdList.length === 0) return; + let remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + userIdList.forEach((userId) => { + remoteUserInfoList = remoteUserInfoList.filter((obj: IUserInfo) => obj.userId !== userId); + }); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList); + TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList); + } + private _analyzeEventData(event: any): any { + return event?.data || {}; // mini INVITED + } + // =========================【调用 chat api】========================= + // 获取群成员 + public async getGroupMemberList(count: number, offset: number) { + const groupID = TUIStore.getData(StoreName.CALL, NAME.GROUP_ID); + let groupMemberList = await getGroupMemberList(groupID, this.getTim(), count, offset); + return groupMemberList; + } + // 获取群信息 + public async getGroupProfile() { + const groupID: string = TUIStore.getData(StoreName.CALL, NAME.GROUP_ID); + return await getGroupProfile(groupID, this.getTim()); + } + // =========================【监听 TUIStore 中的状态】========================= + private _handleCallStatusChange = async (value: CallStatus) => { + try { + const bellParams: IBellParams = { + callRole: TUIStore.getData(StoreName.CALL, NAME.CALL_ROLE), + callStatus: TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS), + }; + this._bellContext.setBellProperties(bellParams); + if (value === CallStatus.CALLING) { + await this?._bellContext?.play(); + } else { + // 状态变更通知 + if (value === CallStatus.CONNECTED) { + const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); + const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); + const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); + const oldStatus = isGroup ? StatusChange.DIALING_GROUP : StatusChange.DIALING_C2C; + TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, ''); + this.statusChanged && this.statusChanged({ oldStatus, newStatus: generateStatusChangeText(TUIStore) }); + if (!isGroup && callMediaType === CallMediaType.VIDEO) { + this.switchScreen(remoteUserInfoList[0].domId); + } + } + await this?._bellContext?.stop(); + } + } catch (error) { + console.warn(`${NAME.PREFIX}handleCallStatusChange, ${error}.`); + } + }; + private _watchTUIStore() { + TUIStore?.watch(StoreName.CALL, { + [NAME.CALL_STATUS]: this._handleCallStatusChange, + }); + } + private _unwatchTUIStore() { + TUIStore?.unwatch(StoreName.CALL, { + [NAME.CALL_STATUS]: this._handleCallStatusChange, + }); + } + // =========================【web 融合 chat 提供的方法】========================= + public bindTUICore(TUICore: any) { + this._TUICore = TUICore; + } + // 下面方法用于接入 TUICore + private _callTUIService(params) { + const { message } = params || {}; + TUICore.callService({ + serviceName: TUIConstants.TUIChat.SERVICE.NAME, + method: TUIConstants.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST, + params: { message }, + }); + } + public async onNotifyEvent(eventName: string, subKey: string) { + try { + if (eventName === TUIConstants.TUILogin.EVENT.LOGIN_STATE_CHANGED) { + if (subKey === TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS) { + // TUICallkit 收到登录成功时执行自己的业务逻辑处理 + // @ts-ignore + const { chat, userID, userSig, SDKAppID } = TUILogin.getContext(); + await this.init({ tim: chat, userID, userSig, sdkAppID: SDKAppID, isFromChat: true }); + } else if (subKey === TUIConstants.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS) { + await this.destroyed(); + } + } + } catch (error) { + console.error(`${NAME.PREFIX}TUICore onNotifyEvent failed, error: ${error}.`); + } + } + public async onCall(method: String, params: any) { + if (method === TUIConstants.TUICalling.SERVICE.METHOD.START_CALL) { + await this._handleTUICoreOnClick(params, params.type); + } + } + private async _handleTUICoreOnClick(options, type: CallMediaType) { + try { + const { groupID, userIDList = [], ...rest } = options; + if (groupID) { + await this.groupCall({ groupID, userIDList, type, ...rest }); + } else if (userIDList.length === 1) { + await this.call({ userID: userIDList[0], type, ...rest }); + } + } catch (error: any) { + console.debug(error); + } + } + public onGetExtension(extensionID: string, params: any) { + if (extensionID === TUIConstants.TUIChat.EXTENSION.INPUT_MORE.EXT_ID) { + const list = []; + const audioCallExtension: ExtensionInfo = { + weight: 1000, + text: '语音通话', + icon: AudioCallIcon, + data: { + name: 'voiceCall', + }, + listener: { + onClicked: async options => await this._handleTUICoreOnClick(options, options.type || CallMediaType.AUDIO), // 点击时发起通话 + }, + }; + const videoCallExtension: ExtensionInfo = { + weight: 900, + text: '视频通话', + icon: VideoCallIcon, + data: { + name: 'videoCall', + }, + listener: { + onClicked: async options => await this._handleTUICoreOnClick(options, options.type || CallMediaType.VIDEO), // 点击时发起通话 + }, + }; + if (!params?.filterVoice) { + list.push(audioCallExtension); + } + if (!params?.filterVideo) { + list.push(videoCallExtension); + } + return list; + } + } +} \ No newline at end of file diff --git a/TUICallKit/TUICallService/CallService/miniProgram.ts b/TUICallKit/TUICallService/CallService/miniProgram.ts new file mode 100644 index 0000000..76466f5 --- /dev/null +++ b/TUICallKit/TUICallService/CallService/miniProgram.ts @@ -0,0 +1,55 @@ +import { CallMediaType, CallStatus } from '../const/index'; + +export function initialUI() { + // 收起键盘 + // @ts-ignore + wx.hideKeyboard({ + complete: () => {}, + }); +}; +// 检测运行时环境, 当是微信开发者工具时, 提示用户需要手机调试 +export function checkRunPlatform() { + // @ts-ignore + const systemInfo = wx.getSystemInfoSync(); + if (systemInfo.platform === 'devtools') { + // 当前运行在微信开发者工具里 + // @ts-ignore + wx.showModal({ + icon: 'none', + title: '运行环境提醒', + content: '微信开发者工具不支持原生推拉流组件(即 标签),请使用真机调试或者扫码预览。', + showCancel: false, + }); + } +}; +export function initAndCheckRunEnv() { + initialUI(); // miniProgram 收起键盘, 隐藏 tabBar + checkRunPlatform(); // miniProgram 检测运行时环境 +} +export async function beforeCall(type: CallMediaType, that: any) { + try { + initAndCheckRunEnv(); + // 检查设备权限 + const deviceMap = { + microphone: true, + camera: type === CallMediaType.VIDEO, + }; + const hasDevicePermission = await that._tuiCallEngine.deviceCheck(deviceMap); // miniProgram 检查设备权限 + return hasDevicePermission ? CallStatus.CALLING : CallStatus.IDLE; + } catch (error) { + console.debug(error); + return CallStatus.IDLE; + } +} +// 套餐问题提示, 小程序最低需要群组通话版, 1v1 通话版本使用 TRTC 就会报错 +export function handlePackageError(error) { + if (error?.code === -1002) { + // @ts-ignore + wx.showModal({ + icon: 'none', + title: 'error', + content: error?.message || '', + showCancel: false, + }); + } +} \ No newline at end of file diff --git a/TUICallKit/TUICallService/CallService/utils.js b/TUICallKit/TUICallService/CallService/utils.js index 0eaed04..d599734 100644 --- a/TUICallKit/TUICallService/CallService/utils.js +++ b/TUICallKit/TUICallService/CallService/utils.js @@ -30,7 +30,7 @@ function setDefaultUserInfo(userId, domId) { exports.setDefaultUserInfo = setDefaultUserInfo; // 获取个人用户信息 function getMyProfile(myselfUserId, tim, TUIStore) { - var _a, _b, _c; + var _a, _b, _c, _d, _e; return __awaiter(this, void 0, void 0, function* () { let localUserInfo = setDefaultUserInfo(myselfUserId, index_1.NAME.LOCAL_VIDEO); try { @@ -39,7 +39,7 @@ function getMyProfile(myselfUserId, tim, TUIStore) { const res = yield tim.getMyProfile(); const currentLocalUserInfo = TUIStore === null || TUIStore === void 0 ? void 0 : TUIStore.getData(index_1.StoreName.CALL, index_1.NAME.LOCAL_USER_INFO); // localUserInfo may have been updated if ((res === null || res === void 0 ? void 0 : res.code) === 0) { - localUserInfo = Object.assign(Object.assign(Object.assign({}, localUserInfo), currentLocalUserInfo), { userId: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.userID, nick: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.nick, avatar: (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.avatar }); + localUserInfo = Object.assign(Object.assign(Object.assign({}, localUserInfo), currentLocalUserInfo), { userId: (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.userID, nick: (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.nick, avatar: (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.avatar, displayUserInfo: ((_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.nick) || ((_e = res === null || res === void 0 ? void 0 : res.data) === null || _e === void 0 ? void 0 : _e.userID) }); } return localUserInfo; } diff --git a/TUICallKit/TUICallService/CallService/utils.ts b/TUICallKit/TUICallService/CallService/utils.ts new file mode 100644 index 0000000..53183cc --- /dev/null +++ b/TUICallKit/TUICallService/CallService/utils.ts @@ -0,0 +1,142 @@ +import { NAME, StoreName, CallStatus, StatusChange, CallMediaType } from '../const/index'; +import { IUserInfo } from '../interface/ICallService'; +import { ITUIStore } from '../interface/ITUIStore'; +import { t } from '../locales/index'; + +// 设置默认的 UserInfo 信息 +export function setDefaultUserInfo(userId: string, domId?: string): IUserInfo { + const userInfo: IUserInfo = { + userId, + nick: '', + avatar: '', + remark: '', + displayUserInfo: '', + isAudioAvailable: false, + isVideoAvailable: false, + isEnter: false, + domId: domId || userId, + }; + return domId ? userInfo : { ...userInfo, isEnter: false }; // localUserInfo 没有 isEnter, remoteUserInfoList 有 isEnter +} +// 获取个人用户信息 +export async function getMyProfile(myselfUserId: string, tim: any, TUIStore: any): Promise { + let localUserInfo: IUserInfo = setDefaultUserInfo(myselfUserId, NAME.LOCAL_VIDEO); + try { + if (!tim) return localUserInfo; + const res = await tim.getMyProfile(); + const currentLocalUserInfo = TUIStore?.getData(StoreName.CALL, NAME.LOCAL_USER_INFO); // localUserInfo may have been updated + if (res?.code === 0) { + localUserInfo = { + ...localUserInfo, + ...currentLocalUserInfo, + userId: res?.data?.userID, + nick: res?.data?.nick, + avatar: res?.data?.avatar, + displayUserInfo: res?.data?.nick || res?.data?.userID, + }; + } + return localUserInfo; + } catch (error) { + console.error(`${NAME.PREFIX}getMyProfile failed, error: ${error}.`); + return localUserInfo; + } +} +// 获取远端用户列表信息 +export async function getRemoteUserProfile(userIdList: Array, tim: any, TUIStore: any): Promise { + let remoteUserInfoList: IUserInfo[] = userIdList.map((userId: string) => setDefaultUserInfo(userId)); + try { + if (!tim) return remoteUserInfoList; + const res = await tim.getFriendProfile({ userIDList: userIdList }); + if (res.code === 0) { + const { friendList = [], failureUserIDList = [] } = res.data; + let unFriendList: IUserInfo[] = failureUserIDList.map((obj: any) => obj.userID); + if (failureUserIDList.length > 0) { + const res = await tim.getUserProfile({ userIDList: failureUserIDList.map((obj: any) => obj.userID) }); + if (res?.code === 0) { + unFriendList = res?.data || []; + } + } + const currentRemoteUserInfoList = TUIStore?.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST); // remoteUserInfoList may have been updated + const tempFriendIdList: string[] = friendList.map((obj: any) => obj.userID); + const tempUnFriendIdList: string[] = unFriendList.map((obj: any) => obj.userID); + remoteUserInfoList = userIdList.map((userId: string) => { + const defaultUserInfo: IUserInfo = setDefaultUserInfo(userId); + const friendListIndex: number = tempFriendIdList.indexOf(userId); + const unFriendListIndex: number = tempUnFriendIdList.indexOf(userId); + let remark = ''; + let nick = ''; + let displayUserInfo = '' ; + let avatar = ''; + if (friendListIndex !== -1) { + remark = friendList[friendListIndex]?.remark || ''; + nick = friendList[friendListIndex]?.profile?.nick || ''; + displayUserInfo = remark || nick || defaultUserInfo.userId || ''; + avatar = friendList[friendListIndex]?.profile?.avatar || ''; + } + if (unFriendListIndex !== -1) { + nick = unFriendList[unFriendListIndex]?.nick || ''; + displayUserInfo = nick || defaultUserInfo.userId || ''; + avatar = unFriendList[unFriendListIndex]?.avatar || ''; + } + const userInfo = currentRemoteUserInfoList.find(subObj => subObj.userId === userId) || {}; + return { ...defaultUserInfo, ...userInfo, remark, nick, displayUserInfo, avatar }; + }); + } + return remoteUserInfoList; + } catch (error) { + console.error(`${NAME.PREFIX}getRemoteUserProfile failed, error: ${error}.`); + return remoteUserInfoList; + } +} +// 生成弹框提示文案 +export function generateText(TUIStore: ITUIStore, key: string, prefix?: string, suffix?: string): string { + const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); + let callTips = `${t(key)}`; + if (isGroup) { + callTips = prefix ? `${prefix} ${callTips}` : callTips; + callTips = suffix ? `${callTips} ${suffix}` : callTips; + } + return callTips; +} +// 生成 statusChange 抛出的字符串 +export function generateStatusChangeText(TUIStore: ITUIStore): string { + const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS); + if (callStatus === CallStatus.IDLE) { + return StatusChange.IDLE; + } + const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP); + if (callStatus === CallStatus.CALLING) { + return isGroup ? StatusChange.DIALING_GROUP : StatusChange.DIALING_C2C; + } + const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE); + if (isGroup) { + return callMediaType === CallMediaType.AUDIO ? StatusChange.CALLING_GROUP_AUDIO : StatusChange.CALLING_GROUP_VIDEO; + } + return callMediaType === CallMediaType.AUDIO ? StatusChange.CALLING_C2C_AUDIO : StatusChange.CALLING_C2C_VIDEO; +} +// 获取群组[offset, count + offset]区间成员 +export async function getGroupMemberList(groupID: string, tim: any, count, offset) { + let groupMemberList = []; + try { + const res = await tim.getGroupMemberList({ groupID, count, offset }); + if (res.code === 0) { + return res.data.memberList || groupMemberList; + } + } catch(error) { + console.error(`${NAME.PREFIX}getGroupMember failed, error: ${error}.`); + return groupMemberList; + } +} +// 获取 IM 群信息 +export async function getGroupProfile(groupID: string, tim: any): Promise { + let groupProfile = {}; + try { + const res = await tim.getGroupProfile({ groupID }); + if (res.code === 0) { + return res.data.group || groupProfile; + } + } catch(error) { + console.error(`${NAME.PREFIX}getGroupProfile failed, error: ${error}.`); + return groupProfile; + } +} \ No newline at end of file diff --git a/TUICallKit/TUICallService/TUIGlobal/tuiGlobal.ts b/TUICallKit/TUICallService/TUIGlobal/tuiGlobal.ts new file mode 100644 index 0000000..843166c --- /dev/null +++ b/TUICallKit/TUICallService/TUIGlobal/tuiGlobal.ts @@ -0,0 +1,43 @@ +import { APP_NAMESPACE, IS_PC, IS_H5, IN_WX_MINI_APP, IN_UNI_NATIVE_APP, IN_UNI_APP, IS_MAC, IS_WIN } from '../utils/env'; +import { ITUIGlobal } from '../interface/ITUIGlobal'; + +export default class TUIGlobal implements ITUIGlobal { + static instance: TUIGlobal; + public global: any = APP_NAMESPACE; + public isPC: boolean = false; + public isH5: boolean = false; + public isWeChat: boolean = false; + public isApp: boolean = false; + public isUniPlatform: boolean = false; + public isOfficial: boolean = false; + public isWIN: boolean = false; + public isMAC: boolean = false; + constructor() { + this.initEnv(); + } + + /** + * 获取 TUIGlobal 实例 + * @returns {TUIGlobal} + */ + static getInstance() { + if (!TUIGlobal.instance) { + TUIGlobal.instance = new TUIGlobal(); + } + return TUIGlobal.instance; + } + + initEnv() { + this.isPC = IS_PC; + this.isH5 = IS_H5; + this.isWeChat = IN_WX_MINI_APP; + this.isApp = IN_UNI_NATIVE_APP && !IN_WX_MINI_APP; // uniApp 打包小程序时 IN_UNI_NATIVE_APP 为 true,所以此处需要增加条件 + this.isUniPlatform = IN_UNI_APP; + this.isWIN = IS_WIN; + this.isMAC = IS_MAC; + } + + initOfficial(SDKAppID: number) { + this.isOfficial = (SDKAppID === 1400187352 || SDKAppID === 1400188366); + } +} diff --git a/TUICallKit/TUICallService/TUIStore/callStore.js b/TUICallKit/TUICallService/TUIStore/callStore.js index 8ac66ef..cf9bd6c 100644 --- a/TUICallKit/TUICallService/TUIStore/callStore.js +++ b/TUICallKit/TUICallService/TUIStore/callStore.js @@ -9,7 +9,9 @@ class CallStore { callRole: index_1.CallRole.UNKNOWN, callMediaType: index_1.CallMediaType.UNKNOWN, localUserInfo: { userId: '' }, + localUserInfoExcludeVolume: { userId: '' }, remoteUserInfoList: [], + remoteUserInfoExcludeVolumeList: [], callerUserInfo: { userId: '' }, isGroup: false, callDuration: '00:00:00', @@ -24,6 +26,7 @@ class CallStore { showPermissionTip: false, groupID: '', roomID: 0, + cameraPosition: index_1.CameraPosition.FRONT, // TUICallKit 组件上的属性 displayMode: index_1.VideoDisplayMode.COVER, videoResolution: index_1.VideoResolution.RESOLUTION_480P, diff --git a/TUICallKit/TUICallService/TUIStore/callStore.ts b/TUICallKit/TUICallService/TUIStore/callStore.ts new file mode 100644 index 0000000..57dd07d --- /dev/null +++ b/TUICallKit/TUICallService/TUIStore/callStore.ts @@ -0,0 +1,66 @@ +import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, CameraPosition } from '../const/index'; +import { ICallStore } from '../interface/ICallStore'; +import { getLanguage } from '../utils/common-utils'; + +export default class CallStore { + public defaultStore: ICallStore = { + callStatus: CallStatus.IDLE, + callRole: CallRole.UNKNOWN, + callMediaType: CallMediaType.UNKNOWN, + localUserInfo: { userId: '' }, + localUserInfoExcludeVolume: { userId: '' }, + remoteUserInfoList: [], + remoteUserInfoExcludeVolumeList: [], + callerUserInfo: { userId: '' }, + isGroup: false, + callDuration: '00:00:00', // 通话时长 + callTips: '', // 通话提示的信息. 例如: '等待谁接听', 'xxx 拒绝通话', 'xxx 挂断通话' + toastInfo: { text: '' }, // 远端用户挂断、拒绝、超时、忙线等的 toast 提示信息 + isMinimized: false, // 用来记录当前是否悬浮窗模式 + enableFloatWindow: false, // 开启/关闭悬浮窗功能,设置为false,通话界面左上角的悬浮窗按钮会隐藏 + bigScreenUserId: '', // 当前大屏幕显示的 userID 用户 + language: getLanguage(), // en, zh-cn + isClickable: false, // 是否可点击, 用于按钮增加 loading 效果,不可点击 + deviceList: { cameraList: [], microphoneList: [], currentCamera: {}, currentMicrophone: {} }, + showPermissionTip: false, + groupID: '', + roomID: 0, + cameraPosition: CameraPosition.FRONT, // 前置或后置,值为front, back + // TUICallKit 组件上的属性 + displayMode: VideoDisplayMode.COVER, // 设置预览远端的画面显示模式 + videoResolution: VideoResolution.RESOLUTION_480P, + showSelectUser: false, + // 小程序相关属性 + pusher: {}, + player: [], + isEarPhone: false, // 是否是听筒, 默认: false + }; + public store: ICallStore = Object.assign({}, this.defaultStore);; + + public update(key: keyof ICallStore, data: any): void { + switch (key) { + // case 'callTips': + // break; + default: + // resolve "Type 'any' is not assignable to type 'never'.ts", ref: https://github.com/microsoft/TypeScript/issues/31663 + (this.store[key] as any) = data as any; + } + } + + public getData(key: string | undefined): any { + if (!key) return this.store; + return this.store[key as keyof ICallStore]; + } + // reset call store + public reset(keyList: Array = []) { + if (keyList.length === 0) { + keyList = Object.keys(this.store); + } + const resetToDefault = keyList.reduce((acc, key) => ({ ...acc, [key]: this.defaultStore[key as keyof ICallStore] }), {}); + this.store = { + ...this.defaultStore, + ...this.store, + ...resetToDefault, + }; + } +} diff --git a/TUICallKit/TUICallService/TUIStore/tuiStore.ts b/TUICallKit/TUICallService/TUIStore/tuiStore.ts new file mode 100644 index 0000000..749f9cb --- /dev/null +++ b/TUICallKit/TUICallService/TUIStore/tuiStore.ts @@ -0,0 +1,157 @@ +import { ITUIStore, IOptions, Task } from '../interface/ITUIStore'; +import { StoreName, NAME } from '../const/index'; +import CallStore from './callStore'; +import { isString, isNumber, isBoolean } from '../utils/common-utils'; + +export default class TUIStore implements ITUIStore { + static instance: TUIStore; + public task: Task; + private storeMap: Partial>; + private timerId: number = -1; + constructor() { + this.storeMap = { + [StoreName.CALL]: new CallStore(), + }; + // todo 此处后续优化结构后调整 + this.task = {} as Task; // 保存监听回调列表 + } + + /** + * 获取 TUIStore 实例 + * @returns {TUIStore} + */ + static getInstance() { + if (!TUIStore.instance) { + TUIStore.instance = new TUIStore(); + } + return TUIStore.instance; + } + + /** + * UI 组件注册监听回调 + * @param {StoreName} storeName store 名称 + * @param {IOptions} options 监听信息 + * @param {Object} params 扩展参数 + * @param {String} params.notifyRangeWhenWatch 注册时监听时的通知范围, 'all' - 通知所有注册该 key 的监听; 'myself' - 通知本次注册该 key 的监听; 默认不通知 + */ + watch(storeName: StoreName, options: IOptions, params?: any) { + if (!this.task[storeName]) { + this.task[storeName] = {}; + } + const watcher = this.task[storeName]; + Object.keys(options).forEach((key) => { + const callback = options[key]; + if (!watcher[key]) { + watcher[key] = new Map(); + } + watcher[key].set(callback, 1); + const { notifyRangeWhenWatch } = params || {}; + // 注册监听后, 通知所有注册该 key 的监听,使用 'all' 时要特别注意是否对其他地方的监听产生影响 + if (notifyRangeWhenWatch === NAME.ALL) { + this.notify(storeName, key); + } + // 注册监听后, 仅通知自己本次监听该 key 的数据 + if (notifyRangeWhenWatch === NAME.MYSELF) { + const data = this.getData(storeName, key); + callback.call(this, data); + } + }); + } + + /** + * UI 取消组件监听回调 + * @param {StoreName} storeName store 名称 + * @param {IOptions} options 监听信息,包含需要取消的回掉等 + */ + unwatch(storeName: StoreName, options: IOptions) { + // todo 该接口暂未支持,unwatch掉同一类,如仅传入store注销掉该store下的所有callback,同样options仅传入key注销掉该key下的所有callback + // options的callback function为必填参数,后续修改 + if (!this.task[storeName]) { + return; + }; + // if (isString(options)) { + // // 移除所有的监听 + // if (options === '*') { + // const watcher = this.task[storeName]; + // Object.keys(watcher).forEach(key => { + // watcher[key].clear(); + // }); + // } else { + // console.warn(`${NAME.PREFIX}unwatch warning: options is ${options}`); + // } + // return; + // } + const watcher = this.task[storeName]; + Object.keys(options).forEach((key: string) => { + watcher[key].delete(options[key]); + }); + } + + /** + * 通用 store 数据更新,messageList 的变更需要单独处理 + * @param {StoreName} storeName store 名称 + * @param {string} key 变更的 key + * @param {unknown} data 变更的数据 + */ + update(storeName: StoreName, key: string, data: unknown) { + // 基本数据类型时, 如果相等, 就不进行更新, 减少不必要的 notify + if (isString(data) || isNumber(data) || isBoolean(data)) { + const currentData = this.storeMap[storeName]['store'][key]; // eslint-disable-line + if (currentData === data) return; + } + this.storeMap[storeName]?.update(key, data); + this.notify(storeName, key); + } + + /** + * 获取 Store 数据 + * @param {StoreName} storeName store 名称 + * @param {string} key 待获取的 key + * @returns {Any} + */ + getData(storeName: StoreName, key: string) { + return this.storeMap[storeName]?.getData(key); + } + + /** + * UI 组件注册监听回调 + * @param {StoreName} storeName store 名称 + * @param {string} key 变更的 key + */ + private notify(storeName: StoreName, key: string) { + if (!this.task[storeName]) { + return; + } + const watcher = this.task[storeName]; + if (watcher[key]) { + const callbackMap = watcher[key]; + const data = this.getData(storeName, key); + for (const [callback] of callbackMap.entries()) { + callback.call(this, data); + } + } + } + + public reset(storeName: StoreName, keyList: Array = [], isNotificationNeeded = false) { + if (storeName in this.storeMap) { + const store = this.storeMap[storeName]; + // reset all + if (keyList.length === 0) { + keyList = Object.keys(store?.store); + } + store.reset(keyList); + if (isNotificationNeeded) { + keyList.forEach((key) => { + this.notify(storeName, key); + }); + } + } + } + // 批量修改多个 key-value + public updateStore(params: any, name?: StoreName): void { + const storeName = name ? name : StoreName.CALL; + Object.keys(params).forEach((key) => { + this.update(storeName, key, params[key]); + }); + } +} diff --git a/TUICallKit/TUICallService/assets/phone_dialing.mp3 b/TUICallKit/TUICallService/assets/phone_dialing.mp3 new file mode 100644 index 0000000..f392528 Binary files /dev/null and b/TUICallKit/TUICallService/assets/phone_dialing.mp3 differ diff --git a/TUICallKit/TUICallService/assets/phone_ringing.mp3 b/TUICallKit/TUICallService/assets/phone_ringing.mp3 new file mode 100644 index 0000000..c3838f3 Binary files /dev/null and b/TUICallKit/TUICallService/assets/phone_ringing.mp3 differ diff --git a/TUICallKit/TUICallService/const/call.d.ts b/TUICallKit/TUICallService/const/call.d.ts index 8af20c4..76dbbc9 100644 --- a/TUICallKit/TUICallService/const/call.d.ts +++ b/TUICallKit/TUICallService/const/call.d.ts @@ -89,5 +89,10 @@ export declare enum AudioPlayBackDevice { } export declare enum DeviceType { MICROPHONE = "microphone", - CAMERA = "camera" + CAMERA = "camera", + SPEAKER = "speaker" +} +export declare enum CameraPosition { + FRONT = 0, + BACK = 1 } diff --git a/TUICallKit/TUICallService/const/call.js b/TUICallKit/TUICallService/const/call.js index e6a9f63..9c973e2 100644 --- a/TUICallKit/TUICallService/const/call.js +++ b/TUICallKit/TUICallService/const/call.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.DeviceType = exports.AudioPlayBackDevice = exports.StatusChange = exports.LanguageType = exports.VideoResolution = exports.VideoDisplayMode = exports.CallStatus = exports.CallRole = exports.CallMediaType = exports.StoreName = void 0; +exports.CameraPosition = exports.DeviceType = exports.AudioPlayBackDevice = exports.StatusChange = exports.LanguageType = exports.VideoResolution = exports.VideoDisplayMode = exports.CallStatus = exports.CallRole = exports.CallMediaType = exports.StoreName = void 0; /** * @property {String} call 1v1 通话 + 群组通话 * @property {String} CUSTOM 自定义 Store @@ -101,4 +101,10 @@ var DeviceType; (function (DeviceType) { DeviceType["MICROPHONE"] = "microphone"; DeviceType["CAMERA"] = "camera"; + DeviceType["SPEAKER"] = "speaker"; })(DeviceType = exports.DeviceType || (exports.DeviceType = {})); +var CameraPosition; +(function (CameraPosition) { + CameraPosition[CameraPosition["FRONT"] = 0] = "FRONT"; + CameraPosition[CameraPosition["BACK"] = 1] = "BACK"; +})(CameraPosition = exports.CameraPosition || (exports.CameraPosition = {})); diff --git a/TUICallKit/TUICallService/const/call.ts b/TUICallKit/TUICallService/const/call.ts new file mode 100644 index 0000000..3815035 --- /dev/null +++ b/TUICallKit/TUICallService/const/call.ts @@ -0,0 +1,107 @@ +/** + * @property {String} call 1v1 通话 + 群组通话 + * @property {String} CUSTOM 自定义 Store +*/ +export enum StoreName { + CALL = 'call', + CUSTOM = 'custom' +} +/** + * @property {String} idle 空闲 + * @property {String} connecting 呼叫等待中 + * @property {String} connected 通话中 +*/ +export enum CallMediaType { + UNKNOWN, + AUDIO, + VIDEO, +} +/** + * @property {String} caller 主叫 + * @property {String} callee 被叫 +*/ +export enum CallRole { + UNKNOWN = 'unknown', + CALLEE = 'callee', + CALLER = 'caller', +} +/** + * @property {String} idle 空闲 + * @property {String} calling 呼叫等待中 + * @property {String} connected 通话中 +*/ +export enum CallStatus { + IDLE = 'idle', + CALLING = 'calling', + CONNECTED = 'connected', +} +/** + * 视频画面显示模式 + * 播放视频流默认使用 cover 模式; 播放屏幕共享流默认使用 contain 模式。 + * @property {String} contain 优先保证视频内容全部显示。视频尺寸等比缩放,直至视频窗口的一边与视窗边框对齐。如果视频尺寸与显示视窗尺寸不一致,在保持长宽比的前提下,将视频进行缩放后填满视窗,缩放后的视频四周会有一圈黑边。 + * @property {String} cover 优先保证视窗被填满。视频尺寸等比缩放,直至整个视窗被视频填满。如果视频长宽与显示窗口不同,则视频流会按照显示视窗的比例进行周边裁剪或图像拉伸后填满视窗 + * @property {String} fill 保证视窗被填满的同时保证视频内容全部显示,但是不保证视频尺寸比例不变。视频的宽高会被拉伸至和视窗尺寸一致。(该选项值自 v4.12.1 开始支持) +*/ +export enum VideoDisplayMode { + CONTAIN = 'contain', + COVER = 'cover', + FILL = 'fill', +} +/** + * 视频分辨率 + * @property {String} 480p + * @property {String} 720p + * @property {String} 1080p +*/ +export enum VideoResolution { + RESOLUTION_480P = '480p', + RESOLUTION_720P = '720p', + RESOLUTION_1080P = '1080p', +} +// 支持的语言 +export enum LanguageType { + EN = 'en', + 'ZH-CN' = 'zh-cn', + JA_JP = 'ja_JP', +} + +export type TDeviceList = { + cameraList: any[], + microphoneList: any[], + currentCamera: any, + currentMicrophone: any, +}; + +/* === 【原来 TUICallKit 对外暴露】=== */ +// 原来 web callKit 定义通知外部状态变更的变量, 对外暴露 +export const StatusChange = { + IDLE: "idle", + BE_INVITED: "be-invited", + DIALING_C2C: "dialing-c2c", + DIALING_GROUP: "dialing-group", + CALLING_C2C_AUDIO: "calling-c2c-audio", + CALLING_C2C_VIDEO: "calling-c2c-video", + CALLING_GROUP_AUDIO: "calling-group-audio", + CALLING_GROUP_VIDEO: "calling-group-video", +} as const; + +/* === 【小程序使用】=== */ +/** + * @property {String} ear 听筒 + * @property {String} speaker 免提 +*/ +export enum AudioPlayBackDevice { + EAR = 'ear', + SPEAKER = 'speaker', +}; + +export enum DeviceType { + MICROPHONE = 'microphone', + CAMERA = 'camera', + SPEAKER = 'speaker', +} + +export enum CameraPosition { + FRONT = 0, + BACK = 1, +} diff --git a/TUICallKit/TUICallService/const/error.ts b/TUICallKit/TUICallService/const/error.ts new file mode 100644 index 0000000..3607030 --- /dev/null +++ b/TUICallKit/TUICallService/const/error.ts @@ -0,0 +1,20 @@ +// 错误码 +export const ErrorCode: any = { + SWITCH_TO_AUDIO_CALL_FAILED: 60001, + SWITCH_TO_VIDEO_CALL_FAILED: 60002, + MICROPHONE_UNAVAILABLE: 60003, + CAMERA_UNAVAILABLE: 60004, + BAN_DEVICE: 60005, + NOT_SUPPORTED_WEBRTC: 60006, + ERROR_BLACKLIST: 20007, +} as const; + +export const ErrorMessage: any = { + SWITCH_TO_AUDIO_CALL_FAILED: 'switchToAudioCall-call-failed', + SWITCH_TO_VIDEO_CALL_FAILED: 'switchToVideoCall-call-failed', + MICROPHONE_UNAVAILABLE: 'microphone-unavailable', + CAMERA_UNAVAILABLE: 'camera-unavailable', + BAN_DEVICE: 'ban-device', + NOT_SUPPORTED_WEBRTC: 'not-supported-webrtc', + ERROR_BLACKLIST: 'blacklist-user-tips' +} as const; diff --git a/TUICallKit/TUICallService/const/index.js b/TUICallKit/TUICallService/const/index.js index 3ca1e32..f3584b7 100644 --- a/TUICallKit/TUICallService/const/index.js +++ b/TUICallKit/TUICallService/const/index.js @@ -26,7 +26,9 @@ exports.CALL_DATA_KEY = { CALL_ROLE: 'callRole', CALL_MEDIA_TYPE: 'callMediaType', LOCAL_USER_INFO: 'localUserInfo', + LOCAL_USER_INFO_EXCLUDE_VOLUMN: 'localUserInfoExcludeVolume', REMOTE_USER_INFO_LIST: 'remoteUserInfoList', + REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST: 'remoteUserInfoExcludeVolumeList', CALLER_USER_INFO: 'callerUserInfo', IS_GROUP: 'isGroup', CALL_DURATION: 'callDuration', @@ -47,7 +49,7 @@ exports.CALL_DATA_KEY = { ROOM_ID: 'roomID', SHOW_SELECT_USER: 'showSelectUser', }; -exports.NAME = Object.assign({ PREFIX: '【CallService】', AUDIO: 'audio', VIDEO: 'video', LOCAL_VIDEO: 'localVideo', ERROR: 'error', TIMEOUT: 'timeout', RAF: 'raf', INTERVAL: 'interval', DEFAULT: 'default', BOOLEAN: 'boolean', STRING: 'string', NUMBER: 'number', OBJECT: 'object', ARRAY: 'array', FUNCTION: 'function', UNDEFINED: "undefined", ALL: 'all', MYSELF: 'myself', DEVICE_LIST: 'deviceList' }, exports.CALL_DATA_KEY); +exports.NAME = Object.assign({ PREFIX: '【CallService】', AUDIO: 'audio', VIDEO: 'video', LOCAL_VIDEO: 'localVideo', ERROR: 'error', TIMEOUT: 'timeout', RAF: 'raf', INTERVAL: 'interval', DEFAULT: 'default', BOOLEAN: 'boolean', STRING: 'string', NUMBER: 'number', OBJECT: 'object', ARRAY: 'array', FUNCTION: 'function', UNDEFINED: "undefined", ALL: 'all', MYSELF: 'myself', DEVICE_LIST: 'deviceList', CAMERA_POSITION: 'cameraPosition' }, exports.CALL_DATA_KEY); exports.AudioCallIcon = 'https://web.sdk.qcloud.com/component/TUIKit/assets/call.png'; exports.VideoCallIcon = 'https://web.sdk.qcloud.com/component/TUIKit/assets/call-video-reverse.svg'; exports.MAX_NUMBER_ROOM_ID = 2147483647; diff --git a/TUICallKit/TUICallService/const/index.ts b/TUICallKit/TUICallService/const/index.ts new file mode 100644 index 0000000..dc16f0e --- /dev/null +++ b/TUICallKit/TUICallService/const/index.ts @@ -0,0 +1,70 @@ +export * from './call'; +export * from './error'; +export * from './log'; + +// import { keys } from 'ts-transformer-keys'; +// import { ICallStore } from '../interface/store'; +// console.warn('--> ', keys()) + +export const CALL_DATA_KEY: any = { + CALL_STATUS: 'callStatus', + CALL_ROLE: 'callRole', + CALL_MEDIA_TYPE: 'callMediaType', + LOCAL_USER_INFO: 'localUserInfo', + LOCAL_USER_INFO_EXCLUDE_VOLUMN: 'localUserInfoExcludeVolume', + REMOTE_USER_INFO_LIST: 'remoteUserInfoList', + REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST: 'remoteUserInfoExcludeVolumeList', + CALLER_USER_INFO: 'callerUserInfo', + IS_GROUP: 'isGroup', + CALL_DURATION: 'callDuration', + CALL_TIPS: 'callTips', + TOAST_INFO: 'toastInfo', + IS_MINIMIZED: 'isMinimized', + ENABLE_FLOAT_WINDOW: 'enableFloatWindow', + BIG_SCREEN_USER_ID: 'bigScreenUserId', + LANGUAGE: 'language', + IS_CLICKABLE: 'isClickable', + DISPLAY_MODE: 'displayMode', + VIDEO_RESOLUTION: 'videoResolution', + PUSHER: 'pusher', + PLAYER: 'player', + IS_EAR_PHONE: 'isEarPhone', + SHOW_PERMISSION_TIP: 'SHOW_PERMISSION_TIP', + GROUP_ID: 'groupID', + ROOM_ID: 'roomID', + SHOW_SELECT_USER: 'showSelectUser', +}; + +export const NAME = { + PREFIX: '【CallService】', + AUDIO: 'audio', + VIDEO: 'video', + LOCAL_VIDEO: 'localVideo', + ERROR: 'error', + TIMEOUT: 'timeout', + RAF: 'raf', + INTERVAL: 'interval', + DEFAULT: 'default', + BOOLEAN: 'boolean', + STRING: 'string', + NUMBER: 'number', + OBJECT: 'object', + ARRAY: 'array', + FUNCTION: 'function', + UNDEFINED: "undefined", + ALL: 'all', + MYSELF: 'myself', + DEVICE_LIST: 'deviceList', + CAMERA_POSITION: 'cameraPosition', + ...CALL_DATA_KEY, +}; + +export const AudioCallIcon = 'https://web.sdk.qcloud.com/component/TUIKit/assets/call.png'; +export const VideoCallIcon = 'https://web.sdk.qcloud.com/component/TUIKit/assets/call-video-reverse.svg'; +export const MAX_NUMBER_ROOM_ID = 2147483647; +export enum PLATFORM { + // eslint-disable-next-line no-unused-vars + MAC = 'mac', + // eslint-disable-next-line no-unused-vars + WIN = 'win', +} diff --git a/TUICallKit/TUICallService/const/log.ts b/TUICallKit/TUICallService/const/log.ts new file mode 100644 index 0000000..8c137d5 --- /dev/null +++ b/TUICallKit/TUICallService/const/log.ts @@ -0,0 +1,9 @@ +/* eslint-disable */ +// 唯一一个变量格式有问题的, 但是为了和原来 TUICallKit 对外暴露的保持一致 +export enum LOG_LEVEL { + NORMAL = 0, // 普通级别,日志量较多,接入时建议使用 + RELEASE = 1, // release级别,SDK 输出关键信息,生产环境时建议使用 + WARNING = 2, // 告警级别,SDK 只输出告警和错误级别的日志 + ERROR = 3, // 错误级别,SDK 只输出错误级别的日志 + NONE = 4, // 无日志级别,SDK 将不打印任何日志 +} diff --git a/TUICallKit/TUICallService/index.ts b/TUICallKit/TUICallService/index.ts new file mode 100644 index 0000000..8e76eec --- /dev/null +++ b/TUICallKit/TUICallService/index.ts @@ -0,0 +1,23 @@ +import TUICallService, { TUIGlobal, TUIStore } from './CallService/index'; +import { StoreName, NAME, CallRole, CallMediaType, CallStatus, StatusChange, VideoResolution, VideoDisplayMode, AudioPlayBackDevice } from './const/index'; +import { t } from './locales/index'; + +// 实例化 +const TUICallKitServer = TUICallService.getInstance(); + +// 输出产物 +export { + TUIGlobal, + TUIStore, + StoreName, + TUICallKitServer, + NAME, + CallStatus, + CallRole, + CallMediaType, + StatusChange, + VideoResolution, + VideoDisplayMode, + AudioPlayBackDevice, + t, +}; diff --git a/TUICallKit/TUICallService/interface/ICallService.ts b/TUICallKit/TUICallService/interface/ICallService.ts new file mode 100644 index 0000000..dc68769 --- /dev/null +++ b/TUICallKit/TUICallService/interface/ICallService.ts @@ -0,0 +1,97 @@ +import { CallStatus, CallRole } from '../const/index'; + +/** + * @interface ITUICallService +*/ +export interface ITUICallService { + + /** + * 初始化 Service + * @function + * @private + */ + init(params: any): void; + + /** + * 1v1 通话 + * @function + * @param {SwitchUserStatusParams} options 用户状态控制参数 + */ + call(callParams: ICallParams): void; +} + +type SDKAppID = { SDKAppID: number; } | { sdkAppID: number; }; +export interface IInitParamsBase { + userID: string; + userSig: string; + tim?: any; + isFromChat?: boolean; +} +export type IInitParams = IInitParamsBase & SDKAppID; +// call params interface +export interface ICallParams { + userID: string; + type: number; + roomID?: number; + userData?: string; + timeout?: number; + offlinePushInfo?: IOfflinePushInfo; +} +// groupCall params interface +export interface IGroupCallParams { + userIDList: Array; + type: number; + groupID: string; + roomID?: number; + userData?: string; + timeout?: number; + offlinePushInfo?: IOfflinePushInfo; +} +// userInfo interface +export interface IUserInfo { + userId: string; + nick?: string; + avatar?: string; + remark?: string; + displayUserInfo?: string; // 远端用户信息展示: remark -> nick -> userId, 简化 UI 组件; 本地用户信息展示: nick -> userId + isAudioAvailable?: boolean; // 用来设置: 麦克风是否打开 + isVideoAvailable?: boolean; // 用来设置: 摄像头是否打开 + volume?: number; + isEnter?: boolean; // 远端用户, 用来控制预览远端是否显示 loading 效果; 本地用户, 用来控制 "呼叫"、"接通" 接通后显示的 loading 效果 + domId?: string; // 播放流 dom 节点, localUserInfo 的 domId = 'localVideo'; remoteUserInfo 的 domId 就是 userId +} +export interface IOfflinePushInfo { + title?: string, + description?: string, + androidOPPOChannelID?: string, + extension: String +} +export interface ICallbackParam { + beforeCalling?: (...args: any[]) => void; + afterCalling?: (...args: any[]) => void; + onMinimized?: (...args: any[]) => void; + onMessageSentByMe?: (...args: any[]) => void; + kickedOut?: (...args: any[]) => void; + statusChanged?: (...args: any[]) => void; +} + +export interface ISelfInfoParams { + nickName: string; + avatar: string; +} + +export interface IBellParams { + callRole?: CallRole; + callStatus?: CallStatus; + isMuteBell?: boolean; + calleeBellFilePath?: string; +} +export interface IInviteUserParams { + userIDList: string[]; + offlinePushInfo?: IOfflinePushInfo; +} +export interface IJoinInGroupCallParams { + type: number; + groupID: string; + roomID: number; +} diff --git a/TUICallKit/TUICallService/interface/ICallStore.d.ts b/TUICallKit/TUICallService/interface/ICallStore.d.ts index 9dcd2e2..8eb280f 100644 --- a/TUICallKit/TUICallService/interface/ICallStore.d.ts +++ b/TUICallKit/TUICallService/interface/ICallStore.d.ts @@ -1,4 +1,4 @@ -import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList } from '../const/index'; +import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition } from '../const/index'; import { IUserInfo } from './index'; export interface IToastInfo { text: string; @@ -9,7 +9,9 @@ export interface ICallStore { callRole: CallRole; callMediaType: CallMediaType; localUserInfo: IUserInfo; + localUserInfoExcludeVolume: IUserInfo; remoteUserInfoList: Array; + remoteUserInfoExcludeVolumeList: Array; callerUserInfo: IUserInfo; isGroup: boolean; callDuration: string; @@ -24,6 +26,7 @@ export interface ICallStore { deviceList: TDeviceList; groupID: string; roomID: number; + cameraPosition: CameraPosition; displayMode: VideoDisplayMode; videoResolution: VideoResolution; pusher: any; diff --git a/TUICallKit/TUICallService/interface/ICallStore.ts b/TUICallKit/TUICallService/interface/ICallStore.ts new file mode 100644 index 0000000..9c91259 --- /dev/null +++ b/TUICallKit/TUICallService/interface/ICallStore.ts @@ -0,0 +1,41 @@ +import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition } from '../const/index'; +import { IUserInfo } from './index'; + +export interface IToastInfo { + text: string; + type?: string; // 默认 info 通知, 取值: 'info' | 'warn' | 'success' | 'error' +} +export interface ICallStore { + callStatus: CallStatus; // 当前的通话状态, 默认: 'idle' + callRole: CallRole; // 通话角色, 默认: 'callee' + callMediaType: CallMediaType; // 通话类型 + localUserInfo: IUserInfo; // 自己的信息, 默认: { userId: '' } + localUserInfoExcludeVolume: IUserInfo; // 不包含音量的当前用户信息 + remoteUserInfoList: Array; // 远端用户信息列表, 默认: [] + remoteUserInfoExcludeVolumeList: Array; // 不包含音量的远端用户信息列表 + // 被叫在未接通时,展示主叫的 userId、头像。但是如果主叫进入通话后再挂断,此时被叫无法知道主叫的信息了。 + // 因为目前 store 中仅提供了 remoteUserInfoList 数据,主叫离开后,被叫就没有主叫的信息了。因此考虑在 store 中增加 callerUserInfo 字段。 + callerUserInfo: IUserInfo; + isGroup: boolean; // 是否是群组通话, 默认: false + callDuration: string; // 通话时长, 默认: '00:00:00' + callTips: string; // 通话提示的信息. 例如: '等待谁接听', 'xxx 拒绝通话', 'xxx 挂断通话' + toastInfo: IToastInfo; // 远端用户挂断、拒绝、超时、忙线等的 toast 提示信息 + isMinimized: boolean; // 当前是否悬浮窗模式, 默认: false + enableFloatWindow: boolean, // 开启/关闭悬浮窗功能,默认: false + bigScreenUserId: string, // 当前大屏幕显示的 userID 用户 + language: string; // 当前语言 + isClickable: boolean; // 按钮是否可点击(呼叫后, '挂断' 按钮不可点击, 发送信令后才可以点击) + showPermissionTip: boolean; // 设备权限弹窗是否展示(如果有麦克风权限为 false,如果没有麦克风也没有摄像头权限为 true) + deviceList: TDeviceList; + groupID: string; + roomID: number; + cameraPosition: CameraPosition; // 前置或后置,值为front, back + // TUICallKit 组件上的属性 + displayMode: VideoDisplayMode; // 设置预览远端的画面显示模式, 默认: VideoDisplayMode.COVER + videoResolution: VideoResolution; // 设置视频分辨率, 默认: VideoResolution.RESOLUTION_480P + // 小程序相关属性 + pusher: any; + player: any[]; + isEarPhone: boolean; // 是否是听筒, 默认: false + showSelectUser: boolean; +} diff --git a/TUICallKit/TUICallService/interface/ITUIGlobal.ts b/TUICallKit/TUICallService/interface/ITUIGlobal.ts new file mode 100644 index 0000000..48b43fb --- /dev/null +++ b/TUICallKit/TUICallService/interface/ITUIGlobal.ts @@ -0,0 +1,38 @@ +/** + * @interface TUIGlobal + * @property {Object} global 根据运行环境代理 wx、uni、window + * @property {Boolean} isPC true 标识是 pc 网页 + * @property {Boolean} isH5 true 标识是 手机 H5 + * @property {Boolean} isWeChat true 标识是 微信小程序 + * @property {Boolean} isApp true 标识是 uniapp 打包的 native app + * @property {Boolean} isUniPlatform true 标识当前应用是通过 uniapp 平台打包的产物 + * @property {Boolean} isOfficial true 标识是腾讯云官网 Demo 应用 + * @property {Boolean} isWIN true 标识是window系统pc + * @property {Boolean} isMAC true 标识是mac os系统pc +*/ +export interface ITUIGlobal { + global: any; // 挂在 wx、uni、window 对象 + isPC: boolean; + isH5: boolean; + isWeChat: boolean; + isApp: boolean; + isUniPlatform: boolean; + isOfficial: boolean; + isWIN: boolean; + isMAC: boolean; + + /** + * 初始化 TUIGlobal 环境变量 + * @function + * @private + */ + initEnv(): void; + + /** + * 初始化 isOfficial + * @function + * @param {number} SDKAppID 当前实例的应用 SDKAppID + * @private + */ + initOfficial(SDKAppID: number): void; +} diff --git a/TUICallKit/TUICallService/interface/ITUIStore.ts b/TUICallKit/TUICallService/interface/ITUIStore.ts new file mode 100644 index 0000000..c325355 --- /dev/null +++ b/TUICallKit/TUICallService/interface/ITUIStore.ts @@ -0,0 +1,85 @@ +import { StoreName } from '../const/index'; + +// 此处 Map 的 value = 1 为占位作用 +export type Task = Record void, 1>>> + +export interface IOptions { + [key: string]: (newData?: any) => void; +} + +/** + * @class TUIStore + * @property {ICustomStore} customStore 自定义 store,可根据业务需要通过以下 API 进行数据操作。 +*/ +export interface ITUIStore { + task: Task; + + /** + * UI 组件注册监听 + * @function + * @param {StoreName} storeName store 名称 + * @param {IOptions} options UI 组件注册的监听信息 + * @param {Object} params 扩展参数 + * @param {String} params.notifyRangeWhenWatch 注册时监听时的通知范围 + * @example + * // UI 层监听会话列表更新通知 + * let onConversationListUpdated = function(conversationList) { + * console.warn(conversationList); + * } + * TUIStore.watch(StoreName.CONV, { + * conversationList: onConversationListUpdated, + * }) + */ + watch(storeName: StoreName, options: IOptions, params?: any): void; + + /** + * UI 组件取消监听回调 + * @function + * @param {StoreName} storeName store 名称 + * @param {IOptions} options 监听信息,包含需要取消的回调等 + * @example + * // UI 层取消监听会话列表更新通知 + * TUIStore.unwatch(StoreName.CONV, { + * conversationList: onConversationListUpdated, + * }) + */ + unwatch(storeName: StoreName, options: IOptions | string): void; + + /** + * 获取 store 中的数据 + * @function + * @param {StoreName} storeName store 名称 + * @param {String} key 需要获取的 key + * @private + */ + getData(storeName: StoreName, key: string): any; + + /** + * 更新 store + * - 需要使用自定义 store 时可以用此 API 更新自定义数据 + * @function + * @param {StoreName} storeName store 名称 + * @param {String} key 需要更新的 key + * @example + * // UI 层更新自定义 Store 数据 + * TUIStore.update(StoreName.CUSTOM, 'customKey', 'customData') + */ + update(storeName: StoreName, key: string, data: unknown): void; + + /** + * 重置 store 内数据 + * @function + * @param {StoreName} storeName store 名称 + * @param {Array} keyList 需要 reset 的 keyList + * @param {boolean} isNotificationNeeded 是否需要触发更新 + * @private + */ + reset: (storeName: StoreName, keyList?: Array, isNotificationNeeded?: boolean) => void; + + /** + * 修改多个 key-value + * @param {Object} params 多个 key-value 组成的 object + * @param {StoreName} storeName store 名称 + */ + updateStore: (params: any, name?: StoreName) => void; +} diff --git a/TUICallKit/TUICallService/interface/index.ts b/TUICallKit/TUICallService/interface/index.ts new file mode 100644 index 0000000..5f8f48c --- /dev/null +++ b/TUICallKit/TUICallService/interface/index.ts @@ -0,0 +1,4 @@ +export * from './ICallService'; +export * from './ICallStore'; +export * from './ITUIGlobal'; +export * from './ITUIStore'; diff --git a/TUICallKit/TUICallService/locales/en.d.ts b/TUICallKit/TUICallService/locales/en.d.ts index c7efd74..9976a1a 100644 --- a/TUICallKit/TUICallService/locales/en.d.ts +++ b/TUICallKit/TUICallService/locales/en.d.ts @@ -1,25 +1,54 @@ export declare const en: { hangup: string; reject: string; + accept: string; + camera: string; + microphone: string; + speaker: string; + 'open camera': string; + 'close camera': string; + 'open microphone': string; + 'close microphone': string; + 'video-to-audio': string; 'other side reject call': string; 'reject call': string; - accept: string; cancel: string; 'other side line busy': string; 'in busy': string; 'call timeout': string; 'no response from the other side': string; 'end call': string; - timeout: string; - 'kick out': string; 'caller calling message': string; 'callee calling video message': string; 'callee calling audio message': string; 'no microphone access': string; 'no camera access': string; 'invite member': string; - speaker: string; 'Invited group call': string; + waiting: string; + me: string; + 'browser-authorization': string; + 'mac-privacy': string; + 'win-privacy': string; + 'mac-preferences': string; + 'win-preferences': string; + 'Please enter userID': string; + 'View more': string; + 'people selected': string; + 'Select all': string; + Cancel: string; + Done: string; + 'camera enabled': string; + 'camera disabled': string; + 'microphone enabled': string; + 'microphone disabled': string; + 'speaker phone': string; + 'ear piece': string; + 'wait to be called': string; + answered: string; + 'people in the call': string; + 'failed to obtain speakers': string; + 'you have a new call': string; 'Those involved': string; call: string; 'video-call': string; @@ -35,18 +64,15 @@ export declare const en: { 'not-support-multi-call': string; userID: string; 'already-enter': string; - waiting: string; 'camera-opened': string; 'camera-closed': string; 'microphone-opened': string; 'microphone-closed': string; - camera: string; - microphone: string; + timeout: string; + 'kick out': string; 'image-resolution': string; 'default-image-resolution': string; 'invited-person': string; - 'video-to-audio': string; - me: string; 'be-rejected': string; 'be-no-response': string; 'be-line-busy': string; @@ -72,19 +98,4 @@ export declare const en: { 'accept-error': string; 'accept-device-error': string; 'call-error': string; - 'browser-authorization': string; - 'mac-privacy': string; - 'win-privacy': string; - 'mac-preferences': string; - 'win-preferences': string; - 'open camera': string; - 'close camera': string; - 'open microphone': string; - 'close microphone': string; - 'Please enter userID': string; - 'View more': string; - 'people selected': string; - 'Select all': string; - Cancel: string; - Done: string; }; diff --git a/TUICallKit/TUICallService/locales/en.js b/TUICallKit/TUICallService/locales/en.js index 9188607..5d2d1fb 100644 --- a/TUICallKit/TUICallService/locales/en.js +++ b/TUICallKit/TUICallService/locales/en.js @@ -2,27 +2,62 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.en = void 0; exports.en = { + // 按钮文案 'hangup': 'Hang up', 'reject': 'Decline', + 'accept': 'Accept', + 'camera': 'Camera', + 'microphone': 'Microphone', + 'speaker': 'speaker', + 'open camera': 'Open Camera', + 'close camera': 'Close Camera', + 'open microphone': 'Open Microphone', + 'close microphone': 'Close Microphone', + 'video-to-audio': 'Switch to audio', + // 通话结果 'other side reject call': 'other side reject call', 'reject call': 'Reject Call', - 'accept': 'Accept', 'cancel': 'Cancel Call', 'other side line busy': 'other side line busy', 'in busy': 'in busy', 'call timeout': 'call timeout', 'no response from the other side': 'no response from the other side', 'end call': 'end call', - 'timeout': 'timeout', - 'kick out': 'kick out', - 'caller calling message': 'Waiting for the callee to accept the invitation...', - 'callee calling video message': 'You are invited to a video call...', - 'callee calling audio message': 'You are invited to a audio call...', + // 通话提示语 + 'caller calling message': 'Awaiting response', + 'callee calling video message': 'invites you to a video call', + 'callee calling audio message': 'invites you to a voice call', 'no microphone access': 'no microphone access', 'no camera access': 'no camera access', 'invite member': 'Invite Member', - 'speaker': 'speaker', - 'Invited group call': 'Invited you to a group call', + 'Invited group call': 'invites you to a group call', + 'waiting': 'Calling...', + 'me': '(me)', + // 弹出层文案 + 'browser-authorization': 'Browser authorization', + 'mac-privacy': 'System Preferences -> Security and Privacy -> Privacy', + 'win-privacy': 'Setting -> Privacy and Security -> App permissions', + 'mac-preferences': 'Open System Preferences', + 'win-preferences': 'Open Setting', + 'Please enter userID': 'Please enter userID', + 'View more': 'View more', + 'people selected': 'people selected', + 'Select all': 'Select all', + 'Cancel': 'Cancel', + 'Done': 'Done', + // UI3.0 新增 + 'camera enabled': 'Camera On', + 'camera disabled': 'Camera Off', + 'microphone enabled': 'Unmuted', + 'microphone disabled': 'Muted', + 'speaker phone': 'Speaker', + 'ear piece': 'Earpiece', + 'wait to be called': 'Waiting', + 'answered': 'Connected', + 'people in the call': ' other(s) in the call', + 'failed to obtain speakers': 'failed to obtain speakers', + 'you have a new call': 'You have a new call', + // 待废弃文案 'Those involved': 'Those involved in the call are', 'call': 'call', 'video-call': 'video call', @@ -38,18 +73,15 @@ exports.en = { 'not-support-multi-call': 'multi-person call interface is not open', 'userID': 'userID', 'already-enter': 'entered the call', - 'waiting': 'Calling...', 'camera-opened': 'Camera on', 'camera-closed': 'Camera off', 'microphone-opened': 'Mic on', 'microphone-closed': 'Mic off', - 'camera': 'Camera', - 'microphone': 'Microphone', + 'timeout': 'timeout', + 'kick out': 'kick out', 'image-resolution': 'Resolution', 'default-image-resolution': 'Default', 'invited-person': 'Invite', - 'video-to-audio': 'Switch to audio', - 'me': '(me)', 'be-rejected': 'Call declined, ', 'be-no-response': 'No response, ', 'be-line-busy': 'Line busy, ', @@ -75,19 +107,4 @@ exports.en = { 'accept-error': 'Accept failed', 'accept-device-error': 'Accept failed, unable to auth calling device', 'call-error': 'Start call failed', - 'browser-authorization': 'Browser authorization', - 'mac-privacy': 'System Preferences -> Security and Privacy -> Privacy', - 'win-privacy': 'Setting -> Privacy and Security -> App permissions', - 'mac-preferences': 'Open System Preferences', - 'win-preferences': 'Open Setting', - 'open camera': 'Open Camera', - 'close camera': 'Close Camera', - 'open microphone': 'Open Microphone', - 'close microphone': 'Close Microphone', - 'Please enter userID': 'Please enter userID', - 'View more': 'View more', - 'people selected': 'people selected', - 'Select all': 'Select all', - 'Cancel': 'Cancel', - 'Done': 'Done', }; diff --git a/TUICallKit/TUICallService/locales/en.ts b/TUICallKit/TUICallService/locales/en.ts new file mode 100644 index 0000000..b96d213 --- /dev/null +++ b/TUICallKit/TUICallService/locales/en.ts @@ -0,0 +1,107 @@ +export const en = { + // 按钮文案 + 'hangup': 'Hang up', + 'reject': 'Decline', + 'accept': 'Accept', + 'camera': 'Camera', + 'microphone': 'Microphone', + 'speaker': 'speaker', + 'open camera': 'Open Camera', + 'close camera': 'Close Camera', + 'open microphone': 'Open Microphone', + 'close microphone': 'Close Microphone', + 'video-to-audio': 'Switch to audio', + // 通话结果 + 'other side reject call': 'other side reject call', + 'reject call': 'Reject Call', + 'cancel': 'Cancel Call', + 'other side line busy': 'other side line busy', + 'in busy': 'in busy', + 'call timeout': 'call timeout', + 'no response from the other side': 'no response from the other side', + 'end call': 'end call', + // 通话提示语 + 'caller calling message': 'Awaiting response', + 'callee calling video message': 'invites you to a video call', + 'callee calling audio message': 'invites you to a voice call', + 'no microphone access': 'no microphone access', + 'no camera access': 'no camera access', + 'invite member': 'Invite Member', + 'Invited group call': 'invites you to a group call', + 'waiting': 'Calling...', + 'me': '(me)', + // 弹出层文案 + 'browser-authorization': 'Browser authorization', + 'mac-privacy': 'System Preferences -> Security and Privacy -> Privacy', + 'win-privacy': 'Setting -> Privacy and Security -> App permissions', + 'mac-preferences': 'Open System Preferences', + 'win-preferences': 'Open Setting', + 'Please enter userID': 'Please enter userID', + 'View more': 'View more', + 'people selected': 'people selected', + 'Select all': 'Select all', + 'Cancel': 'Cancel', + 'Done': 'Done', + // UI3.0 新增 + 'camera enabled': 'Camera On', + 'camera disabled': 'Camera Off', + 'microphone enabled': 'Unmuted', + 'microphone disabled': 'Muted', + 'speaker phone': 'Speaker', + 'ear piece': 'Earpiece', + 'wait to be called': 'Waiting', + 'answered': 'Connected', + 'people in the call': ' other(s) in the call', + 'failed to obtain speakers': 'failed to obtain speakers', + 'you have a new call': 'You have a new call', + // 待废弃文案 + 'Those involved': 'Those involved in the call are', + 'call': 'call', + 'video-call': 'video call', + 'audio-call': 'audio call', + 'search': 'search', + 'search-result': 'search result', + 'no-user': 'user not found', + 'member-not-added': 'member not added', + 'input-phone-userID': 'phone number or userID', + 'not-login': 'not logged in', + 'login-status-expire': 'login status is invalid, please refresh the page and try again', + 'experience-multi-call': 'experience multi-person calls, please download the full-featured demo: ', + 'not-support-multi-call': 'multi-person call interface is not open', + 'userID': 'userID', + 'already-enter': 'entered the call', + 'camera-opened': 'Camera on', + 'camera-closed': 'Camera off', + 'microphone-opened': 'Mic on', + 'microphone-closed': 'Mic off', + 'timeout': 'timeout', + 'kick out': 'kick out', + 'image-resolution': 'Resolution', + 'default-image-resolution': 'Default', + 'invited-person': 'Invite', + 'be-rejected': 'Call declined, ', + 'be-no-response': 'No response, ', + 'be-line-busy': 'Line busy, ', + 'be-canceled': 'The call is canceled, ', + 'voice-call-end': 'Voice call ended', + 'video-call-end': 'Video call ended', + 'method-call-failed': 'Failed to sync the operation', + 'failed-to-obtain-permission': 'Failed to obtain permissions', + 'environment-detection-failed': 'Failed to check the environment', + 'switchToAudioCall-call-failed': 'switch to audio call method failed', + 'switchToVideoCall-call-failed': 'switch to video call method failed', + 'microphone-unavailable': 'No mic found', + 'camera-unavailable': 'No camera found', + 'ban-device': 'Device access denied', + 'not-supported-webrtc': 'Your current environment does not support WebRTC', + 'blacklist-user-tips': 'The identifier is in blacklist. Failed to send this message!', + 'is-already-calling': 'TUICallKit is already on a call', + 'need-init': 'Before initiating a call with TUICallKit, ensure that the TUICallKitServer.init() method has executed successfully. ', + "can't call yourself": "Can't call yourself", // eslint-disable-line + 'Use-phone-and-computer': 'Use your mobile phone and computer to experience video calls', + 'Wechat scan right QR code': 'Wechat scan right QR code', + 'Scan the QR code above': 'Scan the QR code above', + 'accept-error': 'Accept failed', + 'accept-device-error': 'Accept failed, unable to auth calling device', + 'call-error': 'Start call failed', +}; diff --git a/TUICallKit/TUICallService/locales/index.js b/TUICallKit/TUICallService/locales/index.js index 12a5316..88f17f2 100644 --- a/TUICallKit/TUICallService/locales/index.js +++ b/TUICallKit/TUICallService/locales/index.js @@ -18,6 +18,7 @@ exports.CallTips = { TIMEOUT: 'timeout', KICK_OUT: 'kick out', CALLER_CALLING_MSG: 'caller calling message', + CALLER_GROUP_CALLING_MSG: 'wait to be called', CALLEE_CALLING_VIDEO_MSG: 'callee calling video message', CALLEE_CALLING_AUDIO_MSG: 'callee calling audio message', NO_MICROPHONE_DEVICE_PERMISSION: 'no microphone access', diff --git a/TUICallKit/TUICallService/locales/index.ts b/TUICallKit/TUICallService/locales/index.ts new file mode 100644 index 0000000..6fc923c --- /dev/null +++ b/TUICallKit/TUICallService/locales/index.ts @@ -0,0 +1,57 @@ +import { TUIStore } from '../CallService/index'; +import { NAME, StoreName } from '../const/index'; +import { en } from './en'; +import { zh } from './zh-cn'; +import { ja_JP } from './ja_JP'; + +export const CallTips: any = { + OTHER_SIDE: 'other side', + CANCEL: 'cancel', + OTHER_SIDE_REJECT_CALL: 'other side reject call', + REJECT_CALL: 'reject call', + OTHER_SIDE_LINE_BUSY: 'other side line busy', + IN_BUSY: 'in busy', + CALL_TIMEOUT: 'call timeout', + END_CALL: 'end call', + TIMEOUT: 'timeout', + KICK_OUT: 'kick out', + CALLER_CALLING_MSG: 'caller calling message', + CALLER_GROUP_CALLING_MSG: 'wait to be called', + CALLEE_CALLING_VIDEO_MSG: 'callee calling video message', + CALLEE_CALLING_AUDIO_MSG: 'callee calling audio message', + NO_MICROPHONE_DEVICE_PERMISSION: 'no microphone access', + NO_CAMERA_DEVICE_PERMISSION: 'no camera access', +}; + +export const languageData: languageDataType = { + en, + 'zh-cn': zh, + ja_JP, +}; + +// language translate +export function t(key: any): string { + const language = TUIStore.getData(StoreName.CALL, NAME.LANGUAGE); + // eslint-disable-next-line + for (const langKey in languageData) { + if (langKey === language) { + const currentLanguage = languageData[langKey]; + // eslint-disable-next-line + for (const sentenceKey in currentLanguage) { + if (sentenceKey === key) { + return currentLanguage[sentenceKey]; + } + } + } + } + const enString = key['en']?.key; // eslint-disable-line + console.error(`${NAME.PREFIX}translation is not found: ${key}.`); + return enString; +} + +interface languageItemType { + [key: string]: string; +} +interface languageDataType { + [key: string]: languageItemType; +} diff --git a/TUICallKit/TUICallService/locales/ja_JP.d.ts b/TUICallKit/TUICallService/locales/ja_JP.d.ts index d03dfc7..2b2af4a 100644 --- a/TUICallKit/TUICallService/locales/ja_JP.d.ts +++ b/TUICallKit/TUICallService/locales/ja_JP.d.ts @@ -1,23 +1,50 @@ export declare const ja_JP: { hangup: string; reject: string; + accept: string; + camera: string; + microphone: string; + speaker: string; 'other side reject call': string; 'reject call': string; - accept: string; cancel: string; 'other side line busy': string; 'in busy': string; 'call timeout': string; 'end call': string; - timeout: string; - 'kick out': string; 'caller calling message': string; 'callee calling video message': string; 'callee calling audio message': string; 'no microphone access': string; 'no camera access': string; 'invite member': string; - speaker: string; + 'browser-authorization': string; + 'mac-privacy': string; + 'win-privacy': string; + 'mac-preferences': string; + 'win-preferences': string; + 'Please enter userID': string; + 'View more': string; + 'people selected': string; + 'Select all': string; + Cancel: string; + Done: string; + 'open camera': string; + 'close camera': string; + 'open microphone': string; + 'close microphone': string; + 'camera enabled': string; + 'camera disabled': string; + 'microphone enabled': string; + 'microphone disabled': string; + 'speaker phone': string; + 'wait to be called': string; + answered: string; + 'people in the call': string; + 'failed to obtain speakers': string; + 'you have a new call': string; + timeout: string; + 'kick out': string; 'Invited group call': string; 'Those involved': string; call: string; @@ -42,8 +69,6 @@ export declare const ja_JP: { 'camera-closed': string; 'microphone-opened': string; 'microphone-closed': string; - camera: string; - microphone: string; 'image-resolution': string; 'default-image-resolution': string; 'invited-person': string; @@ -71,15 +96,4 @@ export declare const ja_JP: { 'accept-error': string; 'accept-device-error': string; 'call-error': string; - 'browser-authorization': string; - 'mac-privacy': string; - 'win-privacy': string; - 'mac-preferences': string; - 'win-preferences': string; - 'Please enter userID': string; - 'View more': string; - 'people selected': string; - 'Select all': string; - Cancel: string; - Done: string; }; diff --git a/TUICallKit/TUICallService/locales/ja_JP.js b/TUICallKit/TUICallService/locales/ja_JP.js index ca52108..ca579b1 100644 --- a/TUICallKit/TUICallService/locales/ja_JP.js +++ b/TUICallKit/TUICallService/locales/ja_JP.js @@ -2,25 +2,58 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ja_JP = void 0; exports.ja_JP = { + // 按钮文案 'hangup': '通話終了', 'reject': '拒否', + 'accept': '応答', + 'camera': 'カメラ', + 'microphone': 'マイク', + 'speaker': 'スピーカー', + // 通话结果 'other side reject call': '通話が拒否されました', 'reject call': '通話拒否', - 'accept': '応答', 'cancel': '通話をキャンセル', 'other side line busy': '相手が通話中です', 'in busy': '通話中', 'call timeout': '呼び出しタイムアウト', 'end call': '通話終了', - 'timeout': 'タイムアウト', - 'kick out': 'キックアウトされました', - 'caller calling message': '相手が招待を承諾するのを待っています。', - 'callee calling video message': 'ビデオ通話に招待されました。', - 'callee calling audio message': '音声通話に招待されました。', + // 通话提示语 + 'caller calling message': '応答を待っています', + 'callee calling video message': 'ビデオ通話に招待されました', + 'callee calling audio message': '音声通話に招待されました', 'no microphone access': 'マイクにアクセスできません', 'no camera access': 'カメラにアクセスできません', 'invite member': 'メンバーを招待する', - 'speaker': 'スピーカー', + // 弹出层文案 + 'browser-authorization': 'ブラウザ認証', + 'mac-privacy': 'システム環境設定 -> セキュリティとプライバシー ->プライバシー', + 'win-privacy': '設定 -> セキュリティとプライバシー ->アプリのアクセス許可', + 'mac-preferences': 'システム環境設定を開く', + 'win-preferences': 'システム設定を開く', + 'Please enter userID': 'ユーザーIDを入力してください', + 'View more': 'もっと見る', + 'people selected': '人が選択されました', + 'Select all': 'すべて選択', + 'Cancel': 'キャンセル', + 'Done': '完了', + // UI3.0文案 + 'open camera': 'オープンカメラ', + 'close camera': 'カメラを閉じる', + 'open microphone': 'オープンマイク', + 'close microphone': 'マイクを閉じる', + 'camera enabled': 'カメラオン', + 'camera disabled': 'カメラオフ', + 'microphone enabled': 'マイクオン', + 'microphone disabled': 'マイクオフ', + 'speaker phone': 'スピーカーオン', + 'wait to be called': '待機中', + 'answered': '接続済み', + 'people in the call': '通話に参加している人たち', + 'failed to obtain speakers': 'スピーカーが見つかりません', + 'you have a new call': '新しい通話があります', + // 待废弃文案 + 'timeout': 'タイムアウト', + 'kick out': 'キックアウトされました', 'Invited group call': 'グループ通話に招待されました。', 'Those involved': '参加者:', 'call': '通話', @@ -45,13 +78,11 @@ exports.ja_JP = { 'camera-closed': 'カメラがオフになっています', 'microphone-opened': 'マイクがオンになっています', 'microphone-closed': 'マイクがオフになっています', - 'camera': 'カメラ', - 'microphone': 'マイク', 'image-resolution': '解像度', 'default-image-resolution': 'デフォルト解像度', 'invited-person': 'メンバーを招待', 'video-to-audio': '音声通話に切り替えます', - 'me': '(自分)', + 'me': '(自分)', 'be-rejected': '通話が拒否されました, ', 'be-no-response': '応答なし, ', 'be-line-busy': '相手が通話中です, ', @@ -74,15 +105,4 @@ exports.ja_JP = { 'accept-error': '接続できませんでした', 'accept-device-error': '接続できませんでした。発信側デバイスを認証できません', 'call-error': '通話が開始できませんでした', - 'browser-authorization': 'ブラウザ認証', - 'mac-privacy': 'システム環境設定 -> セキュリティとプライバシー ->プライバシー', - 'win-privacy': '設定 -> セキュリティとプライバシー ->アプリのアクセス許可', - 'mac-preferences': 'システム環境設定を開く', - 'win-preferences': 'システム設定を開く', - 'Please enter userID': 'ユーザーIDを入力してください', - 'View more': 'もっと見る', - 'people selected': '人が選択されました', - 'Select all': 'すべて選択', - 'Cancel': 'キャンセル', - 'Done': '完了', }; diff --git a/TUICallKit/TUICallService/locales/ja_JP.ts b/TUICallKit/TUICallService/locales/ja_JP.ts new file mode 100644 index 0000000..fd4cbe0 --- /dev/null +++ b/TUICallKit/TUICallService/locales/ja_JP.ts @@ -0,0 +1,105 @@ +export const ja_JP = { + // 按钮文案 + 'hangup': '通話終了', + 'reject': '拒否', + 'accept': '応答', + 'camera': 'カメラ', + 'microphone': 'マイク', + 'speaker': 'スピーカー', + // 通话结果 + 'other side reject call': '通話が拒否されました', + 'reject call': '通話拒否', + 'cancel': '通話をキャンセル', + 'other side line busy': '相手が通話中です', + 'in busy': '通話中', + 'call timeout': '呼び出しタイムアウト', + 'end call': '通話終了', + // 通话提示语 + 'caller calling message': '応答を待っています', + 'callee calling video message': 'ビデオ通話に招待されました', + 'callee calling audio message': '音声通話に招待されました', + 'no microphone access': 'マイクにアクセスできません', + 'no camera access': 'カメラにアクセスできません', + 'invite member': 'メンバーを招待する', + // 弹出层文案 + 'browser-authorization': 'ブラウザ認証', + 'mac-privacy': 'システム環境設定 -> セキュリティとプライバシー ->プライバシー', + 'win-privacy': '設定 -> セキュリティとプライバシー ->アプリのアクセス許可', + 'mac-preferences': 'システム環境設定を開く', + 'win-preferences': 'システム設定を開く', + 'Please enter userID': 'ユーザーIDを入力してください', + 'View more': 'もっと見る', + 'people selected': '人が選択されました', + 'Select all': 'すべて選択', + 'Cancel': 'キャンセル', + 'Done': '完了', + // UI3.0文案 + 'open camera': 'オープンカメラ', + 'close camera': 'カメラを閉じる', + 'open microphone': 'オープンマイク', + 'close microphone': 'マイクを閉じる', + 'camera enabled': 'カメラオン', + 'camera disabled': 'カメラオフ', + 'microphone enabled': 'マイクオン', + 'microphone disabled': 'マイクオフ', + 'speaker phone': 'スピーカーオン', + 'wait to be called': '待機中', + 'answered': '接続済み', + 'people in the call': '通話に参加している人たち', + 'failed to obtain speakers': 'スピーカーが見つかりません', + 'you have a new call': '新しい通話があります', + // 待废弃文案 + 'timeout': 'タイムアウト', + 'kick out': 'キックアウトされました', + 'Invited group call': 'グループ通話に招待されました。', + 'Those involved': '参加者:', + 'call': '通話', + 'video-call': 'ビデオ通話', + 'audio-call': '音声通話', + 'search': '検索', + 'search-result': '検索結果', + 'Wechat scan right QR code': 'WeChatで右側にあるQRコードを読み取ります。', + 'Use-phone-and-computer': '携帯電話とコンピュータを使用してビデオ通話を体験してください', + 'Scan the QR code above': '上のQRコードを読み取ります。', + 'no-user': 'ユーザーが見つかりませんでした', + 'member-not-added': 'メンバーが追加されていません', + 'not-login': 'ログインしていません', + 'login-status-expire': 'ログインの有効期限が過ぎています。ページを更新してもう一度お試しください', + 'experience-multi-call': '複数人で同時に音声通話できるグループ通話機能を体験するには、全機能のデモをダウンロードしてください', + 'not-support-multi-call': 'グループ通話インターフェイスが開いていません', + 'input-phone-userID': '携帯電話番号/ユーザーIDを入力してください', + 'userID': 'ユーザーID', + 'already-enter': 'すでに通話に参加しています', + 'waiting': '応答を待っています...', + 'camera-opened': 'カメラがオンになっています', + 'camera-closed': 'カメラがオフになっています', + 'microphone-opened': 'マイクがオンになっています', + 'microphone-closed': 'マイクがオフになっています', + 'image-resolution': '解像度', + 'default-image-resolution': 'デフォルト解像度', + 'invited-person': 'メンバーを招待', + 'video-to-audio': '音声通話に切り替えます', + 'me': '(自分)', + 'be-rejected': '通話が拒否されました, ', + 'be-no-response': '応答なし, ', + 'be-line-busy': '相手が通話中です, ', + 'be-canceled': '相手が通話をキャンセルしました', + 'voice-call-end': '音声通話が終了しました', + 'video-call-end': 'ビデオ通話が終了しました', + 'method-call-failed': '操作の同期に失敗しました', + 'failed-to-obtain-permission': '権限の取得に失敗しました', + 'environment-detection-failed': '環境の検出に失敗しました', + 'switchToAudioCall-call-failed': '音声通話に切り替えることはできません', + 'switchToVideoCall-call-failed': 'ビデオ通話に切り替えることはできません', + 'microphone-unavailable': '使用できるマイクがありません', + 'camera-unavailable': '使用できるカメラがありません', + 'ban-device': 'デバイスへのアクセスが拒否されました', + 'not-supported-webrtc': '現在の環境はWebRTCをサポートしていません', + 'blacklist-user-tips': 'ユーザーはブラックリストに登録され、通話が開始できませんでした', + 'is-already-calling': 'TUICallKit はすでに通話中です', + 'need-init': 'TUICallKitで通話を開始する前に、TUICallKitServer.init() メソッドが正常に実行されたことを確認してください。', + "can't call yourself": '自分に電話をかけることができません', + 'accept-error': '接続できませんでした', + 'accept-device-error': '接続できませんでした。発信側デバイスを認証できません', + 'call-error': '通話が開始できませんでした', +}; diff --git a/TUICallKit/TUICallService/locales/zh-cn.d.ts b/TUICallKit/TUICallService/locales/zh-cn.d.ts index 369b1c7..d6dc968 100644 --- a/TUICallKit/TUICallService/locales/zh-cn.d.ts +++ b/TUICallKit/TUICallService/locales/zh-cn.d.ts @@ -1,25 +1,56 @@ export declare const zh: { hangup: string; reject: string; + accept: string; + camera: string; + microphone: string; + speaker: string; + 'open camera': string; + 'close camera': string; + 'open microphone': string; + 'close microphone': string; + 'video-to-audio': string; 'other side reject call': string; 'reject call': string; - accept: string; cancel: string; 'other side line busy': string; 'in busy': string; 'call timeout': string; 'end call': string; - timeout: string; - 'kick out': string; 'caller calling message': string; 'callee calling video message': string; 'callee calling audio message': string; 'no microphone access': string; 'no camera access': string; 'invite member': string; - speaker: string; 'Invited group call': string; 'Those involved': string; + waiting: string; + me: string; + 'browser-authorization': string; + 'mac-privacy': string; + 'win-privacy': string; + 'mac-preferences': string; + 'win-preferences': string; + 'Please enter userID': string; + 'View more': string; + 'people selected': string; + 'Select all': string; + Cancel: string; + Done: string; + 'camera enabled': string; + 'camera disabled': string; + 'microphone enabled': string; + 'microphone disabled': string; + 'speaker phone': string; + 'ear piece': string; + 'wait to be called': string; + answered: string; + 'people in the call': string; + 'failed to obtain speakers': string; + 'you have a new call': string; + timeout: string; + 'kick out': string; call: string; 'video-call': string; 'audio-call': string; @@ -37,18 +68,9 @@ export declare const zh: { 'input-phone-userID': string; userID: string; 'already-enter': string; - waiting: string; - 'camera-opened': string; - 'camera-closed': string; - 'microphone-opened': string; - 'microphone-closed': string; - camera: string; - microphone: string; 'image-resolution': string; 'default-image-resolution': string; 'invited-person': string; - 'video-to-audio': string; - me: string; 'be-rejected': string; 'be-no-response': string; 'be-line-busy': string; @@ -71,19 +93,4 @@ export declare const zh: { 'accept-error': string; 'accept-device-error': string; 'call-error': string; - 'browser-authorization': string; - 'mac-privacy': string; - 'win-privacy': string; - 'mac-preferences': string; - 'win-preferences': string; - 'open camera': string; - 'close camera': string; - 'open microphone': string; - 'close microphone': string; - 'Please enter userID': string; - 'View more': string; - 'people selected': string; - 'Select all': string; - Cancel: string; - Done: string; }; diff --git a/TUICallKit/TUICallService/locales/zh-cn.js b/TUICallKit/TUICallService/locales/zh-cn.js index ac854ae..881df3c 100644 --- a/TUICallKit/TUICallService/locales/zh-cn.js +++ b/TUICallKit/TUICallService/locales/zh-cn.js @@ -2,27 +2,64 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.zh = void 0; exports.zh = { + // 按钮文案 'hangup': '挂断', 'reject': '拒绝', + 'accept': '接受', + 'camera': '摄像头', + 'microphone': '麦克风', + 'speaker': '扬声器', + 'open camera': '打开摄像头', + 'close camera': '关闭摄像头', + 'open microphone': '打开麦克风', + 'close microphone': '关闭麦克风', + 'video-to-audio': '转语音通话', + // 通话结果 'other side reject call': '对方已拒绝', 'reject call': '拒绝通话', - 'accept': '接受', 'cancel': '取消通话', 'other side line busy': '对方忙线', 'in busy': '正在忙', 'call timeout': '呼叫超时', 'end call': '结束通话', - 'timeout': '超时', - 'kick out': '被踢', - 'caller calling message': '正在等待对方接受邀请…', - 'callee calling video message': '邀请您进行视频通话…', - 'callee calling audio message': '邀请您进行语音通话…', + // 通话提示语 + 'caller calling message': '等待对方接受邀请', + 'callee calling video message': '邀请你视频通话', + 'callee calling audio message': '邀请你语音通话', 'no microphone access': '没有麦克风权限', 'no camera access': '没有摄像头权限', 'invite member': '邀请成员', - 'speaker': '扬声器', - 'Invited group call': '邀请你参加多人通话', + 'Invited group call': '邀请你加入多人通话', 'Those involved': '参与通话的有:', + 'waiting': '等待接听...', + 'me': '(我)', + // 弹出层文案 + 'browser-authorization': '浏览器授权', + 'mac-privacy': '系统偏好设置 -> 安全与隐私 -> 隐私', + 'win-privacy': '设置 -> 隐私和安全性 -> 应用权限', + 'mac-preferences': '打开系统偏好设置', + 'win-preferences': '打开系统设置', + 'Please enter userID': '请输入 userID', + 'View more': '查看更多', + 'people selected': '人已选中', + 'Select all': '全选', + 'Cancel': '取消', + 'Done': '完成', + // UI3.0 新增 + 'camera enabled': '摄像头已开', + 'camera disabled': '摄像头已关', + 'microphone enabled': '麦克风已开', + 'microphone disabled': '麦克风已关', + 'speaker phone': '扬声器已开', + 'ear piece': '扬声器已关', + 'wait to be called': '等待接听', + 'answered': '已接通', + 'people in the call': '人参与通话', + 'failed to obtain speakers': '无法获取扬声器', + 'you have a new call': '您有一个新的通话', + // 待废弃文案 + 'timeout': '超时', + 'kick out': '被踢', 'call': '通话', 'video-call': '视频通话', 'audio-call': '音频通话', @@ -40,18 +77,9 @@ exports.zh = { 'input-phone-userID': '请输入手机号/用户ID', 'userID': '用户ID', 'already-enter': '已经进入当前通话', - 'waiting': '等待接听...', - 'camera-opened': '摄像头已开', - 'camera-closed': '摄像头已关', - 'microphone-opened': '麦克风已开', - 'microphone-closed': '麦克风已关', - 'camera': '摄像头', - 'microphone': '麦克风', 'image-resolution': '分辨率', 'default-image-resolution': '默认分辨率', 'invited-person': '添加成员', - 'video-to-audio': '切到语音通话', - 'me': '(我)', 'be-rejected': '对方已拒绝,', 'be-no-response': '对方无应答,', 'be-line-busy': '对方忙线中,', @@ -74,19 +102,4 @@ exports.zh = { 'accept-error': '接通失败', 'accept-device-error': '接通失败,通话设备获取失败', 'call-error': '发起通话失败', - 'browser-authorization': '浏览器授权', - 'mac-privacy': '系统偏好设置 -> 安全与隐私 -> 隐私', - 'win-privacy': '设置 -> 隐私和安全性 -> 应用权限', - 'mac-preferences': '打开系统偏好设置', - 'win-preferences': '打开系统设置', - 'open camera': '打开摄像头', - 'close camera': '关闭摄像头', - 'open microphone': '打开麦克风', - 'close microphone': '关闭麦克风', - 'Please enter userID': '请输入 userID', - 'View more': '查看更多', - 'people selected': '人已选中', - 'Select all': '全选', - 'Cancel': '取消', - 'Done': '完成', }; diff --git a/TUICallKit/TUICallService/locales/zh-cn.ts b/TUICallKit/TUICallService/locales/zh-cn.ts new file mode 100644 index 0000000..a6769f8 --- /dev/null +++ b/TUICallKit/TUICallService/locales/zh-cn.ts @@ -0,0 +1,102 @@ +export const zh = { + // 按钮文案 + 'hangup': '挂断', + 'reject': '拒绝', + 'accept': '接受', + 'camera': '摄像头', + 'microphone': '麦克风', + 'speaker': '扬声器', + 'open camera': '打开摄像头', + 'close camera': '关闭摄像头', + 'open microphone': '打开麦克风', + 'close microphone': '关闭麦克风', + 'video-to-audio': '转语音通话', + // 通话结果 + 'other side reject call': '对方已拒绝', + 'reject call': '拒绝通话', + 'cancel': '取消通话', + 'other side line busy': '对方忙线', + 'in busy': '正在忙', + 'call timeout': '呼叫超时', + 'end call': '结束通话', + // 通话提示语 + 'caller calling message': '等待对方接受邀请', + 'callee calling video message': '邀请你视频通话', + 'callee calling audio message': '邀请你语音通话', + 'no microphone access': '没有麦克风权限', + 'no camera access': '没有摄像头权限', + 'invite member': '邀请成员', + 'Invited group call': '邀请你加入多人通话', + 'Those involved': '参与通话的有:', + 'waiting': '等待接听...', + 'me': '(我)', + // 弹出层文案 + 'browser-authorization': '浏览器授权', + 'mac-privacy': '系统偏好设置 -> 安全与隐私 -> 隐私', + 'win-privacy': '设置 -> 隐私和安全性 -> 应用权限', + 'mac-preferences': '打开系统偏好设置', + 'win-preferences': '打开系统设置', + 'Please enter userID': '请输入 userID', + 'View more': '查看更多', + 'people selected': '人已选中', + 'Select all': '全选', + 'Cancel': '取消', + 'Done': '完成', + // UI3.0 新增 + 'camera enabled': '摄像头已开', + 'camera disabled': '摄像头已关', + 'microphone enabled': '麦克风已开', + 'microphone disabled': '麦克风已关', + 'speaker phone': '扬声器已开', + 'ear piece': '扬声器已关', + 'wait to be called': '等待接听', + 'answered': '已接通', + 'people in the call': '人参与通话', + 'failed to obtain speakers': '无法获取扬声器', + 'you have a new call': '您有一个新的通话', + // 待废弃文案 + 'timeout': '超时', + 'kick out': '被踢', + 'call': '通话', + 'video-call': '视频通话', + 'audio-call': '音频通话', + 'search': '搜索', + 'search-result': '搜索结果', + 'Wechat scan right QR code': '微信扫右二维码', + 'Use-phone-and-computer': '用手机与电脑互打体验视频通话', + 'Scan the QR code above': '扫描上方二维码', + 'no-user': '未搜索到用户', + 'member-not-added': '未添加成员', + 'not-login': '未登录', + 'login-status-expire': '登录状态已失效,请刷新网页重试', + 'experience-multi-call': '体验多人通话请下载全功能demo:', + 'not-support-multi-call': '多人通话接口未开放', + 'input-phone-userID': '请输入手机号/用户ID', + 'userID': '用户ID', + 'already-enter': '已经进入当前通话', + 'image-resolution': '分辨率', + 'default-image-resolution': '默认分辨率', + 'invited-person': '添加成员', + 'be-rejected': '对方已拒绝,', + 'be-no-response': '对方无应答,', + 'be-line-busy': '对方忙线中,', + 'be-canceled': '对方已取消', + 'voice-call-end': '语音通话结束', + 'video-call-end': '视频通话结束', + 'method-call-failed': '同步操作失败', + 'failed-to-obtain-permission': '权限获取失败', + 'environment-detection-failed': '环境检测失败', + 'switchToAudioCall-call-failed': '切语音调用失败', + 'switchToVideoCall-call-failed': '切视频调用失败', + 'microphone-unavailable': '没有可用的麦克风设备', + 'camera-unavailable': '没有可用的摄像头设备', + 'ban-device': '用户禁止使用设备', + 'not-supported-webrtc': '当前环境不支持 WebRTC', + 'blacklist-user-tips': '发起通话失败,被对方拉入黑名单,禁止发起!', + 'is-already-calling': 'TUICallKit 已在通话状态', + 'need-init': 'TUICallKit 发起通话前需保证 TUICallKitServer.init() 方法执行成功', + "can't call yourself": '不能呼叫自己', // eslint-disable-line + 'accept-error': '接通失败', + 'accept-device-error': '接通失败,通话设备获取失败', + 'call-error': '发起通话失败', +}; diff --git a/TUICallKit/TUICallService/serve/callManager.d.ts b/TUICallKit/TUICallService/serve/callManager.d.ts index 3474175..c91458f 100644 --- a/TUICallKit/TUICallService/serve/callManager.d.ts +++ b/TUICallKit/TUICallService/serve/callManager.d.ts @@ -1,11 +1,13 @@ export declare class CallManager { private _globalCallPagePath; private _isPageRedirected; + private _targetPagePath; init(params: any): Promise; private _watchTUIStore; private _unwatchTUIStore; private _handleCallStatusChange; private _handleCallStatusToCalling; private _handleCallStatusToIdle; + getRoute(): any; destroyed(): Promise; } diff --git a/TUICallKit/TUICallService/serve/callManager.js b/TUICallKit/TUICallService/serve/callManager.js index 7f4fbe5..2d2b3ff 100644 --- a/TUICallKit/TUICallService/serve/callManager.js +++ b/TUICallKit/TUICallService/serve/callManager.js @@ -34,6 +34,7 @@ class CallManager { constructor() { this._globalCallPagePath = ''; this._isPageRedirected = false; + this._targetPagePath = ''; this._handleCallStatusChange = (value) => __awaiter(this, void 0, void 0, function* () { switch (value) { case index_2.CallStatus.CALLING: @@ -88,6 +89,7 @@ class CallManager { _handleCallStatusToCalling() { if (this._isPageRedirected) return; + this._targetPagePath = this.getRoute().route; // @ts-ignore wx.navigateTo({ url: `/${this._globalCallPagePath}`, @@ -103,6 +105,10 @@ class CallManager { _handleCallStatusToIdle() { if (!this._isPageRedirected) return; + if (this._targetPagePath === this.getRoute().route) { + this._isPageRedirected = false; + return; + } // @ts-ignore wx.navigateBack({ success: () => { @@ -114,6 +120,13 @@ class CallManager { complete: () => { }, }); } + // 获取当前的页面地址 + getRoute() { + // @ts-ignore + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + return currentPage; + } // 卸载 callManger destroyed() { return __awaiter(this, void 0, void 0, function* () { diff --git a/TUICallKit/TUICallService/serve/callManager.ts b/TUICallKit/TUICallService/serve/callManager.ts new file mode 100644 index 0000000..3b1b361 --- /dev/null +++ b/TUICallKit/TUICallService/serve/callManager.ts @@ -0,0 +1,117 @@ +import { TUICallKitServer, NAME, TUIStore, StoreName } from '../../index'; +import { CallStatus } from '../const/index'; +import { avoidRepeatedCall } from '../utils/validate/index'; +/** + * @param {Number} sdkAppID 用户的sdkAppID 必传 + * @param {String} userID 用户的userID 必传 + * @param {String} userSig 用户的userSig 必传 + * @param {String} globalCallPagePath 跳转的路径 必传 + * @param {ChatSDK} tim tim实例 非必传 + */ +const PREFIX = 'callManager'; +export class CallManager { + private _globalCallPagePath:string = ''; + private _isPageRedirected:boolean = false; + private _targetPagePath:string = ''; + @avoidRepeatedCall() + public async init(params) { + const { sdkAppID, userID, userSig, globalCallPagePath, tim } = params; + if (!globalCallPagePath) { + console.error(`${PREFIX} globalCallPagePath Can not be empty!`); + return; + }; + this._globalCallPagePath = globalCallPagePath; + try { + await TUICallKitServer.init({ + sdkAppID, + userID, + userSig, + tim, + }); + this._watchTUIStore(); + // 全局监听下,关闭悬浮窗 + TUICallKitServer.enableFloatWindow(false); + console.log(`${PREFIX} init Ready!`); + } catch (error) { + console.error(`${PREFIX} init fail!`); + } + } + + // =========================【监听 TUIStore 中的状态】========================= + private _watchTUIStore() { + TUIStore?.watch(StoreName.CALL, { + [NAME.CALL_STATUS]: this._handleCallStatusChange, + }, { + notifyRangeWhenWatch: NAME.MYSELF, + }); + } + + private _unwatchTUIStore() { + TUIStore?.unwatch(StoreName.CALL, { + [NAME.CALL_STATUS]: this._handleCallStatusChange, + }); + } + + private _handleCallStatusChange = async (value: CallStatus) => { + switch (value) { + case CallStatus.CALLING: + case CallStatus.CONNECTED: + this._handleCallStatusToCalling(); + break; + + case CallStatus.IDLE: + this._handleCallStatusToIdle(); + break; + } + }; + + private _handleCallStatusToCalling() { + if (this._isPageRedirected) return; + this._targetPagePath = this.getRoute().route; + // @ts-ignore + wx.navigateTo({ + url: `/${this._globalCallPagePath}`, + success: () => { + this._isPageRedirected = true; + }, + fail: () => { + console.error(`${PREFIX} navigateTo fail!`); + }, + complete: () => {}, + }); + } + + private _handleCallStatusToIdle() { + if (!this._isPageRedirected) return; + if(this._targetPagePath === this.getRoute().route) { + this._isPageRedirected = false; + return; + } + // @ts-ignore + wx.navigateBack({ + success: () => { + this._isPageRedirected = false; + }, + fail: () => { + console.error(`${PREFIX} navigateBack fail!`); + }, + complete: () => {}, + }); + } + + // 获取当前的页面地址 + getRoute() { + // @ts-ignore + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + return currentPage; + } + + // 卸载 callManger + public async destroyed() { + this._globalCallPagePath = ''; + this._isPageRedirected = false; + this._unwatchTUIStore(); + await TUICallKitServer.destroyed(); + } +} diff --git a/TUICallKit/TUICallService/utils/common-utils.js b/TUICallKit/TUICallService/utils/common-utils.js index 53237d0..57dc19f 100644 --- a/TUICallKit/TUICallService/utils/common-utils.js +++ b/TUICallKit/TUICallService/utils/common-utils.js @@ -170,16 +170,16 @@ function handleNoDevicePermissionError(error) { exports.handleNoDevicePermissionError = handleNoDevicePermissionError; /* * 获取向下取整的 performance.now() 值 + * 在不支持 performance.now 的浏览器中,使用 Date.now(). 例如 ie 9,ie 10,避免加载 sdk 时报错 * @export * @return {Number} */ function performanceNow() { - // 在不支持 performance.now 的浏览器中,使用 Date.now() - // 例如 ie 9,ie 10,避免加载 sdk 时报错 - if (!performance || !performance.now) { - return Date.now(); - } - return Math.floor(performance.now()); + // if (!performance || !performance.now) { + // return Date.now(); + // } + // return Math.floor(performance.now()); // uni-app 打包小程序没有 performance, 报错 + return Date.now(); } exports.performanceNow = performanceNow; /** diff --git a/TUICallKit/TUICallService/utils/common-utils.ts b/TUICallKit/TUICallService/utils/common-utils.ts new file mode 100644 index 0000000..9a9a62f --- /dev/null +++ b/TUICallKit/TUICallService/utils/common-utils.ts @@ -0,0 +1,239 @@ +import { NAME } from '../const/index'; +import TUIGlobal from '../TUIGlobal/tuiGlobal'; + +export const isUndefined = function (input: any) { + return typeof input === NAME.UNDEFINED; +}; + +export const isPlainObject = function (input: any) { + // 注意不能使用以下方式判断,因为IE9/IE10下,对象的__proto__是 undefined + // return isObject(input) && input.__proto__ === Object.prototype; + if (typeof input !== NAME.OBJECT || input === null) { + return false; + } + const proto = Object.getPrototypeOf(input); + if (proto === null) { // edge case Object.create(null) + return true; + } + let baseProto = proto; + while (Object.getPrototypeOf(baseProto) !== null) { + baseProto = Object.getPrototypeOf(baseProto); + } + // 原型链第一个和最后一个比较 + return proto === baseProto; +}; + +export const isArray = function (input: any) { + if (typeof Array.isArray === NAME.FUNCTION) { + return Array.isArray(input); + } + return (Object as any).prototype.toString.call(input).match(/^\[object (.*)\]$/)[1].toLowerCase() === NAME.ARRAY; +}; + +export const isPrivateKey = function (key: string) { + return key.startsWith('_'); +}; + +export const isUrl = function (url: string) { + return /^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(url); +}; +/** + * 检测input类型是否为string + * @param {*} input 任意类型的输入 + * @returns {Boolean} true->string / false->not a string + */ +export const isString = function (input: any) { + return typeof input === NAME.STRING; +}; +export const isBoolean = function (input: any) { + return typeof input === NAME.BOOLEAN; +}; +export const isNumber = function (input: any) { + return ( + // eslint-disable-next-line + input !== null && + ((typeof input === NAME.NUMBER && !isNaN(input - 0)) || (typeof input === NAME.OBJECT && input.constructor === Number)) + ); +}; + +export function formatTime(secondTime: number): string { + const hours: number = Math.floor(secondTime / 3600); + const minutes: number = Math.floor((secondTime % 3600) / 60); + const seconds: number = Math.floor(secondTime % 60); + let callDurationStr: string = hours > 9 ? `${hours}` : `0${hours}`; + callDurationStr += minutes > 9 ? `:${minutes}` : `:0${minutes}`; + callDurationStr += seconds > 9 ? `:${seconds}` : `:0${seconds}`; + return callDurationStr; +} +export function formatTimeInverse(stringTime: string): number { + const list = stringTime.split(':'); + return parseInt(list[0]) * 3600 + parseInt(list[1]) * 60 + parseInt(list[2]); // eslint-disable-line +} + + +// Determine if it is a JSON string +export function isJSON(str: string) { + if (typeof str === NAME.STRING) { + try { + const data = JSON.parse(str); + if (data) { + return true; + } + return false; + } catch (error) { + console.debug(error); + return false; + } + } + return false; +} + +// Determine if it is a JSON string +export const JSONToObject = function (str: string) { + if (!str || !isJSON(str)) { + return str; + } + return JSON.parse(str); +}; + + +/** + * 重试函数, catch 时,重试 + * @param {Promise} promise 需重试的函数 + * @param {number} num 需要重试的次数 + * @param {number} time 间隔时间(s) + * @returns {Promise} im 接口的 response 原样返回 + */ +export const retryPromise = (promise: Promise, num: number = 6, time: number = 0.5) => { + let n = num; + const func = () => promise; + return func() + .catch((error: any) => { + if (n === 0) { + throw error; + } + const timer = setTimeout(() => { + func(); + clearTimeout(timer); + n = n - 1; + }, time * 1000); + }); +}; + +// /** +// * 节流函数(目前 TUICallKit 增加防重调用装饰器,该方法可删除) +// * @param {Function} func 传入的函数 +// * @param {wait} time 间隔时间(ms) +// */ +// export const throttle = (func: Function, wait: number) => { +// let previousTime = 0; +// return function () { +// const now = Date.now(); +// const args = [...arguments]; +// if (now - previousTime > wait) { +// func.apply(this, args); +// previousTime = now; +// } +// }; +// } + +/** + * web call engine 重复调用时的错误, 这种错误在 TUICallKit 应该忽略 + * @param {any} error 错误信息 + * @returns {Boolean} + */ +export function handleRepeatedCallError(error: any) { + if (error?.message.indexOf('is ongoing, please avoid repeated calls') !== -1) { + return true; + } + return false; +} +/** + * 设备无权限时的错误处理 + * @param {any} error 错误信息 + * @returns {Boolean} + */ +export function handleNoDevicePermissionError(error: any) { + const { message } = error; + if (message.indexOf('NotAllowedError: Permission denied') !== -1) { + return true; + } + return false; +} + +/* + * 获取向下取整的 performance.now() 值 + * 在不支持 performance.now 的浏览器中,使用 Date.now(). 例如 ie 9,ie 10,避免加载 sdk 时报错 + * @export + * @return {Number} + */ +export function performanceNow() { + // if (!performance || !performance.now) { + // return Date.now(); + // } + // return Math.floor(performance.now()); // uni-app 打包小程序没有 performance, 报错 + return Date.now(); + +} +/** + * 检测input类型是否为function + * @param {*} input 任意类型的输入 + * @returns {Boolean} true->input is a function + */ +export const isFunction = function (input: any) { + return typeof input === NAME.FUNCTION; +}; + +/* + * 获取浏览器语言 + * @export + * @return {zh-cn | en} + */ +export const getLanguage = () => { + if (TUIGlobal.getInstance().isWeChat) { + return 'zh-cn'; + } + // @ts-ignore + const lang = (navigator?.language || navigator?.userLanguage || '').substr(0, 2); + let language = 'en'; + switch (lang) { + case 'zh': + language = 'zh-cn'; + break; + case 'ja': + language = 'ja_JP'; + break; + default: + language = 'en'; + } + return language; +}; + +export function noop(e: any) {} + +/** + * Get the object type string + * @param {*} input 任意类型的输入 + * @returns {String} the object type string + */ +export const getType = function(input) { + return Object.prototype.toString + .call(input) + .match(/^\[object (.*)\]$/)[1] + .toLowerCase(); +}; +// 修改对象键名 +export function modifyObjectKey(obj, oldKey, newKey) { + if (!obj.hasOwnProperty(oldKey)) { + return obj; + } + const newObj = {}; + Object.keys(obj).forEach(key => { + if (key === oldKey) { + newObj[newKey] = obj[key]; + } else { + newObj[key] = obj[key]; + } + }); + return newObj; +} \ No newline at end of file diff --git a/TUICallKit/TUICallService/utils/decorators/promise-retry.d.ts b/TUICallKit/TUICallService/utils/decorators/promise-retry.d.ts new file mode 100644 index 0000000..bb50af1 --- /dev/null +++ b/TUICallKit/TUICallService/utils/decorators/promise-retry.d.ts @@ -0,0 +1,32 @@ +/** + * 异步函数重试 Interface + * @param {number} [retries = 5] 重试次数 + * @param {number} [timeout = 2000] 重试间隔时间 + * @param {Function=} onError 重试错误回调 + * @param {Function=} onRetrying 重试回调 + * @param {Function=} onRetryFailed 重试失败回调 + */ +interface IPromiseRetryDecoratorSettings { + retries?: number; + timeout?: number; + onError?: Function; + onRetrying?: Function; + onRetryFailed?: Function; +} +/** + * 装饰器函数:给异步函数增加重试 + * @param {Object} settings 入参 + * @returns {Function} + * @example + * class LocalStream { + * @promiseRetryDecorator({ + * retries: 10, + * timeout: 3000, + * onRetryFailed: function(error) { + * } + * }) + * async recoverCapture(options) {} + * } + */ +export default function promiseRetryDecorator(settings: IPromiseRetryDecoratorSettings): (target: any, name: any, descriptor: any) => any; +export {}; diff --git a/TUICallKit/TUICallService/utils/decorators/promise-retry.js b/TUICallKit/TUICallService/utils/decorators/promise-retry.js new file mode 100644 index 0000000..dc48ef4 --- /dev/null +++ b/TUICallKit/TUICallService/utils/decorators/promise-retry.js @@ -0,0 +1,40 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const retry_1 = __importDefault(require("../retry")); +; +/** + * 装饰器函数:给异步函数增加重试 + * @param {Object} settings 入参 + * @returns {Function} + * @example + * class LocalStream { + * @promiseRetryDecorator({ + * retries: 10, + * timeout: 3000, + * onRetryFailed: function(error) { + * } + * }) + * async recoverCapture(options) {} + * } + */ +function promiseRetryDecorator(settings) { + return function (target, name, descriptor) { + const { retries = 5, timeout = 2000, onError, onRetrying, onRetryFailed } = settings; + const oldFn = (0, retry_1.default)({ + retryFunction: descriptor.value, + settings: { retries, timeout }, + onError, + onRetrying, + onRetryFailed, + context: null, + }); + descriptor.value = function (...args) { + return oldFn.apply(this, args); + }; + return descriptor; + }; +} +exports.default = promiseRetryDecorator; diff --git a/TUICallKit/TUICallService/utils/decorators/promise-retry.ts b/TUICallKit/TUICallService/utils/decorators/promise-retry.ts new file mode 100644 index 0000000..6c926ce --- /dev/null +++ b/TUICallKit/TUICallService/utils/decorators/promise-retry.ts @@ -0,0 +1,51 @@ +import promiseRetry from '../retry'; + +/** + * 异步函数重试 Interface + * @param {number} [retries = 5] 重试次数 + * @param {number} [timeout = 2000] 重试间隔时间 + * @param {Function=} onError 重试错误回调 + * @param {Function=} onRetrying 重试回调 + * @param {Function=} onRetryFailed 重试失败回调 + */ +interface IPromiseRetryDecoratorSettings { + retries?: number; + timeout?: number; + onError?: Function; + onRetrying?: Function; + onRetryFailed?: Function; +}; + +/** + * 装饰器函数:给异步函数增加重试 + * @param {Object} settings 入参 + * @returns {Function} + * @example + * class LocalStream { + * @promiseRetryDecorator({ + * retries: 10, + * timeout: 3000, + * onRetryFailed: function(error) { + * } + * }) + * async recoverCapture(options) {} + * } + */ +export default function promiseRetryDecorator(settings: IPromiseRetryDecoratorSettings) { + return function(target, name, descriptor) { + const { retries = 5, timeout = 2000, onError, onRetrying, onRetryFailed } = settings; + const oldFn = promiseRetry({ + retryFunction: descriptor.value, + settings: { retries, timeout }, + onError, + onRetrying, + onRetryFailed, + context: null, + }); + + descriptor.value = function(...args) { + return oldFn.apply(this, args); + }; + return descriptor; + }; +} diff --git a/TUICallKit/TUICallService/utils/env.ts b/TUICallKit/TUICallService/utils/env.ts new file mode 100644 index 0000000..267855c --- /dev/null +++ b/TUICallKit/TUICallService/utils/env.ts @@ -0,0 +1,51 @@ +// eslint-disable-next-line +declare var wx: any; +// eslint-disable-next-line +declare var uni: any; +// eslint-disable-next-line +declare var window: any; + +// 在 uniApp 框架下,打包 H5、ios app、android app 时存在 wx/qq/tt/swan/my 等变量会导致引入 web sdk 环境判断失效 +// 小程序 getSystemInfoSync 返回的 fontSizeSetting 在 H5 和 app 中为 undefined,所以通过 fontSizeSetting 增强小程序环境判断 +// wx 小程序 +export const IN_WX_MINI_APP = (typeof wx !== 'undefined' && typeof wx.getSystemInfoSync === 'function' && Boolean(wx.getSystemInfoSync().fontSizeSetting)); + +// 用 uni-app 打包 native app,此时运行于 js core,无 window 等对象,此时调用 api 都得 uni.xxx,由于风格跟小程序类似,就归为 IN_MINI_APP 的一种 +export const IN_UNI_NATIVE_APP = (typeof uni !== 'undefined' && typeof uni === 'undefined'); + +export const IN_MINI_APP = IN_WX_MINI_APP || IN_UNI_NATIVE_APP; + +export const IN_UNI_APP = (typeof uni !== 'undefined'); + +// 在 uniApp 框架下,由于客户打包 ios app、android app 时 window 不一定存在,所以通过 !IN_MINI_APP 进行判断 +// 非 uniApp 框架下,仍然通过 window 结合 IN_MINI_APP 进行判断,可兼容 Taro3.0+ 暴露 window 对象引起的 IN_BROWSER 判断失效问题 +export const IN_BROWSER = (function () { + if (typeof uni !== 'undefined') { + return !IN_MINI_APP; + } + return (typeof window !== 'undefined') && !IN_MINI_APP; +}()); + +// 命名空间 +export const APP_NAMESPACE = (function () { + if (IN_WX_MINI_APP) { + return wx; + } + if (IN_UNI_APP) { + return uni; + } + return window; +}()); + +// eslint-disable-next-line no-mixed-operators +const USER_AGENT = IN_BROWSER && window && window.navigator && window.navigator.userAgent || ''; +const IS_ANDROID = /Android/i.test(USER_AGENT); +const IS_WIN_PHONE = /(?:Windows Phone)/.test(USER_AGENT); +const IS_SYMBIAN = /(?:SymbianOS)/.test(USER_AGENT); +const IS_IOS = /iPad/i.test(USER_AGENT) || /iPhone/i.test(USER_AGENT) || /iPod/i.test(USER_AGENT); + +export const IS_H5 = IS_ANDROID || IS_WIN_PHONE || IS_SYMBIAN || IS_IOS; + +export const IS_PC = IN_BROWSER && !IS_H5; +export const IS_WIN = IS_PC && USER_AGENT.includes('Windows NT'); +export const IS_MAC = IS_PC && USER_AGENT.includes('Mac'); diff --git a/TUICallKit/TUICallService/utils/index.ts b/TUICallKit/TUICallService/utils/index.ts new file mode 100644 index 0000000..ed9791c --- /dev/null +++ b/TUICallKit/TUICallService/utils/index.ts @@ -0,0 +1,16 @@ +export async function checkLocalMP3FileExists(src: string) { + if (!src) return false; + try { + const response = await new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.open('HEAD', src, true); + xhr.onload = () => resolve(xhr); + xhr.onerror = () => reject(xhr); + xhr.send(); + }); + return response.status === 200 && response.getResponseHeader('Content-Type') === 'audio/mpeg'; + } catch (error) { + console.warn(error); + return false; + } +} diff --git a/TUICallKit/TUICallService/utils/is-empty.ts b/TUICallKit/TUICallService/utils/is-empty.ts new file mode 100644 index 0000000..550e02b --- /dev/null +++ b/TUICallKit/TUICallService/utils/is-empty.ts @@ -0,0 +1,31 @@ +import { isPlainObject } from './common-utils'; + +const isEmpty = function (input: any) { + // Null and Undefined... + if (input === null || typeof (input) === 'undefined') return true; + // Booleans... + if (typeof input === 'boolean') return false; + // Numbers... + if (typeof input === 'number') return input === 0; + // Strings... + if (typeof input === 'string') return input.length === 0; + // Functions... + if (typeof input === 'function') return input.length === 0; + // Arrays... + if (Array.isArray(input)) return input.length === 0; + // Errors... + if (input instanceof Error) return input.message === ''; + // plain object + if (isPlainObject(input)) { + // eslint-disable-next-line + for (const key in input) { + if (Object.prototype.hasOwnProperty.call(input, key)) { + return false; + } + } + return true; + } + return false; +}; + +export default isEmpty; diff --git a/TUICallKit/TUICallService/utils/retry.d.ts b/TUICallKit/TUICallService/utils/retry.d.ts new file mode 100644 index 0000000..77ffdb2 --- /dev/null +++ b/TUICallKit/TUICallService/utils/retry.d.ts @@ -0,0 +1,36 @@ +/** + * 给异步函数封装重试逻辑 + * @param {Object} options 重试逻辑入参 + * @param {Object} options.retryFunction 需要封装的异步函数 + * @param {Object} options.settings 重试属性 + * @param {Number} [options.settings.retries = 5] 重试次数 + * @param {Number} [options.settings.timeout = 1000] 重试间隔 + * @param {onErrorCallback} options.onError 重试错误回调 + * @param {onRetryingCallback} [options.onRetrying] 重试后的回调 + * @param {Object} options.context 上下文,可选 + * @returns {Function} 封装后的函数 + * @example + * const getUserMedia = promiseRetry({ + * retryFunction: getUserMedia_, + * settings: { retries: 5, timeout: 2000 }, + * onError: (error, retry, reject) => { + * if (error.name === 'NotReadableError') { + * retry(); + * } else { + * reject(error); + * } + * }, + * onRetrying: retryCount => { + * console.warn(`getUserMedia NotReadableError observed, retrying [${retryCount}/5]`); + * } + * }); + */ +declare function promiseRetry({ retryFunction, settings, onError, onRetrying, onRetryFailed, context }: { + retryFunction: any; + settings: any; + onError: any; + onRetrying: any; + onRetryFailed: any; + context: any; +}): (...args: any[]) => Promise; +export default promiseRetry; diff --git a/TUICallKit/TUICallService/utils/retry.js b/TUICallKit/TUICallService/utils/retry.js new file mode 100644 index 0000000..10cdb19 --- /dev/null +++ b/TUICallKit/TUICallService/utils/retry.js @@ -0,0 +1,95 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const common_utils_1 = require("./common-utils"); +const RETRY_STATE_NOT_START = 0; +const RETRY_STATE_STARTED = 1; +const RETRY_STATE_STOPPED = 2; +/** + * 给异步函数封装重试逻辑 + * @param {Object} options 重试逻辑入参 + * @param {Object} options.retryFunction 需要封装的异步函数 + * @param {Object} options.settings 重试属性 + * @param {Number} [options.settings.retries = 5] 重试次数 + * @param {Number} [options.settings.timeout = 1000] 重试间隔 + * @param {onErrorCallback} options.onError 重试错误回调 + * @param {onRetryingCallback} [options.onRetrying] 重试后的回调 + * @param {Object} options.context 上下文,可选 + * @returns {Function} 封装后的函数 + * @example + * const getUserMedia = promiseRetry({ + * retryFunction: getUserMedia_, + * settings: { retries: 5, timeout: 2000 }, + * onError: (error, retry, reject) => { + * if (error.name === 'NotReadableError') { + * retry(); + * } else { + * reject(error); + * } + * }, + * onRetrying: retryCount => { + * console.warn(`getUserMedia NotReadableError observed, retrying [${retryCount}/5]`); + * } + * }); + */ +function promiseRetry({ retryFunction, settings, onError, onRetrying, onRetryFailed, context }) { + return function (...args) { + const retries = settings.retries || 5; + let retryCount = 0; + let timer = -1; + let retryState = RETRY_STATE_NOT_START; + const run = (resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const ctx = context || this; + try { + const result = yield retryFunction.apply(ctx, args); + // 执行成功,正常返回 + retryCount = 0; + resolve(result); + } + catch (error) { + // 用于停止重试 + const stopRetry = () => { + clearTimeout(timer); + retryCount = 0; + retryState = RETRY_STATE_STOPPED; + reject(error); + }; + const retry = () => { + if (retryState !== RETRY_STATE_STOPPED && retryCount < retries) { + retryCount++; + retryState = RETRY_STATE_STARTED; + if ((0, common_utils_1.isFunction)(onRetrying)) { + onRetrying.call(ctx, retryCount, stopRetry); + } + timer = setTimeout(() => { + timer = -1; + run(resolve, reject); + }, (0, common_utils_1.isUndefined)(settings.timeout) ? 1000 : settings.timeout); + } + else { + stopRetry(); + if ((0, common_utils_1.isFunction)(onRetryFailed)) { + onRetryFailed.call(ctx, error); + } + } + }; + if ((0, common_utils_1.isFunction)(onError)) { + onError.call(ctx, error, retry, reject, args); + } + else { + retry(); + } + } + }); + return new Promise(run); + }; +} +exports.default = promiseRetry; diff --git a/TUICallKit/TUICallService/utils/retry.ts b/TUICallKit/TUICallService/utils/retry.ts new file mode 100644 index 0000000..4748584 --- /dev/null +++ b/TUICallKit/TUICallService/utils/retry.ts @@ -0,0 +1,88 @@ +import { isFunction, isUndefined } from './common-utils'; + +const RETRY_STATE_NOT_START = 0; +const RETRY_STATE_STARTED = 1; +const RETRY_STATE_STOPPED = 2; + +/** + * 给异步函数封装重试逻辑 + * @param {Object} options 重试逻辑入参 + * @param {Object} options.retryFunction 需要封装的异步函数 + * @param {Object} options.settings 重试属性 + * @param {Number} [options.settings.retries = 5] 重试次数 + * @param {Number} [options.settings.timeout = 1000] 重试间隔 + * @param {onErrorCallback} options.onError 重试错误回调 + * @param {onRetryingCallback} [options.onRetrying] 重试后的回调 + * @param {Object} options.context 上下文,可选 + * @returns {Function} 封装后的函数 + * @example + * const getUserMedia = promiseRetry({ + * retryFunction: getUserMedia_, + * settings: { retries: 5, timeout: 2000 }, + * onError: (error, retry, reject) => { + * if (error.name === 'NotReadableError') { + * retry(); + * } else { + * reject(error); + * } + * }, + * onRetrying: retryCount => { + * console.warn(`getUserMedia NotReadableError observed, retrying [${retryCount}/5]`); + * } + * }); + */ +function promiseRetry({ retryFunction, settings, onError, onRetrying, onRetryFailed, context }) { + return function(...args) { + const retries = settings.retries || 5; + let retryCount = 0; + let timer: any = -1; + let retryState = RETRY_STATE_NOT_START; + const run = async (resolve, reject) => { + const ctx = context || this; + try { + const result = await retryFunction.apply(ctx, args); + // 执行成功,正常返回 + retryCount = 0; + resolve(result); + } catch (error) { + // 用于停止重试 + const stopRetry = () => { + clearTimeout(timer); + retryCount = 0; + retryState = RETRY_STATE_STOPPED; + reject(error); + }; + const retry = () => { + if (retryState !== RETRY_STATE_STOPPED && retryCount < retries) { + retryCount++; + retryState = RETRY_STATE_STARTED; + if (isFunction(onRetrying)) { + onRetrying.call(ctx, retryCount, stopRetry); + } + timer = setTimeout( + () => { + timer = -1; + run(resolve, reject); + }, + isUndefined(settings.timeout) ? 1000 : settings.timeout + ); + } else { + stopRetry(); + if (isFunction(onRetryFailed)) { + onRetryFailed.call(ctx, error); + } + } + }; + if (isFunction(onError)) { + onError.call(ctx, error, retry, reject, args); + } else { + retry(); + } + } + }; + + return new Promise(run); + }; +} + +export default promiseRetry; diff --git a/TUICallKit/TUICallService/utils/timer.d.ts b/TUICallKit/TUICallService/utils/timer.d.ts index d88f832..050f260 100644 --- a/TUICallKit/TUICallService/utils/timer.d.ts +++ b/TUICallKit/TUICallService/utils/timer.d.ts @@ -42,7 +42,7 @@ declare class Timer { * @param {*} count * @returns ID */ - static interval(taskItem: any): NodeJS.Timer; + static interval(taskItem: any): NodeJS.Timeout; /** * 延迟执行回调 * count = 0,循环 diff --git a/TUICallKit/TUICallService/utils/timer.ts b/TUICallKit/TUICallService/utils/timer.ts new file mode 100644 index 0000000..6b11e0c --- /dev/null +++ b/TUICallKit/TUICallService/utils/timer.ts @@ -0,0 +1,162 @@ +/* eslint-disable */ +import { isPlainObject, performanceNow, isFunction } from './common-utils'; +import { NAME } from '../const/index'; + +/** + * 定时器,功能: + * 1. 支持定时执行回调 [1,n] 次,用于常规延迟、定时操作 + * @example + * // 默认嵌套执行,count=0 无限次 + * timer.run(callback, {delay: 2000}); + * // count=1 等同于 原始setTimeout + * timer.run(callback, {delay: 2000, count:0}); + * 2. 支持 RAF 执行回调,用于小流渲染,audio音量获取等任务,需要渲染频率稳定,支持页面退后台后,用 setTimeout 接管,最短 1s 执行一次 + * @example + * // 默认60fps,可以根据单位时长换算,默认开启后台执行 + * timer.run('raf', callback, {fps: 60}); + * // 设置执行次数 + * timer.run('raf', callback, {fps: 60, count: 300, backgroundTask: false}); + * 3. 支持空闲任务执行回调, requestIdleCallback 在帧渲染的空闲时间执行任务,可以用于 storage 写入等低优先级的任务 + * @example + * // 支持原生setInterval 但不推荐使用,定时任务推荐用 timeout + * timer.run('interval', callback, {delay:2000, count:10}) + */ + +class Timer { + static taskMap = new Map(); + static currentTaskID = 1; + static generateTaskID() { + return this.currentTaskID++; + } + /** + * + * @param {string} taskName 'interval' 'timeout' + * @param {function} callback + * @param {object} options include: + * @param {number} options.delay millisecond + * @param {number} options.count 定时器回调执行次数,0 无限次 or n次 + * @param {boolean} options.backgroundTask 在页面静默后是否继续执行定时器 + */ + static run(taskName = NAME.TIMEOUT, callback: any, options: any) { + // default options + if (taskName === NAME.INTERVAL) { + options = { ...{ delay: 2000, count: 0, backgroundTask: true }, ...options }; + } else { + options = { ...{ delay: 2000, count: 0, backgroundTask: true }, ...options }; + } + // call run(function, {...}) + if (isPlainObject(callback)) { + options = { ...options, ...callback }; + } + if (isFunction(taskName)) { + callback = taskName; + taskName = NAME.TIMEOUT; + } + // 1. 创建 taskID,作为 timer task 的唯一标识,在本函数执行完后返回,用于在调用的地方实现互斥逻辑 + // 2. 根据 taskName 执行相应的函数 + const taskItem = { + taskID: this.generateTaskID(), + loopCount: 0, + intervalID: null, + timeoutID: null, + taskName, + callback, + ...options + }; + this.taskMap.set(taskItem.taskID, taskItem); + // console.log(`timer run task:${taskItem.taskName}, task queue size: ${this.taskMap.size}`); + if (taskName === NAME.INTERNAL) { + this.interval(taskItem); + } else { + this.timeout(taskItem); + } + return taskItem.taskID; + } + + /** + * 定时循环执行回调函数 + * 可以指定循环的时间间隔 + * 可以指定循环次数 + * @param {object} taskItem + * @param {function} callback + * @param {*} delay + * @param {*} count + * @returns ID + */ + static interval(taskItem: any) { + // setInterval 缺点,浏览器退后台会降频,循环执行间隔时间不可靠 + // 创建进入定时器循环的任务函数,函数内:1. 判断是否满足执行条件,2.执行 callback + // 通过 setInterval 执行任务函数 + // 将 intervalID 记录到 taskMap 对应的 item + const task = () => { + taskItem.callback(); + taskItem.loopCount += 1; + if (this.isBreakLoop(taskItem)) { + return; + } + }; + return taskItem.intervalID = setInterval(task, taskItem.delay); + } + /** + * 延迟执行回调 + * count = 0,循环 + * count = n, 执行n次 + * @param {object} taskItem + * + */ + static timeout(taskItem: any) { + // setTimeout 浏览器退后台,延迟变为至少1s + const task: any = () => { + // 执行回调 + taskItem.callback(); + taskItem.loopCount += 1; + if (this.isBreakLoop(taskItem)) { + return; + } + // 不修正延迟,每次callback间隔平均 + return taskItem.timeoutID = setTimeout(task, taskItem.delay); + }; + return taskItem.timeoutID = setTimeout(task, taskItem.delay); + } + + static hasTask(taskID: any) { + return this.taskMap.has(taskID); + } + + static clearTask(taskID: any) { + // console.log('timer clearTask start', `| taskID:${taskID} | size:${this.taskMap.size}`); + if (!this.taskMap.has(taskID)) { + return true; + } + const { intervalID, timeoutID, onVisibilitychange } = this.taskMap.get(taskID); + if (intervalID) { + clearInterval(intervalID); + } + if (timeoutID) { + clearTimeout(timeoutID); + } + if (onVisibilitychange) { + document.removeEventListener('visibilitychange', onVisibilitychange); + } + this.taskMap.delete(taskID); + // console.log('timer clearTask end ', `| size:${this.taskMap.size}`); + return true; + } + /** + * 1. 如果已移除出定时队列,退出当前任务 + * 2. 如果当前任务已满足次数限制,则退出当前任务 + * @param {object} taskItem + * @returns + */ + static isBreakLoop(taskItem: any) { + if (!this.taskMap.has(taskItem.taskID)) { + return true; + } + if (taskItem.count !== 0 && taskItem.loopCount >= taskItem.count) { + this.clearTask(taskItem.taskID); + return true; + } + return false; + } +} +export default Timer; diff --git a/TUICallKit/TUICallService/utils/validate/avoidRepeatedCall.ts b/TUICallKit/TUICallService/utils/validate/avoidRepeatedCall.ts new file mode 100644 index 0000000..df56eb4 --- /dev/null +++ b/TUICallKit/TUICallService/utils/validate/avoidRepeatedCall.ts @@ -0,0 +1,34 @@ +import { NAME } from '../../const/index'; + +/** + * 装饰器:阻止函数重复调用 + * @export + * @param {Object} options 入参 + * @param {Function} options.fn 函数 + * @param {Object} options.context 上下文对象 + * @param {String} options.name 函数名 + * @returns {Function} 封装后的函数 + */ +export function avoidRepeatedCall() { + return function (target: any, name: string, descriptor: any) { + const oldFn = descriptor.value; + const isCallingSet = new Set(); + descriptor.value = async function (...args: any[]) { + if (isCallingSet.has(this)) { + console.warn((`${NAME.PREFIX}previous ${name}() is ongoing, please avoid repeated calls`)); + // throw new Error(`previous ${name}() is ongoing, please avoid repeated calls`); + return; + } + try { + isCallingSet.add(this); + const result = await oldFn.apply(this, args); + isCallingSet.delete(this); + return result; + } catch (error) { + isCallingSet.delete(this); + throw error; + } + }; + return descriptor; + }; +} diff --git a/TUICallKit/TUICallService/utils/validate/index.ts b/TUICallKit/TUICallService/utils/validate/index.ts new file mode 100644 index 0000000..283fe0e --- /dev/null +++ b/TUICallKit/TUICallService/utils/validate/index.ts @@ -0,0 +1,11 @@ +import { avoidRepeatedCall } from './avoidRepeatedCall'; +import { paramValidate } from './validateParams'; +import { VALIDATE_PARAMS } from './validateConfig'; +// import { apiCallQueue } from "./apiCallQueue"; + +export { + VALIDATE_PARAMS, + paramValidate, + avoidRepeatedCall, + // apiCallQueue, +}; diff --git a/TUICallKit/TUICallService/utils/validate/validateConfig.ts b/TUICallKit/TUICallService/utils/validate/validateConfig.ts new file mode 100644 index 0000000..c31882a --- /dev/null +++ b/TUICallKit/TUICallService/utils/validate/validateConfig.ts @@ -0,0 +1,188 @@ +import { NAME, MAX_NUMBER_ROOM_ID, VideoResolution, VideoDisplayMode } from "../../const/index"; + +export const VALIDATE_PARAMS = { + init: { + SDKAppID: { + required: true, + rules: [NAME.NUMBER], + allowEmpty: false, + }, + userID: { + required: true, + rules: [NAME.STRING], + allowEmpty: false, + }, + userSig: { + required: true, + rules: [NAME.STRING], + allowEmpty: false, + }, + tim: { + required: false, + rules: [NAME.OBJECT], + }, + }, + call: { + userID: { + required: true, + rules: [NAME.STRING], + allowEmpty: false + }, + type: { + required: true, + rules: [NAME.NUMBER], + range: [1, 2], + allowEmpty: false + }, + roomID: { + required: false, + rules: [NAME.NUMBER], // 仅支持数字房间号, 后续会支持字符串房间号 + range: `1~${MAX_NUMBER_ROOM_ID}`, + allowEmpty: false, + }, + userData: { + required: false, + rules: [NAME.STRING], + allowEmpty: false, + }, + timeout: { + required: false, + rules: [NAME.NUMBER], + allowEmpty: false + } + }, + groupCall: { + userIDList: { + required: true, + rules: [NAME.ARRAY], + allowEmpty: false + }, + type: { + required: true, + rules: [NAME.NUMBER], + range: [1, 2], + allowEmpty: false + }, + groupID: { + required: true, + rules: [NAME.STRING], + allowEmpty: false + }, + roomID: { + required: false, + rules: [NAME.NUMBER], // 仅支持数字房间号, 后续会支持字符串房间号 + range: `1~${MAX_NUMBER_ROOM_ID}`, + allowEmpty: false + }, + timeout: { + required: false, + rules: [NAME.NUMBER], + allowEmpty: false + }, + userData: { + required: false, + rules: [NAME.STRING], + allowEmpty: false, + }, + offlinePushInfo: { + required: false, + rules: [NAME.OBJECT], + allowEmpty: false, + }, + }, + joinInGroupCall: { + type: { + required: true, + rules: [NAME.NUMBER], + range: [1, 2], + allowEmpty: false + }, + groupID: { + required: true, + rules: [NAME.STRING], + allowEmpty: false + }, + roomID: { + required: true, + rules: [NAME.NUMBER], + allowEmpty: false, + }, + }, + inviteUser: { + userIDList: { + required: true, + rules: [NAME.ARRAY], + allowEmpty: false + }, + }, + setSelfInfo: { + nickName: { + required: false, + rules: [NAME.STRING], + allowEmpty: false, + }, + avatar: { + required: false, + rules: [NAME.STRING], + allowEmpty: false, + } + }, + enableFloatWindow: [ + { + key: "enable", + required: false, + rules: [NAME.BOOLEAN], + allowEmpty: false, + } + ], + enableAIVoice: [ + { + key: "enable", + required: true, + rules: [NAME.BOOLEAN], + allowEmpty: false, + } + ], + enableMuteMode: [ + { + key: "enable", + required: true, + rules: [NAME.BOOLEAN], + allowEmpty: false, + } + ], + setCallingBell: [ + { + key: "filePath", + required: false, + rules: [NAME.STRING], + allowEmpty: true, + } + ], + setLanguage: [ + { + key: "language", + required: true, + rules: [NAME.STRING], + allowEmpty: false + } + ], + setVideoDisplayMode: [ + { + key: "displayMode", + required: true, + rules: [NAME.STRING], + range: [VideoDisplayMode.CONTAIN, VideoDisplayMode.COVER, VideoDisplayMode.FILL], + allowEmpty: false + } + ], + setVideoResolution: [ + { + key: "resolution", + required: true, + rules: [NAME.STRING], + range: [VideoResolution.RESOLUTION_1080P, VideoResolution.RESOLUTION_480P, VideoResolution.RESOLUTION_720P], + allowEmpty: false + } + ] +}; diff --git a/TUICallKit/TUICallService/utils/validate/validateParams.ts b/TUICallKit/TUICallService/utils/validate/validateParams.ts new file mode 100644 index 0000000..c1a0543 --- /dev/null +++ b/TUICallKit/TUICallService/utils/validate/validateParams.ts @@ -0,0 +1,88 @@ +import { getType, isArray, isString, isUndefined, isNumber, modifyObjectKey } from "../common-utils"; +import { NAME } from "../../const/index"; +const PREFIX = NAME.PREFIX + "API"; + +export function paramValidate (config: any) { + return function (target, propertyName: string, descriptor: PropertyDescriptor) { + let method = descriptor.value; + descriptor.value = function (...args) { + doValidate.call(this, config, args, propertyName); + return method.apply(this, args); + }; + return descriptor; + }; +} +function doValidate(config, args, name) { + try { + // 兼容 init 方法中: SDKAppID sdkAppID 两种写法的参数校验判断 + if (!args[0].SDKAppID) { + config = modifyObjectKey(config, "SDKAppID", "sdkAppID"); + } + if (isArray(config)) { + for (let i = 0; i < config.length; i++) { + check.call(this, { + ...config[i], + value: args[i], + name, + }); + } + } else { + for (const key in config) { + if (config.hasOwnProperty(key)) { + check.call(this, { + ...config[key], + value: args[0][key], + name, + key, + }); + } + } + } + } catch (error) { + console.error(error); + throw error; + } +} +function check({ required, rules, range, value, allowEmpty, name, key }) { + // 用户没传指定参数 + if (isUndefined(value)) { + // 检查必填参数, 若配置是必填则报错 + if (required) { + throw new Error(`${PREFIX}<${name}>: ${key} is required.`); + } else { + return; + } + } + // 判断参数类型是否正确 + const result = rules.some((item)=>item === getType(value)); + let type = ''; + if (!result) { + for (let i = 0; i < rules.length; i++) { + let str = rules[i]; + str = str.replace(str[0], str[0].toUpperCase()); + type += `${str}/`; + } + type = type.substring(0, type.length - 1); + throw new Error(`${PREFIX}<${name}>: ${key} must be ${type}, current ${key} is ${typeof value}.`); + } + // 不允许传空值, 例如: '', ' ' + if (allowEmpty === false) { + const isEmptyString = isString(value) && value.trim() === ''; + if (isEmptyString) { + throw new Error(`${PREFIX}<${name}>: ${key} is blank.`); + } + } + // 判断是否符合限制条件 + if (isArray(range)) { + if (range && range.indexOf(value) === -1) { + throw new Error(`${PREFIX}<${name}>: ${key} error, only be ${range}, current ${key} is ${value}.`); + } + } + // 取值范围, 前闭后闭 + if (isString(range) && range.indexOf('~') !== -1) { + const valueList = range.split('~'); + if (value < +valueList[0] || value > +valueList[1] || (isNumber(value) && Number.isNaN(value))) { + throw new Error(`${PREFIX}<${name}>: ${key} error, only be ${range}, current ${key} is ${value}.`); + } + } +} diff --git a/TUICallKit/min-npm/tim-wx-sdk/index.js b/TUICallKit/min-npm/tim-wx-sdk/index.js index 738d43d..d1910d2 100644 --- a/TUICallKit/min-npm/tim-wx-sdk/index.js +++ b/TUICallKit/min-npm/tim-wx-sdk/index.js @@ -4,11 +4,11 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1704939160518, function(require, module, exports) { -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TIM=t()}(this,(function(){function e(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function t(t){for(var o=1;o=0||(a[o]=e[o]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function f(e){var t=l();return function(){var o,n=c(e);if(t){var a=c(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return h(this,o)}}function m(e,t){return M(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==o)return;var n,a,s=[],r=!0,i=!1;try{for(o=o.call(e);!(r=(n=o.next()).done)&&(s.push(n.value),!t||s.length!==t);r=!0);}catch(c){i=!0,a=c}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return s}(e,t)||I(e,t)||T()}function v(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e){if(Array.isArray(e))return e}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return C(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,r=!0,i=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,s=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw s}}}}var S={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},D={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},N=function(){function e(){n(this,e),this.cache=[],this.options=null}return s(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(e,t){return e(t={exports:{}},t.exports),t.exports}var R=k((function(e,t){var o,n,a,s,r,i,c,u,l,d,p,g,_,h,f,m,v,M;e.exports=(o="function"==typeof Promise,n="object"==typeof self?self:A,a="undefined"!=typeof Symbol,s="undefined"!=typeof Map,r="undefined"!=typeof Set,i="undefined"!=typeof WeakMap,c="undefined"!=typeof WeakSet,u="undefined"!=typeof DataView,l=a&&void 0!==Symbol.iterator,d=a&&void 0!==Symbol.toStringTag,p=r&&"function"==typeof Set.prototype.entries,g=s&&"function"==typeof Map.prototype.entries,_=p&&Object.getPrototypeOf((new Set).entries()),h=g&&Object.getPrototypeOf((new Map).entries()),f=l&&"function"==typeof Array.prototype[Symbol.iterator],m=f&&Object.getPrototypeOf([][Symbol.iterator]()),v=l&&"function"==typeof String.prototype[Symbol.iterator],M=v&&Object.getPrototypeOf(""[Symbol.iterator]()),function(e){var t=typeof e;if("object"!==t)return t;if(null===e)return"null";if(e===n)return"global";if(Array.isArray(e)&&(!1===d||!(Symbol.toStringTag in e)))return"Array";if("object"==typeof window&&null!==window){if("object"==typeof window.location&&e===window.location)return"Location";if("object"==typeof window.document&&e===window.document)return"Document";if("object"==typeof window.navigator){if("object"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return"MimeTypeArray";if("object"==typeof window.navigator.plugins&&e===window.navigator.plugins)return"PluginArray"}if(("function"==typeof window.HTMLElement||"object"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if("BLOCKQUOTE"===e.tagName)return"HTMLQuoteElement";if("TD"===e.tagName)return"HTMLTableDataCellElement";if("TH"===e.tagName)return"HTMLTableHeaderCellElement"}}var a=d&&e[Symbol.toStringTag];if("string"==typeof a)return a;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?"RegExp":l===Date.prototype?"Date":o&&l===Promise.prototype?"Promise":r&&l===Set.prototype?"Set":s&&l===Map.prototype?"Map":c&&l===WeakSet.prototype?"WeakSet":i&&l===WeakMap.prototype?"WeakMap":u&&l===DataView.prototype?"DataView":s&&l===h?"Map Iterator":r&&l===_?"Set Iterator":f&&l===m?"Array Iterator":v&&l===M?"String Iterator":null===l?"Object":Object.prototype.toString.call(e).slice(8,-1)})})),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n(this,e),this.high=t,this.low=o}return s(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var o=8-t.length;o;)t="0"+t,o--;return e+t}}]),e}(),O={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com"}}},G={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15},P="1.7.3",U=537048168,b="CHINA",w="OVERSEA",F="SINGAPORE",q="KOREA",x="GERMANY",V="IND",B="JPN",K="USA",H={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;this.CURRENT=O.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate"},CMD:{LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_specified",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",MARK_AVCHATROOM_MEMBER_INFO:"modify_user_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_GROUP_NOTIFY:"get_group_notify",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",SET_CONVERSATION_CUSTOM_DATA:"mark_contact",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",UPDATE_CONVERSATION_GROUP:"update_contact_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",GET_RPOFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},W={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString()},Y="c2c_text_message",j="c2c_custom_message",$="group_text_message",z="group_custom_message",J="user_profile",X="group_profile",Q="group_member_profile";H.HOST.setCurrent(b);var Z,ee,te,oe,ne="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),ae="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),se="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),re="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ie="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ce="undefined"!=typeof uni&&"undefined"==typeof window,ue="undefined"!=typeof uni,le=ne||ae||se||re||ie||ce,de=("undefined"!=typeof uni||"undefined"!=typeof window)&&!le,pe=ae?qq:se?tt:re?swan:ie?my:ne?wx:ce?uni:{},ge=(Z="WEB",Ae?Z="WEB":ae?Z="QQ_MP":se?Z="TT_MP":re?Z="BAIDU_MP":ie?Z="ALI_MP":ne?Z="WX_MP":ce&&(Z="UNI_NATIVE_APP"),G[Z]),_e=de&&window&&window.navigator&&window.navigator.userAgent||"",he=/AppleWebKit\/([\d.]+)/i.exec(_e),fe=(he&&parseFloat(he.pop()),/iPad/i.test(_e)),me=/iPhone/i.test(_e)&&!fe,ve=/iPod/i.test(_e),Me=me||fe||ve,ye=(ee=_e.match(/OS (\d+)_/i))&&ee[1]?ee[1]:null,Ie=/Android/i.test(_e),Ce=function(){var e=_e.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),o=e[2]&&parseFloat(e[2]);return t&&o?parseFloat(e[1]+"."+e[2]):t||null}(),Te=(Ie&&/webkit/i.test(_e),/Firefox/i.test(_e),/Edge/i.test(_e)),Ee=!Te&&/Chrome/i.test(_e),Se=(function(){var e=_e.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(_e)||_e.indexOf("Trident")>-1&&_e.indexOf("rv:11.0")>-1),De=(/MSIE\s8\.0/.test(_e),function(){var e=/MSIE\s(\d+)\.\d/.exec(_e),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(_e)&&/rv:11.0/.test(_e)&&(t=11),t}()),Ne=(/Safari/i.test(_e),/TBS\/\d+/i.test(_e)),Ae=(function(){var e=_e.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}(),!Ne&&/MQQBrowser\/\d+/i.test(_e),!Ne&&/ QQBrowser\/\d+/i.test(_e),/(micromessenger|webbrowser)/i.test(_e)),ke=/Windows/i.test(_e),Re=/MAC OS X/i.test(_e),Le=(/MicroMessenger/i.test(_e),de&&"undefined"!=typeof Worker&&!Se),Oe=Ie||Me,Ge=de&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,Pe="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};te="undefined"!=typeof console?console:void 0!==Pe&&Pe.console?Pe.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Ue=function(){},be=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],we=be.length;we--;)oe=be[we],console[oe]||(te[oe]=Ue);var Fe=te,qe=0,xe=function(){return(new Date).getTime()+qe},Ve=function(){qe=0},Be=function(){return Math.floor(xe()/1e3)},Ke=0;function He(){return Zt()?"%c TIM %c":"TIM"}function We(){var e,t=((e=new Date).setTime(xe()),e);return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())}var Ye={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var o=0,n=e.length;o4294967295?(mt+=4294967295,Date.now()-mt):e},Mt=function e(t,o,n,a){if(!pt(t)||!pt(o))return 0;for(var s,r=0,i=Object.keys(o),c=0,u=i.length;c=0?n[s]=t[s]:n[s]=e(t[s])):n[s]=void 0:n[s]=null;return n};function kt(e,t){lt(e)&<(t)&&t.forEach((function(t){var o=t.key,n=t.value,a=e.find((function(e){return e.key===o}));a?a.value=n:e.push({key:o,value:n})}))}var Rt=function(e){return e===D.GRP_PUBLIC},Lt=function(e){return e===D.GRP_AVCHATROOM},Ot=function(e){var t=e.type,o=e.groupID;return t===D.GRP_COMMUNITY||"".concat(o).startsWith(et)&&!"".concat(o).includes(ot)},Gt=function(e){return"".concat(e).startsWith(et)&&"".concat(e).includes(ot)},Pt=function(e){return it(e)&&e.slice(0,3)===D.CONV_C2C},Ut=function(e){return it(e)&&e.slice(0,5)===D.CONV_GROUP},bt=function(e){return it(e)&&e===D.CONV_SYSTEM};function wt(e,t){var o={};return Object.keys(e).forEach((function(n){o[n]=t(e[n],n)})),o}function Ft(e){return le?new Promise((function(t,o){pe.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):Se&&9===De?Promise.resolve({width:0,height:0}):new Promise((function(t,o){var n=new Image;n.onload=function(){t({width:this.width,height:this.height}),n=null},n.onerror=function(){t({width:0,height:0}),n=null},n.src=e}))}function qt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function xt(){var e="unknown";if(Re&&(e="mac"),ke&&(e="windows"),Me&&(e="ios"),Ie&&(e="android"),le)try{var t=pe.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(o){}return e}function Vt(e,t){e=e.split("."),t=t.split(".");for(var o=Math.max(e.length,t.length);e.lengths)return 1;if(a-1?"".concat(o,"&"):"".concat(o,"?");u.url="".concat(l,198===r?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return dt(o)?g(u,nt):u}function Kt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var o=0;o=0;n--)"1"===e[n]&&t.push(Math.pow(2,o-n-1));return t}function Qt(e){return 0===e||e>=2e7&&e<8e7||e>=172e7&&e<178e7}function Zt(){return!Se&&!le}function eo(e){return"the length of userIDList cannot exceed ".concat(e)}var to=Object.prototype.hasOwnProperty;function oo(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(ut(e)){for(var t in e)if(to.call(e,t))return!1;return!0}return!(!at(e)&&(o=e,"set"!==ht(o))&&!st(e))&&0===e.size;var o}function no(e,t,o){if(void 0===t)return!0;var n=!0;if("object"===R(t).toLowerCase())Object.keys(t).forEach((function(a){var s=1===e.length?e[0][a]:void 0;n=!!ao(s,t[a],o,a)&&n}));else if("array"===R(t).toLowerCase())for(var a=0;a256)||(Ye.warn(lo({api:"setConversationCustomData",param:"customData",desc:Co("customData",256)})),!1):(Ye.warn(lo({api:"setConversationCustomData",param:"customData",desc:po()})),!1)}}},markConversation:{conversationIDList:t({},Oo),markType:{type:"number",validator:function(e){return rt(e)?e<=0?(Ye.warn(lo({api:"markConversation",param:"markType",desc:(t="markType",o=0,co?"".concat(t," must be greater than ").concat(o):"".concat(t," 必须大于").concat(o))})),!1):!(e>=Math.pow(2,64))||(Ye.warn(lo({api:"markConversation",param:"markType",desc:To("markType","Math.pow(2,64)")})),!1):(Ye.warn(lo({api:"markConversation",param:"markType",desc:_o()})),!1);var t,o}},enableMark:t({},Po)},createConversationGroup:{conversationIDList:t({},Oo),groupName:t(t({},Lo),{},{validator:function(e){return!!e&&(!(e.length>32)||(Ye.warn(lo({api:"createConversationGroup",param:"groupName",desc:Co("groupName",32)})),!1))}})},deleteConversationGroup:[t({name:"groupName"},Lo)],renameConversationGroup:{oldName:t({},Lo),newName:t(t({},Lo),{},{validator:function(e){return!!e&&(!(e.length>32)||(Ye.warn(lo({api:"renameConversationGroup",param:"newName",desc:Co("newName",32)})),!1))}})},addConversationsToGroup:{conversationIDList:t({},Oo),groupName:t({},Lo)},deleteConversationsFromGroup:{conversationIDList:t({},Oo),groupName:t({},Lo)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Lo,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Oo},createGroup:{name:Lo},joinGroup:{groupID:Lo,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Lo)],handleApplication:{message:Go,handleAction:Lo,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Lo,newOwnerID:Lo},updateGroupProfile:{groupID:Lo,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Lo)],searchGroupByID:[t({name:"groupID"},Lo)],initGroupAttributes:{groupID:Lo,groupAttributes:t(t({},Go),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!it(e[o]))return Ye.warn(lo({api:"initGroupAttributes",param:"groupAttributes",desc:Eo("value")})),t=!1})),t}})},setGroupAttributes:{groupID:Lo,groupAttributes:t(t({},Go),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!it(e[o]))return Ye.warn(lo({api:"setGroupAttributes",param:"groupAttributes",desc:Eo("value")})),t=!1})),t}})},deleteGroupAttributes:{groupID:Lo,keyList:{type:"Array",validator:function(e){if(dt(e)||!lt(e))return Ye.warn(lo({api:"deleteGroupAttributes",param:"keyList",desc:vo()})),!1;if(!oo(e)){var t=!0;return e.forEach((function(e){if(!it(e))return Ye.warn(lo({api:"deleteGroupAttributes",param:"keyList",desc:co?"Type of the array element must be String":"数组元素的类型必须为 String"})),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Lo,keyList:{type:"Array",validator:function(e){if(dt(e)||!lt(e))return Ye.warn(lo({api:"getGroupAttributes",param:"keyList",desc:vo()})),!1;if(!oo(e)){var t=!0;return e.forEach((function(e){if(!it(e))return Ye.warn(lo({api:"getGroupAttributes",param:"keyList",desc:Eo("key")})),t=!1})),t}return!0}}},setGroupCounters:{groupID:Lo,counters:Go},increaseGroupCounter:{groupID:Lo,key:Lo,value:Uo},decreaseGroupCounter:{groupID:Lo,key:Lo,value:Uo},getGroupCounters:{groupID:Lo},getGroupMemberList:{groupID:Lo,count:{type:"Number"}},getGroupMemberProfile:{groupID:Lo,userIDList:Oo,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Lo,userIDList:Oo},setGroupMemberRole:{groupID:Lo,userID:Lo,role:Lo},setGroupMemberMuteTime:{groupID:Lo,userID:Lo,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Lo,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return it(e)?(e.length,!0):(Ye.warn(lo({api:"setGroupMemberNameCard",param:"nameCard",desc:po()})),!1)}}},setGroupMemberCustomField:{groupID:Lo,userID:{type:"String"},memberCustomField:Oo},deleteGroupMember:{groupID:Lo},markGroupMemberList:{groupID:Lo,markType:{type:"number",validator:function(e){return rt(e)?!(e<1e3)||(Ye.warn(lo({api:"markGroupMemberList",param:"markType",desc:(t="markType",o=1e3,co?"".concat(t," must be greater than or equal to ").concat(o):"".concat(t," 必须大于或等于").concat(o))})),!1):(Ye.warn(lo({api:"markGroupMemberList",param:"markType",desc:_o()})),!1);var t,o}},userIDList:t({},Oo),enableMark:t({},Po)},createTextMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.text)?0!==e.text.length||(Ye.warn(lo({api:"createTextMessage",param:"payload.text",desc:Do()})),!1):(Ye.warn(lo({api:"createTextMessage",param:"payload.text",desc:po()})),!1):(Ye.warn(lo({api:"createTextMessage",param:"payload",desc:So()})),!1)}})},createTextAtMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.text)?0===e.text.length?(Ye.warn(lo({api:"createTextAtMessage",param:"payload.text",desc:Do()})),!1):!(e.atUserList&&!lt(e.atUserList))||(Ye.warn(lo({api:"createTextAtMessage",param:"payload.atUserList",desc:vo()})),!1):(Ye.warn(lo({api:"createTextAtMessage",param:"payload.text",desc:po()})),!1):(Ye.warn(lo({api:"createTextAtMessage",param:"payload",desc:So()})),!1)}})},createCustomMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?e.data&&!it(e.data)?(Ye.warn(lo({api:"createCustomMessage",param:"payload.data",desc:po()})),!1):e.description&&!it(e.description)?(Ye.warn(lo({api:"createCustomMessage",param:"payload.description",desc:po()})),!1):!(e.extension&&!it(e.extension))||(Ye.warn(lo({api:"createCustomMessage",param:"payload.extension",desc:po()})),!1):(Ye.warn(lo({api:"createCustomMessage",param:"payload",desc:So()})),!1)}})},createImageMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:"createImageMessage",param:"payload",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:"createImageMessage",param:"payload.file",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ye.warn(lo({api:"createImageMessage",param:"payload.file",desc:No()})),!1):(Ye.warn(lo({api:"createImageMessage",param:"payload.file",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:"createImageMessage",param:"payload.file",desc:No()})),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:"createImageMessage",param:"onProgress",desc:yo()})),!0}}})},createAudioMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return!!ut(e)||(Ye.warn(lo({api:"createAudioMessage",param:"payload",desc:So()})),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:"createAudioMessage",param:"onProgress",desc:yo()})),!0}}},createVideoMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:"createVideoMessage",param:"payload",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:"createVideoMessage",param:"payload.file",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&"undefined"!=typeof uni?!!st(e.file.tempFile)||(Ye.warn(lo({api:"createVideoMessage",param:"payload.file",desc:No()})),!1):(Ye.warn(lo({api:"createVideoMessage",param:"payload.file",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:"createVideoMessage",param:"payload.file",desc:No()})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:"createVideoMessage",param:"onProgress",desc:yo()})),!0}}},createFaceMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?rt(e.index)?!!it(e.data)||(Ye.warn(lo({api:"createFaceMessage",param:"payload.data",desc:po()})),!1):(Ye.warn(lo({api:"createFaceMessage",param:"payload.index",desc:_o()})),!1):(Ye.warn(lo({api:"createFaceMessage",param:"payload",desc:So()})),!1)}})},createFileMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:"createFileMessage",param:"payload",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:"createFileMessage",param:"payload.file",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ye.warn(lo({api:"createFileMessage",param:"payload.file",desc:No()})),!1):(Ye.warn(lo({api:"createFileMessage",param:"payload.file",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:"createFileMessage",param:"payload.file",desc:No()})),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:"createFileMessage",param:"onProgress",desc:yo()})),!0}}},createLocationMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.description)?rt(e.longitude)?!!rt(e.latitude)||(Ye.warn(lo({api:"createLocationMessage",param:"payload.latitude",desc:_o()})),!1):(Ye.warn(lo({api:"createLocationMessage",param:"payload.longitude",desc:_o()})),!1):(Ye.warn(lo({api:"createLocationMessage",param:"payload.description",desc:po()})),!1):(Ye.warn(lo({api:"createLocationMessage",param:"payload",desc:So()})),!1)}})},createMergerMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(oo(e.messageList))return Ye.warn(lo({api:"createMergerMessage",param:"payload.messageList",desc:Mo()})),!1;if(oo(e.compatibleText))return Ye.warn(lo({api:"createMergerMessage",param:"payload.compatibleText",desc:go("compatibleText")})),!1;var t=!1;return e.messageList.forEach((function(e){e.status===ro.FAIL&&(t=!0)})),!t||(Ye.warn(lo({api:"createMergerMessage",param:"payload.messageList",desc:co?"Does not support combining messages that failed to sent":"不支持合并已发送失败的消息"})),!1)}})},revokeMessage:[t(t({name:"message"},Go),{},{validator:function(e){return oo(e)?(Ye.warn(lo({api:"revokeMessage",param:"message",desc:Ao()})),!1):e.conversationType===D.CONV_SYSTEM?(Ye.warn(lo({api:"revokeMessage",param:"message",desc:co?"Only one-to-one or group message can be recalled":"不支持撤回系统会话消息,只支持撤回单聊消息或群消息"})),!1):!0!==e.isRevoked||(Ye.warn(lo({api:"revokeMessage",param:"message",desc:co?"Message has been recalled":"消息已经被撤回,请勿重复操作"})),!1)}})],deleteMessage:[t(t({name:"messageList"},Oo),{},{validator:function(e){return!oo(e)||(Ye.warn(lo({api:"deleteMessage",param:"messageList",desc:Mo()})),!1)}})],translateText:{sourceTextList:Oo,sourceLanguage:Lo,targetLanguage:Lo},modifyMessage:[t(t({name:"message"},Go),{},{validator:function(e){return oo(e)?(Ye.warn(lo({api:"modifyMessage",param:"message",desc:Ao()})),!1):e.conversationType===D.CONV_SYSTEM?(Ye.warn(lo({api:"modifyMessage",param:"message",desc:co?"Only one-to-one or group message can be modified":"不支持修改系统会话消息,只支持修改单聊消息或群消息"})),!1):!0!==e._onlineOnlyFlag||(Ye.warn(lo({api:"modifyMessage",param:"message",desc:co?"Does not support modifying online message":"不支持修改在线消息"})),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return lt(e)?(0===e.length&&Ye.warn(lo({api:"getUserProfile",param:"userIDList",desc:Mo()})),!0):(Ye.warn(lo({api:"getUserProfile",param:"userIDList",desc:vo()})),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!dt(e)||(!!lt(e)||(Ye.warn(lo({api:"updateMyProfile",param:"profileCustomField",desc:vo()})),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!it(e)||(Ye.warn(lo({api:"setSelfStatus",param:"customStatus",desc:po()})),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:"getUserStatus",param:"userIDList",desc:Mo()})),!1):(Ye.warn(lo({api:"getUserStatus",param:"userIDList",desc:vo()})),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:"subscribeUserStatus",param:"userIDList",desc:Mo()})),!1):(Ye.warn(lo({api:"subscribeUserStatus",param:"userIDList",desc:vo()})),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:"subscribeUserStatus",param:"userIDList",desc:vo()})),!1))}}},addFriend:{to:Lo,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(Ye.warn(lo({api:"addFriend",param:"source",desc:Co("keyword",8)})),!1):(Ye.warn(lo({api:"addFriend",param:"source",desc:co?"The prefix of the source field is AddSource_Type_":"前缀必须是:AddSource_Type_"})),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(Ye.warn(lo({api:"addFriend",param:"remark",desc:Co("remark",96)})),!1)}}},deleteFriend:{userIDList:Oo},checkFriend:{userIDList:Oo},getFriendProfile:{userIDList:Oo},updateFriend:{userID:Lo,remark:{type:"String",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(Ye.warn(lo({api:"updateFriend",param:"remark",desc:Co("remark",96)})),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!lt(e))return Ye.warn(lo({api:"updateFriend",param:"friendCustomField",desc:vo()})),!1;var t=!0;return e.forEach((function(e){return it(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?it(e.value)?e.key.replace("Tag_SNS_Custom_","").length>8?(Ye.warn(lo({api:"updateFriend",param:"friendCustomField",desc:Co("keyword",8)})),t=!1):void 0:(Ye.warn(lo({api:"updateFriend",param:"friendCustomField",desc:Eo("value")})),t=!1):(Ye.warn(lo({api:"updateFriend",param:"friendCustomField",desc:co?"The prefix of the friendCustomField is Tag_SNS_Custom":"前缀必须是 Tag_SNS_Custom"})),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Lo},refuseFriendApplication:{userID:Lo},deleteFriendApplication:{userID:Lo},createFriendGroup:{name:Lo},deleteFriendGroup:{name:Lo},addToFriendGroup:{name:Lo,userIDList:Oo},removeFromFriendGroup:{name:Lo,userIDList:Oo},renameFriendGroup:{oldName:Lo,newName:Lo},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:"sendMessageReadReceipt",param:"messageList",desc:Mo()})),!1):(Ye.warn(lo({api:"sendMessageReadReceipt",param:"messageList",desc:vo()})),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:"getMessageReadReceiptList",param:"messageList",desc:Mo()})),!1):(Ye.warn(lo({api:"getMessageReadReceiptList",param:"messageList",desc:vo()})),!1)}}],createTopicInCommunity:{groupID:Lo,topicName:Lo},deleteTopicFromCommunity:{groupID:Lo,topicIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:"deleteTopicFromCommunity",param:"topicIDList",desc:vo()})),!1))}}},updateTopicProfile:{groupID:Lo,topicID:Lo},getTopicList:{groupID:Lo,topicIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:"getTopicList",param:"topicIDList",desc:vo()})),!1))}}}},wo={login:"login",logout:"logout",on:"on",once:"once",off:"off",setLogLevel:"setLogLevel",registerPlugin:"registerPlugin",destroy:"destroy",createTextMessage:"createTextMessage",createTextAtMessage:"createTextAtMessage",createImageMessage:"createImageMessage",createAudioMessage:"createAudioMessage",createVideoMessage:"createVideoMessage",createCustomMessage:"createCustomMessage",createFaceMessage:"createFaceMessage",createFileMessage:"createFileMessage",createLocationMessage:"createLocationMessage",createMergerMessage:"createMergerMessage",downloadMergerMessage:"downloadMergerMessage",createForwardMessage:"createForwardMessage",sendMessage:"sendMessage",resendMessage:"resendMessage",revokeMessage:"revokeMessage",deleteMessage:"deleteMessage",translateText:"translateText",modifyMessage:"modifyMessage",sendMessageReadReceipt:"sendMessageReadReceipt",getGroupMessageReadMemberList:"getGroupMessageReadMemberList",getMessageReadReceiptList:"getMessageReadReceiptList",setMessageExtensions:"setMessageExtensions",getMessageExtensions:"getMessageExtensions",deleteMessageExtensions:"deleteMessageExtensions",getMessageList:"getMessageList",findMessage:"findMessage",getMessageListHopping:"getMessageListHopping",setMessageRead:"setMessageRead",setAllMessageRead:"setAllMessageRead",getConversationList:"getConversationList",getConversationProfile:"getConversationProfile",deleteConversation:"deleteConversation",pinConversation:"pinConversation",getTotalUnreadMessageCount:"getTotalUnreadMessageCount",setConversationCustomData:"setConversationCustomData",markConversation:"markConversation",createConversationGroup:"createConversationGroup",getConversationGroupList:"getConversationGroupList",deleteConversationGroup:"deleteConversationGroup",renameConversationGroup:"renameConversationGroup",addConversationsToGroup:"addConversationsToGroup",deleteConversationsFromGroup:"deleteConversationsFromGroup",clearHistoryMessage:"clearHistoryMessage",getGroupList:"getGroupList",getGroupProfile:"getGroupProfile",createGroup:"createGroup",joinGroup:"joinGroup",updateGroupProfile:"updateGroupProfile",quitGroup:"quitGroup",dismissGroup:"dismissGroup",changeGroupOwner:"changeGroupOwner",searchGroupByID:"searchGroupByID",setMessageRemindType:"setMessageRemindType",getGroupApplicationList:"getGroupApplicationList",handleGroupApplication:"handleGroupApplication",initGroupAttributes:"initGroupAttributes",setGroupAttributes:"setGroupAttributes",deleteGroupAttributes:"deleteGroupAttributes",getGroupAttributes:"getGroupAttributes",setGroupCounters:"setGroupCounters",increaseGroupCounter:"increaseGroupCounter",decreaseGroupCounter:"decreaseGroupCounter",getGroupCounters:"getGroupCounters",getJoinedCommunityList:"getJoinedCommunityList",createTopicInCommunity:"createTopicInCommunity",deleteTopicFromCommunity:"deleteTopicFromCommunity",updateTopicProfile:"updateTopicProfile",getTopicList:"getTopicList",getGroupMemberProfile:"getGroupMemberProfile",getGroupMemberList:"getGroupMemberList",addGroupMember:"addGroupMember",deleteGroupMember:"deleteGroupMember",setGroupMemberNameCard:"setGroupMemberNameCard",setGroupMemberMuteTime:"setGroupMemberMuteTime",setGroupMemberRole:"setGroupMemberRole",setGroupMemberCustomField:"setGroupMemberCustomField",getGroupOnlineMemberCount:"getGroupOnlineMemberCount",markGroupMemberList:"markGroupMemberList",getMyProfile:"getMyProfile",getUserProfile:"getUserProfile",updateMyProfile:"updateMyProfile",setSelfStatus:"setSelfStatus",getUserStatus:"getUserStatus",subscribeUserStatus:"subscribeUserStatus",unsubscribeUserStatus:"unsubscribeUserStatus",getBlacklist:"getBlacklist",addToBlacklist:"addToBlacklist",removeFromBlacklist:"removeFromBlacklist",getFriendList:"getFriendList",addFriend:"addFriend",deleteFriend:"deleteFriend",checkFriend:"checkFriend",updateFriend:"updateFriend",getFriendProfile:"getFriendProfile",getFriendApplicationList:"getFriendApplicationList",refuseFriendApplication:"refuseFriendApplication",deleteFriendApplication:"deleteFriendApplication",acceptFriendApplication:"acceptFriendApplication",setFriendApplicationRead:"setFriendApplicationRead",getFriendGroupList:"getFriendGroupList",createFriendGroup:"createFriendGroup",renameFriendGroup:"renameFriendGroup",deleteFriendGroup:"deleteFriendGroup",addToFriendGroup:"addToFriendGroup",removeFromFriendGroup:"removeFromFriendGroup",callExperimentalAPI:"callExperimentalAPI"},Fo="sign",qo="message",xo="messageExtension",Vo="user",Bo="c2c",Ko="group",Ho="sns",Wo="groupMember",Yo="Topic",jo="conversation",$o="context",zo="storage",Jo="eventStat",Xo="netMonitor",Qo="bigDataChannel",Zo="upload",en="plugin",tn="syncUnreadMessage",on="session",nn="channel",an="message_loss_detection",sn="cloudControl",rn="workerTimer",cn="recoverMessage",un="qualityStat",ln="commercialConfig",dn="offlinePush",pn="profanityFilter",gn="transCmd",_n="comboMessage",hn={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},fn={2e3:"无 SDKAppID",2022:"无 tinyID",2023:"无 a2key",2024:"用户未登录",2025:"重复登录",2040:"未检测到上传插件",2041:"获取 COS 预签名 URL 失败",2100:"消息发送失败",2101:"未加入直播群不能向直播群发送消息",2105:"需要 Message 的实例",2106:'Message.conversationType 只能为 "C2C" 或 "GROUP"',2108:"无法发送空文件",2109:"回调函数运行时遇到错误,请检查接入侧代码",2110:"消息撤回失败",2111:"消息删除失败",2112:"设置所有未读消息为已读处理失败",2114:"消息列表中没有需要发送已读回执的消息",2115:"不能在支持话题的群组中发消息,请检查群组 isSupportTopic 属性",2116:"不支持删除群系统通知",2117:"翻译文本失败",2251:"请先选择一张图片",2252:"只允许上传 jpg png jpeg gif bmp image webp 格式的图片",2253:"图片大小超过20M,无法发送",2300:"语音上传失败",2301:"语音大小超过20M,无法发送",2350:"视频上传失败",2351:"视频大小超过100M,无法发送",2352:"只允许上传 mp4/mov 格式的视频",2400:"文件上传失败",2401:"请先选择一个文件",2402:"文件大小超过100M,无法发送",2403:"缺少必要的参数文件 URL",2450:"非合并消息",2451:"合并消息的 messageKey 无效",2452:"下载合并消息失败",2453:"选择的消息类型(如群提示消息)不可以转发",2480:"修改消息时发生冲突",2481:"直播群不支持修改消息",2500:"没有找到相应的会话,请检查传入参数",2501:"没有找到相应的用户或群主,请检查传入参数",2502:"未记录的会话类型",2503:"无效的会话 ID",2600:"非法的群类型,请检查传入参数",2601:"不能加入 Work 类型的群组",2602:"群组 ID 非法",2603:"找不到指定 ID 的群组",2620:"AVChatRoom 类型的群组不能转让群主",2621:"不能把群主转让给自己",2622:"不能解散 Work 类型的群组",2623:"用户不在该群组内",2660:"加群失败,请检查传入参数或重试",2661:"AVChatRoom 类型的群不支持邀请群成员",2662:"非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群",2681:"你不是群主,只有群主才有权限操作",2682:"不能在 Work / AVChatRoom 类型的群中设置群成员身份",2683:"不合法的群成员身份,请检查传入参数",2684:"不能设置自己的群成员身份,请检查传入参数",2685:"不能将自己禁言,请检查传入参数",2686:"封禁时长无效,必须传入 duration 参数且要大于 0",2700:"指定的 userID 不是我的好友效",2701:"已经是好友关系",2710:"好友分组已经存在",2711:"好友分组不存在",2716:"好友申请不存在",2721:"传入 updateMyProfile 接口的参数无效",2722:"updateMyProfile 无标配资料字段或自定义资料字段",2742:"不能拉黑自己",2800:"网络错误",2801:"请求超时",2805:"未连接到网络",2903:"未经明确定义的错误",2905:"无效操作,如调用了未定义或者未实现的方法等",2996:"超出 SDK 频率控制",2997:"无法找到协议",2998:"无法找到模块,关系链使用指引:https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-03-sns.html",2999:"接口调用时机不合理,请等待 SDK 处于 ready 状态后再调用(监听 TIM.EVENT.SDK_READY 事件)",3e3:"用户正在登录中导致 sdk not ready",3001:"用户登录失败导致 sdk not ready",3002:"用户多终端登录被踢出导致 sdk not ready",3003:"用户多实例登录被踢出导致 sdk not ready",3004:"用户 userSig 过期被踢出导致 sdk not ready",3005:"用户已登出导致 sdk not ready",3006:"用户被 REST API 踢出导致 sdk not ready",3021:"非法的 topicID",3122:"套餐包不支持该接口的使用,请升级到旗舰版套餐",3123:"文本包含本地审核拦截词",60022:"后台服务正忙,请稍后再试"},mn={2e3:"No SDKAppID",2022:"No tinyID",2023:"No a2key",2024:"The user has not logged in",2025:"Repeated login",2040:"No upload plugin is detected",2041:"Failed to get cos presig url",2100:"Failed to send the message",2101:"Failed to send the message to an audio-video group due to not joining it",2105:"A message instance is required",2106:'Message.conversationType can only be "C2C" or "GROUP"',2108:"An empty file cannot be sent",2109:"An error occurred while running the callback function. Please check the code on the access side",2110:"Failed to recall the message",2111:"Failed to delete the message",2112:"Failed to set all messages as read",2114:"No messages in the message list that require a read receipt",2115:"Message cannot be sent to Community that supports Topic, please check the isSupportTopic property of Community",2116:"Group system notification cannot be deleted",2117:"Failed to translate the text",2251:"Please select an image first",2252:"Only JPG/PNG/JPEG/GIF images can be uploaded",2253:"Unable to send the image as it exceeds 20 MB",2300:"Failed to upload the audio",2301:"Unable to send the audio as it exceeds 20 MB",2350:"Failed to upload the video",2351:"Unable to send the video as it exceeds 100 MB",2352:"Only MP4 videos can be uploaded",2400:"File upload failed",2401:"Please select a file first",2402:"Unable to send the file as it exceeds 100 MB",2403:"The required parameter file URL is missing",2450:"Non-combined message",2451:"Invalid messageKey of the combined message",2452:"Failed to download the combined message",2453:"The selected message type (such as group notification) does not support forwarding",2480:"Conflict occurred while modifying message",2481:"Audio-video group does not support modifying messages",2500:"The corresponding conversation is not found. Please check the input parameters",2501:"The corresponding user or group owner is not found. Please check the input parameters",2502:"Unrecorded conversation type",2503:"Invalid conversationID",2600:"Invalid group type. Please check the input parameters",2601:"Unable to join a work group",2602:"Invalid groupID",2603:"The group with the given id could not be found",2620:"The group owner of an audio-video group cannot be changed",2621:"You cannot change the group owner to yourself",2622:"A work group cannot be disbanded",2623:"The user is not in the group",2660:"Failed to join the group. Please check the input parameters and try again",2661:"Audio-video groups do not support inviting group members",2662:"Non Audio-video groups do not allow anonymous joining. Please log in before you join the group",2681:"You are not the group owner. Only the group owner has the permission to perform the operation",2682:"You cannot set the group member role in a Work or Audio-video group",2683:"Invalid group member role. Please check the input parameters",2684:"You cannot set the group member role for yourself. Please check the input parameters",2685:"You cannot mute yourself. Please check the input parameters",2686:"Ban duration must be greater than 0",2700:"The specified userID is not my friend",2701:"The specified userID is my friend already",2710:"The Friend group already exists",2711:"The Friend group does not exist",2716:"The Friend application does not exist",2721:"Invalid parameter passed in to the updateMyProfile API",2722:"updateMyProfile does not contain standard or custom profile fields",2742:"You cannot blacklist yourself",2800:"Network error",2801:"Request timeout",2805:"Network disconnected",2903:"Undefined error",2905:"Invalid operation, such as calling an undefined or unimplemented method",2996:"Frequency control limit exceeded",2997:"Protocol not found",2998:"Module not found",2999:"The API call timing is inappropriate. Call the API until the SDK is ready (listening for the TIM.EVENT.SDK_READY event)",3e3:"SDK not ready because the user is Logging in",3001:"SDK not ready because the user login failed",3002:"SDK not ready because the user is kicked offline(the same account logs in from multiple pages on the web client)",3003:"SDK not ready because the user is kicked offline(the same account logs in from multiple terminals)",3004:"SDK not ready because the user is kicked offline(the signature expires)",3005:"SDK not ready because the user is logged out ",3006:"SDK not ready because the user is kicked offline by REST API",3021:"Invalid topicID",3122:"Please upgrade to the ultimate version",3123:"Blocked due to filtering profanity",60022:"Service is busy, please try again later"},vn=function(){function e(t){n(this,e),this._moduleManager=t,this._className=""}return s(e,[{key:"isLoggedIn",value:function(){return this._moduleManager.getModule($o).isLoggedIn()}},{key:"isOversea",value:function(){return this._moduleManager.getModule($o).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._moduleManager.getModule($o).isPrivateNetWork()}},{key:"getMyUserID",value:function(){return this._moduleManager.getModule($o).getUserID()}},{key:"getMyTinyID",value:function(){return this._moduleManager.getModule($o).getTinyID()}},{key:"getSDKAppID",value:function(){return this._moduleManager.getModule($o).getSDKAppID()}},{key:"isIntl",value:function(){return this._moduleManager.getModule($o).isIntl()}},{key:"isDevMode",value:function(){return this._moduleManager.getModule($o).isDevMode()}},{key:"getModule",value:function(e){return this._moduleManager.getModule(e)}},{key:"getPlatform",value:function(){return ge}},{key:"getNetworkType",value:function(){return this._moduleManager.getModule(Xo).getNetworkType()}},{key:"probeNetwork",value:function(e){return this._moduleManager.getModule(Xo).probe(e)}},{key:"getCloudConfig",value:function(e){return this._moduleManager.getModule(sn).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._moduleManager.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._moduleManager.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._moduleManager.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._moduleManager.getModule($o).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!oo(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(S.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return oo(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._moduleManager.getModule(on).request(e)}},{key:"canIUse",value:function(e){return this._moduleManager.getModule(ln).canIUse(e)}},{key:"getErrorMessage",value:function(e){return this.isIntl()?mn[e]:fn[e]}}]),e}(),Mn="wslogin",yn="wslogout",In="wshello",Cn="KickOther",Tn="getmsg",En="authkey",Sn="sendmsg",Dn="send_group_msg",Nn="portrait_get_all",An="portrait_set",kn="black_list_get",Rn="black_list_add",Ln="black_list_delete",On="msgwithdraw",Gn="msgreaded",Pn="set_c2c_peer_mute_notifications",Un="get_c2c_peer_mute_notifications",bn="getroammsg",wn="get_peer_read_time",Fn="delete_c2c_msg_ramble",qn="modify_c2c_msg",xn="set_key_values",Vn="get_key_values",Bn="page_get",Kn="get",Hn="delete",Wn="clear_msg",Yn="top",jn="deletemsg",$n="set_conv_custom_data",zn="mark_contact",Jn="create_contact_group",Xn="del_contact_group",Qn="update_contact_group",Zn="add_conv_to_group",ea="del_conv_from_group",ta="get_contact_group",oa="get_joined_group_list",na="get_group_self_member_info",aa="create_group",sa="destroy_group",ra="modify_group_base_info",ia="apply_join_group",ca="apply_join_group_noauth",ua="quit_group",la="get_group_public_info",da="change_group_owner",pa="handle_apply_join_group",ga="handle_invite_join_group",_a="group_msg_recall",ha="msg_read_report",fa="read_all_unread_msg",ma="group_msg_get",va="get_group_msg_receipt",Ma="group_msg_receipt",ya="c2c_msg_read_receipt",Ia="get_group_msg_receipt_detail",Ca="get_pendency",Ta="deletemsg",Ea="get_msg",Sa="get_msg_noauth",Da="get_online_member_num",Na="delete_group_ramble_msg_by_seq",Aa="modify_group_msg",ka="set_group_attr",Ra="modify_group_attr",La="delete_group_attr",Oa="clear_group_attr",Ga="get_group_attr",Pa="group_set_key_values",Ua="group_get_key_values",ba="get_group_notify",wa="update_group_counter",Fa="get_group_counter",qa="get_group_member_info",xa="get_members",Va="get_specified_group_member_info",Ba="add_group_member",Ka="delete_group_member",Ha="ban_group_member",Wa="modify_group_member_info",Ya="modify_user_info",ja="cos",$a="pre_sig",za="video_cover",Ja="tim_web_report_v2",Xa="alive",Qa="msg_push",Za="multi_msg_push_ws",es="ws_msg_push_ack",ts="stat_forceoffline",os="save_relay_json_msg",ns="get_relay_json_msg",as="fetch_config",ss="push_configv2",rs="fetch_imsdk_purchase_bitsv2",is="push_imsdk_purchase_bitsv2",cs="notify2",us="create_topic",ls="destroy_topic",ds="modify_topic",ps="get_topic",gs="ws_set_custom_status",_s="ws_get_user_status",hs="ws_status_subscribe",fs="ws_status_unsubscribe",ms="ws_stat_background",vs="ws_stat_foreground",Ms="ws_stat_settoken",ys="get_local_words",Is="ws_batch_trans_text",Cs="networkRTT",Ts="messageE2EDelay",Es="sendMessageC2C",Ss="sendMessageGroup",Ds="sendMessageGroupAV",Ns="sendMessageRichMedia",As="cosUpload",ks="messageReceivedGroup",Rs="messageReceivedGroupAVPush",Ls="messageReceivedGroupAVPull",Os=(r(so={},Cs,2),r(so,Ts,3),r(so,Es,4),r(so,Ss,5),r(so,Ds,6),r(so,Ns,7),r(so,ks,8),r(so,Rs,9),r(so,Ls,10),r(so,As,11),so),Gs={info:4,warning:5,error:6},Ps={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Us={login:4},bs=function(){function e(t){n(this,e),this.eventType=Us[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=xe()}return s(e,[{key:"updateTimeStamp",value:function(){this.timestamp=xe()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var o=xe();0===this.costTime&&(this.costTime=o-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(o)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,o){if(!(e instanceof Error))return Ye.warn("SSOLogData.setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;if(this.setNetworkType(o),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var n=hn.NO_NETWORK;this.setCode(n),this.setMoreMessage(mn[n])}return this.setLevel("error"),this}},{key:"setCode",value:function(e){return dt(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),rt(e)?this.code=e:Ye.warn("SSOLogData.setCode value not a number, please check!",e,o(e))),this}},{key:"setMessage",value:function(e){return dt(e)||this._sentFlag||(rt(e)&&(this.message=e.toString()),it(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return dt(e)||this._sentFlag||(this.level=Gs[e]),this}},{key:"setMoreMessage",value:function(e){return oo(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(dt(e))Ye.warn("SSOLogData.setNetworkType value is undefined, please check!");else{var t=Ps[e.toLowerCase()];dt(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),ws={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",LOGIN:"login",LOGOUT:"logout",KICKED_OUT:"kickedOut",REGISTER_PLUGIN:"registerPlugin",KICK_OTHER:"kickOther",WS_CONNECT:"wsConnect",WS_ON_OPEN:"wsOnOpen",WS_ON_CLOSE:"wsOnClose",WS_ON_ERROR:"wsOnError",NETWORK_CHANGE:"networkChange",GET_COS_AUTH_KEY:"getCosAuthKey",GET_COS_PRE_SIG_URL:"getCosPreSigUrl",GET_SNAPSHOT_INFO:"getSnapshotInfo",UPLOAD:"upload",SEND_MESSAGE:"sendMessage",SEND_MESSAGE_WITH_RECEIPT:"sendMessageWithReceipt",SEND_COMBO_MESSAGE:"sendComboMessage",GET_C2C_ROAMING_MESSAGES:"getC2CRoamingMessages",GET_GROUP_ROAMING_MESSAGES:"getGroupRoamingMessages",GET_C2C_ROAMING_MESSAGES_HOPPING:"getC2CRoamingMessagesHopping",GET_GROUP_ROAMING_MESSAGES_HOPPING:"getGroupRoamingMessagesHopping",GET_READ_RECEIPT:"getReadReceipt",GET_READ_RECEIPT_DETAIL:"getReadReceiptDetail",SEND_READ_RECEIPT:"sendReadReceipt",SEND_C2C_READ_RECEIPT:"sendC2CReadReceipt",REVOKE_MESSAGE:"revokeMessage",DELETE_MESSAGE:"deleteMessage",MODIFY_MESSAGE:"modifyMessage",TRANSLATE_TEXT:"translateText",SET_C2C_MESSAGE_READ:"setC2CMessageRead",SET_GROUP_MESSAGE_READ:"setGroupMessageRead",EMPTY_MESSAGE_BODY:"emptyMessageBody",GET_PEER_READ_TIME:"getPeerReadTime",UPLOAD_MERGER_MESSAGE:"uploadMergerMessage",DOWNLOAD_MERGER_MESSAGE:"downloadMergerMessage",JSON_PARSE_ERROR:"jsonParseError",MESSAGE_E2E_DELAY_EXCEPTION:"messageE2EDelayException",SET_MESSAGE_EXTENSIONS:"setMessageExtensions",DELETE_MESSAGE_EXTENSIONS:"deleteMessageExtensions",GET_MESSAGE_EXTENSIONS:"getMessageExtensions",PROFANITY_FILTER:"profanityFilter",GET_CONVERSATION_LIST:"getConversationList",GET_CONVERSATION_PROFILE:"getConversationProfile",DELETE_CONVERSATION:"deleteConversation",CLEAR_HISTORY_MESSAGE:"clearHistoryMessage",PIN_CONVERSATION:"pinConversation",GET_CONVERSATION_LIST_IN_STORAGE:"getConversationListInStorage",SYNC_CONVERSATION_LIST:"syncConversationList",SET_ALL_MESSAGE_READ:"setAllMessageRead",SET_CONV_CUSTOM_DATA:"setConvCustomData",MARK_CONVERSATION:"markConversation",GET_REMOTE_CONV_GROUP_LIST:"getRemoteConvGroupList",CREATE_CONV_GROUP:"createConvGroup",DELETE_CONV_GROUP:"deleteConvGroup",RENAME_CONV_GROUP:"renameConvGroup",ADD_CONVS_TO_GROUP:"addConvsToGroup",DELETE_CONVS_FROM_GROUP:"deleteConvsFromGroup",CREATE_GROUP:"createGroup",APPLY_JOIN_GROUP:"applyJoinGroup",QUIT_GROUP:"quitGroup",SEARCH_GROUP_BY_ID:"searchGroupByID",CHANGE_GROUP_OWNER:"changeGroupOwner",HANDLE_GROUP_APPLICATION:"handleGroupApplication",HANDLE_GROUP_INVITATION:"handleGroupInvitation",SET_MESSAGE_REMIND_TYPE:"setMessageRemindType",DISMISS_GROUP:"dismissGroup",UPDATE_GROUP_PROFILE:"updateGroupProfile",GET_GROUP_LIST:"getGroupList",GET_GROUP_PROFILE:"getGroupProfile",GET_GROUP_LIST_IN_STORAGE:"getGroupListInStorage",GET_GROUP_LAST_SEQUENCE:"getGroupLastSequence",RECOVER_MESSAGE:"recoverMessage",PAGING_GET_GROUP_LIST:"pagingGetGroupList",PAGING_GET_GROUP_LIST_WITH_TOPIC:"pagingGetGroupListWithTopic",GET_GROUP_SIMPLIFIED_INFO:"getGroupSimplifiedInfo",JOIN_WITHOUT_AUTH:"joinWithoutAuth",INIT_GROUP_ATTRIBUTES:"initGroupAttributes",SET_GROUP_ATTRIBUTES:"setGroupAttributes",DELETE_GROUP_ATTRIBUTES:"deleteGroupAttributes",GET_GROUP_ATTRIBUTES:"getGroupAttributes",SET_GROUP_COUNTERS:"setGroupCounters",INCREASE_GROUP_COUNTER:"increaseGroupCounter",DECREASE_GROUP_COUNTER:"decreaseGroupCounter",GET_GROUP_COUNTERS:"getGroupCounters",GET_GROUP_MEMBER_LIST:"getGroupMemberList",GET_AVCHATROOM_MEMBER_LIST:"getAVChatRoomMemberList",GET_GROUP_MEMBER_PROFILE:"getGroupMemberProfile",ADD_GROUP_MEMBER:"addGroupMember",DELETE_GROUP_MEMBER:"deleteGroupMember",BAN_AVCHATROOM_MEMBER:"banAVChatRoomMember",SET_GROUP_MEMBER_MUTE_TIME:"setGroupMemberMuteTime",SET_GROUP_MEMBER_NAME_CARD:"setGroupMemberNameCard",SET_GROUP_MEMBER_ROLE:"setGroupMemberRole",SET_GROUP_MEMBER_CUSTOM_FIELD:"setGroupMemberCustomField",GET_GROUP_ONLINE_MEMBER_COUNT:"getGroupOnlineMemberCount",MARK_GROUP_MEMBER_LIST:"markGroupMemberList",SYNC_MESSAGE:"syncMessage",LONG_POLLING_AV_ERROR:"longPollingAVError",MESSAGE_LOSS:"messageLoss",MESSAGE_STACKED:"messageStacked",GET_USER_PROFILE:"getUserProfile",UPDATE_MY_PROFILE:"updateMyProfile",GET_BLACKLIST:"getBlacklist",ADD_TO_BLACKLIST:"addToBlacklist",REMOVE_FROM_BLACKLIST:"removeFromBlacklist",SET_SELF_STATUS:"setSelfStatus",GET_USER_STATUS:"getUserStatus",SUBSCRIBE_USER_STATUS:"subscribeUserStatus",UNSUBSCRIBE_USER_STATUS:"unsubscribeUserStatus",ADD_FRIEND:"addFriend",CHECK_FRIEND:"checkFriend",DELETE_FRIEND:"removeFromFriendList",GET_FRIEND_PROFILE:"getFriendProfile",GET_FRIEND_LIST:"getFriendList",UPDATE_FRIEND:"updateFriend",GET_FRIEND_APPLICATION_LIST:"getFriendApplicationList",DELETE_FRIEND_APPLICATION:"deleteFriendApplication",ACCEPT_FRIEND_APPLICATION:"acceptFriendApplication",REFUSE_FRIEND_APPLICATION:"refuseFriendApplication",SET_FRIEND_APPLICATION_READ:"setFriendApplicationRead",CREATE_FRIEND_GROUP:"createFriendGroup",DELETE_FRIEND_GROUP:"deleteFriendGroup",RENAME_FRIEND_GROUP:"renameFriendGroup",ADD_TO_FRIEND_GROUP:"addToFriendGroup",REMOVE_FROM_FRIEND_GROUP:"removeFromFriendGroup",GET_FRIEND_GROUP_LIST:"getFriendGroupList",CREATE_TOPIC:"createTopic",DELETE_TOPIC:"deleteTopic",UPDATE_TOPIC_PROFILE:"updateTopicProfile",GET_TOPIC_LIST:"getTopicList",RELAY_GET_TOPIC_LIST:"relayGetTopicList",GET_TOPIC_LAST_SEQUENCE:"getTopicLastSequence",GET_DEVICE_TOKEN:"getDeviceToken",GET_DEVICE_TOKEN_RES:"getDeviceTokenRes",OFFLINE_PUSH_SET_TOKEN:"offlinePushSetToken",SET_APP_SHOW_LISTENER:"setAppShowListener",SET_APP_SHOW_LISTENER_RES:"setAppShowListenerRes",ON_FOREGROUND:"onForeground",ON_BACKGROUND:"onBackground",MP_HIDE_TO_SHOW:"mpHideToShow",CALLBACK_FUNCTION_ERROR:"callbackFunctionError",FETCH_CLOUD_CONTROL_CONFIG:"fetchCloudControlConfig",PUSHED_CLOUD_CONTROL_CONFIG:"pushedCloudControlConfig",FETCH_COMMERCIAL_CONFIG:"fetchCommercialConfig",PUSHED_COMMERCIAL_CONFIG:"pushedCommercialConfig",ERROR:"error",LAST_MESSAGE_NOT_EXIST:"lastMessageNotExist"},Fs=function(){function e(t){n(this,e),this.type=D.MSG_TEXT,this.content={text:t.text||""}}return s(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),qs=function(){function e(t){n(this,e),this._imageMemoryURL="",le?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=D.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||je.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._defaultImage="http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg",this._autoFixUrl()}return s(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=Ct(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=t.url||e._imageMemoryURL||e._defaultImage},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,o=null,n=null;t<=2;)n=dt(e)||dt(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(o=new this._ImageInfoModel(n)).setSizeType(t+1),o.setType(t),this.addImageInfo(o),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,o=this.content.imageInfoArray.length,n=0;n1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=je[e.toUpperCase()]||je.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],o=t.width,n=void 0===o?0:o,a=t.height,s=void 0===a?0:a;0!==n&&0!==s&&(Kt(e),Object.assign(e[2],Bt({originWidth:n,originHeight:s,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),xs=function(){function e(t){n(this,e),this.type=D.MSG_FACE,this.content=t||null}return s(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Vs=function(){function e(t){n(this,e),this.type=D.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:t.url,remoteAudioUrl:t.url||"",uuid:t.uuid}}return s(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),Bs={from:!0,groupID:!0,groupName:!0,to:!0},Ks=function(){function e(t){n(this,e),this.type=D.MSG_GRP_TIP,this.content={},this._initContent(t)}return s(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[o]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[o]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":t.content[o]=e[o],t.content.memberCount=e[o];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[o]);break;default:t.content[o]=e[o]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),o=0;o1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),js=function(){function e(t){n(this,e),this.type=D.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return s(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),$s=function(){function e(t){n(this,e),this.type=D.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:t.videoUrl,videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:t.thumbUrl,snapshotUrl:t.thumbUrl}}return s(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,o=e.snapshotWidth,n=e.snapshotHeight;oo(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),oo(o)||(this.content.thumbWidth=this.content.snapshotWidth=Number(o)),oo(n)||(this.content.thumbHeight=this.content.snapshotHeight=Number(n))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),zs=function(){function e(t){n(this,e),this.type=D.MSG_LOCATION;var o=t.description,a=t.longitude,s=t.latitude;this.content={description:o,longitude:a,latitude:s}}return s(e,[{key:"sendable",value:function(){return!0}}]),e}(),Js=function(){function e(t){if(n(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(D.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(D.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var o=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(o,a),o===D.MSG_MERGER?this.messageBody.push({type:o,payload:new Xs(a).content}):this.messageBody.push({type:o,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return s(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===D.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===D.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===D.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===D.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}}]),e}(),Xs=function(){function e(t){if(n(this,e),this.type=D.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var o=t.downloadKey,a=t.pbDownloadKey,s=t.title,r=t.abstractList,i=t.compatibleText,c=t.version;this.content.downloadKey=o,this.content.pbDownloadKey=a,this.content.title=s,this.content.abstractList=r,this.content.compatibleText=i,this.content.version=c||0}else if(oo(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var u=t.messageList,l=t.title,d=t.abstractList,p=t.compatibleText,g=t.version,_=[];u.forEach((function(e){if(!oo(e)){var t=new Js(e);_.push(t)}})),this.content.messageList=_,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=g||0}Ye.debug("MergerElement.content:",this.content)}return s(e,[{key:"sendable",value:function(){return!oo(this.content.messageList)||!oo(this.content.downloadKey)}}]),e}(),Qs={1:D.MSG_PRIORITY_HIGH,2:D.MSG_PRIORITY_NORMAL,3:D.MSG_PRIORITY_LOW,4:D.MSG_PRIORITY_LOWEST},Zs=function(){function e(t){n(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||D.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:Ct(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||ro.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||Be()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return s(e,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){it(e.nick)&&(this.nick=e.nick),it(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ut(t)&&it(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==D.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(D.MSG_AT_ALL))})),lt(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(D.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?ro.SUCCESS:ro.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"!=typeof this._elements[0].sendable?(Ye.warn("".concat(this._elements[0].type,' need "boolean : sendable()" method')),!1):this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===D.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return Ye.error("autoIncrementIndex(string: key) need key parameter"),!1;if(void 0===Dt[e]){var t=new Date,o="3".concat(t.getHours()).slice(-2),n="0".concat(t.getMinutes()).slice(-2),a="0".concat(t.getSeconds()).slice(-2);Dt[e]=parseInt([o,n,a,"0001"].join("")),o=null,n=null,a=null,Ye.log("autoIncrementIndex start index:".concat(Dt[e]))}return Dt[e]++}(e)),0===this.sequence&&this.conversationType===D.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===D.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,o="",n=this.conversationType;n!==D.CONV_SYSTEM?(o=n===D.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID="".concat(n).concat(o)):this.conversationID=D.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Fs||e instanceof qs||e instanceof xs||e instanceof Vs||e instanceof Ys||e instanceof $s||e instanceof Ks||e instanceof Ws||e instanceof js||e instanceof zs||e instanceof Xs}},{key:"setElement",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case D.MSG_TEXT:t.setTextElement(e.content);break;case D.MSG_IMAGE:t.setImageElement(e.content);break;case D.MSG_AUDIO:t.setAudioElement(e.content);break;case D.MSG_FILE:t.setFileElement(e.content);break;case D.MSG_VIDEO:t.setVideoElement(e.content);break;case D.MSG_CUSTOM:t.setCustomElement(e.content);break;case D.MSG_LOCATION:t.setLocationElement(e.content);break;case D.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case D.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case D.MSG_FACE:t.setFaceElement(e.content);break;case D.MSG_MERGER:t.setMergerElement(e.content);break;default:Ye.warn(e.type,e.content,"no operation......")}};if(lt(e))for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];if(e instanceof rr)return t&&null!==ir&&ir.emit(S.ERROR,e),Promise.reject(e);if(e instanceof Error){var o=new rr({code:hn.UNCAUGHT_ERROR,message:mn[hn.UNCAUGHT_ERROR]});return t&&null!==ir&&ir.emit(S.ERROR,o),Promise.reject(o)}if(!dt(e)&&!dt(e.code)){var n=new rr(e);return t&&null!==ir&&ir.emit(S.ERROR,n),Promise.reject(n)}Ye.error("IMPromise.reject code required!")},dr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="C2CModule",t._messageFromUnreadDBMap=new Map,t}return s(a,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,o=e.isInstantMessage,n=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList;Ye.debug("".concat(this._className,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(o));var s=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:n,C2CPairUnreadList:a,isInstantMessage:o}),r=s.conversationOptionsList,i=s.messageList,c=s.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(jo).onNewMessage({conversationOptionsList:r,isInstantMessage:o,isUnreadC2CMessage:c});var u=this.filterUnmodifiedMessage(i);o&&u.length>0&&this.emitOuterEvent(S.MESSAGE_RECEIVED,u),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,o=e.C2CRemainingUnreadList,n=e.C2CPairUnreadList,a=e.isInstantMessage,s=null,r=[],i=[],c={},u=this.getModule(Qo),l=this.getModule(un),d=!1,p=this.getModule(jo),g=0,_=t.length;g<_;g++){var h=t[g];h.currentUser=this.getMyUserID(),h.conversationType=D.CONV_C2C,h.isSystemMessage=!!h.isSystemMessage,(dt(h.nick)||dt(h.avatar))&&(d=!0,Ye.debug("".concat(this._className,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),s=new Zs(h),h.elements=u.parseElements(h.elements,h.from),s.setElement(h.elements),s.setNickAndAvatar({nick:h.nick,avatar:h.avatar});var f=s.conversationID;if(a){if(1===this._messageFromUnreadDBMap.get(s.ID))continue;var m=!1;if(s.from!==this.getMyUserID()){var v=p.getLatestMessageSentByPeer(f);if(v){var M=v.nick,y=v.avatar;d?s.setNickAndAvatar({nick:M,avatar:y}):M===s.nick&&y===s.avatar||(m=!0)}}else{var I=p.getLatestMessageSentByMe(f);if(I){var C=I.nick,T=I.avatar;C===s.nick&&T===s.avatar||p.modifyMessageSentByMe({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar})}}var E=1===t[g].isModified;if(p.isMessageSentByCurrentInstance(s)?s.isModified=E:E=!1,0===h.msgLifeTime)s._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(s)||i.push(s);else{if(!p.pushIntoMessageList(i,s,E))continue;m&&(p.modifyMessageSentByPeer({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar}),p.updateUserProfileSpecifiedKey({conversationID:f,nick:s.nick,avatar:s.avatar}))}a&&s.clientTime>0&&l.addMessageDelay(s.clientTime)}else this._messageFromUnreadDBMap.set(s.ID,1);if(0!==h.msgLifeTime){if(!1===s._onlineOnlyFlag){var S=p.getLastMessageTime(f);if(rt(S)&&s.time0){k=!0;var o=r.find((function(t){return t.conversationID==="C2C".concat(n[e].from)}));o?o.unreadCount=n[e].unreadCount:r.push({conversationID:"C2C".concat(n[e].from),unreadCount:n[e].unreadCount,type:D.CONV_C2C})}},L=0,O=n.length;L0&&(n=e.cloudCustomData);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:Sn,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:n,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==c?a:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_isVoipPush",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:On,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,o=e.keyList;return Ye.log("".concat(this._className,".deleteMessage toAccount:").concat(t," count:").concat(o.length)),this.request({protocolName:Fn,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:o}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,o=e.to,n=e.version,a=void 0===n?0:n,s=e.sequence,r=e.random,i=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return Jt(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:qn,requestData:{from:t,to:o,version:a,sequence:s,random:r,time:i,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,o=e.conversationID,n=e.lastMessageTime,a="".concat(this._className,".setMessageRead");if(Ye.log("".concat(a," conversationID:").concat(o," lastMessageTime:").concat(n)),!rt(n)){var s="";s=this.isIntl()?"Do not modify Conversation.lastMessage.lastTime, otherwise the result of setMessageRead will be incorrect":"请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确",Ye.warn("".concat(a," ").concat(s))}var r=new bs(ws.SET_C2C_MESSAGE_READ);return r.setMessage("conversationID:".concat(o," lastMessageTime:").concat(n)),this.request({protocolName:Gn,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:o.replace("C2C",""),lastMessageTime:n,receipt:1}]}}}).then((function(){r.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(a," ok"));var e=t.getModule(jo);return e.updateIsReadAfterReadReport({conversationID:o,lastMessageTime:n}),e.updateUnreadCount(o),er()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.log("".concat(a," failed. error:"),e),lr(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessage"),n=e.peerAccount,a=e.conversationID,s=e.count,r=e.lastMessageTime,i=e.messageKey,c="peerAccount:".concat(n," count:").concat(s||15," lastMessageTime:").concat(r||0," messageKey:").concat(i);Ye.log("".concat(o," ").concat(c));var u=new bs(ws.GET_C2C_ROAMING_MESSAGES);return this.request({protocolName:bn,requestData:{peerAccount:n,count:s||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var n=e.data,s=n.complete,r=n.messageList,i=n.messageKey,l=n.lastMessageTime;dt(r)?Ye.log("".concat(o," ok. complete:").concat(s," but messageList is undefined!")):Ye.log("".concat(o," ok. complete:").concat(s," count:").concat(r.length)),u.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(s," length:").concat(r.length)).end();var d=t.getModule(jo);1===s&&d.setCompleted(a);var p=d.onRoamingMessage(r,a);d.modifyMessageList(a),d.updateIsRead(a),d.updateRoamingMessageKeyAndTime(a,i,l);var g=d.getPeerReadTime(a);if(Ye.log("".concat(o," update isPeerRead property. conversationID:").concat(a," peerReadTime:").concat(g)),g)d.updateMessageIsPeerReadProperty(a,g);else{var _=a.replace(D.CONV_C2C,"");t.getRemotePeerReadTime([_]).then((function(){d.updateMessageIsPeerReadProperty(a,d.getPeerReadTime(a))}))}var h="";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(a);f&&(h=f.ID)}return Ye.log("".concat(o," nextReqID:").concat(h," stored message count:").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setMessage(c).setError(e,n,a).end()})),Ye.warn("".concat(o," failed. error:"),e),lr(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessagesHopping"),n=e.peerAccount,a=e.time,s=void 0===a?0:a,r=e.count,i=e.direction,c="".concat(D.CONV_C2C).concat(n),u="peerAccount:".concat(n," count:").concat(r," time:").concat(s," direction:").concat(i);Ye.log("".concat(o," ").concat(u));var l=new bs(ws.GET_C2C_ROAMING_MESSAGES_HOPPING);return this.request({protocolName:bn,requestData:{peerAccount:n,count:r+1,lastMessageTime:s,direction:i}}).then((function(e){var n=e.data,a=n.complete,s=n.messageList,r=void 0===s?[]:s,d=n.lastMessageTime;Ye.log("".concat(o," ok. complete:").concat(a," count:").concat(r.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(a," length:").concat(r.length)).end(),1!==a&&(1===i?r.pop():r.shift());var p=t.getModule(jo).onRoamingMessage(r,c,!1);t._modifyMessageList(c,p);var g=t._computeResult({complete:a,lastMessageTime:d,resultList:p});return er(g)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setMessage(u).setError(e,n,a).end()})),Ye.warn("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,o=void 0===t?0:t,n=e.lastMessageTime,a=e.resultList,s={messageList:v(void 0===a?[]:a),isCompleted:!1,nextMessageTime:""};return 1===o?(s.isCompleted=!0,s):(s.nextMessageTime=n,s)}},{key:"_modifyMessageList",value:function(e,t){var o=this.getModule(jo).getLocalConversation(e);if(o)for(var n=o.userProfile.nick,a=o.userProfile.avatar,s=this.getModule(Vo).getNickAndAvatarByUserID(this.getMyUserID()),r=s.nick,i=s.avatar,c=t.length-1;c>=0;c--){var u=t[c];"in"===u.flow&&(u.nick!==n&&u.setNickAndAvatar({nick:n}),u.avatar!==a&&u.setNickAndAvatar({avatar:a})),"out"===u.flow&&(u.nick!==r&&u.setNickAndAvatar({nick:r}),u.avatar!==i&&u.setNickAndAvatar({avatar:i}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,o="".concat(this._className,".getRemotePeerReadTime");if(oo(e))return Ye.warn("".concat(o," userIDList is empty!")),Promise.resolve();var n=new bs(ws.GET_PEER_READ_TIME);return Ye.log("".concat(o," userIDList:").concat(e)),this.request({protocolName:wn,requestData:{userIDList:e}}).then((function(a){var s=a.data.peerReadTimeList;Ye.log("".concat(o," ok. peerReadTimeList:").concat(s));for(var r="",i=t.getModule(jo),c=0;c0&&i.recordPeerReadTime("C2C".concat(e[c]),s[c]);n.setNetworkType(t.getNetworkType()).setMessage(r).end()})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.warn("".concat(o," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,o=e[0].conversationID.replace(D.CONV_C2C,""),n=new bs(ws.SEND_C2C_READ_RECEIPT);n.setMessage("peerAccount:".concat(o));var a=this.getMyUserID(),s=e.filter((function(e){return e.from!==a&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===s.length)return lr({code:hn.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._className,".sendReadReceipt");return Ye.log("".concat(r,". peerAccount:").concat(o," messageInfoList length:").concat(s.length)),this.request({protocolName:ya,requestData:{peerAccount:o,messageInfoList:s}}).then((function(e){return n.end(),Ye.log("".concat(r," ok")),er()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.warn("".concat(r," failed. error:"),e),lr(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._className,".getReadReceiptList"),o=this.getMyUserID(),n=e.filter((function(e){return e.from===o&&!0===e.needReadReceipt}));return Ye.log("".concat(t," userID:").concat(o," messageList length:").concat(n.length)),ur({messageList:n})}},{key:"getMessageExtensions",value:function(e,t){return Ye.log("".concat(this._className,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Vn,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ye.log("".concat(this._className,".modifyMessageExtensions operateType:").concat(o)),this.request({protocolName:xn,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:t,operateType:o}})}},{key:"_getMessageKey",value:function(e){var t=e.clientSequence,o=e.random,n=e.time;return"".concat(t,"_").concat(o,"_").concat(n)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._messageFromUnreadDBMap.clear()}}]),a}(vn),pr=function(){function e(){n(this,e),this.list=new Map,this._className="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return s(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e.conversationID,n=!0;this.list.has(o)||this.list.set(o,new Map);var a=this._getUniqueIDOfMessage(e),s=this.list.get(o).has(a);if(s){var r=this.list.get(o).get(a);if(!t||!0===r.isModified)return n=!1}return this.list.get(o).set(a,e),this._setLatestMessageSentByPeer(o,e),this._setLatestMessageSentByMe(o,e),n}},{key:"unshift",value:function(e,t){var o;if(lt(e)?e.length>0&&(o=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(o=e.conversationID,this._unshiftSingleMessage(e,t)),o&&o.startsWith(D.CONV_C2C)){var n=Array.from(this.list.get(o).values()),a=n.length;if(0===a)return;for(var s=a-1;s>=0;s--)if("out"===n[s].flow){this._setLatestMessageSentByMe(o,n[s]);break}for(var r=a-1;r>=0;r--)if("in"===n[r].flow){this._setLatestMessageSentByPeer(o,n[r]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var o=e.conversationID,n=this._getUniqueIDOfMessage(e);if(!this.list.has(o))return this.list.set(o,new Map),this.list.get(o).set(n,e),void t.push(e);var a=this.list.get(o),s=Array.from(a);a.has(n)||(s.unshift([n,e]),this.list.set(o,new Map(s)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var o=e.length,n=[],a=e[0].conversationID,s=this.list.get(a),r=this.list.has(a)?Array.from(s):[],i=0;i=0;l--)"in"===s[l].flow&&((i=s[l]).nick!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));Ye.log("".concat(this._className,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(c))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,o=e.latestNick,n=e.latestAvatar,a=this.list.get(t);if(!oo(a)){var s=Array.from(a.values()),r=s.length;if(0!==r){for(var i=null,c=0,u=!1,l=r-1;l>=0;l--)"out"===s[l].flow&&((i=s[l]).nick!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));Ye.log("".concat(this._className,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(c))}}}},{key:"getTopicConversationIDList",value:function(e){return v(this.list.keys()).filter((function(t){return t.startsWith("".concat(D.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===Ye.getLevel()){console.group("conversationID-messageCount");var e,t=E(this.list);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];console.log("".concat(n,"-").concat(a.size))}}catch(s){t.e(s)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var o=this._getUniqueIDOfMessage(t),n=this.list.get(e).has(o);if(Ye.debug("".concat(this._className,".onMessageModified conversationID:").concat(e," uniqueID:").concat(o," has:").concat(n)),n){var a=this.list.get(e).get(o),s=t.messageVersion,r=t.elements,i=t.cloudCustomData;return a.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var mr=["jpg","jpeg","gif","png","bmp","image","webp"],vr=["mp4","quicktime","mov"],Mr=1,yr=2,Ir=3,Cr=255,Tr=function(){function e(t){var o=this;n(this,e),oo(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||D.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||D.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],oo(t.profileCustomField)||t.profileCustomField.forEach((function(e){o.profileCustomField.push({key:e.key,value:e.value})})))}return s(e,[{key:"validate",value:function(e){var t=!0,o="";if(oo(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var n=e.profileCustomField.length,a=null,s=0;s500&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(It(e[r])," bytes"),t=!1);break;case"gender":St(ze,e.gender)||(o="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":rt(e.birthday)||(o="birthday must be a number",t=!1);break;case"location":it(e.location)||(o="location must be a string",t=!1);break;case"selfSignature":it(e.selfSignature)||(o="selfSignature must be a string",t=!1);break;case"allowType":St(Xe,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":rt(e.language)||(o="language must be a number",t=!1);break;case"avatar":it(e.avatar)||(o="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(o="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":St(Je,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":rt(e.level)||(o="level must be a number",t=!1);break;case"role":rt(e.role)||(o="role must be a number",t=!1);break;default:o="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:o}}}]),e}(),Er=s((function e(t){n(this,e),this.value=t,this.next=null})),Sr=function(){function e(t){n(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,Ye.debug("SinglyLinkedList init MAX_LENGTH:".concat(this.MAX_LENGTH))}return s(e,[{key:"set",value:function(e){var t=new Er(e);if(this.map.size0&&o.members.forEach((function(e){e.userID===t.selfInfo.userID&&Mt(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var o={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};Mt(this.selfInfo,t({},o),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),Ar=function(e,o){return dt(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:e instanceof Zs?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:zt(e.type,e.payload,o),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:zt(e.type,e.payload,o)})},kr=function(){function e(t,o){n(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Ar(t.lastMessage,o),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return s(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(D.CONV_C2C)?this.conversationID.replace(D.CONV_C2C,""):this.conversationID.startsWith(D.CONV_GROUP)?this.conversationID.replace(D.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),dt(this.userProfile)&&this.type===D.CONV_C2C?this.userProfile=new Tr({userID:e.conversationID.replace("C2C","")}):dt(this.groupProfile)&&this.type===D.CONV_GROUP&&(this.groupProfile=new Nr({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,o=e.isFromGetConversations,n=e.isUnreadC2CMessage;dt(t)||(Lt(this.subType)?this.unreadCount=0:o&&this.type===D.CONV_GROUP||o&&this.type===D.CONV_TOPIC||n&&this.type===D.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Ar(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,o=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==o.indexOf(D.CONV_AT_ME)&&-1!==o.indexOf(D.CONV_AT_ALL)&&(o=[D.CONV_AT_ALL_AT_ME]);var n={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:o,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(n),Ye.debug("Conversation.updateGroupAtInfoList conversationID:".concat(this.conversationID),this.groupAtInfoList)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,o=e.sequence;if(!Ot({groupID:t}))return!1;var n=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===o&&(t.atTypeArray.indexOf(D.CONV_AT_ME)>-1&&e.groupAtType.indexOf(D.CONV_AT_ALL)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(D.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(D.CONV_AT_ME)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),n=!0)})),n}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,o=e.time;return this.type===D.CONV_C2C&&t===this.lastMessage.lastSequence&&o===this.lastMessage.lastTime||this.type===D.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),Rr=function(){function e(t){n(this,e),this._conversationModule=t,this._className="MessageRemindHandler",this._updateSequence=0}return s(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._className,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:Un,updateSequence:this._updateSequence}).then((function(o){Ye.log("".concat(t," ok"));var n=o.data,a=n.updateSequence,s=n.muteFlagList;e._updateSequence=a,e._patchC2CMessageRemindType(s)})).catch((function(e){Ye.error("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,o=0,n="";lt(e)&&e.length>0&&e.forEach((function(e){var a=e.userID,s=e.muteFlag;0===s?n=D.MSG_REMIND_ACPT_AND_NOTE:1===s?n=D.MSG_REMIND_DISCARD:2===s&&(n=D.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:n})&&(o+=1)})),Ye.log("".concat(this._className,"._patchC2CMessageRemindType count:").concat(o))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):lt(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,o="".concat(this._className,"._setGroupMessageRemindType"),n=e.groupID,a=e.messageRemindType,s="groupID:".concat(n," messageRemindType:").concat(a),r=new bs(ws.SET_MESSAGE_REMIND_TYPE);return r.setMessage(s),this._getModule(Wo).modifyGroupMemberInfo({groupID:n,messageRemindType:a,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(o," ok. ").concat(s));var n=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),er(n)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,o=e.messageRemindType,n=this._getModule(Ko).getLocalGroupProfile(t);if(n&&(n.selfInfo.messageRemindType=o),Gt(t)){var a=t,s=$t(a),r=this._getModule(Yo).getLocalTopic(s,a);return r&&(r.updateSelfInfo({messageRemindType:o}),this._conversationModule.emitOuterEvent(S.TOPIC_UPDATED,{groupID:s,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:o})&&this._emitConversationUpdate(),{group:n}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,o="".concat(this._className,"._setC2CMessageRemindType"),n=e.userIDList,a=e.messageRemindType,s=n.slice(0,30),r=0;a===D.MSG_REMIND_DISCARD?r=1:a===D.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i="userIDList:".concat(s," messageRemindType:").concat(a),c=new bs(ws.SET_MESSAGE_REMIND_TYPE);return c.setMessage(i),this._conversationModule.request({protocolName:Pn,requestData:{userIDList:s,muteFlag:r}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var n=e.data,r=n.updateSequence,i=n.errorList;t._updateSequence=r;var u=[],l=[];lt(i)&&i.forEach((function(e){u.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=s.filter((function(e){return-1===u.indexOf(e)}));Ye.log("".concat(o," ok. successUserIDList:").concat(d," failureUserIDList:").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:a})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),s.length=u.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),ur({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._updateSequence=0}}]),e}(),Lr=function(){function e(t){n(this,e),this._conversationModule=t,this._className="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=io.NOT_START}return s(e,[{key:"setConvCustomData",value:function(e){var t=this,o="".concat(this._className,".setConvCustomData"),n=e.conversationIDList,a=e.customData;Ye.log("".concat(o," options:"),e);var s=new bs(ws.SET_CONV_CUSTOM_DATA);s.setMessage(JSON.stringify(e));var r={fromAccount:this._getMyUserID(),itemList:[]},i=[],c=[];return n.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(c,e),!0;if(!Pt(e)&&!Ut(e))return t._onConversationIDInvalid(c,e),!0;var o={operationType:2,contactItem:void 0,customMark:a};Pt(e)?o.contactItem={type:1,toAccount:e.replace(D.CONV_C2C,"")}:Ut(e)&&(o.contactItem={type:2,groupID:e.replace(D.CONV_GROUP,"")}),r.itemList.push(o)})),c.length===n.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:$n,requestData:r}).then((function(e){s.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(o," ok"));var n=e.data.resultItem;if(lt(n)){var r,u,l=!1;n.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(r),(u=t._getLocalConversation(r))&&u.customData!==a&&(u.customData=a,l=!0)):c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"markConversation",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_MARK))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".markConversation"),n=e.conversationIDList,a=e.markType,s=e.enableMark;Ye.log("".concat(o," options:"),e);var r=new bs(ws.MARK_CONVERSATION);r.setMessage(JSON.stringify(e));var i=void 0,c=void 0,u=this._getFlagBit(a);!0===s?c=[u]:i=[u];var l={fromAccount:this._getMyUserID(),itemList:[]},d=[],p=[];return n.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(p,e),!0;if(!Pt(e)&&!Ut(e))return t._onConversationIDInvalid(p,e),!0;var o={operationType:1,contactItem:void 0,clearMark:i,setMark:c};Pt(e)?o.contactItem={type:1,toAccount:e.replace(D.CONV_C2C,"")}:Ut(e)&&(o.contactItem={type:2,groupID:e.replace(D.CONV_GROUP,"")}),l.itemList.push(o)})),p.length===n.length?ur({successConversationIDList:d,failureConversationIDList:p}):this._conversationModule.request({protocolName:zn,requestData:l}).then((function(e){r.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(o," ok"));var n=e.data.resultItem;if(lt(n)){var i,c,u=!1;n.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(d.push(i),c=t._getLocalConversation(i)){var o=c.markList.indexOf(a);!0===s?-1===o&&(c.markList.push(a),u=!0):-1!==o&&(c.markList.splice(o,1),u=!0)}}else p.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===u&&t._emitConversationUpdate()}return er({successConversationIDList:d,failureConversationIDList:p})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"getLocalConvGroupList",value:function(){var e=this;return Ye.log("".concat(this._className,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===io.REJECTED?this.getRemoteConvGroupList().then((function(){return er(v(e._convGroupMap.values()))})):ur(v(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._className,".getRemoteConvGroupList");return this._pagingStatus=io.PENDING,this._conversationModule.request({protocolName:ta,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:Be()}}).then((function(o){var n,a,s=o.data,r=s.completeFlag,i=s.contactItem,c=s.nextStartIndex,u=void 0===c?0:c,l=s.groupItem;(e._startIndex=u,Ye.log("".concat(t," completeFlag:").concat(r," nextStartIndex:").concat(u)),lt(l)&&l.forEach((function(t){var o=t.convGroupID,n=t.groupName;e._convGroupMap.set(o,n)})),lt(i))&&i.forEach((function(t){var o=t.standardMark,s=t.customData,r=t.convGroupIDList;if(n=e._concatConversationID(t),(a=e._getLocalConversation(n))&&(a.markList=Xt(o),a.customData=s||"",lt(r))){var i=[];r.forEach((function(t){e._convGroupMap.has(t)&&i.push(e._convGroupMap.get(t))})),a.conversationGroupList=[].concat(i),i.length=0}}));if(0===r)return e.getRemoteConvGroupList();1===r&&(e._pagingStatus=io.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(o){e._pagingStatus=io.REJECTED,Ye.warn("".concat(t," failed. error:"),o)}))}},{key:"createConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.CREATE_CONV_GROUP);o.setMessage(JSON.stringify(e));var n="".concat(this._className,".createConvGroup");Ye.log("".concat(n," options:"),e);var a=e.groupName,s=e.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:a,contactItem:[]}]},i=[],c=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(D.CONV_C2C,"")}):Ut(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(D.CONV_GROUP,"")})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===s.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:Jn,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(n," ok"));var s=e.data.groupResultItem[0],r=s.groupItem,u=s.resultItem;if(ut(r)&&(t._convGroupMap.set(r.convGroupID,r.groupName),t._emitConvGroupListUpdate()),lt(u)){var l,d,p=!1;u.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(l),(d=t._getLocalConversation(l))&&-1===d.conversationGroupList.indexOf(a)&&(d.conversationGroupList.push(a),p=!0)):c.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===p&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"deleteConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.DELETE_CONV_GROUP);o.setMessage(e);var n="".concat(this._className,".deleteConvGroup");return Ye.log("".concat(n," groupName:").concat(e)),this._conversationModule.request({protocolName:Xn,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(a){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(n," ok"));var s=a.data.groupItem;if(lt(s)){var r=!1;s.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),r=!0)})),!0===r&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"renameConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.RENAME_CONV_GROUP);o.setMessage(JSON.stringify(e));var n="".concat(this._className,".renameConvGroup");Ye.log("".concat(n," options:"),e);var a=e.oldName,s=e.newName;return this._conversationModule.request({protocolName:Qn,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:a,newName:s}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(n," ok"));var r=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(r,s),t._emitConvGroupListUpdate();var i,c,u=t._conversationModule.getLocalConversationList(),l=!1;u.forEach((function(e){i=e.conversationGroupList,-1!==(c=i.indexOf(a))&&(i.splice(c,1,s),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"addConvsToGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.ADD_CONVS_TO_GROUP);o.setMessage(JSON.stringify(e));var n="".concat(this._className,".addConvsToGroup");Ye.log("".concat(n," options:"),e);var a=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],c=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(D.CONV_C2C,"")}}):Ut(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(D.CONV_GROUP,"")}})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===a.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:Zn,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(n," ok"));var a=e.data.updateGroupResult.contactResultItem;if(lt(a)){var r,u,l=!1;a.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(u=t._getLocalConversation(r))&&-1===u.conversationGroupList.indexOf(s)&&(u.conversationGroupList.push(s),i.push(r),l=!0):c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"deleteConvsFromGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.DELETE_CONVS_FROM_GROUP);o.setMessage(JSON.stringify(e));var n="".concat(this._className,".deleteConvsFromGroup");Ye.log("".concat(n," options:"),e);var a=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],c=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(D.CONV_C2C,"")}}):Ut(e)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(D.CONV_GROUP,"")}})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===a.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:ea,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log("".concat(n," ok"));var a=e.data.updateGroupResult.contactResultItem;if(lt(a)){var r,u,l=!1;a.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(u=t._getLocalConversation(r)){var o=u.conversationGroupList.indexOf(s);-1!==o&&(u.conversationGroupList.splice(o,1),i.push(r),l=!0)}}else c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"onConvMarkUpdated",value:function(e){var t=this;if(!oo(e)){var o,n;Ye.debug("".concat(this._className,".onConvMarkUpdated markItemList:"),e);var a=!1;e.forEach((function(e){var s=e.recentContactItem,r=e.optType,i=e.standardMark,c=e.customMark;if(o=t._concatConversationID(s),n=t._getLocalConversation(o))if(1===r){var u=Xt(i);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var o=0,n=e.length;o=0;n--)if("1"===t[n])return o-n-1}},{key:"_concatConversationID",value:function(e){var t,o=e.type,n=e.to,a=e.groupID,s=e.userID;return 1===o?dt(s)?dt(n)||(t="".concat(D.CONV_C2C).concat(n)):t="".concat(D.CONV_C2C).concat(s):2===o&&(t="".concat(D.CONV_GROUP).concat(a)),t}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(e,t){var o=this._getLocalConversation(e);if(o){var n=o.conversationGroupList;-1===n.indexOf(t)&&n.push(t)}}},{key:"_getLocalConversation",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:"_hasLocalConversation",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(S.CONVERSATION_GROUP_LIST_UPDATED,v(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},o=this._conversationModule.getLocalConversationList();t.conversationList=o.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(S.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=io.NOT_START}}]),e}(),Or=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="ConversationModule",fr.mixin(_(t)),t._messageListHandler=new pr,t._messageRemindHandler=new Rr(_(t)),t._convGroupHandler=new Lr(_(t)),t.singlyLinkedList=new Sr(100),t._pagingStatus=io.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._initListeners(),t}return s(a,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(gr,this._initLocalConversationList,this),e.on(hr,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new bs(ws.GET_CONVERSATION_LIST_IN_STORAGE);Ye.log("".concat(this._className,"._initLocalConversationList."));var o="",n=this._getStorageConversationList(),a=this.isIntl();if(n){for(var s=n.length,r=0;r0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,o=e.conversationOptionsList,n=e.isInstantMessage,a=void 0===n||n,s=e.isUnreadC2CMessage,r=void 0!==s&&s,i=e.updateUnreadCount,c=void 0===i||i;this._isReady?0!==o.length&&(this._getC2CPeerReadTime(o),this._updateLocalConversationList({conversationOptionsList:o,isInstantMessage:a,isUnreadC2CMessage:r,isFromGetConversations:!1,updateUnreadCount:c}),this._setStorageConversationList(),o.filter((function(e){return e.type===D.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!lt(e)||0!==e.length)if(0!==this._conversationMap.size){var o=!1;e.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){o=!0;var a=t._conversationMap.get(n);a.groupProfile=JSON.parse(JSON.stringify(e)),a.lastMessage.lastSequence=0;r--)if(!a[r].isDeleted){s=a[r];break}var i=this._conversationMap.get(n);if(i){var c=!1;i.lastMessage.lastSequence===s.sequence&&i.lastMessage.lastTime===s.time||(oo(s)&&(s=void 0),i.updateLastMessage(s),i.type!==D.CONV_TOPIC&&(c=!0),Ye.log("".concat(this._className,".onMessageDeleted. update conversationID:").concat(n," with lastMessage:"),i.lastMessage)),n.startsWith(D.CONV_C2C)&&this.updateUnreadCount(n),c&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,o=e.from,n=e.to,a=e.time,s=e.sequence,r=e.elements,i=e.cloudCustomData,c=e.messageVersion,u=this.getMyUserID(),l="".concat(t).concat(n);n===u&&t===D.CONV_C2C&&(l="".concat(t).concat(o));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(S.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(Ye.log("".concat(this._className,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(_," from:").concat(o," to:").concat(n)),_){this.getModule(Yo).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;Ye.debug("".concat(this._className.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===a&&f.lastSequence===s&&f.version!==c&&(f.type=r[0].type,f.payload=r[0].content,f.messageForShow=zt(f.type,f.payload,this.isIntl()),f.cloudCustomData=i,f.version=c,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var o=this,n=e.dataList,a=null;n.forEach((function(e){e.groupAtTips?a=e.groupAtTips:e.elements?a=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(a=t(t({},e),{},{sync:!0})),a.__random=e.random,a.__sequence=e.clientSequence,o._tmpGroupAtTipsList.push(a)})),Ye.debug("".concat(this._className,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(o){var n=o.groupID,a=o.from,s=o.topicID,r=void 0===s?void 0:s,i=o.sync,c=void 0!==i&&i;if(a!==e.getMyUserID())if(dt(r)){var u=e._conversationMap.get("".concat(D.CONV_GROUP).concat(n));u&&(u.updateGroupAtInfoList(o),t=!0)}else{var l=e._conversationMap.get("".concat(D.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(o);var d=e.getModule(Yo),p=l.groupAtInfoList;d.onConversationProxy({topicID:r,groupAtInfoList:p})}if(oo(l)&&c)e.updateTopicConversation([{conversationID:"".concat(D.CONV_GROUP).concat(r),type:D.CONV_TOPIC}]),e._conversationMap.get("".concat(D.CONV_GROUP).concat(r)).updateGroupAtInfoList(o)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,o=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==D.CONV_C2C||o.push(e.conversationID.replace(D.CONV_C2C,""))})),o.length>0){Ye.debug("".concat(this._className,"._getC2CPeerReadTime userIDList:").concat(o));var n=this.getModule(Bo);n&&n.getRemotePeerReadTime(o)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(zo).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===D.CONV_C2C||e.type===D.CONV_GROUP&&e.lastMessage.type!==D.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(zo).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversationList();if(t){var n=this.getModule(Ko);n&&n.updateGroupLastMessage(o)}e&&this.emitOuterEvent(S.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return v(this._conversationMap.values()).filter((function(e){return e.type!==D.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new bs(ws.SYNC_CONVERSATION_LIST);return this._pagingStatus===io.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(o){return e._pagingStatus=io.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setNetworkType(e.getNetworkType()).end(),o})).catch((function(o){return e._pagingStatus=io.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),lr(o)}))}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),o=this.checkAndPatchRemark(),n=this._messageRemindHandler.getC2CMessageRemindType(),a=this.getModule(Ko).getGroupList();Promise.all([o,n,a]).then((function(){var o=Date.now()-t;Ye.log("".concat(e._className,"._patchConversationProperties ok. cost ").concat(o," ms")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._className,"._pagingGetConversationList");return Ye.log("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex)),this._pagingStatus=io.PENDING,this.request({protocolName:Bn,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var n=o.data,a=n.completeFlag,s=n.conversations,r=void 0===s?[]:s,i=n.timeStamp,c=n.startIndex,u=n.pinnedTimeStamp,l=n.pinnedStartIndex,d=n.groupItem;if(Ye.log("".concat(t," ok. completeFlag:").concat(a," count:").concat(r.length," isReady:").concat(e._isReady)),e._convGroupHandler.onConvGroupListSynced(d),r.length>0){var p=e._getConversationOptions(r);e._updateLocalConversationList({conversationOptionsList:p,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return ur();e.triggerReady()}return e._pagingTimeStamp=i,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=u,e._pagingPinnedStartIndex=l,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),ur())})).catch((function(o){throw e.isLoggedIn()&&(e._isReady||(Ye.warn("".concat(t," failed. error:"),o),e.triggerReady())),o}))}},{key:"_updateLocalConversationList",value:function(e){var t,o=e.isFromGetConversations,n=e.isInstantMessage,a=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(v(t.toBeUpdatedConversationList),v(this._conversationMap)))),o||(this._updateUserOrGroupProfile(t.newConversationList),n&&this.emitTotalUnreadMessageCountUpdate()),Ye.debug("".concat(this._className,"._updateLocalConversationList cost ").concat(Date.now()-a," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,o=e.isFromGetConversations,n=e.isInstantMessage,a=e.isUnreadC2CMessage,s=void 0!==a&&a,r=e.updateUnreadCount,i=[],c=[],u=this.getModule(Ko),l=this.getModule(Ho),d=this.isIntl(),p=0,g=t.length;p0&&a.getUserProfile({userIDList:o}).then((function(e){var o=e.data;lt(o)?o.forEach((function(e){t._conversationMap.get("C2C".concat(e.userID)).userProfile=e})):t._conversationMap.get("C2C".concat(o.userID)).userProfile=o})),n.length>0&&s.getGroupProfileAdvance({groupIDList:n,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){var n=t._conversationMap.get(o);Mt(n.groupProfile,e,[],[null,void 0,"",0,NaN]),!n.subType&&e.type&&(n.subType=e.type)}}))}))}}},{key:"_getConversationOptions",value:function(e){var o=this,n=[],a=e.filter((function(e){var t=e.type,o=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==o&&"@TLS#ERROR"!==o||2===t})),s=this.getMyUserID(),r=a.map((function(e){if(dt(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var a={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return n.push(a),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?o._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===s&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new Tr(a),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:"",customData:e.customMark||"",markList:Xt(e.standardMark),conversationGroupList:o._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.messageReadSeq+e.unreadCount,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},o._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new Nr({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0,customData:e.customMark||"",markList:Xt(e.standardMark),conversationGroupList:o._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));n.length>0&&this.getModule(Vo).onConversationsProfileUpdated(n);return r}},{key:"_patchTypeAndPayload",value:function(e){var o=e.lastMsg,n=o.event,a=void 0===n?void 0:n,s=o.elements,r=void 0===s?[]:s,i=o.groupTips,c=void 0===i?{}:i;if(!dt(a)&&!oo(c)){var u=new Zs(c);u.setElement({type:D.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:D.MSG_GRP_TIP,payload:l}}return{type:r[0]?r[0].type:null,payload:r[0]?this._amendLayersOverLimitProperty(r[0].content):null}}},{key:"_amendLayersOverLimitProperty",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof Zs&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){var t=this;Ye.log("".concat(this._className,".onConversationDeleted")),lt(e)&&e.forEach((function(e){var o=e.type,n=e.userID,a=e.groupID,s="";1===o?s="".concat(D.CONV_C2C).concat(n):2===o&&(s="".concat(D.CONV_GROUP).concat(a)),t.deleteLocalConversation(s)}))}},{key:"onConversationPinned",value:function(e){var t=this;if(lt(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation("".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation("".concat(D.CONV_GROUP).concat(r))),n&&(Ye.log("".concat(t._className,".onConversationPinned conversationID:").concat(n.conversationID," isPinned:").concat(n.isPinned)),n.isPinned||(n.isPinned=!0,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(lt(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation("".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation("".concat(D.CONV_GROUP).concat(r))),n&&(Ye.log("".concat(t._className,".onConversationUnpinned conversationID:").concat(n.conversationID," isPinned:").concat(n.isPinned)),n.isPinned&&(n.isPinned=!1,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,o=e.conversationID,n=e.nextReqMessageID,a=e.count,s="".concat(this._className,".getMessageList"),r=this.getLocalConversation(o),i="";if(r&&r.groupProfile&&(i=r.groupProfile.type),Lt(i))return Ye.log("".concat(s," not available in avchatroom. conversationID:").concat(o)),ur({messageList:[],nextReqMessageID:"",isCompleted:!0});(dt(a)||a>15)&&(a=15),!n&&this._isNotInCommunity(o)&&(this._messageListHandler.removeByConversationID(o),this._completedMap.delete(o),this._roamingMessageSequenceMap.delete(o));var c=this._computeRemainingCount({conversationID:o,nextReqMessageID:n}),u=this._completedMap.has(o);if(Ye.log("".concat(s," conversationID:").concat(o," nextReqMessageID:").concat(n)+" remainingCount:".concat(c," count:").concat(a," isCompleted:").concat(u)),this._needGetHistory({conversationID:o,remainingCount:c,count:a}))return this.getHistoryMessages({conversationID:o,nextReqMessageID:n,count:20}).then((function(e){var n=e.nextReqID,a=e.storedMessageList,r=t._completedMap.has(o),i=a;c>0&&(i=t._messageListHandler.getLocalMessageList(o).slice(0,a.length+c));var u={nextReqMessageID:r?"":n,messageList:i,isCompleted:r};return Ye.log("".concat(s," ret.nextReqMessageID:").concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(i.length)),er(u)}));this.modifyMessageList(o);var l=this._getMessageListFromMemory({conversationID:o,nextReqMessageID:n,count:a});return ur(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=e.count,a="".concat(this._className,"._getMessageListFromMemory"),s=this._messageListHandler.getLocalMessageList(t),r=s.length,i=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return o?(i=s.findIndex((function(e){return e.ID===o})))>n?(c.messageList=s.slice(i-n,i),c.nextReqMessageID=s[i-n].ID):(c.messageList=s.slice(0,i),c.isCompleted=!0):r>n?(i=r-n,c.messageList=s.slice(i,r),c.nextReqMessageID=s[i].ID):(c.messageList=s.slice(0,r),c.isCompleted=!0),Ye.log("".concat(a," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(c.messageList.length)),c}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,o=e.sequence,n=e.time,a=e.count,s=e.direction,r=void 0===s?0:s;if((dt(a)||a>15)&&(a=15),t.startsWith(D.CONV_C2C)){var i=this.getModule(Bo),c=t.replace(D.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:c,time:n,count:a,direction:r})}if(t.startsWith(D.CONV_GROUP)){var u=this.getModule(Ko),l=t.replace(D.CONV_GROUP,"");return u.getRoamingMessagesHopping({groupID:l,sequence:o,count:a,direction:r})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=this._messageListHandler.getLocalMessageList(t),a=n.length;if(!o)return a;var s=0;return Pt(t)?s=n.findIndex((function(e){return e.ID===o})):Ut(t)&&(s=-1!==o.indexOf("-")?n.findIndex((function(e){return e.ID===o})):n.findIndex((function(e){return e.sequence===o}))),-1===s&&(s=0),s}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,o=e.remainingCount,n=e.count,a=this.getLocalConversation(t),s="";return a&&a.groupProfile&&(s=a.groupProfile.type),!bt(t)&&!Lt(s)&&(!(Ut(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(o<=n&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(D.CONV_GROUP,"");return Gt(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,o=e.count;if(t===D.CONV_SYSTEM)return ur();var n=15;o>20&&(n=20);var a=null;if(Pt(t)){var s=this._roamingMessageKeyAndTimeMap.has(t);return(a=this.getModule(Bo))?a.getRoamingMessage({conversationID:t,peerAccount:t.replace(D.CONV_C2C,""),count:n,lastMessageTime:s?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:s?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):lr({code:hn.CANNOT_FIND_MODULE})}if(Ut(t)){if(!(a=this.getModule(Ko)))return lr({code:hn.CANNOT_FIND_MODULE});var r=null;this._conversationMap.has(t)&&(r=this._conversationMap.get(t).lastMessage);var i=0;r&&(i=r.lastSequence);var c=this._roamingMessageSequenceMap.get(t);return a.getRoamingMessage({conversationID:t,groupID:t.replace(D.CONV_GROUP,""),count:n,sequence:c||i})}return ur()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var o=t.lastMessage,n=o.messageForShow,a=o.payload;if(oo(n)||oo(a)){var s=this._messageListHandler.getLocalMessageList(e);if(0===s.length)return;var r=s[s.length-1];Ye.log("".concat(this._className,".patchConversationLastMessage conversationID:").concat(e," payload:"),r.payload),t.updateLastMessage(r)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=o.startsWith(D.CONV_C2C)?D.CONV_C2C:D.CONV_GROUP,s=null,r=[],i=[],c=0,u=e.length,l=null,d=a===D.CONV_GROUP,p=this.getModule(Qo),g=function(){c=d?e.length-1:0,u=d?0:e.length},_=function(){d?--c:++c},h=function(){return d?c>=u:c0&&void 0!==arguments[0]?arguments[0]:{},o="".concat(this._className,".setAllMessageRead");t.scope||(t.scope=D.READ_ALL_MSG),Ye.log("".concat(o," options:"),t);var n=this._createSetAllMessageReadPack(t);if(0===n.readAllC2CMessage&&0===n.groupMessageReadInfoList.length)return ur();var a=new bs(ws.SET_ALL_MESSAGE_READ);return this.request({protocolName:fa,requestData:n}).then((function(o){var n=o.data,s=e._handleAllMessageRead(n);return a.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),ur()})).catch((function(t){return e.probeNetwork().then((function(e){var o=m(e,2),n=o[0],s=o[1];a.setError(t,n,s).end()})),Ye.warn("".concat(o," failed. error:"),t),lr({code:t&&t.code?t.code:hn.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastSequence;return t&&o0)if(s.type===D.CONV_C2C&&0===o.readAllC2CMessage){if(n===D.READ_ALL_MSG)o.readAllC2CMessage=1;else if(n===D.READ_ALL_C2C_MSG){o.readAllC2CMessage=1;break}}else if(s.type===D.CONV_GROUP&&(n===D.READ_ALL_GROUP_MSG||n===D.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(s);o.groupMessageReadInfoList.push({groupID:s.groupProfile.groupID,messageSequence:r})}}}catch(i){a.e(i)}finally{a.f()}return o}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,o=e.readAllC2CMessage,n=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:o})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),n}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var o=0,n=e.length;o=1){if(1===o&&i.type===D.CONV_C2C){var c=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:c})}else if(i.type===D.CONV_GROUP){var u=r.replace(D.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(u)){var l=this._remoteGroupReadSequenceMap.get(u),d=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:r,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(u)}}this.updateUnreadCount(r,!1)&&(n+=1)}}}catch(p){a.e(p)}finally{a.f()}return n}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,o=e.sequence,n=t.replace(D.CONV_GROUP,""),a=!1;if(this._remoteGroupReadSequenceMap.has(n)){var s=this._remoteGroupReadSequenceMap.get(n);o<=s&&(a=!0,Ye.log("".concat(this._className,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(o," remoteReadSequence:").concat(s))),o>=s+10&&this._remoteGroupReadSequenceMap.delete(n)}return a}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,o=e.lastMessageSeq,n=e.lastMessageTime,a=this._messageListHandler.getLocalMessageList(t);if(0!==a.length)for(var s,r=a.length-1;r>=0;r--)if(s=a[r],!(n&&s.time>n||o&&s.sequence>o)){if("in"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!1,n=this.getLocalConversation(e),a=this._messageListHandler.getLocalMessageList(e);if(n){var s=n.unreadCount,r=a.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(s!==r&&(n.unreadCount=r,o=!0,Ye.log("".concat(this._className,".updateUnreadCount from ").concat(s," to ").concat(r,", conversationID:").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),o&&n.type===D.CONV_TOPIC){var i=n.unreadCount,c=this.getModule(Yo),u=e.replace(D.CONV_GROUP,"");c.onConversationProxy({topicID:u,unreadCount:i})}return o}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversation(e);if(o&&o.groupAtInfoList.length>0){if(o.clearGroupAtInfoList(),Ye.log("".concat(this._className,".clearGroupAtInfoList conversationID:").concat(e)),o.type===D.CONV_TOPIC){var n=o.groupAtInfoList,a=this.getModule(Yo),s=e.replace(D.CONV_GROUP,"");a.onConversationProxy({topicID:s,groupAtInfoList:n})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,o=e.userID,n=void 0===o?void 0:o,a=e.groupID,s=void 0===a?void 0:a,r=e.readReceiptList;if(!oo(r)){var i=[];if(dt(n)){if(!dt(s)){var c="".concat(D.CONV_GROUP).concat(s);r.forEach((function(e){var o=e.tinyID,n=e.clientTime,a=e.random,r=e.readCount,u=e.unreadCount,l="".concat(o,"-").concat(n,"-").concat(a),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:s,messageID:l,readCount:0,unreadCount:0};d&&(rt(r)&&(d.readReceiptInfo.readCount=r,p.readCount=r),rt(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),i.push(p))}))}}else{var u="".concat(D.CONV_C2C).concat(n);r.forEach((function(e){var o=e.tinyID,a=e.clientTime,s=e.random,r="".concat(o,"-").concat(a,"-").concat(s),c=t._messageListHandler.getLocalMessage(u,r);if(c){c.readReceiptInfo.isPeerRead=!0;var l={userID:n,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(S.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,o=e.count,n=this.getLocalConversation(t);if(n){var a=n.unreadCount,s=a-o;s<0&&(s=0),n.unreadCount=s,Ye.log("".concat(this._className,".recomputeGroupUnreadCount from ").concat(a," to ").concat(s,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),o=this.getLocalMessageList(e);if(t&&0!==o.length&&!bt(t.type)){for(var n=[],a=0,s=o.length;a0){var o=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(o.length>0&&this.emitOuterEvent(S.MESSAGE_READ_BY_PEER,o),this._conversationMap.has(e)){var n=this._conversationMap.get(e).lastMessage;oo(n)||n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){Ye.log("".concat(this._className,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,o){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:o})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,o="".concat(this._className,".getConversationList"),n="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(Ye.log("".concat(o,". ").concat(n)),this._pagingStatus===io.REJECTED){var a=new bs(ws.GET_CONVERSATION_LIST);return a.setMessage(n),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return er({conversationList:o,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}if(0===this._conversationMap.size){var s=new bs(ws.GET_CONVERSATION_LIST);return s.setMessage(n),this.syncConversationList().then((function(){s.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return er({conversationList:o,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}var r=this._getConversationList(e);return Ye.log("".concat(o,". returned conversation count:").concat(r.length)),ur({conversationList:r,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(dt(e))return this.getLocalConversationList();if(lt(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ut(e)){var t=e.type,o=e.markType,n=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==D.CONV_C2C&&t!==D.CONV_GROUP||e.type===t)&&(!it(n)||e.conversationGroupList.includes(n))&&(!rt(o)||e.markList.includes(o))}))}return[]}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=E(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];a.type===D.CONV_C2C&&(Ye.debug("".concat(this._className,"._handleC2CPeerReadTime conversationID:").concat(n," peerReadTime:").concat(a.peerReadTime)),this.recordPeerReadTime(n,a.peerReadTime))}}catch(s){t.e(s)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(Ko).isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){return this.getModule(Ko).getLocalGroupList().length}},{key:"_hasLocalGroup",value:function(e){return this.getModule(Ko).hasLocalGroup(e.replace(D.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,o=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new kr({conversationID:e,type:e.slice(0,3)===D.CONV_C2C?D.CONV_C2C:D.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===D.CONV_SYSTEM)return ur({conversation:t});if(Ut(e)&&!this._hasLocalGroup(e))return ur({conversation:t});var n=new bs(ws.GET_CONVERSATION_PROFILE),a="".concat(this._className,".getConversationProfile");return Ye.log("".concat(a,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(s){n.setNetworkType(o.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(s.data.conversation.unreadCount)).end();var r=o.getModule(Ho);if(r&&t.type===D.CONV_C2C){var i=e.replace(D.CONV_C2C,"");if(r.isMyFriend(i)){var c=r.getFriendRemark(i);t.remark!==c&&(t.remark=c,Ye.log("".concat(a,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return Ye.log("".concat(a," ok. conversationID:").concat(e)),s})).catch((function(t){return o.probeNetwork().then((function(o){var a=m(o,2),s=a[0],r=a[1];n.setError(t,s,r).setMessage("conversationID:".concat(e)).end()})),Ye.error("".concat(a," failed. error:"),t),lr(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===D.CONV_C2C?this.getModule(Vo).getUserProfile({userIDList:[e.toAccount]}).then((function(o){var n=o.data;return 0===n.length?lr(new rr({code:hn.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=n[0],e._isInfoCompleted=!0,t._unshiftConversation(e),ur({conversation:e}))})):this.getModule(Ko).getGroupProfile({groupID:e.toAccount}).then((function(o){return e.groupProfile=o.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),ur({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof kr&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(v(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var o=e.userID;if(o===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var n=t._conversationMap.get("".concat(D.CONV_C2C).concat(o));n&&(n.userProfile=e)}}))}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===io.RESOLVED}},{key:"deleteConversation",value:function(e){var t=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return lr({code:hn.CONVERSATION_NOT_FOUND});var n=this._conversationMap.get(e).type;if(n===D.CONV_C2C)o.type=1,o.toAccount=e.replace(D.CONV_C2C,"");else{if(n!==D.CONV_GROUP)return n===D.CONV_SYSTEM?(this.getModule(Ko).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),this.deleteLocalConversation(e),ur({conversationID:e})):lr({code:hn.CONVERSATION_UN_RECORDED_TYPE});if(!this._hasLocalGroup(e))return this.deleteLocalConversation(e),ur({conversationID:e});o.type=2,o.toGroupID=e.replace(D.CONV_GROUP,"")}var a=new bs(ws.DELETE_CONVERSATION);a.setMessage("conversationID:".concat(e));var s="".concat(this._className,".deleteConversation");return Ye.log("".concat(s,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Hn,requestData:o})})).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(s," ok")),t.deleteLocalConversation(e),ur({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error("".concat(s," failed. error:"),e),lr(e)}))}},{key:"clearHistoryMessage",value:function(e){var t=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return lr({code:hn.CONVERSATION_NOT_FOUND});var n=this._conversationMap.get(e).type;if(n===D.CONV_C2C)o.type=1,o.toAccount=e.replace(D.CONV_C2C,"");else{if(n!==D.CONV_GROUP)return n===D.CONV_SYSTEM?(this.getModule(Ko).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),ur({conversationID:e})):lr({code:hn.CONVERSATION_UN_RECORDED_TYPE});o.type=2,o.toGroupID=e.replace(D.CONV_GROUP,"")}var a=new bs(ws.CLEAR_HISTORY_MESSAGE);a.setMessage("conversationID:".concat(e));var s="".concat(this._className,".clearHistoryMessage");return Ye.log("".concat(s,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Wn,requestData:o})})).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(s," ok")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var o=t.getLocalConversation(e);return o&&(o.updateLastMessage(),t.emitConversationUpdate(!0,!1)),ur({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error("".concat(s," failed. error:"),e),lr(e)}))}},{key:"pinConversation",value:function(e){var t=this,o=e.conversationID,n=e.isPinned;if(!this._conversationMap.has(o))return lr({code:hn.CONVERSATION_NOT_FOUND});var a=this.getLocalConversation(o);if(a.isPinned===n)return ur({conversationID:o});var s=new bs(ws.PIN_CONVERSATION);s.setMessage("conversationID:".concat(o," isPinned:").concat(n));var r="".concat(this._className,".pinConversation");Ye.log("".concat(r,". conversationID:").concat(o," isPinned:").concat(n));var i=null;return Pt(o)?i={type:1,toAccount:o.replace(D.CONV_C2C,"")}:Ut(o)&&(i={type:2,groupID:o.replace(D.CONV_GROUP,"")}),this.request({protocolName:Yn,requestData:{fromAccount:this.getMyUserID(),operationType:!0===n?1:2,itemList:[i]}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(r," ok")),a.isPinned!==n&&(a.isPinned=n,t._sortConversationListAndEmitEvent()),er({conversationID:o})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error("".concat(r," failed. error:"),e),lr(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,o=e.isC2CConversation,n=e.messageRemindType,a=!1,s=this.getLocalConversation(o?"".concat(D.CONV_C2C).concat(t):"".concat(D.CONV_GROUP).concat(t));return s&&s.messageRemindType!==n&&(s.messageRemindType=n,a=!0),Ye.debug("".concat(this._className,".patchMessageRemindType options:"),e,"ret:".concat(a)),a}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this;Ye.debug("".concat(this._className,".onC2CMessageRemindTypeSynced options:"),e),e.dataList.forEach((function(e){if(!oo(e.muteNotificationsSync)){var o,n=e.muteNotificationsSync,a=n.to,s=n.updateSequence,r=n.muteFlag;t._messageRemindHandler.setUpdateSequence(s),0===r?o=D.MSG_REMIND_ACPT_AND_NOTE:1===r?o=D.MSG_REMIND_DISCARD:2===r&&(o=D.MSG_REMIND_ACPT_NOT_NOTE);var i=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(i+=1),Ye.log("".concat(t._className,".onC2CMessageRemindTypeSynced updateCount:").concat(i)),i>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){Ye.debug("".concat(this._className,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=this._conversationMap.has(e);if(Ye.log("".concat(this._className,".deleteLocalConversation conversationID:").concat(e," has:").concat(t)),t){this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e);var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(D.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),o=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var n=this.getModule(Vo).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),Ye.log("".concat(this._className,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-o," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){Ye.log("".concat(this._className,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,o=e.nick,n=e.avatar;if(this._conversationMap.has(t)){var a=this._conversationMap.get(t).userProfile;it(o)&&a.nick!==o&&(a.nick=o),it(n)&&a.avatar!==n&&(a.avatar=n),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var o=this,n=this.getLocalConversationList(),a=Date.now();n.forEach((function(n){o.modifyMessageSentByMe(t({conversationID:n.conversationID},e))})),Ye.log("".concat(this._className,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-a," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(Ho);if(!t)return e;var o=v(this._conversationMap.values()).filter((function(e){return e.type===D.CONV_C2C}));if(0===o.length)return e;var n=0;return o.forEach((function(e){var o=e.conversationID.replace(D.CONV_C2C,"");if(t.isMyFriend(o)){var a=t.getFriendRemark(o);e.remark!==a&&(e.remark=a,n+=1)}})),Ye.log("".concat(this._className,".checkAndPatchRemark. c2c conversation count:").concat(o.length,", patched count:").concat(n)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(Bo):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(Ko)),o?o.sendReadReceipt(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(Bo):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(Ko)),o?o.getReadReceiptList(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"getTotalUnreadMessageCount",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==D.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==D.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(Ye.log("".concat(this._className,".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._pagingStatus=io.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this.resetReady()}}]),a}(vn),Gr=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return s(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);Ye.log("".concat(e._className,"._checkCachedGroupTips groupID:").concat(o," hasLocalGroup:").concat(a," checkCount:").concat(n)),a?(e._notifyCachedGroupTips(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:"onNewGroupTips",value:function(e){Ye.debug("".concat(this._className,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),o=t.eventDataList,n=t.result,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:o,isInstantMessage:!0}));n.length>0&&(this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,n),this.handleMessageList(n))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var o=this,n=e.event,a=e.dataList,s=null,r=[],i=[],c={},u=[],l=function(e,l){var d=At(a[e]);if(6===n){if(o._groupModule.isGroupAttributesUpdatedNotice(d))return"continue";if(o._groupModule.isGroupCountersNotice(d))return"continue"}var p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,v=p.invisible,M=void 0,y=o._groupModule.isMessageFromTopic(h,m);if(y){M=D.CONV_TOPIC,d.to=m;var I=o._groupModule.getModule(Yo);I.hasLocalTopic(g,m)||o._getTopicPendingMap.has(m)||(o._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){o._getTopicPendingMap.delete(m)})))}var C=o._groupModule.hasLocalGroup(g);if(!C&&o._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!C&&!y)return o._cacheGroupTipsAndProbe({groupID:g,event:n,item:d}),"continue";if(o._groupModule.isMessageFromOrToAVChatroom(g))return d.event=n,u.push(d),"continue";if(d.currentUser=o._groupModule.getMyUserID(),d.conversationType=D.CONV_GROUP,(s=new Zs(d)).setElement({type:D.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),s.isSystemMessage=!1,1===v)return o._qualityStat(s),"continue";var T=o._groupModule.getModule(jo),E=s,S=E.conversationID,N=E.sequence;if(6===n)s._onlineOnlyFlag=!0,i.push(s);else if(!T.pushIntoNoticeResult(i,s))return"continue";if(o._groupModule.isMessageFromCommunityOfTopic(h,m))return"continue";if(6===n&&T.getLocalConversation(S))return"continue";6!==n&&o._qualityStat(s);var A=T.isRemoteRead({conversationID:S,sequence:N});if(dt(c[S])){var k=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||A||(k=1)),c[S]=r.push({conversationID:S,unreadCount:k,type:dt(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var R=c[S];r[R].type=s.conversationType,r[R].subType=s.conversationSubType,r[R].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||A||r[R].unreadCount++)}},d=0,p=a.length;d=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(S.TOPIC_UPDATED,{groupID:i,topic:c})}}},{key:"_onTopicProfileUpdated",value:function(e){var o=e.payload,n=o.groupProfile.groupID,a=o.newTopicInfo;this._groupModule.getModule(Yo).onTopicProfileUpdated(t({groupID:n,topicID:e.to},a))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,o=this._cachedGroupTipsMap.get(e)||[];o.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Ye.log("".concat(this._className,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(o.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupTips(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupTips(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),Ye.log("".concat(this._className,"._cacheGroupTipsAndProbe groupID:").concat(o))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Pr=function(){function e(t){n(this,e),this._groupModule=t,this._className="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(gr,this._initGroupList,this)}return s(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);Ye.log("".concat(e._className,"._checkCachedGroupMessage groupID:").concat(o," hasLocalGroup:").concat(a," checkCount:").concat(n)),a?(e._notifyCachedGroupMessage(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:"_initGroupList",value:function(){var e=this;Ye.log("".concat(this._className,"._initGroupList"));var t=new bs(ws.GET_GROUP_LIST_IN_STORAGE),o=this._groupModule.getStorageGroupList();if(lt(o)&&o.length>0){o.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var n=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(n)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();Ye.log("".concat(this._className,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var o="".concat(this._className,".handleUpdateGroupLastMessage");if(Ye.log("".concat(o," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var n,a,s,r=!1,i=0,c=e.length;i0&&this._groupModule.onAVChatRoomMessage(a),this._groupModule.filterModifiedMessage(n),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:o,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var s=this._groupModule.filterUnmodifiedMessage(n);s.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,s),n.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,o=e.dataList,n=e.event,a=e.isInstantMessage,s=null,r=[],i=[],c=[],u={},l=this._groupModule.getModule(Qo),d=o.length;d>1&&o.sort((function(e,t){return e.sequence-t.sequence}));for(var p=function(e){var d=At(o[e]),p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,v=p.invisible,M=void 0,y=t._groupModule.isMessageFromTopic(h,m);if(y){M=D.CONV_TOPIC,d.to=m;var I=t._groupModule.getModule(Yo);I.hasLocalTopic(g,m)||t._getTopicPendingMap.has(m)||(t._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){t._getTopicPendingMap.delete(m)})))}var C=t._groupModule.hasLocalGroup(g);if(!C&&t._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!C&&!y)return t._cacheGroupMessageAndProbe({groupID:g,event:n,item:d}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(g))return d.event=n,c.push(d),"continue";if(d.currentUser=t._groupModule.getMyUserID(),d.conversationType=D.CONV_GROUP,d.isSystemMessage=!!d.isSystemMessage,s=new Zs(d),d.elements=l.parseElements(d.elements,d.from),s.setElement(d.elements),1===v)return t._qualityStat(a,s),"continue";var T=1===o[e].isModified,E=t._groupModule.getModule(jo);if(E.isMessageSentByCurrentInstance(s)?s.isModified=T:T=!1,1===d.onlineOnlyFlag)s._onlineOnlyFlag=!0,E.isMessageSentByCurrentInstance(s)||i.push(s);else{if(t._groupModule.isMessageFromCommunityOfTopic(h,m))return i.push(s),"continue";if(!E.pushIntoMessageList(i,s,T))return"continue";t._qualityStat(a,s);var S=s,N=S.conversationID,A=S.sequence,k=E.isRemoteRead({conversationID:N,sequence:A});if(dt(u[N])){var R=0;"in"===s.flow&&(s._isExcludedFromUnreadCount||k||(R=1)),u[N]=r.push({conversationID:N,unreadCount:R,type:dt(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1}else{var L=u[N];r[L].type=dt(M)?s.conversationType:M,r[L].subType=s.conversationSubType,r[L].lastMessage=s._isExcludedFromLastMessage?"":s,"in"===s.flow&&(s._isExcludedFromUnreadCount||k||r[L].unreadCount++)}}},g=0;g0&&o.addMessageDelay(t.clientTime)}},{key:"onGroupMessageRevoked",value:function(e){var t=this._groupModule.getModule(jo),o=[],n=null,a=!0;e.dataList.forEach((function(e){var s=e.elements.revokedInfos;dt(s)||s.forEach((function(e){var s=oo(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);n=t.revoke(s,e.sequence,e.random);var r=e.revokerInfo&&e.revokerInfo.revoker;if(n)n.revoker=r,o.push(n);else{var i={conversationID:s,to:e.topicID||"",sequence:e.sequence,time:e.time,revoker:r};t.isLastMessageRevoked(i)&&(o.push(i),a=!1)}}))})),0!==o.length&&(t.onMessageRevoked(o),!0===a&&(Ye.log("".concat(this._className,".onGroupMessageRevoked count:").concat(o.length)),this._groupModule.emitOuterEvent(S.MESSAGE_REVOKED,o)))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(v(this._groupModule.getGroupMap())),o=0,n=e.length;og),h="offset:".concat(c," totalCount:").concat(p," isCompleted:").concat(_," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(a);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),a||_?!a&&_?(Ye.log("".concat(o," start to get community list")),c=0,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):a&&!_?(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):(Ye.log("".concat(o," ok. totalCount:").concat(l.length)),er({groupList:l})):(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];d.setMessage("isCommunityRelay:".concat(a)).setError(e,n,s).end()})),a?(11e3===e.code&&(d=null,Ye.log("".concat(o," ok. community unavailable"))),ur({groupList:l})):lr(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,o="".concat(this._className,"._pagingGetGroupListWithTopic"),n=e.limit,a=e.offset,s=e.groupBaseInfoFilter,r=e.groupList,i=new bs(ws.PAGING_GET_GROUP_LIST_WITH_TOPIC);return this._groupModule.request({protocolName:oa,requestData:{type:D.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:n,offset:a,responseFilter:{groupBaseInfoFilter:s,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var c=e.data,u=c.groups,l=void 0===u?[]:u,d=c.totalCount;r.push.apply(r,v(l));var p=a+n,g=!(d>p),_="offset:".concat(a," totalCount:").concat(d," isCompleted:").concat(g," ")+"currentCount:".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),g?(Ye.log("".concat(o," ok. totalCount:").concat(r.length)),er({groupList:r})):(a=p,t._pagingGetGroupListWithTopic({limit:n,offset:a,groupBaseInfoFilter:s,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),lr(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,o=this._cachedGroupMessageMap.get(e)||[];o.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),Ye.log("".concat(this._className,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(o.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupMessage(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupMessage(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),Ye.log("".concat(this._className,"._cacheGroupMessageAndProbe groupID:").concat(o))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,o){var n=this;e&&0!==o.length&&o.forEach((function(e){var o=e.groupID,a=e.groupAtInfoList,s=[];dt(a)||(a.forEach((function(e){s.push(t(t({},e),{},{groupID:o}))})),n._groupModule.getModule(jo).onNewGroupAtTips({dataList:s}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(gr,this._initGroupList,this)}}]),e}(),Ur=1,br=2,wr=3,Fr=4,qr=5,xr=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupAttributesHandler",this._groupAttributesMap=new Map,this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");dt(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,o=e.elements.newGroupProfile,n=!dt(o)&&!oo(o.groupAttributeOption);return n&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:o.groupAttributeOption}),n}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,o=e.groupID,n=e.groupAttributeOption,a=n.mainSequence,s=n.isWithChangedAttributeInfo,r=n.groupAttributeList,i=void 0===r?[]:r,c=n.operationType;if(Ye.log("".concat(this._className,".onGroupAttributesUpdated. ")+"groupID:".concat(o," isWithChangedAttributeInfo:").concat(s," operationType:").concat(c)),!dt(c)){if(1===s)return this._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:a,groupAttributeList:i,operationType:c}),void this._emitGroupAttributesUpdated(o);if(this._hasLocalGroupAttributes(o)){var u=this._getLocalGroupAttributes(o).avChatRoomKey;this._getGroupAttributes({groupID:o,avChatRoomKey:u}).then((function(){t._emitGroupAttributesUpdated(o)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,o=e.avChatRoomKey,n=void 0===o?void 0:o;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),Ye.log("".concat(this._className,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"initGroupAttributes",value:function(e){var t=this,o=e.groupID,n=e.groupAttributes,a=this._getLocalGroupAttributes(o),s=a.remoteMainSequence,r=a.avChatRoomKey,i=new bs(ws.INIT_GROUP_ATTRIBUTES);return i.setMessage("groupID:".concat(o," avChatRoomKey:").concat(r," mainSequence:").concat(s)),this._groupModule.request({protocolName:ka,requestData:{groupID:o,avChatRoomKey:r,mainSequence:s,groupAttributeList:this._transformGroupAttributes(n)}}).then((function(e){var a=e.data,s=a.mainSequence,r=v(a.groupAttributeList);return r.forEach((function(e){e.value=n[e.key]})),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:r,operationType:Ur}),i.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log("".concat(t._className,".initGroupAttributes ok. groupID:").concat(o)),er({groupAttributes:n})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),lr(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,o="".concat(this._className,".setGroupAttributes"),n=e.groupID,a=e.groupAttributes,s=this._getLocalGroupAttributes(n),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=this._transformGroupAttributes(a);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new bs(ws.SET_GROUP_ATTRIBUTES);return l.setMessage("groupID:".concat(n,"groupAttributes:").concat(JSON.stringify(a))),Ye.log("".concat(o,". groupID:").concat(n," mainSequence:").concat(r)),this._groupModule.request({protocolName:Ra,requestData:{groupID:n,avChatRoomKey:i,mainSequence:r,groupAttributeList:u}}).then((function(e){var s=e.data,r=s.mainSequence,i=v(s.groupAttributeList);return i.forEach((function(e){e.value=a[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:r,groupAttributeList:i,operationType:br}),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log("".concat(o," ok.")),er({groupAttributes:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),lr(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,o=e.groupID,n=e.keyList,a=void 0===n?[]:n,s=this._getLocalGroupAttributes(o),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=v(c.keys()),l=Oa,d=wr,p={groupID:o,avChatRoomKey:i,mainSequence:r},g=[];a.length>0&&(u=[],l=La,d=Fr,a.forEach((function(e){var t=0;c.has(e)&&(t=c.get(e).sequence,u.push(e)),g.push({key:e,sequence:t})})),p.groupAttributeList=g);var _=new bs(ws.DELETE_GROUP_ATTRIBUTES);return _.setMessage("groupID:".concat(o," mainSequence:").concat(r," keyList:").concat(a," protocolName:").concat(l)),this._groupModule.request({protocolName:l,requestData:p}).then((function(e){var n=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:n,groupAttributeList:g,operationType:d}),_.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log("".concat(t._className,".deleteGroupAttributes ok. groupID:").concat(o)),er({keyList:u})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];_.setError(e,n,a).end()})),lr(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,o=e.groupID,n=this._getLocalGroupAttributes(o),a=n.avChatRoomKey,s=n.lastUpdateTime,r=n.localMainSequence,i=n.remoteMainSequence,c=new bs(ws.GET_GROUP_ATTRIBUTES);if(c.setMessage("groupID:".concat(o," localMainSequence:").concat(r," remoteMainSequence:").concat(i," keyList:").concat(e.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||r0)n.forEach((function(e){s.has(e)&&(a[e]=s.get(e).value)}));else{var r,i=E(s.keys());try{for(i.s();!(r=i.n()).done;){var c=r.value;a[c]=s.get(c).value}}catch(u){i.e(u)}finally{i.f()}}}return a}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,o=e.groupAttributeList,n=e.operationType;n!==wr?n!==Fr?(n===Ur&&t.attributes.clear(),o.forEach((function(e){var o=e.key,n=e.value,a=e.sequence;t.attributes.set(o,{value:n,sequence:a})}))):o.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(o){t.push({key:o,value:e[o]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e});this._groupModule.emitOuterEvent(S.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t})}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Vr="Set",Br="Increase",Kr="Decrease",Hr=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_counter_expire_time");dt(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,o=e.elements.groupCounterInfo,n=!1;return oo(o)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:o}),n=!0),n}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,o=e.groupID;e.groupCounterInfo.forEach((function(e){var n=e.type,a=e.groupCounterSeq,s=e.counterList,r=void 0===s?[]:s;0!==n&&2!==n||(t._updateLocalGroupCounters({groupID:o,groupCounterSeq:a,counterList:r}),r.forEach((function(e){t._groupModule.emitOuterEvent(S.GROUP_COUNTER_UPDATED,{groupID:o,key:e.key,value:e.value})}))),1===n&&t._deleteLocalGroupCounters({groupID:o,groupCounterSeq:a,counterList:r})})),Ye.log("".concat(this._className,"._onGroupCountersUpdated groupID:").concat(o))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID,o=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:o}),Ye.log("".concat(this._className,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"setGroupCounters",value:function(e){var t=this,o="".concat(this._className,".setGroupCounters"),n=e.groupID,a=e.counters,s=this._convertObjectToList(a),r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," count:").concat(s.length),c=new bs(ws.SET_GROUP_COUNTERS);return c.setMessage("".concat(i)),Ye.log("".concat(o,". ").concat(i)),this._updateGroupCounters({groupID:n,counterList:s,avChatRoomKey:r,mode:Vr}).then((function(e){return c.end(),Ye.log("".concat(o," ok.")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"increaseGroupCounter",value:function(e){var t=this,o="".concat(this._className,".increaseGroupCounters"),n=e.groupID,a=e.key,s=e.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," key:").concat(a," value:").concat(s),c=new bs(ws.INCREASE_GROUP_COUNTER);c.setMessage("".concat(i)),Ye.log("".concat(o,". ").concat(i));var u=[{key:a,value:s}];return this._updateGroupCounters({groupID:n,counterList:u,avChatRoomKey:r,mode:Br}).then((function(e){return c.end(),Ye.log("".concat(o," ok.")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"decreaseGroupCounter",value:function(e){var t=this,o="".concat(this._className,".decreaseGroupCounter"),n=e.groupID,a=e.key,s=e.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i="groupID:".concat(n," key:").concat(a," value:").concat(s),c=new bs(ws.DECREASE_GROUP_COUNTER);c.setMessage("".concat(i)),Ye.log("".concat(o,". ").concat(i));var u=[{key:a,value:s}];return this._updateGroupCounters({groupID:n,counterList:u,avChatRoomKey:r,mode:Kr}).then((function(e){return c.end(),Ye.log("".concat(o," ok.")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"getGroupCounters",value:function(e){var t=this,o="".concat(this._className,".getGroupCounters"),n=e.groupID,a=e.keyList,s=void 0===a?[]:a,r=this._getLocalGroupCounters(n),i=r.avChatRoomKey,c=r.lastUpdateTime,u=new bs(ws.GET_GROUP_COUNTERS);if(u.setMessage("groupID:".concat(n)),Date.now()-c>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:n,avChatRoomKey:i}).then((function(e){u.setMoreMessage("from remote. count:".concat(e.length)).end(),Ye.log("".concat(o," from remote. groupID:").concat(n));var a=t._getLocalCounters(n,s);return er({counters:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),lr(e)}));u.setMoreMessage("from cache").end(),Ye.log("".concat(o," from cache. groupID:").concat(n));var l=this._getLocalCounters(n,s);return ur({counters:l})}},{key:"_getRemoteGroupCounters",value:function(e){var o=this;return this._groupModule.request({protocolName:Fa,requestData:t({},e)}).then((function(t){var n=t.data,a=n.counterList,s=void 0===a?[]:a,r=n.groupCounterSeq;return o._updateLocalGroupCounters({groupID:e.groupID,counterList:s,groupCounterSeq:r}),Ye.log("".concat(o._className,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),s})).catch((function(e){return lr(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(o){t.push({key:o,value:e[o]})})),t}},{key:"_updateGroupCounters",value:function(e){var o="".concat(this._className,"._updateGroupCounters"),n=e.groupID,a=e.avChatRoomKey,s=e.mode;return Ye.log("".concat(o,". groupID:").concat(n," avChatRoomKey:").concat(a," mode:").concat(s)),this._groupModule.request({protocolName:wa,requestData:t({},e)}).then((function(e){Ye.log("".concat(o," ok."));var t=e.data.counterList,n={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,o=e.value;n[t]=o})),n})).catch((function(e){return lr(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t=e.groupID,o=e.counterList,n=void 0===o?[]:o,a=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var s=this._getLocalGroupCounters(t),r=s.counters,i=s.avChatRoomKey,c=s.groupCounterSeq;if(a>0&&a0)t.forEach((function(e){n.has(e)&&(o[e]=n.get(e))}));else{var a,s=E(n.keys());try{for(s.s();!(a=s.n()).done;){var r=a.value;o[r]=n.get(r)}}catch(i){s.e(i)}finally{s.f()}}return o}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Wr=function(){function e(t){n(this,e);var o=t.manager,a=t.groupID,s=t.onInit,r=t.onSuccess,i=t.onFail;this._className="Polling",this._manager=o,this._groupModule=o._groupModule,this._onInit=s,this._onSuccess=r,this._onFail=i,this._groupID=a,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Ea}return s(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Sa),Ye.log("".concat(this._className,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){Ye.log("".concat(this._className,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}]),e}(),Yr={3:!0,4:!0,5:!0,6:!0,17:!0},jr=function(){function e(t){n(this,e),this._groupModule=t,this._className="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Sr(200),this.messageIDLinkedList=new Sr(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map}return s(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?v(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var o=this._pollingRequestInfoMap.get(e);return e===v(this._pollingInstanceMap.keys())[0]?t(t({},o),{},{startBroadcastSeq:this._startBroadcastSeq}):t({},o)}},{key:"_handleSuccess",value:function(e,t){var o=t.data,n=o.key,a=o.nextSeq,s=o.rspMsgList,r=o.errorCode,i=o.nextBroadcastSeq,c=o.broadcastMessageList;if(0!==r){var u=this._pollingRequestInfoMap.get(e),l=new bs(ws.LONG_POLLING_AV_ERROR),d=u?"".concat(u.key,"-").concat(u.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;it(n)&&rt(a)&&this._pollingRequestInfoMap.set(e,{key:n,startSeq:a}),rt(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),lt(s)&&s.length>0?(s.forEach((function(e){e.to=e.groupID})),this.onMessage(s)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(lt(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,o=[],n=this._getModule(jo),a=this._getModule(un),s=e.length;s>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule($o),i=0;i1&&p<=20?this._getModule(an).onMessageMaybeLost(l,d+1,p-1):p<-1&&p>=-20&&this._getModule(an).onMessageMaybeLost(l,t.sequence+1,Math.abs(p)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var g=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(g=!0,t.isModified=c,n.updateMessageIsModifiedProperty(t)):g=!0,g){if(t.conversationType===D.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!u&&t.conversationType!==D.CONV_SYSTEM){var _=t.conversationID.replace(D.CONV_GROUP,"");this._pollingInstanceMap.has(_)?this._groupModule.isLoggedIn()&&a.addMessageSequence({key:Ls,message:t}):(t.type!==D.MSG_GRP_TIP&&t.clientTime>0&&a.addMessageDelay(t.clientTime),a.addMessageSequence({key:Rs,message:t}))}o.push(t)}}}else Ye.warn("".concat(this._className,".onMessage unknown event:").concat(e[i].event));if(0!==o.length){this._groupModule.filterModifiedMessage(o);var h=this.packConversationOption(o);if(h.length>0)this._getModule(jo).onNewMessage({conversationOptionsList:h,isInstantMessage:!0});Ye.debug("".concat(this._className,".onMessage count:").concat(o.length)),this._checkMessageStacked(o);var f=this._groupModule.filterUnmodifiedMessage(o);f.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,f),o.length=0}}}},{key:"_onGroupDismissed",value:function(e){Ye.log("".concat(this._className,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="".concat(this._className,"._checkMessageStacked"),o=e.length;o>=100&&(this._groupModule.isIntl()||Ye.warn("".concat(t," 直播群消息堆积数:").concat(e.length,'!可能会导致微信小程序渲染时遇到 "Dom limit exceeded" 的错误,建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new bs(ws.MESSAGE_STACKED).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(o," groupID:").concat(v(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(jo).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?D.CONV_SYSTEM:D.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var o=new Zs(e),n=this.packElements(e,t);return o.setElement(n),o}},{key:"packElements",value:function(e,o){return 4===o||6===o?(this._updateMemberCountByGroupTips(e),{type:D.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===o?{type:D.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(Qo).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,o=0;o0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var o=new Wr({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});o.start(),this._pollingInstanceMap.set(e,o),Ye.log("".concat(this._className,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var o=e.longPollingKey,n=e.group,a=n.groupID;return t._joinedGroupMap.set(a,n),t._groupModule.updateGroupMap([n]),t._groupModule.deleteUnjoinedAVChatRoom(a),t._groupModule.emitGroupListUpdate(!0,!1),dt(o)?ur({status:Qe,group:n}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var o=e.longPollingKey,n=e.group,a=e.startSeq,s=void 0===a?0:a,r=n.groupID;return t._pollingRequestInfoMap.set(r,{key:o,startSeq:s}),t.start(r),t._groupModule.isLoggedIn()?ur({status:Qe,group:n}):ur({status:Qe})}))}},{key:"_preCheck",value:function(){if(this._getModule($o).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],o=e[1];if(this._groupModule.isLoggedIn()){if(!(o.selfInfo.role===D.GRP_MBR_ROLE_OWNER||o.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,o=e.groupID,n="".concat(this._className,".joinWithoutAuth"),a=new bs(ws.JOIN_WITHOUT_AUTH);return this._groupModule.request({protocolName:ca,requestData:e}).then((function(e){var s=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2),n=(t[0],t[1]);a.setNetworkType(n).setMessage("groupID:".concat(o," longPollingKey:").concat(s)).end(!0)})),dt(s))return lr({code:hn.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});Ye.log("".concat(n," ok. groupID:").concat(o)),t._getModule(jo).setCompleted("".concat(D.CONV_GROUP).concat(o));var r=new Nr({groupID:o});return t.startRunLoop({group:r,longPollingKey:s}),er({status:Qe})})).catch((function(e){return Ye.error("".concat(n," failed. groupID:").concat(o," error:"),e),t._groupModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];a.setError(e,s,r).setMessage("groupID:".concat(o)).end(!0)})),lr(e)})).finally((function(){t._groupModule.getModule(Jo).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},o=Date.now();return oo(t)||o-t.lastSyncTime>1e3*t.expireTime&&o-t.latestUpdateTime>1e4&&o-t.lastReqTime>3e3?(t.lastReqTime=o,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return er({memberCount:e.memberCount})})).catch((function(e){return lr(e)}))):ur({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,o="".concat(this._className,"._getGroupOnlineMemberCount");return this._groupModule.request({protocolName:Da,requestData:{groupID:e}}).then((function(n){var a=t._onlineMemberCountMap.get(e)||{},s=n.data,r=s.onlineMemberNum,i=void 0===r?0:r,c=s.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;Ye.log("".concat(o," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(u));var l=Date.now();return oo(a)&&(a.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(a,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:u})),{memberCount:i}})).catch((function(n){return Ye.warn("".concat(o," failed. error:"),n),new bs(ws.GET_GROUP_ONLINE_MEMBER_COUNT).setCode(n.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(n))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(n)}))}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){dt(e)||(rt(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){dt(e)||(rt(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){dt(e)||(rt(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){var t=e.payload.groupProfile.groupID;Ye.log("".concat(this._className,".onAVChatRoomMemberBanned groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"reset",value:function(e){if(e){Ye.log("".concat(this._className,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{Ye.log("".concat(this._className,".reset all"));var o,n=E(this._pollingInstanceMap.values());try{for(n.s();!(o=n.n()).done;){o.value.stop()}}catch(a){n.e(a)}finally{n.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),$r=1,zr=15,Jr=function(){function e(t){n(this,e),this._groupModule=t,this._className="GroupSystemNoticeHandler",this.pendencyMap=new Map}return s(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,o=e.isSyncingEnded,n=e.isInstantMessage;Ye.debug("".concat(this._className,".onReceiveSystemNotice count:").concat(t.length));var a=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:n}),s=a.eventDataList,r=a.result;s.length>0&&(this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:s,isInstantMessage:n}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:n}));n?r.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,r):!0===o&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var o=e.notifiesList,n=e.isInstantMessage,a=null,s=o.length,r=0,i=[],c={conversationID:D.CONV_SYSTEM,unreadCount:0,type:D.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r0?[c]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var o=e._groupModule.getModule(jo).getLocalMessageList(D.CONV_SYSTEM),n=[];o.forEach((function(t){var o=t.payload,a=o.operatorID,s=o.operationType,r=o.groupProfile;if(s===$r){var i="".concat(a,"_").concat(r.groupID,"_").concat(r.to),c=e.pendencyMap.get(i);c&&rt(c.handled)&&0!==c.handled&&n.push(t)}})),e.deleteGroupSystemNotice({messageList:n})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,o="".concat(this._className,".deleteGroupSystemNotice");return lt(e.messageList)&&0!==e.messageList.length?(Ye.log("".concat(o," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Ta,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:D.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Ye.log("".concat(o," ok"));var n=t._groupModule.getModule(jo);return e.messageList.forEach((function(e){n.deleteLocalMessage(e)})),er()})).catch((function(e){return Ye.error("".concat(o," error:"),e),lr(e)}))):ur()}},{key:"_getPendencyList",value:function(e){var t=this;return this._groupModule.request({protocolName:Ca,requestData:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this._groupModule.getMyUserID()}}).then((function(e){var o=e.data.pendencyList;return 0!==e.data.nextStartTime?t._getPendencyList({startTime:e.data.nextStartTime}).then((function(e){return[].concat(v(o),v(e))})):o}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){var o=[];return t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t),0===t.handled&&o.push({applicant:t.from,applicantNick:t.fromUserNickName,groupName:t.groupName,groupID:t.groupID,authentication:t.authentication,messageKey:t.time})})),ur({applicationList:o})}))}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,o=e.result;e.isInstantMessage&&o.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;if(o){t._groupModule.updateGroupMap([o]);var n=!o.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,n)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var o=this._groupModule._AVChatRoomHandler;o&&o.checkJoinedAVChatRoomByID(t)&&o.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;o&&(t._groupModule.updateGroupMap([o]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,o=t.to,n=t.groupID,a=this._groupModule.getModule(Wo).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,o=t.to,n=t.groupID,a=this._groupModule.getModule(Wo).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,o=e.payload.messageRemindType;this._groupModule.getModule(jo).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:o})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,o=t.groupID,n=t.topicID,a=e.elements,s=a.operationType,r=a.topicIDList,i=a.messageRemindType,c=this._groupModule.getModule(Yo);17===s?c.onTopicCreated({groupID:o,topicID:n}):18===s?c.onTopicDeleted({groupID:o,topicIDList:r}):20===s&&c.onTopicMessageRemindTypeUpdated({groupID:o,topicID:n,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),Xr=["relayFlag"],Qr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Pr(_(t)),t._groupAttributesHandler=new xr(_(t)),t._groupCountersHandler=new Hr(_(t)),t._AVChatRoomHandler=new jr(_(t)),t._groupTipsHandler=new Gr(_(t)),t._groupSystemNoticeHandler=new Jr(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),o=this.getCloudConfig("polling_no_msg_count");this._AVChatRoomHandler&&(Ye.log("".concat(this._className,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(o))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===D.CONV_GROUP){var o=Gt(e.to)?$t(e.to):e.to;return this.hasLocalGroup(o)?ur():this.getGroupProfile({groupID:o}).then((function(n){var a=n.data.group.type;if(Ye.log("".concat(t._className,".guardForAVChatRoom. groupID:").concat(o," type:").concat(a)),a===D.GRP_AVCHATROOM){var s=hn.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM,r=t.isIntl()?"".concat(mn[s],". See https://web.sdk.qcloud.com/im/doc/en/SDK.html#joinGroup"):"userID:".concat(e.from," 未加入群 groupID:").concat(o,"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup");return Ye.warn("".concat(t._className,".guardForAVChatRoom. ").concat(r)),lr(new rr({code:s,message:r,data:{message:e}}))}return ur()}))}return ur()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(lt(e)){var o=this.getModule(Yo);e.forEach((function(e){var n=e.conversationID.replace(D.CONV_GROUP,"");Gt(n)&&o.updateLastMessage(n,e.lastMessage),t.groupMap.has(n)&&(t.groupMap.get(n).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var o=e.elements.groupMessageReadNotice;if(!dt(o)){var n=t.getModule(jo);o.forEach((function(e){var o=e.groupID,a=e.topicID,s=void 0===a?void 0:a,r=e.lastMessageSeq;Ye.debug("".concat(t._className,".onGroupMessageReadNotice groupID:").concat(o," lastMessageSeq:").concat(r));var i="".concat(D.CONV_GROUP).concat(o),c=!0;oo(s)||(i="".concat(D.CONV_GROUP).concat(s),c=!1),n.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),n.updateUnreadCount(i,c),n.clearGroupAtInfoList(i,c)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;Ye.debug("".concat(this._className,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var o=e.groupProfile,n=e.elements,a=o.groupID,s=t.getModule(jo),r=n.readReceiptList;s.updateReadReceiptInfo({groupID:a,readReceiptList:r})}))}},{key:"onGroupMessageModified",value:function(e){Ye.debug("".concat(this._className,".onGroupMessageModified options:"),JSON.stringify(e));var o=this.getModule(jo);e.dataList.forEach((function(e){o.onMessageModified(t(t({},e),{},{conversationType:D.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new Nr(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,o=this,n=this.getModule(jo);e.forEach((function(e){t=e.groupID,o.groupMap.has(t)?o.groupMap.get(t).updateGroup(e):(o.groupMap.set(t,new Nr(e)),n.deleteGroupRomaingMessageInfo(t))}));var a,s=this.getMyUserID(),r=E(this.groupMap);try{for(r.s();!(a=r.n()).done;){var i=m(a.value,2)[1];i.selfInfo.userID=s,"Owner"===i.selfInfo.role&&(i.ownerID=s)}}catch(c){r.e(c)}finally{r.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(zo).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Lt(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(zo).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return v(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=v(this.groupMap).filter((function(e){var t=m(e,2);t[0];return!oo(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(v(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalGroupList();if(e&&this.emitOuterEvent(S.GROUP_LIST_UPDATED),t){var n=JSON.parse(JSON.stringify(o)),a=this.getModule(jo);a.updateConversationGroupProfile(n)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(jo),o=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(o+=1)})),Ye.log("".concat(this._className,".patchGroupMessageRemindType count:").concat(o))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(jo);e.forEach((function(e){var o=e.groupID,n=e.selfInfo,a=n.excludedUnreadSequenceList,s=n.readedSequence;if(lt(a)){var r=0;a.forEach((function(t){t>=s&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(D.CONV_GROUP).concat(o),count:r})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):ur()}},{key:"getGroupProfile",value:function(e){var t=this,o=new bs(ws.GET_GROUP_PROFILE),n="".concat(this._className,".getGroupProfile"),a=e.groupID,s=e.groupCustomFieldFilter;Ye.log("".concat(n," groupID:").concat(a));var r={groupIDList:[a],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:s,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(r).then((function(e){var s,r=e.data,i=r.successGroupList,c=r.failureGroupList;if(Ye.log("".concat(n," ok")),c.length>0)return lr(c[0]);(Lt(i[0].type)&&!t.hasLocalGroup(a)?s=new Nr(i[0]):(t.updateGroupMap(i),s=t.getLocalGroupProfile(a)),s.isSupportTopic)||t.getModule(jo).updateConversationGroupProfile([s]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," type:").concat(s.type," muteAllMembers:").concat(s.muteAllMembers," ownerID:").concat(s.ownerID)).end(),er({group:s})})).catch((function(a){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(a,s,r).setMessage("groupID:".concat(e.groupID)).end()})),Ye.error("".concat(n," failed. error:"),a),lr(a)}))}},{key:"getGroupProfileAdvance",value:function(e){var o=this,n="".concat(this._className,".getGroupProfileAdvance"),a=e.groupIDList;lt(a)&&a.length>50&&(Ye.warn("".concat(n," 获取群资料的数量不能超过50个")),a.length=50);var s=[],r=[];a.forEach((function(e){Ot({groupID:e})?r.push(e):s.push(e)}));var i=[];if(s.length>0){var c=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));i.push(c)}if(r.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:r,relayFlag:s.length>0}));i.push(u)}return Promise.all(i).then((function(e){var t=[],o=[];return e.forEach((function(e){t.push.apply(t,v(e.successGroupList)),o.push.apply(o,v(e.failureGroupList))})),er({successGroupList:t,failureGroupList:o})})).catch((function(e){return Ye.error("".concat(o._className,"._getGroupProfileAdvance failed. error:"),e),lr(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,o=e.relayFlag,n=void 0!==o&&o,a=g(e,Xr);return this.request({protocolName:na,requestData:a}).then((function(e){Ye.log("".concat(t._className,"._getGroupProfileAdvance ok."));var o=e.data.groups;return{successGroupList:o.filter((function(e){return dt(e.errorCode)||0===e.errorCode})),failureGroupList:o.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new rr({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return n&&Ot({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:lr(t)}))}},{key:"createGroup",value:function(e){var o=this,n="".concat(this._className,".createGroup"),a=e.type,s=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return lr({code:hn.PROFANITY_FOUND});if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(a))return lr({code:hn.ILLEGAL_GROUP_TYPE});if(!Ot({type:a})){if(!oo(s)&&Ot({groupID:s}))return lr({code:hn.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Lt(a)&&!dt(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),Rt(a)||dt(e.joinOption)||(e.joinOption=void 0),Ot({type:a})){if(!oo(s)&&!Ot({groupID:s}))return lr({code:hn.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new bs(ws.CREATE_GROUP);Ye.log("".concat(n," options:"),e);var i=null,c=[];return this.request({protocolName:aa,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(a){var s=a.data,u=s.groupID,l=s.overLimitUserIDList,d=void 0===l?[]:l;if(i=u,c=d,r.setNetworkType(o.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(u," overLimitUserIDList=").concat(d)).end(),Ye.log("".concat(n," ok groupID:").concat(u," overLimitUserIDList:"),d),e.type===D.GRP_AVCHATROOM)return o.getGroupProfile({groupID:u});if(e.type===D.GRP_COMMUNITY&&1===e.isSupportTopic)return o.getGroupProfile({groupID:u});oo(e.memberList)||oo(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),o.updateGroupMap([t(t({},e),{},{groupID:u})]);var p=o.getModule(qo),g=p.createCustomMessage({to:u,conversationType:D.CONV_GROUP,payload:{data:"group_create",extension:o.isIntl()?"".concat(o.getMyUserID()," created a group"):"".concat(o.getMyUserID(),"创建群组")}});return p.sendMessageInstance(g),o.emitGroupListUpdate(),o.getGroupProfile({groupID:u})})).then((function(e){var t=e.data.group,o=t.selfInfo,n=o.nameCard,a=o.joinTime;return t.updateSelfInfo({nameCard:n,joinTime:a,messageRemindType:D.MSG_REMIND_ACPT_AND_NOTE,role:D.GRP_MBR_ROLE_OWNER}),er({group:t,overLimitUserIDList:c})})).catch((function(a){if(r.setMessage("groupType:".concat(e.type)),o.probeNetwork().then((function(e){var t=m(e,2),o=t[0],n=t[1];r.setError(a,o,n).end()})),10010===a.code||10007===a.code){o.updateGroupMap([t(t({},e),{},{groupID:i})]);var s=o.getLocalGroupProfile(i);return Ye.log("".concat(n," success, but failed to get group profile.")),er({group:s,overLimitUserIDList:c})}return Ye.error("".concat(n," failed. error:"),a),lr(a)}))}},{key:"dismissGroup",value:function(e){var t=this,o="".concat(this._className,".dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===D.GRP_WORK)return lr(new rr({code:hn.CANNOT_DISMISS_WORK}));var n=new bs(ws.DISMISS_GROUP);return n.setMessage("groupID:".concat(e)),Ye.log("".concat(o," groupID:").concat(e)),this.request({protocolName:sa,requestData:{groupID:e}}).then((function(){return n.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),er({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,o="".concat(this._className,".updateGroupProfile");if(!this.hasLocalGroup(e.groupID)||Rt(this.getLocalGroupProfile(e.groupID).type)||dt(e.joinOption)||(Ye.warn("".concat(o," joinOption is unavailable for Work/Meeting/AVChatRoom/Community")),e.joinOption=void 0),dt(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.UPDATE_GROUP_PROFILE);return n.setMessage(JSON.stringify(e)),Ye.log("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:ra,requestData:e}).then((function(){(n.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return er({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.log("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_filterProfanity",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],X),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:"joinGroup",value:function(e){var t=this,o=e.groupID,n=e.type,a="".concat(this._className,".joinGroup");if(n===D.GRP_WORK)return lr({code:hn.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)){if(!this.isLoggedIn())return ur({status:D.JOIN_STATUS_ALREADY_IN_GROUP});var s=new bs(ws.APPLY_JOIN_GROUP);return this.getGroupProfile({groupID:o}).then((function(){return s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," joinedStatus:").concat(D.JOIN_STATUS_ALREADY_IN_GROUP)).end(),ur({status:D.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(n){return s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," unjoined")).end(),Ye.warn("".concat(a," ").concat(o," was unjoined, now join!")),t.groupMap.delete(o),t.applyJoinGroup(e)}))}return Ye.log("".concat(a," groupID:").concat(o)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var o=this,n="".concat(this._className,".applyJoinGroup"),a=e.groupID;if(!oo(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return lr({code:hn.PROFANITY_FOUND});var s=new bs(ws.APPLY_JOIN_GROUP),r=t({},e),i=this.canIUse(W.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(jo).deleteTopicRoamingMessageInfo(a),this.request({protocolName:ia,requestData:r}).then((function(e){var t=e.data,r=t.joinedStatus,c=t.longPollingKey,u=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,g="groupID:".concat(a," joinedStatus:").concat(r," longPollingKey:").concat(c," startSeq:").concat(u)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(i,",")+" history message count:".concat(oo(p)?0:p.length);switch(s.setNetworkType(o.getNetworkType()).setMessage("".concat(g)).end(),Ye.log("".concat(n," ok. ").concat(g)),r){case Ze:return er({status:Ze});case Qe:return o.getGroupProfile({groupID:a}).then((function(e){var t,n=e.data.group,s={status:Qe,group:n};return 1===l?(o.getModule(jo).setCompleted("".concat(D.CONV_GROUP).concat(a)),o._groupAttributesHandler.initGroupAttributesCache({groupID:a,avChatRoomKey:d}),o._groupCountersHandler.initGroupCountersCache({groupID:a,avChatRoomKey:d}),(t=dt(c)?o._AVChatRoomHandler.handleJoinResult({group:n}):o._AVChatRoomHandler.startRunLoop({longPollingKey:c,group:n,startSeq:u})).then((function(){o._onAVChatRoomHistoryMessage(p)})),t):(o.emitGroupListUpdate(!0,!1),er(s))}));default:var _=new rr({code:hn.JOIN_GROUP_FAIL});return Ye.error("".concat(n," failed. error:"),_),lr(_)}})).catch((function(e){return s.setMessage("groupID:".concat(a)),o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"quitGroup",value:function(e){var t=this,o="".concat(this._className,".quitGroup");Ye.log("".concat(o," groupID:").concat(e));var n=this.checkJoinedAVChatRoomByID(e);if(!n&&!this.hasLocalGroup(e))return lr({code:hn.MEMBER_NOT_IN_GROUP});if(n&&!this.isLoggedIn())return Ye.log("".concat(o," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),ur({groupID:e});var a=new bs(ws.QUIT_GROUP);return a.setMessage("groupID:".concat(e)),this.request({protocolName:ua,requestData:{groupID:e}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),t.deleteLocalGroupAndConversation(e),n&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),er({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,o="".concat(this._className,".searchGroupByID"),n={groupIDList:[e]},a=new bs(ws.SEARCH_GROUP_BY_ID);return a.setMessage("groupID:".concat(e)),Ye.log("".concat(o," groupID:").concat(e)),this.request({protocolName:la,requestData:n}).then((function(e){var n=e.data.groupProfile;if(0!==n[0].errorCode)throw new rr({code:n[0].errorCode,message:n[0].errorInfo});return a.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),er({group:new Nr(n[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.warn("".concat(o," failed. error:"),e),lr(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,o="".concat(this._className,".changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===D.GRP_AVCHATROOM)return lr({code:hn.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return lr({code:hn.CANNOT_CHANGE_OWNER_TO_SELF});var n=new bs(ws.CHANGE_GROUP_OWNER);return n.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),Ye.log("".concat(o," groupID:").concat(e.groupID)),this.request({protocolName:da,requestData:e}).then((function(){n.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok"));var a=e.groupID,s=e.newOwnerID;t.groupMap.get(a).ownerID=s;var r=t.getModule(Wo).getLocalGroupMemberList(a);if(r instanceof Map){var i=r.get(t.getMyUserID());dt(i)||(i.updateRole("Member"),t.groupMap.get(a).selfInfo.role="Member");var c=r.get(s);dt(c)||c.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),er({group:t.groupMap.get(a)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,o,n,a,s=this,r="".concat(this._className,".handleGroupApplication"),i=e.handleAction,c=e.handleMessage,u=e.message,l=e.application;u?(t=u.payload.operatorID,o=u.payload.groupProfile.groupID,n=u.payload.authentication,a=u.payload.messageKey):l&&(t=l.applicant,o=l.groupID,n=l.authentication,a=l.messageKey);var d=new bs(ws.HANDLE_GROUP_APPLICATION);return d.setMessage("groupID:".concat(o)),Ye.log("".concat(r," groupID:").concat(o)),this.request({protocolName:pa,requestData:{handleAction:i,handleMessage:c,applicant:t,groupID:o,authentication:n,messageKey:a}}).then((function(){return d.setNetworkType(s.getNetworkType()).end(),Ye.log("".concat(r," ok")),u&&s._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),er({group:s.getLocalGroupProfile(o)})})).catch((function(e){return s.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];d.setError(e,n,a).end()})),Ye.error("".concat(r," failed. error"),e),lr(e)}))}},{key:"handleGroupInvitation",value:function(e){var o=this,n="".concat(this._className,".handleGroupInvitation"),a=e.message.payload,s=a.groupProfile.groupID,r=a.authentication,i=a.messageKey,c=a.operatorID,u=e.handleAction,l=new bs(ws.HANDLE_GROUP_INVITATION);return l.setMessage("groupID:".concat(s," inviter:").concat(c," handleAction:").concat(u)),Ye.log("".concat(n," groupID:").concat(s," inviter:").concat(c," handleAction:").concat(u)),this.request({protocolName:ga,requestData:t(t({},e),{},{inviter:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(o.getNetworkType()).end(),Ye.log("".concat(n," ok")),o._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),er({group:o.getLocalGroupProfile(s)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error"),e),lr(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):ur({memberCount:0}):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Ye.log("".concat(this._className,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(jo).deleteLocalConversation("".concat(D.CONV_GROUP).concat(e));if(Ot({groupID:e})){var o=this.getLocalGroupProfile(e);if(o&&!0===o.isSupportTopic)this.getModule(Yo).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(Wo).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){if(lt(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(W.MSG_TO_SPECIFIED_GRP_MBR))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=this.createGroupMessagePack(e,t);return this.request(o)}},{key:"createGroupMessagePack",value:function(e,t){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var n="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(n=e.cloudCustomData);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}var c=void 0;lt(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),Ye.warn("".concat(this._className,".createGroupMessagePack receiverList must be less than or equal to 50."))));var u=this.isOnlineMessage(e,t)?1:0,l=e.getGroupAtInfoList(),d={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:n,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==D.MSG_TEXT||oo(l)?void 0:l,onlineOnlyFlag:u,clientTime:e.clientTime,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:0===u?a:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return Gt(e.to)&&(d.groupID=$t(e.to),d.topicID=e.to),{protocolName:Dn,tjgID:this.generateTjgID(e),requestData:d}}},{key:"_isVoipPush",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Gt(e.to)&&(t.groupID=$t(e.to),t.topicID=e.to),this.request({protocolName:_a,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,o=e.keyList;Ye.log("".concat(this._className,".deleteMessage groupID:").concat(t," count:").concat(o.length));var n={groupID:t,deleter:this.getMyUserID(),keyList:o};return Gt(t)&&(n.groupID=$t(t),n.topicID=t),this.request({protocolName:Na,requestData:n})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,o=e.sequence,n=e.payload,a=e.type,s=e.version,r=void 0===s?0:s,i=e.cloudCustomData,c=t,u=void 0;Gt(t)&&(c=$t(t),u=t);var l=void 0;return Jt(a)&&(l=[]).push({type:a,content:n}),this.request({protocolName:Aa,requestData:{groupID:c,topicID:u,sequence:o,version:r,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessage"),n=e.conversationID,a=e.groupID,s=e.sequence,r=new bs(ws.GET_GROUP_ROAMING_MESSAGES),i=0,c=void 0;return Gt(a)&&(a=$t(c=a)),this._computeLastSequence({groupID:a,topicID:c,sequence:s}).then((function(e){return i=e,Ye.log("".concat(o," groupID:").concat(a," startSequence:").concat(i)),t.request({protocolName:ma,requestData:{groupID:a,count:21,sequence:i,topicID:c}})})).then((function(e){var s=e.data,u=s.messageList,l=s.complete,d=s.invisibleSequenceList,p=void 0===d?[]:d;dt(u)?Ye.log("".concat(o," ok. complete:").concat(l," but messageList is undefined!")):Ye.log("".concat(o," ok. complete:").concat(l," count:").concat(u.length));var g=t._getMinSequence(p,u)-1;r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(i," complete:").concat(l," nextSequence:").concat(g)).end();var _=t.getModule(jo),h=[];return oo(u)||(_.updateRoamingMessageSequence(n,g),h=_.onRoamingMessage(u,n),_.updateIsRead(n),_.patchConversationLastMessage(n)),2===l&&(_.setCompleted(n),g=""),Ye.log("".concat(o," nextReqID:").concat(g,", stored message count:").concat(h.length,", invisible sequence count:").concat(p.length)),{nextReqID:g+"",storedMessageList:h}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];r.setError(e,n,s).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(i)).end()})),Ye.warn("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(D.CONV_GROUP,"")}},{key:"_getMinSequence",value:function(e,t){var o=0;oo(t)||(o=t[t.length-1].sequence);var n=0;oo(e)||(n=e[e.length-1]);return Ye.log("".concat(this._className,"._getMinSequence minVisibleSequence:").concat(o," minInvisibleSequence:").concat(n)),n>0&&n=100?100:s,_="groupID:".concat(r," sequence:").concat(c," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);Ye.log("".concat(u," ").concat(_));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new bs(ws.GET_READ_RECEIPT_DETAIL);return f.setMessage(_),this.request({protocolName:Ia,requestData:{groupID:r,sequence:c,flag:d,cursor:p,count:g}}).then((function(e){f.end();var o=e.data,n=o.cursor,a=o.isCompleted,s=o.unreadUserIDList,r=o.readUserIDList;return h.cursor=n,1===a&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===d?h.readUserIDList=r.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=s.map((function(e){return e.userID}))),Ye.log("".concat(u," ok")),er(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];f.setError(e,n,a).end()})),Ye.warn("".concat(u," failed. error:"),e),lr(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,o="".concat(this._className,".getRoamingMessagesHopping"),n=new bs(ws.GET_GROUP_ROAMING_MESSAGES_HOPPING),a=e.groupID,s=e.count,r=e.sequence,i=e.direction,c=r;1===i&&(c=r+s-1);var u=void 0;Gt(a)&&(a=$t(u=a));var l="".concat(u?"topicID:".concat(u):"groupID:".concat(a)," sequence:").concat(r," direction:").concat(i);return Ye.log("".concat(o," ").concat(l)),this.request({protocolName:ma,requestData:{groupID:a,topicID:u,count:s,sequence:c}}).then((function(a){var s=a.data,c=s.messageList,u=s.complete,d="complete:".concat(u," count:").concat(c?c.length:0);if(Ye.log("".concat(o," ok. ").concat(d)),n.setNetworkType(t.getNetworkType()).setMessage("".concat(l," ").concat(d)).end(),2===u||oo(c)){var p=t._computeResult();return er(p)}var g="".concat(D.CONV_GROUP).concat(e.groupID),_=t.getModule(jo).onRoamingMessage(c,g,!1),h=t._computeResult({direction:i,sequence:r,remoteMessageList:c,processedMessageList:_});return er(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),i=o[0],c=o[1];n.setError(e,i,c).setMessage("groupID:".concat(a," sequence:").concat(r," count:").concat(s)).end()})),Ye.warn("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(dt(e))return t.isCompleted=!0,t;var o=e.direction,n=e.sequence,a=e.remoteMessageList,s=void 0===a?[]:a,r=e.processedMessageList,i=void 0===r?[]:r,c=s.length;return 1===o?(t.nextMessageSeq=s[0].sequence+1,i.forEach((function(e){e.sequence>=n&&t.messageList.push(e)})),0===t.messageList.length&&s[0].sequence0?Promise.resolve(a):dt(n)||this.hasLocalGroup(t)?dt(n)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:n}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,o="".concat(this._className,".getGroupLastSequence"),n=new bs(ws.GET_GROUP_LAST_SEQUENCE),a=0,s="";if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),i=r.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return a=i.lastSequence,s="got lastSequence:".concat(a," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),Ye.log("".concat(o," ").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a);if(r.nextMessageSeq>1)return a=r.nextMessageSeq-1,s="got lastSequence:".concat(a," from local group profile[nextMessageSeq]. groupID:").concat(e),Ye.log("".concat(o," ").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a)}var c="GROUP".concat(e),u=this.getModule(jo).getLocalConversation(c);if(u&&u.lastMessage.lastSequence&&!1===u.lastMessage.onlineOnlyFlag)return a=u.lastMessage.lastSequence,s="got lastSequence:".concat(a," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),Ye.log("".concat(o," ").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage("".concat(s)).end(),Promise.resolve(a);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(r){var i=r.data.successGroupList;return oo(i)?Ye.log("".concat(o," successGroupList is empty. groupID:").concat(e)):(a=i[0].nextMessageSeq-1,s="got lastSequence:".concat(a," from getGroupProfileAdvance. groupID:").concat(e),Ye.log("".concat(o," ").concat(s))),n.setNetworkType(t.getNetworkType()).setMessage("".concat(s)).end(),a})).catch((function(a){return t.probeNetwork().then((function(t){var o=m(t,2),s=o[0],r=o[1];n.setError(a,s,r).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),Ye.warn("".concat(o," failed. error:"),a),lr(a)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,o=e.groupID,n=e.topicID,a="".concat(this._className,".getTopicLastSequence"),s=new bs(ws.GET_TOPIC_LAST_SEQUENCE),r=0,i="",c=this.getModule(Yo);return c.hasLocalTopic(o,n)?(r=c.getLocalTopic(o,n).nextMessageSeq-1,i="get lastSequence:".concat(r," from local topic info[nextMessageSeq]. topicID:").concat(n),Ye.log("".concat(a," ").concat(i)),s.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r)):c.getTopicList({groupID:o,topicIDList:[n]}).then((function(e){var o=e.data.successTopicList;return oo(o)?Ye.log("".concat(a," successTopicList is empty. topicID:").concat(n)):(r=o[0].nextMessageSeq-1,i="get lastSequence:".concat(r," from getTopicList. topicID:").concat(n),Ye.log("".concat(a," ").concat(i))),s.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],r=o[1];s.setError(e,a,r).setMessage("get lastSequence failed from getTopicList. topicID:".concat(n)).end()})),Ye.warn("".concat(a," failed. error:"),e),lr(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==D.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!oo(e)){Ye.log("".concat(this._className,"._onAVChatRoomHistoryMessage count:").concat(e.length));var o=[];e.forEach((function(e){o.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(o)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,o=new bs(ws.GET_GROUP_SIMPLIFIED_INFO),n={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(n).then((function(n){var a=n.data.successGroupList;return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(a[0].type)).end(),a[0]})).catch((function(n){t.probeNetwork().then((function(t){var a=m(t,2),s=a[0],r=a[1];o.setError(n,s,r).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,t){return 2===e&&!oo(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&oo(t)}},{key:"getMessageExtensions",value:function(e,t){return Ye.log("".concat(this._className,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Ua,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ye.log("".concat(this._className,".modifyMessageExtensions operateType:").concat(o)),this.request({protocolName:Pa,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:o}})}},{key:"getGroupNotify",value:function(e){var o=this;if(this.hasLocalGroup(e)){var n=this.getLocalGroupProfile(e),a=n.type,s=n.isSupportTopic;if(!Lt(a)&&!s){var r="".concat(this._className,".getGroupNotify"),i=this._getGroupLastRevokedTime(e),c=1e3*xe();Ye.log("".concat(r," groupID:").concat(e," type:").concat(a," beginTime:").concat(i," endTime:").concat(c)),this.request({protocolName:ba,requestData:{type:Ot({type:a,groupID:e})?D.GRP_COMMUNITY:void 0,groupID:e,beginTime:i,endTime:c}}).then((function(n){var a=n.data,s=a.nextRevokedTime,i=a.notifyList;Ye.log("".concat(r," ok. nextRevokedTime:").concat(s));var c={dataList:[{elements:{revokedInfos:[]}}]};lt(i)&&i.forEach((function(o){c.dataList[0].elements.revokedInfos.push({groupID:e,sequence:o.sequence,random:o.random,revokerInfo:t({},o.revokerInfo)})})),o.onGroupMessageRevoked(c),0!==s?(o._setGroupLastRevokedTime(e,s),o.getGroupNotify(e)):o._setGroupLastRevokedTime(e,1e3*xe())})).catch((function(e){Ye.error("".concat(r," failed. error:"),e)}))}}}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),a}(vn),Zr=function(){function e(t){n(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return s(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&kt(this.memberCustomField,e.memberCustomField),Mt(this,e,["memberCustomField","marks"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){dt(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){dt(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&kt(this.memberCustomField,e)}}]),e}(),ei=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(hr,t._onProfileUpdated,_(t)),t}return s(a,[{key:"_onProfileUpdated",value:function(e){for(var t=this,o=e.data,n=function(e){var n=o[e];t.groupMemberListMap.forEach((function(e){e.has(n.userID)&&e.get(n.userID).updateMember({nick:n.nick,avatar:n.avatar})}))},a=0;a100?100:r};Ot({groupID:o})?_.next="".concat(a):(_.offset=a,g=a+r);var h=[];return this.request({protocolName:qa,requestData:_}).then((function(e){var n=e.data,a=n.members,s=n.memberNum,r=n.next,i=void 0===r?void 0:r;if(dt(i)||(g=oo(i)?0:i),!lt(a)||0===a.length)return g=0,Promise.resolve([]);var c=t.getModule(Ko);return c.hasLocalGroup(o)&&(c.getLocalGroupProfile(o).memberNum=s),h=t._updateLocalGroupMemberMap(o,a),t.getModule(Vo).getUserProfile({userIDList:a.map((function(e){return e.userID})),tagList:[$e.NICK,$e.AVATAR]})})).then((function(e){var n=e.data;if(!lt(n)||0===n.length)return ur({memberList:[],offset:g});var s=n.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(o,s),h.length5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),Ye.log("".concat(n," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var s=e.groupID,r=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return lt(t)&&0!==t.length?(o._updateLocalGroupMemberMap(s,t),o.getModule(Vo).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[$e.NICK,$e.AVATAR]})):ur([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));o._updateLocalGroupMemberMap(s,t);var n=r.filter((function(e){return o.hasLocalGroupMember(s,e)})).map((function(e){return o.getLocalGroupMemberInfo(s,e)}));return a.setNetworkType(o.getNetworkType()).end(),er({memberList:n})}))}},{key:"addGroupMember",value:function(e){var t=this,o="".concat(this._className,".addGroupMember"),n=e.groupID,a=this.getModule(Ko).getLocalGroupProfile(n),s=a.type,r=new bs(ws.ADD_GROUP_MEMBER);if(r.setMessage("groupID:".concat(n," groupType:").concat(s)),Lt(s)){var i=new rr({code:hn.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setError(i,!0,this.getNetworkType()).end(),lr(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Ye.log("".concat(o," groupID:").concat(n)),this.request({protocolName:Ba,requestData:e}).then((function(n){var s=n.data.members;Ye.log("".concat(o," ok"));var i=s.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),c=s.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),u=s.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=s.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(i,", ")+"failureUserIDList:".concat(c,", ")+"existedUserIDList:".concat(u,", ")+"overLimitUserIDList:".concat(l);return r.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===i.length?er({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(a.memberCount+=i.length,t._updateConversationGroupProfile(a),er({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:a}))})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,o="".concat(this._className,".deleteGroupMember"),n=e.groupID,a=e.userIDList,s=this.getModule(Ko).getLocalGroupProfile(n);if(dt(s))return lr({code:hn.CANNOT_FIND_GROUP});if(Lt(s.type))return this.canIUse(W.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var r=new bs(ws.DELETE_GROUP_MEMBER),i="groupID:".concat(n," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a));return r.setMessage(i),Ye.log("".concat(o," groupID:").concat(n," userIDList:"),a),this.request({protocolName:Ka,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),s.memberCount-=1,t._updateConversationGroupProfile(s),t.deleteLocalGroupMembers(n,a),er({group:s,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(jo).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,o="".concat(this._className,"._banAVChatRoomMember"),n=e.groupID,a=e.userIDList,s="groupID:".concat(n," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a)),r=new bs(ws.BAN_AVCHATROOM_MEMBER);r.setMessage(s),Ye.log("".concat(o," groupID:").concat(n," userIDList:"),a);var i=this.getModule(Ko).getLocalGroupProfile(n);return dt(e.duration)||0===e.duration?lr({code:hn.BAN_DURATION_INVALID}):this.request({protocolName:Ha,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),t.deleteLocalGroupMembers(n,a),er({group:i,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,o=e.groupID,n=e.userID,a=e.muteTime,s="".concat(this._className,".setGroupMemberMuteTime");if(n===this.getMyUserID())return lr(new rr({code:hn.CANNOT_MUTE_SELF}));Ye.log("".concat(s," groupID:").concat(o," userID:").concat(n));var r=new bs(ws.SET_GROUP_MEMBER_MUTE_TIME);return r.setMessage("groupID:".concat(o," userID:").concat(n," muteTime:").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:n,muteTime:a}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(s," ok"));var n=t.getModule(Ko);return er({group:n.getLocalGroupProfile(o),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(s," failed. error:"),e),lr(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberRole"),n=e.groupID,a=e.userID,s=e.role,r=this.getModule(Ko).getLocalGroupProfile(n);if(r.selfInfo.role!==D.GRP_MBR_ROLE_OWNER)return lr({code:hn.NOT_OWNER});if([D.GRP_WORK,D.GRP_AVCHATROOM].includes(r.type))return lr({code:hn.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[D.GRP_MBR_ROLE_ADMIN,D.GRP_MBR_ROLE_MEMBER];if(Ot({groupID:n})&&i.push(D.GRP_MBR_ROLE_CUSTOM),i.indexOf(s)<0)return lr({code:hn.INVALID_MEMBER_ROLE});if(a===this.getMyUserID())return lr({code:hn.CANNOT_SET_SELF_MEMBER_ROLE});var c=new bs(ws.SET_GROUP_MEMBER_ROLE);return c.setMessage("groupID:".concat(n," userID:").concat(a," role:").concat(s)),Ye.log("".concat(o," groupID:").concat(n," userID:").concat(a)),this.modifyGroupMemberInfo({groupID:n,userID:a,role:s}).then((function(e){return c.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok")),er({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_filterProfanity",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],Q),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:"setGroupMemberNameCard",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberNameCard");if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return lr({code:hn.PROFANITY_FOUND});var n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.nameCard;Ye.log("".concat(o," groupID:").concat(n," userID:").concat(s));var i=new bs(ws.SET_GROUP_MEMBER_NAME_CARD);return i.setMessage("groupID:".concat(n," userID:").concat(s," nameCard:").concat(r)),this.modifyGroupMemberInfo({groupID:n,userID:s,nameCard:r}).then((function(e){Ye.log("".concat(o," ok")),i.setNetworkType(t.getNetworkType()).end();var a=t.getModule(Ko).getLocalGroupProfile(n);return s===t.getMyUserID()&&a&&a.setSelfNameCard(r),er({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,o="".concat(this._className,".setGroupMemberCustomField"),n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.memberCustomField;Ye.log("".concat(o," groupID:").concat(n," userID:").concat(s));var i=new bs(ws.SET_GROUP_MEMBER_CUSTOM_FIELD);return i.setMessage("groupID:".concat(n," userID:").concat(s," memberCustomField:").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:n,userID:s,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(o," ok"));var a=t.getModule(Ko).getLocalGroupProfile(n);return er({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var o=this,n=e.groupID,a=e.userID,s=void 0;return Gt(n)&&(n=$t(s=n)),this.request({protocolName:Wa,requestData:t(t({},e),{},{groupID:n,topicID:s})}).then((function(){if(o.hasLocalGroupMember(n,a)){var t=o.getLocalGroupMemberInfo(n,a);return dt(e.muteTime)||t.updateMuteUntil(e.muteTime),dt(e.role)||t.updateRole(e.role),dt(e.nameCard)||t.updateNameCard(e.nameCard),dt(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return o.getGroupMemberProfile({groupID:n,userIDList:[a]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:"markGroupMemberList",value:function(e){var t=this,o="".concat(this._className,".markGroupMemberList"),n=e.groupID,a=e.markType,s=e.enableMark,r=e.userIDList,i=void 0===r?[]:r,c="groupID:".concat(n," markType:").concat(a," enableMark:").concat(s," userIDList count: ").concat(i.length);Ye.log("".concat(o," ").concat(c));var u=2,l=[];!0===s&&(u=1);var d=v(i);i.length>500&&(d=i.slice(0,500),Ye.warn("".concat(o," ").concat(eo(500)))),d.forEach((function(e){l.push({userID:e,markType:[a]})})),d=null;var p=new bs(ws.MARK_GROUP_MEMBER_LIST);return p.setMessage("".concat(c)),this.request({protocolName:Ya,requestData:{groupID:n,operationType:u,memberList:l}}).then((function(e){var n=e.data.memberList,a=void 0===n?[]:n,s=[],r=[];a.length===i.length?s.push.apply(s,v(i)):(a.forEach((function(e){s.push(e.userID)})),i.forEach((function(e){s.includes(e)||r.push(e)})));var c="success count:".concat(s.length," fail count:").concat(r.length);return p.setNetworkType(t.getNetworkType()).setMessage(c).end(),Ye.log("".concat(o," ok. ").concat(c)),er({successUserIDList:s,failureUserIDList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];p.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Va,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var o=this;return lt(t)&&0!==t.length?t.map((function(t){return o.hasLocalGroupMember(e,t.userID)?o.getLocalGroupMemberInfo(e,t.userID).updateMember(t):o.setLocalGroupMember(e,new Zr(t)),o.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var o=this.groupMemberListMap.get(e);o&&t.forEach((function(e){o.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var o=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,o)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),a}(vn),ti=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],oi=function(e,t){return oo(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:zt(e.type,e.payload,t),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},ni=function(){function e(t,o){n(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=oi(t.lastMessage,o),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return s(e,[{key:"_initTopic",value:function(e){for(var t in e)ti.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=oi(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){dt(e.selfInfo)||this.updateSelfInfo(e.selfInfo),dt(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),Mt(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0!==Mt(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),ai=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");dt(e)||(this.TOPIC_CACHE_TIME=Number(e)),dt(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(S.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,o=e.groupID,n=e.topicIDList;(void 0===n?[]:n).forEach((function(e){t._deleteLocalTopic(o,e)})),this.emitOuterEvent(S.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,o=e.topicID,n=e.messageRemindType,a=this.getLocalTopic(t,o);if(a){var s=a.updateSelfInfo({messageRemindType:n});s&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:a}),Ye.debug("".concat(this._className,".onTopicMessageRemindTypeUpdated topicID:").concat(o)+" messageRemindType:".concat(n," isTopicUpdated:").concat(s))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,o=e.topicID,n=this.getLocalTopic(t,o);n&&(n.updateTopic(e),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,o=e.unreadCount,n=e.groupAtInfoList,a=$t(t),s=this.getLocalTopic(a,t),r=!1;s&&(dt(o)||s.unreadCount===o||(s.updateUnreadCount(o),r=!0),dt(n)||(s.updateGroupAtInfoList(n),r=!0)),r&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:a,topic:s})}},{key:"onMessageSent",value:function(e){var t=e.groupID,o=e.topicID,n=e.lastMessage,a=this.getLocalTopic(t,o);a&&(a.nextMessageSeq+=1,a.updateLastMessage(n),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:a}))}},{key:"onMessageModified",value:function(e){var t=e.to,o=e.time,n=e.sequence,a=e.elements,s=e.cloudCustomData,r=e.messageVersion,i=$t(t),c=this.getLocalTopic(i,t);if(c){var u=c.lastMessage;Ye.debug("".concat(this._className,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(u),"options:",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===o&&u.lastSequence===n&&u.version!==r)&&(u.type=a[0].type,u.payload=a[0].content,u.messageForShow=zt(u.type,u.payload,this.isIntl()),u.cloudCustomData=s,u.version=r,u.lastSequence=n,u.lastTime=o,this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:i,topic:c}))}}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var o=null,n=null,a=!1;e.forEach((function(e){var s=e.to;n=$t(s),(o=t.getLocalTopic(n,s))&&(o.reduceUnreadCount()&&(a=!0),o.isLastMessageRevoked(e)&&(o.setLastMessageRevoked(!0),o.setLastMessageRevoker(e.revoker),a=!0))})),a&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,o=e.sequence,n=$t(t),a=this.getLocalTopic(n,t),s=!1;return a&&(s=a.isLastMessageRevoked({sequence:o})),s}},{key:"getJoinedCommunityList",value:function(){return this.getModule(Ko).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return er({groupList:void 0===t?[]:t})})).catch((function(e){return lr(e)}))}},{key:"createTopicInCommunity",value:function(e){var o=this,n="".concat(this._className,".createTopicInCommunity"),a=e.topicID;if(!dt(a)&&!Gt(a))return lr({code:hn.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity("topicName",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return lr({code:hn.PROFANITY_FOUND});var s=new bs(ws.CREATE_TOPIC);return this.request({protocolName:us,requestData:t({},e)}).then((function(a){var r=a.data.topicID;return s.setMessage("topicID:".concat(r)).setNetworkType(o.getNetworkType()).end(),Ye.log("".concat(n," ok")),o._updateTopicMap([t(t({},e),{},{topicID:r})]),er({topicID:r})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,o="".concat(this._className,".deleteTopicFromCommunity"),n=e.groupID,a=e.topicIDList,s=void 0===a?[]:a,r=new bs(ws.DELETE_TOPIC);return r.setMessage("groupID:".concat(n," topicIDList:").concat(s)),this.request({protocolName:ls,requestData:{groupID:n,topicIDList:s}}).then((function(e){var o=e.data.resultList,a=[],s=[];(void 0===o?[]:o).forEach((function(e){var t=e.topicID,o=e.errorCode,n=e.errorInfo;0===o?a.push({topicID:t}):s.push({topicID:t,code:o,message:n})}));var i="success count:".concat(a.length,", fail count:").concat(s.length);return r.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),Ye.log("".concat(i)),a.forEach((function(e){t._deleteLocalTopic(n,e.topicID)})),er({successTopicList:a,failureTopicList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"updateTopicProfile",value:function(e){var o=this,n="".concat(this._className,".updateTopicProfile");if(Ye.log("".concat(n," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return lr({code:hn.PROFANITY_FOUND});var a=new bs(ws.UPDATE_TOPIC_PROFILE);return a.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),dt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:ds,requestData:t({},e)}).then((function(){return a.setNetworkType(o.getNetworkType()).end(),Ye.log("".concat(n," ok")),o._updateTopicMap([e]),er({topic:o.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"getTopicList",value:function(e){var o=this,n="".concat(this._className,".getTopicList"),a=e.groupID,s=e.topicIDList,r=void 0===s?[]:s,i=0===r.length,c=new bs(ws.GET_TOPIC_LIST);if(c.setMessage("groupID:".concat(a)),this._getTopicTimeMap.has(a)){var u=this._getTopicTimeMap.get(a),l=u.isGetAll,d=u.time;if((l||!l&&!i)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(a,r);if(i||p.length===r.length)return c.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),Ye.log("".concat(n," groupID:").concat(a," from cache, topic count:").concat(p.length)),ur({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:ps,requestData:{groupID:a,topicIDList:r}}).then((function(e){var s=e.data.topicInfoList,r=[],u=[],l=[];(void 0===s?[]:s).forEach((function(e){var o=e.topic,n=e.selfInfo,a=e.errorCode,s=e.errorInfo,i=o.topicID;0===a?(r.push(t(t({},o),{},{selfInfo:n})),u.push(i)):l.push({topicID:i,code:a,message:s})})),o._updateTopicMap(r),o._handleTopicAtInfo(r);var d="success count:".concat(u.length,", fail count:").concat(l.length);c.setNetworkType(o.getNetworkType()).setMoreMessage("".concat(d)).end(),Ye.log("".concat(n," groupID:").concat(a," from remote, ").concat(d));var p=[];return oo(u)||(o._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:i}),p=o._getLocalTopicList(a,u)),er({successTopicList:p,failureTopicList:l})})).catch((function(e){return o.probeNetwork(e).then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var o=null;return this._topicMap.has(e)&&(o=this._topicMap.get(e).get(t)),o}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._topicMap.get(e),n=[];return o&&(n=v(o.values())),0===t.length?n:n.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),Ye.log("".concat(this._className,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,o=[];(e.forEach((function(e){var n=e.groupID,a=e.topicID,s=null;t._topicMap.has(n)||t._topicMap.set(n,new Map),t._topicMap.get(n).has(a)?(s=t._topicMap.get(n).get(a)).updateTopic(e):(t._getTopicLastMessage(e),s=new ni(e,t.isIntl()),t._topicMap.get(n).set(a,s));var r=t._computeUnreadCount(s);s.updateUnreadCount(r),o.push({conversationID:"".concat(D.CONV_GROUP).concat(a),type:D.CONV_TOPIC,unreadCount:r})})),o.length>0)&&this.getModule(jo).updateTopicConversation(o)}},{key:"resetGetTopicTime",value:function(e){var t=this;dt(e)?v(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=v(this._topicMap.keys()),o=[];t.forEach((function(t){var n=[];e._getLocalTopicList(t).forEach((function(t){var o=t.lastMessage.lastTime,a=void 0===o?0:o;Date.now()-1e3*a<1e3*e.TOPIC_LAST_ACTIVE_TIME&&n.push(t.topicID)})),n.length>0&&o.push({groupID:t,topicIDList:n})})),Ye.log("".concat(this._className,".getTopicListOnReconnected. active community count:").concat(o.length)),this._relayGetTopicList(o)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var o=e.shift(),n=o.topicIDList.length>5?"topicIDList.length:".concat(o.topicIDList.length):"topicIDList:".concat(o.topicIDList),a=new bs(ws.RELAY_GET_TOPIC_LIST);a.setMessage(n),Ye.log("".concat(this._className,"._relayGetTopicList. ").concat(n)),this.getTopicList(o).then((function(){a.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),n=t[0],s=t[1];a.setError(o,n,s).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var o=this;0!==e.length&&e.forEach((function(e){var n=e.groupID,a=e.topicID,s=e.groupAtInfoList,r=[];dt(s)||(s.forEach((function(e){r.push(t(t({},e),{},{groupID:n,topicID:a}))})),o.getModule(jo).onNewGroupAtTips({dataList:r}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!dt(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:oo(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,o=this._getLocalTopicList(e),n=this.getModule(jo);o.forEach((function(o){var a=o.topicID;t._deleteLocalTopic(e,a),t._getTopicTimeMap.delete(e),n.deleteLocalConversation("".concat(D.CONV_GROUP).concat(a))}))}},{key:"_computeUnreadCount",value:function(e){var t=e.selfInfo,o=t.excludedUnreadSequenceList,n=t.readedSequence,a=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(lt(o)){var s=0;o.forEach((function(t){t>=n&&t<=e.nextMessageSeq-1&&(s+=1)})),s>=1&&(a-=s)}return a<0?0:a}},{key:"_filterProfanity",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],X),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:"updateLastMessage",value:function(e,t){var o=$t(e),n=this.getLocalTopic(o,e);if(n){var a=t.sequence+1;n.updateNextMessageSeq(a),n.updateLastMessage(t),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),a}(vn),si=function(){function e(t){n(this,e),this._userModule=t,this._className="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return s(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(Ye.warn("".concat(this._className,".getUserProfile ").concat(eo(100))),o.length=100);for(var n,a=[],s=[],r=0,i=o.length;r5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:Nn,requestData:e}).then((function(e){l.setNetworkType(t._userModule.getNetworkType()).end(),Ye.info("".concat(t._className,".getUserProfile ok"));var o=t._handleResponse(e).concat(s);return er(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error("".concat(t._className,".getUserProfile failed. error:"),e),lr(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount();if(Ye.log("".concat(this._className,".getMyProfile myAccount:").concat(e)),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return Ye.debug("".concat(this._className,".getMyProfile from cache, myProfile:")+JSON.stringify(t)),ur(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){for(var t,o,n=vt(),a=e.data.userProfileItem,s=[],r=0,i=a.length;r-1)o.profileCustomField.push({key:t[n].tag,value:t[n].value});else switch(t[n].tag){case $e.NICK:o.nick=t[n].value;break;case $e.GENDER:o.gender=t[n].value;break;case $e.BIRTHDAY:o.birthday=t[n].value;break;case $e.LOCATION:o.location=t[n].value;break;case $e.SELFSIGNATURE:o.selfSignature=t[n].value;break;case $e.ALLOWTYPE:o.allowType=t[n].value;break;case $e.LANGUAGE:o.language=t[n].value;break;case $e.AVATAR:o.avatar=t[n].value;break;case $e.MESSAGESETTINGS:o.messageSettings=t[n].value;break;case $e.ADMINFORBIDTYPE:o.adminForbidType=t[n].value;break;case $e.LEVEL:o.level=t[n].value;break;case $e.ROLE:o.role=t[n].value;break;default:Ye.warn("".concat(this._className,"._handleResponse unknown tag:"),t[n].tag,t[n].value)}return o}},{key:"updateMyProfile",value:function(e){var t=this,o="".concat(this._className,".updateMyProfile");if(e.nick&&!1===this._userModule.filterProfanity("nick",e))return lr({code:hn.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity("selfSignature",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.UPDATE_MY_PROFILE);n.setMessage(JSON.stringify(e));var a=(new Tr).validate(e);if(!a.valid)return n.setCode(hn.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("updateMyProfile info:".concat(a.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Ye.error("".concat(o," info:").concat(a.tips)),lr({code:hn.UPDATE_PROFILE_INVALID_PARAM});var s=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&("profileCustomField"===r?e.profileCustomField.forEach((function(e){s.push({tag:e.key,value:e.value})})):s.push({tag:$e[r.toUpperCase()],value:e[r]}));if(0===s.length){var i=new rr({code:hn.UPDATE_PROFILE_NO_KEY});return n.setError(i,!0,this._userModule.getNetworkType()).end(),Ye.error("".concat(o," failed. error:"),i),lr(i)}return this._userModule.request({protocolName:An,requestData:{fromAccount:this._userModule.getMyAccount(),profileItem:s}}).then((function(a){n.setNetworkType(t._userModule.getNetworkType()).end(),Ye.info("".concat(o," ok"));var s=t._updateMap(t._userModule.getMyAccount(),e);return t._userModule.emitOuterEvent(S.PROFILE_UPDATED,[s]),ur(s)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!oo(t)){var o,n,a=t.length;Ye.debug("".concat(this._className,".onProfileModified count:").concat(a," dataList:"),e.dataList);for(var s=[],r=0;r0&&(this._userModule.emitInnerEvent(hr,s),this._userModule.emitOuterEvent(S.PROFILE_UPDATED,s))}}},{key:"_fillMap",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),o=0,n=e.length;o0&&a.push(o)):a.push(t.userID));0!==a.length&&(Ye.info("".concat(this._className,".onConversationsProfileUpdated toAccountList:").concat(a)),this.getUserProfile({userIDList:a}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._containsAccount(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flushMap(!0),this.accountProfileMap.clear()}}]),e}(),ri=s((function e(t){n(this,e),oo||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),ii=function(){function e(t){n(this,e),this._userModule=t,this._className="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return s(e,[{key:"getLocalBlacklist",value:function(){return v(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._className,".getBlacklist"),o={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},n=new bs(ws.GET_BLACKLIST);return this._userModule.request({protocolName:kn,requestData:o}).then((function(o){var a=o.data,s=a.blackListItem,r=a.currentSequence,i=oo(s)?0:s.length;n.setNetworkType(e._userModule.getNetworkType()).setMessage("count:".concat(i)).end(),Ye.info("".concat(t," ok")),e.currentSequence=r,e._handleResponse(s,!0),e._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(e._blacklistMap.keys()))})).catch((function(o){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()})),Ye.error("".concat(t," failed. error:"),o),lr(o)}))}},{key:"addBlacklist",value:function(e){var t=this,o=new bs(ws.ADD_TO_BLACKLIST),n="".concat(this._className,".addBlacklist"),a=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===a){var s=hn.CANNOT_ADD_SELF_TO_BLACKLIST,r=this._userModule.getErrorMessage(s);o.setCode(s).setMessage(r).setNetworkType(this._userModule.getNetworkType()).end();var i=new rr({code:s});return Ye.error("".concat(n," failed. error:"),i),lr(i)}return e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Rn,requestData:e}).then((function(a){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ye.info("".concat(n," ok")),t._handleResponse(a.resultItem,!0),er(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"_handleResponse",value:function(e,t){if(!oo(e))for(var o,n,a,s=0,r=e.length;s5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ye.info("".concat(o," ok")),t._handleResponse(a.data.resultItem,!1),er(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t,o=[],n=0,a=e.length;n0&&(Ye.log("".concat(this._className,".onAccountDeleted count:").concat(o.length," userIDList:"),o),this._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,o=[],n=0,a=e.length;n0&&(Ye.log("".concat(this._className,".onAccountAdded count:").concat(o.length," userIDList:"),o),this._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),ci=function(e){var t=String(e).replace(/[=]+$/,""),o="";if(t.length%4==1)return Ye.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),"";for(var n,a,s=0,r=0;a=t.charAt(r++);~a&&(n=s%4?64*n+a:a,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);try{return decodeURIComponent(escape(o))}catch(i){return Ye.warn("decodeBase64 failed: ".concat(e," to be decoded is not correctly encoded.")),""}},ui=function(){function e(t){n(this,e),this._userModule=t,this._className="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),o=this._userModule.getCloudConfig("status_unsub_count");Ye.log("".concat(this._className,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(o)),dt(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),dt(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),dt(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(o,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,o=this._userModule.getMyUserID(),n=this._userModule.getModule($o),a=t.map((function(e){var t=e.to,a=e.statusType,s=e.customStatus,r=ci(s);return t===o&&n.setCustomStatus(r),{userID:t,statusType:a,customStatus:r}}));this._userModule.emitOuterEvent(S.USER_STATUS_UPDATED,a)}},{key:"setSelfStatus",value:function(e){var t=this,o="".concat(this._className,".setSelfStatus");if(!1===this._userModule.filterProfanity("customStatus",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.SET_SELF_STATUS),a=e.customStatus;return this._userModule.request({protocolName:gs,requestData:{customStatus:a}}).then((function(e){return n.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(a)).end(),Ye.log("".concat(o," ok. customStatus:").concat(a)),t._userModule.getModule($o).setCustomStatus(a),er({userID:t._userModule.getMyUserID(),statusType:1,customStatus:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"getUserStatus",value:function(e){var t=this,o="".concat(this._className,".getUserStatus"),n=e.userIDList,a=void 0===n?[]:n,s=this._userModule.getMyUserID(),r=v(a),i=void 0,c=r.indexOf(s);if(c>-1){r.splice(c,1);var u=this._userModule.getModule($o).getCustomStatus();i={userID:s,statusType:1,customStatus:u}}if(0===r.length)return ur({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(Ye.warn("".concat(o," ").concat(eo(this.MAX_QUERY_USER_COUNT))),r=a.slice(0,this.MAX_QUERY_USER_COUNT));var l=new bs(ws.GET_USER_STATUS);return this._userModule.request({protocolName:_s,requestData:{userIDList:r}}).then((function(e){var n=e.data,s=n.successUserList,r=void 0===s?[]:s,c=n.failureUserList,u=void 0===c?[]:c,d=r.map((function(e){var t=e.userID,o=e.statusType,n=e.customStatus;return{userID:t,statusType:o,customStatus:ci(n)}})),p=u.map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));dt(i)||d.unshift(i);var g="userID count:".concat(a.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),Ye.log("".concat(o," ok. ").concat(g,".")),er({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];l.setMessage("userID count:".concat(a.length)).setError(e,n,s).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".subscribeUserStatus"),n=e.userIDList,a=void 0===n?[]:n,s=v(a);s.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ye.warn("".concat(o," ").concat(eo(this.MAX_SUBSCRIBE_USER_COUNT))),s=a.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new bs(ws.SUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);return Ye.log("".concat(o," ").concat(i)),this._userModule.request({protocolName:hs,requestData:{userIDList:s}}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),Ye.log("".concat(o," ok. fail count:").concat(a.length,".")),er({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage("".concat(i)).setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".unsubscribeUserStatus"),n=(e||{}).userIDList,a=void 0===n?[]:n,s=v(a);a.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ye.warn("".concat(o," ").concat(eo(this.MAX_UNSUBSCRIBE_USER_COUNT))),s=a.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new bs(ws.UNSUBSCRIBE_USER_STATUS),i="userID count:".concat(a.length);Ye.log("".concat(o," ").concat(i));var c={userIDList:s};return 0===s.length&&(c.userIDList=void 0,c.unsubscribeAll=1),this._userModule.request({protocolName:fs,requestData:c}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(a.length)).end(),Ye.log("".concat(o," ok. fail count:").concat(a.length,".")),er({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage("".concat(i)).setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),li=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="UserModule",a._profileHandler=new si(_(a)),a._blacklistHandler=new ii(_(a)),a._userStatusHandler=new ui(_(a)),a.getInnerEmitterInstance().on(gr,a.onContextUpdated,_(a)),a}return s(o,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!oo(t)){var o=[];t.forEach((function(e){e.blackListDelAccount&&o.push.apply(o,v(e.blackListDelAccount))})),o.length>0&&this._blacklistHandler.onAccountDeleted(o);var n=[];t.forEach((function(e){e.blackListAddAccount&&n.push.apply(n,v(e.blackListAddAccount))})),n.length>0&&this._blacklistHandler.onAccountAdded(n)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(zo)}},{key:"filterProfanity",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],J),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:"isMyFriend",value:function(e){var t=this.getModule(Ho);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return ur(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),o}(vn),di=function(){function e(t,o){n(this,e),this._moduleManager=t,this._isLoggedIn=!1,this._SDKAppID=o.SDKAppID,this._userID=o.userID||"",this._userSig=o.userSig||"",this._version="2.26.1",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=o.unlimitedAVChatRoom,this._scene=o.scene||"",this._oversea=o.oversea,this._instanceID=o.instanceID,this._statusInstanceID=0,this._isDevMode=o.devMode,this._proxyServer=o.proxyServer}return s(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIntl",value:function(){return Qt(this._SDKAppID)}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Ge?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,o=!1,n=!1,a=[];le&&(a=Object.keys(pe)),de&&(a=ue?Object.keys(uni):Object.keys(window));for(var s=0,r=a.length;s0){for(var u=0,l=c.length;u0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return lr({code:hn.USER_NOT_LOGGED_IN});var o=new bs(ws.LOGOUT);return o.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0),Ye.info("".concat(this._className,".logout type:").concat(t)),0===t&&this._moduleManager.setNotReadyReason(hn.LOGGED_OUT),this.request({protocolName:yn,requestData:{type:t}}).then((function(){return e.resetReady(),ur({})})).catch((function(t){return Ye.error("".concat(e._className,"._logout error:"),t),e.resetReady(),ur({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(sn).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:In,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){Ye.warn("".concat(e._className,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return oo(this.getModule($o).getSDKAppID())?t=hn.NO_SDKAPPID:oo(e.userID)?t=hn.NO_IDENTIFIER:oo(e.userSig)&&(t=hn.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return de&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ye.warn("".concat(this._className,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_MULT_ACCOUNT}),t._moduleManager.setNotReadyReason(hn.KICKED_OUT_MULT_ACCOUNT),t._moduleManager.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ye.warn("".concat(this._className,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_MULT_DEVICE}),t._moduleManager.setNotReadyReason(hn.KICKED_OUT_MULT_DEVICE),t._moduleManager.reset()}))}},{key:"onUserSigExpired",value:function(){new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(D.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ye.warn("".concat(this._className,".onUserSigExpired: userSig 签名过期被踢下线")),0!==this.getModule($o).getStatusInstanceID()&&(this.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_USERSIG_EXPIRED}),this._moduleManager.setNotReadyReason(hn.KICKED_OUT_USERSIG_EXPIRED),this._moduleManager.reset())}},{key:"onRestApiKickedOut",value:function(e){(new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage("type:".concat(D.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ye.warn("".concat(this._className,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule($o).getStatusInstanceID())&&(this.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_REST_API}),this._moduleManager.setNotReadyReason(hn.KICKED_OUT_REST_API),this._moduleManager.reset(),this.getModule(nn).onRestApiKickedOut())}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),o}(vn);function gi(){return null}var _i=function(){function e(t){n(this,e),this._moduleManager=t,this._className="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return s(e,[{key:"_errorTolerantHandle",value:function(){le||!dt(window)&&this._canIUseCookies()||(this.getItem=gi,this.setItem=gi,this.removeItem=gi,this.clear=gi)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=E(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];this._setStorageSync(this._getKey(n),a)}}catch(s){t.e(s)}finally{t.f()}this._storageQueue.clear()}catch(r){Ye.warn("".concat(this._className,"._doFlush error:"),r)}}},{key:"_getPrefix",value:function(){var e=this._moduleManager.getModule($o);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var o=t?this._getKey(e):e;return this.getStorageSync(o)}catch(n){return Ye.warn("".concat(this._className,".getItem error:"),n),{}}}},{key:"setItem",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o){var a=n?this._getKey(e):e;this._setStorageSync(a,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{le?pe.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ye.warn("".concat(this._className,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var o=t?this._getKey(e):e;this._removeStorageSync(o)}catch(n){Ye.warn("".concat(this._className,".removeItem error:"),n)}}},{key:"getSize",value:function(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var n={size:0,limitSize:5242880,unit:o};if(Object.defineProperty(n,"leftSize",{enumerable:!0,get:function(){return n.limitSize-n.size}}),le&&(n.limitSize=1024*pe.getStorageInfoSync().limitSize),e)n.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(le){var a=pe.getStorageInfoSync(),s=a.keys;s.forEach((function(e){n.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var r in localStorage)localStorage.hasOwnProperty(r)&&(n.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(n)}catch(i){Ye.warn("".concat(this._className," error:"),i)}}},{key:"_convertUnit",value:function(e){var t={},o=e.unit;for(var n in t.unit=o,e)"number"==typeof e[n]&&("kb"===o.toLowerCase()?t[n]=Math.round(e[n]/1024):"mb"===o.toLowerCase()?t[n]=Math.round(e[n]/1024/1024):t[n]=e[n]);return t}},{key:"_setStorageSync",value:function(e,t){le?ie?my.setStorageSync({key:e,data:t}):pe.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return le?ie?my.getStorageSync({key:e}).data:pe.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){le?ie?my.removeStorageSync({key:e}):pe.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._doFlush()}}]),e}(),hi=function(){function e(t){n(this,e),this._className="SSOLogBody",this._report=[]}return s(e,[{key:"pushIn",value:function(e){Ye.debug("".concat(this._className,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;lt(e)&&0!==e.length&&(Ye.debug("".concat(this._className,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,v(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),fi=function(e){var t=e.getModule($o);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:xe()}},mi=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new hi,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var s=t.getInnerEmitterInstance();return s.on(gr,t._onLoginSuccess,_(t)),s.on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"reportAtOnce",value:function(){Ye.debug("".concat(this._className,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(zo),o=t.getItem(this.TAG,!1);!oo(o)&>(o.forEach)&&(Ye.log("".concat(this._className,"._onLoginSuccess get ssolog in storage, count:").concat(o.length)),o.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),o=this.getCloudConfig("evt_rpt_level"),n=this.getCloudConfig("evt_rpt_sdkappid_bl"),a=this.getCloudConfig("evt_rpt_tinyid_wl");dt(e)||(this.MIN_THRESHOLD=Number(e)),dt(t)||(this.WAITING_TIME=Number(t)),dt(o)||(this.REPORT_LEVEL=o.split(",").map((function(e){return Number(e)}))),dt(n)||(this.REPORT_SDKAPPID_BLACKLIST=n.split(",").map((function(e){return Number(e)}))),dt(a)||(this.REPORT_TINYID_WHITELIST=a.split(","))}},{key:"pushIn",value:function(e){e instanceof bs&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(zo),t=e.getItem(this.TAG,!1),o=this._reportBody.getLogsInMemory();if(oo(t))Ye.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),Ye.log("".concat(this._className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),a}(vn),vi="none",Mi="online",yi=[hn.OVER_FREQUENCY_LIMIT,hn.OPEN_SERVICE_OVERLOAD_ERROR],Ii=function(){function e(t){n(this,e),this._moduleManager=t,this._networkType="",this._className="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return s(e,[{key:"start",value:function(){var e=this;le?(pe.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===vi?Ye.warn("".concat(e._className,".start no network, please check!")):Ye.info("".concat(e._className,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),pe.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Mi,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:Mi})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:vi})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,o=e.networkType,n=!1;t?(Ye.info("".concat(this._className,"._onNetworkStatusChange previousNetworkType:").concat(this._networkType," currentNetworkType:").concat(o)),this._networkType!==o&&(n=!0,this._moduleManager.getModule(nn).reConnect(!0))):this._networkType!==o&&(n=!0,Ye.warn("".concat(this._className,"._onNetworkStatusChange no network, please check!")),this._moduleManager.getModule(nn).offline());n&&(new bs(ws.NETWORK_CHANGE).setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(o)).end(),this._networkType=o)}},{key:"probe",value:function(e){var t=this;return!dt(e)&&yi.includes(e.code)?Promise.resolve([!0,this._networkType]):new Promise((function(e,o){le?pe.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===vi?(Ye.warn("".concat(t._className,".probe no network, please check!")),e([!1,o.networkType])):(Ye.info("".concat(t._className,".probe networkType:").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===vi?e([!1,vi]):e([!0,Mi])}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),le?null!==this._mpNetworkStatusCallback&&(pe.offNetworkStatusChange&&(ce||se?pe.offNetworkStatusChange(this._mpNetworkStatusCallback):pe.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}(),Ci=k((function(e){var t=Object.prototype.hasOwnProperty,o="~";function n(){}function a(e,t,o){this.fn=e,this.context=t,this.once=o||!1}function s(e,t,n,s,r){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new a(n,s||e,r),c=o?o+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],i]:e._events[c].push(i):(e._events[c]=i,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function i(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(o=!1)),i.prototype.eventNames=function(){var e,n,a=[];if(0===this._eventsCount)return a;for(n in e=this._events)t.call(e,n)&&a.push(o?n.slice(1):n);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},i.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var a=0,s=n.length,r=new Array(s);a=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule(un);switch(e.type){case D.MSG_IMAGE:return t.addTotalCount(As),this._uploadImage(e);case D.MSG_FILE:return t.addTotalCount(As),this._uploadFile(e);case D.MSG_AUDIO:return t.addTotalCount(As),this._uploadAudio(e);case D.MSG_VIDEO:return t.addTotalCount(As),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var o=this,n=this.getModule(qo),a=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadImage({file:s.payload.file,to:s.to,onProgress:function(e){if(a.updatePercent(e),gt(s.onProgress))try{s.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=n.fileType,i=n.fileSize,c=n.width,u=n.height,l=o.isPrivateNetWork()?s:Nt(s);a.updateImageFormat(r);var d=Bt({originUrl:l,originWidth:c,originHeight:u,min:198}),p=Bt({originUrl:l,originWidth:c,originHeight:u,min:720});return a.updateImageInfoArray([{size:i,url:l,width:c,height:u},t({},p),t({},d)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadFile({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:Nt(a);return n.updateFileUrl(s),e}))}},{key:"_uploadAudio",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadAudio({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:Nt(a);return n.updateAudioUrl(s),e}))}},{key:"_uploadVideo",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadVideo({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=o.snapshotInfo,r=t.isPrivateNetWork()?a:Nt(a);return n.updateVideoUrl(r),oo(s)||n.updateSnapshotInfo(s),e}))}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return lr({code:hn.MESSAGE_IMAGE_SELECT_FILE_FIRST});var o=this._checkImageType(e.file);if(!0!==o)return o;var n=this._checkImageSize(e.file);if(!0!==n)return n;var a=null;return this._setUploadFileType(Mr),this.uploadByCOS(e).then((function(e){return a=e,t.isPrivateNetWork()?Ft(e.location):Ft("https://".concat(e.location))})).then((function(e){return a.width=e.width,a.height=e.height,Promise.resolve(a)}))}},{key:"_checkImageType",value:function(e){var t="";return t=le?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),mr.indexOf(t.toLowerCase())>=0||lr({code:hn.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=le?e.size:e.files[0].size)?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):t<20971520||lr({code:hn.MESSAGE_IMAGE_SIZE_LIMIT})}},{key:"doUploadFile",value:function(e){return e.file?e.file.files[0].size>104857600?lr({code:hn.MESSAGE_FILE_SIZE_LIMIT}):0===e.file.files[0].size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(Cr),this.uploadByCOS(e)):lr({code:hn.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>104857600?lr({code:hn.MESSAGE_VIDEO_SIZE_LIMIT}):0===e.file.videoFile.size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):-1===vr.indexOf(e.file.videoFile.type)?lr({code:hn.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(yr),le?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):de?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(o,n){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){n(new rr({code:hn.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>20971520?lr({code:hn.MESSAGE_AUDIO_SIZE_LIMIT}):0===e.file.size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(Ir),this.uploadByCOS(e)):lr({code:hn.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t=this,o="".concat(this._className,".uploadByCOS");if(!gt(this._cosUploadMethod))return Ye.warn("".concat(o," ").concat(this._getPluginUndetectedLog())),lr({code:hn.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new bs(ws.UPLOAD),a=Date.now(),s=this._getFile(e);return new Promise((function(r,i){var c=le?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),u=t;t._cosUploadMethod(c,(function(e,c){var l=Object.create(null);if(c){if(e||lt(c.files)&&c.files[0].error){var d=new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),Ye.log("".concat(o," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&(Ye.warn("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void i(d)}l.fileName=s.name,l.fileSize=s.size,l.fileType=s.type.slice(s.type.indexOf("/")+1).toLowerCase(),l.location=le?c.Location:c.files[0].data.Location;var p=Date.now()-a,g=u._formatFileSize(s.size),_=u._formatSpeed(1e3*s.size/p),h="size:".concat(g," time:").concat(p,"ms speed:").concat(_);Ye.log("".concat(o," success. name:").concat(s.name," ").concat(h)),r(l);var f=t.getModule(un);return f.addCost(As,p),f.addFileSize(As,s.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL});n.setError(m,!0,u.getNetworkType()).end(),Ye.warn("".concat(o," failed. error:"),e),403===e.statusCode&&(Ye.warn("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(m)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,o="".concat(this._className,"._uploadWithPreSigUrl"),n=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(a,s){var r=new bs(ws.UPLOAD),i=e.requestSnapshotUrl,c=void 0===i?void 0:i,u=g(e,Ei),l=Date.now();t._cosUploadMethod(u,(function(e,i){var u=Object.create(null);if(e||403===i.statusCode)return r.setError(new rr(e),!0,t.getNetworkType()).end(),Ye.log("".concat(o," failed, error:"),e),void s(new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL}));var d=i.data.location||"";t.isPrivateNetWork()||0!==d.indexOf("https://")&&0!==d.indexOf("http://")||(d=d.split("//")[1]),u.fileName=n.name,u.fileSize=n.size,u.fileType=n.type.slice(n.type.indexOf("/")+1).toLowerCase(),u.location=d;var p=Date.now()-l,g=t._formatFileSize(n.size),_=t._formatSpeed(1e3*n.size/p),h="size:".concat(g,",time:").concat(p,"ms,speed:").concat(_," res:").concat(JSON.stringify(i.data));Ye.log("".concat(o," success name:").concat(n.name,",").concat(h)),r.setNetworkType(t.getNetworkType()).setMessage(h).end();var f=t.getModule(un);if(f.addCost(As,p),f.addFileSize(As,n.size),!oo(c))return t._getSnapshotInfoByUrl(c).then((function(e){u.snapshotInfo=e,a(u)}));a(u)}))}))}))}},{key:"_getFile",value:function(e){var t;return lt(e.file.files)||(t=e.file.files,"filelist"===ht(t))?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?Wt(e/1024,1)+"KB/s":Wt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),o=t.name,n=o.slice(o.lastIndexOf(".")),a=this._genFileName("".concat(Ct(999999)).concat(n));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(a),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn("onProgress callback error:",o)}},onFileFinish:function(e,t,o){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),o=this._genFileName(t.name),n=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(o),FilePath:n,onProgress:function(t){if(Ye.log(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn("onProgress callback error:",o)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,o="",n="",a=0,s=this._getFile(e);if(le)o=this._genFileName(s.name),n=s.url,a=1;else{var r=s.name,i=r.slice(r.lastIndexOf("."));o=this._genFileName("".concat(Ct(999999)).concat(i)),n=s,a=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:o,uploadMethod:a,duration:this.duration}).then((function(a){var s=a.uploadUrl,r=a.downloadUrl,i=a.requestSnapshotUrl,c=void 0===i?void 0:i;return{url:s,fileType:t.uploadFileType,fileName:o,resources:n,downloadUrl:r,requestSnapshotUrl:c,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn("onProgress callback error:",o),Ye.error(o)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(qt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e){var t=this,o=new bs(ws.GET_SNAPSHOT_INFO);return this.request({protocolName:za,requestData:{platform:this.getPlatform(),coverName:this._genFileName(Ct(99999)),requestSnapshotUrl:e}}).then((function(e){var t=(e.data||{}).snapshotUrl;return o.setMessage("snapshotUrl:".concat(t)).end(),oo(t)?{}:Ft(t).then((function(e){return{snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Ye.warn("".concat(t._className,"._getSnapshotInfoByUrl failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getPluginUndetectedLog",value:function(){return this.isIntl()?"No upload plugin is detected. SDK can not send image/audio/video/file messages. See https://web.sdk.qcloud.com/im/doc/en/SDK.html#registerPlugin":"未检测到上传插件,SDK 将无法发送图片、音频、视频、文件等类型的消息。请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin"}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset"))}}]),a}(vn),Di=["downloadKey","pbDownloadKey","messageList"],Ni=function(){function e(t){n(this,e),this._className="MergerMessageHandler",this._messageModule=t}return s(e,[{key:"uploadMergerMessage",value:function(e,t){var o=this;Ye.debug("".concat(this._className,".uploadMergerMessage message:"),e,"messageBytes:".concat(t));var n=e.payload.messageList,a=n.length,s=new bs(ws.UPLOAD_MERGER_MESSAGE);return this._messageModule.request({protocolName:os,requestData:{messageList:n}}).then((function(e){Ye.debug("".concat(o._className,".uploadMergerMessage ok. response:"),e.data);var n=e.data,r=n.pbDownloadKey,i=n.downloadKey,c={pbDownloadKey:r,downloadKey:i,messageNumber:a};return s.setNetworkType(o._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(t,"-").concat(i)).end(),c})).catch((function(e){throw Ye.warn("".concat(o._className,".uploadMergerMessage failed. error:"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var o=this;Ye.debug("".concat(this._className,".downloadMergerMessage message:"),e);var n=e.payload.downloadKey,a=new bs(ws.DOWNLOAD_MERGER_MESSAGE);return a.setMessage("downloadKey:".concat(n)),this._messageModule.request({protocolName:ns,requestData:{downloadKey:n}}).then((function(n){if(Ye.debug("".concat(o._className,".downloadMergerMessage ok. response:"),n.data),gt(e.clearElement)){var s=e.payload,r=(s.downloadKey,s.pbDownloadKey,s.messageList,g(s,Di));e.clearElement(),e.setElement({type:e.type,content:t({messageList:n.data.messageList},r)})}else{var i=[];n.data.messageList.forEach((function(e){if(!oo(e)){var t=new Js(e);i.push(t)}})),e.payload.messageList=i,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return a.setNetworkType(o._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Ye.warn("".concat(o._className,".downloadMergerMessage failed. key:").concat(n," error:"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,o){return e.conversationType===D.CONV_C2C?this._createC2CMergerMessagePack(e,t,o):this._createGroupMergerMessagePack(e,t,o)}},{key:"_createC2CMergerMessagePack",value:function(e,t,o){var n=null;t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0}));var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}var c="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var u=o.pbDownloadKey,l=o.downloadKey,d=o.messageNumber,p=e.payload,g=p.title,_=p.abstractList,h=p.compatibleText,f=this._messageModule.getModule(Bo),m=f&&f.isOnlineMessage(e,t)?0:void 0;return{protocolName:Sn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:u,downloadKey:l,title:g,abstractList:_,compatibleText:h,messageNumber:d}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==m?a:void 0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,o){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push("NoUnread"),!0===i&&a.push("NoLastMsg")}var c="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var u=o.pbDownloadKey,l=o.downloadKey,d=o.messageNumber,p=e.payload,g=p.title,_=p.abstractList,h=p.compatibleText,f=this._messageModule.getModule(Ko),m=f&&f.isOnlineMessage(e,t)?1:0;return{protocolName:Dn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:u,downloadKey:l,title:g,abstractList:_,compatibleText:h,messageNumber:d}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:m,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||f.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?a:void 0}}}}]),e}(),Ai={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},ki=[hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR,hn.MESSAGE_IMAGE_SELECT_FILE_FIRST,hn.MESSAGE_IMAGE_TYPES_LIMIT,hn.MESSAGE_FILE_IS_EMPTY,hn.MESSAGE_IMAGE_SIZE_LIMIT,hn.MESSAGE_FILE_SELECT_FILE_FIRST,hn.MESSAGE_FILE_SIZE_LIMIT,hn.MESSAGE_VIDEO_SIZE_LIMIT,hn.MESSAGE_VIDEO_TYPES_LIMIT,hn.MESSAGE_AUDIO_UPLOAD_FAIL,hn.MESSAGE_AUDIO_SIZE_LIMIT,hn.COS_UNDETECTED];function Ri(e){var t=!1;return Object.values(Ai).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var Li=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Ni(_(t)),t}return s(a,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n="string"==typeof e.payload?e.payload:e.payload.text,a=new Fs({text:n}),s=this._getNickAndAvatarByUserID(t);return o.setElement(a),o.setNickAndAvatar(s),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"_fileUnsupportedWarning",value:function(e){this.isIntl()||Ye.warn("小程序环境下调用 ".concat(e," 接口时,payload.file 不支持传入 File 对象"))}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e);if(le){var n=e.payload.file;if(st(n))return void this._fileUnsupportedWarning("createImageMessage");var a=n.tempFiles[0].path||n.tempFiles[0].tempFilePath,s={url:a,name:a.slice(a.lastIndexOf("/")+1),size:n.tempFiles&&n.tempFiles[0].size||1,type:a.slice(a.lastIndexOf(".")+1).toLowerCase()};e.payload.file=s}else if(de)if(st(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(ut(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var c=new qs({imageFormat:je.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return o.setElement(c),o.setNickAndAvatar(u),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(le){var o={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=o}var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var a=new Zs(e),s=new Vs({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID()}),r=this._getNickAndAvatarByUserID(n);return a.setElement(s),a.setNickAndAvatar(r),a.setNameCard(this._getNameCardByGroupID(a)),this._messageOptionsMap.set(a.clientSequence,e),a}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="https://web.sdk.qcloud.com/im/assets/images/transparent.png",e.payload.file.thumbSize=1668;var o={};if(le){if(ie)return void Ye.warn("createVideoMessage 不支持在支付宝小程序环境下使用");if(st(e.payload.file))return void this._fileUnsupportedWarning("createVideoMessage");var n=e.payload.file;lt(n.tempFiles)&&(n=n.tempFiles[0]),o.url=n.tempFilePath,o.name=n.tempFilePath.slice(n.tempFilePath.lastIndexOf("/")+1),o.size=n.size,o.second=n.duration,o.type=n.tempFilePath.slice(n.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(de){if(st(e.payload.file)){var a=e.payload.file;e.payload.file.files=[a]}else if(ut(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file.tempFile;e.payload.file.files=[s]}var r=e.payload.file;o.url=window.URL.createObjectURL(r.files[0]),o.name=r.files[0].name,o.size=r.files[0].size,o.second=r.files[0].duration||0,o.type=r.files[0].type.split("/")[1]}e.payload.file.videoFile=o;var i=new Zs(e),c=new $s({videoFormat:o.type,videoSecond:Wt(o.second,0),videoSize:o.size,remoteVideoUrl:"",videoUrl:o.url,videoUUID:this._generateUUID(),thumbUUID:this._generateUUID(),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),u=this._getNickAndAvatarByUserID(t);return i.setElement(c),i.setNickAndAvatar(u),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new js({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new xs(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=this._getNickAndAvatarByUserID(t),n=new Zs(e),a=new Xs(e.payload);return n.setElement(a),n.setNickAndAvatar(o),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:"createForwardMessage",value:function(e){var t=e.to,o=e.conversationType,n=e.priority,a=e.payload,s=e.needReadReceipt,r=e.receiverList,i=this.getMyUserID(),c=this._getNickAndAvatarByUserID(i);if(a.type===D.MSG_GRP_TIP)return lr({code:hn.MESSAGE_FORWARD_TYPE_INVALID});var u={to:t,conversationType:o,conversationID:"".concat(o).concat(t),priority:n,isPlaceMessage:0,status:ro.UNSEND,currentUser:i,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||"",needReadReceipt:s,receiverList:r,isSupportExtension:e.isSupportExtension||!1},l=new Zs(u);return l.setElement(a.getElements()[0]),l.setNickAndAvatar(c),l.setNameCard(this._getNameCardByGroupID(a)),l.setRelayFlag(!0),l}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(le){var o,n="createFileMessage 接口不可用!";if(!ne&&!ae&&!ce)return void Ye.warn("小程序目前不支持选择文件,".concat(n));var a=pe.getSystemInfoSync().SDKVersion;if(ne&&Vt(a,o="2.5.0")<0)return void Ye.warn("wx.chooseMessageFile 需要基础库".concat(o,"或更高版本,").concat(n));if(ae&&Vt(a,o="1.18.0")<0)return void Ye.warn("qq.chooseMessageFile 需要基础库".concat(o,"或更高版本,").concat(n))}if(de||ce){if(st(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(ut(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file,i=r.tempFiles,c=r.files,u=null;lt(i)?u=i[0]:lt(c)&&(u=c[0]),e.payload.file={files:[u]}}}else if(ne||ae){var l=e.payload.file.tempFiles,d=t(t({},l[0]),{},{url:l[0].path});e.payload.file={files:[d]}}var p=this.getMyUserID();e.currentUser=p,e.senderTinyID=this.getMyTinyID();var g=new Zs(e),_=new Ys({uuid:this._generateUUID(),file:e.payload.file}),h=this._getNickAndAvatarByUserID(p);return g.setElement(_),g.setNickAndAvatar(h),g.setNameCard(this._getNameCardByGroupID(g)),this._messageOptionsMap.set(g.clientSequence,e),g}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new zs(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:"_onCannotFindModule",value:function(){return lr({code:hn.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var o=this;if(!1===this.getModule(pn).filterMessage(e))return this._onSendMessageFailed(e,new rr({code:hn.PROFANITY_FOUND}));var n,a=null;switch(e.conversationType){case D.CONV_C2C:if(!(a=this.getModule(Bo)))return this._onCannotFindModule();break;case D.CONV_GROUP:if(!(a=this.getModule(Ko)))return this._onCannotFindModule();if(Ot({groupID:e.to})){var s=a.getLocalGroupProfile(e.to);if(s&&s.isSupportTopic)return lr({code:hn.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return lr({code:hn.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(Zo),i=this.getModule(Ko);return r.upload(e).then((function(){o._getSendMessageSpecifiedKey(e)===Ns&&o.getModule(un).addSuccessCount(As);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return lr({code:hn.MESSAGE_FILE_URL_IS_EMPTY});o._addSendMessageTotalCount(e),n=Date.now();var s=function(e){var t="utf-8";de&&document&&(t=document.charset.toLowerCase());var o,n,a=0;if(n=e.length,"utf-8"===t||"utf8"===t)for(var s=0;s11264?o._mergerMessageHandler.uploadMergerMessage(e,s).then((function(n){var a=o._mergerMessageHandler.createMergerMessagePack(e,t,n);return o.request(a)})):(o.getModule(jo).setMessageRandom(e),e.conversationType===D.CONV_C2C||e.conversationType===D.CONV_GROUP?a.sendMessage(e,t):void 0)})).then((function(s){var r=s.data,i=r.time,c=r.sequence,u=r.readReceiptCode;rt(u)&&0!==u&&(new bs(ws.SEND_MESSAGE_WITH_RECEIPT).setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(c," readReceiptCode:").concat(u)).end(),Ye.warn("".concat(o._className,".sendMessageInstance readReceiptCode:").concat(u," message:").concat(sr[u])));o._addSendMessageSuccessCount(e,n),o._messageOptionsMap.delete(e.clientSequence);var l=o.getModule(jo);e.status=ro.SUCCESS,e.time=i;var d=!1;if(e.conversationType===D.CONV_GROUP)e.sequence=c;else if(e.conversationType===D.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,_=p.avatar;g===e.nick&&_===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),a.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;ut(t)&&ut(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Gt(e.to))f=D.CONV_TOPIC,o.getModule(Yo).onMessageSent({groupID:$t(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||Kt(e.payload.imageInfoArray),er({message:e})}))})).catch((function(t){return o._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=ro.FAIL,this.getModule(jo).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var o=new bs(ws.SEND_MESSAGE);return o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),Ye.error("".concat(this._className,"._onSendMessageFailed error:"),t),lr(new rr({code:t&&t.code?t.code:hn.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([D.MSG_IMAGE,D.MSG_AUDIO,D.MSG_VIDEO,D.MSG_FILE].includes(e.type))return Ns;if(e.conversationType===D.CONV_C2C)return Es;if(e.conversationType===D.CONV_GROUP){var t=this.getModule(Ko).getLocalGroupProfile(e.to);if(!t)return;var o=t.type;return Lt(o)?Ds:Ss}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(un).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var o=Math.abs(Date.now()-t),n=this._getSendMessageSpecifiedKey(e);if(n){var a=this.getModule(un);a.addSuccessCount(n),a.addCost(n,o)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var o,n,a=t.code,s=void 0===a?-1:a,r=this.getModule(un),i=this._getSendMessageSpecifiedKey(e);i===Ns&&(o=s,n=!1,ki.includes(o)&&(n=!0),n)?r.addFailedCountOfUserSide(As):Ri(s)&&i&&r.addFailedCountOfUserSide(i)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=ro.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,o=null;if(e.conversationType===D.CONV_C2C){if(!(o=this.getModule(Bo)))return this._onCannotFindModule()}else if(e.conversationType===D.CONV_GROUP&&!(o=this.getModule(Ko)))return this._onCannotFindModule();var n=new bs(ws.REVOKE_MESSAGE);return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),o.revokeMessage(e).then((function(o){var a=o.data.recallRetList;if(!oo(a)&&0!==a[0].retCode){var s=new rr({code:a[0].retCode,data:{message:e}});return n.setCode(s.code).setMoreMessage(s.message).end(),lr(s)}return Ye.info("".concat(t._className,".revokeMessage ok. ID:").concat(e.ID)),e.isRevoked=!0,n.end(),t.getModule(jo).onMessageRevoked([e]),er({message:e})})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()}));var a=new rr({code:o&&o.code?o.code:hn.MESSAGE_REVOKE_FAIL,message:o&&o.message?o.message:void 0,data:{message:e}});return Ye.warn("".concat(t._className,".revokeMessage failed. error:"),o),lr(a)}))}},{key:"deleteMessage",value:function(e){var t=this,o=null,n=e[0],a=n.conversationID,s="",r=[],i=[];if(n.conversationType===D.CONV_C2C)o=this.getModule(Bo),s=a.replace(D.CONV_C2C,""),e.forEach((function(e){e&&e.status===ro.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(n.conversationType===D.CONV_GROUP)o=this.getModule(Ko),s=a.replace(D.CONV_GROUP,""),e.forEach((function(e){e&&e.status===ro.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push("".concat(e.sequence)),i.push(e))}));else if(n.conversationType===D.CONV_SYSTEM)return lr({code:hn.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!o)return this._onCannotFindModule();if(0===r.length)return this._onMessageDeleted(i);r.length>30&&(r=r.slice(0,30),i=i.slice(0,30));var c=new bs(ws.DELETE_MESSAGE);return c.setMessage("to:".concat(s," count:").concat(r.length)),o.deleteMessage({to:s,keyList:r}).then((function(e){return c.end(),Ye.info("".concat(t._className,".deleteMessage ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.warn("".concat(t._className,".deleteMessage failed. error:"),e);var o=new rr({code:e&&e.code?e.code:hn.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return lr(o)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(jo).onMessageDeleted(e),ur({messageList:e})}},{key:"translateText",value:function(e){var o="".concat(this._className,".translateText"),n=e.sourceTextList,a=e.sourceLanguage,s=e.targetLanguage,r=new bs(ws.TRANSLATE_MESSAGE);return r.setMessage("sourceLanguage:".concat(a," targetLanguage:").concat(s)),this.request({protocolName:Is,requestData:{sourceTextList:n,source:a||"auto",target:s,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var n=e.data,a=n.error,s=n.requestID,i=n.translatedTextList;if(0===a.code)return r.end(),Ye.info("".concat(o," ok. requestID:").concat(s)),er({translatedTextList:i});throw t(t({},a),{},{requestID:s})})).catch((function(e){return r.setCode(e.code).setMoreMessage(e.requestID).end(),Ye.warn("".concat(o," failed. error:"),e),lr({code:hn.TRANSLATE_TEXT_FAIL})}))}},{key:"modifyRemoteMessage",value:function(e){var t=this,o=null,n=e.conversationType,a=e.to;if(this.getModule(Ko).isMessageFromOrToAVChatroom(a))return lr({code:hn.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(pn).filterMessage(e))return lr({code:hn.PROFANITY_FOUND,data:{message:e}});n===D.CONV_C2C?o=this.getModule(Bo):n===D.CONV_GROUP&&(o=this.getModule(Ko));var s=new bs(ws.MODIFY_MESSAGE);return s.setMessage("to:".concat(a)),o.modifyRemoteMessage(e).then((function(o){s.end(),Ye.info("".concat(t._className,".modifyRemoteMessage ok"));var n=t._onModifyRemoteMessageResp(e,o.data);return er({message:n})})).catch((function(o){if(s.setCode(o.code).setMoreMessage(o.message).end(),Ye.warn("".concat(t._className,".modifyRemoteMessage failed. error:"),o),20027===o.code){var n=t._onModifyRemoteMessageResp(e,o.data);return lr({code:hn.MESSAGE_MODIFY_CONFLICT,data:{message:n}})}return lr({code:o.code,message:o.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){Ye.debug("".concat(this._className,"._onModifyRemoteMessageResp options:"),t);var o=e.conversationType,n=e.from,a=e.to,s=e.random,r=e.sequence,i=e.time,c=t.elements,u=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(jo).onMessageModified({conversationType:o,from:n,to:a,time:i,random:s,sequence:r,elements:c,cloudCustomData:d,messageVersion:u})}},{key:"_generateUUID",value:function(){var e=this.getModule($o);return"".concat(e.getSDKAppID(),"-").concat(e.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=Tt[Math.floor(Math.random()*Et)];return e}())}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(Vo).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===D.CONV_GROUP){var t=this.getModule(Ko);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._messageOptionsMap.clear()}}]),a}(vn),Oi=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="MessageExtensionModule",a.messageExtensionMap=new Map,a.globalSeqMap=new Map,a.getMessageExtensionsMap=new Map,a}return s(o,[{key:"onMessageExtensionNotify",value:function(e){var t=this,o=e.dataList,n=o.messageInfo,a=o.operateType,s=o.operateResultList,r=o.tinyID,i=o.globalSequence,c=n.clientTime,u=n.random,l="".concat(r,"-").concat(c,"-").concat(u),d=[],p=[];Ye.log("".concat(this._className,".onMessageExtensionNotify messageID:").concat(l," operateType:").concat(a," globalSequence:").concat(i)),this._updateGlobalSequence(l,i);var g=!1,_=!1;s.forEach((function(e){var o=e.extensions,n=void 0===o?[]:o,s=e.clearSequence;if(1===a)g=!0,n.forEach((function(e){d.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,n);else if(2===a)_=!0,n.forEach((function(e){p.push(e.key)})),t._updateLocalExtension(l,n);else if(3===a){if(_=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=s&&!oo(e.value)&&p.push(t)}));t._clearLocalExtension(l,s)}})),g&&this.emitOuterEvent(S.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),_&&this.emitOuterEvent(S.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:p})}},{key:"setMessageExtensions",value:function(e,t){var o=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".setMessageExtensions"),a=e.ID,s=e.conversationID,r=e.sequence,i=e.time,c=v(t);t.length>20&&(c=t.slice(0,20),Ye.warn("".concat(n,". the length of extensions cannot exceed 20.")));var u="conversationID:".concat(s," messageID:").concat(a," sequence:").concat(r," time:").concat(i," count:").concat(c.length),l=new bs(ws.SET_MESSAGE_EXTENSIONS);return l.setMessage(u),Ye.log("".concat(n," ").concat(u)),this._modifyMessageExtensions(e,c).then((function(e){var t=e.resultList,o=e.successCount,a=e.failureCount,s="success count:".concat(o," fail count:").concat(a);return l.setMoreMessage(s).end(),Ye.log("".concat(n," ok. ").concat(s)),er({extensions:t})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"getMessageExtensions",value:function(e){var t=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._className,".getMessageExtensions"),n=e.ID,a=e.conversationID,s=e.sequence,r=e.time,i="conversationID:".concat(a," messageID:").concat(n," sequence:").concat(s," time:").concat(r),c=new bs(ws.GET_MESSAGE_EXTENSIONS);c.setMessage(i),Ye.log("".concat(o," ").concat(i));var u=void 0;return this.getMessageExtensionsMap.has(n)&&(u=this._getGlobalSequence(n)),this._getMessageExtensions(e,u).then((function(e){return c.end(),Ye.log("".concat(o," ok. total count:").concat(e.length)),dt(u)&&e.length>0&&t.getMessageExtensionsMap.set(n,1),er({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"deleteMessageExtensions",value:function(e,t){var o=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._className,".deleteMessageExtensions"),a=[],s=3;oo(t)||(s=2,t.forEach((function(e){a.push({key:e,value:"",seq:0})})));var r=e.ID,i=e.conversationID,c=e.sequence,u=e.time,l="conversationID:".concat(i," messageID:").concat(r," sequence:").concat(c," time:").concat(u," operateType:").concat(s),d=new bs(ws.DELETE_MESSAGE_EXTENSIONS);return d.setMessage(l),Ye.log("".concat(n," ").concat(l)),this._modifyMessageExtensions(e,a,s).then((function(e){var t=e.resultList,o=e.successCount,a=e.failureCount,r="";return 2===s&&(r="success count:".concat(o," fail count:").concat(a)),d.setMoreMessage("".concat(r)).end(),Ye.log("".concat(n," ok. ").concat(r)),er({extensions:t})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];d.setError(e,n,a).end()})),Ye.error("".concat(n," failed. error:"),e),lr(e)}))}},{key:"_modifyMessageExtensions",value:function(e,t){var o=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=e.conversationType,s=void 0;3!==n&&(s=this._getRequestExtensions(e,t));var r=null;switch(a){case D.CONV_C2C:r=this.getModule(Bo);break;case D.CONV_GROUP:r=this.getModule(Ko);break;default:return lr({code:hn.CANNOT_FIND_MODULE})}return r.modifyMessageExtensions(e,s,n).then((function(t){var n=t.data,a=n.extensions,s=n.seq,r=[],i=0,c=0,u=[];return(a=oo(a)?[]:a).forEach((function(e){var t=e.errorCode,o=e.extension,n=o.key,a=o.value,s=o.seq;r.push({code:t,key:n,value:a}),0===t?i++:c++,u.push({key:n,value:a,seq:s})})),o._updateGlobalSequence(e.ID,s),u.length>0&&(o._updateLocalExtension(e.ID,u),u=null),{resultList:r,successCount:i,failureCount:c}})).catch((function(e){return lr(e)}))}},{key:"_getRequestExtensions",value:function(e,t){var o=[];if(this._hasLocalExtension(e.ID)){var n=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,a=e.value,s=0;n.has(t)&&(s=n.get(t).seq),o.push({key:t,value:a,seq:s})})),o}return t.forEach((function(e){var t=e.key,n=e.value;o.push({key:t,value:n,seq:0})})),o}},{key:"_getMessageExtensions",value:function(e,t){var o=this,n="".concat(this._className,"._getMessageExtensions"),a=e.ID,s=null;switch(e.conversationType){case D.CONV_C2C:s=this.getModule(Bo);break;case D.CONV_GROUP:s=this.getModule(Ko);break;default:return lr({code:hn.CANNOT_FIND_MODULE})}return s.getMessageExtensions(e,t).then((function(t){var s=t.data,r=s.extensions,i=s.completeFlag,c=s.globalSequence,u=s.clearSequence;if(r=oo(r)?[]:r,Ye.log("".concat(n," ok. completeFlag:").concat(i," globalSequence:").concat(c," clearSequence:").concat(u," count:").concat(r.length)),o._updateLocalExtension(a,r),o._clearLocalExtension(a,u),o._updateGlobalSequence(a,c),1!==i){var l=r.slice(-1)[0].seq+1;return o._getMessageExtensions(e,l)}return o._getLocalExtensions(a)})).catch((function(e){return lr(e)}))}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var o=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,n=e.value,a=void 0===n?"":n,s=e.seq;o.set(t,{value:a,seq:s})}))}},{key:"_clearLocalExtension",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var o=this._getLocalExtension(e);o.forEach((function(e,n){e.seq<=t&&o.delete(n)}))}}},{key:"_getLocalExtensions",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,o){var n=e.value;oo(n)||t.push({key:o,value:n})}));return t}},{key:"_getGlobalSequence",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSequence",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),o}(vn),Gi=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="ComboMessageModule",a}return s(o,[{key:"sendMessage",value:function(e){var t=this,o=this._constructMessageInstance(e);if(null===o)return lr({code:hn.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(o);var n=Date.now();return this.getModule(jo).setMessageRandom(o),this._sendComboMessage(o,e).then((function(e){var a=e.data,s=a.time,r=a.sequence,i=a.readReceiptCode;rt(i)&&0!==i&&(new bs(ws.SEND_MESSAGE_WITH_RECEIPT).setMessage("from:".concat(o.from," to:").concat(o.to," sequence:").concat(r," readReceiptCode:").concat(i)).end(),Ye.warn("".concat(t._className,".sendMessage readReceiptCode:").concat(i," message:").concat(sr[i])));t._addSendMessageSuccessCount(o,n);var c=t.getModule(jo);o.status=ro.SUCCESS,o.time=s,o.conversationType===D.CONV_GROUP&&(o.sequence=r),c.appendToMessageList(o);var u=o;return!0===o._isExcludedFromLastMessage&&(u=""),c.onMessageSent({conversationOptionsList:[{conversationID:o.conversationID,unreadCount:0,type:o.conversationType,subType:o.conversationSubType,lastMessage:u}]}),er({message:o})})).catch((function(e){return t._onSendMessageFailed(o,e)}))}},{key:"_sendComboMessage",value:function(e,t){var o=this._moduleManager.getModule(on),n="";return e.conversationType===D.CONV_C2C&&(n="".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SEND_MESSAGE)),e.conversationType===D.CONV_GROUP&&(n="".concat(H.NAME.GROUP,".").concat(H.CMD.SEND_GROUP_MESSAGE)),o.sendComboMessage({servcmd:n,data:t})}},{key:"_constructMessageInstance",value:function(e){var t=null;try{var o=this.getMyUserID(),n={};if(n.senderTinyID=this.getMyTinyID(),n.currentUser=o,n.from=e.From_Account||o,e.GroupId?(n.conversationID="".concat(D.CONV_GROUP).concat(e.GroupId),n.conversationType=D.CONV_GROUP,n.to=e.GroupId):e.To_Account&&(n.conversationID="".concat(D.CONV_C2C).concat(e.To_Account),n.conversationType=D.CONV_C2C,n.to=e.To_Account),n.time=e.MsgTimeStamp||0,n.random=e.Random||e.MsgRandom||0,n.priority=e.MsgPriority,it(e.CloudCustomData)&&e.CloudCustomData.length>0&&(n.cloudCustomData=e.CloudCustomData),lt(e.SendMsgControl)&&(n.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(n.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(n.messageControlInfo.excludedFromLastMessage=1)),n.conversationType===D.CONV_GROUP&<(e.To_Account)&&e.To_Account.length>0){var a=e.To_Account;e.To_Account.length>50&&(a=e.To_Account.slice(0,50),Ye.warn("".concat(this._className,"._constructMessageInstance To_Account must be less than or equal to 50."))),n.receiverList=v(a),e.To_Account=v(a)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(n.needReadReceipt=!0),1===e.SupportMessageExtension&&(n.isSupportExtension=!0),(t=new Zs(n)).status=ro.UNSEND,e.MsgClientTime=t.clientTime,t.conversationType===D.CONV_C2C&&(e.MsgSeq=t.sequence);for(var s,r=e.MsgBody.length,i=0;i100)return o--,t;if(lt(t)){var a=t.map((function(t){return ct(t)?e(t,n):t}));return o--,a}if(ct(t)){var s=(r=t,i=function(e,t){if(!ft(t))return!1;if((a=t)!==wi(a))for(var o=0;o65535)return Vi(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Vi(192|t>>>6,128|63&t):Vi(224|t>>>12,128|t>>>6&63,128|63&t)},Ki=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Bi),o=0|t.length,n=new Uint8Array(o),a=0;a0)for(var c=0;c=s&&(Ye.log("".concat(e._className,"._checkPromiseMap request timeout, delete requestID:").concat(o)),e._promiseMap.delete(o),n(new rr({code:hn.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(o))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var o=Date.now()-this._startTs;Ye.log("".concat(this._className,"._onOpen cost ").concat(o," ms. socketID:").concat(t)),new bs(ws.WS_ON_OPEN).setMessage(o).setCostTime(o).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=Ji,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new bs(ws.WS_ON_CLOSE),o=e.id,n=e.e,a="sourceSocketID:".concat(o," currentSocketID:").concat(this._socketID," code:").concat(n.code," reason:").concat(n.reason),s=0;0!==this._onOpenTs&&(s=Date.now()-this._onOpenTs),t.setMessage(s).setCostTime(s).setMoreMessage(a).setCode(n.code).end(),Ye.log("".concat(this._className,"._onClose ").concat(a," onlineTime:").concat(s)),o===this._socketID&&(this._readyState=Qi,s<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,o=e.e,n="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new bs(ws.WS_ON_ERROR).setMessage(o.errMsg||yt(o)).setMoreMessage(n).setLevel("error").end(),Ye.warn("".concat(this._className,"._onError"),o,n),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(u){new bs(ws.JSON_PARSE_ERROR).setMessage(e.data).end()}if(t&&t.head){var o=this._getRequestIDFromHead(t.head),n=t.body;if(!o.startsWith(H.NAME.TUIROOM_SVR)){var a=Ht(t.head);n=xi(t.body,this._getResponseKeyMap(a))}if(Ye.debug("".concat(this._className,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(o," has:").concat(this._promiseMap.has(o))),this._setNextPingTs(),this._promiseMap.has(o)){var s=this._promiseMap.get(o),r=s.resolve,i=s.reject,c=s.timestamp;return this._promiseMap.delete(o),this._calcRTT(c),void(n.errorCode&&0!==n.errorCode?(this._channelModule.onErrorCodeNotZero(n),i(new rr({code:n.errorCode,message:n.errorInfo||"",data:o.includes(qn)||o.includes(Aa)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData}:void 0}))):r(er(n)))}this._channelModule.onMessage({head:t.head,body:n})}}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(un).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new Wi(this),this._socketID=this._socket.getID(),this._readyState=Xi,Ye.log("".concat(this._className,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new bs(ws.WS_CONNECT).setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){this._channelModule.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=xt();(ie||ne&&"windows"===e||ce)&&(this._canIUseBinaryFrame=!1);var t=-1;"ios"===e?t=ye||-1:"android"===e&&(t=Ce||-1);var o=this._channelModule.getModule($o),n=this._channelModule.getPlatform(),a=o.getSDKAppID(),s=o.getInstanceID();return this._canIUseBinaryFrame?"".concat(this._url,"/binfo?sdkappid=").concat(a,"&instanceid=").concat(s,"&random=").concat(this._getRandom(),"&platform=").concat(n,"&host=").concat(e,"&version=").concat(t):"".concat(this._url,"/info?sdkappid=").concat(a,"&instanceid=").concat(s,"&random=").concat(this._getRandom(),"&platform=").concat(n,"&host=").concat(e,"&version=").concat(t)}},{key:"_closeConnection",value:function(e){Ye.log("".concat(this._className,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=Qi)}},{key:"_resend",value:function(){var e=this;if(Ye.log("".concat(this._className,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach((function(t,o){var n=t.uplinkData,a=t.resolve,s=t.reject;e._promiseMap.set(o,{resolve:a,reject:s,timestamp:Date.now(),uplinkData:n}),e._execute(o,n)})),this._simpleRequestMap.size>0){var t,o=E(this._simpleRequestMap);try{for(o.s();!(t=o.n()).done;){var n=m(t.value,2),a=n[0],s=n[1];this._execute(a,s)}}catch(r){o.e(r)}finally{o.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var o=g(e,$i),n=this._getRequestIDFromHead(e.head),a=JSON.stringify(o);return new Promise((function(e,s){(t._promiseMap.set(n,{resolve:e,reject:s,timestamp:Date.now(),uplinkData:a}),Ye.debug("".concat(t._className,".send uplinkData:").concat(JSON.stringify(o)," requestID:").concat(n," readyState:").concat(t._readyState)),t._readyState!==Ji)?t._reConnect():(t._execute(n,a),t._channelModule.getModule(un).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var t=g(e,zi),o=this._getRequestIDFromHead(e.head),n=JSON.stringify(t);this._readyState!==Ji?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(on).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(on).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==D.NET_STATE_CONNECTED&&e.head.servcmd.includes(Ja)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=H.HOST.CURRENT.STAT;return new Promise((function(o,n){var a="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),s=JSON.stringify(e.body),r="application/x-www-form-urlencoded;charset=UTF-8";if(le)pe.request({url:a,data:s,method:"POST",timeout:3e3,header:{"content-type":r},success:function(){o()},fail:function(){n(new rr({code:hn.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,c=setTimeout((function(){i.abort(),n(new rr({code:hn.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(c),200===i.status||304===i.status?o():n(new rr({code:hn.NETWORK_ERROR})))},i.open("POST",a,!0),i.setRequestHeader("Content-type",r),i.send(s)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){le&&!ce&&(this.isIntl()||Ye.error("".concat(this._className,".onError 从v2.11.2起,SDK 支持了 WebSocket,如您未添加相关受信域名,请先添加!(如已添加请忽略),升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html"))),this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(on).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){Ye.log("".concat(this._className,".onReconnected")),this.getModule(on).onReconnected(),this._emitNetStateChangeEvent(D.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){Ye.log("".concat(this._className,".onReconnectFailed")),this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var o="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(Ye.log("".concat(this._className,".reConnect ").concat(o)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===D.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(D.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(Ye.log("".concat(this._className,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(S.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(on).getProtocolData({protocolName:Xa});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Ye.warn("".concat(e._className,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new bs(ws.ERROR).setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(Xo).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];Ye.log("".concat(e._className,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(n," networkType:").concat(a)),n?e.reConnect():e._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._previousState=D.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),o}(vn),tc=["a2","tinyid"],oc=["a2","tinyid"],nc=function(){function e(t){n(this,e),this._className="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return s(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),o=this._sessionModule.genCosSpecifiedHead(),n=this._sessionModule.genSSOReportHead(),a=this._sessionModule.isIntl();this._configMap.set(Mn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(yn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(In,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Cn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.STAT_SERVICE,".").concat(H.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(ja,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_COS_SIGN,".").concat(H.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(o)),this._configMap.set($a,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.CUSTOM_UPLOAD,".").concat(H.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(o)),this._configMap.set(za,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.CUSTOM_UPLOAD,".").concat(H.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(o)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_CONFIG_MANAGER,".").concat(H.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_CONFIG_MANAGER,".").concat(H.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_CONFIG_MANAGER,".").concat(H.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_CONFIG_MANAGER,".").concat(H.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OVERLOAD_PUSH,".").concat(H.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(Tn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),a||(this._configMap.set(En,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_MSG_AUDIT_MGR,".").concat(H.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(e))),this._configMap.set(Sn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(Dn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(On,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(_a,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(e)),this._configMap.set(qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(ma,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList"}}}}(e)),this._configMap.set(Gn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(Pn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Un,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(ha,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(fa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(Fn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(Na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_TRANSLATE,".").concat(H.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(Aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(va,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(ya,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(Ma,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(Ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM_MSG_EXT,".").concat(H.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Vn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM_MSG_EXT,".").concat(H.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Pa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM_MSG_EXT,".").concat(H.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ua,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM_MSG_EXT,".").concat(H.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(Bn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Hn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0,clearHistoryMessage:1},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble"}}}}(e)),this._configMap.set(Wn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(e)),this._configMap.set(Yn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set($n,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Jn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Xn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(e)),this._configMap.set(Qn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Zn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.RECENT_CONTACT,".").concat(H.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(e)),this._configMap.set(Nn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.PROFILE,".").concat(H.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(An,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.PROFILE,".").concat(H.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:$e.NICK,value:""},{tag:$e.GENDER,value:""},{tag:$e.ALLOWTYPE,value:""},{tag:$e.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(kn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.FRIEND,".").concat(H.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Rn,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.FRIEND,".").concat(H.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Ln,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.FRIEND,".").concat(H.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0},keyMap:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(ca,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,tc)),{},{servcmd:"".concat(H.NAME.BIG_GROUP_NO_AUTH,".").concat(H.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(da,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(ga,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Ca,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"}}}}(e)),this._configMap.set(Ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.BIG_GROUP_LONG_POLLING,".").concat(H.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(Sa,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,oc)),{},{servcmd:"".concat(H.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(H.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID"}}}}(e)),this._configMap.set(Da,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(ka,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(La,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(Oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(Ga,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_ATTR,".").concat(H.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(ba,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:"",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList"}}}}(e)),this._configMap.set(wa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(e)),this._configMap.set(Fa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_COMMUNITY,".").concat(H.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_COMMUNITY,".").concat(H.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_COMMUNITY,".").concat(H.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_COMMUNITY,".").concat(H.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(e)),this._configMap.set(qa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(xa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_AVCHATROOM,".").concat(H.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(e)),this._configMap.set(Va,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Ba,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set(Ka,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(Ha,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(e)),this._configMap.set(Wa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP,".").concat(H.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(Ya,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.GROUP_AVCHATROOM,".").concat(H.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(e)),this._configMap.set(Ja,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STAT,".").concat(H.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(n)),this._configMap.set(Xa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.HEARTBEAT,".").concat(H.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(Qa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_PUSH,".").concat(H.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence"}}}}(e)),this._configMap.set(Za,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_PUSH,".").concat(H.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.OPEN_IM,".").concat(H.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_LONG_MESSAGE,".").concat(H.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_LONG_MESSAGE,".").concat(H.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(e)),this._configMap.set(vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(H.NAME.IM_OPEN_STATUS,".").concat(H.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Ye.warn("".concat(this._className,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,o=e.requestData,n=this.get(t),a=null;if(o){var s=this._simpleDeepCopy(n),r=this._updateService(o,s),i=r.body,c=Object.create(null);for(var u in i)if(Object.prototype.hasOwnProperty.call(i,u)){if(c[u]=i[u],void 0===o[u])continue;c[u]=o[u]}r.body=c,a=this._getUplinkData(r)}else a=this._getUplinkData(n);return a}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),o=Ht(t.head),n=qi(t.body,this._getRequestKeyMap(o));return t.body=n,t}},{key:"_updateService",value:function(e,t){var o=Ht(t.head);if(this._isFromGroupRequest(t)){var n=e.type,a=e.groupID,s=void 0===a?void 0:a,r=e.groupIDList,i=void 0===r?[]:r;dt(s)&&(s=i[0]||""),Ot({type:n,groupID:s})&&(t.head.servcmd="".concat(H.NAME.GROUP_COMMUNITY,".").concat(o))}return t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(H.NAME.GROUP)||e.head.servcmd.includes(H.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(e){var o=this.getKeyMap(e);return t(t({},bi.request),o.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&ft(n)&&null!==e[n]&&void 0!==e[n]&&("object"!==o(e[n])?t[n]=e[n]:t[n]=this._requestDataCleaner.bind(this)(e[n]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,o=Object.keys(e),n={},a=0,s=o.length;a1e3*a)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:r,requestCount:i});var c=!1;return i>n&&(c=!0),c}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),o=t.overloadTime,n=t.waitingTime,a=!1;return Date.now()-o<=1e3*n?a=!0:(this._serverOverloadInfoMap.delete(e),a=!1),a}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,o=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:o}),Ye.warn("".concat(this._className,".onPushedServerOverload waitingTime:").concat(o,"s"))}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._updateCommandFrequencyLimitMap(rc),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),a}(vn),cc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="MessageLossDetectionModule",a._maybeLostSequencesMap=new Map,a._firstRoundRet=[],a}return s(o,[{key:"onMessageMaybeLost",value:function(e,t,o){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var n=this._maybeLostSequencesMap.get(e),a=0;a=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(Ye.log("".concat(this._className,".fetchConfig canFetchConfig:").concat(t)),t){var o=new bs(ws.FETCH_CLOUD_CONTROL_CONFIG),n=this.getModule($o).getSDKAppID();this._isFetching=!0,this.request({protocolName:as,requestData:{SDKAppID:n,version:this._version}}).then((function(t){e._isFetching=!1,o.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),Ye.log("".concat(e._className,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),Ye.log("".concat(e._className,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){Ye.log("".concat(this._className,".onPushedCloudControlConfig")),new bs(ws.PUSHED_CLOUD_CONTROL_CONFIG).setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,o="".concat(this._className,"._parseCloudControlConfig"),n=e.errorCode,a=e.errorMessage,s=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===n){if(this._version!==r){var c=null;try{c=JSON.parse(s)}catch(u){this.isPrivateNetWork()||Ye.error("".concat(o," JSON parse error. cloudControlConfig:"),s)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=r,this.emitInnerEvent(_r))}this._expiredTime=Date.now()+1e3*i}else dt(n)?(Ye.log("".concat(o," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ye.error("".concat(o," errorCode:").concat(n," errorMessage:").concat(a)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),o}(vn),lc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="RecoverMessageModule",a.PULL_LIMIT_COUNT=15,a}return s(o,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,o=this,n=this._getLocalConversationList().filter((function(e){return e.type===D.CONV_GROUP&&e.groupProfile.type!==D.GRP_AVCHATROOM})),a=this.getModule(jo),s=0,r=0,i=0;n.forEach((function(n){var c=n.conversationID,u=n.lastMessage;t=c.replace(D.CONV_GROUP,""),e=a.getLocalLastMessage(c),u&&0!==u.lastSequence&&e?(r=u.lastSequence,s=e.sequence,i=r-s,s>0&&i>=1&&i<300?o._recoverGroupMessage({groupID:t,localLastMessageSequence:s,remoteLastMessageSequence:r}):o._getGroupNotify(t)):o._getGroupNotify(t)}))}},{key:"_recoverC2CChat",value:function(){var e,t=this,o=this._getLocalConversationList().filter((function(e){return e.type===D.CONV_C2C})),n=this.getModule(jo),a=0,s=0,r=0,i=[Promise.resolve()];o.forEach((function(o){var c=o.conversationID,u=o.lastMessage;e=n.getLocalLastMessage(c),u&&0!==u.lastTime&&e&&(s=u.lastTime,a=e.time,r=s-a,a>0&&r>=1&&r<=600&&i.push(t._recoverC2CMessage({conversationID:c,localLastMessageTime:a,remoteLastMessageTime:s})))})),Promise.all(i).then((function(){Ye.log("".concat(t._className,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),t.getModule(tn).startSyncOnReconnected()}))}},{key:"_getLocalConversationList",value:function(){return this.getModule(jo).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var t=this,o="".concat(this._className,"._recoverGroupMessage");Ye.log("".concat(o," options:"),e);var n=e.groupID,a=e.localLastMessageSequence,s=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:n,sequence:a}).then((function(e){var a=e.data,r=a.complete,i=a.messageList;if(!dt(i)){var c=i[0].sequence;Ye.log("".concat(o," pkgLastMessageSequence:").concat(c," complete:").concat(r)),c=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var o=0;return e.forEach((function(e){o+=e})),Wt(o/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,o=e.min,n=e.max;return t.filter((function(e){return o<=e&&e100&&(o=100),o}},{key:"_checkE2EDelayException",value:function(e,t){var o=e.filter((function(e){return e>t}));if(o.length>0){var n=o.length,a=Math.min.apply(Math,v(o)),s=Math.max.apply(Math,v(o)),r=this._calcAvg(o,n),i=Wt(n/e.length*100,2);if(i>50)new bs(ws.MESSAGE_E2E_DELAY_EXCEPTION).setMessage("message e2e delay exception. count:".concat(n," min:").concat(a," max:").concat(s," avg:").concat(r," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=v(this._e2eDelayArray),o=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),a=this._calcPercent(o,e),s=this._calcPercent(n,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:o,percentOfCountLessThan1Second:a,countLessThan3Second:n,percentOfCountLessThan3Second:s,avgDelay:r}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),pc=function(){function e(){n(this,e),this._className="AvgRTT",this._requestCount=0,this._rttArray=[]}return s(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var o=Wt(e/t*100,2);return o>100&&(o=100),o}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var o=0;return e.forEach((function(e){o+=e})),parseInt(o/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,v(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,v(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=v(this._rttArray);if(0===e)return null;var o=this._calcRTTCount(t),n=this._calcSuccessRateOfRequest(o,e),a=this._calcAvg(t,o);return Ye.log("".concat(this._className,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(a)),this.reset(),{totalCount:e,rttCount:o,successRateOfRequest:n,avgRTT:a}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),gc=function(){function e(){n(this,e),this._map=new Map}return s(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=Wt(t.successCount/t.totalCount*100,2);return o>100&&(o=100),o}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(o=Wt(o,2))>100&&(o=100),o}},{key:"_calcTotalCount",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return dt(e)||!this._map.has(e)?-1:e===As?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var o=0;return this._map.get(e).costArray.forEach((function(e){o+=e})),parseInt(o/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,o=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){o+=e})),parseInt(1e3*o/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var o=this._calcSuccessCountOfBusiness(e),n=this._calcSuccessRateOfBusiness(e),a=this._calcSuccessCountOfPlatform(e),s=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:o,successRateOfBusiness:n,successCountOfPlatform:a,successRateOfPlatform:s,avgValue:r}}},{key:"reset",value:function(e){dt(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),_c=function(){function e(){n(this,e),this._lastMap=new Map,this._currentMap=new Map}return s(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,o=e.message;if(dt(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var n=o.conversationID,a=o.sequence,s=n.replace(D.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(s)){var r=this._lastMap.get(t).get(s),i=r.length-1;a>r[0]&&a100&&(n=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:o,successRateOfMessageReceived:n}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),hc=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[Cs,Ts,Es,Ss,Ds,Ns,As,ks,Rs,Ls],t._messageSentItems=[Es,Ss,Ds,Ns,As],t._messageReceivedItems=[ks,Rs,Ls],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new pc,t._avgE2EDelay=new dc,t._rateMessageSent=new gc,t._rateMessageReceived=new _c;var s=t.getInnerEmitterInstance();return s.on(gr,t._onLoginSuccess,_(t)),s.on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(zo),o=t.getItem(this.TAG,!1);!oo(o)&>(o.forEach)&&(Ye.log("".concat(this._className,"._onLoginSuccess get quality stat logs from local storage, count:").concat(o.length)),o.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),o=this.getCloudConfig("q_rpt_tinyid_wl");dt(e)||(this.REPORT_INTERVAL=Number(e)),dt(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),dt(o)||(this.REPORT_TINYID_WHITELIST=o.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||Ye.warn("".concat(this._className,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||Ye.warn("".concat(this._className,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ye.warn("".concat(this._className,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||Ye.warn("".concat(this._className,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Ye.warn("".concat(this._className,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Ye.warn("".concat(this._className,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var o={},n=Ps[this.getNetworkType()];dt(n)&&(n=8);var a={qualityType:Os[e],timestamp:xe(),networkType:n,extension:""};switch(e){case Cs:o=this._avgRTT.getStatResult();break;case Ts:o=this._avgE2EDelay.getStatResult();break;case Es:case Ss:case Ds:case Ns:case As:o=this._rateMessageSent.getStatResult(e);break;case ks:case Rs:case Ls:o=this._rateMessageReceived.getStatResult(e)}return null===o?null:t(t({},a),o)}},{key:"_report",value:function(e){var t=this,o=[],n=null;dt(e)?this._qualityItems.forEach((function(e){null!==(n=t._getQualityItem(e))&&(n.reportIndex=t.reportIndex,n.wholePeriod=t.wholePeriod,o.push(n))})):null!==(n=this._getQualityItem(e))&&(n.reportIndex=this.reportIndex,n.wholePeriod=this.wholePeriod,o.push(n)),Ye.debug("".concat(this._className,"._report"),o),this._statInfoArr.length>0&&(o=o.concat(this._statInfoArr),this._statInfoArr=[]);var a=this.getModule($o),s=a.getSDKAppID(),r=a.getTinyID();Yt(this.REPORT_SDKAPPID_BLACKLIST,s)&&!jt(this.REPORT_TINYID_WHITELIST,r)&&(o=[]),o.length>0&&this._doReport(o)}},{key:"_doReport",value:function(e){var o=this,n={header:fi(this),quality:e};this.request({protocolName:Ja,requestData:t({},n)}).then((function(){o.reportIndex++,o.wholePeriod=!1})).catch((function(t){Ye.warn("".concat(o._className,"._doReport, online:").concat(o.getNetworkType()," error:"),t),o._statInfoArr=o._statInfoArr.concat(e),o._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(zo),t=e.getItem(this.TAG,!1),o=this._statInfoArr;if(oo(t))Ye.log("".concat(this._className,"._flushAtOnce count:").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>10&&(n=n.slice(0,10)),Ye.log("".concat(this.className,"._flushAtOnce count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),a}(vn),fc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="WorkerTimerModule",a._isWorkerEnabled=!0,a._workerTimer=null,a._init(),a.getInnerEmitterInstance().on(_r,a._onCloudConfigUpdated,_(a)),a}return s(o,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Le}},{key:"startWorkerTimer",value:function(){Ye.log("".concat(this._className,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){Ye.log("".concat(this._className,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Le){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000) } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(){t._moduleManager.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");Ye.log("".concat(this._className,"._onCloudConfigUpdated enableWorker:").concat(e)),dt(e)||"1"===e?!this._isWorkerEnabled&&Le&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._moduleManager.onWorkerTimerEnabled()):this._isWorkerEnabled&&Le&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._moduleManager.onWorkerTimerDisabled())}},{key:"terminate",value:function(){Ye.log("".concat(this._className,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset"))}}]),o}(vn),mc=function(){function e(){n(this,e),this._className="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return s(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){var t="".concat(this._className,".parsePurchaseBits");if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var o=null,n=e.length-1,a=0;n>=0;n--,a++)o=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),"1"===e[n]?this._purchasedFeatureMap.set(o,!0):this._purchasedFeatureMap.set(o,!1)}else Ye.warn("".concat(t," invalid purchase bits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),o=void 0,n=!0,a=t.length-1,s=0;a>=0;a--,s++)if("1"===t.charAt(a)&&(o=s<32?new L(0,Math.pow(2,s)).toString():new L(Math.pow(2,s-32),0).toString(),!this._purchasedFeatureMap.get(o))){n=!1;break}return Ye.log("".concat(this._className,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(n)),ur({enabled:n})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),vc=function(){function e(t){n(this,e),this._moduleManager=t,this._className="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new mc}return s(e,[{key:"_canFetch",value:function(){return this._getModule($o).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),o="".concat(this._className,".fetchConfig");if(Ye.log("".concat(o," canFetch:").concat(t)),t){var n=this._getModule(Xo),a=new bs(ws.FETCH_COMMERCIAL_CONFIG);a.setNetworkType(n.getNetworkType());var s=this._getModule($o).getSDKAppID(),r=this._getModule(on);this._isFetching=!0,r.request({protocolName:rs,requestData:{SDKAppID:s}}).then((function(t){a.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),Ye.log("".concat(o," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){n.probe().then((function(e){var o=m(e,2),n=o[0],s=o[1];a.setError(t,n,s).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._className,".onPushedConfig");Ye.log("".concat(t)),new bs(ws.PUSHED_COMMERCIAL_CONFIG).setNetworkType(this._getModule(Xo).getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._className,"._parseConfig"),o=e.errorCode,n=e.errorMessage,a=e.purchaseBits,s=e.expiredTime;0===o?(this._purchasedFeatureHandler.parsePurchaseBits(a),this._expiredTime=Date.now()+1e3*s):dt(o)?(Ye.log("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ye.error("".concat(t," errorCode:").concat(o," errorMessage:").concat(n)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"_getModule",value:function(e){return this._moduleManager.getModule(e)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),Mc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._moduleManager=e,a._className="OfflinePushModule",a._offlinePushPlugin=void 0,a._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:""},a._deviceToken="",a._businessID=0,a._iosBusinessID=0,a._c2cUnreadCount=0,a._groupUnreadCount=0,a._isWebUniapp=0,a}return s(o,[{key:"registerPlugin",value:function(e){if(ce){this._offlinePushPlugin=e["tim-offline-push-plugin"];var t=e.offlinePushConfig||{},o=t.huaweiBusinessID,n=t.xiaomiBusinessID,a=t.xiaomiAppID,s=t.xiaomiAppKey,r=t.meizuBusinessID,i=t.meizuAppID,c=t.meizuAppKey,u=t.vivoBusinessID,l=t.oppoBusinessID,d=t.oppoAppKey,p=t.oppoAppSecret,g=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=o,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=a,this._androidPushConfig.xiaomiPushAppKey=s,this._androidPushConfig.meizuPushBussinessId=r,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=c,this._androidPushConfig.vivoPushBussinessId=u,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,new bs(ws.REGISTER_PLUGIN).setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!dt(this._offlinePushPlugin))).end(!0),Ye.log("".concat(this._className,".registerPlugin ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=g,this._setAppShowListener()}else this.isIntl()||Ye.warn("!!!离线推送插件仅支持在 uni-app 打包的 native app 环境使用")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,t="".concat(this._className,"._getDeviceToken");if(gt(this._offlinePushPlugin.getDeviceToken)){var o="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);Ye.log("".concat(t," start. ").concat(o)),new bs(ws.GET_DEVICE_TOKEN).setMessage("".concat(o)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(n){var a=new bs(ws.GET_DEVICE_TOKEN_RES),s=n.code,r=n.msg;if(0===s){var i=n.data,c=i.deviceToken,u=i.deviceBrand,l=i.deviceType,d=i.bussinessId;e._deviceToken=c,e._businessID=d||e._iosBusinessID,o="deviceToken:".concat(c,", deviceBrand:").concat(u||l,", businessID:").concat(e._businessID),Ye.log("".concat(t," ok. ").concat(o)),a.setMessage(o).end(!0),e._setToken()}else a.setMessage("code:".concat(s,", msg:").concat(r)).end(!0),Ye.error("".concat(t," failed. error:"),n)}))}else Ye.error("".concat(t," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return ce&&!dt(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._className,"._setAppShowListener");dt(this._offlinePushPlugin)?Ye.error("".concat(t," offlinePushPlugin is undefined")):gt(this._offlinePushPlugin.setAppShowListener)?(new bs(ws.SET_APP_SHOW_LISTENER).end(!0),Ye.log("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(o){var n=(o||{}).appShow;new bs(ws.SET_APP_SHOW_LISTENER_RES).setMessage("appShow:".concat(n)).end(!0),Ye.log("".concat(t," ok. appShow:").concat(n)),e._moduleManager.isReady()&&(0===n?(e._getConvUnreadCount(),e._onBackground()):1===n&&e._onForeground())}))):Ye.error("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!dt(this._offlinePushPlugin)&>(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return Ye.log("".concat(this._className,".getDeviceBrand ok. deviceType:").concat(e)),e}}},{key:"_setToken",value:function(){var e,t=this,o="".concat(this._className,"._setToken"),n=this.getModule($o),a=1,s="",r="";oo(this._deviceToken)&&(a=0);var i=this.getUniAppPlatform(),c=this.getDeviceBrand();i===G.IOS||i===G.IPAD||i===G.MAC?r=this._deviceToken:i===G.ANDROID&&(s=this._deviceToken);var u=new bs(ws.OFFLINE_PUSH_SET_TOKEN);return e="deviceToken:".concat(r||s,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(c,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(a,", platform:").concat(i),u.setMessage("".concat(e)),Ye.log("".concat(o," ").concat(e)),this.request({protocolName:Ms,requestData:{tokenID:s,pushMsg:a,sdkAppID:n.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then((function(e){return u.end(),Ye.log("".concat(o," ok")),e})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),Ye.error("".concat(o," failed. error:"),e),lr(e)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(jo).getLocalConversationList().forEach((function(t){t.type===D.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===D.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._className,"._onBackground"),o=new bs(ws.ON_BACKGROUND);this.request({protocolName:ms,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(n){return o.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),Ye.log("".concat(t," ok")),n})).catch((function(n){e.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()})),Ye.error("".concat(t," failed. error:"),n)}))}},{key:"_onForeground",value:function(){var e=this,t="".concat(this._className,"._onForeground"),o=new bs(ws.ON_FOREGROUND);this.request({protocolName:vs,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return o.end(),Ye.log("".concat(t," ok")),e})).catch((function(n){e.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()})),Ye.error("".concat(t," failed. error:"),n)}))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?G.IOS:"android"===e?G.ANDROID:1002===t?G.IPAD:1001===t?G.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ye.log("".concat(this._className,".reset"))}}]),o}(vn),yc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className="ProfanityFilterModule",a._plugin=null,a._filterConfigMap=new Map,a._startIndex=0,a._version=0,a._canIUseLexicon=!1,a._isFetching=!1,a._expiredTime=0,a}return s(o,[{key:"init",value:function(){var e=this.getModule(en).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:Ye,isArray:lt,isMap:at,isDevMode:this.isDevMode()}),this._getLexicon()):Ye.warn("TIMProfanityFilterPlugin not found! See https://www.npmjs.com/package/tim-profanity-filter-plugin ")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e){var t=!0;if(!this._plugin||!this._canIUseLexicon)return t;var o,n=e.type,a=e.conversationType;if(n!==D.MSG_TEXT&&n!==D.MSG_CUSTOM)return t;if(Ye.log("".concat(this._className,".filterMessage")),n===D.MSG_TEXT){if(a===D.CONV_C2C?o=Y:a===D.CONV_GROUP&&(o=$),!this._isConfigOn(o))return t;var s=this._plugin.filter(e.payload.text),r=s.type,i=s.modifiedText;1===r?t=!1:2===r&&(e.payload.text=i)}else if(n===D.MSG_CUSTOM){if(a===D.CONV_C2C?o=j:a===D.CONV_GROUP&&(o=z),!this._isConfigOn(o))return t;var c=this._plugin.filter(e.payload.data),u=this._plugin.filter(e.payload.description),l=this._plugin.filter(e.payload.extension);1===c.type||1===u.type||1===l.type?t=!1:(2===c.type&&(e.payload.data=c.modifiedText),2===u.type&&(e.payload.description=u.modifiedText),2===l.type&&(e.payload.extension=l.modifiedText))}return Ye.log("".concat(this._className,".filterMessage done. isAllowedToSend:").concat(t)),t}},{key:"filterText",value:function(e,t){var o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;Ye.log("".concat(this._className,".filterText"));var n=this._plugin.filter(e),a=n.type,s=n.modifiedText;return 1===a?o.isAllowedToSend=!1:2===a&&(o.modifiedText=s),Ye.log("".concat(this._className,".filterText done. ret:"),o),o}},{key:"_getLexicon",value:function(){var e=this,t=new bs(ws.PROFANITY_FILTER),o="".concat(this._className,"._getLexicon");this._isFetching=!0,this.request({protocolName:ys,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(n){var a=n.data,s=a.errorInfo,r=a.filterConfig,i=a.lexicon,c=a.strToken,u=a.completeFlag,l=a.nextStartIndex,d=a.version,p=a.expiredTime,g=s.errorCode,_=s.errorMessage;return 0!==g?(e._isFetching=!1,Ye.warn("".concat(o," failed. error:"),s),void t.setCode(g).setMessage(_).end()):(e._onFilterConfig(r),e._getToken(c),1===u?(Ye.log("".concat(e._className,"._getLexicon done. version:").concat(d," expiredTime:").concat(p)),e._version=d,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*p,void e._plugin.onLexiconCompleted(i)):(e._startIndex=l,e._plugin.onLexiconSliced(i),void e._getLexicon()))})).catch((function(n){e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];t.setError(n,a,s).end()})),e._isFetching=!1,Ye.log("".concat(o," failed. error:"),n)}))}},{key:"_onFilterConfig",value:function(e){var t=this;oo(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(o){t._filterConfigMap.set(o,e[o])})),Ye.log("".concat(this._className,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(it(e)){var t=e.length,o="";if(t%2==0)for(var n=0;n<=t-1;n+=2)o+=e[n+1],o+=e[n];else{for(var a=0;a0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){Ye.log("".concat(this._className,"._stopMainThreadSocket"));var e=this._moduleMap.get(nn);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){Ye.log("".concat(this._className,"._startMainThreadSocket"));var e=this._moduleMap.get(nn);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){Ye.log("".concat(this._className,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){Ye.log("".concat(this._className,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=E(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2)[1];o.onCheckTimer&&o.onCheckTimer(this._checkCount)}}catch(n){t.e(n)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(Fo),this._moduleMap.get(jo)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(S.SDK_READY);var t=Date.now()-this._startLoginTs;Ye.warn("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var o=this._moduleMap.get(Xo).getNetworkType(),n=this._ssoLogForReady.getStartTs()+qe;this._ssoLogForReady.setNetworkType(o).setMessage(t).start(n).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Ve(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(Xo).start(),this._ssoLogForReady=new bs(ws.SDK_READY),this._reason=hn.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new Ci,cr(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var o=this;if(e===S.CONVERSATION_LIST_UPDATED||e===S.FRIEND_LIST_UPDATED||e===S.GROUP_LIST_UPDATED||e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var n=Date.now(),a=this._eventThrottleMap.get(e);n-a.last<1e3?(a.timeoutID&&clearTimeout(a.timeoutID),a.timeoutID=setTimeout((function(){a.last=n,o._outerEmitter._emit.apply(o._outerEmitter,[e,{name:e,data:o._getEventData(e)}])}),500)):(a.last=n,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===S.CONVERSATION_LIST_UPDATED?this._moduleMap.get(jo).getLocalConversationList():e===S.FRIEND_LIST_UPDATED?this._moduleMap.get(Ho).getLocalFriendList(!1):e===S.GROUP_LIST_UPDATED?this._moduleMap.get(Ko).getLocalGroupList():e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(jo).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new Ci,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var o;ut(arguments[1])&&arguments[1].data?(Ye.warn("inner eventData has data property, please check!"),o=[e,{name:arguments[0],data:arguments[1].data}]):o=[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,o)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.getModule($o).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);Ye.warn("Oops! ".concat(t)),new bs(ws.ERROR).setMessage(t).setNetworkType(this.getModule(Xo).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(S.ERROR,e)}},{key:"reset",value:function(){Ye.log("".concat(this._className,".reset")),Ve();var e,t=E(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2)[1];o.reset&&o.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(S.SDK_NOT_READY);var n,a=E(this._eventThrottleMap);try{for(a.s();!(n=a.n()).done;){var s=m(n.value,2)[1];s.timeoutID&&clearTimeout(s.timeoutID)}}catch(r){a.e(r)}finally{a.f()}this._eventThrottleMap.clear()}}]),e}(),Tc=function(){function e(t){n(this,e),this._isIntl=t,this._funcMap=new Map}return s(e,[{key:"defense",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var n=null;return this._funcMap.get(e).has(t)?n=this._funcMap.get(e).get(t):(n=this._pack(e,t,o),this._funcMap.get(e).set(t,n)),n}},{key:"defenseOnce",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,o)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(Ye.warn("Callback function for event ".concat(e," cannot be found")),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,o){var n=this;return function(){try{t.apply(o,Array.from(arguments))}catch(i){var a=Object.values(S).indexOf(e);if(-1!==a){var s=Object.keys(S)[a];n._isIntl?Ye.warn("There is a logic error with the corresponding callback function for event TIM.EVENT.".concat(s),"error: ".concat(i)):Ye.warn("接入侧事件 TIM.EVENT.".concat(s," 对应的回调函数逻辑存在问题!"),"error: ".concat(i))}var r=new bs(ws.CALLBACK_FUNCTION_ERROR);r.setMessage("eventName:".concat(e)).setMoreMessage(i.message).end()}}}}]),e}(),Ec=function(){function e(t){n(this,e);var o={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:qt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0};this._moduleManager=new Cc(o),this._safetyCallbackFactory=new Tc(this.isIntl())}return s(e,[{key:"onError",value:function(e){this._moduleManager.onError(e)}},{key:"login",value:function(e){return this._moduleManager.login(),this._moduleManager.getModule(Fo).login(e)}},{key:"logout",value:function(){var e=this;return this._moduleManager.getModule(Fo).logout().then((function(t){return e._moduleManager.reset(),t}))}},{key:"isReady",value:function(){return this._moduleManager.isReady()}},{key:"isIntl",value:function(){return this._moduleManager.isIntl()}},{key:"getNotReadyReason",value:function(){return this._moduleManager.getNotReadyReason()}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._moduleManager.stopTimer(),e._moduleManager.getModule(rn).terminate(),e._moduleManager.getModule(nn).dealloc();var t=e._moduleManager.getOuterEmitterInstance(),o=e._moduleManager.getModule($o);t.emit(S.SDK_DESTROY,{SDKAppID:o.getSDKAppID()})}))}},{key:"on",value:function(e,t,o){e===S.GROUP_SYSTEM_NOTICE_RECEIVED&&Ye.warn("!!!TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知,详细请参考:https://web.sdk.qcloud.com/im/doc/zh-cn/Message.html#.GroupSystemNoticePayload"),Ye.debug("on","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,o),o)}},{key:"once",value:function(e,t,o){Ye.debug("once","eventName:".concat(e)),this._moduleManager.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,o),o||this)}},{key:"off",value:function(e,t,o,n){Ye.debug("off","eventName:".concat(e));var a=this._safetyCallbackFactory.find(e,t);null!==a&&(this._moduleManager.getOuterEmitterInstance().off(e,a,o,n),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){dt(e["tim-offline-push-plugin"])?this._moduleManager.getModule(en).registerPlugin(e):this._moduleManager.getModule(dn).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){if(console.log([""," ________ ______ __ __ __ __ ________ _______","| \\| \\| \\ / \\| \\ _ | \\| \\| \\"," \\$$$$$$$$ \\$$$$$$| $$\\ / $$| $$ / \\ | $$| $$$$$$$$| $$$$$$$\\"," | $$ | $$ | $$$\\ / $$$| $$/ $\\| $$| $$__ | $$__/ $$"," | $$ | $$ | $$$$\\ $$$$| $$ $$$\\ $$| $$ \\ | $$ $$"," | $$ | $$ | $$\\$$ $$ $$| $$ $$\\$$\\$$| $$$$$ | $$$$$$$\\"," | $$ _| $$_ | $$ \\$$$| $$| $$$$ \\$$$$| $$_____ | $$__/ $$"," | $$ | $$ \\| $$ \\$ | $$| $$$ \\$$$| $$ \\| $$ $$"," \\$$ \\$$$$$$ \\$$ \\$$ \\$$ \\$$ \\$$$$$$$$ \\$$$$$$$","",""].join("\n")),this._printDocLink(),!this.isIntl()){console.log(["","参考以下文档,会更快解决问题哦!(#^.^#)\n","IM 智能客服:https://cloud.tencent.com/act/event/smarty-service?from=im-doc\n","WebSocket 升级指引:https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html\n","SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\n","常见问题: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-01-faq.html\n","如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\n"].join("\n"))}}Ye.setLevel(e)}},{key:"_printDocLink",value:function(){var e="https://web.sdk.qcloud.com/im/doc/".concat(this.isIntl()?"en":"zh-cn","/SDK.html");Zt()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",e):console.log("IM SDK API ->",e)}},{key:"createTextMessage",value:function(e){return this._moduleManager.getModule(qo).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._moduleManager.getModule(qo).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._moduleManager.getModule(qo).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._moduleManager.getModule(qo).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._moduleManager.getModule(qo).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._moduleManager.getModule(qo).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._moduleManager.getModule(qo).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._moduleManager.getModule(qo).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._moduleManager.getModule(qo).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._moduleManager.getModule(qo).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==D.MSG_MERGER?lr({code:hn.MESSAGE_MERGER_TYPE_INVALID}):oo(e.payload.downloadKey)?lr({code:hn.MESSAGE_MERGER_KEY_INVALID}):this._moduleManager.getModule(qo).downloadMergerMessage(e).catch((function(e){return lr({code:hn.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._moduleManager.getModule(qo).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Zs?this._moduleManager.getModule(qo).sendMessageInstance(e,t):lr({code:hn.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._moduleManager.getModule(_n).sendMessage(t):"handleGroupInvitation"===e?this._moduleManager.getModule(Ko).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._moduleManager.getModule(ln).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e?this._moduleManager.getModule(gn).sendTRTCCustomData(t):lr({code:hn.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._moduleManager.getModule(qo).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._moduleManager.getModule(qo).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._moduleManager.getModule(qo).deleteMessage(e)}},{key:"translateText",value:function(e){return this._moduleManager.getModule(qo).translateText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._moduleManager.getModule(xo).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._moduleManager.getModule(xo).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._moduleManager.getModule(xo).deleteMessageExtensions(e,t)}},{key:"modifyMessage",value:function(e){return this._moduleManager.getModule(qo).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._moduleManager.getModule(jo).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._moduleManager.getModule(jo).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._moduleManager.getModule(jo).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._moduleManager.getModule(jo).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._moduleManager.getModule(Ko).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._moduleManager.getModule(jo).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._moduleManager.getModule(jo).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._moduleManager.getModule(jo).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._moduleManager.getModule(jo).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._moduleManager.getModule(jo).deleteConversation(e)}},{key:"clearHistoryMessage",value:function(e){return this._moduleManager.getModule(jo).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._moduleManager.getModule(jo).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._moduleManager.getModule(jo).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._moduleManager.getModule(jo).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._moduleManager.getModule(jo).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._moduleManager.getModule(jo).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._moduleManager.getModule(jo).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._moduleManager.getModule(jo).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._moduleManager.getModule(jo).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._moduleManager.getModule(jo).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._moduleManager.getModule(jo).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._moduleManager.getModule(jo).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._moduleManager.getModule(jo).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._moduleManager.getModule(Vo).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._moduleManager.getModule(Vo).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._moduleManager.getModule(Vo).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._moduleManager.getModule(Vo).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._moduleManager.getModule(Vo).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._moduleManager.getModule(Vo).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._moduleManager.getModule(Vo).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._moduleManager.getModule(Vo).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._moduleManager.getModule(Vo).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._moduleManager.getModule(Vo).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.addFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.checkFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.getFriendProfile(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.updateFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendApplicationList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.acceptFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.refuseFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.setFriendApplicationRead():lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendGroupList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.createFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.addToFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.removeFromFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.renameFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._moduleManager.getModule(Ko).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._moduleManager.getModule(Ko).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._moduleManager.getModule(Ko).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._moduleManager.getModule(Ko).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._moduleManager.getModule(Ko).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._moduleManager.getModule(Ko).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._moduleManager.getModule(Ko).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._moduleManager.getModule(Ko).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._moduleManager.getModule(Ko).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._moduleManager.getModule(Ko).changeGroupOwner(e)}},{key:"getGroupApplicationList",value:function(){return this._moduleManager.getModule(Ko).getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){return this._moduleManager.getModule(Ko).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._moduleManager.getModule(Ko).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._moduleManager.getModule(Ko).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._moduleManager.getModule(Ko).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._moduleManager.getModule(Ko).getGroupAttributes(e)}},{key:"setGroupCounters",value:function(e){return this._moduleManager.getModule(Ko).setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._moduleManager.getModule(Ko).increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._moduleManager.getModule(Ko).decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._moduleManager.getModule(Ko).getGroupCounters(e)}},{key:"getGroupMemberList",value:function(e){return this._moduleManager.getModule(Wo).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._moduleManager.getModule(Wo).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._moduleManager.getModule(Wo).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._moduleManager.getModule(Wo).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._moduleManager.getModule(Wo).markGroupMemberList(e)}},{key:"getJoinedCommunityList",value:function(){return this._moduleManager.getModule(Yo).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._moduleManager.getModule(Yo).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._moduleManager.getModule(Yo).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._moduleManager.getModule(Yo).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._moduleManager.getModule(Yo).getTopicList(e)}}]),e}(),Sc={login:"login",logout:"logout",destroy:"destroy",on:"on",off:"off",ready:"ready",setLogLevel:"setLogLevel",joinGroup:"joinGroup",quitGroup:"quitGroup",registerPlugin:"registerPlugin",getGroupOnlineMemberCount:"getGroupOnlineMemberCount"};function Dc(e,t){if(e.isReady()||void 0!==Sc[t])return!0;var o=e.getNotReadyReason(),n=e.isIntl(),a="";Object.getOwnPropertyNames(hn).forEach((function(e){hn[e]===o&&(a=n?mn[o]:fn[o])}));var s={code:o,message:"".concat(a," | ").concat(t," | ").concat(n?mn[hn.SDK_IS_NOT_READY]:fn[hn.SDK_IS_NOT_READY])};return e.onError(s),s}var Nc={},Ac={};return Ac.create=function(e){var o=0,n=e.SDKAppID,a=Qt(n);if(rt(n))o=n;else if(a?Ye.warn("TIM.create The type of the SDKAppID must be Number!"):Ye.warn("TIM.create SDKAppID 的类型应该为 Number,请修改!"),o=parseInt(n),isNaN(n))return a?Ye.error("TIM.create failed. Parse the SDKAppID failed, please check the arguments"):Ye.error("TIM.create failed. 解析 SDKAppID 失败,请检查传参!"),null;if(o&&Nc[o])return Nc[o];Ye.log("TIM.create");var s=new Ec(t(t({},e),{},{SDKAppID:o}));s.on(S.SDK_DESTROY,(function(e){Nc[e.data.SDKAppID]=null,delete Nc[e.data.SDKAppID]}));var r=function(e){var t=Object.create(null);return Object.keys(wo).forEach((function(o){if(e[o]){var n=wo[o],a=new N;t[n]=function(){var t=Array.from(arguments);return a.use((function(t,n){var a=Dc(e,o);return!0===a?n():lr(a)})).use((function(e,t){if(!0===no(e,bo[o],n))return t()})).use((function(t,n){return e[o].apply(e,t)})),a.run(t)}}})),t}(s);return Nc[o]=r,bo.setIsIntl(a),Ye.log("TIM.create ok"),r},Ac.TYPES=D,Ac.EVENT=S,Ac.VERSION="2.26.1",Ye.log("TIM.VERSION:".concat(Ac.VERSION)),Ac})); +__DEFINE__(1710723475375, function(require, module, exports) { +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function f(e){var t=l();return function(){var n,o=u(e);if(t){var s=u(this).constructor;n=Reflect.construct(o,arguments,s)}else n=o.apply(this,arguments);return h(this,n)}}function v(e,t){return M(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,s,a=[],r=!0,i=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);r=!0);}catch(u){i=!0,s=u}finally{try{r||null==n.return||n.return()}finally{if(i)throw s}}return a}(e,t)||I(e,t)||T()}function m(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e){if(Array.isArray(e))return e}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,r=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){i=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(i)throw a}}}}var E={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},S={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},k=function(){function e(){o(this,e),this.cache=[],this.options=null}return a(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return a(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),A={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com"}}},R={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15},N="1.7.3",O=537048168,G="CHINA",U="OVERSEA",P="SINGAPORE",b="KOREA",w="GERMANY",F="IND",q="JPN",x="USA",V={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;this.CURRENT=A.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate"},CMD:{LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_specified",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",MARK_AVCHATROOM_MEMBER_INFO:"modify_user_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_INVITE_JOIN_GROUP:"handle_invite_join_permission_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_GROUP_NOTIFY:"get_group_notify",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"batch_delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",SET_CONVERSATION_CUSTOM_DATA:"mark_contact",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",UPDATE_CONVERSATION_GROUP:"update_contact_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",GET_RPOFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},B={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString(),GRP_COUNTER:new L(0,Math.pow(2,15)).toString()},H="c2c_text_message",K="c2c_custom_message",W="group_text_message",Y="group_custom_message",j="user_profile",z="group_profile",J="group_member_profile";V.HOST.setCurrent(G);var X="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Q="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),Z="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),$="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ee="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),te="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,ne="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,oe="undefined"!=typeof uni,se=X||Q||Z||$||ee||ne||te,ae=("undefined"!=typeof uni||"undefined"!=typeof window)&&!se,re=Q?qq:Z?tt:$?swan:ee?my:X?wx:ne?uni:te?jd:{},ie=ae&&window&&window.navigator&&window.navigator.userAgent||"",ue=/(micromessenger|webbrowser)/i.test(ie),ce=/AppleWebKit\/([\d.]+)/i.exec(ie);ce&&parseFloat(ce.pop());var le,pe,de=(le="WEB",ue?le="WEB":Q?le="QQ_MP":Z?le="TT_MP":$?le="BAIDU_MP":ee?le="ALI_MP":X?le="WX_MP":ne&&(le="UNI_NATIVE_APP"),R[le]),ge=/iPad/i.test(ie),_e=/iPhone/i.test(ie)&&!ge,he=/iPod/i.test(ie),fe=_e||ge||he,ve=(pe=ie.match(/OS (\d+)_/i))&&pe[1]?pe[1]:null,me=/Android/i.test(ie),Me=function(){var e=ie.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}();!function(){var e=ie.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var ye=/MSIE/.test(ie)||ie.indexOf("Trident")>-1&&ie.indexOf("rv:11.0")>-1,Ie=function(){var e=/MSIE\s(\d+)\.\d/.exec(ie),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(ie)&&/rv:11.0/.test(ie)&&(t=11),t}();!function(){var e=ie.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Ce,Te,De=/Windows/i.test(ie),Ee=/MAC OS X/i.test(ie),Se=ae&&"undefined"!=typeof Worker&&!ye,ke=me||fe,Le=ae&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy;Ce="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Ae=function(){},Re=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ne=Re.length;Ne--;)Te=Re[Ne],console[Te]||(Ce[Te]=Ae);var Oe=Ce,Ge=0,Ue=function(){return(new Date).getTime()+Ge},Pe=function(){Ge=0},be=function(){return Math.floor(Ue()/1e3)},we=0;function Fe(){return Ht()?"%c TIM %c":"TIM"}function qe(){var e,t=((e=new Date).setTime(Ue()),e);return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())}var xe={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n=0?o[a]=t[a]:o[a]=e(t[a])):o[a]=void 0:o[a]=null;return o};function It(e,t){if(!st(e)||!st(t))return!1;var n=!1;return t.forEach((function(t){var o=t.key,s=t.value,a=e.find((function(e){return e.key===o}));a?a.value!==s&&(a.value=s,n=!0):(e.push({key:o,value:s}),n=!0)})),n}var Ct=function(e){return e===S.GRP_AVCHATROOM},Tt=function(e){var t=e.type,n=e.groupID;return t===S.GRP_COMMUNITY||"".concat(n).startsWith(ze)&&!"".concat(n).includes(Je)},Dt=function(e){return"".concat(e).startsWith(ze)&&"".concat(e).includes(Je)},Et=function(e){return et(e)&&e.slice(0,3)===S.CONV_C2C},St=function(e){return et(e)&&e.slice(0,5)===S.CONV_GROUP},kt=function(e){return et(e)&&e===S.CONV_SYSTEM};function Lt(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function At(e){return se?new Promise((function(t,n){re.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):ye&&9===Ie?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Rt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Nt(){var e="unknown";if(Ee&&(e="mac"),De&&(e="windows"),fe&&(e="ios"),me&&(e="android"),se)try{var t=re.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function Ot(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.lengtha)return 1;if(s-1?"".concat(n,"&"):"".concat(n,"?");c.url="".concat(l,198===r?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return at(n)?(c.url,g(c,Xe)):c}function Ut(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n=0;o--)"1"===e[o]&&t.push(Math.pow(2,n-o-1));return t}function Ht(){return!ye&&!se}function Kt(e){return"the length of userIDList cannot exceed ".concat(e)}function Wt(e,t){if(e){var n=e;return t&&(e.startsWith("http://")?n=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(n=e.replace(/^https:\/\/[^/]+/,t))),n}}var Yt=Object.prototype.hasOwnProperty;function jt(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(ot(e)){for(var t in e)if(Yt.call(e,t))return!1;return!0}return!(!Qe(e)&&(n=e,"set"!==ct(n))&&!Ze(e))&&0===e.size;var n}function zt(e,t,n){if(void 0===t)return!0;var o=!0;if(ot(t))Object.keys(t).forEach((function(s){var a=1===e.length?e[0][s]:void 0;o=!!Jt(a,t[s],n,s)&&o}));else if(st(t))for(var s=0;s256)||(en({api:"setConversationCustomData",param:"customData",desc:dn("customData",256)}),!1):(en({api:"setConversationCustomData",param:"customData",desc:tn()}),!1)}}},markConversation:{conversationIDList:t({},Cn),markType:{type:"number",validator:function(e){return $e(e)?e<=0?(en({api:"markConversation",param:"markType",desc:(t="markType",n=0,Sn("NumberGreaterThanLog",t,n))}),!1):!(e>=Math.pow(2,64))||(en({api:"markConversation",param:"markType",desc:gn("markType","Math.pow(2,64)")}),!1):(en({api:"markConversation",param:"markType",desc:on()}),!1);var t,n}},enableMark:t({},Dn)},createConversationGroup:{conversationIDList:t({},Cn),groupName:t(t({},In),{},{validator:function(e){return!!e&&(!(e.length>32)||(en({api:"createConversationGroup",param:"groupName",desc:dn("groupName",32)}),!1))}})},deleteConversationGroup:[t({name:"groupName"},In)],renameConversationGroup:{oldName:t({},In),newName:t(t({},In),{},{validator:function(e){return!!e&&(!(e.length>32)||(en({api:"renameConversationGroup",param:"newName",desc:dn("newName",32)}),!1))}})},addConversationsToGroup:{conversationIDList:t({},Cn),groupName:t({},In)},deleteConversationsFromGroup:{conversationIDList:t({},Cn),groupName:t({},In)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:In,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Cn},createGroup:{name:In},joinGroup:{groupID:In,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},In)],handleApplication:{message:Tn,handleAction:In,handleMessage:{type:"String"}},changeGroupOwner:{groupID:In,newOwnerID:In},updateGroupProfile:{groupID:In,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},In)],searchGroupByID:[t({name:"groupID"},In)],initGroupAttributes:{groupID:In,groupAttributes:t(t({},Tn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!et(e[n]))return en({api:"initGroupAttributes",param:"groupAttributes",desc:_n("value")}),t=!1})),t}})},setGroupAttributes:{groupID:In,groupAttributes:t(t({},Tn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!et(e[n]))return en({api:"setGroupAttributes",param:"groupAttributes",desc:_n("value")}),t=!1})),t}})},deleteGroupAttributes:{groupID:In,keyList:{type:"Array",validator:function(e){if(at(e)||!st(e))return en({api:"deleteGroupAttributes",param:"keyList",desc:un()}),!1;if(!jt(e)){var t=!0;return e.forEach((function(e){if(!et(e))return en({api:"deleteGroupAttributes",param:"keyList",desc:Sn("StringArrayRequiredLog")}),t=!1})),t}return!0}}},getGroupAttributes:{groupID:In,keyList:{type:"Array",validator:function(e){if(at(e)||!st(e))return en({api:"getGroupAttributes",param:"keyList",desc:un()}),!1;if(!jt(e)){var t=!0;return e.forEach((function(e){if(!et(e))return en({api:"getGroupAttributes",param:"keyList",desc:_n("key")}),t=!1})),t}return!0}}},setGroupCounters:{groupID:In,counters:Tn},increaseGroupCounter:{groupID:In,key:In,value:En},decreaseGroupCounter:{groupID:In,key:In,value:En},getGroupCounters:{groupID:In},getGroupMemberList:{groupID:In,count:{type:"Number"}},getGroupMemberProfile:{groupID:In,userIDList:Cn,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:In,userIDList:Cn},setGroupMemberRole:{groupID:In,userID:In,role:In},setGroupMemberMuteTime:{groupID:In,userID:In,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:In,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return et(e)?(e.length,!0):(en({api:"setGroupMemberNameCard",param:"nameCard",desc:tn()}),!1)}}},setGroupMemberCustomField:{groupID:In,userID:{type:"String"},memberCustomField:Cn},deleteGroupMember:{groupID:In},markGroupMemberList:{groupID:In,markType:{type:"number",validator:function(e){return $e(e)?!(e<1e3)||(en({api:"markGroupMemberList",param:"markType",desc:(t="markType",n=1e3,Sn("NumberGreaterOrEqualLog",t,n))}),!1):(en({api:"markGroupMemberList",param:"markType",desc:on()}),!1);var t,n}},userIDList:t({},Cn),enableMark:t({},Dn)},createTextMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.text)?0!==e.text.length||(en({api:"createTextMessage",param:"payload.text",desc:fn()}),!1):(en({api:"createTextMessage",param:"payload.text",desc:tn()}),!1):(en({api:"createTextMessage",param:"payload",desc:hn()}),!1)}})},createTextAtMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.text)?0===e.text.length?(en({api:"createTextAtMessage",param:"payload.text",desc:fn()}),!1):!(e.atUserList&&!st(e.atUserList))||(en({api:"createTextAtMessage",param:"payload.atUserList",desc:un()}),!1):(en({api:"createTextAtMessage",param:"payload.text",desc:tn()}),!1):(en({api:"createTextAtMessage",param:"payload",desc:hn()}),!1)}})},createCustomMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?e.data&&!et(e.data)?(en({api:"createCustomMessage",param:"payload.data",desc:tn()}),!1):e.description&&!et(e.description)?(en({api:"createCustomMessage",param:"payload.description",desc:tn()}),!1):!(e.extension&&!et(e.extension))||(en({api:"createCustomMessage",param:"payload.extension",desc:tn()}),!1):(en({api:"createCustomMessage",param:"payload",desc:hn()}),!1)}})},createImageMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:"createImageMessage",param:"payload",desc:hn()}),!1;if(at(e.file))return en({api:"createImageMessage",param:"payload.file",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(en({api:"createImageMessage",param:"payload.file",desc:vn()}),!1):(en({api:"createImageMessage",param:"payload.file",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:"createImageMessage",param:"payload.file",desc:vn()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return at(e)&&en({api:"createImageMessage",param:"onProgress",desc:ln()}),!0}}})},createAudioMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return!!ot(e)||(en({api:"createAudioMessage",param:"payload",desc:hn()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return at(e)&&en({api:"createAudioMessage",param:"onProgress",desc:ln()}),!0}}},createVideoMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:"createVideoMessage",param:"payload",desc:hn()}),!1;if(at(e.file))return en({api:"createVideoMessage",param:"payload.file",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&"undefined"!=typeof uni?!!Ze(e.file.tempFile)||(en({api:"createVideoMessage",param:"payload.file",desc:vn()}),!1):(en({api:"createVideoMessage",param:"payload.file",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:"createVideoMessage",param:"payload.file",desc:vn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return at(e)&&en({api:"createVideoMessage",param:"onProgress",desc:ln()}),!0}}},createFaceMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?$e(e.index)?!!et(e.data)||(en({api:"createFaceMessage",param:"payload.data",desc:tn()}),!1):(en({api:"createFaceMessage",param:"payload.index",desc:on()}),!1):(en({api:"createFaceMessage",param:"payload",desc:hn()}),!1)}})},createFileMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:"createFileMessage",param:"payload",desc:hn()}),!1;if(at(e.file))return en({api:"createFileMessage",param:"payload.file",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(en({api:"createFileMessage",param:"payload.file",desc:vn()}),!1):(en({api:"createFileMessage",param:"payload.file",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:"createFileMessage",param:"payload.file",desc:vn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return at(e)&&en({api:"createFileMessage",param:"onProgress",desc:ln()}),!0}}},createLocationMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.description)?$e(e.longitude)?!!$e(e.latitude)||(en({api:"createLocationMessage",param:"payload.latitude",desc:on()}),!1):(en({api:"createLocationMessage",param:"payload.longitude",desc:on()}),!1):(en({api:"createLocationMessage",param:"payload.description",desc:tn()}),!1):(en({api:"createLocationMessage",param:"payload",desc:hn()}),!1)}})},createMergerMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(jt(e.messageList))return en({api:"createMergerMessage",param:"payload.messageList",desc:cn()}),!1;if(jt(e.compatibleText))return en({api:"createMergerMessage",param:"payload.compatibleText",desc:nn("compatibleText")}),!1;var t=!1;return e.messageList.forEach((function(e){e.status===Qt.FAIL&&(t=!0)})),!t||(en({api:"createMergerMessage",param:"payload.messageList",desc:Sn("MergeFailedMessageLog")}),!1)}})},revokeMessage:[t(t({name:"message"},Tn),{},{validator:function(e){return jt(e)?(en({api:"revokeMessage",param:"message",desc:mn()}),!1):e.conversationType===S.CONV_SYSTEM?(en({api:"revokeMessage",param:"message",desc:Sn("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(en({api:"revokeMessage",param:"message",desc:Sn("MessageRevokedLog")}),!1)}})],deleteMessage:[t(t({name:"messageList"},Cn),{},{validator:function(e){return!jt(e)||(en({api:"deleteMessage",param:"messageList",desc:cn()}),!1)}})],translateText:{sourceTextList:Cn,sourceLanguage:In,targetLanguage:In},modifyMessage:[t(t({name:"message"},Tn),{},{validator:function(e){return jt(e)?(en({api:"modifyMessage",param:"message",desc:mn()}),!1):e.conversationType===S.CONV_SYSTEM?(en({api:"modifyMessage",param:"message",desc:Sn("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(en({api:"modifyMessage",param:"message",desc:Sn("OnlineMessageNotSupportLog")}),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return st(e)?(0===e.length&&en({api:"getUserProfile",param:"userIDList",desc:cn()}),!0):(en({api:"getUserProfile",param:"userIDList",desc:un()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!at(e)||(!!st(e)||(en({api:"updateMyProfile",param:"profileCustomField",desc:un()}),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!et(e)||(en({api:"setSelfStatus",param:"customStatus",desc:tn()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return st(e)?0!==e.length||(en({api:"getUserStatus",param:"userIDList",desc:cn()}),!1):(en({api:"getUserStatus",param:"userIDList",desc:un()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return st(e)?0!==e.length||(en({api:"subscribeUserStatus",param:"userIDList",desc:cn()}),!1):(en({api:"subscribeUserStatus",param:"userIDList",desc:un()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!st(e)||(en({api:"subscribeUserStatus",param:"userIDList",desc:un()}),!1))}}},addFriend:{to:In,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(en({api:"addFriend",param:"source",desc:dn("keyword",8)}),!1):(en({api:"addFriend",param:"source",desc:Sn("SourcePrefixLog")}),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(et(e)&&e.length>96)||(en({api:"addFriend",param:"remark",desc:dn("remark",96)}),!1)}}},deleteFriend:{userIDList:Cn},checkFriend:{userIDList:Cn},getFriendProfile:{userIDList:Cn},updateFriend:{userID:In,remark:{type:"String",required:!1,validator:function(e){return!(et(e)&&e.length>96)||(en({api:"updateFriend",param:"remark",desc:dn("remark",96)}),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!st(e))return en({api:"updateFriend",param:"friendCustomField",desc:un()}),!1;var t=!0;return e.forEach((function(e){return et(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?et(e.value)?e.key.replace("Tag_SNS_Custom_","").length>8?(en({api:"updateFriend",param:"friendCustomField",desc:dn("keyword",8)}),t=!1):void 0:(en({api:"updateFriend",param:"friendCustomField",desc:_n("value")}),t=!1):(en({api:"updateFriend",param:"friendCustomField",desc:Sn("FriendCustomFieldPrefixLog")}),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:In},refuseFriendApplication:{userID:In},deleteFriendApplication:{userID:In},createFriendGroup:{name:In},deleteFriendGroup:{name:In},addToFriendGroup:{name:In,userIDList:Cn},removeFromFriendGroup:{name:In,userIDList:Cn},renameFriendGroup:{oldName:In,newName:In},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return st(e)?0!==e.length||(en({api:"sendMessageReadReceipt",param:"messageList",desc:cn()}),!1):(en({api:"sendMessageReadReceipt",param:"messageList",desc:un()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return st(e)?0!==e.length||(en({api:"getMessageReadReceiptList",param:"messageList",desc:cn()}),!1):(en({api:"getMessageReadReceiptList",param:"messageList",desc:un()}),!1)}}],createTopicInCommunity:{groupID:In,topicName:In},deleteTopicFromCommunity:{groupID:In,topicIDList:{type:"Array",validator:function(e){return!e||(!!st(e)||(en({api:"deleteTopicFromCommunity",param:"topicIDList",desc:un()}),!1))}}},updateTopicProfile:{groupID:In,topicID:In},getTopicList:{groupID:In,topicIDList:{type:"Array",validator:function(e){return!e||(!!st(e)||(en({api:"getTopicList",param:"topicIDList",desc:un()}),!1))}}}},Ln={login:1,logout:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1},An=1,Rn=2,Nn=3,On=4,Gn=6,Un=7,Pn=8,bn=9,wn=10,Fn=11,qn=12,xn=13,Vn=14,Bn=15,Hn=16,Kn=17,Wn=18,Yn=19,jn=20,zn=21,Jn=22,Xn=23,Qn=24,Zn=25,$n=26,eo=27,to=28,no=29,oo=30,so=31,ao=32,ro=function(){function e(t){o(this,e),this._m=t,this._n=""}return a(e,[{key:"isLoggedIn",value:function(){return this._m.getModule(qn).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.getModule(qn).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._m.getModule(qn).isPrivateNetWork()}},{key:"getFileDownloadProxy",value:function(){return this._m.getModule(qn).getFileDownloadProxy()}},{key:"getMyUserID",value:function(){return this._m.getModule(qn).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.getModule(qn).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.getModule(qn).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.getModule(qn).isIntl()}},{key:"isDevMode",value:function(){return this._m.getModule(qn).isDevMode()}},{key:"getModule",value:function(e){return this._m.getModule(e)}},{key:"getPlatform",value:function(){return de}},{key:"getNetworkType",value:function(){return this._m.getModule(Bn).getNetworkType()}},{key:"probeNetwork",value:function(e){return this._m.getModule(Bn).probe(e)}},{key:"getCloudConfig",value:function(e){return this._m.getModule(Xn).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._m.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._m.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._m.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._m.getModule(qn).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!jt(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(E.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return jt(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._m.getModule(jn).request(e)}},{key:"canIUse",value:function(e){return this._m.getModule(eo).canIUse(e)}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&xe.w(o)}}]),e}(),io="wslogin",uo="wslogout",co="wshello",lo="KickOther",po="getmsg",go="authkey",_o="sendmsg",ho="send_group_msg",fo="portrait_get_all",vo="portrait_set",mo="black_list_get",Mo="black_list_add",yo="black_list_delete",Io="msgwithdraw",Co="msgreaded",To="set_c2c_peer_mute_notifications",Do="get_c2c_peer_mute_notifications",Eo="getroammsg",So="get_peer_read_time",ko="delete_c2c_msg_ramble",Lo="modify_c2c_msg",Ao="set_key_values",Ro="get_key_values",No="page_get",Oo="get",Go="batch_delete",Uo="clear_msg",Po="top",bo="deletemsg",wo="set_conv_custom_data",Fo="mark_contact",qo="create_contact_group",xo="del_contact_group",Vo="update_contact_group",Bo="add_conv_to_group",Ho="del_conv_from_group",Ko="get_contact_group",Wo="get_joined_group_list",Yo="get_group_self_member_info",jo="create_group",zo="destroy_group",Jo="modify_group_base_info",Xo="apply_join_group",Qo="apply_join_group_noauth",Zo="quit_group",$o="get_group_public_info",es="change_group_owner",ts="handle_apply_join_group",ns="handle_invite_join_permission_group",os="handle_invite_join_group",ss="group_msg_recall",as="msg_read_report",rs="read_all_unread_msg",is="group_msg_get",us="get_group_msg_receipt",cs="group_msg_receipt",ls="c2c_msg_read_receipt",ps="get_group_msg_receipt_detail",ds="get_pendency",gs="deletemsg",_s="get_msg",hs="get_msg_noauth",fs="get_online_member_num",vs="delete_group_ramble_msg_by_seq",ms="modify_group_msg",Ms="set_group_attr",ys="modify_group_attr",Is="delete_group_attr",Cs="clear_group_attr",Ts="get_group_attr",Ds="group_set_key_values",Es="group_get_key_values",Ss="get_group_notify",ks="update_group_counter",Ls="get_group_counter",As="get_group_member_info",Rs="get_members",Ns="get_specified_group_member_info",Os="add_group_member",Gs="delete_group_member",Us="ban_group_member",Ps="modify_group_member_info",bs="modify_user_info",ws="cos",Fs="pre_sig",qs="video_cover",xs="tim_web_report_v2",Vs="alive",Bs="msg_push",Hs="multi_msg_push_ws",Ks="ws_msg_push_ack",Ws="stat_forceoffline",Ys="save_relay_json_msg",js="get_relay_json_msg",zs="fetch_config",Js="push_configv2",Xs="fetch_imsdk_purchase_bitsv2",Qs="push_imsdk_purchase_bitsv2",Zs="notify2",$s="create_topic",ea="destroy_topic",ta="modify_topic",na="get_topic",oa="ws_set_custom_status",sa="ws_get_user_status",aa="ws_status_subscribe",ra="ws_status_unsubscribe",ia="ws_stat_background",ua="ws_stat_foreground",ca="ws_stat_settoken",la="get_local_words",pa="ws_batch_trans_text",da={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},ga="networkRTT",_a="messageE2EDelay",ha="sendMessageC2C",fa="sendMessageGroup",va="sendMessageGroupAV",ma="sendMessageRichMedia",Ma="cosUpload",ya="messageReceivedGroup",Ia="messageReceivedGroupAVPush",Ca="messageReceivedGroupAVPull",Ta=(r(Xt={},ga,2),r(Xt,_a,3),r(Xt,ha,4),r(Xt,fa,5),r(Xt,va,6),r(Xt,ma,7),r(Xt,ya,8),r(Xt,Ia,9),r(Xt,Ca,10),r(Xt,Ma,11),Xt),Da={info:4,warning:5,error:6},Ea={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Sa={login:4},ka=function(){function e(t){o(this,e),this._n="SSOLogData",this.eventType=Sa[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Ue()}return a(e,[{key:"updateTimeStamp",value:function(){this.timestamp=Ue()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=Ue();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,n){if(!(e instanceof Error))return xe.w("".concat(this._n,".setError value not instanceof Error, please check!")),this;if(this._sentFlag)return this;if(this.setNetworkType(n),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var o=da.NO_NETWORK;this.setCode(o)}return this.setLevel("error"),this}},{key:"setCode",value:function(e){return at(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),$e(e)?this.code=e:xe.w("".concat(this._n,".setCode value not a number, please check!"),e,n(e))),this}},{key:"setMessage",value:function(e){return at(e)||this._sentFlag||($e(e)&&(this.message=e.toString()),et(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return at(e)||this._sentFlag||(this.level=Da[e]),this}},{key:"setMoreMessage",value:function(e){return jt(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(at(e))xe.w("".concat(this._n,".setNetworkType value is undefined, please check!"));else{var t=Ea[e.toLowerCase()];at(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),La=function(){function e(t){o(this,e),this.type=S.MSG_TEXT,this.content={text:t.text||""}}return a(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),Aa=function(){function e(t,n){o(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,se?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=S.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||Ve.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return a(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=_t(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=Wt(t.url||e._imageMemoryURL,e._fileDownloadProxy)},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=at(e)||at(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=Ve[e.toUpperCase()]||Ve.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,s=t.height,a=void 0===s?0:s;0!==o&&0!==a&&(Ut(e),Object.assign(e[2],Gt({originWidth:o,originHeight:a,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),Ra=function(){function e(t){o(this,e),this.type=S.MSG_FACE,this.content=t||null}return a(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Na=function(){function e(t,n){o(this,e),this.type=S.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:Wt(t.url,n),remoteAudioUrl:t.url||"",uuid:t.uuid}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),Oa={from:!0,groupID:!0,groupName:!0,to:!0},Ga=function(){function e(t){o(this,e),this.type=S.MSG_GRP_TIP,this.content={},this._initContent(t)}return a(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),wa=function(){function e(t){o(this,e),this.type=S.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return a(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),Fa=function(){function e(t,n){o(this,e),this.type=S.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:Wt(t.videoUrl,n),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:Wt(t.thumbUrl,n),snapshotUrl:Wt(t.thumbUrl,n)}}return a(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;jt(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),jt(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),jt(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),qa=function(){function e(t){o(this,e),this.type=S.MSG_LOCATION;var n=t.description,s=t.longitude,a=t.latitude;this.content={description:n,longitude:s,latitude:a}}return a(e,[{key:"sendable",value:function(){return!0}}]),e}(),xa=function(){function e(t,n){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(S.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(S.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var s=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(s,a),this._updateRichMediaDownloadUrl(s,a,n),s===S.MSG_MERGER?this.messageBody.push({type:s,payload:new Va(a).content}):this.messageBody.push({type:s,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return a(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===S.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===S.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===S.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n){n&&(e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.url=Wt(e.url,n)})):e===S.MSG_VIDEO?(t.videoUrl=Wt(t.videoUrl,n),t.snapshotUrl=Wt(t.thumbUrl,n),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===S.MSG_AUDIO?t.url=Wt(t.url,n):e===S.MSG_FILE&&(t.fileUrl=Wt(t.fileUrl,n)))}}]),e}(),Va=function(){function e(t,n){if(o(this,e),this.type=S.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var s=t.downloadKey,a=t.pbDownloadKey,r=t.title,i=t.abstractList,u=t.compatibleText,c=t.version;this.content.downloadKey=s,this.content.pbDownloadKey=a,this.content.title=r,this.content.abstractList=i,this.content.compatibleText=u,this.content.version=c||0}else if(jt(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var l=t.messageList,p=t.title,d=t.abstractList,g=t.compatibleText,_=t.version,h=[];l.forEach((function(e){if(!jt(e)){var t=new xa(e,n);h.push(t)}})),this.content.messageList=h,this.content.title=p,this.content.abstractList=d,this.content.compatibleText=g,this.content.version=_||0}}return a(e,[{key:"sendable",value:function(){return!jt(this.content.messageList)||!jt(this.content.downloadKey)}}]),e}(),Ba={1:S.MSG_PRIORITY_HIGH,2:S.MSG_PRIORITY_NORMAL,3:S.MSG_PRIORITY_LOW,4:S.MSG_PRIORITY_LOWEST},Ha=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||S.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:_t(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||Qt.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||be()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return a(e,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){et(e.nick)&&(this.nick=e.nick),et(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ot(t)&&et(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==S.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(S.MSG_AT_ALL))})),st(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(S.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?Qt.SUCCESS:Qt.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===S.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return!1;if(void 0===mt[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),s="0".concat(t.getSeconds()).slice(-2);mt[e]=parseInt([n,o,s,"0001"].join("")),n=null,o=null,s=null,xe.l("autoIncrementIndex start index:".concat(mt[e]))}return mt[e]++}(e)),0===this.sequence&&this.conversationType===S.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===S.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n="",o=this.conversationType;o!==S.CONV_SYSTEM?(n=o===S.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=n?"".concat(o).concat(n):null):this.conversationID=S.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof La||e instanceof Aa||e instanceof Ra||e instanceof Na||e instanceof ba||e instanceof Fa||e instanceof Ga||e instanceof Pa||e instanceof wa||e instanceof qa||e instanceof Va}},{key:"setElement",value:function(e,t){var n=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case S.MSG_TEXT:n.setTextElement(e.content);break;case S.MSG_IMAGE:n.setImageElement(e.content,t);break;case S.MSG_AUDIO:n.setAudioElement(e.content,t);break;case S.MSG_FILE:n.setFileElement(e.content,t);break;case S.MSG_VIDEO:n.setVideoElement(e.content,t);break;case S.MSG_CUSTOM:n.setCustomElement(e.content);break;case S.MSG_LOCATION:n.setLocationElement(e.content);break;case S.MSG_GRP_TIP:n.setGroupTipElement(e.content);break;case S.MSG_GRP_SYS_NOTICE:n.setGroupSystemNoticeElement(e.content);break;case S.MSG_FACE:n.setFaceElement(e.content);break;case S.MSG_MERGER:n.setMergerElement(e.content,t)}};if(st(e))for(var s=0;s1&&void 0!==arguments[1]&&arguments[1];if(e instanceof Wa)return t&&null!==Ya&&Ya.emit(E.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new Wa({code:da.UNCAUGHT_ERROR});return t&&null!==Ya&&Ya.emit(E.ERROR,n),Promise.reject(n)}if(!at(e)&&!at(e.code)){var o=new Wa(e);return t&&null!==Ya&&Ya.emit(E.ERROR,o),Promise.reject(o)}},Xa=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="C2CModule",t._messageFromUnreadDBMap=new Map,t._signalingFromUnreadDBList=[],t}return a(s,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,s=e.C2CPairUnreadList;xe.d("".concat(this._n,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var a=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:s,isInstantMessage:n}),r=a.conversationOptionsList,i=a.messageList,u=a.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(Fn).onNewMessage({conversationOptionsList:r,isInstantMessage:n,isUnreadC2CMessage:u});var c=this.filterUnmodifiedMessage(i);n&&c.length>0&&this.emitOuterEvent(E.MESSAGE_RECEIVED,c),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=e.isInstantMessage,a=null,r=[],i=[],u={},c=this.getModule(Hn),l=this.getModule($n),p=!1,d=this.getModule(Fn),g=this.getFileDownloadProxy(),_=0,h=t.length;_0&&l.addMessageDelay(a.clientTime)}else this._messageFromUnreadDBMap.set(a.ID,1);if(0!==f.msgLifeTime){if(!1===a._onlineOnlyFlag){var k=d.getLastMessageTime(v);if($e(k)&&a.time0){R=!0;var n=r.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:r.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:S.CONV_C2C})}},O=0,G=o.length;O0&&(o=e.cloudCustomData);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:_o,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==c?s:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_isVoipPush",value:function(e){var t=void 0;return at(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:Io,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;return xe.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:ko,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,s=void 0===o?0:o,a=e.sequence,r=e.random,i=e.time,u=e.payload,c=e.type,l=e.cloudCustomData,p=void 0;return Vt(c)&&(p=[]).push({type:c,content:u}),this.request({protocolName:Lo,requestData:{from:t,to:n,version:s,sequence:a,random:r,time:i,elements:p,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,s="".concat(this._n,".setMessageRead");xe.l("".concat(s," conversationID:").concat(n," lastMessageTime:").concat(o)),$e(o)||this.outputWarning("DoNotModifyLastTime");var a=new ka("setC2CMessageRead");return a.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:Co,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){a.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(s," ok"));var e=t.getModule(Fn);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),Ka()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.l("".concat(s," failed. error:"),e),Ja(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.peerAccount,s=e.conversationID,a=e.count,r=e.lastMessageTime,i=e.messageKey,u="peerAccount:".concat(o," count:").concat(a||15," lastMessageTime:").concat(r||0," messageKey:").concat(i);xe.l("".concat(n," ").concat(u));var c=new ka("getC2CRoamingMessages");return this.request({protocolName:Eo,requestData:{peerAccount:o,count:a||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var o=e.data,a=o.complete,r=o.messageList,i=o.messageKey,l=o.lastMessageTime;at(r)?xe.l("".concat(n," ok. complete:").concat(a," but messageList is undefined!")):xe.l("".concat(n," ok. complete:").concat(a," count:").concat(r.length)),c.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(a," length:").concat(r.length)).end();var p=t.getModule(Fn);1===a&&p.setCompleted(s);var d=p.onRoamingMessage(r,s);p.modifyMessageList(s),p.updateIsRead(s),p.updateRoamingMessageKeyAndTime(s,i,l);var g=p.getPeerReadTime(s);if(xe.l("".concat(n," update isPeerRead property. conversationID:").concat(s," peerReadTime:").concat(g)),g)p.updateMessageIsPeerReadProperty(s,g);else{var _=s.replace(S.CONV_C2C,"");t.getRemotePeerReadTime([_]).then((function(){p.updateMessageIsPeerReadProperty(s,p.getPeerReadTime(s))}))}var h="";if(d.length>0)h=d[0].ID;else{var f=p.getLocalOldestMessage(s);f&&(h=f.ID)}return xe.l("".concat(n," nextReqID:").concat(h," stored message count:").concat(d.length)),{nextReqID:h,storedMessageList:d}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setMessage(u).setError(e,o,s).end()})),xe.w("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=e.peerAccount,s=e.time,a=void 0===s?0:s,r=e.count,i=e.direction,u="".concat(S.CONV_C2C).concat(o),c="peerAccount:".concat(o," count:").concat(r," time:").concat(a," direction:").concat(i);xe.l("".concat(n," ").concat(c));var l=new ka("getC2CRoamingMessagesHopping");return this.request({protocolName:Eo,requestData:{peerAccount:o,count:r+1,lastMessageTime:a,direction:i}}).then((function(e){var o=e.data,s=o.complete,a=o.messageList,r=void 0===a?[]:a,p=o.lastMessageTime;xe.l("".concat(n," ok. complete:").concat(s," count:").concat(r.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(s," length:").concat(r.length)).end(),1!==s&&(1===i?r.pop():r.shift());var d=t.getModule(Fn).onRoamingMessage(r,u,!1);t._modifyMessageList(u,d);var g=t._computeResult({complete:s,lastMessageTime:p,resultList:d});return Ka(g)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setMessage(c).setError(e,o,s).end()})),xe.w("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,s=e.resultList,a={messageList:m(void 0===s?[]:s),isCompleted:!1,nextMessageTime:""};return 1===n?(a.isCompleted=!0,a):(a.nextMessageTime=o,a)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(Fn).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,s=n.userProfile.avatar,a=this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID()),r=a.nick,i=a.avatar,u=t.length-1;u>=0;u--){var c=t[u];"in"===c.flow&&(c.nick!==o&&c.setNickAndAvatar({nick:o}),c.avatar!==s&&c.setNickAndAvatar({avatar:s})),"out"===c.flow&&(c.nick!==r&&c.setNickAndAvatar({nick:r}),c.avatar!==i&&c.setNickAndAvatar({avatar:i}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._n,".getRemotePeerReadTime");if(jt(e))return xe.w("".concat(n," userIDList is empty!")),Promise.resolve();var o=new ka("getPeerReadTime");return xe.l("".concat(n," userIDList:").concat(e)),this.request({protocolName:So,requestData:{userIDList:e}}).then((function(s){var a=s.data.peerReadTimeList;xe.l("".concat(n," ok. peerReadTimeList:").concat(a));for(var r="",i=t.getModule(Fn),u=0;u0&&i.recordPeerReadTime("C2C".concat(e[u]),a[u]);o.setNetworkType(t.getNetworkType()).setMessage(r).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.w("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(S.CONV_C2C,""),o=new ka("sendC2CReadReceipt");o.setMessage("peerAccount:".concat(n));var s=this.getMyUserID(),a=e.filter((function(e){return e.from!==s&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===a.length)return Ja({code:da.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r="".concat(this._n,".sendReadReceipt");return xe.l("".concat(r,". peerAccount:").concat(n," messageInfoList length:").concat(a.length)),this.request({protocolName:ls,requestData:{peerAccount:n,messageInfoList:a}}).then((function(e){return o.end(),xe.l("".concat(r," ok")),Ka()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.w("".concat(r," failed. error:"),e),Ja(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._n,".getReadReceiptList"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return xe.l("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),za({messageList:o})}},{key:"getMessageExtensions",value:function(e,t){return xe.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Ro,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return xe.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Ao,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:t,operateType:n}})}},{key:"_getMessageKey",value:function(e){var t=e.clientSequence,n=e.random,o=e.time;return"".concat(t,"_").concat(n,"_").concat(o)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._messageFromUnreadDBMap.clear(),this._signalingFromUnreadDBList.length=0}}]),s}(ro),Qa=function(){function e(){o(this,e),this.list=new Map,this._n="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return a(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var s=this._getUniqueIDOfMessage(e),a=this.list.get(n).has(s);if(a){var r=this.list.get(n).get(s);if(!t||!0===r.isModified)return o=!1}return this.list.get(n).set(s,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(st(e)?e.length>0&&(n=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(n=e.conversationID,this._unshiftSingleMessage(e,t)),n&&n.startsWith(S.CONV_C2C)){var o=Array.from(this.list.get(n).values()),s=o.length;if(0===s)return;for(var a=s-1;a>=0;a--)if("out"===o[a].flow){this._setLatestMessageSentByMe(n,o[a]);break}for(var r=s-1;r>=0;r--)if("in"===o[r].flow){this._setLatestMessageSentByPeer(n,o[r]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var s=this.list.get(n),a=Array.from(s);s.has(o)||(a.unshift([o,e]),this.list.set(n,new Map(a)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],s=e[0].conversationID,a=this.list.get(s),r=this.list.has(s)?Array.from(a):[],i=0;i=0;l--)"in"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));xe.l("".concat(this._n,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(u))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,s=this.list.get(t);if(!jt(s)){var a=Array.from(s.values()),r=a.length;if(0!==r){for(var i=null,u=0,c=!1,l=r-1;l>=0;l--)"out"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));xe.l("".concat(this._n,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(u))}}}},{key:"getTopicConversationIDList",value:function(e){return m(this.list.keys()).filter((function(t){return t.startsWith("".concat(S.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===xe.getLevel()){console.group("conversationID-messageCount");var e,t=D(this.list);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];console.log("".concat(o,"-").concat(s.size))}}catch(a){t.e(a)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(xe.d("".concat(this._n,".onMessageModified conversationID:").concat(e," uniqueID:").concat(n," has:").concat(o)),o){var s=this.list.get(e).get(n),a=t.messageVersion,r=t.elements,i=t.cloudCustomData;return s.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var nr=["jpg","jpeg","gif","png","bmp","image","webp"],or=["mp4","quicktime","mov"],sr=1,ar=2,rr=3,ir=255,ur=function(){function e(t){var n=this;o(this,e),jt(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||S.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||S.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],jt(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return a(e,[{key:"validate",value:function(e){var t=!0,n="";if(jt(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(gt(e[r])," bytes"),t=!1);break;case"gender":vt(He,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":$e(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":et(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":et(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":vt(We,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":$e(e.language)||(n="language must be a number",t=!1);break;case"avatar":et(e.avatar)||(n="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":vt(Ke,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":$e(e.level)||(n="level must be a number",t=!1);break;case"role":$e(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+r+" "+e[r],t=!1}}return{valid:t,tips:n}}}]),e}(),cr=a((function e(t){o(this,e),this.value=t,this.next=null})),lr=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return a(e,[{key:"set",value:function(e){var t=new cr(e);if(this.map.size0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&pt(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};pt(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),gr=function(e,n){return at(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:e instanceof Ha?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:xt(e.type,e.payload,n),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:xt(e.type,e.payload,n)})},_r=function(){function e(t,n){o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=gr(t.lastMessage,n),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return a(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(S.CONV_C2C)?this.conversationID.replace(S.CONV_C2C,""):this.conversationID.startsWith(S.CONV_GROUP)?this.conversationID.replace(S.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),at(this.userProfile)&&this.type===S.CONV_C2C?this.userProfile=new ur({userID:e.conversationID.replace("C2C","")}):at(this.groupProfile)&&this.type===S.CONV_GROUP&&(this.groupProfile=new dr({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;at(t)||(Ct(this.subType)?this.unreadCount=0:n&&this.type===S.CONV_GROUP||n&&this.type===S.CONV_TOPIC||o&&this.type===S.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=gr(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==n.indexOf(S.CONV_AT_ME)&&-1!==n.indexOf(S.CONV_AT_ALL)&&(n=[S.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!Tt({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(S.CONV_AT_ME)>-1&&e.groupAtType.indexOf(S.CONV_AT_ALL)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(S.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(S.CONV_AT_ME)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,n=e.time;return this.type===S.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===S.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),hr=function(){function e(t){o(this,e),this._conversationModule=t,this._n="MessageRemindHandler",this._updateSequence=0}return a(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._n,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:Do,updateSequence:this._updateSequence}).then((function(n){xe.l("".concat(t," ok"));var o=n.data,s=o.updateSequence,a=o.muteFlagList;e._updateSequence=s,e._patchC2CMessageRemindType(a)})).catch((function(e){xe.e("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,n=0,o="";st(e)&&e.length>0&&e.forEach((function(e){var s=e.userID,a=e.muteFlag;0===a?o=S.MSG_REMIND_ACPT_AND_NOTE:1===a?o=S.MSG_REMIND_DISCARD:2===a&&(o=S.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:s,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),xe.l("".concat(this._n,"._patchC2CMessageRemindType count:").concat(n))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):st(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setGroupMessageRemindType"),o=e.groupID,s=e.messageRemindType,a="groupID:".concat(o," messageRemindType:").concat(s),r=new ka("setMessageRemindType");return r.setMessage(a),this._getModule(bn).modifyGroupMemberInfo({groupID:o,messageRemindType:s,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok. ").concat(a));var o=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),Ka(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(Un).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),Dt(t)){var s=t,a=qt(s),r=this._getModule(wn).getLocalTopic(a,s);return r&&(r.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:a,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setC2CMessageRemindType"),o=e.userIDList,s=e.messageRemindType,a=o.slice(0,30),r=0;s===S.MSG_REMIND_DISCARD?r=1:s===S.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i="userIDList:".concat(a," messageRemindType:").concat(s),u=new ka("setMessageRemindType");return u.setMessage(i),this._conversationModule.request({protocolName:To,requestData:{userIDList:a,muteFlag:r}}).then((function(e){u.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,r=o.updateSequence,i=o.errorList;t._updateSequence=r;var c=[],l=[];st(i)&&i.forEach((function(e){c.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var p=a.filter((function(e){return-1===c.indexOf(e)}));xe.l("".concat(n," ok. successUserIDList:").concat(p," failureUserIDList:").concat(JSON.stringify(l)));var d=0;return p.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:s})&&(d+=1)})),d>=1&&t._emitConversationUpdate(),a.length=c.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),za({successUserIDList:p.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._updateSequence=0}}]),e}(),fr=function(){function e(t){o(this,e),this._conversationModule=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Zt.NOT_START}return a(e,[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),o=e.conversationIDList,s=e.customData;xe.l("".concat(n," options:"),e);var a=new ka("setConvCustomData");a.setMessage(JSON.stringify(e));var r={fromAccount:this._getMyUserID(),itemList:[]},i=[],u=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(u,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(u,e),!0;var n={operationType:2,contactItem:void 0,customMark:s};Et(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,"")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,"")}),r.itemList.push(n)})),u.length===o.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:wo,requestData:r}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var o=e.data.resultItem;if(st(o)){var r,c,l=!1;o.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(r),(c=t._getLocalConversation(r))&&c.customData!==s&&(c.customData=s,l=!0)):u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"markConversation",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_MARK))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("markConversation"),o=e.conversationIDList,s=e.markType,a=e.enableMark;xe.l("".concat(n," options:"),e);var r=new ka("markConversation");r.setMessage(JSON.stringify(e));var i=void 0,u=void 0,c=this._getFlagBit(s);!0===a?u=[c]:i=[c];var l={fromAccount:this._getMyUserID(),itemList:[]},p=[],d=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(d,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(d,e),!0;var n={operationType:1,contactItem:void 0,clearMark:i,setMark:u};Et(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,"")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,"")}),l.itemList.push(n)})),d.length===o.length?za({successConversationIDList:p,failureConversationIDList:d}):this._conversationModule.request({protocolName:Fo,requestData:l}).then((function(e){r.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var o=e.data.resultItem;if(st(o)){var i,u,c=!1;o.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(p.push(i),u=t._getLocalConversation(i)){var n=u.markList.indexOf(s);!0===a?-1===n&&(u.markList.push(s),c=!0):-1!==n&&(u.markList.splice(n,1),c=!0)}}else d.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===c&&t._emitConversationUpdate()}return Ka({successConversationIDList:p,failureConversationIDList:d})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getLocalConvGroupList",value:function(){var e=this;return xe.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===Zt.REJECTED?this.getRemoteConvGroupList().then((function(){return Ka(m(e._convGroupMap.values()))})):za(m(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=Zt.PENDING,this._conversationModule.request({protocolName:Ko,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:be()}}).then((function(n){var o,s,a=n.data,r=a.completeFlag,i=a.contactItem,u=a.nextStartIndex,c=void 0===u?0:u,l=a.groupItem;(e._startIndex=c,xe.l("".concat(t," completeFlag:").concat(r," nextStartIndex:").concat(c)),st(l)&&l.forEach((function(t){var n=t.convGroupID,o=t.groupName;e._convGroupMap.set(n,o)})),st(i))&&i.forEach((function(t){var n=t.standardMark,a=t.customData,r=t.convGroupIDList;if(o=e._concatConversationID(t),(s=e._getLocalConversation(o))&&(s.markList=Bt(n),s.customData=a||"",st(r))){var i=[];r.forEach((function(t){e._convGroupMap.has(t)&&i.push(e._convGroupMap.get(t))})),s.conversationGroupList=[].concat(i),i.length=0}}));if(0===r)return e.getRemoteConvGroupList();1===r&&(e._pagingStatus=Zt.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=Zt.REJECTED,xe.w("".concat(t," failed. error:"),n)}))}},{key:"createConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("createConvGroup");xe.l("".concat(n," options:"),e);var o=new ka("createConvGroup");o.setMessage(JSON.stringify(e));var s=e.groupName,a=e.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:s,contactItem:[]}]},i=[],u=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(S.CONV_C2C,"")}):St(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(S.CONV_GROUP,"")})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===a.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:qo,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var a=e.data.groupResultItem[0],r=a.groupItem,c=a.resultItem;if(ot(r)&&(t._convGroupMap.set(r.convGroupID,r.groupName),t._emitConvGroupListUpdate()),st(c)){var l,p,d=!1;c.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(l),(p=t._getLocalConversation(l))&&-1===p.conversationGroupList.indexOf(s)&&(p.conversationGroupList.push(s),d=!0)):u.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===d&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"deleteConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvGroup");xe.l("".concat(n," groupName:").concat(e));var o=new ka("deleteConvGroup");return o.setMessage(e),this._conversationModule.request({protocolName:xo,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(s){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var a=s.data.groupItem;if(st(a)){var r=!1;a.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),r=!0)})),!0===r&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"renameConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("renameConvGroup");xe.l("".concat(n," options:"),e);var o=new ka("renameConvGroup");o.setMessage(JSON.stringify(e));var s=e.oldName,a=e.newName;return this._conversationModule.request({protocolName:Vo,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:s,newName:a}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var r=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(r,a),t._emitConvGroupListUpdate();var i,u,c=t._conversationModule.getLocalConversationList(),l=!1;c.forEach((function(e){i=e.conversationGroupList,-1!==(u=i.indexOf(s))&&(i.splice(u,1,a),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"addConvsToGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("addConvsToGroup");xe.l("".concat(n," options:"),e);var o=new ka("addConvsToGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,"")}}):St(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:Bo,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(st(s)){var r,c,l=!1;s.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(c=t._getLocalConversation(r))&&-1===c.conversationGroupList.indexOf(a)&&(c.conversationGroupList.push(a),i.push(r),l=!0):u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"deleteConvsFromGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvsFromGroup");xe.l("".concat(n," options:"),e);var o=new ka("deleteConvsFromGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,"")}}):St(e)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:Ho,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(st(s)){var r,c,l=!1;s.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(c=t._getLocalConversation(r)){var n=c.conversationGroupList.indexOf(a);-1!==n&&(c.conversationGroupList.splice(n,1),i.push(r),l=!0)}}else u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"onConvMarkUpdated",value:function(e){var t=this;if(!jt(e)){var n,o;xe.d("".concat(this._n,".onConvMarkUpdated markItemList:"),e);var s=!1;e.forEach((function(e){var a=e.recentContactItem,r=e.optType,i=e.standardMark,u=e.customMark;if(n=t._concatConversationID(a),o=t._getLocalConversation(n))if(1===r){var c=Bt(i);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n=0;o--)if("1"===t[o])return n-o-1}},{key:"_concatConversationID",value:function(e){var t,n=e.type,o=e.to,s=e.groupID,a=e.userID;return 1===n?at(a)?at(o)||(t="".concat(S.CONV_C2C).concat(o)):t="".concat(S.CONV_C2C).concat(a):2===n&&(t="".concat(S.CONV_GROUP).concat(s)),t}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(e,t){var n=this._getLocalConversation(e);if(n){var o=n.conversationGroupList;-1===o.indexOf(t)&&o.push(t)}}},{key:"_getLocalConversation",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:"_hasLocalConversation",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(E.CONVERSATION_GROUP_LIST_UPDATED,m(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},n=this._conversationModule.getLocalConversationList();t.conversationList=n.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(E.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Zt.NOT_START}}]),e}(),vr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="ConversationModule",tr.mixin(_(t)),t._messageListHandler=new Qa,t._messageRemindHandler=new hr(_(t)),t._convGroupHandler=new fr(_(t)),t.singlyLinkedList=new lr(100),t._pagingStatus=Zt.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._pagingConvIDMap=new Map,t._convIDFromUnreadDBMap=new Map,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._pagingGetCostList=[],t._initListeners(),t}return a(s,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(Za,this._initLocalConversationList,this),e.on(er,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new ka("_initLocalConversationList");xe.l("".concat(this._n,".").concat("_initLocalConversationList"));var n="",o=this._getStorageConversationList(),s=this.isIntl();if(o){for(var a=o.length,r=0;r0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,s=void 0===o||o,a=e.isUnreadC2CMessage,r=void 0!==a&&a,i=e.updateUnreadCount,u=void 0===i||i;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:s,isUnreadC2CMessage:r,isFromGetConversations:!1,updateUnreadCount:u}),s||(this._convIDFromUnreadDBMap=new Map([].concat(m(this._convIDFromUnreadDBMap),m(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConversation()),this._setStorageConversationList(),n.filter((function(e){return e.type===S.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!st(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var s=t._conversationMap.get(o);s.groupProfile=JSON.parse(JSON.stringify(e)),s.lastMessage.lastSequence=0;r--)if(!s[r].isDeleted){a=s[r];break}var i=this._conversationMap.get(o);if(i){var u=!1;i.lastMessage.lastSequence===a.sequence&&i.lastMessage.lastTime===a.time||(jt(a)&&(a=void 0),i.updateLastMessage(a),i.type!==S.CONV_TOPIC&&(u=!0),xe.l("".concat(this._n,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),i.lastMessage)),o.startsWith(S.CONV_C2C)&&this.updateUnreadCount(o),u&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,n=e.from,o=e.to,s=e.time,a=e.sequence,r=e.elements,i=e.cloudCustomData,u=e.messageVersion,c=this.getMyUserID(),l="".concat(t).concat(o);o===c&&t===S.CONV_C2C&&(l="".concat(t).concat(n));var p=this._messageListHandler.onMessageModified(l,e),d=p.isUpdated,g=p.message;!0===d&&this.emitOuterEvent(E.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(xe.l("".concat(this._n,".onMessageModified isUpdated:").concat(d," isTopicMessage:").concat(_," from:").concat(n," to:").concat(o)),_){this.getModule(wn).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;xe.d("".concat(this._n.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===s&&f.lastSequence===a&&f.version!==u&&(f.type=r[0].type,f.payload=r[0].content,f.messageForShow=xt(f.type,f.payload,this.isIntl()),f.cloudCustomData=i,f.version=u,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,s=null;o.forEach((function(e){e.groupAtTips?s=e.groupAtTips:e.elements?s=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(s=t(t({},e),{},{sync:!0})),s.__random=e.random,s.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(s)})),xe.d("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,s=n.from,a=n.topicID,r=void 0===a?void 0:a,i=n.sync,u=void 0!==i&&i;if(s!==e.getMyUserID())if(at(r)){var c=e._conversationMap.get("".concat(S.CONV_GROUP).concat(o));c&&(c.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(S.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(n);var p=e.getModule(wn),d=l.groupAtInfoList;p.onConversationProxy({topicID:r,groupAtInfoList:d})}if(jt(l)&&u)e.updateTopicConversation([{conversationID:"".concat(S.CONV_GROUP).concat(r),type:S.CONV_TOPIC}]),e._conversationMap.get("".concat(S.CONV_GROUP).concat(r)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==S.CONV_C2C||n.push(e.conversationID.replace(S.CONV_C2C,""))})),n.length>0){xe.d("".concat(this._n,"._getC2CPeerReadTime userIDList:").concat(n));var o=this.getModule(Gn);o&&o.getRemotePeerReadTime(n)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(xn).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===S.CONV_C2C||e.type===S.CONV_GROUP&&e.lastMessage.type!==S.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(xn).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(Un);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(E.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return m(this._conversationMap.values()).filter((function(e){return e.type!==S.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new ka("syncConversationList");return this._pagingStatus===Zt.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){var o=function(e){if(st(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}}(e._pagingGetCostList);return xe.l("".concat(e._n,".").concat("syncConversationList",". sum ").concat(function(e){if(st(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t.toFixed(0)}}(e._pagingGetCostList)," ms, average ").concat(o," ms")),e._pagingGetCostList.length=0,e._pagingStatus=Zt.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setMoreMessage(o).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=Zt.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];t.setError(n,s,a).end()})),Ja(n)}))}},{key:"_diffAndDeleteConversation",value:function(){var e=this;if(this._isSyncCompleted()){var t=[];this._conversationMap.forEach((function(n,o){!e._pagingConvIDMap.has(o)&&e._convIDFromUnreadDBMap.has(o)&&(e._conversationMap.delete(o),t.push(o))})),xe.l("".concat(this._n,"._diffAndDeleteConversation list:").concat(t))}}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),s=this.getModule(Un).getGroupList();Promise.all([n,o,s]).then((function(){var n=Date.now()-t;xe.l("".concat(e._n,"._patchConversationProperties ok. cost ").concat(n," ms")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._n,"._pagingGetConversationList");xe.l("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex));var n=Date.now();return this._pagingStatus=Zt.PENDING,this.request({protocolName:No,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var s=o.data,a=s.completeFlag,r=s.conversations,i=void 0===r?[]:r,u=s.timeStamp,c=s.startIndex,l=s.pinnedTimeStamp,p=s.pinnedStartIndex,d=s.groupItem,g=Date.now()-n;if(e._pagingGetCostList.push(g),xe.l("".concat(t," ok. completeFlag:").concat(a," count:").concat(i.length," cost ").concat(g," ms")),e._convGroupHandler.onConvGroupListSynced(d),i.length>0){var _=e._getConversationOptions(i);e._pagingConvIDMap=new Map([].concat(m(e._pagingConvIDMap),m(_.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConversationList({conversationOptionsList:_,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return za();e.triggerReady()}return e._pagingTimeStamp=u,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=l,e._pagingPinnedStartIndex=p,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),za())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(xe.w("".concat(t," failed. error:"),n),e.triggerReady())),n}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=e.isInstantMessage,s=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(m(t.toBeUpdatedConversationList),m(this._conversationMap)))),n||(this._updateUserOrGroupProfile(t.newConversationList),o&&this.emitTotalUnreadMessageCountUpdate()),xe.d("".concat(this._n,"._updateLocalConversationList cost ").concat(Date.now()-s," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,s=e.isUnreadC2CMessage,a=void 0!==s&&s,r=e.updateUnreadCount,i=[],u=[],c=this.getModule(Un),l=this.getModule(Pn),p=this.isIntl(),d=0,g=t.length;d0&&s.getUserProfile({userIDList:n}).then((function(e){var n=e.data;st(n)?n.forEach((function(e){t._doUpdateUserProfile("C2C".concat(e.userID),e)})):t._doUpdateUserProfile("C2C".concat(n.userID),n)})),o.length>0&&a.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);pt(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t)}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],s=e.filter((function(e){var t=e.type,n=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==n&&"@TLS#ERROR"!==n||2===t})),a=this.getMyUserID(),r=s.map((function(e){if(at(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(s),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?n._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===a&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new ur(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:"",customData:e.customMark||"",markList:Bt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new dr({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0,customData:e.customMark||"",markList:Bt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));o.length>0&&this.getModule(On).onConversationsProfileUpdated(o);return r}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,s=void 0===o?void 0:o,a=n.elements,r=void 0===a?[]:a,i=n.groupTips,u=void 0===i?{}:i;if(!at(s)&&!jt(u)){var c=new Ha(u);c.setElement({type:S.MSG_GRP_TIP,content:t(t({},u.elements),{},{groupProfile:u.groupProfile})});var l=JSON.parse(JSON.stringify(c.payload));return c=null,{type:S.MSG_GRP_TIP,payload:l}}return{type:r[0]?r[0].type:null,payload:r[0]?this._amendLayersOverLimitProperty(r[0].content):null}}},{key:"_amendLayersOverLimitProperty",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof Ha&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){if(st(e)){var t=e.map((function(e){var t=e.type,n=e.userID,o=e.groupID;return 1===t?"".concat(S.CONV_C2C).concat(n):2===t?"".concat(S.CONV_GROUP).concat(o):void 0}));xe.l("".concat(this._n,".onConversationDeleted conversationIDList:").concat(t)),this.deleteLocalConversationList(t)}}},{key:"onConversationPinned",value:function(e){var t=this;if(st(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,r=e.groupID;1===s?o=t.getLocalConversation("".concat(S.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation("".concat(S.CONV_GROUP).concat(r))),o&&(xe.l("".concat(t._n,".onConversationPinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(st(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,r=e.groupID;1===s?o=t.getLocalConversation("".concat(S.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation("".concat(S.CONV_GROUP).concat(r))),o&&(xe.l("".concat(t._n,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,s=e.count,a="".concat(this._n,".getMessageList"),r=this.getLocalConversation(n),i="";if(r&&r.groupProfile&&(i=r.groupProfile.type),Ct(i))return xe.l("".concat(a," not available in avchatroom. conversationID:").concat(n)),za({messageList:[],nextReqMessageID:"",isCompleted:!0});(at(s)||s>15)&&(s=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var u=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),c=this._completedMap.has(n);if(xe.l("".concat(a," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(u," count:").concat(s," isCompleted:").concat(c)),this._needGetHistory({conversationID:n,remainingCount:u,count:s}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,s=e.storedMessageList,r=t._completedMap.has(n),i=s;u>0&&(i=t._messageListHandler.getLocalMessageList(n).slice(0,s.length+u));var c={nextReqMessageID:r?"":o,messageList:i,isCompleted:r};return xe.l("".concat(a," ret.nextReqMessageID:").concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(i.length)),Ka(c)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:s});return za(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,s="".concat(this._n,"._getMessageListFromMemory"),a=this._messageListHandler.getLocalMessageList(t),r=a.length,i=0,u={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(i=a.findIndex((function(e){return e.ID===n})))>o?(u.messageList=a.slice(i-o,i),u.nextReqMessageID=a[i-o].ID):(u.messageList=a.slice(0,i),u.isCompleted=!0):r>o?(i=r-o,u.messageList=a.slice(i,r),u.nextReqMessageID=a[i].ID):(u.messageList=a.slice(0,r),u.isCompleted=!0),xe.l("".concat(s," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(u.messageList.length)),u}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,s=e.count,a=e.direction,r=void 0===a?0:a;if((at(s)||s>15)&&(s=15),t.startsWith(S.CONV_C2C)){var i=this.getModule(Gn),u=t.replace(S.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:u,time:o,count:s,direction:r})}if(t.startsWith(S.CONV_GROUP)){var c=this.getModule(Un),l=t.replace(S.CONV_GROUP,"");return c.getRoamingMessagesHopping({groupID:l,sequence:n,count:s,direction:r})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),s=o.length;if(!n)return s;var a=0;return Et(t)?a=o.findIndex((function(e){return e.ID===n})):St(t)&&(a=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===a&&(a=0),a}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,s=this.getLocalConversation(t),a="";return s&&s.groupProfile&&(a=s.groupProfile.type),!kt(t)&&!Ct(a)&&(!(St(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(S.CONV_GROUP,"");return Dt(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===S.CONV_SYSTEM)return za();var o=15;n>20&&(o=20);var s=null;if(Et(t)){var a=this._roamingMessageKeyAndTimeMap.has(t);return(s=this.getModule(Gn))?s.getRoamingMessage({conversationID:t,peerAccount:t.replace(S.CONV_C2C,""),count:o,lastMessageTime:a?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:a?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):Ja({code:da.CANNOT_FIND_MODULE})}if(St(t)){if(!(s=this.getModule(Un)))return Ja({code:da.CANNOT_FIND_MODULE});var r=null;this._conversationMap.has(t)&&(r=this._conversationMap.get(t).lastMessage);var i=0;r&&(i=r.lastSequence);var u=this._roamingMessageSequenceMap.get(t);return s.getRoamingMessage({conversationID:t,groupID:t.replace(S.CONV_GROUP,""),count:o,sequence:u||i})}return za()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,s=n.payload;if(jt(o)||jt(s)){var a=this._messageListHandler.getLocalMessageList(e);if(0===a.length)return;var r=a[a.length-1];xe.l("".concat(this._n,".patchConversationLastMessage conversationID:").concat(e," payload:"),r.payload),t.updateLastMessage(r)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=n.startsWith(S.CONV_C2C)?S.CONV_C2C:S.CONV_GROUP,a=null,r=[],i=[],u=0,c=e.length,l=null,p=s===S.CONV_GROUP,d=this.getModule(Hn),g=this.getFileDownloadProxy(),_=function(){u=p?e.length-1:0,c=p?0:e.length},h=function(){p?--u:++u},f=function(){return p?u>=c:u0&&void 0!==arguments[0]?arguments[0]:{},n="setAllMessageRead",o="".concat(this._n,".").concat(n);t.scope||(t.scope=S.READ_ALL_MSG),xe.l("".concat(o," options:"),t);var s=this._createSetAllMessageReadPack(t);if(0===s.readAllC2CMessage&&0===s.groupMessageReadInfoList.length)return za();var a=new ka(n);return this.request({protocolName:rs,requestData:s}).then((function(n){var o=n.data,s=e._handleAllMessageRead(o);return a.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),za()})).catch((function(t){return e.probeNetwork().then((function(e){var n=v(e,2),o=n[0],s=n[1];a.setError(t,o,s).end()})),xe.w("".concat(o," failed. error:"),t),Ja({code:t&&t.code?t.code:da.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n0)if(a.type===S.CONV_C2C&&0===n.readAllC2CMessage){if(o===S.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===S.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(a.type===S.CONV_GROUP&&(o===S.READ_ALL_GROUP_MSG||o===S.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(a);n.groupMessageReadInfoList.push({groupID:a.groupProfile.groupID,messageSequence:r})}}}catch(i){s.e(i)}finally{s.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n=1){if(1===n&&i.type===S.CONV_C2C){var u=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:u})}else if(i.type===S.CONV_GROUP){var c=r.replace(S.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(c)){var l=this._remoteGroupReadSequenceMap.get(c),p=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:r,remoteReadSequence:l}),p>=l&&this._remoteGroupReadSequenceMap.delete(c)}}this.updateUnreadCount(r,!1)&&(o+=1)}}}catch(d){s.e(d)}finally{s.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(S.CONV_GROUP,""),s=!1;if(this._remoteGroupReadSequenceMap.has(o)){var a=this._remoteGroupReadSequenceMap.get(o);n<=a&&(s=!0,xe.l("".concat(this._n,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(a))),n>=a+10&&this._remoteGroupReadSequenceMap.delete(o)}return s}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,s=this._messageListHandler.getLocalMessageList(t);if(0!==s.length)for(var a,r=s.length-1;r>=0;r--)if(a=s[r],!(o&&a.time>o||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),s=this._messageListHandler.getLocalMessageList(e);if(o){var a=o.unreadCount,r=s.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(a!==r&&(o.unreadCount=r,n=!0,xe.l("".concat(this._n,".updateUnreadCount from ").concat(a," to ").concat(r,", conversationID:").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),n&&o.type===S.CONV_TOPIC){var i=o.unreadCount,u=this.getModule(wn),c=e.replace(S.CONV_GROUP,"");u.onConversationProxy({topicID:c,unreadCount:i})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),xe.l("".concat(this._n,".clearGroupAtInfoList conversationID:").concat(e)),n.type===S.CONV_TOPIC){var o=n.groupAtInfoList,s=this.getModule(wn),a=e.replace(S.CONV_GROUP,"");s.onConversationProxy({topicID:a,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,s=e.groupID,a=void 0===s?void 0:s,r=e.readReceiptList;if(!jt(r)){var i=[];if(at(o)){if(!at(a)){var u="".concat(S.CONV_GROUP).concat(a);r.forEach((function(e){var n=e.tinyID,o=e.clientTime,s=e.random,r=e.readCount,c=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(s),p=t._messageListHandler.getLocalMessage(u,l),d={groupID:a,messageID:l,readCount:0,unreadCount:0};p&&($e(r)&&(p.readReceiptInfo.readCount=r,d.readCount=r),$e(c)&&(p.readReceiptInfo.unreadCount=c,d.unreadCount=c),i.push(d))}))}}else{var c="".concat(S.CONV_C2C).concat(o);r.forEach((function(e){var n=e.tinyID,s=e.clientTime,a=e.random,r="".concat(n,"-").concat(s,"-").concat(a),u=t._messageListHandler.getLocalMessage(c,r);if(u){u.readReceiptInfo.isPeerRead=!0;var l={userID:o,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(E.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var s=o.unreadCount,a=s-n;a<0&&(a=0),o.unreadCount=a,xe.l("".concat(this._n,".recomputeGroupUnreadCount from ").concat(s," to ").concat(a,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!kt(t.type)){for(var o=[],s=0,a=n.length;s0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(E.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;jt(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){xe.l("".concat(this._n,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="getConversationList",o="".concat(this._n,".").concat(n),s="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(xe.l("".concat(o,". ").concat(s)),this._pagingStatus===Zt.REJECTED){var a=new ka(n);return a.setMessage(s),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ka({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}if(0===this._conversationMap.size){var r=new ka(n);return r.setMessage(s),this.syncConversationList().then((function(){r.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ka({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}var i=this._getConversationList(e);return xe.l("".concat(o,". returned conversation count:").concat(i.length)),za({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(at(e))return this.getLocalConversationList();if(st(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ot(e)){var t=e.type,n=e.markType,o=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==S.CONV_C2C&&t!==S.CONV_GROUP||e.type===t)&&(!et(o)||e.conversationGroupList.includes(o))&&(!$e(n)||e.markList.includes(n))}))}return[]}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=D(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];s.type===S.CONV_C2C&&(xe.d("".concat(this._n,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(s.peerReadTime)),this.recordPeerReadTime(o,s.peerReadTime))}}catch(a){t.e(a)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(Un).isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){return this.getModule(Un).getLocalGroupList().length}},{key:"_hasLocalGroup",value:function(e){return this.getModule(Un).hasLocalGroup(e.replace(S.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new _r({conversationID:e,type:e.slice(0,3)===S.CONV_C2C?S.CONV_C2C:S.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===S.CONV_SYSTEM)return za({conversation:t});if(St(e)&&!this._hasLocalGroup(e))return za({conversation:t});var o="".concat(this._n,".").concat("getConversationProfile"),s=new ka("getConversationProfile");return xe.l("".concat(o,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(a){s.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(a.data.conversation.unreadCount)).end();var r=n.getModule(Pn);if(r&&t.type===S.CONV_C2C){var i=e.replace(S.CONV_C2C,"");if(r.isMyFriend(i)){var u=r.getFriendRemark(i);t.remark!==u&&(t.remark=u,xe.l("".concat(o,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return xe.l("".concat(o," ok. conversationID:").concat(e)),a})).catch((function(t){return n.probeNetwork().then((function(n){var o=v(n,2),a=o[0],r=o[1];s.setError(t,a,r).setMessage("conversationID:".concat(e)).end()})),xe.e("".concat(o," failed. error:"),t),Ja(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===S.CONV_C2C?this.getModule(On).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?Ja(new Wa({code:da.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),za({conversation:e}))})):this.getModule(Un).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),za({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof _r&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(m(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(S.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===Zt.RESOLVED}},{key:"_errorLog",value:function(e,t,n,o){var s=new Error("Params validate failed."),a="".concat(this.getErrorMessage("API_REFER")).concat(e);throw xe.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrorMessage(n,o),", ").concat(a)),xe.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),s}},{key:"_isValidConversationID",value:function(e){return Et(e)||St(e)||kt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return et(e)||nt(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),et(e)?(this._isValidConversationID(e)||this._errorLog(n,"options","InvalidConversationID",e),xe.l("".concat(this._n,".").concat(n," conversationID:").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(st(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach((function(e){t._isValidConversationID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)})),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:"deleteConversationList",value:function(e){var t=this,n=e.conversationIDList,o=void 0===n?[]:n,s=e.clearHistoryMessage,a=void 0===s||s,r=e.flag,i=void 0===r?0:r,u="".concat(this._n,".").concat("deleteConversationList");xe.l("".concat(u," conversationIDList.length:").concat(o.length," clearHistoryMessage:").concat(a));var c=new ka("deleteConversationList");return c.setMessage("conversationIDList:".concat(o)),Promise.all([this.rmLocalOnlyConversationList(o),this.rmLocalAndRemoteConversationList(o,a)]).then((function(e){c.setNetworkType(t.getNetworkType()).end();var n=[].concat(m(e[0]),m(e[1]));return 0===n.length?Ja(new Wa({code:da.CONVERSATION_NOT_FOUND})):(xe.l("".concat(u," ok")),za(1===i?{conversationID:n[0]}:{conversationIDList:n}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),xe.e("".concat(u," failed. error:"),e),Ja(e)}))}},{key:"rmLocalOnlyConversationList",value:function(e){var t=this;return e.filter((function(e){if(!t._conversationMap.has(e))return!1;var n=t.getLocalConversation(e).type;return n!==S.CONV_GROUP||t._hasLocalGroup(e)?n===S.CONV_SYSTEM&&(t.getModule(Un).deleteGroupSystemNotice({messageList:t._messageListHandler.getLocalMessageList(e)}),t.deleteLocalConversation(e),!0):(t.deleteLocalConversation(e),!0)}))}},{key:"rmLocalAndRemoteConversationList",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach((function(e){if(n._conversationMap.has(e)){var t=n.getLocalConversation(e).type;t===S.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,""),type:1}):t===S.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,""),type:2})}})),0===o.conversationList.length?[]:this.request({protocolName:Go,requestData:o}).then((function(e){var t=[];return e.data.resultList.length>0&&e.data.resultList.map((function(e){if(0===e.code){var n=1===e.type?"".concat(S.CONV_C2C).concat(e.to):"".concat(S.CONV_GROUP).concat(e.groupID);t.push(n)}})),n.deleteLocalConversationList(t),t}))}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return Ja({code:da.CONVERSATION_NOT_FOUND});var o=this._conversationMap.get(e).type;if(o===S.CONV_C2C)n.type=1,n.toAccount=e.replace(S.CONV_C2C,"");else{if(o!==S.CONV_GROUP)return o===S.CONV_SYSTEM?(this.getModule(Un).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),za({conversationID:e})):Ja({code:da.CONVERSATION_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(S.CONV_GROUP,"")}var s="".concat(this._n,".").concat("clearHistoryMessage"),a=new ka("clearHistoryMessage");return a.setMessage("conversationID:".concat(e)),xe.l("".concat(s,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Uo,requestData:n})})).then((function(){a.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(s," ok")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConversationListAndEmitEvent()),za({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e("".concat(s," failed. error:"),e),Ja(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return Ja({code:da.CONVERSATION_NOT_FOUND});var s=this.getLocalConversation(n);if(s.isPinned===o)return za({conversationID:n});var a="".concat(this._n,".").concat("pinConversation"),r=new ka("pinConversation");r.setMessage("conversationID:".concat(n," isPinned:").concat(o)),xe.l("".concat(a,". conversationID:").concat(n," isPinned:").concat(o));var i=null;return Et(n)?i={type:1,toAccount:n.replace(S.CONV_C2C,"")}:St(n)&&(i={type:2,groupID:n.replace(S.CONV_GROUP,"")}),this.request({protocolName:Po,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[i]}}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(a," ok")),s.isPinned!==o&&(s.isPinned=o,t._sortConversationListAndEmitEvent()),Ka({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(a," failed. error:"),e),Ja(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,s=!1,a=this.getLocalConversation(n?"".concat(S.CONV_C2C).concat(t):"".concat(S.CONV_GROUP).concat(t));return a&&a.messageRemindType!==o&&(a.messageRemindType=o,s=!0),xe.d("".concat(this._n,".patchMessageRemindType options:"),e,"ret:".concat(s)),s}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMessageRemindTypeSynced");xe.d(n,e),e.dataList.forEach((function(e){if(!jt(e.muteNotificationsSync)){var o,s=e.muteNotificationsSync,a=s.to,r=s.updateSequence,i=s.muteFlag;t._messageRemindHandler.setUpdateSequence(r),0===i?o=S.MSG_REMIND_ACPT_AND_NOTE:1===i?o=S.MSG_REMIND_DISCARD:2===i&&(o=S.MSG_REMIND_ACPT_NOT_NOTE);var u=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(u+=1),xe.l("".concat(n," updateCount:").concat(u)),u>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){xe.d("".concat(this._n,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._conversationMap.has(e);if(xe.d("".concat(this._n,".deleteLocalConversation conversationID:").concat(e," has:").concat(n)),n&&(this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e),t)){var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:"deleteLocalConversationList",value:function(e){var t=this,n=0,o=!1;e.forEach((function(e){t._conversationMap.has(e)&&(n+=t._conversationMap.get(e).unreadCount||0,t.deleteLocalConversation(e,!1),o=!0)})),xe.l("".concat(this._n,".deleteLocalConversationList conversationIDList.length:").concat(e.length," isConvIDExisted:").concat(o)),o&&(this.emitConversationUpdate(!0,!1),n>0&&this.emitTotalUnreadMessageCountUpdate())}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(S.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),xe.l("".concat(this._n,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-n," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){xe.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var s=this._conversationMap.get(t).userProfile;et(n)&&s.nick!==n&&(s.nick=n),et(o)&&s.avatar!==o&&(s.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),s=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),xe.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-s," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(Pn);if(!t)return e;var n=m(this._conversationMap.values()).filter((function(e){return e.type===S.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(S.CONV_C2C,"");if(t.isMyFriend(n)){var s=t.getFriendRemark(n);e.remark!==s&&(e.remark=s,o+=1)}})),xe.l("".concat(this._n,".checkAndPatchRemark. c2c conversation count:").concat(n.length,", patched count:").concat(o)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(Gn):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(Un)),n?n.sendReadReceipt(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(Gn):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(Un)),n?n.getReadReceiptList(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"getTotalUnreadMessageCount",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==S.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==S.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(xe.l("".concat(this._n,".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._pagingStatus=Zt.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this.resetReady()}}]),s}(ro),mr=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);xe.l("".concat(e._n,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){xe.d("".concat(this._n,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,s=t.AVChatRoomMessageList;(s.length>0&&this._groupModule.onAVChatRoomMessage(s),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,s=e.dataList,a=null,r=[],i=[],u={},c=[],l=function(e,l){var p=yt(s[e]);if(6===o){if(n._groupModule.isGroupAttributesUpdatedNotice(p))return"continue";if(n._groupModule.isGroupCountersNotice(p))return"continue"}var d=p.groupProfile,g=d.groupID,_=d.communityType,h=void 0===_?0:_,f=d.topicID,v=void 0===f?void 0:f,m=d.invisible,M=void 0,y=n._groupModule.isMessageFromTopic(h,v);if(y){M=S.CONV_TOPIC,p.to=v;var I=n._groupModule.getModule(wn);I.hasLocalTopic(g,v)||n._getTopicPendingMap.has(v)||(n._getTopicPendingMap.set(v,1),I.getTopicList({groupID:g,topicIDList:[v]}).finally((function(){n._getTopicPendingMap.delete(v)})))}var C=n._groupModule.hasLocalGroup(g);if(!C&&n._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!C&&!y)return n._cacheGroupTipsAndProbe({groupID:g,event:o,item:p}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(g))return p.event=o,c.push(p),"continue";if(p.currentUser=n._groupModule.getMyUserID(),p.conversationType=S.CONV_GROUP,(a=new Ha(p)).setElement({type:S.MSG_GRP_TIP,content:t(t({},p.elements),{},{groupProfile:p.groupProfile})}),a.isSystemMessage=!1,1===m)return n._qualityStat(a),"continue";var T=n._groupModule.getModule(Fn),D=a,E=D.conversationID,k=D.sequence;if(6===o)a._onlineOnlyFlag=!0,i.push(a);else if(!T.pushIntoNoticeResult(i,a))return"continue";if(n._groupModule.isMessageFromCommunityOfTopic(h,v))return"continue";if(6===o&&T.getLocalConversation(E))return"continue";6!==o&&n._qualityStat(a);var L=T.isRemoteRead({conversationID:E,sequence:k});if(at(u[E])){var A=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||(A=1)),u[E]=r.push({conversationID:E,unreadCount:A,type:at(M)?a.conversationType:M,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var R=u[E];r[R].type=a.conversationType,r[R].subType=a.conversationSubType,r[R].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||r[R].unreadCount++)}},p=0,d=s.length;p=0){u.updateSelfInfo({muteTime:p.muteTime}),c=!0;break}}c&&this._groupModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,s=n.newTopicInfo;this._groupModule.getModule(wn).onTopicProfileUpdated(t({groupID:o,topicID:e.to},s))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),xe.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupTips(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),xe.l("".concat(this._n,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Mr=function(){function e(t){o(this,e),this._groupModule=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(Za,this._initGroupList,this)}return a(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);xe.l("".concat(e._n,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"_initGroupList",value:function(){var e=this;xe.l("".concat(this._n,"._initGroupList"));var t=new ka("getGroupListInStorage"),n=this._groupModule.getStorageGroupList();if(st(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();xe.l("".concat(this._n,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var n="".concat(this._n,".handleUpdateGroupLastMessage");if(xe.l("".concat(n," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var o,s,a,r=!1,i=0,u=e.length;i0&&this._groupModule.onAVChatRoomMessage(s),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:n,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var a=this._groupModule.filterUnmodifiedMessage(o);a.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,a),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,s=e.isInstantMessage,a=null,r=[],i=[],u=[],c={},l=this._groupModule.getModule(Hn),p=this._groupModule.getFileDownloadProxy(),d=n.length;d>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var d=yt(n[e]),g=d.groupProfile,_=g.groupID,h=g.communityType,f=void 0===h?0:h,v=g.topicID,m=void 0===v?void 0:v,M=g.invisible,y=void 0,I=t._groupModule.isMessageFromTopic(f,m);if(I){y=S.CONV_TOPIC,d.to=m;var C=t._groupModule.getModule(wn);C.hasLocalTopic(_,m)||t._getTopicPendingMap.has(m)||(t._getTopicPendingMap.set(m,1),C.getTopicList({groupID:_,topicIDList:[m]}).finally((function(){t._getTopicPendingMap.delete(m)})))}var T=t._groupModule.hasLocalGroup(_);if(!T&&t._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!T&&!I)return t._cacheGroupMessageAndProbe({groupID:_,event:o,item:d}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(_))return d.event=o,u.push(d),"continue";if(d.currentUser=t._groupModule.getMyUserID(),d.conversationType=S.CONV_GROUP,d.isSystemMessage=!!d.isSystemMessage,a=new Ha(d),d.elements=l.parseElements(d.elements,d.from),a.setElement(d.elements,p),1===M)return t._qualityStat(s,a),"continue";var D=1===n[e].isModified,E=t._groupModule.getModule(Fn);if(E.isMessageSentByCurrentInstance(a)?a.isModified=D:D=!1,1===d.onlineOnlyFlag)a._onlineOnlyFlag=!0,E.isMessageSentByCurrentInstance(a)||i.push(a);else{if(t._groupModule.isMessageFromCommunityOfTopic(f,m))return i.push(a),"continue";if(!E.pushIntoMessageList(i,a,D))return"continue";t._qualityStat(s,a);var k=a,L=k.conversationID,A=k.sequence,R=E.isRemoteRead({conversationID:L,sequence:A});if(at(c[L])){var N=0;"in"===a.flow&&(a._isExcludedFromUnreadCount||R||(N=1)),c[L]=r.push({conversationID:L,unreadCount:N,type:at(y)?a.conversationType:y,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?"":a})-1}else{var O=c[L];r[O].type=at(y)?a.conversationType:y,r[O].subType=a.conversationSubType,r[O].lastMessage=a._isExcludedFromLastMessage?"":a,"in"===a.flow&&(a._isExcludedFromUnreadCount||R||r[O].unreadCount++)}}},_=0;_0&&n.addMessageDelay(t.clientTime)}},{key:"onGroupMessageRevoked",value:function(e){var t=this._groupModule.getModule(Fn),n=[],o=null,s=!0;e.dataList.forEach((function(e){var a=e.elements.revokedInfos;at(a)||a.forEach((function(e){var a=jt(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);o=t.revoke(a,e.sequence,e.random);var r=e.revokerInfo&&e.revokerInfo.revoker;if(o)o.revoker=r,n.push(o);else{var i={conversationID:a,to:e.topicID||"",sequence:e.sequence,time:e.time,revoker:r};t.isLastMessageRevoked(i)&&(n.push(i),s=!1)}}))})),0!==n.length&&(t.onMessageRevoked(n),!0===s&&(xe.l("".concat(this._n,".onGroupMessageRevoked count:").concat(n.length)),this._groupModule.emitOuterEvent(E.MESSAGE_REVOKED,n)))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(m(this._groupModule.getGroupMap())),n=0,o=e.length;ng),h="offset:".concat(u," totalCount:").concat(d," isCompleted:").concat(_," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(s);return p.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),s||_?!s&&_?(xe.l("".concat(n," start to get community list")),u=0,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):s&&!_?(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):(xe.l("".concat(n," ok. totalCount:").concat(l.length)),Ka({groupList:l})):(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];p.setMessage("isCommunityRelay:".concat(s)).setError(e,o,a).end()})),s?(11e3===e.code&&(p=null,xe.l("".concat(n," ok. community unavailable"))),za({groupList:l})):Ja(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),o=e.limit,s=e.offset,a=e.groupBaseInfoFilter,r=e.groupList,i=new ka("pagingGetGroupListWithTopic");return this._groupModule.request({protocolName:Wo,requestData:{type:S.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var u=e.data,c=u.groups,l=void 0===c?[]:c,p=u.totalCount;r.push.apply(r,m(l));var d=s+o,g=!(p>d),_="offset:".concat(s," totalCount:").concat(p," isCompleted:").concat(g," ")+"currentCount:".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),g?(xe.l("".concat(n," ok. totalCount:").concat(r.length)),Ka({groupList:r})):(s=d,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ja(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),xe.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupMessage(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),xe.l("".concat(this._n,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,s=e.groupAtInfoList,a=[];at(s)||(s.forEach((function(e){a.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(Fn).onNewGroupAtTips({dataList:a}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(Za,this._initGroupList,this)}}]),e}(),yr=1,Ir=2,Cr=3,Tr=4,Dr=5,Er=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");at(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,n=e.elements.newGroupProfile,o=!at(n)&&!jt(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,s=o.mainSequence,a=o.isWithChangedAttributeInfo,r=o.groupAttributeList,i=void 0===r?[]:r,u=o.operationType;if(xe.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(n," isWithChangedAttributeInfo:").concat(a," operationType:").concat(u)),!at(u)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var c=s-this._getLocalGroupAttributes(n).localMainSequence;if(0!==c){if(1===a&&1===c)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:i,operationType:u}),void this._emitGroupAttributesUpdated(n);if(this._hasLocalGroupAttributes(n)){var l=this._getLocalGroupAttributes(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey,o=void 0===n?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),xe.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,s=this._getLocalGroupAttributes(n),a=s.remoteMainSequence,r=s.avChatRoomKey,i=new ka("initGroupAttributes");return i.setMessage("groupID:".concat(n," avChatRoomKey:").concat(r," mainSequence:").concat(a)),this._groupModule.request({protocolName:Ms,requestData:{groupID:n,avChatRoomKey:r,mainSequence:a,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){xe.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n));var s=e.data,a=s.mainSequence,r=m(s.groupAttributeList);return r.forEach((function(e){e.value=o[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:r,operationType:yr}),t._emitGroupAttributesUpdated(n),i.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ja(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),o=e.groupID,s=e.groupAttributes,a=this._getLocalGroupAttributes(o),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,c=this._transformGroupAttributes(s);c.forEach((function(e){var t=e.key;e.sequence=0,u.has(t)&&(e.sequence=u.get(t).sequence)}));var l=new ka("setGroupAttributes");return l.setMessage("groupID:".concat(o," groupAttributes:").concat(JSON.stringify(s))),xe.l("".concat(n,". groupID:").concat(o," mainSequence:").concat(r)),this._groupModule.request({protocolName:ys,requestData:{groupID:o,avChatRoomKey:i,mainSequence:r,groupAttributeList:c}}).then((function(e){xe.l("".concat(n," ok."));var a=e.data,r=a.mainSequence,i=m(a.groupAttributeList);return i.forEach((function(e){e.value=s[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:o}),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:r,groupAttributeList:i,operationType:Ir}),t._emitGroupAttributesUpdated(o),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({groupAttributes:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ja(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,s=void 0===o?[]:o,a=this._getLocalGroupAttributes(n),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,c=m(u.keys()),l=Cs,p=Cr,d={groupID:n,avChatRoomKey:i,mainSequence:r},g=[];s.length>0&&(c=[],l=Is,p=Tr,s.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,c.push(e)),g.push({key:e,sequence:t})})),d.groupAttributeList=g);var _=new ka("deleteGroupAttributes");return _.setMessage("groupID:".concat(n," mainSequence:").concat(r," keyList:").concat(s," protocolName:").concat(l)),this._groupModule.request({protocolName:l,requestData:d}).then((function(e){xe.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n));var o=e.data.mainSequence;return t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:g,operationType:p}),t._emitGroupAttributesUpdated(n),_.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({keyList:c})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];_.setError(e,o,s).end()})),Ja(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),o=e.groupID,s=this._getLocalGroupAttributes(o),a=s.avChatRoomKey,r=s.lastUpdateTime,i=s.localMainSequence,u=s.remoteMainSequence,c=new ka("getGroupAttributes");if(c.setMessage("groupID:".concat(o," localMainSequence:").concat(i," remoteMainSequence:").concat(u," keyList:").concat(e.keyList)),Date.now()-r>=this.CACHE_EXPIRE_TIME||i0)o.forEach((function(e){a.has(e)&&(s[e]=a.get(e).value)}));else{var r,i=D(a.keys());try{for(i.s();!(r=i.n()).done;){var u=r.value;s[u]=a.get(u).value}}catch(c){i.e(c)}finally{i.f()}}}return s}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;o!==Cr?o!==Tr?(o===yr&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,s=e.sequence;t.attributes.set(n,{value:o,sequence:s})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,s=n.deletedKeyList;xe.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(o.length,", delete:").concat(s.length)),0===o.length&&0===s.length||this._groupModule.emitOuterEvent(E.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:s})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach((function(o){e[o]!==t._groupAttributesCopy[o]&&n.push(o)})),Object.keys(this._groupAttributesCopy).forEach((function(t){at(e[t])&&o.push(t)})),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:o}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Sr="Set",kr="Increase",Lr="Decrease",Ar=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_counter_expire_time");at(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,n=e.elements.groupCounterInfo,o=!1;return jt(n)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:n}),o=!0),o}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var o=e.type,s=e.groupCounterSeq,a=e.counterList,r=void 0===a?[]:a;0!==o&&2!==o||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:r}),r.forEach((function(e){t._groupModule.emitOuterEvent(E.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===o&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:r})})),xe.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(n))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:n}),xe.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"setGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".setGroupCounters"),o=e.groupID,s=e.counters,a=this._convertObjectToList(s),r=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," count:").concat(a.length),u=new ka("setGroupCounters");return u.setMessage("".concat(i)),xe.l("".concat(n,". ").concat(i)),this._updateGroupCounters({groupID:o,counterList:a,avChatRoomKey:r,mode:Sr}).then((function(e){return u.end(),xe.l("".concat(n," ok.")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"increaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".increaseGroupCounters"),o=e.groupID,s=e.key,a=e.value,r=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," key:").concat(s," value:").concat(a),u=new ka("increaseGroupCounter");u.setMessage("".concat(i)),xe.l("".concat(n,". ").concat(i));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:r,mode:kr}).then((function(e){return u.end(),xe.l("".concat(n," ok.")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"decreaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".decreaseGroupCounter"),o=e.groupID,s=e.key,a=e.value,r=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," key:").concat(s," value:").concat(a),u=new ka("decreaseGroupCounter");u.setMessage("".concat(i)),xe.l("".concat(n,". ").concat(i));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:r,mode:Lr}).then((function(e){return u.end(),xe.l("".concat(n," ok.")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".getGroupCounters"),o=e.groupID,s=e.keyList,a=void 0===s?[]:s,r=this._getLocalGroupCounters(o),i=r.avChatRoomKey,u=r.lastUpdateTime,c=new ka("getGroupCounters");if(c.setMessage("groupID:".concat(o)),Date.now()-u>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:i}).then((function(e){c.setMoreMessage("from remote. count:".concat(e.length)).end(),xe.l("".concat(n," from remote. groupID:").concat(o));var s=t._getLocalCounters(o,a);return Ka({counters:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ja(e)}));c.setMoreMessage("from cache").end(),xe.l("".concat(n," from cache. groupID:").concat(o));var l=this._getLocalCounters(o,a);return za({counters:l})}},{key:"_getRemoteGroupCounters",value:function(e){var n=this;return this._groupModule.request({protocolName:Ls,requestData:t({},e)}).then((function(t){var o=t.data,s=o.counterList,a=void 0===s?[]:s,r=o.groupCounterSeq;return n._updateLocalGroupCounters({groupID:e.groupID,counterList:a,groupCounterSeq:r}),xe.l("".concat(n._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),a})).catch((function(e){return Ja(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var n="".concat(this._n,"._updateGroupCounters"),o=e.groupID,s=e.avChatRoomKey,a=e.mode;return xe.l("".concat(n,". groupID:").concat(o," avChatRoomKey:").concat(s," mode:").concat(a)),this._groupModule.request({protocolName:ks,requestData:t({},e)}).then((function(e){xe.l("".concat(n," ok."));var t=e.data.counterList,o={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,n=e.value;o[t]=n})),o})).catch((function(e){return Ja(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,s=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var a=this._getLocalGroupCounters(t),r=a.counters,i=a.avChatRoomKey,u=a.groupCounterSeq;if(s>0&&s0)t.forEach((function(e){o.has(e)&&(n[e]=o.get(e))}));else{var s,a=D(o.keys());try{for(a.s();!(s=a.n()).done;){var r=s.value;n[r]=o.get(r)}}catch(i){a.e(i)}finally{a.f()}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Rr=function(){function e(t){o(this,e);var n=t.manager,s=t.groupID,a=t.onInit,r=t.onSuccess,i=t.onFail;this._n="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=a,this._onSuccess=r,this._onFail=i,this._groupID=s,this._timeoutID=-1,this._isRunning=!1,this._protocolName=_s}return a(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=hs),xe.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){xe.l("".concat(this._n,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),e}(),Nr={3:!0,4:!0,5:!0,6:!0,17:!0},Or=function(){function e(t){o(this,e),this._groupModule=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new lr(200),this.messageIDLinkedList=new lr(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return a(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?m(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===m(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):t(t({},n),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,s=n.nextSeq,a=n.rspMsgList,r=n.errorCode,i=n.nextBroadcastSeq,u=n.broadcastMessageList;if(0!==r){var c=this._pollingRequestInfoMap.get(e),l=new ka("longPollingAVError"),p=c?"".concat(c.key,"-").concat(c.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(p,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;et(o)&&$e(s)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:s}),$e(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),st(a)&&a.length>0?(a.forEach((function(e){e.to=e.groupID})),this.onMessage(a)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(u)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(st(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(Fn),s=this._getModule($n),a=e.length;a>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule(qn),i=0;i1&&g<=20?this._getModule(Jn).onMessageMaybeLost(p,d+1,g-1):g<-1&&g>=-20&&this._getModule(Jn).onMessageMaybeLost(p,t.sequence+1,Math.abs(g)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var _=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(_=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):_=!0,_){if(t.conversationType===S.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!l&&t.conversationType!==S.CONV_SYSTEM){var h=t.conversationID.replace(S.CONV_GROUP,"");this._pollingInstanceMap.has(h)?this._groupModule.isLoggedIn()&&s.addMessageSequence({key:Ca,message:t}):(t.type!==S.MSG_GRP_TIP&&t.clientTime>0&&s.addMessageDelay(t.clientTime),s.addMessageSequence({key:Ia,message:t}))}n.push(t)}}}else xe.w("".concat(this._n,".onMessage unknown event:").concat(u.event))}if(0!==n.length){this._groupModule.filterModifiedMessage(n);var f=this.packConversationOption(n);if(f.length>0)this._getModule(Fn).onNewMessage({conversationOptionsList:f,isInstantMessage:!0});xe.d("".concat(this._n,".onMessage count:").concat(n.length)),this._checkMessageStacked(n);var v=this._groupModule.filterUnmodifiedMessage(n);v.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,v),n.length=0}}}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.groupJoinType||(e.groupJoinType=1);var t=e.operatorInfo,n=void 0===t?{}:t,o=e.operatorID,s=e.userIDList,a=void 0===s?[]:s,r=n.userID,i=void 0===r?o:r,u=n.avatar,c=void 0===u?"":u,l=n.nick,p=void 0===l?"":l;e.operatorInfo={userID:i,avatar:c,nick:p};var d=a.map((function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||d,e}},{key:"restoreMessageFromSimplified",value:function(e){var n=e.event;if(this.isBroadcastOrNormal(n)&&(e.cloudCustomData=e.cloudCustomData||"",e.elements=e.elements.map((function(e){if(e.type===S.MSG_CUSTOM){var n=e.content,o=void 0===n?{}:n;e.content=t({data:"",description:"",extension:""},o)}return e}))),(this.isGroupTip(n)||this.isGroupSystemNotice(n))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(n)){e.elements=this.restoreGroupTipElements(e.elements);var o=e.elements,s=void 0===o?{}:o,a=s.operationType,i=s.operatorInfo;if(1===a){var u=[{userID:(void 0===i?{}:i).userID}];s.memberInfoList=s.memberInfoList||u}}if(this.isGroupSystemNotice(n)){var c=e.elements,l=c.memberInfoList,p=c.operatorInfo;l||(l=void 0===p?{}:p),e.elements.memberInfoList=t({userID:e.elements.operatorID,avatar:"",nick:""},l),e.elements=t({authentication:"",remarkInfo:"",messageKey:1e3*e.time},e.elements);var d=Object.keys(e.elements).filter((function(e){return"operatorInfo"!==e})).reduce((function(n,o){return t(t({},n),{},r({},o,e.elements[o]))}),{});e.elements=d}return e}},{key:"_onGroupDismissed",value:function(e){xe.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="MessageStacked",n=e.length;n>=100&&(this._groupModule.outputWarning(t,n),this._reportMessageStackedCount<5&&(new ka(t).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(n," groupID:").concat(m(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(Fn).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?S.CONV_SYSTEM:S.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new Ha(e),o=this.packElements(e,t);return n.setElement(o,this._groupModule.getFileDownloadProxy()),n}},{key:"packElements",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),{type:S.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:S.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(Hn).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new Rr({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),xe.l("".concat(this._n,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,s=o.groupID;return t._joinedGroupMap.set(s,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(s),t._groupModule.emitGroupListUpdate(!0,!1),at(n)?za({status:Ye,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,s=e.startSeq,a=void 0===s?0:s,r=o.groupID;return t._pollingRequestInfoMap.set(r,{key:n,startSeq:a}),t.start(r),t._groupModule.isLoggedIn()?za({status:Ye,group:o}):za({status:Ye})}))}},{key:"_preCheck",value:function(){if(this._getModule(qn).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=v(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===S.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._n,".").concat("joinWithoutAuth"),s=new ka("joinWithoutAuth");return this._groupModule.request({protocolName:Qo,requestData:e}).then((function(e){var a=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=v(e,2);t[0];var o=t[1];s.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(a)).end(!0)})),at(a))return Ja({code:da.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});xe.l("".concat(o," ok. groupID:").concat(n)),t._getModule(Fn).setCompleted("".concat(S.CONV_GROUP).concat(n));var r=new dr({groupID:n});return t.startRunLoop({group:r,longPollingKey:a}),Ka({status:Ye})})).catch((function(e){return xe.e("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=v(t,2),a=o[0],r=o[1];s.setError(e,a,r).setMessage("groupID:".concat(n)).end(!0)})),Ja(e)})).finally((function(){t._groupModule.getModule(Vn).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return jt(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return Ka({memberCount:e.memberCount})})).catch((function(e){return Ja(e)}))):za({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount");return this._groupModule.request({protocolName:fs,requestData:{groupID:e}}).then((function(o){var s=t._onlineMemberCountMap.get(e)||{},a=o.data,r=a.onlineMemberNum,i=void 0===r?0:r,u=a.expireTime,c=void 0===u?t.DEFAULT_EXPIRE_TIME:u;xe.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(c));var l=Date.now();return jt(s)&&(s.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(s,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:c})),{memberCount:i}})).catch((function(o){return xe.w("".concat(n," failed. error:"),o),new ka("_getGroupOnlineMemberCount").setCode(o.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){at(e)||($e(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){at(e)||($e(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){at(e)||($e(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){at(e)||"0"!==e&&"1"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){var t=e.payload.groupProfile.groupID;xe.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"restartPolling",value:function(){xe.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=D(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(o){t.e(o)}finally{t.f()}}},{key:"getPollingTimerID",value:function(e){if(!this._pollingInstanceMap.has(e))return-1;var t=this._pollingInstanceMap.get(e).getPollingTimerID();return xe.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t}},{key:"reset",value:function(e){if(e){xe.l("".concat(this._n,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{xe.l("".concat(this._n,".reset all"));var n,o=D(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(s){o.e(s)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),Gr=1,Ur=15,Pr=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}return a(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;xe.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length));var s=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),a=s.eventDataList,r=s.result;a.length>0&&(this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:a,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:o}));o?r.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,r):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,s=null,a=n.length,r=0,i=[],u={conversationID:S.CONV_SYSTEM,unreadCount:0,type:S.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r0?[u]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(Fn).getLocalMessageList(S.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,s=n.operatorID,a=n.operationType,r=n.groupProfile;if(a===Gr){var i="".concat(s,"_").concat(r.groupID,"_").concat(r.to),u=e.pendencyMap.get(i);u&&$e(u.handled)&&0!==u.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return st(e.messageList)&&0!==e.messageList.length?(xe.l("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:gs,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:S.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){xe.l("".concat(n," ok"));var o=t._groupModule.getModule(Fn);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),Ka()})).catch((function(e){return xe.e("".concat(n," error:"),e),Ja(e)}))):za()}},{key:"_getPendencyList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,o=void 0===n?void 0:n,s=t.startTime,a=void 0===s?0:s,r=t.limit,i=void 0===r?20:r;return this._groupModule.request({protocolName:ds,requestData:{type:o,startTime:a,limit:i,handleAccount:this._groupModule.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(m(n),m(e))})):n}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:S.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,m(n)),e._handlePendencyResult(t)})).catch((function(n){return e._handlePendencyResult(t)}))}))}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach((function(e){t.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID})})),za({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(bn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(S.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(bn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(S.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(Fn).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,s=e.elements,a=s.operationType,r=s.topicIDList,i=s.messageRemindType,u=this._groupModule.getModule(wn);17===a?u.onTopicCreated({groupID:n,topicID:o}):18===a?u.onTopicDeleted({groupID:n,topicIDList:r}):20===a&&u.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),br=["relayFlag"],wr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Mr(_(t)),t._groupAttributesHandler=new Er(_(t)),t._groupCountersHandler=new Ar(_(t)),t._AVChatRoomHandler=new Or(_(t)),t._groupTipsHandler=new mr(_(t)),t._groupSystemNoticeHandler=new Pr(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),o=this.getCloudConfig("polling_simplified_msg");this._AVChatRoomHandler&&(xe.l("".concat(this._n,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===S.CONV_GROUP){var n=Dt(e.to)?qt(e.to):e.to;return this.hasLocalGroup(n)?za():this.getGroupProfile({groupID:n}).then((function(o){var s=o.data.group.type;if(xe.l("".concat(t._n,".guardForAVChatRoom. groupID:").concat(n," type:").concat(s)),s===S.GRP_AVCHATROOM){var a=da.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;return Ja(new Wa({code:a,message:t.getErrorMessage(a,e.from,n),data:{message:e}}))}return za()}))}return za()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(st(e)){var n=this.getModule(wn);e.forEach((function(e){var o=e.conversationID.replace(S.CONV_GROUP,"");Dt(o)&&n.updateLastMessage(o,e.lastMessage),t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!at(n)){var o=t.getModule(Fn);n.forEach((function(e){var n=e.groupID,s=e.topicID,a=void 0===s?void 0:s,r=e.lastMessageSeq;xe.d("".concat(t._n,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(r));var i="".concat(S.CONV_GROUP).concat(n),u=!0;jt(a)||(i="".concat(S.CONV_GROUP).concat(a),u=!1),o.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),o.updateUnreadCount(i,u),o.clearGroupAtInfoList(i,u)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;xe.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,s=n.groupID,a=t.getModule(Fn),r=o.readReceiptList;a.updateReadReceiptInfo({groupID:s,readReceiptList:r})}))}},{key:"onGroupMessageModified",value:function(e){xe.d("".concat(this._n,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(Fn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:S.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new dr(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(Fn);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new dr(e)),o.deleteGroupRomaingMessageInfo(t))}));var s,a=this.getMyUserID(),r=D(this.groupMap);try{for(r.s();!(s=r.n()).done;){var i=v(s.value,2)[1];i.selfInfo.userID=a,"Owner"===i.selfInfo.role&&(i.ownerID=a)}}catch(u){r.e(u)}finally{r.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(xn).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Ct(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(xn).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return m(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=m(this.groupMap).filter((function(e){var t=v(e,2);return t[0],!jt(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(m(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(E.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),s=this.getModule(Fn);s.updateConversationGroupProfile(o)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Fn),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),xe.l("".concat(this._n,".patchGroupMessageRemindType count:").concat(n))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Fn);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,s=o.excludedUnreadSequenceList,a=o.readedSequence;if(st(s)){var r=0;s.forEach((function(t){t>=a&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(S.CONV_GROUP).concat(n),count:r})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):za()}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),o=new ka("getGroupProfile"),s=e.groupID,a=e.groupCustomFieldFilter;xe.l("".concat(n," groupID:").concat(s));var r={groupIDList:[s],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],groupCustomFieldFilter:a,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(r).then((function(e){var a,r=e.data,i=r.successGroupList,u=r.failureGroupList;if(xe.l("".concat(n," ok")),u.length>0)return Ja(u[0]);(Ct(i[0].type)&&!t.hasLocalGroup(s)?a=new dr(i[0]):(t.updateGroupMap(i),a=t.getLocalGroupProfile(s)),a.isSupportTopic)||t.getModule(Fn).updateConversationGroupProfile([a]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," type:").concat(a.type," muteAllMembers:").concat(a.muteAllMembers," ownerID:").concat(a.ownerID)).end(),Ka({group:a})})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],r=n[1];o.setError(s,a,r).setMessage("groupID:".concat(e.groupID)).end()})),xe.e("".concat(n," failed. error:"),s),Ja(s)}))}},{key:"getGroupProfileAdvance",value:function(e){var n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList;st(o)&&o.length>50&&(this.outputWarning("GetGroupProfileLimit"),o.length=50);var s=[],a=[];o.forEach((function(e){Tt({groupID:e})?a.push(e):s.push(e)}));var r=[];if(s.length>0){var i=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));r.push(i)}if(a.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:a,relayFlag:s.length>0}));r.push(u)}return Promise.all(r).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,m(e.successGroupList)),n.push.apply(n,m(e.failureGroupList))})),Ka({successGroupList:t,failureGroupList:n})})).catch((function(e){return xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,s=g(e,br);return this.request({protocolName:Yo,requestData:s}).then((function(e){xe.l("".concat(t._n,"._getGroupProfileAdvance ok."));var n=e.data.groups;return{successGroupList:n.filter((function(e){return at(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new Wa({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&Tt({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:Ja(t)}))}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("createGroup"),s=e.type,a=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Ja({code:da.PROFANITY_FOUND});if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(s))return Ja({code:da.ILLEGAL_GROUP_TYPE});if(!Tt({type:s})){if(!jt(a)&&Tt({groupID:a}))return Ja({code:da.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Ct(s)&&!at(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(s)||at(e.joinOption)||(e.joinOption=void 0),Tt({type:s})){if(!jt(a)&&!Tt({groupID:a}))return Ja({code:da.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new ka("createGroup");xe.l("".concat(o," options:"),e);var i=null,u=[];return this.request({protocolName:jo,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(s){var a=s.data,c=a.groupID,l=a.overLimitUserIDList,p=void 0===l?[]:l;if(i=c,u=p,r.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(p)).end(),xe.l("".concat(o," ok groupID:").concat(c," overLimitUserIDList:"),p),e.type===S.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===S.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});jt(e.memberList)||jt(p)||(e.memberList=e.memberList.filter((function(e){return-1===p.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var d=n.getModule(Rn),g=d.createCustomMessage({to:c,conversationType:S.CONV_GROUP,payload:{data:"group_create",extension:n.isIntl()?"".concat(n.getMyUserID()," created a group"):"".concat(n.getMyUserID(),"创建群组")}});return d.sendMessageInstance(g),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,s=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:s,messageRemindType:S.MSG_REMIND_ACPT_AND_NOTE,role:S.GRP_MBR_ROLE_OWNER}),Ka({group:t,overLimitUserIDList:u})})).catch((function(s){if(r.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var t=v(e,2),n=t[0],o=t[1];r.setError(s,n,o).end()})),10010===s.code||10007===s.code){n.updateGroupMap([t(t({},e),{},{groupID:i})]);var a=n.getLocalGroupProfile(i);return xe.l("".concat(o," success, but failed to get group profile.")),Ka({group:a,overLimitUserIDList:u})}return xe.e("".concat(o," failed. error:"),s),Ja(s)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===S.GRP_WORK)return Ja(new Wa({code:da.CANNOT_DISMISS_WORK}));var o=new ka("dismissGroup");return o.setMessage("groupID:".concat(e)),xe.l("".concat(n," groupID:").concat(e)),this.request({protocolName:zo,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ka({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateGroupProfile");if(this.hasLocalGroup(e.groupID)){var o=this.getLocalGroupProfile(e.groupID).type;this._canIUseJoinOption(o)||at(e.joinOption)||(xe.w("".concat(n," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)}if(at(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Ja({code:da.PROFANITY_FOUND});var s=new ka("updateGroupProfile");return s.setMessage(JSON.stringify(e)),xe.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:Jo,requestData:e}).then((function(){(s.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return Ka({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.l("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,s="".concat(this._n,".joinGroup");if(o===S.GRP_WORK)return Ja({code:da.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return za({status:S.JOIN_STATUS_ALREADY_IN_GROUP});var a=new ka("applyJoinGroup");return this.getGroupProfile({groupID:n}).then((function(){return a.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(S.JOIN_STATUS_ALREADY_IN_GROUP)).end(),za({status:S.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return a.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),xe.w("".concat(s," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return xe.l("".concat(s," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("applyJoinGroup"),s=e.groupID;if(!jt(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return Ja({code:da.PROFANITY_FOUND});var a=new ka("applyJoinGroup"),r=t({},e),i=this.canIUse(B.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(Fn).deleteTopicRoamingMessageInfo(s),this.request({protocolName:Xo,requestData:r}).then((function(e){var t=e.data,r=t.joinedStatus,u=t.longPollingKey,c=t.startSeq,l=t.avChatRoomFlag,p=t.avChatRoomKey,d=t.messageList,g="groupID:".concat(s," joinedStatus:").concat(r," longPollingKey:").concat(u," startSeq:").concat(c)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(i,",")+" history message count:".concat(jt(d)?0:d.length);switch(a.setNetworkType(n.getNetworkType()).setMessage("".concat(g)).end(),xe.l("".concat(o," ok. ").concat(g)),r){case je:return Ka({status:je});case Ye:return n.getGroupProfile({groupID:s}).then((function(e){var t=e.data.group;return n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:p,messageList:d})})).catch((function(){var e=new dr({groupID:s});return n._handleJoinResult({group:e,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:p,messageList:d})}));default:var _=new Wa({code:da.JOIN_GROUP_FAIL});return xe.e("".concat(o," failed. error:"),_),Ja(_)}})).catch((function(e){return a.setMessage("groupID:".concat(s)),n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"_handleJoinResult",value:function(e){var t,n=this,o=e.group,s=e.avChatRoomFlag,a=e.longPollingKey,r=e.startSeq,i=e.avChatRoomKey,u=e.messageList,c=o.groupID;return 1===s?(this.getModule(Fn).setCompleted("".concat(S.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:i}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:i}),(t=at(a)?this._AVChatRoomHandler.handleJoinResult({group:o}):this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:a,startSeq:r})).then((function(){n._onAVChatRoomHistoryMessage(u)})),t):(this.emitGroupListUpdate(!0,!1),Ka({status:Ye,group:o}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("quitGroup");xe.l("".concat(n," groupID:").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e))return Ja({code:da.MEMBER_NOT_IN_GROUP});if(o&&!this.isLoggedIn())return xe.l("".concat(n," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),za({groupID:e});var s=new ka("quitGroup");return s.setMessage("groupID:".concat(e)),this.request({protocolName:Zo,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ka({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._n,".").concat("searchGroupByID"),o={groupIDList:[e]},s=new ka("searchGroupByID");return s.setMessage("groupID:".concat(e)),xe.l("".concat(n," groupID:").concat(e)),this.request({protocolName:$o,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new Wa({code:o[0].errorCode,message:o[0].errorInfo});return s.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),Ka({group:new dr(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.w("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(this._n,".").concat("changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===S.GRP_AVCHATROOM)return Ja({code:da.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return Ja({code:da.CANNOT_CHANGE_OWNER_TO_SELF});var o=new ka("changeGroupOwner");return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),xe.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:es,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok"));var s=e.groupID,a=e.newOwnerID;t.groupMap.get(s).ownerID=a;var r=t.getModule(bn).getLocalGroupMemberList(s);if(r instanceof Map){var i=r.get(t.getMyUserID());at(i)||(i.updateRole("Member"),t.groupMap.get(s).selfInfo.role="Member");var u=r.get(a);at(u)||u.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),Ka({group:t.groupMap.get(s)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,s,a,r=this,i="".concat(this._n,".").concat("handleGroupApplication"),u=e.handleAction,c=e.handleMessage,l=e.message,p=e.application;l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,s=l.payload.messageKey):p&&(t=p.applicant,n=p.groupID,o=p.authentication,s=p.messageKey);var d=ts;p&&2===p.applicationType&&(d=ns,a=p.userID);var g=new ka("handleGroupApplication");return g.setMessage("groupID:".concat(n)),xe.l("".concat(i," groupID:").concat(n)),this.request({protocolName:d,requestData:{handleAction:u,handleMessage:c,applicant:t,invitee:a,groupID:n,authentication:o,messageKey:s}}).then((function(){return g.setNetworkType(r.getNetworkType()).end(),xe.l("".concat(i," ok")),l&&r._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ka({group:r.getLocalGroupProfile(n)})})).catch((function(e){return r.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];g.setError(e,o,s).end()})),xe.e("".concat(i," failed. error"),e),Ja(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._n,".").concat("handleGroupInvitation"),s=e.message.payload,a=s.groupProfile.groupID,r=s.authentication,i=s.messageKey,u=s.operatorID,c=e.handleAction,l=new ka("handleGroupInvitation");return l.setMessage("groupID:".concat(a," inviter:").concat(u," handleAction:").concat(c)),xe.l("".concat(o," groupID:").concat(a," inviter:").concat(u," handleAction:").concat(c)),this.request({protocolName:os,requestData:t(t({},e),{},{inviter:u,groupID:a,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),xe.l("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ka({group:n.getLocalGroupProfile(a)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),xe.e("".concat(o," failed. error"),e),Ja(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):za({memberCount:0}):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(xe.l("".concat(this._n,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(Fn).deleteLocalConversation("".concat(S.CONV_GROUP).concat(e));if(Tt({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(wn).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(bn).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){if(st(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(B.MSG_TO_SPECIFIED_GRP_MBR))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=void 0;st(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),this.outputWarning("ReceiverListLimit")));var l=this.isOnlineMessage(e,t)?1:0,p=e.getGroupAtInfoList(),d={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==S.MSG_TEXT||jt(p)?void 0:p,onlineOnlyFlag:l,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0===l?s:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return Dt(e.to)&&(d.groupID=qt(e.to),d.topicID=e.to),{protocolName:ho,tjgID:this.generateTjgID(e),requestData:d}}},{key:"_isVoipPush",value:function(e){var t=void 0;return at(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Dt(e.to)&&(t.groupID=qt(e.to),t.topicID=e.to),this.request({protocolName:ss,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;xe.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return Dt(t)&&(o.groupID=qt(t),o.topicID=t),this.request({protocolName:vs,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,s=e.type,a=e.version,r=void 0===a?0:a,i=e.cloudCustomData,u=t,c=void 0;Dt(t)&&(u=qt(t),c=t);var l=void 0;return Vt(s)&&(l=[]).push({type:s,content:o}),this.request({protocolName:ms,requestData:{groupID:u,topicID:c,sequence:n,version:r,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.conversationID,s=e.groupID,a=e.sequence,r=new ka("getGroupRoamingMessages"),i=0,u=void 0;return Dt(s)&&(s=qt(u=s)),this._computeLastSequence({groupID:s,topicID:u,sequence:a}).then((function(e){return i=e,xe.l("".concat(n," groupID:").concat(s," startSequence:").concat(i)),t.request({protocolName:is,requestData:{groupID:s,count:21,sequence:i,topicID:u}})})).then((function(e){var a=e.data,c=a.messageList,l=a.complete,p=a.invisibleSequenceList,d=void 0===p?[]:p;at(c)?xe.l("".concat(n," ok. complete:").concat(l," but messageList is undefined!")):xe.l("".concat(n," ok. complete:").concat(l," count:").concat(c.length));var g=t._getMinSequence(d,c)-1;r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(i," complete:").concat(l," nextSequence:").concat(g)).end();var _=t.getModule(Fn),h=[];return jt(c)||(_.updateRoamingMessageSequence(o,g),h=_.onRoamingMessage(c,o),_.updateIsRead(o),_.patchConversationLastMessage(o)),(2===l||g<=1)&&(_.setCompleted(o),g=""),xe.l("".concat(n," nextReqID:").concat(g,", stored message count:").concat(h.length,", invisible sequence count:").concat(d.length)),{nextReqID:g+"",storedMessageList:h}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(i)).end()})),xe.w("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(S.CONV_GROUP,"")}},{key:"_getMinSequence",value:function(e,t){var n=0;jt(t)||(n=t[t.length-1].sequence);var o=0;jt(e)||(o=e[e.length-1]);return xe.l("".concat(this._n,"._getMinSequence minVisibleSequence:").concat(n," minInvisibleSequence:").concat(o)),o>0&&o=100?100:a,_="groupID:".concat(r," sequence:").concat(u," cursor:").concat(d," filter:").concat(p," completeFlag:").concat(l);xe.l("".concat(c," ").concat(_));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new ka("getReadReceiptDetail");return f.setMessage(_),this.request({protocolName:ps,requestData:{groupID:r,sequence:u,flag:p,cursor:d,count:g}}).then((function(e){f.end();var n=e.data,o=n.cursor,s=n.isCompleted,a=n.unreadUserIDList,r=n.readUserIDList;return h.cursor=o,1===s&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===p?h.readUserIDList=r.map((function(e){return e.userID})):1===p&&(h.unreadUserIDList=a.map((function(e){return e.userID}))),xe.l("".concat(c," ok")),Ka(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];f.setError(e,o,s).end()})),xe.w("".concat(c," failed. error:"),e),Ja(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=new ka("getGroupRoamingMessagesHopping"),s=e.groupID,a=e.count,r=e.sequence,i=e.direction,u=r;1===i&&(u=r+a-1);var c=void 0;Dt(s)&&(s=qt(c=s));var l="".concat(c?"topicID:".concat(c):"groupID:".concat(s)," sequence:").concat(r," direction:").concat(i);return xe.l("".concat(n," ").concat(l)),this.request({protocolName:is,requestData:{groupID:s,topicID:c,count:a,sequence:u}}).then((function(s){var a=s.data,u=a.messageList,c=a.complete,p="complete:".concat(c," count:").concat(u?u.length:0);if(xe.l("".concat(n," ok. ").concat(p)),o.setNetworkType(t.getNetworkType()).setMessage("".concat(l," ").concat(p)).end(),2===c||jt(u)){var d=t._computeResult();return Ka(d)}var g="".concat(S.CONV_GROUP).concat(e.groupID),_=t.getModule(Fn).onRoamingMessage(u,g,!1),h=t._computeResult({direction:i,sequence:r,remoteMessageList:u,processedMessageList:_});return Ka(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),i=n[0],u=n[1];o.setError(e,i,u).setMessage("groupID:".concat(s," sequence:").concat(r," count:").concat(a)).end()})),xe.w("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(at(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,s=e.remoteMessageList,a=void 0===s?[]:s,r=e.processedMessageList,i=void 0===r?[]:r,u=a.length;return 1===n?(t.nextMessageSeq=a[0].sequence+1,i.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),0===t.messageList.length&&a[0].sequence0?Promise.resolve(s):at(o)||this.hasLocalGroup(t)?at(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupLastSequence"),o=new ka("getGroupLastSequence"),s=0,a="";if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),i=r.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return s=i.lastSequence,a="got lastSequence:".concat(s," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),xe.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s);if(r.nextMessageSeq>1)return s=r.nextMessageSeq-1,a="got lastSequence:".concat(s," from local group profile[nextMessageSeq]. groupID:").concat(e),xe.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s)}var u="GROUP".concat(e),c=this.getModule(Fn).getLocalConversation(u);if(c&&c.lastMessage.lastSequence&&!1===c.lastMessage.onlineOnlyFlag)return s=c.lastMessage.lastSequence,a="got lastSequence:".concat(s," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),xe.l("".concat(n," ").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(a)).end(),Promise.resolve(s);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(r){var i=r.data.successGroupList;return jt(i)?xe.l("".concat(n," successGroupList is empty. groupID:").concat(e)):(s=i[0].nextMessageSeq-1,a="got lastSequence:".concat(s," from getGroupProfileAdvance. groupID:").concat(e),xe.l("".concat(n," ").concat(a))),o.setNetworkType(t.getNetworkType()).setMessage("".concat(a)).end(),s})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],r=n[1];o.setError(s,a,r).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),xe.w("".concat(n," failed. error:"),s),Ja(s)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,n=e.groupID,o=e.topicID,s="".concat(this._n,".").concat("getTopicLastSequence"),a=new ka("getTopicLastSequence"),r=0,i="",u=this.getModule(wn);return u.hasLocalTopic(n,o)?(r=u.getLocalTopic(n,o).nextMessageSeq-1,i="get lastSequence:".concat(r," from local topic info[nextMessageSeq]. topicID:").concat(o),xe.l("".concat(s," ").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(r)):u.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return jt(n)?xe.l("".concat(s," successTopicList is empty. topicID:").concat(o)):(r=n[0].nextMessageSeq-1,i="get lastSequence:".concat(r," from getTopicList. topicID:").concat(o),xe.l("".concat(s," ").concat(i))),a.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],r=n[1];a.setError(e,s,r).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o)).end()})),xe.w("".concat(s," failed. error:"),e),Ja(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==S.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!jt(e)){xe.l("".concat(this._n,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new ka("getGroupSimplifiedInfo"),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var s=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(s[0].type)).end(),s[0]})).catch((function(o){t.probeNetwork().then((function(t){var s=v(t,2),a=s[0],r=s[1];n.setError(o,a,r).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,t){return 2===e&&!jt(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&jt(t)}},{key:"getMessageExtensions",value:function(e,t){return xe.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Es,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return xe.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Ds,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"getGroupNotify",value:function(e){var n=this;if(this.hasLocalGroup(e)){var o=this.getLocalGroupProfile(e),s=o.type,a=o.isSupportTopic;if(!Ct(s)&&!a){var r="".concat(this._n,".getGroupNotify"),i=this._getGroupLastRevokedTime(e),u=1e3*Ue();xe.l("".concat(r," groupID:").concat(e," type:").concat(s," beginTime:").concat(i," endTime:").concat(u)),this.request({protocolName:Ss,requestData:{type:Tt({type:s,groupID:e})?S.GRP_COMMUNITY:void 0,groupID:e,beginTime:i,endTime:u}}).then((function(o){var s=o.data,a=s.nextRevokedTime,i=s.notifyList;xe.l("".concat(r," ok. groupID:").concat(e," nextRevokedTime:").concat(a));var u={dataList:[{elements:{revokedInfos:[]}}]};st(i)&&i.forEach((function(n){u.dataList[0].elements.revokedInfos.push({groupID:e,sequence:n.sequence,random:n.random,revokerInfo:t({},n.revokerInfo)})})),n.onGroupMessageRevoked(u),0!==a?(n._setGroupLastRevokedTime(e,a),n.getGroupNotify(e)):n._setGroupLastRevokedTime(e,1e3*Ue())})).catch((function(e){xe.e("".concat(r," failed. error:"),e)}))}}}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler&&this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&Ct(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return function(e){return e===S.GRP_PUBLIC}(e)||Tt({type:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),s}(ro),Fr=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return a(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&It(this.memberCustomField,e.memberCustomField),pt(this,e,["memberCustomField","marks"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){at(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){at(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&It(this.memberCustomField,e)}}]),e}(),qr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(er,t._onProfileUpdated,_(t)),t}return a(s,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},s=0;s100?100:r};Tt({groupID:n})?_.next="".concat(s):(_.offset=s,g=s+r);var h=[];return this.request({protocolName:As,requestData:_}).then((function(e){var o=e.data,s=o.members,a=o.memberNum,r=o.next,i=void 0===r?void 0:r;if(at(i)||(g=jt(i)?0:i),!st(s)||0===s.length)return g=0,Promise.resolve([]);var u=t.getModule(Un);return u.hasLocalGroup(n)&&(u.getLocalGroupProfile(n).memberNum=a),h=t._updateLocalGroupMemberMap(n,s),t.getModule(On).getUserProfile({userIDList:s.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})})).then((function(e){var o=e.data;if(!st(o)||0===o.length)return za({memberList:[],offset:g});var a=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,a),h.length5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),xe.l("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var a=e.groupID,r=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return st(t)&&0!==t.length?(n._updateLocalGroupMemberMap(a,t),n.getModule(On).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})):za([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(a,t);var o=r.filter((function(e){return n.hasLocalGroupMember(a,e)})).map((function(e){return n.getLocalGroupMemberInfo(a,e)}));return s.setNetworkType(n.getNetworkType()).end(),Ka({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),o=e.groupID,s=this.getModule(Un).getLocalGroupProfile(o),a=s.type,r=new ka("addGroupMember");if(r.setMessage("groupID:".concat(o," groupType:").concat(a)),Ct(a)){var i=new Wa({code:da.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setError(i,!0,this.getNetworkType()).end(),Ja(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),xe.l("".concat(n," groupID:").concat(o)),this.request({protocolName:Os,requestData:e}).then((function(o){var a=o.data.members;xe.l("".concat(n," ok"));var i=a.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),u=a.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=a.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=a.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),p="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(i,", ")+"failureUserIDList:".concat(u,", ")+"existedUserIDList:".concat(c,", ")+"overLimitUserIDList:".concat(l);return r.setNetworkType(t.getNetworkType()).setMoreMessage(p).end(),0===i.length?Ka({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l}):(s.memberCount+=i.length,t._updateConversationGroupProfile(s),Ka({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l,group:s}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,a=this.getModule(Un).getLocalGroupProfile(o);if(at(a))return Ja({code:da.CANNOT_FIND_GROUP});if(Ct(a.type))return this.canIUse(B.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var r=new ka("deleteGroupMember"),i="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s));return r.setMessage(i),xe.l("".concat(n," groupID:").concat(o," userIDList:"),s),this.request({protocolName:Gs,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),a.memberCount-=1,t._updateConversationGroupProfile(a),t.deleteLocalGroupMembers(o,s),Ka({group:a,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(Fn).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,a="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s)),r=new ka("deleteGroupMember");r.setMessage(a),xe.l("".concat(n," groupID:").concat(o," userIDList:"),s);var i=this.getModule(Un).getLocalGroupProfile(o);return at(e.duration)||0===e.duration?Ja({code:da.BAN_DURATION_INVALID}):this.request({protocolName:Us,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,s),Ka({group:i,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,s=e.muteTime,a="".concat(this._n,".").concat("setGroupMemberMuteTime");if(o===this.getMyUserID())return Ja(new Wa({code:da.CANNOT_MUTE_SELF}));xe.l("".concat(a," groupID:").concat(n," userID:").concat(o));var r=new ka("setGroupMemberMuteTime");return r.setMessage("groupID:".concat(n," userID:").concat(o," muteTime:").concat(s)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:s}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(a," ok"));var o=t.getModule(Un);return Ka({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(a," failed. error:"),e),Ja(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberRole"),o=e.groupID,s=e.userID,a=e.role,r=this.getModule(Un).getLocalGroupProfile(o);if(r.selfInfo.role!==S.GRP_MBR_ROLE_OWNER)return Ja({code:da.NOT_OWNER});if([S.GRP_WORK,S.GRP_AVCHATROOM].includes(r.type))return Ja({code:da.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[S.GRP_MBR_ROLE_ADMIN,S.GRP_MBR_ROLE_MEMBER];if(Tt({groupID:o})&&i.push(S.GRP_MBR_ROLE_CUSTOM),i.indexOf(a)<0)return Ja({code:da.INVALID_MEMBER_ROLE});if(s===this.getMyUserID())return Ja({code:da.CANNOT_SET_SELF_MEMBER_ROLE});var u=new ka("setGroupMemberRole");return u.setMessage("groupID:".concat(o," userID:").concat(s," role:").concat(a)),xe.l("".concat(n," groupID:").concat(o," userID:").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:s,role:a}).then((function(e){return u.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok")),Ka({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],J),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberNameCard");if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return Ja({code:da.PROFANITY_FOUND});var o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,r=e.nameCard;xe.l("".concat(n," groupID:").concat(o," userID:").concat(a));var i=new ka("setGroupMemberNameCard");return i.setMessage("groupID:".concat(o," userID:").concat(a," nameCard:").concat(r)),this.modifyGroupMemberInfo({groupID:o,userID:a,nameCard:r}).then((function(e){xe.l("".concat(n," ok")),i.setNetworkType(t.getNetworkType()).end();var s=t.getModule(Un).getLocalGroupProfile(o);return a===t.getMyUserID()&&s&&s.setSelfNameCard(r),Ka({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberCustomField"),o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,r=e.memberCustomField;xe.l("".concat(n," groupID:").concat(o," userID:").concat(a));var i=new ka("setGroupMemberCustomField");return i.setMessage("groupID:".concat(o," userID:").concat(a," memberCustomField:").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:o,userID:a,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),xe.l("".concat(n," ok"));var s=t.getModule(Un).getLocalGroupProfile(o);return Ka({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,s=e.userID,a=void 0;return Dt(o)&&(o=qt(a=o)),this.request({protocolName:Ps,requestData:t(t({},e),{},{groupID:o,topicID:a})}).then((function(){if(n.hasLocalGroupMember(o,s)){var t=n.getLocalGroupMemberInfo(o,s);return at(e.muteTime)||t.updateMuteUntil(e.muteTime),at(e.role)||t.updateRole(e.role),at(e.nameCard)||t.updateNameCard(e.nameCard),at(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[s]}).then((function(e){return v(e.data.memberList,1)[0]}))}))}},{key:"markGroupMemberList",value:function(e){var t=this,n="".concat(this._n,".").concat("markGroupMemberList"),o=e.groupID,s=e.markType,a=e.enableMark,r=e.userIDList,i=void 0===r?[]:r,u="groupID:".concat(o," markType:").concat(s," enableMark:").concat(a," userIDList count: ").concat(i.length);xe.l("".concat(n," ").concat(u));var c=2,l=[];!0===a&&(c=1);var p=m(i);i.length>500&&(p=i.slice(0,500),xe.w("".concat(n," ").concat(Kt(500)))),p.forEach((function(e){l.push({userID:e,markType:[s]})})),p=null;var d=new ka("markGroupMemberList");return d.setMessage("".concat(u)),this.request({protocolName:bs,requestData:{groupID:o,operationType:c,memberList:l}}).then((function(e){var o=e.data.memberList,s=void 0===o?[]:o,a=[],r=[];s.length===i.length?a.push.apply(a,m(i)):(s.forEach((function(e){a.push(e.userID)})),i.forEach((function(e){a.includes(e)||r.push(e)})));var u="success count:".concat(a.length," fail count:").concat(r.length);return d.setNetworkType(t.getNetworkType()).setMessage(u).end(),xe.l("".concat(n," ok. ").concat(u)),Ka({successUserIDList:a,failureUserIDList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Ns,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return st(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new Fr(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),s}(ro),xr=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Vr=function(e,t){return jt(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:xt(e.type,e.payload,t),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},Br=function(){function e(t,n){o(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Vr(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return a(e,[{key:"_initTopic",value:function(e){for(var t in e)xr.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Vr(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){at(e.selfInfo)||this.updateSelfInfo(e.selfInfo),at(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),pt(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0!==pt(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),Hr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");at(e)||(this.TOPIC_CACHE_TIME=Number(e)),at(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(E.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(E.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,s=this.getLocalTopic(t,n);if(s){var a=s.updateSelfInfo({messageRemindType:o});a&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}),xe.d("".concat(this._n,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(a))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,s=qt(t),a=this.getLocalTopic(s,t),r=!1;a&&(at(n)||a.unreadCount===n||(a.updateUnreadCount(n),r=!0),at(o)||(a.updateGroupAtInfoList(o),r=!0)),r&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:s,topic:a})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,s=this.getLocalTopic(t,n);s&&(s.nextMessageSeq+=1,s.updateLastMessage(o),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,s=e.elements,a=e.cloudCustomData,r=e.messageVersion,i=qt(t),u=this.getLocalTopic(i,t);if(u){var c=u.lastMessage;xe.d("".concat(this._n,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(c),"options:",JSON.stringify(e)),c&&(null===c.payload||c.lastTime===n&&c.lastSequence===o&&c.version!==r)&&(c.type=s[0].type,c.payload=s[0].content,c.messageForShow=xt(c.type,c.payload,this.isIntl()),c.cloudCustomData=a,c.version=r,c.lastSequence=o,c.lastTime=n,this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u}))}}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=null,s=!1;e.forEach((function(e){var a=e.to;o=qt(a),(n=t.getLocalTopic(o,a))&&(n.reduceUnreadCount()&&(s=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),s=!0))})),s&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=e.sequence,o=qt(t),s=this.getLocalTopic(o,t),a=!1;return s&&(a=s.isLastMessageRevoked({sequence:n})),a}},{key:"getJoinedCommunityList",value:function(){return this.getModule(Un).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return Ka({groupList:void 0===t?[]:t})})).catch((function(e){return Ja(e)}))}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),s=e.topicID;if(!at(s)&&!Dt(s))return Ja({code:da.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity("topicName",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Ja({code:da.PROFANITY_FOUND});var a=new ka("createTopicInCommunity");return this.request({protocolName:$s,requestData:t({},e)}).then((function(s){var r=s.data.topicID;return a.setMessage("topicID:".concat(r)).setNetworkType(n.getNetworkType()).end(),xe.l("".concat(o," ok")),n._updateTopicMap([t(t({},e),{},{topicID:r})]),Ka({topicID:r})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),o=e.groupID,s=e.topicIDList,a=void 0===s?[]:s,r=new ka("deleteTopicFromCommunity");return r.setMessage("groupID:".concat(o," topicIDList:").concat(a)),this.request({protocolName:ea,requestData:{groupID:o,topicIDList:a}}).then((function(e){var n=e.data.resultList,s=[],a=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?s.push({topicID:t}):a.push({topicID:t,code:n,message:o})}));var i="success count:".concat(s.length,", fail count:").concat(a.length);return r.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),xe.l("".concat(i)),s.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),Ka({successTopicList:s,failureTopicList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateTopicProfile");if(xe.l("".concat(o," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Ja({code:da.PROFANITY_FOUND});var s=new ka("updateTopicProfile");return s.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),at(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:ta,requestData:t({},e)}).then((function(){return s.setNetworkType(n.getNetworkType()).end(),xe.l("".concat(o," ok")),n._updateTopicMap([e]),Ka({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._n,".").concat("getTopicList"),s=e.groupID,a=e.topicIDList,r=void 0===a?[]:a,i=0===r.length,u=new ka("getTopicList");if(u.setMessage("groupID:".concat(s)),this._getTopicTimeMap.has(s)){var c=this._getTopicTimeMap.get(s),l=c.isGetAll,p=c.time;if((l||!l&&!i)&&Date.now()-p<1e3*this.TOPIC_CACHE_TIME){var d=this._getLocalTopicList(s,r);if(i||d.length===r.length)return u.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(d.length)).end(),xe.l("".concat(o," groupID:").concat(s," from cache, topic count:").concat(d.length)),za({successTopicList:d,failureTopicList:[]})}}return this.request({protocolName:na,requestData:{groupID:s,topicIDList:r}}).then((function(e){var a=e.data.topicInfoList,r=[],c=[],l=[];(void 0===a?[]:a).forEach((function(e){var n=e.topic,o=e.selfInfo,s=e.errorCode,a=e.errorInfo,i=n.topicID;0===s?(r.push(t(t({},n),{},{selfInfo:o})),c.push(i)):l.push({topicID:i,code:s,message:a})})),n._updateTopicMap(r),n._handleTopicAtInfo(r);var p="success count:".concat(c.length,", fail count:").concat(l.length);u.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(p)).end(),xe.l("".concat(o," groupID:").concat(s," from remote, ").concat(p));var d=[];return jt(c)||(n._getTopicTimeMap.set(s,{time:Date.now(),isGetAll:i}),d=n._getLocalTopicList(s,c)),Ka({successTopicList:d,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=m(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),xe.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,s=e.topicID,a=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(s)?(a=t._topicMap.get(o).get(s)).updateTopic(e):(t._getTopicLastMessage(e),a=new Br(e,t.isIntl()),t._topicMap.get(o).set(s,a));var r=t._computeUnreadCount(a);a.updateUnreadCount(r),n.push({conversationID:"".concat(S.CONV_GROUP).concat(s),type:S.CONV_TOPIC,unreadCount:r})})),n.length>0)&&this.getModule(Fn).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;at(e)?m(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=m(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,s=void 0===n?0:n;Date.now()-1e3*s<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),xe.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),s=new ka("relayGetTopicList");s.setMessage(o),xe.l("".concat(this._n,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){s.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),o=t[0],a=t[1];s.setError(n,o,a).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,s=e.topicID,a=e.groupAtInfoList,r=[];at(a)||(a.forEach((function(e){r.push(t(t({},e),{},{groupID:o,topicID:s}))})),n.getModule(Fn).onNewGroupAtTips({dataList:r}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!at(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:jt(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(Fn);n.forEach((function(n){var s=n.topicID;t._deleteLocalTopic(e,s),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(S.CONV_GROUP).concat(s))}))}},{key:"_computeUnreadCount",value:function(e){var t=e.selfInfo,n=t.excludedUnreadSequenceList,o=t.readedSequence,s=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(st(n)){var a=0;n.forEach((function(t){t>=o&&t<=e.nextMessageSeq-1&&(a+=1)})),a>=1&&(s-=a)}return s<0?0:s}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"updateLastMessage",value:function(e,t){var n=qt(e),o=this.getLocalTopic(n,e);if(o){var s=t.sequence+1;o.updateNextMessageSeq(s),o.updateLastMessage(t),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"getMessageExtensions",value:function(e,t){xe.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=qt(e.to);return this.request({protocolName:Es,requestData:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;xe.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n));var o=qt(e.to);return this.request({protocolName:Ds,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),s}(ro),Kr=function(){function e(t){o(this,e),this._userModule=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return a(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserProfile"),o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(xe.w("".concat(n," ").concat(Kt(100))),o.length=100);for(var s,a=[],r=[],i=0,u=o.length;i5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:fo,requestData:e}).then((function(e){p.setNetworkType(t._userModule.getNetworkType()).end(),xe.i("".concat(n," ok"));var o=t._handleResponse(e).concat(r);return Ka(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount(),t="".concat(this._n,".getMyProfile");if(xe.l("".concat(t," myAccount:").concat(e)),this._fill(),this._contains(e)){var n=this._getProfileFromMap(e);return xe.d("".concat(t," from cache, myProfile:").concat(JSON.stringify(n))),za(n)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!st(t))return[];for(var n=[],o=Date.now(),s=0,a=t.length;s-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case Be.NICK:n.nick=t[o].value;break;case Be.GENDER:n.gender=t[o].value;break;case Be.BIRTHDAY:n.birthday=t[o].value;break;case Be.LOCATION:n.location=t[o].value;break;case Be.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Be.ALLOWTYPE:n.allowType=t[o].value;break;case Be.LANGUAGE:n.language=t[o].value;break;case Be.AVATAR:n.avatar=t[o].value;break;case Be.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Be.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Be.LEVEL:n.level=t[o].value;break;case Be.ROLE:n.role=t[o].value;break;default:xe.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateMyProfile");if(e.nick&&!1===this._userModule.filterProfanity("nick",e))return Ja({code:da.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity("selfSignature",e))return Ja({code:da.PROFANITY_FOUND});var o=new ka("updateMyProfile");o.setMessage(JSON.stringify(e));var s=(new ur).validate(e);if(!s.valid)return o.setCode(da.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(s.tips)).setNetworkType(this._userModule.getNetworkType()).end(),xe.e("".concat(n," info:").concat(s.tips)),Ja({code:da.UPDATE_PROFILE_INVALID_PARAM});var a=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&("profileCustomField"===r?e.profileCustomField.forEach((function(e){a.push({tag:e.key,value:e.value})})):a.push({tag:Be[r.toUpperCase()],value:e[r]}));if(0===a.length){var i=new Wa({code:da.UPDATE_PROFILE_NO_KEY});return o.setError(i,!0,this._userModule.getNetworkType()).end(),xe.e("".concat(n," failed. error:"),i),Ja(i)}var u=this._userModule.getMyAccount();return this._userModule.request({protocolName:vo,requestData:{fromAccount:u,profileItem:a}}).then((function(s){o.setNetworkType(t._userModule.getNetworkType()).end(),xe.i("".concat(n," ok"));var a=t._update(u,e),r=a.isProfileUpdated,i=a.latestProfile;return!0===r&&t._userModule.emitOuterEvent(E.PROFILE_UPDATED,[i]),za(i)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!jt(t)){var n,o=t.length;xe.d("".concat(this._n,".onProfileModified count:").concat(o," dataList:"),e.dataList);for(var s=[],a=0;a0&&(this._userModule.emitInnerEvent(er,s),this._userModule.emitOuterEvent(E.PROFILE_UPDATED,s))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n0&&(n.lastUpdatedTime=s,o=!0)):(n=new ur(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=s,o=!0,this.accountProfileMap.set(e,n)));return this._flush(e===this._userModule.getMyAccount()),xe.l("".concat(this._n,"._update account:").concat(e," isProfileUpdated:").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=m(this.accountProfileMap.values()),n=this._userModule.getStorageModule();xe.d("".concat(this._n,"._flush length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_contains",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return jt(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,o,s=[],a=0,r=e.length;a0&&s.push(n)):s.push(t.userID));0!==s.length&&(xe.i("".concat(this._n,".onConversationsProfileUpdated toAccountList:").concat(s)),this.getUserProfile({userIDList:s}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._contains(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),e}(),Wr=a((function e(t){o(this,e),jt||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),Yr=function(){function e(t){o(this,e),this._userModule=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return a(e,[{key:"getLocalBlacklist",value:function(){return m(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._n,".getBlacklist"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new ka("getBlacklist");return this._userModule.request({protocolName:mo,requestData:n}).then((function(n){var s=n.data,a=s.blackListItem,r=s.currentSequence,i=jt(a)?0:a.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("count:".concat(i)).end(),xe.i("".concat(t," ok")),e.currentSequence=r,e._handleResponse(a,!0),e._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()})),xe.e("".concat(t," failed. error:"),n),Ja(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n=new ka("addToBlacklist"),o="".concat(this._n,".addBlacklist"),s=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===s){var a=da.CANNOT_ADD_SELF_TO_BLACKLIST,r=this._userModule.getErrorMessage(a);n.setCode(a).setMessage(r).setNetworkType(this._userModule.getNetworkType()).end();var i=new Wa({code:a});return xe.e("".concat(o," failed. error:"),i),Ja(i)}return e.userIDList.includes(s)&&(e.userIDList=e.userIDList.filter((function(e){return e!==s}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Mo,requestData:e}).then((function(s){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),xe.i("".concat(o," ok")),t._handleResponse(s.resultItem,!0),Ka(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=v(t,2),s=o[0],a=o[1];n.setError(e,s,a).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"_handleResponse",value:function(e,t){if(!jt(e))for(var n,o,s,a=0,r=e.length;a5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),xe.i("".concat(n," ok")),t._handleResponse(s.data.resultItem,!1),Ka(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(xe.l("".concat(this._n,".onAccountDeleted count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(xe.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),jr=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,s,a=0,r=0;s=t.charAt(r++);~s&&(o=a%4?64*o+s:s,a++%4)?n+=String.fromCharCode(255&o>>(-2*a&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);try{return decodeURIComponent(escape(n))}catch(i){return""}},zr=function(){function e(t){o(this,e),this._userModule=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),n=this._userModule.getCloudConfig("status_unsub_count");xe.l("".concat(this._n,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),at(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),at(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),at(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(qn),s=t.map((function(e){var t=e.to,s=e.statusType,a=e.customStatus,r=jr(a);return t===n&&o.setCustomStatus(r),{userID:t,statusType:s,customStatus:r}}));this._userModule.emitOuterEvent(E.USER_STATUS_UPDATED,s)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._n,".setSelfStatus");if(!1===this._userModule.filterProfanity("customStatus",e))return Ja({code:da.PROFANITY_FOUND});var o=new ka("setSelfStatus"),s=e.customStatus;return this._userModule.request({protocolName:oa,requestData:{customStatus:s}}).then((function(e){return o.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(s)).end(),xe.l("".concat(n," ok. customStatus:").concat(s)),t._userModule.getModule(qn).setCustomStatus(s),Ka({userID:t._userModule.getMyUserID(),statusType:1,customStatus:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._n,".getUserStatus"),o=e.userIDList,s=void 0===o?[]:o,a=this._userModule.getMyUserID(),r=m(s),i=void 0,u=r.indexOf(a);if(u>-1){r.splice(u,1);var c=this._userModule.getModule(qn).getCustomStatus();i={userID:a,statusType:1,customStatus:c}}if(0===r.length)return za({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(xe.w("".concat(n," ").concat(Kt(this.MAX_QUERY_USER_COUNT))),r=s.slice(0,this.MAX_QUERY_USER_COUNT));var l=new ka("getUserStatus");return this._userModule.request({protocolName:sa,requestData:{userIDList:r}}).then((function(e){var o=e.data,a=o.successUserList,r=void 0===a?[]:a,u=o.failureUserList,c=void 0===u?[]:u,p=r.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:jr(o)}})),d=c.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));at(i)||p.unshift(i);var g="userID count:".concat(s.length,", success count:").concat(p.length,", fail count:").concat(d.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),xe.l("".concat(n," ok. ").concat(g,".")),Ka({successUserList:p,failureUserList:d})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setMessage("userID count:".concat(s.length)).setError(e,o,a).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".subscribeUserStatus"),o=e.userIDList,s=void 0===o?[]:o,a=m(s);a.length>this.MAX_SUBSCRIBE_USER_COUNT&&(xe.w("".concat(n," ").concat(Kt(this.MAX_SUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new ka("subscribeUserStatus"),i="userID count:".concat(s.length);return xe.l("".concat(n," ").concat(i)),this._userModule.request({protocolName:aa,requestData:{userIDList:a}}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(s.length)).end(),xe.l("".concat(n," ok. fail count:").concat(s.length,".")),Ka({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setMessage("".concat(i)).setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".unsubscribeUserStatus"),o=(e||{}).userIDList,s=void 0===o?[]:o,a=m(s);s.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(xe.w("".concat(n," ").concat(Kt(this.MAX_UNSUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new ka("unsubscribeUserStatus"),i="userID count:".concat(s.length);xe.l("".concat(n," ").concat(i));var u={userIDList:a};return 0===a.length&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:ra,requestData:u}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(s.length)).end(),xe.l("".concat(n," ok. fail count:").concat(s.length,".")),Ka({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setMessage("".concat(i)).setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),Jr=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="UserModule",s._profileHandler=new Kr(_(s)),s._blacklistHandler=new Yr(_(s)),s._userStatusHandler=new zr(_(s)),s.getInnerEmitterInstance().on(Za,s.onContextUpdated,_(s)),s}return a(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!jt(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,m(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,m(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(xn)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],j),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:"isMyFriend",value:function(e){var t=this.getModule(Pn);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return za(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(ro),Xr=function(){function e(t,n){o(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="2.27.5",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy}return a(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||e>=2e7&&e<8e7||e>=172e7&&e<178e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Le?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,s=[];se&&(s=Object.keys(re)),ae&&(s=oe?Object.keys(uni):Object.keys(window));for(var a=0,r=s.length;a0){for(var c=0,l=u.length;c0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return Ja({code:da.USER_NOT_LOGGED_IN});var n=new ka("logout");n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0);var o="".concat(this._n,".logout");return xe.i("".concat(o," type:").concat(t)),0===t&&this._m.setNotReadyReason(da.LOGGED_OUT),this.request({protocolName:uo,requestData:{type:t}}).then((function(){return e.resetReady(),za({})})).catch((function(t){return xe.e("".concat(o," error:"),t),e.resetReady(),za({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(Xn).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:co,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){xe.w("".concat(e._n,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return jt(this.getModule(qn).getSDKAppID())?t=da.NO_SDKAPPID:jt(e.userID)?t=da.NO_IDENTIFIER:jt(e.userSig)&&(t=da.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return ae&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),xe.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(da.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),xe.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(da.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:"onUserSigExpired",value:function(){new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage(S.KICKED_OUT_USERSIG_EXPIRED).end(!0),xe.w("".concat(this._n,".onUserSigExpired: userSig expired")),0!==this.getModule(qn).getStatusInstanceID()&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(da.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){(new ka("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),xe.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(qn).getStatusInstanceID())&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_REST_API}),this._m.setNotReadyReason(da.KICKED_OUT_REST_API),this._m.reset(),this.getModule(zn).onRestApiKickedOut())}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),n}(ro);function Zr(){return null}var $r=function(){function e(t){o(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return a(e,[{key:"_errorTolerantHandle",value:function(){se||!at(window)&&this._canIUseCookies()||(this.getItem=Zr,this.setItem=Zr,this.removeItem=Zr,this.clear=Zr)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=D(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];this._setStorageSync(this._getKey(o),s)}}catch(a){t.e(a)}finally{t.f()}this._storageQueue.clear()}catch(r){xe.w("".concat(this._n,"._doFlush error:"),r)}}},{key:"_getPrefix",value:function(){var e=this._m.getModule(qn);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return xe.w("".concat(this._n,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var s=o?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{se?re.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){xe.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){xe.w("".concat(this._n,".removeItem error:"),o)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),se&&(o.limitSize=1024*re.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(se){var s=re.getStorageInfoSync(),a=s.keys;a.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var r in localStorage)localStorage.hasOwnProperty(r)&&(o.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(o)}catch(i){xe.w("".concat(this._n," error:"),i)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){se?ee?my.setStorageSync({key:e,data:t}):re.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return se?ee?my.getStorageSync({key:e}).data:re.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){se?ee?my.removeStorageSync({key:e}):re.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._doFlush()}}]),e}(),ei=function(){function e(t){o(this,e),this._n="SSOLogBody",this._report=[]}return a(e,[{key:"pushIn",value:function(e){xe.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;st(e)&&0!==e.length&&(xe.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,m(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),ti=function(e){var t=e.getModule(qn);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Ue()}},ni=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new ei,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var a=t.getInnerEmitterInstance();return a.on(Za,t._onLoginSuccess,_(t)),a.on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:"reportAtOnce",value:function(){xe.d("".concat(this._n,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(xn),n=t.getItem(this.TAG,!1);!jt(n)&&it(n.forEach)&&(xe.l("".concat(this._n,"._onLoginSuccess get ssolog in storage, count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),s=this.getCloudConfig("evt_rpt_tinyid_wl");at(e)||(this.MIN_THRESHOLD=Number(e)),at(t)||(this.WAITING_TIME=Number(t)),at(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),at(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),at(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}},{key:"pushIn",value:function(e){e instanceof ka&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(xn),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");if(jt(t))xe.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>this.MAX_THRESHOLD&&(s=s.slice(0,this.MAX_THRESHOLD)),xe.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),s}(ro),oi="none",si="online",ai=[da.OVER_FREQUENCY_LIMIT,da.OPEN_SERVICE_OVERLOAD_ERROR],ri=function(){function e(t){o(this,e),this._m=t,this._networkType="",this._n="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return a(e,[{key:"start",value:function(){var e=this;se?(re.getNetworkType({success:function(t){e._networkType=t.networkType||t.subtype||"",t.networkType===oi?xe.w("".concat(e._n,".start no network, please check!")):xe.i("".concat(e._n,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),re.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=si,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:si})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:oi})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o="".concat(this._n,"._onNetworkStatusChange"),s=!1;t?(xe.i("".concat(o," previous:").concat(this._networkType," current:").concat(n)),this._networkType!==n&&(s=!0,this._m.getModule(zn).reConnect(!0))):this._networkType!==n&&(s=!0,xe.w("".concat(o," no network, please check!")),this._m.getModule(zn).offline());s&&(new ka("networkChange").setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(n)).end(),this._networkType=n)}},{key:"probe",value:function(e){var t=this;if(!at(e)&&ai.includes(e.code))return Promise.resolve([!0,this._networkType]);var n="".concat(this._n,".probe");return new Promise((function(e,o){se?re.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===oi?(xe.w("".concat(n," no network, please check!")),e([!1,o.networkType])):(xe.i("".concat(n," networkType:").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===oi?e([!1,oi]):e([!0,si])}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),se?null!==this._mpNetworkStatusCallback&&(re.offNetworkStatusChange&&(ne||Z?re.offNetworkStatusChange(this._mpNetworkStatusCallback):re.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}();var ii=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,o,a,r){if("function"!=typeof o)throw new TypeError("The listener must be a function");var i=new s(o,a||e,r),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],i]:e._events[u].push(i):(e._events[u]=i,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,o,s=[];if(0===this._eventsCount)return s;for(o in e=this._events)t.call(e,o)&&s.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},i.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var s=0,a=o.length,r=new Array(a);s=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule($n);switch(e.type){case S.MSG_IMAGE:return t.addTotalCount(Ma),this._uploadImage(e);case S.MSG_FILE:return t.addTotalCount(Ma),this._uploadFile(e);case S.MSG_AUDIO:return t.addTotalCount(Ma),this._uploadAudio(e);case S.MSG_VIDEO:return t.addTotalCount(Ma),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(Rn),s=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:a.payload.file,to:a.to,onProgress:function(e){if(s.updatePercent(e),it(a.onProgress))try{a.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a,r,i=o.location,u=o.fileType,c=o.fileSize,l=o.width,p=o.height,d=o.smallImageUrl,g=o.smallImageWidth,_=o.smallImageHeight,h=o.largeImageUrl,f=o.largeImageWidth,v=o.largeImageHeight,m=n.isPrivateNetWork()?i:Mt(i);return s.updateImageFormat(u),d&&h?(a={url:d,width:g,height:_},r={url:h,width:f,height:v}):(a=Gt({originUrl:m,originWidth:l,originHeight:p,min:198}),r=Gt({originUrl:m,originWidth:l,originHeight:p,min:720})),s.updateImageInfoArray([{size:c,url:m,width:l,height:p},t({},r),t({},a)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:Mt(s);return o.updateFileUrl(a),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:Mt(s);return o.updateAudioUrl(a),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=n.snapshotInfo,r=t.isPrivateNetWork()?s:Mt(s);return o.updateVideoUrl(r),jt(a)||o.updateSnapshotInfo(a),e}))}},{key:"_checkSizeError",value:function(e){return Ja({code:da["MESSAGE_".concat(e,"_SIZE_LIMIT")],message:this.getErrorMessage("UploadSizeLimit",e.toLowerCase(),"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576," MB"))})}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return Ja({code:da.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var s=null;return this._setUploadFileType(sr),this.uploadByCOS(e).then((function(e){return s=e,t.isPrivateNetWork()?At(e.location):At("https://".concat(e.location))})).then((function(e){return s.width=e.width,s.height=e.height,Promise.resolve(s)}))}},{key:"_checkImageType",value:function(e){var t="";return t=se?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),nr.indexOf(t.toLowerCase())>=0||Ja({code:da.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=se?e.size:e.files[0].size)?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):tthis.UPLOAD_SIZE_LIMIT.FILE?this._checkSizeError("FILE"):0===e.file.files[0].size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(ir),this.uploadByCOS(e)):Ja({code:da.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.VIDEO?this._checkSizeError("VIDEO"):0===e.file.videoFile.size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):-1===or.indexOf(e.file.videoFile.type)?Ja({code:da.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(ar),se?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ae?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new Wa({code:da.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.AUDIO?this._checkSizeError("AUDIO"):0===e.file.size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(rr),this.uploadByCOS(e)):Ja({code:da.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t=this;if(!it(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),Ja({code:da.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new ka("upload"),o="".concat(this._n,".uploadByCOS"),s=Date.now(),a=this._getFile(e);return new Promise((function(r,i){var u=se?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),c=t;t._cosUploadMethod(u,(function(e,u){var l=Object.create(null);if(u){if(e||st(u.files)&&u.files[0].error){var p=new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(p,!0,t.getNetworkType()).end(),xe.l("".concat(o," failed. error:"),u.files[0].error),403===u.files[0].error.statusCode&&(xe.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void i(p)}l.fileName=a.name,l.fileSize=a.size,l.fileType=a.type.slice(a.type.indexOf("/")+1).toLowerCase(),l.location=se?u.Location:u.files[0].data.Location;var d=Date.now()-s,g=c._formatFileSize(a.size),_=c._formatSpeed(1e3*a.size/d),h="size:".concat(g," time:").concat(d,"ms speed:").concat(_);xe.l("".concat(o," success. name:").concat(a.name," ").concat(h)),r(l);var f=t.getModule($n);return f.addCost(Ma,d),f.addFileSize(Ma,a.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var v=new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL});n.setError(v,!0,c.getNetworkType()).end(),xe.w("".concat(o," failed. error:"),e),403===e.statusCode&&(xe.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(v)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(s,a){var r=new ka("upload"),i=e.requestSnapshotUrl,u=void 0===i?void 0:i,c=g(e,ci),l=Date.now();t._cosUploadMethod(c,(function(e,i){if(e||403===i.statusCode)return r.setError(new Wa(e),!0,t.getNetworkType()).end(),xe.l("".concat(n," failed, error:"),e),void a(new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL}));var p=Object.create(null),d=i.data.location||"";t.isPrivateNetWork()||0!==d.indexOf("https://")&&0!==d.indexOf("http://")||(d=d.split("//")[1]),p.fileName=o.name,p.fileSize=o.size,p.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),p.location=d;var g=Date.now()-l,_=t._formatFileSize(o.size),h=t._formatSpeed(1e3*o.size/g),f="size:".concat(_,",time:").concat(g,"ms,speed:").concat(h," res:").concat(JSON.stringify(i.data));xe.l("".concat(n," success name:").concat(o.name,",").concat(f)),r.setNetworkType(t.getNetworkType()).setMessage(f).end();var v=t.getModule($n);v.addCost(Ma,g),v.addFileSize(Ma,o.size);var m=[];if(c.thumbUrl&&c.largeUrl&&(m=[t._getSmallImageInfoByUrl(c.thumbUrl,p),t._getLargeImageInfoByUrl(c.largeUrl,p)]),u&&m.push(t._getSnapshotInfoByUrl(u,p)),m.length>0)return Promise.all(m).then((function(){s(p)}));s(p)}))}))}))}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.getModule(qn).getFileUploadProxy(),n=e;return t&&(n=e.replace(/^https:\/\/[^/]+/,t)),n}},{key:"_getFile",value:function(e){var t;return st(e.file.files)||(t=e.file.files,"filelist"===ct(t))?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?bt(e/1024,1)+"KB/s":bt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(".")),s=this._genFileName("".concat(_t(999999)).concat(o));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(s),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:o,onProgress:function(t){if(xe.l(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",s=0,a=this._getFile(e);if(se)n=this._genFileName(a.name),o=a.url,s=1;else{var r=a.name,i=r.slice(r.lastIndexOf("."));n=this._genFileName("".concat(_t(999999)).concat(i)),o=a,s=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:s,duration:this.duration}).then((function(s){var a=s.uploadUrl,r=s.downloadUrl,i=s.requestSnapshotUrl,u=void 0===i?void 0:i,c=s.thumbUrl,l=s.largeUrl;return{url:t._getRawOrUploadProxyUrl(a),fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:r,requestSnapshotUrl:u,thumbUrl:c,largeUrl:l,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w("onProgress callback error:",n),xe.e(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Rt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,o=new ka("getSnapshotInfo");return this.request({protocolName:qs,requestData:{platform:this.getPlatform(),coverName:this._genFileName(_t(99999)),requestSnapshotUrl:e}}).then((function(e){var n=(e.data||{}).snapshotUrl;return o.setMessage("snapshotUrl:".concat(n)).end(),jt(n)?{}:At(n).then((function(e){t.snapshotInfo={snapshotUrl:n,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return xe.w("".concat(n._n,"._getSnapshotInfoByUrl failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return At(e).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return At(e).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset"))}}]),s}(ro),pi=["downloadKey","pbDownloadKey","messageList"],di=function(){function e(t){o(this,e),this._n="MergerMessageHandler",this._messageModule=t}return a(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this,o="".concat(this._n,".").concat("uploadMergerMessage");xe.d("".concat(o," message:"),e,"messageBytes:".concat(t));var s=e.payload.messageList,a=s.length,r=new ka("uploadMergerMessage");return this._messageModule.request({protocolName:Ys,requestData:{messageList:s}}).then((function(e){xe.d("".concat(o," ok. response:"),e.data);var s=e.data,i=s.pbDownloadKey,u=s.downloadKey,c={pbDownloadKey:i,downloadKey:u,messageNumber:a};return r.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(a,"-").concat(t,"-").concat(u)).end(),c})).catch((function(e){throw xe.w("".concat(o," failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this,o="".concat(this._n,".").concat("downloadMergerMessage");xe.d("".concat(o," message:"),e);var s=e.payload.downloadKey,a=this._messageModule.getFileDownloadProxy(),r=new ka("downloadMergerMessage");return r.setMessage("downloadKey:".concat(s)),this._messageModule.request({protocolName:js,requestData:{downloadKey:s}}).then((function(s){if(xe.d("".concat(o," ok. response:"),s.data),it(e.clearElement)){var i=e.payload;i.downloadKey,i.pbDownloadKey,i.messageList;var u=g(i,pi);e.clearElement(),e.setElement({type:e.type,content:t({messageList:s.data.messageList},u)},a)}else{var c=[];s.data.messageList.forEach((function(e){if(!jt(e)){var t=new xa(e,a);c.push(t)}})),e.payload.messageList=c,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return r.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw xe.w("".concat(o," failed. key:").concat(s," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===S.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,p=n.downloadKey,d=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Gn),m=v&&v.isOnlineMessage(e,t)?0:void 0;return{protocolName:_o,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:p,title:_,abstractList:h,compatibleText:f,messageNumber:d}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,p=n.downloadKey,d=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Un),m=v&&v.isOnlineMessage(e,t)?1:0;return{protocolName:ho,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:p,title:_,abstractList:h,compatibleText:f,messageNumber:d}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||v.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}}]),e}(),gi={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},_i=[da.MESSAGE_ONPROGRESS_FUNCTION_ERROR,da.MESSAGE_IMAGE_SELECT_FILE_FIRST,da.MESSAGE_IMAGE_TYPES_LIMIT,da.MESSAGE_FILE_IS_EMPTY,da.MESSAGE_IMAGE_SIZE_LIMIT,da.MESSAGE_FILE_SELECT_FILE_FIRST,da.MESSAGE_FILE_SIZE_LIMIT,da.MESSAGE_VIDEO_SIZE_LIMIT,da.MESSAGE_VIDEO_TYPES_LIMIT,da.MESSAGE_AUDIO_UPLOAD_FAIL,da.MESSAGE_AUDIO_SIZE_LIMIT,da.COS_UNDETECTED];function hi(e){var t=!1;return Object.values(gi).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var fi=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new di(_(t)),t}return a(s,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o="string"==typeof e.payload?e.payload:e.payload.text,s=new La({text:o}),a=this._getNickAndAvatarByUserID(t);return n.setElement(s),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e);if(se){var o=e.payload.file;if(Ze(o))return void this.outputWarning("FileUnsupportedInMP","createImageMessage");var s=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,a={url:s,name:s.slice(s.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:s.slice(s.lastIndexOf(".")+1).toLowerCase()};e.payload.file=a}else if(ae)if(Ze(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(ot(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var u=new Aa({imageFormat:Ve.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),c=this._getNickAndAvatarByUserID(t);return n.setElement(u),n.setNickAndAvatar(c),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(se){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var s=new Ha(e),a=new Na({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID(e.payload.file)}),r=this._getNickAndAvatarByUserID(o);return s.setElement(a),s.setNickAndAvatar(r),s.setNameCard(this._getNameCardByGroupID(s)),this._messageOptionsMap.set(s.clientSequence,e),s}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0;var n={};if(se){if(ee)return void this.outputWarning("VideoUnsupportedInAlipay");if(Ze(e.payload.file))return void this.outputWarning("FileUnsupportedInMP","createVideoMessage");var o=e.payload.file;st(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ae){if(Ze(e.payload.file)){var s=e.payload.file;e.payload.file.files=[s]}else if(ot(e.payload.file)&&"undefined"!=typeof uni){var a=e.payload.file.tempFile;e.payload.file.files=[a]}var r=e.payload.file;n.url=window.URL.createObjectURL(r.files[0]),n.name=r.files[0].name,n.size=r.files[0].size||1,n.second=r.files[0].duration||0,n.type=r.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var i=new Ha(e),u=new Fa({videoFormat:n.type,videoSecond:bt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),c=this._getNickAndAvatarByUserID(t);return i.setElement(u),i.setNickAndAvatar(c),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new wa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new Ra(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new Ha(e),s=new Va(e.payload);return o.setElement(s),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,s=e.payload,a=e.needReadReceipt,r=e.receiverList,i=this.getMyUserID(),u=this._getNickAndAvatarByUserID(i);if(s.type===S.MSG_GRP_TIP)return Ja({code:da.MESSAGE_FORWARD_TYPE_INVALID});var c={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:Qt.UNSEND,currentUser:i,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||s.cloudCustomData||"",needReadReceipt:a,receiverList:r,isSupportExtension:e.isSupportExtension||!1},l=new Ha(c);return l.setElement(s.getElements()[0]),l.setNickAndAvatar(u),l.setNameCard(this._getNameCardByGroupID(s)),l.setRelayFlag(!0),l}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(se){if(!X&&!Q&&!ne)return;var n=re.getSystemInfoSync().SDKVersion;if(X&&Ot(n,"2.5.0")<0)return void this.outputWarning("WXChooseMessageFile");if(Q&&Ot(n,"1.18.0")<0)return void this.outputWarning("QQChooseMessageFile")}if(ae||ne){if(Ze(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(ot(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file,a=s.tempFiles,r=s.files,i=null;st(a)?i=a[0]:st(r)&&(i=r[0]),e.payload.file={files:[i]}}}else if(X||Q){var u=e.payload.file.tempFiles,c=t(t({},u[0]),{},{url:u[0].path});e.payload.file={files:[c]}}var l=this.getMyUserID();e.currentUser=l,e.senderTinyID=this.getMyTinyID();var p=new Ha(e),d=new ba({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),g=this._getNickAndAvatarByUserID(l);return p.setElement(d),p.setNickAndAvatar(g),p.setNameCard(this._getNameCardByGroupID(p)),this._messageOptionsMap.set(p.clientSequence,e),p}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new qa(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return Ja({code:da.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(!1===this.getModule(no).filterMessage(e,t))return this._onSendMessageFailed(e,new Wa({code:da.PROFANITY_FOUND}));var o,s=null;switch(e.conversationType){case S.CONV_C2C:if(!(s=this.getModule(Gn)))return this._onCannotFindModule();break;case S.CONV_GROUP:if(!(s=this.getModule(Un)))return this._onCannotFindModule();if(Tt({groupID:e.to})){var a=s.getLocalGroupProfile(e.to);if(a&&a.isSupportTopic)return Ja({code:da.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return Ja({code:da.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(Kn),i=this.getModule(Un);return r.upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===ma&&n.getModule($n).addSuccessCount(Ma);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return Ja({code:da.MESSAGE_FILE_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var a=function(e){var t="utf-8";ae&&document&&(t=document.charset.toLowerCase());var n,o,s=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var a=0;a11264?n._mergerMessageHandler.uploadMergerMessage(e,a).then((function(o){var s=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(s)})):(n.getModule(Fn).setMessageRandom(e),e.conversationType===S.CONV_C2C||e.conversationType===S.CONV_GROUP?s.sendMessage(e,t):void 0)})).then((function(a){var r=a.data,i=r.time,u=r.sequence,c=r.readReceiptCode;$e(c)&&0!==c&&(new ka("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(u," readReceiptCode:").concat(c)).end(),xe.w("".concat(n._n,".sendMessageInstance readReceiptCode:").concat(c," message:").concat(n.getErrorMessage(c))));n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence);var l=n.getModule(Fn);e.status=Qt.SUCCESS,e.time=i;var p=!1;if(e.conversationType===S.CONV_GROUP)e.sequence=u;else if(e.conversationType===S.CONV_C2C){var d=l.getLatestMessageSentByMe(e.conversationID);if(d){var g=d.nick,_=d.avatar;g===e.nick&&_===e.avatar||(p=!0)}}if(p&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),s.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;ot(t)&&ot(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Dt(e.to))f=S.CONV_TOPIC,n.getModule(wn).onMessageSent({groupID:qt(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||Ut(e.payload.imageInfoArray),Ka({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Qt.FAIL,this.getModule(Fn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new ka("sendMessage");return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),xe.e("".concat(this._n,"._onSendMessageFailed error:"),t),Ja(new Wa({code:t&&t.code?t.code:da.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([S.MSG_IMAGE,S.MSG_AUDIO,S.MSG_VIDEO,S.MSG_FILE].includes(e.type))return ma;if(e.conversationType===S.CONV_C2C)return ha;if(e.conversationType===S.CONV_GROUP){var t=this.getModule(Un).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Ct(n)?va:fa}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule($n).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var s=this.getModule($n);s.addSuccessCount(o),s.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,s=t.code,a=void 0===s?-1:s,r=this.getModule($n),i=this._getSendMessageSpecifiedKey(e);i===ma&&(n=a,o=!1,_i.includes(n)&&(o=!0),o)?r.addFailedCountOfUserSide(Ma):hi(a)&&i&&r.addFailedCountOfUserSide(i)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=Qt.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===S.CONV_C2C?n=this.getModule(Gn):e.conversationType===S.CONV_GROUP&&(n=this.getModule(Un)),!n)return this._onCannotFindModule();var o=new ka("revokeMessage");o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to));var s="".concat(this._n,".").concat("revokeMessage");return n.revokeMessage(e).then((function(n){var a=n.data.recallRetList;if(!jt(a)&&0!==a[0].retCode){var r=new Wa({code:a[0].retCode,data:{message:e}});return o.setCode(r.code).setMoreMessage(r.message).end(),Ja(r)}return xe.i("".concat(s," ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(Fn).onMessageRevoked([e]),Ka({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()}));var a=new Wa({code:n&&n.code?n.code:da.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}});return xe.w("".concat(s," failed. error:"),n),Ja(a)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],s=o.conversationID,a="",r=[],i=[];if(o.conversationType===S.CONV_C2C)n=this.getModule(Gn),a=s.replace(S.CONV_C2C,""),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||r.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(o.conversationType===S.CONV_GROUP)n=this.getModule(Un),a=s.replace(S.CONV_GROUP,""),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||r.push("".concat(e.sequence)),i.push(e))}));else if(o.conversationType===S.CONV_SYSTEM)return Ja({code:da.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===r.length)return this._onMessageDeleted(i);r.length>30&&(r=r.slice(0,30),i=i.slice(0,30));var u=new ka("deleteMessage");u.setMessage("to:".concat(a," count:").concat(r.length));var c="".concat(this._n,".").concat("deleteMessage");return n.deleteMessage({to:a,keyList:r}).then((function(e){return u.end(),xe.i("".concat(c," ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.w("".concat(c," failed. error:"),e);var n=new Wa({code:e&&e.code?e.code:da.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return Ja(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(Fn).onMessageDeleted(e),za({messageList:e})}},{key:"translateText",value:function(e){var n="".concat(this._n,".").concat("translateText"),o=e.sourceTextList,s=e.sourceLanguage,a=e.targetLanguage,r=new ka("translateText");return r.setMessage("sourceLanguage:".concat(s," targetLanguage:").concat(a)),this.request({protocolName:pa,requestData:{sourceTextList:o,source:s||"auto",target:a,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var o=e.data,s=o.error,a=o.requestID,i=o.translatedTextList;if(0===s.code)return r.end(),xe.i("".concat(n," ok. requestID:").concat(a)),Ka({translatedTextList:i});throw t(t({},s),{},{requestID:a})})).catch((function(e){return r.setCode(e.code).setMoreMessage(e.requestID).end(),xe.w("".concat(n," failed. error:"),e),Ja({code:da.TRANSLATE_TEXT_FAIL})}))}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,s=e.to;if(this.getModule(Un).isMessageFromOrToAVChatroom(s))return Ja({code:da.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(no).filterMessage(e))return Ja({code:da.PROFANITY_FOUND,data:{message:e}});o===S.CONV_C2C?n=this.getModule(Gn):o===S.CONV_GROUP&&(n=this.getModule(Un));var a=new ka("modifyMessage");a.setMessage("to:".concat(s));var r="".concat(this._n,".modifyRemoteMessage");return n.modifyRemoteMessage(e).then((function(n){a.end(),xe.i("".concat(r," ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return Ka({message:o})})).catch((function(n){if(a.setCode(n.code).setMoreMessage(n.message).end(),xe.w("".concat(r," failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return Ja({code:da.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return Ja({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){xe.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,s=e.to,a=e.random,r=e.sequence,i=e.time,u=t.elements,c=t.messageVersion,l=t.cloudCustomData,p=void 0===l?"":l;return this.getModule(Fn).onMessageModified({conversationType:n,from:o,to:s,time:i,random:a,sequence:r,elements:u,cloudCustomData:p,messageVersion:c})}},{key:"_generateUUID",value:function(e){var t=this.getModule(qn),n="".concat(t.getSDKAppID(),"-").concat(t.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=ht[Math.floor(Math.random()*ft)];return e}()),o=e.name||e.value||e.url||e.tempFilePath,s=o&&o.slice(o.lastIndexOf(".")+1);return s&&(n="".concat(n,".").concat(s)),n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(On).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===S.CONV_GROUP){var t=this.getModule(Un);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),s}(ro),vi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageExtensionModule",s.messageExtensionMap=new Map,s.globalSeqMap=new Map,s.getMessageExtensionsMap=new Map,s}return a(n,[{key:"onMessageExtensionNotify",value:function(e){var t=this,n=e.dataList,o=n.messageInfo,s=n.operateType,a=n.operateResultList,r=n.tinyID,i=n.globalSequence,u=o.clientTime,c=o.random,l="".concat(r,"-").concat(u,"-").concat(c),p=[],d=[];xe.l("".concat(this._n,".onMessageExtensionNotify messageID:").concat(l," operateType:").concat(s," globalSequence:").concat(i)),this._updateGlobalSequence(l,i);var g=!1,_=!1;a.forEach((function(e){var n=e.extensions,o=void 0===n?[]:n,a=e.clearSequence;if(1===s)g=!0,o.forEach((function(e){p.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,o);else if(2===s)_=!0,o.forEach((function(e){d.push(e.key)})),t._updateLocalExtension(l,o);else if(3===s){if(_=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=a&&!jt(e.value)&&d.push(t)}));t._clearLocalExtension(l,a)}})),g&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:p}),_&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:d})}},{key:"setMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("setMessageExtensions"),s=e.ID,a=e.conversationID,r=e.sequence,i=e.time,u=m(t);t.length>20&&(u=t.slice(0,20),xe.w("".concat(o,". the length of extensions cannot exceed 20.")));var c="conversationID:".concat(a," messageID:").concat(s," sequence:").concat(r," time:").concat(i," count:").concat(u.length),l=new ka("setMessageExtensions");return l.setMessage(c),xe.l("".concat(o," ").concat(c)),this._modifyMessageExtensions(e,u).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,a="success count:".concat(n," fail count:").concat(s);return l.setMoreMessage(a).end(),xe.l("".concat(o," ok. ").concat(a)),Ka({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"getMessageExtensions",value:function(e){var t=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("getMessageExtensions"),o=e.ID,s=e.conversationID,a=e.sequence,r=e.time,i="conversationID:".concat(s," messageID:").concat(o," sequence:").concat(a," time:").concat(r),u=new ka("getMessageExtensions");u.setMessage(i),xe.l("".concat(n," ").concat(i));var c=void 0;return this.getMessageExtensionsMap.has(o)&&(c=this._getGlobalSequence(o)),this._getMessageExtensions(e,c).then((function(e){return u.end(),xe.l("".concat(n," ok. total count:").concat(e.length)),at(c)&&e.length>0&&t.getMessageExtensionsMap.set(o,1),Ka({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"deleteMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("deleteMessageExtensions"),s=[],a=3;jt(t)||(a=2,t.forEach((function(e){s.push({key:e,value:"",seq:0})})));var r=e.ID,i=e.conversationID,u=e.sequence,c=e.time,l="conversationID:".concat(i," messageID:").concat(r," sequence:").concat(u," time:").concat(c," operateType:").concat(a),p=new ka("deleteMessageExtensions");return p.setMessage(l),xe.l("".concat(o," ").concat(l)),this._modifyMessageExtensions(e,s,a).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,r="";return 2===a&&(r="success count:".concat(n," fail count:").concat(s)),p.setMoreMessage("".concat(r)).end(),xe.l("".concat(o," ok. ").concat(r)),Ka({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),xe.e("".concat(o," failed. error:"),e),Ja(e)}))}},{key:"_modifyMessageExtensions",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=Dt(e.to)?S.CONV_TOPIC:e.conversationType,a=void 0;3!==o&&(a=this._getRequestExtensions(e,t));var r=null;switch(s){case S.CONV_C2C:r=this.getModule(Gn);break;case S.CONV_GROUP:r=this.getModule(Un);break;case S.CONV_TOPIC:r=this.getModule(wn);break;default:return Ja({code:da.CANNOT_FIND_MODULE})}return r.modifyMessageExtensions(e,a,o).then((function(t){var o=t.data,s=o.extensions,a=o.seq,r=[],i=0,u=0,c=[];return(s=jt(s)?[]:s).forEach((function(e){var t=e.errorCode,n=e.extension,o=n.key,s=n.value,a=n.seq;r.push({code:t,key:o,value:s}),0===t?i++:u++,c.push({key:o,value:s,seq:a})})),n._updateGlobalSequence(e.ID,a),c.length>0&&(n._updateLocalExtension(e.ID,c),c=null),{resultList:r,successCount:i,failureCount:u}})).catch((function(e){return Ja(e)}))}},{key:"_getRequestExtensions",value:function(e,t){var n=[];if(this._hasLocalExtension(e.ID)){var o=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,s=e.value,a=0;o.has(t)&&(a=o.get(t).seq),n.push({key:t,value:s,seq:a})})),n}return t.forEach((function(e){var t=e.key,o=e.value;n.push({key:t,value:o,seq:0})})),n}},{key:"_getMessageExtensions",value:function(e,t){var n=this,o="".concat(this._n,"._getMessageExtensions"),s=e.ID,a=e.to,r=null;switch(Dt(a)?S.CONV_TOPIC:e.conversationType){case S.CONV_C2C:r=this.getModule(Gn);break;case S.CONV_GROUP:r=this.getModule(Un);break;case S.CONV_TOPIC:r=this.getModule(wn);break;default:return Ja({code:da.CANNOT_FIND_MODULE})}return r.getMessageExtensions(e,t).then((function(t){var a=t.data,r=a.extensions,i=a.completeFlag,u=a.globalSequence,c=a.clearSequence;if(r=jt(r)?[]:r,xe.l("".concat(o," ok. completeFlag:").concat(i," globalSequence:").concat(u," clearSequence:").concat(c," count:").concat(r.length)),n._updateLocalExtension(s,r),n._clearLocalExtension(s,c),n._updateGlobalSequence(s,u),1!==i){var l=r.slice(-1)[0].seq+1;return n._getMessageExtensions(e,l)}return n._getLocalExtensions(s)})).catch((function(e){return Ja(e)}))}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var n=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,o=e.value,s=void 0===o?"":o,a=e.seq;n.set(t,{value:s,seq:a})}))}},{key:"_clearLocalExtension",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var n=this._getLocalExtension(e);n.forEach((function(e,o){e.seq<=t&&n.delete(o)}))}}},{key:"_getLocalExtensions",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,n){var o=e.value;jt(o)||t.push({key:n,value:o})}));return t}},{key:"_getGlobalSequence",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSequence",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),n}(ro),mi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ComboMessageModule",s}return a(n,[{key:"sendMessage",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return Ja({code:da.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.getModule(Fn).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var s=e.data,a=s.time,r=s.sequence,i=s.readReceiptCode;$e(i)&&0!==i&&(new ka("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(r," readReceiptCode:").concat(i)).end(),xe.w("".concat(t._n,".sendMessage readReceiptCode:").concat(i," message:").concat(t.getErrorMessage(i))));t._addSendMessageSuccessCount(n,o);var u=t.getModule(Fn);n.status=Qt.SUCCESS,n.time=a,n.conversationType===S.CONV_GROUP&&(n.sequence=r),u.appendToMessageList(n);var c=n;return!0===n._isExcludedFromLastMessage&&(c=""),u.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:c}]}),Ka({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.getModule(jn),o="";return e.conversationType===S.CONV_C2C&&(o="".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)),e.conversationType===S.CONV_GROUP&&(o="".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_constructMessageInstance",value:function(e){var t="".concat(this._n,"._constructMessageInstance"),n=null;try{var o=this.getMyUserID(),s={};if(s.senderTinyID=this.getMyTinyID(),s.currentUser=o,s.from=e.From_Account||o,e.GroupId?(s.conversationID="".concat(S.CONV_GROUP).concat(e.GroupId),s.conversationType=S.CONV_GROUP,s.to=e.GroupId):e.To_Account&&(s.conversationID="".concat(S.CONV_C2C).concat(e.To_Account),s.conversationType=S.CONV_C2C,s.to=e.To_Account),s.time=e.MsgTimeStamp||0,s.random=e.Random||e.MsgRandom||0,s.priority=e.MsgPriority,et(e.CloudCustomData)&&e.CloudCustomData.length>0&&(s.cloudCustomData=e.CloudCustomData),st(e.SendMsgControl)&&(s.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(s.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(s.messageControlInfo.excludedFromLastMessage=1)),s.conversationType===S.CONV_GROUP&&st(e.To_Account)&&e.To_Account.length>0){var a=e.To_Account;e.To_Account.length>50&&(a=e.To_Account.slice(0,50),xe.w("".concat(t," To_Account must be less than or equal to 50."))),s.receiverList=m(a),e.To_Account=m(a)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(s.needReadReceipt=!0),1===e.SupportMessageExtension&&(s.isSupportExtension=!0),(n=new Ha(s)).status=Qt.UNSEND,e.MsgClientTime=n.clientTime,n.conversationType===S.CONV_C2C&&(e.MsgSeq=n.sequence);for(var r,i=e.MsgBody.length,u=0;u100)return n--,t;if(st(t)){var s=t.map((function(t){return nt(t)?e(t,o):t}));return n--,s}if(nt(t)){var a=(r=t,i=function(e,t){if(!lt(t))return!1;if((s=t)!==Ci(s))for(var n=0;n65535)return Si(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Si(192|t>>>6,128|63&t):Si(224|t>>>12,128|t>>>6&63,128|63&t)},Li=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,ki),n=0|t.length,o=new Uint8Array(n),s=0;s0)for(var u=0;u=a&&(xe.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new Wa({code:da.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=Date.now()-this._startTs;xe.l("".concat(this._n,"._onOpen cost ").concat(n," ms. socketID:").concat(t)),new ka("wsOnOpen").setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=Pi,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new ka("wsOnClose"),n=e.id,o=e.e,s="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),a=0;0!==this._onOpenTs&&(a=Date.now()-this._onOpenTs),t.setMessage(a).setCostTime(a).setMoreMessage(s).setCode(o.code).end(),xe.l("".concat(this._n,"._onClose ").concat(s," onlineTime:").concat(a)),n===this._socketID&&(this._readyState=wi,a<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,n=e.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new ka("wsOnError").setMessage(n.errMsg||dt(n)).setMoreMessage(o).setLevel("error").end(),xe.w("".concat(this._n,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(c){new ka("jsonParseError").setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=t.body;if(!this._isTRTCCommand(n)){var s=Pt(t.head);o=Ei(t.body,this._getResponseKeyMap(s))}if(xe.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(o)," requestID:").concat(n," has:").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var a=this._promiseMap.get(n),r=a.resolve,i=a.reject,u=a.timestamp;return this._promiseMap.delete(n),this._calcRTT(u),void(o.errorCode&&0!==o.errorCode?(this._channelModule.onErrorCodeNotZero(o),i(new Wa({code:o.errorCode,message:o.errorInfo||"",data:n.includes(Lo)||n.includes(ms)?{elements:o.elements,messageVersion:o.messageVersion,cloudCustomData:o.cloudCustomData}:void 0}))):r(Ka(o)))}this._channelModule.onMessage({head:t.head,body:o})}}},{key:"_isTRTCCommand",value:function(e){for(var t=this._channelModule.getModule(oo).getCommandList(),n=!1,o=0;o0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,s=t.resolve,a=t.reject;e._promiseMap.set(n,{resolve:s,reject:a,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=D(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=v(t.value,2),s=o[0],a=o[1];this._execute(s,a)}}catch(r){n.e(r)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var n=g(e,Gi),o=this._getRequestIDFromHead(e.head),s=JSON.stringify(n);return new Promise((function(e,a){(t._promiseMap.set(o,{resolve:e,reject:a,timestamp:Date.now(),uplinkData:s}),xe.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==Pi)?t._reConnect():(t._execute(o,s),t._channelModule.getModule($n).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=g(e,Ui),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==Pi?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(jn).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(jn).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==S.NET_STATE_CONNECTED&&e.head.servcmd.includes(xs)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=V.HOST.CURRENT.STAT;return new Promise((function(n,o){var s="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),a=JSON.stringify(e.body),r="application/x-www-form-urlencoded;charset=UTF-8";if(se)re.request({url:s,data:a,method:"POST",timeout:3e3,header:{"content-type":r},success:function(){n()},fail:function(){o(new Wa({code:da.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,u=setTimeout((function(){i.abort(),o(new Wa({code:da.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(u),200===i.status||304===i.status?n():o(new Wa({code:da.NETWORK_ERROR})))},i.open("POST",s,!0),i.setRequestHeader("Content-type",r),i.send(a)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){se&&!ne&&this.outputWarning("DomainNameInMP"),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(jn).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){xe.l("".concat(this._n,".onReconnected")),this._m.restartTimer(),this.getModule(jn).onReconnected(),this._emitNetStateChangeEvent(S.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){xe.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(xe.l("".concat(this._n,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===S.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(S.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(xe.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(E.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(jn).getProtocolData({protocolName:Vs});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(xe.w("".concat(e._n,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new ka("error").setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(Bn).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];xe.l("".concat(e._n,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(s)),o?e.reConnect():e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._previousState=S.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(ro),xi=["a2","tinyid"],Vi=["a2","tinyid"],Bi=function(){function e(t){o(this,e),this._n="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return a(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead(),s=this._sessionModule.isIntl();this._configMap.set(io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.STAT_SERVICE,".").concat(V.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_COS_SIGN,".").concat(V.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(Fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(Xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(Qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(Js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(Zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OVERLOAD_PUSH,".").concat(V.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),s||(this._configMap.set(go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_MSG_AUDIT_MGR,".").concat(V.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(e))),this._configMap.set(_o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(Io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(Eo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList"}}}}(e)),this._configMap.set(Co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(To,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Do,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_TRANSLATE,".").concat(V.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(Ao,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(So,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(No,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},response:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(e)),this._configMap.set(Po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(e)),this._configMap.set(Vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(e)),this._configMap.set(fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:Be.NICK,value:""},{tag:Be.GENDER,value:""},{tag:Be.ALLOWTYPE,value:""},{tag:Be.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(Qo,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,xi)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_NO_AUTH,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(Zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set($o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"},response:{To_Account:"userID"}}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(hs,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,Vi)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(Cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(Ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_ATTR,".").concat(V.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(Ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:"",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList"}}}}(e)),this._configMap.set(ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(e)),this._configMap.set(Ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(e)),this._configMap.set($s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(e)),this._configMap.set(As,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(Rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(e)),this._configMap.set(Ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set(Gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(Us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(e)),this._configMap.set(Ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(e)),this._configMap.set(xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STAT,".").concat(V.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(Vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.HEARTBEAT,".").concat(V.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(Bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(Hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(Ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(Ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(Ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e)),this._configMap.set(ca,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(xe.w("".concat(this._n,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),s=null;if(n){var a=this._simpleDeepCopy(o),r=this._updateService(n,a),i=r.body,u=Object.create(null);for(var c in i)if(Object.prototype.hasOwnProperty.call(i,c)){if(u[c]=i[c],void 0===n[c])continue;u[c]=n[c]}r.body=u,s=this._getUplinkData(r)}else s=this._getUplinkData(o);return s}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=Pt(t.head),o=Di(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=Pt(t.head);if(this._isFromGroupRequest(t)){var o=e.type,s=e.groupID,a=void 0===s?void 0:s,r=e.groupIDList,i=void 0===r?[]:r;at(a)&&(a=i[0]||""),Tt({type:o,groupID:a})&&(t.head.servcmd="".concat(V.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(V.NAME.GROUP)||e.head.servcmd.includes(V.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},Ii.request),n.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&<(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},s=0,a=n.length;s1e3*s)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:r,requestCount:i});var u=!1;return i>o&&(u=!0),u}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,s=!1;return Date.now()-n<=1e3*o?s=!0:(this._serverOverloadInfoMap.delete(e),s=!1),s}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),xe.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(n,"s"))}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._updateCommandFrequencyLimitMap(Wi),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),s}(ro),ji=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageLossDetectionModule",s._maybeLostSequencesMap=new Map,s._firstRoundRet=[],s}return a(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),s=0;s=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(xe.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(t)),t){var n=new ka("fetchCloudControlConfig"),o=this.getModule(qn).getSDKAppID();this._isFetching=!0,this.request({protocolName:zs,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),xe.l("".concat(e._n,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),xe.l("".concat(e._n,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){xe.l("".concat(this._n,".onPushedCloudControlConfig")),new ka("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._n,"._parseCloudControlConfig"),o=e.errorCode,s=e.errorMessage,a=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===o){if(this._version!==r){var u=null;try{u=JSON.parse(a)}catch(c){this.isPrivateNetWork()||xe.e("".concat(n," JSON parse error. cloudControlConfig:"),a)}u&&(this._cloudConfig.clear(),Object.keys(u).forEach((function(e){t._cloudConfig.set(e,u[e])})),this._version=r,this.emitInnerEvent($a))}this._expiredTime=Date.now()+1e3*i}else at(o)?(xe.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(xe.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(s)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(ro),Ji=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="RecoverMessageModule",s.PULL_LIMIT_COUNT=15,s}return a(n,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n=this,o=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_GROUP&&e.groupProfile.type!==S.GRP_AVCHATROOM})),s=this.getModule(Fn),a=0,r=0,i=0;o.forEach((function(o){var u=o.conversationID,c=o.lastMessage;t=u.replace(S.CONV_GROUP,""),e=s.getLocalLastMessage(u),c&&0!==c.lastSequence&&e?(r=c.lastSequence,a=e.sequence,i=r-a,a>0&&i>=1&&i<300?n._recoverGroupMessage({groupID:t,localLastMessageSequence:a,remoteLastMessageSequence:r}):n._getGroupNotify(t)):n._getGroupNotify(t)}))}},{key:"_recoverC2CChat",value:function(){var e,t=this,n=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_C2C})),o=this.getModule(Fn),s=0,a=0,r=0,i=[Promise.resolve()];n.forEach((function(n){var u=n.conversationID,c=n.lastMessage;e=o.getLocalLastMessage(u),c&&0!==c.lastTime&&e&&(a=c.lastTime,s=e.time,r=a-s,s>0&&r>=1&&r<=600&&i.push(t._recoverC2CMessage({conversationID:u,localLastMessageTime:s,remoteLastMessageTime:a})))})),Promise.all(i).then((function(){xe.l("".concat(t._n,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),t.getModule(Yn).startSyncOnReconnected()}))}},{key:"_getLocalConversationList",value:function(){return this.getModule(Fn).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var t=this,n="".concat(this._n,"._recoverGroupMessage");xe.l("".concat(n," options:"),e);var o=e.groupID,s=e.localLastMessageSequence,a=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:o,sequence:s}).then((function(e){var s=e.data,r=s.complete,i=s.messageList;if(!at(i)){var u=i[0].sequence;xe.l("".concat(n," pkgLastMessageSequence:").concat(u," complete:").concat(r)),u1&&i.sort((function(e,t){return e.sequence-t.sequence}));for(var l=0;l=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),bt(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e100&&(n=100),n}},{key:"_checkE2EDelayException",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,s=Math.min.apply(Math,m(n)),a=Math.max.apply(Math,m(n)),r=this._calcAvg(n,o),i=bt(o/e.length*100,2);if(i>50)new ka("messageE2EDelayException").setMessage("count:".concat(o," min:").concat(s," max:").concat(a," avg:").concat(r," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=m(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),s=this._calcPercent(n,e),a=this._calcPercent(o,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:s,countLessThan3Second:o,percentOfCountLessThan3Second:a,avgDelay:r}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),Qi=function(){function e(){o(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}return a(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var n=bt(e/t*100,2);return n>100&&(n=100),n}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,m(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,m(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=m(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),s=this._calcAvg(t,n);return xe.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(s)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:s}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),Zi=function(){function e(){o(this,e),this._map=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(at(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(at(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=bt(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=bt(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return at(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return at(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return at(e)||!this._map.has(e)?-1:e===Ma?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),s=this._calcSuccessCountOfPlatform(e),a=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:s,successRateOfPlatform:a,avgValue:r}}},{key:"reset",value:function(e){at(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),$i=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return a(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(at(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,s=n.sequence,a=o.replace(S.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(a)){var r=this._lastMap.get(t).get(a),i=r.length-1;s>r[0]&&s100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),eu=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[ga,_a,ha,fa,va,ma,Ma,ya,Ia,Ca],t._messageSentItems=[ha,fa,va,ma,Ma],t._messageReceivedItems=[ya,Ia,Ca],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new Qi,t._avgE2EDelay=new Xi,t._rateMessageSent=new Zi,t._rateMessageReceived=new $i;var a=t.getInnerEmitterInstance();return a.on(Za,t._onLoginSuccess,_(t)),a.on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(xn),n=t.getItem(this.TAG,!1);!jt(n)&&it(n.forEach)&&(xe.l("".concat(this._n,"._onLoginSuccess get quality stat logs from local storage, count:").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");at(e)||(this.REPORT_INTERVAL=Number(e)),at(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),at(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||xe.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||xe.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||xe.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||xe.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||xe.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||xe.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Ea[this.getNetworkType()];at(o)&&(o=8);var s={qualityType:Ta[e],timestamp:Ue(),networkType:o,extension:""};switch(e){case ga:n=this._avgRTT.getStatResult();break;case _a:n=this._avgE2EDelay.getStatResult();break;case ha:case fa:case va:case ma:case Ma:n=this._rateMessageSent.getStatResult(e);break;case ya:case Ia:case Ca:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},s),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;at(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),xe.d("".concat(this._n,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var s=this.getModule(qn),a=s.getSDKAppID(),r=s.getTinyID();wt(this.REPORT_SDKAPPID_BLACKLIST,a)&&!Ft(this.REPORT_TINYID_WHITELIST,r)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:ti(this),quality:e};this.request({protocolName:xs,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){xe.w("".concat(n._n,"._doReport, online:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(xn),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");if(jt(t))xe.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>10&&(s=s.slice(0,10)),xe.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),s}(ro),tu=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="WorkerTimerModule",s._isWorkerEnabled=!0,s._workerTimer=null,s._timerID=-1,s._init(),s.getInnerEmitterInstance().on($a,s._onCloudConfigUpdated,_(s)),s}return a(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Se}},{key:"startWorkerTimer",value:function(){xe.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){xe.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Se){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,xe.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");xe.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),at(e)||"1"===e?!this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){xe.l("".concat(this._n,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}},{key:"getTimerID",value:function(){return this._timerID}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset"))}}]),n}(ro),nu=function(){function e(){o(this,e),this._n="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return a(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var t=null,n=e.length-1,o=0;n>=0;n--,o++)t=o<32?new L(0,Math.pow(2,o)).toString():new L(Math.pow(2,o-32),0).toString(),"1"===e[n]?this._purchasedFeatureMap.set(t,!0):this._purchasedFeatureMap.set(t,!1)}else xe.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,s=t.length-1,a=0;s>=0;s--,a++)if("1"===t.charAt(s)&&(n=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return xe.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(o)),za({enabled:o})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),ou=function(){function e(t){o(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new nu}return a(e,[{key:"_canFetch",value:function(){return this._getModule(qn).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),n="".concat(this._n,".fetchConfig");if(xe.l("".concat(n," canFetch:").concat(t)),t){var o=this._getModule(Bn),s=new ka("fetchCommercialConfig");s.setNetworkType(o.getNetworkType());var a=this._getModule(qn).getSDKAppID(),r=this._getModule(jn);this._isFetching=!0,r.request({protocolName:Xs,requestData:{SDKAppID:a}}).then((function(t){s.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),xe.l("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){o.probe().then((function(e){var n=v(e,2),o=n[0],a=n[1];s.setError(t,o,a).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));xe.l("".concat(t)),new ka("pushedCommercialConfig").setNetworkType(this._getModule(Bn).getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,s=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(s),this._expiredTime=Date.now()+1e3*a):at(n)?(xe.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(xe.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),su=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._m=e,s._n="OfflinePushModule",s._offlinePushPlugin=void 0,s._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},s._deviceToken="",s._businessID=0,s._iosBusinessID=0,s._c2cUnreadCount=0,s._groupUnreadCount=0,s._isWebUniapp=0,s}return a(n,[{key:"registerPlugin",value:function(e){if(ne){this._offlinePushPlugin=e["tim-offline-push-plugin"];var t=e.offlinePushConfig||{},n=t.huaweiBusinessID,o=t.xiaomiBusinessID,s=t.xiaomiAppID,a=t.xiaomiAppKey,r=t.meizuBusinessID,i=t.meizuAppID,u=t.meizuAppKey,c=t.vivoBusinessID,l=t.oppoBusinessID,p=t.oppoAppKey,d=t.oppoAppSecret,g=t.honorBusinessID,_=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=n,this._androidPushConfig.xiaomiPushBussinessId=o,this._androidPushConfig.xiaomiPushAppId=s,this._androidPushConfig.xiaomiPushAppKey=a,this._androidPushConfig.meizuPushBussinessId=r,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=u,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=p,this._androidPushConfig.oppoPushAppSecret=d,this._androidPushConfig.honorPushBussinessId=g,new ka("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!at(this._offlinePushPlugin))).end(!0),xe.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=_,this._setAppShowListener()}else this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,t="".concat(this._n,".").concat("_getDeviceToken");if(it(this._offlinePushPlugin.getDeviceToken)){var n="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);xe.l("".concat(t," start. ").concat(n)),new ka("_getDeviceToken").setMessage("".concat(n)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(o){var s=new ka("getDeviceTokenRes"),a=o.code,r=o.msg;if(0===a){var i=o.data,u=i.deviceToken,c=i.deviceBrand,l=i.deviceType,p=i.bussinessId;e._deviceToken=u,e._businessID=p||e._iosBusinessID,n="deviceToken:".concat(u,", deviceBrand:").concat(c||l,", businessID:").concat(e._businessID),xe.l("".concat(t," ok. ").concat(n)),s.setMessage(n).end(!0),e._setToken()}else s.setMessage("code:".concat(a,", msg:").concat(r)).end(!0),xe.e("".concat(t," failed. error:"),o)}))}else xe.e("".concat(t," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return ne&&!at(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");at(this._offlinePushPlugin)?xe.e("".concat(t," offlinePushPlugin is undefined")):it(this._offlinePushPlugin.setAppShowListener)?(new ka("_setAppShowListener").end(!0),xe.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){var o=(n||{}).appShow;new ka("setAppShowListenerRes").setMessage("appShow:".concat(o)).end(!0),xe.l("".concat(t," ok. appShow:").concat(o)),e._m.isReady()&&(0===o?(e._getConvUnreadCount(),e._onBackground()):1===o&&e._onForeground())}))):xe.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!at(this._offlinePushPlugin)&&it(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return xe.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}}},{key:"_setToken",value:function(){var e,t=this,n="".concat(this._n,"._setToken"),o=this.getModule(qn),s=1,a="",r="";jt(this._deviceToken)&&(s=0);var i=this.getUniAppPlatform(),u=this.getDeviceBrand();i===R.IOS||i===R.IPAD||i===R.MAC?r=this._deviceToken:i===R.ANDROID&&(a=this._deviceToken);var c=new ka("offlinePushSetToken");return e="deviceToken:".concat(r||a,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(u,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(s,", platform:").concat(i),c.setMessage("".concat(e)),xe.l("".concat(n," ").concat(e)),this.request({protocolName:ca,requestData:{tokenID:a,pushMsg:s,sdkAppID:o.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:u,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then((function(e){return c.end(),xe.l("".concat(n," ok")),e})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),xe.e("".concat(n," failed. error:"),e),Ja(e)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(Fn).getLocalConversationList().forEach((function(t){t.type===S.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===S.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new ka("_onBackground");this.request({protocolName:ia,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(o){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),xe.l("".concat(t," ok")),o})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),xe.e("".concat(t," failed. error:"),o)}))}},{key:"_onForeground",value:function(){var e=this,t="".concat(this._n,".").concat("_onForeground"),n=new ka("_onForeground");this.request({protocolName:ua,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return n.end(),xe.l("".concat(t," ok")),e})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),xe.e("".concat(t," failed. error:"),o)}))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?R.IOS:"android"===e?R.ANDROID:1002===t?R.IPAD:1001===t?R.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,xe.l("".concat(this._n,".reset"))}}]),n}(ro),au=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ProfanityFilterModule",s._plugin=null,s._filterConfigMap=new Map,s._startIndex=0,s._version=0,s._canIUseLexicon=!1,s._isFetching=!1,s._expiredTime=0,s}return a(n,[{key:"init",value:function(){var e=this.getModule(Wn).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:xe,isArray:st,isMap:Qe,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning("ProfanityPluginNotFound")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var o=e.type,s=e.conversationType;if(o!==S.MSG_TEXT&&o!==S.MSG_CUSTOM)return n;var a,r="".concat(this._n,".filterMessage");if(xe.l("".concat(r)),o===S.MSG_TEXT){if(s===S.CONV_C2C?a=H:s===S.CONV_GROUP&&(a=W),!this._isConfigOn(a))return n;var i=this._plugin.filter(e.payload.text),u=i.type,c=i.modifiedText;1===u?n=!1:2===u&&(e.payload.text=c)}else if(o===S.MSG_CUSTOM){if(s===S.CONV_C2C?a=K:s===S.CONV_GROUP&&(a=Y),!this._isConfigOn(a))return n;var l=this._plugin.filter(e.payload.data),p=this._plugin.filter(e.payload.description),d=this._plugin.filter(e.payload.extension);1===l.type||1===p.type||1===d.type?n=!1:(2===l.type&&(e.payload.data=l.modifiedText),2===p.type&&(e.payload.description=p.modifiedText),2===d.type&&(e.payload.extension=d.modifiedText))}return xe.l("".concat(r," done. isAllowedToSend:").concat(n)),n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;xe.l("".concat(n));var s=this._plugin.filter(e),a=s.type,r=s.modifiedText;return 1===a?o.isAllowedToSend=!1:2===a&&(o.modifiedText=r),xe.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var e=this,t=new ka("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.request({protocolName:la,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(o){var s=o.data,a=s.errorInfo,r=s.filterConfig,i=s.lexicon,u=s.strToken,c=s.completeFlag,l=s.nextStartIndex,p=s.version,d=s.expiredTime,g=a.errorCode,_=a.errorMessage;return 0!==g?(e._isFetching=!1,xe.w("".concat(n," failed. error:"),a),void t.setCode(g).setMessage(_).end()):(e._onFilterConfig(r),e._getToken(u),1===c?(xe.l("".concat(n," done. version:").concat(p," expiredTime:").concat(d)),e._version=p,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*d,void e._plugin.onLexiconCompleted(i)):(e._startIndex=l,e._plugin.onLexiconSliced(i),void e._getLexicon()))})).catch((function(o){e.probeNetwork().then((function(e){var n=v(e,2),s=n[0],a=n[1];t.setError(o,s,a).end()})),e._isFetching=!1,xe.l("".concat(n," failed. error:"),o)}))}},{key:"_onFilterConfig",value:function(e){var t=this;jt(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),xe.l("".concat(this._n,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(et(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n+=e[o+1],n+=e[o];else{for(var s=0;s=this.STORAGE_EXPIRES_TIME,s=!n||"2.27.5"!==n;return xe.l("".concat(this._n,"._needToUpdate isTimeout:").concat(o," isDifferentVersion:").concat(s)),o||s}},{key:"_fetch",value:function(){if(!this._m.getModule(qn).isPrivateNetWork()){var e="https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this;if(se)re.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),xe.l("".concat(n," mini program"))},fail:function(){}});else{var s=new XMLHttpRequest,a=setTimeout((function(){s.abort()}),3e3);s.onreadystatechange=function(){4===s.readyState&&(clearTimeout(a),200!==s.status&&304!==s.status||(xe.l("".concat(n," browser")),o._fillAndSave(s.responseText)))},s.open("GET",e,!0),s.setRequestHeader("Content-type",t),s.send()}}}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"2.27.5"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.getModule(xn)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o,s=e.split(";\n"),a=s.length,r=new RegExp(/'/g),i=0;i0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){xe.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._moduleMap.get(zn);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){xe.l("".concat(this._n,"._startMainThreadSocket"));var e=this._moduleMap.get(zn);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){xe.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){xe.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(An),this._moduleMap.get(Fn)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(E.SDK_READY);var t=Date.now()-this._startLoginTs;xe.w("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(Bn).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Ge;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Pe(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(Bn).start(),this._ssoLogForReady=new ka("sdkReady"),this._reason=da.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new ii,ja(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===E.CONVERSATION_LIST_UPDATED||e===E.FRIEND_LIST_UPDATED||e===E.GROUP_LIST_UPDATED||e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),s=this._eventThrottleMap.get(e);o-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout((function(){s.last=Date.now(),n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),1e3)):(s.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===E.CONVERSATION_LIST_UPDATED?this._moduleMap.get(Fn).getLocalConversationList():e===E.FRIEND_LIST_UPDATED?this._moduleMap.get(Pn).getLocalFriendList(!1):e===E.GROUP_LIST_UPDATED?this._moduleMap.get(Un).getLocalGroupList():e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(Fn).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new ii,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;n=ot(arguments[1])&&arguments[1].data?[e,{name:arguments[0],data:arguments[1].data}]:[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.getModule(qn).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrorMessage",value:function(e,t,n){return this._moduleMap.get(ao).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&xe.w(o)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);xe.w("Oops! ".concat(t)),new ka("error").setMessage(t).setNetworkType(this.getModule(Bn).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(E.ERROR,e)}},{key:"restartTimer",value:function(){xe.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer(),this.getModule(Un).restartPolling()}},{key:"getTimerID",value:function(){var e=this._moduleMap.get(Qn);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._moduleMap.get(Un).getPollingTimerID(e)}},{key:"reset",value:function(){xe.l("".concat(this._n,".reset")),Pe();var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.reset&&n.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(E.SDK_NOT_READY);var o,s=D(this._eventThrottleMap);try{for(s.s();!(o=s.n()).done;){var a=v(o.value,2)[1];a.timeoutID&&clearTimeout(a.timeoutID)}}catch(r){s.e(r)}finally{s.f()}this._eventThrottleMap.clear()}}]),e}(),cu=function(){function e(t){o(this,e),this._funcMap=new Map,this._m=t}return a(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.outputWarning("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){var o=this;return function(){try{t.apply(n,Array.from(arguments))}catch(u){var s=Object.values(E).indexOf(e),a="CallbackError";if(-1!==s){var r=Object.keys(E)[s];o._m.outputWarning(a,r,u)}var i=new ka(a);i.setMessage("eventName:".concat(e)).setMoreMessage(u.message).end()}}}}]),e}(),lu=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Rt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0};this._m=new uu(n),this._safetyCallbackFactory=new cu(this._m)}return a(e,[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._getModule(An).login(e)}},{key:"logout",value:function(){var e=this;return this._getModule(An).logout().then((function(t){return e._m.reset(),t}))}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._m.stopTimer(),e._getModule(Qn).terminate(),e._getModule(zn).dealloc();var t=e._m.getOuterEmitterInstance(),n=e._getModule(qn);t.emit(E.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){xe.d("on","eventName:".concat(e)),this._m.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){xe.d("once","eventName:".concat(e)),this._m.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){xe.d("off","eventName:".concat(e));var s=this._safetyCallbackFactory.find(e,t);null!==s&&(this._m.getOuterEmitterInstance().off(e,s,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){at(e["tim-offline-push-plugin"])?this._getModule(Wn).registerPlugin(e):this._getModule(to).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){var t=this.getErrorMessage("TIM_ASCII_ART");t&&console.log(t);var n=this.getErrorMessage("API_REFER");if(n){Ht()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",n):console.log("IM SDK API ->",n)}var o=this.getErrorMessage("DOCS_GUIDE");o&&console.log(o)}xe.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._getModule(Rn).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._getModule(Rn).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._getModule(Rn).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._getModule(Rn).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._getModule(Rn).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._getModule(Rn).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._getModule(Rn).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._getModule(Rn).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._getModule(Rn).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._getModule(Rn).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==S.MSG_MERGER?Ja({code:da.MESSAGE_MERGER_TYPE_INVALID}):jt(e.payload.downloadKey)?Ja({code:da.MESSAGE_MERGER_KEY_INVALID}):this._getModule(Rn).downloadMergerMessage(e).catch((function(e){return Ja({code:da.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._getModule(Rn).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Ha?this._getModule(Rn).sendMessageInstance(e,t):Ja({code:da.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._getModule(so).sendMessage(t):"handleGroupInvitation"===e?this._getModule(Un).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._getModule(eo).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e?this._getModule(oo).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):Ja({code:da.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._getModule(Rn).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._getModule(Rn).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._getModule(Rn).deleteMessage(e)}},{key:"translateText",value:function(e){return this._getModule(Rn).translateText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._getModule(Nn).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._getModule(Nn).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._getModule(Nn).deleteMessageExtensions(e,t)}},{key:"modifyMessage",value:function(e){return this._getModule(Rn).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._getModule(Fn).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._getModule(Fn).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._getModule(Fn).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._getModule(Fn).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._getModule(Un).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._getModule(Fn).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._getModule(Fn).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._getModule(Fn).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._getModule(Fn).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._getModule(Fn).deleteConversation(e)}},{key:"clearHistoryMessage",value:function(e){return this._getModule(Fn).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._getModule(Fn).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._getModule(Fn).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._getModule(Fn).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._getModule(Fn).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._getModule(Fn).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._getModule(Fn).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._getModule(Fn).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._getModule(Fn).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._getModule(Fn).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._getModule(Fn).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._getModule(Fn).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._getModule(Fn).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._getModule(On).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._getModule(On).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._getModule(On).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._getModule(On).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._getModule(On).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._getModule(On).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._getModule(On).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._getModule(On).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._getModule(On).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._getModule(On).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._getModule(Pn);return t?t.addFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._getModule(Pn);return t?t.checkFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._getModule(Pn);return t?t.getFriendProfile(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._getModule(Pn);return t?t.updateFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendApplicationList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._getModule(Pn);return t?t.acceptFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._getModule(Pn);return t?t.refuseFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._getModule(Pn);return e?e.setFriendApplicationRead():Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendGroupList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._getModule(Pn);return t?t.createFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._getModule(Pn);return t?t.addToFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._getModule(Pn);return t?t.removeFromFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._getModule(Pn);return t?t.renameFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._getModule(Un).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._getModule(Un).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._getModule(Un).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._getModule(Un).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._getModule(Un).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._getModule(Un).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._getModule(Un).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._getModule(Un).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._getModule(Un).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._getModule(Un).changeGroupOwner(e)}},{key:"getGroupApplicationList",value:function(){return this._getModule(Un).getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){return this._getModule(Un).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._getModule(Un).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._getModule(Un).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._getModule(Un).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._getModule(Un).getGroupAttributes(e)}},{key:"setGroupCounters",value:function(e){return this._getModule(Un).setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._getModule(Un).increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._getModule(Un).decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._getModule(Un).getGroupCounters(e)}},{key:"getGroupMemberList",value:function(e){return this._getModule(bn).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._getModule(bn).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._getModule(bn).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._getModule(bn).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._getModule(bn).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._getModule(bn).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._getModule(bn).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._getModule(bn).setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._getModule(bn).markGroupMemberList(e)}},{key:"getJoinedCommunityList",value:function(){return this._getModule(wn).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._getModule(wn).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._getModule(wn).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._getModule(wn).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._getModule(wn).getTopicList(e)}}]),e}(),pu={login:1,logout:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1};function du(e,t){if(e.isReady()||1===pu[t])return!0;var n=e.getNotReadyReason(),o={code:n,message:"".concat(e.getErrorMessage(n)," | ").concat(t," | ").concat(e.getErrorMessage(da.SDK_IS_NOT_READY))};return e.onError(o),o}var gu={},_u={};return _u.create=function(e){var n=0,o=e.SDKAppID;if($e(o))n=o;else if(n=parseInt(o),isNaN(o))return xe.e("".concat("TIM.create"," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&gu[n])return gu[n];xe.l("".concat("TIM.create"));var s=new lu(t(t({},e),{},{SDKAppID:n}));s.on(E.SDK_DESTROY,(function(e){gu[e.data.SDKAppID]=null,delete gu[e.data.SDKAppID]}));var a=function(e){var t=Object.create(null);return Object.keys(Ln).forEach((function(n){if(e[n]){var o=new k;t[n]=function(){var t=Array.from(arguments);return o.use((function(t,o){var s=du(e,n);return!0===s?o():Ja(s)})).use((function(e,t){if(!0===zt(e,kn[n],n))return t()})).use((function(t,o){return e[n].apply(e,t)})),o.run(t)}}})),t}(s);return gu[n]=a,kn.hookGetAPITips(s.getErrorMessage.bind(s)),xe.l("".concat("TIM.create"," ok")),a},_u.TYPES=S,_u.EVENT=E,_u.VERSION="2.27.5",xe.l("TIM.VERSION:".concat(_u.VERSION)),_u})); }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) -return __REQUIRE__(1704939160518); +return __REQUIRE__(1710723475375); })() //miniprogram-npm-outsideDeps=[] //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/TUICallKit/min-npm/tim-wx-sdk/index.js.map b/TUICallKit/min-npm/tim-wx-sdk/index.js.map index 746332f..db06002 100644 --- a/TUICallKit/min-npm/tim-wx-sdk/index.js.map +++ b/TUICallKit/min-npm/tim-wx-sdk/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["tim-wx.js"],"names":[],"mappings":";;;;;;;AAAA;AACA","file":"index.js","sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=e||self).TIM=t()}(this,(function(){function e(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function t(t){for(var o=1;o=0||(a[o]=e[o]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}function _(e){if(void 0===e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e}function h(e,t){if(t&&(\"object\"==typeof t||\"function\"==typeof t))return t;if(void 0!==t)throw new TypeError(\"Derived constructors may only return object or undefined\");return _(e)}function f(e){var t=l();return function(){var o,n=c(e);if(t){var a=c(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return h(this,o)}}function m(e,t){return M(e)||function(e,t){var o=null==e?null:\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(null==o)return;var n,a,s=[],r=!0,i=!1;try{for(o=o.call(e);!(r=(n=o.next()).done)&&(s.push(n.value),!t||s.length!==t);r=!0);}catch(c){i=!0,a=c}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return s}(e,t)||I(e,t)||T()}function v(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function M(e){if(Array.isArray(e))return e}function y(e){if(\"undefined\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)}function I(e,t){if(e){if(\"string\"==typeof e)return C(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return\"Object\"===o&&e.constructor&&(o=e.constructor.name),\"Map\"===o||\"Set\"===o?Array.from(e):\"Arguments\"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var s,r=!0,i=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){i=!0,s=e},f:function(){try{r||null==o.return||o.return()}finally{if(i)throw s}}}}var S={SDK_READY:\"sdkStateReady\",SDK_NOT_READY:\"sdkStateNotReady\",SDK_DESTROY:\"sdkDestroy\",MESSAGE_RECEIVED:\"onMessageReceived\",MESSAGE_MODIFIED:\"onMessageModified\",MESSAGE_REVOKED:\"onMessageRevoked\",MESSAGE_READ_BY_PEER:\"onMessageReadByPeer\",MESSAGE_READ_RECEIPT_RECEIVED:\"onMessageReadReceiptReceived\",MESSAGE_EXTENSIONS_UPDATED:\"onMessageExtensionsUpdated\",MESSAGE_EXTENSIONS_DELETED:\"onMessageExtensionsDeleted\",CONVERSATION_LIST_UPDATED:\"onConversationListUpdated\",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:\"onTotalUnreadMessageCountUpdated\",CONVERSATION_GROUP_LIST_UPDATED:\"onConversationGroupListUpdated\",CONVERSATION_IN_GROUP_UPDATED:\"onConversationInGroupUpdated\",GROUP_LIST_UPDATED:\"onGroupListUpdated\",GROUP_SYSTEM_NOTICE_RECEIVED:\"receiveGroupSystemNotice\",GROUP_ATTRIBUTES_UPDATED:\"groupAttributesUpdated\",GROUP_COUNTER_UPDATED:\"onGroupCounterUpdated\",TOPIC_CREATED:\"onTopicCreated\",TOPIC_DELETED:\"onTopicDeleted\",TOPIC_UPDATED:\"onTopicUpdated\",PROFILE_UPDATED:\"onProfileUpdated\",USER_STATUS_UPDATED:\"onUserStatusUpdated\",BLACKLIST_UPDATED:\"blacklistUpdated\",FRIEND_LIST_UPDATED:\"onFriendListUpdated\",FRIEND_GROUP_LIST_UPDATED:\"onFriendGroupListUpdated\",FRIEND_APPLICATION_LIST_UPDATED:\"onFriendApplicationListUpdated\",KICKED_OUT:\"kickedOut\",ERROR:\"error\",NET_STATE_CHANGE:\"netStateChange\",SDK_RELOAD:\"sdkReload\"},D={MSG_TEXT:\"TIMTextElem\",MSG_IMAGE:\"TIMImageElem\",MSG_SOUND:\"TIMSoundElem\",MSG_AUDIO:\"TIMSoundElem\",MSG_FILE:\"TIMFileElem\",MSG_FACE:\"TIMFaceElem\",MSG_VIDEO:\"TIMVideoFileElem\",MSG_GEO:\"TIMLocationElem\",MSG_LOCATION:\"TIMLocationElem\",MSG_GRP_TIP:\"TIMGroupTipElem\",MSG_GRP_SYS_NOTICE:\"TIMGroupSystemNoticeElem\",MSG_CUSTOM:\"TIMCustomElem\",MSG_MERGER:\"TIMRelayElem\",MSG_PRIORITY_HIGH:\"High\",MSG_PRIORITY_NORMAL:\"Normal\",MSG_PRIORITY_LOW:\"Low\",MSG_PRIORITY_LOWEST:\"Lowest\",CONV_C2C:\"C2C\",CONV_GROUP:\"GROUP\",CONV_TOPIC:\"TOPIC\",CONV_SYSTEM:\"@TIM#SYSTEM\",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:\"Private\",GRP_WORK:\"Private\",GRP_PUBLIC:\"Public\",GRP_CHATROOM:\"ChatRoom\",GRP_MEETING:\"ChatRoom\",GRP_AVCHATROOM:\"AVChatRoom\",GRP_COMMUNITY:\"Community\",GRP_MBR_ROLE_OWNER:\"Owner\",GRP_MBR_ROLE_ADMIN:\"Admin\",GRP_MBR_ROLE_MEMBER:\"Member\",GRP_MBR_ROLE_CUSTOM:\"Custom\",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:\"AcceptAndNotify\",MSG_REMIND_ACPT_NOT_NOTE:\"AcceptNotNotify\",MSG_REMIND_DISCARD:\"Discard\",GENDER_UNKNOWN:\"Gender_Type_Unknown\",GENDER_FEMALE:\"Gender_Type_Female\",GENDER_MALE:\"Gender_Type_Male\",KICKED_OUT_MULT_ACCOUNT:\"multipleAccount\",KICKED_OUT_MULT_DEVICE:\"multipleDevice\",KICKED_OUT_USERSIG_EXPIRED:\"userSigExpired\",KICKED_OUT_REST_API:\"REST_API_Kick\",ALLOW_TYPE_ALLOW_ANY:\"AllowType_Type_AllowAny\",ALLOW_TYPE_NEED_CONFIRM:\"AllowType_Type_NeedConfirm\",ALLOW_TYPE_DENY_ANY:\"AllowType_Type_DenyAny\",FORBID_TYPE_NONE:\"AdminForbid_Type_None\",FORBID_TYPE_SEND_OUT:\"AdminForbid_Type_SendOut\",JOIN_OPTIONS_FREE_ACCESS:\"FreeAccess\",JOIN_OPTIONS_NEED_PERMISSION:\"NeedPermission\",JOIN_OPTIONS_DISABLE_APPLY:\"DisableApply\",JOIN_STATUS_SUCCESS:\"JoinedSuccess\",JOIN_STATUS_ALREADY_IN_GROUP:\"AlreadyInGroup\",JOIN_STATUS_WAIT_APPROVAL:\"WaitAdminApproval\",GRP_PROFILE_OWNER_ID:\"ownerID\",GRP_PROFILE_CREATE_TIME:\"createTime\",GRP_PROFILE_LAST_INFO_TIME:\"lastInfoTime\",GRP_PROFILE_MEMBER_NUM:\"memberNum\",GRP_PROFILE_MAX_MEMBER_NUM:\"maxMemberNum\",GRP_PROFILE_JOIN_OPTION:\"joinOption\",GRP_PROFILE_INTRODUCTION:\"introduction\",GRP_PROFILE_NOTIFICATION:\"notification\",GRP_PROFILE_MUTE_ALL_MBRS:\"muteAllMembers\",SNS_ADD_TYPE_SINGLE:\"Add_Type_Single\",SNS_ADD_TYPE_BOTH:\"Add_Type_Both\",SNS_DELETE_TYPE_SINGLE:\"Delete_Type_Single\",SNS_DELETE_TYPE_BOTH:\"Delete_Type_Both\",SNS_APPLICATION_TYPE_BOTH:\"Pendency_Type_Both\",SNS_APPLICATION_SENT_TO_ME:\"Pendency_Type_ComeIn\",SNS_APPLICATION_SENT_BY_ME:\"Pendency_Type_SendOut\",SNS_APPLICATION_AGREE:\"Response_Action_Agree\",SNS_APPLICATION_AGREE_AND_ADD:\"Response_Action_AgreeAndAdd\",SNS_CHECK_TYPE_BOTH:\"CheckResult_Type_Both\",SNS_CHECK_TYPE_SINGLE:\"CheckResult_Type_Single\",SNS_TYPE_NO_RELATION:\"CheckResult_Type_NoRelation\",SNS_TYPE_A_WITH_B:\"CheckResult_Type_AWithB\",SNS_TYPE_B_WITH_A:\"CheckResult_Type_BWithA\",SNS_TYPE_BOTH_WAY:\"CheckResult_Type_BothWay\",NET_STATE_CONNECTED:\"connected\",NET_STATE_CONNECTING:\"connecting\",NET_STATE_DISCONNECTED:\"disconnected\",MSG_AT_ALL:\"__kImSDK_MesssageAtALL__\",READ_ALL_C2C_MSG:\"readAllC2CMessage\",READ_ALL_GROUP_MSG:\"readAllGroupMessage\",READ_ALL_MSG:\"readAllMessage\",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},N=function(){function e(){n(this,e),this.cache=[],this.options=null}return s(e,[{key:\"use\",value:function(e){if(\"function\"!=typeof e)throw\"middleware must be a function\";return this.cache.push(e),this}},{key:\"next\",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:\"run\",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),A=\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:{};function k(e,t){return e(t={exports:{}},t.exports),t.exports}var R=k((function(e,t){var o,n,a,s,r,i,c,u,l,d,p,g,_,h,f,m,v,M;e.exports=(o=\"function\"==typeof Promise,n=\"object\"==typeof self?self:A,a=\"undefined\"!=typeof Symbol,s=\"undefined\"!=typeof Map,r=\"undefined\"!=typeof Set,i=\"undefined\"!=typeof WeakMap,c=\"undefined\"!=typeof WeakSet,u=\"undefined\"!=typeof DataView,l=a&&void 0!==Symbol.iterator,d=a&&void 0!==Symbol.toStringTag,p=r&&\"function\"==typeof Set.prototype.entries,g=s&&\"function\"==typeof Map.prototype.entries,_=p&&Object.getPrototypeOf((new Set).entries()),h=g&&Object.getPrototypeOf((new Map).entries()),f=l&&\"function\"==typeof Array.prototype[Symbol.iterator],m=f&&Object.getPrototypeOf([][Symbol.iterator]()),v=l&&\"function\"==typeof String.prototype[Symbol.iterator],M=v&&Object.getPrototypeOf(\"\"[Symbol.iterator]()),function(e){var t=typeof e;if(\"object\"!==t)return t;if(null===e)return\"null\";if(e===n)return\"global\";if(Array.isArray(e)&&(!1===d||!(Symbol.toStringTag in e)))return\"Array\";if(\"object\"==typeof window&&null!==window){if(\"object\"==typeof window.location&&e===window.location)return\"Location\";if(\"object\"==typeof window.document&&e===window.document)return\"Document\";if(\"object\"==typeof window.navigator){if(\"object\"==typeof window.navigator.mimeTypes&&e===window.navigator.mimeTypes)return\"MimeTypeArray\";if(\"object\"==typeof window.navigator.plugins&&e===window.navigator.plugins)return\"PluginArray\"}if((\"function\"==typeof window.HTMLElement||\"object\"==typeof window.HTMLElement)&&e instanceof window.HTMLElement){if(\"BLOCKQUOTE\"===e.tagName)return\"HTMLQuoteElement\";if(\"TD\"===e.tagName)return\"HTMLTableDataCellElement\";if(\"TH\"===e.tagName)return\"HTMLTableHeaderCellElement\"}}var a=d&&e[Symbol.toStringTag];if(\"string\"==typeof a)return a;var l=Object.getPrototypeOf(e);return l===RegExp.prototype?\"RegExp\":l===Date.prototype?\"Date\":o&&l===Promise.prototype?\"Promise\":r&&l===Set.prototype?\"Set\":s&&l===Map.prototype?\"Map\":c&&l===WeakSet.prototype?\"WeakSet\":i&&l===WeakMap.prototype?\"WeakMap\":u&&l===DataView.prototype?\"DataView\":s&&l===h?\"Map Iterator\":r&&l===_?\"Set Iterator\":f&&l===m?\"Array Iterator\":v&&l===M?\"String Iterator\":null===l?\"Object\":Object.prototype.toString.call(e).slice(8,-1)})})),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n(this,e),this.high=t,this.low=o}return s(e,[{key:\"equal\",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:\"toString\",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var o=8-t.length;o;)t=\"0\"+t,o--;return e+t}}]),e}(),O={TEST:{CHINA:{DEFAULT:\"wss://wss-dev.tim.qq.com\"},OVERSEA:{DEFAULT:\"wss://wss-dev.tim.qq.com\"},SINGAPORE:{DEFAULT:\"wss://wsssgp-dev.im.qcloud.com\"},KOREA:{DEFAULT:\"wss://wsskr-dev.im.qcloud.com\"},GERMANY:{DEFAULT:\"wss://wssger-dev.im.qcloud.com\"},IND:{DEFAULT:\"wss://wssind-dev.im.qcloud.com\"},JPN:{DEFAULT:\"wss://wssjpn-dev.im.qcloud.com\"},USA:{DEFAULT:\"wss://wssusa-dev.im.qcloud.com\"}},PRODUCTION:{CHINA:{DEFAULT:\"wss://wss.im.qcloud.com\",BACKUP:\"wss://wss.tim.qq.com\",STAT:\"https://events.im.qcloud.com\"},OVERSEA:{DEFAULT:\"wss://wss.im.qcloud.com\",BACKUP:\"wss://wss.my-imcloud.com\",STAT:\"https://api.my-imcloud.com\"},SINGAPORE:{DEFAULT:\"wss://wsssgp.im.qcloud.com\",BACKUP:\"wss://wsssgp.my-imcloud.com\",STAT:\"https://apisgp.my-imcloud.com\"},KOREA:{DEFAULT:\"wss://wsskr.im.qcloud.com\",BACKUP:\"wss://wsskr.my-imcloud.com\",STAT:\"https://apikr.my-imcloud.com\"},GERMANY:{DEFAULT:\"wss://wssger.im.qcloud.com\",BACKUP:\"wss://wssger.my-imcloud.com\",STAT:\"https://apiger.my-imcloud.com\"},IND:{DEFAULT:\"wss://wssind.my-imcloud.com\",BACKUP:\"wss://wssind.im.qcloud.com\",STAT:\"https://apiind.my-imcloud.com\"},JPN:{DEFAULT:\"wss://wssjpn.im.qcloud.com\",BACKUP:\"wss://wssjpn.my-imcloud.com\",STAT:\"https://apijpn.my-imcloud.com\"},USA:{DEFAULT:\"wss://wssusa.im.qcloud.com\",BACKUP:\"wss://wssusa.my-imcloud.com\",STAT:\"https://apiusa.my-imcloud.com\"}}},G={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15},P=\"1.7.3\",U=537048168,b=\"CHINA\",w=\"OVERSEA\",F=\"SINGAPORE\",q=\"KOREA\",x=\"GERMANY\",V=\"IND\",B=\"JPN\",K=\"USA\",H={HOST:{CURRENT:{DEFAULT:\"wss://wss.im.qcloud.com\",STAT:\"https://events.im.qcloud.com\"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;this.CURRENT=O.PRODUCTION[e]}},NAME:{OPEN_IM:\"openim\",OPEN_IM_MSG_EXT:\"openim_msg_ext_http_svc\",GROUP:\"group_open_http_svc\",GROUP_AVCHATROOM:\"group_open_avchatroom_http_svc\",GROUP_COMMUNITY:\"million_group_open_http_svc\",GROUP_ATTR:\"group_open_attr_http_svc\",FRIEND:\"sns\",PROFILE:\"profile\",RECENT_CONTACT:\"recentcontact\",PIC:\"openpic\",BIG_GROUP_NO_AUTH:\"group_open_http_noauth_svc\",BIG_GROUP_LONG_POLLING:\"group_open_long_polling_http_svc\",BIG_GROUP_LONG_POLLING_NO_AUTH:\"group_open_long_polling_http_noauth_svc\",IM_OPEN_STAT:\"imopenstat\",WEB_IM:\"webim\",IM_COS_SIGN:\"im_cos_sign_svr\",CUSTOM_UPLOAD:\"im_cos_msg\",HEARTBEAT:\"heartbeat\",IM_OPEN_PUSH:\"im_open_push\",IM_OPEN_STATUS:\"im_open_status\",IM_LONG_MESSAGE:\"im_long_msg\",IM_CONFIG_MANAGER:\"im_sdk_config_mgr\",STAT_SERVICE:\"StatSvc\",OVERLOAD_PUSH:\"OverLoadPush\",IM_MSG_AUDIT_MGR:\"im_msg_audit_mgr\",TUIROOM_SVR:\"tui_room_svr\",IM_OPEN_TRANSLATE:\"im_open_translate\"},CMD:{LOGIN:\"wslogin\",LOGOUT_LONG_POLL:\"longpollinglogout\",LOGOUT:\"wslogout\",HELLO:\"wshello\",STAT_BACKGROUND:\"ws_stat_background\",STAT_FOREGROUND:\"ws_stat_foreground\",SET_TOKEN:\"ws_stat_settoken\",PORTRAIT_GET:\"portrait_get_all\",PORTRAIT_SET:\"portrait_set\",GET_LONG_POLL_ID:\"getlongpollingid\",LONG_POLL:\"longpolling\",AVCHATROOM_LONG_POLL:\"get_msg\",ADD_FRIEND:\"friend_add\",UPDATE_FRIEND:\"friend_update\",GET_FRIEND_LIST:\"friend_get\",GET_FRIEND_PROFILE:\"friend_get_specified\",DELETE_FRIEND:\"friend_delete\",CHECK_FRIEND:\"friend_check\",GET_FRIEND_GROUP_LIST:\"group_get\",RESPOND_FRIEND_APPLICATION:\"friend_response\",GET_FRIEND_APPLICATION_LIST:\"pendency_get\",DELETE_FRIEND_APPLICATION:\"pendency_delete\",REPORT_FRIEND_APPLICATION:\"pendency_report\",GET_GROUP_APPLICATION:\"get_pendency\",CREATE_FRIEND_GROUP:\"group_add\",DELETE_FRIEND_GROUP:\"group_delete\",UPDATE_FRIEND_GROUP:\"group_update\",GET_BLACKLIST:\"black_list_get\",ADD_BLACKLIST:\"black_list_add\",DELETE_BLACKLIST:\"black_list_delete\",CREATE_GROUP:\"create_group\",GET_JOINED_GROUPS:\"get_joined_group_list\",SET_GROUP_ATTRIBUTES:\"set_group_attr\",MODIFY_GROUP_ATTRIBUTES:\"modify_group_attr\",DELETE_GROUP_ATTRIBUTES:\"delete_group_attr\",CLEAR_GROUP_ATTRIBUTES:\"clear_group_attr\",GET_GROUP_ATTRIBUTES:\"get_group_attr\",SEND_MESSAGE:\"sendmsg\",REVOKE_C2C_MESSAGE:\"msgwithdraw\",DELETE_C2C_MESSAGE:\"delete_c2c_msg_ramble\",MODIFY_C2C_MESSAGE:\"modify_c2c_msg\",MODIFY_C2C_MESSAGE_EXTENSIONS:\"set_key_values\",GET_C2C_MESSAGE_EXTENSIONS:\"get_key_values\",SEND_GROUP_MESSAGE:\"send_group_msg\",REVOKE_GROUP_MESSAGE:\"group_msg_recall\",DELETE_GROUP_MESSAGE:\"delete_group_ramble_msg_by_seq\",MODIFY_GROUP_MESSAGE:\"modify_group_msg\",MODIFY_GROUP_MESSAGE_EXTENSIONS:\"group_set_key_values\",GET_GROUP_MESSAGE_EXTENSIONS:\"group_get_key_values\",GET_GROUP_INFO:\"get_group_self_member_info\",GET_GROUP_MEMBER_INFO:\"get_specified_group_member_info\",GET_GROUP_MEMBER_LIST:\"get_group_member_info\",GET_AVCHATROOM_MEMBER_LIST:\"get_members\",MARK_AVCHATROOM_MEMBER_INFO:\"modify_user_info\",QUIT_GROUP:\"quit_group\",CHANGE_GROUP_OWNER:\"change_group_owner\",DESTROY_GROUP:\"destroy_group\",ADD_GROUP_MEMBER:\"add_group_member\",DELETE_GROUP_MEMBER:\"delete_group_member\",BAN_AVCHATROOM_MEMBER:\"ban_group_member\",SEARCH_GROUP_BY_ID:\"get_group_public_info\",APPLY_JOIN_GROUP:\"apply_join_group\",HANDLE_APPLY_JOIN_GROUP:\"handle_apply_join_group\",HANDLE_GROUP_INVITATION:\"handle_invite_join_group\",MODIFY_GROUP_INFO:\"modify_group_base_info\",MODIFY_GROUP_MEMBER_INFO:\"modify_group_member_info\",DELETE_GROUP_SYSTEM_MESSAGE:\"deletemsg\",DELETE_GROUP_AT_TIPS:\"deletemsg\",GET_GROUP_NOTIFY:\"get_group_notify\",GET_CONVERSATION_LIST:\"get\",PAGING_GET_CONVERSATION_LIST:\"page_get\",DELETE_CONVERSATION:\"delete\",CLEAR_HISTORY_MESSAGE:\"clear_msg\",PIN_CONVERSATION:\"top\",SET_CONVERSATION_CUSTOM_DATA:\"mark_contact\",MARK_CONVERSATION:\"mark_contact\",CREATE_CONVERSATION_GROUP:\"create_contact_group\",DELETE_CONVERSATION_GROUP:\"del_contact_group\",UPDATE_CONVERSATION_GROUP:\"update_contact_group\",GET_CONVERSATION_GROUP_LIST:\"get_contact_group\",GET_MESSAGES:\"getmsg\",GET_C2C_ROAM_MESSAGES:\"getroammsg\",SET_C2C_PEER_MUTE_NOTIFICATIONS:\"set_c2c_peer_mute_notifications\",GET_C2C_PEER_MUTE_NOTIFICATIONS:\"get_c2c_peer_mute_notifications\",GET_GROUP_ROAM_MESSAGES:\"group_msg_get\",GET_READ_RECEIPT:\"get_group_msg_receipt\",GET_READ_RECEIPT_DETAIL:\"get_group_msg_receipt_detail\",SEND_READ_RECEIPT:\"group_msg_receipt\",SEND_C2C_READ_RECEIPT:\"c2c_msg_read_receipt\",SET_C2C_MESSAGE_READ:\"msgreaded\",GET_PEER_READ_TIME:\"get_peer_read_time\",SET_GROUP_MESSAGE_READ:\"msg_read_report\",FILE_READ_AND_WRITE_AUTHKEY:\"authkey\",FILE_UPLOAD:\"pic_up\",COS_SIGN:\"cos\",COS_PRE_SIG:\"pre_sig\",VIDEO_COVER:\"video_cover\",TIM_WEB_REPORT_V2:\"tim_web_report_v2\",BIG_DATA_HALLWAY_AUTH_KEY:\"authkey\",GET_ONLINE_MEMBER_NUM:\"get_online_member_num\",ALIVE:\"alive\",MESSAGE_PUSH:\"msg_push\",MULTI_MESSAGE_PUSH:\"multi_msg_push_ws\",MESSAGE_PUSH_ACK:\"ws_msg_push_ack\",STATUS_FORCE_OFFLINE:\"stat_forceoffline\",DOWNLOAD_MERGER_MESSAGE:\"get_relay_json_msg\",UPLOAD_MERGER_MESSAGE:\"save_relay_json_msg\",FETCH_CLOUD_CONTROL_CONFIG:\"fetch_config\",PUSHED_CLOUD_CONTROL_CONFIG:\"push_configv2\",FETCH_COMMERCIAL_CONFIG:\"fetch_imsdk_purchase_bitsv2\",PUSHED_COMMERCIAL_CONFIG:\"push_imsdk_purchase_bitsv2\",KICK_OTHER:\"KickOther\",OVERLOAD_NOTIFY:\"notify2\",SET_ALL_MESSAGE_READ:\"read_all_unread_msg\",CREATE_TOPIC:\"create_topic\",DELETE_TOPIC:\"destroy_topic\",UPDATE_TOPIC_PROFILE:\"modify_topic\",GET_TOPIC_LIST:\"get_topic\",SET_SELF_STATUS:\"ws_set_custom_status\",GET_USER_STATUS:\"ws_get_user_status\",SUBSCRIBE_USER_STATUS:\"ws_status_subscribe\",UNSUBSCRIBE_USER_STATUS:\"ws_status_unsubscribe\",GET_RPOFANITY_LIST:\"get_local_words\",TRANSLATE_TEXT:\"ws_batch_trans_text\",UPDATE_GROUP_COUNTER:\"update_group_counter\",GET_GROUP_COUNTER:\"get_group_counter\"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:\"v4\",group_open_http_svc:\"v4\",sns:\"v4\",profile:\"v4\",recentcontact:\"v4\",openpic:\"v4\",group_open_http_noauth_svc:\"v4\",group_open_long_polling_http_svc:\"v4\",group_open_long_polling_http_noauth_svc:\"v4\",imopenstat:\"v4\",im_cos_sign_svr:\"v4\",im_cos_msg:\"v4\",webim:\"v4\",im_open_push:\"v4\",im_open_status:\"v4\"}},W={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString()},Y=\"c2c_text_message\",j=\"c2c_custom_message\",$=\"group_text_message\",z=\"group_custom_message\",J=\"user_profile\",X=\"group_profile\",Q=\"group_member_profile\";H.HOST.setCurrent(b);var Z,ee,te,oe,ne=\"undefined\"!=typeof wx&&\"function\"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),ae=\"undefined\"!=typeof qq&&\"function\"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),se=\"undefined\"!=typeof tt&&\"function\"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),re=\"undefined\"!=typeof swan&&\"function\"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ie=\"undefined\"!=typeof my&&\"function\"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ce=\"undefined\"!=typeof uni&&\"undefined\"==typeof window,ue=\"undefined\"!=typeof uni,le=ne||ae||se||re||ie||ce,de=(\"undefined\"!=typeof uni||\"undefined\"!=typeof window)&&!le,pe=ae?qq:se?tt:re?swan:ie?my:ne?wx:ce?uni:{},ge=(Z=\"WEB\",Ae?Z=\"WEB\":ae?Z=\"QQ_MP\":se?Z=\"TT_MP\":re?Z=\"BAIDU_MP\":ie?Z=\"ALI_MP\":ne?Z=\"WX_MP\":ce&&(Z=\"UNI_NATIVE_APP\"),G[Z]),_e=de&&window&&window.navigator&&window.navigator.userAgent||\"\",he=/AppleWebKit\\/([\\d.]+)/i.exec(_e),fe=(he&&parseFloat(he.pop()),/iPad/i.test(_e)),me=/iPhone/i.test(_e)&&!fe,ve=/iPod/i.test(_e),Me=me||fe||ve,ye=(ee=_e.match(/OS (\\d+)_/i))&&ee[1]?ee[1]:null,Ie=/Android/i.test(_e),Ce=function(){var e=_e.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),o=e[2]&&parseFloat(e[2]);return t&&o?parseFloat(e[1]+\".\"+e[2]):t||null}(),Te=(Ie&&/webkit/i.test(_e),/Firefox/i.test(_e),/Edge/i.test(_e)),Ee=!Te&&/Chrome/i.test(_e),Se=(function(){var e=_e.match(/Chrome\\/(\\d+)/);e&&e[1]&&parseFloat(e[1])}(),/MSIE/.test(_e)||_e.indexOf(\"Trident\")>-1&&_e.indexOf(\"rv:11.0\")>-1),De=(/MSIE\\s8\\.0/.test(_e),function(){var e=/MSIE\\s(\\d+)\\.\\d/.exec(_e),t=e&&parseFloat(e[1]);return!t&&/Trident\\/7.0/i.test(_e)&&/rv:11.0/.test(_e)&&(t=11),t}()),Ne=(/Safari/i.test(_e),/TBS\\/\\d+/i.test(_e)),Ae=(function(){var e=_e.match(/TBS\\/(\\d+)/i);if(e&&e[1])e[1]}(),!Ne&&/MQQBrowser\\/\\d+/i.test(_e),!Ne&&/ QQBrowser\\/\\d+/i.test(_e),/(micromessenger|webbrowser)/i.test(_e)),ke=/Windows/i.test(_e),Re=/MAC OS X/i.test(_e),Le=(/MicroMessenger/i.test(_e),de&&\"undefined\"!=typeof Worker&&!Se),Oe=Ie||Me,Ge=de&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,Pe=\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{};te=\"undefined\"!=typeof console?console:void 0!==Pe&&Pe.console?Pe.console:\"undefined\"!=typeof window&&window.console?window.console:{};for(var Ue=function(){},be=[\"assert\",\"clear\",\"count\",\"debug\",\"dir\",\"dirxml\",\"error\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"log\",\"profile\",\"profileEnd\",\"table\",\"time\",\"timeEnd\",\"timeStamp\",\"trace\",\"warn\"],we=be.length;we--;)oe=be[we],console[oe]||(te[oe]=Ue);var Fe=te,qe=0,xe=function(){return(new Date).getTime()+qe},Ve=function(){qe=0},Be=function(){return Math.floor(xe()/1e3)},Ke=0;function He(){return Zt()?\"%c TIM %c\":\"TIM\"}function We(){var e,t=((e=new Date).setTime(xe()),e);return t.toLocaleTimeString(\"en-US\",{hour12:!1})+\".\"+function(e){var t;switch(e.toString().length){case 1:t=\"00\"+e;break;case 2:t=\"0\"+e;break;default:t=e}return t}(t.getMilliseconds())}var Ye={arguments2String:function(e){var t=\"\";if(1===e.length)t=e[0];else for(var o=0,n=e.length;o4294967295?(mt+=4294967295,Date.now()-mt):e},Mt=function e(t,o,n,a){if(!pt(t)||!pt(o))return 0;for(var s,r=0,i=Object.keys(o),c=0,u=i.length;c=0?n[s]=t[s]:n[s]=e(t[s])):n[s]=void 0:n[s]=null;return n};function kt(e,t){lt(e)&<(t)&&t.forEach((function(t){var o=t.key,n=t.value,a=e.find((function(e){return e.key===o}));a?a.value=n:e.push({key:o,value:n})}))}var Rt=function(e){return e===D.GRP_PUBLIC},Lt=function(e){return e===D.GRP_AVCHATROOM},Ot=function(e){var t=e.type,o=e.groupID;return t===D.GRP_COMMUNITY||\"\".concat(o).startsWith(et)&&!\"\".concat(o).includes(ot)},Gt=function(e){return\"\".concat(e).startsWith(et)&&\"\".concat(e).includes(ot)},Pt=function(e){return it(e)&&e.slice(0,3)===D.CONV_C2C},Ut=function(e){return it(e)&&e.slice(0,5)===D.CONV_GROUP},bt=function(e){return it(e)&&e===D.CONV_SYSTEM};function wt(e,t){var o={};return Object.keys(e).forEach((function(n){o[n]=t(e[n],n)})),o}function Ft(e){return le?new Promise((function(t,o){pe.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):Se&&9===De?Promise.resolve({width:0,height:0}):new Promise((function(t,o){var n=new Image;n.onload=function(){t({width:this.width,height:this.height}),n=null},n.onerror=function(){t({width:0,height:0}),n=null},n.src=e}))}function qt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return\"\".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function xt(){var e=\"unknown\";if(Re&&(e=\"mac\"),ke&&(e=\"windows\"),Me&&(e=\"ios\"),Ie&&(e=\"android\"),le)try{var t=pe.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(o){}return e}function Vt(e,t){e=e.split(\".\"),t=t.split(\".\");for(var o=Math.max(e.length,t.length);e.lengths)return 1;if(a-1?\"\".concat(o,\"&\"):\"\".concat(o,\"?\");u.url=\"\".concat(l,198===r?\"imageView2/3/w/198/h/198\":\"imageView2/3/w/720/h/720\")}return dt(o)?g(u,nt):u}function Kt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var o=0;o=0;n--)\"1\"===e[n]&&t.push(Math.pow(2,o-n-1));return t}function Qt(e){return 0===e||e>=2e7&&e<8e7||e>=172e7&&e<178e7}function Zt(){return!Se&&!le}function eo(e){return\"the length of userIDList cannot exceed \".concat(e)}var to=Object.prototype.hasOwnProperty;function oo(e){if(null==e)return!0;if(\"boolean\"==typeof e)return!1;if(\"number\"==typeof e)return 0===e;if(\"string\"==typeof e)return 0===e.length;if(\"function\"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return\"\"===e.message;if(ut(e)){for(var t in e)if(to.call(e,t))return!1;return!0}return!(!at(e)&&(o=e,\"set\"!==ht(o))&&!st(e))&&0===e.size;var o}function no(e,t,o){if(void 0===t)return!0;var n=!0;if(\"object\"===R(t).toLowerCase())Object.keys(t).forEach((function(a){var s=1===e.length?e[0][a]:void 0;n=!!ao(s,t[a],o,a)&&n}));else if(\"array\"===R(t).toLowerCase())for(var a=0;a256)||(Ye.warn(lo({api:\"setConversationCustomData\",param:\"customData\",desc:Co(\"customData\",256)})),!1):(Ye.warn(lo({api:\"setConversationCustomData\",param:\"customData\",desc:po()})),!1)}}},markConversation:{conversationIDList:t({},Oo),markType:{type:\"number\",validator:function(e){return rt(e)?e<=0?(Ye.warn(lo({api:\"markConversation\",param:\"markType\",desc:(t=\"markType\",o=0,co?\"\".concat(t,\" must be greater than \").concat(o):\"\".concat(t,\" 必须大于\").concat(o))})),!1):!(e>=Math.pow(2,64))||(Ye.warn(lo({api:\"markConversation\",param:\"markType\",desc:To(\"markType\",\"Math.pow(2,64)\")})),!1):(Ye.warn(lo({api:\"markConversation\",param:\"markType\",desc:_o()})),!1);var t,o}},enableMark:t({},Po)},createConversationGroup:{conversationIDList:t({},Oo),groupName:t(t({},Lo),{},{validator:function(e){return!!e&&(!(e.length>32)||(Ye.warn(lo({api:\"createConversationGroup\",param:\"groupName\",desc:Co(\"groupName\",32)})),!1))}})},deleteConversationGroup:[t({name:\"groupName\"},Lo)],renameConversationGroup:{oldName:t({},Lo),newName:t(t({},Lo),{},{validator:function(e){return!!e&&(!(e.length>32)||(Ye.warn(lo({api:\"renameConversationGroup\",param:\"newName\",desc:Co(\"newName\",32)})),!1))}})},addConversationsToGroup:{conversationIDList:t({},Oo),groupName:t({},Lo)},deleteConversationsFromGroup:{conversationIDList:t({},Oo),groupName:t({},Lo)},getGroupList:{groupProfileFilter:{type:\"Array\"}},getGroupProfile:{groupID:Lo,groupCustomFieldFilter:{type:\"Array\"},memberCustomFieldFilter:{type:\"Array\"}},getGroupProfileAdvance:{groupIDList:Oo},createGroup:{name:Lo},joinGroup:{groupID:Lo,type:{type:\"String\"},applyMessage:{type:\"String\"}},quitGroup:[t({name:\"groupID\"},Lo)],handleApplication:{message:Go,handleAction:Lo,handleMessage:{type:\"String\"}},changeGroupOwner:{groupID:Lo,newOwnerID:Lo},updateGroupProfile:{groupID:Lo,muteAllMembers:{type:\"Boolean\"}},dismissGroup:[t({name:\"groupID\"},Lo)],searchGroupByID:[t({name:\"groupID\"},Lo)],initGroupAttributes:{groupID:Lo,groupAttributes:t(t({},Go),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!it(e[o]))return Ye.warn(lo({api:\"initGroupAttributes\",param:\"groupAttributes\",desc:Eo(\"value\")})),t=!1})),t}})},setGroupAttributes:{groupID:Lo,groupAttributes:t(t({},Go),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(o){if(!it(e[o]))return Ye.warn(lo({api:\"setGroupAttributes\",param:\"groupAttributes\",desc:Eo(\"value\")})),t=!1})),t}})},deleteGroupAttributes:{groupID:Lo,keyList:{type:\"Array\",validator:function(e){if(dt(e)||!lt(e))return Ye.warn(lo({api:\"deleteGroupAttributes\",param:\"keyList\",desc:vo()})),!1;if(!oo(e)){var t=!0;return e.forEach((function(e){if(!it(e))return Ye.warn(lo({api:\"deleteGroupAttributes\",param:\"keyList\",desc:co?\"Type of the array element must be String\":\"数组元素的类型必须为 String\"})),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Lo,keyList:{type:\"Array\",validator:function(e){if(dt(e)||!lt(e))return Ye.warn(lo({api:\"getGroupAttributes\",param:\"keyList\",desc:vo()})),!1;if(!oo(e)){var t=!0;return e.forEach((function(e){if(!it(e))return Ye.warn(lo({api:\"getGroupAttributes\",param:\"keyList\",desc:Eo(\"key\")})),t=!1})),t}return!0}}},setGroupCounters:{groupID:Lo,counters:Go},increaseGroupCounter:{groupID:Lo,key:Lo,value:Uo},decreaseGroupCounter:{groupID:Lo,key:Lo,value:Uo},getGroupCounters:{groupID:Lo},getGroupMemberList:{groupID:Lo,count:{type:\"Number\"}},getGroupMemberProfile:{groupID:Lo,userIDList:Oo,memberCustomFieldFilter:{type:\"Array\"}},addGroupMember:{groupID:Lo,userIDList:Oo},setGroupMemberRole:{groupID:Lo,userID:Lo,role:Lo},setGroupMemberMuteTime:{groupID:Lo,userID:Lo,muteTime:{type:\"Number\",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Lo,userID:{type:\"String\"},nameCard:{type:\"String\",validator:function(e){return it(e)?(e.length,!0):(Ye.warn(lo({api:\"setGroupMemberNameCard\",param:\"nameCard\",desc:po()})),!1)}}},setGroupMemberCustomField:{groupID:Lo,userID:{type:\"String\"},memberCustomField:Oo},deleteGroupMember:{groupID:Lo},markGroupMemberList:{groupID:Lo,markType:{type:\"number\",validator:function(e){return rt(e)?!(e<1e3)||(Ye.warn(lo({api:\"markGroupMemberList\",param:\"markType\",desc:(t=\"markType\",o=1e3,co?\"\".concat(t,\" must be greater than or equal to \").concat(o):\"\".concat(t,\" 必须大于或等于\").concat(o))})),!1):(Ye.warn(lo({api:\"markGroupMemberList\",param:\"markType\",desc:_o()})),!1);var t,o}},userIDList:t({},Oo),enableMark:t({},Po)},createTextMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.text)?0!==e.text.length||(Ye.warn(lo({api:\"createTextMessage\",param:\"payload.text\",desc:Do()})),!1):(Ye.warn(lo({api:\"createTextMessage\",param:\"payload.text\",desc:po()})),!1):(Ye.warn(lo({api:\"createTextMessage\",param:\"payload\",desc:So()})),!1)}})},createTextAtMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.text)?0===e.text.length?(Ye.warn(lo({api:\"createTextAtMessage\",param:\"payload.text\",desc:Do()})),!1):!(e.atUserList&&!lt(e.atUserList))||(Ye.warn(lo({api:\"createTextAtMessage\",param:\"payload.atUserList\",desc:vo()})),!1):(Ye.warn(lo({api:\"createTextAtMessage\",param:\"payload.text\",desc:po()})),!1):(Ye.warn(lo({api:\"createTextAtMessage\",param:\"payload\",desc:So()})),!1)}})},createCustomMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?e.data&&!it(e.data)?(Ye.warn(lo({api:\"createCustomMessage\",param:\"payload.data\",desc:po()})),!1):e.description&&!it(e.description)?(Ye.warn(lo({api:\"createCustomMessage\",param:\"payload.description\",desc:po()})),!1):!(e.extension&&!it(e.extension))||(Ye.warn(lo({api:\"createCustomMessage\",param:\"payload.extension\",desc:po()})),!1):(Ye.warn(lo({api:\"createCustomMessage\",param:\"payload\",desc:So()})),!1)}})},createImageMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:\"createImageMessage\",param:\"payload\",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:\"createImageMessage\",param:\"payload.file\",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&\"undefined\"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ye.warn(lo({api:\"createImageMessage\",param:\"payload.file\",desc:No()})),!1):(Ye.warn(lo({api:\"createImageMessage\",param:\"payload.file\",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:\"createImageMessage\",param:\"payload.file\",desc:No()})),!1}return!0},onProgress:{type:\"Function\",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:\"createImageMessage\",param:\"onProgress\",desc:yo()})),!0}}})},createAudioMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return!!ut(e)||(Ye.warn(lo({api:\"createAudioMessage\",param:\"payload\",desc:So()})),!1)}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:\"createAudioMessage\",param:\"onProgress\",desc:yo()})),!0}}},createVideoMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:\"createVideoMessage\",param:\"payload\",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:\"createVideoMessage\",param:\"payload.file\",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&\"undefined\"!=typeof uni?!!st(e.file.tempFile)||(Ye.warn(lo({api:\"createVideoMessage\",param:\"payload.file\",desc:No()})),!1):(Ye.warn(lo({api:\"createVideoMessage\",param:\"payload.file\",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:\"createVideoMessage\",param:\"payload.file\",desc:No()})),!1}return!0}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:\"createVideoMessage\",param:\"onProgress\",desc:yo()})),!0}}},createFaceMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?rt(e.index)?!!it(e.data)||(Ye.warn(lo({api:\"createFaceMessage\",param:\"payload.data\",desc:po()})),!1):(Ye.warn(lo({api:\"createFaceMessage\",param:\"payload.index\",desc:_o()})),!1):(Ye.warn(lo({api:\"createFaceMessage\",param:\"payload\",desc:So()})),!1)}})},createFileMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(!ut(e))return Ye.warn(lo({api:\"createFileMessage\",param:\"payload\",desc:So()})),!1;if(dt(e.file))return Ye.warn(lo({api:\"createFileMessage\",param:\"payload.file\",desc:ho()})),!1;if(de){if(!(e.file instanceof HTMLInputElement||st(e.file)))return ut(e.file)&&\"undefined\"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ye.warn(lo({api:\"createFileMessage\",param:\"payload.file\",desc:No()})),!1):(Ye.warn(lo({api:\"createFileMessage\",param:\"payload.file\",desc:fo()})),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ye.warn(lo({api:\"createFileMessage\",param:\"payload.file\",desc:No()})),!1}return!0}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return dt(e)&&Ye.warn(lo({api:\"createFileMessage\",param:\"onProgress\",desc:yo()})),!0}}},createLocationMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){return ut(e)?it(e.description)?rt(e.longitude)?!!rt(e.latitude)||(Ye.warn(lo({api:\"createLocationMessage\",param:\"payload.latitude\",desc:_o()})),!1):(Ye.warn(lo({api:\"createLocationMessage\",param:\"payload.longitude\",desc:_o()})),!1):(Ye.warn(lo({api:\"createLocationMessage\",param:\"payload.description\",desc:po()})),!1):(Ye.warn(lo({api:\"createLocationMessage\",param:\"payload\",desc:So()})),!1)}})},createMergerMessage:{to:Lo,conversationType:Lo,payload:t(t({},Go),{},{validator:function(e){if(oo(e.messageList))return Ye.warn(lo({api:\"createMergerMessage\",param:\"payload.messageList\",desc:Mo()})),!1;if(oo(e.compatibleText))return Ye.warn(lo({api:\"createMergerMessage\",param:\"payload.compatibleText\",desc:go(\"compatibleText\")})),!1;var t=!1;return e.messageList.forEach((function(e){e.status===ro.FAIL&&(t=!0)})),!t||(Ye.warn(lo({api:\"createMergerMessage\",param:\"payload.messageList\",desc:co?\"Does not support combining messages that failed to sent\":\"不支持合并已发送失败的消息\"})),!1)}})},revokeMessage:[t(t({name:\"message\"},Go),{},{validator:function(e){return oo(e)?(Ye.warn(lo({api:\"revokeMessage\",param:\"message\",desc:Ao()})),!1):e.conversationType===D.CONV_SYSTEM?(Ye.warn(lo({api:\"revokeMessage\",param:\"message\",desc:co?\"Only one-to-one or group message can be recalled\":\"不支持撤回系统会话消息,只支持撤回单聊消息或群消息\"})),!1):!0!==e.isRevoked||(Ye.warn(lo({api:\"revokeMessage\",param:\"message\",desc:co?\"Message has been recalled\":\"消息已经被撤回,请勿重复操作\"})),!1)}})],deleteMessage:[t(t({name:\"messageList\"},Oo),{},{validator:function(e){return!oo(e)||(Ye.warn(lo({api:\"deleteMessage\",param:\"messageList\",desc:Mo()})),!1)}})],translateText:{sourceTextList:Oo,sourceLanguage:Lo,targetLanguage:Lo},modifyMessage:[t(t({name:\"message\"},Go),{},{validator:function(e){return oo(e)?(Ye.warn(lo({api:\"modifyMessage\",param:\"message\",desc:Ao()})),!1):e.conversationType===D.CONV_SYSTEM?(Ye.warn(lo({api:\"modifyMessage\",param:\"message\",desc:co?\"Only one-to-one or group message can be modified\":\"不支持修改系统会话消息,只支持修改单聊消息或群消息\"})),!1):!0!==e._onlineOnlyFlag||(Ye.warn(lo({api:\"modifyMessage\",param:\"message\",desc:co?\"Does not support modifying online message\":\"不支持修改在线消息\"})),!1)}})],getUserProfile:{userIDList:{type:\"Array\",validator:function(e){return lt(e)?(0===e.length&&Ye.warn(lo({api:\"getUserProfile\",param:\"userIDList\",desc:Mo()})),!0):(Ye.warn(lo({api:\"getUserProfile\",param:\"userIDList\",desc:vo()})),!1)}}},updateMyProfile:{profileCustomField:{type:\"Array\",validator:function(e){return!!dt(e)||(!!lt(e)||(Ye.warn(lo({api:\"updateMyProfile\",param:\"profileCustomField\",desc:vo()})),!1))}}},setSelfStatus:{customStatus:{type:\"String\",validator:function(e){return!!it(e)||(Ye.warn(lo({api:\"setSelfStatus\",param:\"customStatus\",desc:po()})),!1)}}},getUserStatus:{userIDList:{type:\"Array\",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:\"getUserStatus\",param:\"userIDList\",desc:Mo()})),!1):(Ye.warn(lo({api:\"getUserStatus\",param:\"userIDList\",desc:vo()})),!1)}}},subscribeUserStatus:{userIDList:{type:\"Array\",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:\"subscribeUserStatus\",param:\"userIDList\",desc:Mo()})),!1):(Ye.warn(lo({api:\"subscribeUserStatus\",param:\"userIDList\",desc:vo()})),!1)}}},unsubscribeUserStatus:{userIDList:{type:\"Array\",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:\"subscribeUserStatus\",param:\"userIDList\",desc:vo()})),!1))}}},addFriend:{to:Lo,source:{type:\"String\",required:!0,validator:function(e){return!!e&&(e.startsWith(\"AddSource_Type_\")?!(e.replace(\"AddSource_Type_\",\"\").length>8)||(Ye.warn(lo({api:\"addFriend\",param:\"source\",desc:Co(\"keyword\",8)})),!1):(Ye.warn(lo({api:\"addFriend\",param:\"source\",desc:co?\"The prefix of the source field is AddSource_Type_\":\"前缀必须是:AddSource_Type_\"})),!1))}},remark:{type:\"String\",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(Ye.warn(lo({api:\"addFriend\",param:\"remark\",desc:Co(\"remark\",96)})),!1)}}},deleteFriend:{userIDList:Oo},checkFriend:{userIDList:Oo},getFriendProfile:{userIDList:Oo},updateFriend:{userID:Lo,remark:{type:\"String\",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(Ye.warn(lo({api:\"updateFriend\",param:\"remark\",desc:Co(\"remark\",96)})),!1)}},friendCustomField:{type:\"Array\",required:!1,validator:function(e){if(e){if(!lt(e))return Ye.warn(lo({api:\"updateFriend\",param:\"friendCustomField\",desc:vo()})),!1;var t=!0;return e.forEach((function(e){return it(e.key)&&-1!==e.key.indexOf(\"Tag_SNS_Custom\")?it(e.value)?e.key.replace(\"Tag_SNS_Custom_\",\"\").length>8?(Ye.warn(lo({api:\"updateFriend\",param:\"friendCustomField\",desc:Co(\"keyword\",8)})),t=!1):void 0:(Ye.warn(lo({api:\"updateFriend\",param:\"friendCustomField\",desc:Eo(\"value\")})),t=!1):(Ye.warn(lo({api:\"updateFriend\",param:\"friendCustomField\",desc:co?\"The prefix of the friendCustomField is Tag_SNS_Custom\":\"前缀必须是 Tag_SNS_Custom\"})),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Lo},refuseFriendApplication:{userID:Lo},deleteFriendApplication:{userID:Lo},createFriendGroup:{name:Lo},deleteFriendGroup:{name:Lo},addToFriendGroup:{name:Lo,userIDList:Oo},removeFromFriendGroup:{name:Lo,userIDList:Oo},renameFriendGroup:{oldName:Lo,newName:Lo},sendMessageReadReceipt:[{name:\"messageList\",type:\"Array\",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:\"sendMessageReadReceipt\",param:\"messageList\",desc:Mo()})),!1):(Ye.warn(lo({api:\"sendMessageReadReceipt\",param:\"messageList\",desc:vo()})),!1)}}],getMessageReadReceiptList:[{name:\"messageList\",type:\"Array\",validator:function(e){return lt(e)?0!==e.length||(Ye.warn(lo({api:\"getMessageReadReceiptList\",param:\"messageList\",desc:Mo()})),!1):(Ye.warn(lo({api:\"getMessageReadReceiptList\",param:\"messageList\",desc:vo()})),!1)}}],createTopicInCommunity:{groupID:Lo,topicName:Lo},deleteTopicFromCommunity:{groupID:Lo,topicIDList:{type:\"Array\",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:\"deleteTopicFromCommunity\",param:\"topicIDList\",desc:vo()})),!1))}}},updateTopicProfile:{groupID:Lo,topicID:Lo},getTopicList:{groupID:Lo,topicIDList:{type:\"Array\",validator:function(e){return!e||(!!lt(e)||(Ye.warn(lo({api:\"getTopicList\",param:\"topicIDList\",desc:vo()})),!1))}}}},wo={login:\"login\",logout:\"logout\",on:\"on\",once:\"once\",off:\"off\",setLogLevel:\"setLogLevel\",registerPlugin:\"registerPlugin\",destroy:\"destroy\",createTextMessage:\"createTextMessage\",createTextAtMessage:\"createTextAtMessage\",createImageMessage:\"createImageMessage\",createAudioMessage:\"createAudioMessage\",createVideoMessage:\"createVideoMessage\",createCustomMessage:\"createCustomMessage\",createFaceMessage:\"createFaceMessage\",createFileMessage:\"createFileMessage\",createLocationMessage:\"createLocationMessage\",createMergerMessage:\"createMergerMessage\",downloadMergerMessage:\"downloadMergerMessage\",createForwardMessage:\"createForwardMessage\",sendMessage:\"sendMessage\",resendMessage:\"resendMessage\",revokeMessage:\"revokeMessage\",deleteMessage:\"deleteMessage\",translateText:\"translateText\",modifyMessage:\"modifyMessage\",sendMessageReadReceipt:\"sendMessageReadReceipt\",getGroupMessageReadMemberList:\"getGroupMessageReadMemberList\",getMessageReadReceiptList:\"getMessageReadReceiptList\",setMessageExtensions:\"setMessageExtensions\",getMessageExtensions:\"getMessageExtensions\",deleteMessageExtensions:\"deleteMessageExtensions\",getMessageList:\"getMessageList\",findMessage:\"findMessage\",getMessageListHopping:\"getMessageListHopping\",setMessageRead:\"setMessageRead\",setAllMessageRead:\"setAllMessageRead\",getConversationList:\"getConversationList\",getConversationProfile:\"getConversationProfile\",deleteConversation:\"deleteConversation\",pinConversation:\"pinConversation\",getTotalUnreadMessageCount:\"getTotalUnreadMessageCount\",setConversationCustomData:\"setConversationCustomData\",markConversation:\"markConversation\",createConversationGroup:\"createConversationGroup\",getConversationGroupList:\"getConversationGroupList\",deleteConversationGroup:\"deleteConversationGroup\",renameConversationGroup:\"renameConversationGroup\",addConversationsToGroup:\"addConversationsToGroup\",deleteConversationsFromGroup:\"deleteConversationsFromGroup\",clearHistoryMessage:\"clearHistoryMessage\",getGroupList:\"getGroupList\",getGroupProfile:\"getGroupProfile\",createGroup:\"createGroup\",joinGroup:\"joinGroup\",updateGroupProfile:\"updateGroupProfile\",quitGroup:\"quitGroup\",dismissGroup:\"dismissGroup\",changeGroupOwner:\"changeGroupOwner\",searchGroupByID:\"searchGroupByID\",setMessageRemindType:\"setMessageRemindType\",getGroupApplicationList:\"getGroupApplicationList\",handleGroupApplication:\"handleGroupApplication\",initGroupAttributes:\"initGroupAttributes\",setGroupAttributes:\"setGroupAttributes\",deleteGroupAttributes:\"deleteGroupAttributes\",getGroupAttributes:\"getGroupAttributes\",setGroupCounters:\"setGroupCounters\",increaseGroupCounter:\"increaseGroupCounter\",decreaseGroupCounter:\"decreaseGroupCounter\",getGroupCounters:\"getGroupCounters\",getJoinedCommunityList:\"getJoinedCommunityList\",createTopicInCommunity:\"createTopicInCommunity\",deleteTopicFromCommunity:\"deleteTopicFromCommunity\",updateTopicProfile:\"updateTopicProfile\",getTopicList:\"getTopicList\",getGroupMemberProfile:\"getGroupMemberProfile\",getGroupMemberList:\"getGroupMemberList\",addGroupMember:\"addGroupMember\",deleteGroupMember:\"deleteGroupMember\",setGroupMemberNameCard:\"setGroupMemberNameCard\",setGroupMemberMuteTime:\"setGroupMemberMuteTime\",setGroupMemberRole:\"setGroupMemberRole\",setGroupMemberCustomField:\"setGroupMemberCustomField\",getGroupOnlineMemberCount:\"getGroupOnlineMemberCount\",markGroupMemberList:\"markGroupMemberList\",getMyProfile:\"getMyProfile\",getUserProfile:\"getUserProfile\",updateMyProfile:\"updateMyProfile\",setSelfStatus:\"setSelfStatus\",getUserStatus:\"getUserStatus\",subscribeUserStatus:\"subscribeUserStatus\",unsubscribeUserStatus:\"unsubscribeUserStatus\",getBlacklist:\"getBlacklist\",addToBlacklist:\"addToBlacklist\",removeFromBlacklist:\"removeFromBlacklist\",getFriendList:\"getFriendList\",addFriend:\"addFriend\",deleteFriend:\"deleteFriend\",checkFriend:\"checkFriend\",updateFriend:\"updateFriend\",getFriendProfile:\"getFriendProfile\",getFriendApplicationList:\"getFriendApplicationList\",refuseFriendApplication:\"refuseFriendApplication\",deleteFriendApplication:\"deleteFriendApplication\",acceptFriendApplication:\"acceptFriendApplication\",setFriendApplicationRead:\"setFriendApplicationRead\",getFriendGroupList:\"getFriendGroupList\",createFriendGroup:\"createFriendGroup\",renameFriendGroup:\"renameFriendGroup\",deleteFriendGroup:\"deleteFriendGroup\",addToFriendGroup:\"addToFriendGroup\",removeFromFriendGroup:\"removeFromFriendGroup\",callExperimentalAPI:\"callExperimentalAPI\"},Fo=\"sign\",qo=\"message\",xo=\"messageExtension\",Vo=\"user\",Bo=\"c2c\",Ko=\"group\",Ho=\"sns\",Wo=\"groupMember\",Yo=\"Topic\",jo=\"conversation\",$o=\"context\",zo=\"storage\",Jo=\"eventStat\",Xo=\"netMonitor\",Qo=\"bigDataChannel\",Zo=\"upload\",en=\"plugin\",tn=\"syncUnreadMessage\",on=\"session\",nn=\"channel\",an=\"message_loss_detection\",sn=\"cloudControl\",rn=\"workerTimer\",cn=\"recoverMessage\",un=\"qualityStat\",ln=\"commercialConfig\",dn=\"offlinePush\",pn=\"profanityFilter\",gn=\"transCmd\",_n=\"comboMessage\",hn={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},fn={2e3:\"无 SDKAppID\",2022:\"无 tinyID\",2023:\"无 a2key\",2024:\"用户未登录\",2025:\"重复登录\",2040:\"未检测到上传插件\",2041:\"获取 COS 预签名 URL 失败\",2100:\"消息发送失败\",2101:\"未加入直播群不能向直播群发送消息\",2105:\"需要 Message 的实例\",2106:'Message.conversationType 只能为 \"C2C\" 或 \"GROUP\"',2108:\"无法发送空文件\",2109:\"回调函数运行时遇到错误,请检查接入侧代码\",2110:\"消息撤回失败\",2111:\"消息删除失败\",2112:\"设置所有未读消息为已读处理失败\",2114:\"消息列表中没有需要发送已读回执的消息\",2115:\"不能在支持话题的群组中发消息,请检查群组 isSupportTopic 属性\",2116:\"不支持删除群系统通知\",2117:\"翻译文本失败\",2251:\"请先选择一张图片\",2252:\"只允许上传 jpg png jpeg gif bmp image webp 格式的图片\",2253:\"图片大小超过20M,无法发送\",2300:\"语音上传失败\",2301:\"语音大小超过20M,无法发送\",2350:\"视频上传失败\",2351:\"视频大小超过100M,无法发送\",2352:\"只允许上传 mp4/mov 格式的视频\",2400:\"文件上传失败\",2401:\"请先选择一个文件\",2402:\"文件大小超过100M,无法发送\",2403:\"缺少必要的参数文件 URL\",2450:\"非合并消息\",2451:\"合并消息的 messageKey 无效\",2452:\"下载合并消息失败\",2453:\"选择的消息类型(如群提示消息)不可以转发\",2480:\"修改消息时发生冲突\",2481:\"直播群不支持修改消息\",2500:\"没有找到相应的会话,请检查传入参数\",2501:\"没有找到相应的用户或群主,请检查传入参数\",2502:\"未记录的会话类型\",2503:\"无效的会话 ID\",2600:\"非法的群类型,请检查传入参数\",2601:\"不能加入 Work 类型的群组\",2602:\"群组 ID 非法\",2603:\"找不到指定 ID 的群组\",2620:\"AVChatRoom 类型的群组不能转让群主\",2621:\"不能把群主转让给自己\",2622:\"不能解散 Work 类型的群组\",2623:\"用户不在该群组内\",2660:\"加群失败,请检查传入参数或重试\",2661:\"AVChatRoom 类型的群不支持邀请群成员\",2662:\"非 AVChatRoom 类型的群组不允许匿名加群,请先登录后再加群\",2681:\"你不是群主,只有群主才有权限操作\",2682:\"不能在 Work / AVChatRoom 类型的群中设置群成员身份\",2683:\"不合法的群成员身份,请检查传入参数\",2684:\"不能设置自己的群成员身份,请检查传入参数\",2685:\"不能将自己禁言,请检查传入参数\",2686:\"封禁时长无效,必须传入 duration 参数且要大于 0\",2700:\"指定的 userID 不是我的好友效\",2701:\"已经是好友关系\",2710:\"好友分组已经存在\",2711:\"好友分组不存在\",2716:\"好友申请不存在\",2721:\"传入 updateMyProfile 接口的参数无效\",2722:\"updateMyProfile 无标配资料字段或自定义资料字段\",2742:\"不能拉黑自己\",2800:\"网络错误\",2801:\"请求超时\",2805:\"未连接到网络\",2903:\"未经明确定义的错误\",2905:\"无效操作,如调用了未定义或者未实现的方法等\",2996:\"超出 SDK 频率控制\",2997:\"无法找到协议\",2998:\"无法找到模块,关系链使用指引:https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-03-sns.html\",2999:\"接口调用时机不合理,请等待 SDK 处于 ready 状态后再调用(监听 TIM.EVENT.SDK_READY 事件)\",3e3:\"用户正在登录中导致 sdk not ready\",3001:\"用户登录失败导致 sdk not ready\",3002:\"用户多终端登录被踢出导致 sdk not ready\",3003:\"用户多实例登录被踢出导致 sdk not ready\",3004:\"用户 userSig 过期被踢出导致 sdk not ready\",3005:\"用户已登出导致 sdk not ready\",3006:\"用户被 REST API 踢出导致 sdk not ready\",3021:\"非法的 topicID\",3122:\"套餐包不支持该接口的使用,请升级到旗舰版套餐\",3123:\"文本包含本地审核拦截词\",60022:\"后台服务正忙,请稍后再试\"},mn={2e3:\"No SDKAppID\",2022:\"No tinyID\",2023:\"No a2key\",2024:\"The user has not logged in\",2025:\"Repeated login\",2040:\"No upload plugin is detected\",2041:\"Failed to get cos presig url\",2100:\"Failed to send the message\",2101:\"Failed to send the message to an audio-video group due to not joining it\",2105:\"A message instance is required\",2106:'Message.conversationType can only be \"C2C\" or \"GROUP\"',2108:\"An empty file cannot be sent\",2109:\"An error occurred while running the callback function. Please check the code on the access side\",2110:\"Failed to recall the message\",2111:\"Failed to delete the message\",2112:\"Failed to set all messages as read\",2114:\"No messages in the message list that require a read receipt\",2115:\"Message cannot be sent to Community that supports Topic, please check the isSupportTopic property of Community\",2116:\"Group system notification cannot be deleted\",2117:\"Failed to translate the text\",2251:\"Please select an image first\",2252:\"Only JPG/PNG/JPEG/GIF images can be uploaded\",2253:\"Unable to send the image as it exceeds 20 MB\",2300:\"Failed to upload the audio\",2301:\"Unable to send the audio as it exceeds 20 MB\",2350:\"Failed to upload the video\",2351:\"Unable to send the video as it exceeds 100 MB\",2352:\"Only MP4 videos can be uploaded\",2400:\"File upload failed\",2401:\"Please select a file first\",2402:\"Unable to send the file as it exceeds 100 MB\",2403:\"The required parameter file URL is missing\",2450:\"Non-combined message\",2451:\"Invalid messageKey of the combined message\",2452:\"Failed to download the combined message\",2453:\"The selected message type (such as group notification) does not support forwarding\",2480:\"Conflict occurred while modifying message\",2481:\"Audio-video group does not support modifying messages\",2500:\"The corresponding conversation is not found. Please check the input parameters\",2501:\"The corresponding user or group owner is not found. Please check the input parameters\",2502:\"Unrecorded conversation type\",2503:\"Invalid conversationID\",2600:\"Invalid group type. Please check the input parameters\",2601:\"Unable to join a work group\",2602:\"Invalid groupID\",2603:\"The group with the given id could not be found\",2620:\"The group owner of an audio-video group cannot be changed\",2621:\"You cannot change the group owner to yourself\",2622:\"A work group cannot be disbanded\",2623:\"The user is not in the group\",2660:\"Failed to join the group. Please check the input parameters and try again\",2661:\"Audio-video groups do not support inviting group members\",2662:\"Non Audio-video groups do not allow anonymous joining. Please log in before you join the group\",2681:\"You are not the group owner. Only the group owner has the permission to perform the operation\",2682:\"You cannot set the group member role in a Work or Audio-video group\",2683:\"Invalid group member role. Please check the input parameters\",2684:\"You cannot set the group member role for yourself. Please check the input parameters\",2685:\"You cannot mute yourself. Please check the input parameters\",2686:\"Ban duration must be greater than 0\",2700:\"The specified userID is not my friend\",2701:\"The specified userID is my friend already\",2710:\"The Friend group already exists\",2711:\"The Friend group does not exist\",2716:\"The Friend application does not exist\",2721:\"Invalid parameter passed in to the updateMyProfile API\",2722:\"updateMyProfile does not contain standard or custom profile fields\",2742:\"You cannot blacklist yourself\",2800:\"Network error\",2801:\"Request timeout\",2805:\"Network disconnected\",2903:\"Undefined error\",2905:\"Invalid operation, such as calling an undefined or unimplemented method\",2996:\"Frequency control limit exceeded\",2997:\"Protocol not found\",2998:\"Module not found\",2999:\"The API call timing is inappropriate. Call the API until the SDK is ready (listening for the TIM.EVENT.SDK_READY event)\",3e3:\"SDK not ready because the user is Logging in\",3001:\"SDK not ready because the user login failed\",3002:\"SDK not ready because the user is kicked offline(the same account logs in from multiple pages on the web client)\",3003:\"SDK not ready because the user is kicked offline(the same account logs in from multiple terminals)\",3004:\"SDK not ready because the user is kicked offline(the signature expires)\",3005:\"SDK not ready because the user is logged out \",3006:\"SDK not ready because the user is kicked offline by REST API\",3021:\"Invalid topicID\",3122:\"Please upgrade to the ultimate version\",3123:\"Blocked due to filtering profanity\",60022:\"Service is busy, please try again later\"},vn=function(){function e(t){n(this,e),this._moduleManager=t,this._className=\"\"}return s(e,[{key:\"isLoggedIn\",value:function(){return this._moduleManager.getModule($o).isLoggedIn()}},{key:\"isOversea\",value:function(){return this._moduleManager.getModule($o).isOversea()}},{key:\"isPrivateNetWork\",value:function(){return this._moduleManager.getModule($o).isPrivateNetWork()}},{key:\"getMyUserID\",value:function(){return this._moduleManager.getModule($o).getUserID()}},{key:\"getMyTinyID\",value:function(){return this._moduleManager.getModule($o).getTinyID()}},{key:\"getSDKAppID\",value:function(){return this._moduleManager.getModule($o).getSDKAppID()}},{key:\"isIntl\",value:function(){return this._moduleManager.getModule($o).isIntl()}},{key:\"isDevMode\",value:function(){return this._moduleManager.getModule($o).isDevMode()}},{key:\"getModule\",value:function(e){return this._moduleManager.getModule(e)}},{key:\"getPlatform\",value:function(){return ge}},{key:\"getNetworkType\",value:function(){return this._moduleManager.getModule(Xo).getNetworkType()}},{key:\"probeNetwork\",value:function(e){return this._moduleManager.getModule(Xo).probe(e)}},{key:\"getCloudConfig\",value:function(e){return this._moduleManager.getModule(sn).getCloudConfig(e)}},{key:\"emitOuterEvent\",value:function(e,t){this._moduleManager.getOuterEmitterInstance().emit(e,t)}},{key:\"emitInnerEvent\",value:function(e,t){this._moduleManager.getInnerEmitterInstance().emit(e,t)}},{key:\"getInnerEmitterInstance\",value:function(){return this._moduleManager.getInnerEmitterInstance()}},{key:\"generateTjgID\",value:function(e){return this._moduleManager.getModule($o).getTinyID()+\"-\"+e.random}},{key:\"filterModifiedMessage\",value:function(e){if(!oo(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(S.MESSAGE_MODIFIED,t)}}},{key:\"filterUnmodifiedMessage\",value:function(e){return oo(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:\"request\",value:function(e){return this._moduleManager.getModule(on).request(e)}},{key:\"canIUse\",value:function(e){return this._moduleManager.getModule(ln).canIUse(e)}},{key:\"getErrorMessage\",value:function(e){return this.isIntl()?mn[e]:fn[e]}}]),e}(),Mn=\"wslogin\",yn=\"wslogout\",In=\"wshello\",Cn=\"KickOther\",Tn=\"getmsg\",En=\"authkey\",Sn=\"sendmsg\",Dn=\"send_group_msg\",Nn=\"portrait_get_all\",An=\"portrait_set\",kn=\"black_list_get\",Rn=\"black_list_add\",Ln=\"black_list_delete\",On=\"msgwithdraw\",Gn=\"msgreaded\",Pn=\"set_c2c_peer_mute_notifications\",Un=\"get_c2c_peer_mute_notifications\",bn=\"getroammsg\",wn=\"get_peer_read_time\",Fn=\"delete_c2c_msg_ramble\",qn=\"modify_c2c_msg\",xn=\"set_key_values\",Vn=\"get_key_values\",Bn=\"page_get\",Kn=\"get\",Hn=\"delete\",Wn=\"clear_msg\",Yn=\"top\",jn=\"deletemsg\",$n=\"set_conv_custom_data\",zn=\"mark_contact\",Jn=\"create_contact_group\",Xn=\"del_contact_group\",Qn=\"update_contact_group\",Zn=\"add_conv_to_group\",ea=\"del_conv_from_group\",ta=\"get_contact_group\",oa=\"get_joined_group_list\",na=\"get_group_self_member_info\",aa=\"create_group\",sa=\"destroy_group\",ra=\"modify_group_base_info\",ia=\"apply_join_group\",ca=\"apply_join_group_noauth\",ua=\"quit_group\",la=\"get_group_public_info\",da=\"change_group_owner\",pa=\"handle_apply_join_group\",ga=\"handle_invite_join_group\",_a=\"group_msg_recall\",ha=\"msg_read_report\",fa=\"read_all_unread_msg\",ma=\"group_msg_get\",va=\"get_group_msg_receipt\",Ma=\"group_msg_receipt\",ya=\"c2c_msg_read_receipt\",Ia=\"get_group_msg_receipt_detail\",Ca=\"get_pendency\",Ta=\"deletemsg\",Ea=\"get_msg\",Sa=\"get_msg_noauth\",Da=\"get_online_member_num\",Na=\"delete_group_ramble_msg_by_seq\",Aa=\"modify_group_msg\",ka=\"set_group_attr\",Ra=\"modify_group_attr\",La=\"delete_group_attr\",Oa=\"clear_group_attr\",Ga=\"get_group_attr\",Pa=\"group_set_key_values\",Ua=\"group_get_key_values\",ba=\"get_group_notify\",wa=\"update_group_counter\",Fa=\"get_group_counter\",qa=\"get_group_member_info\",xa=\"get_members\",Va=\"get_specified_group_member_info\",Ba=\"add_group_member\",Ka=\"delete_group_member\",Ha=\"ban_group_member\",Wa=\"modify_group_member_info\",Ya=\"modify_user_info\",ja=\"cos\",$a=\"pre_sig\",za=\"video_cover\",Ja=\"tim_web_report_v2\",Xa=\"alive\",Qa=\"msg_push\",Za=\"multi_msg_push_ws\",es=\"ws_msg_push_ack\",ts=\"stat_forceoffline\",os=\"save_relay_json_msg\",ns=\"get_relay_json_msg\",as=\"fetch_config\",ss=\"push_configv2\",rs=\"fetch_imsdk_purchase_bitsv2\",is=\"push_imsdk_purchase_bitsv2\",cs=\"notify2\",us=\"create_topic\",ls=\"destroy_topic\",ds=\"modify_topic\",ps=\"get_topic\",gs=\"ws_set_custom_status\",_s=\"ws_get_user_status\",hs=\"ws_status_subscribe\",fs=\"ws_status_unsubscribe\",ms=\"ws_stat_background\",vs=\"ws_stat_foreground\",Ms=\"ws_stat_settoken\",ys=\"get_local_words\",Is=\"ws_batch_trans_text\",Cs=\"networkRTT\",Ts=\"messageE2EDelay\",Es=\"sendMessageC2C\",Ss=\"sendMessageGroup\",Ds=\"sendMessageGroupAV\",Ns=\"sendMessageRichMedia\",As=\"cosUpload\",ks=\"messageReceivedGroup\",Rs=\"messageReceivedGroupAVPush\",Ls=\"messageReceivedGroupAVPull\",Os=(r(so={},Cs,2),r(so,Ts,3),r(so,Es,4),r(so,Ss,5),r(so,Ds,6),r(so,Ns,7),r(so,ks,8),r(so,Rs,9),r(so,Ls,10),r(so,As,11),so),Gs={info:4,warning:5,error:6},Ps={wifi:1,\"2g\":2,\"3g\":3,\"4g\":4,\"5g\":5,unknown:6,none:7,online:8},Us={login:4},bs=function(){function e(t){n(this,e),this.eventType=Us[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message=\"\",this.moreMessage=\"\",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=xe()}return s(e,[{key:\"updateTimeStamp\",value:function(){this.timestamp=xe()}},{key:\"start\",value:function(e){return this._startts=e,this}},{key:\"end\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var o=xe();0===this.costTime&&(this.costTime=o-this._startts),this.setMoreMessage(\"startts:\".concat(this._startts,\" endts:\").concat(o)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:\"setError\",value:function(e,t,o){if(!(e instanceof Error))return Ye.warn(\"SSOLogData.setError value not instanceof Error, please check!\"),this;if(this._sentFlag)return this;if(this.setNetworkType(o),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var n=hn.NO_NETWORK;this.setCode(n),this.setMoreMessage(mn[n])}return this.setLevel(\"error\"),this}},{key:\"setCode\",value:function(e){return dt(e)||this._sentFlag||(\"ECONNABORTED\"===e&&(this.code=103),rt(e)?this.code=e:Ye.warn(\"SSOLogData.setCode value not a number, please check!\",e,o(e))),this}},{key:\"setMessage\",value:function(e){return dt(e)||this._sentFlag||(rt(e)&&(this.message=e.toString()),it(e)&&(this.message=e)),this}},{key:\"setCostTime\",value:function(e){return this.costTime=e,this}},{key:\"setLevel\",value:function(e){return dt(e)||this._sentFlag||(this.level=Gs[e]),this}},{key:\"setMoreMessage\",value:function(e){return oo(this.moreMessage)?this.moreMessage=\"\".concat(e):this.moreMessage+=\" \".concat(e),this}},{key:\"setNetworkType\",value:function(e){if(dt(e))Ye.warn(\"SSOLogData.setNetworkType value is undefined, please check!\");else{var t=Ps[e.toLowerCase()];dt(t)||(this.networkType=t)}return this}},{key:\"getStartTs\",value:function(){return this._startts}},{key:\"setUIPlatform\",value:function(e){this.uiPlatform=e}}],[{key:\"bindEventStatModule\",value:function(t){e.prototype._eventStatModule=t}}]),e}(),ws={SDK_CONSTRUCT:\"sdkConstruct\",SDK_READY:\"sdkReady\",LOGIN:\"login\",LOGOUT:\"logout\",KICKED_OUT:\"kickedOut\",REGISTER_PLUGIN:\"registerPlugin\",KICK_OTHER:\"kickOther\",WS_CONNECT:\"wsConnect\",WS_ON_OPEN:\"wsOnOpen\",WS_ON_CLOSE:\"wsOnClose\",WS_ON_ERROR:\"wsOnError\",NETWORK_CHANGE:\"networkChange\",GET_COS_AUTH_KEY:\"getCosAuthKey\",GET_COS_PRE_SIG_URL:\"getCosPreSigUrl\",GET_SNAPSHOT_INFO:\"getSnapshotInfo\",UPLOAD:\"upload\",SEND_MESSAGE:\"sendMessage\",SEND_MESSAGE_WITH_RECEIPT:\"sendMessageWithReceipt\",SEND_COMBO_MESSAGE:\"sendComboMessage\",GET_C2C_ROAMING_MESSAGES:\"getC2CRoamingMessages\",GET_GROUP_ROAMING_MESSAGES:\"getGroupRoamingMessages\",GET_C2C_ROAMING_MESSAGES_HOPPING:\"getC2CRoamingMessagesHopping\",GET_GROUP_ROAMING_MESSAGES_HOPPING:\"getGroupRoamingMessagesHopping\",GET_READ_RECEIPT:\"getReadReceipt\",GET_READ_RECEIPT_DETAIL:\"getReadReceiptDetail\",SEND_READ_RECEIPT:\"sendReadReceipt\",SEND_C2C_READ_RECEIPT:\"sendC2CReadReceipt\",REVOKE_MESSAGE:\"revokeMessage\",DELETE_MESSAGE:\"deleteMessage\",MODIFY_MESSAGE:\"modifyMessage\",TRANSLATE_TEXT:\"translateText\",SET_C2C_MESSAGE_READ:\"setC2CMessageRead\",SET_GROUP_MESSAGE_READ:\"setGroupMessageRead\",EMPTY_MESSAGE_BODY:\"emptyMessageBody\",GET_PEER_READ_TIME:\"getPeerReadTime\",UPLOAD_MERGER_MESSAGE:\"uploadMergerMessage\",DOWNLOAD_MERGER_MESSAGE:\"downloadMergerMessage\",JSON_PARSE_ERROR:\"jsonParseError\",MESSAGE_E2E_DELAY_EXCEPTION:\"messageE2EDelayException\",SET_MESSAGE_EXTENSIONS:\"setMessageExtensions\",DELETE_MESSAGE_EXTENSIONS:\"deleteMessageExtensions\",GET_MESSAGE_EXTENSIONS:\"getMessageExtensions\",PROFANITY_FILTER:\"profanityFilter\",GET_CONVERSATION_LIST:\"getConversationList\",GET_CONVERSATION_PROFILE:\"getConversationProfile\",DELETE_CONVERSATION:\"deleteConversation\",CLEAR_HISTORY_MESSAGE:\"clearHistoryMessage\",PIN_CONVERSATION:\"pinConversation\",GET_CONVERSATION_LIST_IN_STORAGE:\"getConversationListInStorage\",SYNC_CONVERSATION_LIST:\"syncConversationList\",SET_ALL_MESSAGE_READ:\"setAllMessageRead\",SET_CONV_CUSTOM_DATA:\"setConvCustomData\",MARK_CONVERSATION:\"markConversation\",GET_REMOTE_CONV_GROUP_LIST:\"getRemoteConvGroupList\",CREATE_CONV_GROUP:\"createConvGroup\",DELETE_CONV_GROUP:\"deleteConvGroup\",RENAME_CONV_GROUP:\"renameConvGroup\",ADD_CONVS_TO_GROUP:\"addConvsToGroup\",DELETE_CONVS_FROM_GROUP:\"deleteConvsFromGroup\",CREATE_GROUP:\"createGroup\",APPLY_JOIN_GROUP:\"applyJoinGroup\",QUIT_GROUP:\"quitGroup\",SEARCH_GROUP_BY_ID:\"searchGroupByID\",CHANGE_GROUP_OWNER:\"changeGroupOwner\",HANDLE_GROUP_APPLICATION:\"handleGroupApplication\",HANDLE_GROUP_INVITATION:\"handleGroupInvitation\",SET_MESSAGE_REMIND_TYPE:\"setMessageRemindType\",DISMISS_GROUP:\"dismissGroup\",UPDATE_GROUP_PROFILE:\"updateGroupProfile\",GET_GROUP_LIST:\"getGroupList\",GET_GROUP_PROFILE:\"getGroupProfile\",GET_GROUP_LIST_IN_STORAGE:\"getGroupListInStorage\",GET_GROUP_LAST_SEQUENCE:\"getGroupLastSequence\",RECOVER_MESSAGE:\"recoverMessage\",PAGING_GET_GROUP_LIST:\"pagingGetGroupList\",PAGING_GET_GROUP_LIST_WITH_TOPIC:\"pagingGetGroupListWithTopic\",GET_GROUP_SIMPLIFIED_INFO:\"getGroupSimplifiedInfo\",JOIN_WITHOUT_AUTH:\"joinWithoutAuth\",INIT_GROUP_ATTRIBUTES:\"initGroupAttributes\",SET_GROUP_ATTRIBUTES:\"setGroupAttributes\",DELETE_GROUP_ATTRIBUTES:\"deleteGroupAttributes\",GET_GROUP_ATTRIBUTES:\"getGroupAttributes\",SET_GROUP_COUNTERS:\"setGroupCounters\",INCREASE_GROUP_COUNTER:\"increaseGroupCounter\",DECREASE_GROUP_COUNTER:\"decreaseGroupCounter\",GET_GROUP_COUNTERS:\"getGroupCounters\",GET_GROUP_MEMBER_LIST:\"getGroupMemberList\",GET_AVCHATROOM_MEMBER_LIST:\"getAVChatRoomMemberList\",GET_GROUP_MEMBER_PROFILE:\"getGroupMemberProfile\",ADD_GROUP_MEMBER:\"addGroupMember\",DELETE_GROUP_MEMBER:\"deleteGroupMember\",BAN_AVCHATROOM_MEMBER:\"banAVChatRoomMember\",SET_GROUP_MEMBER_MUTE_TIME:\"setGroupMemberMuteTime\",SET_GROUP_MEMBER_NAME_CARD:\"setGroupMemberNameCard\",SET_GROUP_MEMBER_ROLE:\"setGroupMemberRole\",SET_GROUP_MEMBER_CUSTOM_FIELD:\"setGroupMemberCustomField\",GET_GROUP_ONLINE_MEMBER_COUNT:\"getGroupOnlineMemberCount\",MARK_GROUP_MEMBER_LIST:\"markGroupMemberList\",SYNC_MESSAGE:\"syncMessage\",LONG_POLLING_AV_ERROR:\"longPollingAVError\",MESSAGE_LOSS:\"messageLoss\",MESSAGE_STACKED:\"messageStacked\",GET_USER_PROFILE:\"getUserProfile\",UPDATE_MY_PROFILE:\"updateMyProfile\",GET_BLACKLIST:\"getBlacklist\",ADD_TO_BLACKLIST:\"addToBlacklist\",REMOVE_FROM_BLACKLIST:\"removeFromBlacklist\",SET_SELF_STATUS:\"setSelfStatus\",GET_USER_STATUS:\"getUserStatus\",SUBSCRIBE_USER_STATUS:\"subscribeUserStatus\",UNSUBSCRIBE_USER_STATUS:\"unsubscribeUserStatus\",ADD_FRIEND:\"addFriend\",CHECK_FRIEND:\"checkFriend\",DELETE_FRIEND:\"removeFromFriendList\",GET_FRIEND_PROFILE:\"getFriendProfile\",GET_FRIEND_LIST:\"getFriendList\",UPDATE_FRIEND:\"updateFriend\",GET_FRIEND_APPLICATION_LIST:\"getFriendApplicationList\",DELETE_FRIEND_APPLICATION:\"deleteFriendApplication\",ACCEPT_FRIEND_APPLICATION:\"acceptFriendApplication\",REFUSE_FRIEND_APPLICATION:\"refuseFriendApplication\",SET_FRIEND_APPLICATION_READ:\"setFriendApplicationRead\",CREATE_FRIEND_GROUP:\"createFriendGroup\",DELETE_FRIEND_GROUP:\"deleteFriendGroup\",RENAME_FRIEND_GROUP:\"renameFriendGroup\",ADD_TO_FRIEND_GROUP:\"addToFriendGroup\",REMOVE_FROM_FRIEND_GROUP:\"removeFromFriendGroup\",GET_FRIEND_GROUP_LIST:\"getFriendGroupList\",CREATE_TOPIC:\"createTopic\",DELETE_TOPIC:\"deleteTopic\",UPDATE_TOPIC_PROFILE:\"updateTopicProfile\",GET_TOPIC_LIST:\"getTopicList\",RELAY_GET_TOPIC_LIST:\"relayGetTopicList\",GET_TOPIC_LAST_SEQUENCE:\"getTopicLastSequence\",GET_DEVICE_TOKEN:\"getDeviceToken\",GET_DEVICE_TOKEN_RES:\"getDeviceTokenRes\",OFFLINE_PUSH_SET_TOKEN:\"offlinePushSetToken\",SET_APP_SHOW_LISTENER:\"setAppShowListener\",SET_APP_SHOW_LISTENER_RES:\"setAppShowListenerRes\",ON_FOREGROUND:\"onForeground\",ON_BACKGROUND:\"onBackground\",MP_HIDE_TO_SHOW:\"mpHideToShow\",CALLBACK_FUNCTION_ERROR:\"callbackFunctionError\",FETCH_CLOUD_CONTROL_CONFIG:\"fetchCloudControlConfig\",PUSHED_CLOUD_CONTROL_CONFIG:\"pushedCloudControlConfig\",FETCH_COMMERCIAL_CONFIG:\"fetchCommercialConfig\",PUSHED_COMMERCIAL_CONFIG:\"pushedCommercialConfig\",ERROR:\"error\",LAST_MESSAGE_NOT_EXIST:\"lastMessageNotExist\"},Fs=function(){function e(t){n(this,e),this.type=D.MSG_TEXT,this.content={text:t.text||\"\"}}return s(e,[{key:\"setText\",value:function(e){this.content.text=e}},{key:\"sendable\",value:function(){return 0!==this.content.text.length}}]),e}(),qs=function(){function e(t){n(this,e),this._imageMemoryURL=\"\",le?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=D.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||je.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._defaultImage=\"http://imgcache.qq.com/open/qcloud/video/act/webim-images/default.jpg\",this._autoFixUrl()}return s(e,[{key:\"_initImageInfoModel\",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=Ct(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||\"\",this.url=t.url||e._imageMemoryURL||e._defaultImage},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:\"initImageInfoArray\",value:function(e){for(var t=0,o=null,n=null;t<=2;)n=dt(e)||dt(e[t])?{type:0,size:0,width:0,height:0,url:\"\"}:e[t],(o=new this._ImageInfoModel(n)).setSizeType(t+1),o.setType(t),this.addImageInfo(o),t++;this.updateAccessSideImageInfoArray()}},{key:\"updateImageInfoArray\",value:function(e){for(var t,o=this.content.imageInfoArray.length,n=0;n1&&(this._percent=1)}},{key:\"updateImageFormat\",value:function(e){this.content.imageFormat=je[e.toUpperCase()]||je.UNKNOWN}},{key:\"createImageDataASURLInWeb\",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:\"createImageDataASURLInWXMiniApp\",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:\"replaceImageInfo\",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:\"addImageInfo\",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:\"updateAccessSideImageInfoArray\",value:function(){var e=this.content.imageInfoArray,t=e[0],o=t.width,n=void 0===o?0:o,a=t.height,s=void 0===a?0:a;0!==n&&0!==s&&(Kt(e),Object.assign(e[2],Bt({originWidth:n,originHeight:s,min:720})))}},{key:\"sendable\",value:function(){return 0!==this.content.imageInfoArray.length&&(\"\"!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),xs=function(){function e(t){n(this,e),this.type=D.MSG_FACE,this.content=t||null}return s(e,[{key:\"sendable\",value:function(){return null!==this.content}}]),e}(),Vs=function(){function e(t){n(this,e),this.type=D.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:t.url,remoteAudioUrl:t.url||\"\",uuid:t.uuid}}return s(e,[{key:\"updatePercent\",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:\"updateAudioUrl\",value:function(e){this.content.remoteAudioUrl=e}},{key:\"sendable\",value:function(){return\"\"!==this.content.remoteAudioUrl}}]),e}(),Bs={from:!0,groupID:!0,groupName:!0,to:!0},Ks=function(){function e(t){n(this,e),this.type=D.MSG_GRP_TIP,this.content={},this._initContent(t)}return s(e,[{key:\"_initContent\",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case\"remarkInfo\":break;case\"groupProfile\":t.content.groupProfile={},t._initGroupProfile(e[o]);break;case\"operatorInfo\":break;case\"memberInfoList\":case\"msgMemberInfo\":t._updateMemberList(e[o]);break;case\"memberExtraInfo\":case\"onlineMemberInfo\":break;case\"memberNum\":t.content[o]=e[o],t.content.memberCount=e[o];break;case\"newGroupProfile\":t.content.newGroupProfile={},t._initNewGroupProfile(e[o]);break;default:t.content[o]=e[o]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:\"_initGroupProfile\",value:function(e){for(var t=Object.keys(e),o=0;o1&&(this._percent=1)}},{key:\"updateFileUrl\",value:function(e){this.content.fileUrl=e}},{key:\"sendable\",value:function(){return\"\"!==this.content.fileUrl&&(\"\"!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),js=function(){function e(t){n(this,e),this.type=D.MSG_CUSTOM,this.content={data:t.data||\"\",description:t.description||\"\",extension:t.extension||\"\"}}return s(e,[{key:\"setData\",value:function(e){return this.content.data=e,this}},{key:\"setDescription\",value:function(e){return this.content.description=e,this}},{key:\"setExtension\",value:function(e){return this.content.extension=e,this}},{key:\"sendable\",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),$s=function(){function e(t){n(this,e),this.type=D.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||\"\",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:t.videoUrl,videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:t.thumbUrl,snapshotUrl:t.thumbUrl}}return s(e,[{key:\"updatePercent\",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:\"updateVideoUrl\",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:\"updateSnapshotInfo\",value:function(e){var t=e.snapshotUrl,o=e.snapshotWidth,n=e.snapshotHeight;oo(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),oo(o)||(this.content.thumbWidth=this.content.snapshotWidth=Number(o)),oo(n)||(this.content.thumbHeight=this.content.snapshotHeight=Number(n))}},{key:\"sendable\",value:function(){return\"\"!==this.content.remoteVideoUrl}}]),e}(),zs=function(){function e(t){n(this,e),this.type=D.MSG_LOCATION;var o=t.description,a=t.longitude,s=t.latitude;this.content={description:o,longitude:a,latitude:s}}return s(e,[{key:\"sendable\",value:function(){return!0}}]),e}(),Js=function(){function e(t){if(n(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||\"\",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||\"\",this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(D.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(D.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.messageBody=[];var o=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(o,a),o===D.MSG_MERGER?this.messageBody.push({type:o,payload:new Xs(a).content}):this.messageBody.push({type:o,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID=\"\".concat(t.tinyID,\"-\").concat(t.clientTime,\"-\").concat(t.random)}}return s(e,[{key:\"_patchRichMediaPayload\",value:function(e,t){e===D.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===D.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===D.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===D.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}}]),e}(),Xs=function(){function e(t){if(n(this,e),this.type=D.MSG_MERGER,this.content={downloadKey:\"\",pbDownloadKey:\"\",messageList:[],title:\"\",abstractList:[],compatibleText:\"\",version:0,layersOverLimit:!1},t.downloadKey){var o=t.downloadKey,a=t.pbDownloadKey,s=t.title,r=t.abstractList,i=t.compatibleText,c=t.version;this.content.downloadKey=o,this.content.pbDownloadKey=a,this.content.title=s,this.content.abstractList=r,this.content.compatibleText=i,this.content.version=c||0}else if(oo(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var u=t.messageList,l=t.title,d=t.abstractList,p=t.compatibleText,g=t.version,_=[];u.forEach((function(e){if(!oo(e)){var t=new Js(e);_.push(t)}})),this.content.messageList=_,this.content.title=l,this.content.abstractList=d,this.content.compatibleText=p,this.content.version=g||0}Ye.debug(\"MergerElement.content:\",this.content)}return s(e,[{key:\"sendable\",value:function(){return!oo(this.content.messageList)||!oo(this.content.downloadKey)}}]),e}(),Qs={1:D.MSG_PRIORITY_HIGH,2:D.MSG_PRIORITY_NORMAL,3:D.MSG_PRIORITY_LOW,4:D.MSG_PRIORITY_LOWEST},Zs=function(){function e(t){n(this,e),this.ID=\"\",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||D.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:Ct(),this.priority=this._computePriority(t.priority),this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.isPeerRead=!1,this.nameCard=\"\",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow=\"\",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||\"JSON\",this.isResend=!1,this.isRead=!1,this.status=t.status||ro.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||\"\",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||Be()||0,this.senderTinyID=t.senderTinyID||t.tinyID||\"\",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return s(e,[{key:\"elements\",get:function(){return this._elements}},{key:\"getElements\",value:function(){return this._elements}},{key:\"extractGroupInfo\",value:function(e){if(null!==e){it(e.nick)&&(this.nick=e.nick),it(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ut(t)&&it(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:\"handleGroupAtInfo\",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==D.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(D.MSG_AT_ALL))})),lt(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(D.MSG_AT_ALL)}))}},{key:\"getGroupAtInfoList\",value:function(){return this._groupAtInfoList}},{key:\"_initProxy\",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:\"reInitialize\",value:function(e){e&&(this.status=this.from?ro.SUCCESS:ro.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:\"isSendable\",value:function(){return 0!==this._elements.length&&(\"function\"!=typeof this._elements[0].sendable?(Ye.warn(\"\".concat(this._elements[0].type,' need \"boolean : sendable()\" method')),!1):this._elements[0].sendable())}},{key:\"_initTo\",value:function(e){this.conversationType===D.CONV_GROUP&&(this.to=e.groupID)}},{key:\"_initSequence\",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return Ye.error(\"autoIncrementIndex(string: key) need key parameter\"),!1;if(void 0===Dt[e]){var t=new Date,o=\"3\".concat(t.getHours()).slice(-2),n=\"0\".concat(t.getMinutes()).slice(-2),a=\"0\".concat(t.getSeconds()).slice(-2);Dt[e]=parseInt([o,n,a,\"0001\"].join(\"\")),o=null,n=null,a=null,Ye.log(\"autoIncrementIndex start index:\".concat(Dt[e]))}return Dt[e]++}(e)),0===this.sequence&&this.conversationType===D.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:\"generateMessageID\",value:function(){this.from===D.CONV_SYSTEM&&(this.senderTinyID=\"144115198244471703\"),this.ID=\"\".concat(this.senderTinyID,\"-\").concat(this.clientTime,\"-\").concat(this.random)}},{key:\"_initFlow\",value:function(e){\"\"!==e&&(e===this.from?(this.flow=\"out\",this.isRead=!0):this.flow=\"in\")}},{key:\"_concatConversationID\",value:function(e){var t=this.to,o=\"\",n=this.conversationType;n!==D.CONV_SYSTEM?(o=n===D.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=\"\".concat(n).concat(o)):this.conversationID=D.CONV_SYSTEM}},{key:\"isElement\",value:function(e){return e instanceof Fs||e instanceof qs||e instanceof xs||e instanceof Vs||e instanceof Ys||e instanceof $s||e instanceof Ks||e instanceof Ws||e instanceof js||e instanceof zs||e instanceof Xs}},{key:\"setElement\",value:function(e){var t=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case D.MSG_TEXT:t.setTextElement(e.content);break;case D.MSG_IMAGE:t.setImageElement(e.content);break;case D.MSG_AUDIO:t.setAudioElement(e.content);break;case D.MSG_FILE:t.setFileElement(e.content);break;case D.MSG_VIDEO:t.setVideoElement(e.content);break;case D.MSG_CUSTOM:t.setCustomElement(e.content);break;case D.MSG_LOCATION:t.setLocationElement(e.content);break;case D.MSG_GRP_TIP:t.setGroupTipElement(e.content);break;case D.MSG_GRP_SYS_NOTICE:t.setGroupSystemNoticeElement(e.content);break;case D.MSG_FACE:t.setFaceElement(e.content);break;case D.MSG_MERGER:t.setMergerElement(e.content);break;default:Ye.warn(e.type,e.content,\"no operation......\")}};if(lt(e))for(var n=0;n1&&void 0!==arguments[1]&&arguments[1];if(e instanceof rr)return t&&null!==ir&&ir.emit(S.ERROR,e),Promise.reject(e);if(e instanceof Error){var o=new rr({code:hn.UNCAUGHT_ERROR,message:mn[hn.UNCAUGHT_ERROR]});return t&&null!==ir&&ir.emit(S.ERROR,o),Promise.reject(o)}if(!dt(e)&&!dt(e.code)){var n=new rr(e);return t&&null!==ir&&ir.emit(S.ERROR,n),Promise.reject(n)}Ye.error(\"IMPromise.reject code required!\")},dr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"C2CModule\",t._messageFromUnreadDBMap=new Map,t}return s(a,[{key:\"onNewC2CMessage\",value:function(e){var t=e.dataList,o=e.isInstantMessage,n=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList;Ye.debug(\"\".concat(this._className,\".onNewC2CMessage count:\").concat(t.length,\" isInstantMessage:\").concat(o));var s=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:n,C2CPairUnreadList:a,isInstantMessage:o}),r=s.conversationOptionsList,i=s.messageList,c=s.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(jo).onNewMessage({conversationOptionsList:r,isInstantMessage:o,isUnreadC2CMessage:c});var u=this.filterUnmodifiedMessage(i);o&&u.length>0&&this.emitOuterEvent(S.MESSAGE_RECEIVED,u),i.length=0}},{key:\"_newC2CMessageStoredAndSummary\",value:function(e){for(var t=e.dataList,o=e.C2CRemainingUnreadList,n=e.C2CPairUnreadList,a=e.isInstantMessage,s=null,r=[],i=[],c={},u=this.getModule(Qo),l=this.getModule(un),d=!1,p=this.getModule(jo),g=0,_=t.length;g<_;g++){var h=t[g];h.currentUser=this.getMyUserID(),h.conversationType=D.CONV_C2C,h.isSystemMessage=!!h.isSystemMessage,(dt(h.nick)||dt(h.avatar))&&(d=!0,Ye.debug(\"\".concat(this._className,\"._newC2CMessageStoredAndSummary nick or avatar missing!\"))),s=new Zs(h),h.elements=u.parseElements(h.elements,h.from),s.setElement(h.elements),s.setNickAndAvatar({nick:h.nick,avatar:h.avatar});var f=s.conversationID;if(a){if(1===this._messageFromUnreadDBMap.get(s.ID))continue;var m=!1;if(s.from!==this.getMyUserID()){var v=p.getLatestMessageSentByPeer(f);if(v){var M=v.nick,y=v.avatar;d?s.setNickAndAvatar({nick:M,avatar:y}):M===s.nick&&y===s.avatar||(m=!0)}}else{var I=p.getLatestMessageSentByMe(f);if(I){var C=I.nick,T=I.avatar;C===s.nick&&T===s.avatar||p.modifyMessageSentByMe({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar})}}var E=1===t[g].isModified;if(p.isMessageSentByCurrentInstance(s)?s.isModified=E:E=!1,0===h.msgLifeTime)s._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(s)||i.push(s);else{if(!p.pushIntoMessageList(i,s,E))continue;m&&(p.modifyMessageSentByPeer({conversationID:f,latestNick:s.nick,latestAvatar:s.avatar}),p.updateUserProfileSpecifiedKey({conversationID:f,nick:s.nick,avatar:s.avatar}))}a&&s.clientTime>0&&l.addMessageDelay(s.clientTime)}else this._messageFromUnreadDBMap.set(s.ID,1);if(0!==h.msgLifeTime){if(!1===s._onlineOnlyFlag){var S=p.getLastMessageTime(f);if(rt(S)&&s.time0){k=!0;var o=r.find((function(t){return t.conversationID===\"C2C\".concat(n[e].from)}));o?o.unreadCount=n[e].unreadCount:r.push({conversationID:\"C2C\".concat(n[e].from),unreadCount:n[e].unreadCount,type:D.CONV_C2C})}},L=0,O=n.length;L0&&(n=e.cloudCustomData);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push(\"NoUnread\"),!0===i&&a.push(\"NoLastMsg\")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:Sn,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:n,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||\"\",desc:o.description||\"\",ext:o.extension||\"\",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0!==c?a:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:\"_isVoipPush\",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:\"isOnlineMessage\",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:\"revokeMessage\",value:function(e){return this.request({protocolName:On,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:\"deleteMessage\",value:function(e){var t=e.to,o=e.keyList;return Ye.log(\"\".concat(this._className,\".deleteMessage toAccount:\").concat(t,\" count:\").concat(o.length)),this.request({protocolName:Fn,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:o}})}},{key:\"modifyRemoteMessage\",value:function(e){var t=e.from,o=e.to,n=e.version,a=void 0===n?0:n,s=e.sequence,r=e.random,i=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return Jt(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:qn,requestData:{from:t,to:o,version:a,sequence:s,random:r,time:i,elements:d,cloudCustomData:l}})}},{key:\"setMessageRead\",value:function(e){var t=this,o=e.conversationID,n=e.lastMessageTime,a=\"\".concat(this._className,\".setMessageRead\");if(Ye.log(\"\".concat(a,\" conversationID:\").concat(o,\" lastMessageTime:\").concat(n)),!rt(n)){var s=\"\";s=this.isIntl()?\"Do not modify Conversation.lastMessage.lastTime, otherwise the result of setMessageRead will be incorrect\":\"请勿修改 Conversation.lastMessage.lastTime,否则可能会导致已读上报结果不准确\",Ye.warn(\"\".concat(a,\" \").concat(s))}var r=new bs(ws.SET_C2C_MESSAGE_READ);return r.setMessage(\"conversationID:\".concat(o,\" lastMessageTime:\").concat(n)),this.request({protocolName:Gn,requestData:{C2CMsgReaded:{cookie:\"\",C2CMsgReadedItem:[{toAccount:o.replace(\"C2C\",\"\"),lastMessageTime:n,receipt:1}]}}}).then((function(){r.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(a,\" ok\"));var e=t.getModule(jo);return e.updateIsReadAfterReadReport({conversationID:o,lastMessageTime:n}),e.updateUnreadCount(o),er()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.log(\"\".concat(a,\" failed. error:\"),e),lr(e)}))}},{key:\"getRoamingMessage\",value:function(e){var t=this,o=\"\".concat(this._className,\".getRoamingMessage\"),n=e.peerAccount,a=e.conversationID,s=e.count,r=e.lastMessageTime,i=e.messageKey,c=\"peerAccount:\".concat(n,\" count:\").concat(s||15,\" lastMessageTime:\").concat(r||0,\" messageKey:\").concat(i);Ye.log(\"\".concat(o,\" \").concat(c));var u=new bs(ws.GET_C2C_ROAMING_MESSAGES);return this.request({protocolName:bn,requestData:{peerAccount:n,count:s||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var n=e.data,s=n.complete,r=n.messageList,i=n.messageKey,l=n.lastMessageTime;dt(r)?Ye.log(\"\".concat(o,\" ok. complete:\").concat(s,\" but messageList is undefined!\")):Ye.log(\"\".concat(o,\" ok. complete:\").concat(s,\" count:\").concat(r.length)),u.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(c,\" complete:\").concat(s,\" length:\").concat(r.length)).end();var d=t.getModule(jo);1===s&&d.setCompleted(a);var p=d.onRoamingMessage(r,a);d.modifyMessageList(a),d.updateIsRead(a),d.updateRoamingMessageKeyAndTime(a,i,l);var g=d.getPeerReadTime(a);if(Ye.log(\"\".concat(o,\" update isPeerRead property. conversationID:\").concat(a,\" peerReadTime:\").concat(g)),g)d.updateMessageIsPeerReadProperty(a,g);else{var _=a.replace(D.CONV_C2C,\"\");t.getRemotePeerReadTime([_]).then((function(){d.updateMessageIsPeerReadProperty(a,d.getPeerReadTime(a))}))}var h=\"\";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(a);f&&(h=f.ID)}return Ye.log(\"\".concat(o,\" nextReqID:\").concat(h,\" stored message count:\").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setMessage(c).setError(e,n,a).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"getRoamingMessagesHopping\",value:function(e){var t=this,o=\"\".concat(this._className,\".getRoamingMessagesHopping\"),n=e.peerAccount,a=e.time,s=void 0===a?0:a,r=e.count,i=e.direction,c=\"\".concat(D.CONV_C2C).concat(n),u=\"peerAccount:\".concat(n,\" count:\").concat(r,\" time:\").concat(s,\" direction:\").concat(i);Ye.log(\"\".concat(o,\" \").concat(u));var l=new bs(ws.GET_C2C_ROAMING_MESSAGES_HOPPING);return this.request({protocolName:bn,requestData:{peerAccount:n,count:r+1,lastMessageTime:s,direction:i}}).then((function(e){var n=e.data,a=n.complete,s=n.messageList,r=void 0===s?[]:s,d=n.lastMessageTime;Ye.log(\"\".concat(o,\" ok. complete:\").concat(a,\" count:\").concat(r.length)),l.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(u,\" complete:\").concat(a,\" length:\").concat(r.length)).end(),1!==a&&(1===i?r.pop():r.shift());var p=t.getModule(jo).onRoamingMessage(r,c,!1);t._modifyMessageList(c,p);var g=t._computeResult({complete:a,lastMessageTime:d,resultList:p});return er(g)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setMessage(u).setError(e,n,a).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_computeResult\",value:function(e){var t=e.complete,o=void 0===t?0:t,n=e.lastMessageTime,a=e.resultList,s={messageList:v(void 0===a?[]:a),isCompleted:!1,nextMessageTime:\"\"};return 1===o?(s.isCompleted=!0,s):(s.nextMessageTime=n,s)}},{key:\"_modifyMessageList\",value:function(e,t){var o=this.getModule(jo).getLocalConversation(e);if(o)for(var n=o.userProfile.nick,a=o.userProfile.avatar,s=this.getModule(Vo).getNickAndAvatarByUserID(this.getMyUserID()),r=s.nick,i=s.avatar,c=t.length-1;c>=0;c--){var u=t[c];\"in\"===u.flow&&(u.nick!==n&&u.setNickAndAvatar({nick:n}),u.avatar!==a&&u.setNickAndAvatar({avatar:a})),\"out\"===u.flow&&(u.nick!==r&&u.setNickAndAvatar({nick:r}),u.avatar!==i&&u.setNickAndAvatar({avatar:i}))}}},{key:\"getRemotePeerReadTime\",value:function(e){var t=this,o=\"\".concat(this._className,\".getRemotePeerReadTime\");if(oo(e))return Ye.warn(\"\".concat(o,\" userIDList is empty!\")),Promise.resolve();var n=new bs(ws.GET_PEER_READ_TIME);return Ye.log(\"\".concat(o,\" userIDList:\").concat(e)),this.request({protocolName:wn,requestData:{userIDList:e}}).then((function(a){var s=a.data.peerReadTimeList;Ye.log(\"\".concat(o,\" ok. peerReadTimeList:\").concat(s));for(var r=\"\",i=t.getModule(jo),c=0;c0&&i.recordPeerReadTime(\"C2C\".concat(e[c]),s[c]);n.setNetworkType(t.getNetworkType()).setMessage(r).end()})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e)}))}},{key:\"sendReadReceipt\",value:function(e){var t=this,o=e[0].conversationID.replace(D.CONV_C2C,\"\"),n=new bs(ws.SEND_C2C_READ_RECEIPT);n.setMessage(\"peerAccount:\".concat(o));var a=this.getMyUserID(),s=e.filter((function(e){return e.from!==a&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===s.length)return lr({code:hn.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r=\"\".concat(this._className,\".sendReadReceipt\");return Ye.log(\"\".concat(r,\". peerAccount:\").concat(o,\" messageInfoList length:\").concat(s.length)),this.request({protocolName:ya,requestData:{peerAccount:o,messageInfoList:s}}).then((function(e){return n.end(),Ye.log(\"\".concat(r,\" ok\")),er()})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.warn(\"\".concat(r,\" failed. error:\"),e),lr(e)}))}},{key:\"getReadReceiptList\",value:function(e){var t=\"\".concat(this._className,\".getReadReceiptList\"),o=this.getMyUserID(),n=e.filter((function(e){return e.from===o&&!0===e.needReadReceipt}));return Ye.log(\"\".concat(t,\" userID:\").concat(o,\" messageList length:\").concat(n.length)),ur({messageList:n})}},{key:\"getMessageExtensions\",value:function(e,t){return Ye.log(\"\".concat(this._className,\".getMessageExtensions startSequence:\").concat(t)),this.request({protocolName:Vn,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:t}})}},{key:\"modifyMessageExtensions\",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ye.log(\"\".concat(this._className,\".modifyMessageExtensions operateType:\").concat(o)),this.request({protocolName:xn,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:t,operateType:o}})}},{key:\"_getMessageKey\",value:function(e){var t=e.clientSequence,o=e.random,n=e.time;return\"\".concat(t,\"_\").concat(o,\"_\").concat(n)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._messageFromUnreadDBMap.clear()}}]),a}(vn),pr=function(){function e(){n(this,e),this.list=new Map,this._className=\"MessageListHandler\",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return s(e,[{key:\"getLocalOldestMessageByConversationID\",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:\"pushIn\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e.conversationID,n=!0;this.list.has(o)||this.list.set(o,new Map);var a=this._getUniqueIDOfMessage(e),s=this.list.get(o).has(a);if(s){var r=this.list.get(o).get(a);if(!t||!0===r.isModified)return n=!1}return this.list.get(o).set(a,e),this._setLatestMessageSentByPeer(o,e),this._setLatestMessageSentByMe(o,e),n}},{key:\"unshift\",value:function(e,t){var o;if(lt(e)?e.length>0&&(o=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(o=e.conversationID,this._unshiftSingleMessage(e,t)),o&&o.startsWith(D.CONV_C2C)){var n=Array.from(this.list.get(o).values()),a=n.length;if(0===a)return;for(var s=a-1;s>=0;s--)if(\"out\"===n[s].flow){this._setLatestMessageSentByMe(o,n[s]);break}for(var r=a-1;r>=0;r--)if(\"in\"===n[r].flow){this._setLatestMessageSentByPeer(o,n[r]);break}}}},{key:\"_unshiftSingleMessage\",value:function(e,t){var o=e.conversationID,n=this._getUniqueIDOfMessage(e);if(!this.list.has(o))return this.list.set(o,new Map),this.list.get(o).set(n,e),void t.push(e);var a=this.list.get(o),s=Array.from(a);a.has(n)||(s.unshift([n,e]),this.list.set(o,new Map(s)),t.push(e))}},{key:\"_unshiftMultipleMessages\",value:function(e,t){for(var o=e.length,n=[],a=e[0].conversationID,s=this.list.get(a),r=this.list.has(a)?Array.from(s):[],i=0;i=0;l--)\"in\"===s[l].flow&&((i=s[l]).nick!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));Ye.log(\"\".concat(this._className,\".modifyMessageSentByPeer conversationID:\").concat(t,\" count:\").concat(c))}}}},{key:\"modifyMessageSentByMe\",value:function(e){var t=e.conversationID,o=e.latestNick,n=e.latestAvatar,a=this.list.get(t);if(!oo(a)){var s=Array.from(a.values()),r=s.length;if(0!==r){for(var i=null,c=0,u=!1,l=r-1;l>=0;l--)\"out\"===s[l].flow&&((i=s[l]).nick!==o&&(i.setNickAndAvatar({nick:o}),u=!0),i.avatar!==n&&(i.setNickAndAvatar({avatar:n}),u=!0),u&&(c+=1));Ye.log(\"\".concat(this._className,\".modifyMessageSentByMe conversationID:\").concat(t,\" count:\").concat(c))}}}},{key:\"getTopicConversationIDList\",value:function(e){return v(this.list.keys()).filter((function(t){return t.startsWith(\"\".concat(D.CONV_GROUP).concat(e))}))}},{key:\"traversal\",value:function(){if(0!==this.list.size&&-1===Ye.getLevel()){console.group(\"conversationID-messageCount\");var e,t=E(this.list);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];console.log(\"\".concat(n,\"-\").concat(a.size))}}catch(s){t.e(s)}finally{t.f()}console.groupEnd()}}},{key:\"onMessageModified\",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var o=this._getUniqueIDOfMessage(t),n=this.list.get(e).has(o);if(Ye.debug(\"\".concat(this._className,\".onMessageModified conversationID:\").concat(e,\" uniqueID:\").concat(o,\" has:\").concat(n)),n){var a=this.list.get(e).get(o),s=t.messageVersion,r=t.elements,i=t.cloudCustomData;return a.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var mr=[\"jpg\",\"jpeg\",\"gif\",\"png\",\"bmp\",\"image\",\"webp\"],vr=[\"mp4\",\"quicktime\",\"mov\"],Mr=1,yr=2,Ir=3,Cr=255,Tr=function(){function e(t){var o=this;n(this,e),oo(t)||(this.userID=t.userID||\"\",this.nick=t.nick||\"\",this.gender=t.gender||\"\",this.birthday=t.birthday||0,this.location=t.location||\"\",this.selfSignature=t.selfSignature||\"\",this.allowType=t.allowType||D.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||\"\",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||D.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],oo(t.profileCustomField)||t.profileCustomField.forEach((function(e){o.profileCustomField.push({key:e.key,value:e.value})})))}return s(e,[{key:\"validate\",value:function(e){var t=!0,o=\"\";if(oo(e))return{valid:!1,tips:\"empty options\"};if(e.profileCustomField)for(var n=e.profileCustomField.length,a=null,s=0;s500&&(o=\"nick name limited: must less than or equal to \".concat(500,\" bytes, current size: \").concat(It(e[r]),\" bytes\"),t=!1);break;case\"gender\":St(ze,e.gender)||(o=\"key:gender, invalid value:\"+e.gender,t=!1);break;case\"birthday\":rt(e.birthday)||(o=\"birthday must be a number\",t=!1);break;case\"location\":it(e.location)||(o=\"location must be a string\",t=!1);break;case\"selfSignature\":it(e.selfSignature)||(o=\"selfSignature must be a string\",t=!1);break;case\"allowType\":St(Xe,e.allowType)||(o=\"key:allowType, invalid value:\"+e.allowType,t=!1);break;case\"language\":rt(e.language)||(o=\"language must be a number\",t=!1);break;case\"avatar\":it(e.avatar)||(o=\"avatar must be a string\",t=!1);break;case\"messageSettings\":0!==e.messageSettings&&1!==e.messageSettings&&(o=\"messageSettings must be 0 or 1\",t=!1);break;case\"adminForbidType\":St(Je,e.adminForbidType)||(o=\"key:adminForbidType, invalid value:\"+e.adminForbidType,t=!1);break;case\"level\":rt(e.level)||(o=\"level must be a number\",t=!1);break;case\"role\":rt(e.role)||(o=\"role must be a number\",t=!1);break;default:o=\"unknown key:\"+r+\" \"+e[r],t=!1}}return{valid:t,tips:o}}}]),e}(),Er=s((function e(t){n(this,e),this.value=t,this.next=null})),Sr=function(){function e(t){n(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map,Ye.debug(\"SinglyLinkedList init MAX_LENGTH:\".concat(this.MAX_LENGTH))}return s(e,[{key:\"set\",value:function(e){var t=new Er(e);if(this.map.size0&&o.members.forEach((function(e){e.userID===t.selfInfo.userID&&Mt(t.selfInfo,e,[\"sequence\"])}))}},{key:\"updateSelfInfo\",value:function(e){var o={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};Mt(this.selfInfo,t({},o),[],[\"\",null,void 0,0,NaN])}},{key:\"setSelfNameCard\",value:function(e){this.selfInfo.nameCard=e}}]),e}(),Ar=function(e,o){return dt(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:\"\",payload:null,type:\"\",isRevoked:!1,cloudCustomData:\"\",onlineOnlyFlag:!1,nick:\"\",nameCard:\"\",version:0,isPeerRead:!1,revoker:null}:e instanceof Zs?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||\"\",messageForShow:zt(e.type,e.payload,o),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||\"\",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||\"\",nameCard:e.nameCard||\"\",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:zt(e.type,e.payload,o)})},kr=function(){function e(t,o){n(this,e),this.conversationID=t.conversationID||\"\",this.unreadCount=t.unreadCount||0,this.type=t.type||\"\",this.lastMessage=Ar(t.lastMessage,o),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark=\"\",this.isPinned=t.isPinned||!1,this.messageRemindType=\"\",this.markList=t.markList||[],this.customData=t.customData||\"\",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return s(e,[{key:\"toAccount\",get:function(){return this.conversationID.startsWith(D.CONV_C2C)?this.conversationID.replace(D.CONV_C2C,\"\"):this.conversationID.startsWith(D.CONV_GROUP)?this.conversationID.replace(D.CONV_GROUP,\"\"):\"\"}},{key:\"subType\",get:function(){return this.groupProfile?this.groupProfile.type:\"\"}},{key:\"_initProfile\",value:function(e){var t=this;Object.keys(e).forEach((function(o){switch(o){case\"userProfile\":t.userProfile=e.userProfile;break;case\"groupProfile\":t.groupProfile=e.groupProfile}})),dt(this.userProfile)&&this.type===D.CONV_C2C?this.userProfile=new Tr({userID:e.conversationID.replace(\"C2C\",\"\")}):dt(this.groupProfile)&&this.type===D.CONV_GROUP&&(this.groupProfile=new Nr({groupID:e.conversationID.replace(\"GROUP\",\"\")}))}},{key:\"updateUnreadCount\",value:function(e){var t=e.nextUnreadCount,o=e.isFromGetConversations,n=e.isUnreadC2CMessage;dt(t)||(Lt(this.subType)?this.unreadCount=0:o&&this.type===D.CONV_GROUP||o&&this.type===D.CONV_TOPIC||n&&this.type===D.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:\"updateLastMessage\",value:function(e){this.lastMessage=Ar(e)}},{key:\"updateGroupAtInfoList\",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,o=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==o.indexOf(D.CONV_AT_ME)&&-1!==o.indexOf(D.CONV_AT_ALL)&&(o=[D.CONV_AT_ALL_AT_ME]);var n={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:o,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(n),Ye.debug(\"Conversation.updateGroupAtInfoList conversationID:\".concat(this.conversationID),this.groupAtInfoList)}}},{key:\"_isNeedMergeGroupAtInfo\",value:function(e){var t=e.groupID,o=e.sequence;if(!Ot({groupID:t}))return!1;var n=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===o&&(t.atTypeArray.indexOf(D.CONV_AT_ME)>-1&&e.groupAtType.indexOf(D.CONV_AT_ALL)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(D.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(D.CONV_AT_ME)>-1&&(t.atTypeArray=[D.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),n=!0)})),n}},{key:\"clearGroupAtInfoList\",value:function(){this.groupAtInfoList.length=0}},{key:\"reduceUnreadCount\",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:\"isLastMessageRevoked\",value:function(e){var t=e.sequence,o=e.time;return this.type===D.CONV_C2C&&t===this.lastMessage.lastSequence&&o===this.lastMessage.lastTime||this.type===D.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:\"setLastMessageRevoked\",value:function(e){this.lastMessage.isRevoked=e}},{key:\"setLastMessageRevoker\",value:function(e){this.lastMessage.revoker=e}}]),e}(),Rr=function(){function e(t){n(this,e),this._conversationModule=t,this._className=\"MessageRemindHandler\",this._updateSequence=0}return s(e,[{key:\"getC2CMessageRemindType\",value:function(){var e=this,t=\"\".concat(this._className,\".getC2CMessageRemindType\");return this._conversationModule.request({protocolName:Un,updateSequence:this._updateSequence}).then((function(o){Ye.log(\"\".concat(t,\" ok\"));var n=o.data,a=n.updateSequence,s=n.muteFlagList;e._updateSequence=a,e._patchC2CMessageRemindType(s)})).catch((function(e){Ye.error(\"\".concat(t,\" failed. error:\"),e)}))}},{key:\"_patchC2CMessageRemindType\",value:function(e){var t=this,o=0,n=\"\";lt(e)&&e.length>0&&e.forEach((function(e){var a=e.userID,s=e.muteFlag;0===s?n=D.MSG_REMIND_ACPT_AND_NOTE:1===s?n=D.MSG_REMIND_DISCARD:2===s&&(n=D.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:n})&&(o+=1)})),Ye.log(\"\".concat(this._className,\"._patchC2CMessageRemindType count:\").concat(o))}},{key:\"set\",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):lt(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:\"_setGroupMessageRemindType\",value:function(e){var t=this,o=\"\".concat(this._className,\"._setGroupMessageRemindType\"),n=e.groupID,a=e.messageRemindType,s=\"groupID:\".concat(n,\" messageRemindType:\").concat(a),r=new bs(ws.SET_MESSAGE_REMIND_TYPE);return r.setMessage(s),this._getModule(Wo).modifyGroupMemberInfo({groupID:n,messageRemindType:a,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok. \").concat(s));var n=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),er(n)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"onGroupMessageRemindTypeUpdated\",value:function(e){var t=e.groupID,o=e.messageRemindType,n=this._getModule(Ko).getLocalGroupProfile(t);if(n&&(n.selfInfo.messageRemindType=o),Gt(t)){var a=t,s=$t(a),r=this._getModule(Yo).getLocalTopic(s,a);return r&&(r.updateSelfInfo({messageRemindType:o}),this._conversationModule.emitOuterEvent(S.TOPIC_UPDATED,{groupID:s,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:o})&&this._emitConversationUpdate(),{group:n}}},{key:\"_setC2CMessageRemindType\",value:function(e){var t=this,o=\"\".concat(this._className,\"._setC2CMessageRemindType\"),n=e.userIDList,a=e.messageRemindType,s=n.slice(0,30),r=0;a===D.MSG_REMIND_DISCARD?r=1:a===D.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i=\"userIDList:\".concat(s,\" messageRemindType:\").concat(a),c=new bs(ws.SET_MESSAGE_REMIND_TYPE);return c.setMessage(i),this._conversationModule.request({protocolName:Pn,requestData:{userIDList:s,muteFlag:r}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var n=e.data,r=n.updateSequence,i=n.errorList;t._updateSequence=r;var u=[],l=[];lt(i)&&i.forEach((function(e){u.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=s.filter((function(e){return-1===u.indexOf(e)}));Ye.log(\"\".concat(o,\" ok. successUserIDList:\").concat(d,\" failureUserIDList:\").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:a})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),s.length=u.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),ur({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_getModule\",value:function(e){return this._conversationModule.getModule(e)}},{key:\"_emitConversationUpdate\",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:\"setUpdateSequence\",value:function(e){this._updateSequence=e}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._updateSequence=0}}]),e}(),Lr=function(){function e(t){n(this,e),this._conversationModule=t,this._className=\"ConvGroupHandler\",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=io.NOT_START}return s(e,[{key:\"setConvCustomData\",value:function(e){var t=this,o=\"\".concat(this._className,\".setConvCustomData\"),n=e.conversationIDList,a=e.customData;Ye.log(\"\".concat(o,\" options:\"),e);var s=new bs(ws.SET_CONV_CUSTOM_DATA);s.setMessage(JSON.stringify(e));var r={fromAccount:this._getMyUserID(),itemList:[]},i=[],c=[];return n.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(c,e),!0;if(!Pt(e)&&!Ut(e))return t._onConversationIDInvalid(c,e),!0;var o={operationType:2,contactItem:void 0,customMark:a};Pt(e)?o.contactItem={type:1,toAccount:e.replace(D.CONV_C2C,\"\")}:Ut(e)&&(o.contactItem={type:2,groupID:e.replace(D.CONV_GROUP,\"\")}),r.itemList.push(o)})),c.length===n.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:$n,requestData:r}).then((function(e){s.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\"));var n=e.data.resultItem;if(lt(n)){var r,u,l=!1;n.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(r),(u=t._getLocalConversation(r))&&u.customData!==a&&(u.customData=a,l=!0)):c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"markConversation\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_MARK))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._className,\".markConversation\"),n=e.conversationIDList,a=e.markType,s=e.enableMark;Ye.log(\"\".concat(o,\" options:\"),e);var r=new bs(ws.MARK_CONVERSATION);r.setMessage(JSON.stringify(e));var i=void 0,c=void 0,u=this._getFlagBit(a);!0===s?c=[u]:i=[u];var l={fromAccount:this._getMyUserID(),itemList:[]},d=[],p=[];return n.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(p,e),!0;if(!Pt(e)&&!Ut(e))return t._onConversationIDInvalid(p,e),!0;var o={operationType:1,contactItem:void 0,clearMark:i,setMark:c};Pt(e)?o.contactItem={type:1,toAccount:e.replace(D.CONV_C2C,\"\")}:Ut(e)&&(o.contactItem={type:2,groupID:e.replace(D.CONV_GROUP,\"\")}),l.itemList.push(o)})),p.length===n.length?ur({successConversationIDList:d,failureConversationIDList:p}):this._conversationModule.request({protocolName:zn,requestData:l}).then((function(e){r.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\"));var n=e.data.resultItem;if(lt(n)){var i,c,u=!1;n.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(d.push(i),c=t._getLocalConversation(i)){var o=c.markList.indexOf(a);!0===s?-1===o&&(c.markList.push(a),u=!0):-1!==o&&(c.markList.splice(o,1),u=!0)}}else p.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===u&&t._emitConversationUpdate()}return er({successConversationIDList:d,failureConversationIDList:p})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"getLocalConvGroupList\",value:function(){var e=this;return Ye.log(\"\".concat(this._className,\".getLocalConvGroupList pagingStatus:\").concat(this._pagingStatus)),this._pagingStatus===io.REJECTED?this.getRemoteConvGroupList().then((function(){return er(v(e._convGroupMap.values()))})):ur(v(this._convGroupMap.values()))}},{key:\"getRemoteConvGroupList\",value:function(){var e=this,t=\"\".concat(this._className,\".getRemoteConvGroupList\");return this._pagingStatus=io.PENDING,this._conversationModule.request({protocolName:ta,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:Be()}}).then((function(o){var n,a,s=o.data,r=s.completeFlag,i=s.contactItem,c=s.nextStartIndex,u=void 0===c?0:c,l=s.groupItem;(e._startIndex=u,Ye.log(\"\".concat(t,\" completeFlag:\").concat(r,\" nextStartIndex:\").concat(u)),lt(l)&&l.forEach((function(t){var o=t.convGroupID,n=t.groupName;e._convGroupMap.set(o,n)})),lt(i))&&i.forEach((function(t){var o=t.standardMark,s=t.customData,r=t.convGroupIDList;if(n=e._concatConversationID(t),(a=e._getLocalConversation(n))&&(a.markList=Xt(o),a.customData=s||\"\",lt(r))){var i=[];r.forEach((function(t){e._convGroupMap.has(t)&&i.push(e._convGroupMap.get(t))})),a.conversationGroupList=[].concat(i),i.length=0}}));if(0===r)return e.getRemoteConvGroupList();1===r&&(e._pagingStatus=io.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(o){e._pagingStatus=io.REJECTED,Ye.warn(\"\".concat(t,\" failed. error:\"),o)}))}},{key:\"createConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.CREATE_CONV_GROUP);o.setMessage(JSON.stringify(e));var n=\"\".concat(this._className,\".createConvGroup\");Ye.log(\"\".concat(n,\" options:\"),e);var a=e.groupName,s=e.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:a,contactItem:[]}]},i=[],c=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(D.CONV_C2C,\"\")}):Ut(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(D.CONV_GROUP,\"\")})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===s.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:Jn,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\"));var s=e.data.groupResultItem[0],r=s.groupItem,u=s.resultItem;if(ut(r)&&(t._convGroupMap.set(r.convGroupID,r.groupName),t._emitConvGroupListUpdate()),lt(u)){var l,d,p=!1;u.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(l),(d=t._getLocalConversation(l))&&-1===d.conversationGroupList.indexOf(a)&&(d.conversationGroupList.push(a),p=!0)):c.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===p&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"deleteConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.DELETE_CONV_GROUP);o.setMessage(e);var n=\"\".concat(this._className,\".deleteConvGroup\");return Ye.log(\"\".concat(n,\" groupName:\").concat(e)),this._conversationModule.request({protocolName:Xn,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(a){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\"));var s=a.data.groupItem;if(lt(s)){var r=!1;s.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),r=!0)})),!0===r&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"renameConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.RENAME_CONV_GROUP);o.setMessage(JSON.stringify(e));var n=\"\".concat(this._className,\".renameConvGroup\");Ye.log(\"\".concat(n,\" options:\"),e);var a=e.oldName,s=e.newName;return this._conversationModule.request({protocolName:Qn,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:a,newName:s}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\"));var r=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(r,s),t._emitConvGroupListUpdate();var i,c,u=t._conversationModule.getLocalConversationList(),l=!1;u.forEach((function(e){i=e.conversationGroupList,-1!==(c=i.indexOf(a))&&(i.splice(c,1,s),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"addConvsToGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.ADD_CONVS_TO_GROUP);o.setMessage(JSON.stringify(e));var n=\"\".concat(this._className,\".addConvsToGroup\");Ye.log(\"\".concat(n,\" options:\"),e);var a=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],c=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(D.CONV_C2C,\"\")}}):Ut(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(D.CONV_GROUP,\"\")}})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===a.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:Zn,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\"));var a=e.data.updateGroupResult.contactResultItem;if(lt(a)){var r,u,l=!1;a.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(u=t._getLocalConversation(r))&&-1===u.conversationGroupList.indexOf(s)&&(u.conversationGroupList.push(s),i.push(r),l=!0):c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"deleteConvsFromGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(W.CONV_GROUP))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=new bs(ws.DELETE_CONVS_FROM_GROUP);o.setMessage(JSON.stringify(e));var n=\"\".concat(this._className,\".deleteConvsFromGroup\");Ye.log(\"\".concat(n,\" options:\"),e);var a=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],c=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Pt(e)||Ut(e)?void(Pt(e)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(D.CONV_C2C,\"\")}}):Ut(e)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(D.CONV_GROUP,\"\")}})):(t._onConversationIDInvalid(c,e),!0):(t._onConversationNotFound(c,e),!0)})),c.length===a.length?ur({successConversationIDList:i,failureConversationIDList:c}):this._conversationModule.request({protocolName:ea,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\"));var a=e.data.updateGroupResult.contactResultItem;if(lt(a)){var r,u,l=!1;a.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(u=t._getLocalConversation(r)){var o=u.conversationGroupList.indexOf(s);-1!==o&&(u.conversationGroupList.splice(o,1),i.push(r),l=!0)}}else c.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return er({successConversationIDList:i,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"onConvMarkUpdated\",value:function(e){var t=this;if(!oo(e)){var o,n;Ye.debug(\"\".concat(this._className,\".onConvMarkUpdated markItemList:\"),e);var a=!1;e.forEach((function(e){var s=e.recentContactItem,r=e.optType,i=e.standardMark,c=e.customMark;if(o=t._concatConversationID(s),n=t._getLocalConversation(o))if(1===r){var u=Xt(i);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var o=0,n=e.length;o=0;n--)if(\"1\"===t[n])return o-n-1}},{key:\"_concatConversationID\",value:function(e){var t,o=e.type,n=e.to,a=e.groupID,s=e.userID;return 1===o?dt(s)?dt(n)||(t=\"\".concat(D.CONV_C2C).concat(n)):t=\"\".concat(D.CONV_C2C).concat(s):2===o&&(t=\"\".concat(D.CONV_GROUP).concat(a)),t}},{key:\"_getMyUserID\",value:function(){return this._conversationModule.getMyUserID()}},{key:\"_insertConversationGroup\",value:function(e,t){var o=this._getLocalConversation(e);if(o){var n=o.conversationGroupList;-1===n.indexOf(t)&&n.push(t)}}},{key:\"_getLocalConversation\",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:\"_hasLocalConversation\",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:\"_emitConversationUpdate\",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:\"_emitConvGroupListUpdate\",value:function(){this._conversationModule.emitOuterEvent(S.CONVERSATION_GROUP_LIST_UPDATED,v(this._convGroupMap.values()))}},{key:\"_emitConvInGroupUpdate\",value:function(e){var t={groupName:e,conversationList:[]},o=this._conversationModule.getLocalConversationList();t.conversationList=o.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(S.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=io.NOT_START}}]),e}(),Or=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"ConversationModule\",fr.mixin(_(t)),t._messageListHandler=new pr,t._messageRemindHandler=new Rr(_(t)),t._convGroupHandler=new Lr(_(t)),t.singlyLinkedList=new Sr(100),t._pagingStatus=io.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._initListeners(),t}return s(a,[{key:\"_initListeners\",value:function(){var e=this.getInnerEmitterInstance();e.on(gr,this._initLocalConversationList,this),e.on(hr,this._onProfileUpdated,this)}},{key:\"onCheckTimer\",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:\"_initLocalConversationList\",value:function(){var e=this,t=new bs(ws.GET_CONVERSATION_LIST_IN_STORAGE);Ye.log(\"\".concat(this._className,\"._initLocalConversationList.\"));var o=\"\",n=this._getStorageConversationList(),a=this.isIntl();if(n){for(var s=n.length,r=0;r0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:\"onMessageSent\",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:\"onNewMessage\",value:function(e){this._onSendOrReceiveMessage(e)}},{key:\"_onSendOrReceiveMessage\",value:function(e){var t=this,o=e.conversationOptionsList,n=e.isInstantMessage,a=void 0===n||n,s=e.isUnreadC2CMessage,r=void 0!==s&&s,i=e.updateUnreadCount,c=void 0===i||i;this._isReady?0!==o.length&&(this._getC2CPeerReadTime(o),this._updateLocalConversationList({conversationOptionsList:o,isInstantMessage:a,isUnreadC2CMessage:r,isFromGetConversations:!1,updateUnreadCount:c}),this._setStorageConversationList(),o.filter((function(e){return e.type===D.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:\"updateConversationGroupProfile\",value:function(e){var t=this;if(!lt(e)||0!==e.length)if(0!==this._conversationMap.size){var o=!1;e.forEach((function(e){var n=\"GROUP\".concat(e.groupID);if(t._conversationMap.has(n)){o=!0;var a=t._conversationMap.get(n);a.groupProfile=JSON.parse(JSON.stringify(e)),a.lastMessage.lastSequence=0;r--)if(!a[r].isDeleted){s=a[r];break}var i=this._conversationMap.get(n);if(i){var c=!1;i.lastMessage.lastSequence===s.sequence&&i.lastMessage.lastTime===s.time||(oo(s)&&(s=void 0),i.updateLastMessage(s),i.type!==D.CONV_TOPIC&&(c=!0),Ye.log(\"\".concat(this._className,\".onMessageDeleted. update conversationID:\").concat(n,\" with lastMessage:\"),i.lastMessage)),n.startsWith(D.CONV_C2C)&&this.updateUnreadCount(n),c&&this.emitConversationUpdate(!0,!1)}}}},{key:\"onMessageModified\",value:function(e){var t=e.conversationType,o=e.from,n=e.to,a=e.time,s=e.sequence,r=e.elements,i=e.cloudCustomData,c=e.messageVersion,u=this.getMyUserID(),l=\"\".concat(t).concat(n);n===u&&t===D.CONV_C2C&&(l=\"\".concat(t).concat(o));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(S.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(Ye.log(\"\".concat(this._className,\".onMessageModified isUpdated:\").concat(p,\" isTopicMessage:\").concat(_,\" from:\").concat(o,\" to:\").concat(n)),_){this.getModule(Yo).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;Ye.debug(\"\".concat(this._className.onMessageModified,\" lastMessage:\"),JSON.stringify(f),\"options:\",JSON.stringify(e)),f&&f.lastTime===a&&f.lastSequence===s&&f.version!==c&&(f.type=r[0].type,f.payload=r[0].content,f.messageForShow=zt(f.type,f.payload,this.isIntl()),f.cloudCustomData=i,f.version=c,this.emitConversationUpdate(!0,!1))}}return g}},{key:\"onNewGroupAtTips\",value:function(e){var o=this,n=e.dataList,a=null;n.forEach((function(e){e.groupAtTips?a=e.groupAtTips:e.elements?a=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(a=t(t({},e),{},{sync:!0})),a.__random=e.random,a.__sequence=e.clientSequence,o._tmpGroupAtTipsList.push(a)})),Ye.debug(\"\".concat(this._className,\".onNewGroupAtTips isReady:\").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:\"_handleGroupAtTipsList\",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(o){var n=o.groupID,a=o.from,s=o.topicID,r=void 0===s?void 0:s,i=o.sync,c=void 0!==i&&i;if(a!==e.getMyUserID())if(dt(r)){var u=e._conversationMap.get(\"\".concat(D.CONV_GROUP).concat(n));u&&(u.updateGroupAtInfoList(o),t=!0)}else{var l=e._conversationMap.get(\"\".concat(D.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(o);var d=e.getModule(Yo),p=l.groupAtInfoList;d.onConversationProxy({topicID:r,groupAtInfoList:p})}if(oo(l)&&c)e.updateTopicConversation([{conversationID:\"\".concat(D.CONV_GROUP).concat(r),type:D.CONV_TOPIC}]),e._conversationMap.get(\"\".concat(D.CONV_GROUP).concat(r)).updateGroupAtInfoList(o)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:\"_getC2CPeerReadTime\",value:function(e){var t=this,o=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==D.CONV_C2C||o.push(e.conversationID.replace(D.CONV_C2C,\"\"))})),o.length>0){Ye.debug(\"\".concat(this._className,\"._getC2CPeerReadTime userIDList:\").concat(o));var n=this.getModule(Bo);n&&n.getRemotePeerReadTime(o)}}},{key:\"_getStorageConversationList\",value:function(){return this.getModule(zo).getItem(\"conversationMap\")}},{key:\"_setStorageConversationList\",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===D.CONV_C2C||e.type===D.CONV_GROUP&&e.lastMessage.type!==D.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(zo).setItem(\"conversationMap\",e)}},{key:\"emitConversationUpdate\",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversationList();if(t){var n=this.getModule(Ko);n&&n.updateGroupLastMessage(o)}e&&this.emitOuterEvent(S.CONVERSATION_LIST_UPDATED)}},{key:\"getLocalConversationList\",value:function(){return v(this._conversationMap.values()).filter((function(e){return e.type!==D.CONV_TOPIC}))}},{key:\"getLocalConversation\",value:function(e){return this._conversationMap.get(e)}},{key:\"hasLocalConversation\",value:function(e){return this._conversationMap.has(e)}},{key:\"getLocalOldestMessage\",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:\"syncConversationList\",value:function(){var e=this,t=new bs(ws.SYNC_CONVERSATION_LIST);return this._pagingStatus===io.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(o){return e._pagingStatus=io.RESOLVED,e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setNetworkType(e.getNetworkType()).end(),o})).catch((function(o){return e._pagingStatus=io.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];t.setError(o,a,s).end()})),lr(o)}))}},{key:\"_patchConversationProperties\",value:function(){var e=this,t=Date.now(),o=this.checkAndPatchRemark(),n=this._messageRemindHandler.getC2CMessageRemindType(),a=this.getModule(Ko).getGroupList();Promise.all([o,n,a]).then((function(){var o=Date.now()-t;Ye.log(\"\".concat(e._className,\"._patchConversationProperties ok. cost \").concat(o,\" ms\")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:\"_pagingGetConversationList\",value:function(){var e=this,t=\"\".concat(this._className,\"._pagingGetConversationList\");return Ye.log(\"\".concat(t,\" timeStamp:\").concat(this._pagingTimeStamp,\" startIndex:\").concat(this._pagingStartIndex)+\" pinnedTimeStamp:\".concat(this._pagingPinnedTimeStamp,\" pinnedStartIndex:\").concat(this._pagingPinnedStartIndex)),this._pagingStatus=io.PENDING,this.request({protocolName:Bn,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var n=o.data,a=n.completeFlag,s=n.conversations,r=void 0===s?[]:s,i=n.timeStamp,c=n.startIndex,u=n.pinnedTimeStamp,l=n.pinnedStartIndex,d=n.groupItem;if(Ye.log(\"\".concat(t,\" ok. completeFlag:\").concat(a,\" count:\").concat(r.length,\" isReady:\").concat(e._isReady)),e._convGroupHandler.onConvGroupListSynced(d),r.length>0){var p=e._getConversationOptions(r);e._updateLocalConversationList({conversationOptionsList:p,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return ur();e.triggerReady()}return e._pagingTimeStamp=i,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=u,e._pagingPinnedStartIndex=l,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),ur())})).catch((function(o){throw e.isLoggedIn()&&(e._isReady||(Ye.warn(\"\".concat(t,\" failed. error:\"),o),e.triggerReady())),o}))}},{key:\"_updateLocalConversationList\",value:function(e){var t,o=e.isFromGetConversations,n=e.isInstantMessage,a=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(v(t.toBeUpdatedConversationList),v(this._conversationMap)))),o||(this._updateUserOrGroupProfile(t.newConversationList),n&&this.emitTotalUnreadMessageCountUpdate()),Ye.debug(\"\".concat(this._className,\"._updateLocalConversationList cost \").concat(Date.now()-a,\" ms\"))}},{key:\"_getTmpConversationListMapping\",value:function(e){for(var t=e.conversationOptionsList,o=e.isFromGetConversations,n=e.isInstantMessage,a=e.isUnreadC2CMessage,s=void 0!==a&&a,r=e.updateUnreadCount,i=[],c=[],u=this.getModule(Ko),l=this.getModule(Ho),d=this.isIntl(),p=0,g=t.length;p0&&a.getUserProfile({userIDList:o}).then((function(e){var o=e.data;lt(o)?o.forEach((function(e){t._conversationMap.get(\"C2C\".concat(e.userID)).userProfile=e})):t._conversationMap.get(\"C2C\".concat(o.userID)).userProfile=o})),n.length>0&&s.getGroupProfileAdvance({groupIDList:n,responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"FaceUrl\"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var o=\"GROUP\".concat(e.groupID);if(t._conversationMap.has(o)){var n=t._conversationMap.get(o);Mt(n.groupProfile,e,[],[null,void 0,\"\",0,NaN]),!n.subType&&e.type&&(n.subType=e.type)}}))}))}}},{key:\"_getConversationOptions\",value:function(e){var o=this,n=[],a=e.filter((function(e){var t=e.type,o=e.userID;return 1===t&&\"@TLS#NOT_FOUND\"!==o&&\"@TLS#ERROR\"!==o||2===t})),s=this.getMyUserID(),r=a.map((function(e){if(dt(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var a={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return n.push(a),{conversationID:\"C2C\".concat(e.userID),type:\"C2C\",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?o._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||\"\",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:\"\",nameCard:\"\",version:0,isPeerRead:e.lastC2CMsgFromAccount===s&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new Tr(a),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:\"\",customData:e.customMark||\"\",markList:Xt(e.standardMark),conversationGroupList:o._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:\"GROUP\".concat(e.groupID),type:\"GROUP\",lastMessage:t(t({lastTime:e.time,lastSequence:e.messageReadSeq+e.unreadCount,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},o._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||\"\",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||\"\",nameCard:e.senderNameCard||\"\",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new Nr({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:\"\",version:0,customData:e.customMark||\"\",markList:Xt(e.standardMark),conversationGroupList:o._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));n.length>0&&this.getModule(Vo).onConversationsProfileUpdated(n);return r}},{key:\"_patchTypeAndPayload\",value:function(e){var o=e.lastMsg,n=o.event,a=void 0===n?void 0:n,s=o.elements,r=void 0===s?[]:s,i=o.groupTips,c=void 0===i?{}:i;if(!dt(a)&&!oo(c)){var u=new Zs(c);u.setElement({type:D.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:D.MSG_GRP_TIP,payload:l}}return{type:r[0]?r[0].type:null,payload:r[0]?this._amendLayersOverLimitProperty(r[0].content):null}}},{key:\"_amendLayersOverLimitProperty\",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:\"getLocalMessageList\",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:\"deleteLocalMessage\",value:function(e){e instanceof Zs&&this._messageListHandler.remove(e)}},{key:\"onConversationDeleted\",value:function(e){var t=this;Ye.log(\"\".concat(this._className,\".onConversationDeleted\")),lt(e)&&e.forEach((function(e){var o=e.type,n=e.userID,a=e.groupID,s=\"\";1===o?s=\"\".concat(D.CONV_C2C).concat(n):2===o&&(s=\"\".concat(D.CONV_GROUP).concat(a)),t.deleteLocalConversation(s)}))}},{key:\"onConversationPinned\",value:function(e){var t=this;if(lt(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation(\"\".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation(\"\".concat(D.CONV_GROUP).concat(r))),n&&(Ye.log(\"\".concat(t._className,\".onConversationPinned conversationID:\").concat(n.conversationID,\" isPinned:\").concat(n.isPinned)),n.isPinned||(n.isPinned=!0,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:\"onConversationUnpinned\",value:function(e){var t=this;if(lt(e)){var o=!1;e.forEach((function(e){var n,a=e.type,s=e.userID,r=e.groupID;1===a?n=t.getLocalConversation(\"\".concat(D.CONV_C2C).concat(s)):2===a&&(n=t.getLocalConversation(\"\".concat(D.CONV_GROUP).concat(r))),n&&(Ye.log(\"\".concat(t._className,\".onConversationUnpinned conversationID:\").concat(n.conversationID,\" isPinned:\").concat(n.isPinned)),n.isPinned&&(n.isPinned=!1,o=!0))})),o&&this._sortConversationListAndEmitEvent()}}},{key:\"getMessageList\",value:function(e){var t=this,o=e.conversationID,n=e.nextReqMessageID,a=e.count,s=\"\".concat(this._className,\".getMessageList\"),r=this.getLocalConversation(o),i=\"\";if(r&&r.groupProfile&&(i=r.groupProfile.type),Lt(i))return Ye.log(\"\".concat(s,\" not available in avchatroom. conversationID:\").concat(o)),ur({messageList:[],nextReqMessageID:\"\",isCompleted:!0});(dt(a)||a>15)&&(a=15),!n&&this._isNotInCommunity(o)&&(this._messageListHandler.removeByConversationID(o),this._completedMap.delete(o),this._roamingMessageSequenceMap.delete(o));var c=this._computeRemainingCount({conversationID:o,nextReqMessageID:n}),u=this._completedMap.has(o);if(Ye.log(\"\".concat(s,\" conversationID:\").concat(o,\" nextReqMessageID:\").concat(n)+\" remainingCount:\".concat(c,\" count:\").concat(a,\" isCompleted:\").concat(u)),this._needGetHistory({conversationID:o,remainingCount:c,count:a}))return this.getHistoryMessages({conversationID:o,nextReqMessageID:n,count:20}).then((function(e){var n=e.nextReqID,a=e.storedMessageList,r=t._completedMap.has(o),i=a;c>0&&(i=t._messageListHandler.getLocalMessageList(o).slice(0,a.length+c));var u={nextReqMessageID:r?\"\":n,messageList:i,isCompleted:r};return Ye.log(\"\".concat(s,\" ret.nextReqMessageID:\").concat(u.nextReqMessageID,\" ret.isCompleted:\").concat(u.isCompleted,\" ret.length:\").concat(i.length)),er(u)}));this.modifyMessageList(o);var l=this._getMessageListFromMemory({conversationID:o,nextReqMessageID:n,count:a});return ur(l)}},{key:\"_getMessageListFromMemory\",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=e.count,a=\"\".concat(this._className,\"._getMessageListFromMemory\"),s=this._messageListHandler.getLocalMessageList(t),r=s.length,i=0,c={isCompleted:!1,nextReqMessageID:\"\",messageList:[]};return o?(i=s.findIndex((function(e){return e.ID===o})))>n?(c.messageList=s.slice(i-n,i),c.nextReqMessageID=s[i-n].ID):(c.messageList=s.slice(0,i),c.isCompleted=!0):r>n?(i=r-n,c.messageList=s.slice(i,r),c.nextReqMessageID=s[i].ID):(c.messageList=s.slice(0,r),c.isCompleted=!0),Ye.log(\"\".concat(a,\" conversationID:\").concat(t)+\" ret.nextReqMessageID:\".concat(c.nextReqMessageID,\" ret.isCompleted:\").concat(c.isCompleted,\" ret.length:\").concat(c.messageList.length)),c}},{key:\"getMessageListHopping\",value:function(e){var t=e.conversationID,o=e.sequence,n=e.time,a=e.count,s=e.direction,r=void 0===s?0:s;if((dt(a)||a>15)&&(a=15),t.startsWith(D.CONV_C2C)){var i=this.getModule(Bo),c=t.replace(D.CONV_C2C,\"\");return i.getRoamingMessagesHopping({peerAccount:c,time:n,count:a,direction:r})}if(t.startsWith(D.CONV_GROUP)){var u=this.getModule(Ko),l=t.replace(D.CONV_GROUP,\"\");return u.getRoamingMessagesHopping({groupID:l,sequence:o,count:a,direction:r})}}},{key:\"_computeRemainingCount\",value:function(e){var t=e.conversationID,o=e.nextReqMessageID,n=this._messageListHandler.getLocalMessageList(t),a=n.length;if(!o)return a;var s=0;return Pt(t)?s=n.findIndex((function(e){return e.ID===o})):Ut(t)&&(s=-1!==o.indexOf(\"-\")?n.findIndex((function(e){return e.ID===o})):n.findIndex((function(e){return e.sequence===o}))),-1===s&&(s=0),s}},{key:\"_getMessageListSize\",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:\"_needGetHistory\",value:function(e){var t=e.conversationID,o=e.remainingCount,n=e.count,a=this.getLocalConversation(t),s=\"\";return a&&a.groupProfile&&(s=a.groupProfile.type),!bt(t)&&!Lt(s)&&(!(Ut(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(o<=n&&!this._completedMap.has(t)))}},{key:\"_isTopicConversation\",value:function(e){var t=e.replace(D.CONV_GROUP,\"\");return Gt(t)}},{key:\"getHistoryMessages\",value:function(e){var t=e.conversationID,o=e.count;if(t===D.CONV_SYSTEM)return ur();var n=15;o>20&&(n=20);var a=null;if(Pt(t)){var s=this._roamingMessageKeyAndTimeMap.has(t);return(a=this.getModule(Bo))?a.getRoamingMessage({conversationID:t,peerAccount:t.replace(D.CONV_C2C,\"\"),count:n,lastMessageTime:s?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:s?this._roamingMessageKeyAndTimeMap.get(t).messageKey:\"\"}):lr({code:hn.CANNOT_FIND_MODULE})}if(Ut(t)){if(!(a=this.getModule(Ko)))return lr({code:hn.CANNOT_FIND_MODULE});var r=null;this._conversationMap.has(t)&&(r=this._conversationMap.get(t).lastMessage);var i=0;r&&(i=r.lastSequence);var c=this._roamingMessageSequenceMap.get(t);return a.getRoamingMessage({conversationID:t,groupID:t.replace(D.CONV_GROUP,\"\"),count:n,sequence:c||i})}return ur()}},{key:\"patchConversationLastMessage\",value:function(e){var t=this.getLocalConversation(e);if(t){var o=t.lastMessage,n=o.messageForShow,a=o.payload;if(oo(n)||oo(a)){var s=this._messageListHandler.getLocalMessageList(e);if(0===s.length)return;var r=s[s.length-1];Ye.log(\"\".concat(this._className,\".patchConversationLastMessage conversationID:\").concat(e,\" payload:\"),r.payload),t.updateLastMessage(r)}}}},{key:\"onRoamingMessage\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1?arguments[1]:void 0,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=o.startsWith(D.CONV_C2C)?D.CONV_C2C:D.CONV_GROUP,s=null,r=[],i=[],c=0,u=e.length,l=null,d=a===D.CONV_GROUP,p=this.getModule(Qo),g=function(){c=d?e.length-1:0,u=d?0:e.length},_=function(){d?--c:++c},h=function(){return d?c>=u:c0&&void 0!==arguments[0]?arguments[0]:{},o=\"\".concat(this._className,\".setAllMessageRead\");t.scope||(t.scope=D.READ_ALL_MSG),Ye.log(\"\".concat(o,\" options:\"),t);var n=this._createSetAllMessageReadPack(t);if(0===n.readAllC2CMessage&&0===n.groupMessageReadInfoList.length)return ur();var a=new bs(ws.SET_ALL_MESSAGE_READ);return this.request({protocolName:fa,requestData:n}).then((function(o){var n=o.data,s=e._handleAllMessageRead(n);return a.setMessage(\"scope:\".concat(t.scope,\" failureGroups:\").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),ur()})).catch((function(t){return e.probeNetwork().then((function(e){var o=m(e,2),n=o[0],s=o[1];a.setError(t,n,s).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),t),lr({code:t&&t.code?t.code:hn.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:\"setConversationCustomData\",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:\"markConversation\",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:\"getConversationGroupList\",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:\"createConversationGroup\",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:\"deleteConversationGroup\",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:\"renameConversationGroup\",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:\"addConversationsToGroup\",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:\"deleteConversationsFromGroup\",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:\"onConversationMarkUpdated\",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:\"onConversationGroupCreated\",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:\"onConversationGroupDeleted\",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:\"onConversationGroupNameUpdated\",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:\"onConversationInGroupUpdated\",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:\"onConversationAddedToOrDeletedFromGroup\",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:\"_getConversationLastMessageSequence\",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),o=e.lastMessage.lastSequence;return t&&o0)if(s.type===D.CONV_C2C&&0===o.readAllC2CMessage){if(n===D.READ_ALL_MSG)o.readAllC2CMessage=1;else if(n===D.READ_ALL_C2C_MSG){o.readAllC2CMessage=1;break}}else if(s.type===D.CONV_GROUP&&(n===D.READ_ALL_GROUP_MSG||n===D.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(s);o.groupMessageReadInfoList.push({groupID:s.groupProfile.groupID,messageSequence:r})}}}catch(i){a.e(i)}finally{a.f()}return o}},{key:\"onPushedAllMessageRead\",value:function(e){this._handleAllMessageRead(e)}},{key:\"_handleAllMessageRead\",value:function(e){var t=e.groupMessageReadInfoList,o=e.readAllC2CMessage,n=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:o})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),n}},{key:\"_parseGroupReadInfo\",value:function(e){var t=[];if(e&&e.length)for(var o=0,n=e.length;o=1){if(1===o&&i.type===D.CONV_C2C){var c=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:c})}else if(i.type===D.CONV_GROUP){var u=r.replace(D.CONV_GROUP,\"\");if(this._remoteGroupReadSequenceMap.has(u)){var l=this._remoteGroupReadSequenceMap.get(u),d=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:r,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(u)}}this.updateUnreadCount(r,!1)&&(n+=1)}}}catch(p){a.e(p)}finally{a.f()}return n}},{key:\"isRemoteRead\",value:function(e){var t=e.conversationID,o=e.sequence,n=t.replace(D.CONV_GROUP,\"\"),a=!1;if(this._remoteGroupReadSequenceMap.has(n)){var s=this._remoteGroupReadSequenceMap.get(n);o<=s&&(a=!0,Ye.log(\"\".concat(this._className,\".isRemoteRead conversationID:\").concat(t,\" messageSequence:\").concat(o,\" remoteReadSequence:\").concat(s))),o>=s+10&&this._remoteGroupReadSequenceMap.delete(n)}return a}},{key:\"updateIsReadAfterReadReport\",value:function(e){var t=e.conversationID,o=e.lastMessageSeq,n=e.lastMessageTime,a=this._messageListHandler.getLocalMessageList(t);if(0!==a.length)for(var s,r=a.length-1;r>=0;r--)if(s=a[r],!(n&&s.time>n||o&&s.sequence>o)){if(\"in\"===s.flow&&s.isRead)break;s.setIsRead(!0)}}},{key:\"updateUnreadCount\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=!1,n=this.getLocalConversation(e),a=this._messageListHandler.getLocalMessageList(e);if(n){var s=n.unreadCount,r=a.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(s!==r&&(n.unreadCount=r,o=!0,Ye.log(\"\".concat(this._className,\".updateUnreadCount from \").concat(s,\" to \").concat(r,\", conversationID:\").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),o&&n.type===D.CONV_TOPIC){var i=n.unreadCount,c=this.getModule(Yo),u=e.replace(D.CONV_GROUP,\"\");c.onConversationProxy({topicID:u,unreadCount:i})}return o}}},{key:\"clearGroupAtInfoList\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalConversation(e);if(o&&o.groupAtInfoList.length>0){if(o.clearGroupAtInfoList(),Ye.log(\"\".concat(this._className,\".clearGroupAtInfoList conversationID:\").concat(e)),o.type===D.CONV_TOPIC){var n=o.groupAtInfoList,a=this.getModule(Yo),s=e.replace(D.CONV_GROUP,\"\");a.onConversationProxy({topicID:s,groupAtInfoList:n})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:\"updateReadReceiptInfo\",value:function(e){var t=this,o=e.userID,n=void 0===o?void 0:o,a=e.groupID,s=void 0===a?void 0:a,r=e.readReceiptList;if(!oo(r)){var i=[];if(dt(n)){if(!dt(s)){var c=\"\".concat(D.CONV_GROUP).concat(s);r.forEach((function(e){var o=e.tinyID,n=e.clientTime,a=e.random,r=e.readCount,u=e.unreadCount,l=\"\".concat(o,\"-\").concat(n,\"-\").concat(a),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:s,messageID:l,readCount:0,unreadCount:0};d&&(rt(r)&&(d.readReceiptInfo.readCount=r,p.readCount=r),rt(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),i.push(p))}))}}else{var u=\"\".concat(D.CONV_C2C).concat(n);r.forEach((function(e){var o=e.tinyID,a=e.clientTime,s=e.random,r=\"\".concat(o,\"-\").concat(a,\"-\").concat(s),c=t._messageListHandler.getLocalMessage(u,r);if(c){c.readReceiptInfo.isPeerRead=!0;var l={userID:n,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(S.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:\"recomputeGroupUnreadCount\",value:function(e){var t=e.conversationID,o=e.count,n=this.getLocalConversation(t);if(n){var a=n.unreadCount,s=a-o;s<0&&(s=0),n.unreadCount=s,Ye.log(\"\".concat(this._className,\".recomputeGroupUnreadCount from \").concat(a,\" to \").concat(s,\", conversationID:\").concat(t))}}},{key:\"updateIsRead\",value:function(e){var t=this.getLocalConversation(e),o=this.getLocalMessageList(e);if(t&&0!==o.length&&!bt(t.type)){for(var n=[],a=0,s=o.length;a0){var o=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(o.length>0&&this.emitOuterEvent(S.MESSAGE_READ_BY_PEER,o),this._conversationMap.has(e)){var n=this._conversationMap.get(e).lastMessage;oo(n)||n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:\"updateMessageIsModifiedProperty\",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:\"setCompleted\",value:function(e){Ye.log(\"\".concat(this._className,\".setCompleted. conversationID:\").concat(e)),this._completedMap.set(e,!0)}},{key:\"updateRoamingMessageKeyAndTime\",value:function(e,t,o){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:o})}},{key:\"updateRoamingMessageSequence\",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:\"getConversationList\",value:function(e){var t=this,o=\"\".concat(this._className,\".getConversationList\"),n=\"pagingStatus:\".concat(this._pagingStatus,\", local conversation count:\").concat(this._conversationMap.size,\", options:\").concat(e);if(Ye.log(\"\".concat(o,\". \").concat(n)),this._pagingStatus===io.REJECTED){var a=new bs(ws.GET_CONVERSATION_LIST);return a.setMessage(n),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return er({conversationList:o,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}if(0===this._conversationMap.size){var s=new bs(ws.GET_CONVERSATION_LIST);return s.setMessage(n),this.syncConversationList().then((function(){s.setNetworkType(t.getNetworkType()).end();var o=t._getConversationList(e);return er({conversationList:o,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}var r=this._getConversationList(e);return Ye.log(\"\".concat(o,\". returned conversation count:\").concat(r.length)),ur({conversationList:r,isSyncCompleted:this._isSyncCompleted()})}},{key:\"_getConversationList\",value:function(e){if(dt(e))return this.getLocalConversationList();if(lt(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ut(e)){var t=e.type,o=e.markType,n=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==D.CONV_C2C&&t!==D.CONV_GROUP||e.type===t)&&(!it(n)||e.conversationGroupList.includes(n))&&(!rt(o)||e.markList.includes(o))}))}return[]}},{key:\"_handleC2CPeerReadTime\",value:function(){var e,t=E(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];a.type===D.CONV_C2C&&(Ye.debug(\"\".concat(this._className,\"._handleC2CPeerReadTime conversationID:\").concat(n,\" peerReadTime:\").concat(a.peerReadTime)),this.recordPeerReadTime(n,a.peerReadTime))}}catch(s){t.e(s)}finally{t.f()}}},{key:\"_isPagingGetGroupListCompleted\",value:function(){return this.getModule(Ko).isPagingGetCompleted()}},{key:\"_getLocalGroupCount\",value:function(){return this.getModule(Ko).getLocalGroupList().length}},{key:\"_hasLocalGroup\",value:function(e){return this.getModule(Ko).hasLocalGroup(e.replace(D.CONV_GROUP,\"\"))}},{key:\"getConversationProfile\",value:function(e){var t,o=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new kr({conversationID:e,type:e.slice(0,3)===D.CONV_C2C?D.CONV_C2C:D.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===D.CONV_SYSTEM)return ur({conversation:t});if(Ut(e)&&!this._hasLocalGroup(e))return ur({conversation:t});var n=new bs(ws.GET_CONVERSATION_PROFILE),a=\"\".concat(this._className,\".getConversationProfile\");return Ye.log(\"\".concat(a,\". conversationID:\").concat(e,\" remark:\").concat(t.remark,\" lastMessage:\"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(s){n.setNetworkType(o.getNetworkType()).setMessage(\"conversationID:\".concat(e,\" unreadCount:\").concat(s.data.conversation.unreadCount)).end();var r=o.getModule(Ho);if(r&&t.type===D.CONV_C2C){var i=e.replace(D.CONV_C2C,\"\");if(r.isMyFriend(i)){var c=r.getFriendRemark(i);t.remark!==c&&(t.remark=c,Ye.log(\"\".concat(a,\". conversationID:\").concat(e,\" patch remark:\").concat(t.remark)))}}return Ye.log(\"\".concat(a,\" ok. conversationID:\").concat(e)),s})).catch((function(t){return o.probeNetwork().then((function(o){var a=m(o,2),s=a[0],r=a[1];n.setError(t,s,r).setMessage(\"conversationID:\".concat(e)).end()})),Ye.error(\"\".concat(a,\" failed. error:\"),t),lr(t)}))}},{key:\"_updateUserOrGroupProfileCompletely\",value:function(e){var t=this;return e.type===D.CONV_C2C?this.getModule(Vo).getUserProfile({userIDList:[e.toAccount]}).then((function(o){var n=o.data;return 0===n.length?lr(new rr({code:hn.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=n[0],e._isInfoCompleted=!0,t._unshiftConversation(e),ur({conversation:e}))})):this.getModule(Ko).getGroupProfile({groupID:e.toAccount}).then((function(o){return e.groupProfile=o.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),ur({conversation:e})}))}},{key:\"_unshiftConversation\",value:function(e){e instanceof kr&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(v(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:\"_onProfileUpdated\",value:function(e){var t=this;e.data.forEach((function(e){var o=e.userID;if(o===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var n=t._conversationMap.get(\"\".concat(D.CONV_C2C).concat(o));n&&(n.userProfile=e)}}))}},{key:\"_isSyncCompleted\",value:function(){return this._pagingStatus===io.RESOLVED}},{key:\"deleteConversation\",value:function(e){var t=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return lr({code:hn.CONVERSATION_NOT_FOUND});var n=this._conversationMap.get(e).type;if(n===D.CONV_C2C)o.type=1,o.toAccount=e.replace(D.CONV_C2C,\"\");else{if(n!==D.CONV_GROUP)return n===D.CONV_SYSTEM?(this.getModule(Ko).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),this.deleteLocalConversation(e),ur({conversationID:e})):lr({code:hn.CONVERSATION_UN_RECORDED_TYPE});if(!this._hasLocalGroup(e))return this.deleteLocalConversation(e),ur({conversationID:e});o.type=2,o.toGroupID=e.replace(D.CONV_GROUP,\"\")}var a=new bs(ws.DELETE_CONVERSATION);a.setMessage(\"conversationID:\".concat(e));var s=\"\".concat(this._className,\".deleteConversation\");return Ye.log(\"\".concat(s,\". conversationID:\").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Hn,requestData:o})})).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(s,\" ok\")),t.deleteLocalConversation(e),ur({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error(\"\".concat(s,\" failed. error:\"),e),lr(e)}))}},{key:\"clearHistoryMessage\",value:function(e){var t=this,o={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return lr({code:hn.CONVERSATION_NOT_FOUND});var n=this._conversationMap.get(e).type;if(n===D.CONV_C2C)o.type=1,o.toAccount=e.replace(D.CONV_C2C,\"\");else{if(n!==D.CONV_GROUP)return n===D.CONV_SYSTEM?(this.getModule(Ko).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),ur({conversationID:e})):lr({code:hn.CONVERSATION_UN_RECORDED_TYPE});o.type=2,o.toGroupID=e.replace(D.CONV_GROUP,\"\")}var a=new bs(ws.CLEAR_HISTORY_MESSAGE);a.setMessage(\"conversationID:\".concat(e));var s=\"\".concat(this._className,\".clearHistoryMessage\");return Ye.log(\"\".concat(s,\". conversationID:\").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Wn,requestData:o})})).then((function(){a.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(s,\" ok\")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var o=t.getLocalConversation(e);return o&&(o.updateLastMessage(),t.emitConversationUpdate(!0,!1)),ur({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error(\"\".concat(s,\" failed. error:\"),e),lr(e)}))}},{key:\"pinConversation\",value:function(e){var t=this,o=e.conversationID,n=e.isPinned;if(!this._conversationMap.has(o))return lr({code:hn.CONVERSATION_NOT_FOUND});var a=this.getLocalConversation(o);if(a.isPinned===n)return ur({conversationID:o});var s=new bs(ws.PIN_CONVERSATION);s.setMessage(\"conversationID:\".concat(o,\" isPinned:\").concat(n));var r=\"\".concat(this._className,\".pinConversation\");Ye.log(\"\".concat(r,\". conversationID:\").concat(o,\" isPinned:\").concat(n));var i=null;return Pt(o)?i={type:1,toAccount:o.replace(D.CONV_C2C,\"\")}:Ut(o)&&(i={type:2,groupID:o.replace(D.CONV_GROUP,\"\")}),this.request({protocolName:Yn,requestData:{fromAccount:this.getMyUserID(),operationType:!0===n?1:2,itemList:[i]}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(r,\" ok\")),a.isPinned!==n&&(a.isPinned=n,t._sortConversationListAndEmitEvent()),er({conversationID:o})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error(\"\".concat(r,\" failed. error:\"),e),lr(e)}))}},{key:\"setMessageRemindType\",value:function(e){return this._messageRemindHandler.set(e)}},{key:\"patchMessageRemindType\",value:function(e){var t=e.ID,o=e.isC2CConversation,n=e.messageRemindType,a=!1,s=this.getLocalConversation(o?\"\".concat(D.CONV_C2C).concat(t):\"\".concat(D.CONV_GROUP).concat(t));return s&&s.messageRemindType!==n&&(s.messageRemindType=n,a=!0),Ye.debug(\"\".concat(this._className,\".patchMessageRemindType options:\"),e,\"ret:\".concat(a)),a}},{key:\"onC2CMessageRemindTypeSynced\",value:function(e){var t=this;Ye.debug(\"\".concat(this._className,\".onC2CMessageRemindTypeSynced options:\"),e),e.dataList.forEach((function(e){if(!oo(e.muteNotificationsSync)){var o,n=e.muteNotificationsSync,a=n.to,s=n.updateSequence,r=n.muteFlag;t._messageRemindHandler.setUpdateSequence(s),0===r?o=D.MSG_REMIND_ACPT_AND_NOTE:1===r?o=D.MSG_REMIND_DISCARD:2===r&&(o=D.MSG_REMIND_ACPT_NOT_NOTE);var i=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(i+=1),Ye.log(\"\".concat(t._className,\".onC2CMessageRemindTypeSynced updateCount:\").concat(i)),i>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:\"onGroupMessageRemindTypeSynced\",value:function(e){Ye.debug(\"\".concat(this._className,\".onGroupMessageRemindTypeSynced options:\"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:\"deleteLocalConversation\",value:function(e){var t=this._conversationMap.has(e);if(Ye.log(\"\".concat(this._className,\".deleteLocalConversation conversationID:\").concat(e,\" has:\").concat(t)),t){this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e);var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:\"isMessageSentByCurrentInstance\",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:\"modifyMessageList\",value:function(e){if(e.startsWith(D.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),o=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var n=this.getModule(Vo).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),Ye.log(\"\".concat(this._className,\".modifyMessageList conversationID:\").concat(e,\" cost \").concat(Date.now()-o,\" ms\"))}}},{key:\"updateUserProfileSpecifiedKey\",value:function(e){Ye.log(\"\".concat(this._className,\".updateUserProfileSpecifiedKey options:\"),e);var t=e.conversationID,o=e.nick,n=e.avatar;if(this._conversationMap.has(t)){var a=this._conversationMap.get(t).userProfile;it(o)&&a.nick!==o&&(a.nick=o),it(n)&&a.avatar!==n&&(a.avatar=n),this.emitConversationUpdate(!0,!1)}}},{key:\"_onMyProfileModified\",value:function(e){var o=this,n=this.getLocalConversationList(),a=Date.now();n.forEach((function(n){o.modifyMessageSentByMe(t({conversationID:n.conversationID},e))})),Ye.log(\"\".concat(this._className,\"._onMyProfileModified. modify all messages sent by me, cost \").concat(Date.now()-a,\" ms\"))}},{key:\"modifyMessageSentByMe\",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:\"getLatestMessageSentByMe\",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:\"modifyMessageSentByPeer\",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:\"getLatestMessageSentByPeer\",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:\"pushIntoNoticeResult\",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:\"getLocalLastMessage\",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:\"checkAndPatchRemark\",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(Ho);if(!t)return e;var o=v(this._conversationMap.values()).filter((function(e){return e.type===D.CONV_C2C}));if(0===o.length)return e;var n=0;return o.forEach((function(e){var o=e.conversationID.replace(D.CONV_C2C,\"\");if(t.isMyFriend(o)){var a=t.getFriendRemark(o);e.remark!==a&&(e.remark=a,n+=1)}})),Ye.log(\"\".concat(this._className,\".checkAndPatchRemark. c2c conversation count:\").concat(o.length,\", patched count:\").concat(n)),e}},{key:\"updateTopicConversation\",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:\"sendReadReceipt\",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(Bo):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(Ko)),o?o.sendReadReceipt(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getReadReceiptList\",value:function(e){var t=e[0],o=null;return t.conversationType===D.CONV_C2C?o=this._moduleManager.getModule(Bo):t.conversationType===D.CONV_GROUP&&(o=this._moduleManager.getModule(Ko)),o?o.getReadReceiptList(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getLastMessageTime\",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:\"getTotalUnreadMessageCount\",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==D.CONV_SYSTEM&&(\"\"!==e.messageRemindType&&e.messageRemindType!==D.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:\"emitTotalUnreadMessageCountUpdate\",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(Ye.log(\"\".concat(this._className,\".emitTotalUnreadMessageCountUpdate from \").concat(this._convTotalUnreadCount,\" to \").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._pagingStatus=io.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this.resetReady()}}]),a}(vn),Gr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"GroupTipsHandler\",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return s(e,[{key:\"onCheckTimer\",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:\"_checkCachedGroupTips\",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);Ye.log(\"\".concat(e._className,\"._checkCachedGroupTips groupID:\").concat(o,\" hasLocalGroup:\").concat(a,\" checkCount:\").concat(n)),a?(e._notifyCachedGroupTips(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:\"onNewGroupTips\",value:function(e){Ye.debug(\"\".concat(this._className,\".onReceiveGroupTips count:\").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),o=t.eventDataList,n=t.result,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:o,isInstantMessage:!0}));n.length>0&&(this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,n),this.handleMessageList(n))}},{key:\"newGroupTipsStoredAndSummary\",value:function(e){for(var o=this,n=e.event,a=e.dataList,s=null,r=[],i=[],c={},u=[],l=function(e,l){var d=At(a[e]);if(6===n){if(o._groupModule.isGroupAttributesUpdatedNotice(d))return\"continue\";if(o._groupModule.isGroupCountersNotice(d))return\"continue\"}var p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,v=p.invisible,M=void 0,y=o._groupModule.isMessageFromTopic(h,m);if(y){M=D.CONV_TOPIC,d.to=m;var I=o._groupModule.getModule(Yo);I.hasLocalTopic(g,m)||o._getTopicPendingMap.has(m)||(o._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){o._getTopicPendingMap.delete(m)})))}var C=o._groupModule.hasLocalGroup(g);if(!C&&o._groupModule.isUnjoinedAVChatRoom(g))return\"continue\";if(!C&&!y)return o._cacheGroupTipsAndProbe({groupID:g,event:n,item:d}),\"continue\";if(o._groupModule.isMessageFromOrToAVChatroom(g))return d.event=n,u.push(d),\"continue\";if(d.currentUser=o._groupModule.getMyUserID(),d.conversationType=D.CONV_GROUP,(s=new Zs(d)).setElement({type:D.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),s.isSystemMessage=!1,1===v)return o._qualityStat(s),\"continue\";var T=o._groupModule.getModule(jo),E=s,S=E.conversationID,N=E.sequence;if(6===n)s._onlineOnlyFlag=!0,i.push(s);else if(!T.pushIntoNoticeResult(i,s))return\"continue\";if(o._groupModule.isMessageFromCommunityOfTopic(h,m))return\"continue\";if(6===n&&T.getLocalConversation(S))return\"continue\";6!==n&&o._qualityStat(s);var A=T.isRemoteRead({conversationID:S,sequence:N});if(dt(c[S])){var k=0;\"in\"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||A||(k=1)),c[S]=r.push({conversationID:S,unreadCount:k,type:dt(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?\"\":s})-1}else{var R=c[S];r[R].type=s.conversationType,r[R].subType=s.conversationSubType,r[R].lastMessage=s._isExcludedFromLastMessage?\"\":s,\"in\"===s.flow&&(s._isExcludedFromUnreadCount||s._onlineOnlyFlag||A||r[R].unreadCount++)}},d=0,p=a.length;d=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(S.TOPIC_UPDATED,{groupID:i,topic:c})}}},{key:\"_onTopicProfileUpdated\",value:function(e){var o=e.payload,n=o.groupProfile.groupID,a=o.newTopicInfo;this._groupModule.getModule(Yo).onTopicProfileUpdated(t({groupID:n,topicID:e.to},a))}},{key:\"_cacheGroupTips\",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:\"_deleteCachedGroupTips\",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:\"_notifyCachedGroupTips\",value:function(e){var t=this,o=this._cachedGroupTipsMap.get(e)||[];o.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Ye.log(\"\".concat(this._className,\"._notifyCachedGroupTips groupID:\").concat(e,\" count:\").concat(o.length))}},{key:\"_cacheGroupTipsAndProbe\",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupTips(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupTips(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),Ye.log(\"\".concat(this._className,\"._cacheGroupTipsAndProbe groupID:\").concat(o))}},{key:\"reset\",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Pr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"CommonGroupHandler\",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(gr,this._initGroupList,this)}return s(e,[{key:\"onCheckTimer\",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:\"_checkCachedGroupMessage\",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,o){var n=e._checkCountMap.get(o),a=e._groupModule.hasLocalGroup(o);Ye.log(\"\".concat(e._className,\"._checkCachedGroupMessage groupID:\").concat(o,\" hasLocalGroup:\").concat(a,\" checkCount:\").concat(n)),a?(e._notifyCachedGroupMessage(o),e._checkCountMap.delete(o),e._groupModule.deleteUnjoinedAVChatRoom(o)):n>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(o),e._checkCountMap.delete(o)):(n++,e._checkCountMap.set(o,n))}))}},{key:\"_initGroupList\",value:function(){var e=this;Ye.log(\"\".concat(this._className,\"._initGroupList\"));var t=new bs(ws.GET_GROUP_LIST_IN_STORAGE),o=this._groupModule.getStorageGroupList();if(lt(o)&&o.length>0){o.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var n=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage(\"group count:\".concat(n)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage(\"group count:0\").end();Ye.log(\"\".concat(this._className,\"._initGroupList ok\"))}},{key:\"handleUpdateGroupLastMessage\",value:function(e){var o=\"\".concat(this._className,\".handleUpdateGroupLastMessage\");if(Ye.log(\"\".concat(o,\" conversation count:\").concat(e.length,\", local group count:\").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var n,a,s,r=!1,i=0,c=e.length;i0&&this._groupModule.onAVChatRoomMessage(a),this._groupModule.filterModifiedMessage(n),o.length>0)&&(this._groupModule.updateNextMessageSeq(o),this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:o,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var s=this._groupModule.filterUnmodifiedMessage(n);s.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,s),n.length=0}},{key:\"_newGroupMessageStoredAndSummary\",value:function(e){var t=this,o=e.dataList,n=e.event,a=e.isInstantMessage,s=null,r=[],i=[],c=[],u={},l=this._groupModule.getModule(Qo),d=o.length;d>1&&o.sort((function(e,t){return e.sequence-t.sequence}));for(var p=function(e){var d=At(o[e]),p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,v=p.invisible,M=void 0,y=t._groupModule.isMessageFromTopic(h,m);if(y){M=D.CONV_TOPIC,d.to=m;var I=t._groupModule.getModule(Yo);I.hasLocalTopic(g,m)||t._getTopicPendingMap.has(m)||(t._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){t._getTopicPendingMap.delete(m)})))}var C=t._groupModule.hasLocalGroup(g);if(!C&&t._groupModule.isUnjoinedAVChatRoom(g))return\"continue\";if(!C&&!y)return t._cacheGroupMessageAndProbe({groupID:g,event:n,item:d}),\"continue\";if(t._groupModule.isMessageFromOrToAVChatroom(g))return d.event=n,c.push(d),\"continue\";if(d.currentUser=t._groupModule.getMyUserID(),d.conversationType=D.CONV_GROUP,d.isSystemMessage=!!d.isSystemMessage,s=new Zs(d),d.elements=l.parseElements(d.elements,d.from),s.setElement(d.elements),1===v)return t._qualityStat(a,s),\"continue\";var T=1===o[e].isModified,E=t._groupModule.getModule(jo);if(E.isMessageSentByCurrentInstance(s)?s.isModified=T:T=!1,1===d.onlineOnlyFlag)s._onlineOnlyFlag=!0,E.isMessageSentByCurrentInstance(s)||i.push(s);else{if(t._groupModule.isMessageFromCommunityOfTopic(h,m))return i.push(s),\"continue\";if(!E.pushIntoMessageList(i,s,T))return\"continue\";t._qualityStat(a,s);var S=s,N=S.conversationID,A=S.sequence,k=E.isRemoteRead({conversationID:N,sequence:A});if(dt(u[N])){var R=0;\"in\"===s.flow&&(s._isExcludedFromUnreadCount||k||(R=1)),u[N]=r.push({conversationID:N,unreadCount:R,type:dt(M)?s.conversationType:M,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?\"\":s})-1}else{var L=u[N];r[L].type=dt(M)?s.conversationType:M,r[L].subType=s.conversationSubType,r[L].lastMessage=s._isExcludedFromLastMessage?\"\":s,\"in\"===s.flow&&(s._isExcludedFromUnreadCount||k||r[L].unreadCount++)}}},g=0;g0&&o.addMessageDelay(t.clientTime)}},{key:\"onGroupMessageRevoked\",value:function(e){var t=this._groupModule.getModule(jo),o=[],n=null,a=!0;e.dataList.forEach((function(e){var s=e.elements.revokedInfos;dt(s)||s.forEach((function(e){var s=oo(e.topicID)?\"GROUP\".concat(e.groupID):\"GROUP\".concat(e.topicID);n=t.revoke(s,e.sequence,e.random);var r=e.revokerInfo&&e.revokerInfo.revoker;if(n)n.revoker=r,o.push(n);else{var i={conversationID:s,to:e.topicID||\"\",sequence:e.sequence,time:e.time,revoker:r};t.isLastMessageRevoked(i)&&(o.push(i),a=!1)}}))})),0!==o.length&&(t.onMessageRevoked(o),!0===a&&(Ye.log(\"\".concat(this._className,\".onGroupMessageRevoked count:\").concat(o.length)),this._groupModule.emitOuterEvent(S.MESSAGE_REVOKED,o)))}},{key:\"_groupListTreeShaking\",value:function(e){for(var t=new Map(v(this._groupModule.getGroupMap())),o=0,n=e.length;og),h=\"offset:\".concat(c,\" totalCount:\").concat(p,\" isCompleted:\").concat(_,\" \")+\"currentCount:\".concat(l.length,\" isCommunityRelay:\").concat(a);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage(\"\".concat(h)).end(),a||_?!a&&_?(Ye.log(\"\".concat(o,\" start to get community list\")),c=0,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):a&&!_?(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l,isCommunityRelay:!0})):(Ye.log(\"\".concat(o,\" ok. totalCount:\").concat(l.length)),er({groupList:l})):(c=g,t._pagingGetGroupList({limit:i,offset:c,groupBaseInfoFilter:u,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];d.setMessage(\"isCommunityRelay:\".concat(a)).setError(e,n,s).end()})),a?(11e3===e.code&&(d=null,Ye.log(\"\".concat(o,\" ok. community unavailable\"))),ur({groupList:l})):lr(e)}))}},{key:\"_pagingGetGroupListWithTopic\",value:function(e){var t=this,o=\"\".concat(this._className,\"._pagingGetGroupListWithTopic\"),n=e.limit,a=e.offset,s=e.groupBaseInfoFilter,r=e.groupList,i=new bs(ws.PAGING_GET_GROUP_LIST_WITH_TOPIC);return this._groupModule.request({protocolName:oa,requestData:{type:D.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:n,offset:a,responseFilter:{groupBaseInfoFilter:s,selfInfoFilter:[\"Role\",\"JoinTime\",\"MsgFlag\",\"MsgSeq\"]},isSupportTopic:1}}).then((function(e){var c=e.data,u=c.groups,l=void 0===u?[]:u,d=c.totalCount;r.push.apply(r,v(l));var p=a+n,g=!(d>p),_=\"offset:\".concat(a,\" totalCount:\").concat(d,\" isCompleted:\").concat(g,\" \")+\"currentCount:\".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage(\"\".concat(_)).end(),g?(Ye.log(\"\".concat(o,\" ok. totalCount:\").concat(r.length)),er({groupList:r})):(a=p,t._pagingGetGroupListWithTopic({limit:n,offset:a,groupBaseInfoFilter:s,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),lr(e)}))}},{key:\"_cacheGroupMessage\",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:\"_deleteCachedGroupMessage\",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:\"_notifyCachedGroupMessage\",value:function(e){var t=this,o=this._cachedGroupMessageMap.get(e)||[];o.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),Ye.log(\"\".concat(this._className,\"._notifyCachedGroupMessage groupID:\").concat(e,\" count:\").concat(o.length))}},{key:\"_cacheGroupMessageAndProbe\",value:function(e){var t=this,o=e.groupID,n=e.event,a=e.item;this._cacheGroupMessage(o,{event:n,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(o).then((function(e){e.type===D.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(o)?t._notifyCachedGroupMessage(o):t._groupModule.setUnjoinedAVChatRoom(o):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(o))})),this._checkCountMap.has(o)||this._checkCountMap.set(o,0),Ye.log(\"\".concat(this._className,\"._cacheGroupMessageAndProbe groupID:\").concat(o))}},{key:\"_handleGroupAtInfoWithoutTopic\",value:function(e,o){var n=this;e&&0!==o.length&&o.forEach((function(e){var o=e.groupID,a=e.groupAtInfoList,s=[];dt(a)||(a.forEach((function(e){s.push(t(t({},e),{},{groupID:o}))})),n._groupModule.getModule(jo).onNewGroupAtTips({dataList:s}))}))}},{key:\"reset\",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(gr,this._initGroupList,this)}}]),e}(),Ur=1,br=2,wr=3,Fr=4,qr=5,xr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"GroupAttributesHandler\",this._groupAttributesMap=new Map,this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._groupModule.getCloudConfig(\"grp_attr_cache_time\");dt(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:\"updateLocalMainSequenceOnReconnected\",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:\"isGroupAttributesUpdatedNotice\",value:function(e){var t=e.to,o=e.elements.newGroupProfile,n=!dt(o)&&!oo(o.groupAttributeOption);return n&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:o.groupAttributeOption}),n}},{key:\"_onGroupAttributesUpdated\",value:function(e){var t=this,o=e.groupID,n=e.groupAttributeOption,a=n.mainSequence,s=n.isWithChangedAttributeInfo,r=n.groupAttributeList,i=void 0===r?[]:r,c=n.operationType;if(Ye.log(\"\".concat(this._className,\".onGroupAttributesUpdated. \")+\"groupID:\".concat(o,\" isWithChangedAttributeInfo:\").concat(s,\" operationType:\").concat(c)),!dt(c)){if(1===s)return this._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:a,groupAttributeList:i,operationType:c}),void this._emitGroupAttributesUpdated(o);if(this._hasLocalGroupAttributes(o)){var u=this._getLocalGroupAttributes(o).avChatRoomKey;this._getGroupAttributes({groupID:o,avChatRoomKey:u}).then((function(){t._emitGroupAttributesUpdated(o)}))}}}},{key:\"initGroupAttributesCache\",value:function(e){var t=e.groupID,o=e.avChatRoomKey,n=void 0===o?void 0:o;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),Ye.log(\"\".concat(this._className,\".initGroupAttributesCache groupID:\").concat(t,\" avChatRoomKey:\").concat(n))}},{key:\"initGroupAttributes\",value:function(e){var t=this,o=e.groupID,n=e.groupAttributes,a=this._getLocalGroupAttributes(o),s=a.remoteMainSequence,r=a.avChatRoomKey,i=new bs(ws.INIT_GROUP_ATTRIBUTES);return i.setMessage(\"groupID:\".concat(o,\" avChatRoomKey:\").concat(r,\" mainSequence:\").concat(s)),this._groupModule.request({protocolName:ka,requestData:{groupID:o,avChatRoomKey:r,mainSequence:s,groupAttributeList:this._transformGroupAttributes(n)}}).then((function(e){var a=e.data,s=a.mainSequence,r=v(a.groupAttributeList);return r.forEach((function(e){e.value=n[e.key]})),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:r,operationType:Ur}),i.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log(\"\".concat(t._className,\".initGroupAttributes ok. groupID:\").concat(o)),er({groupAttributes:n})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),lr(e)}))}},{key:\"setGroupAttributes\",value:function(e){var t=this,o=\"\".concat(this._className,\".setGroupAttributes\"),n=e.groupID,a=e.groupAttributes,s=this._getLocalGroupAttributes(n),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=this._transformGroupAttributes(a);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new bs(ws.SET_GROUP_ATTRIBUTES);return l.setMessage(\"groupID:\".concat(n,\"groupAttributes:\").concat(JSON.stringify(a))),Ye.log(\"\".concat(o,\". groupID:\").concat(n,\" mainSequence:\").concat(r)),this._groupModule.request({protocolName:Ra,requestData:{groupID:n,avChatRoomKey:i,mainSequence:r,groupAttributeList:u}}).then((function(e){var s=e.data,r=s.mainSequence,i=v(s.groupAttributeList);return i.forEach((function(e){e.value=a[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:r,groupAttributeList:i,operationType:br}),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok.\")),er({groupAttributes:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),lr(e)}))}},{key:\"deleteGroupAttributes\",value:function(e){var t=this,o=e.groupID,n=e.keyList,a=void 0===n?[]:n,s=this._getLocalGroupAttributes(o),r=s.remoteMainSequence,i=s.avChatRoomKey,c=s.attributes,u=v(c.keys()),l=Oa,d=wr,p={groupID:o,avChatRoomKey:i,mainSequence:r},g=[];a.length>0&&(u=[],l=La,d=Fr,a.forEach((function(e){var t=0;c.has(e)&&(t=c.get(e).sequence,u.push(e)),g.push({key:e,sequence:t})})),p.groupAttributeList=g);var _=new bs(ws.DELETE_GROUP_ATTRIBUTES);return _.setMessage(\"groupID:\".concat(o,\" mainSequence:\").concat(r,\" keyList:\").concat(a,\" protocolName:\").concat(l)),this._groupModule.request({protocolName:l,requestData:p}).then((function(e){var n=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:n,groupAttributeList:g,operationType:d}),_.setNetworkType(t._groupModule.getNetworkType()).end(),Ye.log(\"\".concat(t._className,\".deleteGroupAttributes ok. groupID:\").concat(o)),er({keyList:u})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];_.setError(e,n,a).end()})),lr(e)}))}},{key:\"getGroupAttributes\",value:function(e){var t=this,o=e.groupID,n=this._getLocalGroupAttributes(o),a=n.avChatRoomKey,s=n.lastUpdateTime,r=n.localMainSequence,i=n.remoteMainSequence,c=new bs(ws.GET_GROUP_ATTRIBUTES);if(c.setMessage(\"groupID:\".concat(o,\" localMainSequence:\").concat(r,\" remoteMainSequence:\").concat(i,\" keyList:\").concat(e.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||r0)n.forEach((function(e){s.has(e)&&(a[e]=s.get(e).value)}));else{var r,i=E(s.keys());try{for(i.s();!(r=i.n()).done;){var c=r.value;a[c]=s.get(c).value}}catch(u){i.e(u)}finally{i.f()}}}return a}},{key:\"_updateCachedAttributes\",value:function(e){var t=e.groupAttributes,o=e.groupAttributeList,n=e.operationType;n!==wr?n!==Fr?(n===Ur&&t.attributes.clear(),o.forEach((function(e){var o=e.key,n=e.value,a=e.sequence;t.attributes.set(o,{value:n,sequence:a})}))):o.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:\"_hasLocalGroupAttributes\",value:function(e){return this._groupAttributesMap.has(e)}},{key:\"_getLocalGroupAttributes\",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:\"_transformGroupAttributes\",value:function(e){var t=[];return Object.keys(e).forEach((function(o){t.push({key:o,value:e[o]})})),t}},{key:\"_emitGroupAttributesUpdated\",value:function(e){var t=this._getCachedAttributes({groupID:e});this._groupModule.emitOuterEvent(S.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t})}},{key:\"deleteLocalGroupAttributes\",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:\"reset\",value:function(){this._groupAttributesMap.clear(),this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Vr=\"Set\",Br=\"Increase\",Kr=\"Decrease\",Hr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"GroupCountersHandler\",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._groupModule.getCloudConfig(\"grp_counter_expire_time\");dt(e)||(this.EXPIRE_TIME=Number(e))}},{key:\"isGroupCountersNotice\",value:function(e){var t=e.to,o=e.elements.groupCounterInfo,n=!1;return oo(o)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:o}),n=!0),n}},{key:\"_onGroupCountersUpdated\",value:function(e){var t=this,o=e.groupID;e.groupCounterInfo.forEach((function(e){var n=e.type,a=e.groupCounterSeq,s=e.counterList,r=void 0===s?[]:s;0!==n&&2!==n||(t._updateLocalGroupCounters({groupID:o,groupCounterSeq:a,counterList:r}),r.forEach((function(e){t._groupModule.emitOuterEvent(S.GROUP_COUNTER_UPDATED,{groupID:o,key:e.key,value:e.value})}))),1===n&&t._deleteLocalGroupCounters({groupID:o,groupCounterSeq:a,counterList:r})})),Ye.log(\"\".concat(this._className,\"._onGroupCountersUpdated groupID:\").concat(o))}},{key:\"initGroupCountersCache\",value:function(e){var t=e.groupID,o=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:o}),Ye.log(\"\".concat(this._className,\".initGroupCountersCache groupID:\").concat(t,\" avChatRoomKey:\").concat(o))}},{key:\"setGroupCounters\",value:function(e){var t=this,o=\"\".concat(this._className,\".setGroupCounters\"),n=e.groupID,a=e.counters,s=this._convertObjectToList(a),r=this._getLocalGroupCounters(n).avChatRoomKey,i=\"groupID:\".concat(n,\" count:\").concat(s.length),c=new bs(ws.SET_GROUP_COUNTERS);return c.setMessage(\"\".concat(i)),Ye.log(\"\".concat(o,\". \").concat(i)),this._updateGroupCounters({groupID:n,counterList:s,avChatRoomKey:r,mode:Vr}).then((function(e){return c.end(),Ye.log(\"\".concat(o,\" ok.\")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"increaseGroupCounter\",value:function(e){var t=this,o=\"\".concat(this._className,\".increaseGroupCounters\"),n=e.groupID,a=e.key,s=e.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i=\"groupID:\".concat(n,\" key:\").concat(a,\" value:\").concat(s),c=new bs(ws.INCREASE_GROUP_COUNTER);c.setMessage(\"\".concat(i)),Ye.log(\"\".concat(o,\". \").concat(i));var u=[{key:a,value:s}];return this._updateGroupCounters({groupID:n,counterList:u,avChatRoomKey:r,mode:Br}).then((function(e){return c.end(),Ye.log(\"\".concat(o,\" ok.\")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"decreaseGroupCounter\",value:function(e){var t=this,o=\"\".concat(this._className,\".decreaseGroupCounter\"),n=e.groupID,a=e.key,s=e.value,r=this._getLocalGroupCounters(n).avChatRoomKey,i=\"groupID:\".concat(n,\" key:\").concat(a,\" value:\").concat(s),c=new bs(ws.DECREASE_GROUP_COUNTER);c.setMessage(\"\".concat(i)),Ye.log(\"\".concat(o,\". \").concat(i));var u=[{key:a,value:s}];return this._updateGroupCounters({groupID:n,counterList:u,avChatRoomKey:r,mode:Kr}).then((function(e){return c.end(),Ye.log(\"\".concat(o,\" ok.\")),er({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"getGroupCounters\",value:function(e){var t=this,o=\"\".concat(this._className,\".getGroupCounters\"),n=e.groupID,a=e.keyList,s=void 0===a?[]:a,r=this._getLocalGroupCounters(n),i=r.avChatRoomKey,c=r.lastUpdateTime,u=new bs(ws.GET_GROUP_COUNTERS);if(u.setMessage(\"groupID:\".concat(n)),Date.now()-c>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:n,avChatRoomKey:i}).then((function(e){u.setMoreMessage(\"from remote. count:\".concat(e.length)).end(),Ye.log(\"\".concat(o,\" from remote. groupID:\").concat(n));var a=t._getLocalCounters(n,s);return er({counters:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),lr(e)}));u.setMoreMessage(\"from cache\").end(),Ye.log(\"\".concat(o,\" from cache. groupID:\").concat(n));var l=this._getLocalCounters(n,s);return ur({counters:l})}},{key:\"_getRemoteGroupCounters\",value:function(e){var o=this;return this._groupModule.request({protocolName:Fa,requestData:t({},e)}).then((function(t){var n=t.data,a=n.counterList,s=void 0===a?[]:a,r=n.groupCounterSeq;return o._updateLocalGroupCounters({groupID:e.groupID,counterList:s,groupCounterSeq:r}),Ye.log(\"\".concat(o._className,\"._getRemoteGroupCounters ok. groupID:\").concat(e.groupID)),s})).catch((function(e){return lr(e)}))}},{key:\"_convertObjectToList\",value:function(e){var t=[];return Object.keys(e).forEach((function(o){t.push({key:o,value:e[o]})})),t}},{key:\"_updateGroupCounters\",value:function(e){var o=\"\".concat(this._className,\"._updateGroupCounters\"),n=e.groupID,a=e.avChatRoomKey,s=e.mode;return Ye.log(\"\".concat(o,\". groupID:\").concat(n,\" avChatRoomKey:\").concat(a,\" mode:\").concat(s)),this._groupModule.request({protocolName:wa,requestData:t({},e)}).then((function(e){Ye.log(\"\".concat(o,\" ok.\"));var t=e.data.counterList,n={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,o=e.value;n[t]=o})),n})).catch((function(e){return lr(e)}))}},{key:\"_hasLocalGroupCounters\",value:function(e){return this._groupCountersMap.has(e)}},{key:\"_getLocalGroupCounters\",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:\"_updateLocalGroupCounters\",value:function(e){var t=e.groupID,o=e.counterList,n=void 0===o?[]:o,a=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var s=this._getLocalGroupCounters(t),r=s.counters,i=s.avChatRoomKey,c=s.groupCounterSeq;if(a>0&&a0)t.forEach((function(e){n.has(e)&&(o[e]=n.get(e))}));else{var a,s=E(n.keys());try{for(s.s();!(a=s.n()).done;){var r=a.value;o[r]=n.get(r)}}catch(i){s.e(i)}finally{s.f()}}return o}},{key:\"reset\",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Wr=function(){function e(t){n(this,e);var o=t.manager,a=t.groupID,s=t.onInit,r=t.onSuccess,i=t.onFail;this._className=\"Polling\",this._manager=o,this._groupModule=o._groupModule,this._onInit=s,this._onSuccess=r,this._onFail=i,this._groupID=a,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Ea}return s(e,[{key:\"start\",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Sa),Ye.log(\"\".concat(this._className,\".start pollingInterval:\").concat(this._manager.getPollingInterval(),\" isLoggedIn:\").concat(e)),this._isRunning=!0,this._request()}},{key:\"isRunning\",value:function(){return this._isRunning}},{key:\"_request\",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:\"stop\",value:function(){Ye.log(\"\".concat(this._className,\".stop\")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}}]),e}(),Yr={3:!0,4:!0,5:!0,6:!0,17:!0},jr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"AVChatRoomHandler\",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Sr(200),this.messageIDLinkedList=new Sr(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map}return s(e,[{key:\"hasJoinedAVChatRoom\",value:function(){return this._joinedGroupMap.size>0}},{key:\"checkJoinedAVChatRoomByID\",value:function(e){return this._joinedGroupMap.has(e)}},{key:\"getJoinedAVChatRoom\",value:function(){return this._joinedGroupMap.size>0?v(this._joinedGroupMap.keys()):null}},{key:\"_updateRequestData\",value:function(e){var o=this._pollingRequestInfoMap.get(e);return e===v(this._pollingInstanceMap.keys())[0]?t(t({},o),{},{startBroadcastSeq:this._startBroadcastSeq}):t({},o)}},{key:\"_handleSuccess\",value:function(e,t){var o=t.data,n=o.key,a=o.nextSeq,s=o.rspMsgList,r=o.errorCode,i=o.nextBroadcastSeq,c=o.broadcastMessageList;if(0!==r){var u=this._pollingRequestInfoMap.get(e),l=new bs(ws.LONG_POLLING_AV_ERROR),d=u?\"\".concat(u.key,\"-\").concat(u.startSeq):\"requestInfo is undefined\";l.setMessage(\"\".concat(e,\"-\").concat(d,\"-\").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;it(n)&&rt(a)&&this._pollingRequestInfoMap.set(e,{key:n,startSeq:a}),rt(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),lt(s)&&s.length>0?(s.forEach((function(e){e.to=e.groupID})),this.onMessage(s)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c)}}},{key:\"_handleFailure\",value:function(e,t){}},{key:\"onMessage\",value:function(e){if(lt(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,o=[],n=this._getModule(jo),a=this._getModule(un),s=e.length;s>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule($o),i=0;i1&&p<=20?this._getModule(an).onMessageMaybeLost(l,d+1,p-1):p<-1&&p>=-20&&this._getModule(an).onMessageMaybeLost(l,t.sequence+1,Math.abs(p)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var g=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(g=!0,t.isModified=c,n.updateMessageIsModifiedProperty(t)):g=!0,g){if(t.conversationType===D.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!u&&t.conversationType!==D.CONV_SYSTEM){var _=t.conversationID.replace(D.CONV_GROUP,\"\");this._pollingInstanceMap.has(_)?this._groupModule.isLoggedIn()&&a.addMessageSequence({key:Ls,message:t}):(t.type!==D.MSG_GRP_TIP&&t.clientTime>0&&a.addMessageDelay(t.clientTime),a.addMessageSequence({key:Rs,message:t}))}o.push(t)}}}else Ye.warn(\"\".concat(this._className,\".onMessage unknown event:\").concat(e[i].event));if(0!==o.length){this._groupModule.filterModifiedMessage(o);var h=this.packConversationOption(o);if(h.length>0)this._getModule(jo).onNewMessage({conversationOptionsList:h,isInstantMessage:!0});Ye.debug(\"\".concat(this._className,\".onMessage count:\").concat(o.length)),this._checkMessageStacked(o);var f=this._groupModule.filterUnmodifiedMessage(o);f.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,f),o.length=0}}}},{key:\"_onGroupDismissed\",value:function(e){Ye.log(\"\".concat(this._className,\"._onGroupDismissed groupID:\").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:\"_checkMessageStacked\",value:function(e){var t=\"\".concat(this._className,\"._checkMessageStacked\"),o=e.length;o>=100&&(this._groupModule.isIntl()||Ye.warn(\"\".concat(t,\" 直播群消息堆积数:\").concat(e.length,'!可能会导致微信小程序渲染时遇到 \"Dom limit exceeded\" 的错误,建议接入侧此时只渲染最近的10条消息')),this._reportMessageStackedCount<5&&(new bs(ws.MESSAGE_STACKED).setNetworkType(this._groupModule.getNetworkType()).setMessage(\"count:\".concat(o,\" groupID:\").concat(v(this._joinedGroupMap.keys()))).setLevel(\"warning\").end(),this._reportMessageStackedCount+=1))}},{key:\"_isMessageSentByCurrentInstance\",value:function(e){return!!this._getModule(jo).isMessageSentByCurrentInstance(e)}},{key:\"packMessage\",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?D.CONV_SYSTEM:D.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var o=new Zs(e),n=this.packElements(e,t);return o.setElement(n),o}},{key:\"packElements\",value:function(e,o){return 4===o||6===o?(this._updateMemberCountByGroupTips(e),{type:D.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===o?{type:D.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(Qo).parseElements(e.elements,e.from)}},{key:\"packConversationOption\",value:function(e){for(var t=new Map,o=0;o0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,t)}}},{key:\"start\",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var o=new Wr({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});o.start(),this._pollingInstanceMap.set(e,o),Ye.log(\"\".concat(this._className,\".start groupID:\").concat(e))}}},{key:\"handleJoinResult\",value:function(e){var t=this;return this._preCheck().then((function(){var o=e.longPollingKey,n=e.group,a=n.groupID;return t._joinedGroupMap.set(a,n),t._groupModule.updateGroupMap([n]),t._groupModule.deleteUnjoinedAVChatRoom(a),t._groupModule.emitGroupListUpdate(!0,!1),dt(o)?ur({status:Qe,group:n}):Promise.resolve()}))}},{key:\"startRunLoop\",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var o=e.longPollingKey,n=e.group,a=e.startSeq,s=void 0===a?0:a,r=n.groupID;return t._pollingRequestInfoMap.set(r,{key:o,startSeq:s}),t.start(r),t._groupModule.isLoggedIn()?ur({status:Qe,group:n}):ur({status:Qe})}))}},{key:\"_preCheck\",value:function(){if(this._getModule($o).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],o=e[1];if(this._groupModule.isLoggedIn()){if(!(o.selfInfo.role===D.GRP_MBR_ROLE_OWNER||o.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:\"joinWithoutAuth\",value:function(e){var t=this,o=e.groupID,n=\"\".concat(this._className,\".joinWithoutAuth\"),a=new bs(ws.JOIN_WITHOUT_AUTH);return this._groupModule.request({protocolName:ca,requestData:e}).then((function(e){var s=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2),n=(t[0],t[1]);a.setNetworkType(n).setMessage(\"groupID:\".concat(o,\" longPollingKey:\").concat(s)).end(!0)})),dt(s))return lr({code:hn.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});Ye.log(\"\".concat(n,\" ok. groupID:\").concat(o)),t._getModule(jo).setCompleted(\"\".concat(D.CONV_GROUP).concat(o));var r=new Nr({groupID:o});return t.startRunLoop({group:r,longPollingKey:s}),er({status:Qe})})).catch((function(e){return Ye.error(\"\".concat(n,\" failed. groupID:\").concat(o,\" error:\"),e),t._groupModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];a.setError(e,s,r).setMessage(\"groupID:\".concat(o)).end(!0)})),lr(e)})).finally((function(){t._groupModule.getModule(Jo).reportAtOnce()}))}},{key:\"getGroupOnlineMemberCount\",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},o=Date.now();return oo(t)||o-t.lastSyncTime>1e3*t.expireTime&&o-t.latestUpdateTime>1e4&&o-t.lastReqTime>3e3?(t.lastReqTime=o,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return er({memberCount:e.memberCount})})).catch((function(e){return lr(e)}))):ur({memberCount:t.memberCount})}},{key:\"_getGroupOnlineMemberCount\",value:function(e){var t=this,o=\"\".concat(this._className,\"._getGroupOnlineMemberCount\");return this._groupModule.request({protocolName:Da,requestData:{groupID:e}}).then((function(n){var a=t._onlineMemberCountMap.get(e)||{},s=n.data,r=s.onlineMemberNum,i=void 0===r?0:r,c=s.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;Ye.log(\"\".concat(o,\" ok. groupID:\").concat(e,\" memberCount:\").concat(i,\" expireTime:\").concat(u));var l=Date.now();return oo(a)&&(a.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(a,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:u})),{memberCount:i}})).catch((function(n){return Ye.warn(\"\".concat(o,\" failed. error:\"),n),new bs(ws.GET_GROUP_ONLINE_MEMBER_COUNT).setCode(n.code).setMessage(\"groupID:\".concat(e,\" error:\").concat(JSON.stringify(n))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(n)}))}},{key:\"_getModule\",value:function(e){return this._groupModule.getModule(e)}},{key:\"setPollingInterval\",value:function(e){dt(e)||(rt(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:\"setPollingIntervalPlus\",value:function(e){dt(e)||(rt(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:\"setPollingNoMessageCount\",value:function(e){dt(e)||(rt(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:\"getPollingInterval\",value:function(){return this._pollingInterval}},{key:\"onAVChatRoomMemberBanned\",value:function(e){var t=e.payload.groupProfile.groupID;Ye.log(\"\".concat(this._className,\".onAVChatRoomMemberBanned groupID:\").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:\"reset\",value:function(e){if(e){Ye.log(\"\".concat(this._className,\".reset groupID:\").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{Ye.log(\"\".concat(this._className,\".reset all\"));var o,n=E(this._pollingInstanceMap.values());try{for(n.s();!(o=n.n()).done;){o.value.stop()}}catch(a){n.e(a)}finally{n.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),$r=1,zr=15,Jr=function(){function e(t){n(this,e),this._groupModule=t,this._className=\"GroupSystemNoticeHandler\",this.pendencyMap=new Map}return s(e,[{key:\"onNewGroupSystemNotice\",value:function(e){var t=e.dataList,o=e.isSyncingEnded,n=e.isInstantMessage;Ye.debug(\"\".concat(this._className,\".onReceiveSystemNotice count:\").concat(t.length));var a=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:n}),s=a.eventDataList,r=a.result;s.length>0&&(this._groupModule.getModule(jo).onNewMessage({conversationOptionsList:s,isInstantMessage:n}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:n}));n?r.length>0&&this._groupModule.emitOuterEvent(S.MESSAGE_RECEIVED,r):!0===o&&this._clearGroupSystemNotice()}},{key:\"newSystemNoticeStoredAndSummary\",value:function(e){var o=e.notifiesList,n=e.isInstantMessage,a=null,s=o.length,r=0,i=[],c={conversationID:D.CONV_SYSTEM,unreadCount:0,type:D.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r0?[c]:[],result:i}}},{key:\"_clearGroupSystemNotice\",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set(\"\".concat(t.from,\"_\").concat(t.groupID,\"_\").concat(t.to),t)}));var o=e._groupModule.getModule(jo).getLocalMessageList(D.CONV_SYSTEM),n=[];o.forEach((function(t){var o=t.payload,a=o.operatorID,s=o.operationType,r=o.groupProfile;if(s===$r){var i=\"\".concat(a,\"_\").concat(r.groupID,\"_\").concat(r.to),c=e.pendencyMap.get(i);c&&rt(c.handled)&&0!==c.handled&&n.push(t)}})),e.deleteGroupSystemNotice({messageList:n})}))}},{key:\"deleteGroupSystemNotice\",value:function(e){var t=this,o=\"\".concat(this._className,\".deleteGroupSystemNotice\");return lt(e.messageList)&&0!==e.messageList.length?(Ye.log(\"\".concat(o,\" \")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Ta,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:D.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Ye.log(\"\".concat(o,\" ok\"));var n=t._groupModule.getModule(jo);return e.messageList.forEach((function(e){n.deleteLocalMessage(e)})),er()})).catch((function(e){return Ye.error(\"\".concat(o,\" error:\"),e),lr(e)}))):ur()}},{key:\"_getPendencyList\",value:function(e){var t=this;return this._groupModule.request({protocolName:Ca,requestData:{startTime:e&&e.startTime?e.startTime:0,limit:e&&e.limit?e.limit:10,handleAccount:this._groupModule.getMyUserID()}}).then((function(e){var o=e.data.pendencyList;return 0!==e.data.nextStartTime?t._getPendencyList({startTime:e.data.nextStartTime}).then((function(e){return[].concat(v(o),v(e))})):o}))}},{key:\"getGroupApplicationList\",value:function(){var e=this;return this._getPendencyList().then((function(t){var o=[];return t.forEach((function(t){e.pendencyMap.set(\"\".concat(t.from,\"_\").concat(t.groupID,\"_\").concat(t.to),t),0===t.handled&&o.push({applicant:t.from,applicantNick:t.fromUserNickName,groupName:t.groupName,groupID:t.groupID,authentication:t.authentication,messageKey:t.time})})),ur({applicationList:o})}))}},{key:\"_onReceivedGroupSystemNotice\",value:function(e){var t=this,o=e.result;e.isInstantMessage&&o.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:\"_onApplyGroupRequestAgreed\",value:function(e){var t=this,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;if(o){t._groupModule.updateGroupMap([o]);var n=!o.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,n)}}))}},{key:\"_onMemberKicked\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:\"_onGroupDismissed\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var o=this._groupModule._AVChatRoomHandler;o&&o.checkJoinedAVChatRoomByID(t)&&o.reset(t)}},{key:\"_onInviteGroup\",value:function(e){var t=this,o=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(o)||this._groupModule.getGroupProfile({groupID:o}).then((function(e){var o=e.data.group;o&&(t._groupModule.updateGroupMap([o]),t._groupModule.emitGroupListUpdate())}))}},{key:\"_onQuitGroup\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:\"_onSetManager\",value:function(e){var t=e.payload.groupProfile,o=t.to,n=t.groupID,a=this._groupModule.getModule(Wo).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_ADMIN)}},{key:\"_onDeleteManager\",value:function(e){var t=e.payload.groupProfile,o=t.to,n=t.groupID,a=this._groupModule.getModule(Wo).getLocalGroupMemberInfo(n,o);a&&a.updateRole(D.GRP_MBR_ROLE_MEMBER)}},{key:\"_onMessageRemindTypeSynced\",value:function(e){var t=e.payload.groupProfile.groupID,o=e.payload.messageRemindType;this._groupModule.getModule(jo).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:o})}},{key:\"_handleTopicSystemNotice\",value:function(e){var t=e.groupProfile,o=t.groupID,n=t.topicID,a=e.elements,s=a.operationType,r=a.topicIDList,i=a.messageRemindType,c=this._groupModule.getModule(Yo);17===s?c.onTopicCreated({groupID:o,topicID:n}):18===s?c.onTopicDeleted({groupID:o,topicIDList:r}):20===s&&c.onTopicMessageRemindTypeUpdated({groupID:o,topicID:n,messageRemindType:i})}},{key:\"reset\",value:function(){this.pendencyMap.clear()}}]),e}(),Xr=[\"relayFlag\"],Qr=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"GroupModule\",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Pr(_(t)),t._groupAttributesHandler=new xr(_(t)),t._groupCountersHandler=new Hr(_(t)),t._AVChatRoomHandler=new jr(_(t)),t._groupTipsHandler=new Gr(_(t)),t._groupSystemNoticeHandler=new Jr(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"polling_interval\"),t=this.getCloudConfig(\"polling_interval_plus\"),o=this.getCloudConfig(\"polling_no_msg_count\");this._AVChatRoomHandler&&(Ye.log(\"\".concat(this._className,\"._onCloudConfigUpdated pollingInterval:\").concat(e)+\" pollingIntervalPlus:\".concat(t,\" pollingNoMessageCount:\").concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(o))}},{key:\"onCheckTimer\",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:\"guardForAVChatRoom\",value:function(e){var t=this;if(e.conversationType===D.CONV_GROUP){var o=Gt(e.to)?$t(e.to):e.to;return this.hasLocalGroup(o)?ur():this.getGroupProfile({groupID:o}).then((function(n){var a=n.data.group.type;if(Ye.log(\"\".concat(t._className,\".guardForAVChatRoom. groupID:\").concat(o,\" type:\").concat(a)),a===D.GRP_AVCHATROOM){var s=hn.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM,r=t.isIntl()?\"\".concat(mn[s],\". See https://web.sdk.qcloud.com/im/doc/en/SDK.html#joinGroup\"):\"userID:\".concat(e.from,\" 未加入群 groupID:\").concat(o,\"。发消息前先使用 joinGroup 接口申请加群,详细请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#joinGroup\");return Ye.warn(\"\".concat(t._className,\".guardForAVChatRoom. \").concat(r)),lr(new rr({code:s,message:r,data:{message:e}}))}return ur()}))}return ur()}},{key:\"checkJoinedAVChatRoomByID\",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:\"onNewGroupMessage\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:\"updateNextMessageSeq\",value:function(e){var t=this;if(lt(e)){var o=this.getModule(Yo);e.forEach((function(e){var n=e.conversationID.replace(D.CONV_GROUP,\"\");Gt(n)&&o.updateLastMessage(n,e.lastMessage),t.groupMap.has(n)&&(t.groupMap.get(n).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:\"onNewGroupTips\",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:\"onGroupMessageRevoked\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:\"onNewGroupSystemNotice\",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:\"onGroupMessageReadNotice\",value:function(e){var t=this;e.dataList.forEach((function(e){var o=e.elements.groupMessageReadNotice;if(!dt(o)){var n=t.getModule(jo);o.forEach((function(e){var o=e.groupID,a=e.topicID,s=void 0===a?void 0:a,r=e.lastMessageSeq;Ye.debug(\"\".concat(t._className,\".onGroupMessageReadNotice groupID:\").concat(o,\" lastMessageSeq:\").concat(r));var i=\"\".concat(D.CONV_GROUP).concat(o),c=!0;oo(s)||(i=\"\".concat(D.CONV_GROUP).concat(s),c=!1),n.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),n.updateUnreadCount(i,c),n.clearGroupAtInfoList(i,c)}))}}))}},{key:\"onReadReceiptList\",value:function(e){var t=this;Ye.debug(\"\".concat(this._className,\".onReadReceiptList options:\"),JSON.stringify(e)),e.dataList.forEach((function(e){var o=e.groupProfile,n=e.elements,a=o.groupID,s=t.getModule(jo),r=n.readReceiptList;s.updateReadReceiptInfo({groupID:a,readReceiptList:r})}))}},{key:\"onGroupMessageModified\",value:function(e){Ye.debug(\"\".concat(this._className,\".onGroupMessageModified options:\"),JSON.stringify(e));var o=this.getModule(jo);e.dataList.forEach((function(e){o.onMessageModified(t(t({},e),{},{conversationType:D.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:\"deleteGroupSystemNotice\",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:\"initGroupMap\",value:function(e){this.groupMap.set(e.groupID,new Nr(e))}},{key:\"deleteGroup\",value:function(e){this.groupMap.delete(e)}},{key:\"updateGroupMap\",value:function(e){var t,o=this,n=this.getModule(jo);e.forEach((function(e){t=e.groupID,o.groupMap.has(t)?o.groupMap.get(t).updateGroup(e):(o.groupMap.set(t,new Nr(e)),n.deleteGroupRomaingMessageInfo(t))}));var a,s=this.getMyUserID(),r=E(this.groupMap);try{for(r.s();!(a=r.n()).done;){var i=m(a.value,2)[1];i.selfInfo.userID=s,\"Owner\"===i.selfInfo.role&&(i.ownerID=s)}}catch(c){r.e(c)}finally{r.f()}this._setStorageGroupList()}},{key:\"getStorageGroupList\",value:function(){return this.getModule(zo).getItem(\"groupMap\")}},{key:\"_setStorageGroupList\",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Lt(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(zo).setItem(\"groupMap\",e)}},{key:\"getGroupMap\",value:function(){return this.groupMap}},{key:\"getLocalGroupList\",value:function(){return v(this.groupMap.values())}},{key:\"getLocalGroupProfile\",value:function(e){return this.groupMap.get(e)}},{key:\"sortLocalGroupList\",value:function(){var e=v(this.groupMap).filter((function(e){var t=m(e,2);t[0];return!oo(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(v(e))}},{key:\"updateGroupLastMessage\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:\"emitGroupListUpdate\",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=this.getLocalGroupList();if(e&&this.emitOuterEvent(S.GROUP_LIST_UPDATED),t){var n=JSON.parse(JSON.stringify(o)),a=this.getModule(jo);a.updateConversationGroupProfile(n)}}},{key:\"patchGroupMessageRemindType\",value:function(){var e=this.getLocalGroupList(),t=this.getModule(jo),o=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(o+=1)})),Ye.log(\"\".concat(this._className,\".patchGroupMessageRemindType count:\").concat(o))}},{key:\"recomputeUnreadCount\",value:function(){var e=this.getLocalGroupList(),t=this.getModule(jo);e.forEach((function(e){var o=e.groupID,n=e.selfInfo,a=n.excludedUnreadSequenceList,s=n.readedSequence;if(lt(a)){var r=0;a.forEach((function(t){t>=s&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:\"\".concat(D.CONV_GROUP).concat(o),count:r})}}))}},{key:\"getMyNameCardByGroupID\",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:\"\"}},{key:\"isPagingGetCompleted\",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:\"getGroupList\",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):ur()}},{key:\"getGroupProfile\",value:function(e){var t=this,o=new bs(ws.GET_GROUP_PROFILE),n=\"\".concat(this._className,\".getGroupProfile\"),a=e.groupID,s=e.groupCustomFieldFilter;Ye.log(\"\".concat(n,\" groupID:\").concat(a));var r={groupIDList:[a],responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"Owner_Account\",\"CreateTime\",\"InfoSeq\",\"LastInfoTime\",\"LastMsgTime\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\",\"NextMsgSeq\",\"ShutUpAllMember\"],groupCustomFieldFilter:s,memberInfoFilter:[\"Role\",\"JoinTime\",\"MsgSeq\",\"MsgFlag\",\"NameCard\"]}};return this.getGroupProfileAdvance(r).then((function(e){var s,r=e.data,i=r.successGroupList,c=r.failureGroupList;if(Ye.log(\"\".concat(n,\" ok\")),c.length>0)return lr(c[0]);(Lt(i[0].type)&&!t.hasLocalGroup(a)?s=new Nr(i[0]):(t.updateGroupMap(i),s=t.getLocalGroupProfile(a)),s.isSupportTopic)||t.getModule(jo).updateConversationGroupProfile([s]);return o.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(a,\" type:\").concat(s.type,\" muteAllMembers:\").concat(s.muteAllMembers,\" ownerID:\").concat(s.ownerID)).end(),er({group:s})})).catch((function(a){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(a,s,r).setMessage(\"groupID:\".concat(e.groupID)).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),a),lr(a)}))}},{key:\"getGroupProfileAdvance\",value:function(e){var o=this,n=\"\".concat(this._className,\".getGroupProfileAdvance\"),a=e.groupIDList;lt(a)&&a.length>50&&(Ye.warn(\"\".concat(n,\" 获取群资料的数量不能超过50个\")),a.length=50);var s=[],r=[];a.forEach((function(e){Ot({groupID:e})?r.push(e):s.push(e)}));var i=[];if(s.length>0){var c=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));i.push(c)}if(r.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:r,relayFlag:s.length>0}));i.push(u)}return Promise.all(i).then((function(e){var t=[],o=[];return e.forEach((function(e){t.push.apply(t,v(e.successGroupList)),o.push.apply(o,v(e.failureGroupList))})),er({successGroupList:t,failureGroupList:o})})).catch((function(e){return Ye.error(\"\".concat(o._className,\"._getGroupProfileAdvance failed. error:\"),e),lr(e)}))}},{key:\"_getGroupProfileAdvance\",value:function(e){var t=this,o=e.relayFlag,n=void 0!==o&&o,a=g(e,Xr);return this.request({protocolName:na,requestData:a}).then((function(e){Ye.log(\"\".concat(t._className,\"._getGroupProfileAdvance ok.\"));var o=e.data.groups;return{successGroupList:o.filter((function(e){return dt(e.errorCode)||0===e.errorCode})),failureGroupList:o.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new rr({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return n&&Ot({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:lr(t)}))}},{key:\"createGroup\",value:function(e){var o=this,n=\"\".concat(this._className,\".createGroup\"),a=e.type,s=e.groupID;if(e.name&&!1===this._filterProfanity(\"name\",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return lr({code:hn.PROFANITY_FOUND});if(![\"Public\",\"Private\",\"ChatRoom\",\"AVChatRoom\",\"Community\"].includes(a))return lr({code:hn.ILLEGAL_GROUP_TYPE});if(!Ot({type:a})){if(!oo(s)&&Ot({groupID:s}))return lr({code:hn.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Lt(a)&&!dt(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),Rt(a)||dt(e.joinOption)||(e.joinOption=void 0),Ot({type:a})){if(!oo(s)&&!Ot({groupID:s}))return lr({code:hn.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new bs(ws.CREATE_GROUP);Ye.log(\"\".concat(n,\" options:\"),e);var i=null,c=[];return this.request({protocolName:aa,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(a){var s=a.data,u=s.groupID,l=s.overLimitUserIDList,d=void 0===l?[]:l;if(i=u,c=d,r.setNetworkType(o.getNetworkType()).setMessage(\"groupType:\".concat(e.type,\" groupID:\").concat(u,\" overLimitUserIDList=\").concat(d)).end(),Ye.log(\"\".concat(n,\" ok groupID:\").concat(u,\" overLimitUserIDList:\"),d),e.type===D.GRP_AVCHATROOM)return o.getGroupProfile({groupID:u});if(e.type===D.GRP_COMMUNITY&&1===e.isSupportTopic)return o.getGroupProfile({groupID:u});oo(e.memberList)||oo(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),o.updateGroupMap([t(t({},e),{},{groupID:u})]);var p=o.getModule(qo),g=p.createCustomMessage({to:u,conversationType:D.CONV_GROUP,payload:{data:\"group_create\",extension:o.isIntl()?\"\".concat(o.getMyUserID(),\" created a group\"):\"\".concat(o.getMyUserID(),\"创建群组\")}});return p.sendMessageInstance(g),o.emitGroupListUpdate(),o.getGroupProfile({groupID:u})})).then((function(e){var t=e.data.group,o=t.selfInfo,n=o.nameCard,a=o.joinTime;return t.updateSelfInfo({nameCard:n,joinTime:a,messageRemindType:D.MSG_REMIND_ACPT_AND_NOTE,role:D.GRP_MBR_ROLE_OWNER}),er({group:t,overLimitUserIDList:c})})).catch((function(a){if(r.setMessage(\"groupType:\".concat(e.type)),o.probeNetwork().then((function(e){var t=m(e,2),o=t[0],n=t[1];r.setError(a,o,n).end()})),10010===a.code||10007===a.code){o.updateGroupMap([t(t({},e),{},{groupID:i})]);var s=o.getLocalGroupProfile(i);return Ye.log(\"\".concat(n,\" success, but failed to get group profile.\")),er({group:s,overLimitUserIDList:c})}return Ye.error(\"\".concat(n,\" failed. error:\"),a),lr(a)}))}},{key:\"dismissGroup\",value:function(e){var t=this,o=\"\".concat(this._className,\".dismissGroup\");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===D.GRP_WORK)return lr(new rr({code:hn.CANNOT_DISMISS_WORK}));var n=new bs(ws.DISMISS_GROUP);return n.setMessage(\"groupID:\".concat(e)),Ye.log(\"\".concat(o,\" groupID:\").concat(e)),this.request({protocolName:sa,requestData:{groupID:e}}).then((function(){return n.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),er({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"updateGroupProfile\",value:function(e){var t=this,o=\"\".concat(this._className,\".updateGroupProfile\");if(!this.hasLocalGroup(e.groupID)||Rt(this.getLocalGroupProfile(e.groupID).type)||dt(e.joinOption)||(Ye.warn(\"\".concat(o,\" joinOption is unavailable for Work/Meeting/AVChatRoom/Community\")),e.joinOption=void 0),dt(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers=\"On\":e.muteAllMembers=\"Off\"),e.name&&!1===this._filterProfanity(\"name\",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.UPDATE_GROUP_PROFILE);return n.setMessage(JSON.stringify(e)),Ye.log(\"\".concat(o,\" groupID:\").concat(e.groupID)),this.request({protocolName:ra,requestData:e}).then((function(){(n.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return er({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.log(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_filterProfanity\",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],X),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:\"joinGroup\",value:function(e){var t=this,o=e.groupID,n=e.type,a=\"\".concat(this._className,\".joinGroup\");if(n===D.GRP_WORK)return lr({code:hn.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)){if(!this.isLoggedIn())return ur({status:D.JOIN_STATUS_ALREADY_IN_GROUP});var s=new bs(ws.APPLY_JOIN_GROUP);return this.getGroupProfile({groupID:o}).then((function(){return s.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(o,\" joinedStatus:\").concat(D.JOIN_STATUS_ALREADY_IN_GROUP)).end(),ur({status:D.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(n){return s.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(o,\" unjoined\")).end(),Ye.warn(\"\".concat(a,\" \").concat(o,\" was unjoined, now join!\")),t.groupMap.delete(o),t.applyJoinGroup(e)}))}return Ye.log(\"\".concat(a,\" groupID:\").concat(o)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:\"applyJoinGroup\",value:function(e){var o=this,n=\"\".concat(this._className,\".applyJoinGroup\"),a=e.groupID;if(!oo(e.applyMessage)&&!1===this._filterProfanity(\"applyMessage\",e))return lr({code:hn.PROFANITY_FOUND});var s=new bs(ws.APPLY_JOIN_GROUP),r=t({},e),i=this.canIUse(W.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(jo).deleteTopicRoamingMessageInfo(a),this.request({protocolName:ia,requestData:r}).then((function(e){var t=e.data,r=t.joinedStatus,c=t.longPollingKey,u=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,g=\"groupID:\".concat(a,\" joinedStatus:\").concat(r,\" longPollingKey:\").concat(c,\" startSeq:\").concat(u)+\" avChatRoomFlag:\".concat(l,\" canGetAVChatRoomHistoryMessage:\").concat(i,\",\")+\" history message count:\".concat(oo(p)?0:p.length);switch(s.setNetworkType(o.getNetworkType()).setMessage(\"\".concat(g)).end(),Ye.log(\"\".concat(n,\" ok. \").concat(g)),r){case Ze:return er({status:Ze});case Qe:return o.getGroupProfile({groupID:a}).then((function(e){var t,n=e.data.group,s={status:Qe,group:n};return 1===l?(o.getModule(jo).setCompleted(\"\".concat(D.CONV_GROUP).concat(a)),o._groupAttributesHandler.initGroupAttributesCache({groupID:a,avChatRoomKey:d}),o._groupCountersHandler.initGroupCountersCache({groupID:a,avChatRoomKey:d}),(t=dt(c)?o._AVChatRoomHandler.handleJoinResult({group:n}):o._AVChatRoomHandler.startRunLoop({longPollingKey:c,group:n,startSeq:u})).then((function(){o._onAVChatRoomHistoryMessage(p)})),t):(o.emitGroupListUpdate(!0,!1),er(s))}));default:var _=new rr({code:hn.JOIN_GROUP_FAIL});return Ye.error(\"\".concat(n,\" failed. error:\"),_),lr(_)}})).catch((function(e){return s.setMessage(\"groupID:\".concat(a)),o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"quitGroup\",value:function(e){var t=this,o=\"\".concat(this._className,\".quitGroup\");Ye.log(\"\".concat(o,\" groupID:\").concat(e));var n=this.checkJoinedAVChatRoomByID(e);if(!n&&!this.hasLocalGroup(e))return lr({code:hn.MEMBER_NOT_IN_GROUP});if(n&&!this.isLoggedIn())return Ye.log(\"\".concat(o,\" anonymously ok. groupID:\").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),ur({groupID:e});var a=new bs(ws.QUIT_GROUP);return a.setMessage(\"groupID:\".concat(e)),this.request({protocolName:ua,requestData:{groupID:e}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),t.deleteLocalGroupAndConversation(e),n&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),er({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"searchGroupByID\",value:function(e){var t=this,o=\"\".concat(this._className,\".searchGroupByID\"),n={groupIDList:[e]},a=new bs(ws.SEARCH_GROUP_BY_ID);return a.setMessage(\"groupID:\".concat(e)),Ye.log(\"\".concat(o,\" groupID:\").concat(e)),this.request({protocolName:la,requestData:n}).then((function(e){var n=e.data.groupProfile;if(0!==n[0].errorCode)throw new rr({code:n[0].errorCode,message:n[0].errorInfo});return a.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),er({group:new Nr(n[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"changeGroupOwner\",value:function(e){var t=this,o=\"\".concat(this._className,\".changeGroupOwner\");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===D.GRP_AVCHATROOM)return lr({code:hn.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return lr({code:hn.CANNOT_CHANGE_OWNER_TO_SELF});var n=new bs(ws.CHANGE_GROUP_OWNER);return n.setMessage(\"groupID:\".concat(e.groupID,\" newOwnerID:\").concat(e.newOwnerID)),Ye.log(\"\".concat(o,\" groupID:\").concat(e.groupID)),this.request({protocolName:da,requestData:e}).then((function(){n.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\"));var a=e.groupID,s=e.newOwnerID;t.groupMap.get(a).ownerID=s;var r=t.getModule(Wo).getLocalGroupMemberList(a);if(r instanceof Map){var i=r.get(t.getMyUserID());dt(i)||(i.updateRole(\"Member\"),t.groupMap.get(a).selfInfo.role=\"Member\");var c=r.get(s);dt(c)||c.updateRole(\"Owner\")}return t.emitGroupListUpdate(!0,!1),er({group:t.groupMap.get(a)})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"getGroupApplicationList\",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:\"handleGroupApplication\",value:function(e){var t,o,n,a,s=this,r=\"\".concat(this._className,\".handleGroupApplication\"),i=e.handleAction,c=e.handleMessage,u=e.message,l=e.application;u?(t=u.payload.operatorID,o=u.payload.groupProfile.groupID,n=u.payload.authentication,a=u.payload.messageKey):l&&(t=l.applicant,o=l.groupID,n=l.authentication,a=l.messageKey);var d=new bs(ws.HANDLE_GROUP_APPLICATION);return d.setMessage(\"groupID:\".concat(o)),Ye.log(\"\".concat(r,\" groupID:\").concat(o)),this.request({protocolName:pa,requestData:{handleAction:i,handleMessage:c,applicant:t,groupID:o,authentication:n,messageKey:a}}).then((function(){return d.setNetworkType(s.getNetworkType()).end(),Ye.log(\"\".concat(r,\" ok\")),u&&s._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),er({group:s.getLocalGroupProfile(o)})})).catch((function(e){return s.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];d.setError(e,n,a).end()})),Ye.error(\"\".concat(r,\" failed. error\"),e),lr(e)}))}},{key:\"handleGroupInvitation\",value:function(e){var o=this,n=\"\".concat(this._className,\".handleGroupInvitation\"),a=e.message.payload,s=a.groupProfile.groupID,r=a.authentication,i=a.messageKey,c=a.operatorID,u=e.handleAction,l=new bs(ws.HANDLE_GROUP_INVITATION);return l.setMessage(\"groupID:\".concat(s,\" inviter:\").concat(c,\" handleAction:\").concat(u)),Ye.log(\"\".concat(n,\" groupID:\").concat(s,\" inviter:\").concat(c,\" handleAction:\").concat(u)),this.request({protocolName:ga,requestData:t(t({},e),{},{inviter:c,groupID:s,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(o.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\")),o._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),er({group:o.getLocalGroupProfile(s)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error\"),e),lr(e)}))}},{key:\"getGroupOnlineMemberCount\",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):ur({memberCount:0}):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"hasLocalGroup\",value:function(e){return this.groupMap.has(e)}},{key:\"deleteLocalGroupAndConversation\",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Ye.log(\"\".concat(this._className,\".deleteLocalGroupAndConversation isJoinedAVChatRoom:\").concat(t)),t)&&this.getModule(jo).deleteLocalConversation(\"\".concat(D.CONV_GROUP).concat(e));if(Ot({groupID:e})){var o=this.getLocalGroupProfile(e);if(o&&!0===o.isSupportTopic)this.getModule(Yo).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:\"_deleteLocalGroup\",value:function(e){this.groupMap.delete(e),this.getModule(Wo).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:\"sendMessage\",value:function(e,t){if(lt(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(W.MSG_TO_SPECIFIED_GRP_MBR))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=this.createGroupMessagePack(e,t);return this.request(o)}},{key:\"createGroupMessagePack\",value:function(e,t){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var n=\"\";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(n=e.cloudCustomData);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push(\"NoUnread\"),!0===i&&a.push(\"NoLastMsg\")}var c=void 0;lt(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),Ye.warn(\"\".concat(this._className,\".createGroupMessagePack receiverList must be less than or equal to 50.\"))));var u=this.isOnlineMessage(e,t)?1:0,l=e.getGroupAtInfoList(),d={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:n,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==D.MSG_TEXT||oo(l)?void 0:l,onlineOnlyFlag:u,clientTime:e.clientTime,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||\"\",desc:o.description||\"\",ext:o.extension||\"\",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(o)},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0===u?a:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return Gt(e.to)&&(d.groupID=$t(e.to),d.topicID=e.to),{protocolName:Dn,tjgID:this.generateTjgID(e),requestData:d}}},{key:\"_isVoipPush\",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:\"revokeMessage\",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Gt(e.to)&&(t.groupID=$t(e.to),t.topicID=e.to),this.request({protocolName:_a,requestData:t})}},{key:\"deleteMessage\",value:function(e){var t=e.to,o=e.keyList;Ye.log(\"\".concat(this._className,\".deleteMessage groupID:\").concat(t,\" count:\").concat(o.length));var n={groupID:t,deleter:this.getMyUserID(),keyList:o};return Gt(t)&&(n.groupID=$t(t),n.topicID=t),this.request({protocolName:Na,requestData:n})}},{key:\"modifyRemoteMessage\",value:function(e){var t=e.to,o=e.sequence,n=e.payload,a=e.type,s=e.version,r=void 0===s?0:s,i=e.cloudCustomData,c=t,u=void 0;Gt(t)&&(c=$t(t),u=t);var l=void 0;return Jt(a)&&(l=[]).push({type:a,content:n}),this.request({protocolName:Aa,requestData:{groupID:c,topicID:u,sequence:o,version:r,elements:l,cloudCustomData:i}})}},{key:\"getRoamingMessage\",value:function(e){var t=this,o=\"\".concat(this._className,\".getRoamingMessage\"),n=e.conversationID,a=e.groupID,s=e.sequence,r=new bs(ws.GET_GROUP_ROAMING_MESSAGES),i=0,c=void 0;return Gt(a)&&(a=$t(c=a)),this._computeLastSequence({groupID:a,topicID:c,sequence:s}).then((function(e){return i=e,Ye.log(\"\".concat(o,\" groupID:\").concat(a,\" startSequence:\").concat(i)),t.request({protocolName:ma,requestData:{groupID:a,count:21,sequence:i,topicID:c}})})).then((function(e){var s=e.data,u=s.messageList,l=s.complete,d=s.invisibleSequenceList,p=void 0===d?[]:d;dt(u)?Ye.log(\"\".concat(o,\" ok. complete:\").concat(l,\" but messageList is undefined!\")):Ye.log(\"\".concat(o,\" ok. complete:\").concat(l,\" count:\").concat(u.length));var g=t._getMinSequence(p,u)-1;r.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(a,\" topicID:\").concat(c,\" startSequence:\").concat(i,\" complete:\").concat(l,\" nextSequence:\").concat(g)).end();var _=t.getModule(jo),h=[];return oo(u)||(_.updateRoamingMessageSequence(n,g),h=_.onRoamingMessage(u,n),_.updateIsRead(n),_.patchConversationLastMessage(n)),2===l&&(_.setCompleted(n),g=\"\"),Ye.log(\"\".concat(o,\" nextReqID:\").concat(g,\", stored message count:\").concat(h.length,\", invisible sequence count:\").concat(p.length)),{nextReqID:g+\"\",storedMessageList:h}})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];r.setError(e,n,s).setMessage(\"groupID:\".concat(a,\" topicID:\").concat(c,\" startSequence:\").concat(i)).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_getGroupIDOfMessage\",value:function(e){return e.conversationID.replace(D.CONV_GROUP,\"\")}},{key:\"_getMinSequence\",value:function(e,t){var o=0;oo(t)||(o=t[t.length-1].sequence);var n=0;oo(e)||(n=e[e.length-1]);return Ye.log(\"\".concat(this._className,\"._getMinSequence minVisibleSequence:\").concat(o,\" minInvisibleSequence:\").concat(n)),n>0&&n=100?100:s,_=\"groupID:\".concat(r,\" sequence:\").concat(c,\" cursor:\").concat(p,\" filter:\").concat(d,\" completeFlag:\").concat(l);Ye.log(\"\".concat(u,\" \").concat(_));var h={cursor:\"\",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new bs(ws.GET_READ_RECEIPT_DETAIL);return f.setMessage(_),this.request({protocolName:Ia,requestData:{groupID:r,sequence:c,flag:d,cursor:p,count:g}}).then((function(e){f.end();var o=e.data,n=o.cursor,a=o.isCompleted,s=o.unreadUserIDList,r=o.readUserIDList;return h.cursor=n,1===a&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===d?h.readUserIDList=r.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=s.map((function(e){return e.userID}))),Ye.log(\"\".concat(u,\" ok\")),er(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];f.setError(e,n,a).end()})),Ye.warn(\"\".concat(u,\" failed. error:\"),e),lr(e)}))}},{key:\"getRoamingMessagesHopping\",value:function(e){var t=this,o=\"\".concat(this._className,\".getRoamingMessagesHopping\"),n=new bs(ws.GET_GROUP_ROAMING_MESSAGES_HOPPING),a=e.groupID,s=e.count,r=e.sequence,i=e.direction,c=r;1===i&&(c=r+s-1);var u=void 0;Gt(a)&&(a=$t(u=a));var l=\"\".concat(u?\"topicID:\".concat(u):\"groupID:\".concat(a),\" sequence:\").concat(r,\" direction:\").concat(i);return Ye.log(\"\".concat(o,\" \").concat(l)),this.request({protocolName:ma,requestData:{groupID:a,topicID:u,count:s,sequence:c}}).then((function(a){var s=a.data,c=s.messageList,u=s.complete,d=\"complete:\".concat(u,\" count:\").concat(c?c.length:0);if(Ye.log(\"\".concat(o,\" ok. \").concat(d)),n.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(l,\" \").concat(d)).end(),2===u||oo(c)){var p=t._computeResult();return er(p)}var g=\"\".concat(D.CONV_GROUP).concat(e.groupID),_=t.getModule(jo).onRoamingMessage(c,g,!1),h=t._computeResult({direction:i,sequence:r,remoteMessageList:c,processedMessageList:_});return er(h)})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),i=o[0],c=o[1];n.setError(e,i,c).setMessage(\"groupID:\".concat(a,\" sequence:\").concat(r,\" count:\").concat(s)).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_computeResult\",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:\"\"};if(dt(e))return t.isCompleted=!0,t;var o=e.direction,n=e.sequence,a=e.remoteMessageList,s=void 0===a?[]:a,r=e.processedMessageList,i=void 0===r?[]:r,c=s.length;return 1===o?(t.nextMessageSeq=s[0].sequence+1,i.forEach((function(e){e.sequence>=n&&t.messageList.push(e)})),0===t.messageList.length&&s[0].sequence0?Promise.resolve(a):dt(n)||this.hasLocalGroup(t)?dt(n)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:n}):Promise.resolve(0)}},{key:\"getGroupLastSequence\",value:function(e){var t=this,o=\"\".concat(this._className,\".getGroupLastSequence\"),n=new bs(ws.GET_GROUP_LAST_SEQUENCE),a=0,s=\"\";if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),i=r.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return a=i.lastSequence,s=\"got lastSequence:\".concat(a,\" from local group profile[lastMessage.lastSequence]. groupID:\").concat(e),Ye.log(\"\".concat(o,\" \").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(s)).end(),Promise.resolve(a);if(r.nextMessageSeq>1)return a=r.nextMessageSeq-1,s=\"got lastSequence:\".concat(a,\" from local group profile[nextMessageSeq]. groupID:\").concat(e),Ye.log(\"\".concat(o,\" \").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(s)).end(),Promise.resolve(a)}var c=\"GROUP\".concat(e),u=this.getModule(jo).getLocalConversation(c);if(u&&u.lastMessage.lastSequence&&!1===u.lastMessage.onlineOnlyFlag)return a=u.lastMessage.lastSequence,s=\"got lastSequence:\".concat(a,\" from local conversation profile[lastMessage.lastSequence]. groupID:\").concat(e),Ye.log(\"\".concat(o,\" \").concat(s)),n.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(s)).end(),Promise.resolve(a);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:[\"NextMsgSeq\"]}};return this.getGroupProfileAdvance(l).then((function(r){var i=r.data.successGroupList;return oo(i)?Ye.log(\"\".concat(o,\" successGroupList is empty. groupID:\").concat(e)):(a=i[0].nextMessageSeq-1,s=\"got lastSequence:\".concat(a,\" from getGroupProfileAdvance. groupID:\").concat(e),Ye.log(\"\".concat(o,\" \").concat(s))),n.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(s)).end(),a})).catch((function(a){return t.probeNetwork().then((function(t){var o=m(t,2),s=o[0],r=o[1];n.setError(a,s,r).setMessage(\"get lastSequence failed from getGroupProfileAdvance. groupID:\".concat(e)).end()})),Ye.warn(\"\".concat(o,\" failed. error:\"),a),lr(a)}))}},{key:\"getTopicLastSequence\",value:function(e){var t=this,o=e.groupID,n=e.topicID,a=\"\".concat(this._className,\".getTopicLastSequence\"),s=new bs(ws.GET_TOPIC_LAST_SEQUENCE),r=0,i=\"\",c=this.getModule(Yo);return c.hasLocalTopic(o,n)?(r=c.getLocalTopic(o,n).nextMessageSeq-1,i=\"get lastSequence:\".concat(r,\" from local topic info[nextMessageSeq]. topicID:\").concat(n),Ye.log(\"\".concat(a,\" \").concat(i)),s.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(i)).end(),Promise.resolve(r)):c.getTopicList({groupID:o,topicIDList:[n]}).then((function(e){var o=e.data.successTopicList;return oo(o)?Ye.log(\"\".concat(a,\" successTopicList is empty. topicID:\").concat(n)):(r=o[0].nextMessageSeq-1,i=\"get lastSequence:\".concat(r,\" from getTopicList. topicID:\").concat(n),Ye.log(\"\".concat(a,\" \").concat(i))),s.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),a=o[0],r=o[1];s.setError(e,a,r).setMessage(\"get lastSequence failed from getTopicList. topicID:\".concat(n)).end()})),Ye.warn(\"\".concat(a,\" failed. error:\"),e),lr(e)}))}},{key:\"isMessageFromOrToAVChatroom\",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:\"hasJoinedAVChatRoom\",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:\"getJoinedAVChatRoom\",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:\"isOnlineMessage\",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:\"_canIUseOnlineOnlyFlag\",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==D.CONV_GROUP}},{key:\"_onAVChatRoomHistoryMessage\",value:function(e){if(!oo(e)){Ye.log(\"\".concat(this._className,\"._onAVChatRoomHistoryMessage count:\").concat(e.length));var o=[];e.forEach((function(e){o.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(o)}}},{key:\"onAVChatRoomMessage\",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:\"onAVChatRoomMemberBanned\",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:\"getGroupSimplifiedInfo\",value:function(e){var t=this,o=new bs(ws.GET_GROUP_SIMPLIFIED_INFO),n={groupIDList:[e],responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\"]}};return this.getGroupProfileAdvance(n).then((function(n){var a=n.data.successGroupList;return o.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(e,\" type:\").concat(a[0].type)).end(),a[0]})).catch((function(n){t.probeNetwork().then((function(t){var a=m(t,2),s=a[0],r=a[1];o.setError(n,s,r).setMessage(\"groupID:\".concat(e)).end()}))}))}},{key:\"setUnjoinedAVChatRoom\",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:\"deleteUnjoinedAVChatRoom\",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:\"isUnjoinedAVChatRoom\",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:\"isGroupAttributesUpdatedNotice\",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:\"updateLocalMainSequenceOnReconnected\",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:\"initGroupAttributes\",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:\"setGroupAttributes\",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:\"deleteGroupAttributes\",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:\"getGroupAttributes\",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:\"isMessageFromTopic\",value:function(e,t){return 2===e&&!oo(t)}},{key:\"isMessageFromCommunityOfTopic\",value:function(e,t){return 2===e&&oo(t)}},{key:\"getMessageExtensions\",value:function(e,t){return Ye.log(\"\".concat(this._className,\".getMessageExtensions startSequence:\").concat(t)),this.request({protocolName:Ua,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:\"modifyMessageExtensions\",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Ye.log(\"\".concat(this._className,\".modifyMessageExtensions operateType:\").concat(o)),this.request({protocolName:Pa,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:o}})}},{key:\"getGroupNotify\",value:function(e){var o=this;if(this.hasLocalGroup(e)){var n=this.getLocalGroupProfile(e),a=n.type,s=n.isSupportTopic;if(!Lt(a)&&!s){var r=\"\".concat(this._className,\".getGroupNotify\"),i=this._getGroupLastRevokedTime(e),c=1e3*xe();Ye.log(\"\".concat(r,\" groupID:\").concat(e,\" type:\").concat(a,\" beginTime:\").concat(i,\" endTime:\").concat(c)),this.request({protocolName:ba,requestData:{type:Ot({type:a,groupID:e})?D.GRP_COMMUNITY:void 0,groupID:e,beginTime:i,endTime:c}}).then((function(n){var a=n.data,s=a.nextRevokedTime,i=a.notifyList;Ye.log(\"\".concat(r,\" ok. nextRevokedTime:\").concat(s));var c={dataList:[{elements:{revokedInfos:[]}}]};lt(i)&&i.forEach((function(o){c.dataList[0].elements.revokedInfos.push({groupID:e,sequence:o.sequence,random:o.random,revokerInfo:t({},o.revokerInfo)})})),o.onGroupMessageRevoked(c),0!==s?(o._setGroupLastRevokedTime(e,s),o.getGroupNotify(e)):o._setGroupLastRevokedTime(e,1e3*xe())})).catch((function(e){Ye.error(\"\".concat(r,\" failed. error:\"),e)}))}}}},{key:\"_getGroupLastRevokedTime\",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:\"_setGroupLastRevokedTime\",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:\"isGroupCountersNotice\",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:\"setGroupCounters\",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:\"increaseGroupCounter\",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:\"decreaseGroupCounter\",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:\"getGroupCounters\",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:\"reset\",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),a}(vn),Zr=function(){function e(t){n(this,e),this.userID=\"\",this.avatar=\"\",this.nick=\"\",this.role=\"\",this.joinTime=\"\",this.lastSendMsgTime=\"\",this.nameCard=\"\",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return s(e,[{key:\"_initMember\",value:function(e){this.updateMember(e)}},{key:\"updateMember\",value:function(e){var t=[null,void 0,\"\",0,NaN];e.memberCustomField&&kt(this.memberCustomField,e.memberCustomField),Mt(this,e,[\"memberCustomField\",\"marks\"],t)}},{key:\"updateRole\",value:function(e){[\"Owner\",\"Admin\",\"Member\"].indexOf(e)<0||(this.role=e)}},{key:\"updateMuteUntil\",value:function(e){dt(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:\"updateNameCard\",value:function(e){dt(e)||(this.nameCard=e)}},{key:\"updateMemberCustomField\",value:function(e){e&&kt(this.memberCustomField,e)}}]),e}(),ei=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"GroupMemberModule\",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(hr,t._onProfileUpdated,_(t)),t}return s(a,[{key:\"_onProfileUpdated\",value:function(e){for(var t=this,o=e.data,n=function(e){var n=o[e];t.groupMemberListMap.forEach((function(e){e.has(n.userID)&&e.get(n.userID).updateMember({nick:n.nick,avatar:n.avatar})}))},a=0;a100?100:r};Ot({groupID:o})?_.next=\"\".concat(a):(_.offset=a,g=a+r);var h=[];return this.request({protocolName:qa,requestData:_}).then((function(e){var n=e.data,a=n.members,s=n.memberNum,r=n.next,i=void 0===r?void 0:r;if(dt(i)||(g=oo(i)?0:i),!lt(a)||0===a.length)return g=0,Promise.resolve([]);var c=t.getModule(Ko);return c.hasLocalGroup(o)&&(c.getLocalGroupProfile(o).memberNum=s),h=t._updateLocalGroupMemberMap(o,a),t.getModule(Vo).getUserProfile({userIDList:a.map((function(e){return e.userID})),tagList:[$e.NICK,$e.AVATAR]})})).then((function(e){var n=e.data;if(!lt(n)||0===n.length)return ur({memberList:[],offset:g});var s=n.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(o,s),h.length5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)),Ye.log(\"\".concat(n,\" groupID:\").concat(e.groupID,\" userIDList:\").concat(e.userIDList.join(\",\"))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var s=e.groupID,r=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return lt(t)&&0!==t.length?(o._updateLocalGroupMemberMap(s,t),o.getModule(Vo).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[$e.NICK,$e.AVATAR]})):ur([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));o._updateLocalGroupMemberMap(s,t);var n=r.filter((function(e){return o.hasLocalGroupMember(s,e)})).map((function(e){return o.getLocalGroupMemberInfo(s,e)}));return a.setNetworkType(o.getNetworkType()).end(),er({memberList:n})}))}},{key:\"addGroupMember\",value:function(e){var t=this,o=\"\".concat(this._className,\".addGroupMember\"),n=e.groupID,a=this.getModule(Ko).getLocalGroupProfile(n),s=a.type,r=new bs(ws.ADD_GROUP_MEMBER);if(r.setMessage(\"groupID:\".concat(n,\" groupType:\").concat(s)),Lt(s)){var i=new rr({code:hn.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setError(i,!0,this.getNetworkType()).end(),lr(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Ye.log(\"\".concat(o,\" groupID:\").concat(n)),this.request({protocolName:Ba,requestData:e}).then((function(n){var s=n.data.members;Ye.log(\"\".concat(o,\" ok\"));var i=s.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),c=s.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),u=s.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=s.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d=\"groupID:\".concat(e.groupID,\", \")+\"successUserIDList:\".concat(i,\", \")+\"failureUserIDList:\".concat(c,\", \")+\"existedUserIDList:\".concat(u,\", \")+\"overLimitUserIDList:\".concat(l);return r.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===i.length?er({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(a.memberCount+=i.length,t._updateConversationGroupProfile(a),er({successUserIDList:i,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:a}))})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"deleteGroupMember\",value:function(e){var t=this,o=\"\".concat(this._className,\".deleteGroupMember\"),n=e.groupID,a=e.userIDList,s=this.getModule(Ko).getLocalGroupProfile(n);if(dt(s))return lr({code:hn.CANNOT_FIND_GROUP});if(Lt(s.type))return this.canIUse(W.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var r=new bs(ws.DELETE_GROUP_MEMBER),i=\"groupID:\".concat(n,\" \").concat(a.length>5?\"userIDList.length:\".concat(a.length):\"userIDList:\".concat(a));return r.setMessage(i),Ye.log(\"\".concat(o,\" groupID:\").concat(n,\" userIDList:\"),a),this.request({protocolName:Ka,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),s.memberCount-=1,t._updateConversationGroupProfile(s),t.deleteLocalGroupMembers(n,a),er({group:s,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_updateConversationGroupProfile\",value:function(e){this.getModule(jo).updateConversationGroupProfile([e])}},{key:\"_banAVChatRoomMember\",value:function(e){var t=this,o=\"\".concat(this._className,\"._banAVChatRoomMember\"),n=e.groupID,a=e.userIDList,s=\"groupID:\".concat(n,\" \").concat(a.length>5?\"userIDList.length:\".concat(a.length):\"userIDList:\".concat(a)),r=new bs(ws.BAN_AVCHATROOM_MEMBER);r.setMessage(s),Ye.log(\"\".concat(o,\" groupID:\").concat(n,\" userIDList:\"),a);var i=this.getModule(Ko).getLocalGroupProfile(n);return dt(e.duration)||0===e.duration?lr({code:hn.BAN_DURATION_INVALID}):this.request({protocolName:Ha,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),t.deleteLocalGroupMembers(n,a),er({group:i,userIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"setGroupMemberMuteTime\",value:function(e){var t=this,o=e.groupID,n=e.userID,a=e.muteTime,s=\"\".concat(this._className,\".setGroupMemberMuteTime\");if(n===this.getMyUserID())return lr(new rr({code:hn.CANNOT_MUTE_SELF}));Ye.log(\"\".concat(s,\" groupID:\").concat(o,\" userID:\").concat(n));var r=new bs(ws.SET_GROUP_MEMBER_MUTE_TIME);return r.setMessage(\"groupID:\".concat(o,\" userID:\").concat(n,\" muteTime:\").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:n,muteTime:a}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(s,\" ok\"));var n=t.getModule(Ko);return er({group:n.getLocalGroupProfile(o),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(s,\" failed. error:\"),e),lr(e)}))}},{key:\"setGroupMemberRole\",value:function(e){var t=this,o=\"\".concat(this._className,\".setGroupMemberRole\"),n=e.groupID,a=e.userID,s=e.role,r=this.getModule(Ko).getLocalGroupProfile(n);if(r.selfInfo.role!==D.GRP_MBR_ROLE_OWNER)return lr({code:hn.NOT_OWNER});if([D.GRP_WORK,D.GRP_AVCHATROOM].includes(r.type))return lr({code:hn.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[D.GRP_MBR_ROLE_ADMIN,D.GRP_MBR_ROLE_MEMBER];if(Ot({groupID:n})&&i.push(D.GRP_MBR_ROLE_CUSTOM),i.indexOf(s)<0)return lr({code:hn.INVALID_MEMBER_ROLE});if(a===this.getMyUserID())return lr({code:hn.CANNOT_SET_SELF_MEMBER_ROLE});var c=new bs(ws.SET_GROUP_MEMBER_ROLE);return c.setMessage(\"groupID:\".concat(n,\" userID:\").concat(a,\" role:\").concat(s)),Ye.log(\"\".concat(o,\" groupID:\").concat(n,\" userID:\").concat(a)),this.modifyGroupMemberInfo({groupID:n,userID:a,role:s}).then((function(e){return c.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\")),er({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_filterProfanity\",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],Q),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:\"setGroupMemberNameCard\",value:function(e){var t=this,o=\"\".concat(this._className,\".setGroupMemberNameCard\");if(e.nameCard&&!1===this._filterProfanity(\"nameCard\",e))return lr({code:hn.PROFANITY_FOUND});var n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.nameCard;Ye.log(\"\".concat(o,\" groupID:\").concat(n,\" userID:\").concat(s));var i=new bs(ws.SET_GROUP_MEMBER_NAME_CARD);return i.setMessage(\"groupID:\".concat(n,\" userID:\").concat(s,\" nameCard:\").concat(r)),this.modifyGroupMemberInfo({groupID:n,userID:s,nameCard:r}).then((function(e){Ye.log(\"\".concat(o,\" ok\")),i.setNetworkType(t.getNetworkType()).end();var a=t.getModule(Ko).getLocalGroupProfile(n);return s===t.getMyUserID()&&a&&a.setSelfNameCard(r),er({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"setGroupMemberCustomField\",value:function(e){var t=this,o=\"\".concat(this._className,\".setGroupMemberCustomField\"),n=e.groupID,a=e.userID,s=void 0===a?this.getMyUserID():a,r=e.memberCustomField;Ye.log(\"\".concat(o,\" groupID:\").concat(n,\" userID:\").concat(s));var i=new bs(ws.SET_GROUP_MEMBER_CUSTOM_FIELD);return i.setMessage(\"groupID:\".concat(n,\" userID:\").concat(s,\" memberCustomField:\").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:n,userID:s,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" ok\"));var a=t.getModule(Ko).getLocalGroupProfile(n);return er({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];i.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"modifyGroupMemberInfo\",value:function(e){var o=this,n=e.groupID,a=e.userID,s=void 0;return Gt(n)&&(n=$t(s=n)),this.request({protocolName:Wa,requestData:t(t({},e),{},{groupID:n,topicID:s})}).then((function(){if(o.hasLocalGroupMember(n,a)){var t=o.getLocalGroupMemberInfo(n,a);return dt(e.muteTime)||t.updateMuteUntil(e.muteTime),dt(e.role)||t.updateRole(e.role),dt(e.nameCard)||t.updateNameCard(e.nameCard),dt(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return o.getGroupMemberProfile({groupID:n,userIDList:[a]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:\"markGroupMemberList\",value:function(e){var t=this,o=\"\".concat(this._className,\".markGroupMemberList\"),n=e.groupID,a=e.markType,s=e.enableMark,r=e.userIDList,i=void 0===r?[]:r,c=\"groupID:\".concat(n,\" markType:\").concat(a,\" enableMark:\").concat(s,\" userIDList count: \").concat(i.length);Ye.log(\"\".concat(o,\" \").concat(c));var u=2,l=[];!0===s&&(u=1);var d=v(i);i.length>500&&(d=i.slice(0,500),Ye.warn(\"\".concat(o,\" \").concat(eo(500)))),d.forEach((function(e){l.push({userID:e,markType:[a]})})),d=null;var p=new bs(ws.MARK_GROUP_MEMBER_LIST);return p.setMessage(\"\".concat(c)),this.request({protocolName:Ya,requestData:{groupID:n,operationType:u,memberList:l}}).then((function(e){var n=e.data.memberList,a=void 0===n?[]:n,s=[],r=[];a.length===i.length?s.push.apply(s,v(i)):(a.forEach((function(e){s.push(e.userID)})),i.forEach((function(e){s.includes(e)||r.push(e)})));var c=\"success count:\".concat(s.length,\" fail count:\").concat(r.length);return p.setNetworkType(t.getNetworkType()).setMessage(c).end(),Ye.log(\"\".concat(o,\" ok. \").concat(c)),er({successUserIDList:s,failureUserIDList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];p.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_getGroupMemberProfileAdvance\",value:function(e){return this.request({protocolName:Va,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:[\"Role\",\"JoinTime\",\"NameCard\",\"ShutUpUntil\"]})})}},{key:\"_updateLocalGroupMemberMap\",value:function(e,t){var o=this;return lt(t)&&0!==t.length?t.map((function(t){return o.hasLocalGroupMember(e,t.userID)?o.getLocalGroupMemberInfo(e,t.userID).updateMember(t):o.setLocalGroupMember(e,new Zr(t)),o.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:\"deleteLocalGroupMembers\",value:function(e,t){var o=this.groupMemberListMap.get(e);o&&t.forEach((function(e){o.delete(e)}))}},{key:\"getLocalGroupMemberInfo\",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:\"setLocalGroupMember\",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var o=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,o)}}},{key:\"getLocalGroupMemberList\",value:function(e){return this.groupMemberListMap.get(e)}},{key:\"hasLocalGroupMember\",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:\"hasLocalGroupMemberMap\",value:function(e){return this.groupMemberListMap.has(e)}},{key:\"reset\",value:function(){this.groupMemberListMap.clear()}}]),a}(vn),ti=[\"topicID\",\"topicName\",\"avatar\",\"introduction\",\"notification\",\"unreadCount\",\"muteAllMembers\",\"customData\",\"groupAtInfoList\",\"nextMessageSeq\",\"selfInfo\"],oi=function(e,t){return oo(e)?{lastTime:0,lastSequence:0,fromAccount:\"\",payload:null,type:\"\",messageForShow:\"\",nick:\"\",version:0,cloudCustomData:\"\",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||\"\",payload:e.payload||null,type:e.type||\"\",messageForShow:zt(e.type,e.payload,t),nick:e.nick||\"\",version:e.version||0,cloudCustomData:e.cloudCustomData||\"\",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},ni=function(){function e(t,o){n(this,e),this.topicID=\"\",this.topicName=\"\",this.avatar=\"\",this.introduction=\"\",this.notification=\"\",this.unreadCount=0,this.muteAllMembers=!1,this.customData=\"\",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=oi(t.lastMessage,o),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:\"\",excludedUnreadSequenceList:void 0},this._initTopic(t)}return s(e,[{key:\"_initTopic\",value:function(e){for(var t in e)ti.indexOf(t)<0||(\"selfInfo\"===t?this.updateSelfInfo(e[t]):this[t]=\"muteAllMembers\"===t?1===e[t]:e[t])}},{key:\"updateUnreadCount\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:\"updateNextMessageSeq\",value:function(e){this.nextMessageSeq=e}},{key:\"updateLastMessage\",value:function(e){this.lastMessage=oi(e)}},{key:\"updateGroupAtInfoList\",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:\"updateTopic\",value:function(e){dt(e.selfInfo)||this.updateSelfInfo(e.selfInfo),dt(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),Mt(this,e,[\"groupID\",\"lastMessageTime\",\"selfInfo\",\"muteAllMembers\",\"lastMsg\"])}},{key:\"updateSelfInfo\",value:function(e){return 0!==Mt(this.selfInfo,e,[],[\"\"])}},{key:\"reduceUnreadCount\",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:\"isLastMessageRevoked\",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:\"setLastMessageRevoked\",value:function(e){this.lastMessage.isRevoked=e}},{key:\"setLastMessageRevoker\",value:function(e){this.lastMessage.revoker=e}}]),e}(),ai=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"TopicModule\",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"topic_cache_time\"),t=this.getCloudConfig(\"topic_last_active_time\");dt(e)||(this.TOPIC_CACHE_TIME=Number(e)),dt(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:\"onTopicCreated\",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(S.TOPIC_CREATED,e)}},{key:\"onTopicDeleted\",value:function(e){var t=this,o=e.groupID,n=e.topicIDList;(void 0===n?[]:n).forEach((function(e){t._deleteLocalTopic(o,e)})),this.emitOuterEvent(S.TOPIC_DELETED,e)}},{key:\"onTopicMessageRemindTypeUpdated\",value:function(e){var t=e.groupID,o=e.topicID,n=e.messageRemindType,a=this.getLocalTopic(t,o);if(a){var s=a.updateSelfInfo({messageRemindType:n});s&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:a}),Ye.debug(\"\".concat(this._className,\".onTopicMessageRemindTypeUpdated topicID:\").concat(o)+\" messageRemindType:\".concat(n,\" isTopicUpdated:\").concat(s))}}},{key:\"onTopicProfileUpdated\",value:function(e){var t=e.groupID,o=e.topicID,n=this.getLocalTopic(t,o);n&&(n.updateTopic(e),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:\"onConversationProxy\",value:function(e){var t=e.topicID,o=e.unreadCount,n=e.groupAtInfoList,a=$t(t),s=this.getLocalTopic(a,t),r=!1;s&&(dt(o)||s.unreadCount===o||(s.updateUnreadCount(o),r=!0),dt(n)||(s.updateGroupAtInfoList(n),r=!0)),r&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:a,topic:s})}},{key:\"onMessageSent\",value:function(e){var t=e.groupID,o=e.topicID,n=e.lastMessage,a=this.getLocalTopic(t,o);a&&(a.nextMessageSeq+=1,a.updateLastMessage(n),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:t,topic:a}))}},{key:\"onMessageModified\",value:function(e){var t=e.to,o=e.time,n=e.sequence,a=e.elements,s=e.cloudCustomData,r=e.messageVersion,i=$t(t),c=this.getLocalTopic(i,t);if(c){var u=c.lastMessage;Ye.debug(\"\".concat(this._className,\".onMessageModified topicID:\").concat(t,\" lastMessage:\"),JSON.stringify(u),\"options:\",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===o&&u.lastSequence===n&&u.version!==r)&&(u.type=a[0].type,u.payload=a[0].content,u.messageForShow=zt(u.type,u.payload,this.isIntl()),u.cloudCustomData=s,u.version=r,u.lastSequence=n,u.lastTime=o,this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:i,topic:c}))}}},{key:\"onMessageRevoked\",value:function(e){var t=this;if(0!==e.length){var o=null,n=null,a=!1;e.forEach((function(e){var s=e.to;n=$t(s),(o=t.getLocalTopic(n,s))&&(o.reduceUnreadCount()&&(a=!0),o.isLastMessageRevoked(e)&&(o.setLastMessageRevoked(!0),o.setLastMessageRevoker(e.revoker),a=!0))})),a&&this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:\"isLastMessageRevoked\",value:function(e){var t=e.topicID,o=e.sequence,n=$t(t),a=this.getLocalTopic(n,t),s=!1;return a&&(s=a.isLastMessageRevoked({sequence:o})),s}},{key:\"getJoinedCommunityList\",value:function(){return this.getModule(Ko).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return er({groupList:void 0===t?[]:t})})).catch((function(e){return lr(e)}))}},{key:\"createTopicInCommunity\",value:function(e){var o=this,n=\"\".concat(this._className,\".createTopicInCommunity\"),a=e.topicID;if(!dt(a)&&!Gt(a))return lr({code:hn.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity(\"topicName\",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return lr({code:hn.PROFANITY_FOUND});var s=new bs(ws.CREATE_TOPIC);return this.request({protocolName:us,requestData:t({},e)}).then((function(a){var r=a.data.topicID;return s.setMessage(\"topicID:\".concat(r)).setNetworkType(o.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\")),o._updateTopicMap([t(t({},e),{},{topicID:r})]),er({topicID:r})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"deleteTopicFromCommunity\",value:function(e){var t=this,o=\"\".concat(this._className,\".deleteTopicFromCommunity\"),n=e.groupID,a=e.topicIDList,s=void 0===a?[]:a,r=new bs(ws.DELETE_TOPIC);return r.setMessage(\"groupID:\".concat(n,\" topicIDList:\").concat(s)),this.request({protocolName:ls,requestData:{groupID:n,topicIDList:s}}).then((function(e){var o=e.data.resultList,a=[],s=[];(void 0===o?[]:o).forEach((function(e){var t=e.topicID,o=e.errorCode,n=e.errorInfo;0===o?a.push({topicID:t}):s.push({topicID:t,code:o,message:n})}));var i=\"success count:\".concat(a.length,\", fail count:\").concat(s.length);return r.setMoreMessage(\"\".concat(i)).setNetworkType(t.getNetworkType()).end(),Ye.log(\"\".concat(i)),a.forEach((function(e){t._deleteLocalTopic(n,e.topicID)})),er({successTopicList:a,failureTopicList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"updateTopicProfile\",value:function(e){var o=this,n=\"\".concat(this._className,\".updateTopicProfile\");if(Ye.log(\"\".concat(n,\" options:\"),e),e.topicName&&!1===this._filterProfanity(\"topicName\",e))return lr({code:hn.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return lr({code:hn.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return lr({code:hn.PROFANITY_FOUND});var a=new bs(ws.UPDATE_TOPIC_PROFILE);return a.setMessage(\"groupID:\".concat(e.groupID,\" topicID:\").concat(e.topicID)),dt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?\"On\":\"Off\"),this.request({protocolName:ds,requestData:t({},e)}).then((function(){return a.setNetworkType(o.getNetworkType()).end(),Ye.log(\"\".concat(n,\" ok\")),o._updateTopicMap([e]),er({topic:o.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"getTopicList\",value:function(e){var o=this,n=\"\".concat(this._className,\".getTopicList\"),a=e.groupID,s=e.topicIDList,r=void 0===s?[]:s,i=0===r.length,c=new bs(ws.GET_TOPIC_LIST);if(c.setMessage(\"groupID:\".concat(a)),this._getTopicTimeMap.has(a)){var u=this._getTopicTimeMap.get(a),l=u.isGetAll,d=u.time;if((l||!l&&!i)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(a,r);if(i||p.length===r.length)return c.setNetworkType(this.getNetworkType()).setMoreMessage(\"from cache, topic count:\".concat(p.length)).end(),Ye.log(\"\".concat(n,\" groupID:\").concat(a,\" from cache, topic count:\").concat(p.length)),ur({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:ps,requestData:{groupID:a,topicIDList:r}}).then((function(e){var s=e.data.topicInfoList,r=[],u=[],l=[];(void 0===s?[]:s).forEach((function(e){var o=e.topic,n=e.selfInfo,a=e.errorCode,s=e.errorInfo,i=o.topicID;0===a?(r.push(t(t({},o),{},{selfInfo:n})),u.push(i)):l.push({topicID:i,code:a,message:s})})),o._updateTopicMap(r),o._handleTopicAtInfo(r);var d=\"success count:\".concat(u.length,\", fail count:\").concat(l.length);c.setNetworkType(o.getNetworkType()).setMoreMessage(\"\".concat(d)).end(),Ye.log(\"\".concat(n,\" groupID:\").concat(a,\" from remote, \").concat(d));var p=[];return oo(u)||(o._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:i}),p=o._getLocalTopicList(a,u)),er({successTopicList:p,failureTopicList:l})})).catch((function(e){return o.probeNetwork(e).then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"hasLocalTopic\",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:\"getLocalTopic\",value:function(e,t){var o=null;return this._topicMap.has(e)&&(o=this._topicMap.get(e).get(t)),o}},{key:\"_getLocalTopicList\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._topicMap.get(e),n=[];return o&&(n=v(o.values())),0===t.length?n:n.filter((function(e){return t.includes(e.topicID)}))}},{key:\"_deleteLocalTopic\",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),Ye.log(\"\".concat(this._className,\"._deleteLocalTopic groupID:\").concat(e,\" topicID:\").concat(t)))}},{key:\"_updateTopicMap\",value:function(e){var t=this,o=[];(e.forEach((function(e){var n=e.groupID,a=e.topicID,s=null;t._topicMap.has(n)||t._topicMap.set(n,new Map),t._topicMap.get(n).has(a)?(s=t._topicMap.get(n).get(a)).updateTopic(e):(t._getTopicLastMessage(e),s=new ni(e,t.isIntl()),t._topicMap.get(n).set(a,s));var r=t._computeUnreadCount(s);s.updateUnreadCount(r),o.push({conversationID:\"\".concat(D.CONV_GROUP).concat(a),type:D.CONV_TOPIC,unreadCount:r})})),o.length>0)&&this.getModule(jo).updateTopicConversation(o)}},{key:\"resetGetTopicTime\",value:function(e){var t=this;dt(e)?v(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:\"getTopicListOnReconnected\",value:function(){var e=this,t=v(this._topicMap.keys()),o=[];t.forEach((function(t){var n=[];e._getLocalTopicList(t).forEach((function(t){var o=t.lastMessage.lastTime,a=void 0===o?0:o;Date.now()-1e3*a<1e3*e.TOPIC_LAST_ACTIVE_TIME&&n.push(t.topicID)})),n.length>0&&o.push({groupID:t,topicIDList:n})})),Ye.log(\"\".concat(this._className,\".getTopicListOnReconnected. active community count:\").concat(o.length)),this._relayGetTopicList(o)}},{key:\"_relayGetTopicList\",value:function(e){var t=this;if(0!==e.length){var o=e.shift(),n=o.topicIDList.length>5?\"topicIDList.length:\".concat(o.topicIDList.length):\"topicIDList:\".concat(o.topicIDList),a=new bs(ws.RELAY_GET_TOPIC_LIST);a.setMessage(n),Ye.log(\"\".concat(this._className,\"._relayGetTopicList. \").concat(n)),this.getTopicList(o).then((function(){a.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),n=t[0],s=t[1];a.setError(o,n,s).end()})),t._relayGetTopicList(e)}))}}},{key:\"_handleTopicAtInfo\",value:function(e){var o=this;0!==e.length&&e.forEach((function(e){var n=e.groupID,a=e.topicID,s=e.groupAtInfoList,r=[];dt(s)||(s.forEach((function(e){r.push(t(t({},e),{},{groupID:n,topicID:a}))})),o.getModule(jo).onNewGroupAtTips({dataList:r}))}))}},{key:\"_getTopicLastMessage\",value:function(e){if(!dt(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:\"\",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:oo(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:\"deleteTopicListInCommunity\",value:function(e){var t=this,o=this._getLocalTopicList(e),n=this.getModule(jo);o.forEach((function(o){var a=o.topicID;t._deleteLocalTopic(e,a),t._getTopicTimeMap.delete(e),n.deleteLocalConversation(\"\".concat(D.CONV_GROUP).concat(a))}))}},{key:\"_computeUnreadCount\",value:function(e){var t=e.selfInfo,o=t.excludedUnreadSequenceList,n=t.readedSequence,a=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(lt(o)){var s=0;o.forEach((function(t){t>=n&&t<=e.nextMessageSeq-1&&(s+=1)})),s>=1&&(a-=s)}return a<0?0:a}},{key:\"_filterProfanity\",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],X),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:\"updateLastMessage\",value:function(e,t){var o=$t(e),n=this.getLocalTopic(o,e);if(n){var a=t.sequence+1;n.updateNextMessageSeq(a),n.updateLastMessage(t),this.emitOuterEvent(S.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),a}(vn),si=function(){function e(t){n(this,e),this._userModule=t,this._className=\"ProfileHandler\",this.TAG=\"profile\",this.accountProfileMap=new Map,this.expirationTime=864e5}return s(e,[{key:\"setExpirationTime\",value:function(e){this.expirationTime=e}},{key:\"getUserProfile\",value:function(e){var t=this,o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(Ye.warn(\"\".concat(this._className,\".getUserProfile \").concat(eo(100))),o.length=100);for(var n,a=[],s=[],r=0,i=o.length;r5?\"userIDList.length:\".concat(o.length):\"userIDList:\".concat(o)),this._userModule.request({protocolName:Nn,requestData:e}).then((function(e){l.setNetworkType(t._userModule.getNetworkType()).end(),Ye.info(\"\".concat(t._className,\".getUserProfile ok\"));var o=t._handleResponse(e).concat(s);return er(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error(\"\".concat(t._className,\".getUserProfile failed. error:\"),e),lr(e)}))}},{key:\"getMyProfile\",value:function(){var e=this._userModule.getMyAccount();if(Ye.log(\"\".concat(this._className,\".getMyProfile myAccount:\").concat(e)),this._fillMap(),this._containsAccount(e)){var t=this._getProfileFromMap(e);return Ye.debug(\"\".concat(this._className,\".getMyProfile from cache, myProfile:\")+JSON.stringify(t)),ur(t)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:\"_handleResponse\",value:function(e){for(var t,o,n=vt(),a=e.data.userProfileItem,s=[],r=0,i=a.length;r-1)o.profileCustomField.push({key:t[n].tag,value:t[n].value});else switch(t[n].tag){case $e.NICK:o.nick=t[n].value;break;case $e.GENDER:o.gender=t[n].value;break;case $e.BIRTHDAY:o.birthday=t[n].value;break;case $e.LOCATION:o.location=t[n].value;break;case $e.SELFSIGNATURE:o.selfSignature=t[n].value;break;case $e.ALLOWTYPE:o.allowType=t[n].value;break;case $e.LANGUAGE:o.language=t[n].value;break;case $e.AVATAR:o.avatar=t[n].value;break;case $e.MESSAGESETTINGS:o.messageSettings=t[n].value;break;case $e.ADMINFORBIDTYPE:o.adminForbidType=t[n].value;break;case $e.LEVEL:o.level=t[n].value;break;case $e.ROLE:o.role=t[n].value;break;default:Ye.warn(\"\".concat(this._className,\"._handleResponse unknown tag:\"),t[n].tag,t[n].value)}return o}},{key:\"updateMyProfile\",value:function(e){var t=this,o=\"\".concat(this._className,\".updateMyProfile\");if(e.nick&&!1===this._userModule.filterProfanity(\"nick\",e))return lr({code:hn.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity(\"selfSignature\",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.UPDATE_MY_PROFILE);n.setMessage(JSON.stringify(e));var a=(new Tr).validate(e);if(!a.valid)return n.setCode(hn.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage(\"updateMyProfile info:\".concat(a.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Ye.error(\"\".concat(o,\" info:\").concat(a.tips)),lr({code:hn.UPDATE_PROFILE_INVALID_PARAM});var s=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(\"profileCustomField\"===r?e.profileCustomField.forEach((function(e){s.push({tag:e.key,value:e.value})})):s.push({tag:$e[r.toUpperCase()],value:e[r]}));if(0===s.length){var i=new rr({code:hn.UPDATE_PROFILE_NO_KEY});return n.setError(i,!0,this._userModule.getNetworkType()).end(),Ye.error(\"\".concat(o,\" failed. error:\"),i),lr(i)}return this._userModule.request({protocolName:An,requestData:{fromAccount:this._userModule.getMyAccount(),profileItem:s}}).then((function(a){n.setNetworkType(t._userModule.getNetworkType()).end(),Ye.info(\"\".concat(o,\" ok\"));var s=t._updateMap(t._userModule.getMyAccount(),e);return t._userModule.emitOuterEvent(S.PROFILE_UPDATED,[s]),ur(s)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"onProfileModified\",value:function(e){var t=e.dataList;if(!oo(t)){var o,n,a=t.length;Ye.debug(\"\".concat(this._className,\".onProfileModified count:\").concat(a,\" dataList:\"),e.dataList);for(var s=[],r=0;r0&&(this._userModule.emitInnerEvent(hr,s),this._userModule.emitOuterEvent(S.PROFILE_UPDATED,s))}}},{key:\"_fillMap\",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),o=0,n=e.length;o0&&a.push(o)):a.push(t.userID));0!==a.length&&(Ye.info(\"\".concat(this._className,\".onConversationsProfileUpdated toAccountList:\").concat(a)),this.getUserProfile({userIDList:a}))}},{key:\"getNickAndAvatarByUserID\",value:function(e){if(this._containsAccount(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:\"\",avatar:\"\"}}},{key:\"reset\",value:function(){this._flushMap(!0),this.accountProfileMap.clear()}}]),e}(),ri=s((function e(t){n(this,e),oo||(this.userID=t.userID||\"\",this.timeStamp=t.timeStamp||0)})),ii=function(){function e(t){n(this,e),this._userModule=t,this._className=\"BlacklistHandler\",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return s(e,[{key:\"getLocalBlacklist\",value:function(){return v(this._blacklistMap.keys())}},{key:\"getBlacklist\",value:function(){var e=this,t=\"\".concat(this._className,\".getBlacklist\"),o={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},n=new bs(ws.GET_BLACKLIST);return this._userModule.request({protocolName:kn,requestData:o}).then((function(o){var a=o.data,s=a.blackListItem,r=a.currentSequence,i=oo(s)?0:s.length;n.setNetworkType(e._userModule.getNetworkType()).setMessage(\"count:\".concat(i)).end(),Ye.info(\"\".concat(t,\" ok\")),e.currentSequence=r,e._handleResponse(s,!0),e._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(e._blacklistMap.keys()))})).catch((function(o){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()})),Ye.error(\"\".concat(t,\" failed. error:\"),o),lr(o)}))}},{key:\"addBlacklist\",value:function(e){var t=this,o=new bs(ws.ADD_TO_BLACKLIST),n=\"\".concat(this._className,\".addBlacklist\"),a=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===a){var s=hn.CANNOT_ADD_SELF_TO_BLACKLIST,r=this._userModule.getErrorMessage(s);o.setCode(s).setMessage(r).setNetworkType(this._userModule.getNetworkType()).end();var i=new rr({code:s});return Ye.error(\"\".concat(n,\" failed. error:\"),i),lr(i)}return e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Rn,requestData:e}).then((function(a){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)).end(),Ye.info(\"\".concat(n,\" ok\")),t._handleResponse(a.resultItem,!0),er(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),a=n[0],s=n[1];o.setError(e,a,s).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"_handleResponse\",value:function(e,t){if(!oo(e))for(var o,n,a,s=0,r=e.length;s5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)).end(),Ye.info(\"\".concat(o,\" ok\")),t._handleResponse(a.data.resultItem,!1),er(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"onAccountDeleted\",value:function(e){for(var t,o=[],n=0,a=e.length;n0&&(Ye.log(\"\".concat(this._className,\".onAccountDeleted count:\").concat(o.length,\" userIDList:\"),o),this._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:\"onAccountAdded\",value:function(e){for(var t,o=[],n=0,a=e.length;n0&&(Ye.log(\"\".concat(this._className,\".onAccountAdded count:\").concat(o.length,\" userIDList:\"),o),this._userModule.emitOuterEvent(S.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:\"reset\",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),ci=function(e){var t=String(e).replace(/[=]+$/,\"\"),o=\"\";if(t.length%4==1)return Ye.warn(\"decodeBase64 failed: \".concat(e,\" to be decoded is not correctly encoded.\")),\"\";for(var n,a,s=0,r=0;a=t.charAt(r++);~a&&(n=s%4?64*n+a:a,s++%4)?o+=String.fromCharCode(255&n>>(-2*s&6)):0)a=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(a);try{return decodeURIComponent(escape(o))}catch(i){return Ye.warn(\"decodeBase64 failed: \".concat(e,\" to be decoded is not correctly encoded.\")),\"\"}},ui=function(){function e(t){n(this,e),this._userModule=t,this._className=\"UserStatusHandler\",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(_r,this._onCloudConfigUpdated,this)}return s(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._userModule.getCloudConfig(\"status_query_count\"),t=this._userModule.getCloudConfig(\"status_sub_count\"),o=this._userModule.getCloudConfig(\"status_unsub_count\");Ye.log(\"\".concat(this._className,\"._onCloudConfigUpdated statusQueryCount:\").concat(e,\" statusSubscribeCount:\").concat(t)+\" statusUnsubscribeCount:\".concat(o)),dt(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),dt(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),dt(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(o,10))}},{key:\"onUserStatusUpdated\",value:function(e){var t=e.dataList,o=this._userModule.getMyUserID(),n=this._userModule.getModule($o),a=t.map((function(e){var t=e.to,a=e.statusType,s=e.customStatus,r=ci(s);return t===o&&n.setCustomStatus(r),{userID:t,statusType:a,customStatus:r}}));this._userModule.emitOuterEvent(S.USER_STATUS_UPDATED,a)}},{key:\"setSelfStatus\",value:function(e){var t=this,o=\"\".concat(this._className,\".setSelfStatus\");if(!1===this._userModule.filterProfanity(\"customStatus\",e))return lr({code:hn.PROFANITY_FOUND});var n=new bs(ws.SET_SELF_STATUS),a=e.customStatus;return this._userModule.request({protocolName:gs,requestData:{customStatus:a}}).then((function(e){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(\"customStatus:\".concat(a)).end(),Ye.log(\"\".concat(o,\" ok. customStatus:\").concat(a)),t._userModule.getModule($o).setCustomStatus(a),er({userID:t._userModule.getMyUserID(),statusType:1,customStatus:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),a=o[0],s=o[1];n.setError(e,a,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"getUserStatus\",value:function(e){var t=this,o=\"\".concat(this._className,\".getUserStatus\"),n=e.userIDList,a=void 0===n?[]:n,s=this._userModule.getMyUserID(),r=v(a),i=void 0,c=r.indexOf(s);if(c>-1){r.splice(c,1);var u=this._userModule.getModule($o).getCustomStatus();i={userID:s,statusType:1,customStatus:u}}if(0===r.length)return ur({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(Ye.warn(\"\".concat(o,\" \").concat(eo(this.MAX_QUERY_USER_COUNT))),r=a.slice(0,this.MAX_QUERY_USER_COUNT));var l=new bs(ws.GET_USER_STATUS);return this._userModule.request({protocolName:_s,requestData:{userIDList:r}}).then((function(e){var n=e.data,s=n.successUserList,r=void 0===s?[]:s,c=n.failureUserList,u=void 0===c?[]:c,d=r.map((function(e){var t=e.userID,o=e.statusType,n=e.customStatus;return{userID:t,statusType:o,customStatus:ci(n)}})),p=u.map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));dt(i)||d.unshift(i);var g=\"userID count:\".concat(a.length,\", success count:\").concat(d.length,\", fail count:\").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(g)).end(),Ye.log(\"\".concat(o,\" ok. \").concat(g,\".\")),er({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];l.setMessage(\"userID count:\".concat(a.length)).setError(e,n,s).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"subscribeUserStatus\",value:function(e){var t=this;if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._className,\".subscribeUserStatus\"),n=e.userIDList,a=void 0===n?[]:n,s=v(a);s.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ye.warn(\"\".concat(o,\" \").concat(eo(this.MAX_SUBSCRIBE_USER_COUNT))),s=a.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new bs(ws.SUBSCRIBE_USER_STATUS),i=\"userID count:\".concat(a.length);return Ye.log(\"\".concat(o,\" \").concat(i)),this._userModule.request({protocolName:hs,requestData:{userIDList:s}}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(i,\" fail count:\").concat(a.length)).end(),Ye.log(\"\".concat(o,\" ok. fail count:\").concat(a.length,\".\")),er({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage(\"\".concat(i)).setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"unsubscribeUserStatus\",value:function(e){var t=this;if(!this._userModule.canIUse(W.USER_STATUS))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._className,\".unsubscribeUserStatus\"),n=(e||{}).userIDList,a=void 0===n?[]:n,s=v(a);a.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ye.warn(\"\".concat(o,\" \").concat(eo(this.MAX_UNSUBSCRIBE_USER_COUNT))),s=a.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new bs(ws.UNSUBSCRIBE_USER_STATUS),i=\"userID count:\".concat(a.length);Ye.log(\"\".concat(o,\" \").concat(i));var c={userIDList:s};return 0===s.length&&(c.userIDList=void 0,c.unsubscribeAll=1),this._userModule.request({protocolName:fs,requestData:c}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,o=e.invalidUserID,n=e.errorCode,a=e.errorInfo;return{userID:oo(o)?t:o,code:n,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(i,\" fail count:\").concat(a.length)).end(),Ye.log(\"\".concat(o,\" ok. fail count:\").concat(a.length,\".\")),er({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];r.setMessage(\"\".concat(i)).setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"reset\",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),li=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"UserModule\",a._profileHandler=new si(_(a)),a._blacklistHandler=new ii(_(a)),a._userStatusHandler=new ui(_(a)),a.getInnerEmitterInstance().on(gr,a.onContextUpdated,_(a)),a}return s(o,[{key:\"onContextUpdated\",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:\"onProfileModified\",value:function(e){this._profileHandler.onProfileModified(e)}},{key:\"onRelationChainModified\",value:function(e){var t=e.dataList;if(!oo(t)){var o=[];t.forEach((function(e){e.blackListDelAccount&&o.push.apply(o,v(e.blackListDelAccount))})),o.length>0&&this._blacklistHandler.onAccountDeleted(o);var n=[];t.forEach((function(e){e.blackListAddAccount&&n.push.apply(n,v(e.blackListAddAccount))})),n.length>0&&this._blacklistHandler.onAccountAdded(n)}}},{key:\"onConversationsProfileUpdated\",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:\"getMyAccount\",value:function(){return this.getMyUserID()}},{key:\"getMyProfile\",value:function(){return this._profileHandler.getMyProfile()}},{key:\"getStorageModule\",value:function(){return this.getModule(zo)}},{key:\"filterProfanity\",value:function(e,t){var o=this.getModule(pn);if(!o)return!0;var n=o.filterText(t[e],J),a=n.isAllowedToSend,s=n.modifiedText;return!0===a&&(t[e]=s,!0)}},{key:\"isMyFriend\",value:function(e){var t=this.getModule(Ho);return!!t&&t.isMyFriend(e)}},{key:\"getUserProfile\",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:\"updateMyProfile\",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:\"getNickAndAvatarByUserID\",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:\"getLocalBlacklist\",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return ur(e)}},{key:\"addBlacklist\",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:\"deleteBlacklist\",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:\"onUserStatusUpdated\",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:\"setSelfStatus\",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:\"getUserStatus\",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:\"subscribeUserStatus\",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:\"unsubscribeUserStatus\",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),o}(vn),di=function(){function e(t,o){n(this,e),this._moduleManager=t,this._isLoggedIn=!1,this._SDKAppID=o.SDKAppID,this._userID=o.userID||\"\",this._userSig=o.userSig||\"\",this._version=\"2.26.1\",this._a2Key=\"\",this._tinyID=\"\",this._customStatus=\"\",this._contentType=\"json\",this._unlimitedAVChatRoom=o.unlimitedAVChatRoom,this._scene=o.scene||\"\",this._oversea=o.oversea,this._instanceID=o.instanceID,this._statusInstanceID=0,this._isDevMode=o.devMode,this._proxyServer=o.proxyServer}return s(e,[{key:\"isLoggedIn\",value:function(){return this._isLoggedIn}},{key:\"isOversea\",value:function(){return this._oversea}},{key:\"isPrivateNetWork\",value:function(){return this._proxyServer}},{key:\"isDevMode\",value:function(){return this._isDevMode}},{key:\"isSingaporeSite\",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:\"isKoreaSite\",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:\"isGermanySite\",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:\"isIndiaSite\",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:\"isJapanSite\",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:\"isUSASite\",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:\"isIntl\",value:function(){return Qt(this._SDKAppID)}},{key:\"isUnlimitedAVChatRoom\",value:function(){return this._unlimitedAVChatRoom}},{key:\"setUserID\",value:function(e){this._userID=e}},{key:\"getUserID\",value:function(){return this._userID}},{key:\"setUserSig\",value:function(e){this._userSig=e}},{key:\"getUserSig\",value:function(){return this._userSig}},{key:\"getSDKAppID\",value:function(){return this._SDKAppID}},{key:\"setTinyID\",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:\"getTinyID\",value:function(){return this._tinyID}},{key:\"setCustomStatus\",value:function(e){this._customStatus=e}},{key:\"getCustomStatus\",value:function(){return this._customStatus}},{key:\"getScene\",value:function(){return Ge?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?\"tuikit\":this._scene}},{key:\"getInstanceID\",value:function(){return this._instanceID}},{key:\"getStatusInstanceID\",value:function(){return this._statusInstanceID}},{key:\"setStatusInstanceID\",value:function(e){this._statusInstanceID=e}},{key:\"getVersion\",value:function(){return this._version}},{key:\"getA2Key\",value:function(){return this._a2Key}},{key:\"setA2Key\",value:function(e){this._a2Key=e}},{key:\"getContentType\",value:function(){return this._contentType}},{key:\"getProxyServer\",value:function(){return this._proxyServer}},{key:\"_isTUIKit\",value:function(){var e=!1,t=!1,o=!1,n=!1,a=[];le&&(a=Object.keys(pe)),de&&(a=ue?Object.keys(uni):Object.keys(window));for(var s=0,r=a.length;s0){for(var u=0,l=c.length;u0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return lr({code:hn.USER_NOT_LOGGED_IN});var o=new bs(ws.LOGOUT);return o.setNetworkType(this.getNetworkType()).setMessage(\"identifier:\".concat(this.getMyUserID())).end(!0),Ye.info(\"\".concat(this._className,\".logout type:\").concat(t)),0===t&&this._moduleManager.setNotReadyReason(hn.LOGGED_OUT),this.request({protocolName:yn,requestData:{type:t}}).then((function(){return e.resetReady(),ur({})})).catch((function(t){return Ye.error(\"\".concat(e._className,\"._logout error:\"),t),e.resetReady(),ur({})}))}},{key:\"_fetchCloudControlConfig\",value:function(){this.getModule(sn).fetchConfig()}},{key:\"_getStatusInstanceID\",value:function(){return uni.getStorageSync(\"timUniAppInstanceID\")}},{key:\"_hello\",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:In,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){Ye.warn(\"\".concat(e._className,\"._hello error:\"),t)}))}},{key:\"getLastWsHelloTs\",value:function(){return this._lastWsHelloTs}},{key:\"_checkLoginInfo\",value:function(e){var t=0;return oo(this.getModule($o).getSDKAppID())?t=hn.NO_SDKAPPID:oo(e.userID)?t=hn.NO_IDENTIFIER:oo(e.userSig)&&(t=hn.NO_USERSIG),{code:t}}},{key:\"_isReactUIKit\",value:function(){return de&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:\"onMultipleAccountKickedOut\",value:function(e){var t=this;new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(D.KICKED_OUT_MULT_ACCOUNT,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),Ye.warn(\"\".concat(this._className,\".onMultipleAccountKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),this.logout(1).then((function(){t.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_MULT_ACCOUNT}),t._moduleManager.setNotReadyReason(hn.KICKED_OUT_MULT_ACCOUNT),t._moduleManager.reset()}))}},{key:\"onMultipleDeviceKickedOut\",value:function(e){var t=this;new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(D.KICKED_OUT_MULT_DEVICE,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),Ye.warn(\"\".concat(this._className,\".onMultipleDeviceKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),this.logout(1).then((function(){t.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_MULT_DEVICE}),t._moduleManager.setNotReadyReason(hn.KICKED_OUT_MULT_DEVICE),t._moduleManager.reset()}))}},{key:\"onUserSigExpired\",value:function(){new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(D.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ye.warn(\"\".concat(this._className,\".onUserSigExpired: userSig 签名过期被踢下线\")),0!==this.getModule($o).getStatusInstanceID()&&(this.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_USERSIG_EXPIRED}),this._moduleManager.setNotReadyReason(hn.KICKED_OUT_USERSIG_EXPIRED),this._moduleManager.reset())}},{key:\"onRestApiKickedOut\",value:function(e){(new bs(ws.KICKED_OUT).setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(D.KICKED_OUT_REST_API,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),Ye.warn(\"\".concat(this._className,\".onRestApiKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),0!==this.getModule($o).getStatusInstanceID())&&(this.emitOuterEvent(S.KICKED_OUT,{type:D.KICKED_OUT_REST_API}),this._moduleManager.setNotReadyReason(hn.KICKED_OUT_REST_API),this._moduleManager.reset(),this.getModule(nn).onRestApiKickedOut())}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),o}(vn);function gi(){return null}var _i=function(){function e(t){n(this,e),this._moduleManager=t,this._className=\"StorageModule\",this._storageQueue=new Map,this._errorTolerantHandle()}return s(e,[{key:\"_errorTolerantHandle\",value:function(){le||!dt(window)&&this._canIUseCookies()||(this.getItem=gi,this.setItem=gi,this.removeItem=gi,this.clear=gi)}},{key:\"onCheckTimer\",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:\"_doFlush\",value:function(){try{var e,t=E(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2),n=o[0],a=o[1];this._setStorageSync(this._getKey(n),a)}}catch(s){t.e(s)}finally{t.f()}this._storageQueue.clear()}catch(r){Ye.warn(\"\".concat(this._className,\"._doFlush error:\"),r)}}},{key:\"_getPrefix\",value:function(){var e=this._moduleManager.getModule($o);return\"TIM_\".concat(e.getSDKAppID(),\"_\").concat(e.getUserID(),\"_\")}},{key:\"_getKey\",value:function(e){return\"\".concat(this._getPrefix()).concat(e)}},{key:\"getItem\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var o=t?this._getKey(e):e;return this.getStorageSync(o)}catch(n){return Ye.warn(\"\".concat(this._className,\".getItem error:\"),n),{}}}},{key:\"setItem\",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(o){var a=n?this._getKey(e):e;this._setStorageSync(a,t)}else this._storageQueue.set(e,t)}},{key:\"clear\",value:function(){try{le?pe.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ye.warn(\"\".concat(this._className,\".clear error:\"),e)}}},{key:\"removeItem\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var o=t?this._getKey(e):e;this._removeStorageSync(o)}catch(n){Ye.warn(\"\".concat(this._className,\".removeItem error:\"),n)}}},{key:\"getSize\",value:function(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"b\";try{var n={size:0,limitSize:5242880,unit:o};if(Object.defineProperty(n,\"leftSize\",{enumerable:!0,get:function(){return n.limitSize-n.size}}),le&&(n.limitSize=1024*pe.getStorageInfoSync().limitSize),e)n.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(le){var a=pe.getStorageInfoSync(),s=a.keys;s.forEach((function(e){n.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var r in localStorage)localStorage.hasOwnProperty(r)&&(n.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(n)}catch(i){Ye.warn(\"\".concat(this._className,\" error:\"),i)}}},{key:\"_convertUnit\",value:function(e){var t={},o=e.unit;for(var n in t.unit=o,e)\"number\"==typeof e[n]&&(\"kb\"===o.toLowerCase()?t[n]=Math.round(e[n]/1024):\"mb\"===o.toLowerCase()?t[n]=Math.round(e[n]/1024/1024):t[n]=e[n]);return t}},{key:\"_setStorageSync\",value:function(e,t){le?ie?my.setStorageSync({key:e,data:t}):pe.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:\"getStorageSync\",value:function(e){return le?ie?my.getStorageSync({key:e}).data:pe.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:\"_removeStorageSync\",value:function(e){le?ie?my.removeStorageSync({key:e}):pe.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:\"_canIUseCookies\",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._doFlush()}}]),e}(),hi=function(){function e(t){n(this,e),this._className=\"SSOLogBody\",this._report=[]}return s(e,[{key:\"pushIn\",value:function(e){Ye.debug(\"\".concat(this._className,\".pushIn\"),this._report.length,e),this._report.push(e)}},{key:\"backfill\",value:function(e){var t;lt(e)&&0!==e.length&&(Ye.debug(\"\".concat(this._className,\".backfill\"),this._report.length,e.length),(t=this._report).unshift.apply(t,v(e)))}},{key:\"getLogsNumInMemory\",value:function(){return this._report.length}},{key:\"isEmpty\",value:function(){return 0===this._report.length}},{key:\"_reset\",value:function(){this._report.length=0,this._report=[]}},{key:\"getLogsInMemory\",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),fi=function(e){var t=e.getModule($o);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:xe()}},mi=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className=\"EventStatModule\",t.TAG=\"im-ssolog-event\",t._reportBody=new hi,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var s=t.getInnerEmitterInstance();return s.on(gr,t._onLoginSuccess,_(t)),s.on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:\"reportAtOnce\",value:function(){Ye.debug(\"\".concat(this._className,\".reportAtOnce\")),this._report()}},{key:\"_onLoginSuccess\",value:function(){var e=this,t=this.getModule(zo),o=t.getItem(this.TAG,!1);!oo(o)&>(o.forEach)&&(Ye.log(\"\".concat(this._className,\"._onLoginSuccess get ssolog in storage, count:\").concat(o.length)),o.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"evt_rpt_threshold\"),t=this.getCloudConfig(\"evt_rpt_waiting\"),o=this.getCloudConfig(\"evt_rpt_level\"),n=this.getCloudConfig(\"evt_rpt_sdkappid_bl\"),a=this.getCloudConfig(\"evt_rpt_tinyid_wl\");dt(e)||(this.MIN_THRESHOLD=Number(e)),dt(t)||(this.WAITING_TIME=Number(t)),dt(o)||(this.REPORT_LEVEL=o.split(\",\").map((function(e){return Number(e)}))),dt(n)||(this.REPORT_SDKAPPID_BLACKLIST=n.split(\",\").map((function(e){return Number(e)}))),dt(a)||(this.REPORT_TINYID_WHITELIST=a.split(\",\"))}},{key:\"pushIn\",value:function(e){e instanceof bs&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:\"onCheckTimer\",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:\"_flushAtOnce\",value:function(){var e=this.getModule(zo),t=e.getItem(this.TAG,!1),o=this._reportBody.getLogsInMemory();if(oo(t))Ye.log(\"\".concat(this._className,\"._flushAtOnce count:\").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),Ye.log(\"\".concat(this._className,\"._flushAtOnce count:\").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),a}(vn),vi=\"none\",Mi=\"online\",yi=[hn.OVER_FREQUENCY_LIMIT,hn.OPEN_SERVICE_OVERLOAD_ERROR],Ii=function(){function e(t){n(this,e),this._moduleManager=t,this._networkType=\"\",this._className=\"NetMonitorModule\",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return s(e,[{key:\"start\",value:function(){var e=this;le?(pe.getNetworkType({success:function(t){e._networkType=t.networkType,t.networkType===vi?Ye.warn(\"\".concat(e._className,\".start no network, please check!\")):Ye.info(\"\".concat(e._className,\".start networkType:\").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),pe.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Mi,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener(\"online\",this._webOnlineCallback),window.addEventListener(\"offline\",this._webOfflineCallback)))}},{key:\"_onWebOnline\",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:Mi})}},{key:\"_onWebOffline\",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:vi})}},{key:\"_onNetworkStatusChange\",value:function(e){var t=e.isConnected,o=e.networkType,n=!1;t?(Ye.info(\"\".concat(this._className,\"._onNetworkStatusChange previousNetworkType:\").concat(this._networkType,\" currentNetworkType:\").concat(o)),this._networkType!==o&&(n=!0,this._moduleManager.getModule(nn).reConnect(!0))):this._networkType!==o&&(n=!0,Ye.warn(\"\".concat(this._className,\"._onNetworkStatusChange no network, please check!\")),this._moduleManager.getModule(nn).offline());n&&(new bs(ws.NETWORK_CHANGE).setMessage(\"isConnected:\".concat(t,\" previousNetworkType:\").concat(this._networkType,\" networkType:\").concat(o)).end(),this._networkType=o)}},{key:\"probe\",value:function(e){var t=this;return!dt(e)&&yi.includes(e.code)?Promise.resolve([!0,this._networkType]):new Promise((function(e,o){le?pe.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===vi?(Ye.warn(\"\".concat(t._className,\".probe no network, please check!\")),e([!1,o.networkType])):(Ye.info(\"\".concat(t._className,\".probe networkType:\").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===vi?e([!1,vi]):e([!0,Mi])}))}},{key:\"getNetworkType\",value:function(){return this._networkType}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),le?null!==this._mpNetworkStatusCallback&&(pe.offNetworkStatusChange&&(ce||se?pe.offNetworkStatusChange(this._mpNetworkStatusCallback):pe.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener(\"online\",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener(\"offline\",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}(),Ci=k((function(e){var t=Object.prototype.hasOwnProperty,o=\"~\";function n(){}function a(e,t,o){this.fn=e,this.context=t,this.once=o||!1}function s(e,t,n,s,r){if(\"function\"!=typeof n)throw new TypeError(\"The listener must be a function\");var i=new a(n,s||e,r),c=o?o+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],i]:e._events[c].push(i):(e._events[c]=i,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function i(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(o=!1)),i.prototype.eventNames=function(){var e,n,a=[];if(0===this._eventsCount)return a;for(n in e=this._events)t.call(e,n)&&a.push(o?n.slice(1):n);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},i.prototype.listeners=function(e){var t=o?o+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var a=0,s=n.length,r=new Array(s);a=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:\"_getAuthorization\",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:\"upload\",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule(un);switch(e.type){case D.MSG_IMAGE:return t.addTotalCount(As),this._uploadImage(e);case D.MSG_FILE:return t.addTotalCount(As),this._uploadFile(e);case D.MSG_AUDIO:return t.addTotalCount(As),this._uploadAudio(e);case D.MSG_VIDEO:return t.addTotalCount(As),this._uploadVideo(e);default:return Promise.resolve()}}},{key:\"_uploadImage\",value:function(e){var o=this,n=this.getModule(qo),a=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadImage({file:s.payload.file,to:s.to,onProgress:function(e){if(a.updatePercent(e),gt(s.onProgress))try{s.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=n.fileType,i=n.fileSize,c=n.width,u=n.height,l=o.isPrivateNetWork()?s:Nt(s);a.updateImageFormat(r);var d=Bt({originUrl:l,originWidth:c,originHeight:u,min:198}),p=Bt({originUrl:l,originWidth:c,originHeight:u,min:720});return a.updateImageInfoArray([{size:i,url:l,width:c,height:u},t({},p),t({},d)]),e}))}},{key:\"_uploadFile\",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadFile({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:Nt(a);return n.updateFileUrl(s),e}))}},{key:\"_uploadAudio\",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadAudio({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=t.isPrivateNetWork()?a:Nt(a);return n.updateAudioUrl(s),e}))}},{key:\"_uploadVideo\",value:function(e){var t=this,o=this.getModule(qo),n=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadVideo({file:a.payload.file,to:a.to,onProgress:function(e){if(n.updatePercent(e),gt(a.onProgress))try{a.onProgress(e)}catch(t){return lr({code:hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a=o.location,s=o.snapshotInfo,r=t.isPrivateNetWork()?a:Nt(a);return n.updateVideoUrl(r),oo(s)||n.updateSnapshotInfo(s),e}))}},{key:\"doUploadImage\",value:function(e){var t=this;if(!e.file)return lr({code:hn.MESSAGE_IMAGE_SELECT_FILE_FIRST});var o=this._checkImageType(e.file);if(!0!==o)return o;var n=this._checkImageSize(e.file);if(!0!==n)return n;var a=null;return this._setUploadFileType(Mr),this.uploadByCOS(e).then((function(e){return a=e,t.isPrivateNetWork()?Ft(e.location):Ft(\"https://\".concat(e.location))})).then((function(e){return a.width=e.width,a.height=e.height,Promise.resolve(a)}))}},{key:\"_checkImageType\",value:function(e){var t=\"\";return t=le?e.url.slice(e.url.lastIndexOf(\".\")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(\".\")+1),mr.indexOf(t.toLowerCase())>=0||lr({code:hn.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:\"_checkImageSize\",value:function(e){var t=0;return 0===(t=le?e.size:e.files[0].size)?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):t<20971520||lr({code:hn.MESSAGE_IMAGE_SIZE_LIMIT})}},{key:\"doUploadFile\",value:function(e){return e.file?e.file.files[0].size>104857600?lr({code:hn.MESSAGE_FILE_SIZE_LIMIT}):0===e.file.files[0].size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(Cr),this.uploadByCOS(e)):lr({code:hn.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:\"doUploadVideo\",value:function(e){return e.file.videoFile.size>104857600?lr({code:hn.MESSAGE_VIDEO_SIZE_LIMIT}):0===e.file.videoFile.size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):-1===vr.indexOf(e.file.videoFile.type)?lr({code:hn.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(yr),le?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):de?this.handleVideoUpload(e):void 0)}},{key:\"handleVideoUpload\",value:function(e){var t=this;return new Promise((function(o,n){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){t.uploadByCOS(e).then((function(e){o(e)})).catch((function(){n(new rr({code:hn.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:\"doUploadAudio\",value:function(e){return e.file?e.file.size>20971520?lr({code:hn.MESSAGE_AUDIO_SIZE_LIMIT}):0===e.file.size?lr({code:hn.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(Ir),this.uploadByCOS(e)):lr({code:hn.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:\"uploadByCOS\",value:function(e){var t=this,o=\"\".concat(this._className,\".uploadByCOS\");if(!gt(this._cosUploadMethod))return Ye.warn(\"\".concat(o,\" \").concat(this._getPluginUndetectedLog())),lr({code:hn.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new bs(ws.UPLOAD),a=Date.now(),s=this._getFile(e);return new Promise((function(r,i){var c=le?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),u=t;t._cosUploadMethod(c,(function(e,c){var l=Object.create(null);if(c){if(e||lt(c.files)&&c.files[0].error){var d=new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" failed. error:\"),c.files[0].error),403===c.files[0].error.statusCode&&(Ye.warn(\"\".concat(o,\" failed. cos AccessKeyId was invalid, regain auth key!\")),t._getAuthorizationKey()),void i(d)}l.fileName=s.name,l.fileSize=s.size,l.fileType=s.type.slice(s.type.indexOf(\"/\")+1).toLowerCase(),l.location=le?c.Location:c.files[0].data.Location;var p=Date.now()-a,g=u._formatFileSize(s.size),_=u._formatSpeed(1e3*s.size/p),h=\"size:\".concat(g,\" time:\").concat(p,\"ms speed:\").concat(_);Ye.log(\"\".concat(o,\" success. name:\").concat(s.name,\" \").concat(h)),r(l);var f=t.getModule(un);return f.addCost(As,p),f.addFileSize(As,s.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL});n.setError(m,!0,u.getNetworkType()).end(),Ye.warn(\"\".concat(o,\" failed. error:\"),e),403===e.statusCode&&(Ye.warn(\"\".concat(o,\" failed. cos AccessKeyId was invalid, regain auth key!\")),t._getAuthorizationKey()),i(m)}))}))}},{key:\"_uploadWithPreSigUrl\",value:function(e){var t=this,o=\"\".concat(this._className,\"._uploadWithPreSigUrl\"),n=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(a,s){var r=new bs(ws.UPLOAD),i=e.requestSnapshotUrl,c=void 0===i?void 0:i,u=g(e,Ei),l=Date.now();t._cosUploadMethod(u,(function(e,i){var u=Object.create(null);if(e||403===i.statusCode)return r.setError(new rr(e),!0,t.getNetworkType()).end(),Ye.log(\"\".concat(o,\" failed, error:\"),e),void s(new rr({code:hn.MESSAGE_FILE_UPLOAD_FAIL}));var d=i.data.location||\"\";t.isPrivateNetWork()||0!==d.indexOf(\"https://\")&&0!==d.indexOf(\"http://\")||(d=d.split(\"//\")[1]),u.fileName=n.name,u.fileSize=n.size,u.fileType=n.type.slice(n.type.indexOf(\"/\")+1).toLowerCase(),u.location=d;var p=Date.now()-l,g=t._formatFileSize(n.size),_=t._formatSpeed(1e3*n.size/p),h=\"size:\".concat(g,\",time:\").concat(p,\"ms,speed:\").concat(_,\" res:\").concat(JSON.stringify(i.data));Ye.log(\"\".concat(o,\" success name:\").concat(n.name,\",\").concat(h)),r.setNetworkType(t.getNetworkType()).setMessage(h).end();var f=t.getModule(un);if(f.addCost(As,p),f.addFileSize(As,n.size),!oo(c))return t._getSnapshotInfoByUrl(c).then((function(e){u.snapshotInfo=e,a(u)}));a(u)}))}))}))}},{key:\"_getFile\",value:function(e){var t;return lt(e.file.files)||(t=e.file.files,\"filelist\"===ht(t))?e.file.files[0]:e.file}},{key:\"_formatFileSize\",value:function(e){return e<1024?e+\"B\":e<1048576?Math.floor(e/1024)+\"KB\":Math.floor(e/1048576)+\"MB\"}},{key:\"_formatSpeed\",value:function(e){return e<=1048576?Wt(e/1024,1)+\"KB/s\":Wt(e/1048576,1)+\"MB/s\"}},{key:\"_createCosOptionsWeb\",value:function(e){var t=this._getFile(e),o=t.name,n=o.slice(o.lastIndexOf(\".\")),a=this._genFileName(\"\".concat(Ct(999999)).concat(n));return{files:[{Bucket:\"\".concat(this.bucketName,\"-\").concat(this.appid),Region:this.region,Key:\"\".concat(this.directory,\"/\").concat(a),Body:t}],SliceSize:1048576,onProgress:function(t){if(\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn(\"onProgress callback error:\",o)}},onFileFinish:function(e,t,o){}}}},{key:\"_createCosOptionsWXMiniApp\",value:function(e){var t=this._getFile(e),o=this._genFileName(t.name),n=t.url;return{Bucket:\"\".concat(this.bucketName,\"-\").concat(this.appid),Region:this.region,Key:\"\".concat(this.directory,\"/\").concat(o),FilePath:n,onProgress:function(t){if(Ye.log(JSON.stringify(t)),\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn(\"onProgress callback error:\",o)}}}}},{key:\"_createCosOptionsPreSigUrl\",value:function(e){var t=this,o=\"\",n=\"\",a=0,s=this._getFile(e);if(le)o=this._genFileName(s.name),n=s.url,a=1;else{var r=s.name,i=r.slice(r.lastIndexOf(\".\"));o=this._genFileName(\"\".concat(Ct(999999)).concat(i)),n=s,a=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:o,uploadMethod:a,duration:this.duration}).then((function(a){var s=a.uploadUrl,r=a.downloadUrl,i=a.requestSnapshotUrl,c=void 0===i?void 0:i;return{url:s,fileType:t.uploadFileType,fileName:o,resources:n,downloadUrl:r,requestSnapshotUrl:c,onProgress:function(t){if(\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(o){Ye.warn(\"onProgress callback error:\",o),Ye.error(o)}}}}))}},{key:\"_genFileName\",value:function(e){return\"\".concat(qt(),\"-\").concat(e)}},{key:\"_setUploadFileType\",value:function(e){this.uploadFileType=e}},{key:\"_getSnapshotInfoByUrl\",value:function(e){var t=this,o=new bs(ws.GET_SNAPSHOT_INFO);return this.request({protocolName:za,requestData:{platform:this.getPlatform(),coverName:this._genFileName(Ct(99999)),requestSnapshotUrl:e}}).then((function(e){var t=(e.data||{}).snapshotUrl;return o.setMessage(\"snapshotUrl:\".concat(t)).end(),oo(t)?{}:Ft(t).then((function(e){return{snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Ye.warn(\"\".concat(t._className,\"._getSnapshotInfoByUrl failed. error:\"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:\"_getPluginUndetectedLog\",value:function(){return this.isIntl()?\"No upload plugin is detected. SDK can not send image/audio/video/file messages. See https://web.sdk.qcloud.com/im/doc/en/SDK.html#registerPlugin\":\"未检测到上传插件,SDK 将无法发送图片、音频、视频、文件等类型的消息。请参考 https://web.sdk.qcloud.com/im/doc/zh-cn/SDK.html#registerPlugin\"}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\"))}}]),a}(vn),Di=[\"downloadKey\",\"pbDownloadKey\",\"messageList\"],Ni=function(){function e(t){n(this,e),this._className=\"MergerMessageHandler\",this._messageModule=t}return s(e,[{key:\"uploadMergerMessage\",value:function(e,t){var o=this;Ye.debug(\"\".concat(this._className,\".uploadMergerMessage message:\"),e,\"messageBytes:\".concat(t));var n=e.payload.messageList,a=n.length,s=new bs(ws.UPLOAD_MERGER_MESSAGE);return this._messageModule.request({protocolName:os,requestData:{messageList:n}}).then((function(e){Ye.debug(\"\".concat(o._className,\".uploadMergerMessage ok. response:\"),e.data);var n=e.data,r=n.pbDownloadKey,i=n.downloadKey,c={pbDownloadKey:r,downloadKey:i,messageNumber:a};return s.setNetworkType(o._messageModule.getNetworkType()).setMessage(\"\".concat(a,\"-\").concat(t,\"-\").concat(i)).end(),c})).catch((function(e){throw Ye.warn(\"\".concat(o._className,\".uploadMergerMessage failed. error:\"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];s.setError(e,n,a).end()})),e}))}},{key:\"downloadMergerMessage\",value:function(e){var o=this;Ye.debug(\"\".concat(this._className,\".downloadMergerMessage message:\"),e);var n=e.payload.downloadKey,a=new bs(ws.DOWNLOAD_MERGER_MESSAGE);return a.setMessage(\"downloadKey:\".concat(n)),this._messageModule.request({protocolName:ns,requestData:{downloadKey:n}}).then((function(n){if(Ye.debug(\"\".concat(o._className,\".downloadMergerMessage ok. response:\"),n.data),gt(e.clearElement)){var s=e.payload,r=(s.downloadKey,s.pbDownloadKey,s.messageList,g(s,Di));e.clearElement(),e.setElement({type:e.type,content:t({messageList:n.data.messageList},r)})}else{var i=[];n.data.messageList.forEach((function(e){if(!oo(e)){var t=new Js(e);i.push(t)}})),e.payload.messageList=i,e.payload.downloadKey=\"\",e.payload.pbDownloadKey=\"\"}return a.setNetworkType(o._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Ye.warn(\"\".concat(o._className,\".downloadMergerMessage failed. key:\").concat(n,\" error:\"),e),o._messageModule.probeNetwork().then((function(t){var o=m(t,2),n=o[0],s=o[1];a.setError(e,n,s).end()})),e}))}},{key:\"createMergerMessagePack\",value:function(e,t,o){return e.conversationType===D.CONV_C2C?this._createC2CMergerMessagePack(e,t,o):this._createGroupMergerMessagePack(e,t,o)}},{key:\"_createC2CMergerMessagePack\",value:function(e,t,o){var n=null;t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0}));var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push(\"NoUnread\"),!0===i&&a.push(\"NoLastMsg\")}var c=\"\";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var u=o.pbDownloadKey,l=o.downloadKey,d=o.messageNumber,p=e.payload,g=p.title,_=p.abstractList,h=p.compatibleText,f=this._messageModule.getModule(Bo),m=f&&f.isOnlineMessage(e,t)?0:void 0;return{protocolName:Sn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:u,downloadKey:l,title:g,abstractList:_,compatibleText:h,messageNumber:d}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||\"\",desc:n.description||\"\",ext:n.extension||\"\",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0!==m?a:void 0}}}},{key:\"_createGroupMergerMessagePack\",value:function(e,t,o){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var a=[];if(ut(t)&&ut(t.messageControlInfo)){var s=t.messageControlInfo,r=s.excludedFromUnreadCount,i=s.excludedFromLastMessage;!0===r&&a.push(\"NoUnread\"),!0===i&&a.push(\"NoLastMsg\")}var c=\"\";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var u=o.pbDownloadKey,l=o.downloadKey,d=o.messageNumber,p=e.payload,g=p.title,_=p.abstractList,h=p.compatibleText,f=this._messageModule.getModule(Ko),m=f&&f.isOnlineMessage(e,t)?1:0;return{protocolName:Dn,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:u,downloadKey:l,title:g,abstractList:_,compatibleText:h,messageNumber:d}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:m,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||\"\",desc:n.description||\"\",ext:n.extension||\"\",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||\"\"}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||f.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?a:void 0}}}}]),e}(),Ai={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},ki=[hn.MESSAGE_ONPROGRESS_FUNCTION_ERROR,hn.MESSAGE_IMAGE_SELECT_FILE_FIRST,hn.MESSAGE_IMAGE_TYPES_LIMIT,hn.MESSAGE_FILE_IS_EMPTY,hn.MESSAGE_IMAGE_SIZE_LIMIT,hn.MESSAGE_FILE_SELECT_FILE_FIRST,hn.MESSAGE_FILE_SIZE_LIMIT,hn.MESSAGE_VIDEO_SIZE_LIMIT,hn.MESSAGE_VIDEO_TYPES_LIMIT,hn.MESSAGE_AUDIO_UPLOAD_FAIL,hn.MESSAGE_AUDIO_SIZE_LIMIT,hn.COS_UNDETECTED];function Ri(e){var t=!1;return Object.values(Ai).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var Li=function(e){i(a,e);var o=f(a);function a(e){var t;return n(this,a),(t=o.call(this,e))._className=\"MessageModule\",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Ni(_(t)),t}return s(a,[{key:\"createTextMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=\"string\"==typeof e.payload?e.payload:e.payload.text,a=new Fs({text:n}),s=this._getNickAndAvatarByUserID(t);return o.setElement(a),o.setNickAndAvatar(s),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:\"_fileUnsupportedWarning\",value:function(e){this.isIntl()||Ye.warn(\"小程序环境下调用 \".concat(e,\" 接口时,payload.file 不支持传入 File 对象\"))}},{key:\"createImageMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e);if(le){var n=e.payload.file;if(st(n))return void this._fileUnsupportedWarning(\"createImageMessage\");var a=n.tempFiles[0].path||n.tempFiles[0].tempFilePath,s={url:a,name:a.slice(a.lastIndexOf(\"/\")+1),size:n.tempFiles&&n.tempFiles[0].size||1,type:a.slice(a.lastIndexOf(\".\")+1).toLowerCase()};e.payload.file=s}else if(de)if(st(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(ut(e.payload.file)&&\"undefined\"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var c=new qs({imageFormat:je.UNKNOWN,uuid:this._generateUUID(),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return o.setElement(c),o.setNickAndAvatar(u),o.setNameCard(this._getNameCardByGroupID(o)),this._messageOptionsMap.set(o.clientSequence,e),o}},{key:\"createAudioMessage\",value:function(e){var t=e.payload.file;if(le){var o={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(\"/\")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(\".\")+1).toLowerCase()};e.payload.file=o}var n=this.getMyUserID();e.currentUser=n,e.senderTinyID=this.getMyTinyID();var a=new Zs(e),s=new Vs({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID()}),r=this._getNickAndAvatarByUserID(n);return a.setElement(s),a.setNickAndAvatar(r),a.setNameCard(this._getNameCardByGroupID(a)),this._messageOptionsMap.set(a.clientSequence,e),a}},{key:\"createVideoMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl=\"https://web.sdk.qcloud.com/im/assets/images/transparent.png\",e.payload.file.thumbSize=1668;var o={};if(le){if(ie)return void Ye.warn(\"createVideoMessage 不支持在支付宝小程序环境下使用\");if(st(e.payload.file))return void this._fileUnsupportedWarning(\"createVideoMessage\");var n=e.payload.file;lt(n.tempFiles)&&(n=n.tempFiles[0]),o.url=n.tempFilePath,o.name=n.tempFilePath.slice(n.tempFilePath.lastIndexOf(\"/\")+1),o.size=n.size,o.second=n.duration,o.type=n.tempFilePath.slice(n.tempFilePath.lastIndexOf(\".\")+1).toLowerCase()}else if(de){if(st(e.payload.file)){var a=e.payload.file;e.payload.file.files=[a]}else if(ut(e.payload.file)&&\"undefined\"!=typeof uni){var s=e.payload.file.tempFile;e.payload.file.files=[s]}var r=e.payload.file;o.url=window.URL.createObjectURL(r.files[0]),o.name=r.files[0].name,o.size=r.files[0].size,o.second=r.files[0].duration||0,o.type=r.files[0].type.split(\"/\")[1]}e.payload.file.videoFile=o;var i=new Zs(e),c=new $s({videoFormat:o.type,videoSecond:Wt(o.second,0),videoSize:o.size,remoteVideoUrl:\"\",videoUrl:o.url,videoUUID:this._generateUUID(),thumbUUID:this._generateUUID(),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(\".\")+1).toLowerCase()}),u=this._getNickAndAvatarByUserID(t);return i.setElement(c),i.setNickAndAvatar(u),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:\"createCustomMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new js({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:\"createFaceMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new xs(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:\"createMergerMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=this._getNickAndAvatarByUserID(t),n=new Zs(e),a=new Xs(e.payload);return n.setElement(a),n.setNickAndAvatar(o),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:\"createForwardMessage\",value:function(e){var t=e.to,o=e.conversationType,n=e.priority,a=e.payload,s=e.needReadReceipt,r=e.receiverList,i=this.getMyUserID(),c=this._getNickAndAvatarByUserID(i);if(a.type===D.MSG_GRP_TIP)return lr({code:hn.MESSAGE_FORWARD_TYPE_INVALID});var u={to:t,conversationType:o,conversationID:\"\".concat(o).concat(t),priority:n,isPlaceMessage:0,status:ro.UNSEND,currentUser:i,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||\"\",needReadReceipt:s,receiverList:r,isSupportExtension:e.isSupportExtension||!1},l=new Zs(u);return l.setElement(a.getElements()[0]),l.setNickAndAvatar(c),l.setNameCard(this._getNameCardByGroupID(a)),l.setRelayFlag(!0),l}},{key:\"downloadMergerMessage\",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:\"createFileMessage\",value:function(e){if(le){var o,n=\"createFileMessage 接口不可用!\";if(!ne&&!ae&&!ce)return void Ye.warn(\"小程序目前不支持选择文件,\".concat(n));var a=pe.getSystemInfoSync().SDKVersion;if(ne&&Vt(a,o=\"2.5.0\")<0)return void Ye.warn(\"wx.chooseMessageFile 需要基础库\".concat(o,\"或更高版本,\").concat(n));if(ae&&Vt(a,o=\"1.18.0\")<0)return void Ye.warn(\"qq.chooseMessageFile 需要基础库\".concat(o,\"或更高版本,\").concat(n))}if(de||ce){if(st(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(ut(e.payload.file)&&\"undefined\"!=typeof uni){var r=e.payload.file,i=r.tempFiles,c=r.files,u=null;lt(i)?u=i[0]:lt(c)&&(u=c[0]),e.payload.file={files:[u]}}}else if(ne||ae){var l=e.payload.file.tempFiles,d=t(t({},l[0]),{},{url:l[0].path});e.payload.file={files:[d]}}var p=this.getMyUserID();e.currentUser=p,e.senderTinyID=this.getMyTinyID();var g=new Zs(e),_=new Ys({uuid:this._generateUUID(),file:e.payload.file}),h=this._getNickAndAvatarByUserID(p);return g.setElement(_),g.setNickAndAvatar(h),g.setNameCard(this._getNameCardByGroupID(g)),this._messageOptionsMap.set(g.clientSequence,e),g}},{key:\"createLocationMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var o=new Zs(e),n=new zs(e.payload),a=this._getNickAndAvatarByUserID(t);return o.setElement(n),o.setNickAndAvatar(a),o.setNameCard(this._getNameCardByGroupID(o)),o}},{key:\"_onCannotFindModule\",value:function(){return lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"sendMessageInstance\",value:function(e,t){var o=this;if(!1===this.getModule(pn).filterMessage(e))return this._onSendMessageFailed(e,new rr({code:hn.PROFANITY_FOUND}));var n,a=null;switch(e.conversationType){case D.CONV_C2C:if(!(a=this.getModule(Bo)))return this._onCannotFindModule();break;case D.CONV_GROUP:if(!(a=this.getModule(Ko)))return this._onCannotFindModule();if(Ot({groupID:e.to})){var s=a.getLocalGroupProfile(e.to);if(s&&s.isSupportTopic)return lr({code:hn.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return lr({code:hn.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(Zo),i=this.getModule(Ko);return r.upload(e).then((function(){o._getSendMessageSpecifiedKey(e)===Ns&&o.getModule(un).addSuccessCount(As);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return lr({code:hn.MESSAGE_FILE_URL_IS_EMPTY});o._addSendMessageTotalCount(e),n=Date.now();var s=function(e){var t=\"utf-8\";de&&document&&(t=document.charset.toLowerCase());var o,n,a=0;if(n=e.length,\"utf-8\"===t||\"utf8\"===t)for(var s=0;s11264?o._mergerMessageHandler.uploadMergerMessage(e,s).then((function(n){var a=o._mergerMessageHandler.createMergerMessagePack(e,t,n);return o.request(a)})):(o.getModule(jo).setMessageRandom(e),e.conversationType===D.CONV_C2C||e.conversationType===D.CONV_GROUP?a.sendMessage(e,t):void 0)})).then((function(s){var r=s.data,i=r.time,c=r.sequence,u=r.readReceiptCode;rt(u)&&0!==u&&(new bs(ws.SEND_MESSAGE_WITH_RECEIPT).setMessage(\"from:\".concat(e.from,\" to:\").concat(e.to,\" sequence:\").concat(c,\" readReceiptCode:\").concat(u)).end(),Ye.warn(\"\".concat(o._className,\".sendMessageInstance readReceiptCode:\").concat(u,\" message:\").concat(sr[u])));o._addSendMessageSuccessCount(e,n),o._messageOptionsMap.delete(e.clientSequence);var l=o.getModule(jo);e.status=ro.SUCCESS,e.time=i;var d=!1;if(e.conversationType===D.CONV_GROUP)e.sequence=c;else if(e.conversationType===D.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,_=p.avatar;g===e.nick&&_===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),a.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;ut(t)&&ut(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=\"\"),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Gt(e.to))f=D.CONV_TOPIC,o.getModule(Yo).onMessageSent({groupID:$t(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||\"TIMImageElem\"!==e.type||Kt(e.payload.imageInfoArray),er({message:e})}))})).catch((function(t){return o._onSendMessageFailed(e,t)}))}},{key:\"_onSendMessageFailed\",value:function(e,t){e.status=ro.FAIL,this.getModule(jo).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var o=new bs(ws.SEND_MESSAGE);return o.setMessage(\"tjg_id:\".concat(this.generateTjgID(e),\" type:\").concat(e.type,\" from:\").concat(e.from,\" to:\").concat(e.to)),this.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),Ye.error(\"\".concat(this._className,\"._onSendMessageFailed error:\"),t),lr(new rr({code:t&&t.code?t.code:hn.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:\"_getSendMessageSpecifiedKey\",value:function(e){if([D.MSG_IMAGE,D.MSG_AUDIO,D.MSG_VIDEO,D.MSG_FILE].includes(e.type))return Ns;if(e.conversationType===D.CONV_C2C)return Es;if(e.conversationType===D.CONV_GROUP){var t=this.getModule(Ko).getLocalGroupProfile(e.to);if(!t)return;var o=t.type;return Lt(o)?Ds:Ss}}},{key:\"_addSendMessageTotalCount\",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(un).addTotalCount(t)}},{key:\"_addSendMessageSuccessCount\",value:function(e,t){var o=Math.abs(Date.now()-t),n=this._getSendMessageSpecifiedKey(e);if(n){var a=this.getModule(un);a.addSuccessCount(n),a.addCost(n,o)}}},{key:\"_addSendMessageFailCountOnUser\",value:function(e,t){var o,n,a=t.code,s=void 0===a?-1:a,r=this.getModule(un),i=this._getSendMessageSpecifiedKey(e);i===Ns&&(o=s,n=!1,ki.includes(o)&&(n=!0),n)?r.addFailedCountOfUserSide(As):Ri(s)&&i&&r.addFailedCountOfUserSide(i)}},{key:\"resendMessage\",value:function(e){return e.isResend=!0,e.status=ro.UNSEND,this.sendMessageInstance(e)}},{key:\"revokeMessage\",value:function(e){var t=this,o=null;if(e.conversationType===D.CONV_C2C){if(!(o=this.getModule(Bo)))return this._onCannotFindModule()}else if(e.conversationType===D.CONV_GROUP&&!(o=this.getModule(Ko)))return this._onCannotFindModule();var n=new bs(ws.REVOKE_MESSAGE);return n.setMessage(\"tjg_id:\".concat(this.generateTjgID(e),\" type:\").concat(e.type,\" from:\").concat(e.from,\" to:\").concat(e.to)),o.revokeMessage(e).then((function(o){var a=o.data.recallRetList;if(!oo(a)&&0!==a[0].retCode){var s=new rr({code:a[0].retCode,data:{message:e}});return n.setCode(s.code).setMoreMessage(s.message).end(),lr(s)}return Ye.info(\"\".concat(t._className,\".revokeMessage ok. ID:\").concat(e.ID)),e.isRevoked=!0,n.end(),t.getModule(jo).onMessageRevoked([e]),er({message:e})})).catch((function(o){t.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];n.setError(o,a,s).end()}));var a=new rr({code:o&&o.code?o.code:hn.MESSAGE_REVOKE_FAIL,message:o&&o.message?o.message:void 0,data:{message:e}});return Ye.warn(\"\".concat(t._className,\".revokeMessage failed. error:\"),o),lr(a)}))}},{key:\"deleteMessage\",value:function(e){var t=this,o=null,n=e[0],a=n.conversationID,s=\"\",r=[],i=[];if(n.conversationType===D.CONV_C2C)o=this.getModule(Bo),s=a.replace(D.CONV_C2C,\"\"),e.forEach((function(e){e&&e.status===ro.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push(\"\".concat(e.sequence,\"_\").concat(e.random,\"_\").concat(e.time)),i.push(e))}));else if(n.conversationType===D.CONV_GROUP)o=this.getModule(Ko),s=a.replace(D.CONV_GROUP,\"\"),e.forEach((function(e){e&&e.status===ro.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||r.push(\"\".concat(e.sequence)),i.push(e))}));else if(n.conversationType===D.CONV_SYSTEM)return lr({code:hn.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!o)return this._onCannotFindModule();if(0===r.length)return this._onMessageDeleted(i);r.length>30&&(r=r.slice(0,30),i=i.slice(0,30));var c=new bs(ws.DELETE_MESSAGE);return c.setMessage(\"to:\".concat(s,\" count:\").concat(r.length)),o.deleteMessage({to:s,keyList:r}).then((function(e){return c.end(),Ye.info(\"\".concat(t._className,\".deleteMessage ok\")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.warn(\"\".concat(t._className,\".deleteMessage failed. error:\"),e);var o=new rr({code:e&&e.code?e.code:hn.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return lr(o)}))}},{key:\"_onMessageDeleted\",value:function(e){return this.getModule(jo).onMessageDeleted(e),ur({messageList:e})}},{key:\"translateText\",value:function(e){var o=\"\".concat(this._className,\".translateText\"),n=e.sourceTextList,a=e.sourceLanguage,s=e.targetLanguage,r=new bs(ws.TRANSLATE_MESSAGE);return r.setMessage(\"sourceLanguage:\".concat(a,\" targetLanguage:\").concat(s)),this.request({protocolName:Is,requestData:{sourceTextList:n,source:a||\"auto\",target:s,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var n=e.data,a=n.error,s=n.requestID,i=n.translatedTextList;if(0===a.code)return r.end(),Ye.info(\"\".concat(o,\" ok. requestID:\").concat(s)),er({translatedTextList:i});throw t(t({},a),{},{requestID:s})})).catch((function(e){return r.setCode(e.code).setMoreMessage(e.requestID).end(),Ye.warn(\"\".concat(o,\" failed. error:\"),e),lr({code:hn.TRANSLATE_TEXT_FAIL})}))}},{key:\"modifyRemoteMessage\",value:function(e){var t=this,o=null,n=e.conversationType,a=e.to;if(this.getModule(Ko).isMessageFromOrToAVChatroom(a))return lr({code:hn.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(pn).filterMessage(e))return lr({code:hn.PROFANITY_FOUND,data:{message:e}});n===D.CONV_C2C?o=this.getModule(Bo):n===D.CONV_GROUP&&(o=this.getModule(Ko));var s=new bs(ws.MODIFY_MESSAGE);return s.setMessage(\"to:\".concat(a)),o.modifyRemoteMessage(e).then((function(o){s.end(),Ye.info(\"\".concat(t._className,\".modifyRemoteMessage ok\"));var n=t._onModifyRemoteMessageResp(e,o.data);return er({message:n})})).catch((function(o){if(s.setCode(o.code).setMoreMessage(o.message).end(),Ye.warn(\"\".concat(t._className,\".modifyRemoteMessage failed. error:\"),o),20027===o.code){var n=t._onModifyRemoteMessageResp(e,o.data);return lr({code:hn.MESSAGE_MODIFY_CONFLICT,data:{message:n}})}return lr({code:o.code,message:o.message,data:{message:e}})}))}},{key:\"_onModifyRemoteMessageResp\",value:function(e,t){Ye.debug(\"\".concat(this._className,\"._onModifyRemoteMessageResp options:\"),t);var o=e.conversationType,n=e.from,a=e.to,s=e.random,r=e.sequence,i=e.time,c=t.elements,u=t.messageVersion,l=t.cloudCustomData,d=void 0===l?\"\":l;return this.getModule(jo).onMessageModified({conversationType:o,from:n,to:a,time:i,random:s,sequence:r,elements:c,cloudCustomData:d,messageVersion:u})}},{key:\"_generateUUID\",value:function(){var e=this.getModule($o);return\"\".concat(e.getSDKAppID(),\"-\").concat(e.getUserID(),\"-\").concat(function(){for(var e=\"\",t=32;t>0;--t)e+=Tt[Math.floor(Math.random()*Et)];return e}())}},{key:\"getMessageOption\",value:function(e){return this._messageOptionsMap.get(e)}},{key:\"_getNickAndAvatarByUserID\",value:function(e){return this.getModule(Vo).getNickAndAvatarByUserID(e)}},{key:\"_getNameCardByGroupID\",value:function(e){if(e.conversationType===D.CONV_GROUP){var t=this.getModule(Ko);if(t)return t.getMyNameCardByGroupID(e.to)}return\"\"}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._messageOptionsMap.clear()}}]),a}(vn),Oi=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"MessageExtensionModule\",a.messageExtensionMap=new Map,a.globalSeqMap=new Map,a.getMessageExtensionsMap=new Map,a}return s(o,[{key:\"onMessageExtensionNotify\",value:function(e){var t=this,o=e.dataList,n=o.messageInfo,a=o.operateType,s=o.operateResultList,r=o.tinyID,i=o.globalSequence,c=n.clientTime,u=n.random,l=\"\".concat(r,\"-\").concat(c,\"-\").concat(u),d=[],p=[];Ye.log(\"\".concat(this._className,\".onMessageExtensionNotify messageID:\").concat(l,\" operateType:\").concat(a,\" globalSequence:\").concat(i)),this._updateGlobalSequence(l,i);var g=!1,_=!1;s.forEach((function(e){var o=e.extensions,n=void 0===o?[]:o,s=e.clearSequence;if(1===a)g=!0,n.forEach((function(e){d.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,n);else if(2===a)_=!0,n.forEach((function(e){p.push(e.key)})),t._updateLocalExtension(l,n);else if(3===a){if(_=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=s&&!oo(e.value)&&p.push(t)}));t._clearLocalExtension(l,s)}})),g&&this.emitOuterEvent(S.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),_&&this.emitOuterEvent(S.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:p})}},{key:\"setMessageExtensions\",value:function(e,t){var o=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._className,\".setMessageExtensions\"),a=e.ID,s=e.conversationID,r=e.sequence,i=e.time,c=v(t);t.length>20&&(c=t.slice(0,20),Ye.warn(\"\".concat(n,\". the length of extensions cannot exceed 20.\")));var u=\"conversationID:\".concat(s,\" messageID:\").concat(a,\" sequence:\").concat(r,\" time:\").concat(i,\" count:\").concat(c.length),l=new bs(ws.SET_MESSAGE_EXTENSIONS);return l.setMessage(u),Ye.log(\"\".concat(n,\" \").concat(u)),this._modifyMessageExtensions(e,c).then((function(e){var t=e.resultList,o=e.successCount,a=e.failureCount,s=\"success count:\".concat(o,\" fail count:\").concat(a);return l.setMoreMessage(s).end(),Ye.log(\"\".concat(n,\" ok. \").concat(s)),er({extensions:t})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];l.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"getMessageExtensions\",value:function(e){var t=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._className,\".getMessageExtensions\"),n=e.ID,a=e.conversationID,s=e.sequence,r=e.time,i=\"conversationID:\".concat(a,\" messageID:\").concat(n,\" sequence:\").concat(s,\" time:\").concat(r),c=new bs(ws.GET_MESSAGE_EXTENSIONS);c.setMessage(i),Ye.log(\"\".concat(o,\" \").concat(i));var u=void 0;return this.getMessageExtensionsMap.has(n)&&(u=this._getGlobalSequence(n)),this._getMessageExtensions(e,u).then((function(e){return c.end(),Ye.log(\"\".concat(o,\" ok. total count:\").concat(e.length)),dt(u)&&e.length>0&&t.getMessageExtensionsMap.set(n,1),er({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];c.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"deleteMessageExtensions\",value:function(e,t){var o=this;if(!this.canIUse(W.MSG_EXT))return lr({code:hn.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._className,\".deleteMessageExtensions\"),a=[],s=3;oo(t)||(s=2,t.forEach((function(e){a.push({key:e,value:\"\",seq:0})})));var r=e.ID,i=e.conversationID,c=e.sequence,u=e.time,l=\"conversationID:\".concat(i,\" messageID:\").concat(r,\" sequence:\").concat(c,\" time:\").concat(u,\" operateType:\").concat(s),d=new bs(ws.DELETE_MESSAGE_EXTENSIONS);return d.setMessage(l),Ye.log(\"\".concat(n,\" \").concat(l)),this._modifyMessageExtensions(e,a,s).then((function(e){var t=e.resultList,o=e.successCount,a=e.failureCount,r=\"\";return 2===s&&(r=\"success count:\".concat(o,\" fail count:\").concat(a)),d.setMoreMessage(\"\".concat(r)).end(),Ye.log(\"\".concat(n,\" ok. \").concat(r)),er({extensions:t})})).catch((function(e){return o.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];d.setError(e,n,a).end()})),Ye.error(\"\".concat(n,\" failed. error:\"),e),lr(e)}))}},{key:\"_modifyMessageExtensions\",value:function(e,t){var o=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=e.conversationType,s=void 0;3!==n&&(s=this._getRequestExtensions(e,t));var r=null;switch(a){case D.CONV_C2C:r=this.getModule(Bo);break;case D.CONV_GROUP:r=this.getModule(Ko);break;default:return lr({code:hn.CANNOT_FIND_MODULE})}return r.modifyMessageExtensions(e,s,n).then((function(t){var n=t.data,a=n.extensions,s=n.seq,r=[],i=0,c=0,u=[];return(a=oo(a)?[]:a).forEach((function(e){var t=e.errorCode,o=e.extension,n=o.key,a=o.value,s=o.seq;r.push({code:t,key:n,value:a}),0===t?i++:c++,u.push({key:n,value:a,seq:s})})),o._updateGlobalSequence(e.ID,s),u.length>0&&(o._updateLocalExtension(e.ID,u),u=null),{resultList:r,successCount:i,failureCount:c}})).catch((function(e){return lr(e)}))}},{key:\"_getRequestExtensions\",value:function(e,t){var o=[];if(this._hasLocalExtension(e.ID)){var n=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,a=e.value,s=0;n.has(t)&&(s=n.get(t).seq),o.push({key:t,value:a,seq:s})})),o}return t.forEach((function(e){var t=e.key,n=e.value;o.push({key:t,value:n,seq:0})})),o}},{key:\"_getMessageExtensions\",value:function(e,t){var o=this,n=\"\".concat(this._className,\"._getMessageExtensions\"),a=e.ID,s=null;switch(e.conversationType){case D.CONV_C2C:s=this.getModule(Bo);break;case D.CONV_GROUP:s=this.getModule(Ko);break;default:return lr({code:hn.CANNOT_FIND_MODULE})}return s.getMessageExtensions(e,t).then((function(t){var s=t.data,r=s.extensions,i=s.completeFlag,c=s.globalSequence,u=s.clearSequence;if(r=oo(r)?[]:r,Ye.log(\"\".concat(n,\" ok. completeFlag:\").concat(i,\" globalSequence:\").concat(c,\" clearSequence:\").concat(u,\" count:\").concat(r.length)),o._updateLocalExtension(a,r),o._clearLocalExtension(a,u),o._updateGlobalSequence(a,c),1!==i){var l=r.slice(-1)[0].seq+1;return o._getMessageExtensions(e,l)}return o._getLocalExtensions(a)})).catch((function(e){return lr(e)}))}},{key:\"_hasLocalExtension\",value:function(e){return this.messageExtensionMap.has(e)}},{key:\"_getLocalExtension\",value:function(e){return this.messageExtensionMap.get(e)}},{key:\"_updateLocalExtension\",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var o=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,n=e.value,a=void 0===n?\"\":n,s=e.seq;o.set(t,{value:a,seq:s})}))}},{key:\"_clearLocalExtension\",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var o=this._getLocalExtension(e);o.forEach((function(e,n){e.seq<=t&&o.delete(n)}))}}},{key:\"_getLocalExtensions\",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,o){var n=e.value;oo(n)||t.push({key:o,value:n})}));return t}},{key:\"_getGlobalSequence\",value:function(e){return this.globalSeqMap.get(e)}},{key:\"_updateGlobalSequence\",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),o}(vn),Gi=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"ComboMessageModule\",a}return s(o,[{key:\"sendMessage\",value:function(e){var t=this,o=this._constructMessageInstance(e);if(null===o)return lr({code:hn.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(o);var n=Date.now();return this.getModule(jo).setMessageRandom(o),this._sendComboMessage(o,e).then((function(e){var a=e.data,s=a.time,r=a.sequence,i=a.readReceiptCode;rt(i)&&0!==i&&(new bs(ws.SEND_MESSAGE_WITH_RECEIPT).setMessage(\"from:\".concat(o.from,\" to:\").concat(o.to,\" sequence:\").concat(r,\" readReceiptCode:\").concat(i)).end(),Ye.warn(\"\".concat(t._className,\".sendMessage readReceiptCode:\").concat(i,\" message:\").concat(sr[i])));t._addSendMessageSuccessCount(o,n);var c=t.getModule(jo);o.status=ro.SUCCESS,o.time=s,o.conversationType===D.CONV_GROUP&&(o.sequence=r),c.appendToMessageList(o);var u=o;return!0===o._isExcludedFromLastMessage&&(u=\"\"),c.onMessageSent({conversationOptionsList:[{conversationID:o.conversationID,unreadCount:0,type:o.conversationType,subType:o.conversationSubType,lastMessage:u}]}),er({message:o})})).catch((function(e){return t._onSendMessageFailed(o,e)}))}},{key:\"_sendComboMessage\",value:function(e,t){var o=this._moduleManager.getModule(on),n=\"\";return e.conversationType===D.CONV_C2C&&(n=\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SEND_MESSAGE)),e.conversationType===D.CONV_GROUP&&(n=\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SEND_GROUP_MESSAGE)),o.sendComboMessage({servcmd:n,data:t})}},{key:\"_constructMessageInstance\",value:function(e){var t=null;try{var o=this.getMyUserID(),n={};if(n.senderTinyID=this.getMyTinyID(),n.currentUser=o,n.from=e.From_Account||o,e.GroupId?(n.conversationID=\"\".concat(D.CONV_GROUP).concat(e.GroupId),n.conversationType=D.CONV_GROUP,n.to=e.GroupId):e.To_Account&&(n.conversationID=\"\".concat(D.CONV_C2C).concat(e.To_Account),n.conversationType=D.CONV_C2C,n.to=e.To_Account),n.time=e.MsgTimeStamp||0,n.random=e.Random||e.MsgRandom||0,n.priority=e.MsgPriority,it(e.CloudCustomData)&&e.CloudCustomData.length>0&&(n.cloudCustomData=e.CloudCustomData),lt(e.SendMsgControl)&&(n.messageControlInfo={},e.SendMsgControl.includes(\"NoUnread\")&&(n.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes(\"NoLastMsg\")&&(n.messageControlInfo.excludedFromLastMessage=1)),n.conversationType===D.CONV_GROUP&<(e.To_Account)&&e.To_Account.length>0){var a=e.To_Account;e.To_Account.length>50&&(a=e.To_Account.slice(0,50),Ye.warn(\"\".concat(this._className,\"._constructMessageInstance To_Account must be less than or equal to 50.\"))),n.receiverList=v(a),e.To_Account=v(a)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(n.needReadReceipt=!0),1===e.SupportMessageExtension&&(n.isSupportExtension=!0),(t=new Zs(n)).status=ro.UNSEND,e.MsgClientTime=t.clientTime,t.conversationType===D.CONV_C2C&&(e.MsgSeq=t.sequence);for(var s,r=e.MsgBody.length,i=0;i100)return o--,t;if(lt(t)){var a=t.map((function(t){return ct(t)?e(t,n):t}));return o--,a}if(ct(t)){var s=(r=t,i=function(e,t){if(!ft(t))return!1;if((a=t)!==wi(a))for(var o=0;o65535)return Vi(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Vi(192|t>>>6,128|63&t):Vi(224|t>>>12,128|t>>>6&63,128|63&t)},Ki=function(e){for(var t=void 0===e?\"\":(\"\"+e).replace(/[\\x80-\\uD7ff\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]?/g,Bi),o=0|t.length,n=new Uint8Array(o),a=0;a0)for(var c=0;c=s&&(Ye.log(\"\".concat(e._className,\"._checkPromiseMap request timeout, delete requestID:\").concat(o)),e._promiseMap.delete(o),n(new rr({code:hn.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(o))}))}},{key:\"onOpen\",value:function(e){if(\"\"!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var o=Date.now()-this._startTs;Ye.log(\"\".concat(this._className,\"._onOpen cost \").concat(o,\" ms. socketID:\").concat(t)),new bs(ws.WS_ON_OPEN).setMessage(o).setCostTime(o).setMoreMessage(\"socketID:\".concat(t)).end(),e.id===this._socketID&&(this._readyState=Ji,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:\"onClose\",value:function(e){var t=new bs(ws.WS_ON_CLOSE),o=e.id,n=e.e,a=\"sourceSocketID:\".concat(o,\" currentSocketID:\").concat(this._socketID,\" code:\").concat(n.code,\" reason:\").concat(n.reason),s=0;0!==this._onOpenTs&&(s=Date.now()-this._onOpenTs),t.setMessage(s).setCostTime(s).setMoreMessage(a).setCode(n.code).end(),Ye.log(\"\".concat(this._className,\"._onClose \").concat(a,\" onlineTime:\").concat(s)),o===this._socketID&&(this._readyState=Qi,s<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:\"onError\",value:function(e){var t=e.id,o=e.e,n=\"sourceSocketID:\".concat(t,\" currentSocketID:\").concat(this._socketID);new bs(ws.WS_ON_ERROR).setMessage(o.errMsg||yt(o)).setMoreMessage(n).setLevel(\"error\").end(),Ye.warn(\"\".concat(this._className,\"._onError\"),o,n),t===this._socketID&&(this._readyState=\"\",this._channelModule.onError())}},{key:\"onMessage\",value:function(e){var t;try{t=JSON.parse(e.data)}catch(u){new bs(ws.JSON_PARSE_ERROR).setMessage(e.data).end()}if(t&&t.head){var o=this._getRequestIDFromHead(t.head),n=t.body;if(!o.startsWith(H.NAME.TUIROOM_SVR)){var a=Ht(t.head);n=xi(t.body,this._getResponseKeyMap(a))}if(Ye.debug(\"\".concat(this._className,\".onMessage ret:\").concat(JSON.stringify(n),\" requestID:\").concat(o,\" has:\").concat(this._promiseMap.has(o))),this._setNextPingTs(),this._promiseMap.has(o)){var s=this._promiseMap.get(o),r=s.resolve,i=s.reject,c=s.timestamp;return this._promiseMap.delete(o),this._calcRTT(c),void(n.errorCode&&0!==n.errorCode?(this._channelModule.onErrorCodeNotZero(n),i(new rr({code:n.errorCode,message:n.errorInfo||\"\",data:o.includes(qn)||o.includes(Aa)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData}:void 0}))):r(er(n)))}this._channelModule.onMessage({head:t.head,body:n})}}},{key:\"_calcRTT\",value:function(e){var t=Date.now()-e;this._channelModule.getModule(un).addRTT(t)}},{key:\"_connect\",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new Wi(this),this._socketID=this._socket.getID(),this._readyState=Xi,Ye.log(\"\".concat(this._className,\"._connect isWorkerEnabled:\").concat(this.getIsWorkerEnabled(),\" socketID:\").concat(this._socketID,\" url:\").concat(this.getURL())),new bs(ws.WS_CONNECT).setMessage(\"socketID:\".concat(this._socketID,\" url:\").concat(this.getURL())).end()}},{key:\"getURL\",value:function(){this._channelModule.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=xt();(ie||ne&&\"windows\"===e||ce)&&(this._canIUseBinaryFrame=!1);var t=-1;\"ios\"===e?t=ye||-1:\"android\"===e&&(t=Ce||-1);var o=this._channelModule.getModule($o),n=this._channelModule.getPlatform(),a=o.getSDKAppID(),s=o.getInstanceID();return this._canIUseBinaryFrame?\"\".concat(this._url,\"/binfo?sdkappid=\").concat(a,\"&instanceid=\").concat(s,\"&random=\").concat(this._getRandom(),\"&platform=\").concat(n,\"&host=\").concat(e,\"&version=\").concat(t):\"\".concat(this._url,\"/info?sdkappid=\").concat(a,\"&instanceid=\").concat(s,\"&random=\").concat(this._getRandom(),\"&platform=\").concat(n,\"&host=\").concat(e,\"&version=\").concat(t)}},{key:\"_closeConnection\",value:function(e){Ye.log(\"\".concat(this._className,\"._closeConnection socketID:\").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=Qi)}},{key:\"_resend\",value:function(){var e=this;if(Ye.log(\"\".concat(this._className,\"._resend reConnectFlag:\").concat(this._reConnectFlag),\"promiseMap.size:\".concat(this._promiseMap.size,\" simpleRequestMap.size:\").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach((function(t,o){var n=t.uplinkData,a=t.resolve,s=t.reject;e._promiseMap.set(o,{resolve:a,reject:s,timestamp:Date.now(),uplinkData:n}),e._execute(o,n)})),this._simpleRequestMap.size>0){var t,o=E(this._simpleRequestMap);try{for(o.s();!(t=o.n()).done;){var n=m(t.value,2),a=n[0],s=n[1];this._execute(a,s)}}catch(r){o.e(r)}finally{o.f()}this._simpleRequestMap.clear()}}},{key:\"send\",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var o=g(e,$i),n=this._getRequestIDFromHead(e.head),a=JSON.stringify(o);return new Promise((function(e,s){(t._promiseMap.set(n,{resolve:e,reject:s,timestamp:Date.now(),uplinkData:a}),Ye.debug(\"\".concat(t._className,\".send uplinkData:\").concat(JSON.stringify(o),\" requestID:\").concat(n,\" readyState:\").concat(t._readyState)),t._readyState!==Ji)?t._reConnect():(t._execute(n,a),t._channelModule.getModule(un).addRequestCount())}))}},{key:\"simplySend\",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);e.keyMap;var t=g(e,zi),o=this._getRequestIDFromHead(e.head),n=JSON.stringify(t);this._readyState!==Ji?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:\"onErrorCodeNotZero\",value:function(e){this.getModule(on).onErrorCodeNotZero(e)}},{key:\"onMessage\",value:function(e){this.getModule(on).onMessage(e)}},{key:\"send\",value:function(e){return this._socketHandler?this._previousState!==D.NET_STATE_CONNECTED&&e.head.servcmd.includes(Ja)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:\"_sendLogViaHTTP\",value:function(e){var t=H.HOST.CURRENT.STAT;return new Promise((function(o,n){var a=\"\".concat(t,\"/v4/imopenstat/tim_web_report_v2?sdkappid=\").concat(e.head.sdkappid,\"&reqtime=\").concat(Date.now()),s=JSON.stringify(e.body),r=\"application/x-www-form-urlencoded;charset=UTF-8\";if(le)pe.request({url:a,data:s,method:\"POST\",timeout:3e3,header:{\"content-type\":r},success:function(){o()},fail:function(){n(new rr({code:hn.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,c=setTimeout((function(){i.abort(),n(new rr({code:hn.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(c),200===i.status||304===i.status?o():n(new rr({code:hn.NETWORK_ERROR})))},i.open(\"POST\",a,!0),i.setRequestHeader(\"Content-type\",r),i.send(s)}}))}},{key:\"simplySend\",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:\"onOpen\",value:function(){this._ping()}},{key:\"onClose\",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED));this.reConnect()}},{key:\"onError\",value:function(){le&&!ce&&(this.isIntl()||Ye.error(\"\".concat(this._className,\".onError 从v2.11.2起,SDK 支持了 WebSocket,如您未添加相关受信域名,请先添加!(如已添加请忽略),升级指引: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html\"))),this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:\"getKeyMap\",value:function(e){return this.getModule(on).getKeyMap(e)}},{key:\"_onAppHide\",value:function(){this._isAppShowing=!1}},{key:\"_onAppShow\",value:function(){this._isAppShowing=!0}},{key:\"onRequestTimeout\",value:function(e){}},{key:\"onReconnected\",value:function(){Ye.log(\"\".concat(this._className,\".onReconnected\")),this.getModule(on).onReconnected(),this._emitNetStateChangeEvent(D.NET_STATE_CONNECTED)}},{key:\"onReconnectFailed\",value:function(){Ye.log(\"\".concat(this._className,\".onReconnectFailed\")),this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:\"setIsWorkerEnabled\",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:\"offline\",value:function(){this._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}},{key:\"reConnect\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var o=\"forcedFlag:\".concat(e,\" fatalErrorFlag:\").concat(this._fatalErrorFlag,\" previousState:\").concat(this._previousState,\" reconnectFlag:\").concat(t);if(Ye.log(\"\".concat(this._className,\".reConnect \").concat(o)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===D.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(D.NET_STATE_CONNECTING)}}},{key:\"_emitNetStateChangeEvent\",value:function(e){this._previousState!==e&&(Ye.log(\"\".concat(this._className,\"._emitNetStateChangeEvent from \").concat(this._previousState,\" to \").concat(e)),this._previousState=e,this.emitOuterEvent(S.NET_STATE_CHANGE,{state:e}))}},{key:\"_ping\",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(on).getProtocolData({protocolName:Xa});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Ye.warn(\"\".concat(e._className,\"._ping failed. error:\"),t),e._probing=!1,t&&60002===t.code)return new bs(ws.ERROR).setMessage(\"code:\".concat(t.code,\" message:\").concat(t.message)).setNetworkType(e.getModule(Xo).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];Ye.log(\"\".concat(e._className,\"._ping failed. probe network, isAppShowing:\").concat(e._isAppShowing,\" online:\").concat(n,\" networkType:\").concat(a)),n?e.reConnect():e._emitNetStateChangeEvent(D.NET_STATE_DISCONNECTED)}))}))}}},{key:\"_checkNextPing\",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:\"dealloc\",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:\"onRestApiKickedOut\",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._previousState=D.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),o}(vn),tc=[\"a2\",\"tinyid\"],oc=[\"a2\",\"tinyid\"],nc=function(){function e(t){n(this,e),this._className=\"ProtocolHandler\",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return s(e,[{key:\"_fillConfigMap\",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),o=this._sessionModule.genCosSpecifiedHead(),n=this._sessionModule.genSSOReportHead(),a=this._sessionModule.isIntl();this._configMap.set(Mn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.LOGIN)}),body:{state:\"Online\",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:\"InstType\"},response:{InstId:\"instanceID\",HelloInterval:\"helloInterval\"}}}}(e)),this._configMap.set(yn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:\"wslogout_type\"}}}}(e)),this._configMap.set(In,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:\"newInstanceInfo\"}}}}(e)),this._configMap.set(Cn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.STAT_SERVICE,\".\").concat(H.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(ja,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_COS_SIGN,\".\").concat(H.CMD.COS_SIGN)}),body:{cmd:\"open_im_cos_svc\",subCmd:\"get_cos_token\",duration:300,version:2},keyMap:{request:{userSig:\"usersig\",subCmd:\"sub_cmd\",cmd:\"cmd\",duration:\"duration\",version:\"version\"},response:{expired_time:\"expiredTime\",bucket_name:\"bucketName\",session_token:\"sessionToken\",tmp_secret_id:\"secretId\",tmp_secret_key:\"secretKey\"}}}}(o)),this._configMap.set($a,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.CUSTOM_UPLOAD,\".\").concat(H.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:\"usersig\",fileType:\"file_type\",fileName:\"file_name\",uploadMethod:\"upload_method\"},response:{expired_time:\"expiredTime\",request_id:\"requestId\",head_url:\"headUrl\",upload_url:\"uploadUrl\",download_url:\"downloadUrl\",ci_url:\"ciUrl\",snapshot_url:\"requestSnapshotUrl\"}}}}(o)),this._configMap.set(za,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.CUSTOM_UPLOAD,\".\").concat(H.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:\"version\",platform:\"platform\",coverName:\"cover_name\",requestSnapshotUrl:\"snapshot_url\"},response:{error_code:\"errorCode\",error_msg:\"errorInfo\",download_url:\"snapshotUrl\"}}}}(o)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_CONFIG_MANAGER,\".\").concat(H.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:\"uint32_sdkappid\"},response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_purchase_bits:\"purchaseBits\",uint32_expired_time:\"expiredTime\"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_CONFIG_MANAGER,\".\").concat(H.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_purchase_bits:\"purchaseBits\",uint32_expired_time:\"expiredTime\"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_CONFIG_MANAGER,\".\").concat(H.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:\"uint32_sdkappid\",version:\"uint64_version\"},response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_json_config:\"cloudControlConfig\",uint32_expired_time:\"expiredTime\",uint32_sdkappid:\"SDKAppID\",uint64_version:\"version\"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_CONFIG_MANAGER,\".\").concat(H.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_json_config:\"cloudControlConfig\",uint32_expired_time:\"expiredTime\",uint32_sdkappid:\"SDKAppID\",uint64_version:\"version\"}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OVERLOAD_PUSH,\".\").concat(H.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:\"overloadCommand\",DelaySecs:\"waitingTime\"}}}}(e)),this._configMap.set(Tn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.GET_MESSAGES)}),body:{cookie:\"\",syncFlag:0,needAbstract:1,isOnlineSync:0},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",from:\"From_Account\",to:\"To_Account\",time:\"MsgTimeStamp\",sequence:\"MsgSeq\",random:\"MsgRandom\",elements:\"MsgBody\"},response:{MsgList:\"messageList\",SyncFlag:\"syncFlag\",To_Account:\"to\",From_Account:\"from\",ClientSeq:\"clientSequence\",MsgSeq:\"sequence\",NoticeSeq:\"noticeSequence\",NotifySeq:\"notifySequence\",MsgRandom:\"random\",MsgTimeStamp:\"time\",MsgContent:\"content\",ToGroupId:\"to\",MsgKey:\"messageKey\",GroupTips:\"groupTips\",MsgBody:\"elements\",MsgType:\"type\",C2CRemainingUnreadCount:\"C2CRemainingUnreadList\",C2CPairUnreadCount:\"C2CPairUnreadList\"}}}}(e)),a||(this._configMap.set(En,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_MSG_AUDIT_MGR,\".\").concat(H.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:\"\",startIndex:void 0},keyMap:{request:{version:\"uint64_version\",deviceID:\"str_device_id\",startIndex:\"uint64_start_index\"},response:{msg_cmd_error_code:\"errorInfo\",str_err_msg:\"errorMessage\",uint32_code:\"errorCode\",msg_scene_ctl_config:\"filterConfig\",uint64_c2c_custom_msg_flag:\"c2c_custom_message\",uint64_c2c_text_msg_flag:\"c2c_text_message\",uint64_group_custom_msg_flag:\"group_custom_message\",uint64_group_text_msg_flag:\"group_text_message\",uint64_group_info_flag:\"group_profile\",uint64_group_member_info_flag:\"group_member_profile\",uint64_relation_chain_flag:\"sns\",uint64_user_info_flag:\"user_profile\",rpt_msg_dirty_word:\"lexicon\",str_dirty_word:\"profanity\",str_replaced_content:\"replacement\",uint64_filter_type:\"filterType\",uint64_id:\"id\",uint64_word_type:\"profanityType\",uint64_complete_flag:\"completeFlag\",uint64_next_start_index:\"nextStartIndex\",uint64_version:\"version\",uint64_expired_time:\"expiredTime\"}}}}(e))),this._configMap.set(Sn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SEND_MESSAGE)}),body:{fromAccount:\"\",toAccount:\"\",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:\"\",avatar:\"\",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:\"\",desc:\"\",ext:\"\",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:\"\"}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\",msgBody:\"MsgBody\",count:\"MaxCnt\",lastMessageTime:\"LastMsgTime\",messageKey:\"MsgKey\",peerAccount:\"Peer_Account\",data:\"Data\",description:\"Desc\",extension:\"Ext\",type:\"MsgType\",content:\"MsgContent\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",nick:\"From_AccountNick\",avatar:\"From_AccountHeadurl\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",elements:\"MsgBody\",clientSequence:\"ClientSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\",needReadReceipt:\"IsNeedReadReceipt\"}}}}(e)),this._configMap.set(Dn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:\"\",groupID:\"\",random:0,clientSequence:0,priority:\"\",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:\"\",desc:\"\",ext:\"\",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:\"\"}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:\"GroupId\",extension:\"Ext\",data:\"Data\",description:\"Desc\",random:\"Random\",sequence:\"ReqMsgSeq\",count:\"ReqMsgNumber\",type:\"MsgType\",priority:\"MsgPriority\",content:\"MsgContent\",elements:\"MsgBody\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",clientSequence:\"ClientSeq\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\",needReadReceipt:\"NeedReadReceipt\",receiverList:\"To_Account\"},response:{MsgTime:\"time\",MsgSeq:\"sequence\"}}}}(e)),this._configMap.set(On,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:\"\",toAccount:\"\",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:\"MsgInfo\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\"}}}}(e)),this._configMap.set(_a,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:\"\",msgSeqList:void 0,topicID:\"\"},keyMap:{request:{msgSeqList:\"MsgSeqList\",msgSeq:\"MsgSeq\"}}}}(e)),this._configMap.set(bn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:\"\",count:15,lastMessageTime:0,messageKey:\"\",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:\"MsgKey\",peerAccount:\"Peer_Account\",count:\"MaxCnt\",lastMessageTime:\"LastMsgTime\",withRecalledMessage:\"WithRecalledMsg\",direction:\"GetDirection\"},response:{LastMsgTime:\"lastMessageTime\",IsNeedReadReceipt:\"needReadReceipt\",IsPeerRead:\"readReceiptSentByPeer\"}}}}(e)),this._configMap.set(qn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.MODIFY_C2C_MESSAGE)}),body:{from:\"\",to:\"\",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:\"MsgSeq\",random:\"MsgRandom\",time:\"MsgTime\",version:\"MsgVersion\",type:\"MsgType\",content:\"MsgContent\"}}}}(e)),this._configMap.set(ma,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:\"\",count:15,sequence:\"\",topicID:void 0},keyMap:{request:{sequence:\"ReqMsgSeq\",count:\"ReqMsgNumber\",withRecalledMessage:\"WithRecalledMsg\"},response:{Random:\"random\",MsgTime:\"time\",MsgSeq:\"sequence\",ReqMsgSeq:\"sequence\",RspMsgList:\"messageList\",IsPlaceMsg:\"isPlaceMessage\",IsSystemMsg:\"isSystemMessage\",ToGroupId:\"to\",EnumFrom_AccountType:\"fromAccountType\",EnumTo_AccountType:\"toAccountType\",GroupCode:\"groupCode\",MsgPriority:\"priority\",MsgBody:\"elements\",MsgType:\"type\",MsgContent:\"content\",IsFinished:\"complete\",Download_Flag:\"downloadFlag\",ClientSeq:\"clientSequence\",ThumbUUID:\"thumbUUID\",VideoUUID:\"videoUUID\",ToTopicId:\"topicID\",InvisibleMsgSeq:\"invisibleSequenceList\"}}}}(e)),this._configMap.set(Gn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:\"LastedMsgTime\"}}}}(e)),this._configMap.set(Pn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:\"Peer_Account\",muteFlag:\"Mute_Notifications\"}}}}(e)),this._configMap.set(Un,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:\"muteFlagList\"}}}}(e)),this._configMap.set(ha,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:\"MsgReadedSeq\"}}}}(e)),this._configMap.set(fa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:\"C2CReadAllMsg\",groupMessageReadInfoList:\"GroupReadInfo\",messageSequence:\"MsgSeq\"},response:{C2CReadAllMsg:\"readAllC2CMessage\",GroupReadInfoArray:\"groupMessageReadInfoList\"}}}}(e)),this._configMap.set(Fn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:\"\",to:\"\",keyList:void 0},keyMap:{request:{keyList:\"MsgKeyList\"}}}}(e)),this._configMap.set(Na,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:\"\",deleter:\"\",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:\"Deleter_Account\",keyList:\"Seqs\"}}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_TRANSLATE,\".\").concat(H.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:\"\",target:\"\"},keyMap:{request:{sourceTextList:\"SourceText\",SDKAppID:\"SdkAppId\",from:\"FromAccount\"},response:{TargetText:\"translatedTextList\",RequestId:\"requestID\",CmdErrorCode:\"error\",ErrorCode:\"code\",ErrorInfo:\"message\"}}}}(e)),this._configMap.set(Aa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:\"\",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:\"MsgSeq\",version:\"MsgVersion\",type:\"MsgType\",content:\"MsgContent\"}}}}(e)),this._configMap.set(va,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_READ_RECEIPT)}),body:{groupID:\"\",sequenceList:void 0},keyMap:{request:{sequence:\"MsgSeq\"}}}}(e)),this._configMap.set(ya,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:\"\",messageInfoList:void 0},keyMap:{request:{peerAccount:\"Peer_Account\",messageInfoList:\"C2CMsgInfo\",fromAccount:\"From_Account\",toAccount:\"To_Account\",sequence:\"MsgSeq\",random:\"MsgRandom\",time:\"MsgTime\",clientTime:\"MsgClientTime\"}}}}(e)),this._configMap.set(Ma,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SEND_READ_RECEIPT)}),body:{groupID:\"\",sequenceList:void 0},keyMap:{request:{sequenceList:\"MsgSeqList\",sequence:\"MsgSeq\"}}}}(e)),this._configMap.set(Ia,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:\"\",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:\"MsgSeq\",count:\"Num\"},response:{ReadList:\"readUserIDList\",Read_Account:\"userID\",UnreadList:\"unreadUserIDList\",Unread_Account:\"userID\",IsFinish:\"isCompleted\"}}}}(e)),this._configMap.set(xn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM_MSG_EXT,\".\").concat(H.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Vn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM_MSG_EXT,\".\").concat(H.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Pa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM_MSG_EXT,\".\").concat(H.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ua,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM_MSG_EXT,\".\").concat(H.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(wn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:\"To_Account\"},response:{ReadTime:\"peerReadTimeList\"}}}}(e)),this._configMap.set(Kn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:\"conversations\",ToAccount:\"groupID\",To_Account:\"userID\",UnreadMsgCount:\"unreadCount\",MsgGroupReadedSeq:\"messageReadSeq\",C2cPeerReadTime:\"c2cPeerReadTime\"}}}}(e)),this._configMap.set(Bn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:\"MsgAssistFlags\",assistFlag:\"AssistFlags\",pinnedTimeStamp:\"TopTimeStamp\",pinnedStartIndex:\"TopStartIndex\"},response:{SessionItem:\"conversations\",ToAccount:\"groupID\",To_Account:\"userID\",UnreadMsgCount:\"unreadCount\",MsgGroupReadedSeq:\"messageReadSeq\",C2cPeerReadTime:\"c2cPeerReadTime\",LastMsgFlags:\"lastMessageFlag\",TopFlags:\"isPinned\",TopTimeStamp:\"pinnedTimeStamp\",TopStartIndex:\"pinnedStartIndex\",GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Hn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.DELETE_CONVERSATION)}),body:{fromAccount:\"\",toAccount:void 0,type:1,toGroupID:void 0,clearHistoryMessage:1},keyMap:{request:{toGroupID:\"ToGroupid\",clearHistoryMessage:\"ClearRamble\"}}}}(e)),this._configMap.set(Wn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:\"\",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:\"ToGroupid\"}}}}(e)),this._configMap.set(Yn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.PIN_CONVERSATION)}),body:{fromAccount:\"\",operationType:1,itemList:void 0},keyMap:{request:{itemList:\"RecentContactItem\"}}}}(e)),this._configMap.set(jn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:\"DelMsgList\",messageSeq:\"MsgSeq\",messageRandom:\"MsgRandom\"}}}}(e)),this._configMap.set($n,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.MARK_CONVERSATION)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"MarkItem\",operationType:\"OptType\",groupID:\"ToGroupId\"},response:{ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(zn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.MARK_CONVERSATION)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"MarkItem\",operationType:\"OptType\",groupID:\"ToGroupId\"},response:{ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(Jn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"GroupContactItem\",groupID:\"ToGroupId\"},response:{GroupId:\"convGroupID\",ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(Xn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",groupName:void 0},keyMap:{request:{},response:{GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Qn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:\"OldGroupName\",newName:\"NewGroupName\",groupID:\"ToGroupId\",operationType:\"ContactOptType\",groupName:\"OldGroupName\",updateItem:\"ContactUpdateItem\"},response:{ContactOptType:\"operationType\",ToGroupId:\"groupID\",GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Zn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.RECENT_CONTACT,\".\").concat(H.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:\"\",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:\"convGroupID\",ToGroupId:\"groupID\",OptType:\"operationType\",CustomMark:\"customData\",ContactGroupId:\"convGroupIDList\"}}}}(e)),this._configMap.set(Nn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.PROFILE,\".\").concat(H.CMD.PORTRAIT_GET)}),body:{fromAccount:\"\",userItem:[]},keyMap:{request:{toAccount:\"To_Account\",standardSequence:\"StandardSequence\",customSequence:\"CustomSequence\"}}}}(e)),this._configMap.set(An,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.PROFILE,\".\").concat(H.CMD.PORTRAIT_SET)}),body:{fromAccount:\"\",profileItem:[{tag:$e.NICK,value:\"\"},{tag:$e.GENDER,value:\"\"},{tag:$e.ALLOWTYPE,value:\"\"},{tag:$e.AVATAR,value:\"\"}]},keyMap:{request:{toAccount:\"To_Account\",standardSequence:\"StandardSequence\",customSequence:\"CustomSequence\"}}}}(e)),this._configMap.set(kn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.FRIEND,\".\").concat(H.CMD.GET_BLACKLIST)}),body:{fromAccount:\"\",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:\"currentSequence\"}}}}(e)),this._configMap.set(Rn,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.FRIEND,\".\").concat(H.CMD.ADD_BLACKLIST)}),body:{fromAccount:\"\",toAccount:[]}}}(e)),this._configMap.set(Ln,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.FRIEND,\".\").concat(H.CMD.DELETE_BLACKLIST)}),body:{fromAccount:\"\",toAccount:[]}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.SET_SELF_STATUS)}),body:{customStatus:\"\"},keyMap:{}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:\"successUserList\",ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\",Status:\"statusType\"}}}}(e)),this._configMap.set(hs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\"}}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:\"\",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:\"Member_Account\"},response:{GroupIdList:\"groups\",NoUnreadSeqList:\"excludedUnreadSequenceList\",MsgSeq:\"readedSequence\",LastRecallTime:\"_lastRevokedTime\"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"Owner_Account\",\"CreateTime\",\"InfoSeq\",\"LastInfoTime\",\"LastMsgTime\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\",\"NextMsgSeq\",\"ShutUpAllMember\"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:\"GroupIdList\",groupCustomField:\"AppDefinedData\",memberCustomField:\"AppMemberDefinedData\",groupCustomFieldFilter:\"AppDefinedDataFilter_Group\",memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{GroupIdList:\"groups\",AppDefinedData:\"groupCustomField\",AppMemberDefinedData:\"memberCustomField\",AppDefinedDataFilter_Group:\"groupCustomFieldFilter\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",InfoSeq:\"infoSequence\",MemberList:\"members\",GroupInfo:\"groups\",ShutUpUntil:\"muteUntil\",ShutUpAllMember:\"muteAllMembers\"}}}}(e)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:\"\",isSupportTopic:void 0},keyMap:{request:{ownerID:\"Owner_Account\",userID:\"Member_Account\",avatar:\"FaceUrl\",maxMemberNum:\"MaxMemberCount\",joinOption:\"ApplyJoinOption\",groupCustomField:\"AppDefinedData\",memberCustomField:\"AppMemberDefinedData\"},response:{HugeGroupFlag:\"avChatRoomFlag\",OverJoinedGroupLimit_Account:\"overLimitUserIDList\"}}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0},keyMap:{request:{groupCustomField:\"AppDefinedData\",muteAllMembers:\"ShutUpAllMember\",joinOption:\"ApplyJoinOption\",avatar:\"FaceUrl\"},response:{AppDefinedData:\"groupCustomField\",ShutUpAllMember:\"muteAllMembers\"}}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:\"ApplyMsg\",historyMessageFlag:\"HugeGroupHistoryMsgFlag\"},response:{HugeGroupFlag:\"avChatRoomFlag\",AVChatRoomKey:\"avChatRoomKey\",RspMsgList:\"messageList\",ToGroupId:\"to\"}}}}(e)),this._configMap.set(ca,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,tc)),{},{servcmd:\"\".concat(H.NAME.BIG_GROUP_NO_AUTH,\".\").concat(H.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:\"ApplyMsg\"},response:{HugeGroupFlag:\"avChatRoomFlag\"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"CreateTime\",\"Owner_Account\",\"LastInfoTime\",\"LastMsgTime\",\"NextMsgSeq\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\"]}},keyMap:{response:{}}}}(e)),this._configMap.set(da,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:\"NewOwner_Account\"}}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:\"Applicant_Account\",handleAction:\"HandleMsg\",handleMessage:\"ApprovalMsg\",messageKey:\"MsgKey\"}}}}(e)),this._configMap.set(ga,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:\"Inviter_Account\",handleAction:\"HandleMsg\",handleMessage:\"ApprovalMsg\",messageKey:\"MsgKey\"}}}}(e)),this._configMap.set(Ca,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:\"Handle_Account\"}}}}(e)),this._configMap.set(Ta,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:\"DelMsgList\",messageSeq:\"MsgSeq\",messageRandom:\"MsgRandom\"}}}}(e)),this._configMap.set(Ea,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.BIG_GROUP_LONG_POLLING,\".\").concat(H.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0},keyMap:{request:{USP:\"USP\"},response:{ToGroupId:\"groupID\",RspBroadcastMsgList:\"broadcastMessageList\",IsSystemMsg:\"isSystemMessage\"}}}}(e)),this._configMap.set(Sa,function(e){e.a2,e.tinyid;return{head:t(t({},g(e,oc)),{},{servcmd:\"\".concat(H.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,\".\").concat(H.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0},keyMap:{request:{USP:\"USP\"},response:{ToGroupId:\"groupID\"}}}}(e)),this._configMap.set(Da,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(ka,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\",value:\"value\"}}}}(e)),this._configMap.set(Ra,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\",value:\"value\"}}}}(e)),this._configMap.set(La,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\"}}}}(e)),this._configMap.set(Oa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]}}}(e)),this._configMap.set(Ga,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_ATTR,\".\").concat(H.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:\"Key\",groupType:\"GroupType\"}}}}(e)),this._configMap.set(ba,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:\"\",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:\"nextRevokedTime\",NotifyMsgList:\"notifyList\"}}}}(e)),this._configMap.set(wa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:\"GroupCounter\"}}}}(e)),this._configMap.set(Fa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:\"GroupCounterKeys\"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_COMMUNITY,\".\").concat(H.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:\"FaceUrl\"}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_COMMUNITY,\".\").concat(H.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:\"TopicIdList\"},response:{DestroyResultItem:\"resultList\"}}}}(e)),this._configMap.set(ds,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_COMMUNITY,\".\").concat(H.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:\"FaceUrl\",muteAllMembers:\"ShutUpAllMember\"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_COMMUNITY,\".\").concat(H.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:[\"NoUnreadSeqList\"]},keyMap:{request:{topicIDList:\"TopicIdList\"},response:{TopicAndSelfInfo:\"topicInfoList\",TopicInfo:\"topic\",GroupID:\"groupID\",ShutUpTime:\"muteTime\",ShutUpAllFlag:\"muteAllMembers\",LastMsgTime:\"lastMessageTime\",MsgSeq:\"readedSequence\",LastMsgSeq:\"sequence\",NoUnreadSeqList:\"excludedUnreadSequenceList\"}}}}(e)),this._configMap.set(qa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:[\"Role\",\"NameCard\",\"ShutUpUntil\",\"JoinTime\"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{AppMemberDefinedData:\"memberCustomField\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",MemberList:\"members\",ShutUpUntil:\"muteUntil\"}}}}(e)),this._configMap.set(xa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_AVCHATROOM,\".\").concat(H.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:\"Timestamp\",filter:\"Mark\"},response:{NextTimestamp:\"offset\"}}}}(e)),this._configMap.set(Va,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:\"Member_List_Account\",memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{MemberList:\"members\",ShutUpUntil:\"muteUntil\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",AppMemberDefinedData:\"memberCustomField\"}}}}(e)),this._configMap.set(Ba,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:\"Member_Account\",userIDList:\"MemberList\"},response:{MemberList:\"members\"}}}}(e)),this._configMap.set(Ka,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:\"MemberToDel_Account\"}}}}(e)),this._configMap.set(Ha,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:\"\"},keyMap:{request:{userIDList:\"Members_Account\",duration:\"Duration\",reason:\"Description\"}}}}(e)),this._configMap.set(Wa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP,\".\").concat(H.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:\"Member_Account\",memberCustomField:\"AppMemberDefinedData\",muteTime:\"ShutUpTime\",messageRemindType:\"MsgFlag\"}}}}(e)),this._configMap.set(Ya,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.GROUP_AVCHATROOM,\".\").concat(H.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:\"CommandType\",memberList:\"MemberList\",markType:\"Marks\",userID:\"Member_Account\"},response:{CommandType:\"operationType\",Marks:\"markType\",Member_Account:\"userID\"}}}}(e)),this._configMap.set(Ja,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STAT,\".\").concat(H.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:\"sdk_type\",SDKVersion:\"sdk_version\",deviceType:\"device_type\",platform:\"platform\",instanceID:\"instance_id\",traceID:\"trace_id\",SDKAppID:\"sdk_app_id\",userID:\"user_id\",tinyID:\"tiny_id\",extension:\"extension\",timestamp:\"timestamp\",networkType:\"network_type\",eventType:\"event_type\",code:\"error_code\",message:\"error_message\",moreMessage:\"more_message\",duplicate:\"duplicate\",costTime:\"cost_time\",level:\"level\",qualityType:\"quality_type\",reportIndex:\"report_index\",wholePeriod:\"whole_period\",totalCount:\"total_count\",rttCount:\"success_count_business\",successRateOfRequest:\"percent_business\",countLessThan1Second:\"success_count_business\",percentOfCountLessThan1Second:\"percent_business\",countLessThan3Second:\"success_count_platform\",percentOfCountLessThan3Second:\"percent_platform\",successCountOfBusiness:\"success_count_business\",successRateOfBusiness:\"percent_business\",successCountOfPlatform:\"success_count_platform\",successRateOfPlatform:\"percent_platform\",successCountOfMessageReceived:\"success_count_business\",successRateOfMessageReceived:\"percent_business\",avgRTT:\"average_value\",avgDelay:\"average_value\",avgValue:\"average_value\",uiPlatform:\"ui_platform\"}}}}(n)),this._configMap.set(Xa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.HEARTBEAT,\".\").concat(H.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(Qa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_PUSH,\".\").concat(H.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:\"C2CMessageArray\",GroupMsgArray:\"groupMessageArray\",GroupTips:\"groupTips\",C2cNotifyMsgArray:\"C2CNotifyMessageArray\",C2cMsgInfo:\"C2CReadReceiptArray\",ClientSeq:\"clientSequence\",MsgPriority:\"priority\",NoticeSeq:\"noticeSequence\",MsgContent:\"content\",MsgType:\"type\",MsgBody:\"elements\",ToGroupId:\"to\",Desc:\"description\",Ext:\"extension\",IsSyncMsg:\"isSyncMessage\",Flag:\"needSync\",NeedAck:\"needAck\",PendencyAdd_Account:\"userID\",ProfileImNick:\"nick\",PendencyType:\"applicationType\",C2CReadAllMsg:\"readAllC2CMessage\",IsNeedReadReceipt:\"needReadReceipt\",Status:\"statusType\",MsgExtensionNotify:\"messageExtensionNotify\",ExtensionC2cMsgInfo:\"messageInfo\",ExtensionGroupMsgInfo:\"messageInfo\",MsgOptType:\"operateType\",SetKVInfo:\"operateResultList\",DeleteKVInfo:\"operateResultList\",ClearKVInfo:\"operateResultList\",MsgKeyValue:\"extensions\",ClearMsgSeq:\"clearSequence\",MsgLastSeq:\"globalSequence\"}}}}(e)),this._configMap.set(Za,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_PUSH,\".\").concat(H.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:\"groupMessageArray\",GroupTips:\"groupTips\",ClientSeq:\"clientSequence\",MsgPriority:\"priority\",NoticeSeq:\"noticeSequence\",MsgContent:\"content\",MsgType:\"type\",MsgBody:\"elements\",ToGroupId:\"to\",Desc:\"description\",Ext:\"extension\",IsSyncMsg:\"isSyncMessage\",Flag:\"needSync\",NeedAck:\"needAck\",PendencyType:\"applicationType\"}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.OPEN_IM,\".\").concat(H.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:\"SessionData\"}}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:\"C2CNotifyMessageArray\",NoticeSeq:\"noticeSequence\",KickoutMsgNotify:\"kickoutMsgNotify\",NewInstInfo:\"newInstanceInfo\"}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_LONG_MESSAGE,\".\").concat(H.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:\"\"},keyMap:{response:{Data:\"data\",Desc:\"description\",Ext:\"extension\",Download_Flag:\"downloadFlag\",ThumbUUID:\"thumbUUID\",VideoUUID:\"videoUUID\"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_LONG_MESSAGE,\".\").concat(H.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\",msgBody:\"MsgBody\",type:\"MsgType\",content:\"MsgContent\",data:\"Data\",description:\"Desc\",extension:\"Ext\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",elements:\"MsgBody\",clientSequence:\"ClientSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\"}}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.SET_TOKEN)}),body:{tokenID:\"\",pushMsg:0,sdkAppID:0,businessID:\"\",deviceBrand:\"\",deviceToken:\"\",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:\"TokenID\",pushMsg:\"PushMsg\",sdkAppID:\"EnterVersion\",businessID:\"BusiID\",deviceBrand:\"InstType\",deviceToken:\"VarToken\",isTpns:\"IsTpns\"}}}}(e)),this._configMap.set(vs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(ms,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(H.NAME.IM_OPEN_STATUS,\".\").concat(H.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:\"C2cUnread\",groupUnreadCount:\"GrpUnread\"}}}}(e))}},{key:\"has\",value:function(e){return this._configMap.has(e)}},{key:\"get\",value:function(e){return this._configMap.get(e)}},{key:\"update\",value:function(){this._fillConfigMap()}},{key:\"getKeyMap\",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Ye.warn(\"\".concat(this._className,\".getKeyMap unknown protocolName:\").concat(e)),{})}},{key:\"getProtocolData\",value:function(e){var t=e.protocolName,o=e.requestData,n=this.get(t),a=null;if(o){var s=this._simpleDeepCopy(n),r=this._updateService(o,s),i=r.body,c=Object.create(null);for(var u in i)if(Object.prototype.hasOwnProperty.call(i,u)){if(c[u]=i[u],void 0===o[u])continue;c[u]=o[u]}r.body=c,a=this._getUplinkData(r)}else a=this._getUplinkData(n);return a}},{key:\"_getUplinkData\",value:function(e){var t=this._requestDataCleaner(e),o=Ht(t.head),n=qi(t.body,this._getRequestKeyMap(o));return t.body=n,t}},{key:\"_updateService\",value:function(e,t){var o=Ht(t.head);if(this._isFromGroupRequest(t)){var n=e.type,a=e.groupID,s=void 0===a?void 0:a,r=e.groupIDList,i=void 0===r?[]:r;dt(s)&&(s=i[0]||\"\"),Ot({type:n,groupID:s})&&(t.head.servcmd=\"\".concat(H.NAME.GROUP_COMMUNITY,\".\").concat(o))}return t}},{key:\"_isFromGroupRequest\",value:function(e){return e.head.servcmd.includes(H.NAME.GROUP)||e.head.servcmd.includes(H.NAME.GROUP_ATTR)}},{key:\"_getRequestKeyMap\",value:function(e){var o=this.getKeyMap(e);return t(t({},bi.request),o.request)}},{key:\"_requestDataCleaner\",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&ft(n)&&null!==e[n]&&void 0!==e[n]&&(\"object\"!==o(e[n])?t[n]=e[n]:t[n]=this._requestDataCleaner.bind(this)(e[n]));return t}},{key:\"_simpleDeepCopy\",value:function(e){for(var t,o=Object.keys(e),n={},a=0,s=o.length;a1e3*a)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:r,requestCount:i});var c=!1;return i>n&&(c=!0),c}},{key:\"_isServerOverload\",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),o=t.overloadTime,n=t.waitingTime,a=!1;return Date.now()-o<=1e3*n?a=!0:(this._serverOverloadInfoMap.delete(e),a=!1),a}},{key:\"onPushedServerOverload\",value:function(e){var t=e.overloadCommand,o=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:o}),Ye.warn(\"\".concat(this._className,\".onPushedServerOverload waitingTime:\").concat(o,\"s\"))}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._updateCommandFrequencyLimitMap(rc),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),a}(vn),cc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"MessageLossDetectionModule\",a._maybeLostSequencesMap=new Map,a._firstRoundRet=[],a}return s(o,[{key:\"onMessageMaybeLost\",value:function(e,t,o){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var n=this._maybeLostSequencesMap.get(e),a=0;a=this._expiredTime}},{key:\"fetchConfig\",value:function(){var e=this,t=this._canFetchConfig();if(Ye.log(\"\".concat(this._className,\".fetchConfig canFetchConfig:\").concat(t)),t){var o=new bs(ws.FETCH_CLOUD_CONTROL_CONFIG),n=this.getModule($o).getSDKAppID();this._isFetching=!0,this.request({protocolName:as,requestData:{SDKAppID:n,version:this._version}}).then((function(t){e._isFetching=!1,o.setMessage(\"version:\".concat(e._version,\" newVersion:\").concat(t.data.version,\" config:\").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),Ye.log(\"\".concat(e._className,\".fetchConfig ok\")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var n=m(e,2),a=n[0],s=n[1];o.setError(t,a,s).end()})),Ye.log(\"\".concat(e._className,\".fetchConfig failed. error:\"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:\"onPushedCloudControlConfig\",value:function(e){Ye.log(\"\".concat(this._className,\".onPushedCloudControlConfig\")),new bs(ws.PUSHED_CLOUD_CONTROL_CONFIG).setNetworkType(this.getNetworkType()).setMessage(\"newVersion:\".concat(e.version,\" config:\").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:\"onCheckTimer\",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:\"_parseCloudControlConfig\",value:function(e){var t=this,o=\"\".concat(this._className,\"._parseCloudControlConfig\"),n=e.errorCode,a=e.errorMessage,s=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===n){if(this._version!==r){var c=null;try{c=JSON.parse(s)}catch(u){this.isPrivateNetWork()||Ye.error(\"\".concat(o,\" JSON parse error. cloudControlConfig:\"),s)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=r,this.emitInnerEvent(_r))}this._expiredTime=Date.now()+1e3*i}else dt(n)?(Ye.log(\"\".concat(o,\" failed. Invalid message format:\"),e),this._setExpiredTimeOnResponseError(36e5)):(Ye.error(\"\".concat(o,\" errorCode:\").concat(n,\" errorMessage:\").concat(a)),this._setExpiredTimeOnResponseError(12e4))}},{key:\"_setExpiredTimeOnResponseError\",value:function(e){this._expiredTime=Date.now()+e}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),o}(vn),lc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"RecoverMessageModule\",a.PULL_LIMIT_COUNT=15,a}return s(o,[{key:\"start\",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:\"_recoverGroupChat\",value:function(){var e,t,o=this,n=this._getLocalConversationList().filter((function(e){return e.type===D.CONV_GROUP&&e.groupProfile.type!==D.GRP_AVCHATROOM})),a=this.getModule(jo),s=0,r=0,i=0;n.forEach((function(n){var c=n.conversationID,u=n.lastMessage;t=c.replace(D.CONV_GROUP,\"\"),e=a.getLocalLastMessage(c),u&&0!==u.lastSequence&&e?(r=u.lastSequence,s=e.sequence,i=r-s,s>0&&i>=1&&i<300?o._recoverGroupMessage({groupID:t,localLastMessageSequence:s,remoteLastMessageSequence:r}):o._getGroupNotify(t)):o._getGroupNotify(t)}))}},{key:\"_recoverC2CChat\",value:function(){var e,t=this,o=this._getLocalConversationList().filter((function(e){return e.type===D.CONV_C2C})),n=this.getModule(jo),a=0,s=0,r=0,i=[Promise.resolve()];o.forEach((function(o){var c=o.conversationID,u=o.lastMessage;e=n.getLocalLastMessage(c),u&&0!==u.lastTime&&e&&(s=u.lastTime,a=e.time,r=s-a,a>0&&r>=1&&r<=600&&i.push(t._recoverC2CMessage({conversationID:c,localLastMessageTime:a,remoteLastMessageTime:s})))})),Promise.all(i).then((function(){Ye.log(\"\".concat(t._className,\"._recoverC2CChat all promise fulfilled, start to sync unread messages\")),t.getModule(tn).startSyncOnReconnected()}))}},{key:\"_getLocalConversationList\",value:function(){return this.getModule(jo).getLocalConversationList()}},{key:\"_recoverGroupMessage\",value:function(e){var t=this,o=\"\".concat(this._className,\"._recoverGroupMessage\");Ye.log(\"\".concat(o,\" options:\"),e);var n=e.groupID,a=e.localLastMessageSequence,s=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:n,sequence:a}).then((function(e){var a=e.data,r=a.complete,i=a.messageList;if(!dt(i)){var c=i[0].sequence;Ye.log(\"\".concat(o,\" pkgLastMessageSequence:\").concat(c,\" complete:\").concat(r)),c=0&&this._e2eDelayArray.push(t)}},{key:\"_calcAvg\",value:function(e,t){if(0===t)return 0;var o=0;return e.forEach((function(e){o+=e})),Wt(o/t,1)}},{key:\"_calcCountWithLimit\",value:function(e){var t=e.e2eDelayArray,o=e.min,n=e.max;return t.filter((function(e){return o<=e&&e100&&(o=100),o}},{key:\"_checkE2EDelayException\",value:function(e,t){var o=e.filter((function(e){return e>t}));if(o.length>0){var n=o.length,a=Math.min.apply(Math,v(o)),s=Math.max.apply(Math,v(o)),r=this._calcAvg(o,n),i=Wt(n/e.length*100,2);if(i>50)new bs(ws.MESSAGE_E2E_DELAY_EXCEPTION).setMessage(\"message e2e delay exception. count:\".concat(n,\" min:\").concat(a,\" max:\").concat(s,\" avg:\").concat(r,\" percent:\").concat(i)).setLevel(\"warning\").end()}}},{key:\"getStatResult\",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=v(this._e2eDelayArray),o=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),a=this._calcPercent(o,e),s=this._calcPercent(n,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:o,percentOfCountLessThan1Second:a,countLessThan3Second:n,percentOfCountLessThan3Second:s,avgDelay:r}}},{key:\"reset\",value:function(){this._e2eDelayArray.length=0}}]),e}(),pc=function(){function e(){n(this,e),this._className=\"AvgRTT\",this._requestCount=0,this._rttArray=[]}return s(e,[{key:\"addRequestCount\",value:function(){this._requestCount+=1}},{key:\"addRTT\",value:function(e){this._rttArray.push(e)}},{key:\"_calcTotalCount\",value:function(){return this._requestCount}},{key:\"_calcRTTCount\",value:function(e){return e.length}},{key:\"_calcSuccessRateOfRequest\",value:function(e,t){if(0===t)return 0;var o=Wt(e/t*100,2);return o>100&&(o=100),o}},{key:\"_calcAvg\",value:function(e,t){if(0===t)return 0;var o=0;return e.forEach((function(e){o+=e})),parseInt(o/t)}},{key:\"_calcMax\",value:function(){return Math.max.apply(Math,v(this._rttArray))}},{key:\"_calcMin\",value:function(){return Math.min.apply(Math,v(this._rttArray))}},{key:\"getStatResult\",value:function(){var e=this._calcTotalCount(),t=v(this._rttArray);if(0===e)return null;var o=this._calcRTTCount(t),n=this._calcSuccessRateOfRequest(o,e),a=this._calcAvg(t,o);return Ye.log(\"\".concat(this._className,\".getStatResult max:\").concat(this._calcMax(),\" min:\").concat(this._calcMin(),\" avg:\").concat(a)),this.reset(),{totalCount:e,rttCount:o,successRateOfRequest:n,avgRTT:a}}},{key:\"reset\",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),gc=function(){function e(){n(this,e),this._map=new Map}return s(e,[{key:\"initMap\",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:\"addTotalCount\",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:\"addSuccessCount\",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:\"addFailedCountOfUserSide\",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:\"addCost\",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:\"addFileSize\",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:\"_calcSuccessRateOfBusiness\",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=Wt(t.successCount/t.totalCount*100,2);return o>100&&(o=100),o}},{key:\"_calcSuccessRateOfPlatform\",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),o=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(o=Wt(o,2))>100&&(o=100),o}},{key:\"_calcTotalCount\",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:\"_calcSuccessCountOfBusiness\",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:\"_calcSuccessCountOfPlatform\",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:\"_calcAvg\",value:function(e){return dt(e)||!this._map.has(e)?-1:e===As?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:\"_calcAvgCost\",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var o=0;return this._map.get(e).costArray.forEach((function(e){o+=e})),parseInt(o/t)}},{key:\"_calcAvgSpeed\",value:function(e){var t=0,o=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){o+=e})),parseInt(1e3*o/t)}},{key:\"getStatResult\",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var o=this._calcSuccessCountOfBusiness(e),n=this._calcSuccessRateOfBusiness(e),a=this._calcSuccessCountOfPlatform(e),s=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:o,successRateOfBusiness:n,successCountOfPlatform:a,successRateOfPlatform:s,avgValue:r}}},{key:\"reset\",value:function(e){dt(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),_c=function(){function e(){n(this,e),this._lastMap=new Map,this._currentMap=new Map}return s(e,[{key:\"initMap\",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:\"addMessageSequence\",value:function(e){var t=e.key,o=e.message;if(dt(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var n=o.conversationID,a=o.sequence,s=n.replace(D.CONV_GROUP,\"\");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(s)){var r=this._lastMap.get(t).get(s),i=r.length-1;a>r[0]&&a100&&(n=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:o,successRateOfMessageReceived:n}}},{key:\"reset\",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),hc=function(e){i(a,e);var o=f(a);function a(e){var t;n(this,a),(t=o.call(this,e))._className=\"QualityStatModule\",t.TAG=\"im-ssolog-quality-stat\",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[Cs,Ts,Es,Ss,Ds,Ns,As,ks,Rs,Ls],t._messageSentItems=[Es,Ss,Ds,Ns,As],t._messageReceivedItems=[ks,Rs,Ls],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new pc,t._avgE2EDelay=new dc,t._rateMessageSent=new gc,t._rateMessageReceived=new _c;var s=t.getInnerEmitterInstance();return s.on(gr,t._onLoginSuccess,_(t)),s.on(_r,t._onCloudConfigUpdated,_(t)),t}return s(a,[{key:\"_onLoginSuccess\",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(zo),o=t.getItem(this.TAG,!1);!oo(o)&>(o.forEach)&&(Ye.log(\"\".concat(this._className,\"._onLoginSuccess get quality stat logs from local storage, count:\").concat(o.length)),o.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"q_rpt_interval\"),t=this.getCloudConfig(\"q_rpt_sdkappid_bl\"),o=this.getCloudConfig(\"q_rpt_tinyid_wl\");dt(e)||(this.REPORT_INTERVAL=Number(e)),dt(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(\",\").map((function(e){return Number(e)}))),dt(o)||(this.REPORT_TINYID_WHITELIST=o.split(\",\"))}},{key:\"onCheckTimer\",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:\"addRequestCount\",value:function(){this._avgRTT.addRequestCount()}},{key:\"addRTT\",value:function(e){this._avgRTT.addRTT(e)}},{key:\"addMessageDelay\",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:\"addTotalCount\",value:function(e){this._rateMessageSent.addTotalCount(e)||Ye.warn(\"\".concat(this._className,\".addTotalCount invalid key:\"),e)}},{key:\"addSuccessCount\",value:function(e){this._rateMessageSent.addSuccessCount(e)||Ye.warn(\"\".concat(this._className,\".addSuccessCount invalid key:\"),e)}},{key:\"addFailedCountOfUserSide\",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ye.warn(\"\".concat(this._className,\".addFailedCountOfUserSide invalid key:\"),e)}},{key:\"addCost\",value:function(e,t){this._rateMessageSent.addCost(e,t)||Ye.warn(\"\".concat(this._className,\".addCost invalid key or cost:\"),e,t)}},{key:\"addFileSize\",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Ye.warn(\"\".concat(this._className,\".addFileSize invalid key or size:\"),e,t)}},{key:\"addMessageSequence\",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Ye.warn(\"\".concat(this._className,\".addMessageSequence invalid key:\"),e.key)}},{key:\"_getQualityItem\",value:function(e){var o={},n=Ps[this.getNetworkType()];dt(n)&&(n=8);var a={qualityType:Os[e],timestamp:xe(),networkType:n,extension:\"\"};switch(e){case Cs:o=this._avgRTT.getStatResult();break;case Ts:o=this._avgE2EDelay.getStatResult();break;case Es:case Ss:case Ds:case Ns:case As:o=this._rateMessageSent.getStatResult(e);break;case ks:case Rs:case Ls:o=this._rateMessageReceived.getStatResult(e)}return null===o?null:t(t({},a),o)}},{key:\"_report\",value:function(e){var t=this,o=[],n=null;dt(e)?this._qualityItems.forEach((function(e){null!==(n=t._getQualityItem(e))&&(n.reportIndex=t.reportIndex,n.wholePeriod=t.wholePeriod,o.push(n))})):null!==(n=this._getQualityItem(e))&&(n.reportIndex=this.reportIndex,n.wholePeriod=this.wholePeriod,o.push(n)),Ye.debug(\"\".concat(this._className,\"._report\"),o),this._statInfoArr.length>0&&(o=o.concat(this._statInfoArr),this._statInfoArr=[]);var a=this.getModule($o),s=a.getSDKAppID(),r=a.getTinyID();Yt(this.REPORT_SDKAPPID_BLACKLIST,s)&&!jt(this.REPORT_TINYID_WHITELIST,r)&&(o=[]),o.length>0&&this._doReport(o)}},{key:\"_doReport\",value:function(e){var o=this,n={header:fi(this),quality:e};this.request({protocolName:Ja,requestData:t({},n)}).then((function(){o.reportIndex++,o.wholePeriod=!1})).catch((function(t){Ye.warn(\"\".concat(o._className,\"._doReport, online:\").concat(o.getNetworkType(),\" error:\"),t),o._statInfoArr=o._statInfoArr.concat(e),o._flushAtOnce()}))}},{key:\"_flushAtOnce\",value:function(){var e=this.getModule(zo),t=e.getItem(this.TAG,!1),o=this._statInfoArr;if(oo(t))Ye.log(\"\".concat(this._className,\"._flushAtOnce count:\").concat(o.length)),e.setItem(this.TAG,o,!0,!1);else{var n=o.concat(t);n.length>10&&(n=n.slice(0,10)),Ye.log(\"\".concat(this.className,\"._flushAtOnce count:\").concat(n.length)),e.setItem(this.TAG,n,!0,!1)}this._statInfoArr=[]}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),a}(vn),fc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"WorkerTimerModule\",a._isWorkerEnabled=!0,a._workerTimer=null,a._init(),a.getInnerEmitterInstance().on(_r,a._onCloudConfigUpdated,_(a)),a}return s(o,[{key:\"isWorkerEnabled\",value:function(){return this._isWorkerEnabled&&Le}},{key:\"startWorkerTimer\",value:function(){Ye.log(\"\".concat(this._className,\".startWorkerTimer\")),this._workerTimer&&this._workerTimer.postMessage(\"start\")}},{key:\"stopWorkerTimer\",value:function(){Ye.log(\"\".concat(this._className,\".stopWorkerTimer\")),this._workerTimer&&this._workerTimer.postMessage(\"stop\")}},{key:\"_init\",value:function(){if(Le){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === \"start\") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(\"\"); }, 1000) } else if (event.data === \"stop\") { clearInterval(interval); interval = -1; }};'],{type:\"application/javascript; charset=utf-8\"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(){t._moduleManager.onCheckTimer()}}}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"enable_worker\");Ye.log(\"\".concat(this._className,\"._onCloudConfigUpdated enableWorker:\").concat(e)),dt(e)||\"1\"===e?!this._isWorkerEnabled&&Le&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._moduleManager.onWorkerTimerEnabled()):this._isWorkerEnabled&&Le&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._moduleManager.onWorkerTimerDisabled())}},{key:\"terminate\",value:function(){Ye.log(\"\".concat(this._className,\".terminate\")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\"))}}]),o}(vn),mc=function(){function e(){n(this,e),this._className=\"PurchasedFeatureHandler\",this._purchasedFeatureMap=new Map}return s(e,[{key:\"isValidPurchaseBits\",value:function(e){return e&&\"string\"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:\"parsePurchaseBits\",value:function(e){var t=\"\".concat(this._className,\".parsePurchaseBits\");if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var o=null,n=e.length-1,a=0;n>=0;n--,a++)o=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),\"1\"===e[n]?this._purchasedFeatureMap.set(o,!0):this._purchasedFeatureMap.set(o,!1)}else Ye.warn(\"\".concat(t,\" invalid purchase bits:\").concat(e))}},{key:\"hasPurchasedFeature\",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:\"isFeatureEnabled\",value:function(e){for(var t=parseInt(e).toString(2),o=void 0,n=!0,a=t.length-1,s=0;a>=0;a--,s++)if(\"1\"===t.charAt(a)&&(o=s<32?new L(0,Math.pow(2,s)).toString():new L(Math.pow(2,s-32),0).toString(),!this._purchasedFeatureMap.get(o))){n=!1;break}return Ye.log(\"\".concat(this._className,\".isFeatureEnabled decimalNumber:\").concat(e,\" binaryString:\").concat(t,\" ret:\").concat(n)),ur({enabled:n})}},{key:\"clear\",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),vc=function(){function e(t){n(this,e),this._moduleManager=t,this._className=\"CommercialConfigModule\",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new mc}return s(e,[{key:\"_canFetch\",value:function(){return this._getModule($o).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:\"onCheckTimer\",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:\"fetchConfig\",value:function(){var e=this,t=this._canFetch(),o=\"\".concat(this._className,\".fetchConfig\");if(Ye.log(\"\".concat(o,\" canFetch:\").concat(t)),t){var n=this._getModule(Xo),a=new bs(ws.FETCH_COMMERCIAL_CONFIG);a.setNetworkType(n.getNetworkType());var s=this._getModule($o).getSDKAppID(),r=this._getModule(on);this._isFetching=!0,r.request({protocolName:rs,requestData:{SDKAppID:s}}).then((function(t){a.setMessage(\"purchaseBits:\".concat(t.data.purchaseBits)).end(),Ye.log(\"\".concat(o,\" ok.\")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){n.probe().then((function(e){var o=m(e,2),n=o[0],s=o[1];a.setError(t,n,s).end()})),e._isFetching=!1}))}}},{key:\"onPushedConfig\",value:function(e){var t=\"\".concat(this._className,\".onPushedConfig\");Ye.log(\"\".concat(t)),new bs(ws.PUSHED_COMMERCIAL_CONFIG).setNetworkType(this._getModule(Xo).getNetworkType()).setMessage(\"purchaseBits:\".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:\"_parseConfig\",value:function(e){var t=\"\".concat(this._className,\"._parseConfig\"),o=e.errorCode,n=e.errorMessage,a=e.purchaseBits,s=e.expiredTime;0===o?(this._purchasedFeatureHandler.parsePurchaseBits(a),this._expiredTime=Date.now()+1e3*s):dt(o)?(Ye.log(\"\".concat(t,\" failed. Invalid message format:\"),e),this._setExpiredTimeOnResponseError(36e5)):(Ye.error(\"\".concat(t,\" errorCode:\").concat(o,\" errorMessage:\").concat(n)),this._setExpiredTimeOnResponseError(12e4))}},{key:\"_setExpiredTimeOnResponseError\",value:function(e){this._expiredTime=Date.now()+e}},{key:\"canIUse\",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:\"isFeatureEnabled\",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:\"_getModule\",value:function(e){return this._moduleManager.getModule(e)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),Mc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._moduleManager=e,a._className=\"OfflinePushModule\",a._offlinePushPlugin=void 0,a._androidPushConfig={huaweiPushBussinessId:\"\",xiaomiPushBussinessId:\"\",xiaomiPushAppId:\"\",xiaomiPushAppKey:\"\",meizuPushBussinessId:\"\",meizuPushAppId:\"\",meizuPushAppKey:\"\",vivoPushBussinessId:\"\",fcmPushBussinessId:\"\",oppoPushBussinessId:\"\",oppoPushAppKey:\"\",oppoPushAppSecret:\"\"},a._deviceToken=\"\",a._businessID=0,a._iosBusinessID=0,a._c2cUnreadCount=0,a._groupUnreadCount=0,a._isWebUniapp=0,a}return s(o,[{key:\"registerPlugin\",value:function(e){if(ce){this._offlinePushPlugin=e[\"tim-offline-push-plugin\"];var t=e.offlinePushConfig||{},o=t.huaweiBusinessID,n=t.xiaomiBusinessID,a=t.xiaomiAppID,s=t.xiaomiAppKey,r=t.meizuBusinessID,i=t.meizuAppID,c=t.meizuAppKey,u=t.vivoBusinessID,l=t.oppoBusinessID,d=t.oppoAppKey,p=t.oppoAppSecret,g=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=o,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=a,this._androidPushConfig.xiaomiPushAppKey=s,this._androidPushConfig.meizuPushBussinessId=r,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=c,this._androidPushConfig.vivoPushBussinessId=u,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,new bs(ws.REGISTER_PLUGIN).setMessage(\"tim-offline-push-plugin\").setMoreMessage(\"isExist:\".concat(!dt(this._offlinePushPlugin))).end(!0),Ye.log(\"\".concat(this._className,\".registerPlugin ok. offlinePushConfig:\").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=g,this._setAppShowListener()}else this.isIntl()||Ye.warn(\"!!!离线推送插件仅支持在 uni-app 打包的 native app 环境使用\")}},{key:\"init\",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:\"_getDeviceToken\",value:function(){var e=this,t=\"\".concat(this._className,\"._getDeviceToken\");if(gt(this._offlinePushPlugin.getDeviceToken)){var o=\"androidPushConfig:\".concat(JSON.stringify(this._androidPushConfig),\", iosBusinessID:\").concat(this._iosBusinessID);Ye.log(\"\".concat(t,\" start. \").concat(o)),new bs(ws.GET_DEVICE_TOKEN).setMessage(\"\".concat(o)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(n){var a=new bs(ws.GET_DEVICE_TOKEN_RES),s=n.code,r=n.msg;if(0===s){var i=n.data,c=i.deviceToken,u=i.deviceBrand,l=i.deviceType,d=i.bussinessId;e._deviceToken=c,e._businessID=d||e._iosBusinessID,o=\"deviceToken:\".concat(c,\", deviceBrand:\").concat(u||l,\", businessID:\").concat(e._businessID),Ye.log(\"\".concat(t,\" ok. \").concat(o)),a.setMessage(o).end(!0),e._setToken()}else a.setMessage(\"code:\".concat(s,\", msg:\").concat(r)).end(!0),Ye.error(\"\".concat(t,\" failed. error:\"),n)}))}else Ye.error(\"\".concat(t,\" getDeviceToken is not a function\"))}},{key:\"canIUseOfflinePush\",value:function(){return ce&&!dt(this._offlinePushPlugin)}},{key:\"_setAppShowListener\",value:function(){var e=this,t=\"\".concat(this._className,\"._setAppShowListener\");dt(this._offlinePushPlugin)?Ye.error(\"\".concat(t,\" offlinePushPlugin is undefined\")):gt(this._offlinePushPlugin.setAppShowListener)?(new bs(ws.SET_APP_SHOW_LISTENER).end(!0),Ye.log(\"\".concat(t,\" start\")),this._offlinePushPlugin.setAppShowListener((function(o){var n=(o||{}).appShow;new bs(ws.SET_APP_SHOW_LISTENER_RES).setMessage(\"appShow:\".concat(n)).end(!0),Ye.log(\"\".concat(t,\" ok. appShow:\").concat(n)),e._moduleManager.isReady()&&(0===n?(e._getConvUnreadCount(),e._onBackground()):1===n&&e._onForeground())}))):Ye.error(\"\".concat(t,\" setAppShowListener is not a function\"))}},{key:\"getDeviceBrand\",value:function(){if(!dt(this._offlinePushPlugin)&>(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return Ye.log(\"\".concat(this._className,\".getDeviceBrand ok. deviceType:\").concat(e)),e}}},{key:\"_setToken\",value:function(){var e,t=this,o=\"\".concat(this._className,\"._setToken\"),n=this.getModule($o),a=1,s=\"\",r=\"\";oo(this._deviceToken)&&(a=0);var i=this.getUniAppPlatform(),c=this.getDeviceBrand();i===G.IOS||i===G.IPAD||i===G.MAC?r=this._deviceToken:i===G.ANDROID&&(s=this._deviceToken);var u=new bs(ws.OFFLINE_PUSH_SET_TOKEN);return e=\"deviceToken:\".concat(r||s,\", businessID:\").concat(this._businessID,\", \")+\"deviceBrand:\".concat(c,\", isWebUniapp:\").concat(this._isWebUniapp,\", pushMsg:\").concat(a,\", platform:\").concat(i),u.setMessage(\"\".concat(e)),Ye.log(\"\".concat(o,\" \").concat(e)),this.request({protocolName:Ms,requestData:{tokenID:s,pushMsg:a,sdkAppID:n.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then((function(e){return u.end(),Ye.log(\"\".concat(o,\" ok\")),e})).catch((function(e){return t.probeNetwork().then((function(t){var o=m(t,2),n=o[0],a=o[1];u.setError(e,n,a).end()})),Ye.error(\"\".concat(o,\" failed. error:\"),e),lr(e)}))}},{key:\"_getConvUnreadCount\",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(jo).getLocalConversationList().forEach((function(t){t.type===D.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===D.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:\"_onBackground\",value:function(){var e=this,t=\"\".concat(this._className,\"._onBackground\"),o=new bs(ws.ON_BACKGROUND);this.request({protocolName:ms,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(n){return o.setMessage(\"c2cUnreadCount: \".concat(e._c2cUnreadCount,\", groupUnreadCount: \").concat(e._groupUnreadCount)).end(),Ye.log(\"\".concat(t,\" ok\")),n})).catch((function(n){e.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()})),Ye.error(\"\".concat(t,\" failed. error:\"),n)}))}},{key:\"_onForeground\",value:function(){var e=this,t=\"\".concat(this._className,\"._onForeground\"),o=new bs(ws.ON_FOREGROUND);this.request({protocolName:vs,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return o.end(),Ye.log(\"\".concat(t,\" ok\")),e})).catch((function(n){e.probeNetwork().then((function(e){var t=m(e,2),a=t[0],s=t[1];o.setError(n,a,s).end()})),Ye.error(\"\".concat(t,\" failed. error:\"),n)}))}},{key:\"getUniAppPlatform\",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return\"ios\"===e?G.IOS:\"android\"===e?G.ANDROID:1002===t?G.IPAD:1001===t?G.MAC:void 0}},{key:\"reset\",value:function(){this._deviceToken=\"\",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ye.log(\"\".concat(this._className,\".reset\"))}}]),o}(vn),yc=function(e){i(o,e);var t=f(o);function o(e){var a;return n(this,o),(a=t.call(this,e))._className=\"ProfanityFilterModule\",a._plugin=null,a._filterConfigMap=new Map,a._startIndex=0,a._version=0,a._canIUseLexicon=!1,a._isFetching=!1,a._expiredTime=0,a}return s(o,[{key:\"init\",value:function(){var e=this.getModule(en).getPlugin(\"tim-profanity-filter-plugin\");e?(this._plugin=new e({logger:Ye,isArray:lt,isMap:at,isDevMode:this.isDevMode()}),this._getLexicon()):Ye.warn(\"TIMProfanityFilterPlugin not found! See https://www.npmjs.com/package/tim-profanity-filter-plugin \")}},{key:\"onCheckTimer\",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:\"filterMessage\",value:function(e){var t=!0;if(!this._plugin||!this._canIUseLexicon)return t;var o,n=e.type,a=e.conversationType;if(n!==D.MSG_TEXT&&n!==D.MSG_CUSTOM)return t;if(Ye.log(\"\".concat(this._className,\".filterMessage\")),n===D.MSG_TEXT){if(a===D.CONV_C2C?o=Y:a===D.CONV_GROUP&&(o=$),!this._isConfigOn(o))return t;var s=this._plugin.filter(e.payload.text),r=s.type,i=s.modifiedText;1===r?t=!1:2===r&&(e.payload.text=i)}else if(n===D.MSG_CUSTOM){if(a===D.CONV_C2C?o=j:a===D.CONV_GROUP&&(o=z),!this._isConfigOn(o))return t;var c=this._plugin.filter(e.payload.data),u=this._plugin.filter(e.payload.description),l=this._plugin.filter(e.payload.extension);1===c.type||1===u.type||1===l.type?t=!1:(2===c.type&&(e.payload.data=c.modifiedText),2===u.type&&(e.payload.description=u.modifiedText),2===l.type&&(e.payload.extension=l.modifiedText))}return Ye.log(\"\".concat(this._className,\".filterMessage done. isAllowedToSend:\").concat(t)),t}},{key:\"filterText\",value:function(e,t){var o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;Ye.log(\"\".concat(this._className,\".filterText\"));var n=this._plugin.filter(e),a=n.type,s=n.modifiedText;return 1===a?o.isAllowedToSend=!1:2===a&&(o.modifiedText=s),Ye.log(\"\".concat(this._className,\".filterText done. ret:\"),o),o}},{key:\"_getLexicon\",value:function(){var e=this,t=new bs(ws.PROFANITY_FILTER),o=\"\".concat(this._className,\"._getLexicon\");this._isFetching=!0,this.request({protocolName:ys,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(n){var a=n.data,s=a.errorInfo,r=a.filterConfig,i=a.lexicon,c=a.strToken,u=a.completeFlag,l=a.nextStartIndex,d=a.version,p=a.expiredTime,g=s.errorCode,_=s.errorMessage;return 0!==g?(e._isFetching=!1,Ye.warn(\"\".concat(o,\" failed. error:\"),s),void t.setCode(g).setMessage(_).end()):(e._onFilterConfig(r),e._getToken(c),1===u?(Ye.log(\"\".concat(e._className,\"._getLexicon done. version:\").concat(d,\" expiredTime:\").concat(p)),e._version=d,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*p,void e._plugin.onLexiconCompleted(i)):(e._startIndex=l,e._plugin.onLexiconSliced(i),void e._getLexicon()))})).catch((function(n){e.probeNetwork().then((function(e){var o=m(e,2),a=o[0],s=o[1];t.setError(n,a,s).end()})),e._isFetching=!1,Ye.log(\"\".concat(o,\" failed. error:\"),n)}))}},{key:\"_onFilterConfig\",value:function(e){var t=this;oo(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(o){t._filterConfigMap.set(o,e[o])})),Ye.log(\"\".concat(this._className,\"._onFilterConfig. keys:\").concat(Array.from(this._filterConfigMap.keys()),\" values:\").concat(Array.from(this._filterConfigMap.values()))))}},{key:\"_isConfigOn\",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:\"_getToken\",value:function(e){if(it(e)){var t=e.length,o=\"\";if(t%2==0)for(var n=0;n<=t-1;n+=2)o+=e[n+1],o+=e[n];else{for(var a=0;a0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:\"_stopMainThreadSocket\",value:function(){Ye.log(\"\".concat(this._className,\"._stopMainThreadSocket\"));var e=this._moduleMap.get(nn);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:\"_startMainThreadSocket\",value:function(){Ye.log(\"\".concat(this._className,\"._startMainThreadSocket\"));var e=this._moduleMap.get(nn);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:\"onWorkerTimerEnabled\",value:function(){Ye.log(\"\".concat(this._className,\".onWorkerTimerEnabled, disable main thread timer and socket\")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:\"onWorkerTimerDisabled\",value:function(){Ye.log(\"\".concat(this._className,\".onWorkerTimerDisabled, enable main thread timer and socket\")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:\"onCheckTimer\",value:function(){this._checkCount+=1;var e,t=E(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2)[1];o.onCheckTimer&&o.onCheckTimer(this._checkCount)}}catch(n){t.e(n)}finally{t.f()}}},{key:\"_initReadyList\",value:function(){var e=this;this._readyList=[this._moduleMap.get(Fo),this._moduleMap.get(jo)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:\"_onModuleReady\",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(S.SDK_READY);var t=Date.now()-this._startLoginTs;Ye.warn(\"SDK is ready. cost \".concat(t,\" ms\")),this._startLoginTs=Date.now();var o=this._moduleMap.get(Xo).getNetworkType(),n=this._ssoLogForReady.getStartTs()+qe;this._ssoLogForReady.setNetworkType(o).setMessage(t).start(n).end()}}},{key:\"login\",value:function(){0===this._startLoginTs&&(Ve(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(Xo).start(),this._ssoLogForReady=new bs(ws.SDK_READY),this._reason=hn.LOGGING_IN)}},{key:\"onLoginFailed\",value:function(){this._startLoginTs=0}},{key:\"getOuterEmitterInstance\",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new Ci,cr(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var o=this;if(e===S.CONVERSATION_LIST_UPDATED||e===S.FRIEND_LIST_UPDATED||e===S.GROUP_LIST_UPDATED||e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var n=Date.now(),a=this._eventThrottleMap.get(e);n-a.last<1e3?(a.timeoutID&&clearTimeout(a.timeoutID),a.timeoutID=setTimeout((function(){a.last=n,o._outerEmitter._emit.apply(o._outerEmitter,[e,{name:e,data:o._getEventData(e)}])}),500)):(a.last=n,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:\"_getEventData\",value:function(e){return e===S.CONVERSATION_LIST_UPDATED?this._moduleMap.get(jo).getLocalConversationList():e===S.FRIEND_LIST_UPDATED?this._moduleMap.get(Ho).getLocalFriendList(!1):e===S.GROUP_LIST_UPDATED?this._moduleMap.get(Ko).getLocalGroupList():e===S.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(jo).getTotalUnreadMessageCount():void 0}},{key:\"getInnerEmitterInstance\",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new Ci,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var o;ut(arguments[1])&&arguments[1].data?(Ye.warn(\"inner eventData has data property, please check!\"),o=[e,{name:arguments[0],data:arguments[1].data}]):o=[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,o)}.bind(this)),this._innerEmitter}},{key:\"hasModule\",value:function(e){return this._moduleMap.has(e)}},{key:\"getModule\",value:function(e){return this._moduleMap.get(e)}},{key:\"isReady\",value:function(){return this._isReady}},{key:\"isIntl\",value:function(){return this.getModule($o).isIntl()}},{key:\"getNotReadyReason\",value:function(){return this._reason}},{key:\"setNotReadyReason\",value:function(e){this._reason=e}},{key:\"onError\",value:function(e){var t=\"code:\".concat(e.code,\" message:\").concat(e.message);Ye.warn(\"Oops! \".concat(t)),new bs(ws.ERROR).setMessage(t).setNetworkType(this.getModule(Xo).getNetworkType()).setLevel(\"error\").end(),this.getOuterEmitterInstance().emit(S.ERROR,e)}},{key:\"reset\",value:function(){Ye.log(\"\".concat(this._className,\".reset\")),Ve();var e,t=E(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var o=m(e.value,2)[1];o.reset&&o.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(S.SDK_NOT_READY);var n,a=E(this._eventThrottleMap);try{for(a.s();!(n=a.n()).done;){var s=m(n.value,2)[1];s.timeoutID&&clearTimeout(s.timeoutID)}}catch(r){a.e(r)}finally{a.f()}this._eventThrottleMap.clear()}}]),e}(),Tc=function(){function e(t){n(this,e),this._isIntl=t,this._funcMap=new Map}return s(e,[{key:\"defense\",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(\"string\"!=typeof e)return null;if(0===e.length)return null;if(\"function\"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var n=null;return this._funcMap.get(e).has(t)?n=this._funcMap.get(e).get(t):(n=this._pack(e,t,o),this._funcMap.get(e).set(t,n)),n}},{key:\"defenseOnce\",value:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return\"function\"!=typeof t?null:this._pack(e,t,o)}},{key:\"find\",value:function(e,t){return\"string\"!=typeof e||0===e.length||\"function\"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(Ye.warn(\"Callback function for event \".concat(e,\" cannot be found\")),null)}},{key:\"delete\",value:function(e,t){return\"function\"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:\"_pack\",value:function(e,t,o){var n=this;return function(){try{t.apply(o,Array.from(arguments))}catch(i){var a=Object.values(S).indexOf(e);if(-1!==a){var s=Object.keys(S)[a];n._isIntl?Ye.warn(\"There is a logic error with the corresponding callback function for event TIM.EVENT.\".concat(s),\"error: \".concat(i)):Ye.warn(\"接入侧事件 TIM.EVENT.\".concat(s,\" 对应的回调函数逻辑存在问题!\"),\"error: \".concat(i))}var r=new bs(ws.CALLBACK_FUNCTION_ERROR);r.setMessage(\"eventName:\".concat(e)).setMoreMessage(i.message).end()}}}}]),e}(),Ec=function(){function e(t){n(this,e);var o={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||\"\",oversea:t.oversea||!1,instanceID:qt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0};this._moduleManager=new Cc(o),this._safetyCallbackFactory=new Tc(this.isIntl())}return s(e,[{key:\"onError\",value:function(e){this._moduleManager.onError(e)}},{key:\"login\",value:function(e){return this._moduleManager.login(),this._moduleManager.getModule(Fo).login(e)}},{key:\"logout\",value:function(){var e=this;return this._moduleManager.getModule(Fo).logout().then((function(t){return e._moduleManager.reset(),t}))}},{key:\"isReady\",value:function(){return this._moduleManager.isReady()}},{key:\"isIntl\",value:function(){return this._moduleManager.isIntl()}},{key:\"getNotReadyReason\",value:function(){return this._moduleManager.getNotReadyReason()}},{key:\"destroy\",value:function(){var e=this;return this.logout().finally((function(){e._moduleManager.stopTimer(),e._moduleManager.getModule(rn).terminate(),e._moduleManager.getModule(nn).dealloc();var t=e._moduleManager.getOuterEmitterInstance(),o=e._moduleManager.getModule($o);t.emit(S.SDK_DESTROY,{SDKAppID:o.getSDKAppID()})}))}},{key:\"on\",value:function(e,t,o){e===S.GROUP_SYSTEM_NOTICE_RECEIVED&&Ye.warn(\"!!!TIM.EVENT.GROUP_SYSTEM_NOTICE_RECEIVED v2.6.0起弃用,为了更好的体验,请在 TIM.EVENT.MESSAGE_RECEIVED 事件回调内接收处理群系统通知,详细请参考:https://web.sdk.qcloud.com/im/doc/zh-cn/Message.html#.GroupSystemNoticePayload\"),Ye.debug(\"on\",\"eventName:\".concat(e)),this._moduleManager.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,o),o)}},{key:\"once\",value:function(e,t,o){Ye.debug(\"once\",\"eventName:\".concat(e)),this._moduleManager.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,o),o||this)}},{key:\"off\",value:function(e,t,o,n){Ye.debug(\"off\",\"eventName:\".concat(e));var a=this._safetyCallbackFactory.find(e,t);null!==a&&(this._moduleManager.getOuterEmitterInstance().off(e,a,o,n),this._safetyCallbackFactory.delete(e,t))}},{key:\"registerPlugin\",value:function(e){dt(e[\"tim-offline-push-plugin\"])?this._moduleManager.getModule(en).registerPlugin(e):this._moduleManager.getModule(dn).registerPlugin(e)}},{key:\"setLogLevel\",value:function(e){if(e<=0){if(console.log([\"\",\" ________ ______ __ __ __ __ ________ _______\",\"| \\\\| \\\\| \\\\ / \\\\| \\\\ _ | \\\\| \\\\| \\\\\",\" \\\\$$$$$$$$ \\\\$$$$$$| $$\\\\ / $$| $$ / \\\\ | $$| $$$$$$$$| $$$$$$$\\\\\",\" | $$ | $$ | $$$\\\\ / $$$| $$/ $\\\\| $$| $$__ | $$__/ $$\",\" | $$ | $$ | $$$$\\\\ $$$$| $$ $$$\\\\ $$| $$ \\\\ | $$ $$\",\" | $$ | $$ | $$\\\\$$ $$ $$| $$ $$\\\\$$\\\\$$| $$$$$ | $$$$$$$\\\\\",\" | $$ _| $$_ | $$ \\\\$$$| $$| $$$$ \\\\$$$$| $$_____ | $$__/ $$\",\" | $$ | $$ \\\\| $$ \\\\$ | $$| $$$ \\\\$$$| $$ \\\\| $$ $$\",\" \\\\$$ \\\\$$$$$$ \\\\$$ \\\\$$ \\\\$$ \\\\$$ \\\\$$$$$$$$ \\\\$$$$$$$\",\"\",\"\"].join(\"\\n\")),this._printDocLink(),!this.isIntl()){console.log([\"\",\"参考以下文档,会更快解决问题哦!(#^.^#)\\n\",\"IM 智能客服:https://cloud.tencent.com/act/event/smarty-service?from=im-doc\\n\",\"WebSocket 升级指引:https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-02-upgradeguideline.html\\n\",\"SDK 更新日志: https://cloud.tencent.com/document/product/269/38492\\n\",\"常见问题: https://web.sdk.qcloud.com/im/doc/zh-cn/tutorial-01-faq.html\\n\",\"如果您需要在生产环境关闭上面的日志,请 tim.setLogLevel(1)\\n\"].join(\"\\n\"))}}Ye.setLevel(e)}},{key:\"_printDocLink\",value:function(){var e=\"https://web.sdk.qcloud.com/im/doc/\".concat(this.isIntl()?\"en\":\"zh-cn\",\"/SDK.html\");Zt()?console.log(\"%c \".concat(\"IM SDK API ->\",\" %c\"),\"background:#ff9d00; padding:1px; border-radius:3px; color: #fff\",\"background:transparent\",e):console.log(\"IM SDK API ->\",e)}},{key:\"createTextMessage\",value:function(e){return this._moduleManager.getModule(qo).createTextMessage(e)}},{key:\"createTextAtMessage\",value:function(e){return this._moduleManager.getModule(qo).createTextMessage(e)}},{key:\"createImageMessage\",value:function(e){return this._moduleManager.getModule(qo).createImageMessage(e)}},{key:\"createAudioMessage\",value:function(e){return this._moduleManager.getModule(qo).createAudioMessage(e)}},{key:\"createVideoMessage\",value:function(e){return this._moduleManager.getModule(qo).createVideoMessage(e)}},{key:\"createCustomMessage\",value:function(e){return this._moduleManager.getModule(qo).createCustomMessage(e)}},{key:\"createFaceMessage\",value:function(e){return this._moduleManager.getModule(qo).createFaceMessage(e)}},{key:\"createFileMessage\",value:function(e){return this._moduleManager.getModule(qo).createFileMessage(e)}},{key:\"createLocationMessage\",value:function(e){return this._moduleManager.getModule(qo).createLocationMessage(e)}},{key:\"createMergerMessage\",value:function(e){return this._moduleManager.getModule(qo).createMergerMessage(e)}},{key:\"downloadMergerMessage\",value:function(e){return e.type!==D.MSG_MERGER?lr({code:hn.MESSAGE_MERGER_TYPE_INVALID}):oo(e.payload.downloadKey)?lr({code:hn.MESSAGE_MERGER_KEY_INVALID}):this._moduleManager.getModule(qo).downloadMergerMessage(e).catch((function(e){return lr({code:hn.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:\"createForwardMessage\",value:function(e){return this._moduleManager.getModule(qo).createForwardMessage(e)}},{key:\"sendMessage\",value:function(e,t){return e instanceof Zs?this._moduleManager.getModule(qo).sendMessageInstance(e,t):lr({code:hn.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:\"callExperimentalAPI\",value:function(e,t){return\"sendComboMessage\"===e?this._moduleManager.getModule(_n).sendMessage(t):\"handleGroupInvitation\"===e?this._moduleManager.getModule(Ko).handleGroupInvitation(t):\"isCommercialAbilityEnabled\"===e?this._moduleManager.getModule(ln).isFeatureEnabled(t):\"isIntl\"===e?this.isIntl():\"sendTRTCCustomData\"===e?this._moduleManager.getModule(gn).sendTRTCCustomData(t):lr({code:hn.INVALID_OPERATION})}},{key:\"revokeMessage\",value:function(e){return this._moduleManager.getModule(qo).revokeMessage(e)}},{key:\"resendMessage\",value:function(e){return this._moduleManager.getModule(qo).resendMessage(e)}},{key:\"deleteMessage\",value:function(e){return this._moduleManager.getModule(qo).deleteMessage(e)}},{key:\"translateText\",value:function(e){return this._moduleManager.getModule(qo).translateText(e)}},{key:\"setMessageExtensions\",value:function(e,t){return this._moduleManager.getModule(xo).setMessageExtensions(e,t)}},{key:\"getMessageExtensions\",value:function(e){return this._moduleManager.getModule(xo).getMessageExtensions(e)}},{key:\"deleteMessageExtensions\",value:function(e,t){return this._moduleManager.getModule(xo).deleteMessageExtensions(e,t)}},{key:\"modifyMessage\",value:function(e){return this._moduleManager.getModule(qo).modifyRemoteMessage(e)}},{key:\"getMessageList\",value:function(e){return this._moduleManager.getModule(jo).getMessageList(e)}},{key:\"getMessageListHopping\",value:function(e){return this._moduleManager.getModule(jo).getMessageListHopping(e)}},{key:\"sendMessageReadReceipt\",value:function(e){return this._moduleManager.getModule(jo).sendReadReceipt(e)}},{key:\"getMessageReadReceiptList\",value:function(e){return this._moduleManager.getModule(jo).getReadReceiptList(e)}},{key:\"getGroupMessageReadMemberList\",value:function(e){return this._moduleManager.getModule(Ko).getReadReceiptDetail(e)}},{key:\"findMessage\",value:function(e){return this._moduleManager.getModule(jo).findMessage(e)}},{key:\"setMessageRead\",value:function(e){return this._moduleManager.getModule(jo).setMessageRead(e)}},{key:\"getConversationList\",value:function(e){return this._moduleManager.getModule(jo).getConversationList(e)}},{key:\"getConversationProfile\",value:function(e){return this._moduleManager.getModule(jo).getConversationProfile(e)}},{key:\"deleteConversation\",value:function(e){return this._moduleManager.getModule(jo).deleteConversation(e)}},{key:\"clearHistoryMessage\",value:function(e){return this._moduleManager.getModule(jo).clearHistoryMessage(e)}},{key:\"pinConversation\",value:function(e){return this._moduleManager.getModule(jo).pinConversation(e)}},{key:\"setAllMessageRead\",value:function(e){return this._moduleManager.getModule(jo).setAllMessageRead(e)}},{key:\"setMessageRemindType\",value:function(e){return this._moduleManager.getModule(jo).setMessageRemindType(e)}},{key:\"getTotalUnreadMessageCount\",value:function(){return this._moduleManager.getModule(jo).getTotalUnreadMessageCount()}},{key:\"setConversationCustomData\",value:function(e){return this._moduleManager.getModule(jo).setConversationCustomData(e)}},{key:\"markConversation\",value:function(e){return this._moduleManager.getModule(jo).markConversation(e)}},{key:\"getConversationGroupList\",value:function(){return this._moduleManager.getModule(jo).getConversationGroupList()}},{key:\"createConversationGroup\",value:function(e){return this._moduleManager.getModule(jo).createConversationGroup(e)}},{key:\"deleteConversationGroup\",value:function(e){return this._moduleManager.getModule(jo).deleteConversationGroup(e)}},{key:\"renameConversationGroup\",value:function(e){return this._moduleManager.getModule(jo).renameConversationGroup(e)}},{key:\"addConversationsToGroup\",value:function(e){return this._moduleManager.getModule(jo).addConversationsToGroup(e)}},{key:\"deleteConversationsFromGroup\",value:function(e){return this._moduleManager.getModule(jo).deleteConversationsFromGroup(e)}},{key:\"getMyProfile\",value:function(){return this._moduleManager.getModule(Vo).getMyProfile()}},{key:\"getUserProfile\",value:function(e){return this._moduleManager.getModule(Vo).getUserProfile(e)}},{key:\"updateMyProfile\",value:function(e){return this._moduleManager.getModule(Vo).updateMyProfile(e)}},{key:\"getBlacklist\",value:function(){return this._moduleManager.getModule(Vo).getLocalBlacklist()}},{key:\"addToBlacklist\",value:function(e){return this._moduleManager.getModule(Vo).addBlacklist(e)}},{key:\"removeFromBlacklist\",value:function(e){return this._moduleManager.getModule(Vo).deleteBlacklist(e)}},{key:\"setSelfStatus\",value:function(e){return this._moduleManager.getModule(Vo).setSelfStatus(e)}},{key:\"getUserStatus\",value:function(e){return this._moduleManager.getModule(Vo).getUserStatus(e)}},{key:\"subscribeUserStatus\",value:function(e){return this._moduleManager.getModule(Vo).subscribeUserStatus(e)}},{key:\"unsubscribeUserStatus\",value:function(e){return this._moduleManager.getModule(Vo).unsubscribeUserStatus(e)}},{key:\"getFriendList\",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"addFriend\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.addFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"deleteFriend\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"checkFriend\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.checkFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getFriendProfile\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.getFriendProfile(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"updateFriend\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.updateFriend(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getFriendApplicationList\",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendApplicationList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"acceptFriendApplication\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.acceptFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"refuseFriendApplication\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.refuseFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"deleteFriendApplication\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriendApplication(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"setFriendApplicationRead\",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.setFriendApplicationRead():lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getFriendGroupList\",value:function(){var e=this._moduleManager.getModule(Ho);return e?e.getLocalFriendGroupList():lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"createFriendGroup\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.createFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"deleteFriendGroup\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.deleteFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"addToFriendGroup\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.addToFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"removeFromFriendGroup\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.removeFromFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"renameFriendGroup\",value:function(e){var t=this._moduleManager.getModule(Ho);return t?t.renameFriendGroup(e):lr({code:hn.CANNOT_FIND_MODULE})}},{key:\"getGroupList\",value:function(e){return this._moduleManager.getModule(Ko).getGroupList(e)}},{key:\"getGroupProfile\",value:function(e){return this._moduleManager.getModule(Ko).getGroupProfile(e)}},{key:\"createGroup\",value:function(e){return this._moduleManager.getModule(Ko).createGroup(e)}},{key:\"dismissGroup\",value:function(e){return this._moduleManager.getModule(Ko).dismissGroup(e)}},{key:\"updateGroupProfile\",value:function(e){return this._moduleManager.getModule(Ko).updateGroupProfile(e)}},{key:\"joinGroup\",value:function(e){return this._moduleManager.getModule(Ko).joinGroup(e)}},{key:\"quitGroup\",value:function(e){return this._moduleManager.getModule(Ko).quitGroup(e)}},{key:\"searchGroupByID\",value:function(e){return this._moduleManager.getModule(Ko).searchGroupByID(e)}},{key:\"getGroupOnlineMemberCount\",value:function(e){return this._moduleManager.getModule(Ko).getGroupOnlineMemberCount(e)}},{key:\"changeGroupOwner\",value:function(e){return this._moduleManager.getModule(Ko).changeGroupOwner(e)}},{key:\"getGroupApplicationList\",value:function(){return this._moduleManager.getModule(Ko).getGroupApplicationList()}},{key:\"handleGroupApplication\",value:function(e){return this._moduleManager.getModule(Ko).handleGroupApplication(e)}},{key:\"initGroupAttributes\",value:function(e){return this._moduleManager.getModule(Ko).initGroupAttributes(e)}},{key:\"setGroupAttributes\",value:function(e){return this._moduleManager.getModule(Ko).setGroupAttributes(e)}},{key:\"deleteGroupAttributes\",value:function(e){return this._moduleManager.getModule(Ko).deleteGroupAttributes(e)}},{key:\"getGroupAttributes\",value:function(e){return this._moduleManager.getModule(Ko).getGroupAttributes(e)}},{key:\"setGroupCounters\",value:function(e){return this._moduleManager.getModule(Ko).setGroupCounters(e)}},{key:\"increaseGroupCounter\",value:function(e){return this._moduleManager.getModule(Ko).increaseGroupCounter(e)}},{key:\"decreaseGroupCounter\",value:function(e){return this._moduleManager.getModule(Ko).decreaseGroupCounter(e)}},{key:\"getGroupCounters\",value:function(e){return this._moduleManager.getModule(Ko).getGroupCounters(e)}},{key:\"getGroupMemberList\",value:function(e){return this._moduleManager.getModule(Wo).getGroupMemberList(e)}},{key:\"getGroupMemberProfile\",value:function(e){return this._moduleManager.getModule(Wo).getGroupMemberProfile(e)}},{key:\"addGroupMember\",value:function(e){return this._moduleManager.getModule(Wo).addGroupMember(e)}},{key:\"deleteGroupMember\",value:function(e){return this._moduleManager.getModule(Wo).deleteGroupMember(e)}},{key:\"setGroupMemberMuteTime\",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberMuteTime(e)}},{key:\"setGroupMemberRole\",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberRole(e)}},{key:\"setGroupMemberNameCard\",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberNameCard(e)}},{key:\"setGroupMemberCustomField\",value:function(e){return this._moduleManager.getModule(Wo).setGroupMemberCustomField(e)}},{key:\"markGroupMemberList\",value:function(e){return this._moduleManager.getModule(Wo).markGroupMemberList(e)}},{key:\"getJoinedCommunityList\",value:function(){return this._moduleManager.getModule(Yo).getJoinedCommunityList()}},{key:\"createTopicInCommunity\",value:function(e){return this._moduleManager.getModule(Yo).createTopicInCommunity(e)}},{key:\"deleteTopicFromCommunity\",value:function(e){return this._moduleManager.getModule(Yo).deleteTopicFromCommunity(e)}},{key:\"updateTopicProfile\",value:function(e){return this._moduleManager.getModule(Yo).updateTopicProfile(e)}},{key:\"getTopicList\",value:function(e){return this._moduleManager.getModule(Yo).getTopicList(e)}}]),e}(),Sc={login:\"login\",logout:\"logout\",destroy:\"destroy\",on:\"on\",off:\"off\",ready:\"ready\",setLogLevel:\"setLogLevel\",joinGroup:\"joinGroup\",quitGroup:\"quitGroup\",registerPlugin:\"registerPlugin\",getGroupOnlineMemberCount:\"getGroupOnlineMemberCount\"};function Dc(e,t){if(e.isReady()||void 0!==Sc[t])return!0;var o=e.getNotReadyReason(),n=e.isIntl(),a=\"\";Object.getOwnPropertyNames(hn).forEach((function(e){hn[e]===o&&(a=n?mn[o]:fn[o])}));var s={code:o,message:\"\".concat(a,\" | \").concat(t,\" | \").concat(n?mn[hn.SDK_IS_NOT_READY]:fn[hn.SDK_IS_NOT_READY])};return e.onError(s),s}var Nc={},Ac={};return Ac.create=function(e){var o=0,n=e.SDKAppID,a=Qt(n);if(rt(n))o=n;else if(a?Ye.warn(\"TIM.create The type of the SDKAppID must be Number!\"):Ye.warn(\"TIM.create SDKAppID 的类型应该为 Number,请修改!\"),o=parseInt(n),isNaN(n))return a?Ye.error(\"TIM.create failed. Parse the SDKAppID failed, please check the arguments\"):Ye.error(\"TIM.create failed. 解析 SDKAppID 失败,请检查传参!\"),null;if(o&&Nc[o])return Nc[o];Ye.log(\"TIM.create\");var s=new Ec(t(t({},e),{},{SDKAppID:o}));s.on(S.SDK_DESTROY,(function(e){Nc[e.data.SDKAppID]=null,delete Nc[e.data.SDKAppID]}));var r=function(e){var t=Object.create(null);return Object.keys(wo).forEach((function(o){if(e[o]){var n=wo[o],a=new N;t[n]=function(){var t=Array.from(arguments);return a.use((function(t,n){var a=Dc(e,o);return!0===a?n():lr(a)})).use((function(e,t){if(!0===no(e,bo[o],n))return t()})).use((function(t,n){return e[o].apply(e,t)})),a.run(t)}}})),t}(s);return Nc[o]=r,bo.setIsIntl(a),Ye.log(\"TIM.create ok\"),r},Ac.TYPES=D,Ac.EVENT=S,Ac.VERSION=\"2.26.1\",Ye.log(\"TIM.VERSION:\".concat(Ac.VERSION)),Ac}));\r\n"]} \ No newline at end of file +{"version":3,"sources":["tim-wx.js"],"names":[],"mappings":";;;;;;;AAAA;AACA","file":"index.js","sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function _(e){if(void 0===e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e}function h(e,t){if(t&&(\"object\"==typeof t||\"function\"==typeof t))return t;if(void 0!==t)throw new TypeError(\"Derived constructors may only return object or undefined\");return _(e)}function f(e){var t=l();return function(){var n,o=u(e);if(t){var s=u(this).constructor;n=Reflect.construct(o,arguments,s)}else n=o.apply(this,arguments);return h(this,n)}}function v(e,t){return M(e)||function(e,t){var n=null==e?null:\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(null==n)return;var o,s,a=[],r=!0,i=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);r=!0);}catch(u){i=!0,s=u}finally{try{r||null==n.return||n.return()}finally{if(i)throw s}}return a}(e,t)||I(e,t)||T()}function m(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function M(e){if(Array.isArray(e))return e}function y(e){if(\"undefined\"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e[\"@@iterator\"])return Array.from(e)}function I(e,t){if(e){if(\"string\"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return\"Object\"===n&&e.constructor&&(n=e.constructor.name),\"Map\"===n||\"Set\"===n?Array.from(e):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var a,r=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){i=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(i)throw a}}}}var E={SDK_READY:\"sdkStateReady\",SDK_NOT_READY:\"sdkStateNotReady\",SDK_DESTROY:\"sdkDestroy\",MESSAGE_RECEIVED:\"onMessageReceived\",MESSAGE_MODIFIED:\"onMessageModified\",MESSAGE_REVOKED:\"onMessageRevoked\",MESSAGE_READ_BY_PEER:\"onMessageReadByPeer\",MESSAGE_READ_RECEIPT_RECEIVED:\"onMessageReadReceiptReceived\",MESSAGE_EXTENSIONS_UPDATED:\"onMessageExtensionsUpdated\",MESSAGE_EXTENSIONS_DELETED:\"onMessageExtensionsDeleted\",CONVERSATION_LIST_UPDATED:\"onConversationListUpdated\",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:\"onTotalUnreadMessageCountUpdated\",CONVERSATION_GROUP_LIST_UPDATED:\"onConversationGroupListUpdated\",CONVERSATION_IN_GROUP_UPDATED:\"onConversationInGroupUpdated\",GROUP_LIST_UPDATED:\"onGroupListUpdated\",GROUP_SYSTEM_NOTICE_RECEIVED:\"receiveGroupSystemNotice\",GROUP_ATTRIBUTES_UPDATED:\"groupAttributesUpdated\",GROUP_COUNTER_UPDATED:\"onGroupCounterUpdated\",TOPIC_CREATED:\"onTopicCreated\",TOPIC_DELETED:\"onTopicDeleted\",TOPIC_UPDATED:\"onTopicUpdated\",PROFILE_UPDATED:\"onProfileUpdated\",USER_STATUS_UPDATED:\"onUserStatusUpdated\",BLACKLIST_UPDATED:\"blacklistUpdated\",FRIEND_LIST_UPDATED:\"onFriendListUpdated\",FRIEND_GROUP_LIST_UPDATED:\"onFriendGroupListUpdated\",FRIEND_APPLICATION_LIST_UPDATED:\"onFriendApplicationListUpdated\",KICKED_OUT:\"kickedOut\",ERROR:\"error\",NET_STATE_CHANGE:\"netStateChange\",SDK_RELOAD:\"sdkReload\"},S={MSG_TEXT:\"TIMTextElem\",MSG_IMAGE:\"TIMImageElem\",MSG_SOUND:\"TIMSoundElem\",MSG_AUDIO:\"TIMSoundElem\",MSG_FILE:\"TIMFileElem\",MSG_FACE:\"TIMFaceElem\",MSG_VIDEO:\"TIMVideoFileElem\",MSG_GEO:\"TIMLocationElem\",MSG_LOCATION:\"TIMLocationElem\",MSG_GRP_TIP:\"TIMGroupTipElem\",MSG_GRP_SYS_NOTICE:\"TIMGroupSystemNoticeElem\",MSG_CUSTOM:\"TIMCustomElem\",MSG_MERGER:\"TIMRelayElem\",MSG_PRIORITY_HIGH:\"High\",MSG_PRIORITY_NORMAL:\"Normal\",MSG_PRIORITY_LOW:\"Low\",MSG_PRIORITY_LOWEST:\"Lowest\",CONV_C2C:\"C2C\",CONV_GROUP:\"GROUP\",CONV_TOPIC:\"TOPIC\",CONV_SYSTEM:\"@TIM#SYSTEM\",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:\"Private\",GRP_WORK:\"Private\",GRP_PUBLIC:\"Public\",GRP_CHATROOM:\"ChatRoom\",GRP_MEETING:\"ChatRoom\",GRP_AVCHATROOM:\"AVChatRoom\",GRP_COMMUNITY:\"Community\",GRP_MBR_ROLE_OWNER:\"Owner\",GRP_MBR_ROLE_ADMIN:\"Admin\",GRP_MBR_ROLE_MEMBER:\"Member\",GRP_MBR_ROLE_CUSTOM:\"Custom\",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:\"AcceptAndNotify\",MSG_REMIND_ACPT_NOT_NOTE:\"AcceptNotNotify\",MSG_REMIND_DISCARD:\"Discard\",GENDER_UNKNOWN:\"Gender_Type_Unknown\",GENDER_FEMALE:\"Gender_Type_Female\",GENDER_MALE:\"Gender_Type_Male\",KICKED_OUT_MULT_ACCOUNT:\"multipleAccount\",KICKED_OUT_MULT_DEVICE:\"multipleDevice\",KICKED_OUT_USERSIG_EXPIRED:\"userSigExpired\",KICKED_OUT_REST_API:\"REST_API_Kick\",ALLOW_TYPE_ALLOW_ANY:\"AllowType_Type_AllowAny\",ALLOW_TYPE_NEED_CONFIRM:\"AllowType_Type_NeedConfirm\",ALLOW_TYPE_DENY_ANY:\"AllowType_Type_DenyAny\",FORBID_TYPE_NONE:\"AdminForbid_Type_None\",FORBID_TYPE_SEND_OUT:\"AdminForbid_Type_SendOut\",JOIN_OPTIONS_FREE_ACCESS:\"FreeAccess\",JOIN_OPTIONS_NEED_PERMISSION:\"NeedPermission\",JOIN_OPTIONS_DISABLE_APPLY:\"DisableApply\",JOIN_STATUS_SUCCESS:\"JoinedSuccess\",JOIN_STATUS_ALREADY_IN_GROUP:\"AlreadyInGroup\",JOIN_STATUS_WAIT_APPROVAL:\"WaitAdminApproval\",INVITE_OPTIONS_DISABLE_INVITE:\"DisableInvite\",INVITE_OPTIONS_NEED_PERMISSION:\"NeedPermission\",INVITE_OPTIONS_FREE_ACCESS:\"FreeAccess\",GRP_PROFILE_OWNER_ID:\"ownerID\",GRP_PROFILE_CREATE_TIME:\"createTime\",GRP_PROFILE_LAST_INFO_TIME:\"lastInfoTime\",GRP_PROFILE_MEMBER_NUM:\"memberNum\",GRP_PROFILE_MAX_MEMBER_NUM:\"maxMemberNum\",GRP_PROFILE_JOIN_OPTION:\"joinOption\",GRP_PROFILE_INVITE_OPTION:\"inviteOption\",GRP_PROFILE_INTRODUCTION:\"introduction\",GRP_PROFILE_NOTIFICATION:\"notification\",GRP_PROFILE_MUTE_ALL_MBRS:\"muteAllMembers\",SNS_ADD_TYPE_SINGLE:\"Add_Type_Single\",SNS_ADD_TYPE_BOTH:\"Add_Type_Both\",SNS_DELETE_TYPE_SINGLE:\"Delete_Type_Single\",SNS_DELETE_TYPE_BOTH:\"Delete_Type_Both\",SNS_APPLICATION_TYPE_BOTH:\"Pendency_Type_Both\",SNS_APPLICATION_SENT_TO_ME:\"Pendency_Type_ComeIn\",SNS_APPLICATION_SENT_BY_ME:\"Pendency_Type_SendOut\",SNS_APPLICATION_AGREE:\"Response_Action_Agree\",SNS_APPLICATION_AGREE_AND_ADD:\"Response_Action_AgreeAndAdd\",SNS_CHECK_TYPE_BOTH:\"CheckResult_Type_Both\",SNS_CHECK_TYPE_SINGLE:\"CheckResult_Type_Single\",SNS_TYPE_NO_RELATION:\"CheckResult_Type_NoRelation\",SNS_TYPE_A_WITH_B:\"CheckResult_Type_AWithB\",SNS_TYPE_B_WITH_A:\"CheckResult_Type_BWithA\",SNS_TYPE_BOTH_WAY:\"CheckResult_Type_BothWay\",NET_STATE_CONNECTED:\"connected\",NET_STATE_CONNECTING:\"connecting\",NET_STATE_DISCONNECTED:\"disconnected\",MSG_AT_ALL:\"__kImSDK_MesssageAtALL__\",READ_ALL_C2C_MSG:\"readAllC2CMessage\",READ_ALL_GROUP_MSG:\"readAllGroupMessage\",READ_ALL_MSG:\"readAllMessage\",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},k=function(){function e(){o(this,e),this.cache=[],this.options=null}return a(e,[{key:\"use\",value:function(e){if(\"function\"!=typeof e)throw\"middleware must be a function\";return this.cache.push(e),this}},{key:\"next\",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:\"run\",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return a(e,[{key:\"equal\",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:\"toString\",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t=\"0\"+t,n--;return e+t}}]),e}(),A={TEST:{CHINA:{DEFAULT:\"wss://wss-dev.tim.qq.com\"},OVERSEA:{DEFAULT:\"wss://wss-dev.tim.qq.com\"},SINGAPORE:{DEFAULT:\"wss://wsssgp-dev.im.qcloud.com\"},KOREA:{DEFAULT:\"wss://wsskr-dev.im.qcloud.com\"},GERMANY:{DEFAULT:\"wss://wssger-dev.im.qcloud.com\"},IND:{DEFAULT:\"wss://wssind-dev.im.qcloud.com\"},JPN:{DEFAULT:\"wss://wssjpn-dev.im.qcloud.com\"},USA:{DEFAULT:\"wss://wssusa-dev.im.qcloud.com\"}},PRODUCTION:{CHINA:{DEFAULT:\"wss://wss.im.qcloud.com\",BACKUP:\"wss://wss.tim.qq.com\",STAT:\"https://events.im.qcloud.com\",ANYCAST:\"wss://162.14.13.203\"},OVERSEA:{DEFAULT:\"wss://wss.im.qcloud.com\",BACKUP:\"wss://wss.my-imcloud.com\",STAT:\"https://api.my-imcloud.com\"},SINGAPORE:{DEFAULT:\"wss://wsssgp.im.qcloud.com\",BACKUP:\"wss://wsssgp.my-imcloud.com\",STAT:\"https://apisgp.my-imcloud.com\"},KOREA:{DEFAULT:\"wss://wsskr.im.qcloud.com\",BACKUP:\"wss://wsskr.my-imcloud.com\",STAT:\"https://apikr.my-imcloud.com\"},GERMANY:{DEFAULT:\"wss://wssger.im.qcloud.com\",BACKUP:\"wss://wssger.my-imcloud.com\",STAT:\"https://apiger.my-imcloud.com\"},IND:{DEFAULT:\"wss://wssind.my-imcloud.com\",BACKUP:\"wss://wssind.im.qcloud.com\",STAT:\"https://apiind.my-imcloud.com\"},JPN:{DEFAULT:\"wss://wssjpn.im.qcloud.com\",BACKUP:\"wss://wssjpn.my-imcloud.com\",STAT:\"https://apijpn.my-imcloud.com\"},USA:{DEFAULT:\"wss://wssusa.im.qcloud.com\",BACKUP:\"wss://wssusa.my-imcloud.com\",STAT:\"https://apiusa.my-imcloud.com\"}}},R={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15},N=\"1.7.3\",O=537048168,G=\"CHINA\",U=\"OVERSEA\",P=\"SINGAPORE\",b=\"KOREA\",w=\"GERMANY\",F=\"IND\",q=\"JPN\",x=\"USA\",V={HOST:{CURRENT:{DEFAULT:\"wss://wss.im.qcloud.com\",STAT:\"https://events.im.qcloud.com\"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;this.CURRENT=A.PRODUCTION[e]}},NAME:{OPEN_IM:\"openim\",OPEN_IM_MSG_EXT:\"openim_msg_ext_http_svc\",GROUP:\"group_open_http_svc\",GROUP_AVCHATROOM:\"group_open_avchatroom_http_svc\",GROUP_COMMUNITY:\"million_group_open_http_svc\",GROUP_ATTR:\"group_open_attr_http_svc\",FRIEND:\"sns\",PROFILE:\"profile\",RECENT_CONTACT:\"recentcontact\",PIC:\"openpic\",BIG_GROUP_NO_AUTH:\"group_open_http_noauth_svc\",BIG_GROUP_LONG_POLLING:\"group_open_long_polling_http_svc\",BIG_GROUP_LONG_POLLING_NO_AUTH:\"group_open_long_polling_http_noauth_svc\",IM_OPEN_STAT:\"imopenstat\",WEB_IM:\"webim\",IM_COS_SIGN:\"im_cos_sign_svr\",CUSTOM_UPLOAD:\"im_cos_msg\",HEARTBEAT:\"heartbeat\",IM_OPEN_PUSH:\"im_open_push\",IM_OPEN_STATUS:\"im_open_status\",IM_LONG_MESSAGE:\"im_long_msg\",IM_CONFIG_MANAGER:\"im_sdk_config_mgr\",STAT_SERVICE:\"StatSvc\",OVERLOAD_PUSH:\"OverLoadPush\",IM_MSG_AUDIT_MGR:\"im_msg_audit_mgr\",TUIROOM_SVR:\"tui_room_svr\",IM_OPEN_TRANSLATE:\"im_open_translate\"},CMD:{LOGIN:\"wslogin\",LOGOUT_LONG_POLL:\"longpollinglogout\",LOGOUT:\"wslogout\",HELLO:\"wshello\",STAT_BACKGROUND:\"ws_stat_background\",STAT_FOREGROUND:\"ws_stat_foreground\",SET_TOKEN:\"ws_stat_settoken\",PORTRAIT_GET:\"portrait_get_all\",PORTRAIT_SET:\"portrait_set\",GET_LONG_POLL_ID:\"getlongpollingid\",LONG_POLL:\"longpolling\",AVCHATROOM_LONG_POLL:\"get_msg\",ADD_FRIEND:\"friend_add\",UPDATE_FRIEND:\"friend_update\",GET_FRIEND_LIST:\"friend_get\",GET_FRIEND_PROFILE:\"friend_get_specified\",DELETE_FRIEND:\"friend_delete\",CHECK_FRIEND:\"friend_check\",GET_FRIEND_GROUP_LIST:\"group_get\",RESPOND_FRIEND_APPLICATION:\"friend_response\",GET_FRIEND_APPLICATION_LIST:\"pendency_get\",DELETE_FRIEND_APPLICATION:\"pendency_delete\",REPORT_FRIEND_APPLICATION:\"pendency_report\",GET_GROUP_APPLICATION:\"get_pendency\",CREATE_FRIEND_GROUP:\"group_add\",DELETE_FRIEND_GROUP:\"group_delete\",UPDATE_FRIEND_GROUP:\"group_update\",GET_BLACKLIST:\"black_list_get\",ADD_BLACKLIST:\"black_list_add\",DELETE_BLACKLIST:\"black_list_delete\",CREATE_GROUP:\"create_group\",GET_JOINED_GROUPS:\"get_joined_group_list\",SET_GROUP_ATTRIBUTES:\"set_group_attr\",MODIFY_GROUP_ATTRIBUTES:\"modify_group_attr\",DELETE_GROUP_ATTRIBUTES:\"delete_group_attr\",CLEAR_GROUP_ATTRIBUTES:\"clear_group_attr\",GET_GROUP_ATTRIBUTES:\"get_group_attr\",SEND_MESSAGE:\"sendmsg\",REVOKE_C2C_MESSAGE:\"msgwithdraw\",DELETE_C2C_MESSAGE:\"delete_c2c_msg_ramble\",MODIFY_C2C_MESSAGE:\"modify_c2c_msg\",MODIFY_C2C_MESSAGE_EXTENSIONS:\"set_key_values\",GET_C2C_MESSAGE_EXTENSIONS:\"get_key_values\",SEND_GROUP_MESSAGE:\"send_group_msg\",REVOKE_GROUP_MESSAGE:\"group_msg_recall\",DELETE_GROUP_MESSAGE:\"delete_group_ramble_msg_by_seq\",MODIFY_GROUP_MESSAGE:\"modify_group_msg\",MODIFY_GROUP_MESSAGE_EXTENSIONS:\"group_set_key_values\",GET_GROUP_MESSAGE_EXTENSIONS:\"group_get_key_values\",GET_GROUP_INFO:\"get_group_self_member_info\",GET_GROUP_MEMBER_INFO:\"get_specified_group_member_info\",GET_GROUP_MEMBER_LIST:\"get_group_member_info\",GET_AVCHATROOM_MEMBER_LIST:\"get_members\",MARK_AVCHATROOM_MEMBER_INFO:\"modify_user_info\",QUIT_GROUP:\"quit_group\",CHANGE_GROUP_OWNER:\"change_group_owner\",DESTROY_GROUP:\"destroy_group\",ADD_GROUP_MEMBER:\"add_group_member\",DELETE_GROUP_MEMBER:\"delete_group_member\",BAN_AVCHATROOM_MEMBER:\"ban_group_member\",SEARCH_GROUP_BY_ID:\"get_group_public_info\",APPLY_JOIN_GROUP:\"apply_join_group\",HANDLE_APPLY_JOIN_GROUP:\"handle_apply_join_group\",HANDLE_INVITE_JOIN_GROUP:\"handle_invite_join_permission_group\",HANDLE_GROUP_INVITATION:\"handle_invite_join_group\",MODIFY_GROUP_INFO:\"modify_group_base_info\",MODIFY_GROUP_MEMBER_INFO:\"modify_group_member_info\",DELETE_GROUP_SYSTEM_MESSAGE:\"deletemsg\",DELETE_GROUP_AT_TIPS:\"deletemsg\",GET_GROUP_NOTIFY:\"get_group_notify\",GET_CONVERSATION_LIST:\"get\",PAGING_GET_CONVERSATION_LIST:\"page_get\",DELETE_CONVERSATION:\"batch_delete\",CLEAR_HISTORY_MESSAGE:\"clear_msg\",PIN_CONVERSATION:\"top\",SET_CONVERSATION_CUSTOM_DATA:\"mark_contact\",MARK_CONVERSATION:\"mark_contact\",CREATE_CONVERSATION_GROUP:\"create_contact_group\",DELETE_CONVERSATION_GROUP:\"del_contact_group\",UPDATE_CONVERSATION_GROUP:\"update_contact_group\",GET_CONVERSATION_GROUP_LIST:\"get_contact_group\",GET_MESSAGES:\"getmsg\",GET_C2C_ROAM_MESSAGES:\"getroammsg\",SET_C2C_PEER_MUTE_NOTIFICATIONS:\"set_c2c_peer_mute_notifications\",GET_C2C_PEER_MUTE_NOTIFICATIONS:\"get_c2c_peer_mute_notifications\",GET_GROUP_ROAM_MESSAGES:\"group_msg_get\",GET_READ_RECEIPT:\"get_group_msg_receipt\",GET_READ_RECEIPT_DETAIL:\"get_group_msg_receipt_detail\",SEND_READ_RECEIPT:\"group_msg_receipt\",SEND_C2C_READ_RECEIPT:\"c2c_msg_read_receipt\",SET_C2C_MESSAGE_READ:\"msgreaded\",GET_PEER_READ_TIME:\"get_peer_read_time\",SET_GROUP_MESSAGE_READ:\"msg_read_report\",FILE_READ_AND_WRITE_AUTHKEY:\"authkey\",FILE_UPLOAD:\"pic_up\",COS_SIGN:\"cos\",COS_PRE_SIG:\"pre_sig\",VIDEO_COVER:\"video_cover\",TIM_WEB_REPORT_V2:\"tim_web_report_v2\",BIG_DATA_HALLWAY_AUTH_KEY:\"authkey\",GET_ONLINE_MEMBER_NUM:\"get_online_member_num\",ALIVE:\"alive\",MESSAGE_PUSH:\"msg_push\",MULTI_MESSAGE_PUSH:\"multi_msg_push_ws\",MESSAGE_PUSH_ACK:\"ws_msg_push_ack\",STATUS_FORCE_OFFLINE:\"stat_forceoffline\",DOWNLOAD_MERGER_MESSAGE:\"get_relay_json_msg\",UPLOAD_MERGER_MESSAGE:\"save_relay_json_msg\",FETCH_CLOUD_CONTROL_CONFIG:\"fetch_config\",PUSHED_CLOUD_CONTROL_CONFIG:\"push_configv2\",FETCH_COMMERCIAL_CONFIG:\"fetch_imsdk_purchase_bitsv2\",PUSHED_COMMERCIAL_CONFIG:\"push_imsdk_purchase_bitsv2\",KICK_OTHER:\"KickOther\",OVERLOAD_NOTIFY:\"notify2\",SET_ALL_MESSAGE_READ:\"read_all_unread_msg\",CREATE_TOPIC:\"create_topic\",DELETE_TOPIC:\"destroy_topic\",UPDATE_TOPIC_PROFILE:\"modify_topic\",GET_TOPIC_LIST:\"get_topic\",SET_SELF_STATUS:\"ws_set_custom_status\",GET_USER_STATUS:\"ws_get_user_status\",SUBSCRIBE_USER_STATUS:\"ws_status_subscribe\",UNSUBSCRIBE_USER_STATUS:\"ws_status_unsubscribe\",GET_RPOFANITY_LIST:\"get_local_words\",TRANSLATE_TEXT:\"ws_batch_trans_text\",UPDATE_GROUP_COUNTER:\"update_group_counter\",GET_GROUP_COUNTER:\"get_group_counter\"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:\"v4\",group_open_http_svc:\"v4\",sns:\"v4\",profile:\"v4\",recentcontact:\"v4\",openpic:\"v4\",group_open_http_noauth_svc:\"v4\",group_open_long_polling_http_svc:\"v4\",group_open_long_polling_http_noauth_svc:\"v4\",imopenstat:\"v4\",im_cos_sign_svr:\"v4\",im_cos_msg:\"v4\",webim:\"v4\",im_open_push:\"v4\",im_open_status:\"v4\"}},B={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString(),GRP_COUNTER:new L(0,Math.pow(2,15)).toString()},H=\"c2c_text_message\",K=\"c2c_custom_message\",W=\"group_text_message\",Y=\"group_custom_message\",j=\"user_profile\",z=\"group_profile\",J=\"group_member_profile\";V.HOST.setCurrent(G);var X=\"undefined\"!=typeof wx&&\"function\"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Q=\"undefined\"!=typeof qq&&\"function\"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),Z=\"undefined\"!=typeof tt&&\"function\"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),$=\"undefined\"!=typeof swan&&\"function\"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ee=\"undefined\"!=typeof my&&\"function\"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),te=\"undefined\"!=typeof jd&&\"function\"==typeof jd.getSystemInfoSync,ne=\"undefined\"!=typeof uni&&\"undefined\"==typeof window&&\"function\"==typeof uni.requireNativePlugin,oe=\"undefined\"!=typeof uni,se=X||Q||Z||$||ee||ne||te,ae=(\"undefined\"!=typeof uni||\"undefined\"!=typeof window)&&!se,re=Q?qq:Z?tt:$?swan:ee?my:X?wx:ne?uni:te?jd:{},ie=ae&&window&&window.navigator&&window.navigator.userAgent||\"\",ue=/(micromessenger|webbrowser)/i.test(ie),ce=/AppleWebKit\\/([\\d.]+)/i.exec(ie);ce&&parseFloat(ce.pop());var le,pe,de=(le=\"WEB\",ue?le=\"WEB\":Q?le=\"QQ_MP\":Z?le=\"TT_MP\":$?le=\"BAIDU_MP\":ee?le=\"ALI_MP\":X?le=\"WX_MP\":ne&&(le=\"UNI_NATIVE_APP\"),R[le]),ge=/iPad/i.test(ie),_e=/iPhone/i.test(ie)&&!ge,he=/iPod/i.test(ie),fe=_e||ge||he,ve=(pe=ie.match(/OS (\\d+)_/i))&&pe[1]?pe[1]:null,me=/Android/i.test(ie),Me=function(){var e=ie.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+\".\"+e[2]):t||null}();!function(){var e=ie.match(/Chrome\\/(\\d+)/);e&&e[1]&&parseFloat(e[1])}();var ye=/MSIE/.test(ie)||ie.indexOf(\"Trident\")>-1&&ie.indexOf(\"rv:11.0\")>-1,Ie=function(){var e=/MSIE\\s(\\d+)\\.\\d/.exec(ie),t=e&&parseFloat(e[1]);return!t&&/Trident\\/7.0/i.test(ie)&&/rv:11.0/.test(ie)&&(t=11),t}();!function(){var e=ie.match(/TBS\\/(\\d+)/i);if(e&&e[1])e[1]}();var Ce,Te,De=/Windows/i.test(ie),Ee=/MAC OS X/i.test(ie),Se=ae&&\"undefined\"!=typeof Worker&&!ye,ke=me||fe,Le=ae&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy;Ce=\"undefined\"!=typeof console?console:\"undefined\"!=typeof global&&global.console?global.console:\"undefined\"!=typeof window&&window.console?window.console:{};for(var Ae=function(){},Re=[\"assert\",\"clear\",\"count\",\"debug\",\"dir\",\"dirxml\",\"error\",\"group\",\"groupCollapsed\",\"groupEnd\",\"info\",\"log\",\"profile\",\"profileEnd\",\"table\",\"time\",\"timeEnd\",\"timeStamp\",\"trace\",\"warn\"],Ne=Re.length;Ne--;)Te=Re[Ne],console[Te]||(Ce[Te]=Ae);var Oe=Ce,Ge=0,Ue=function(){return(new Date).getTime()+Ge},Pe=function(){Ge=0},be=function(){return Math.floor(Ue()/1e3)},we=0;function Fe(){return Ht()?\"%c TIM %c\":\"TIM\"}function qe(){var e,t=((e=new Date).setTime(Ue()),e);return t.toLocaleTimeString(\"en-US\",{hour12:!1})+\".\"+function(e){var t;switch(e.toString().length){case 1:t=\"00\"+e;break;case 2:t=\"0\"+e;break;default:t=e}return t}(t.getMilliseconds())}var xe={arguments2String:function(e){var t=\"\";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n=0?o[a]=t[a]:o[a]=e(t[a])):o[a]=void 0:o[a]=null;return o};function It(e,t){if(!st(e)||!st(t))return!1;var n=!1;return t.forEach((function(t){var o=t.key,s=t.value,a=e.find((function(e){return e.key===o}));a?a.value!==s&&(a.value=s,n=!0):(e.push({key:o,value:s}),n=!0)})),n}var Ct=function(e){return e===S.GRP_AVCHATROOM},Tt=function(e){var t=e.type,n=e.groupID;return t===S.GRP_COMMUNITY||\"\".concat(n).startsWith(ze)&&!\"\".concat(n).includes(Je)},Dt=function(e){return\"\".concat(e).startsWith(ze)&&\"\".concat(e).includes(Je)},Et=function(e){return et(e)&&e.slice(0,3)===S.CONV_C2C},St=function(e){return et(e)&&e.slice(0,5)===S.CONV_GROUP},kt=function(e){return et(e)&&e===S.CONV_SYSTEM};function Lt(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function At(e){return se?new Promise((function(t,n){re.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):ye&&9===Ie?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Rt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return\"\".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Nt(){var e=\"unknown\";if(Ee&&(e=\"mac\"),De&&(e=\"windows\"),fe&&(e=\"ios\"),me&&(e=\"android\"),se)try{var t=re.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function Ot(e,t){e=e.split(\".\"),t=t.split(\".\");for(var n=Math.max(e.length,t.length);e.lengtha)return 1;if(s-1?\"\".concat(n,\"&\"):\"\".concat(n,\"?\");c.url=\"\".concat(l,198===r?\"imageView2/3/w/198/h/198\":\"imageView2/3/w/720/h/720\")}return at(n)?(c.url,g(c,Xe)):c}function Ut(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n=0;o--)\"1\"===e[o]&&t.push(Math.pow(2,n-o-1));return t}function Ht(){return!ye&&!se}function Kt(e){return\"the length of userIDList cannot exceed \".concat(e)}function Wt(e,t){if(e){var n=e;return t&&(e.startsWith(\"http://\")?n=e.replace(/^http:\\/\\/[^/]+/,t):e.startsWith(\"https://\")&&(n=e.replace(/^https:\\/\\/[^/]+/,t))),n}}var Yt=Object.prototype.hasOwnProperty;function jt(e){if(null==e)return!0;if(\"boolean\"==typeof e)return!1;if(\"number\"==typeof e)return 0===e;if(\"string\"==typeof e)return 0===e.length;if(\"function\"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return\"\"===e.message;if(ot(e)){for(var t in e)if(Yt.call(e,t))return!1;return!0}return!(!Qe(e)&&(n=e,\"set\"!==ct(n))&&!Ze(e))&&0===e.size;var n}function zt(e,t,n){if(void 0===t)return!0;var o=!0;if(ot(t))Object.keys(t).forEach((function(s){var a=1===e.length?e[0][s]:void 0;o=!!Jt(a,t[s],n,s)&&o}));else if(st(t))for(var s=0;s256)||(en({api:\"setConversationCustomData\",param:\"customData\",desc:dn(\"customData\",256)}),!1):(en({api:\"setConversationCustomData\",param:\"customData\",desc:tn()}),!1)}}},markConversation:{conversationIDList:t({},Cn),markType:{type:\"number\",validator:function(e){return $e(e)?e<=0?(en({api:\"markConversation\",param:\"markType\",desc:(t=\"markType\",n=0,Sn(\"NumberGreaterThanLog\",t,n))}),!1):!(e>=Math.pow(2,64))||(en({api:\"markConversation\",param:\"markType\",desc:gn(\"markType\",\"Math.pow(2,64)\")}),!1):(en({api:\"markConversation\",param:\"markType\",desc:on()}),!1);var t,n}},enableMark:t({},Dn)},createConversationGroup:{conversationIDList:t({},Cn),groupName:t(t({},In),{},{validator:function(e){return!!e&&(!(e.length>32)||(en({api:\"createConversationGroup\",param:\"groupName\",desc:dn(\"groupName\",32)}),!1))}})},deleteConversationGroup:[t({name:\"groupName\"},In)],renameConversationGroup:{oldName:t({},In),newName:t(t({},In),{},{validator:function(e){return!!e&&(!(e.length>32)||(en({api:\"renameConversationGroup\",param:\"newName\",desc:dn(\"newName\",32)}),!1))}})},addConversationsToGroup:{conversationIDList:t({},Cn),groupName:t({},In)},deleteConversationsFromGroup:{conversationIDList:t({},Cn),groupName:t({},In)},getGroupList:{groupProfileFilter:{type:\"Array\"}},getGroupProfile:{groupID:In,groupCustomFieldFilter:{type:\"Array\"},memberCustomFieldFilter:{type:\"Array\"}},getGroupProfileAdvance:{groupIDList:Cn},createGroup:{name:In},joinGroup:{groupID:In,type:{type:\"String\"},applyMessage:{type:\"String\"}},quitGroup:[t({name:\"groupID\"},In)],handleApplication:{message:Tn,handleAction:In,handleMessage:{type:\"String\"}},changeGroupOwner:{groupID:In,newOwnerID:In},updateGroupProfile:{groupID:In,muteAllMembers:{type:\"Boolean\"}},dismissGroup:[t({name:\"groupID\"},In)],searchGroupByID:[t({name:\"groupID\"},In)],initGroupAttributes:{groupID:In,groupAttributes:t(t({},Tn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!et(e[n]))return en({api:\"initGroupAttributes\",param:\"groupAttributes\",desc:_n(\"value\")}),t=!1})),t}})},setGroupAttributes:{groupID:In,groupAttributes:t(t({},Tn),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!et(e[n]))return en({api:\"setGroupAttributes\",param:\"groupAttributes\",desc:_n(\"value\")}),t=!1})),t}})},deleteGroupAttributes:{groupID:In,keyList:{type:\"Array\",validator:function(e){if(at(e)||!st(e))return en({api:\"deleteGroupAttributes\",param:\"keyList\",desc:un()}),!1;if(!jt(e)){var t=!0;return e.forEach((function(e){if(!et(e))return en({api:\"deleteGroupAttributes\",param:\"keyList\",desc:Sn(\"StringArrayRequiredLog\")}),t=!1})),t}return!0}}},getGroupAttributes:{groupID:In,keyList:{type:\"Array\",validator:function(e){if(at(e)||!st(e))return en({api:\"getGroupAttributes\",param:\"keyList\",desc:un()}),!1;if(!jt(e)){var t=!0;return e.forEach((function(e){if(!et(e))return en({api:\"getGroupAttributes\",param:\"keyList\",desc:_n(\"key\")}),t=!1})),t}return!0}}},setGroupCounters:{groupID:In,counters:Tn},increaseGroupCounter:{groupID:In,key:In,value:En},decreaseGroupCounter:{groupID:In,key:In,value:En},getGroupCounters:{groupID:In},getGroupMemberList:{groupID:In,count:{type:\"Number\"}},getGroupMemberProfile:{groupID:In,userIDList:Cn,memberCustomFieldFilter:{type:\"Array\"}},addGroupMember:{groupID:In,userIDList:Cn},setGroupMemberRole:{groupID:In,userID:In,role:In},setGroupMemberMuteTime:{groupID:In,userID:In,muteTime:{type:\"Number\",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:In,userID:{type:\"String\"},nameCard:{type:\"String\",validator:function(e){return et(e)?(e.length,!0):(en({api:\"setGroupMemberNameCard\",param:\"nameCard\",desc:tn()}),!1)}}},setGroupMemberCustomField:{groupID:In,userID:{type:\"String\"},memberCustomField:Cn},deleteGroupMember:{groupID:In},markGroupMemberList:{groupID:In,markType:{type:\"number\",validator:function(e){return $e(e)?!(e<1e3)||(en({api:\"markGroupMemberList\",param:\"markType\",desc:(t=\"markType\",n=1e3,Sn(\"NumberGreaterOrEqualLog\",t,n))}),!1):(en({api:\"markGroupMemberList\",param:\"markType\",desc:on()}),!1);var t,n}},userIDList:t({},Cn),enableMark:t({},Dn)},createTextMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.text)?0!==e.text.length||(en({api:\"createTextMessage\",param:\"payload.text\",desc:fn()}),!1):(en({api:\"createTextMessage\",param:\"payload.text\",desc:tn()}),!1):(en({api:\"createTextMessage\",param:\"payload\",desc:hn()}),!1)}})},createTextAtMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.text)?0===e.text.length?(en({api:\"createTextAtMessage\",param:\"payload.text\",desc:fn()}),!1):!(e.atUserList&&!st(e.atUserList))||(en({api:\"createTextAtMessage\",param:\"payload.atUserList\",desc:un()}),!1):(en({api:\"createTextAtMessage\",param:\"payload.text\",desc:tn()}),!1):(en({api:\"createTextAtMessage\",param:\"payload\",desc:hn()}),!1)}})},createCustomMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?e.data&&!et(e.data)?(en({api:\"createCustomMessage\",param:\"payload.data\",desc:tn()}),!1):e.description&&!et(e.description)?(en({api:\"createCustomMessage\",param:\"payload.description\",desc:tn()}),!1):!(e.extension&&!et(e.extension))||(en({api:\"createCustomMessage\",param:\"payload.extension\",desc:tn()}),!1):(en({api:\"createCustomMessage\",param:\"payload\",desc:hn()}),!1)}})},createImageMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:\"createImageMessage\",param:\"payload\",desc:hn()}),!1;if(at(e.file))return en({api:\"createImageMessage\",param:\"payload.file\",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&\"undefined\"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(en({api:\"createImageMessage\",param:\"payload.file\",desc:vn()}),!1):(en({api:\"createImageMessage\",param:\"payload.file\",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:\"createImageMessage\",param:\"payload.file\",desc:vn()}),!1}return!0},onProgress:{type:\"Function\",required:!1,validator:function(e){return at(e)&&en({api:\"createImageMessage\",param:\"onProgress\",desc:ln()}),!0}}})},createAudioMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return!!ot(e)||(en({api:\"createAudioMessage\",param:\"payload\",desc:hn()}),!1)}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return at(e)&&en({api:\"createAudioMessage\",param:\"onProgress\",desc:ln()}),!0}}},createVideoMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:\"createVideoMessage\",param:\"payload\",desc:hn()}),!1;if(at(e.file))return en({api:\"createVideoMessage\",param:\"payload.file\",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&\"undefined\"!=typeof uni?!!Ze(e.file.tempFile)||(en({api:\"createVideoMessage\",param:\"payload.file\",desc:vn()}),!1):(en({api:\"createVideoMessage\",param:\"payload.file\",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:\"createVideoMessage\",param:\"payload.file\",desc:vn()}),!1}return!0}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return at(e)&&en({api:\"createVideoMessage\",param:\"onProgress\",desc:ln()}),!0}}},createFaceMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?$e(e.index)?!!et(e.data)||(en({api:\"createFaceMessage\",param:\"payload.data\",desc:tn()}),!1):(en({api:\"createFaceMessage\",param:\"payload.index\",desc:on()}),!1):(en({api:\"createFaceMessage\",param:\"payload\",desc:hn()}),!1)}})},createFileMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(!ot(e))return en({api:\"createFileMessage\",param:\"payload\",desc:hn()}),!1;if(at(e.file))return en({api:\"createFileMessage\",param:\"payload.file\",desc:sn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||Ze(e.file)))return ot(e.file)&&\"undefined\"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(en({api:\"createFileMessage\",param:\"payload.file\",desc:vn()}),!1):(en({api:\"createFileMessage\",param:\"payload.file\",desc:an()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return en({api:\"createFileMessage\",param:\"payload.file\",desc:vn()}),!1}return!0}}),onProgress:{type:\"Function\",required:!1,validator:function(e){return at(e)&&en({api:\"createFileMessage\",param:\"onProgress\",desc:ln()}),!0}}},createLocationMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){return ot(e)?et(e.description)?$e(e.longitude)?!!$e(e.latitude)||(en({api:\"createLocationMessage\",param:\"payload.latitude\",desc:on()}),!1):(en({api:\"createLocationMessage\",param:\"payload.longitude\",desc:on()}),!1):(en({api:\"createLocationMessage\",param:\"payload.description\",desc:tn()}),!1):(en({api:\"createLocationMessage\",param:\"payload\",desc:hn()}),!1)}})},createMergerMessage:{to:In,conversationType:In,payload:t(t({},Tn),{},{validator:function(e){if(jt(e.messageList))return en({api:\"createMergerMessage\",param:\"payload.messageList\",desc:cn()}),!1;if(jt(e.compatibleText))return en({api:\"createMergerMessage\",param:\"payload.compatibleText\",desc:nn(\"compatibleText\")}),!1;var t=!1;return e.messageList.forEach((function(e){e.status===Qt.FAIL&&(t=!0)})),!t||(en({api:\"createMergerMessage\",param:\"payload.messageList\",desc:Sn(\"MergeFailedMessageLog\")}),!1)}})},revokeMessage:[t(t({name:\"message\"},Tn),{},{validator:function(e){return jt(e)?(en({api:\"revokeMessage\",param:\"message\",desc:mn()}),!1):e.conversationType===S.CONV_SYSTEM?(en({api:\"revokeMessage\",param:\"message\",desc:Sn(\"MessageCanBeRevokedDesc\")}),!1):!0!==e.isRevoked||(en({api:\"revokeMessage\",param:\"message\",desc:Sn(\"MessageRevokedLog\")}),!1)}})],deleteMessage:[t(t({name:\"messageList\"},Cn),{},{validator:function(e){return!jt(e)||(en({api:\"deleteMessage\",param:\"messageList\",desc:cn()}),!1)}})],translateText:{sourceTextList:Cn,sourceLanguage:In,targetLanguage:In},modifyMessage:[t(t({name:\"message\"},Tn),{},{validator:function(e){return jt(e)?(en({api:\"modifyMessage\",param:\"message\",desc:mn()}),!1):e.conversationType===S.CONV_SYSTEM?(en({api:\"modifyMessage\",param:\"message\",desc:Sn(\"MessageCanBeModifiedLog\")}),!1):!0!==e._onlineOnlyFlag||(en({api:\"modifyMessage\",param:\"message\",desc:Sn(\"OnlineMessageNotSupportLog\")}),!1)}})],getUserProfile:{userIDList:{type:\"Array\",validator:function(e){return st(e)?(0===e.length&&en({api:\"getUserProfile\",param:\"userIDList\",desc:cn()}),!0):(en({api:\"getUserProfile\",param:\"userIDList\",desc:un()}),!1)}}},updateMyProfile:{profileCustomField:{type:\"Array\",validator:function(e){return!!at(e)||(!!st(e)||(en({api:\"updateMyProfile\",param:\"profileCustomField\",desc:un()}),!1))}}},setSelfStatus:{customStatus:{type:\"String\",validator:function(e){return!!et(e)||(en({api:\"setSelfStatus\",param:\"customStatus\",desc:tn()}),!1)}}},getUserStatus:{userIDList:{type:\"Array\",validator:function(e){return st(e)?0!==e.length||(en({api:\"getUserStatus\",param:\"userIDList\",desc:cn()}),!1):(en({api:\"getUserStatus\",param:\"userIDList\",desc:un()}),!1)}}},subscribeUserStatus:{userIDList:{type:\"Array\",validator:function(e){return st(e)?0!==e.length||(en({api:\"subscribeUserStatus\",param:\"userIDList\",desc:cn()}),!1):(en({api:\"subscribeUserStatus\",param:\"userIDList\",desc:un()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:\"Array\",validator:function(e){return!e||(!!st(e)||(en({api:\"subscribeUserStatus\",param:\"userIDList\",desc:un()}),!1))}}},addFriend:{to:In,source:{type:\"String\",required:!0,validator:function(e){return!!e&&(e.startsWith(\"AddSource_Type_\")?!(e.replace(\"AddSource_Type_\",\"\").length>8)||(en({api:\"addFriend\",param:\"source\",desc:dn(\"keyword\",8)}),!1):(en({api:\"addFriend\",param:\"source\",desc:Sn(\"SourcePrefixLog\")}),!1))}},remark:{type:\"String\",required:!1,validator:function(e){return!(et(e)&&e.length>96)||(en({api:\"addFriend\",param:\"remark\",desc:dn(\"remark\",96)}),!1)}}},deleteFriend:{userIDList:Cn},checkFriend:{userIDList:Cn},getFriendProfile:{userIDList:Cn},updateFriend:{userID:In,remark:{type:\"String\",required:!1,validator:function(e){return!(et(e)&&e.length>96)||(en({api:\"updateFriend\",param:\"remark\",desc:dn(\"remark\",96)}),!1)}},friendCustomField:{type:\"Array\",required:!1,validator:function(e){if(e){if(!st(e))return en({api:\"updateFriend\",param:\"friendCustomField\",desc:un()}),!1;var t=!0;return e.forEach((function(e){return et(e.key)&&-1!==e.key.indexOf(\"Tag_SNS_Custom\")?et(e.value)?e.key.replace(\"Tag_SNS_Custom_\",\"\").length>8?(en({api:\"updateFriend\",param:\"friendCustomField\",desc:dn(\"keyword\",8)}),t=!1):void 0:(en({api:\"updateFriend\",param:\"friendCustomField\",desc:_n(\"value\")}),t=!1):(en({api:\"updateFriend\",param:\"friendCustomField\",desc:Sn(\"FriendCustomFieldPrefixLog\")}),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:In},refuseFriendApplication:{userID:In},deleteFriendApplication:{userID:In},createFriendGroup:{name:In},deleteFriendGroup:{name:In},addToFriendGroup:{name:In,userIDList:Cn},removeFromFriendGroup:{name:In,userIDList:Cn},renameFriendGroup:{oldName:In,newName:In},sendMessageReadReceipt:[{name:\"messageList\",type:\"Array\",validator:function(e){return st(e)?0!==e.length||(en({api:\"sendMessageReadReceipt\",param:\"messageList\",desc:cn()}),!1):(en({api:\"sendMessageReadReceipt\",param:\"messageList\",desc:un()}),!1)}}],getMessageReadReceiptList:[{name:\"messageList\",type:\"Array\",validator:function(e){return st(e)?0!==e.length||(en({api:\"getMessageReadReceiptList\",param:\"messageList\",desc:cn()}),!1):(en({api:\"getMessageReadReceiptList\",param:\"messageList\",desc:un()}),!1)}}],createTopicInCommunity:{groupID:In,topicName:In},deleteTopicFromCommunity:{groupID:In,topicIDList:{type:\"Array\",validator:function(e){return!e||(!!st(e)||(en({api:\"deleteTopicFromCommunity\",param:\"topicIDList\",desc:un()}),!1))}}},updateTopicProfile:{groupID:In,topicID:In},getTopicList:{groupID:In,topicIDList:{type:\"Array\",validator:function(e){return!e||(!!st(e)||(en({api:\"getTopicList\",param:\"topicIDList\",desc:un()}),!1))}}}},Ln={login:1,logout:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1},An=1,Rn=2,Nn=3,On=4,Gn=6,Un=7,Pn=8,bn=9,wn=10,Fn=11,qn=12,xn=13,Vn=14,Bn=15,Hn=16,Kn=17,Wn=18,Yn=19,jn=20,zn=21,Jn=22,Xn=23,Qn=24,Zn=25,$n=26,eo=27,to=28,no=29,oo=30,so=31,ao=32,ro=function(){function e(t){o(this,e),this._m=t,this._n=\"\"}return a(e,[{key:\"isLoggedIn\",value:function(){return this._m.getModule(qn).isLoggedIn()}},{key:\"isOversea\",value:function(){return this._m.getModule(qn).isOversea()}},{key:\"isPrivateNetWork\",value:function(){return this._m.getModule(qn).isPrivateNetWork()}},{key:\"getFileDownloadProxy\",value:function(){return this._m.getModule(qn).getFileDownloadProxy()}},{key:\"getMyUserID\",value:function(){return this._m.getModule(qn).getUserID()}},{key:\"getMyTinyID\",value:function(){return this._m.getModule(qn).getTinyID()}},{key:\"getSDKAppID\",value:function(){return this._m.getModule(qn).getSDKAppID()}},{key:\"isIntl\",value:function(){return this._m.getModule(qn).isIntl()}},{key:\"isDevMode\",value:function(){return this._m.getModule(qn).isDevMode()}},{key:\"getModule\",value:function(e){return this._m.getModule(e)}},{key:\"getPlatform\",value:function(){return de}},{key:\"getNetworkType\",value:function(){return this._m.getModule(Bn).getNetworkType()}},{key:\"probeNetwork\",value:function(e){return this._m.getModule(Bn).probe(e)}},{key:\"getCloudConfig\",value:function(e){return this._m.getModule(Xn).getCloudConfig(e)}},{key:\"emitOuterEvent\",value:function(e,t){this._m.getOuterEmitterInstance().emit(e,t)}},{key:\"emitInnerEvent\",value:function(e,t){this._m.getInnerEmitterInstance().emit(e,t)}},{key:\"getInnerEmitterInstance\",value:function(){return this._m.getInnerEmitterInstance()}},{key:\"generateTjgID\",value:function(e){return this._m.getModule(qn).getTinyID()+\"-\"+e.random}},{key:\"filterModifiedMessage\",value:function(e){if(!jt(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(E.MESSAGE_MODIFIED,t)}}},{key:\"filterUnmodifiedMessage\",value:function(e){return jt(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:\"request\",value:function(e){return this._m.getModule(jn).request(e)}},{key:\"canIUse\",value:function(e){return this._m.getModule(eo).canIUse(e)}},{key:\"getErrorMessage\",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:\"outputWarning\",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&xe.w(o)}}]),e}(),io=\"wslogin\",uo=\"wslogout\",co=\"wshello\",lo=\"KickOther\",po=\"getmsg\",go=\"authkey\",_o=\"sendmsg\",ho=\"send_group_msg\",fo=\"portrait_get_all\",vo=\"portrait_set\",mo=\"black_list_get\",Mo=\"black_list_add\",yo=\"black_list_delete\",Io=\"msgwithdraw\",Co=\"msgreaded\",To=\"set_c2c_peer_mute_notifications\",Do=\"get_c2c_peer_mute_notifications\",Eo=\"getroammsg\",So=\"get_peer_read_time\",ko=\"delete_c2c_msg_ramble\",Lo=\"modify_c2c_msg\",Ao=\"set_key_values\",Ro=\"get_key_values\",No=\"page_get\",Oo=\"get\",Go=\"batch_delete\",Uo=\"clear_msg\",Po=\"top\",bo=\"deletemsg\",wo=\"set_conv_custom_data\",Fo=\"mark_contact\",qo=\"create_contact_group\",xo=\"del_contact_group\",Vo=\"update_contact_group\",Bo=\"add_conv_to_group\",Ho=\"del_conv_from_group\",Ko=\"get_contact_group\",Wo=\"get_joined_group_list\",Yo=\"get_group_self_member_info\",jo=\"create_group\",zo=\"destroy_group\",Jo=\"modify_group_base_info\",Xo=\"apply_join_group\",Qo=\"apply_join_group_noauth\",Zo=\"quit_group\",$o=\"get_group_public_info\",es=\"change_group_owner\",ts=\"handle_apply_join_group\",ns=\"handle_invite_join_permission_group\",os=\"handle_invite_join_group\",ss=\"group_msg_recall\",as=\"msg_read_report\",rs=\"read_all_unread_msg\",is=\"group_msg_get\",us=\"get_group_msg_receipt\",cs=\"group_msg_receipt\",ls=\"c2c_msg_read_receipt\",ps=\"get_group_msg_receipt_detail\",ds=\"get_pendency\",gs=\"deletemsg\",_s=\"get_msg\",hs=\"get_msg_noauth\",fs=\"get_online_member_num\",vs=\"delete_group_ramble_msg_by_seq\",ms=\"modify_group_msg\",Ms=\"set_group_attr\",ys=\"modify_group_attr\",Is=\"delete_group_attr\",Cs=\"clear_group_attr\",Ts=\"get_group_attr\",Ds=\"group_set_key_values\",Es=\"group_get_key_values\",Ss=\"get_group_notify\",ks=\"update_group_counter\",Ls=\"get_group_counter\",As=\"get_group_member_info\",Rs=\"get_members\",Ns=\"get_specified_group_member_info\",Os=\"add_group_member\",Gs=\"delete_group_member\",Us=\"ban_group_member\",Ps=\"modify_group_member_info\",bs=\"modify_user_info\",ws=\"cos\",Fs=\"pre_sig\",qs=\"video_cover\",xs=\"tim_web_report_v2\",Vs=\"alive\",Bs=\"msg_push\",Hs=\"multi_msg_push_ws\",Ks=\"ws_msg_push_ack\",Ws=\"stat_forceoffline\",Ys=\"save_relay_json_msg\",js=\"get_relay_json_msg\",zs=\"fetch_config\",Js=\"push_configv2\",Xs=\"fetch_imsdk_purchase_bitsv2\",Qs=\"push_imsdk_purchase_bitsv2\",Zs=\"notify2\",$s=\"create_topic\",ea=\"destroy_topic\",ta=\"modify_topic\",na=\"get_topic\",oa=\"ws_set_custom_status\",sa=\"ws_get_user_status\",aa=\"ws_status_subscribe\",ra=\"ws_status_unsubscribe\",ia=\"ws_stat_background\",ua=\"ws_stat_foreground\",ca=\"ws_stat_settoken\",la=\"get_local_words\",pa=\"ws_batch_trans_text\",da={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},ga=\"networkRTT\",_a=\"messageE2EDelay\",ha=\"sendMessageC2C\",fa=\"sendMessageGroup\",va=\"sendMessageGroupAV\",ma=\"sendMessageRichMedia\",Ma=\"cosUpload\",ya=\"messageReceivedGroup\",Ia=\"messageReceivedGroupAVPush\",Ca=\"messageReceivedGroupAVPull\",Ta=(r(Xt={},ga,2),r(Xt,_a,3),r(Xt,ha,4),r(Xt,fa,5),r(Xt,va,6),r(Xt,ma,7),r(Xt,ya,8),r(Xt,Ia,9),r(Xt,Ca,10),r(Xt,Ma,11),Xt),Da={info:4,warning:5,error:6},Ea={wifi:1,\"2g\":2,\"3g\":3,\"4g\":4,\"5g\":5,unknown:6,none:7,online:8},Sa={login:4},ka=function(){function e(t){o(this,e),this._n=\"SSOLogData\",this.eventType=Sa[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message=\"\",this.moreMessage=\"\",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Ue()}return a(e,[{key:\"updateTimeStamp\",value:function(){this.timestamp=Ue()}},{key:\"start\",value:function(e){return this._startts=e,this}},{key:\"end\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=Ue();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage(\"startts:\".concat(this._startts,\" endts:\").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:\"setError\",value:function(e,t,n){if(!(e instanceof Error))return xe.w(\"\".concat(this._n,\".setError value not instanceof Error, please check!\")),this;if(this._sentFlag)return this;if(this.setNetworkType(n),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var o=da.NO_NETWORK;this.setCode(o)}return this.setLevel(\"error\"),this}},{key:\"setCode\",value:function(e){return at(e)||this._sentFlag||(\"ECONNABORTED\"===e&&(this.code=103),$e(e)?this.code=e:xe.w(\"\".concat(this._n,\".setCode value not a number, please check!\"),e,n(e))),this}},{key:\"setMessage\",value:function(e){return at(e)||this._sentFlag||($e(e)&&(this.message=e.toString()),et(e)&&(this.message=e)),this}},{key:\"setCostTime\",value:function(e){return this.costTime=e,this}},{key:\"setLevel\",value:function(e){return at(e)||this._sentFlag||(this.level=Da[e]),this}},{key:\"setMoreMessage\",value:function(e){return jt(this.moreMessage)?this.moreMessage=\"\".concat(e):this.moreMessage+=\" \".concat(e),this}},{key:\"setNetworkType\",value:function(e){if(at(e))xe.w(\"\".concat(this._n,\".setNetworkType value is undefined, please check!\"));else{var t=Ea[e.toLowerCase()];at(t)||(this.networkType=t)}return this}},{key:\"getStartTs\",value:function(){return this._startts}},{key:\"setUIPlatform\",value:function(e){this.uiPlatform=e}}],[{key:\"bindEventStatModule\",value:function(t){e.prototype._eventStatModule=t}}]),e}(),La=function(){function e(t){o(this,e),this.type=S.MSG_TEXT,this.content={text:t.text||\"\"}}return a(e,[{key:\"setText\",value:function(e){this.content.text=e}},{key:\"sendable\",value:function(){return 0!==this.content.text.length}}]),e}(),Aa=function(){function e(t,n){o(this,e),this._imageMemoryURL=\"\",this._fileDownloadProxy=n,se?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=S.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||Ve.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return a(e,[{key:\"_initImageInfoModel\",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=_t(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||\"\",this.url=Wt(t.url||e._imageMemoryURL,e._fileDownloadProxy)},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:\"initImageInfoArray\",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=at(e)||at(e[t])?{type:0,size:0,width:0,height:0,url:\"\"}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:\"updateImageInfoArray\",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o1&&(this._percent=1)}},{key:\"updateImageFormat\",value:function(e){this.content.imageFormat=Ve[e.toUpperCase()]||Ve.UNKNOWN}},{key:\"createImageDataASURLInWeb\",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:\"createImageDataASURLInWXMiniApp\",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:\"replaceImageInfo\",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:\"addImageInfo\",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:\"updateAccessSideImageInfoArray\",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,s=t.height,a=void 0===s?0:s;0!==o&&0!==a&&(Ut(e),Object.assign(e[2],Gt({originWidth:o,originHeight:a,min:720})))}},{key:\"sendable\",value:function(){return 0!==this.content.imageInfoArray.length&&(\"\"!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),Ra=function(){function e(t){o(this,e),this.type=S.MSG_FACE,this.content=t||null}return a(e,[{key:\"sendable\",value:function(){return null!==this.content}}]),e}(),Na=function(){function e(t,n){o(this,e),this.type=S.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:Wt(t.url,n),remoteAudioUrl:t.url||\"\",uuid:t.uuid}}return a(e,[{key:\"updatePercent\",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:\"updateAudioUrl\",value:function(e){this.content.remoteAudioUrl=e}},{key:\"sendable\",value:function(){return\"\"!==this.content.remoteAudioUrl}}]),e}(),Oa={from:!0,groupID:!0,groupName:!0,to:!0},Ga=function(){function e(t){o(this,e),this.type=S.MSG_GRP_TIP,this.content={},this._initContent(t)}return a(e,[{key:\"_initContent\",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case\"remarkInfo\":break;case\"groupProfile\":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case\"operatorInfo\":break;case\"memberInfoList\":case\"msgMemberInfo\":t._updateMemberList(e[n]);break;case\"memberExtraInfo\":case\"onlineMemberInfo\":break;case\"memberNum\":t.content[n]=e[n],t.content.memberCount=e[n];break;case\"newGroupProfile\":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:\"_initGroupProfile\",value:function(e){for(var t=Object.keys(e),n=0;n1&&(this._percent=1)}},{key:\"updateFileUrl\",value:function(e){this.content.fileUrl=e}},{key:\"sendable\",value:function(){return\"\"!==this.content.fileUrl&&(\"\"!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),wa=function(){function e(t){o(this,e),this.type=S.MSG_CUSTOM,this.content={data:t.data||\"\",description:t.description||\"\",extension:t.extension||\"\"}}return a(e,[{key:\"setData\",value:function(e){return this.content.data=e,this}},{key:\"setDescription\",value:function(e){return this.content.description=e,this}},{key:\"setExtension\",value:function(e){return this.content.extension=e,this}},{key:\"sendable\",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),Fa=function(){function e(t,n){o(this,e),this.type=S.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||\"\",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:Wt(t.videoUrl,n),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:Wt(t.thumbUrl,n),snapshotUrl:Wt(t.thumbUrl,n)}}return a(e,[{key:\"updatePercent\",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:\"updateVideoUrl\",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:\"updateSnapshotInfo\",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;jt(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),jt(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),jt(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:\"sendable\",value:function(){return\"\"!==this.content.remoteVideoUrl}}]),e}(),qa=function(){function e(t){o(this,e),this.type=S.MSG_LOCATION;var n=t.description,s=t.longitude,a=t.latitude;this.content={description:n,longitude:s,latitude:a}}return a(e,[{key:\"sendable\",value:function(){return!0}}]),e}(),xa=function(){function e(t,n){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||\"\",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||\"\",this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(S.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(S.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.messageBody=[];var s=t.elements[0].type,a=t.elements[0].content;this._patchRichMediaPayload(s,a),this._updateRichMediaDownloadUrl(s,a,n),s===S.MSG_MERGER?this.messageBody.push({type:s,payload:new Va(a).content}):this.messageBody.push({type:s,payload:a}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID=\"\".concat(t.tinyID,\"-\").concat(t.clientTime,\"-\").concat(t.random)}}return a(e,[{key:\"_patchRichMediaPayload\",value:function(e,t){e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===S.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===S.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===S.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:\"_updateRichMediaDownloadUrl\",value:function(e,t,n){n&&(e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.url=Wt(e.url,n)})):e===S.MSG_VIDEO?(t.videoUrl=Wt(t.videoUrl,n),t.snapshotUrl=Wt(t.thumbUrl,n),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===S.MSG_AUDIO?t.url=Wt(t.url,n):e===S.MSG_FILE&&(t.fileUrl=Wt(t.fileUrl,n)))}}]),e}(),Va=function(){function e(t,n){if(o(this,e),this.type=S.MSG_MERGER,this.content={downloadKey:\"\",pbDownloadKey:\"\",messageList:[],title:\"\",abstractList:[],compatibleText:\"\",version:0,layersOverLimit:!1},t.downloadKey){var s=t.downloadKey,a=t.pbDownloadKey,r=t.title,i=t.abstractList,u=t.compatibleText,c=t.version;this.content.downloadKey=s,this.content.pbDownloadKey=a,this.content.title=r,this.content.abstractList=i,this.content.compatibleText=u,this.content.version=c||0}else if(jt(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var l=t.messageList,p=t.title,d=t.abstractList,g=t.compatibleText,_=t.version,h=[];l.forEach((function(e){if(!jt(e)){var t=new xa(e,n);h.push(t)}})),this.content.messageList=h,this.content.title=p,this.content.abstractList=d,this.content.compatibleText=g,this.content.version=_||0}}return a(e,[{key:\"sendable\",value:function(){return!jt(this.content.messageList)||!jt(this.content.downloadKey)}}]),e}(),Ba={1:S.MSG_PRIORITY_HIGH,2:S.MSG_PRIORITY_NORMAL,3:S.MSG_PRIORITY_LOW,4:S.MSG_PRIORITY_LOWEST},Ha=function(){function e(t){o(this,e),this.ID=\"\",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||S.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:_t(),this.priority=this._computePriority(t.priority),this.nick=t.nick||\"\",this.avatar=t.avatar||\"\",this.isPeerRead=!1,this.nameCard=\"\",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow=\"\",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||\"JSON\",this.isResend=!1,this.isRead=!1,this.status=t.status||Qt.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||\"\",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||be()||0,this.senderTinyID=t.senderTinyID||t.tinyID||\"\",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return a(e,[{key:\"elements\",get:function(){return this._elements}},{key:\"getElements\",value:function(){return this._elements}},{key:\"extractGroupInfo\",value:function(e){if(null!==e){et(e.nick)&&(this.nick=e.nick),et(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ot(t)&&et(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:\"handleGroupAtInfo\",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==S.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(S.MSG_AT_ALL))})),st(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(S.MSG_AT_ALL)}))}},{key:\"getGroupAtInfoList\",value:function(){return this._groupAtInfoList}},{key:\"_initProxy\",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:\"reInitialize\",value:function(e){e&&(this.status=this.from?Qt.SUCCESS:Qt.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:\"isSendable\",value:function(){return 0!==this._elements.length&&(\"function\"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:\"_initTo\",value:function(e){this.conversationType===S.CONV_GROUP&&(this.to=e.groupID)}},{key:\"_initSequence\",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return!1;if(void 0===mt[e]){var t=new Date,n=\"3\".concat(t.getHours()).slice(-2),o=\"0\".concat(t.getMinutes()).slice(-2),s=\"0\".concat(t.getSeconds()).slice(-2);mt[e]=parseInt([n,o,s,\"0001\"].join(\"\")),n=null,o=null,s=null,xe.l(\"autoIncrementIndex start index:\".concat(mt[e]))}return mt[e]++}(e)),0===this.sequence&&this.conversationType===S.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:\"generateMessageID\",value:function(){this.from===S.CONV_SYSTEM&&(this.senderTinyID=\"144115198244471703\"),this.ID=\"\".concat(this.senderTinyID,\"-\").concat(this.clientTime,\"-\").concat(this.random)}},{key:\"_initFlow\",value:function(e){\"\"!==e&&(e===this.from?(this.flow=\"out\",this.isRead=!0):this.flow=\"in\")}},{key:\"_concatConversationID\",value:function(e){var t=this.to,n=\"\",o=this.conversationType;o!==S.CONV_SYSTEM?(n=o===S.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=n?\"\".concat(o).concat(n):null):this.conversationID=S.CONV_SYSTEM}},{key:\"isElement\",value:function(e){return e instanceof La||e instanceof Aa||e instanceof Ra||e instanceof Na||e instanceof ba||e instanceof Fa||e instanceof Ga||e instanceof Pa||e instanceof wa||e instanceof qa||e instanceof Va}},{key:\"setElement\",value:function(e,t){var n=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case S.MSG_TEXT:n.setTextElement(e.content);break;case S.MSG_IMAGE:n.setImageElement(e.content,t);break;case S.MSG_AUDIO:n.setAudioElement(e.content,t);break;case S.MSG_FILE:n.setFileElement(e.content,t);break;case S.MSG_VIDEO:n.setVideoElement(e.content,t);break;case S.MSG_CUSTOM:n.setCustomElement(e.content);break;case S.MSG_LOCATION:n.setLocationElement(e.content);break;case S.MSG_GRP_TIP:n.setGroupTipElement(e.content);break;case S.MSG_GRP_SYS_NOTICE:n.setGroupSystemNoticeElement(e.content);break;case S.MSG_FACE:n.setFaceElement(e.content);break;case S.MSG_MERGER:n.setMergerElement(e.content,t)}};if(st(e))for(var s=0;s1&&void 0!==arguments[1]&&arguments[1];if(e instanceof Wa)return t&&null!==Ya&&Ya.emit(E.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new Wa({code:da.UNCAUGHT_ERROR});return t&&null!==Ya&&Ya.emit(E.ERROR,n),Promise.reject(n)}if(!at(e)&&!at(e.code)){var o=new Wa(e);return t&&null!==Ya&&Ya.emit(E.ERROR,o),Promise.reject(o)}},Xa=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"C2CModule\",t._messageFromUnreadDBMap=new Map,t._signalingFromUnreadDBList=[],t}return a(s,[{key:\"onNewC2CMessage\",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,s=e.C2CPairUnreadList;xe.d(\"\".concat(this._n,\".onNewC2CMessage count:\").concat(t.length,\" isInstantMessage:\").concat(n));var a=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:s,isInstantMessage:n}),r=a.conversationOptionsList,i=a.messageList,u=a.isUnreadC2CMessage;(this.filterModifiedMessage(i),r.length>0)&&this.getModule(Fn).onNewMessage({conversationOptionsList:r,isInstantMessage:n,isUnreadC2CMessage:u});var c=this.filterUnmodifiedMessage(i);n&&c.length>0&&this.emitOuterEvent(E.MESSAGE_RECEIVED,c),i.length=0}},{key:\"_newC2CMessageStoredAndSummary\",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=e.isInstantMessage,a=null,r=[],i=[],u={},c=this.getModule(Hn),l=this.getModule($n),p=!1,d=this.getModule(Fn),g=this.getFileDownloadProxy(),_=0,h=t.length;_0&&l.addMessageDelay(a.clientTime)}else this._messageFromUnreadDBMap.set(a.ID,1);if(0!==f.msgLifeTime){if(!1===a._onlineOnlyFlag){var k=d.getLastMessageTime(v);if($e(k)&&a.time0){R=!0;var n=r.find((function(t){return t.conversationID===\"C2C\".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:r.push({conversationID:\"C2C\".concat(o[e].from),unreadCount:o[e].unreadCount,type:S.CONV_C2C})}},O=0,G=o.length;O0&&(o=e.cloudCustomData);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push(\"NoUnread\"),!0===i&&s.push(\"NoLastMsg\"),!0===u&&s.push(\"NoMsgCheck\")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:_o,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||\"\",desc:n.description||\"\",ext:n.extension||\"\",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0!==c?s:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:\"_isVoipPush\",value:function(e){var t=void 0;return at(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:\"isOnlineMessage\",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:\"revokeMessage\",value:function(e){return this.request({protocolName:Io,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:\"deleteMessage\",value:function(e){var t=e.to,n=e.keyList;return xe.l(\"\".concat(this._n,\".deleteMessage toAccount:\").concat(t,\" count:\").concat(n.length)),this.request({protocolName:ko,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:\"modifyRemoteMessage\",value:function(e){var t=e.from,n=e.to,o=e.version,s=void 0===o?0:o,a=e.sequence,r=e.random,i=e.time,u=e.payload,c=e.type,l=e.cloudCustomData,p=void 0;return Vt(c)&&(p=[]).push({type:c,content:u}),this.request({protocolName:Lo,requestData:{from:t,to:n,version:s,sequence:a,random:r,time:i,elements:p,cloudCustomData:l}})}},{key:\"setMessageRead\",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,s=\"\".concat(this._n,\".setMessageRead\");xe.l(\"\".concat(s,\" conversationID:\").concat(n,\" lastMessageTime:\").concat(o)),$e(o)||this.outputWarning(\"DoNotModifyLastTime\");var a=new ka(\"setC2CMessageRead\");return a.setMessage(\"conversationID:\".concat(n,\" lastMessageTime:\").concat(o)),this.request({protocolName:Co,requestData:{C2CMsgReaded:{cookie:\"\",C2CMsgReadedItem:[{toAccount:n.replace(\"C2C\",\"\"),lastMessageTime:o,receipt:1}]}}}).then((function(){a.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(s,\" ok\"));var e=t.getModule(Fn);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),Ka()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.l(\"\".concat(s,\" failed. error:\"),e),Ja(e)}))}},{key:\"getRoamingMessage\",value:function(e){var t=this,n=\"\".concat(this._n,\".getRoamingMessage\"),o=e.peerAccount,s=e.conversationID,a=e.count,r=e.lastMessageTime,i=e.messageKey,u=\"peerAccount:\".concat(o,\" count:\").concat(a||15,\" lastMessageTime:\").concat(r||0,\" messageKey:\").concat(i);xe.l(\"\".concat(n,\" \").concat(u));var c=new ka(\"getC2CRoamingMessages\");return this.request({protocolName:Eo,requestData:{peerAccount:o,count:a||15,lastMessageTime:r||0,messageKey:i}}).then((function(e){var o=e.data,a=o.complete,r=o.messageList,i=o.messageKey,l=o.lastMessageTime;at(r)?xe.l(\"\".concat(n,\" ok. complete:\").concat(a,\" but messageList is undefined!\")):xe.l(\"\".concat(n,\" ok. complete:\").concat(a,\" count:\").concat(r.length)),c.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(u,\" complete:\").concat(a,\" length:\").concat(r.length)).end();var p=t.getModule(Fn);1===a&&p.setCompleted(s);var d=p.onRoamingMessage(r,s);p.modifyMessageList(s),p.updateIsRead(s),p.updateRoamingMessageKeyAndTime(s,i,l);var g=p.getPeerReadTime(s);if(xe.l(\"\".concat(n,\" update isPeerRead property. conversationID:\").concat(s,\" peerReadTime:\").concat(g)),g)p.updateMessageIsPeerReadProperty(s,g);else{var _=s.replace(S.CONV_C2C,\"\");t.getRemotePeerReadTime([_]).then((function(){p.updateMessageIsPeerReadProperty(s,p.getPeerReadTime(s))}))}var h=\"\";if(d.length>0)h=d[0].ID;else{var f=p.getLocalOldestMessage(s);f&&(h=f.ID)}return xe.l(\"\".concat(n,\" nextReqID:\").concat(h,\" stored message count:\").concat(d.length)),{nextReqID:h,storedMessageList:d}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setMessage(u).setError(e,o,s).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getRoamingMessagesHopping\",value:function(e){var t=this,n=\"\".concat(this._n,\".getRoamingMessagesHopping\"),o=e.peerAccount,s=e.time,a=void 0===s?0:s,r=e.count,i=e.direction,u=\"\".concat(S.CONV_C2C).concat(o),c=\"peerAccount:\".concat(o,\" count:\").concat(r,\" time:\").concat(a,\" direction:\").concat(i);xe.l(\"\".concat(n,\" \").concat(c));var l=new ka(\"getC2CRoamingMessagesHopping\");return this.request({protocolName:Eo,requestData:{peerAccount:o,count:r+1,lastMessageTime:a,direction:i}}).then((function(e){var o=e.data,s=o.complete,a=o.messageList,r=void 0===a?[]:a,p=o.lastMessageTime;xe.l(\"\".concat(n,\" ok. complete:\").concat(s,\" count:\").concat(r.length)),l.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(c,\" complete:\").concat(s,\" length:\").concat(r.length)).end(),1!==s&&(1===i?r.pop():r.shift());var d=t.getModule(Fn).onRoamingMessage(r,u,!1);t._modifyMessageList(u,d);var g=t._computeResult({complete:s,lastMessageTime:p,resultList:d});return Ka(g)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setMessage(c).setError(e,o,s).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_computeResult\",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,s=e.resultList,a={messageList:m(void 0===s?[]:s),isCompleted:!1,nextMessageTime:\"\"};return 1===n?(a.isCompleted=!0,a):(a.nextMessageTime=o,a)}},{key:\"_modifyMessageList\",value:function(e,t){var n=this.getModule(Fn).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,s=n.userProfile.avatar,a=this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID()),r=a.nick,i=a.avatar,u=t.length-1;u>=0;u--){var c=t[u];\"in\"===c.flow&&(c.nick!==o&&c.setNickAndAvatar({nick:o}),c.avatar!==s&&c.setNickAndAvatar({avatar:s})),\"out\"===c.flow&&(c.nick!==r&&c.setNickAndAvatar({nick:r}),c.avatar!==i&&c.setNickAndAvatar({avatar:i}))}}},{key:\"getRemotePeerReadTime\",value:function(e){var t=this,n=\"\".concat(this._n,\".getRemotePeerReadTime\");if(jt(e))return xe.w(\"\".concat(n,\" userIDList is empty!\")),Promise.resolve();var o=new ka(\"getPeerReadTime\");return xe.l(\"\".concat(n,\" userIDList:\").concat(e)),this.request({protocolName:So,requestData:{userIDList:e}}).then((function(s){var a=s.data.peerReadTimeList;xe.l(\"\".concat(n,\" ok. peerReadTimeList:\").concat(a));for(var r=\"\",i=t.getModule(Fn),u=0;u0&&i.recordPeerReadTime(\"C2C\".concat(e[u]),a[u]);o.setNetworkType(t.getNetworkType()).setMessage(r).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e)}))}},{key:\"sendReadReceipt\",value:function(e){var t=this,n=e[0].conversationID.replace(S.CONV_C2C,\"\"),o=new ka(\"sendC2CReadReceipt\");o.setMessage(\"peerAccount:\".concat(n));var s=this.getMyUserID(),a=e.filter((function(e){return e.from!==s&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===a.length)return Ja({code:da.READ_RECEIPT_MESSAGE_LIST_EMPTY});var r=\"\".concat(this._n,\".sendReadReceipt\");return xe.l(\"\".concat(r,\". peerAccount:\").concat(n,\" messageInfoList length:\").concat(a.length)),this.request({protocolName:ls,requestData:{peerAccount:n,messageInfoList:a}}).then((function(e){return o.end(),xe.l(\"\".concat(r,\" ok\")),Ka()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.w(\"\".concat(r,\" failed. error:\"),e),Ja(e)}))}},{key:\"getReadReceiptList\",value:function(e){var t=\"\".concat(this._n,\".getReadReceiptList\"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return xe.l(\"\".concat(t,\" userID:\").concat(n,\" messageList length:\").concat(o.length)),za({messageList:o})}},{key:\"getMessageExtensions\",value:function(e,t){return xe.l(\"\".concat(this._n,\".getMessageExtensions startSequence:\").concat(t)),this.request({protocolName:Ro,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),startSequence:t}})}},{key:\"modifyMessageExtensions\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return xe.l(\"\".concat(this._n,\".modifyMessageExtensions operateType:\").concat(n)),this.request({protocolName:Ao,requestData:{from:e.from,to:e.to,messageKey:this._getMessageKey(e),extensionList:t,operateType:n}})}},{key:\"_getMessageKey\",value:function(e){var t=e.clientSequence,n=e.random,o=e.time;return\"\".concat(t,\"_\").concat(n,\"_\").concat(o)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._messageFromUnreadDBMap.clear(),this._signalingFromUnreadDBList.length=0}}]),s}(ro),Qa=function(){function e(){o(this,e),this.list=new Map,this._n=\"MessageListHandler\",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return a(e,[{key:\"getLocalOldestMessageByConversationID\",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:\"pushIn\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var s=this._getUniqueIDOfMessage(e),a=this.list.get(n).has(s);if(a){var r=this.list.get(n).get(s);if(!t||!0===r.isModified)return o=!1}return this.list.get(n).set(s,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),o}},{key:\"unshift\",value:function(e,t){var n;if(st(e)?e.length>0&&(n=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(n=e.conversationID,this._unshiftSingleMessage(e,t)),n&&n.startsWith(S.CONV_C2C)){var o=Array.from(this.list.get(n).values()),s=o.length;if(0===s)return;for(var a=s-1;a>=0;a--)if(\"out\"===o[a].flow){this._setLatestMessageSentByMe(n,o[a]);break}for(var r=s-1;r>=0;r--)if(\"in\"===o[r].flow){this._setLatestMessageSentByPeer(n,o[r]);break}}}},{key:\"_unshiftSingleMessage\",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var s=this.list.get(n),a=Array.from(s);s.has(o)||(a.unshift([o,e]),this.list.set(n,new Map(a)),t.push(e))}},{key:\"_unshiftMultipleMessages\",value:function(e,t){for(var n=e.length,o=[],s=e[0].conversationID,a=this.list.get(s),r=this.list.has(s)?Array.from(a):[],i=0;i=0;l--)\"in\"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));xe.l(\"\".concat(this._n,\".modifyMessageSentByPeer conversationID:\").concat(t,\" count:\").concat(u))}}}},{key:\"modifyMessageSentByMe\",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,s=this.list.get(t);if(!jt(s)){var a=Array.from(s.values()),r=a.length;if(0!==r){for(var i=null,u=0,c=!1,l=r-1;l>=0;l--)\"out\"===a[l].flow&&((i=a[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));xe.l(\"\".concat(this._n,\".modifyMessageSentByMe conversationID:\").concat(t,\" count:\").concat(u))}}}},{key:\"getTopicConversationIDList\",value:function(e){return m(this.list.keys()).filter((function(t){return t.startsWith(\"\".concat(S.CONV_GROUP).concat(e))}))}},{key:\"traversal\",value:function(){if(0!==this.list.size&&-1===xe.getLevel()){console.group(\"conversationID-messageCount\");var e,t=D(this.list);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];console.log(\"\".concat(o,\"-\").concat(s.size))}}catch(a){t.e(a)}finally{t.f()}console.groupEnd()}}},{key:\"onMessageModified\",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(xe.d(\"\".concat(this._n,\".onMessageModified conversationID:\").concat(e,\" uniqueID:\").concat(n,\" has:\").concat(o)),o){var s=this.list.get(e).get(n),a=t.messageVersion,r=t.elements,i=t.cloudCustomData;return s.version1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var nr=[\"jpg\",\"jpeg\",\"gif\",\"png\",\"bmp\",\"image\",\"webp\"],or=[\"mp4\",\"quicktime\",\"mov\"],sr=1,ar=2,rr=3,ir=255,ur=function(){function e(t){var n=this;o(this,e),jt(t)||(this.userID=t.userID||\"\",this.nick=t.nick||\"\",this.gender=t.gender||\"\",this.birthday=t.birthday||0,this.location=t.location||\"\",this.selfSignature=t.selfSignature||\"\",this.allowType=t.allowType||S.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||\"\",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||S.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],jt(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return a(e,[{key:\"validate\",value:function(e){var t=!0,n=\"\";if(jt(e))return{valid:!1,tips:\"empty options\"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,a=0;a500&&(n=\"nick name limited: must less than or equal to \".concat(500,\" bytes, current size: \").concat(gt(e[r]),\" bytes\"),t=!1);break;case\"gender\":vt(He,e.gender)||(n=\"key:gender, invalid value:\"+e.gender,t=!1);break;case\"birthday\":$e(e.birthday)||(n=\"birthday must be a number\",t=!1);break;case\"location\":et(e.location)||(n=\"location must be a string\",t=!1);break;case\"selfSignature\":et(e.selfSignature)||(n=\"selfSignature must be a string\",t=!1);break;case\"allowType\":vt(We,e.allowType)||(n=\"key:allowType, invalid value:\"+e.allowType,t=!1);break;case\"language\":$e(e.language)||(n=\"language must be a number\",t=!1);break;case\"avatar\":et(e.avatar)||(n=\"avatar must be a string\",t=!1);break;case\"messageSettings\":0!==e.messageSettings&&1!==e.messageSettings&&(n=\"messageSettings must be 0 or 1\",t=!1);break;case\"adminForbidType\":vt(Ke,e.adminForbidType)||(n=\"key:adminForbidType, invalid value:\"+e.adminForbidType,t=!1);break;case\"level\":$e(e.level)||(n=\"level must be a number\",t=!1);break;case\"role\":$e(e.role)||(n=\"role must be a number\",t=!1);break;default:n=\"unknown key:\"+r+\" \"+e[r],t=!1}}return{valid:t,tips:n}}}]),e}(),cr=a((function e(t){o(this,e),this.value=t,this.next=null})),lr=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return a(e,[{key:\"set\",value:function(e){var t=new cr(e);if(this.map.size0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&pt(t.selfInfo,e,[\"sequence\"])}))}},{key:\"updateSelfInfo\",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};pt(this.selfInfo,t({},n),[],[\"\",null,void 0,0,NaN])}},{key:\"setSelfNameCard\",value:function(e){this.selfInfo.nameCard=e}}]),e}(),gr=function(e,n){return at(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:\"\",payload:null,type:\"\",isRevoked:!1,cloudCustomData:\"\",onlineOnlyFlag:!1,nick:\"\",nameCard:\"\",version:0,isPeerRead:!1,revoker:null}:e instanceof Ha?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||\"\",messageForShow:xt(e.type,e.payload,n),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||\"\",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||\"\",nameCard:e.nameCard||\"\",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:xt(e.type,e.payload,n)})},_r=function(){function e(t,n){o(this,e),this.conversationID=t.conversationID||\"\",this.unreadCount=t.unreadCount||0,this.type=t.type||\"\",this.lastMessage=gr(t.lastMessage,n),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark=\"\",this.isPinned=t.isPinned||!1,this.messageRemindType=\"\",this.markList=t.markList||[],this.customData=t.customData||\"\",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return a(e,[{key:\"toAccount\",get:function(){return this.conversationID.startsWith(S.CONV_C2C)?this.conversationID.replace(S.CONV_C2C,\"\"):this.conversationID.startsWith(S.CONV_GROUP)?this.conversationID.replace(S.CONV_GROUP,\"\"):\"\"}},{key:\"subType\",get:function(){return this.groupProfile?this.groupProfile.type:\"\"}},{key:\"_initProfile\",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case\"userProfile\":t.userProfile=e.userProfile;break;case\"groupProfile\":t.groupProfile=e.groupProfile}})),at(this.userProfile)&&this.type===S.CONV_C2C?this.userProfile=new ur({userID:e.conversationID.replace(\"C2C\",\"\")}):at(this.groupProfile)&&this.type===S.CONV_GROUP&&(this.groupProfile=new dr({groupID:e.conversationID.replace(\"GROUP\",\"\")}))}},{key:\"updateUnreadCount\",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;at(t)||(Ct(this.subType)?this.unreadCount=0:n&&this.type===S.CONV_GROUP||n&&this.type===S.CONV_TOPIC||o&&this.type===S.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:\"updateLastMessage\",value:function(e){this.lastMessage=gr(e)}},{key:\"updateGroupAtInfoList\",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==n.indexOf(S.CONV_AT_ME)&&-1!==n.indexOf(S.CONV_AT_ALL)&&(n=[S.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o)}}},{key:\"_isNeedMergeGroupAtInfo\",value:function(e){var t=e.groupID,n=e.sequence;if(!Tt({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(S.CONV_AT_ME)>-1&&e.groupAtType.indexOf(S.CONV_AT_ALL)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(S.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(S.CONV_AT_ME)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:\"clearGroupAtInfoList\",value:function(){this.groupAtInfoList.length=0}},{key:\"reduceUnreadCount\",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:\"isLastMessageRevoked\",value:function(e){var t=e.sequence,n=e.time;return this.type===S.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===S.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:\"setLastMessageRevoked\",value:function(e){this.lastMessage.isRevoked=e}},{key:\"setLastMessageRevoker\",value:function(e){this.lastMessage.revoker=e}}]),e}(),hr=function(){function e(t){o(this,e),this._conversationModule=t,this._n=\"MessageRemindHandler\",this._updateSequence=0}return a(e,[{key:\"getC2CMessageRemindType\",value:function(){var e=this,t=\"\".concat(this._n,\".getC2CMessageRemindType\");return this._conversationModule.request({protocolName:Do,updateSequence:this._updateSequence}).then((function(n){xe.l(\"\".concat(t,\" ok\"));var o=n.data,s=o.updateSequence,a=o.muteFlagList;e._updateSequence=s,e._patchC2CMessageRemindType(a)})).catch((function(e){xe.e(\"\".concat(t,\" failed. error:\"),e)}))}},{key:\"_patchC2CMessageRemindType\",value:function(e){var t=this,n=0,o=\"\";st(e)&&e.length>0&&e.forEach((function(e){var s=e.userID,a=e.muteFlag;0===a?o=S.MSG_REMIND_ACPT_AND_NOTE:1===a?o=S.MSG_REMIND_DISCARD:2===a&&(o=S.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:s,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),xe.l(\"\".concat(this._n,\"._patchC2CMessageRemindType count:\").concat(n))}},{key:\"set\",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):st(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:\"_setGroupMessageRemindType\",value:function(e){var t=this,n=\"\".concat(this._n,\"._setGroupMessageRemindType\"),o=e.groupID,s=e.messageRemindType,a=\"groupID:\".concat(o,\" messageRemindType:\").concat(s),r=new ka(\"setMessageRemindType\");return r.setMessage(a),this._getModule(bn).modifyGroupMemberInfo({groupID:o,messageRemindType:s,userID:this._conversationModule.getMyUserID()}).then((function(){r.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok. \").concat(a));var o=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),Ka(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"onGroupMessageRemindTypeUpdated\",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(Un).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),Dt(t)){var s=t,a=qt(s),r=this._getModule(wn).getLocalTopic(a,s);return r&&(r.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:a,topic:r})),{topic:r}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:\"_setC2CMessageRemindType\",value:function(e){var t=this,n=\"\".concat(this._n,\"._setC2CMessageRemindType\"),o=e.userIDList,s=e.messageRemindType,a=o.slice(0,30),r=0;s===S.MSG_REMIND_DISCARD?r=1:s===S.MSG_REMIND_ACPT_NOT_NOTE&&(r=2);var i=\"userIDList:\".concat(a,\" messageRemindType:\").concat(s),u=new ka(\"setMessageRemindType\");return u.setMessage(i),this._conversationModule.request({protocolName:To,requestData:{userIDList:a,muteFlag:r}}).then((function(e){u.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,r=o.updateSequence,i=o.errorList;t._updateSequence=r;var c=[],l=[];st(i)&&i.forEach((function(e){c.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var p=a.filter((function(e){return-1===c.indexOf(e)}));xe.l(\"\".concat(n,\" ok. successUserIDList:\").concat(p,\" failureUserIDList:\").concat(JSON.stringify(l)));var d=0;return p.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:s})&&(d+=1)})),d>=1&&t._emitConversationUpdate(),a.length=c.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),za({successUserIDList:p.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_getModule\",value:function(e){return this._conversationModule.getModule(e)}},{key:\"_emitConversationUpdate\",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:\"setUpdateSequence\",value:function(e){this._updateSequence=e}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._updateSequence=0}}]),e}(),fr=function(){function e(t){o(this,e),this._conversationModule=t,this._n=\"ConvGroupHandler\",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Zt.NOT_START}return a(e,[{key:\"setConvCustomData\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"setConvCustomData\"),o=e.conversationIDList,s=e.customData;xe.l(\"\".concat(n,\" options:\"),e);var a=new ka(\"setConvCustomData\");a.setMessage(JSON.stringify(e));var r={fromAccount:this._getMyUserID(),itemList:[]},i=[],u=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(u,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(u,e),!0;var n={operationType:2,contactItem:void 0,customMark:s};Et(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,\"\")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,\"\")}),r.itemList.push(n)})),u.length===o.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:wo,requestData:r}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var o=e.data.resultItem;if(st(o)){var r,c,l=!1;o.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(r),(c=t._getLocalConversation(r))&&c.customData!==s&&(c.customData=s,l=!0)):u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"markConversation\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_MARK))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"markConversation\"),o=e.conversationIDList,s=e.markType,a=e.enableMark;xe.l(\"\".concat(n,\" options:\"),e);var r=new ka(\"markConversation\");r.setMessage(JSON.stringify(e));var i=void 0,u=void 0,c=this._getFlagBit(s);!0===a?u=[c]:i=[c];var l={fromAccount:this._getMyUserID(),itemList:[]},p=[],d=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(d,e),!0;if(!Et(e)&&!St(e))return t._onConversationIDInvalid(d,e),!0;var n={operationType:1,contactItem:void 0,clearMark:i,setMark:u};Et(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,\"\")}:St(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,\"\")}),l.itemList.push(n)})),d.length===o.length?za({successConversationIDList:p,failureConversationIDList:d}):this._conversationModule.request({protocolName:Fo,requestData:l}).then((function(e){r.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var o=e.data.resultItem;if(st(o)){var i,u,c=!1;o.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(p.push(i),u=t._getLocalConversation(i)){var n=u.markList.indexOf(s);!0===a?-1===n&&(u.markList.push(s),c=!0):-1!==n&&(u.markList.splice(n,1),c=!0)}}else d.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===c&&t._emitConversationUpdate()}return Ka({successConversationIDList:p,failureConversationIDList:d})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getLocalConvGroupList\",value:function(){var e=this;return xe.l(\"\".concat(this._n,\".getLocalConvGroupList pagingStatus:\").concat(this._pagingStatus)),this._pagingStatus===Zt.REJECTED?this.getRemoteConvGroupList().then((function(){return Ka(m(e._convGroupMap.values()))})):za(m(this._convGroupMap.values()))}},{key:\"getRemoteConvGroupList\",value:function(){var e=this,t=\"\".concat(this._n,\".getRemoteConvGroupList\");return this._pagingStatus=Zt.PENDING,this._conversationModule.request({protocolName:Ko,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:be()}}).then((function(n){var o,s,a=n.data,r=a.completeFlag,i=a.contactItem,u=a.nextStartIndex,c=void 0===u?0:u,l=a.groupItem;(e._startIndex=c,xe.l(\"\".concat(t,\" completeFlag:\").concat(r,\" nextStartIndex:\").concat(c)),st(l)&&l.forEach((function(t){var n=t.convGroupID,o=t.groupName;e._convGroupMap.set(n,o)})),st(i))&&i.forEach((function(t){var n=t.standardMark,a=t.customData,r=t.convGroupIDList;if(o=e._concatConversationID(t),(s=e._getLocalConversation(o))&&(s.markList=Bt(n),s.customData=a||\"\",st(r))){var i=[];r.forEach((function(t){e._convGroupMap.has(t)&&i.push(e._convGroupMap.get(t))})),s.conversationGroupList=[].concat(i),i.length=0}}));if(0===r)return e.getRemoteConvGroupList();1===r&&(e._pagingStatus=Zt.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=Zt.REJECTED,xe.w(\"\".concat(t,\" failed. error:\"),n)}))}},{key:\"createConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"createConvGroup\");xe.l(\"\".concat(n,\" options:\"),e);var o=new ka(\"createConvGroup\");o.setMessage(JSON.stringify(e));var s=e.groupName,a=e.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:s,contactItem:[]}]},i=[],u=[];return a.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(S.CONV_C2C,\"\")}):St(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(S.CONV_GROUP,\"\")})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===a.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:qo,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var a=e.data.groupResultItem[0],r=a.groupItem,c=a.resultItem;if(ot(r)&&(t._convGroupMap.set(r.convGroupID,r.groupName),t._emitConvGroupListUpdate()),st(c)){var l,p,d=!1;c.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(l),(p=t._getLocalConversation(l))&&-1===p.conversationGroupList.indexOf(s)&&(p.conversationGroupList.push(s),d=!0)):u.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===d&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"deleteConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"deleteConvGroup\");xe.l(\"\".concat(n,\" groupName:\").concat(e));var o=new ka(\"deleteConvGroup\");return o.setMessage(e),this._conversationModule.request({protocolName:xo,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(s){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var a=s.data.groupItem;if(st(a)){var r=!1;a.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),r=!0)})),!0===r&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"renameConvGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"renameConvGroup\");xe.l(\"\".concat(n,\" options:\"),e);var o=new ka(\"renameConvGroup\");o.setMessage(JSON.stringify(e));var s=e.oldName,a=e.newName;return this._conversationModule.request({protocolName:Vo,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:s,newName:a}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var r=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(r,a),t._emitConvGroupListUpdate();var i,u,c=t._conversationModule.getLocalConversationList(),l=!1;c.forEach((function(e){i=e.conversationGroupList,-1!==(u=i.indexOf(s))&&(i.splice(u,1,a),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"addConvsToGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"addConvsToGroup\");xe.l(\"\".concat(n,\" options:\"),e);var o=new ka(\"addConvsToGroup\");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,\"\")}}):St(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,\"\")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:Bo,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var s=e.data.updateGroupResult.contactResultItem;if(st(s)){var r,c,l=!1;s.forEach((function(e){r=t._concatConversationID(e.contactItem),0===e.resultCode?(c=t._getLocalConversation(r))&&-1===c.conversationGroupList.indexOf(a)&&(c.conversationGroupList.push(a),i.push(r),l=!0):u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"deleteConvsFromGroup\",value:function(e){var t=this;if(!this._conversationModule.canIUse(B.CONV_GROUP))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"deleteConvsFromGroup\");xe.l(\"\".concat(n,\" options:\"),e);var o=new ka(\"deleteConvsFromGroup\");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,a=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:a,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Et(e)||St(e)?void(Et(e)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,\"\")}}):St(e)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,\"\")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?za({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:Ho,requestData:r}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var s=e.data.updateGroupResult.contactResultItem;if(st(s)){var r,c,l=!1;s.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(c=t._getLocalConversation(r)){var n=c.conversationGroupList.indexOf(a);-1!==n&&(c.conversationGroupList.splice(n,1),i.push(r),l=!0)}}else u.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(a))}return Ka({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"onConvMarkUpdated\",value:function(e){var t=this;if(!jt(e)){var n,o;xe.d(\"\".concat(this._n,\".onConvMarkUpdated markItemList:\"),e);var s=!1;e.forEach((function(e){var a=e.recentContactItem,r=e.optType,i=e.standardMark,u=e.customMark;if(n=t._concatConversationID(a),o=t._getLocalConversation(n))if(1===r){var c=Bt(i);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n=0;o--)if(\"1\"===t[o])return n-o-1}},{key:\"_concatConversationID\",value:function(e){var t,n=e.type,o=e.to,s=e.groupID,a=e.userID;return 1===n?at(a)?at(o)||(t=\"\".concat(S.CONV_C2C).concat(o)):t=\"\".concat(S.CONV_C2C).concat(a):2===n&&(t=\"\".concat(S.CONV_GROUP).concat(s)),t}},{key:\"_getMyUserID\",value:function(){return this._conversationModule.getMyUserID()}},{key:\"_insertConversationGroup\",value:function(e,t){var n=this._getLocalConversation(e);if(n){var o=n.conversationGroupList;-1===o.indexOf(t)&&o.push(t)}}},{key:\"_getLocalConversation\",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:\"_hasLocalConversation\",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:\"_emitConversationUpdate\",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:\"_emitConvGroupListUpdate\",value:function(){this._conversationModule.emitOuterEvent(E.CONVERSATION_GROUP_LIST_UPDATED,m(this._convGroupMap.values()))}},{key:\"_emitConvInGroupUpdate\",value:function(e){var t={groupName:e,conversationList:[]},n=this._conversationModule.getLocalConversationList();t.conversationList=n.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(E.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Zt.NOT_START}}]),e}(),vr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"ConversationModule\",tr.mixin(_(t)),t._messageListHandler=new Qa,t._messageRemindHandler=new hr(_(t)),t._convGroupHandler=new fr(_(t)),t.singlyLinkedList=new lr(100),t._pagingStatus=Zt.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._pagingConvIDMap=new Map,t._convIDFromUnreadDBMap=new Map,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._pagingGetCostList=[],t._initListeners(),t}return a(s,[{key:\"_initListeners\",value:function(){var e=this.getInnerEmitterInstance();e.on(Za,this._initLocalConversationList,this),e.on(er,this._onProfileUpdated,this)}},{key:\"onCheckTimer\",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:\"_initLocalConversationList\",value:function(){var e=this,t=new ka(\"_initLocalConversationList\");xe.l(\"\".concat(this._n,\".\").concat(\"_initLocalConversationList\"));var n=\"\",o=this._getStorageConversationList(),s=this.isIntl();if(o){for(var a=o.length,r=0;r0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:\"onMessageSent\",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:\"onNewMessage\",value:function(e){this._onSendOrReceiveMessage(e)}},{key:\"_onSendOrReceiveMessage\",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,s=void 0===o||o,a=e.isUnreadC2CMessage,r=void 0!==a&&a,i=e.updateUnreadCount,u=void 0===i||i;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:s,isUnreadC2CMessage:r,isFromGetConversations:!1,updateUnreadCount:u}),s||(this._convIDFromUnreadDBMap=new Map([].concat(m(this._convIDFromUnreadDBMap),m(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConversation()),this._setStorageConversationList(),n.filter((function(e){return e.type===S.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:\"updateConversationGroupProfile\",value:function(e){var t=this;if(!st(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o=\"GROUP\".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var s=t._conversationMap.get(o);s.groupProfile=JSON.parse(JSON.stringify(e)),s.lastMessage.lastSequence=0;r--)if(!s[r].isDeleted){a=s[r];break}var i=this._conversationMap.get(o);if(i){var u=!1;i.lastMessage.lastSequence===a.sequence&&i.lastMessage.lastTime===a.time||(jt(a)&&(a=void 0),i.updateLastMessage(a),i.type!==S.CONV_TOPIC&&(u=!0),xe.l(\"\".concat(this._n,\".onMessageDeleted. update conversationID:\").concat(o,\" with lastMessage:\"),i.lastMessage)),o.startsWith(S.CONV_C2C)&&this.updateUnreadCount(o),u&&this.emitConversationUpdate(!0,!1)}}}},{key:\"onMessageModified\",value:function(e){var t=e.conversationType,n=e.from,o=e.to,s=e.time,a=e.sequence,r=e.elements,i=e.cloudCustomData,u=e.messageVersion,c=this.getMyUserID(),l=\"\".concat(t).concat(o);o===c&&t===S.CONV_C2C&&(l=\"\".concat(t).concat(n));var p=this._messageListHandler.onMessageModified(l,e),d=p.isUpdated,g=p.message;!0===d&&this.emitOuterEvent(E.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(xe.l(\"\".concat(this._n,\".onMessageModified isUpdated:\").concat(d,\" isTopicMessage:\").concat(_,\" from:\").concat(n,\" to:\").concat(o)),_){this.getModule(wn).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;xe.d(\"\".concat(this._n.onMessageModified,\" lastMessage:\"),JSON.stringify(f),\"options:\",JSON.stringify(e)),f&&f.lastTime===s&&f.lastSequence===a&&f.version!==u&&(f.type=r[0].type,f.payload=r[0].content,f.messageForShow=xt(f.type,f.payload,this.isIntl()),f.cloudCustomData=i,f.version=u,this.emitConversationUpdate(!0,!1))}}return g}},{key:\"onNewGroupAtTips\",value:function(e){var n=this,o=e.dataList,s=null;o.forEach((function(e){e.groupAtTips?s=e.groupAtTips:e.elements?s=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(s=t(t({},e),{},{sync:!0})),s.__random=e.random,s.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(s)})),xe.d(\"\".concat(this._n,\".onNewGroupAtTips isReady:\").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:\"_handleGroupAtTipsList\",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,s=n.from,a=n.topicID,r=void 0===a?void 0:a,i=n.sync,u=void 0!==i&&i;if(s!==e.getMyUserID())if(at(r)){var c=e._conversationMap.get(\"\".concat(S.CONV_GROUP).concat(o));c&&(c.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get(\"\".concat(S.CONV_GROUP).concat(r));if(l){l.updateGroupAtInfoList(n);var p=e.getModule(wn),d=l.groupAtInfoList;p.onConversationProxy({topicID:r,groupAtInfoList:d})}if(jt(l)&&u)e.updateTopicConversation([{conversationID:\"\".concat(S.CONV_GROUP).concat(r),type:S.CONV_TOPIC}]),e._conversationMap.get(\"\".concat(S.CONV_GROUP).concat(r)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:\"_getC2CPeerReadTime\",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==S.CONV_C2C||n.push(e.conversationID.replace(S.CONV_C2C,\"\"))})),n.length>0){xe.d(\"\".concat(this._n,\"._getC2CPeerReadTime userIDList:\").concat(n));var o=this.getModule(Gn);o&&o.getRemotePeerReadTime(n)}}},{key:\"_getStorageConversationList\",value:function(){return this.getModule(xn).getItem(\"conversationMap\")}},{key:\"_setStorageConversationList\",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===S.CONV_C2C||e.type===S.CONV_GROUP&&e.lastMessage.type!==S.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(xn).setItem(\"conversationMap\",e)}},{key:\"emitConversationUpdate\",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(Un);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(E.CONVERSATION_LIST_UPDATED)}},{key:\"getLocalConversationList\",value:function(){return m(this._conversationMap.values()).filter((function(e){return e.type!==S.CONV_TOPIC}))}},{key:\"getLocalConversation\",value:function(e){return this._conversationMap.get(e)}},{key:\"hasLocalConversation\",value:function(e){return this._conversationMap.has(e)}},{key:\"getLocalOldestMessage\",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:\"syncConversationList\",value:function(){var e=this,t=new ka(\"syncConversationList\");return this._pagingStatus===Zt.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){var o=function(e){if(st(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}}(e._pagingGetCostList);return xe.l(\"\".concat(e._n,\".\").concat(\"syncConversationList\",\". sum \").concat(function(e){if(st(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t.toFixed(0)}}(e._pagingGetCostList),\" ms, average \").concat(o,\" ms\")),e._pagingGetCostList.length=0,e._pagingStatus=Zt.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setMoreMessage(o).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=Zt.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];t.setError(n,s,a).end()})),Ja(n)}))}},{key:\"_diffAndDeleteConversation\",value:function(){var e=this;if(this._isSyncCompleted()){var t=[];this._conversationMap.forEach((function(n,o){!e._pagingConvIDMap.has(o)&&e._convIDFromUnreadDBMap.has(o)&&(e._conversationMap.delete(o),t.push(o))})),xe.l(\"\".concat(this._n,\"._diffAndDeleteConversation list:\").concat(t))}}},{key:\"_patchConversationProperties\",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),s=this.getModule(Un).getGroupList();Promise.all([n,o,s]).then((function(){var n=Date.now()-t;xe.l(\"\".concat(e._n,\"._patchConversationProperties ok. cost \").concat(n,\" ms\")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:\"_pagingGetConversationList\",value:function(){var e=this,t=\"\".concat(this._n,\"._pagingGetConversationList\");xe.l(\"\".concat(t,\" timeStamp:\").concat(this._pagingTimeStamp,\" startIndex:\").concat(this._pagingStartIndex)+\" pinnedTimeStamp:\".concat(this._pagingPinnedTimeStamp,\" pinnedStartIndex:\").concat(this._pagingPinnedStartIndex));var n=Date.now();return this._pagingStatus=Zt.PENDING,this.request({protocolName:No,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var s=o.data,a=s.completeFlag,r=s.conversations,i=void 0===r?[]:r,u=s.timeStamp,c=s.startIndex,l=s.pinnedTimeStamp,p=s.pinnedStartIndex,d=s.groupItem,g=Date.now()-n;if(e._pagingGetCostList.push(g),xe.l(\"\".concat(t,\" ok. completeFlag:\").concat(a,\" count:\").concat(i.length,\" cost \").concat(g,\" ms\")),e._convGroupHandler.onConvGroupListSynced(d),i.length>0){var _=e._getConversationOptions(i);e._pagingConvIDMap=new Map([].concat(m(e._pagingConvIDMap),m(_.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConversationList({conversationOptionsList:_,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return za();e.triggerReady()}return e._pagingTimeStamp=u,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=l,e._pagingPinnedStartIndex=p,1!==a?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),za())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(xe.w(\"\".concat(t,\" failed. error:\"),n),e.triggerReady())),n}))}},{key:\"_updateLocalConversationList\",value:function(e){var t,n=e.isFromGetConversations,o=e.isInstantMessage,s=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(m(t.toBeUpdatedConversationList),m(this._conversationMap)))),n||(this._updateUserOrGroupProfile(t.newConversationList),o&&this.emitTotalUnreadMessageCountUpdate()),xe.d(\"\".concat(this._n,\"._updateLocalConversationList cost \").concat(Date.now()-s,\" ms\"))}},{key:\"_getTmpConversationListMapping\",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,s=e.isUnreadC2CMessage,a=void 0!==s&&s,r=e.updateUnreadCount,i=[],u=[],c=this.getModule(Un),l=this.getModule(Pn),p=this.isIntl(),d=0,g=t.length;d0&&s.getUserProfile({userIDList:n}).then((function(e){var n=e.data;st(n)?n.forEach((function(e){t._doUpdateUserProfile(\"C2C\".concat(e.userID),e)})):t._doUpdateUserProfile(\"C2C\".concat(n.userID),n)})),o.length>0&&a.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"FaceUrl\"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n=\"GROUP\".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);pt(o.groupProfile,e,[],[null,void 0,\"\",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:\"_doUpdateUserProfile\",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t)}},{key:\"_getConversationOptions\",value:function(e){var n=this,o=[],s=e.filter((function(e){var t=e.type,n=e.userID;return 1===t&&\"@TLS#NOT_FOUND\"!==n&&\"@TLS#ERROR\"!==n||2===t})),a=this.getMyUserID(),r=s.map((function(e){if(at(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(s),{conversationID:\"C2C\".concat(e.userID),type:\"C2C\",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?n._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||\"\",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:\"\",nameCard:\"\",version:0,isPeerRead:e.lastC2CMsgFromAccount===a&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new ur(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:\"\",customData:e.customMark||\"\",markList:Bt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:\"GROUP\".concat(e.groupID),type:\"GROUP\",lastMessage:t(t({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||\"\",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||\"\",nameCard:e.senderNameCard||\"\",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new dr({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:\"\",version:0,customData:e.customMark||\"\",markList:Bt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));o.length>0&&this.getModule(On).onConversationsProfileUpdated(o);return r}},{key:\"_patchTypeAndPayload\",value:function(e){var n=e.lastMsg,o=n.event,s=void 0===o?void 0:o,a=n.elements,r=void 0===a?[]:a,i=n.groupTips,u=void 0===i?{}:i;if(!at(s)&&!jt(u)){var c=new Ha(u);c.setElement({type:S.MSG_GRP_TIP,content:t(t({},u.elements),{},{groupProfile:u.groupProfile})});var l=JSON.parse(JSON.stringify(c.payload));return c=null,{type:S.MSG_GRP_TIP,payload:l}}return{type:r[0]?r[0].type:null,payload:r[0]?this._amendLayersOverLimitProperty(r[0].content):null}}},{key:\"_amendLayersOverLimitProperty\",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:\"getLocalMessageList\",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:\"deleteLocalMessage\",value:function(e){e instanceof Ha&&this._messageListHandler.remove(e)}},{key:\"onConversationDeleted\",value:function(e){if(st(e)){var t=e.map((function(e){var t=e.type,n=e.userID,o=e.groupID;return 1===t?\"\".concat(S.CONV_C2C).concat(n):2===t?\"\".concat(S.CONV_GROUP).concat(o):void 0}));xe.l(\"\".concat(this._n,\".onConversationDeleted conversationIDList:\").concat(t)),this.deleteLocalConversationList(t)}}},{key:\"onConversationPinned\",value:function(e){var t=this;if(st(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,r=e.groupID;1===s?o=t.getLocalConversation(\"\".concat(S.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation(\"\".concat(S.CONV_GROUP).concat(r))),o&&(xe.l(\"\".concat(t._n,\".onConversationPinned conversationID:\").concat(o.conversationID,\" isPinned:\").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:\"onConversationUnpinned\",value:function(e){var t=this;if(st(e)){var n=!1;e.forEach((function(e){var o,s=e.type,a=e.userID,r=e.groupID;1===s?o=t.getLocalConversation(\"\".concat(S.CONV_C2C).concat(a)):2===s&&(o=t.getLocalConversation(\"\".concat(S.CONV_GROUP).concat(r))),o&&(xe.l(\"\".concat(t._n,\".onConversationUnpinned conversationID:\").concat(o.conversationID,\" isPinned:\").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:\"getMessageList\",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,s=e.count,a=\"\".concat(this._n,\".getMessageList\"),r=this.getLocalConversation(n),i=\"\";if(r&&r.groupProfile&&(i=r.groupProfile.type),Ct(i))return xe.l(\"\".concat(a,\" not available in avchatroom. conversationID:\").concat(n)),za({messageList:[],nextReqMessageID:\"\",isCompleted:!0});(at(s)||s>15)&&(s=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var u=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),c=this._completedMap.has(n);if(xe.l(\"\".concat(a,\" conversationID:\").concat(n,\" nextReqMessageID:\").concat(o)+\" remainingCount:\".concat(u,\" count:\").concat(s,\" isCompleted:\").concat(c)),this._needGetHistory({conversationID:n,remainingCount:u,count:s}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,s=e.storedMessageList,r=t._completedMap.has(n),i=s;u>0&&(i=t._messageListHandler.getLocalMessageList(n).slice(0,s.length+u));var c={nextReqMessageID:r?\"\":o,messageList:i,isCompleted:r};return xe.l(\"\".concat(a,\" ret.nextReqMessageID:\").concat(c.nextReqMessageID,\" ret.isCompleted:\").concat(c.isCompleted,\" ret.length:\").concat(i.length)),Ka(c)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:s});return za(l)}},{key:\"_getMessageListFromMemory\",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,s=\"\".concat(this._n,\"._getMessageListFromMemory\"),a=this._messageListHandler.getLocalMessageList(t),r=a.length,i=0,u={isCompleted:!1,nextReqMessageID:\"\",messageList:[]};return n?(i=a.findIndex((function(e){return e.ID===n})))>o?(u.messageList=a.slice(i-o,i),u.nextReqMessageID=a[i-o].ID):(u.messageList=a.slice(0,i),u.isCompleted=!0):r>o?(i=r-o,u.messageList=a.slice(i,r),u.nextReqMessageID=a[i].ID):(u.messageList=a.slice(0,r),u.isCompleted=!0),xe.l(\"\".concat(s,\" conversationID:\").concat(t)+\" ret.nextReqMessageID:\".concat(u.nextReqMessageID,\" ret.isCompleted:\").concat(u.isCompleted,\" ret.length:\").concat(u.messageList.length)),u}},{key:\"getMessageListHopping\",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,s=e.count,a=e.direction,r=void 0===a?0:a;if((at(s)||s>15)&&(s=15),t.startsWith(S.CONV_C2C)){var i=this.getModule(Gn),u=t.replace(S.CONV_C2C,\"\");return i.getRoamingMessagesHopping({peerAccount:u,time:o,count:s,direction:r})}if(t.startsWith(S.CONV_GROUP)){var c=this.getModule(Un),l=t.replace(S.CONV_GROUP,\"\");return c.getRoamingMessagesHopping({groupID:l,sequence:n,count:s,direction:r})}}},{key:\"_computeRemainingCount\",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),s=o.length;if(!n)return s;var a=0;return Et(t)?a=o.findIndex((function(e){return e.ID===n})):St(t)&&(a=-1!==n.indexOf(\"-\")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===a&&(a=0),a}},{key:\"_getMessageListSize\",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:\"_needGetHistory\",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,s=this.getLocalConversation(t),a=\"\";return s&&s.groupProfile&&(a=s.groupProfile.type),!kt(t)&&!Ct(a)&&(!(St(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:\"_isTopicConversation\",value:function(e){var t=e.replace(S.CONV_GROUP,\"\");return Dt(t)}},{key:\"getHistoryMessages\",value:function(e){var t=e.conversationID,n=e.count;if(t===S.CONV_SYSTEM)return za();var o=15;n>20&&(o=20);var s=null;if(Et(t)){var a=this._roamingMessageKeyAndTimeMap.has(t);return(s=this.getModule(Gn))?s.getRoamingMessage({conversationID:t,peerAccount:t.replace(S.CONV_C2C,\"\"),count:o,lastMessageTime:a?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:a?this._roamingMessageKeyAndTimeMap.get(t).messageKey:\"\"}):Ja({code:da.CANNOT_FIND_MODULE})}if(St(t)){if(!(s=this.getModule(Un)))return Ja({code:da.CANNOT_FIND_MODULE});var r=null;this._conversationMap.has(t)&&(r=this._conversationMap.get(t).lastMessage);var i=0;r&&(i=r.lastSequence);var u=this._roamingMessageSequenceMap.get(t);return s.getRoamingMessage({conversationID:t,groupID:t.replace(S.CONV_GROUP,\"\"),count:o,sequence:u||i})}return za()}},{key:\"patchConversationLastMessage\",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,s=n.payload;if(jt(o)||jt(s)){var a=this._messageListHandler.getLocalMessageList(e);if(0===a.length)return;var r=a[a.length-1];xe.l(\"\".concat(this._n,\".patchConversationLastMessage conversationID:\").concat(e,\" payload:\"),r.payload),t.updateLastMessage(r)}}}},{key:\"onRoamingMessage\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=n.startsWith(S.CONV_C2C)?S.CONV_C2C:S.CONV_GROUP,a=null,r=[],i=[],u=0,c=e.length,l=null,p=s===S.CONV_GROUP,d=this.getModule(Hn),g=this.getFileDownloadProxy(),_=function(){u=p?e.length-1:0,c=p?0:e.length},h=function(){p?--u:++u},f=function(){return p?u>=c:u0&&void 0!==arguments[0]?arguments[0]:{},n=\"setAllMessageRead\",o=\"\".concat(this._n,\".\").concat(n);t.scope||(t.scope=S.READ_ALL_MSG),xe.l(\"\".concat(o,\" options:\"),t);var s=this._createSetAllMessageReadPack(t);if(0===s.readAllC2CMessage&&0===s.groupMessageReadInfoList.length)return za();var a=new ka(n);return this.request({protocolName:rs,requestData:s}).then((function(n){var o=n.data,s=e._handleAllMessageRead(o);return a.setMessage(\"scope:\".concat(t.scope,\" failureGroups:\").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),za()})).catch((function(t){return e.probeNetwork().then((function(e){var n=v(e,2),o=n[0],s=n[1];a.setError(t,o,s).end()})),xe.w(\"\".concat(o,\" failed. error:\"),t),Ja({code:t&&t.code?t.code:da.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:\"setConversationCustomData\",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:\"markConversation\",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:\"getConversationGroupList\",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:\"createConversationGroup\",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:\"deleteConversationGroup\",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:\"renameConversationGroup\",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:\"addConversationsToGroup\",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:\"deleteConversationsFromGroup\",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:\"onConversationMarkUpdated\",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:\"onConversationGroupCreated\",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:\"onConversationGroupDeleted\",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:\"onConversationGroupNameUpdated\",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:\"onConversationInGroupUpdated\",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:\"onConversationAddedToOrDeletedFromGroup\",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:\"_getConversationLastMessageSequence\",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n0)if(a.type===S.CONV_C2C&&0===n.readAllC2CMessage){if(o===S.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===S.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(a.type===S.CONV_GROUP&&(o===S.READ_ALL_GROUP_MSG||o===S.READ_ALL_MSG)){var r=this._getConversationLastMessageSequence(a);n.groupMessageReadInfoList.push({groupID:a.groupProfile.groupID,messageSequence:r})}}}catch(i){s.e(i)}finally{s.f()}return n}},{key:\"onPushedAllMessageRead\",value:function(e){this._handleAllMessageRead(e)}},{key:\"_handleAllMessageRead\",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),o}},{key:\"_parseGroupReadInfo\",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n=1){if(1===n&&i.type===S.CONV_C2C){var u=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:u})}else if(i.type===S.CONV_GROUP){var c=r.replace(S.CONV_GROUP,\"\");if(this._remoteGroupReadSequenceMap.has(c)){var l=this._remoteGroupReadSequenceMap.get(c),p=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:r,remoteReadSequence:l}),p>=l&&this._remoteGroupReadSequenceMap.delete(c)}}this.updateUnreadCount(r,!1)&&(o+=1)}}}catch(d){s.e(d)}finally{s.f()}return o}},{key:\"isRemoteRead\",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(S.CONV_GROUP,\"\"),s=!1;if(this._remoteGroupReadSequenceMap.has(o)){var a=this._remoteGroupReadSequenceMap.get(o);n<=a&&(s=!0,xe.l(\"\".concat(this._n,\".isRemoteRead conversationID:\").concat(t,\" messageSequence:\").concat(n,\" remoteReadSequence:\").concat(a))),n>=a+10&&this._remoteGroupReadSequenceMap.delete(o)}return s}},{key:\"updateIsReadAfterReadReport\",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,s=this._messageListHandler.getLocalMessageList(t);if(0!==s.length)for(var a,r=s.length-1;r>=0;r--)if(a=s[r],!(o&&a.time>o||n&&a.sequence>n)){if(\"in\"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:\"updateUnreadCount\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),s=this._messageListHandler.getLocalMessageList(e);if(o){var a=o.unreadCount,r=s.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(a!==r&&(o.unreadCount=r,n=!0,xe.l(\"\".concat(this._n,\".updateUnreadCount from \").concat(a,\" to \").concat(r,\", conversationID:\").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),n&&o.type===S.CONV_TOPIC){var i=o.unreadCount,u=this.getModule(wn),c=e.replace(S.CONV_GROUP,\"\");u.onConversationProxy({topicID:c,unreadCount:i})}return n}}},{key:\"clearGroupAtInfoList\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),xe.l(\"\".concat(this._n,\".clearGroupAtInfoList conversationID:\").concat(e)),n.type===S.CONV_TOPIC){var o=n.groupAtInfoList,s=this.getModule(wn),a=e.replace(S.CONV_GROUP,\"\");s.onConversationProxy({topicID:a,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:\"updateReadReceiptInfo\",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,s=e.groupID,a=void 0===s?void 0:s,r=e.readReceiptList;if(!jt(r)){var i=[];if(at(o)){if(!at(a)){var u=\"\".concat(S.CONV_GROUP).concat(a);r.forEach((function(e){var n=e.tinyID,o=e.clientTime,s=e.random,r=e.readCount,c=e.unreadCount,l=\"\".concat(n,\"-\").concat(o,\"-\").concat(s),p=t._messageListHandler.getLocalMessage(u,l),d={groupID:a,messageID:l,readCount:0,unreadCount:0};p&&($e(r)&&(p.readReceiptInfo.readCount=r,d.readCount=r),$e(c)&&(p.readReceiptInfo.unreadCount=c,d.unreadCount=c),i.push(d))}))}}else{var c=\"\".concat(S.CONV_C2C).concat(o);r.forEach((function(e){var n=e.tinyID,s=e.clientTime,a=e.random,r=\"\".concat(n,\"-\").concat(s,\"-\").concat(a),u=t._messageListHandler.getLocalMessage(c,r);if(u){u.readReceiptInfo.isPeerRead=!0;var l={userID:o,messageID:r,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(E.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:\"recomputeGroupUnreadCount\",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var s=o.unreadCount,a=s-n;a<0&&(a=0),o.unreadCount=a,xe.l(\"\".concat(this._n,\".recomputeGroupUnreadCount from \").concat(s,\" to \").concat(a,\", conversationID:\").concat(t))}}},{key:\"updateIsRead\",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!kt(t.type)){for(var o=[],s=0,a=n.length;s0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(E.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;jt(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:\"updateMessageIsModifiedProperty\",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:\"setCompleted\",value:function(e){xe.l(\"\".concat(this._n,\".setCompleted. conversationID:\").concat(e)),this._completedMap.set(e,!0)}},{key:\"updateRoamingMessageKeyAndTime\",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:\"updateRoamingMessageSequence\",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:\"getConversationList\",value:function(e){var t=this,n=\"getConversationList\",o=\"\".concat(this._n,\".\").concat(n),s=\"pagingStatus:\".concat(this._pagingStatus,\", local conversation count:\").concat(this._conversationMap.size,\", options:\").concat(e);if(xe.l(\"\".concat(o,\". \").concat(s)),this._pagingStatus===Zt.REJECTED){var a=new ka(n);return a.setMessage(s),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ka({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}if(0===this._conversationMap.size){var r=new ka(n);return r.setMessage(s),this.syncConversationList().then((function(){r.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return Ka({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}var i=this._getConversationList(e);return xe.l(\"\".concat(o,\". returned conversation count:\").concat(i.length)),za({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}},{key:\"_getConversationList\",value:function(e){if(at(e))return this.getLocalConversationList();if(st(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ot(e)){var t=e.type,n=e.markType,o=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==S.CONV_C2C&&t!==S.CONV_GROUP||e.type===t)&&(!et(o)||e.conversationGroupList.includes(o))&&(!$e(n)||e.markList.includes(n))}))}return[]}},{key:\"_handleC2CPeerReadTime\",value:function(){var e,t=D(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];s.type===S.CONV_C2C&&(xe.d(\"\".concat(this._n,\"._handleC2CPeerReadTime conversationID:\").concat(o,\" peerReadTime:\").concat(s.peerReadTime)),this.recordPeerReadTime(o,s.peerReadTime))}}catch(a){t.e(a)}finally{t.f()}}},{key:\"_isPagingGetGroupListCompleted\",value:function(){return this.getModule(Un).isPagingGetCompleted()}},{key:\"_getLocalGroupCount\",value:function(){return this.getModule(Un).getLocalGroupList().length}},{key:\"_hasLocalGroup\",value:function(e){return this.getModule(Un).hasLocalGroup(e.replace(S.CONV_GROUP,\"\"))}},{key:\"getConversationProfile\",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new _r({conversationID:e,type:e.slice(0,3)===S.CONV_C2C?S.CONV_C2C:S.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===S.CONV_SYSTEM)return za({conversation:t});if(St(e)&&!this._hasLocalGroup(e))return za({conversation:t});var o=\"\".concat(this._n,\".\").concat(\"getConversationProfile\"),s=new ka(\"getConversationProfile\");return xe.l(\"\".concat(o,\". conversationID:\").concat(e,\" remark:\").concat(t.remark,\" lastMessage:\"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(a){s.setNetworkType(n.getNetworkType()).setMessage(\"conversationID:\".concat(e,\" unreadCount:\").concat(a.data.conversation.unreadCount)).end();var r=n.getModule(Pn);if(r&&t.type===S.CONV_C2C){var i=e.replace(S.CONV_C2C,\"\");if(r.isMyFriend(i)){var u=r.getFriendRemark(i);t.remark!==u&&(t.remark=u,xe.l(\"\".concat(o,\". conversationID:\").concat(e,\" patch remark:\").concat(t.remark)))}}return xe.l(\"\".concat(o,\" ok. conversationID:\").concat(e)),a})).catch((function(t){return n.probeNetwork().then((function(n){var o=v(n,2),a=o[0],r=o[1];s.setError(t,a,r).setMessage(\"conversationID:\".concat(e)).end()})),xe.e(\"\".concat(o,\" failed. error:\"),t),Ja(t)}))}},{key:\"_updateUserOrGroupProfileCompletely\",value:function(e){var t=this;return e.type===S.CONV_C2C?this.getModule(On).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?Ja(new Wa({code:da.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),za({conversation:e}))})):this.getModule(Un).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),za({conversation:e})}))}},{key:\"_unshiftConversation\",value:function(e){e instanceof _r&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(m(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:\"_onProfileUpdated\",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get(\"\".concat(S.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:\"_isSyncCompleted\",value:function(){return this._pagingStatus===Zt.RESOLVED}},{key:\"_errorLog\",value:function(e,t,n,o){var s=new Error(\"Params validate failed.\"),a=\"\".concat(this.getErrorMessage(\"API_REFER\")).concat(e);throw xe.w(\"[\".concat(e,\"] | \").concat(t,\" | \").concat(this.getErrorMessage(n,o),\", \").concat(a)),xe.e(\"[\".concat(e,\"] Invalid \").concat(t,\": type check failed for \").concat(t,\".\")),s}},{key:\"_isValidConversationID\",value:function(e){return Et(e)||St(e)||kt(e)}},{key:\"deleteConversation\",value:function(e){var t=this,n=\"deleteConversation\";return et(e)||nt(e)||this._errorLog(n,\"options\",\"StringOrObjectRequiredLog\"),et(e)?(this._isValidConversationID(e)||this._errorLog(n,\"options\",\"InvalidConversationID\",e),xe.l(\"\".concat(this._n,\".\").concat(n,\" conversationID:\").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(st(e.conversationIDList)||this._errorLog(n,\"conversationIDList\",\"ArrayRequiredLog\"),0===e.conversationIDList.length&&this._errorLog(n,\"conversationIDList\",\"NonEmptyArrayLog\"),e.conversationIDList.forEach((function(e){t._isValidConversationID(e)||t._errorLog(n,\"conversationIDList\",\"InvalidConversationID\",e)})),\"clearHistoryMessage\"in e&&\"boolean\"!=typeof e.clearHistoryMessage&&this._errorLog(n,\"clearHistoryMessage\",\"BooleanRequiredLog\"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:\"deleteConversationList\",value:function(e){var t=this,n=e.conversationIDList,o=void 0===n?[]:n,s=e.clearHistoryMessage,a=void 0===s||s,r=e.flag,i=void 0===r?0:r,u=\"\".concat(this._n,\".\").concat(\"deleteConversationList\");xe.l(\"\".concat(u,\" conversationIDList.length:\").concat(o.length,\" clearHistoryMessage:\").concat(a));var c=new ka(\"deleteConversationList\");return c.setMessage(\"conversationIDList:\".concat(o)),Promise.all([this.rmLocalOnlyConversationList(o),this.rmLocalAndRemoteConversationList(o,a)]).then((function(e){c.setNetworkType(t.getNetworkType()).end();var n=[].concat(m(e[0]),m(e[1]));return 0===n.length?Ja(new Wa({code:da.CONVERSATION_NOT_FOUND})):(xe.l(\"\".concat(u,\" ok\")),za(1===i?{conversationID:n[0]}:{conversationIDList:n}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),xe.e(\"\".concat(u,\" failed. error:\"),e),Ja(e)}))}},{key:\"rmLocalOnlyConversationList\",value:function(e){var t=this;return e.filter((function(e){if(!t._conversationMap.has(e))return!1;var n=t.getLocalConversation(e).type;return n!==S.CONV_GROUP||t._hasLocalGroup(e)?n===S.CONV_SYSTEM&&(t.getModule(Un).deleteGroupSystemNotice({messageList:t._messageListHandler.getLocalMessageList(e)}),t.deleteLocalConversation(e),!0):(t.deleteLocalConversation(e),!0)}))}},{key:\"rmLocalAndRemoteConversationList\",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach((function(e){if(n._conversationMap.has(e)){var t=n.getLocalConversation(e).type;t===S.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,\"\"),type:1}):t===S.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,\"\"),type:2})}})),0===o.conversationList.length?[]:this.request({protocolName:Go,requestData:o}).then((function(e){var t=[];return e.data.resultList.length>0&&e.data.resultList.map((function(e){if(0===e.code){var n=1===e.type?\"\".concat(S.CONV_C2C).concat(e.to):\"\".concat(S.CONV_GROUP).concat(e.groupID);t.push(n)}})),n.deleteLocalConversationList(t),t}))}},{key:\"clearHistoryMessage\",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return Ja({code:da.CONVERSATION_NOT_FOUND});var o=this._conversationMap.get(e).type;if(o===S.CONV_C2C)n.type=1,n.toAccount=e.replace(S.CONV_C2C,\"\");else{if(o!==S.CONV_GROUP)return o===S.CONV_SYSTEM?(this.getModule(Un).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),za({conversationID:e})):Ja({code:da.CONVERSATION_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(S.CONV_GROUP,\"\")}var s=\"\".concat(this._n,\".\").concat(\"clearHistoryMessage\"),a=new ka(\"clearHistoryMessage\");return a.setMessage(\"conversationID:\".concat(e)),xe.l(\"\".concat(s,\". conversationID:\").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Uo,requestData:n})})).then((function(){a.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(s,\" ok\")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConversationListAndEmitEvent()),za({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e(\"\".concat(s,\" failed. error:\"),e),Ja(e)}))}},{key:\"pinConversation\",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return Ja({code:da.CONVERSATION_NOT_FOUND});var s=this.getLocalConversation(n);if(s.isPinned===o)return za({conversationID:n});var a=\"\".concat(this._n,\".\").concat(\"pinConversation\"),r=new ka(\"pinConversation\");r.setMessage(\"conversationID:\".concat(n,\" isPinned:\").concat(o)),xe.l(\"\".concat(a,\". conversationID:\").concat(n,\" isPinned:\").concat(o));var i=null;return Et(n)?i={type:1,toAccount:n.replace(S.CONV_C2C,\"\")}:St(n)&&(i={type:2,groupID:n.replace(S.CONV_GROUP,\"\")}),this.request({protocolName:Po,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[i]}}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(a,\" ok\")),s.isPinned!==o&&(s.isPinned=o,t._sortConversationListAndEmitEvent()),Ka({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(a,\" failed. error:\"),e),Ja(e)}))}},{key:\"setMessageRemindType\",value:function(e){return this._messageRemindHandler.set(e)}},{key:\"patchMessageRemindType\",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,s=!1,a=this.getLocalConversation(n?\"\".concat(S.CONV_C2C).concat(t):\"\".concat(S.CONV_GROUP).concat(t));return a&&a.messageRemindType!==o&&(a.messageRemindType=o,s=!0),xe.d(\"\".concat(this._n,\".patchMessageRemindType options:\"),e,\"ret:\".concat(s)),s}},{key:\"onC2CMessageRemindTypeSynced\",value:function(e){var t=this,n=\"\".concat(this._n,\".onC2CMessageRemindTypeSynced\");xe.d(n,e),e.dataList.forEach((function(e){if(!jt(e.muteNotificationsSync)){var o,s=e.muteNotificationsSync,a=s.to,r=s.updateSequence,i=s.muteFlag;t._messageRemindHandler.setUpdateSequence(r),0===i?o=S.MSG_REMIND_ACPT_AND_NOTE:1===i?o=S.MSG_REMIND_DISCARD:2===i&&(o=S.MSG_REMIND_ACPT_NOT_NOTE);var u=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:o})&&(u+=1),xe.l(\"\".concat(n,\" updateCount:\").concat(u)),u>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:\"onGroupMessageRemindTypeSynced\",value:function(e){xe.d(\"\".concat(this._n,\".onGroupMessageRemindTypeSynced options:\"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:\"deleteLocalConversation\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._conversationMap.has(e);if(xe.d(\"\".concat(this._n,\".deleteLocalConversation conversationID:\").concat(e,\" has:\").concat(n)),n&&(this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e),t)){var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:\"deleteLocalConversationList\",value:function(e){var t=this,n=0,o=!1;e.forEach((function(e){t._conversationMap.has(e)&&(n+=t._conversationMap.get(e).unreadCount||0,t.deleteLocalConversation(e,!1),o=!0)})),xe.l(\"\".concat(this._n,\".deleteLocalConversationList conversationIDList.length:\").concat(e.length,\" isConvIDExisted:\").concat(o)),o&&(this.emitConversationUpdate(!0,!1),n>0&&this.emitTotalUnreadMessageCountUpdate())}},{key:\"isMessageSentByCurrentInstance\",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:\"modifyMessageList\",value:function(e){if(e.startsWith(S.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule(On).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),xe.l(\"\".concat(this._n,\".modifyMessageList conversationID:\").concat(e,\" cost \").concat(Date.now()-n,\" ms\"))}}},{key:\"updateUserProfileSpecifiedKey\",value:function(e){xe.l(\"\".concat(this._n,\".updateUserProfileSpecifiedKey options:\"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var s=this._conversationMap.get(t).userProfile;et(n)&&s.nick!==n&&(s.nick=n),et(o)&&s.avatar!==o&&(s.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:\"_onMyProfileModified\",value:function(e){var n=this,o=this.getLocalConversationList(),s=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),xe.l(\"\".concat(this._n,\"._onMyProfileModified. modify all messages sent by me, cost \").concat(Date.now()-s,\" ms\"))}},{key:\"modifyMessageSentByMe\",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:\"getLatestMessageSentByMe\",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:\"modifyMessageSentByPeer\",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:\"getLatestMessageSentByPeer\",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:\"pushIntoNoticeResult\",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:\"getLocalLastMessage\",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:\"checkAndPatchRemark\",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(Pn);if(!t)return e;var n=m(this._conversationMap.values()).filter((function(e){return e.type===S.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(S.CONV_C2C,\"\");if(t.isMyFriend(n)){var s=t.getFriendRemark(n);e.remark!==s&&(e.remark=s,o+=1)}})),xe.l(\"\".concat(this._n,\".checkAndPatchRemark. c2c conversation count:\").concat(n.length,\", patched count:\").concat(o)),e}},{key:\"updateTopicConversation\",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:\"sendReadReceipt\",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(Gn):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(Un)),n?n.sendReadReceipt(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getReadReceiptList\",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(Gn):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(Un)),n?n.getReadReceiptList(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getLastMessageTime\",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:\"getTotalUnreadMessageCount\",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==S.CONV_SYSTEM&&(\"\"!==e.messageRemindType&&e.messageRemindType!==S.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:\"emitTotalUnreadMessageCountUpdate\",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(xe.l(\"\".concat(this._n,\".emitTotalUnreadMessageCountUpdate from \").concat(this._convTotalUnreadCount,\" to \").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._pagingStatus=Zt.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this.resetReady()}}]),s}(ro),mr=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"GroupTipsHandler\",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return a(e,[{key:\"onCheckTimer\",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:\"_checkCachedGroupTips\",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);xe.l(\"\".concat(e._n,\"._checkCachedGroupTips groupID:\").concat(n,\" hasLocalGroup:\").concat(s,\" checkCount:\").concat(o)),s?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:\"onNewGroupTips\",value:function(e){xe.d(\"\".concat(this._n,\".onReceiveGroupTips count:\").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,s=t.AVChatRoomMessageList;(s.length>0&&this._groupModule.onAVChatRoomMessage(s),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:\"newGroupTipsStoredAndSummary\",value:function(e){for(var n=this,o=e.event,s=e.dataList,a=null,r=[],i=[],u={},c=[],l=function(e,l){var p=yt(s[e]);if(6===o){if(n._groupModule.isGroupAttributesUpdatedNotice(p))return\"continue\";if(n._groupModule.isGroupCountersNotice(p))return\"continue\"}var d=p.groupProfile,g=d.groupID,_=d.communityType,h=void 0===_?0:_,f=d.topicID,v=void 0===f?void 0:f,m=d.invisible,M=void 0,y=n._groupModule.isMessageFromTopic(h,v);if(y){M=S.CONV_TOPIC,p.to=v;var I=n._groupModule.getModule(wn);I.hasLocalTopic(g,v)||n._getTopicPendingMap.has(v)||(n._getTopicPendingMap.set(v,1),I.getTopicList({groupID:g,topicIDList:[v]}).finally((function(){n._getTopicPendingMap.delete(v)})))}var C=n._groupModule.hasLocalGroup(g);if(!C&&n._groupModule.isUnjoinedAVChatRoom(g))return\"continue\";if(!C&&!y)return n._cacheGroupTipsAndProbe({groupID:g,event:o,item:p}),\"continue\";if(n._groupModule.isMessageFromOrToAVChatroom(g))return p.event=o,c.push(p),\"continue\";if(p.currentUser=n._groupModule.getMyUserID(),p.conversationType=S.CONV_GROUP,(a=new Ha(p)).setElement({type:S.MSG_GRP_TIP,content:t(t({},p.elements),{},{groupProfile:p.groupProfile})}),a.isSystemMessage=!1,1===m)return n._qualityStat(a),\"continue\";var T=n._groupModule.getModule(Fn),D=a,E=D.conversationID,k=D.sequence;if(6===o)a._onlineOnlyFlag=!0,i.push(a);else if(!T.pushIntoNoticeResult(i,a))return\"continue\";if(n._groupModule.isMessageFromCommunityOfTopic(h,v))return\"continue\";if(6===o&&T.getLocalConversation(E))return\"continue\";6!==o&&n._qualityStat(a);var L=T.isRemoteRead({conversationID:E,sequence:k});if(at(u[E])){var A=0;\"in\"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||(A=1)),u[E]=r.push({conversationID:E,unreadCount:A,type:at(M)?a.conversationType:M,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?\"\":a})-1}else{var R=u[E];r[R].type=a.conversationType,r[R].subType=a.conversationSubType,r[R].lastMessage=a._isExcludedFromLastMessage?\"\":a,\"in\"===a.flow&&(a._isExcludedFromUnreadCount||a._onlineOnlyFlag||L||r[R].unreadCount++)}},p=0,d=s.length;p=0){u.updateSelfInfo({muteTime:p.muteTime}),c=!0;break}}c&&this._groupModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u})}}},{key:\"_onTopicProfileUpdated\",value:function(e){var n=e.payload,o=n.groupProfile.groupID,s=n.newTopicInfo;this._groupModule.getModule(wn).onTopicProfileUpdated(t({groupID:o,topicID:e.to},s))}},{key:\"_cacheGroupTips\",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:\"_deleteCachedGroupTips\",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:\"_notifyCachedGroupTips\",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),xe.l(\"\".concat(this._n,\"._notifyCachedGroupTips groupID:\").concat(e,\" count:\").concat(n.length))}},{key:\"_cacheGroupTipsAndProbe\",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupTips(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),xe.l(\"\".concat(this._n,\"._cacheGroupTipsAndProbe groupID:\").concat(n))}},{key:\"reset\",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Mr=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"CommonGroupHandler\",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(Za,this._initGroupList,this)}return a(e,[{key:\"onCheckTimer\",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:\"_checkCachedGroupMessage\",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);xe.l(\"\".concat(e._n,\"._checkCachedGroupMessage groupID:\").concat(n,\" hasLocalGroup:\").concat(s,\" checkCount:\").concat(o)),s?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:\"_initGroupList\",value:function(){var e=this;xe.l(\"\".concat(this._n,\"._initGroupList\"));var t=new ka(\"getGroupListInStorage\"),n=this._groupModule.getStorageGroupList();if(st(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage(\"group count:\".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage(\"group count:0\").end();xe.l(\"\".concat(this._n,\"._initGroupList ok\"))}},{key:\"handleUpdateGroupLastMessage\",value:function(e){var n=\"\".concat(this._n,\".handleUpdateGroupLastMessage\");if(xe.l(\"\".concat(n,\" conversation count:\").concat(e.length,\", local group count:\").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var o,s,a,r=!1,i=0,u=e.length;i0&&this._groupModule.onAVChatRoomMessage(s),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:n,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var a=this._groupModule.filterUnmodifiedMessage(o);a.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,a),o.length=0}},{key:\"_newGroupMessageStoredAndSummary\",value:function(e){var t=this,n=e.dataList,o=e.event,s=e.isInstantMessage,a=null,r=[],i=[],u=[],c={},l=this._groupModule.getModule(Hn),p=this._groupModule.getFileDownloadProxy(),d=n.length;d>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var d=yt(n[e]),g=d.groupProfile,_=g.groupID,h=g.communityType,f=void 0===h?0:h,v=g.topicID,m=void 0===v?void 0:v,M=g.invisible,y=void 0,I=t._groupModule.isMessageFromTopic(f,m);if(I){y=S.CONV_TOPIC,d.to=m;var C=t._groupModule.getModule(wn);C.hasLocalTopic(_,m)||t._getTopicPendingMap.has(m)||(t._getTopicPendingMap.set(m,1),C.getTopicList({groupID:_,topicIDList:[m]}).finally((function(){t._getTopicPendingMap.delete(m)})))}var T=t._groupModule.hasLocalGroup(_);if(!T&&t._groupModule.isUnjoinedAVChatRoom(_))return\"continue\";if(!T&&!I)return t._cacheGroupMessageAndProbe({groupID:_,event:o,item:d}),\"continue\";if(t._groupModule.isMessageFromOrToAVChatroom(_))return d.event=o,u.push(d),\"continue\";if(d.currentUser=t._groupModule.getMyUserID(),d.conversationType=S.CONV_GROUP,d.isSystemMessage=!!d.isSystemMessage,a=new Ha(d),d.elements=l.parseElements(d.elements,d.from),a.setElement(d.elements,p),1===M)return t._qualityStat(s,a),\"continue\";var D=1===n[e].isModified,E=t._groupModule.getModule(Fn);if(E.isMessageSentByCurrentInstance(a)?a.isModified=D:D=!1,1===d.onlineOnlyFlag)a._onlineOnlyFlag=!0,E.isMessageSentByCurrentInstance(a)||i.push(a);else{if(t._groupModule.isMessageFromCommunityOfTopic(f,m))return i.push(a),\"continue\";if(!E.pushIntoMessageList(i,a,D))return\"continue\";t._qualityStat(s,a);var k=a,L=k.conversationID,A=k.sequence,R=E.isRemoteRead({conversationID:L,sequence:A});if(at(c[L])){var N=0;\"in\"===a.flow&&(a._isExcludedFromUnreadCount||R||(N=1)),c[L]=r.push({conversationID:L,unreadCount:N,type:at(y)?a.conversationType:y,subType:a.conversationSubType,lastMessage:a._isExcludedFromLastMessage?\"\":a})-1}else{var O=c[L];r[O].type=at(y)?a.conversationType:y,r[O].subType=a.conversationSubType,r[O].lastMessage=a._isExcludedFromLastMessage?\"\":a,\"in\"===a.flow&&(a._isExcludedFromUnreadCount||R||r[O].unreadCount++)}}},_=0;_0&&n.addMessageDelay(t.clientTime)}},{key:\"onGroupMessageRevoked\",value:function(e){var t=this._groupModule.getModule(Fn),n=[],o=null,s=!0;e.dataList.forEach((function(e){var a=e.elements.revokedInfos;at(a)||a.forEach((function(e){var a=jt(e.topicID)?\"GROUP\".concat(e.groupID):\"GROUP\".concat(e.topicID);o=t.revoke(a,e.sequence,e.random);var r=e.revokerInfo&&e.revokerInfo.revoker;if(o)o.revoker=r,n.push(o);else{var i={conversationID:a,to:e.topicID||\"\",sequence:e.sequence,time:e.time,revoker:r};t.isLastMessageRevoked(i)&&(n.push(i),s=!1)}}))})),0!==n.length&&(t.onMessageRevoked(n),!0===s&&(xe.l(\"\".concat(this._n,\".onGroupMessageRevoked count:\").concat(n.length)),this._groupModule.emitOuterEvent(E.MESSAGE_REVOKED,n)))}},{key:\"_groupListTreeShaking\",value:function(e){for(var t=new Map(m(this._groupModule.getGroupMap())),n=0,o=e.length;ng),h=\"offset:\".concat(u,\" totalCount:\").concat(d,\" isCompleted:\").concat(_,\" \")+\"currentCount:\".concat(l.length,\" isCommunityRelay:\").concat(s);return p.setNetworkType(t._groupModule.getNetworkType()).setMessage(\"\".concat(h)).end(),s||_?!s&&_?(xe.l(\"\".concat(n,\" start to get community list\")),u=0,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):s&&!_?(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):(xe.l(\"\".concat(n,\" ok. totalCount:\").concat(l.length)),Ka({groupList:l})):(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];p.setMessage(\"isCommunityRelay:\".concat(s)).setError(e,o,a).end()})),s?(11e3===e.code&&(p=null,xe.l(\"\".concat(n,\" ok. community unavailable\"))),za({groupList:l})):Ja(e)}))}},{key:\"_pagingGetGroupListWithTopic\",value:function(e){var t=this,n=\"\".concat(this._n,\"._pagingGetGroupListWithTopic\"),o=e.limit,s=e.offset,a=e.groupBaseInfoFilter,r=e.groupList,i=new ka(\"pagingGetGroupListWithTopic\");return this._groupModule.request({protocolName:Wo,requestData:{type:S.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:[\"Role\",\"JoinTime\",\"MsgFlag\",\"MsgSeq\"]},isSupportTopic:1}}).then((function(e){var u=e.data,c=u.groups,l=void 0===c?[]:c,p=u.totalCount;r.push.apply(r,m(l));var d=s+o,g=!(p>d),_=\"offset:\".concat(s,\" totalCount:\").concat(p,\" isCompleted:\").concat(g,\" \")+\"currentCount:\".concat(r.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage(\"\".concat(_)).end(),g?(xe.l(\"\".concat(n,\" ok. totalCount:\").concat(r.length)),Ka({groupList:r})):(s=d,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:a,groupList:r}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ja(e)}))}},{key:\"_cacheGroupMessage\",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:\"_deleteCachedGroupMessage\",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:\"_notifyCachedGroupMessage\",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),xe.l(\"\".concat(this._n,\"._notifyCachedGroupMessage groupID:\").concat(e,\" count:\").concat(n.length))}},{key:\"_cacheGroupMessageAndProbe\",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupMessage(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),xe.l(\"\".concat(this._n,\"._cacheGroupMessageAndProbe groupID:\").concat(n))}},{key:\"_handleGroupAtInfoWithoutTopic\",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,s=e.groupAtInfoList,a=[];at(s)||(s.forEach((function(e){a.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(Fn).onNewGroupAtTips({dataList:a}))}))}},{key:\"reset\",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(Za,this._initGroupList,this)}}]),e}(),yr=1,Ir=2,Cr=3,Tr=4,Dr=5,Er=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"GroupAttributesHandler\",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._groupModule.getCloudConfig(\"grp_attr_cache_time\");at(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:\"updateLocalMainSequenceOnReconnected\",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:\"isGroupAttributesUpdatedNotice\",value:function(e){var t=e.to,n=e.elements.newGroupProfile,o=!at(n)&&!jt(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:\"_onGroupAttributesUpdated\",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,s=o.mainSequence,a=o.isWithChangedAttributeInfo,r=o.groupAttributeList,i=void 0===r?[]:r,u=o.operationType;if(xe.l(\"\".concat(this._n,\".onGroupAttributesUpdated. \")+\"groupID:\".concat(n,\" isWithChangedAttributeInfo:\").concat(a,\" operationType:\").concat(u)),!at(u)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var c=s-this._getLocalGroupAttributes(n).localMainSequence;if(0!==c){if(1===a&&1===c)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:i,operationType:u}),void this._emitGroupAttributesUpdated(n);if(this._hasLocalGroupAttributes(n)){var l=this._getLocalGroupAttributes(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}}},{key:\"initGroupAttributesCache\",value:function(e){var t=e.groupID,n=e.avChatRoomKey,o=void 0===n?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),xe.l(\"\".concat(this._n,\".initGroupAttributesCache groupID:\").concat(t,\" avChatRoomKey:\").concat(o))}},{key:\"initGroupAttributes\",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,s=this._getLocalGroupAttributes(n),a=s.remoteMainSequence,r=s.avChatRoomKey,i=new ka(\"initGroupAttributes\");return i.setMessage(\"groupID:\".concat(n,\" avChatRoomKey:\").concat(r,\" mainSequence:\").concat(a)),this._groupModule.request({protocolName:Ms,requestData:{groupID:n,avChatRoomKey:r,mainSequence:a,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){xe.l(\"\".concat(t._n,\".\").concat(\"initGroupAttributes\",\" ok. groupID:\").concat(n));var s=e.data,a=s.mainSequence,r=m(s.groupAttributeList);return r.forEach((function(e){e.value=o[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:r,operationType:yr}),t._emitGroupAttributesUpdated(n),i.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ja(e)}))}},{key:\"setGroupAttributes\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"setGroupAttributes\"),o=e.groupID,s=e.groupAttributes,a=this._getLocalGroupAttributes(o),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,c=this._transformGroupAttributes(s);c.forEach((function(e){var t=e.key;e.sequence=0,u.has(t)&&(e.sequence=u.get(t).sequence)}));var l=new ka(\"setGroupAttributes\");return l.setMessage(\"groupID:\".concat(o,\" groupAttributes:\").concat(JSON.stringify(s))),xe.l(\"\".concat(n,\". groupID:\").concat(o,\" mainSequence:\").concat(r)),this._groupModule.request({protocolName:ys,requestData:{groupID:o,avChatRoomKey:i,mainSequence:r,groupAttributeList:c}}).then((function(e){xe.l(\"\".concat(n,\" ok.\"));var a=e.data,r=a.mainSequence,i=m(a.groupAttributeList);return i.forEach((function(e){e.value=s[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:o}),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:r,groupAttributeList:i,operationType:Ir}),t._emitGroupAttributesUpdated(o),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({groupAttributes:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ja(e)}))}},{key:\"deleteGroupAttributes\",value:function(e){var t=this,n=e.groupID,o=e.keyList,s=void 0===o?[]:o,a=this._getLocalGroupAttributes(n),r=a.remoteMainSequence,i=a.avChatRoomKey,u=a.attributes,c=m(u.keys()),l=Cs,p=Cr,d={groupID:n,avChatRoomKey:i,mainSequence:r},g=[];s.length>0&&(c=[],l=Is,p=Tr,s.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,c.push(e)),g.push({key:e,sequence:t})})),d.groupAttributeList=g);var _=new ka(\"deleteGroupAttributes\");return _.setMessage(\"groupID:\".concat(n,\" mainSequence:\").concat(r,\" keyList:\").concat(s,\" protocolName:\").concat(l)),this._groupModule.request({protocolName:l,requestData:d}).then((function(e){xe.l(\"\".concat(t._n,\".\").concat(\"deleteGroupAttributes\",\" ok. groupID:\").concat(n));var o=e.data.mainSequence;return t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:g,operationType:p}),t._emitGroupAttributesUpdated(n),_.setNetworkType(t._groupModule.getNetworkType()).end(),Ka({keyList:c})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];_.setError(e,o,s).end()})),Ja(e)}))}},{key:\"getGroupAttributes\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"getGroupAttributes\"),o=e.groupID,s=this._getLocalGroupAttributes(o),a=s.avChatRoomKey,r=s.lastUpdateTime,i=s.localMainSequence,u=s.remoteMainSequence,c=new ka(\"getGroupAttributes\");if(c.setMessage(\"groupID:\".concat(o,\" localMainSequence:\").concat(i,\" remoteMainSequence:\").concat(u,\" keyList:\").concat(e.keyList)),Date.now()-r>=this.CACHE_EXPIRE_TIME||i0)o.forEach((function(e){a.has(e)&&(s[e]=a.get(e).value)}));else{var r,i=D(a.keys());try{for(i.s();!(r=i.n()).done;){var u=r.value;s[u]=a.get(u).value}}catch(c){i.e(c)}finally{i.f()}}}return s}},{key:\"_updateCachedAttributes\",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;o!==Cr?o!==Tr?(o===yr&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,s=e.sequence;t.attributes.set(n,{value:o,sequence:s})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:\"_hasLocalGroupAttributes\",value:function(e){return this._groupAttributesMap.has(e)}},{key:\"_getLocalGroupAttributes\",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:\"_transformGroupAttributes\",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:\"_emitGroupAttributesUpdated\",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,s=n.deletedKeyList;xe.l(\"\".concat(this._n,\"._emitGroupAttributesUpdated update:\").concat(o.length,\", delete:\").concat(s.length)),0===o.length&&0===s.length||this._groupModule.emitOuterEvent(E.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:s})}},{key:\"_computeAttrChangedInfo\",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach((function(o){e[o]!==t._groupAttributesCopy[o]&&n.push(o)})),Object.keys(this._groupAttributesCopy).forEach((function(t){at(e[t])&&o.push(t)})),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:o}}},{key:\"deleteLocalGroupAttributes\",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:\"reset\",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Sr=\"Set\",kr=\"Increase\",Lr=\"Decrease\",Ar=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"GroupCountersHandler\",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._groupModule.getCloudConfig(\"grp_counter_expire_time\");at(e)||(this.EXPIRE_TIME=Number(e))}},{key:\"isGroupCountersNotice\",value:function(e){var t=e.to,n=e.elements.groupCounterInfo,o=!1;return jt(n)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:n}),o=!0),o}},{key:\"_onGroupCountersUpdated\",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var o=e.type,s=e.groupCounterSeq,a=e.counterList,r=void 0===a?[]:a;0!==o&&2!==o||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:r}),r.forEach((function(e){t._groupModule.emitOuterEvent(E.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===o&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:r})})),xe.l(\"\".concat(this._n,\"._onGroupCountersUpdated groupID:\").concat(n))}},{key:\"initGroupCountersCache\",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:n}),xe.l(\"\".concat(this._n,\".initGroupCountersCache groupID:\").concat(t,\" avChatRoomKey:\").concat(n))}},{key:\"setGroupCounters\",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".setGroupCounters\"),o=e.groupID,s=e.counters,a=this._convertObjectToList(s),r=this._getLocalGroupCounters(o).avChatRoomKey,i=\"groupID:\".concat(o,\" count:\").concat(a.length),u=new ka(\"setGroupCounters\");return u.setMessage(\"\".concat(i)),xe.l(\"\".concat(n,\". \").concat(i)),this._updateGroupCounters({groupID:o,counterList:a,avChatRoomKey:r,mode:Sr}).then((function(e){return u.end(),xe.l(\"\".concat(n,\" ok.\")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"increaseGroupCounter\",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".increaseGroupCounters\"),o=e.groupID,s=e.key,a=e.value,r=this._getLocalGroupCounters(o).avChatRoomKey,i=\"groupID:\".concat(o,\" key:\").concat(s,\" value:\").concat(a),u=new ka(\"increaseGroupCounter\");u.setMessage(\"\".concat(i)),xe.l(\"\".concat(n,\". \").concat(i));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:r,mode:kr}).then((function(e){return u.end(),xe.l(\"\".concat(n,\" ok.\")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"decreaseGroupCounter\",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".decreaseGroupCounter\"),o=e.groupID,s=e.key,a=e.value,r=this._getLocalGroupCounters(o).avChatRoomKey,i=\"groupID:\".concat(o,\" key:\").concat(s,\" value:\").concat(a),u=new ka(\"decreaseGroupCounter\");u.setMessage(\"\".concat(i)),xe.l(\"\".concat(n,\". \").concat(i));var c=[{key:s,value:a}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:r,mode:Lr}).then((function(e){return u.end(),xe.l(\"\".concat(n,\" ok.\")),Ka({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getGroupCounters\",value:function(e){var t=this;if(!this._groupModule.canIUse(B.GRP_COUNTER))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".getGroupCounters\"),o=e.groupID,s=e.keyList,a=void 0===s?[]:s,r=this._getLocalGroupCounters(o),i=r.avChatRoomKey,u=r.lastUpdateTime,c=new ka(\"getGroupCounters\");if(c.setMessage(\"groupID:\".concat(o)),Date.now()-u>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:i}).then((function(e){c.setMoreMessage(\"from remote. count:\".concat(e.length)).end(),xe.l(\"\".concat(n,\" from remote. groupID:\").concat(o));var s=t._getLocalCounters(o,a);return Ka({counters:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ja(e)}));c.setMoreMessage(\"from cache\").end(),xe.l(\"\".concat(n,\" from cache. groupID:\").concat(o));var l=this._getLocalCounters(o,a);return za({counters:l})}},{key:\"_getRemoteGroupCounters\",value:function(e){var n=this;return this._groupModule.request({protocolName:Ls,requestData:t({},e)}).then((function(t){var o=t.data,s=o.counterList,a=void 0===s?[]:s,r=o.groupCounterSeq;return n._updateLocalGroupCounters({groupID:e.groupID,counterList:a,groupCounterSeq:r}),xe.l(\"\".concat(n._n,\"._getRemoteGroupCounters ok. groupID:\").concat(e.groupID)),a})).catch((function(e){return Ja(e)}))}},{key:\"_convertObjectToList\",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:\"_updateGroupCounters\",value:function(e){var n=\"\".concat(this._n,\"._updateGroupCounters\"),o=e.groupID,s=e.avChatRoomKey,a=e.mode;return xe.l(\"\".concat(n,\". groupID:\").concat(o,\" avChatRoomKey:\").concat(s,\" mode:\").concat(a)),this._groupModule.request({protocolName:ks,requestData:t({},e)}).then((function(e){xe.l(\"\".concat(n,\" ok.\"));var t=e.data.counterList,o={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,n=e.value;o[t]=n})),o})).catch((function(e){return Ja(e)}))}},{key:\"_hasLocalGroupCounters\",value:function(e){return this._groupCountersMap.has(e)}},{key:\"_getLocalGroupCounters\",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:\"_updateLocalGroupCounters\",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,s=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var a=this._getLocalGroupCounters(t),r=a.counters,i=a.avChatRoomKey,u=a.groupCounterSeq;if(s>0&&s0)t.forEach((function(e){o.has(e)&&(n[e]=o.get(e))}));else{var s,a=D(o.keys());try{for(a.s();!(s=a.n()).done;){var r=s.value;n[r]=o.get(r)}}catch(i){a.e(i)}finally{a.f()}}return n}},{key:\"reset\",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Rr=function(){function e(t){o(this,e);var n=t.manager,s=t.groupID,a=t.onInit,r=t.onSuccess,i=t.onFail;this._n=\"Polling\",this._manager=n,this._groupModule=n._groupModule,this._onInit=a,this._onSuccess=r,this._onFail=i,this._groupID=s,this._timeoutID=-1,this._isRunning=!1,this._protocolName=_s}return a(e,[{key:\"start\",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=hs),xe.l(\"\".concat(this._n,\".start pollingInterval:\").concat(this._manager.getPollingInterval(),\" isLoggedIn:\").concat(e)),this._isRunning=!0,this._request()}},{key:\"isRunning\",value:function(){return this._isRunning}},{key:\"_request\",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:\"stop\",value:function(){xe.l(\"\".concat(this._n,\".stop\")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:\"getPollingTimerID\",value:function(){return this._timeoutID}}]),e}(),Nr={3:!0,4:!0,5:!0,6:!0,17:!0},Or=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"AVChatRoomHandler\",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new lr(200),this.messageIDLinkedList=new lr(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return a(e,[{key:\"hasJoinedAVChatRoom\",value:function(){return this._joinedGroupMap.size>0}},{key:\"checkJoinedAVChatRoomByID\",value:function(e){return this._joinedGroupMap.has(e)}},{key:\"getJoinedAVChatRoom\",value:function(){return this._joinedGroupMap.size>0?m(this._joinedGroupMap.keys()):null}},{key:\"_updateRequestData\",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===m(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):t(t({},n),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:\"_handleSuccess\",value:function(e,t){var n=t.data,o=n.key,s=n.nextSeq,a=n.rspMsgList,r=n.errorCode,i=n.nextBroadcastSeq,u=n.broadcastMessageList;if(0!==r){var c=this._pollingRequestInfoMap.get(e),l=new ka(\"longPollingAVError\"),p=c?\"\".concat(c.key,\"-\").concat(c.startSeq):\"requestInfo is undefined\";l.setMessage(\"\".concat(e,\"-\").concat(p,\"-\").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;et(o)&&$e(s)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:s}),$e(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),st(a)&&a.length>0?(a.forEach((function(e){e.to=e.groupID})),this.onMessage(a)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(u)}}},{key:\"_handleFailure\",value:function(e,t){}},{key:\"onMessage\",value:function(e){if(st(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(Fn),s=this._getModule($n),a=e.length;a>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var r=this._getModule(qn),i=0;i1&&g<=20?this._getModule(Jn).onMessageMaybeLost(p,d+1,g-1):g<-1&&g>=-20&&this._getModule(Jn).onMessageMaybeLost(p,t.sequence+1,Math.abs(g)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var _=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(_=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):_=!0,_){if(t.conversationType===S.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!l&&t.conversationType!==S.CONV_SYSTEM){var h=t.conversationID.replace(S.CONV_GROUP,\"\");this._pollingInstanceMap.has(h)?this._groupModule.isLoggedIn()&&s.addMessageSequence({key:Ca,message:t}):(t.type!==S.MSG_GRP_TIP&&t.clientTime>0&&s.addMessageDelay(t.clientTime),s.addMessageSequence({key:Ia,message:t}))}n.push(t)}}}else xe.w(\"\".concat(this._n,\".onMessage unknown event:\").concat(u.event))}if(0!==n.length){this._groupModule.filterModifiedMessage(n);var f=this.packConversationOption(n);if(f.length>0)this._getModule(Fn).onNewMessage({conversationOptionsList:f,isInstantMessage:!0});xe.d(\"\".concat(this._n,\".onMessage count:\").concat(n.length)),this._checkMessageStacked(n);var v=this._groupModule.filterUnmodifiedMessage(n);v.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,v),n.length=0}}}},{key:\"isBroadcastOrNormal\",value:function(e){return 3===e||17===e}},{key:\"isGroupTip\",value:function(e){return 4===e||6===e}},{key:\"isGroupSystemNotice\",value:function(e){return 5===e}},{key:\"restoreGroupTipElements\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.groupJoinType||(e.groupJoinType=1);var t=e.operatorInfo,n=void 0===t?{}:t,o=e.operatorID,s=e.userIDList,a=void 0===s?[]:s,r=n.userID,i=void 0===r?o:r,u=n.avatar,c=void 0===u?\"\":u,l=n.nick,p=void 0===l?\"\":l;e.operatorInfo={userID:i,avatar:c,nick:p};var d=a.map((function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||d,e}},{key:\"restoreMessageFromSimplified\",value:function(e){var n=e.event;if(this.isBroadcastOrNormal(n)&&(e.cloudCustomData=e.cloudCustomData||\"\",e.elements=e.elements.map((function(e){if(e.type===S.MSG_CUSTOM){var n=e.content,o=void 0===n?{}:n;e.content=t({data:\"\",description:\"\",extension:\"\"},o)}return e}))),(this.isGroupTip(n)||this.isGroupSystemNotice(n))&&(e.from=e.from||\"@TIM#SYSTEM\"),this.isGroupTip(n)){e.elements=this.restoreGroupTipElements(e.elements);var o=e.elements,s=void 0===o?{}:o,a=s.operationType,i=s.operatorInfo;if(1===a){var u=[{userID:(void 0===i?{}:i).userID}];s.memberInfoList=s.memberInfoList||u}}if(this.isGroupSystemNotice(n)){var c=e.elements,l=c.memberInfoList,p=c.operatorInfo;l||(l=void 0===p?{}:p),e.elements.memberInfoList=t({userID:e.elements.operatorID,avatar:\"\",nick:\"\"},l),e.elements=t({authentication:\"\",remarkInfo:\"\",messageKey:1e3*e.time},e.elements);var d=Object.keys(e.elements).filter((function(e){return\"operatorInfo\"!==e})).reduce((function(n,o){return t(t({},n),{},r({},o,e.elements[o]))}),{});e.elements=d}return e}},{key:\"_onGroupDismissed\",value:function(e){xe.l(\"\".concat(this._n,\"._onGroupDismissed groupID:\").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:\"_checkMessageStacked\",value:function(e){var t=\"MessageStacked\",n=e.length;n>=100&&(this._groupModule.outputWarning(t,n),this._reportMessageStackedCount<5&&(new ka(t).setNetworkType(this._groupModule.getNetworkType()).setMessage(\"count:\".concat(n,\" groupID:\").concat(m(this._joinedGroupMap.keys()))).setLevel(\"warning\").end(),this._reportMessageStackedCount+=1))}},{key:\"_isMessageSentByCurrentInstance\",value:function(e){return!!this._getModule(Fn).isMessageSentByCurrentInstance(e)}},{key:\"packMessage\",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?S.CONV_SYSTEM:S.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new Ha(e),o=this.packElements(e,t);return n.setElement(o,this._groupModule.getFileDownloadProxy()),n}},{key:\"packElements\",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),{type:S.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:S.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(Hn).parseElements(e.elements,e.from)}},{key:\"packConversationOption\",value:function(e){for(var t=new Map,n=0;n0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,t)}}},{key:\"start\",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new Rr({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),xe.l(\"\".concat(this._n,\".start groupID:\").concat(e))}}},{key:\"handleJoinResult\",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,s=o.groupID;return t._joinedGroupMap.set(s,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(s),t._groupModule.emitGroupListUpdate(!0,!1),at(n)?za({status:Ye,group:o}):Promise.resolve()}))}},{key:\"startRunLoop\",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,s=e.startSeq,a=void 0===s?0:s,r=o.groupID;return t._pollingRequestInfoMap.set(r,{key:n,startSeq:a}),t.start(r),t._groupModule.isLoggedIn()?za({status:Ye,group:o}):za({status:Ye})}))}},{key:\"_preCheck\",value:function(){if(this._getModule(qn).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=v(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===S.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:\"joinWithoutAuth\",value:function(e){var t=this,n=e.groupID,o=\"\".concat(this._n,\".\").concat(\"joinWithoutAuth\"),s=new ka(\"joinWithoutAuth\");return this._groupModule.request({protocolName:Qo,requestData:e}).then((function(e){var a=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=v(e,2);t[0];var o=t[1];s.setNetworkType(o).setMessage(\"groupID:\".concat(n,\" longPollingKey:\").concat(a)).end(!0)})),at(a))return Ja({code:da.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});xe.l(\"\".concat(o,\" ok. groupID:\").concat(n)),t._getModule(Fn).setCompleted(\"\".concat(S.CONV_GROUP).concat(n));var r=new dr({groupID:n});return t.startRunLoop({group:r,longPollingKey:a}),Ka({status:Ye})})).catch((function(e){return xe.e(\"\".concat(o,\" failed. groupID:\").concat(n,\" error:\"),e),t._groupModule.probeNetwork().then((function(t){var o=v(t,2),a=o[0],r=o[1];s.setError(e,a,r).setMessage(\"groupID:\".concat(n)).end(!0)})),Ja(e)})).finally((function(){t._groupModule.getModule(Vn).reportAtOnce()}))}},{key:\"getGroupOnlineMemberCount\",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return jt(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return Ka({memberCount:e.memberCount})})).catch((function(e){return Ja(e)}))):za({memberCount:t.memberCount})}},{key:\"_getGroupOnlineMemberCount\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"_getGroupOnlineMemberCount\");return this._groupModule.request({protocolName:fs,requestData:{groupID:e}}).then((function(o){var s=t._onlineMemberCountMap.get(e)||{},a=o.data,r=a.onlineMemberNum,i=void 0===r?0:r,u=a.expireTime,c=void 0===u?t.DEFAULT_EXPIRE_TIME:u;xe.l(\"\".concat(n,\" ok. groupID:\").concat(e,\" memberCount:\").concat(i,\" expireTime:\").concat(c));var l=Date.now();return jt(s)&&(s.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(s,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:c})),{memberCount:i}})).catch((function(o){return xe.w(\"\".concat(n,\" failed. error:\"),o),new ka(\"_getGroupOnlineMemberCount\").setCode(o.code).setMessage(\"groupID:\".concat(e,\" error:\").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:\"_getModule\",value:function(e){return this._groupModule.getModule(e)}},{key:\"setPollingInterval\",value:function(e){at(e)||($e(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:\"setPollingIntervalPlus\",value:function(e){at(e)||($e(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:\"setPollingNoMessageCount\",value:function(e){at(e)||($e(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:\"setPollingSimplifiedMessage\",value:function(e){at(e)||\"0\"!==e&&\"1\"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:\"getPollingInterval\",value:function(){return this._pollingInterval}},{key:\"onAVChatRoomMemberBanned\",value:function(e){var t=e.payload.groupProfile.groupID;xe.l(\"\".concat(this._n,\".onAVChatRoomMemberBanned groupID:\").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:\"restartPolling\",value:function(){xe.l(\"\".concat(this._n,\".restartPolling count:\").concat(this._pollingInstanceMap.size));var e,t=D(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(o){t.e(o)}finally{t.f()}}},{key:\"getPollingTimerID\",value:function(e){if(!this._pollingInstanceMap.has(e))return-1;var t=this._pollingInstanceMap.get(e).getPollingTimerID();return xe.l(\"\".concat(this._n,\".getPollingTimerID groupID:\").concat(e,\" timerID:\").concat(t)),t}},{key:\"reset\",value:function(e){if(e){xe.l(\"\".concat(this._n,\".reset groupID:\").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{xe.l(\"\".concat(this._n,\".reset all\"));var n,o=D(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(s){o.e(s)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),Gr=1,Ur=15,Pr=function(){function e(t){o(this,e),this._groupModule=t,this._n=\"GroupSystemNoticeHandler\",this.pendencyMap=new Map}return a(e,[{key:\"onNewGroupSystemNotice\",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;xe.d(\"\".concat(this._n,\".onReceiveSystemNotice count:\").concat(t.length));var s=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),a=s.eventDataList,r=s.result;a.length>0&&(this._groupModule.getModule(Fn).onNewMessage({conversationOptionsList:a,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:r,isInstantMessage:o}));o?r.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,r):!0===n&&this._clearGroupSystemNotice()}},{key:\"newSystemNoticeStoredAndSummary\",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,s=null,a=n.length,r=0,i=[],u={conversationID:S.CONV_SYSTEM,unreadCount:0,type:S.CONV_SYSTEM,subType:null,lastMessage:null};for(r=0;r0?[u]:[],result:i}}},{key:\"_clearGroupSystemNotice\",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set(\"\".concat(t.from,\"_\").concat(t.groupID,\"_\").concat(t.to),t)}));var n=e._groupModule.getModule(Fn).getLocalMessageList(S.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,s=n.operatorID,a=n.operationType,r=n.groupProfile;if(a===Gr){var i=\"\".concat(s,\"_\").concat(r.groupID,\"_\").concat(r.to),u=e.pendencyMap.get(i);u&&$e(u.handled)&&0!==u.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:\"deleteGroupSystemNotice\",value:function(e){var t=this,n=\"\".concat(this._n,\".deleteGroupSystemNotice\");return st(e.messageList)&&0!==e.messageList.length?(xe.l(\"\".concat(n,\" \")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:gs,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:S.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){xe.l(\"\".concat(n,\" ok\"));var o=t._groupModule.getModule(Fn);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),Ka()})).catch((function(e){return xe.e(\"\".concat(n,\" error:\"),e),Ja(e)}))):za()}},{key:\"_getPendencyList\",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,o=void 0===n?void 0:n,s=t.startTime,a=void 0===s?0:s,r=t.limit,i=void 0===r?20:r;return this._groupModule.request({protocolName:ds,requestData:{type:o,startTime:a,limit:i,handleAccount:this._groupModule.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(m(n),m(e))})):n}))}},{key:\"getGroupApplicationList\",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:S.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,m(n)),e._handlePendencyResult(t)})).catch((function(n){return e._handlePendencyResult(t)}))}))}},{key:\"_handlePendencyResult\",value:function(e){var t=this,n=[];return e.forEach((function(e){t.pendencyMap.set(\"\".concat(e.from,\"_\").concat(e.groupID,\"_\").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID})})),za({applicationList:n})}},{key:\"_onReceivedGroupSystemNotice\",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:\"_onApplyGroupRequestAgreed\",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:\"_onMemberKicked\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:\"_onGroupDismissed\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:\"_onInviteGroup\",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:\"_onQuitGroup\",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:\"_onSetManager\",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(bn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(S.GRP_MBR_ROLE_ADMIN)}},{key:\"_onDeleteManager\",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(bn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(S.GRP_MBR_ROLE_MEMBER)}},{key:\"_onMessageRemindTypeSynced\",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(Fn).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:\"_handleTopicSystemNotice\",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,s=e.elements,a=s.operationType,r=s.topicIDList,i=s.messageRemindType,u=this._groupModule.getModule(wn);17===a?u.onTopicCreated({groupID:n,topicID:o}):18===a?u.onTopicDeleted({groupID:n,topicIDList:r}):20===a&&u.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:i})}},{key:\"reset\",value:function(){this.pendencyMap.clear()}}]),e}(),br=[\"relayFlag\"],wr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"GroupModule\",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new Mr(_(t)),t._groupAttributesHandler=new Er(_(t)),t._groupCountersHandler=new Ar(_(t)),t._AVChatRoomHandler=new Or(_(t)),t._groupTipsHandler=new mr(_(t)),t._groupSystemNoticeHandler=new Pr(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"polling_interval\"),t=this.getCloudConfig(\"polling_interval_plus\"),n=this.getCloudConfig(\"polling_no_msg_count\"),o=this.getCloudConfig(\"polling_simplified_msg\");this._AVChatRoomHandler&&(xe.l(\"\".concat(this._n,\"._onCloudConfigUpdated pollingInterval:\").concat(e)+\" pollingIntervalPlus:\".concat(t,\" pollingNoMessageCount:\").concat(n)+\" pollingSimplifiedMessage:\".concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o))}},{key:\"onCheckTimer\",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:\"guardForAVChatRoom\",value:function(e){var t=this;if(e.conversationType===S.CONV_GROUP){var n=Dt(e.to)?qt(e.to):e.to;return this.hasLocalGroup(n)?za():this.getGroupProfile({groupID:n}).then((function(o){var s=o.data.group.type;if(xe.l(\"\".concat(t._n,\".guardForAVChatRoom. groupID:\").concat(n,\" type:\").concat(s)),s===S.GRP_AVCHATROOM){var a=da.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;return Ja(new Wa({code:a,message:t.getErrorMessage(a,e.from,n),data:{message:e}}))}return za()}))}return za()}},{key:\"checkJoinedAVChatRoomByID\",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:\"onNewGroupMessage\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:\"updateNextMessageSeq\",value:function(e){var t=this;if(st(e)){var n=this.getModule(wn);e.forEach((function(e){var o=e.conversationID.replace(S.CONV_GROUP,\"\");Dt(o)&&n.updateLastMessage(o,e.lastMessage),t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:\"onNewGroupTips\",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:\"onGroupMessageRevoked\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:\"onNewGroupSystemNotice\",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:\"onGroupMessageReadNotice\",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!at(n)){var o=t.getModule(Fn);n.forEach((function(e){var n=e.groupID,s=e.topicID,a=void 0===s?void 0:s,r=e.lastMessageSeq;xe.d(\"\".concat(t._n,\".onGroupMessageReadNotice groupID:\").concat(n,\" lastMessageSeq:\").concat(r));var i=\"\".concat(S.CONV_GROUP).concat(n),u=!0;jt(a)||(i=\"\".concat(S.CONV_GROUP).concat(a),u=!1),o.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:r}),o.updateUnreadCount(i,u),o.clearGroupAtInfoList(i,u)}))}}))}},{key:\"onReadReceiptList\",value:function(e){var t=this;xe.d(\"\".concat(this._n,\".onReadReceiptList options:\"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,s=n.groupID,a=t.getModule(Fn),r=o.readReceiptList;a.updateReadReceiptInfo({groupID:s,readReceiptList:r})}))}},{key:\"onGroupMessageModified\",value:function(e){xe.d(\"\".concat(this._n,\".onGroupMessageModified options:\"),JSON.stringify(e));var n=this.getModule(Fn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:S.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:\"deleteGroupSystemNotice\",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:\"initGroupMap\",value:function(e){this.groupMap.set(e.groupID,new dr(e))}},{key:\"deleteGroup\",value:function(e){this.groupMap.delete(e)}},{key:\"updateGroupMap\",value:function(e){var t,n=this,o=this.getModule(Fn);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new dr(e)),o.deleteGroupRomaingMessageInfo(t))}));var s,a=this.getMyUserID(),r=D(this.groupMap);try{for(r.s();!(s=r.n()).done;){var i=v(s.value,2)[1];i.selfInfo.userID=a,\"Owner\"===i.selfInfo.role&&(i.ownerID=a)}}catch(u){r.e(u)}finally{r.f()}this._setStorageGroupList()}},{key:\"getStorageGroupList\",value:function(){return this.getModule(xn).getItem(\"groupMap\")}},{key:\"_setStorageGroupList\",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Ct(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(xn).setItem(\"groupMap\",e)}},{key:\"getGroupMap\",value:function(){return this.groupMap}},{key:\"getLocalGroupList\",value:function(){return m(this.groupMap.values())}},{key:\"getLocalGroupProfile\",value:function(e){return this.groupMap.get(e)}},{key:\"sortLocalGroupList\",value:function(){var e=m(this.groupMap).filter((function(e){var t=v(e,2);return t[0],!jt(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(m(e))}},{key:\"updateGroupLastMessage\",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:\"emitGroupListUpdate\",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(E.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),s=this.getModule(Fn);s.updateConversationGroupProfile(o)}}},{key:\"patchGroupMessageRemindType\",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Fn),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),xe.l(\"\".concat(this._n,\".patchGroupMessageRemindType count:\").concat(n))}},{key:\"recomputeUnreadCount\",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Fn);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,s=o.excludedUnreadSequenceList,a=o.readedSequence;if(st(s)){var r=0;s.forEach((function(t){t>=a&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&t.recomputeGroupUnreadCount({conversationID:\"\".concat(S.CONV_GROUP).concat(n),count:r})}}))}},{key:\"getMyNameCardByGroupID\",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:\"\"}},{key:\"isPagingGetCompleted\",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:\"getGroupList\",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):za()}},{key:\"getGroupProfile\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"getGroupProfile\"),o=new ka(\"getGroupProfile\"),s=e.groupID,a=e.groupCustomFieldFilter;xe.l(\"\".concat(n,\" groupID:\").concat(s));var r={groupIDList:[s],responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"Owner_Account\",\"CreateTime\",\"InfoSeq\",\"LastInfoTime\",\"LastMsgTime\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\",\"NextMsgSeq\",\"ShutUpAllMember\",\"InviteJoinOption\"],groupCustomFieldFilter:a,memberInfoFilter:[\"Role\",\"JoinTime\",\"MsgSeq\",\"MsgFlag\",\"NameCard\"]}};return this.getGroupProfileAdvance(r).then((function(e){var a,r=e.data,i=r.successGroupList,u=r.failureGroupList;if(xe.l(\"\".concat(n,\" ok\")),u.length>0)return Ja(u[0]);(Ct(i[0].type)&&!t.hasLocalGroup(s)?a=new dr(i[0]):(t.updateGroupMap(i),a=t.getLocalGroupProfile(s)),a.isSupportTopic)||t.getModule(Fn).updateConversationGroupProfile([a]);return o.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(s,\" type:\").concat(a.type,\" muteAllMembers:\").concat(a.muteAllMembers,\" ownerID:\").concat(a.ownerID)).end(),Ka({group:a})})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],r=n[1];o.setError(s,a,r).setMessage(\"groupID:\".concat(e.groupID)).end()})),xe.e(\"\".concat(n,\" failed. error:\"),s),Ja(s)}))}},{key:\"getGroupProfileAdvance\",value:function(e){var n=\"\".concat(this._n,\".getGroupProfileAdvance\"),o=e.groupIDList;st(o)&&o.length>50&&(this.outputWarning(\"GetGroupProfileLimit\"),o.length=50);var s=[],a=[];o.forEach((function(e){Tt({groupID:e})?a.push(e):s.push(e)}));var r=[];if(s.length>0){var i=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));r.push(i)}if(a.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:a,relayFlag:s.length>0}));r.push(u)}return Promise.all(r).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,m(e.successGroupList)),n.push.apply(n,m(e.failureGroupList))})),Ka({successGroupList:t,failureGroupList:n})})).catch((function(e){return xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_getGroupProfileAdvance\",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,s=g(e,br);return this.request({protocolName:Yo,requestData:s}).then((function(e){xe.l(\"\".concat(t._n,\"._getGroupProfileAdvance ok.\"));var n=e.data.groups;return{successGroupList:n.filter((function(e){return at(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new Wa({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&Tt({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:Ja(t)}))}},{key:\"createGroup\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"createGroup\"),s=e.type,a=e.groupID;if(e.name&&!1===this._filterProfanity(\"name\",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return Ja({code:da.PROFANITY_FOUND});if(![\"Public\",\"Private\",\"ChatRoom\",\"AVChatRoom\",\"Community\"].includes(s))return Ja({code:da.ILLEGAL_GROUP_TYPE});if(!Tt({type:s})){if(!jt(a)&&Tt({groupID:a}))return Ja({code:da.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Ct(s)&&!at(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(s)||at(e.joinOption)||(e.joinOption=void 0),Tt({type:s})){if(!jt(a)&&!Tt({groupID:a}))return Ja({code:da.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new ka(\"createGroup\");xe.l(\"\".concat(o,\" options:\"),e);var i=null,u=[];return this.request({protocolName:jo,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(s){var a=s.data,c=a.groupID,l=a.overLimitUserIDList,p=void 0===l?[]:l;if(i=c,u=p,r.setNetworkType(n.getNetworkType()).setMessage(\"groupType:\".concat(e.type,\" groupID:\").concat(c,\" overLimitUserIDList=\").concat(p)).end(),xe.l(\"\".concat(o,\" ok groupID:\").concat(c,\" overLimitUserIDList:\"),p),e.type===S.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===S.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});jt(e.memberList)||jt(p)||(e.memberList=e.memberList.filter((function(e){return-1===p.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var d=n.getModule(Rn),g=d.createCustomMessage({to:c,conversationType:S.CONV_GROUP,payload:{data:\"group_create\",extension:n.isIntl()?\"\".concat(n.getMyUserID(),\" created a group\"):\"\".concat(n.getMyUserID(),\"创建群组\")}});return d.sendMessageInstance(g),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,s=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:s,messageRemindType:S.MSG_REMIND_ACPT_AND_NOTE,role:S.GRP_MBR_ROLE_OWNER}),Ka({group:t,overLimitUserIDList:u})})).catch((function(s){if(r.setMessage(\"groupType:\".concat(e.type)),n.probeNetwork().then((function(e){var t=v(e,2),n=t[0],o=t[1];r.setError(s,n,o).end()})),10010===s.code||10007===s.code){n.updateGroupMap([t(t({},e),{},{groupID:i})]);var a=n.getLocalGroupProfile(i);return xe.l(\"\".concat(o,\" success, but failed to get group profile.\")),Ka({group:a,overLimitUserIDList:u})}return xe.e(\"\".concat(o,\" failed. error:\"),s),Ja(s)}))}},{key:\"dismissGroup\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"dismissGroup\");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===S.GRP_WORK)return Ja(new Wa({code:da.CANNOT_DISMISS_WORK}));var o=new ka(\"dismissGroup\");return o.setMessage(\"groupID:\".concat(e)),xe.l(\"\".concat(n,\" groupID:\").concat(e)),this.request({protocolName:zo,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ka({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"updateGroupProfile\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"updateGroupProfile\");if(this.hasLocalGroup(e.groupID)){var o=this.getLocalGroupProfile(e.groupID).type;this._canIUseJoinOption(o)||at(e.joinOption)||(xe.w(\"\".concat(n,\" joinOption is unavailable for Work/Meeting/AVChatRoom\")),e.joinOption=void 0)}if(at(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers=\"On\":e.muteAllMembers=\"Off\"),e.name&&!1===this._filterProfanity(\"name\",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return Ja({code:da.PROFANITY_FOUND});var s=new ka(\"updateGroupProfile\");return s.setMessage(JSON.stringify(e)),xe.l(\"\".concat(n,\" groupID:\").concat(e.groupID)),this.request({protocolName:Jo,requestData:e}).then((function(){(s.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return Ka({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.l(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_filterProfanity\",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:\"joinGroup\",value:function(e){var t=this,n=e.groupID,o=e.type,s=\"\".concat(this._n,\".joinGroup\");if(o===S.GRP_WORK)return Ja({code:da.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return za({status:S.JOIN_STATUS_ALREADY_IN_GROUP});var a=new ka(\"applyJoinGroup\");return this.getGroupProfile({groupID:n}).then((function(){return a.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(n,\" joinedStatus:\").concat(S.JOIN_STATUS_ALREADY_IN_GROUP)).end(),za({status:S.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return a.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(n,\" unjoined\")).end(),xe.w(\"\".concat(s,\" \").concat(n,\" was unjoined, now join!\")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return xe.l(\"\".concat(s,\" groupID:\").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:\"applyJoinGroup\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"applyJoinGroup\"),s=e.groupID;if(!jt(e.applyMessage)&&!1===this._filterProfanity(\"applyMessage\",e))return Ja({code:da.PROFANITY_FOUND});var a=new ka(\"applyJoinGroup\"),r=t({},e),i=this.canIUse(B.AVCHATROOM_HISTORY_MSG);return i&&(r.historyMessageFlag=1),this.getModule(Fn).deleteTopicRoamingMessageInfo(s),this.request({protocolName:Xo,requestData:r}).then((function(e){var t=e.data,r=t.joinedStatus,u=t.longPollingKey,c=t.startSeq,l=t.avChatRoomFlag,p=t.avChatRoomKey,d=t.messageList,g=\"groupID:\".concat(s,\" joinedStatus:\").concat(r,\" longPollingKey:\").concat(u,\" startSeq:\").concat(c)+\" avChatRoomFlag:\".concat(l,\" canGetAVChatRoomHistoryMessage:\").concat(i,\",\")+\" history message count:\".concat(jt(d)?0:d.length);switch(a.setNetworkType(n.getNetworkType()).setMessage(\"\".concat(g)).end(),xe.l(\"\".concat(o,\" ok. \").concat(g)),r){case je:return Ka({status:je});case Ye:return n.getGroupProfile({groupID:s}).then((function(e){var t=e.data.group;return n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:p,messageList:d})})).catch((function(){var e=new dr({groupID:s});return n._handleJoinResult({group:e,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:p,messageList:d})}));default:var _=new Wa({code:da.JOIN_GROUP_FAIL});return xe.e(\"\".concat(o,\" failed. error:\"),_),Ja(_)}})).catch((function(e){return a.setMessage(\"groupID:\".concat(s)),n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"_handleJoinResult\",value:function(e){var t,n=this,o=e.group,s=e.avChatRoomFlag,a=e.longPollingKey,r=e.startSeq,i=e.avChatRoomKey,u=e.messageList,c=o.groupID;return 1===s?(this.getModule(Fn).setCompleted(\"\".concat(S.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:i}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:i}),(t=at(a)?this._AVChatRoomHandler.handleJoinResult({group:o}):this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:a,startSeq:r})).then((function(){n._onAVChatRoomHistoryMessage(u)})),t):(this.emitGroupListUpdate(!0,!1),Ka({status:Ye,group:o}))}},{key:\"quitGroup\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"quitGroup\");xe.l(\"\".concat(n,\" groupID:\").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e))return Ja({code:da.MEMBER_NOT_IN_GROUP});if(o&&!this.isLoggedIn())return xe.l(\"\".concat(n,\" anonymously ok. groupID:\").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),za({groupID:e});var s=new ka(\"quitGroup\");return s.setMessage(\"groupID:\".concat(e)),this.request({protocolName:Zo,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),Ka({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"searchGroupByID\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"searchGroupByID\"),o={groupIDList:[e]},s=new ka(\"searchGroupByID\");return s.setMessage(\"groupID:\".concat(e)),xe.l(\"\".concat(n,\" groupID:\").concat(e)),this.request({protocolName:$o,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new Wa({code:o[0].errorCode,message:o[0].errorInfo});return s.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),Ka({group:new dr(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"changeGroupOwner\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"changeGroupOwner\");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===S.GRP_AVCHATROOM)return Ja({code:da.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return Ja({code:da.CANNOT_CHANGE_OWNER_TO_SELF});var o=new ka(\"changeGroupOwner\");return o.setMessage(\"groupID:\".concat(e.groupID,\" newOwnerID:\").concat(e.newOwnerID)),xe.l(\"\".concat(n,\" groupID:\").concat(e.groupID)),this.request({protocolName:es,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var s=e.groupID,a=e.newOwnerID;t.groupMap.get(s).ownerID=a;var r=t.getModule(bn).getLocalGroupMemberList(s);if(r instanceof Map){var i=r.get(t.getMyUserID());at(i)||(i.updateRole(\"Member\"),t.groupMap.get(s).selfInfo.role=\"Member\");var u=r.get(a);at(u)||u.updateRole(\"Owner\")}return t.emitGroupListUpdate(!0,!1),Ka({group:t.groupMap.get(s)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getGroupApplicationList\",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:\"handleGroupApplication\",value:function(e){var t,n,o,s,a,r=this,i=\"\".concat(this._n,\".\").concat(\"handleGroupApplication\"),u=e.handleAction,c=e.handleMessage,l=e.message,p=e.application;l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,s=l.payload.messageKey):p&&(t=p.applicant,n=p.groupID,o=p.authentication,s=p.messageKey);var d=ts;p&&2===p.applicationType&&(d=ns,a=p.userID);var g=new ka(\"handleGroupApplication\");return g.setMessage(\"groupID:\".concat(n)),xe.l(\"\".concat(i,\" groupID:\").concat(n)),this.request({protocolName:d,requestData:{handleAction:u,handleMessage:c,applicant:t,invitee:a,groupID:n,authentication:o,messageKey:s}}).then((function(){return g.setNetworkType(r.getNetworkType()).end(),xe.l(\"\".concat(i,\" ok\")),l&&r._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ka({group:r.getLocalGroupProfile(n)})})).catch((function(e){return r.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];g.setError(e,o,s).end()})),xe.e(\"\".concat(i,\" failed. error\"),e),Ja(e)}))}},{key:\"handleGroupInvitation\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"handleGroupInvitation\"),s=e.message.payload,a=s.groupProfile.groupID,r=s.authentication,i=s.messageKey,u=s.operatorID,c=e.handleAction,l=new ka(\"handleGroupInvitation\");return l.setMessage(\"groupID:\".concat(a,\" inviter:\").concat(u,\" handleAction:\").concat(c)),xe.l(\"\".concat(o,\" groupID:\").concat(a,\" inviter:\").concat(u,\" handleAction:\").concat(c)),this.request({protocolName:os,requestData:t(t({},e),{},{inviter:u,groupID:a,authentication:r,messageKey:i})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),xe.l(\"\".concat(o,\" ok\")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),Ka({group:n.getLocalGroupProfile(a)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error\"),e),Ja(e)}))}},{key:\"getGroupOnlineMemberCount\",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):za({memberCount:0}):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"hasLocalGroup\",value:function(e){return this.groupMap.has(e)}},{key:\"deleteLocalGroupAndConversation\",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(xe.l(\"\".concat(this._n,\".deleteLocalGroupAndConversation isJoinedAVChatRoom:\").concat(t)),t)&&this.getModule(Fn).deleteLocalConversation(\"\".concat(S.CONV_GROUP).concat(e));if(Tt({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(wn).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:\"_deleteLocalGroup\",value:function(e){this.groupMap.delete(e),this.getModule(bn).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:\"sendMessage\",value:function(e,t){if(st(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(B.MSG_TO_SPECIFIED_GRP_MBR))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:\"createGroupMessagePack\",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o=\"\";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push(\"NoUnread\"),!0===i&&s.push(\"NoLastMsg\"),!0===u&&s.push(\"NoMsgCheck\")}var c=void 0;st(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),this.outputWarning(\"ReceiverListLimit\")));var l=this.isOnlineMessage(e,t)?1:0,p=e.getGroupAtInfoList(),d={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==S.MSG_TEXT||jt(p)?void 0:p,onlineOnlyFlag:l,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||\"\",desc:n.description||\"\",ext:n.extension||\"\",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0===l?s:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return Dt(e.to)&&(d.groupID=qt(e.to),d.topicID=e.to),{protocolName:ho,tjgID:this.generateTjgID(e),requestData:d}}},{key:\"_isVoipPush\",value:function(e){var t=void 0;return at(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:\"revokeMessage\",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Dt(e.to)&&(t.groupID=qt(e.to),t.topicID=e.to),this.request({protocolName:ss,requestData:t})}},{key:\"deleteMessage\",value:function(e){var t=e.to,n=e.keyList;xe.l(\"\".concat(this._n,\".deleteMessage groupID:\").concat(t,\" count:\").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return Dt(t)&&(o.groupID=qt(t),o.topicID=t),this.request({protocolName:vs,requestData:o})}},{key:\"modifyRemoteMessage\",value:function(e){var t=e.to,n=e.sequence,o=e.payload,s=e.type,a=e.version,r=void 0===a?0:a,i=e.cloudCustomData,u=t,c=void 0;Dt(t)&&(u=qt(t),c=t);var l=void 0;return Vt(s)&&(l=[]).push({type:s,content:o}),this.request({protocolName:ms,requestData:{groupID:u,topicID:c,sequence:n,version:r,elements:l,cloudCustomData:i}})}},{key:\"getRoamingMessage\",value:function(e){var t=this,n=\"\".concat(this._n,\".getRoamingMessage\"),o=e.conversationID,s=e.groupID,a=e.sequence,r=new ka(\"getGroupRoamingMessages\"),i=0,u=void 0;return Dt(s)&&(s=qt(u=s)),this._computeLastSequence({groupID:s,topicID:u,sequence:a}).then((function(e){return i=e,xe.l(\"\".concat(n,\" groupID:\").concat(s,\" startSequence:\").concat(i)),t.request({protocolName:is,requestData:{groupID:s,count:21,sequence:i,topicID:u}})})).then((function(e){var a=e.data,c=a.messageList,l=a.complete,p=a.invisibleSequenceList,d=void 0===p?[]:p;at(c)?xe.l(\"\".concat(n,\" ok. complete:\").concat(l,\" but messageList is undefined!\")):xe.l(\"\".concat(n,\" ok. complete:\").concat(l,\" count:\").concat(c.length));var g=t._getMinSequence(d,c)-1;r.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(s,\" topicID:\").concat(u,\" startSequence:\").concat(i,\" complete:\").concat(l,\" nextSequence:\").concat(g)).end();var _=t.getModule(Fn),h=[];return jt(c)||(_.updateRoamingMessageSequence(o,g),h=_.onRoamingMessage(c,o),_.updateIsRead(o),_.patchConversationLastMessage(o)),(2===l||g<=1)&&(_.setCompleted(o),g=\"\"),xe.l(\"\".concat(n,\" nextReqID:\").concat(g,\", stored message count:\").concat(h.length,\", invisible sequence count:\").concat(d.length)),{nextReqID:g+\"\",storedMessageList:h}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).setMessage(\"groupID:\".concat(s,\" topicID:\").concat(u,\" startSequence:\").concat(i)).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_getGroupIDOfMessage\",value:function(e){return e.conversationID.replace(S.CONV_GROUP,\"\")}},{key:\"_getMinSequence\",value:function(e,t){var n=0;jt(t)||(n=t[t.length-1].sequence);var o=0;jt(e)||(o=e[e.length-1]);return xe.l(\"\".concat(this._n,\"._getMinSequence minVisibleSequence:\").concat(n,\" minInvisibleSequence:\").concat(o)),o>0&&o=100?100:a,_=\"groupID:\".concat(r,\" sequence:\").concat(u,\" cursor:\").concat(d,\" filter:\").concat(p,\" completeFlag:\").concat(l);xe.l(\"\".concat(c,\" \").concat(_));var h={cursor:\"\",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new ka(\"getReadReceiptDetail\");return f.setMessage(_),this.request({protocolName:ps,requestData:{groupID:r,sequence:u,flag:p,cursor:d,count:g}}).then((function(e){f.end();var n=e.data,o=n.cursor,s=n.isCompleted,a=n.unreadUserIDList,r=n.readUserIDList;return h.cursor=o,1===s&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===p?h.readUserIDList=r.map((function(e){return e.userID})):1===p&&(h.unreadUserIDList=a.map((function(e){return e.userID}))),xe.l(\"\".concat(c,\" ok\")),Ka(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];f.setError(e,o,s).end()})),xe.w(\"\".concat(c,\" failed. error:\"),e),Ja(e)}))}},{key:\"getRoamingMessagesHopping\",value:function(e){var t=this,n=\"\".concat(this._n,\".getRoamingMessagesHopping\"),o=new ka(\"getGroupRoamingMessagesHopping\"),s=e.groupID,a=e.count,r=e.sequence,i=e.direction,u=r;1===i&&(u=r+a-1);var c=void 0;Dt(s)&&(s=qt(c=s));var l=\"\".concat(c?\"topicID:\".concat(c):\"groupID:\".concat(s),\" sequence:\").concat(r,\" direction:\").concat(i);return xe.l(\"\".concat(n,\" \").concat(l)),this.request({protocolName:is,requestData:{groupID:s,topicID:c,count:a,sequence:u}}).then((function(s){var a=s.data,u=a.messageList,c=a.complete,p=\"complete:\".concat(c,\" count:\").concat(u?u.length:0);if(xe.l(\"\".concat(n,\" ok. \").concat(p)),o.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(l,\" \").concat(p)).end(),2===c||jt(u)){var d=t._computeResult();return Ka(d)}var g=\"\".concat(S.CONV_GROUP).concat(e.groupID),_=t.getModule(Fn).onRoamingMessage(u,g,!1),h=t._computeResult({direction:i,sequence:r,remoteMessageList:u,processedMessageList:_});return Ka(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),i=n[0],u=n[1];o.setError(e,i,u).setMessage(\"groupID:\".concat(s,\" sequence:\").concat(r,\" count:\").concat(a)).end()})),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_computeResult\",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:\"\"};if(at(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,s=e.remoteMessageList,a=void 0===s?[]:s,r=e.processedMessageList,i=void 0===r?[]:r,u=a.length;return 1===n?(t.nextMessageSeq=a[0].sequence+1,i.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),0===t.messageList.length&&a[0].sequence0?Promise.resolve(s):at(o)||this.hasLocalGroup(t)?at(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:\"getGroupLastSequence\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"getGroupLastSequence\"),o=new ka(\"getGroupLastSequence\"),s=0,a=\"\";if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),i=r.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return s=i.lastSequence,a=\"got lastSequence:\".concat(s,\" from local group profile[lastMessage.lastSequence]. groupID:\").concat(e),xe.l(\"\".concat(n,\" \").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(a)).end(),Promise.resolve(s);if(r.nextMessageSeq>1)return s=r.nextMessageSeq-1,a=\"got lastSequence:\".concat(s,\" from local group profile[nextMessageSeq]. groupID:\").concat(e),xe.l(\"\".concat(n,\" \").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(a)).end(),Promise.resolve(s)}var u=\"GROUP\".concat(e),c=this.getModule(Fn).getLocalConversation(u);if(c&&c.lastMessage.lastSequence&&!1===c.lastMessage.onlineOnlyFlag)return s=c.lastMessage.lastSequence,a=\"got lastSequence:\".concat(s,\" from local conversation profile[lastMessage.lastSequence]. groupID:\").concat(e),xe.l(\"\".concat(n,\" \").concat(a)),o.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(a)).end(),Promise.resolve(s);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:[\"NextMsgSeq\"]}};return this.getGroupProfileAdvance(l).then((function(r){var i=r.data.successGroupList;return jt(i)?xe.l(\"\".concat(n,\" successGroupList is empty. groupID:\").concat(e)):(s=i[0].nextMessageSeq-1,a=\"got lastSequence:\".concat(s,\" from getGroupProfileAdvance. groupID:\").concat(e),xe.l(\"\".concat(n,\" \").concat(a))),o.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(a)).end(),s})).catch((function(s){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],r=n[1];o.setError(s,a,r).setMessage(\"get lastSequence failed from getGroupProfileAdvance. groupID:\".concat(e)).end()})),xe.w(\"\".concat(n,\" failed. error:\"),s),Ja(s)}))}},{key:\"getTopicLastSequence\",value:function(e){var t=this,n=e.groupID,o=e.topicID,s=\"\".concat(this._n,\".\").concat(\"getTopicLastSequence\"),a=new ka(\"getTopicLastSequence\"),r=0,i=\"\",u=this.getModule(wn);return u.hasLocalTopic(n,o)?(r=u.getLocalTopic(n,o).nextMessageSeq-1,i=\"get lastSequence:\".concat(r,\" from local topic info[nextMessageSeq]. topicID:\").concat(o),xe.l(\"\".concat(s,\" \").concat(i)),a.setNetworkType(this.getNetworkType()).setMessage(\"\".concat(i)).end(),Promise.resolve(r)):u.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return jt(n)?xe.l(\"\".concat(s,\" successTopicList is empty. topicID:\").concat(o)):(r=n[0].nextMessageSeq-1,i=\"get lastSequence:\".concat(r,\" from getTopicList. topicID:\").concat(o),xe.l(\"\".concat(s,\" \").concat(i))),a.setNetworkType(t.getNetworkType()).setMessage(\"\".concat(i)).end(),r})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],r=n[1];a.setError(e,s,r).setMessage(\"get lastSequence failed from getTopicList. topicID:\".concat(o)).end()})),xe.w(\"\".concat(s,\" failed. error:\"),e),Ja(e)}))}},{key:\"isMessageFromOrToAVChatroom\",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:\"hasJoinedAVChatRoom\",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:\"getJoinedAVChatRoom\",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:\"isOnlineMessage\",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:\"_canIUseOnlineOnlyFlag\",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==S.CONV_GROUP}},{key:\"_onAVChatRoomHistoryMessage\",value:function(e){if(!jt(e)){xe.l(\"\".concat(this._n,\"._onAVChatRoomHistoryMessage count:\").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:\"onAVChatRoomMessage\",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:\"onAVChatRoomMemberBanned\",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:\"getGroupSimplifiedInfo\",value:function(e){var t=this,n=new ka(\"getGroupSimplifiedInfo\"),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\"]}};return this.getGroupProfileAdvance(o).then((function(o){var s=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage(\"groupID:\".concat(e,\" type:\").concat(s[0].type)).end(),s[0]})).catch((function(o){t.probeNetwork().then((function(t){var s=v(t,2),a=s[0],r=s[1];n.setError(o,a,r).setMessage(\"groupID:\".concat(e)).end()}))}))}},{key:\"setUnjoinedAVChatRoom\",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:\"deleteUnjoinedAVChatRoom\",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:\"isUnjoinedAVChatRoom\",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:\"isGroupAttributesUpdatedNotice\",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:\"updateLocalMainSequenceOnReconnected\",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:\"initGroupAttributes\",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:\"setGroupAttributes\",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:\"deleteGroupAttributes\",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:\"getGroupAttributes\",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:\"isMessageFromTopic\",value:function(e,t){return 2===e&&!jt(t)}},{key:\"isMessageFromCommunityOfTopic\",value:function(e,t){return 2===e&&jt(t)}},{key:\"getMessageExtensions\",value:function(e,t){return xe.l(\"\".concat(this._n,\".getMessageExtensions startSequence:\").concat(t)),this.request({protocolName:Es,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:\"modifyMessageExtensions\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return xe.l(\"\".concat(this._n,\".modifyMessageExtensions operateType:\").concat(n)),this.request({protocolName:Ds,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:\"getGroupNotify\",value:function(e){var n=this;if(this.hasLocalGroup(e)){var o=this.getLocalGroupProfile(e),s=o.type,a=o.isSupportTopic;if(!Ct(s)&&!a){var r=\"\".concat(this._n,\".getGroupNotify\"),i=this._getGroupLastRevokedTime(e),u=1e3*Ue();xe.l(\"\".concat(r,\" groupID:\").concat(e,\" type:\").concat(s,\" beginTime:\").concat(i,\" endTime:\").concat(u)),this.request({protocolName:Ss,requestData:{type:Tt({type:s,groupID:e})?S.GRP_COMMUNITY:void 0,groupID:e,beginTime:i,endTime:u}}).then((function(o){var s=o.data,a=s.nextRevokedTime,i=s.notifyList;xe.l(\"\".concat(r,\" ok. groupID:\").concat(e,\" nextRevokedTime:\").concat(a));var u={dataList:[{elements:{revokedInfos:[]}}]};st(i)&&i.forEach((function(n){u.dataList[0].elements.revokedInfos.push({groupID:e,sequence:n.sequence,random:n.random,revokerInfo:t({},n.revokerInfo)})})),n.onGroupMessageRevoked(u),0!==a?(n._setGroupLastRevokedTime(e,a),n.getGroupNotify(e)):n._setGroupLastRevokedTime(e,1e3*Ue())})).catch((function(e){xe.e(\"\".concat(r,\" failed. error:\"),e)}))}}}},{key:\"_getGroupLastRevokedTime\",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:\"_setGroupLastRevokedTime\",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:\"isGroupCountersNotice\",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:\"setGroupCounters\",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:\"increaseGroupCounter\",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:\"decreaseGroupCounter\",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:\"getGroupCounters\",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:\"restartPolling\",value:function(){this._AVChatRoomHandler&&this._AVChatRoomHandler.restartPolling()}},{key:\"getPollingTimerID\",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&Ct(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:\"_canIUseJoinOption\",value:function(e){return function(e){return e===S.GRP_PUBLIC}(e)||Tt({type:e})}},{key:\"reset\",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),s}(ro),Fr=function(){function e(t){o(this,e),this.userID=\"\",this.avatar=\"\",this.nick=\"\",this.role=\"\",this.joinTime=\"\",this.lastSendMsgTime=\"\",this.nameCard=\"\",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return a(e,[{key:\"_initMember\",value:function(e){this.updateMember(e)}},{key:\"updateMember\",value:function(e){var t=[null,void 0,\"\",0,NaN];e.memberCustomField&&It(this.memberCustomField,e.memberCustomField),pt(this,e,[\"memberCustomField\",\"marks\"],t)}},{key:\"updateRole\",value:function(e){[\"Owner\",\"Admin\",\"Member\"].indexOf(e)<0||(this.role=e)}},{key:\"updateMuteUntil\",value:function(e){at(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:\"updateNameCard\",value:function(e){at(e)||(this.nameCard=e)}},{key:\"updateMemberCustomField\",value:function(e){e&&It(this.memberCustomField,e)}}]),e}(),qr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"GroupMemberModule\",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(er,t._onProfileUpdated,_(t)),t}return a(s,[{key:\"_onProfileUpdated\",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},s=0;s100?100:r};Tt({groupID:n})?_.next=\"\".concat(s):(_.offset=s,g=s+r);var h=[];return this.request({protocolName:As,requestData:_}).then((function(e){var o=e.data,s=o.members,a=o.memberNum,r=o.next,i=void 0===r?void 0:r;if(at(i)||(g=jt(i)?0:i),!st(s)||0===s.length)return g=0,Promise.resolve([]);var u=t.getModule(Un);return u.hasLocalGroup(n)&&(u.getLocalGroupProfile(n).memberNum=a),h=t._updateLocalGroupMemberMap(n,s),t.getModule(On).getUserProfile({userIDList:s.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})})).then((function(e){var o=e.data;if(!st(o)||0===o.length)return za({memberList:[],offset:g});var a=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,a),h.length5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)),xe.l(\"\".concat(o,\" groupID:\").concat(e.groupID,\" userIDList:\").concat(e.userIDList.join(\",\"))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var a=e.groupID,r=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return st(t)&&0!==t.length?(n._updateLocalGroupMemberMap(a,t),n.getModule(On).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})):za([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(a,t);var o=r.filter((function(e){return n.hasLocalGroupMember(a,e)})).map((function(e){return n.getLocalGroupMemberInfo(a,e)}));return s.setNetworkType(n.getNetworkType()).end(),Ka({memberList:o})}))}},{key:\"addGroupMember\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"addGroupMember\"),o=e.groupID,s=this.getModule(Un).getLocalGroupProfile(o),a=s.type,r=new ka(\"addGroupMember\");if(r.setMessage(\"groupID:\".concat(o,\" groupType:\").concat(a)),Ct(a)){var i=new Wa({code:da.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return r.setError(i,!0,this.getNetworkType()).end(),Ja(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),xe.l(\"\".concat(n,\" groupID:\").concat(o)),this.request({protocolName:Os,requestData:e}).then((function(o){var a=o.data.members;xe.l(\"\".concat(n,\" ok\"));var i=a.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),u=a.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=a.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=a.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),p=\"groupID:\".concat(e.groupID,\", \")+\"successUserIDList:\".concat(i,\", \")+\"failureUserIDList:\".concat(u,\", \")+\"existedUserIDList:\".concat(c,\", \")+\"overLimitUserIDList:\".concat(l);return r.setNetworkType(t.getNetworkType()).setMoreMessage(p).end(),0===i.length?Ka({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l}):(s.memberCount+=i.length,t._updateConversationGroupProfile(s),Ka({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l,group:s}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"deleteGroupMember\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"deleteGroupMember\"),o=e.groupID,s=e.userIDList,a=this.getModule(Un).getLocalGroupProfile(o);if(at(a))return Ja({code:da.CANNOT_FIND_GROUP});if(Ct(a.type))return this.canIUse(B.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var r=new ka(\"deleteGroupMember\"),i=\"groupID:\".concat(o,\" \").concat(s.length>5?\"userIDList.length:\".concat(s.length):\"userIDList:\".concat(s));return r.setMessage(i),xe.l(\"\".concat(n,\" groupID:\").concat(o,\" userIDList:\"),s),this.request({protocolName:Gs,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),a.memberCount-=1,t._updateConversationGroupProfile(a),t.deleteLocalGroupMembers(o,s),Ka({group:a,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_updateConversationGroupProfile\",value:function(e){this.getModule(Fn).updateConversationGroupProfile([e])}},{key:\"_banAVChatRoomMember\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"deleteGroupMember\"),o=e.groupID,s=e.userIDList,a=\"groupID:\".concat(o,\" \").concat(s.length>5?\"userIDList.length:\".concat(s.length):\"userIDList:\".concat(s)),r=new ka(\"deleteGroupMember\");r.setMessage(a),xe.l(\"\".concat(n,\" groupID:\").concat(o,\" userIDList:\"),s);var i=this.getModule(Un).getLocalGroupProfile(o);return at(e.duration)||0===e.duration?Ja({code:da.BAN_DURATION_INVALID}):this.request({protocolName:Us,requestData:e}).then((function(){return r.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),t.deleteLocalGroupMembers(o,s),Ka({group:i,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"setGroupMemberMuteTime\",value:function(e){var t=this,n=e.groupID,o=e.userID,s=e.muteTime,a=\"\".concat(this._n,\".\").concat(\"setGroupMemberMuteTime\");if(o===this.getMyUserID())return Ja(new Wa({code:da.CANNOT_MUTE_SELF}));xe.l(\"\".concat(a,\" groupID:\").concat(n,\" userID:\").concat(o));var r=new ka(\"setGroupMemberMuteTime\");return r.setMessage(\"groupID:\".concat(n,\" userID:\").concat(o,\" muteTime:\").concat(s)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:s}).then((function(e){r.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(a,\" ok\"));var o=t.getModule(Un);return Ka({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(a,\" failed. error:\"),e),Ja(e)}))}},{key:\"setGroupMemberRole\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"setGroupMemberRole\"),o=e.groupID,s=e.userID,a=e.role,r=this.getModule(Un).getLocalGroupProfile(o);if(r.selfInfo.role!==S.GRP_MBR_ROLE_OWNER)return Ja({code:da.NOT_OWNER});if([S.GRP_WORK,S.GRP_AVCHATROOM].includes(r.type))return Ja({code:da.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[S.GRP_MBR_ROLE_ADMIN,S.GRP_MBR_ROLE_MEMBER];if(Tt({groupID:o})&&i.push(S.GRP_MBR_ROLE_CUSTOM),i.indexOf(a)<0)return Ja({code:da.INVALID_MEMBER_ROLE});if(s===this.getMyUserID())return Ja({code:da.CANNOT_SET_SELF_MEMBER_ROLE});var u=new ka(\"setGroupMemberRole\");return u.setMessage(\"groupID:\".concat(o,\" userID:\").concat(s,\" role:\").concat(a)),xe.l(\"\".concat(n,\" groupID:\").concat(o,\" userID:\").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:s,role:a}).then((function(e){return u.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\")),Ka({group:r,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_filterProfanity\",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],J),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:\"setGroupMemberNameCard\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"setGroupMemberNameCard\");if(e.nameCard&&!1===this._filterProfanity(\"nameCard\",e))return Ja({code:da.PROFANITY_FOUND});var o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,r=e.nameCard;xe.l(\"\".concat(n,\" groupID:\").concat(o,\" userID:\").concat(a));var i=new ka(\"setGroupMemberNameCard\");return i.setMessage(\"groupID:\".concat(o,\" userID:\").concat(a,\" nameCard:\").concat(r)),this.modifyGroupMemberInfo({groupID:o,userID:a,nameCard:r}).then((function(e){xe.l(\"\".concat(n,\" ok\")),i.setNetworkType(t.getNetworkType()).end();var s=t.getModule(Un).getLocalGroupProfile(o);return a===t.getMyUserID()&&s&&s.setSelfNameCard(r),Ka({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"setGroupMemberCustomField\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"setGroupMemberCustomField\"),o=e.groupID,s=e.userID,a=void 0===s?this.getMyUserID():s,r=e.memberCustomField;xe.l(\"\".concat(n,\" groupID:\").concat(o,\" userID:\").concat(a));var i=new ka(\"setGroupMemberCustomField\");return i.setMessage(\"groupID:\".concat(o,\" userID:\").concat(a,\" memberCustomField:\").concat(JSON.stringify(r))),this.modifyGroupMemberInfo({groupID:o,userID:a,memberCustomField:r}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(n,\" ok\"));var s=t.getModule(Un).getLocalGroupProfile(o);return Ka({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"modifyGroupMemberInfo\",value:function(e){var n=this,o=e.groupID,s=e.userID,a=void 0;return Dt(o)&&(o=qt(a=o)),this.request({protocolName:Ps,requestData:t(t({},e),{},{groupID:o,topicID:a})}).then((function(){if(n.hasLocalGroupMember(o,s)){var t=n.getLocalGroupMemberInfo(o,s);return at(e.muteTime)||t.updateMuteUntil(e.muteTime),at(e.role)||t.updateRole(e.role),at(e.nameCard)||t.updateNameCard(e.nameCard),at(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[s]}).then((function(e){return v(e.data.memberList,1)[0]}))}))}},{key:\"markGroupMemberList\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"markGroupMemberList\"),o=e.groupID,s=e.markType,a=e.enableMark,r=e.userIDList,i=void 0===r?[]:r,u=\"groupID:\".concat(o,\" markType:\").concat(s,\" enableMark:\").concat(a,\" userIDList count: \").concat(i.length);xe.l(\"\".concat(n,\" \").concat(u));var c=2,l=[];!0===a&&(c=1);var p=m(i);i.length>500&&(p=i.slice(0,500),xe.w(\"\".concat(n,\" \").concat(Kt(500)))),p.forEach((function(e){l.push({userID:e,markType:[s]})})),p=null;var d=new ka(\"markGroupMemberList\");return d.setMessage(\"\".concat(u)),this.request({protocolName:bs,requestData:{groupID:o,operationType:c,memberList:l}}).then((function(e){var o=e.data.memberList,s=void 0===o?[]:o,a=[],r=[];s.length===i.length?a.push.apply(a,m(i)):(s.forEach((function(e){a.push(e.userID)})),i.forEach((function(e){a.includes(e)||r.push(e)})));var u=\"success count:\".concat(a.length,\" fail count:\").concat(r.length);return d.setNetworkType(t.getNetworkType()).setMessage(u).end(),xe.l(\"\".concat(n,\" ok. \").concat(u)),Ka({successUserIDList:a,failureUserIDList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_getGroupMemberProfileAdvance\",value:function(e){return this.request({protocolName:Ns,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:[\"Role\",\"JoinTime\",\"NameCard\",\"ShutUpUntil\"]})})}},{key:\"_updateLocalGroupMemberMap\",value:function(e,t){var n=this;return st(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new Fr(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:\"deleteLocalGroupMembers\",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:\"getLocalGroupMemberInfo\",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:\"setLocalGroupMember\",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:\"getLocalGroupMemberList\",value:function(e){return this.groupMemberListMap.get(e)}},{key:\"hasLocalGroupMember\",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:\"hasLocalGroupMemberMap\",value:function(e){return this.groupMemberListMap.has(e)}},{key:\"reset\",value:function(){this.groupMemberListMap.clear()}}]),s}(ro),xr=[\"topicID\",\"topicName\",\"avatar\",\"introduction\",\"notification\",\"unreadCount\",\"muteAllMembers\",\"customData\",\"groupAtInfoList\",\"nextMessageSeq\",\"selfInfo\"],Vr=function(e,t){return jt(e)?{lastTime:0,lastSequence:0,fromAccount:\"\",payload:null,type:\"\",messageForShow:\"\",nick:\"\",version:0,cloudCustomData:\"\",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||\"\",payload:e.payload||null,type:e.type||\"\",messageForShow:xt(e.type,e.payload,t),nick:e.nick||\"\",version:e.version||0,cloudCustomData:e.cloudCustomData||\"\",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},Br=function(){function e(t,n){o(this,e),this.topicID=\"\",this.topicName=\"\",this.avatar=\"\",this.introduction=\"\",this.notification=\"\",this.unreadCount=0,this.muteAllMembers=!1,this.customData=\"\",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=Vr(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:\"\",excludedUnreadSequenceList:void 0},this._initTopic(t)}return a(e,[{key:\"_initTopic\",value:function(e){for(var t in e)xr.indexOf(t)<0||(\"selfInfo\"===t?this.updateSelfInfo(e[t]):this[t]=\"muteAllMembers\"===t?1===e[t]:e[t])}},{key:\"updateUnreadCount\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:\"updateNextMessageSeq\",value:function(e){this.nextMessageSeq=e}},{key:\"updateLastMessage\",value:function(e){this.lastMessage=Vr(e)}},{key:\"updateGroupAtInfoList\",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:\"updateTopic\",value:function(e){at(e.selfInfo)||this.updateSelfInfo(e.selfInfo),at(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),pt(this,e,[\"groupID\",\"lastMessageTime\",\"selfInfo\",\"muteAllMembers\",\"lastMsg\"])}},{key:\"updateSelfInfo\",value:function(e){return 0!==pt(this.selfInfo,e,[],[\"\"])}},{key:\"reduceUnreadCount\",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:\"isLastMessageRevoked\",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:\"setLastMessageRevoked\",value:function(e){this.lastMessage.isRevoked=e}},{key:\"setLastMessageRevoker\",value:function(e){this.lastMessage.revoker=e}}]),e}(),Hr=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"TopicModule\",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"topic_cache_time\"),t=this.getCloudConfig(\"topic_last_active_time\");at(e)||(this.TOPIC_CACHE_TIME=Number(e)),at(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:\"onTopicCreated\",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(E.TOPIC_CREATED,e)}},{key:\"onTopicDeleted\",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(E.TOPIC_DELETED,e)}},{key:\"onTopicMessageRemindTypeUpdated\",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,s=this.getLocalTopic(t,n);if(s){var a=s.updateSelfInfo({messageRemindType:o});a&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}),xe.d(\"\".concat(this._n,\".onTopicMessageRemindTypeUpdated topicID:\").concat(n)+\" messageRemindType:\".concat(o,\" isTopicUpdated:\").concat(a))}}},{key:\"onTopicProfileUpdated\",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:\"onConversationProxy\",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,s=qt(t),a=this.getLocalTopic(s,t),r=!1;a&&(at(n)||a.unreadCount===n||(a.updateUnreadCount(n),r=!0),at(o)||(a.updateGroupAtInfoList(o),r=!0)),r&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:s,topic:a})}},{key:\"onMessageSent\",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,s=this.getLocalTopic(t,n);s&&(s.nextMessageSeq+=1,s.updateLastMessage(o),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}))}},{key:\"onMessageModified\",value:function(e){var t=e.to,n=e.time,o=e.sequence,s=e.elements,a=e.cloudCustomData,r=e.messageVersion,i=qt(t),u=this.getLocalTopic(i,t);if(u){var c=u.lastMessage;xe.d(\"\".concat(this._n,\".onMessageModified topicID:\").concat(t,\" lastMessage:\"),JSON.stringify(c),\"options:\",JSON.stringify(e)),c&&(null===c.payload||c.lastTime===n&&c.lastSequence===o&&c.version!==r)&&(c.type=s[0].type,c.payload=s[0].content,c.messageForShow=xt(c.type,c.payload,this.isIntl()),c.cloudCustomData=a,c.version=r,c.lastSequence=o,c.lastTime=n,this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u}))}}},{key:\"onMessageRevoked\",value:function(e){var t=this;if(0!==e.length){var n=null,o=null,s=!1;e.forEach((function(e){var a=e.to;o=qt(a),(n=t.getLocalTopic(o,a))&&(n.reduceUnreadCount()&&(s=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),s=!0))})),s&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:\"isLastMessageRevoked\",value:function(e){var t=e.topicID,n=e.sequence,o=qt(t),s=this.getLocalTopic(o,t),a=!1;return s&&(a=s.isLastMessageRevoked({sequence:n})),a}},{key:\"getJoinedCommunityList\",value:function(){return this.getModule(Un).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return Ka({groupList:void 0===t?[]:t})})).catch((function(e){return Ja(e)}))}},{key:\"createTopicInCommunity\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"createTopicInCommunity\"),s=e.topicID;if(!at(s)&&!Dt(s))return Ja({code:da.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity(\"topicName\",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return Ja({code:da.PROFANITY_FOUND});var a=new ka(\"createTopicInCommunity\");return this.request({protocolName:$s,requestData:t({},e)}).then((function(s){var r=s.data.topicID;return a.setMessage(\"topicID:\".concat(r)).setNetworkType(n.getNetworkType()).end(),xe.l(\"\".concat(o,\" ok\")),n._updateTopicMap([t(t({},e),{},{topicID:r})]),Ka({topicID:r})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"deleteTopicFromCommunity\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"deleteTopicFromCommunity\"),o=e.groupID,s=e.topicIDList,a=void 0===s?[]:s,r=new ka(\"deleteTopicFromCommunity\");return r.setMessage(\"groupID:\".concat(o,\" topicIDList:\").concat(a)),this.request({protocolName:ea,requestData:{groupID:o,topicIDList:a}}).then((function(e){var n=e.data.resultList,s=[],a=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?s.push({topicID:t}):a.push({topicID:t,code:n,message:o})}));var i=\"success count:\".concat(s.length,\", fail count:\").concat(a.length);return r.setMoreMessage(\"\".concat(i)).setNetworkType(t.getNetworkType()).end(),xe.l(\"\".concat(i)),s.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),Ka({successTopicList:s,failureTopicList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"updateTopicProfile\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"updateTopicProfile\");if(xe.l(\"\".concat(o,\" options:\"),e),e.topicName&&!1===this._filterProfanity(\"topicName\",e))return Ja({code:da.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity(\"introduction\",e))return Ja({code:da.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity(\"notification\",e))return Ja({code:da.PROFANITY_FOUND});var s=new ka(\"updateTopicProfile\");return s.setMessage(\"groupID:\".concat(e.groupID,\" topicID:\").concat(e.topicID)),at(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?\"On\":\"Off\"),this.request({protocolName:ta,requestData:t({},e)}).then((function(){return s.setNetworkType(n.getNetworkType()).end(),xe.l(\"\".concat(o,\" ok\")),n._updateTopicMap([e]),Ka({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"getTopicList\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"getTopicList\"),s=e.groupID,a=e.topicIDList,r=void 0===a?[]:a,i=0===r.length,u=new ka(\"getTopicList\");if(u.setMessage(\"groupID:\".concat(s)),this._getTopicTimeMap.has(s)){var c=this._getTopicTimeMap.get(s),l=c.isGetAll,p=c.time;if((l||!l&&!i)&&Date.now()-p<1e3*this.TOPIC_CACHE_TIME){var d=this._getLocalTopicList(s,r);if(i||d.length===r.length)return u.setNetworkType(this.getNetworkType()).setMoreMessage(\"from cache, topic count:\".concat(d.length)).end(),xe.l(\"\".concat(o,\" groupID:\").concat(s,\" from cache, topic count:\").concat(d.length)),za({successTopicList:d,failureTopicList:[]})}}return this.request({protocolName:na,requestData:{groupID:s,topicIDList:r}}).then((function(e){var a=e.data.topicInfoList,r=[],c=[],l=[];(void 0===a?[]:a).forEach((function(e){var n=e.topic,o=e.selfInfo,s=e.errorCode,a=e.errorInfo,i=n.topicID;0===s?(r.push(t(t({},n),{},{selfInfo:o})),c.push(i)):l.push({topicID:i,code:s,message:a})})),n._updateTopicMap(r),n._handleTopicAtInfo(r);var p=\"success count:\".concat(c.length,\", fail count:\").concat(l.length);u.setNetworkType(n.getNetworkType()).setMoreMessage(\"\".concat(p)).end(),xe.l(\"\".concat(o,\" groupID:\").concat(s,\" from remote, \").concat(p));var d=[];return jt(c)||(n._getTopicTimeMap.set(s,{time:Date.now(),isGetAll:i}),d=n._getLocalTopicList(s,c)),Ka({successTopicList:d,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"hasLocalTopic\",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:\"getLocalTopic\",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:\"_getLocalTopicList\",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=m(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:\"_deleteLocalTopic\",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),xe.l(\"\".concat(this._n,\"._deleteLocalTopic groupID:\").concat(e,\" topicID:\").concat(t)))}},{key:\"_updateTopicMap\",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,s=e.topicID,a=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(s)?(a=t._topicMap.get(o).get(s)).updateTopic(e):(t._getTopicLastMessage(e),a=new Br(e,t.isIntl()),t._topicMap.get(o).set(s,a));var r=t._computeUnreadCount(a);a.updateUnreadCount(r),n.push({conversationID:\"\".concat(S.CONV_GROUP).concat(s),type:S.CONV_TOPIC,unreadCount:r})})),n.length>0)&&this.getModule(Fn).updateTopicConversation(n)}},{key:\"resetGetTopicTime\",value:function(e){var t=this;at(e)?m(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:\"getTopicListOnReconnected\",value:function(){var e=this,t=m(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,s=void 0===n?0:n;Date.now()-1e3*s<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),xe.l(\"\".concat(this._n,\".getTopicListOnReconnected. active community count:\").concat(n.length)),this._relayGetTopicList(n)}},{key:\"_relayGetTopicList\",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?\"topicIDList.length:\".concat(n.topicIDList.length):\"topicIDList:\".concat(n.topicIDList),s=new ka(\"relayGetTopicList\");s.setMessage(o),xe.l(\"\".concat(this._n,\"._relayGetTopicList. \").concat(o)),this.getTopicList(n).then((function(){s.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),o=t[0],a=t[1];s.setError(n,o,a).end()})),t._relayGetTopicList(e)}))}}},{key:\"_handleTopicAtInfo\",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,s=e.topicID,a=e.groupAtInfoList,r=[];at(a)||(a.forEach((function(e){r.push(t(t({},e),{},{groupID:o,topicID:s}))})),n.getModule(Fn).onNewGroupAtTips({dataList:r}))}))}},{key:\"_getTopicLastMessage\",value:function(e){if(!at(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:\"\",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:jt(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:\"deleteTopicListInCommunity\",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(Fn);n.forEach((function(n){var s=n.topicID;t._deleteLocalTopic(e,s),t._getTopicTimeMap.delete(e),o.deleteLocalConversation(\"\".concat(S.CONV_GROUP).concat(s))}))}},{key:\"_computeUnreadCount\",value:function(e){var t=e.selfInfo,n=t.excludedUnreadSequenceList,o=t.readedSequence,s=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(st(n)){var a=0;n.forEach((function(t){t>=o&&t<=e.nextMessageSeq-1&&(a+=1)})),a>=1&&(s-=a)}return s<0?0:s}},{key:\"_filterProfanity\",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:\"updateLastMessage\",value:function(e,t){var n=qt(e),o=this.getLocalTopic(n,e);if(o){var s=t.sequence+1;o.updateNextMessageSeq(s),o.updateLastMessage(t),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:\"getMessageExtensions\",value:function(e,t){xe.l(\"\".concat(this._n,\".getMessageExtensions startSequence:\").concat(t));var n=qt(e.to);return this.request({protocolName:Es,requestData:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:\"modifyMessageExtensions\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;xe.l(\"\".concat(this._n,\".modifyMessageExtensions operateType:\").concat(n));var o=qt(e.to);return this.request({protocolName:Ds,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),s}(ro),Kr=function(){function e(t){o(this,e),this._userModule=t,this._n=\"ProfileHandler\",this.TAG=\"profile\",this.accountProfileMap=new Map,this.expirationTime=864e5}return a(e,[{key:\"setExpirationTime\",value:function(e){this.expirationTime=e}},{key:\"getUserProfile\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"getUserProfile\"),o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(xe.w(\"\".concat(n,\" \").concat(Kt(100))),o.length=100);for(var s,a=[],r=[],i=0,u=o.length;i5?\"userIDList.length:\".concat(o.length):\"userIDList:\".concat(o)),this._userModule.request({protocolName:fo,requestData:e}).then((function(e){p.setNetworkType(t._userModule.getNetworkType()).end(),xe.i(\"\".concat(n,\" ok\"));var o=t._handleResponse(e).concat(r);return Ka(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getMyProfile\",value:function(){var e=this._userModule.getMyAccount(),t=\"\".concat(this._n,\".getMyProfile\");if(xe.l(\"\".concat(t,\" myAccount:\").concat(e)),this._fill(),this._contains(e)){var n=this._getProfileFromMap(e);return xe.d(\"\".concat(t,\" from cache, myProfile:\").concat(JSON.stringify(n))),za(n)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:\"_handleResponse\",value:function(e){var t=e.data.userProfileItem;if(!st(t))return[];for(var n=[],o=Date.now(),s=0,a=t.length;s-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case Be.NICK:n.nick=t[o].value;break;case Be.GENDER:n.gender=t[o].value;break;case Be.BIRTHDAY:n.birthday=t[o].value;break;case Be.LOCATION:n.location=t[o].value;break;case Be.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Be.ALLOWTYPE:n.allowType=t[o].value;break;case Be.LANGUAGE:n.language=t[o].value;break;case Be.AVATAR:n.avatar=t[o].value;break;case Be.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Be.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Be.LEVEL:n.level=t[o].value;break;case Be.ROLE:n.role=t[o].value;break;default:xe.w(\"\".concat(this._n,\"._getLatestProfileFromResponse unknown tag:\"),t[o].tag,t[o].value)}return n}},{key:\"updateMyProfile\",value:function(e){var t=this,n=\"\".concat(this._n,\".\").concat(\"updateMyProfile\");if(e.nick&&!1===this._userModule.filterProfanity(\"nick\",e))return Ja({code:da.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity(\"selfSignature\",e))return Ja({code:da.PROFANITY_FOUND});var o=new ka(\"updateMyProfile\");o.setMessage(JSON.stringify(e));var s=(new ur).validate(e);if(!s.valid)return o.setCode(da.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage(\"info:\".concat(s.tips)).setNetworkType(this._userModule.getNetworkType()).end(),xe.e(\"\".concat(n,\" info:\").concat(s.tips)),Ja({code:da.UPDATE_PROFILE_INVALID_PARAM});var a=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(\"profileCustomField\"===r?e.profileCustomField.forEach((function(e){a.push({tag:e.key,value:e.value})})):a.push({tag:Be[r.toUpperCase()],value:e[r]}));if(0===a.length){var i=new Wa({code:da.UPDATE_PROFILE_NO_KEY});return o.setError(i,!0,this._userModule.getNetworkType()).end(),xe.e(\"\".concat(n,\" failed. error:\"),i),Ja(i)}var u=this._userModule.getMyAccount();return this._userModule.request({protocolName:vo,requestData:{fromAccount:u,profileItem:a}}).then((function(s){o.setNetworkType(t._userModule.getNetworkType()).end(),xe.i(\"\".concat(n,\" ok\"));var a=t._update(u,e),r=a.isProfileUpdated,i=a.latestProfile;return!0===r&&t._userModule.emitOuterEvent(E.PROFILE_UPDATED,[i]),za(i)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"onProfileModified\",value:function(e){var t=e.dataList;if(!jt(t)){var n,o=t.length;xe.d(\"\".concat(this._n,\".onProfileModified count:\").concat(o,\" dataList:\"),e.dataList);for(var s=[],a=0;a0&&(this._userModule.emitInnerEvent(er,s),this._userModule.emitOuterEvent(E.PROFILE_UPDATED,s))}}},{key:\"_fill\",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n0&&(n.lastUpdatedTime=s,o=!0)):(n=new ur(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=s,o=!0,this.accountProfileMap.set(e,n)));return this._flush(e===this._userModule.getMyAccount()),xe.l(\"\".concat(this._n,\"._update account:\").concat(e,\" isProfileUpdated:\").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:\"_flush\",value:function(e){var t=m(this.accountProfileMap.values()),n=this._userModule.getStorageModule();xe.d(\"\".concat(this._n,\"._flush length:\").concat(t.length,\" flushAtOnce:\").concat(e)),n.setItem(this.TAG,t,e)}},{key:\"_contains\",value:function(e){return this.accountProfileMap.has(e)}},{key:\"_getProfileFromMap\",value:function(e){return this.accountProfileMap.get(e)}},{key:\"_getCachedProfiles\",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return jt(e)?[]:e}},{key:\"onConversationsProfileUpdated\",value:function(e){for(var t,n,o,s=[],a=0,r=e.length;a0&&s.push(n)):s.push(t.userID));0!==s.length&&(xe.i(\"\".concat(this._n,\".onConversationsProfileUpdated toAccountList:\").concat(s)),this.getUserProfile({userIDList:s}))}},{key:\"getNickAndAvatarByUserID\",value:function(e){if(this._contains(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:\"\",avatar:\"\"}}},{key:\"reset\",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),e}(),Wr=a((function e(t){o(this,e),jt||(this.userID=t.userID||\"\",this.timeStamp=t.timeStamp||0)})),Yr=function(){function e(t){o(this,e),this._userModule=t,this._n=\"BlacklistHandler\",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return a(e,[{key:\"getLocalBlacklist\",value:function(){return m(this._blacklistMap.keys())}},{key:\"getBlacklist\",value:function(){var e=this,t=\"\".concat(this._n,\".getBlacklist\"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new ka(\"getBlacklist\");return this._userModule.request({protocolName:mo,requestData:n}).then((function(n){var s=n.data,a=s.blackListItem,r=s.currentSequence,i=jt(a)?0:a.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage(\"count:\".concat(i)).end(),xe.i(\"\".concat(t,\" ok\")),e.currentSequence=r,e._handleResponse(a,!0),e._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()})),xe.e(\"\".concat(t,\" failed. error:\"),n),Ja(n)}))}},{key:\"addBlacklist\",value:function(e){var t=this,n=new ka(\"addToBlacklist\"),o=\"\".concat(this._n,\".addBlacklist\"),s=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===s){var a=da.CANNOT_ADD_SELF_TO_BLACKLIST,r=this._userModule.getErrorMessage(a);n.setCode(a).setMessage(r).setNetworkType(this._userModule.getNetworkType()).end();var i=new Wa({code:a});return xe.e(\"\".concat(o,\" failed. error:\"),i),Ja(i)}return e.userIDList.includes(s)&&(e.userIDList=e.userIDList.filter((function(e){return e!==s}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Mo,requestData:e}).then((function(s){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)).end(),xe.i(\"\".concat(o,\" ok\")),t._handleResponse(s.resultItem,!0),Ka(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=v(t,2),s=o[0],a=o[1];n.setError(e,s,a).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"_handleResponse\",value:function(e,t){if(!jt(e))for(var n,o,s,a=0,r=e.length;a5?\"userIDList.length:\".concat(e.userIDList.length):\"userIDList:\".concat(e.userIDList)).end(),xe.i(\"\".concat(n,\" ok\")),t._handleResponse(s.data.resultItem,!1),Ka(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"onAccountDeleted\",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(xe.l(\"\".concat(this._n,\".onAccountDeleted count:\").concat(n.length,\" userIDList:\"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:\"onAccountAdded\",value:function(e){for(var t,n=[],o=0,s=e.length;o0&&(xe.l(\"\".concat(this._n,\".onAccountAdded count:\").concat(n.length,\" userIDList:\"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:\"reset\",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),jr=function(e){var t=String(e).replace(/[=]+$/,\"\"),n=\"\";if(t.length%4==1)return\"\";for(var o,s,a=0,r=0;s=t.charAt(r++);~s&&(o=a%4?64*o+s:s,a++%4)?n+=String.fromCharCode(255&o>>(-2*a&6)):0)s=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(s);try{return decodeURIComponent(escape(n))}catch(i){return\"\"}},zr=function(){function e(t){o(this,e),this._userModule=t,this._n=\"UserStatusHandler\",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on($a,this._onCloudConfigUpdated,this)}return a(e,[{key:\"_onCloudConfigUpdated\",value:function(){var e=this._userModule.getCloudConfig(\"status_query_count\"),t=this._userModule.getCloudConfig(\"status_sub_count\"),n=this._userModule.getCloudConfig(\"status_unsub_count\");xe.l(\"\".concat(this._n,\"._onCloudConfigUpdated statusQueryCount:\").concat(e,\" statusSubscribeCount:\").concat(t)+\" statusUnsubscribeCount:\".concat(n)),at(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),at(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),at(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:\"onUserStatusUpdated\",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(qn),s=t.map((function(e){var t=e.to,s=e.statusType,a=e.customStatus,r=jr(a);return t===n&&o.setCustomStatus(r),{userID:t,statusType:s,customStatus:r}}));this._userModule.emitOuterEvent(E.USER_STATUS_UPDATED,s)}},{key:\"setSelfStatus\",value:function(e){var t=this,n=\"\".concat(this._n,\".setSelfStatus\");if(!1===this._userModule.filterProfanity(\"customStatus\",e))return Ja({code:da.PROFANITY_FOUND});var o=new ka(\"setSelfStatus\"),s=e.customStatus;return this._userModule.request({protocolName:oa,requestData:{customStatus:s}}).then((function(e){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(\"customStatus:\".concat(s)).end(),xe.l(\"\".concat(n,\" ok. customStatus:\").concat(s)),t._userModule.getModule(qn).setCustomStatus(s),Ka({userID:t._userModule.getMyUserID(),statusType:1,customStatus:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),s=n[0],a=n[1];o.setError(e,s,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"getUserStatus\",value:function(e){var t=this,n=\"\".concat(this._n,\".getUserStatus\"),o=e.userIDList,s=void 0===o?[]:o,a=this._userModule.getMyUserID(),r=m(s),i=void 0,u=r.indexOf(a);if(u>-1){r.splice(u,1);var c=this._userModule.getModule(qn).getCustomStatus();i={userID:a,statusType:1,customStatus:c}}if(0===r.length)return za({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});r.length>this.MAX_QUERY_USER_COUNT&&(xe.w(\"\".concat(n,\" \").concat(Kt(this.MAX_QUERY_USER_COUNT))),r=s.slice(0,this.MAX_QUERY_USER_COUNT));var l=new ka(\"getUserStatus\");return this._userModule.request({protocolName:sa,requestData:{userIDList:r}}).then((function(e){var o=e.data,a=o.successUserList,r=void 0===a?[]:a,u=o.failureUserList,c=void 0===u?[]:u,p=r.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:jr(o)}})),d=c.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));at(i)||p.unshift(i);var g=\"userID count:\".concat(s.length,\", success count:\").concat(p.length,\", fail count:\").concat(d.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(g)).end(),xe.l(\"\".concat(n,\" ok. \").concat(g,\".\")),Ka({successUserList:p,failureUserList:d})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setMessage(\"userID count:\".concat(s.length)).setError(e,o,a).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"subscribeUserStatus\",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".subscribeUserStatus\"),o=e.userIDList,s=void 0===o?[]:o,a=m(s);a.length>this.MAX_SUBSCRIBE_USER_COUNT&&(xe.w(\"\".concat(n,\" \").concat(Kt(this.MAX_SUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new ka(\"subscribeUserStatus\"),i=\"userID count:\".concat(s.length);return xe.l(\"\".concat(n,\" \").concat(i)),this._userModule.request({protocolName:aa,requestData:{userIDList:a}}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(i,\" fail count:\").concat(s.length)).end(),xe.l(\"\".concat(n,\" ok. fail count:\").concat(s.length,\".\")),Ka({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setMessage(\"\".concat(i)).setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"unsubscribeUserStatus\",value:function(e){var t=this;if(!this._userModule.canIUse(B.USER_STATUS))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".unsubscribeUserStatus\"),o=(e||{}).userIDList,s=void 0===o?[]:o,a=m(s);s.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(xe.w(\"\".concat(n,\" \").concat(Kt(this.MAX_UNSUBSCRIBE_USER_COUNT))),a=s.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new ka(\"unsubscribeUserStatus\"),i=\"userID count:\".concat(s.length);xe.l(\"\".concat(n,\" \").concat(i));var u={userIDList:a};return 0===a.length&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:ra,requestData:u}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:jt(n)?t:n,code:o,message:s}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage(\"\".concat(i,\" fail count:\").concat(s.length)).end(),xe.l(\"\".concat(n,\" ok. fail count:\").concat(s.length,\".\")),Ka({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setMessage(\"\".concat(i)).setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"reset\",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),Jr=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"UserModule\",s._profileHandler=new Kr(_(s)),s._blacklistHandler=new Yr(_(s)),s._userStatusHandler=new zr(_(s)),s.getInnerEmitterInstance().on(Za,s.onContextUpdated,_(s)),s}return a(n,[{key:\"onContextUpdated\",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:\"onProfileModified\",value:function(e){this._profileHandler.onProfileModified(e)}},{key:\"onRelationChainModified\",value:function(e){var t=e.dataList;if(!jt(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,m(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,m(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:\"onConversationsProfileUpdated\",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:\"getMyAccount\",value:function(){return this.getMyUserID()}},{key:\"getMyProfile\",value:function(){return this._profileHandler.getMyProfile()}},{key:\"getStorageModule\",value:function(){return this.getModule(xn)}},{key:\"filterProfanity\",value:function(e,t){var n=this.getModule(no);if(!n)return!0;var o=n.filterText(t[e],j),s=o.isAllowedToSend,a=o.modifiedText;return!0===s&&(t[e]=a,!0)}},{key:\"isMyFriend\",value:function(e){var t=this.getModule(Pn);return!!t&&t.isMyFriend(e)}},{key:\"getUserProfile\",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:\"updateMyProfile\",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:\"getNickAndAvatarByUserID\",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:\"getLocalBlacklist\",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return za(e)}},{key:\"addBlacklist\",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:\"deleteBlacklist\",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:\"onUserStatusUpdated\",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:\"setSelfStatus\",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:\"getUserStatus\",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:\"subscribeUserStatus\",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:\"unsubscribeUserStatus\",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(ro),Xr=function(){function e(t,n){o(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||\"\",this._userSig=n.userSig||\"\",this._version=\"2.27.5\",this._a2Key=\"\",this._tinyID=\"\",this._customStatus=\"\",this._contentType=\"json\",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||\"\",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy}return a(e,[{key:\"isLoggedIn\",value:function(){return this._isLoggedIn}},{key:\"isOversea\",value:function(){return this._oversea}},{key:\"isPrivateNetWork\",value:function(){return this._proxyServer}},{key:\"isDevMode\",value:function(){return this._isDevMode}},{key:\"isSingaporeSite\",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:\"isKoreaSite\",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:\"isGermanySite\",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:\"isIndiaSite\",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:\"isJapanSite\",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:\"isUSASite\",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:\"isIntl\",value:function(){return 0===(e=this._SDKAppID)||e>=2e7&&e<8e7||e>=172e7&&e<178e7;var e}},{key:\"isUnlimitedAVChatRoom\",value:function(){return this._unlimitedAVChatRoom}},{key:\"setUserID\",value:function(e){this._userID=e}},{key:\"getUserID\",value:function(){return this._userID}},{key:\"setUserSig\",value:function(e){this._userSig=e}},{key:\"getUserSig\",value:function(){return this._userSig}},{key:\"getSDKAppID\",value:function(){return this._SDKAppID}},{key:\"setTinyID\",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:\"getTinyID\",value:function(){return this._tinyID}},{key:\"setCustomStatus\",value:function(e){this._customStatus=e}},{key:\"getCustomStatus\",value:function(){return this._customStatus}},{key:\"getScene\",value:function(){return Le?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?\"tuikit\":this._scene}},{key:\"getInstanceID\",value:function(){return this._instanceID}},{key:\"getStatusInstanceID\",value:function(){return this._statusInstanceID}},{key:\"setStatusInstanceID\",value:function(e){this._statusInstanceID=e}},{key:\"getVersion\",value:function(){return this._version}},{key:\"getA2Key\",value:function(){return this._a2Key}},{key:\"setA2Key\",value:function(e){this._a2Key=e}},{key:\"getContentType\",value:function(){return this._contentType}},{key:\"getProxyServer\",value:function(){return this._proxyServer}},{key:\"getFileUploadProxy\",value:function(){return this._fileUploadProxy}},{key:\"getFileDownloadProxy\",value:function(){return this._fileDownloadProxy}},{key:\"_isTUIKit\",value:function(){var e=!1,t=!1,n=!1,o=!1,s=[];se&&(s=Object.keys(re)),ae&&(s=oe?Object.keys(uni):Object.keys(window));for(var a=0,r=s.length;a0){for(var c=0,l=u.length;c0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return Ja({code:da.USER_NOT_LOGGED_IN});var n=new ka(\"logout\");n.setNetworkType(this.getNetworkType()).setMessage(\"identifier:\".concat(this.getMyUserID())).end(!0);var o=\"\".concat(this._n,\".logout\");return xe.i(\"\".concat(o,\" type:\").concat(t)),0===t&&this._m.setNotReadyReason(da.LOGGED_OUT),this.request({protocolName:uo,requestData:{type:t}}).then((function(){return e.resetReady(),za({})})).catch((function(t){return xe.e(\"\".concat(o,\" error:\"),t),e.resetReady(),za({})}))}},{key:\"_fetchCloudControlConfig\",value:function(){this.getModule(Xn).fetchConfig()}},{key:\"_getStatusInstanceID\",value:function(){return uni.getStorageSync(\"timUniAppInstanceID\")}},{key:\"_hello\",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:co,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){xe.w(\"\".concat(e._n,\"._hello error:\"),t)}))}},{key:\"getLastWsHelloTs\",value:function(){return this._lastWsHelloTs}},{key:\"_checkLoginInfo\",value:function(e){var t=0;return jt(this.getModule(qn).getSDKAppID())?t=da.NO_SDKAPPID:jt(e.userID)?t=da.NO_IDENTIFIER:jt(e.userSig)&&(t=da.NO_USERSIG),{code:t}}},{key:\"_isReactUIKit\",value:function(){return ae&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:\"onMultipleAccountKickedOut\",value:function(e){var t=this;new ka(\"kickedOut\").setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(S.KICKED_OUT_MULT_ACCOUNT,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),xe.w(\"\".concat(this._n,\".onMultipleAccountKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(da.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:\"onMultipleDeviceKickedOut\",value:function(e){var t=this;new ka(\"kickedOut\").setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(S.KICKED_OUT_MULT_DEVICE,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),xe.w(\"\".concat(this._n,\".onMultipleDeviceKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(da.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:\"onUserSigExpired\",value:function(){new ka(\"kickedOut\").setNetworkType(this.getNetworkType()).setMessage(S.KICKED_OUT_USERSIG_EXPIRED).end(!0),xe.w(\"\".concat(this._n,\".onUserSigExpired: userSig expired\")),0!==this.getModule(qn).getStatusInstanceID()&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(da.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:\"onRestApiKickedOut\",value:function(e){(new ka(\"kickedOut\").setNetworkType(this.getNetworkType()).setMessage(\"type:\".concat(S.KICKED_OUT_REST_API,\" newInstanceInfo:\").concat(JSON.stringify(e))).end(!0),xe.w(\"\".concat(this._n,\".onRestApiKickedOut userID:\").concat(this.getMyUserID(),\" newInstanceInfo:\"),e),0!==this.getModule(qn).getStatusInstanceID())&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_REST_API}),this._m.setNotReadyReason(da.KICKED_OUT_REST_API),this._m.reset(),this.getModule(zn).onRestApiKickedOut())}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),n}(ro);function Zr(){return null}var $r=function(){function e(t){o(this,e),this._m=t,this._n=\"StorageModule\",this._storageQueue=new Map,this._errorTolerantHandle()}return a(e,[{key:\"_errorTolerantHandle\",value:function(){se||!at(window)&&this._canIUseCookies()||(this.getItem=Zr,this.setItem=Zr,this.removeItem=Zr,this.clear=Zr)}},{key:\"onCheckTimer\",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:\"_doFlush\",value:function(){try{var e,t=D(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],s=n[1];this._setStorageSync(this._getKey(o),s)}}catch(a){t.e(a)}finally{t.f()}this._storageQueue.clear()}catch(r){xe.w(\"\".concat(this._n,\"._doFlush error:\"),r)}}},{key:\"_getPrefix\",value:function(){var e=this._m.getModule(qn);return\"TIM_\".concat(e.getSDKAppID(),\"_\").concat(e.getUserID(),\"_\")}},{key:\"_getKey\",value:function(e){return\"\".concat(this._getPrefix()).concat(e)}},{key:\"getItem\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return xe.w(\"\".concat(this._n,\".getItem error:\"),o),{}}}},{key:\"setItem\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var s=o?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}},{key:\"clear\",value:function(){try{se?re.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){xe.w(\"\".concat(this._n,\".clear error:\"),e)}}},{key:\"removeItem\",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){xe.w(\"\".concat(this._n,\".removeItem error:\"),o)}}},{key:\"getSize\",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"b\";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,\"leftSize\",{enumerable:!0,get:function(){return o.limitSize-o.size}}),se&&(o.limitSize=1024*re.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(se){var s=re.getStorageInfoSync(),a=s.keys;a.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var r in localStorage)localStorage.hasOwnProperty(r)&&(o.size+=localStorage.getItem(r).length+r.length);return this._convertUnit(o)}catch(i){xe.w(\"\".concat(this._n,\" error:\"),i)}}},{key:\"_convertUnit\",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)\"number\"==typeof e[o]&&(\"kb\"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):\"mb\"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:\"_setStorageSync\",value:function(e,t){se?ee?my.setStorageSync({key:e,data:t}):re.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:\"getStorageSync\",value:function(e){return se?ee?my.getStorageSync({key:e}).data:re.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:\"_removeStorageSync\",value:function(e){se?ee?my.removeStorageSync({key:e}):re.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:\"_canIUseCookies\",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._doFlush()}}]),e}(),ei=function(){function e(t){o(this,e),this._n=\"SSOLogBody\",this._report=[]}return a(e,[{key:\"pushIn\",value:function(e){xe.d(\"\".concat(this._n,\".pushIn\"),this._report.length,e),this._report.push(e)}},{key:\"backfill\",value:function(e){var t;st(e)&&0!==e.length&&(xe.d(\"\".concat(this._n,\".backfill\"),this._report.length,e.length),(t=this._report).unshift.apply(t,m(e)))}},{key:\"getLogsNumInMemory\",value:function(){return this._report.length}},{key:\"isEmpty\",value:function(){return 0===this._report.length}},{key:\"_reset\",value:function(){this._report.length=0,this._report=[]}},{key:\"getLogsInMemory\",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),ti=function(e){var t=e.getModule(qn);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Ue()}},ni=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n=\"EventStatModule\",t.TAG=\"im-ssolog-event\",t._reportBody=new ei,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var a=t.getInnerEmitterInstance();return a.on(Za,t._onLoginSuccess,_(t)),a.on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:\"reportAtOnce\",value:function(){xe.d(\"\".concat(this._n,\".reportAtOnce\")),this._report()}},{key:\"_onLoginSuccess\",value:function(){var e=this,t=this.getModule(xn),n=t.getItem(this.TAG,!1);!jt(n)&&it(n.forEach)&&(xe.l(\"\".concat(this._n,\"._onLoginSuccess get ssolog in storage, count:\").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"evt_rpt_threshold\"),t=this.getCloudConfig(\"evt_rpt_waiting\"),n=this.getCloudConfig(\"evt_rpt_level\"),o=this.getCloudConfig(\"evt_rpt_sdkappid_bl\"),s=this.getCloudConfig(\"evt_rpt_tinyid_wl\");at(e)||(this.MIN_THRESHOLD=Number(e)),at(t)||(this.WAITING_TIME=Number(t)),at(n)||(this.REPORT_LEVEL=n.split(\",\").map((function(e){return Number(e)}))),at(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(\",\").map((function(e){return Number(e)}))),at(s)||(this.REPORT_TINYID_WHITELIST=s.split(\",\"))}},{key:\"pushIn\",value:function(e){e instanceof ka&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:\"onCheckTimer\",value:function(){Date.now()e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:\"_flushAtOnce\",value:function(){var e=this.getModule(xn),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o=\"\".concat(this._n,\"._flushAtOnce\");if(jt(t))xe.l(\"\".concat(o,\" count:\").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>this.MAX_THRESHOLD&&(s=s.slice(0,this.MAX_THRESHOLD)),xe.l(\"\".concat(o,\" count:\").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),s}(ro),oi=\"none\",si=\"online\",ai=[da.OVER_FREQUENCY_LIMIT,da.OPEN_SERVICE_OVERLOAD_ERROR],ri=function(){function e(t){o(this,e),this._m=t,this._networkType=\"\",this._n=\"NetMonitorModule\",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return a(e,[{key:\"start\",value:function(){var e=this;se?(re.getNetworkType({success:function(t){e._networkType=t.networkType||t.subtype||\"\",t.networkType===oi?xe.w(\"\".concat(e._n,\".start no network, please check!\")):xe.i(\"\".concat(e._n,\".start networkType:\").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),re.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=si,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener(\"online\",this._webOnlineCallback),window.addEventListener(\"offline\",this._webOfflineCallback)))}},{key:\"_onWebOnline\",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:si})}},{key:\"_onWebOffline\",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:oi})}},{key:\"_onNetworkStatusChange\",value:function(e){var t=e.isConnected,n=e.networkType,o=\"\".concat(this._n,\"._onNetworkStatusChange\"),s=!1;t?(xe.i(\"\".concat(o,\" previous:\").concat(this._networkType,\" current:\").concat(n)),this._networkType!==n&&(s=!0,this._m.getModule(zn).reConnect(!0))):this._networkType!==n&&(s=!0,xe.w(\"\".concat(o,\" no network, please check!\")),this._m.getModule(zn).offline());s&&(new ka(\"networkChange\").setMessage(\"isConnected:\".concat(t,\" previousNetworkType:\").concat(this._networkType,\" networkType:\").concat(n)).end(),this._networkType=n)}},{key:\"probe\",value:function(e){var t=this;if(!at(e)&&ai.includes(e.code))return Promise.resolve([!0,this._networkType]);var n=\"\".concat(this._n,\".probe\");return new Promise((function(e,o){se?re.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===oi?(xe.w(\"\".concat(n,\" no network, please check!\")),e([!1,o.networkType])):(xe.i(\"\".concat(n,\" networkType:\").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===oi?e([!1,oi]):e([!0,si])}))}},{key:\"getNetworkType\",value:function(){return this._networkType}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),se?null!==this._mpNetworkStatusCallback&&(re.offNetworkStatusChange&&(ne||Z?re.offNetworkStatusChange(this._mpNetworkStatusCallback):re.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener(\"online\",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener(\"offline\",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}();var ii=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,n=\"~\";function o(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,o,a,r){if(\"function\"!=typeof o)throw new TypeError(\"The listener must be a function\");var i=new s(o,a||e,r),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],i]:e._events[u].push(i):(e._events[u]=i,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,o,s=[];if(0===this._eventsCount)return s;for(o in e=this._events)t.call(e,o)&&s.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},i.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var s=0,a=o.length,r=new Array(a);s=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:\"_getAuthorization\",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:\"upload\",value:function(e){if(!0===e.getRelayFlag())return Promise.resolve();var t=this.getModule($n);switch(e.type){case S.MSG_IMAGE:return t.addTotalCount(Ma),this._uploadImage(e);case S.MSG_FILE:return t.addTotalCount(Ma),this._uploadFile(e);case S.MSG_AUDIO:return t.addTotalCount(Ma),this._uploadAudio(e);case S.MSG_VIDEO:return t.addTotalCount(Ma),this._uploadVideo(e);default:return Promise.resolve()}}},{key:\"_uploadImage\",value:function(e){var n=this,o=this.getModule(Rn),s=e.getElements()[0],a=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:a.payload.file,to:a.to,onProgress:function(e){if(s.updatePercent(e),it(a.onProgress))try{a.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var a,r,i=o.location,u=o.fileType,c=o.fileSize,l=o.width,p=o.height,d=o.smallImageUrl,g=o.smallImageWidth,_=o.smallImageHeight,h=o.largeImageUrl,f=o.largeImageWidth,v=o.largeImageHeight,m=n.isPrivateNetWork()?i:Mt(i);return s.updateImageFormat(u),d&&h?(a={url:d,width:g,height:_},r={url:h,width:f,height:v}):(a=Gt({originUrl:m,originWidth:l,originHeight:p,min:198}),r=Gt({originUrl:m,originWidth:l,originHeight:p,min:720})),s.updateImageInfoArray([{size:c,url:m,width:l,height:p},t({},r),t({},a)]),e}))}},{key:\"_uploadFile\",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:Mt(s);return o.updateFileUrl(a),e}))}},{key:\"_uploadAudio\",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=t.isPrivateNetWork()?s:Mt(s);return o.updateAudioUrl(a),e}))}},{key:\"_uploadVideo\",value:function(e){var t=this,n=this.getModule(Rn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),it(s.onProgress))try{s.onProgress(e)}catch(t){return Ja({code:da.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,a=n.snapshotInfo,r=t.isPrivateNetWork()?s:Mt(s);return o.updateVideoUrl(r),jt(a)||o.updateSnapshotInfo(a),e}))}},{key:\"_checkSizeError\",value:function(e){return Ja({code:da[\"MESSAGE_\".concat(e,\"_SIZE_LIMIT\")],message:this.getErrorMessage(\"UploadSizeLimit\",e.toLowerCase(),\"\".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576,\" MB\"))})}},{key:\"doUploadImage\",value:function(e){var t=this;if(!e.file)return Ja({code:da.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var s=null;return this._setUploadFileType(sr),this.uploadByCOS(e).then((function(e){return s=e,t.isPrivateNetWork()?At(e.location):At(\"https://\".concat(e.location))})).then((function(e){return s.width=e.width,s.height=e.height,Promise.resolve(s)}))}},{key:\"_checkImageType\",value:function(e){var t=\"\";return t=se?e.url.slice(e.url.lastIndexOf(\".\")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(\".\")+1),nr.indexOf(t.toLowerCase())>=0||Ja({code:da.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:\"_checkImageSize\",value:function(e){var t=0;return 0===(t=se?e.size:e.files[0].size)?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):tthis.UPLOAD_SIZE_LIMIT.FILE?this._checkSizeError(\"FILE\"):0===e.file.files[0].size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(ir),this.uploadByCOS(e)):Ja({code:da.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:\"doUploadVideo\",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.VIDEO?this._checkSizeError(\"VIDEO\"):0===e.file.videoFile.size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):-1===or.indexOf(e.file.videoFile.type)?Ja({code:da.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(ar),se?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ae?this.handleVideoUpload(e):void 0)}},{key:\"handleVideoUpload\",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new Wa({code:da.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:\"doUploadAudio\",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.AUDIO?this._checkSizeError(\"AUDIO\"):0===e.file.size?Ja({code:da.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(rr),this.uploadByCOS(e)):Ja({code:da.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:\"uploadByCOS\",value:function(e){var t=this;if(!it(this._cosUploadMethod))return this.outputWarning(\"PluginUndetected\"),Ja({code:da.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new ka(\"upload\"),o=\"\".concat(this._n,\".uploadByCOS\"),s=Date.now(),a=this._getFile(e);return new Promise((function(r,i){var u=se?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),c=t;t._cosUploadMethod(u,(function(e,u){var l=Object.create(null);if(u){if(e||st(u.files)&&u.files[0].error){var p=new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(p,!0,t.getNetworkType()).end(),xe.l(\"\".concat(o,\" failed. error:\"),u.files[0].error),403===u.files[0].error.statusCode&&(xe.w(\"\".concat(o,\" failed. cos AccessKeyId was invalid, regain auth key!\")),t._getAuthorizationKey()),void i(p)}l.fileName=a.name,l.fileSize=a.size,l.fileType=a.type.slice(a.type.indexOf(\"/\")+1).toLowerCase(),l.location=se?u.Location:u.files[0].data.Location;var d=Date.now()-s,g=c._formatFileSize(a.size),_=c._formatSpeed(1e3*a.size/d),h=\"size:\".concat(g,\" time:\").concat(d,\"ms speed:\").concat(_);xe.l(\"\".concat(o,\" success. name:\").concat(a.name,\" \").concat(h)),r(l);var f=t.getModule($n);return f.addCost(Ma,d),f.addFileSize(Ma,a.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var v=new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL});n.setError(v,!0,c.getNetworkType()).end(),xe.w(\"\".concat(o,\" failed. error:\"),e),403===e.statusCode&&(xe.w(\"\".concat(o,\" failed. cos AccessKeyId was invalid, regain auth key!\")),t._getAuthorizationKey()),i(v)}))}))}},{key:\"_uploadWithPreSigUrl\",value:function(e){var t=this,n=\"\".concat(this._n,\"._uploadWithPreSigUrl\"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(s,a){var r=new ka(\"upload\"),i=e.requestSnapshotUrl,u=void 0===i?void 0:i,c=g(e,ci),l=Date.now();t._cosUploadMethod(c,(function(e,i){if(e||403===i.statusCode)return r.setError(new Wa(e),!0,t.getNetworkType()).end(),xe.l(\"\".concat(n,\" failed, error:\"),e),void a(new Wa({code:da.MESSAGE_FILE_UPLOAD_FAIL}));var p=Object.create(null),d=i.data.location||\"\";t.isPrivateNetWork()||0!==d.indexOf(\"https://\")&&0!==d.indexOf(\"http://\")||(d=d.split(\"//\")[1]),p.fileName=o.name,p.fileSize=o.size,p.fileType=o.type.slice(o.type.indexOf(\"/\")+1).toLowerCase(),p.location=d;var g=Date.now()-l,_=t._formatFileSize(o.size),h=t._formatSpeed(1e3*o.size/g),f=\"size:\".concat(_,\",time:\").concat(g,\"ms,speed:\").concat(h,\" res:\").concat(JSON.stringify(i.data));xe.l(\"\".concat(n,\" success name:\").concat(o.name,\",\").concat(f)),r.setNetworkType(t.getNetworkType()).setMessage(f).end();var v=t.getModule($n);v.addCost(Ma,g),v.addFileSize(Ma,o.size);var m=[];if(c.thumbUrl&&c.largeUrl&&(m=[t._getSmallImageInfoByUrl(c.thumbUrl,p),t._getLargeImageInfoByUrl(c.largeUrl,p)]),u&&m.push(t._getSnapshotInfoByUrl(u,p)),m.length>0)return Promise.all(m).then((function(){s(p)}));s(p)}))}))}))}},{key:\"_getRawOrUploadProxyUrl\",value:function(e){var t=this.getModule(qn).getFileUploadProxy(),n=e;return t&&(n=e.replace(/^https:\\/\\/[^/]+/,t)),n}},{key:\"_getFile\",value:function(e){var t;return st(e.file.files)||(t=e.file.files,\"filelist\"===ct(t))?e.file.files[0]:e.file}},{key:\"_formatFileSize\",value:function(e){return e<1024?e+\"B\":e<1048576?Math.floor(e/1024)+\"KB\":Math.floor(e/1048576)+\"MB\"}},{key:\"_formatSpeed\",value:function(e){return e<=1048576?bt(e/1024,1)+\"KB/s\":bt(e/1048576,1)+\"MB/s\"}},{key:\"_createCosOptionsWeb\",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(\".\")),s=this._genFileName(\"\".concat(_t(999999)).concat(o));return{files:[{Bucket:\"\".concat(this.bucketName,\"-\").concat(this.appid),Region:this.region,Key:\"\".concat(this.directory,\"/\").concat(s),Body:t}],SliceSize:1048576,onProgress:function(t){if(\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w(\"onProgress callback error:\",n)}},onFileFinish:function(e,t,n){}}}},{key:\"_createCosOptionsWXMiniApp\",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:\"\".concat(this.bucketName,\"-\").concat(this.appid),Region:this.region,Key:\"\".concat(this.directory,\"/\").concat(n),FilePath:o,onProgress:function(t){if(xe.l(JSON.stringify(t)),\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w(\"onProgress callback error:\",n)}}}}},{key:\"_createCosOptionsPreSigUrl\",value:function(e){var t=this,n=\"\",o=\"\",s=0,a=this._getFile(e);if(se)n=this._genFileName(a.name),o=a.url,s=1;else{var r=a.name,i=r.slice(r.lastIndexOf(\".\"));n=this._genFileName(\"\".concat(_t(999999)).concat(i)),o=a,s=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:s,duration:this.duration}).then((function(s){var a=s.uploadUrl,r=s.downloadUrl,i=s.requestSnapshotUrl,u=void 0===i?void 0:i,c=s.thumbUrl,l=s.largeUrl;return{url:t._getRawOrUploadProxyUrl(a),fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:r,requestSnapshotUrl:u,thumbUrl:c,largeUrl:l,onProgress:function(t){if(\"function\"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){xe.w(\"onProgress callback error:\",n),xe.e(n)}}}}))}},{key:\"_genFileName\",value:function(e){return\"\".concat(Rt(),\"-\").concat(e)}},{key:\"_setUploadFileType\",value:function(e){this.uploadFileType=e}},{key:\"_getSnapshotInfoByUrl\",value:function(e,t){var n=this,o=new ka(\"getSnapshotInfo\");return this.request({protocolName:qs,requestData:{platform:this.getPlatform(),coverName:this._genFileName(_t(99999)),requestSnapshotUrl:e}}).then((function(e){var n=(e.data||{}).snapshotUrl;return o.setMessage(\"snapshotUrl:\".concat(n)).end(),jt(n)?{}:At(n).then((function(e){t.snapshotInfo={snapshotUrl:n,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return xe.w(\"\".concat(n._n,\"._getSnapshotInfoByUrl failed. error:\"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:\"_getSmallImageInfoByUrl\",value:function(e,t){return At(e).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:\"_getLargeImageInfoByUrl\",value:function(e,t){return At(e).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\"))}}]),s}(ro),pi=[\"downloadKey\",\"pbDownloadKey\",\"messageList\"],di=function(){function e(t){o(this,e),this._n=\"MergerMessageHandler\",this._messageModule=t}return a(e,[{key:\"uploadMergerMessage\",value:function(e,t){var n=this,o=\"\".concat(this._n,\".\").concat(\"uploadMergerMessage\");xe.d(\"\".concat(o,\" message:\"),e,\"messageBytes:\".concat(t));var s=e.payload.messageList,a=s.length,r=new ka(\"uploadMergerMessage\");return this._messageModule.request({protocolName:Ys,requestData:{messageList:s}}).then((function(e){xe.d(\"\".concat(o,\" ok. response:\"),e.data);var s=e.data,i=s.pbDownloadKey,u=s.downloadKey,c={pbDownloadKey:i,downloadKey:u,messageNumber:a};return r.setNetworkType(n._messageModule.getNetworkType()).setMessage(\"\".concat(a,\"-\").concat(t,\"-\").concat(u)).end(),c})).catch((function(e){throw xe.w(\"\".concat(o,\" failed. error:\"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),e}))}},{key:\"downloadMergerMessage\",value:function(e){var n=this,o=\"\".concat(this._n,\".\").concat(\"downloadMergerMessage\");xe.d(\"\".concat(o,\" message:\"),e);var s=e.payload.downloadKey,a=this._messageModule.getFileDownloadProxy(),r=new ka(\"downloadMergerMessage\");return r.setMessage(\"downloadKey:\".concat(s)),this._messageModule.request({protocolName:js,requestData:{downloadKey:s}}).then((function(s){if(xe.d(\"\".concat(o,\" ok. response:\"),s.data),it(e.clearElement)){var i=e.payload;i.downloadKey,i.pbDownloadKey,i.messageList;var u=g(i,pi);e.clearElement(),e.setElement({type:e.type,content:t({messageList:s.data.messageList},u)},a)}else{var c=[];s.data.messageList.forEach((function(e){if(!jt(e)){var t=new xa(e,a);c.push(t)}})),e.payload.messageList=c,e.payload.downloadKey=\"\",e.payload.pbDownloadKey=\"\"}return r.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw xe.w(\"\".concat(o,\" failed. key:\").concat(s,\" error:\"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),e}))}},{key:\"createMergerMessagePack\",value:function(e,t,n){return e.conversationType===S.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:\"_createC2CMergerMessagePack\",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push(\"NoUnread\"),!0===i&&s.push(\"NoLastMsg\"),!0===u&&s.push(\"NoMsgCheck\")}var c=\"\";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,p=n.downloadKey,d=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Gn),m=v&&v.isOnlineMessage(e,t)?0:void 0;return{protocolName:_o,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:p,title:_,abstractList:h,compatibleText:f,messageNumber:d}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||\"\",desc:o.description||\"\",ext:o.extension||\"\",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||\"\"}}:void 0,messageControlInfo:0!==m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:\"_createGroupMergerMessagePack\",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var s=[];if(ot(t)&&ot(t.messageControlInfo)){var a=t.messageControlInfo,r=a.excludedFromUnreadCount,i=a.excludedFromLastMessage,u=a.excludedFromContentModeration;!0===r&&s.push(\"NoUnread\"),!0===i&&s.push(\"NoLastMsg\"),!0===u&&s.push(\"NoMsgCheck\")}var c=\"\";et(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,p=n.downloadKey,d=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,v=this._messageModule.getModule(Un),m=v&&v.isOnlineMessage(e,t)?1:0;return{protocolName:ho,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:p,title:_,abstractList:h,compatibleText:f,messageNumber:d}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||\"\",desc:o.description||\"\",ext:o.extension||\"\",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||\"\"}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||v.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}}]),e}(),gi={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},_i=[da.MESSAGE_ONPROGRESS_FUNCTION_ERROR,da.MESSAGE_IMAGE_SELECT_FILE_FIRST,da.MESSAGE_IMAGE_TYPES_LIMIT,da.MESSAGE_FILE_IS_EMPTY,da.MESSAGE_IMAGE_SIZE_LIMIT,da.MESSAGE_FILE_SELECT_FILE_FIRST,da.MESSAGE_FILE_SIZE_LIMIT,da.MESSAGE_VIDEO_SIZE_LIMIT,da.MESSAGE_VIDEO_TYPES_LIMIT,da.MESSAGE_AUDIO_UPLOAD_FAIL,da.MESSAGE_AUDIO_SIZE_LIMIT,da.COS_UNDETECTED];function hi(e){var t=!1;return Object.values(gi).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var fi=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n=\"MessageModule\",t._messageOptionsMap=new Map,t._mergerMessageHandler=new di(_(t)),t}return a(s,[{key:\"createTextMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=\"string\"==typeof e.payload?e.payload:e.payload.text,s=new La({text:o}),a=this._getNickAndAvatarByUserID(t);return n.setElement(s),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:\"createImageMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e);if(se){var o=e.payload.file;if(Ze(o))return void this.outputWarning(\"FileUnsupportedInMP\",\"createImageMessage\");var s=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,a={url:s,name:s.slice(s.lastIndexOf(\"/\")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:s.slice(s.lastIndexOf(\".\")+1).toLowerCase()};e.payload.file=a}else if(ae)if(Ze(e.payload.file)){var r=e.payload.file;e.payload.file={files:[r]}}else if(ot(e.payload.file)&&\"undefined\"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var u=new Aa({imageFormat:Ve.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),c=this._getNickAndAvatarByUserID(t);return n.setElement(u),n.setNickAndAvatar(c),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:\"createAudioMessage\",value:function(e){var t=e.payload.file;if(se){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(\"/\")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(\".\")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var s=new Ha(e),a=new Na({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID(e.payload.file)}),r=this._getNickAndAvatarByUserID(o);return s.setElement(a),s.setNickAndAvatar(r),s.setNameCard(this._getNameCardByGroupID(s)),this._messageOptionsMap.set(s.clientSequence,e),s}},{key:\"createVideoMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl=\"\",e.payload.file.thumbSize=0;var n={};if(se){if(ee)return void this.outputWarning(\"VideoUnsupportedInAlipay\");if(Ze(e.payload.file))return void this.outputWarning(\"FileUnsupportedInMP\",\"createVideoMessage\");var o=e.payload.file;st(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(\"/\")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(\".\")+1).toLowerCase()}else if(ae){if(Ze(e.payload.file)){var s=e.payload.file;e.payload.file.files=[s]}else if(ot(e.payload.file)&&\"undefined\"!=typeof uni){var a=e.payload.file.tempFile;e.payload.file.files=[a]}var r=e.payload.file;n.url=window.URL.createObjectURL(r.files[0]),n.name=r.files[0].name,n.size=r.files[0].size||1,n.second=r.files[0].duration||0,n.type=r.files[0].type.split(\"/\")[1]}e.payload.file.videoFile=n;var i=new Ha(e),u=new Fa({videoFormat:n.type,videoSecond:bt(n.second,0),videoSize:n.size,remoteVideoUrl:\"\",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(\".\")+1).toLowerCase()}),c=this._getNickAndAvatarByUserID(t);return i.setElement(u),i.setNickAndAvatar(c),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:\"createCustomMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new wa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:\"createFaceMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new Ra(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:\"createMergerMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new Ha(e),s=new Va(e.payload);return o.setElement(s),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:\"createForwardMessage\",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,s=e.payload,a=e.needReadReceipt,r=e.receiverList,i=this.getMyUserID(),u=this._getNickAndAvatarByUserID(i);if(s.type===S.MSG_GRP_TIP)return Ja({code:da.MESSAGE_FORWARD_TYPE_INVALID});var c={to:t,conversationType:n,conversationID:\"\".concat(n).concat(t),priority:o,isPlaceMessage:0,status:Qt.UNSEND,currentUser:i,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||s.cloudCustomData||\"\",needReadReceipt:a,receiverList:r,isSupportExtension:e.isSupportExtension||!1},l=new Ha(c);return l.setElement(s.getElements()[0]),l.setNickAndAvatar(u),l.setNameCard(this._getNameCardByGroupID(s)),l.setRelayFlag(!0),l}},{key:\"downloadMergerMessage\",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:\"createFileMessage\",value:function(e){if(se){if(!X&&!Q&&!ne)return;var n=re.getSystemInfoSync().SDKVersion;if(X&&Ot(n,\"2.5.0\")<0)return void this.outputWarning(\"WXChooseMessageFile\");if(Q&&Ot(n,\"1.18.0\")<0)return void this.outputWarning(\"QQChooseMessageFile\")}if(ae||ne){if(Ze(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(ot(e.payload.file)&&\"undefined\"!=typeof uni){var s=e.payload.file,a=s.tempFiles,r=s.files,i=null;st(a)?i=a[0]:st(r)&&(i=r[0]),e.payload.file={files:[i]}}}else if(X||Q){var u=e.payload.file.tempFiles,c=t(t({},u[0]),{},{url:u[0].path});e.payload.file={files:[c]}}var l=this.getMyUserID();e.currentUser=l,e.senderTinyID=this.getMyTinyID();var p=new Ha(e),d=new ba({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),g=this._getNickAndAvatarByUserID(l);return p.setElement(d),p.setNickAndAvatar(g),p.setNameCard(this._getNameCardByGroupID(p)),this._messageOptionsMap.set(p.clientSequence,e),p}},{key:\"createLocationMessage\",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new Ha(e),o=new qa(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:\"_onCannotFindModule\",value:function(){return Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"sendMessageInstance\",value:function(e,t){var n=this;if(!1===this.getModule(no).filterMessage(e,t))return this._onSendMessageFailed(e,new Wa({code:da.PROFANITY_FOUND}));var o,s=null;switch(e.conversationType){case S.CONV_C2C:if(!(s=this.getModule(Gn)))return this._onCannotFindModule();break;case S.CONV_GROUP:if(!(s=this.getModule(Un)))return this._onCannotFindModule();if(Tt({groupID:e.to})){var a=s.getLocalGroupProfile(e.to);if(a&&a.isSupportTopic)return Ja({code:da.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return Ja({code:da.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var r=this.getModule(Kn),i=this.getModule(Un);return r.upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===ma&&n.getModule($n).addSuccessCount(Ma);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return Ja({code:da.MESSAGE_FILE_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var a=function(e){var t=\"utf-8\";ae&&document&&(t=document.charset.toLowerCase());var n,o,s=0;if(o=e.length,\"utf-8\"===t||\"utf8\"===t)for(var a=0;a11264?n._mergerMessageHandler.uploadMergerMessage(e,a).then((function(o){var s=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(s)})):(n.getModule(Fn).setMessageRandom(e),e.conversationType===S.CONV_C2C||e.conversationType===S.CONV_GROUP?s.sendMessage(e,t):void 0)})).then((function(a){var r=a.data,i=r.time,u=r.sequence,c=r.readReceiptCode;$e(c)&&0!==c&&(new ka(\"sendMessageWithReceipt\").setMessage(\"from:\".concat(e.from,\" to:\").concat(e.to,\" sequence:\").concat(u,\" readReceiptCode:\").concat(c)).end(),xe.w(\"\".concat(n._n,\".sendMessageInstance readReceiptCode:\").concat(c,\" message:\").concat(n.getErrorMessage(c))));n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence);var l=n.getModule(Fn);e.status=Qt.SUCCESS,e.time=i;var p=!1;if(e.conversationType===S.CONV_GROUP)e.sequence=u;else if(e.conversationType===S.CONV_C2C){var d=l.getLatestMessageSentByMe(e.conversationID);if(d){var g=d.nick,_=d.avatar;g===e.nick&&_===e.avatar||(p=!0)}}if(p&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),s.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;ot(t)&&ot(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=\"\"),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Dt(e.to))f=S.CONV_TOPIC,n.getModule(wn).onMessageSent({groupID:qt(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||\"TIMImageElem\"!==e.type||Ut(e.payload.imageInfoArray),Ka({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t)}))}},{key:\"_onSendMessageFailed\",value:function(e,t){e.status=Qt.FAIL,this.getModule(Fn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new ka(\"sendMessage\");return n.setMessage(\"tjg_id:\".concat(this.generateTjgID(e),\" type:\").concat(e.type,\" from:\").concat(e.from,\" to:\").concat(e.to)),this.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),xe.e(\"\".concat(this._n,\"._onSendMessageFailed error:\"),t),Ja(new Wa({code:t&&t.code?t.code:da.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:\"_getSendMessageSpecifiedKey\",value:function(e){if([S.MSG_IMAGE,S.MSG_AUDIO,S.MSG_VIDEO,S.MSG_FILE].includes(e.type))return ma;if(e.conversationType===S.CONV_C2C)return ha;if(e.conversationType===S.CONV_GROUP){var t=this.getModule(Un).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Ct(n)?va:fa}}},{key:\"_addSendMessageTotalCount\",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule($n).addTotalCount(t)}},{key:\"_addSendMessageSuccessCount\",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var s=this.getModule($n);s.addSuccessCount(o),s.addCost(o,n)}}},{key:\"_addSendMessageFailCountOnUser\",value:function(e,t){var n,o,s=t.code,a=void 0===s?-1:s,r=this.getModule($n),i=this._getSendMessageSpecifiedKey(e);i===ma&&(n=a,o=!1,_i.includes(n)&&(o=!0),o)?r.addFailedCountOfUserSide(Ma):hi(a)&&i&&r.addFailedCountOfUserSide(i)}},{key:\"resendMessage\",value:function(e){return e.isResend=!0,e.status=Qt.UNSEND,this.sendMessageInstance(e)}},{key:\"revokeMessage\",value:function(e){var t=this,n=null;if(e.conversationType===S.CONV_C2C?n=this.getModule(Gn):e.conversationType===S.CONV_GROUP&&(n=this.getModule(Un)),!n)return this._onCannotFindModule();var o=new ka(\"revokeMessage\");o.setMessage(\"tjg_id:\".concat(this.generateTjgID(e),\" type:\").concat(e.type,\" from:\").concat(e.from,\" to:\").concat(e.to));var s=\"\".concat(this._n,\".\").concat(\"revokeMessage\");return n.revokeMessage(e).then((function(n){var a=n.data.recallRetList;if(!jt(a)&&0!==a[0].retCode){var r=new Wa({code:a[0].retCode,data:{message:e}});return o.setCode(r.code).setMoreMessage(r.message).end(),Ja(r)}return xe.i(\"\".concat(s,\" ok. ID:\").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(Fn).onMessageRevoked([e]),Ka({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];o.setError(n,s,a).end()}));var a=new Wa({code:n&&n.code?n.code:da.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}});return xe.w(\"\".concat(s,\" failed. error:\"),n),Ja(a)}))}},{key:\"deleteMessage\",value:function(e){var t=this,n=null,o=e[0],s=o.conversationID,a=\"\",r=[],i=[];if(o.conversationType===S.CONV_C2C)n=this.getModule(Gn),a=s.replace(S.CONV_C2C,\"\"),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||r.push(\"\".concat(e.sequence,\"_\").concat(e.random,\"_\").concat(e.time)),i.push(e))}));else if(o.conversationType===S.CONV_GROUP)n=this.getModule(Un),a=s.replace(S.CONV_GROUP,\"\"),e.forEach((function(e){e&&e.status===Qt.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||r.push(\"\".concat(e.sequence)),i.push(e))}));else if(o.conversationType===S.CONV_SYSTEM)return Ja({code:da.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===r.length)return this._onMessageDeleted(i);r.length>30&&(r=r.slice(0,30),i=i.slice(0,30));var u=new ka(\"deleteMessage\");u.setMessage(\"to:\".concat(a,\" count:\").concat(r.length));var c=\"\".concat(this._n,\".\").concat(\"deleteMessage\");return n.deleteMessage({to:a,keyList:r}).then((function(e){return u.end(),xe.i(\"\".concat(c,\" ok\")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.w(\"\".concat(c,\" failed. error:\"),e);var n=new Wa({code:e&&e.code?e.code:da.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return Ja(n)}))}},{key:\"_onMessageDeleted\",value:function(e){return this.getModule(Fn).onMessageDeleted(e),za({messageList:e})}},{key:\"translateText\",value:function(e){var n=\"\".concat(this._n,\".\").concat(\"translateText\"),o=e.sourceTextList,s=e.sourceLanguage,a=e.targetLanguage,r=new ka(\"translateText\");return r.setMessage(\"sourceLanguage:\".concat(s,\" targetLanguage:\").concat(a)),this.request({protocolName:pa,requestData:{sourceTextList:o,source:s||\"auto\",target:a,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var o=e.data,s=o.error,a=o.requestID,i=o.translatedTextList;if(0===s.code)return r.end(),xe.i(\"\".concat(n,\" ok. requestID:\").concat(a)),Ka({translatedTextList:i});throw t(t({},s),{},{requestID:a})})).catch((function(e){return r.setCode(e.code).setMoreMessage(e.requestID).end(),xe.w(\"\".concat(n,\" failed. error:\"),e),Ja({code:da.TRANSLATE_TEXT_FAIL})}))}},{key:\"modifyRemoteMessage\",value:function(e){var t=this,n=null,o=e.conversationType,s=e.to;if(this.getModule(Un).isMessageFromOrToAVChatroom(s))return Ja({code:da.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(no).filterMessage(e))return Ja({code:da.PROFANITY_FOUND,data:{message:e}});o===S.CONV_C2C?n=this.getModule(Gn):o===S.CONV_GROUP&&(n=this.getModule(Un));var a=new ka(\"modifyMessage\");a.setMessage(\"to:\".concat(s));var r=\"\".concat(this._n,\".modifyRemoteMessage\");return n.modifyRemoteMessage(e).then((function(n){a.end(),xe.i(\"\".concat(r,\" ok\"));var o=t._onModifyRemoteMessageResp(e,n.data);return Ka({message:o})})).catch((function(n){if(a.setCode(n.code).setMoreMessage(n.message).end(),xe.w(\"\".concat(r,\" failed. error:\"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return Ja({code:da.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return Ja({code:n.code,message:n.message,data:{message:e}})}))}},{key:\"_onModifyRemoteMessageResp\",value:function(e,t){xe.d(\"\".concat(this._n,\"._onModifyRemoteMessageResp options:\"),t);var n=e.conversationType,o=e.from,s=e.to,a=e.random,r=e.sequence,i=e.time,u=t.elements,c=t.messageVersion,l=t.cloudCustomData,p=void 0===l?\"\":l;return this.getModule(Fn).onMessageModified({conversationType:n,from:o,to:s,time:i,random:a,sequence:r,elements:u,cloudCustomData:p,messageVersion:c})}},{key:\"_generateUUID\",value:function(e){var t=this.getModule(qn),n=\"\".concat(t.getSDKAppID(),\"-\").concat(t.getUserID(),\"-\").concat(function(){for(var e=\"\",t=32;t>0;--t)e+=ht[Math.floor(Math.random()*ft)];return e}()),o=e.name||e.value||e.url||e.tempFilePath,s=o&&o.slice(o.lastIndexOf(\".\")+1);return s&&(n=\"\".concat(n,\".\").concat(s)),n}},{key:\"getMessageOption\",value:function(e){return this._messageOptionsMap.get(e)}},{key:\"_getNickAndAvatarByUserID\",value:function(e){return this.getModule(On).getNickAndAvatarByUserID(e)}},{key:\"_getNameCardByGroupID\",value:function(e){if(e.conversationType===S.CONV_GROUP){var t=this.getModule(Un);if(t)return t.getMyNameCardByGroupID(e.to)}return\"\"}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._messageOptionsMap.clear()}}]),s}(ro),vi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"MessageExtensionModule\",s.messageExtensionMap=new Map,s.globalSeqMap=new Map,s.getMessageExtensionsMap=new Map,s}return a(n,[{key:\"onMessageExtensionNotify\",value:function(e){var t=this,n=e.dataList,o=n.messageInfo,s=n.operateType,a=n.operateResultList,r=n.tinyID,i=n.globalSequence,u=o.clientTime,c=o.random,l=\"\".concat(r,\"-\").concat(u,\"-\").concat(c),p=[],d=[];xe.l(\"\".concat(this._n,\".onMessageExtensionNotify messageID:\").concat(l,\" operateType:\").concat(s,\" globalSequence:\").concat(i)),this._updateGlobalSequence(l,i);var g=!1,_=!1;a.forEach((function(e){var n=e.extensions,o=void 0===n?[]:n,a=e.clearSequence;if(1===s)g=!0,o.forEach((function(e){p.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,o);else if(2===s)_=!0,o.forEach((function(e){d.push(e.key)})),t._updateLocalExtension(l,o);else if(3===s){if(_=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=a&&!jt(e.value)&&d.push(t)}));t._clearLocalExtension(l,a)}})),g&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:p}),_&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:d})}},{key:\"setMessageExtensions\",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._n,\".\").concat(\"setMessageExtensions\"),s=e.ID,a=e.conversationID,r=e.sequence,i=e.time,u=m(t);t.length>20&&(u=t.slice(0,20),xe.w(\"\".concat(o,\". the length of extensions cannot exceed 20.\")));var c=\"conversationID:\".concat(a,\" messageID:\").concat(s,\" sequence:\").concat(r,\" time:\").concat(i,\" count:\").concat(u.length),l=new ka(\"setMessageExtensions\");return l.setMessage(c),xe.l(\"\".concat(o,\" \").concat(c)),this._modifyMessageExtensions(e,u).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,a=\"success count:\".concat(n,\" fail count:\").concat(s);return l.setMoreMessage(a).end(),xe.l(\"\".concat(o,\" ok. \").concat(a)),Ka({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"getMessageExtensions\",value:function(e){var t=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var n=\"\".concat(this._n,\".\").concat(\"getMessageExtensions\"),o=e.ID,s=e.conversationID,a=e.sequence,r=e.time,i=\"conversationID:\".concat(s,\" messageID:\").concat(o,\" sequence:\").concat(a,\" time:\").concat(r),u=new ka(\"getMessageExtensions\");u.setMessage(i),xe.l(\"\".concat(n,\" \").concat(i));var c=void 0;return this.getMessageExtensionsMap.has(o)&&(c=this._getGlobalSequence(o)),this._getMessageExtensions(e,c).then((function(e){return u.end(),xe.l(\"\".concat(n,\" ok. total count:\").concat(e.length)),at(c)&&e.length>0&&t.getMessageExtensionsMap.set(o,1),Ka({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"deleteMessageExtensions\",value:function(e,t){var n=this;if(!this.canIUse(B.MSG_EXT))return Ja({code:da.CANNOT_USE_COMMERCIAL_ABILITY});var o=\"\".concat(this._n,\".\").concat(\"deleteMessageExtensions\"),s=[],a=3;jt(t)||(a=2,t.forEach((function(e){s.push({key:e,value:\"\",seq:0})})));var r=e.ID,i=e.conversationID,u=e.sequence,c=e.time,l=\"conversationID:\".concat(i,\" messageID:\").concat(r,\" sequence:\").concat(u,\" time:\").concat(c,\" operateType:\").concat(a),p=new ka(\"deleteMessageExtensions\");return p.setMessage(l),xe.l(\"\".concat(o,\" \").concat(l)),this._modifyMessageExtensions(e,s,a).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,r=\"\";return 2===a&&(r=\"success count:\".concat(n,\" fail count:\").concat(s)),p.setMoreMessage(\"\".concat(r)).end(),xe.l(\"\".concat(o,\" ok. \").concat(r)),Ka({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),xe.e(\"\".concat(o,\" failed. error:\"),e),Ja(e)}))}},{key:\"_modifyMessageExtensions\",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=Dt(e.to)?S.CONV_TOPIC:e.conversationType,a=void 0;3!==o&&(a=this._getRequestExtensions(e,t));var r=null;switch(s){case S.CONV_C2C:r=this.getModule(Gn);break;case S.CONV_GROUP:r=this.getModule(Un);break;case S.CONV_TOPIC:r=this.getModule(wn);break;default:return Ja({code:da.CANNOT_FIND_MODULE})}return r.modifyMessageExtensions(e,a,o).then((function(t){var o=t.data,s=o.extensions,a=o.seq,r=[],i=0,u=0,c=[];return(s=jt(s)?[]:s).forEach((function(e){var t=e.errorCode,n=e.extension,o=n.key,s=n.value,a=n.seq;r.push({code:t,key:o,value:s}),0===t?i++:u++,c.push({key:o,value:s,seq:a})})),n._updateGlobalSequence(e.ID,a),c.length>0&&(n._updateLocalExtension(e.ID,c),c=null),{resultList:r,successCount:i,failureCount:u}})).catch((function(e){return Ja(e)}))}},{key:\"_getRequestExtensions\",value:function(e,t){var n=[];if(this._hasLocalExtension(e.ID)){var o=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,s=e.value,a=0;o.has(t)&&(a=o.get(t).seq),n.push({key:t,value:s,seq:a})})),n}return t.forEach((function(e){var t=e.key,o=e.value;n.push({key:t,value:o,seq:0})})),n}},{key:\"_getMessageExtensions\",value:function(e,t){var n=this,o=\"\".concat(this._n,\"._getMessageExtensions\"),s=e.ID,a=e.to,r=null;switch(Dt(a)?S.CONV_TOPIC:e.conversationType){case S.CONV_C2C:r=this.getModule(Gn);break;case S.CONV_GROUP:r=this.getModule(Un);break;case S.CONV_TOPIC:r=this.getModule(wn);break;default:return Ja({code:da.CANNOT_FIND_MODULE})}return r.getMessageExtensions(e,t).then((function(t){var a=t.data,r=a.extensions,i=a.completeFlag,u=a.globalSequence,c=a.clearSequence;if(r=jt(r)?[]:r,xe.l(\"\".concat(o,\" ok. completeFlag:\").concat(i,\" globalSequence:\").concat(u,\" clearSequence:\").concat(c,\" count:\").concat(r.length)),n._updateLocalExtension(s,r),n._clearLocalExtension(s,c),n._updateGlobalSequence(s,u),1!==i){var l=r.slice(-1)[0].seq+1;return n._getMessageExtensions(e,l)}return n._getLocalExtensions(s)})).catch((function(e){return Ja(e)}))}},{key:\"_hasLocalExtension\",value:function(e){return this.messageExtensionMap.has(e)}},{key:\"_getLocalExtension\",value:function(e){return this.messageExtensionMap.get(e)}},{key:\"_updateLocalExtension\",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var n=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,o=e.value,s=void 0===o?\"\":o,a=e.seq;n.set(t,{value:s,seq:a})}))}},{key:\"_clearLocalExtension\",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var n=this._getLocalExtension(e);n.forEach((function(e,o){e.seq<=t&&n.delete(o)}))}}},{key:\"_getLocalExtensions\",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,n){var o=e.value;jt(o)||t.push({key:n,value:o})}));return t}},{key:\"_getGlobalSequence\",value:function(e){return this.globalSeqMap.get(e)}},{key:\"_updateGlobalSequence\",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),n}(ro),mi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"ComboMessageModule\",s}return a(n,[{key:\"sendMessage\",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return Ja({code:da.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.getModule(Fn).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var s=e.data,a=s.time,r=s.sequence,i=s.readReceiptCode;$e(i)&&0!==i&&(new ka(\"sendMessageWithReceipt\").setMessage(\"from:\".concat(n.from,\" to:\").concat(n.to,\" sequence:\").concat(r,\" readReceiptCode:\").concat(i)).end(),xe.w(\"\".concat(t._n,\".sendMessage readReceiptCode:\").concat(i,\" message:\").concat(t.getErrorMessage(i))));t._addSendMessageSuccessCount(n,o);var u=t.getModule(Fn);n.status=Qt.SUCCESS,n.time=a,n.conversationType===S.CONV_GROUP&&(n.sequence=r),u.appendToMessageList(n);var c=n;return!0===n._isExcludedFromLastMessage&&(c=\"\"),u.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:c}]}),Ka({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:\"_sendComboMessage\",value:function(e,t){var n=this._m.getModule(jn),o=\"\";return e.conversationType===S.CONV_C2C&&(o=\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SEND_MESSAGE)),e.conversationType===S.CONV_GROUP&&(o=\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SEND_GROUP_MESSAGE)),n.sendComboMessage({servcmd:o,data:t})}},{key:\"_constructMessageInstance\",value:function(e){var t=\"\".concat(this._n,\"._constructMessageInstance\"),n=null;try{var o=this.getMyUserID(),s={};if(s.senderTinyID=this.getMyTinyID(),s.currentUser=o,s.from=e.From_Account||o,e.GroupId?(s.conversationID=\"\".concat(S.CONV_GROUP).concat(e.GroupId),s.conversationType=S.CONV_GROUP,s.to=e.GroupId):e.To_Account&&(s.conversationID=\"\".concat(S.CONV_C2C).concat(e.To_Account),s.conversationType=S.CONV_C2C,s.to=e.To_Account),s.time=e.MsgTimeStamp||0,s.random=e.Random||e.MsgRandom||0,s.priority=e.MsgPriority,et(e.CloudCustomData)&&e.CloudCustomData.length>0&&(s.cloudCustomData=e.CloudCustomData),st(e.SendMsgControl)&&(s.messageControlInfo={},e.SendMsgControl.includes(\"NoUnread\")&&(s.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes(\"NoLastMsg\")&&(s.messageControlInfo.excludedFromLastMessage=1)),s.conversationType===S.CONV_GROUP&&st(e.To_Account)&&e.To_Account.length>0){var a=e.To_Account;e.To_Account.length>50&&(a=e.To_Account.slice(0,50),xe.w(\"\".concat(t,\" To_Account must be less than or equal to 50.\"))),s.receiverList=m(a),e.To_Account=m(a)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(s.needReadReceipt=!0),1===e.SupportMessageExtension&&(s.isSupportExtension=!0),(n=new Ha(s)).status=Qt.UNSEND,e.MsgClientTime=n.clientTime,n.conversationType===S.CONV_C2C&&(e.MsgSeq=n.sequence);for(var r,i=e.MsgBody.length,u=0;u100)return n--,t;if(st(t)){var s=t.map((function(t){return nt(t)?e(t,o):t}));return n--,s}if(nt(t)){var a=(r=t,i=function(e,t){if(!lt(t))return!1;if((s=t)!==Ci(s))for(var n=0;n65535)return Si(240|t>>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Si(192|t>>>6,128|63&t):Si(224|t>>>12,128|t>>>6&63,128|63&t)},Li=function(e){for(var t=void 0===e?\"\":(\"\"+e).replace(/[\\x80-\\uD7ff\\uDC00-\\uFFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]?/g,ki),n=0|t.length,o=new Uint8Array(n),s=0;s0)for(var u=0;u=a&&(xe.l(\"\".concat(e._n,\"._checkPromiseMap request timeout, delete requestID:\").concat(n)),e._promiseMap.delete(n),o(new Wa({code:da.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:\"onOpen\",value:function(e){if(\"\"!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=Date.now()-this._startTs;xe.l(\"\".concat(this._n,\"._onOpen cost \").concat(n,\" ms. socketID:\").concat(t)),new ka(\"wsOnOpen\").setMessage(n).setCostTime(n).setMoreMessage(\"socketID:\".concat(t)).end(),e.id===this._socketID&&(this._readyState=Pi,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:\"onClose\",value:function(e){var t=new ka(\"wsOnClose\"),n=e.id,o=e.e,s=\"sourceSocketID:\".concat(n,\" currentSocketID:\").concat(this._socketID,\" code:\").concat(o.code,\" reason:\").concat(o.reason),a=0;0!==this._onOpenTs&&(a=Date.now()-this._onOpenTs),t.setMessage(a).setCostTime(a).setMoreMessage(s).setCode(o.code).end(),xe.l(\"\".concat(this._n,\"._onClose \").concat(s,\" onlineTime:\").concat(a)),n===this._socketID&&(this._readyState=wi,a<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:\"onError\",value:function(e){var t=e.id,n=e.e,o=\"sourceSocketID:\".concat(t,\" currentSocketID:\").concat(this._socketID);new ka(\"wsOnError\").setMessage(n.errMsg||dt(n)).setMoreMessage(o).setLevel(\"error\").end(),xe.w(\"\".concat(this._n,\"._onError\"),n,o),t===this._socketID&&(this._readyState=\"\",this._channelModule.onError())}},{key:\"onMessage\",value:function(e){var t;try{t=JSON.parse(e.data)}catch(c){new ka(\"jsonParseError\").setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=t.body;if(!this._isTRTCCommand(n)){var s=Pt(t.head);o=Ei(t.body,this._getResponseKeyMap(s))}if(xe.d(\"\".concat(this._n,\".onMessage ret:\").concat(JSON.stringify(o),\" requestID:\").concat(n,\" has:\").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var a=this._promiseMap.get(n),r=a.resolve,i=a.reject,u=a.timestamp;return this._promiseMap.delete(n),this._calcRTT(u),void(o.errorCode&&0!==o.errorCode?(this._channelModule.onErrorCodeNotZero(o),i(new Wa({code:o.errorCode,message:o.errorInfo||\"\",data:n.includes(Lo)||n.includes(ms)?{elements:o.elements,messageVersion:o.messageVersion,cloudCustomData:o.cloudCustomData}:void 0}))):r(Ka(o)))}this._channelModule.onMessage({head:t.head,body:o})}}},{key:\"_isTRTCCommand\",value:function(e){for(var t=this._channelModule.getModule(oo).getCommandList(),n=!1,o=0;o0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,s=t.resolve,a=t.reject;e._promiseMap.set(n,{resolve:s,reject:a,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=D(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=v(t.value,2),s=o[0],a=o[1];this._execute(s,a)}}catch(r){n.e(r)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:\"send\",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var n=g(e,Gi),o=this._getRequestIDFromHead(e.head),s=JSON.stringify(n);return new Promise((function(e,a){(t._promiseMap.set(o,{resolve:e,reject:a,timestamp:Date.now(),uplinkData:s}),xe.d(\"\".concat(t._n,\".send uplinkData:\").concat(JSON.stringify(n),\" requestID:\").concat(o,\" readyState:\").concat(t._readyState)),t._readyState!==Pi)?t._reConnect():(t._execute(o,s),t._channelModule.getModule($n).addRequestCount())}))}},{key:\"simplySend\",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=g(e,Ui),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==Pi?(this._simpleRequestMap.size0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:\"onErrorCodeNotZero\",value:function(e){this.getModule(jn).onErrorCodeNotZero(e)}},{key:\"onMessage\",value:function(e){this.getModule(jn).onMessage(e)}},{key:\"send\",value:function(e){return this._socketHandler?this._previousState!==S.NET_STATE_CONNECTED&&e.head.servcmd.includes(xs)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:\"_sendLogViaHTTP\",value:function(e){var t=V.HOST.CURRENT.STAT;return new Promise((function(n,o){var s=\"\".concat(t,\"/v4/imopenstat/tim_web_report_v2?sdkappid=\").concat(e.head.sdkappid,\"&reqtime=\").concat(Date.now()),a=JSON.stringify(e.body),r=\"application/x-www-form-urlencoded;charset=UTF-8\";if(se)re.request({url:s,data:a,method:\"POST\",timeout:3e3,header:{\"content-type\":r},success:function(){n()},fail:function(){o(new Wa({code:da.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,u=setTimeout((function(){i.abort(),o(new Wa({code:da.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(u),200===i.status||304===i.status?n():o(new Wa({code:da.NETWORK_ERROR})))},i.open(\"POST\",s,!0),i.setRequestHeader(\"Content-type\",r),i.send(a)}}))}},{key:\"simplySend\",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:\"onOpen\",value:function(){this._ping()}},{key:\"onClose\",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED));this.reConnect()}},{key:\"onError\",value:function(){se&&!ne&&this.outputWarning(\"DomainNameInMP\"),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:\"getKeyMap\",value:function(e){return this.getModule(jn).getKeyMap(e)}},{key:\"_onAppHide\",value:function(){this._isAppShowing=!1}},{key:\"_onAppShow\",value:function(){this._isAppShowing=!0}},{key:\"onRequestTimeout\",value:function(e){}},{key:\"onReconnected\",value:function(){xe.l(\"\".concat(this._n,\".onReconnected\")),this._m.restartTimer(),this.getModule(jn).onReconnected(),this._emitNetStateChangeEvent(S.NET_STATE_CONNECTED)}},{key:\"onReconnectFailed\",value:function(){xe.l(\"\".concat(this._n,\".onReconnectFailed\")),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:\"setIsWorkerEnabled\",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:\"offline\",value:function(){this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:\"reConnect\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n=\"forcedFlag:\".concat(e,\" fatalErrorFlag:\").concat(this._fatalErrorFlag,\" previousState:\").concat(this._previousState,\" reconnectFlag:\").concat(t);if(xe.l(\"\".concat(this._n,\".reConnect \").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===S.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(S.NET_STATE_CONNECTING)}}},{key:\"_emitNetStateChangeEvent\",value:function(e){this._previousState!==e&&(xe.l(\"\".concat(this._n,\"._emitNetStateChangeEvent from \").concat(this._previousState,\" to \").concat(e)),this._previousState=e,this.emitOuterEvent(E.NET_STATE_CHANGE,{state:e}))}},{key:\"_ping\",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(jn).getProtocolData({protocolName:Vs});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(xe.w(\"\".concat(e._n,\"._ping failed. error:\"),t),e._probing=!1,t&&60002===t.code)return new ka(\"error\").setMessage(\"code:\".concat(t.code,\" message:\").concat(t.message)).setNetworkType(e.getModule(Bn).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];xe.l(\"\".concat(e._n,\"._ping failed. probe network, isAppShowing:\").concat(e._isAppShowing,\" online:\").concat(o,\" networkType:\").concat(s)),o?e.reConnect():e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}))}))}}},{key:\"_checkNextPing\",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:\"dealloc\",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:\"onRestApiKickedOut\",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._previousState=S.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(ro),xi=[\"a2\",\"tinyid\"],Vi=[\"a2\",\"tinyid\"],Bi=function(){function e(t){o(this,e),this._n=\"ProtocolHandler\",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return a(e,[{key:\"_fillConfigMap\",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead(),s=this._sessionModule.isIntl();this._configMap.set(io,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.LOGIN)}),body:{state:\"Online\",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:\"InstType\"},response:{InstId:\"instanceID\",HelloInterval:\"helloInterval\"}}}}(e)),this._configMap.set(uo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:\"wslogout_type\"}}}}(e)),this._configMap.set(co,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:\"newInstanceInfo\"}}}}(e)),this._configMap.set(lo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.STAT_SERVICE,\".\").concat(V.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(ws,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_COS_SIGN,\".\").concat(V.CMD.COS_SIGN)}),body:{cmd:\"open_im_cos_svc\",subCmd:\"get_cos_token\",duration:300,version:2},keyMap:{request:{userSig:\"usersig\",subCmd:\"sub_cmd\",cmd:\"cmd\",duration:\"duration\",version:\"version\"},response:{expired_time:\"expiredTime\",bucket_name:\"bucketName\",session_token:\"sessionToken\",tmp_secret_id:\"secretId\",tmp_secret_key:\"secretKey\"}}}}(n)),this._configMap.set(Fs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.CUSTOM_UPLOAD,\".\").concat(V.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:\"usersig\",fileType:\"file_type\",fileName:\"file_name\",uploadMethod:\"upload_method\"},response:{expired_time:\"expiredTime\",request_id:\"requestId\",head_url:\"headUrl\",upload_url:\"uploadUrl\",download_url:\"downloadUrl\",ci_url:\"ciUrl\",snapshot_url:\"requestSnapshotUrl\"}}}}(n)),this._configMap.set(qs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.CUSTOM_UPLOAD,\".\").concat(V.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:\"version\",platform:\"platform\",coverName:\"cover_name\",requestSnapshotUrl:\"snapshot_url\"},response:{error_code:\"errorCode\",error_msg:\"errorInfo\",download_url:\"snapshotUrl\"}}}}(n)),this._configMap.set(Xs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_CONFIG_MANAGER,\".\").concat(V.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:\"uint32_sdkappid\"},response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_purchase_bits:\"purchaseBits\",uint32_expired_time:\"expiredTime\"}}}}(e)),this._configMap.set(Qs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_CONFIG_MANAGER,\".\").concat(V.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_purchase_bits:\"purchaseBits\",uint32_expired_time:\"expiredTime\"}}}}(e)),this._configMap.set(zs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_CONFIG_MANAGER,\".\").concat(V.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:\"uint32_sdkappid\",version:\"uint64_version\"},response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_json_config:\"cloudControlConfig\",uint32_expired_time:\"expiredTime\",uint32_sdkappid:\"SDKAppID\",uint64_version:\"version\"}}}}(e)),this._configMap.set(Js,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_CONFIG_MANAGER,\".\").concat(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:\"errorCode\",str_error_message:\"errorMessage\",str_json_config:\"cloudControlConfig\",uint32_expired_time:\"expiredTime\",uint32_sdkappid:\"SDKAppID\",uint64_version:\"version\"}}}}(e)),this._configMap.set(Zs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OVERLOAD_PUSH,\".\").concat(V.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:\"overloadCommand\",DelaySecs:\"waitingTime\"}}}}(e)),this._configMap.set(po,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.GET_MESSAGES)}),body:{cookie:\"\",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",from:\"From_Account\",to:\"To_Account\",time:\"MsgTimeStamp\",sequence:\"MsgSeq\",random:\"MsgRandom\",elements:\"MsgBody\"},response:{MsgList:\"messageList\",SyncFlag:\"syncFlag\",To_Account:\"to\",From_Account:\"from\",ClientSeq:\"clientSequence\",MsgSeq:\"sequence\",NoticeSeq:\"noticeSequence\",NotifySeq:\"notifySequence\",MsgRandom:\"random\",MsgTimeStamp:\"time\",MsgContent:\"content\",ToGroupId:\"to\",MsgKey:\"messageKey\",GroupTips:\"groupTips\",MsgBody:\"elements\",MsgType:\"type\",C2CRemainingUnreadCount:\"C2CRemainingUnreadList\",C2CPairUnreadCount:\"C2CPairUnreadList\"}}}}(e)),s||(this._configMap.set(go,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(la,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_MSG_AUDIT_MGR,\".\").concat(V.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:\"\",startIndex:void 0},keyMap:{request:{version:\"uint64_version\",deviceID:\"str_device_id\",startIndex:\"uint64_start_index\"},response:{msg_cmd_error_code:\"errorInfo\",str_err_msg:\"errorMessage\",uint32_code:\"errorCode\",msg_scene_ctl_config:\"filterConfig\",uint64_c2c_custom_msg_flag:\"c2c_custom_message\",uint64_c2c_text_msg_flag:\"c2c_text_message\",uint64_group_custom_msg_flag:\"group_custom_message\",uint64_group_text_msg_flag:\"group_text_message\",uint64_group_info_flag:\"group_profile\",uint64_group_member_info_flag:\"group_member_profile\",uint64_relation_chain_flag:\"sns\",uint64_user_info_flag:\"user_profile\",rpt_msg_dirty_word:\"lexicon\",str_dirty_word:\"profanity\",str_replaced_content:\"replacement\",uint64_filter_type:\"filterType\",uint64_id:\"id\",uint64_word_type:\"profanityType\",uint64_complete_flag:\"completeFlag\",uint64_next_start_index:\"nextStartIndex\",uint64_version:\"version\",uint64_expired_time:\"expiredTime\"}}}}(e))),this._configMap.set(_o,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SEND_MESSAGE)}),body:{fromAccount:\"\",toAccount:\"\",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:\"\",avatar:\"\",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:\"\",desc:\"\",ext:\"\",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:\"\"}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\",msgBody:\"MsgBody\",count:\"MaxCnt\",lastMessageTime:\"LastMsgTime\",messageKey:\"MsgKey\",peerAccount:\"Peer_Account\",data:\"Data\",description:\"Desc\",extension:\"Ext\",type:\"MsgType\",content:\"MsgContent\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",nick:\"From_AccountNick\",avatar:\"From_AccountHeadurl\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",elements:\"MsgBody\",clientSequence:\"ClientSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\",needReadReceipt:\"IsNeedReadReceipt\"}}}}(e)),this._configMap.set(ho,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:\"\",groupID:\"\",random:0,clientSequence:0,priority:\"\",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:\"\",desc:\"\",ext:\"\",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:\"\"}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:\"GroupId\",extension:\"Ext\",data:\"Data\",description:\"Desc\",random:\"Random\",sequence:\"ReqMsgSeq\",count:\"ReqMsgNumber\",type:\"MsgType\",priority:\"MsgPriority\",content:\"MsgContent\",elements:\"MsgBody\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",clientSequence:\"ClientSeq\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\",needReadReceipt:\"NeedReadReceipt\",receiverList:\"To_Account\"},response:{MsgTime:\"time\",MsgSeq:\"sequence\"}}}}(e)),this._configMap.set(Io,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:\"\",toAccount:\"\",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:\"MsgInfo\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:\"\",msgSeqList:void 0,topicID:\"\"},keyMap:{request:{msgSeqList:\"MsgSeqList\",msgSeq:\"MsgSeq\"}}}}(e)),this._configMap.set(Eo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:\"\",count:15,lastMessageTime:0,messageKey:\"\",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:\"MsgKey\",peerAccount:\"Peer_Account\",count:\"MaxCnt\",lastMessageTime:\"LastMsgTime\",withRecalledMessage:\"WithRecalledMsg\",direction:\"GetDirection\"},response:{LastMsgTime:\"lastMessageTime\",IsNeedReadReceipt:\"needReadReceipt\",IsPeerRead:\"readReceiptSentByPeer\"}}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.MODIFY_C2C_MESSAGE)}),body:{from:\"\",to:\"\",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:\"MsgSeq\",random:\"MsgRandom\",time:\"MsgTime\",version:\"MsgVersion\",type:\"MsgType\",content:\"MsgContent\"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:\"\",count:15,sequence:\"\",topicID:void 0},keyMap:{request:{sequence:\"ReqMsgSeq\",count:\"ReqMsgNumber\",withRecalledMessage:\"WithRecalledMsg\"},response:{Random:\"random\",MsgTime:\"time\",MsgSeq:\"sequence\",ReqMsgSeq:\"sequence\",RspMsgList:\"messageList\",IsPlaceMsg:\"isPlaceMessage\",IsSystemMsg:\"isSystemMessage\",ToGroupId:\"to\",EnumFrom_AccountType:\"fromAccountType\",EnumTo_AccountType:\"toAccountType\",GroupCode:\"groupCode\",MsgPriority:\"priority\",MsgBody:\"elements\",MsgType:\"type\",MsgContent:\"content\",IsFinished:\"complete\",Download_Flag:\"downloadFlag\",ClientSeq:\"clientSequence\",ThumbUUID:\"thumbUUID\",VideoUUID:\"videoUUID\",ToTopicId:\"topicID\",InvisibleMsgSeq:\"invisibleSequenceList\"}}}}(e)),this._configMap.set(Co,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:\"LastedMsgTime\"}}}}(e)),this._configMap.set(To,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:\"Peer_Account\",muteFlag:\"Mute_Notifications\"}}}}(e)),this._configMap.set(Do,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:\"muteFlagList\"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:\"MsgReadedSeq\"}}}}(e)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:\"C2CReadAllMsg\",groupMessageReadInfoList:\"GroupReadInfo\",messageSequence:\"MsgSeq\"},response:{C2CReadAllMsg:\"readAllC2CMessage\",GroupReadInfoArray:\"groupMessageReadInfoList\"}}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:\"\",to:\"\",keyList:void 0},keyMap:{request:{keyList:\"MsgKeyList\"}}}}(e)),this._configMap.set(vs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:\"\",deleter:\"\",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:\"Deleter_Account\",keyList:\"Seqs\"}}}}(e)),this._configMap.set(pa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_TRANSLATE,\".\").concat(V.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:\"\",target:\"\"},keyMap:{request:{sourceTextList:\"SourceText\",SDKAppID:\"SdkAppId\",from:\"FromAccount\"},response:{TargetText:\"translatedTextList\",RequestId:\"requestID\",CmdErrorCode:\"error\",ErrorCode:\"code\",ErrorInfo:\"message\"}}}}(e)),this._configMap.set(ms,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:\"\",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:\"MsgSeq\",version:\"MsgVersion\",type:\"MsgType\",content:\"MsgContent\"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_READ_RECEIPT)}),body:{groupID:\"\",sequenceList:void 0},keyMap:{request:{sequence:\"MsgSeq\"}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:\"\",messageInfoList:void 0},keyMap:{request:{peerAccount:\"Peer_Account\",messageInfoList:\"C2CMsgInfo\",fromAccount:\"From_Account\",toAccount:\"To_Account\",sequence:\"MsgSeq\",random:\"MsgRandom\",time:\"MsgTime\",clientTime:\"MsgClientTime\"}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SEND_READ_RECEIPT)}),body:{groupID:\"\",sequenceList:void 0},keyMap:{request:{sequenceList:\"MsgSeqList\",sequence:\"MsgSeq\"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:\"\",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:\"MsgSeq\",count:\"Num\"},response:{ReadList:\"readUserIDList\",Read_Account:\"userID\",UnreadList:\"unreadUserIDList\",Unread_Account:\"userID\",IsFinish:\"isCompleted\"}}}}(e)),this._configMap.set(Ao,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM_MSG_EXT,\".\").concat(V.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM_MSG_EXT,\".\").concat(V.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Ds,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM_MSG_EXT,\".\").concat(V.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Es,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM_MSG_EXT,\".\").concat(V.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(So,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:\"To_Account\"},response:{ReadTime:\"peerReadTimeList\"}}}}(e)),this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:\"conversations\",ToAccount:\"groupID\",To_Account:\"userID\",UnreadMsgCount:\"unreadCount\",MsgGroupReadedSeq:\"messageReadSeq\",C2cPeerReadTime:\"c2cPeerReadTime\"}}}}(e)),this._configMap.set(No,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:\"MsgAssistFlags\",assistFlag:\"AssistFlags\",pinnedTimeStamp:\"TopTimeStamp\",pinnedStartIndex:\"TopStartIndex\"},response:{SessionItem:\"conversations\",ToAccount:\"groupID\",To_Account:\"userID\",UnreadMsgCount:\"unreadCount\",MsgGroupReadedSeq:\"messageReadSeq\",C2cPeerReadTime:\"c2cPeerReadTime\",LastMsgFlags:\"lastMessageFlag\",TopFlags:\"isPinned\",TopTimeStamp:\"pinnedTimeStamp\",TopStartIndex:\"pinnedStartIndex\",GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Go,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.DELETE_CONVERSATION)}),body:{fromAccount:\"\",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:\"ToGroupid\",clearHistoryMessage:\"ClearRamble\",conversationList:\"ContactItem\"},response:{ResultItem:\"resultList\",ToGroupid:\"groupID\",ResultCode:\"code\",ResultInfo:\"info\"}}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:\"\",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:\"ToGroupid\"}}}}(e)),this._configMap.set(Po,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.PIN_CONVERSATION)}),body:{fromAccount:\"\",operationType:1,itemList:void 0},keyMap:{request:{itemList:\"RecentContactItem\"}}}}(e)),this._configMap.set(bo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:\"DelMsgList\",messageSeq:\"MsgSeq\",messageRandom:\"MsgRandom\"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"MarkItem\",operationType:\"OptType\",groupID:\"ToGroupId\"},response:{ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"MarkItem\",operationType:\"OptType\",groupID:\"ToGroupId\"},response:{ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(qo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",itemList:void 0},keyMap:{request:{itemList:\"GroupContactItem\",groupID:\"ToGroupId\"},response:{GroupId:\"convGroupID\",ToGroupId:\"groupID\",OptType:\"operationType\"}}}}(e)),this._configMap.set(xo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",groupName:void 0},keyMap:{request:{},response:{GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Vo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:\"OldGroupName\",newName:\"NewGroupName\",groupID:\"ToGroupId\",operationType:\"ContactOptType\",groupName:\"OldGroupName\",updateItem:\"ContactUpdateItem\"},response:{ContactOptType:\"operationType\",ToGroupId:\"groupID\",GroupId:\"convGroupID\"}}}}(e)),this._configMap.set(Bo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Ho,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:\"\",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.RECENT_CONTACT,\".\").concat(V.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:\"\",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:\"convGroupID\",ToGroupId:\"groupID\",OptType:\"operationType\",CustomMark:\"customData\",ContactGroupId:\"convGroupIDList\"}}}}(e)),this._configMap.set(fo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.PROFILE,\".\").concat(V.CMD.PORTRAIT_GET)}),body:{fromAccount:\"\",userItem:[]},keyMap:{request:{toAccount:\"To_Account\",standardSequence:\"StandardSequence\",customSequence:\"CustomSequence\"}}}}(e)),this._configMap.set(vo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.PROFILE,\".\").concat(V.CMD.PORTRAIT_SET)}),body:{fromAccount:\"\",profileItem:[{tag:Be.NICK,value:\"\"},{tag:Be.GENDER,value:\"\"},{tag:Be.ALLOWTYPE,value:\"\"},{tag:Be.AVATAR,value:\"\"}]},keyMap:{request:{toAccount:\"To_Account\",standardSequence:\"StandardSequence\",customSequence:\"CustomSequence\"}}}}(e)),this._configMap.set(mo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.FRIEND,\".\").concat(V.CMD.GET_BLACKLIST)}),body:{fromAccount:\"\",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:\"currentSequence\"}}}}(e)),this._configMap.set(Mo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.FRIEND,\".\").concat(V.CMD.ADD_BLACKLIST)}),body:{fromAccount:\"\",toAccount:[]}}}(e)),this._configMap.set(yo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.FRIEND,\".\").concat(V.CMD.DELETE_BLACKLIST)}),body:{fromAccount:\"\",toAccount:[]}}}(e)),this._configMap.set(oa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.SET_SELF_STATUS)}),body:{customStatus:\"\"},keyMap:{}}}(e)),this._configMap.set(sa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:\"successUserList\",ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\",Status:\"statusType\"}}}}(e)),this._configMap.set(aa,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\"}}}}(e)),this._configMap.set(ra,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:\"failureUserList\",To_Account:\"userID\",Invalid_Account:\"invalidUserID\"}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:\"\",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:\"Member_Account\"},response:{GroupIdList:\"groups\",NoUnreadSeqList:\"excludedUnreadSequenceList\",MsgSeq:\"readedSequence\",LastRecallTime:\"_lastRevokedTime\"}}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"Owner_Account\",\"CreateTime\",\"InfoSeq\",\"LastInfoTime\",\"LastMsgTime\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\",\"NextMsgSeq\",\"ShutUpAllMember\"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:\"GroupIdList\",groupCustomField:\"AppDefinedData\",memberCustomField:\"AppMemberDefinedData\",groupCustomFieldFilter:\"AppDefinedDataFilter_Group\",memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{GroupIdList:\"groups\",AppDefinedData:\"groupCustomField\",AppMemberDefinedData:\"memberCustomField\",AppDefinedDataFilter_Group:\"groupCustomFieldFilter\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",InfoSeq:\"infoSequence\",MemberList:\"members\",GroupInfo:\"groups\",ShutUpUntil:\"muteUntil\",ShutUpAllMember:\"muteAllMembers\"}}}}(e)),this._configMap.set(jo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:\"\",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:\"Owner_Account\",userID:\"Member_Account\",avatar:\"FaceUrl\",maxMemberNum:\"MaxMemberCount\",joinOption:\"ApplyJoinOption\",groupCustomField:\"AppDefinedData\",memberCustomField:\"AppMemberDefinedData\",inviteOption:\"InviteJoinOption\"},response:{HugeGroupFlag:\"avChatRoomFlag\",OverJoinedGroupLimit_Account:\"overLimitUserIDList\"}}}}(e)),this._configMap.set(zo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Jo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{request:{groupCustomField:\"AppDefinedData\",muteAllMembers:\"ShutUpAllMember\",joinOption:\"ApplyJoinOption\",avatar:\"FaceUrl\",inviteOption:\"InviteJoinOption\"},response:{AppDefinedData:\"groupCustomField\",ShutUpAllMember:\"muteAllMembers\"}}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:\"ApplyMsg\",historyMessageFlag:\"HugeGroupHistoryMsgFlag\"},response:{HugeGroupFlag:\"avChatRoomFlag\",AVChatRoomKey:\"avChatRoomKey\",RspMsgList:\"messageList\",ToGroupId:\"to\"}}}}(e)),this._configMap.set(Qo,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,xi)),{},{servcmd:\"\".concat(V.NAME.BIG_GROUP_NO_AUTH,\".\").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:\"ApplyMsg\"},response:{HugeGroupFlag:\"avChatRoomFlag\"}}}}(e)),this._configMap.set(Zo,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set($o,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:[\"Type\",\"Name\",\"Introduction\",\"Notification\",\"FaceUrl\",\"CreateTime\",\"Owner_Account\",\"LastInfoTime\",\"LastMsgTime\",\"NextMsgSeq\",\"MemberNum\",\"MaxMemberNum\",\"ApplyJoinOption\",\"InviteJoinOption\"]}},keyMap:{response:{}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:\"NewOwner_Account\"}}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:\"Applicant_Account\",handleAction:\"HandleMsg\",handleMessage:\"ApprovalMsg\",messageKey:\"MsgKey\"}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:\"Applicant_Account\",invitee:\"Invited_Account\",handleAction:\"HandleMsg\",handleMessage:\"ApprovalMsg\"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:\"Inviter_Account\",handleAction:\"HandleMsg\",handleMessage:\"ApprovalMsg\",messageKey:\"MsgKey\"}}}}(e)),this._configMap.set(ds,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:\"Handle_Account\"},response:{To_Account:\"userID\"}}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:\"DelMsgList\",messageSeq:\"MsgSeq\",messageRandom:\"MsgRandom\"}}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.BIG_GROUP_LONG_POLLING,\".\").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:\"USP\"},response:{ToGroupId:\"groupID\",RspBroadcastMsgList:\"broadcastMessageList\",IsSystemMsg:\"isSystemMessage\"}}}}(e)),this._configMap.set(hs,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,Vi)),{},{servcmd:\"\".concat(V.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,\".\").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:\"USP\"},response:{ToGroupId:\"groupID\",RspBroadcastMsgList:\"broadcastMessageList\",IsSystemMsg:\"isSystemMessage\"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\",value:\"value\"}}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\",value:\"value\"}}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]},keyMap:{request:{key:\"key\"}}}}(e)),this._configMap.set(Cs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:[\"RaceConflict\"]}}}(e)),this._configMap.set(Ts,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_ATTR,\".\").concat(V.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:\"Key\",groupType:\"GroupType\"}}}}(e)),this._configMap.set(Ss,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:\"\",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:\"nextRevokedTime\",NotifyMsgList:\"notifyList\"}}}}(e)),this._configMap.set(ks,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:\"GroupCounter\"}}}}(e)),this._configMap.set(Ls,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:\"GroupCounterKeys\"}}}}(e)),this._configMap.set($s,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_COMMUNITY,\".\").concat(V.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:\"FaceUrl\"}}}}(e)),this._configMap.set(ea,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_COMMUNITY,\".\").concat(V.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:\"TopicIdList\"},response:{DestroyResultItem:\"resultList\"}}}}(e)),this._configMap.set(ta,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_COMMUNITY,\".\").concat(V.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:\"FaceUrl\",muteAllMembers:\"ShutUpAllMember\"}}}}(e)),this._configMap.set(na,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_COMMUNITY,\".\").concat(V.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:[\"NoUnreadSeqList\"]},keyMap:{request:{topicIDList:\"TopicIdList\"},response:{TopicAndSelfInfo:\"topicInfoList\",TopicInfo:\"topic\",GroupID:\"groupID\",ShutUpTime:\"muteTime\",ShutUpAllFlag:\"muteAllMembers\",LastMsgTime:\"lastMessageTime\",MsgSeq:\"readedSequence\",LastMsgSeq:\"sequence\",NoUnreadSeqList:\"excludedUnreadSequenceList\"}}}}(e)),this._configMap.set(As,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:[\"Role\",\"NameCard\",\"ShutUpUntil\",\"JoinTime\"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{AppMemberDefinedData:\"memberCustomField\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",MemberList:\"members\",ShutUpUntil:\"muteUntil\"}}}}(e)),this._configMap.set(Rs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_AVCHATROOM,\".\").concat(V.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:\"Timestamp\",filter:\"Mark\"},response:{NextTimestamp:\"offset\"}}}}(e)),this._configMap.set(Ns,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:\"Member_List_Account\",memberCustomFieldFilter:\"AppDefinedDataFilter_GroupMember\"},response:{MemberList:\"members\",ShutUpUntil:\"muteUntil\",AppDefinedDataFilter_GroupMember:\"memberCustomFieldFilter\",AppMemberDefinedData:\"memberCustomField\"}}}}(e)),this._configMap.set(Os,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:\"Member_Account\",userIDList:\"MemberList\"},response:{MemberList:\"members\"}}}}(e)),this._configMap.set(Gs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:\"MemberToDel_Account\"}}}}(e)),this._configMap.set(Us,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:\"\"},keyMap:{request:{userIDList:\"Members_Account\",duration:\"Duration\",reason:\"Description\"}}}}(e)),this._configMap.set(Ps,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP,\".\").concat(V.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:\"Member_Account\",memberCustomField:\"AppMemberDefinedData\",muteTime:\"ShutUpTime\",messageRemindType:\"MsgFlag\"}}}}(e)),this._configMap.set(bs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.GROUP_AVCHATROOM,\".\").concat(V.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:\"CommandType\",memberList:\"MemberList\",markType:\"Marks\",userID:\"Member_Account\"},response:{CommandType:\"operationType\",Marks:\"markType\",Member_Account:\"userID\"}}}}(e)),this._configMap.set(xs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STAT,\".\").concat(V.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:\"sdk_type\",SDKVersion:\"sdk_version\",deviceType:\"device_type\",platform:\"platform\",instanceID:\"instance_id\",traceID:\"trace_id\",SDKAppID:\"sdk_app_id\",userID:\"user_id\",tinyID:\"tiny_id\",extension:\"extension\",timestamp:\"timestamp\",networkType:\"network_type\",eventType:\"event_type\",code:\"error_code\",message:\"error_message\",moreMessage:\"more_message\",duplicate:\"duplicate\",costTime:\"cost_time\",level:\"level\",qualityType:\"quality_type\",reportIndex:\"report_index\",wholePeriod:\"whole_period\",totalCount:\"total_count\",rttCount:\"success_count_business\",successRateOfRequest:\"percent_business\",countLessThan1Second:\"success_count_business\",percentOfCountLessThan1Second:\"percent_business\",countLessThan3Second:\"success_count_platform\",percentOfCountLessThan3Second:\"percent_platform\",successCountOfBusiness:\"success_count_business\",successRateOfBusiness:\"percent_business\",successCountOfPlatform:\"success_count_platform\",successRateOfPlatform:\"percent_platform\",successCountOfMessageReceived:\"success_count_business\",successRateOfMessageReceived:\"percent_business\",avgRTT:\"average_value\",avgDelay:\"average_value\",avgValue:\"average_value\",uiPlatform:\"ui_platform\"}}}}(o)),this._configMap.set(Vs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.HEARTBEAT,\".\").concat(V.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(Bs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_PUSH,\".\").concat(V.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:\"C2CMessageArray\",GroupMsgArray:\"groupMessageArray\",GroupTips:\"groupTips\",C2cNotifyMsgArray:\"C2CNotifyMessageArray\",C2cMsgInfo:\"C2CReadReceiptArray\",ClientSeq:\"clientSequence\",MsgPriority:\"priority\",NoticeSeq:\"noticeSequence\",MsgContent:\"content\",MsgType:\"type\",MsgBody:\"elements\",ToGroupId:\"to\",Desc:\"description\",Ext:\"extension\",IsSyncMsg:\"isSyncMessage\",Flag:\"needSync\",NeedAck:\"needAck\",PendencyAdd_Account:\"userID\",ProfileImNick:\"nick\",PendencyType:\"applicationType\",C2CReadAllMsg:\"readAllC2CMessage\",IsNeedReadReceipt:\"needReadReceipt\",Status:\"statusType\"}}}}(e)),this._configMap.set(Hs,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_PUSH,\".\").concat(V.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:\"groupMessageArray\",GroupTips:\"groupTips\",ClientSeq:\"clientSequence\",MsgPriority:\"priority\",NoticeSeq:\"noticeSequence\",MsgContent:\"content\",MsgType:\"type\",MsgBody:\"elements\",ToGroupId:\"to\",Desc:\"description\",Ext:\"extension\",IsSyncMsg:\"isSyncMessage\",Flag:\"needSync\",NeedAck:\"needAck\",PendencyType:\"applicationType\"}}}}(e)),this._configMap.set(Ks,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.OPEN_IM,\".\").concat(V.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:\"SessionData\"}}}}(e)),this._configMap.set(Ws,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:\"C2CNotifyMessageArray\",NoticeSeq:\"noticeSequence\",KickoutMsgNotify:\"kickoutMsgNotify\",NewInstInfo:\"newInstanceInfo\"}}}}(e)),this._configMap.set(js,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_LONG_MESSAGE,\".\").concat(V.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:\"\"},keyMap:{response:{Data:\"data\",Desc:\"description\",Ext:\"extension\",Download_Flag:\"downloadFlag\",ThumbUUID:\"thumbUUID\",VideoUUID:\"videoUUID\"}}}}(e)),this._configMap.set(Ys,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_LONG_MESSAGE,\".\").concat(V.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:\"From_Account\",toAccount:\"To_Account\",msgTimeStamp:\"MsgTimeStamp\",msgSeq:\"MsgSeq\",msgRandom:\"MsgRandom\",msgBody:\"MsgBody\",type:\"MsgType\",content:\"MsgContent\",data:\"Data\",description:\"Desc\",extension:\"Ext\",sizeType:\"Type\",uuid:\"UUID\",url:\"\",imageUrl:\"URL\",fileUrl:\"Url\",remoteAudioUrl:\"Url\",remoteVideoUrl:\"VideoUrl\",thumbUUID:\"ThumbUUID\",videoUUID:\"VideoUUID\",videoUrl:\"\",downloadFlag:\"Download_Flag\",from:\"From_Account\",time:\"MsgTimeStamp\",messageRandom:\"MsgRandom\",messageSequence:\"MsgSeq\",elements:\"MsgBody\",clientSequence:\"ClientSeq\",payload:\"MsgContent\",messageList:\"MsgList\",messageNumber:\"MsgNum\",abstractList:\"AbstractList\",messageBody:\"MsgBody\"}}}}(e)),this._configMap.set(ca,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.SET_TOKEN)}),body:{tokenID:\"\",pushMsg:0,sdkAppID:0,businessID:\"\",deviceBrand:\"\",deviceToken:\"\",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:\"TokenID\",pushMsg:\"PushMsg\",sdkAppID:\"EnterVersion\",businessID:\"BusiID\",deviceBrand:\"InstType\",deviceToken:\"VarToken\",isTpns:\"IsTpns\"}}}}(e)),this._configMap.set(ua,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(ia,function(e){return{head:t(t({},e),{},{servcmd:\"\".concat(V.NAME.IM_OPEN_STATUS,\".\").concat(V.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:\"C2cUnread\",groupUnreadCount:\"GrpUnread\"}}}}(e))}},{key:\"has\",value:function(e){return this._configMap.has(e)}},{key:\"get\",value:function(e){return this._configMap.get(e)}},{key:\"update\",value:function(){this._fillConfigMap()}},{key:\"getKeyMap\",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(xe.w(\"\".concat(this._n,\".getKeyMap unknown protocolName:\").concat(e)),{})}},{key:\"getProtocolData\",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),s=null;if(n){var a=this._simpleDeepCopy(o),r=this._updateService(n,a),i=r.body,u=Object.create(null);for(var c in i)if(Object.prototype.hasOwnProperty.call(i,c)){if(u[c]=i[c],void 0===n[c])continue;u[c]=n[c]}r.body=u,s=this._getUplinkData(r)}else s=this._getUplinkData(o);return s}},{key:\"_getUplinkData\",value:function(e){var t=this._requestDataCleaner(e),n=Pt(t.head),o=Di(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:\"_updateService\",value:function(e,t){var n=Pt(t.head);if(this._isFromGroupRequest(t)){var o=e.type,s=e.groupID,a=void 0===s?void 0:s,r=e.groupIDList,i=void 0===r?[]:r;at(a)&&(a=i[0]||\"\"),Tt({type:o,groupID:a})&&(t.head.servcmd=\"\".concat(V.NAME.GROUP_COMMUNITY,\".\").concat(n))}return t}},{key:\"_isFromGroupRequest\",value:function(e){return e.head.servcmd.includes(V.NAME.GROUP)||e.head.servcmd.includes(V.NAME.GROUP_ATTR)}},{key:\"_getRequestKeyMap\",value:function(e){var n=this.getKeyMap(e);return t(t({},Ii.request),n.request)}},{key:\"_requestDataCleaner\",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&<(o)&&null!==e[o]&&void 0!==e[o]&&(\"object\"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:\"_simpleDeepCopy\",value:function(e){for(var t,n=Object.keys(e),o={},s=0,a=n.length;s1e3*s)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:r,requestCount:i});var u=!1;return i>o&&(u=!0),u}},{key:\"_isServerOverload\",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,s=!1;return Date.now()-n<=1e3*o?s=!0:(this._serverOverloadInfoMap.delete(e),s=!1),s}},{key:\"onPushedServerOverload\",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),xe.w(\"\".concat(this._n,\".onPushedServerOverload waitingTime:\").concat(n,\"s\"))}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._updateCommandFrequencyLimitMap(Wi),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),s}(ro),ji=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"MessageLossDetectionModule\",s._maybeLostSequencesMap=new Map,s._firstRoundRet=[],s}return a(n,[{key:\"onMessageMaybeLost\",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),s=0;s=this._expiredTime}},{key:\"fetchConfig\",value:function(){var e=this,t=this._canFetchConfig();if(xe.l(\"\".concat(this._n,\".fetchConfig canFetchConfig:\").concat(t)),t){var n=new ka(\"fetchCloudControlConfig\"),o=this.getModule(qn).getSDKAppID();this._isFetching=!0,this.request({protocolName:zs,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage(\"version:\".concat(e._version,\" newVersion:\").concat(t.data.version,\" config:\").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),xe.l(\"\".concat(e._n,\".fetchConfig ok\")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=v(e,2),s=o[0],a=o[1];n.setError(t,s,a).end()})),xe.l(\"\".concat(e._n,\".fetchConfig failed. error:\"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:\"onPushedCloudControlConfig\",value:function(e){xe.l(\"\".concat(this._n,\".onPushedCloudControlConfig\")),new ka(\"pushedCloudControlConfig\").setNetworkType(this.getNetworkType()).setMessage(\"newVersion:\".concat(e.version,\" config:\").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:\"onCheckTimer\",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:\"_parseCloudControlConfig\",value:function(e){var t=this,n=\"\".concat(this._n,\"._parseCloudControlConfig\"),o=e.errorCode,s=e.errorMessage,a=e.cloudControlConfig,r=e.version,i=e.expiredTime;if(0===o){if(this._version!==r){var u=null;try{u=JSON.parse(a)}catch(c){this.isPrivateNetWork()||xe.e(\"\".concat(n,\" JSON parse error. cloudControlConfig:\"),a)}u&&(this._cloudConfig.clear(),Object.keys(u).forEach((function(e){t._cloudConfig.set(e,u[e])})),this._version=r,this.emitInnerEvent($a))}this._expiredTime=Date.now()+1e3*i}else at(o)?(xe.l(\"\".concat(n,\" failed. Invalid message format:\"),e),this._setExpiredTimeOnResponseError(36e5)):(xe.e(\"\".concat(n,\" errorCode:\").concat(o,\" errorMessage:\").concat(s)),this._setExpiredTimeOnResponseError(12e4))}},{key:\"_setExpiredTimeOnResponseError\",value:function(e){this._expiredTime=Date.now()+e}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(ro),Ji=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"RecoverMessageModule\",s.PULL_LIMIT_COUNT=15,s}return a(n,[{key:\"start\",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:\"_recoverGroupChat\",value:function(){var e,t,n=this,o=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_GROUP&&e.groupProfile.type!==S.GRP_AVCHATROOM})),s=this.getModule(Fn),a=0,r=0,i=0;o.forEach((function(o){var u=o.conversationID,c=o.lastMessage;t=u.replace(S.CONV_GROUP,\"\"),e=s.getLocalLastMessage(u),c&&0!==c.lastSequence&&e?(r=c.lastSequence,a=e.sequence,i=r-a,a>0&&i>=1&&i<300?n._recoverGroupMessage({groupID:t,localLastMessageSequence:a,remoteLastMessageSequence:r}):n._getGroupNotify(t)):n._getGroupNotify(t)}))}},{key:\"_recoverC2CChat\",value:function(){var e,t=this,n=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_C2C})),o=this.getModule(Fn),s=0,a=0,r=0,i=[Promise.resolve()];n.forEach((function(n){var u=n.conversationID,c=n.lastMessage;e=o.getLocalLastMessage(u),c&&0!==c.lastTime&&e&&(a=c.lastTime,s=e.time,r=a-s,s>0&&r>=1&&r<=600&&i.push(t._recoverC2CMessage({conversationID:u,localLastMessageTime:s,remoteLastMessageTime:a})))})),Promise.all(i).then((function(){xe.l(\"\".concat(t._n,\"._recoverC2CChat all promise fulfilled, start to sync unread messages\")),t.getModule(Yn).startSyncOnReconnected()}))}},{key:\"_getLocalConversationList\",value:function(){return this.getModule(Fn).getLocalConversationList()}},{key:\"_recoverGroupMessage\",value:function(e){var t=this,n=\"\".concat(this._n,\"._recoverGroupMessage\");xe.l(\"\".concat(n,\" options:\"),e);var o=e.groupID,s=e.localLastMessageSequence,a=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:o,sequence:s}).then((function(e){var s=e.data,r=s.complete,i=s.messageList;if(!at(i)){var u=i[0].sequence;xe.l(\"\".concat(n,\" pkgLastMessageSequence:\").concat(u,\" complete:\").concat(r)),u1&&i.sort((function(e,t){return e.sequence-t.sequence}));for(var l=0;l=0&&this._e2eDelayArray.push(t)}},{key:\"_calcAvg\",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),bt(n/t,1)}},{key:\"_calcCountWithLimit\",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e100&&(n=100),n}},{key:\"_checkE2EDelayException\",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,s=Math.min.apply(Math,m(n)),a=Math.max.apply(Math,m(n)),r=this._calcAvg(n,o),i=bt(o/e.length*100,2);if(i>50)new ka(\"messageE2EDelayException\").setMessage(\"count:\".concat(o,\" min:\").concat(s,\" max:\").concat(a,\" avg:\").concat(r,\" percent:\").concat(i)).setLevel(\"warning\").end()}}},{key:\"getStatResult\",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=m(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),s=this._calcPercent(n,e),a=this._calcPercent(o,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:s,countLessThan3Second:o,percentOfCountLessThan3Second:a,avgDelay:r}}},{key:\"reset\",value:function(){this._e2eDelayArray.length=0}}]),e}(),Qi=function(){function e(){o(this,e),this._n=\"AvgRTT\",this._requestCount=0,this._rttArray=[]}return a(e,[{key:\"addRequestCount\",value:function(){this._requestCount+=1}},{key:\"addRTT\",value:function(e){this._rttArray.push(e)}},{key:\"_calcTotalCount\",value:function(){return this._requestCount}},{key:\"_calcRTTCount\",value:function(e){return e.length}},{key:\"_calcSuccessRateOfRequest\",value:function(e,t){if(0===t)return 0;var n=bt(e/t*100,2);return n>100&&(n=100),n}},{key:\"_calcAvg\",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:\"_calcMax\",value:function(){return Math.max.apply(Math,m(this._rttArray))}},{key:\"_calcMin\",value:function(){return Math.min.apply(Math,m(this._rttArray))}},{key:\"getStatResult\",value:function(){var e=this._calcTotalCount(),t=m(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),s=this._calcAvg(t,n);return xe.l(\"\".concat(this._n,\".getStatResult max:\").concat(this._calcMax(),\" min:\").concat(this._calcMin(),\" avg:\").concat(s)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:s}}},{key:\"reset\",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),Zi=function(){function e(){o(this,e),this._map=new Map}return a(e,[{key:\"initMap\",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:\"addTotalCount\",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:\"addSuccessCount\",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:\"addFailedCountOfUserSide\",value:function(e){return!(at(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:\"addCost\",value:function(e,t){return!(at(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:\"addFileSize\",value:function(e,t){return!(at(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:\"_calcSuccessRateOfBusiness\",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=bt(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:\"_calcSuccessRateOfPlatform\",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=bt(n,2))>100&&(n=100),n}},{key:\"_calcTotalCount\",value:function(e){return at(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:\"_calcSuccessCountOfBusiness\",value:function(e){return at(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:\"_calcSuccessCountOfPlatform\",value:function(e){if(at(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:\"_calcAvg\",value:function(e){return at(e)||!this._map.has(e)?-1:e===Ma?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:\"_calcAvgCost\",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:\"_calcAvgSpeed\",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:\"getStatResult\",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),s=this._calcSuccessCountOfPlatform(e),a=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:s,successRateOfPlatform:a,avgValue:r}}},{key:\"reset\",value:function(e){at(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),$i=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return a(e,[{key:\"initMap\",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:\"addMessageSequence\",value:function(e){var t=e.key,n=e.message;if(at(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,s=n.sequence,a=o.replace(S.CONV_GROUP,\"\");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(a)){var r=this._lastMap.get(t).get(a),i=r.length-1;s>r[0]&&s100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:\"reset\",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),eu=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n=\"QualityStatModule\",t.TAG=\"im-ssolog-quality-stat\",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[ga,_a,ha,fa,va,ma,Ma,ya,Ia,Ca],t._messageSentItems=[ha,fa,va,ma,Ma],t._messageReceivedItems=[ya,Ia,Ca],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new Qi,t._avgE2EDelay=new Xi,t._rateMessageSent=new Zi,t._rateMessageReceived=new $i;var a=t.getInnerEmitterInstance();return a.on(Za,t._onLoginSuccess,_(t)),a.on($a,t._onCloudConfigUpdated,_(t)),t}return a(s,[{key:\"_onLoginSuccess\",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(xn),n=t.getItem(this.TAG,!1);!jt(n)&&it(n.forEach)&&(xe.l(\"\".concat(this._n,\"._onLoginSuccess get quality stat logs from local storage, count:\").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"q_rpt_interval\"),t=this.getCloudConfig(\"q_rpt_sdkappid_bl\"),n=this.getCloudConfig(\"q_rpt_tinyid_wl\");at(e)||(this.REPORT_INTERVAL=Number(e)),at(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(\",\").map((function(e){return Number(e)}))),at(n)||(this.REPORT_TINYID_WHITELIST=n.split(\",\"))}},{key:\"onCheckTimer\",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:\"addRequestCount\",value:function(){this._avgRTT.addRequestCount()}},{key:\"addRTT\",value:function(e){this._avgRTT.addRTT(e)}},{key:\"addMessageDelay\",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:\"addTotalCount\",value:function(e){this._rateMessageSent.addTotalCount(e)||xe.w(\"\".concat(this._n,\".addTotalCount invalid key:\"),e)}},{key:\"addSuccessCount\",value:function(e){this._rateMessageSent.addSuccessCount(e)||xe.w(\"\".concat(this._n,\".addSuccessCount invalid key:\"),e)}},{key:\"addFailedCountOfUserSide\",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||xe.w(\"\".concat(this._n,\".addFailedCountOfUserSide invalid key:\"),e)}},{key:\"addCost\",value:function(e,t){this._rateMessageSent.addCost(e,t)||xe.w(\"\".concat(this._n,\".addCost invalid key or cost:\"),e,t)}},{key:\"addFileSize\",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||xe.w(\"\".concat(this._n,\".addFileSize invalid key or size:\"),e,t)}},{key:\"addMessageSequence\",value:function(e){this._rateMessageReceived.addMessageSequence(e)||xe.w(\"\".concat(this._n,\".addMessageSequence invalid key:\"),e.key)}},{key:\"_getQualityItem\",value:function(e){var n={},o=Ea[this.getNetworkType()];at(o)&&(o=8);var s={qualityType:Ta[e],timestamp:Ue(),networkType:o,extension:\"\"};switch(e){case ga:n=this._avgRTT.getStatResult();break;case _a:n=this._avgE2EDelay.getStatResult();break;case ha:case fa:case va:case ma:case Ma:n=this._rateMessageSent.getStatResult(e);break;case ya:case Ia:case Ca:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},s),n)}},{key:\"_report\",value:function(e){var t=this,n=[],o=null;at(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),xe.d(\"\".concat(this._n,\"._report\"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var s=this.getModule(qn),a=s.getSDKAppID(),r=s.getTinyID();wt(this.REPORT_SDKAPPID_BLACKLIST,a)&&!Ft(this.REPORT_TINYID_WHITELIST,r)&&(n=[]),n.length>0&&this._doReport(n)}},{key:\"_doReport\",value:function(e){var n=this,o={header:ti(this),quality:e};this.request({protocolName:xs,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){xe.w(\"\".concat(n._n,\"._doReport, online:\").concat(n.getNetworkType(),\" error:\"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:\"_flushAtOnce\",value:function(){var e=this.getModule(xn),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o=\"\".concat(this._n,\"._flushAtOnce\");if(jt(t))xe.l(\"\".concat(o,\" count:\").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>10&&(s=s.slice(0,10)),xe.l(\"\".concat(o,\" count:\").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}this._statInfoArr=[]}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),s}(ro),tu=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"WorkerTimerModule\",s._isWorkerEnabled=!0,s._workerTimer=null,s._timerID=-1,s._init(),s.getInnerEmitterInstance().on($a,s._onCloudConfigUpdated,_(s)),s}return a(n,[{key:\"isWorkerEnabled\",value:function(){return this._isWorkerEnabled&&Se}},{key:\"startWorkerTimer\",value:function(){xe.l(\"\".concat(this._n,\".startWorkerTimer\")),this._workerTimer&&this._workerTimer.postMessage(\"start\")}},{key:\"stopWorkerTimer\",value:function(){xe.l(\"\".concat(this._n,\".stopWorkerTimer\")),this._workerTimer&&this._workerTimer.postMessage(\"stop\")}},{key:\"_init\",value:function(){if(Se){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === \"start\") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(\"\"); }, 1000); postMessage(interval); } else if (event.data === \"stop\") { clearInterval(interval); interval = -1; }};'],{type:\"application/javascript; charset=utf-8\"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,xe.l(\"\".concat(t._n,\"._init seed:\").concat(t._timerID))):t._m.onCheckTimer()}}}},{key:\"_onCloudConfigUpdated\",value:function(){var e=this.getCloudConfig(\"enable_worker\");xe.l(\"\".concat(this._n,\"._onCloudConfigUpdated enableWorker:\").concat(e)),at(e)||\"1\"===e?!this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:\"terminate\",value:function(){xe.l(\"\".concat(this._n,\".terminate\")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}},{key:\"getTimerID\",value:function(){return this._timerID}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\"))}}]),n}(ro),nu=function(){function e(){o(this,e),this._n=\"PurchasedFeatureHandler\",this._purchasedFeatureMap=new Map}return a(e,[{key:\"isValidPurchaseBits\",value:function(e){return e&&\"string\"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:\"parsePurchaseBits\",value:function(e){if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var t=null,n=e.length-1,o=0;n>=0;n--,o++)t=o<32?new L(0,Math.pow(2,o)).toString():new L(Math.pow(2,o-32),0).toString(),\"1\"===e[n]?this._purchasedFeatureMap.set(t,!0):this._purchasedFeatureMap.set(t,!1)}else xe.w(\"\".concat(this._n,\".parsePurchaseBits invalid purchasebits:\").concat(e))}},{key:\"hasPurchasedFeature\",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:\"isFeatureEnabled\",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,s=t.length-1,a=0;s>=0;s--,a++)if(\"1\"===t.charAt(s)&&(n=a<32?new L(0,Math.pow(2,a)).toString():new L(Math.pow(2,a-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return xe.l(\"\".concat(this._n,\".isFeatureEnabled decimalNumber:\").concat(e,\" binaryString:\").concat(t,\" ret:\").concat(o)),za({enabled:o})}},{key:\"clear\",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),ou=function(){function e(t){o(this,e),this._m=t,this._n=\"CommercialConfigModule\",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new nu}return a(e,[{key:\"_canFetch\",value:function(){return this._getModule(qn).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:\"onCheckTimer\",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:\"fetchConfig\",value:function(){var e=this,t=this._canFetch(),n=\"\".concat(this._n,\".fetchConfig\");if(xe.l(\"\".concat(n,\" canFetch:\").concat(t)),t){var o=this._getModule(Bn),s=new ka(\"fetchCommercialConfig\");s.setNetworkType(o.getNetworkType());var a=this._getModule(qn).getSDKAppID(),r=this._getModule(jn);this._isFetching=!0,r.request({protocolName:Xs,requestData:{SDKAppID:a}}).then((function(t){s.setMessage(\"purchaseBits:\".concat(t.data.purchaseBits)).end(),xe.l(\"\".concat(n,\" ok.\")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){o.probe().then((function(e){var n=v(e,2),o=n[0],a=n[1];s.setError(t,o,a).end()})),e._isFetching=!1}))}}},{key:\"onPushedConfig\",value:function(e){var t=\"\".concat(this._n,\".onPushedConfig data:\").concat(JSON.stringify(e));xe.l(\"\".concat(t)),new ka(\"pushedCommercialConfig\").setNetworkType(this._getModule(Bn).getNetworkType()).setMessage(\"purchaseBits:\".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:\"_parseConfig\",value:function(e){var t=\"\".concat(this._n,\"._parseConfig\"),n=e.errorCode,o=e.errorMessage,s=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(s),this._expiredTime=Date.now()+1e3*a):at(n)?(xe.l(\"\".concat(t,\" failed. Invalid message format:\"),e),this._setExpiredTimeOnResponseError(36e5)):(xe.e(\"\".concat(t,\" errorCode:\").concat(n,\" errorMessage:\").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:\"_setExpiredTimeOnResponseError\",value:function(e){this._expiredTime=Date.now()+e}},{key:\"canIUse\",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:\"isFeatureEnabled\",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:\"_getModule\",value:function(e){return this._m.getModule(e)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),su=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._m=e,s._n=\"OfflinePushModule\",s._offlinePushPlugin=void 0,s._androidPushConfig={huaweiPushBussinessId:\"\",xiaomiPushBussinessId:\"\",xiaomiPushAppId:\"\",xiaomiPushAppKey:\"\",meizuPushBussinessId:\"\",meizuPushAppId:\"\",meizuPushAppKey:\"\",vivoPushBussinessId:\"\",fcmPushBussinessId:\"\",oppoPushBussinessId:\"\",oppoPushAppKey:\"\",oppoPushAppSecret:\"\",honorPushBussinessId:\"\"},s._deviceToken=\"\",s._businessID=0,s._iosBusinessID=0,s._c2cUnreadCount=0,s._groupUnreadCount=0,s._isWebUniapp=0,s}return a(n,[{key:\"registerPlugin\",value:function(e){if(ne){this._offlinePushPlugin=e[\"tim-offline-push-plugin\"];var t=e.offlinePushConfig||{},n=t.huaweiBusinessID,o=t.xiaomiBusinessID,s=t.xiaomiAppID,a=t.xiaomiAppKey,r=t.meizuBusinessID,i=t.meizuAppID,u=t.meizuAppKey,c=t.vivoBusinessID,l=t.oppoBusinessID,p=t.oppoAppKey,d=t.oppoAppSecret,g=t.honorBusinessID,_=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=n,this._androidPushConfig.xiaomiPushBussinessId=o,this._androidPushConfig.xiaomiPushAppId=s,this._androidPushConfig.xiaomiPushAppKey=a,this._androidPushConfig.meizuPushBussinessId=r,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=u,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=p,this._androidPushConfig.oppoPushAppSecret=d,this._androidPushConfig.honorPushBussinessId=g,new ka(\"registerPlugin\").setMessage(\"tim-offline-push-plugin\").setMoreMessage(\"isExist:\".concat(!at(this._offlinePushPlugin))).end(!0),xe.l(\"\".concat(this._n,\".\").concat(\"registerPlugin\",\" ok. offlinePushConfig:\").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=_,this._setAppShowListener()}else this.outputWarning(\"OfflinePushInUniapp\")}},{key:\"init\",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:\"_getDeviceToken\",value:function(){var e=this,t=\"\".concat(this._n,\".\").concat(\"_getDeviceToken\");if(it(this._offlinePushPlugin.getDeviceToken)){var n=\"androidPushConfig:\".concat(JSON.stringify(this._androidPushConfig),\", iosBusinessID:\").concat(this._iosBusinessID);xe.l(\"\".concat(t,\" start. \").concat(n)),new ka(\"_getDeviceToken\").setMessage(\"\".concat(n)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(o){var s=new ka(\"getDeviceTokenRes\"),a=o.code,r=o.msg;if(0===a){var i=o.data,u=i.deviceToken,c=i.deviceBrand,l=i.deviceType,p=i.bussinessId;e._deviceToken=u,e._businessID=p||e._iosBusinessID,n=\"deviceToken:\".concat(u,\", deviceBrand:\").concat(c||l,\", businessID:\").concat(e._businessID),xe.l(\"\".concat(t,\" ok. \").concat(n)),s.setMessage(n).end(!0),e._setToken()}else s.setMessage(\"code:\".concat(a,\", msg:\").concat(r)).end(!0),xe.e(\"\".concat(t,\" failed. error:\"),o)}))}else xe.e(\"\".concat(t,\" getDeviceToken is not a function\"))}},{key:\"canIUseOfflinePush\",value:function(){return ne&&!at(this._offlinePushPlugin)}},{key:\"_setAppShowListener\",value:function(){var e=this,t=\"\".concat(this._n,\".\").concat(\"_setAppShowListener\");at(this._offlinePushPlugin)?xe.e(\"\".concat(t,\" offlinePushPlugin is undefined\")):it(this._offlinePushPlugin.setAppShowListener)?(new ka(\"_setAppShowListener\").end(!0),xe.l(\"\".concat(t,\" start\")),this._offlinePushPlugin.setAppShowListener((function(n){var o=(n||{}).appShow;new ka(\"setAppShowListenerRes\").setMessage(\"appShow:\".concat(o)).end(!0),xe.l(\"\".concat(t,\" ok. appShow:\").concat(o)),e._m.isReady()&&(0===o?(e._getConvUnreadCount(),e._onBackground()):1===o&&e._onForeground())}))):xe.e(\"\".concat(t,\" setAppShowListener is not a function\"))}},{key:\"getDeviceBrand\",value:function(){if(!at(this._offlinePushPlugin)&&it(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return xe.l(\"\".concat(this._n,\".getDeviceBrand ok. deviceType:\").concat(e)),e}}},{key:\"_setToken\",value:function(){var e,t=this,n=\"\".concat(this._n,\"._setToken\"),o=this.getModule(qn),s=1,a=\"\",r=\"\";jt(this._deviceToken)&&(s=0);var i=this.getUniAppPlatform(),u=this.getDeviceBrand();i===R.IOS||i===R.IPAD||i===R.MAC?r=this._deviceToken:i===R.ANDROID&&(a=this._deviceToken);var c=new ka(\"offlinePushSetToken\");return e=\"deviceToken:\".concat(r||a,\", businessID:\").concat(this._businessID,\", \")+\"deviceBrand:\".concat(u,\", isWebUniapp:\").concat(this._isWebUniapp,\", pushMsg:\").concat(s,\", platform:\").concat(i),c.setMessage(\"\".concat(e)),xe.l(\"\".concat(n,\" \").concat(e)),this.request({protocolName:ca,requestData:{tokenID:a,pushMsg:s,sdkAppID:o.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:u,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then((function(e){return c.end(),xe.l(\"\".concat(n,\" ok\")),e})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),xe.e(\"\".concat(n,\" failed. error:\"),e),Ja(e)}))}},{key:\"_getConvUnreadCount\",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(Fn).getLocalConversationList().forEach((function(t){t.type===S.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===S.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:\"_onBackground\",value:function(){var e=this,t=\"\".concat(this._n,\".\").concat(\"_onBackground\"),n=new ka(\"_onBackground\");this.request({protocolName:ia,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(o){return n.setMessage(\"c2cUnreadCount: \".concat(e._c2cUnreadCount,\", groupUnreadCount: \").concat(e._groupUnreadCount)).end(),xe.l(\"\".concat(t,\" ok\")),o})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),xe.e(\"\".concat(t,\" failed. error:\"),o)}))}},{key:\"_onForeground\",value:function(){var e=this,t=\"\".concat(this._n,\".\").concat(\"_onForeground\"),n=new ka(\"_onForeground\");this.request({protocolName:ua,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return n.end(),xe.l(\"\".concat(t,\" ok\")),e})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),s=t[0],a=t[1];n.setError(o,s,a).end()})),xe.e(\"\".concat(t,\" failed. error:\"),o)}))}},{key:\"getUniAppPlatform\",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return\"ios\"===e?R.IOS:\"android\"===e?R.ANDROID:1002===t?R.IPAD:1001===t?R.MAC:void 0}},{key:\"reset\",value:function(){this._deviceToken=\"\",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,xe.l(\"\".concat(this._n,\".reset\"))}}]),n}(ro),au=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n=\"ProfanityFilterModule\",s._plugin=null,s._filterConfigMap=new Map,s._startIndex=0,s._version=0,s._canIUseLexicon=!1,s._isFetching=!1,s._expiredTime=0,s}return a(n,[{key:\"init\",value:function(){var e=this.getModule(Wn).getPlugin(\"tim-profanity-filter-plugin\");e?(this._plugin=new e({logger:xe,isArray:st,isMap:Qe,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning(\"ProfanityPluginNotFound\")}},{key:\"onCheckTimer\",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:\"filterMessage\",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var o=e.type,s=e.conversationType;if(o!==S.MSG_TEXT&&o!==S.MSG_CUSTOM)return n;var a,r=\"\".concat(this._n,\".filterMessage\");if(xe.l(\"\".concat(r)),o===S.MSG_TEXT){if(s===S.CONV_C2C?a=H:s===S.CONV_GROUP&&(a=W),!this._isConfigOn(a))return n;var i=this._plugin.filter(e.payload.text),u=i.type,c=i.modifiedText;1===u?n=!1:2===u&&(e.payload.text=c)}else if(o===S.MSG_CUSTOM){if(s===S.CONV_C2C?a=K:s===S.CONV_GROUP&&(a=Y),!this._isConfigOn(a))return n;var l=this._plugin.filter(e.payload.data),p=this._plugin.filter(e.payload.description),d=this._plugin.filter(e.payload.extension);1===l.type||1===p.type||1===d.type?n=!1:(2===l.type&&(e.payload.data=l.modifiedText),2===p.type&&(e.payload.description=p.modifiedText),2===d.type&&(e.payload.extension=d.modifiedText))}return xe.l(\"\".concat(r,\" done. isAllowedToSend:\").concat(n)),n}},{key:\"filterText\",value:function(e,t){var n=\"\".concat(this._n,\".filterText\"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;xe.l(\"\".concat(n));var s=this._plugin.filter(e),a=s.type,r=s.modifiedText;return 1===a?o.isAllowedToSend=!1:2===a&&(o.modifiedText=r),xe.l(\"\".concat(n,\" done. ret:\"),o),o}},{key:\"_getLexicon\",value:function(){var e=this,t=new ka(\"profanityFilter\"),n=\"\".concat(this._n,\"._getLexicon\");this._isFetching=!0,this.request({protocolName:la,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(o){var s=o.data,a=s.errorInfo,r=s.filterConfig,i=s.lexicon,u=s.strToken,c=s.completeFlag,l=s.nextStartIndex,p=s.version,d=s.expiredTime,g=a.errorCode,_=a.errorMessage;return 0!==g?(e._isFetching=!1,xe.w(\"\".concat(n,\" failed. error:\"),a),void t.setCode(g).setMessage(_).end()):(e._onFilterConfig(r),e._getToken(u),1===c?(xe.l(\"\".concat(n,\" done. version:\").concat(p,\" expiredTime:\").concat(d)),e._version=p,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*d,void e._plugin.onLexiconCompleted(i)):(e._startIndex=l,e._plugin.onLexiconSliced(i),void e._getLexicon()))})).catch((function(o){e.probeNetwork().then((function(e){var n=v(e,2),s=n[0],a=n[1];t.setError(o,s,a).end()})),e._isFetching=!1,xe.l(\"\".concat(n,\" failed. error:\"),o)}))}},{key:\"_onFilterConfig\",value:function(e){var t=this;jt(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),xe.l(\"\".concat(this._n,\"._onFilterConfig. keys:\").concat(Array.from(this._filterConfigMap.keys()),\" values:\").concat(Array.from(this._filterConfigMap.values()))))}},{key:\"_isConfigOn\",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:\"_getToken\",value:function(e){if(et(e)){var t=e.length,n=\"\";if(t%2==0)for(var o=0;o<=t-1;o+=2)n+=e[o+1],n+=e[o];else{for(var s=0;s=this.STORAGE_EXPIRES_TIME,s=!n||\"2.27.5\"!==n;return xe.l(\"\".concat(this._n,\"._needToUpdate isTimeout:\").concat(o,\" isDifferentVersion:\").concat(s)),o||s}},{key:\"_fetch\",value:function(){if(!this._m.getModule(qn).isPrivateNetWork()){var e=\"https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt\",t=\"application/x-www-form-urlencoded;charset=UTF-8\",n=\"\".concat(this._n,\"._fetch ok in\"),o=this;if(se)re.request({url:e,method:\"GET\",timeout:3e3,header:{\"content-type\":t},dataType:\"text\",success:function(e){o._fillAndSave(e.data),xe.l(\"\".concat(n,\" mini program\"))},fail:function(){}});else{var s=new XMLHttpRequest,a=setTimeout((function(){s.abort()}),3e3);s.onreadystatechange=function(){4===s.readyState&&(clearTimeout(a),200!==s.status&&304!==s.status||(xe.l(\"\".concat(n,\" browser\")),o._fillAndSave(s.responseText)))},s.open(\"GET\",e,!0),s.setRequestHeader(\"Content-type\",t),s.send()}}}},{key:\"_fillAndSave\",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:\"2.27.5\"}),!0,!1)}},{key:\"_getStorageModule\",value:function(){return this._m.getModule(xn)}},{key:\"_fillMap\",value:function(e){this._map.clear();for(var t,n,o,s=e.split(\";\\n\"),a=s.length,r=new RegExp(/'/g),i=0;i0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:\"_stopMainThreadSocket\",value:function(){xe.l(\"\".concat(this._n,\"._stopMainThreadSocket\"));var e=this._moduleMap.get(zn);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:\"_startMainThreadSocket\",value:function(){xe.l(\"\".concat(this._n,\"._startMainThreadSocket\"));var e=this._moduleMap.get(zn);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:\"onWorkerTimerEnabled\",value:function(){xe.l(\"\".concat(this._n,\".onWorkerTimerEnabled, disable main thread timer and socket\")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:\"onWorkerTimerDisabled\",value:function(){xe.l(\"\".concat(this._n,\".onWorkerTimerDisabled, enable main thread timer and socket\")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:\"onCheckTimer\",value:function(){this._checkCount+=1;var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:\"_initReadyList\",value:function(){var e=this;this._readyList=[this._moduleMap.get(An),this._moduleMap.get(Fn)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:\"_onModuleReady\",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(E.SDK_READY);var t=Date.now()-this._startLoginTs;xe.w(\"SDK is ready. cost \".concat(t,\" ms\")),this._startLoginTs=Date.now();var n=this._moduleMap.get(Bn).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Ge;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:\"login\",value:function(){0===this._startLoginTs&&(Pe(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(Bn).start(),this._ssoLogForReady=new ka(\"sdkReady\"),this._reason=da.LOGGING_IN)}},{key:\"onLoginFailed\",value:function(){this._startLoginTs=0}},{key:\"getOuterEmitterInstance\",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new ii,ja(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===E.CONVERSATION_LIST_UPDATED||e===E.FRIEND_LIST_UPDATED||e===E.GROUP_LIST_UPDATED||e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),s=this._eventThrottleMap.get(e);o-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout((function(){s.last=Date.now(),n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),1e3)):(s.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:\"_getEventData\",value:function(e){return e===E.CONVERSATION_LIST_UPDATED?this._moduleMap.get(Fn).getLocalConversationList():e===E.FRIEND_LIST_UPDATED?this._moduleMap.get(Pn).getLocalFriendList(!1):e===E.GROUP_LIST_UPDATED?this._moduleMap.get(Un).getLocalGroupList():e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(Fn).getTotalUnreadMessageCount():void 0}},{key:\"getInnerEmitterInstance\",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new ii,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;n=ot(arguments[1])&&arguments[1].data?[e,{name:arguments[0],data:arguments[1].data}]:[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:\"hasModule\",value:function(e){return this._moduleMap.has(e)}},{key:\"getModule\",value:function(e){return this._moduleMap.get(e)}},{key:\"isReady\",value:function(){return this._isReady}},{key:\"isIntl\",value:function(){return this.getModule(qn).isIntl()}},{key:\"getNotReadyReason\",value:function(){return this._reason}},{key:\"setNotReadyReason\",value:function(e){this._reason=e}},{key:\"getErrorMessage\",value:function(e,t,n){return this._moduleMap.get(ao).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:\"outputWarning\",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&xe.w(o)}},{key:\"onError\",value:function(e){var t=\"code:\".concat(e.code,\" message:\").concat(e.message);xe.w(\"Oops! \".concat(t)),new ka(\"error\").setMessage(t).setNetworkType(this.getModule(Bn).getNetworkType()).setLevel(\"error\").end(),this.getOuterEmitterInstance().emit(E.ERROR,e)}},{key:\"restartTimer\",value:function(){xe.l(\"\".concat(this._n,\".restartTimer\")),this.stopTimer(),this._startTimer(),this.getModule(Un).restartPolling()}},{key:\"getTimerID\",value:function(){var e=this._moduleMap.get(Qn);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:\"getPollingTimerID\",value:function(e){return this._moduleMap.get(Un).getPollingTimerID(e)}},{key:\"reset\",value:function(){xe.l(\"\".concat(this._n,\".reset\")),Pe();var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.reset&&n.reset()}}catch(r){t.e(r)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(E.SDK_NOT_READY);var o,s=D(this._eventThrottleMap);try{for(s.s();!(o=s.n()).done;){var a=v(o.value,2)[1];a.timeoutID&&clearTimeout(a.timeoutID)}}catch(r){s.e(r)}finally{s.f()}this._eventThrottleMap.clear()}}]),e}(),cu=function(){function e(t){o(this,e),this._funcMap=new Map,this._m=t}return a(e,[{key:\"defense\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(\"string\"!=typeof e)return null;if(0===e.length)return null;if(\"function\"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:\"defenseOnce\",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return\"function\"!=typeof t?null:this._pack(e,t,n)}},{key:\"find\",value:function(e,t){return\"string\"!=typeof e||0===e.length||\"function\"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.outputWarning(\"ListenerFnNotFound\",e),null)}},{key:\"delete\",value:function(e,t){return\"function\"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:\"_pack\",value:function(e,t,n){var o=this;return function(){try{t.apply(n,Array.from(arguments))}catch(u){var s=Object.values(E).indexOf(e),a=\"CallbackError\";if(-1!==s){var r=Object.keys(E)[s];o._m.outputWarning(a,r,u)}var i=new ka(a);i.setMessage(\"eventName:\".concat(e)).setMoreMessage(u.message).end()}}}}]),e}(),lu=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||\"\",oversea:t.oversea||!1,instanceID:Rt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0};this._m=new uu(n),this._safetyCallbackFactory=new cu(this._m)}return a(e,[{key:\"onError\",value:function(e){this._m.onError(e)}},{key:\"login\",value:function(e){return this._m.login(),this._getModule(An).login(e)}},{key:\"logout\",value:function(){var e=this;return this._getModule(An).logout().then((function(t){return e._m.reset(),t}))}},{key:\"isReady\",value:function(){return this._m.isReady()}},{key:\"isIntl\",value:function(){return this._m.isIntl()}},{key:\"getNotReadyReason\",value:function(){return this._m.getNotReadyReason()}},{key:\"getErrorMessage\",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:\"_getModule\",value:function(e){return this._m.getModule(e)}},{key:\"destroy\",value:function(){var e=this;return this.logout().finally((function(){e._m.stopTimer(),e._getModule(Qn).terminate(),e._getModule(zn).dealloc();var t=e._m.getOuterEmitterInstance(),n=e._getModule(qn);t.emit(E.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:\"on\",value:function(e,t,n){xe.d(\"on\",\"eventName:\".concat(e)),this._m.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:\"once\",value:function(e,t,n){xe.d(\"once\",\"eventName:\".concat(e)),this._m.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:\"off\",value:function(e,t,n,o){xe.d(\"off\",\"eventName:\".concat(e));var s=this._safetyCallbackFactory.find(e,t);null!==s&&(this._m.getOuterEmitterInstance().off(e,s,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:\"registerPlugin\",value:function(e){at(e[\"tim-offline-push-plugin\"])?this._getModule(Wn).registerPlugin(e):this._getModule(to).registerPlugin(e)}},{key:\"setLogLevel\",value:function(e){if(e<=0){var t=this.getErrorMessage(\"TIM_ASCII_ART\");t&&console.log(t);var n=this.getErrorMessage(\"API_REFER\");if(n){Ht()?console.log(\"%c \".concat(\"IM SDK API ->\",\" %c\"),\"background:#ff9d00; padding:1px; border-radius:3px; color: #fff\",\"background:transparent\",n):console.log(\"IM SDK API ->\",n)}var o=this.getErrorMessage(\"DOCS_GUIDE\");o&&console.log(o)}xe.setLevel(e)}},{key:\"createTextMessage\",value:function(e){return this._getModule(Rn).createTextMessage(e)}},{key:\"createTextAtMessage\",value:function(e){return this._getModule(Rn).createTextMessage(e)}},{key:\"createImageMessage\",value:function(e){return this._getModule(Rn).createImageMessage(e)}},{key:\"createAudioMessage\",value:function(e){return this._getModule(Rn).createAudioMessage(e)}},{key:\"createVideoMessage\",value:function(e){return this._getModule(Rn).createVideoMessage(e)}},{key:\"createCustomMessage\",value:function(e){return this._getModule(Rn).createCustomMessage(e)}},{key:\"createFaceMessage\",value:function(e){return this._getModule(Rn).createFaceMessage(e)}},{key:\"createFileMessage\",value:function(e){return this._getModule(Rn).createFileMessage(e)}},{key:\"createLocationMessage\",value:function(e){return this._getModule(Rn).createLocationMessage(e)}},{key:\"createMergerMessage\",value:function(e){return this._getModule(Rn).createMergerMessage(e)}},{key:\"downloadMergerMessage\",value:function(e){return e.type!==S.MSG_MERGER?Ja({code:da.MESSAGE_MERGER_TYPE_INVALID}):jt(e.payload.downloadKey)?Ja({code:da.MESSAGE_MERGER_KEY_INVALID}):this._getModule(Rn).downloadMergerMessage(e).catch((function(e){return Ja({code:da.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:\"createForwardMessage\",value:function(e){return this._getModule(Rn).createForwardMessage(e)}},{key:\"sendMessage\",value:function(e,t){return e instanceof Ha?this._getModule(Rn).sendMessageInstance(e,t):Ja({code:da.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:\"callExperimentalAPI\",value:function(e,t){return\"sendComboMessage\"===e?this._getModule(so).sendMessage(t):\"handleGroupInvitation\"===e?this._getModule(Un).handleGroupInvitation(t):\"isCommercialAbilityEnabled\"===e?this._getModule(eo).isFeatureEnabled(t):\"isIntl\"===e?this.isIntl():\"sendTRTCCustomData\"===e?this._getModule(oo).sendTRTCCustomData(t):\"getTimerID\"===e?this._m.getTimerID():\"getPollingTimerID\"===e?this._m.getPollingTimerID(t):Ja({code:da.INVALID_OPERATION})}},{key:\"revokeMessage\",value:function(e){return this._getModule(Rn).revokeMessage(e)}},{key:\"resendMessage\",value:function(e){return this._getModule(Rn).resendMessage(e)}},{key:\"deleteMessage\",value:function(e){return this._getModule(Rn).deleteMessage(e)}},{key:\"translateText\",value:function(e){return this._getModule(Rn).translateText(e)}},{key:\"setMessageExtensions\",value:function(e,t){return this._getModule(Nn).setMessageExtensions(e,t)}},{key:\"getMessageExtensions\",value:function(e){return this._getModule(Nn).getMessageExtensions(e)}},{key:\"deleteMessageExtensions\",value:function(e,t){return this._getModule(Nn).deleteMessageExtensions(e,t)}},{key:\"modifyMessage\",value:function(e){return this._getModule(Rn).modifyRemoteMessage(e)}},{key:\"getMessageList\",value:function(e){return this._getModule(Fn).getMessageList(e)}},{key:\"getMessageListHopping\",value:function(e){return this._getModule(Fn).getMessageListHopping(e)}},{key:\"sendMessageReadReceipt\",value:function(e){return this._getModule(Fn).sendReadReceipt(e)}},{key:\"getMessageReadReceiptList\",value:function(e){return this._getModule(Fn).getReadReceiptList(e)}},{key:\"getGroupMessageReadMemberList\",value:function(e){return this._getModule(Un).getReadReceiptDetail(e)}},{key:\"findMessage\",value:function(e){return this._getModule(Fn).findMessage(e)}},{key:\"setMessageRead\",value:function(e){return this._getModule(Fn).setMessageRead(e)}},{key:\"getConversationList\",value:function(e){return this._getModule(Fn).getConversationList(e)}},{key:\"getConversationProfile\",value:function(e){return this._getModule(Fn).getConversationProfile(e)}},{key:\"deleteConversation\",value:function(e){return this._getModule(Fn).deleteConversation(e)}},{key:\"clearHistoryMessage\",value:function(e){return this._getModule(Fn).clearHistoryMessage(e)}},{key:\"pinConversation\",value:function(e){return this._getModule(Fn).pinConversation(e)}},{key:\"setAllMessageRead\",value:function(e){return this._getModule(Fn).setAllMessageRead(e)}},{key:\"setMessageRemindType\",value:function(e){return this._getModule(Fn).setMessageRemindType(e)}},{key:\"getTotalUnreadMessageCount\",value:function(){return this._getModule(Fn).getTotalUnreadMessageCount()}},{key:\"setConversationCustomData\",value:function(e){return this._getModule(Fn).setConversationCustomData(e)}},{key:\"markConversation\",value:function(e){return this._getModule(Fn).markConversation(e)}},{key:\"getConversationGroupList\",value:function(){return this._getModule(Fn).getConversationGroupList()}},{key:\"createConversationGroup\",value:function(e){return this._getModule(Fn).createConversationGroup(e)}},{key:\"deleteConversationGroup\",value:function(e){return this._getModule(Fn).deleteConversationGroup(e)}},{key:\"renameConversationGroup\",value:function(e){return this._getModule(Fn).renameConversationGroup(e)}},{key:\"addConversationsToGroup\",value:function(e){return this._getModule(Fn).addConversationsToGroup(e)}},{key:\"deleteConversationsFromGroup\",value:function(e){return this._getModule(Fn).deleteConversationsFromGroup(e)}},{key:\"getMyProfile\",value:function(){return this._getModule(On).getMyProfile()}},{key:\"getUserProfile\",value:function(e){return this._getModule(On).getUserProfile(e)}},{key:\"updateMyProfile\",value:function(e){return this._getModule(On).updateMyProfile(e)}},{key:\"getBlacklist\",value:function(){return this._getModule(On).getLocalBlacklist()}},{key:\"addToBlacklist\",value:function(e){return this._getModule(On).addBlacklist(e)}},{key:\"removeFromBlacklist\",value:function(e){return this._getModule(On).deleteBlacklist(e)}},{key:\"setSelfStatus\",value:function(e){return this._getModule(On).setSelfStatus(e)}},{key:\"getUserStatus\",value:function(e){return this._getModule(On).getUserStatus(e)}},{key:\"subscribeUserStatus\",value:function(e){return this._getModule(On).subscribeUserStatus(e)}},{key:\"unsubscribeUserStatus\",value:function(e){return this._getModule(On).unsubscribeUserStatus(e)}},{key:\"getFriendList\",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"addFriend\",value:function(e){var t=this._getModule(Pn);return t?t.addFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"deleteFriend\",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"checkFriend\",value:function(e){var t=this._getModule(Pn);return t?t.checkFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getFriendProfile\",value:function(e){var t=this._getModule(Pn);return t?t.getFriendProfile(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"updateFriend\",value:function(e){var t=this._getModule(Pn);return t?t.updateFriend(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getFriendApplicationList\",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendApplicationList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"acceptFriendApplication\",value:function(e){var t=this._getModule(Pn);return t?t.acceptFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"refuseFriendApplication\",value:function(e){var t=this._getModule(Pn);return t?t.refuseFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"deleteFriendApplication\",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriendApplication(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"setFriendApplicationRead\",value:function(){var e=this._getModule(Pn);return e?e.setFriendApplicationRead():Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getFriendGroupList\",value:function(){var e=this._getModule(Pn);return e?e.getLocalFriendGroupList():Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"createFriendGroup\",value:function(e){var t=this._getModule(Pn);return t?t.createFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"deleteFriendGroup\",value:function(e){var t=this._getModule(Pn);return t?t.deleteFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"addToFriendGroup\",value:function(e){var t=this._getModule(Pn);return t?t.addToFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"removeFromFriendGroup\",value:function(e){var t=this._getModule(Pn);return t?t.removeFromFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"renameFriendGroup\",value:function(e){var t=this._getModule(Pn);return t?t.renameFriendGroup(e):Ja({code:da.CANNOT_FIND_MODULE})}},{key:\"getGroupList\",value:function(e){return this._getModule(Un).getGroupList(e)}},{key:\"getGroupProfile\",value:function(e){return this._getModule(Un).getGroupProfile(e)}},{key:\"createGroup\",value:function(e){return this._getModule(Un).createGroup(e)}},{key:\"dismissGroup\",value:function(e){return this._getModule(Un).dismissGroup(e)}},{key:\"updateGroupProfile\",value:function(e){return this._getModule(Un).updateGroupProfile(e)}},{key:\"joinGroup\",value:function(e){return this._getModule(Un).joinGroup(e)}},{key:\"quitGroup\",value:function(e){return this._getModule(Un).quitGroup(e)}},{key:\"searchGroupByID\",value:function(e){return this._getModule(Un).searchGroupByID(e)}},{key:\"getGroupOnlineMemberCount\",value:function(e){return this._getModule(Un).getGroupOnlineMemberCount(e)}},{key:\"changeGroupOwner\",value:function(e){return this._getModule(Un).changeGroupOwner(e)}},{key:\"getGroupApplicationList\",value:function(){return this._getModule(Un).getGroupApplicationList()}},{key:\"handleGroupApplication\",value:function(e){return this._getModule(Un).handleGroupApplication(e)}},{key:\"initGroupAttributes\",value:function(e){return this._getModule(Un).initGroupAttributes(e)}},{key:\"setGroupAttributes\",value:function(e){return this._getModule(Un).setGroupAttributes(e)}},{key:\"deleteGroupAttributes\",value:function(e){return this._getModule(Un).deleteGroupAttributes(e)}},{key:\"getGroupAttributes\",value:function(e){return this._getModule(Un).getGroupAttributes(e)}},{key:\"setGroupCounters\",value:function(e){return this._getModule(Un).setGroupCounters(e)}},{key:\"increaseGroupCounter\",value:function(e){return this._getModule(Un).increaseGroupCounter(e)}},{key:\"decreaseGroupCounter\",value:function(e){return this._getModule(Un).decreaseGroupCounter(e)}},{key:\"getGroupCounters\",value:function(e){return this._getModule(Un).getGroupCounters(e)}},{key:\"getGroupMemberList\",value:function(e){return this._getModule(bn).getGroupMemberList(e)}},{key:\"getGroupMemberProfile\",value:function(e){return this._getModule(bn).getGroupMemberProfile(e)}},{key:\"addGroupMember\",value:function(e){return this._getModule(bn).addGroupMember(e)}},{key:\"deleteGroupMember\",value:function(e){return this._getModule(bn).deleteGroupMember(e)}},{key:\"setGroupMemberMuteTime\",value:function(e){return this._getModule(bn).setGroupMemberMuteTime(e)}},{key:\"setGroupMemberRole\",value:function(e){return this._getModule(bn).setGroupMemberRole(e)}},{key:\"setGroupMemberNameCard\",value:function(e){return this._getModule(bn).setGroupMemberNameCard(e)}},{key:\"setGroupMemberCustomField\",value:function(e){return this._getModule(bn).setGroupMemberCustomField(e)}},{key:\"markGroupMemberList\",value:function(e){return this._getModule(bn).markGroupMemberList(e)}},{key:\"getJoinedCommunityList\",value:function(){return this._getModule(wn).getJoinedCommunityList()}},{key:\"createTopicInCommunity\",value:function(e){return this._getModule(wn).createTopicInCommunity(e)}},{key:\"deleteTopicFromCommunity\",value:function(e){return this._getModule(wn).deleteTopicFromCommunity(e)}},{key:\"updateTopicProfile\",value:function(e){return this._getModule(wn).updateTopicProfile(e)}},{key:\"getTopicList\",value:function(e){return this._getModule(wn).getTopicList(e)}}]),e}(),pu={login:1,logout:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1};function du(e,t){if(e.isReady()||1===pu[t])return!0;var n=e.getNotReadyReason(),o={code:n,message:\"\".concat(e.getErrorMessage(n),\" | \").concat(t,\" | \").concat(e.getErrorMessage(da.SDK_IS_NOT_READY))};return e.onError(o),o}var gu={},_u={};return _u.create=function(e){var n=0,o=e.SDKAppID;if($e(o))n=o;else if(n=parseInt(o),isNaN(o))return xe.e(\"\".concat(\"TIM.create\",\" failed. Failed to parse the SDKAppID, please check the arguments\")),null;if(n&&gu[n])return gu[n];xe.l(\"\".concat(\"TIM.create\"));var s=new lu(t(t({},e),{},{SDKAppID:n}));s.on(E.SDK_DESTROY,(function(e){gu[e.data.SDKAppID]=null,delete gu[e.data.SDKAppID]}));var a=function(e){var t=Object.create(null);return Object.keys(Ln).forEach((function(n){if(e[n]){var o=new k;t[n]=function(){var t=Array.from(arguments);return o.use((function(t,o){var s=du(e,n);return!0===s?o():Ja(s)})).use((function(e,t){if(!0===zt(e,kn[n],n))return t()})).use((function(t,o){return e[n].apply(e,t)})),o.run(t)}}})),t}(s);return gu[n]=a,kn.hookGetAPITips(s.getErrorMessage.bind(s)),xe.l(\"\".concat(\"TIM.create\",\" ok\")),a},_u.TYPES=S,_u.EVENT=E,_u.VERSION=\"2.27.5\",xe.l(\"TIM.VERSION:\".concat(_u.VERSION)),_u}));\n"]} \ No newline at end of file diff --git a/TUICallKit/min-npm/trtc-wx-sdk/index.js b/TUICallKit/min-npm/trtc-wx-sdk/index.js index 7a20ce6..3384e6e 100644 --- a/TUICallKit/min-npm/trtc-wx-sdk/index.js +++ b/TUICallKit/min-npm/trtc-wx-sdk/index.js @@ -4,12 +4,12 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1704939160519, function(require, module, exports) { -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TRTC=t()}(this,(function(){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r4294967296)?(h.error("roomID 超出取值范围 1 ~ 4294967295"),!1):e.strRoomID&&t.test(e.strRoomID)?(h.error("strRoomID 请勿使用中文字符"),!1):e.userID?e.userID&&t.test(e.userID)?(h.error("userID 请勿使用中文字符"),!1):!!e.userSig||(h.error("未设置 userSig"),!1):(h.error("未设置 userID"),!1):(h.error("未设置 sdkAppID"),!1)},v={LOCAL_JOIN:"LOCAL_JOIN",LOCAL_LEAVE:"LOCAL_LEAVE",KICKED_OUT:"KICKED_OUT",REMOTE_USER_JOIN:"REMOTE_USER_JOIN",REMOTE_USER_LEAVE:"REMOTE_USER_LEAVE",REMOTE_VIDEO_ADD:"REMOTE_VIDEO_ADD",REMOTE_VIDEO_REMOVE:"REMOTE_VIDEO_REMOVE",REMOTE_AUDIO_ADD:"REMOTE_AUDIO_ADD",REMOTE_AUDIO_REMOVE:"REMOTE_AUDIO_REMOVE",REMOTE_STATE_UPDATE:"REMOTE_STATE_UPDATE",LOCAL_NET_STATE_UPDATE:"LOCAL_NET_STATE_UPDATE",REMOTE_NET_STATE_UPDATE:"REMOTE_NET_STATE_UPDATE",LOCAL_AUDIO_VOLUME_UPDATE:"LOCAL_AUDIO_VOLUME_UPDATE",REMOTE_AUDIO_VOLUME_UPDATE:"REMOTE_AUDIO_VOLUME_UPDATE",VIDEO_FULLSCREEN_UPDATE:"VIDEO_FULLSCREEN_UPDATE",BGM_PLAY_START:"BGM_PLAY_START",BGM_PLAY_FAIL:"BGM_PLAY_FAIL",BGM_PLAY_PROGRESS:"BGM_PLAY_PROGRESS",BGM_PLAY_COMPLETE:"BGM_PLAY_COMPLETE",ERROR:"ERROR",IM_READY:"IM_READY",IM_MESSAGE_RECEIVED:"IM_MESSAGE_RECEIVED",IM_NOT_READY:"IM_NOT_READY",IM_KICKED_OUT:"IM_KICKED_OUT",IM_ERROR:"IM_ERROR"},g={url:"",mode:"RTC",autopush:!1,enableCamera:!1,enableMic:!1,enableAgc:!1,enableAns:!1,enableEarMonitor:!1,enableAutoFocus:!0,enableZoom:!1,minBitrate:600,maxBitrate:900,videoWidth:360,videoHeight:640,beautyLevel:0,whitenessLevel:0,videoOrientation:"vertical",videoAspect:"9:16",frontCamera:"front",enableRemoteMirror:!1,localMirror:"auto",enableBackgroundMute:!1,audioQuality:"high",audioVolumeType:"voicecall",audioReverbType:0,waitingImage:"",waitingImageHash:"",beautyStyle:"smooth",filter:"",netStatus:{}},f={src:"",mode:"RTC",autoplay:!0,muteAudio:!0,muteVideo:!0,orientation:"vertical",objectFit:"fillCrop",enableBackgroundMute:!1,minCache:1,maxCache:2,soundMode:"speaker",enableRecvMessage:!1,autoPauseIfNavigate:!0,autoPauseIfOpenNative:!0,isVisible:!0,_definitionType:"main",netStatus:{}};(new Date).getTime();function d(){var e=new Date;return e.setTime((new Date).getTime()+0),e.toLocaleString()}var E=function(e){var t=[];if(e&&e.TUIScene&&t.push(e.TUIScene),e&&"test"===e.env)return"default";if(wx&&wx.TUIScene&&t.push(wx.TUIScene),wx&&"function"==typeof getApp){var r=getApp().globalData;r&&r.TUIScene&&t.push(r.TUIScene)}return wx&&wx.getStorage({key:"TUIScene",success:function(e){t.push(e.data)}}),t[0]||"default"},A=new(function(){function e(){t(this,e),this.sdkAppId="",this.userId="",this.version="",this.common={}}return s(e,[{key:"setConfig",value:function(e){this.sdkAppId="".concat(e.sdkAppId),this.userId="".concat(e.userId),this.version="".concat(e.version),this.common.TUIScene=E(e)}},{key:"log",value:function(e){wx.request({url:"https://yun.tim.qq.com/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log",method:"POST",header:{"content-type":"application/json"},data:{timestamp:d(),sdkAppId:this.sdkAppId,userId:this.userId,version:this.version,log:JSON.stringify(n(n({},e),this.common))}})}}]),e}()),I="enterRoom",_="exitRoom",L="setPusherAttributes",b="setPlayerAttributes",T="init",D="error",O="connectServer",k="startPusher",S="openCamera",P="screenCap",R="pusherResolution",M="pusherCodeRate",U="collectionFirstFrame",C="encoderStart",x="enterRoomSuccess",w="exitRoomSuccess",V="kicked_out",B="renderFirstFrame",G="miniAppHang",j="closeSuspension",N="other",F="update",H="addUser",K="remove_user",Y="update_user_video",q="update_user_audio",J="pusherStart",W="pusherStop",Q="pusherPause",X="pusherResume",Z=function(){function r(e,s){t(this,r),this.context=wx.createLivePusherContext(s),this.pusherAttributes={},Object.assign(this.pusherAttributes,g,e)}return s(r,[{key:"setPusherAttributes",value:function(e){return Object.assign(this.pusherAttributes,e),this.pusherAttributes}},{key:"start",value:function(e){h.log("[apiLog][pusherStart]"),A.log({name:J,options:e}),this.context.start(e)}},{key:"stop",value:function(e){h.log("[apiLog][pusherStop]"),A.log({name:W,options:e}),this.context.stop(e)}},{key:"pause",value:function(e){h.log("[apiLog] pusherPause()"),A.log({name:Q,options:e}),this.context.pause(e)}},{key:"resume",value:function(e){h.log("[apiLog][pusherResume]"),A.log({name:X,options:e}),this.context.resume(e)}},{key:"switchCamera",value:function(e){return h.log("[apiLog][switchCamera]"),this.pusherAttributes.frontCamera="front"===this.pusherAttributes.frontCamera?"back":"front",this.context.switchCamera(e),this.pusherAttributes}},{key:"sendMessage",value:function(e){h.log("[apiLog][sendMessage]",e.msg),this.context.sendMessage(e)}},{key:"snapshot",value:function(){var e=this;return h.log("[apiLog][pusherSnapshot]"),new Promise((function(t,r){e.context.snapshot({quality:"raw",complete:function(e){e.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:e.tempImagePath,success:function(r){t(e)},fail:function(e){h.error("[error] pusher截图失败: ",e),r(new Error("截图失败"))}}),t(e)):(h.error("[error] snapShot 回调失败",e),r(new Error("截图失败")))}})}))}},{key:"toggleTorch",value:function(e){this.context.toggleTorch(e)}},{key:"startDumpAudio",value:function(e){this.context.startDumpAudio(e)}},{key:"stopDumpAudio",value:function(e){this.context.startDumpAudio(e)}},{key:"playBGM",value:function(e){h.log("[apiLog] playBGM() url: ",e.url),this.context.playBGM(e)}},{key:"pauseBGM",value:function(e){h.log("[apiLog] pauseBGM()"),this.context.pauseBGM(e)}},{key:"resumeBGM",value:function(e){h.log("[apiLog] resumeBGM()"),this.context.resumeBGM(e)}},{key:"stopBGM",value:function(e){h.log("[apiLog] stopBGM()"),this.context.stopBGM(e)}},{key:"setBGMVolume",value:function(t){h.log("[apiLog] setBGMVolume() volume:",t),t&&t.volume&&"object"===e(t.volume)&&t.volume.volume?this.context.setBGMVolume(t.volume):this.context.setBGMVolume(t)}},{key:"setMICVolume",value:function(t){h.log("[apiLog] setMICVolume() volume:",t),t&&t.volume&&"object"===e(t.volume)&&t.volume.volume?this.context.setMICVolume(t.volume):this.context.setMICVolume(t)}},{key:"startPreview",value:function(e){h.log("[apiLog] startPreview()"),this.context.startPreview(e)}},{key:"stopPreview",value:function(e){h.log("[apiLog] stopPreview()"),this.context.stopPreview(e)}},{key:"reset",value:function(){return console.log("Pusher reset",this.context),this.pusherConfig={},this.context&&(this.stop({success:function(){console.log("Pusher context.stop()")}}),this.context=null),this.pusherAttributes}}]),r}(),z=function e(r){t(this,e),Object.assign(this,{userID:"",streams:{}},r)},$=function(){function e(r,s){t(this,e),this.ctx=s,this.playerAttributes=this.getInitPlayerAttributes(r)}return s(e,[{key:"play",value:function(e){this.getPlayerContext().play(e)}},{key:"stop",value:function(e){this.getPlayerContext().stop(e)}},{key:"mute",value:function(e){this.getPlayerContext().mute(e)}},{key:"pause",value:function(e){this.getPlayerContext().pause(e)}},{key:"resume",value:function(e){this.getPlayerContext().resume(e)}},{key:"requestFullScreen",value:function(e){var t=this;return new Promise((function(r,s){t.getPlayerContext().requestFullScreen({direction:e.direction,success:function(e){r(e)},fail:function(e){s(e)}})}))}},{key:"requestExitFullScreen",value:function(){var e=this;return new Promise((function(t,r){e.getPlayerContext().exitFullScreen({success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:"snapshot",value:function(e){var t=this;return h.log("[playerSnapshot]",e),new Promise((function(e,r){t.getPlayerContext().snapshot({quality:"raw",complete:function(t){t.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:t.tempImagePath,success:function(r){h.log("save photo is success",r),e(t)},fail:function(e){h.error("save photo is fail",e),r(e)}}),e(t)):(h.error("snapShot 回调失败",t),r(new Error("截图失败")))}})}))}},{key:"setPlayerAttributes",value:function(e){this.playerAttributes=Object.assign({},this.playerAttributes,e)}},{key:"getPlayerContext",value:function(){return this.playerContext||(this.playerContext=wx.createLivePlayerContext(this.playerAttributes.id,this.ctx)),this.playerContext}},{key:"reset",value:function(){this.playerContext&&(this.playerContext.stop(),this.playerContext=void 0),this.playerAttributes=this.getInitPlayerAttributes()}},{key:"getInitPlayerAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},f,{userID:"",streamType:"",streamID:"",id:"",hasVideo:!1,hasAudio:!1,volume:0,playerContext:void 0},e)}}]),e}(),ee="UserController",te=function(){function e(r,s){t(this,e),this.ctx=s,this.userMap=new Map,this.userList=[],this.streamList=[],this.emitter=r}return s(e,[{key:"userEventHandler",value:function(e){var t=e.detail.code,r=e.detail.message,s={name:N,code:t,message:r,data:""};switch(t){case 0:h.log(r,t);break;case 1001:h.log("已经连接推流服务器",t),s.name=O;break;case 1002:h.log("已经与服务器握手完毕,开始推流",t),s.name=k;break;case 1003:h.log("打开摄像头成功",t),s.name=S;break;case 1004:h.log("录屏启动成功",t),s.name=P;break;case 1005:h.log("推流动态调整分辨率",t),s.name=R;break;case 1006:h.log("推流动态调整码率",t),s.name=M;break;case 1007:h.log("首帧画面采集完成",t),s.name=U;break;case 1008:h.log("编码器启动",t),s.name=C;break;case 1018:h.log("进房成功",t),s.name=x,s.data="event enterRoom success",this.emitter.emit(v.LOCAL_JOIN);break;case 1019:h.log("退出房间",t),r.indexOf("reason[0]")>-1?(s.name=w,s.data="event exitRoom success"):(s.name=V,s.data="event abnormal exitRoom",this.emitter.emit(v.KICKED_OUT));break;case 2003:h.log("渲染首帧视频",t),s.name=B;break;case-1301:h.error("打开摄像头失败: ",t),s.name=D,s.data="event start camera failed",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1302:s.name=D,s.data="event start microphone failed",h.error("打开麦克风失败: ",t),this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1303:h.error("视频编码失败: ",t),s.name=D,s.data="event video encode failed",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1304:h.error("音频编码失败: ",t),s.name=D,s.data="event audio encode failed",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1307:h.error("推流连接断开: ",t),s.name=D,s.data="event pusher stream failed",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-100018:h.error("进房失败: userSig 校验失败,请检查 userSig 是否填写正确",t,r),s.name=D,s.data="event userSig is error",this.emitter.emit(v.ERROR,{code:t,message:r});break;case 5e3:h.log("小程序被挂起: ",t),s.name=G,s.data="miniApp is hang";break;case 5001:h.log("小程序悬浮窗被关闭: ",t),s.name=j;break;case 1021:h.log("网络类型发生变化,需要重新进房",t);break;case 2007:h.log("本地视频播放loading: ",t);break;case 2004:h.log("本地视频播放开始: ",t);break;case 1031:case 1032:case 1033:case 1034:this._handleUserEvent(e)}A.log(s)}},{key:"_handleUserEvent",value:function(e){var t,r=e.detail.code,s=e.detail.message;if(!e.detail.message||"string"!=typeof s)return h.warn(ee,"userEventHandler 数据格式错误"),!1;try{t=JSON.parse(e.detail.message)}catch(e){return h.warn(ee,"userEventHandler 数据格式错误",e),!1}switch(this.emitter.emit(v.LOCAL_STATE_UPDATE,e),A.log({name:F,code:r,message:s,data:t}),r){case 1031:this.addUser(t);break;case 1032:this.removeUser(t);break;case 1033:this.updateUserVideo(t);break;case 1034:this.updateUserAudio(t)}}},{key:"addUser",value:function(e){var t=this;h.log("addUser",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s||(s=new z({userID:r}),t.userList.push({userID:r})),t.userMap.set(r,s),t.emitter.emit(v.REMOTE_USER_JOIN,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:H,userID:r,userList:t.userList,playerList:t.getPlayerList()})}))}},{key:"removeUser",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s&&s.streams&&(t._removeUserAndStream(r),s.streams.main&&s.streams.main.reset(),s.streams.aux&&s.streams.aux.reset(),t.emitter.emit(v.REMOTE_USER_LEAVE,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:K,userID:r,userList:t.userList,playerList:t.getPlayerList()}),s=void 0,t.userMap.delete(r))}))}},{key:"updateUserVideo",value:function(e){var t=this;h.log(ee,"updateUserVideo",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=e.streamtype,a="".concat(r,"_").concat(s),i=a,n=e.hasvideo,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams[s];h.log(ee,"updateUserVideo start",u,s,l),l?(l.setPlayerAttributes({hasVideo:n}),n||l.playerAttributes.hasAudio||t._removeStream(l)):(l=new $({userID:r,streamID:a,hasVideo:n,src:o,streamType:s,id:i},t.ctx),u.streams[s]=l,t._addStream(l)),"aux"===s&&(n?(l.setPlayerAttributes({objectFit:"contain",muteAudio:!1}),t._addStream(l)):t._removeStream(l)),t.userList.find((function(e){if(e.userID===r)return e["has".concat(s.replace(/^\S/,(function(e){return e.toUpperCase()})),"Video")]=n,!0})),h.log(ee,"updateUserVideo end",u,s,l);var c=n?v.REMOTE_VIDEO_ADD:v.REMOTE_VIDEO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:Y,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:"updateUserAudio",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s="main",a="".concat(r,"_").concat(s),i=a,n=e.hasaudio,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams.main;l?(l.setPlayerAttributes({hasAudio:n}),n||l.playerAttributes.hasVideo||t._removeStream(l)):(l=new $({userID:r,streamID:a,hasAudio:n,src:o,streamType:s,id:i},t.ctx),u.streams.main=l,t._addStream(l)),t.userList.find((function(e){if(e.userID===r)return e["has".concat(s.replace(/^\S/,(function(e){return e.toUpperCase()})),"Audio")]=n,!0}));var c=n?v.REMOTE_AUDIO_ADD:v.REMOTE_AUDIO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:q,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:"getUser",value:function(e){return this.userMap.get(e)}},{key:"getStream",value:function(e){var t=e.userID,r=e.streamType,s=this.userMap.get(t);if(s)return s.streams[r]}},{key:"getUserList",value:function(){return this.userList}},{key:"getStreamList",value:function(){return this.streamList}},{key:"getPlayerList",value:function(){return this.getStreamList().map((function(e){return Object.assign({},e.playerAttributes)}))}},{key:"reset",value:function(){return this.streamList.forEach((function(e){e.reset()})),this.streamList=[],this.userList=[],this.userMap.clear(),{userList:this.userList,streamList:this.streamList}}},{key:"_removeUserAndStream",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e&&""!==t.playerAttributes.userID})),this.userList=this.userList.filter((function(t){return t.userID!==e}))}},{key:"_addStream",value:function(e){-1===this.streamList.findIndex((function(t){return t.playerAttributes.userID===e.playerAttributes.userID&&t.playerAttributes.streamType===e.playerAttributes.streamType}))&&this.streamList.push(e)}},{key:"_removeStream",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e.playerAttributes.userID||t.playerAttributes.streamType!==e.playerAttributes.streamType})),this.getUser(e.playerAttributes.userID).streams[e.playerAttributes.streamType]=void 0}}]),e}(),re=function(){function e(){t(this,e)}return s(e,[{key:"on",value:function(e,t,r){"function"==typeof t?(this._stores=this._stores||{},(this._stores[e]=this._stores[e]||[]).push({cb:t,ctx:r})):console.error("listener must be a function")}},{key:"emit",value:function(e){this._stores=this._stores||{};var t,r=this._stores[e];if(r){r=r.slice(0),(t=[].slice.call(arguments,1))[0]={eventCode:e,data:t[0]};for(var s=0,a=r.length;s4294967296)?(h.error("roomID 超出取值范围 1 ~ 4294967295"),!1):e.strRoomID&&t.test(e.strRoomID)?(h.error("strRoomID 请勿使用中文字符"),!1):e.userID?e.userID&&t.test(e.userID)?(h.error("userID 请勿使用中文字符"),!1):!!e.userSig||(h.error("未设置 userSig"),!1):(h.error("未设置 userID"),!1):(h.error("未设置 sdkAppID"),!1)},g={LOCAL_JOIN:"LOCAL_JOIN",LOCAL_LEAVE:"LOCAL_LEAVE",KICKED_OUT:"KICKED_OUT",REMOTE_USER_JOIN:"REMOTE_USER_JOIN",REMOTE_USER_LEAVE:"REMOTE_USER_LEAVE",REMOTE_VIDEO_ADD:"REMOTE_VIDEO_ADD",REMOTE_VIDEO_REMOVE:"REMOTE_VIDEO_REMOVE",REMOTE_AUDIO_ADD:"REMOTE_AUDIO_ADD",REMOTE_AUDIO_REMOVE:"REMOTE_AUDIO_REMOVE",REMOTE_STATE_UPDATE:"REMOTE_STATE_UPDATE",LOCAL_NET_STATE_UPDATE:"LOCAL_NET_STATE_UPDATE",REMOTE_NET_STATE_UPDATE:"REMOTE_NET_STATE_UPDATE",LOCAL_AUDIO_VOLUME_UPDATE:"LOCAL_AUDIO_VOLUME_UPDATE",REMOTE_AUDIO_VOLUME_UPDATE:"REMOTE_AUDIO_VOLUME_UPDATE",VIDEO_FULLSCREEN_UPDATE:"VIDEO_FULLSCREEN_UPDATE",BGM_PLAY_START:"BGM_PLAY_START",BGM_PLAY_FAIL:"BGM_PLAY_FAIL",BGM_PLAY_PROGRESS:"BGM_PLAY_PROGRESS",BGM_PLAY_COMPLETE:"BGM_PLAY_COMPLETE",ERROR:"ERROR",IM_READY:"IM_READY",IM_MESSAGE_RECEIVED:"IM_MESSAGE_RECEIVED",IM_NOT_READY:"IM_NOT_READY",IM_KICKED_OUT:"IM_KICKED_OUT",IM_ERROR:"IM_ERROR"},f={url:"",mode:"RTC",autopush:!1,enableCamera:!1,enableMic:!1,enableAgc:!1,enableAns:!1,enableEarMonitor:!1,enableAutoFocus:!0,enableZoom:!1,minBitrate:600,maxBitrate:900,videoWidth:360,videoHeight:640,beautyLevel:0,whitenessLevel:0,videoOrientation:"vertical",videoAspect:"9:16",frontCamera:"front",enableRemoteMirror:!1,localMirror:"auto",enableBackgroundMute:!1,audioQuality:"high",audioVolumeType:"voicecall",audioReverbType:0,waitingImage:"",waitingImageHash:"",beautyStyle:"smooth",filter:"",netStatus:{}},d={src:"",mode:"RTC",autoplay:!0,muteAudio:!1,muteVideo:!1,orientation:"vertical",objectFit:"fillCrop",enableBackgroundMute:!1,minCache:1,maxCache:2,soundMode:"speaker",enableRecvMessage:!1,autoPauseIfNavigate:!0,autoPauseIfOpenNative:!0,isVisible:!0,_definitionType:"main",netStatus:{}};(new Date).getTime();function E(){var e=new Date;return e.setTime((new Date).getTime()+0),e.toLocaleString()}var A=function(e){var t=[];if(e&&e.TUIScene&&t.push(e.TUIScene),e&&"test"===e.env)return"default";if(wx&&wx.TUIScene&&t.push(wx.TUIScene),wx&&"function"==typeof getApp){var r=getApp().globalData;r&&r.TUIScene&&t.push(r.TUIScene)}return wx&&wx.getStorage({key:"TUIScene",success:function(e){t.push(e.data)}}),t[0]||"default"},I=new(function(){function e(){t(this,e),this.sdkAppId="",this.userId="",this.version="",this.common={}}return s(e,[{key:"setConfig",value:function(e){this.sdkAppId="".concat(e.sdkAppId),this.userId="".concat(e.userId),this.version="".concat(e.version),this.common.TUIScene=A(e)}},{key:"log",value:function(e){wx.request({url:"https://yun.tim.qq.com/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log",method:"POST",header:{"content-type":"application/json"},data:{timestamp:E(),sdkAppId:this.sdkAppId,userId:this.userId,version:this.version,log:JSON.stringify(n(n({},e),this.common))}})}}]),e}()),L="enterRoom",_="exitRoom",b="setPusherAttributes",T="setPlayerAttributes",D="init",O="error",S="connectServer",k="startPusher",R="openCamera",P="screenCap",M="pusherResolution",U="pusherCodeRate",C="collectionFirstFrame",x="encoderStart",w="enterRoomSuccess",V="exitRoomSuccess",B="kicked_out",G="renderFirstFrame",N="miniAppHang",j="closeSuspension",F="other",H="update",K="addUser",Y="remove_user",q="update_user_video",J="update_user_audio",W="pusherStart",Q="pusherStop",X="pusherPause",Z="pusherResume",z=function(){function r(e,s){t(this,r),this.context=wx.createLivePusherContext(s),this.pusherAttributes={},Object.assign(this.pusherAttributes,f,e)}return s(r,[{key:"setPusherAttributes",value:function(e){return Object.assign(this.pusherAttributes,e),this.pusherAttributes}},{key:"start",value:function(e){h.log("[apiLog][pusherStart]"),I.log({name:W,options:e}),this.context.start(e)}},{key:"stop",value:function(e){h.log("[apiLog][pusherStop]"),I.log({name:Q,options:e}),this.context.stop(e)}},{key:"pause",value:function(e){h.log("[apiLog] pusherPause()"),I.log({name:X,options:e}),this.context.pause(e)}},{key:"resume",value:function(e){h.log("[apiLog][pusherResume]"),I.log({name:Z,options:e}),this.context.resume(e)}},{key:"switchCamera",value:function(e){return h.log("[apiLog][switchCamera]"),this.pusherAttributes.frontCamera="front"===this.pusherAttributes.frontCamera?"back":"front",this.context.switchCamera(e),this.pusherAttributes}},{key:"sendMessage",value:function(e){h.log("[apiLog][sendMessage]",e.msg),this.context.sendMessage(e)}},{key:"snapshot",value:function(){var e=this;return h.log("[apiLog][pusherSnapshot]"),new Promise((function(t,r){e.context.snapshot({quality:"raw",complete:function(e){e.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:e.tempImagePath,success:function(r){t(e)},fail:function(e){h.error("[error] pusher截图失败: ",e),r(new Error("截图失败"))}}),t(e)):(h.error("[error] snapShot 回调失败",e),r(new Error("截图失败")))}})}))}},{key:"toggleTorch",value:function(e){this.context.toggleTorch(e)}},{key:"startDumpAudio",value:function(e){this.context.startDumpAudio(e)}},{key:"stopDumpAudio",value:function(e){this.context.startDumpAudio(e)}},{key:"playBGM",value:function(e){h.log("[apiLog] playBGM() url: ",e.url),this.context.playBGM(e)}},{key:"pauseBGM",value:function(e){h.log("[apiLog] pauseBGM()"),this.context.pauseBGM(e)}},{key:"resumeBGM",value:function(e){h.log("[apiLog] resumeBGM()"),this.context.resumeBGM(e)}},{key:"stopBGM",value:function(e){h.log("[apiLog] stopBGM()"),this.context.stopBGM(e)}},{key:"setBGMVolume",value:function(t){h.log("[apiLog] setBGMVolume() volume:",t),t&&t.volume&&"object"===e(t.volume)&&t.volume.volume?this.context.setBGMVolume(t.volume):this.context.setBGMVolume(t)}},{key:"setMICVolume",value:function(t){h.log("[apiLog] setMICVolume() volume:",t),t&&t.volume&&"object"===e(t.volume)&&t.volume.volume?this.context.setMICVolume(t.volume):this.context.setMICVolume(t)}},{key:"startPreview",value:function(e){h.log("[apiLog] startPreview()"),this.context.startPreview(e)}},{key:"stopPreview",value:function(e){h.log("[apiLog] stopPreview()"),this.context.stopPreview(e)}},{key:"reset",value:function(){return console.log("Pusher reset",this.context),this.pusherConfig={},this.context&&(this.stop({success:function(){console.log("Pusher context.stop()")}}),this.context=null),this.pusherAttributes}}]),r}(),$=function e(r){t(this,e),Object.assign(this,{userID:"",streams:{}},r)},ee=function(){function e(r,s){t(this,e),this.ctx=s,this.playerAttributes=this.getInitPlayerAttributes(r)}return s(e,[{key:"play",value:function(e){this.getPlayerContext().play(e)}},{key:"stop",value:function(e){this.getPlayerContext().stop(e)}},{key:"mute",value:function(e){this.getPlayerContext().mute(e)}},{key:"pause",value:function(e){this.getPlayerContext().pause(e)}},{key:"resume",value:function(e){this.getPlayerContext().resume(e)}},{key:"requestFullScreen",value:function(e){var t=this;return new Promise((function(r,s){t.getPlayerContext().requestFullScreen({direction:e.direction,success:function(e){r(e)},fail:function(e){s(e)}})}))}},{key:"requestExitFullScreen",value:function(){var e=this;return new Promise((function(t,r){e.getPlayerContext().exitFullScreen({success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:"snapshot",value:function(e){var t=this;return h.log("[playerSnapshot]",e),new Promise((function(e,r){t.getPlayerContext().snapshot({quality:"raw",complete:function(t){t.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:t.tempImagePath,success:function(r){h.log("save photo is success",r),e(t)},fail:function(e){h.error("save photo is fail",e),r(e)}}),e(t)):(h.error("snapShot 回调失败",t),r(new Error("截图失败")))}})}))}},{key:"setPlayerAttributes",value:function(e){this.playerAttributes=Object.assign({},this.playerAttributes,e)}},{key:"getPlayerContext",value:function(){return this.playerContext||(this.playerContext=wx.createLivePlayerContext(this.playerAttributes.id,this.ctx)),this.playerContext}},{key:"reset",value:function(){this.playerContext&&(this.playerContext.stop(),this.playerContext=void 0),this.playerAttributes=this.getInitPlayerAttributes()}},{key:"getInitPlayerAttributes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},d,{userID:"",streamType:"",streamID:"",id:"",hasVideo:!1,hasAudio:!1,volume:0,playerContext:void 0},e)}}]),e}(),te="UserController",re=function(){function e(r,s){t(this,e),this.ctx=s,this.userMap=new Map,this.userList=[],this.streamList=[],this.emitter=r}return s(e,[{key:"userEventHandler",value:function(e){var t=e.detail.code,r=e.detail.message,s={name:F,code:t,message:r,data:""};switch(t){case 0:h.log(r,t);break;case 1001:h.log("已经连接推流服务器",t),s.name=S;break;case 1002:h.log("已经与服务器握手完毕,开始推流",t),s.name=k;break;case 1003:h.log("打开摄像头成功",t),s.name=R;break;case 1004:h.log("录屏启动成功",t),s.name=P;break;case 1005:h.log("推流动态调整分辨率",t),s.name=M;break;case 1006:h.log("推流动态调整码率",t),s.name=U;break;case 1007:h.log("首帧画面采集完成",t),s.name=C;break;case 1008:h.log("编码器启动",t),s.name=x;break;case 1018:h.log("进房成功",t),s.name=w,s.data="event enterRoom success",this.emitter.emit(g.LOCAL_JOIN);break;case 1019:h.log("退出房间",t),r.indexOf("reason[0]")>-1?(s.name=V,s.data="event exitRoom success"):(s.name=B,s.data="event abnormal exitRoom",this.emitter.emit(g.KICKED_OUT));break;case 2003:h.log("渲染首帧视频",t),s.name=G;break;case-1301:h.error("打开摄像头失败: ",t),s.name=O,s.data="event start camera failed",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1302:s.name=O,s.data="event start microphone failed",h.error("打开麦克风失败: ",t),this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1303:h.error("视频编码失败: ",t),s.name=O,s.data="event video encode failed",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1304:h.error("音频编码失败: ",t),s.name=O,s.data="event audio encode failed",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1307:h.error("推流连接断开: ",t),s.name=O,s.data="event pusher stream failed",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-100018:h.error("进房失败: userSig 校验失败,请检查 userSig 是否填写正确",t,r),s.name=O,s.data="event userSig is error",this.emitter.emit(g.ERROR,{code:t,message:r});break;case 5e3:h.log("小程序被挂起: ",t),s.name=N,s.data="miniApp is hang";break;case 5001:h.log("小程序悬浮窗被关闭: ",t),s.name=j;break;case 1021:h.log("网络类型发生变化,需要重新进房",t);break;case 2007:h.log("本地视频播放loading: ",t);break;case 2004:h.log("本地视频播放开始: ",t);break;case 1031:case 1032:case 1033:case 1034:this._handleUserEvent(e)}I.log(s)}},{key:"_handleUserEvent",value:function(e){var t,r=e.detail.code,s=e.detail.message;if(!e.detail.message||"string"!=typeof s)return h.warn(te,"userEventHandler 数据格式错误"),!1;try{t=JSON.parse(e.detail.message)}catch(e){return h.warn(te,"userEventHandler 数据格式错误",e),!1}switch(this.emitter.emit(g.LOCAL_STATE_UPDATE,e),I.log({name:H,code:r,message:s,data:t}),r){case 1031:this.addUser(t);break;case 1032:this.removeUser(t);break;case 1033:this.updateUserVideo(t);break;case 1034:this.updateUserAudio(t)}}},{key:"addUser",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s||(s=new $({userID:r}),t.userList.push({userID:r})),t.userMap.set(r,s),t.emitter.emit(g.REMOTE_USER_JOIN,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:K,userID:r,userList:t.userList,playerList:t.getPlayerList()})}))}},{key:"removeUser",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);if(s&&s.streams){if(s.streams){var a,i,n=null===(a=s.streams)||void 0===a?void 0:a.main,o=null===(i=s.streams)||void 0===i?void 0:i.aux,u=function(e){var r,s;null!=e&&null!==(r=e.playerAttributes)&&void 0!==r&&r.hasVideo&&t.emitter.emit(g.REMOTE_VIDEO_REMOVE,{player:e.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),null!=e&&null!==(s=e.playerAttributes)&&void 0!==s&&s.hasAudio&&t.emitter.emit(g.REMOTE_AUDIO_REMOVE,{player:e.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})};u(n),u(o)}t._removeUserAndStream(r),s.streams.main&&s.streams.main.reset(),s.streams.aux&&s.streams.aux.reset(),t.emitter.emit(g.REMOTE_USER_LEAVE,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:Y,userID:r,userList:t.userList,playerList:t.getPlayerList()}),s=void 0,t.userMap.delete(r)}}))}},{key:"updateUserVideo",value:function(e){var t=this;h.log(te,"updateUserVideo",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=e.streamtype,a="".concat(r,"_").concat(s),i=a,n=e.hasvideo,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams[s];h.log(te,"updateUserVideo start",u,s,l),l?(l.setPlayerAttributes({hasVideo:n}),n||l.playerAttributes.hasAudio||t._removeStream(l)):(l=new ee({userID:r,streamID:a,hasVideo:n,src:o,streamType:s,id:i},t.ctx),u.streams[s]=l,t._addStream(l)),"aux"===s&&(n?(l.setPlayerAttributes({objectFit:"contain",muteAudio:!1}),t._addStream(l)):t._removeStream(l)),t.userList.find((function(e){if(e.userID===r)return e["has".concat(s.replace(/^\S/,(function(e){return e.toUpperCase()})),"Video")]=n,!0})),h.log(te,"updateUserVideo end",u,s,l);var c=n?g.REMOTE_VIDEO_ADD:g.REMOTE_VIDEO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:q,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:"updateUserAudio",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s="main",a="".concat(r,"_").concat(s),i=a,n=e.hasaudio,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams.main;l?(l.setPlayerAttributes({hasAudio:n}),n||l.playerAttributes.hasVideo||t._removeStream(l)):(l=new ee({userID:r,streamID:a,hasAudio:n,src:o,streamType:s,id:i},t.ctx),u.streams.main=l,t._addStream(l)),t.userList.find((function(e){if(e.userID===r)return e["has".concat(s.replace(/^\S/,(function(e){return e.toUpperCase()})),"Audio")]=n,!0}));var c=n?g.REMOTE_AUDIO_ADD:g.REMOTE_AUDIO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:J,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:"getUser",value:function(e){return this.userMap.get(e)}},{key:"getStream",value:function(e){var t=e.userID,r=e.streamType,s=this.userMap.get(t);if(s)return s.streams[r]}},{key:"getUserList",value:function(){return this.userList}},{key:"getStreamList",value:function(){return this.streamList}},{key:"getPlayerList",value:function(){return this.getStreamList().map((function(e){return Object.assign({},e.playerAttributes)}))}},{key:"reset",value:function(){return this.streamList.forEach((function(e){e.reset()})),this.streamList=[],this.userList=[],this.userMap.clear(),{userList:this.userList,streamList:this.streamList}}},{key:"_removeUserAndStream",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e&&""!==t.playerAttributes.userID})),this.userList=this.userList.filter((function(t){return t.userID!==e}))}},{key:"_addStream",value:function(e){-1===this.streamList.findIndex((function(t){return t.playerAttributes.userID===e.playerAttributes.userID&&t.playerAttributes.streamType===e.playerAttributes.streamType}))&&this.streamList.push(e)}},{key:"_removeStream",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e.playerAttributes.userID||t.playerAttributes.streamType!==e.playerAttributes.streamType})),this.getUser(e.playerAttributes.userID).streams[e.playerAttributes.streamType]=void 0}}]),e}(),se=function(){function e(){t(this,e)}return s(e,[{key:"on",value:function(e,t,r){"function"==typeof t?(this._stores=this._stores||{},(this._stores[e]=this._stores[e]||[]).push({cb:t,ctx:r})):console.error("listener must be a function")}},{key:"emit",value:function(e){this._stores=this._stores||{};var t,r=this._stores[e];if(r){r=r.slice(0),(t=[].slice.call(arguments,1))[0]={eventCode:e,data:t[0]};for(var s=0,a=r.length;s4294967296)?(h.error(\"roomID 超出取值范围 1 ~ 4294967295\"),!1):e.strRoomID&&t.test(e.strRoomID)?(h.error(\"strRoomID 请勿使用中文字符\"),!1):e.userID?e.userID&&t.test(e.userID)?(h.error(\"userID 请勿使用中文字符\"),!1):!!e.userSig||(h.error(\"未设置 userSig\"),!1):(h.error(\"未设置 userID\"),!1):(h.error(\"未设置 sdkAppID\"),!1)},v={LOCAL_JOIN:\"LOCAL_JOIN\",LOCAL_LEAVE:\"LOCAL_LEAVE\",KICKED_OUT:\"KICKED_OUT\",REMOTE_USER_JOIN:\"REMOTE_USER_JOIN\",REMOTE_USER_LEAVE:\"REMOTE_USER_LEAVE\",REMOTE_VIDEO_ADD:\"REMOTE_VIDEO_ADD\",REMOTE_VIDEO_REMOVE:\"REMOTE_VIDEO_REMOVE\",REMOTE_AUDIO_ADD:\"REMOTE_AUDIO_ADD\",REMOTE_AUDIO_REMOVE:\"REMOTE_AUDIO_REMOVE\",REMOTE_STATE_UPDATE:\"REMOTE_STATE_UPDATE\",LOCAL_NET_STATE_UPDATE:\"LOCAL_NET_STATE_UPDATE\",REMOTE_NET_STATE_UPDATE:\"REMOTE_NET_STATE_UPDATE\",LOCAL_AUDIO_VOLUME_UPDATE:\"LOCAL_AUDIO_VOLUME_UPDATE\",REMOTE_AUDIO_VOLUME_UPDATE:\"REMOTE_AUDIO_VOLUME_UPDATE\",VIDEO_FULLSCREEN_UPDATE:\"VIDEO_FULLSCREEN_UPDATE\",BGM_PLAY_START:\"BGM_PLAY_START\",BGM_PLAY_FAIL:\"BGM_PLAY_FAIL\",BGM_PLAY_PROGRESS:\"BGM_PLAY_PROGRESS\",BGM_PLAY_COMPLETE:\"BGM_PLAY_COMPLETE\",ERROR:\"ERROR\",IM_READY:\"IM_READY\",IM_MESSAGE_RECEIVED:\"IM_MESSAGE_RECEIVED\",IM_NOT_READY:\"IM_NOT_READY\",IM_KICKED_OUT:\"IM_KICKED_OUT\",IM_ERROR:\"IM_ERROR\"},g={url:\"\",mode:\"RTC\",autopush:!1,enableCamera:!1,enableMic:!1,enableAgc:!1,enableAns:!1,enableEarMonitor:!1,enableAutoFocus:!0,enableZoom:!1,minBitrate:600,maxBitrate:900,videoWidth:360,videoHeight:640,beautyLevel:0,whitenessLevel:0,videoOrientation:\"vertical\",videoAspect:\"9:16\",frontCamera:\"front\",enableRemoteMirror:!1,localMirror:\"auto\",enableBackgroundMute:!1,audioQuality:\"high\",audioVolumeType:\"voicecall\",audioReverbType:0,waitingImage:\"\",waitingImageHash:\"\",beautyStyle:\"smooth\",filter:\"\",netStatus:{}},f={src:\"\",mode:\"RTC\",autoplay:!0,muteAudio:!0,muteVideo:!0,orientation:\"vertical\",objectFit:\"fillCrop\",enableBackgroundMute:!1,minCache:1,maxCache:2,soundMode:\"speaker\",enableRecvMessage:!1,autoPauseIfNavigate:!0,autoPauseIfOpenNative:!0,isVisible:!0,_definitionType:\"main\",netStatus:{}};(new Date).getTime();function d(){var e=new Date;return e.setTime((new Date).getTime()+0),e.toLocaleString()}var E=function(e){var t=[];if(e&&e.TUIScene&&t.push(e.TUIScene),e&&\"test\"===e.env)return\"default\";if(wx&&wx.TUIScene&&t.push(wx.TUIScene),wx&&\"function\"==typeof getApp){var r=getApp().globalData;r&&r.TUIScene&&t.push(r.TUIScene)}return wx&&wx.getStorage({key:\"TUIScene\",success:function(e){t.push(e.data)}}),t[0]||\"default\"},A=new(function(){function e(){t(this,e),this.sdkAppId=\"\",this.userId=\"\",this.version=\"\",this.common={}}return s(e,[{key:\"setConfig\",value:function(e){this.sdkAppId=\"\".concat(e.sdkAppId),this.userId=\"\".concat(e.userId),this.version=\"\".concat(e.version),this.common.TUIScene=E(e)}},{key:\"log\",value:function(e){wx.request({url:\"https://yun.tim.qq.com/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log\",method:\"POST\",header:{\"content-type\":\"application/json\"},data:{timestamp:d(),sdkAppId:this.sdkAppId,userId:this.userId,version:this.version,log:JSON.stringify(n(n({},e),this.common))}})}}]),e}()),I=\"enterRoom\",_=\"exitRoom\",L=\"setPusherAttributes\",b=\"setPlayerAttributes\",T=\"init\",D=\"error\",O=\"connectServer\",k=\"startPusher\",S=\"openCamera\",P=\"screenCap\",R=\"pusherResolution\",M=\"pusherCodeRate\",U=\"collectionFirstFrame\",C=\"encoderStart\",x=\"enterRoomSuccess\",w=\"exitRoomSuccess\",V=\"kicked_out\",B=\"renderFirstFrame\",G=\"miniAppHang\",j=\"closeSuspension\",N=\"other\",F=\"update\",H=\"addUser\",K=\"remove_user\",Y=\"update_user_video\",q=\"update_user_audio\",J=\"pusherStart\",W=\"pusherStop\",Q=\"pusherPause\",X=\"pusherResume\",Z=function(){function r(e,s){t(this,r),this.context=wx.createLivePusherContext(s),this.pusherAttributes={},Object.assign(this.pusherAttributes,g,e)}return s(r,[{key:\"setPusherAttributes\",value:function(e){return Object.assign(this.pusherAttributes,e),this.pusherAttributes}},{key:\"start\",value:function(e){h.log(\"[apiLog][pusherStart]\"),A.log({name:J,options:e}),this.context.start(e)}},{key:\"stop\",value:function(e){h.log(\"[apiLog][pusherStop]\"),A.log({name:W,options:e}),this.context.stop(e)}},{key:\"pause\",value:function(e){h.log(\"[apiLog] pusherPause()\"),A.log({name:Q,options:e}),this.context.pause(e)}},{key:\"resume\",value:function(e){h.log(\"[apiLog][pusherResume]\"),A.log({name:X,options:e}),this.context.resume(e)}},{key:\"switchCamera\",value:function(e){return h.log(\"[apiLog][switchCamera]\"),this.pusherAttributes.frontCamera=\"front\"===this.pusherAttributes.frontCamera?\"back\":\"front\",this.context.switchCamera(e),this.pusherAttributes}},{key:\"sendMessage\",value:function(e){h.log(\"[apiLog][sendMessage]\",e.msg),this.context.sendMessage(e)}},{key:\"snapshot\",value:function(){var e=this;return h.log(\"[apiLog][pusherSnapshot]\"),new Promise((function(t,r){e.context.snapshot({quality:\"raw\",complete:function(e){e.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:e.tempImagePath,success:function(r){t(e)},fail:function(e){h.error(\"[error] pusher截图失败: \",e),r(new Error(\"截图失败\"))}}),t(e)):(h.error(\"[error] snapShot 回调失败\",e),r(new Error(\"截图失败\")))}})}))}},{key:\"toggleTorch\",value:function(e){this.context.toggleTorch(e)}},{key:\"startDumpAudio\",value:function(e){this.context.startDumpAudio(e)}},{key:\"stopDumpAudio\",value:function(e){this.context.startDumpAudio(e)}},{key:\"playBGM\",value:function(e){h.log(\"[apiLog] playBGM() url: \",e.url),this.context.playBGM(e)}},{key:\"pauseBGM\",value:function(e){h.log(\"[apiLog] pauseBGM()\"),this.context.pauseBGM(e)}},{key:\"resumeBGM\",value:function(e){h.log(\"[apiLog] resumeBGM()\"),this.context.resumeBGM(e)}},{key:\"stopBGM\",value:function(e){h.log(\"[apiLog] stopBGM()\"),this.context.stopBGM(e)}},{key:\"setBGMVolume\",value:function(t){h.log(\"[apiLog] setBGMVolume() volume:\",t),t&&t.volume&&\"object\"===e(t.volume)&&t.volume.volume?this.context.setBGMVolume(t.volume):this.context.setBGMVolume(t)}},{key:\"setMICVolume\",value:function(t){h.log(\"[apiLog] setMICVolume() volume:\",t),t&&t.volume&&\"object\"===e(t.volume)&&t.volume.volume?this.context.setMICVolume(t.volume):this.context.setMICVolume(t)}},{key:\"startPreview\",value:function(e){h.log(\"[apiLog] startPreview()\"),this.context.startPreview(e)}},{key:\"stopPreview\",value:function(e){h.log(\"[apiLog] stopPreview()\"),this.context.stopPreview(e)}},{key:\"reset\",value:function(){return console.log(\"Pusher reset\",this.context),this.pusherConfig={},this.context&&(this.stop({success:function(){console.log(\"Pusher context.stop()\")}}),this.context=null),this.pusherAttributes}}]),r}(),z=function e(r){t(this,e),Object.assign(this,{userID:\"\",streams:{}},r)},$=function(){function e(r,s){t(this,e),this.ctx=s,this.playerAttributes=this.getInitPlayerAttributes(r)}return s(e,[{key:\"play\",value:function(e){this.getPlayerContext().play(e)}},{key:\"stop\",value:function(e){this.getPlayerContext().stop(e)}},{key:\"mute\",value:function(e){this.getPlayerContext().mute(e)}},{key:\"pause\",value:function(e){this.getPlayerContext().pause(e)}},{key:\"resume\",value:function(e){this.getPlayerContext().resume(e)}},{key:\"requestFullScreen\",value:function(e){var t=this;return new Promise((function(r,s){t.getPlayerContext().requestFullScreen({direction:e.direction,success:function(e){r(e)},fail:function(e){s(e)}})}))}},{key:\"requestExitFullScreen\",value:function(){var e=this;return new Promise((function(t,r){e.getPlayerContext().exitFullScreen({success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:\"snapshot\",value:function(e){var t=this;return h.log(\"[playerSnapshot]\",e),new Promise((function(e,r){t.getPlayerContext().snapshot({quality:\"raw\",complete:function(t){t.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:t.tempImagePath,success:function(r){h.log(\"save photo is success\",r),e(t)},fail:function(e){h.error(\"save photo is fail\",e),r(e)}}),e(t)):(h.error(\"snapShot 回调失败\",t),r(new Error(\"截图失败\")))}})}))}},{key:\"setPlayerAttributes\",value:function(e){this.playerAttributes=Object.assign({},this.playerAttributes,e)}},{key:\"getPlayerContext\",value:function(){return this.playerContext||(this.playerContext=wx.createLivePlayerContext(this.playerAttributes.id,this.ctx)),this.playerContext}},{key:\"reset\",value:function(){this.playerContext&&(this.playerContext.stop(),this.playerContext=void 0),this.playerAttributes=this.getInitPlayerAttributes()}},{key:\"getInitPlayerAttributes\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},f,{userID:\"\",streamType:\"\",streamID:\"\",id:\"\",hasVideo:!1,hasAudio:!1,volume:0,playerContext:void 0},e)}}]),e}(),ee=\"UserController\",te=function(){function e(r,s){t(this,e),this.ctx=s,this.userMap=new Map,this.userList=[],this.streamList=[],this.emitter=r}return s(e,[{key:\"userEventHandler\",value:function(e){var t=e.detail.code,r=e.detail.message,s={name:N,code:t,message:r,data:\"\"};switch(t){case 0:h.log(r,t);break;case 1001:h.log(\"已经连接推流服务器\",t),s.name=O;break;case 1002:h.log(\"已经与服务器握手完毕,开始推流\",t),s.name=k;break;case 1003:h.log(\"打开摄像头成功\",t),s.name=S;break;case 1004:h.log(\"录屏启动成功\",t),s.name=P;break;case 1005:h.log(\"推流动态调整分辨率\",t),s.name=R;break;case 1006:h.log(\"推流动态调整码率\",t),s.name=M;break;case 1007:h.log(\"首帧画面采集完成\",t),s.name=U;break;case 1008:h.log(\"编码器启动\",t),s.name=C;break;case 1018:h.log(\"进房成功\",t),s.name=x,s.data=\"event enterRoom success\",this.emitter.emit(v.LOCAL_JOIN);break;case 1019:h.log(\"退出房间\",t),r.indexOf(\"reason[0]\")>-1?(s.name=w,s.data=\"event exitRoom success\"):(s.name=V,s.data=\"event abnormal exitRoom\",this.emitter.emit(v.KICKED_OUT));break;case 2003:h.log(\"渲染首帧视频\",t),s.name=B;break;case-1301:h.error(\"打开摄像头失败: \",t),s.name=D,s.data=\"event start camera failed\",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1302:s.name=D,s.data=\"event start microphone failed\",h.error(\"打开麦克风失败: \",t),this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1303:h.error(\"视频编码失败: \",t),s.name=D,s.data=\"event video encode failed\",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1304:h.error(\"音频编码失败: \",t),s.name=D,s.data=\"event audio encode failed\",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-1307:h.error(\"推流连接断开: \",t),s.name=D,s.data=\"event pusher stream failed\",this.emitter.emit(v.ERROR,{code:t,message:r});break;case-100018:h.error(\"进房失败: userSig 校验失败,请检查 userSig 是否填写正确\",t,r),s.name=D,s.data=\"event userSig is error\",this.emitter.emit(v.ERROR,{code:t,message:r});break;case 5e3:h.log(\"小程序被挂起: \",t),s.name=G,s.data=\"miniApp is hang\";break;case 5001:h.log(\"小程序悬浮窗被关闭: \",t),s.name=j;break;case 1021:h.log(\"网络类型发生变化,需要重新进房\",t);break;case 2007:h.log(\"本地视频播放loading: \",t);break;case 2004:h.log(\"本地视频播放开始: \",t);break;case 1031:case 1032:case 1033:case 1034:this._handleUserEvent(e)}A.log(s)}},{key:\"_handleUserEvent\",value:function(e){var t,r=e.detail.code,s=e.detail.message;if(!e.detail.message||\"string\"!=typeof s)return h.warn(ee,\"userEventHandler 数据格式错误\"),!1;try{t=JSON.parse(e.detail.message)}catch(e){return h.warn(ee,\"userEventHandler 数据格式错误\",e),!1}switch(this.emitter.emit(v.LOCAL_STATE_UPDATE,e),A.log({name:F,code:r,message:s,data:t}),r){case 1031:this.addUser(t);break;case 1032:this.removeUser(t);break;case 1033:this.updateUserVideo(t);break;case 1034:this.updateUserAudio(t)}}},{key:\"addUser\",value:function(e){var t=this;h.log(\"addUser\",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s||(s=new z({userID:r}),t.userList.push({userID:r})),t.userMap.set(r,s),t.emitter.emit(v.REMOTE_USER_JOIN,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:H,userID:r,userList:t.userList,playerList:t.getPlayerList()})}))}},{key:\"removeUser\",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s&&s.streams&&(t._removeUserAndStream(r),s.streams.main&&s.streams.main.reset(),s.streams.aux&&s.streams.aux.reset(),t.emitter.emit(v.REMOTE_USER_LEAVE,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:K,userID:r,userList:t.userList,playerList:t.getPlayerList()}),s=void 0,t.userMap.delete(r))}))}},{key:\"updateUserVideo\",value:function(e){var t=this;h.log(ee,\"updateUserVideo\",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=e.streamtype,a=\"\".concat(r,\"_\").concat(s),i=a,n=e.hasvideo,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams[s];h.log(ee,\"updateUserVideo start\",u,s,l),l?(l.setPlayerAttributes({hasVideo:n}),n||l.playerAttributes.hasAudio||t._removeStream(l)):(l=new $({userID:r,streamID:a,hasVideo:n,src:o,streamType:s,id:i},t.ctx),u.streams[s]=l,t._addStream(l)),\"aux\"===s&&(n?(l.setPlayerAttributes({objectFit:\"contain\",muteAudio:!1}),t._addStream(l)):t._removeStream(l)),t.userList.find((function(e){if(e.userID===r)return e[\"has\".concat(s.replace(/^\\S/,(function(e){return e.toUpperCase()})),\"Video\")]=n,!0})),h.log(ee,\"updateUserVideo end\",u,s,l);var c=n?v.REMOTE_VIDEO_ADD:v.REMOTE_VIDEO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:Y,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:\"updateUserAudio\",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=\"main\",a=\"\".concat(r,\"_\").concat(s),i=a,n=e.hasaudio,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams.main;l?(l.setPlayerAttributes({hasAudio:n}),n||l.playerAttributes.hasVideo||t._removeStream(l)):(l=new $({userID:r,streamID:a,hasAudio:n,src:o,streamType:s,id:i},t.ctx),u.streams.main=l,t._addStream(l)),t.userList.find((function(e){if(e.userID===r)return e[\"has\".concat(s.replace(/^\\S/,(function(e){return e.toUpperCase()})),\"Audio\")]=n,!0}));var c=n?v.REMOTE_AUDIO_ADD:v.REMOTE_AUDIO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),A.log({name:q,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:\"getUser\",value:function(e){return this.userMap.get(e)}},{key:\"getStream\",value:function(e){var t=e.userID,r=e.streamType,s=this.userMap.get(t);if(s)return s.streams[r]}},{key:\"getUserList\",value:function(){return this.userList}},{key:\"getStreamList\",value:function(){return this.streamList}},{key:\"getPlayerList\",value:function(){return this.getStreamList().map((function(e){return Object.assign({},e.playerAttributes)}))}},{key:\"reset\",value:function(){return this.streamList.forEach((function(e){e.reset()})),this.streamList=[],this.userList=[],this.userMap.clear(),{userList:this.userList,streamList:this.streamList}}},{key:\"_removeUserAndStream\",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e&&\"\"!==t.playerAttributes.userID})),this.userList=this.userList.filter((function(t){return t.userID!==e}))}},{key:\"_addStream\",value:function(e){-1===this.streamList.findIndex((function(t){return t.playerAttributes.userID===e.playerAttributes.userID&&t.playerAttributes.streamType===e.playerAttributes.streamType}))&&this.streamList.push(e)}},{key:\"_removeStream\",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e.playerAttributes.userID||t.playerAttributes.streamType!==e.playerAttributes.streamType})),this.getUser(e.playerAttributes.userID).streams[e.playerAttributes.streamType]=void 0}}]),e}(),re=function(){function e(){t(this,e)}return s(e,[{key:\"on\",value:function(e,t,r){\"function\"==typeof t?(this._stores=this._stores||{},(this._stores[e]=this._stores[e]||[]).push({cb:t,ctx:r})):console.error(\"listener must be a function\")}},{key:\"emit\",value:function(e){this._stores=this._stores||{};var t,r=this._stores[e];if(r){r=r.slice(0),(t=[].slice.call(arguments,1))[0]={eventCode:e,data:t[0]};for(var s=0,a=r.length;s4294967296)?(h.error(\"roomID 超出取值范围 1 ~ 4294967295\"),!1):e.strRoomID&&t.test(e.strRoomID)?(h.error(\"strRoomID 请勿使用中文字符\"),!1):e.userID?e.userID&&t.test(e.userID)?(h.error(\"userID 请勿使用中文字符\"),!1):!!e.userSig||(h.error(\"未设置 userSig\"),!1):(h.error(\"未设置 userID\"),!1):(h.error(\"未设置 sdkAppID\"),!1)},g={LOCAL_JOIN:\"LOCAL_JOIN\",LOCAL_LEAVE:\"LOCAL_LEAVE\",KICKED_OUT:\"KICKED_OUT\",REMOTE_USER_JOIN:\"REMOTE_USER_JOIN\",REMOTE_USER_LEAVE:\"REMOTE_USER_LEAVE\",REMOTE_VIDEO_ADD:\"REMOTE_VIDEO_ADD\",REMOTE_VIDEO_REMOVE:\"REMOTE_VIDEO_REMOVE\",REMOTE_AUDIO_ADD:\"REMOTE_AUDIO_ADD\",REMOTE_AUDIO_REMOVE:\"REMOTE_AUDIO_REMOVE\",REMOTE_STATE_UPDATE:\"REMOTE_STATE_UPDATE\",LOCAL_NET_STATE_UPDATE:\"LOCAL_NET_STATE_UPDATE\",REMOTE_NET_STATE_UPDATE:\"REMOTE_NET_STATE_UPDATE\",LOCAL_AUDIO_VOLUME_UPDATE:\"LOCAL_AUDIO_VOLUME_UPDATE\",REMOTE_AUDIO_VOLUME_UPDATE:\"REMOTE_AUDIO_VOLUME_UPDATE\",VIDEO_FULLSCREEN_UPDATE:\"VIDEO_FULLSCREEN_UPDATE\",BGM_PLAY_START:\"BGM_PLAY_START\",BGM_PLAY_FAIL:\"BGM_PLAY_FAIL\",BGM_PLAY_PROGRESS:\"BGM_PLAY_PROGRESS\",BGM_PLAY_COMPLETE:\"BGM_PLAY_COMPLETE\",ERROR:\"ERROR\",IM_READY:\"IM_READY\",IM_MESSAGE_RECEIVED:\"IM_MESSAGE_RECEIVED\",IM_NOT_READY:\"IM_NOT_READY\",IM_KICKED_OUT:\"IM_KICKED_OUT\",IM_ERROR:\"IM_ERROR\"},f={url:\"\",mode:\"RTC\",autopush:!1,enableCamera:!1,enableMic:!1,enableAgc:!1,enableAns:!1,enableEarMonitor:!1,enableAutoFocus:!0,enableZoom:!1,minBitrate:600,maxBitrate:900,videoWidth:360,videoHeight:640,beautyLevel:0,whitenessLevel:0,videoOrientation:\"vertical\",videoAspect:\"9:16\",frontCamera:\"front\",enableRemoteMirror:!1,localMirror:\"auto\",enableBackgroundMute:!1,audioQuality:\"high\",audioVolumeType:\"voicecall\",audioReverbType:0,waitingImage:\"\",waitingImageHash:\"\",beautyStyle:\"smooth\",filter:\"\",netStatus:{}},d={src:\"\",mode:\"RTC\",autoplay:!0,muteAudio:!1,muteVideo:!1,orientation:\"vertical\",objectFit:\"fillCrop\",enableBackgroundMute:!1,minCache:1,maxCache:2,soundMode:\"speaker\",enableRecvMessage:!1,autoPauseIfNavigate:!0,autoPauseIfOpenNative:!0,isVisible:!0,_definitionType:\"main\",netStatus:{}};(new Date).getTime();function E(){var e=new Date;return e.setTime((new Date).getTime()+0),e.toLocaleString()}var A=function(e){var t=[];if(e&&e.TUIScene&&t.push(e.TUIScene),e&&\"test\"===e.env)return\"default\";if(wx&&wx.TUIScene&&t.push(wx.TUIScene),wx&&\"function\"==typeof getApp){var r=getApp().globalData;r&&r.TUIScene&&t.push(r.TUIScene)}return wx&&wx.getStorage({key:\"TUIScene\",success:function(e){t.push(e.data)}}),t[0]||\"default\"},I=new(function(){function e(){t(this,e),this.sdkAppId=\"\",this.userId=\"\",this.version=\"\",this.common={}}return s(e,[{key:\"setConfig\",value:function(e){this.sdkAppId=\"\".concat(e.sdkAppId),this.userId=\"\".concat(e.userId),this.version=\"\".concat(e.version),this.common.TUIScene=A(e)}},{key:\"log\",value:function(e){wx.request({url:\"https://yun.tim.qq.com/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log\",method:\"POST\",header:{\"content-type\":\"application/json\"},data:{timestamp:E(),sdkAppId:this.sdkAppId,userId:this.userId,version:this.version,log:JSON.stringify(n(n({},e),this.common))}})}}]),e}()),L=\"enterRoom\",_=\"exitRoom\",b=\"setPusherAttributes\",T=\"setPlayerAttributes\",D=\"init\",O=\"error\",S=\"connectServer\",k=\"startPusher\",R=\"openCamera\",P=\"screenCap\",M=\"pusherResolution\",U=\"pusherCodeRate\",C=\"collectionFirstFrame\",x=\"encoderStart\",w=\"enterRoomSuccess\",V=\"exitRoomSuccess\",B=\"kicked_out\",G=\"renderFirstFrame\",N=\"miniAppHang\",j=\"closeSuspension\",F=\"other\",H=\"update\",K=\"addUser\",Y=\"remove_user\",q=\"update_user_video\",J=\"update_user_audio\",W=\"pusherStart\",Q=\"pusherStop\",X=\"pusherPause\",Z=\"pusherResume\",z=function(){function r(e,s){t(this,r),this.context=wx.createLivePusherContext(s),this.pusherAttributes={},Object.assign(this.pusherAttributes,f,e)}return s(r,[{key:\"setPusherAttributes\",value:function(e){return Object.assign(this.pusherAttributes,e),this.pusherAttributes}},{key:\"start\",value:function(e){h.log(\"[apiLog][pusherStart]\"),I.log({name:W,options:e}),this.context.start(e)}},{key:\"stop\",value:function(e){h.log(\"[apiLog][pusherStop]\"),I.log({name:Q,options:e}),this.context.stop(e)}},{key:\"pause\",value:function(e){h.log(\"[apiLog] pusherPause()\"),I.log({name:X,options:e}),this.context.pause(e)}},{key:\"resume\",value:function(e){h.log(\"[apiLog][pusherResume]\"),I.log({name:Z,options:e}),this.context.resume(e)}},{key:\"switchCamera\",value:function(e){return h.log(\"[apiLog][switchCamera]\"),this.pusherAttributes.frontCamera=\"front\"===this.pusherAttributes.frontCamera?\"back\":\"front\",this.context.switchCamera(e),this.pusherAttributes}},{key:\"sendMessage\",value:function(e){h.log(\"[apiLog][sendMessage]\",e.msg),this.context.sendMessage(e)}},{key:\"snapshot\",value:function(){var e=this;return h.log(\"[apiLog][pusherSnapshot]\"),new Promise((function(t,r){e.context.snapshot({quality:\"raw\",complete:function(e){e.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:e.tempImagePath,success:function(r){t(e)},fail:function(e){h.error(\"[error] pusher截图失败: \",e),r(new Error(\"截图失败\"))}}),t(e)):(h.error(\"[error] snapShot 回调失败\",e),r(new Error(\"截图失败\")))}})}))}},{key:\"toggleTorch\",value:function(e){this.context.toggleTorch(e)}},{key:\"startDumpAudio\",value:function(e){this.context.startDumpAudio(e)}},{key:\"stopDumpAudio\",value:function(e){this.context.startDumpAudio(e)}},{key:\"playBGM\",value:function(e){h.log(\"[apiLog] playBGM() url: \",e.url),this.context.playBGM(e)}},{key:\"pauseBGM\",value:function(e){h.log(\"[apiLog] pauseBGM()\"),this.context.pauseBGM(e)}},{key:\"resumeBGM\",value:function(e){h.log(\"[apiLog] resumeBGM()\"),this.context.resumeBGM(e)}},{key:\"stopBGM\",value:function(e){h.log(\"[apiLog] stopBGM()\"),this.context.stopBGM(e)}},{key:\"setBGMVolume\",value:function(t){h.log(\"[apiLog] setBGMVolume() volume:\",t),t&&t.volume&&\"object\"===e(t.volume)&&t.volume.volume?this.context.setBGMVolume(t.volume):this.context.setBGMVolume(t)}},{key:\"setMICVolume\",value:function(t){h.log(\"[apiLog] setMICVolume() volume:\",t),t&&t.volume&&\"object\"===e(t.volume)&&t.volume.volume?this.context.setMICVolume(t.volume):this.context.setMICVolume(t)}},{key:\"startPreview\",value:function(e){h.log(\"[apiLog] startPreview()\"),this.context.startPreview(e)}},{key:\"stopPreview\",value:function(e){h.log(\"[apiLog] stopPreview()\"),this.context.stopPreview(e)}},{key:\"reset\",value:function(){return console.log(\"Pusher reset\",this.context),this.pusherConfig={},this.context&&(this.stop({success:function(){console.log(\"Pusher context.stop()\")}}),this.context=null),this.pusherAttributes}}]),r}(),$=function e(r){t(this,e),Object.assign(this,{userID:\"\",streams:{}},r)},ee=function(){function e(r,s){t(this,e),this.ctx=s,this.playerAttributes=this.getInitPlayerAttributes(r)}return s(e,[{key:\"play\",value:function(e){this.getPlayerContext().play(e)}},{key:\"stop\",value:function(e){this.getPlayerContext().stop(e)}},{key:\"mute\",value:function(e){this.getPlayerContext().mute(e)}},{key:\"pause\",value:function(e){this.getPlayerContext().pause(e)}},{key:\"resume\",value:function(e){this.getPlayerContext().resume(e)}},{key:\"requestFullScreen\",value:function(e){var t=this;return new Promise((function(r,s){t.getPlayerContext().requestFullScreen({direction:e.direction,success:function(e){r(e)},fail:function(e){s(e)}})}))}},{key:\"requestExitFullScreen\",value:function(){var e=this;return new Promise((function(t,r){e.getPlayerContext().exitFullScreen({success:function(e){t(e)},fail:function(e){r(e)}})}))}},{key:\"snapshot\",value:function(e){var t=this;return h.log(\"[playerSnapshot]\",e),new Promise((function(e,r){t.getPlayerContext().snapshot({quality:\"raw\",complete:function(t){t.tempImagePath?(wx.saveImageToPhotosAlbum({filePath:t.tempImagePath,success:function(r){h.log(\"save photo is success\",r),e(t)},fail:function(e){h.error(\"save photo is fail\",e),r(e)}}),e(t)):(h.error(\"snapShot 回调失败\",t),r(new Error(\"截图失败\")))}})}))}},{key:\"setPlayerAttributes\",value:function(e){this.playerAttributes=Object.assign({},this.playerAttributes,e)}},{key:\"getPlayerContext\",value:function(){return this.playerContext||(this.playerContext=wx.createLivePlayerContext(this.playerAttributes.id,this.ctx)),this.playerContext}},{key:\"reset\",value:function(){this.playerContext&&(this.playerContext.stop(),this.playerContext=void 0),this.playerAttributes=this.getInitPlayerAttributes()}},{key:\"getInitPlayerAttributes\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},d,{userID:\"\",streamType:\"\",streamID:\"\",id:\"\",hasVideo:!1,hasAudio:!1,volume:0,playerContext:void 0},e)}}]),e}(),te=\"UserController\",re=function(){function e(r,s){t(this,e),this.ctx=s,this.userMap=new Map,this.userList=[],this.streamList=[],this.emitter=r}return s(e,[{key:\"userEventHandler\",value:function(e){var t=e.detail.code,r=e.detail.message,s={name:F,code:t,message:r,data:\"\"};switch(t){case 0:h.log(r,t);break;case 1001:h.log(\"已经连接推流服务器\",t),s.name=S;break;case 1002:h.log(\"已经与服务器握手完毕,开始推流\",t),s.name=k;break;case 1003:h.log(\"打开摄像头成功\",t),s.name=R;break;case 1004:h.log(\"录屏启动成功\",t),s.name=P;break;case 1005:h.log(\"推流动态调整分辨率\",t),s.name=M;break;case 1006:h.log(\"推流动态调整码率\",t),s.name=U;break;case 1007:h.log(\"首帧画面采集完成\",t),s.name=C;break;case 1008:h.log(\"编码器启动\",t),s.name=x;break;case 1018:h.log(\"进房成功\",t),s.name=w,s.data=\"event enterRoom success\",this.emitter.emit(g.LOCAL_JOIN);break;case 1019:h.log(\"退出房间\",t),r.indexOf(\"reason[0]\")>-1?(s.name=V,s.data=\"event exitRoom success\"):(s.name=B,s.data=\"event abnormal exitRoom\",this.emitter.emit(g.KICKED_OUT));break;case 2003:h.log(\"渲染首帧视频\",t),s.name=G;break;case-1301:h.error(\"打开摄像头失败: \",t),s.name=O,s.data=\"event start camera failed\",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1302:s.name=O,s.data=\"event start microphone failed\",h.error(\"打开麦克风失败: \",t),this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1303:h.error(\"视频编码失败: \",t),s.name=O,s.data=\"event video encode failed\",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1304:h.error(\"音频编码失败: \",t),s.name=O,s.data=\"event audio encode failed\",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-1307:h.error(\"推流连接断开: \",t),s.name=O,s.data=\"event pusher stream failed\",this.emitter.emit(g.ERROR,{code:t,message:r});break;case-100018:h.error(\"进房失败: userSig 校验失败,请检查 userSig 是否填写正确\",t,r),s.name=O,s.data=\"event userSig is error\",this.emitter.emit(g.ERROR,{code:t,message:r});break;case 5e3:h.log(\"小程序被挂起: \",t),s.name=N,s.data=\"miniApp is hang\";break;case 5001:h.log(\"小程序悬浮窗被关闭: \",t),s.name=j;break;case 1021:h.log(\"网络类型发生变化,需要重新进房\",t);break;case 2007:h.log(\"本地视频播放loading: \",t);break;case 2004:h.log(\"本地视频播放开始: \",t);break;case 1031:case 1032:case 1033:case 1034:this._handleUserEvent(e)}I.log(s)}},{key:\"_handleUserEvent\",value:function(e){var t,r=e.detail.code,s=e.detail.message;if(!e.detail.message||\"string\"!=typeof s)return h.warn(te,\"userEventHandler 数据格式错误\"),!1;try{t=JSON.parse(e.detail.message)}catch(e){return h.warn(te,\"userEventHandler 数据格式错误\",e),!1}switch(this.emitter.emit(g.LOCAL_STATE_UPDATE,e),I.log({name:H,code:r,message:s,data:t}),r){case 1031:this.addUser(t);break;case 1032:this.removeUser(t);break;case 1033:this.updateUserVideo(t);break;case 1034:this.updateUserAudio(t)}}},{key:\"addUser\",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);s||(s=new $({userID:r}),t.userList.push({userID:r})),t.userMap.set(r,s),t.emitter.emit(g.REMOTE_USER_JOIN,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:K,userID:r,userList:t.userList,playerList:t.getPlayerList()})}))}},{key:\"removeUser\",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=t.getUser(r);if(s&&s.streams){if(s.streams){var a,i,n=null===(a=s.streams)||void 0===a?void 0:a.main,o=null===(i=s.streams)||void 0===i?void 0:i.aux,u=function(e){var r,s;null!=e&&null!==(r=e.playerAttributes)&&void 0!==r&&r.hasVideo&&t.emitter.emit(g.REMOTE_VIDEO_REMOVE,{player:e.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),null!=e&&null!==(s=e.playerAttributes)&&void 0!==s&&s.hasAudio&&t.emitter.emit(g.REMOTE_AUDIO_REMOVE,{player:e.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})};u(n),u(o)}t._removeUserAndStream(r),s.streams.main&&s.streams.main.reset(),s.streams.aux&&s.streams.aux.reset(),t.emitter.emit(g.REMOTE_USER_LEAVE,{userID:r,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:Y,userID:r,userList:t.userList,playerList:t.getPlayerList()}),s=void 0,t.userMap.delete(r)}}))}},{key:\"updateUserVideo\",value:function(e){var t=this;h.log(te,\"updateUserVideo\",e);var r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=e.streamtype,a=\"\".concat(r,\"_\").concat(s),i=a,n=e.hasvideo,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams[s];h.log(te,\"updateUserVideo start\",u,s,l),l?(l.setPlayerAttributes({hasVideo:n}),n||l.playerAttributes.hasAudio||t._removeStream(l)):(l=new ee({userID:r,streamID:a,hasVideo:n,src:o,streamType:s,id:i},t.ctx),u.streams[s]=l,t._addStream(l)),\"aux\"===s&&(n?(l.setPlayerAttributes({objectFit:\"contain\",muteAudio:!1}),t._addStream(l)):t._removeStream(l)),t.userList.find((function(e){if(e.userID===r)return e[\"has\".concat(s.replace(/^\\S/,(function(e){return e.toUpperCase()})),\"Video\")]=n,!0})),h.log(te,\"updateUserVideo end\",u,s,l);var c=n?g.REMOTE_VIDEO_ADD:g.REMOTE_VIDEO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:q,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:\"updateUserAudio\",value:function(e){var t=this,r=e.userlist;Array.isArray(r)&&r.length>0&&r.forEach((function(e){var r=e.userid,s=\"main\",a=\"\".concat(r,\"_\").concat(s),i=a,n=e.hasaudio,o=e.playurl,u=t.getUser(r);if(u){var l=u.streams.main;l?(l.setPlayerAttributes({hasAudio:n}),n||l.playerAttributes.hasVideo||t._removeStream(l)):(l=new ee({userID:r,streamID:a,hasAudio:n,src:o,streamType:s,id:i},t.ctx),u.streams.main=l,t._addStream(l)),t.userList.find((function(e){if(e.userID===r)return e[\"has\".concat(s.replace(/^\\S/,(function(e){return e.toUpperCase()})),\"Audio\")]=n,!0}));var c=n?g.REMOTE_AUDIO_ADD:g.REMOTE_AUDIO_REMOVE;t.emitter.emit(c,{player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()}),I.log({name:J,player:l.playerAttributes,userList:t.userList,playerList:t.getPlayerList()})}}))}},{key:\"getUser\",value:function(e){return this.userMap.get(e)}},{key:\"getStream\",value:function(e){var t=e.userID,r=e.streamType,s=this.userMap.get(t);if(s)return s.streams[r]}},{key:\"getUserList\",value:function(){return this.userList}},{key:\"getStreamList\",value:function(){return this.streamList}},{key:\"getPlayerList\",value:function(){return this.getStreamList().map((function(e){return Object.assign({},e.playerAttributes)}))}},{key:\"reset\",value:function(){return this.streamList.forEach((function(e){e.reset()})),this.streamList=[],this.userList=[],this.userMap.clear(),{userList:this.userList,streamList:this.streamList}}},{key:\"_removeUserAndStream\",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e&&\"\"!==t.playerAttributes.userID})),this.userList=this.userList.filter((function(t){return t.userID!==e}))}},{key:\"_addStream\",value:function(e){-1===this.streamList.findIndex((function(t){return t.playerAttributes.userID===e.playerAttributes.userID&&t.playerAttributes.streamType===e.playerAttributes.streamType}))&&this.streamList.push(e)}},{key:\"_removeStream\",value:function(e){this.streamList=this.streamList.filter((function(t){return t.playerAttributes.userID!==e.playerAttributes.userID||t.playerAttributes.streamType!==e.playerAttributes.streamType})),this.getUser(e.playerAttributes.userID).streams[e.playerAttributes.streamType]=void 0}}]),e}(),se=function(){function e(){t(this,e)}return s(e,[{key:\"on\",value:function(e,t,r){\"function\"==typeof t?(this._stores=this._stores||{},(this._stores[e]=this._stores[e]||[]).push({cb:t,ctx:r})):console.error(\"listener must be a function\")}},{key:\"emit\",value:function(e){this._stores=this._stores||{};var t,r=this._stores[e];if(r){r=r.slice(0),(t=[].slice.call(arguments,1))[0]={eventCode:e,data:t[0]};for(var s=0,a=r.length;s4294967295?(D+=4294967295,Date.now()-D):t},utc:function(){return Math.round(Date.now()/1e3)}},b=function(t){return JSON.stringify(t,["message","code"])}},function(t,e,n){n.r(e);var i=n(3),r=n(0);let o=0;const s=new Map;function a(){const t=new Date;return"TSignaling "+t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())+":"}const u={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,i=t.length;n0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]t.weight>e.weight),this}_getCallbacks(t){return o(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==o(this)._maxListeners&&o(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),r=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&r&&r.context===n}_has(t){return o(this)._events.has(t)}on(t,e,n=null,i=1){const r=o(this);if("function"!=typeof e)throw new TypeError(e+" is not a function");return this._has(t)?(this._achieveMaxListener(t)&&r._console.warn(`Max listeners (${r._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&r._console.warn(`Event "${t}" already has the callback ${e}.`)):(r._events.add(t),r._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,r=1){const o=(...r)=>(this.off(t,o),i.call(e,n,r));return this.on(t,o,n,r)}off(t,e=null){const n=o(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=o(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.r(e);var i=n(0);const r=Object.prototype.hasOwnProperty;e.default=function(t){if(null==t)return!0;if("boolean"==typeof t)return!1;if("number"==typeof t)return 0===t;if("string"==typeof t)return 0===t.length;if("function"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return""===t.message;if(Object(i.f)(t)){for(const e in t)if(r.call(t,e))return!1;return!0}return!!(Object(i.e)(t)||Object(i.g)(t)||Object(i.c)(t))&&0===t.size}},function(t,e,n){n.r(e);class i extends Error{constructor(t){super(),this.code=t.code,this.message=t.message,this.data=t.data||{}}}e.default=i},function(t,e,n){n.r(e);var i=n(1),r=n(4),o=n.n(r);e.default=class{constructor(){this._funcMap=new Map}defense(t,e,n){if("string"!=typeof t)return null;if(0===t.length)return null;if("function"!=typeof e)return null;if(this._funcMap.has(t)&&this._funcMap.get(t).has(e))return this._funcMap.get(t).get(e);this._funcMap.has(t)||this._funcMap.set(t,new Map);let i=null;return this._funcMap.get(t).has(e)?i=this._funcMap.get(t).get(e):(i=this._pack(t,e,n),this._funcMap.get(t).set(e,i)),i}defenseOnce(t,e,n){return"function"!=typeof e?null:this._pack(t,e,n)}find(t,e){return"string"!=typeof t||0===t.length||"function"!=typeof e?null:this._funcMap.has(t)?this._funcMap.get(t).has(e)?this._funcMap.get(t).get(e):(i.default.log(`SafetyCallback.find: 找不到 func —— ${t}/${""!==e.name?e.name:"[anonymous]"}`),null):(i.default.log(`SafetyCallback.find: 找不到 eventName-${t} 对应的 func`),null)}delete(t,e){return"function"==typeof e&&(!!this._funcMap.has(t)&&(!!this._funcMap.get(t).has(e)&&(this._funcMap.get(t).delete(e),0===this._funcMap.get(t).size&&this._funcMap.delete(t),!0)))}_pack(t,e,n){return function(){try{e.apply(n,Array.from(arguments))}catch(e){const n=Object.values(o.a).indexOf(t),r=Object.keys(o.a)[n];i.default.error(`接入侧事件 EVENT.${r} 对应的回调函数逻辑存在问题,请检查!`,e)}}}}},function(t,e,n){ +__DEFINE__(1710723475377, function(require, module, exports) { +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tim-wx-sdk")):"function"==typeof define&&define.amd?define(["tim-wx-sdk"],e):"object"==typeof exports?exports.TSignaling=e(require("tim-wx-sdk")):t.TSignaling=e(t.TIM)}(window,(function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(t,e,n){n.d(e,"e",(function(){return I})),n.d(e,"g",(function(){return h})),n.d(e,"c",(function(){return g})),n.d(e,"f",(function(){return v})),n.d(e,"b",(function(){return m})),n.d(e,"d",(function(){return T})),n.d(e,"a",(function(){return S})),n.d(e,"h",(function(){return b}));const i="undefined"!=typeof window,o=("undefined"!=typeof wx&&wx.getSystemInfoSync,i&&window.navigator&&window.navigator.userAgent||""),r=/AppleWebKit\/([\d.]+)/i.exec(o),s=(r&&parseFloat(r.pop()),/iPad/i.test(o)),a=/iPhone/i.test(o)&&!s,u=/iPod/i.test(o),l=a||s||u,c=(function(){const t=o.match(/OS (\d+)_/i);t&&t[1]&&t[1]}(),/Android/i.test(o)),d=function(){const t=o.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;const e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);return e&&n?parseFloat(t[1]+"."+t[2]):e||null}(),f=(c&&/webkit/i.test(o),/Firefox/i.test(o),/Edge/i.test(o)),_=!f&&/Chrome/i.test(o),p=(function(){const t=o.match(/Chrome\/(\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(o),/MSIE\s8\.0/.test(o),function(){const t=/MSIE\s(\d+)\.\d/.exec(o);let e=t&&parseFloat(t[1]);!e&&/Trident\/7.0/i.test(o)&&/rv:11.0/.test(o)&&(e=11)}(),/Safari/i.test(o),/TBS\/\d+/i.test(o));(function(){const t=o.match(/TBS\/(\d+)/i);if(t&&t[1])t[1]})(),!p&&/MQQBrowser\/\d+/i.test(o),!p&&/ QQBrowser\/\d+/i.test(o),/(micromessenger|webbrowser)/i.test(o),/Windows/i.test(o),/MAC OS X/i.test(o),/MicroMessenger/i.test(o);n(2),n(1);const I=function(t){return"map"===y(t)},h=function(t){return"set"===y(t)},g=function(t){return"file"===y(t)},v=function(t){if("object"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},E=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===y(t)},m=function(t){return E(t)||function(t){return null!==t&&"object"==typeof t}(t)},T=function(t){return t instanceof Error},y=function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()};let D=0;Date.now||(Date.now=function(){return(new Date).getTime()});const S={now:function(){0===D&&(D=Date.now()-1);const t=Date.now()-D;return t>4294967295?(D+=4294967295,Date.now()-D):t},utc:function(){return Math.round(Date.now()/1e3)}},b=function(t){return JSON.stringify(t,["message","code"])}},function(t,e,n){n.r(e);var i=n(3),o=n(0);let r=0;const s=new Map;function a(){const t=new Date;return"TSignaling "+t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(t){let e;switch(t.toString().length){case 1:e="00"+t;break;case 2:e="0"+t;break;default:e=t}return e}(t.getMilliseconds())+":"}const u={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,i=t.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]t.weight>e.weight),this}_getCallbacks(t){return r(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==r(this)._maxListeners&&r(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),o=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&o&&o.context===n}_has(t){return r(this)._events.has(t)}on(t,e,n=null,i=1){const o=r(this);if("function"!=typeof e)throw new TypeError(e+" is not a function");return this._has(t)?(this._achieveMaxListener(t)&&o._console.warn(`Max listeners (${o._maxListeners}) for event "${t}" is reached!`),this._callbackIsExists(...arguments)&&o._console.warn(`Event "${t}" already has the callback ${e}.`)):(o._events.add(t),o._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,o=1){const r=(...o)=>(this.off(t,r),i.call(e,n,o));return this.on(t,r,n,o)}off(t,e=null){const n=r(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=r(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.r(e);var i=n(0);const o=Object.prototype.hasOwnProperty;e.default=function(t){if(null==t)return!0;if("boolean"==typeof t)return!1;if("number"==typeof t)return 0===t;if("string"==typeof t)return 0===t.length;if("function"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return""===t.message;if(Object(i.f)(t)){for(const e in t)if(o.call(t,e))return!1;return!0}return!!(Object(i.e)(t)||Object(i.g)(t)||Object(i.c)(t))&&0===t.size}},function(t,e,n){n.r(e);class i extends Error{constructor(t){super(),this.code=t.code,this.message=t.message,this.data=t.data||{}}}e.default=i},function(t,e,n){n.r(e);var i=n(1),o=n(4),r=n.n(o);e.default=class{constructor(){this._funcMap=new Map}defense(t,e,n){if("string"!=typeof t)return null;if(0===t.length)return null;if("function"!=typeof e)return null;if(this._funcMap.has(t)&&this._funcMap.get(t).has(e))return this._funcMap.get(t).get(e);this._funcMap.has(t)||this._funcMap.set(t,new Map);let i=null;return this._funcMap.get(t).has(e)?i=this._funcMap.get(t).get(e):(i=this._pack(t,e,n),this._funcMap.get(t).set(e,i)),i}defenseOnce(t,e,n){return"function"!=typeof e?null:this._pack(t,e,n)}find(t,e){return"string"!=typeof t||0===t.length||"function"!=typeof e?null:this._funcMap.has(t)?this._funcMap.get(t).has(e)?this._funcMap.get(t).get(e):(i.default.log(`SafetyCallback.find: 找不到 func —— ${t}/${""!==e.name?e.name:"[anonymous]"}`),null):(i.default.log(`SafetyCallback.find: 找不到 eventName-${t} 对应的 func`),null)}delete(t,e){return"function"==typeof e&&(!!this._funcMap.has(t)&&(!!this._funcMap.get(t).has(e)&&(this._funcMap.get(t).delete(e),0===this._funcMap.get(t).size&&this._funcMap.delete(t),!0)))}_pack(t,e,n){return function(){try{e.apply(n,Array.from(arguments))}catch(e){const n=Object.values(r.a).indexOf(t),o=Object.keys(r.a)[n];i.default.error(`接入侧事件 EVENT.${o} 对应的回调函数逻辑存在问题,请检查!`,e)}}}}},function(t,e,n){ /** * UUID.js - RFC-compliant UUID Generator for JavaScript * * @file * @author LiosK - * @version v4.2.5 - * @license Apache License 2.0: Copyright (c) 2010-2020 LiosK + * @version v4.2.12 + * @license Apache License 2.0: Copyright (c) 2010-2022 LiosK */ -var i;i=function(e){function i(){var t=r._getRandomInt;this.timestamp=0,this.sequence=t(14),this.node=1099511627776*(1|t(8))+t(40),this.tick=t(4)}function r(){}return r.generate=function(){var t=r._getRandomInt,e=r._hexAligner;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)},r._getRandomInt=function(t){if(t<0||t>53)return NaN;var e=0|1073741824*Math.random();return t>30?e+1073741824*(0|Math.random()*(1<>>30-t},r._hexAligner=function(t,e){for(var n=t.toString(16),i=e-n.length,r="0";i>0;i>>>=1,r+=r)1&i&&(n=r+n);return n},r.overwrittenUUID=e,function(){var t=r._getRandomInt;r.useMathRandom=function(){r._getRandomInt=t};var e=null,i=t;"undefined"!=typeof window&&(e=window.crypto||window.msCrypto)?e.getRandomValues&&"undefined"!=typeof Uint32Array&&(i=function(t){if(t<0||t>53)return NaN;var n=new Uint32Array(t>32?2:1);return n=e.getRandomValues(n)||n,t>32?n[0]+4294967296*(n[1]>>>64-t):n[0]>>>32-t}):(e=n(14))&&e.randomBytes&&(i=function(t){if(t<0||t>53)return NaN;var n=e.randomBytes(t>32?8:4),i=n.readUInt32BE(0);return t>32?i+4294967296*(n.readUInt32BE(4)>>>64-t):i>>>32-t}),r._getRandomInt=i}(),r.FIELD_NAMES=["timeLow","timeMid","timeHiAndVersion","clockSeqHiAndReserved","clockSeqLow","node"],r.FIELD_SIZES=[32,16,16,8,8,48],r.genV4=function(){var t=r._getRandomInt;return(new r)._init(t(32),t(16),16384|t(12),128|t(6),t(8),t(48))},r.parse=function(t){var e;if(e=/^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(t)){var n=e[1]||"",i=e[8]||"";if(n+i===""||"{"===n&&"}"===i||"urn:uuid:"===n.toLowerCase()&&""===i)return(new r)._init(parseInt(e[2],16),parseInt(e[3],16),parseInt(e[4],16),parseInt(e[5],16),parseInt(e[6],16),parseInt(e[7],16))}return null},r.prototype._init=function(){var t=r.FIELD_NAMES,e=r.FIELD_SIZES,n=r._binAligner,i=r._hexAligner;this.intFields=new Array(6),this.bitFields=new Array(6),this.hexFields=new Array(6);for(var o=0;o<6;o++){var s=parseInt(arguments[o]||0);this.intFields[o]=this.intFields[t[o]]=s,this.bitFields[o]=this.bitFields[t[o]]=n(s,e[o]),this.hexFields[o]=this.hexFields[t[o]]=i(s,e[o]>>>2)}return this.version=this.intFields.timeHiAndVersion>>>12&15,this.bitString=this.bitFields.join(""),this.hexNoDelim=this.hexFields.join(""),this.hexString=this.hexFields[0]+"-"+this.hexFields[1]+"-"+this.hexFields[2]+"-"+this.hexFields[3]+this.hexFields[4]+"-"+this.hexFields[5],this.urn="urn:uuid:"+this.hexString,this},r._binAligner=function(t,e){for(var n=t.toString(2),i=e-n.length,r="0";i>0;i>>>=1,r+=r)1&i&&(n=r+n);return n},r.prototype.toString=function(){return this.hexString},r.prototype.equals=function(t){if(!(t instanceof r))return!1;for(var e=0;e<6;e++)if(this.intFields[e]!==t.intFields[e])return!1;return!0},r.NIL=(new r)._init(0,0,0,0,0,0),r.genV1=function(){null==r._state&&r.resetState();var t=(new Date).getTime(),e=r._state;t!=e.timestamp?(t>>8|128,a=255&e.sequence;return(new r)._init(i,n.mid,o,s,a,e.node)},r.resetState=function(){r._state=new i},r._tsRatio=1/4,r._state=null,r._getTimeFieldValues=function(t){var e=t-Date.UTC(1582,9,15),n=e/4294967296*1e4&268435455;return{low:1e4*(268435455&e)%4294967296,mid:65535&n,hi:n>>>16,timestamp:e}},"object"==typeof t.exports&&(t.exports=r),r}(i)},function(t,e){},function(t){t.exports=JSON.parse('{"name":"tsignaling","version":"1.0.3","description":"腾讯云 Web 信令 SDK","main":"./src/index.ts","scripts":{"lint":"./node_modules/.bin/eslint ./src","fix":"./node_modules/.bin/eslint --fix ./src","ts2js":"tsc src/index.ts --outDir build/ts2js","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","build:wx":"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js","build:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js","build:package":"node build/package-bundle.js","prerelease":"npm run changelog && npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js","start:wx":"cross-env NODE_ENV=wx webpack-dev-server --config webpack.config.js","start:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js","build_withcopy":"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js","build_withcopy:mp":"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js","changelog":"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md"},"husky":{"hooks":{"pre-commit":"npm run lint"}},"lint-staged":{"*.{.ts,.tsx}":["eslint","git add"]},"keywords":["腾讯云","即时通信","信令"],"author":"","license":"ISC","devDependencies":{"conventional-changelog-cli":"^2.1.1","cross-env":"^7.0.2","fs-extra":"^9.0.1","html-webpack-plugin":"^4.3.0","ts-loader":"^7.0.5","typescript":"^3.9.9","webpack":"^4.43.0","webpack-cli":"^3.3.11","webpack-dev-server":"^3.11.0"},"dependencies":{"@typescript-eslint/eslint-plugin":"^4.22.1","@typescript-eslint/parser":"^4.22.1","EventEmitter":"^1.0.0","docdash-blue":"^1.1.3","eslint":"^5.16.0","eslint-config-google":"^0.13.0","eslint-plugin-classes":"^0.1.1","jsdoc":"^3.6.4","jsdoc-plugin-typescript":"^2.0.5","pretty":"^2.0.0","replace":"^1.2.0","uuidjs":"^4.2.5"}}')},function(t,e,n){var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0&&u.lastMessage.lastTime&&1e3*u.lastMessage.lastTime>this.currentTime-this.expiredTime&&t.push(u);return[2,t]}}))}))},e}(l),f=function(t){function e(e){var n=t.call(this)||this;return n.tim=null,n.expiredTime=3e4,n.tim=e.tim,n}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){var e,n,i,r,o,a,l,c,d=this;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,s.label=1;case 1:return nd.currentTime-d.expiredTime}))),s.label=3;case 3:return n++,[3,1];case 4:return[2,e.flat().sort((function(t,e){return t.time-e.time}))]}}))}))},e}(l),_=function(t){function e(){return t.call(this)||this}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,t.filter((function(t){var e=!1;try{e=JSON.parse(t.payload.data).businessID===a.BusinessID.SIGNAL}catch(t){}return e}))]}))}))},e}(l),p=function(t){function e(){return t.call(this)||this}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(r){return Array.isArray(t)?0===t.length?[2,[]]:(e=new Map,t.forEach((function(t,n){var i=JSON.parse(t.payload.data),r=i.inviteID,o=i.actionType;!e.has(r)||e.get(r).actionType!==a.ActionType.INVITE||o!==a.ActionType.CANCEL_INVITE&&o!==a.ActionType.ACCEPT_INVITE&&o!==a.ActionType.REJECT_INVITE&&o!==a.ActionType.INVITE_TIMEOUT?e.set(r,{index:n,actionType:o}):e.delete(r)})),n=[],e.forEach((function(t){t.actionType===a.ActionType.INVITE&&n.push(t.index)})),0===n.length?[2,[]]:(i=[],n.sort((function(t,e){return t-e})).forEach((function(e){i.push(t[e])})),[2,i])):[2,[]]}))}))},e}(l),h=function(){function t(t){this.tim=null;var e=t.tim;this.tim=e}return t.prototype.getHistoricalSignaling=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){return(t=new c).register(new d({tim:this.tim})),t.register(new f({tim:this.tim})),t.register(new _),t.register(new p),[2,t.run()]}))}))},t}();e.default=h}]).default})); +var i;i=function(e){function i(){var t=o._getRandomInt;this.timestamp=0,this.tick=0,this.sequence=t(14),this.node=1099511627776*(1|t(8))+t(40)}function o(){}return o.generate=function(){var t=o._getRandomInt,e=o._hexAligner;return e(t(32),8)+"-"+e(t(16),4)+"-"+e(16384|t(12),4)+"-"+e(32768|t(14),4)+"-"+e(t(48),12)},o._getRandomInt=function(t){if(t<0||t>53)return NaN;var e=0|1073741824*Math.random();return t>30?e+1073741824*(0|Math.random()*(1<>>30-t},o._hexAligner=function(t,e){for(var n=t.toString(16),i=e-n.length,o="0";i>0;i>>>=1,o+=o)1&i&&(n=o+n);return n},o.overwrittenUUID=e,function(){var t=o._getRandomInt;o.useMathRandom=function(){o._getRandomInt=t};var e=null,i=t;"undefined"!=typeof window&&(e=window.crypto||window.msCrypto)?e.getRandomValues&&"undefined"!=typeof Uint32Array&&(i=function(t){if(t<0||t>53)return NaN;var n=new Uint32Array(t>32?2:1);return n=e.getRandomValues(n)||n,t>32?n[0]+4294967296*(n[1]>>>64-t):n[0]>>>32-t}):(e=n(14))&&e.randomBytes&&(i=function(t){if(t<0||t>53)return NaN;var n=e.randomBytes(t>32?8:4),i=n.readUInt32BE(0);return t>32?i+4294967296*(n.readUInt32BE(4)>>>64-t):i>>>32-t}),o._getRandomInt=i}(),o.FIELD_NAMES=["timeLow","timeMid","timeHiAndVersion","clockSeqHiAndReserved","clockSeqLow","node"],o.FIELD_SIZES=[32,16,16,8,8,48],o.genV4=function(){var t=o._getRandomInt;return(new o)._init(t(32),t(16),16384|t(12),128|t(6),t(8),t(48))},o.parse=function(t){var e;if(e=/^\s*(urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\})?\s*$/i.exec(t)){var n=e[1]||"",i=e[8]||"";if(n+i===""||"{"===n&&"}"===i||"urn:uuid:"===n.toLowerCase()&&""===i)return(new o)._init(parseInt(e[2],16),parseInt(e[3],16),parseInt(e[4],16),parseInt(e[5],16),parseInt(e[6],16),parseInt(e[7],16))}return null},o.prototype._init=function(){var t=o.FIELD_NAMES,e=o.FIELD_SIZES,n=o._binAligner,i=o._hexAligner;this.intFields=new Array(6),this.bitFields=new Array(6),this.hexFields=new Array(6);for(var r=0;r<6;r++){var s=parseInt(arguments[r]||0);this.intFields[r]=this.intFields[t[r]]=s,this.bitFields[r]=this.bitFields[t[r]]=n(s,e[r]),this.hexFields[r]=this.hexFields[t[r]]=i(s,e[r]>>>2)}return this.version=this.intFields.timeHiAndVersion>>>12&15,this.bitString=this.bitFields.join(""),this.hexNoDelim=this.hexFields.join(""),this.hexString=this.hexFields[0]+"-"+this.hexFields[1]+"-"+this.hexFields[2]+"-"+this.hexFields[3]+this.hexFields[4]+"-"+this.hexFields[5],this.urn="urn:uuid:"+this.hexString,this},o._binAligner=function(t,e){for(var n=t.toString(2),i=e-n.length,o="0";i>0;i>>>=1,o+=o)1&i&&(n=o+n);return n},o.prototype.toString=function(){return this.hexString},o.prototype.equals=function(t){if(!(t instanceof o))return!1;for(var e=0;e<6;e++)if(this.intFields[e]!==t.intFields[e])return!1;return!0},o.NIL=(new o)._init(0,0,0,0,0,0),o.genV1=function(){null==o._state&&o.resetState();var t=(new Date).getTime(),e=o._state;t!=e.timestamp?(t>>8|128,a=255&e.sequence;return(new o)._init(i,n.mid,r,s,a,e.node)},o.resetState=function(){o._state=new i},o._tsRatio=1/4,o._state=null,o._getTimeFieldValues=function(t){var e=t-Date.UTC(1582,9,15),n=e/4294967296*1e4&268435455;return{low:1e4*(268435455&e)%4294967296,mid:65535&n,hi:n>>>16,timestamp:e}},"object"==typeof t.exports&&(t.exports=o),o}(i)},function(t,e){},function(t){t.exports=JSON.parse('{"name":"tsignaling","version":"1.0.6","description":"腾讯云 Web 信令 SDK","main":"./src/index.ts","scripts":{"lint":"./node_modules/.bin/eslint ./src","fix":"./node_modules/.bin/eslint --fix ./src","ts2js":"tsc src/index.ts --outDir build/ts2js","doc":"npm run ts2js && npm run doc:clean && npm run doc:build","doc:build":"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js","doc:clean":"node ./build/jsdoc/clean-doc.js","build:wx":"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js","build:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js","build:package":"node build/package-bundle.js","prerelease":"npm run changelog && npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js","start:wx":"cross-env NODE_ENV=wx webpack-dev-server --config webpack.config.js","start:web":"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js","build_withcopy":"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js","build_withcopy:mp":"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js","changelog":"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md"},"husky":{"hooks":{"pre-commit":"npm run lint"}},"lint-staged":{"*.{.ts,.tsx}":["eslint","git add"]},"keywords":["腾讯云","即时通信","信令"],"author":"","license":"ISC","devDependencies":{"conventional-changelog-cli":"^2.1.1","cross-env":"^7.0.2","fs-extra":"^9.0.1","html-webpack-plugin":"^4.3.0","ts-loader":"^7.0.5","typescript":"^3.9.9","webpack":"^4.43.0","@types/node":"18.11.9","webpack-cli":"^3.3.11","webpack-dev-server":"^3.11.0"},"dependencies":{"@typescript-eslint/eslint-plugin":"^4.22.1","@typescript-eslint/parser":"^4.22.1","EventEmitter":"^1.0.0","docdash-blue":"1.1.9","eslint":"^5.16.0","eslint-config-google":"^0.13.0","eslint-plugin-classes":"^0.1.1","jsdoc":"^3.6.4","jsdoc-plugin-typescript":"^2.0.5","pretty":"^2.0.0","replace":"^1.2.0","uuidjs":"^4.2.5"}}')},function(t,e,n){var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]0&&u.lastMessage.lastTime&&1e3*u.lastMessage.lastTime>this.currentTime-this.expiredTime&&t.push(u);return[2,t]}}))}))},e}(l),f=function(t){function e(e){var n=t.call(this)||this;return n.tim=null,n.expiredTime=3e4,n.tim=e.tim,n}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){var e,n,i,o,r,a,l,c,d=this;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,s.label=1;case 1:return nd.currentTime-d.expiredTime}))),s.label=3;case 3:return n++,[3,1];case 4:return[2,e.flat().sort((function(t,e){return t.time-e.time}))]}}))}))},e}(l),_=function(t){function e(){return t.call(this)||this}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,t.filter((function(t){var e=!1;try{e=JSON.parse(t.payload.data).businessID===a.BusinessID.SIGNAL}catch(t){}return e}))]}))}))},e}(l),p=function(t){function e(){return t.call(this)||this}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(o){return Array.isArray(t)?0===t.length?[2,[]]:(e=new Map,t.forEach((function(t,n){var i=JSON.parse(t.payload.data),o=i.inviteID,r=i.actionType;!e.has(o)||e.get(o).actionType!==a.ActionType.INVITE||r!==a.ActionType.CANCEL_INVITE&&r!==a.ActionType.ACCEPT_INVITE&&r!==a.ActionType.REJECT_INVITE&&r!==a.ActionType.INVITE_TIMEOUT?e.set(o,{index:n,actionType:r}):e.delete(o)})),n=[],e.forEach((function(t){t.actionType===a.ActionType.INVITE&&n.push(t.index)})),0===n.length?[2,[]]:(i=[],n.sort((function(t,e){return t-e})).forEach((function(e){i.push(t[e])})),[2,i])):[2,[]]}))}))},e}(l),I=function(){function t(t){this.tim=null;var e=t.tim;this.tim=e}return t.prototype.getHistoricalSignaling=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){return(t=new c).register(new d({tim:this.tim})),t.register(new f({tim:this.tim})),t.register(new _),t.register(new p),[2,t.run()]}))}))},t}();e.default=I}]).default})); }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) -return __REQUIRE__(1704939160520); +return __REQUIRE__(1710723475377); })() //miniprogram-npm-outsideDeps=["tim-wx-sdk"] //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/TUICallKit/min-npm/tsignaling-wx/index.js.map b/TUICallKit/min-npm/tsignaling-wx/index.js.map index 0f5a807..ba1a89a 100644 --- a/TUICallKit/min-npm/tsignaling-wx/index.js.map +++ b/TUICallKit/min-npm/tsignaling-wx/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["tsignaling-wx.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e(require(\"tim-wx-sdk\")):\"function\"==typeof define&&define.amd?define([\"tim-wx-sdk\"],e):\"object\"==typeof exports?exports.TSignaling=e(require(\"tim-wx-sdk\")):t.TSignaling=e(t.TIM)}(window,(function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=7)}([function(t,e,n){n.d(e,\"e\",(function(){return h})),n.d(e,\"g\",(function(){return I})),n.d(e,\"c\",(function(){return g})),n.d(e,\"f\",(function(){return v})),n.d(e,\"b\",(function(){return m})),n.d(e,\"d\",(function(){return T})),n.d(e,\"a\",(function(){return S})),n.d(e,\"h\",(function(){return b}));const i=\"undefined\"!=typeof window,r=(\"undefined\"!=typeof wx&&wx.getSystemInfoSync,i&&window.navigator&&window.navigator.userAgent||\"\"),o=/AppleWebKit\\/([\\d.]+)/i.exec(r),s=(o&&parseFloat(o.pop()),/iPad/i.test(r)),a=/iPhone/i.test(r)&&!s,u=/iPod/i.test(r),l=a||s||u,c=(function(){const t=r.match(/OS (\\d+)_/i);t&&t[1]&&t[1]}(),/Android/i.test(r)),d=function(){const t=r.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);if(!t)return null;const e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);return e&&n?parseFloat(t[1]+\".\"+t[2]):e||null}(),f=(c&&/webkit/i.test(r),/Firefox/i.test(r),/Edge/i.test(r)),_=!f&&/Chrome/i.test(r),p=(function(){const t=r.match(/Chrome\\/(\\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(r),/MSIE\\s8\\.0/.test(r),function(){const t=/MSIE\\s(\\d+)\\.\\d/.exec(r);let e=t&&parseFloat(t[1]);!e&&/Trident\\/7.0/i.test(r)&&/rv:11.0/.test(r)&&(e=11)}(),/Safari/i.test(r),/TBS\\/\\d+/i.test(r));(function(){const t=r.match(/TBS\\/(\\d+)/i);if(t&&t[1])t[1]})(),!p&&/MQQBrowser\\/\\d+/i.test(r),!p&&/ QQBrowser\\/\\d+/i.test(r),/(micromessenger|webbrowser)/i.test(r),/Windows/i.test(r),/MAC OS X/i.test(r),/MicroMessenger/i.test(r);n(2),n(1);const h=function(t){return\"map\"===y(t)},I=function(t){return\"set\"===y(t)},g=function(t){return\"file\"===y(t)},v=function(t){if(\"object\"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},E=function(t){return\"function\"==typeof Array.isArray?Array.isArray(t):\"array\"===y(t)},m=function(t){return E(t)||function(t){return null!==t&&\"object\"==typeof t}(t)},T=function(t){return t instanceof Error},y=function(t){return Object.prototype.toString.call(t).match(/^\\[object (.*)\\]$/)[1].toLowerCase()};let D=0;Date.now||(Date.now=function(){return(new Date).getTime()});const S={now:function(){0===D&&(D=Date.now()-1);const t=Date.now()-D;return t>4294967295?(D+=4294967295,Date.now()-D):t},utc:function(){return Math.round(Date.now()/1e3)}},b=function(t){return JSON.stringify(t,[\"message\",\"code\"])}},function(t,e,n){n.r(e);var i=n(3),r=n(0);let o=0;const s=new Map;function a(){const t=new Date;return\"TSignaling \"+t.toLocaleTimeString(\"en-US\",{hour12:!1})+\".\"+function(t){let e;switch(t.toString().length){case 1:e=\"00\"+t;break;case 2:e=\"0\"+t;break;default:e=t}return e}(t.getMilliseconds())+\":\"}const u={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,i=t.length;n0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0:r.length>0&&r.includes(this._userID))},t.prototype._startTimer=function(t,e){var n=this;void 0===e&&(e=!0);var i=t.timeout;if(c.default.log(\"TSignaling._startTimer timeout=\"+i+\" isInvitator=\"+e+\" timeoutStatus=\"+(0===i)),0!==i)var r=e?i+5:i,o=1,s=setInterval((function(){var i=n._hasLocalInviteInfo(t,e);c.default.log(\"TSignaling.setInterval hasInviteInfo=\"+i),o0||l?this._outerEmitter.emit(t.EVENT.NEW_INVITATION_RECEIVED,{inviteID:n,inviter:i,groupID:o,inviteeList:r,data:e.data||\"\"}):(o&&a||!o)&&(this._inviteInfoMap.set(n,e),this._outerEmitter.emit(t.EVENT.NEW_INVITATION_RECEIVED,{inviteID:n,inviter:i,groupID:o,inviteeList:r,data:e.data||\"\"}),this._startTimer(e,!1))},t.prototype._onInviteeRejected=function(t){var e=t.inviteID,n=t.inviter,i=t.groupID,r=this._inviteInfoMap.has(e);c.default.log(\"TSignaling._onInviteeRejected inviteID=\"+e+\" hasInviteID=\"+r+\" inviter=\"+n+\" groupID=\"+i+\" _isRejectNotifyAll=\"+this._isRejectNotifyAll),(i&&r||!i||this._isRejectNotifyAll)&&(this._updateLocalInviteInfo(t),this._outerEmitter.emit(u.default.INVITEE_REJECTED,{inviteID:e,inviter:n,groupID:i,invitee:t.inviteeList[0],data:t.data||\"\"}))},t.prototype._onInviteeAccepted=function(t){var e=t.inviteID,n=t.inviter,i=t.groupID,r=this._inviteInfoMap.has(e);c.default.log(\"TSignaling._onInviteeAccepted inviteID=\"+e+\" hasInviteID=\"+r+\" inviter=\"+n+\" groupID=\"+i),(i&&r||!i)&&(this._updateLocalInviteInfo(t),this._outerEmitter.emit(u.default.INVITEE_ACCEPTED,{inviteID:e,inviter:n,groupID:i,invitee:t.inviteeList[0],data:t.data||\"\"}))},t.prototype._onInvitationCancelled=function(t){var e=t.inviteID,n=t.inviter,i=t.groupID,r=this._inviteInfoMap.has(e);c.default.log(\"TSignaling._onInvitationCancelled inviteID=\"+e+\" hasInviteID=\"+r+\" inviter=\"+n+\" groupID=\"+i),(i&&r||!i)&&(this._deleteInviteInfoByID(e),this._outerEmitter.emit(u.default.INVITATION_CANCELLED,{inviteID:e,inviter:n,groupID:i,data:t.data||\"\"}))},t.prototype._onInvitationTimeout=function(t){var e=t.inviteID,n=t.inviter,i=t.groupID,r=t.data,o=this._inviteInfoMap.has(e);c.default.log(\"TSignaling._onInvitationTimeout inviteID=\"+e+\" hasInviteID=\"+o+\" inviter=\"+n+\" groupID=\"+i),c.default.log(\"TSignaling._onInvitationTimeout data=\"+t.data);var s=JSON.parse(r),a=i&&(0===s.call_end||d.default(s.room_id));d.default(s.room_id)&&s.call_end>0||a||(i&&o||!i)&&(this._updateLocalInviteInfo(t),this._outerEmitter.emit(u.default.INVITATION_TIMEOUT,{inviteID:e,inviter:n,groupID:i,inviteeList:t.inviteeList,isSelfTimeout:!1}))},t.prototype._updateLocalInviteInfo=function(t){var e=t.inviteID,n=t.inviter,i=t.inviteeList,r=t.groupID;if(c.default.log(\"TSignaling._updateLocalInviteInfo inviteID=\"+e+\" inviter=\"+n+\" groupID=\"+r),r){if(this._inviteInfoMap.has(e)){var o=i[0],s=this._inviteInfoMap.get(e).inviteeList;s.includes(o)&&(s.splice(s.indexOf(o),1),c.default.log(\"TSignaling._updateLocalInviteInfo remove \"+o+\" from localInviteeList. \"+s.length+\" invitees left\")),0===s.length&&this._deleteInviteInfoByID(e)}}else this._deleteInviteInfoByID(e)},t.prototype._deleteInviteInfoByID=function(t){this._inviteInfoMap.has(t)&&(c.default.log(\"TSignaling._deleteInviteInfoByID remove \"+t+\" from inviteInfoMap.\"),this._inviteInfoMap.delete(t))},t.prototype._sendCustomMessage=function(t,e,n){var o,a,l,d;return i(this,void 0,void 0,(function(){var i,f,_,p,I,g;return r(this,(function(r){switch(r.label){case 0:return i=e.groupID,f=this._tim.createCustomMessage({to:t,conversationType:i?h.TYPES.CONV_GROUP:h.TYPES.CONV_C2C,priority:h.TYPES.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}}),e.actionType!==s.ActionType.INVITE?[3,2]:(p={title:(_=n||{}).title||\"\",description:_.description||\"您有一个通话请求\",androidOPPOChannelID:_.androidOPPOChannelID||\"\",extension:this._handleOfflineInfo(e,_.extension||\"\")},c.default.log(\"TSignaling.offlinePushInfo \"+JSON.stringify(p)),[4,this._tim.sendMessage(f,{offlinePushInfo:{title:p.title,description:p.description,androidOPPOChannelID:p.androidOPPOChannelID,extension:p.extension}})]);case 1:return I=r.sent(),(null===(o=null==I?void 0:I.data)||void 0===o?void 0:o.message)&&this._outerEmitter.emit(u.default.MESSAGE_SENT_BY_ME,null===(a=null==I?void 0:I.data)||void 0===a?void 0:a.message),[2,I];case 2:return[4,this._tim.sendMessage(f)];case 3:return g=r.sent(),(null===(l=null==g?void 0:g.data)||void 0===l?void 0:l.message)&&this._outerEmitter.emit(u.default.MESSAGE_SENT_BY_ME,null===(d=null==g?void 0:g.data)||void 0===d?void 0:d.message),[2,g]}}))}))},t.prototype._handleOfflineInfo=function(t,e){var n=JSON.parse(t.data),i={action:t.actionType,call_type:n.call_type,room_id:n.room_id,call_id:t.inviteID,timeout:n.timeout,version:4,invited_list:t.inviteeList};t.groupID&&(i.group_id=t.groupID);var r={entity:{action:2,chatType:t.groupID?2:1,content:JSON.stringify(i),sendTime:parseInt(Date.now()/1e3+\"\"),sender:t.inviter,version:1},userData:e||\"\"},o=JSON.stringify(r);return c.default.log(\"TSignaling._handleOfflineInfo \"+o),o},t.EVENT=u.default,t.TYPES=l.default,t}();e.default=v},function(t,e,n){n.r(e),n.d(e,\"default\",(function(){return s}));const i=Function.prototype.apply,r=new WeakMap;function o(t){return r.has(t)||r.set(t,{}),r.get(t)}class s{constructor(t=null,e=console){const n=o(this);return n._events=new Set,n._callbacks={},n._console=e,n._maxListeners=null===t?null:parseInt(t,10),this}_addCallback(t,e,n,i){return this._getCallbacks(t).push({callback:e,context:n,weight:i}),this._getCallbacks(t).sort((t,e)=>t.weight>e.weight),this}_getCallbacks(t){return o(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==o(this)._maxListeners&&o(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),r=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&r&&r.context===n}_has(t){return o(this)._events.has(t)}on(t,e,n=null,i=1){const r=o(this);if(\"function\"!=typeof e)throw new TypeError(e+\" is not a function\");return this._has(t)?(this._achieveMaxListener(t)&&r._console.warn(`Max listeners (${r._maxListeners}) for event \"${t}\" is reached!`),this._callbackIsExists(...arguments)&&r._console.warn(`Event \"${t}\" already has the callback ${e}.`)):(r._events.add(t),r._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,r=1){const o=(...r)=>(this.off(t,o),i.call(e,n,r));return this.on(t,o,n,r)}off(t,e=null){const n=o(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=o(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.r(e);var i=n(0);const r=Object.prototype.hasOwnProperty;e.default=function(t){if(null==t)return!0;if(\"boolean\"==typeof t)return!1;if(\"number\"==typeof t)return 0===t;if(\"string\"==typeof t)return 0===t.length;if(\"function\"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return\"\"===t.message;if(Object(i.f)(t)){for(const e in t)if(r.call(t,e))return!1;return!0}return!!(Object(i.e)(t)||Object(i.g)(t)||Object(i.c)(t))&&0===t.size}},function(t,e,n){n.r(e);class i extends Error{constructor(t){super(),this.code=t.code,this.message=t.message,this.data=t.data||{}}}e.default=i},function(t,e,n){n.r(e);var i=n(1),r=n(4),o=n.n(r);e.default=class{constructor(){this._funcMap=new Map}defense(t,e,n){if(\"string\"!=typeof t)return null;if(0===t.length)return null;if(\"function\"!=typeof e)return null;if(this._funcMap.has(t)&&this._funcMap.get(t).has(e))return this._funcMap.get(t).get(e);this._funcMap.has(t)||this._funcMap.set(t,new Map);let i=null;return this._funcMap.get(t).has(e)?i=this._funcMap.get(t).get(e):(i=this._pack(t,e,n),this._funcMap.get(t).set(e,i)),i}defenseOnce(t,e,n){return\"function\"!=typeof e?null:this._pack(t,e,n)}find(t,e){return\"string\"!=typeof t||0===t.length||\"function\"!=typeof e?null:this._funcMap.has(t)?this._funcMap.get(t).has(e)?this._funcMap.get(t).get(e):(i.default.log(`SafetyCallback.find: 找不到 func —— ${t}/${\"\"!==e.name?e.name:\"[anonymous]\"}`),null):(i.default.log(`SafetyCallback.find: 找不到 eventName-${t} 对应的 func`),null)}delete(t,e){return\"function\"==typeof e&&(!!this._funcMap.has(t)&&(!!this._funcMap.get(t).has(e)&&(this._funcMap.get(t).delete(e),0===this._funcMap.get(t).size&&this._funcMap.delete(t),!0)))}_pack(t,e,n){return function(){try{e.apply(n,Array.from(arguments))}catch(e){const n=Object.values(o.a).indexOf(t),r=Object.keys(o.a)[n];i.default.error(`接入侧事件 EVENT.${r} 对应的回调函数逻辑存在问题,请检查!`,e)}}}}},function(t,e,n){\r\n/**\r\n * UUID.js - RFC-compliant UUID Generator for JavaScript\r\n *\r\n * @file\r\n * @author LiosK\r\n * @version v4.2.5\r\n * @license Apache License 2.0: Copyright (c) 2010-2020 LiosK\r\n */\r\nvar i;i=function(e){function i(){var t=r._getRandomInt;this.timestamp=0,this.sequence=t(14),this.node=1099511627776*(1|t(8))+t(40),this.tick=t(4)}function r(){}return r.generate=function(){var t=r._getRandomInt,e=r._hexAligner;return e(t(32),8)+\"-\"+e(t(16),4)+\"-\"+e(16384|t(12),4)+\"-\"+e(32768|t(14),4)+\"-\"+e(t(48),12)},r._getRandomInt=function(t){if(t<0||t>53)return NaN;var e=0|1073741824*Math.random();return t>30?e+1073741824*(0|Math.random()*(1<>>30-t},r._hexAligner=function(t,e){for(var n=t.toString(16),i=e-n.length,r=\"0\";i>0;i>>>=1,r+=r)1&i&&(n=r+n);return n},r.overwrittenUUID=e,function(){var t=r._getRandomInt;r.useMathRandom=function(){r._getRandomInt=t};var e=null,i=t;\"undefined\"!=typeof window&&(e=window.crypto||window.msCrypto)?e.getRandomValues&&\"undefined\"!=typeof Uint32Array&&(i=function(t){if(t<0||t>53)return NaN;var n=new Uint32Array(t>32?2:1);return n=e.getRandomValues(n)||n,t>32?n[0]+4294967296*(n[1]>>>64-t):n[0]>>>32-t}):(e=n(14))&&e.randomBytes&&(i=function(t){if(t<0||t>53)return NaN;var n=e.randomBytes(t>32?8:4),i=n.readUInt32BE(0);return t>32?i+4294967296*(n.readUInt32BE(4)>>>64-t):i>>>32-t}),r._getRandomInt=i}(),r.FIELD_NAMES=[\"timeLow\",\"timeMid\",\"timeHiAndVersion\",\"clockSeqHiAndReserved\",\"clockSeqLow\",\"node\"],r.FIELD_SIZES=[32,16,16,8,8,48],r.genV4=function(){var t=r._getRandomInt;return(new r)._init(t(32),t(16),16384|t(12),128|t(6),t(8),t(48))},r.parse=function(t){var e;if(e=/^\\s*(urn:uuid:|\\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\\})?\\s*$/i.exec(t)){var n=e[1]||\"\",i=e[8]||\"\";if(n+i===\"\"||\"{\"===n&&\"}\"===i||\"urn:uuid:\"===n.toLowerCase()&&\"\"===i)return(new r)._init(parseInt(e[2],16),parseInt(e[3],16),parseInt(e[4],16),parseInt(e[5],16),parseInt(e[6],16),parseInt(e[7],16))}return null},r.prototype._init=function(){var t=r.FIELD_NAMES,e=r.FIELD_SIZES,n=r._binAligner,i=r._hexAligner;this.intFields=new Array(6),this.bitFields=new Array(6),this.hexFields=new Array(6);for(var o=0;o<6;o++){var s=parseInt(arguments[o]||0);this.intFields[o]=this.intFields[t[o]]=s,this.bitFields[o]=this.bitFields[t[o]]=n(s,e[o]),this.hexFields[o]=this.hexFields[t[o]]=i(s,e[o]>>>2)}return this.version=this.intFields.timeHiAndVersion>>>12&15,this.bitString=this.bitFields.join(\"\"),this.hexNoDelim=this.hexFields.join(\"\"),this.hexString=this.hexFields[0]+\"-\"+this.hexFields[1]+\"-\"+this.hexFields[2]+\"-\"+this.hexFields[3]+this.hexFields[4]+\"-\"+this.hexFields[5],this.urn=\"urn:uuid:\"+this.hexString,this},r._binAligner=function(t,e){for(var n=t.toString(2),i=e-n.length,r=\"0\";i>0;i>>>=1,r+=r)1&i&&(n=r+n);return n},r.prototype.toString=function(){return this.hexString},r.prototype.equals=function(t){if(!(t instanceof r))return!1;for(var e=0;e<6;e++)if(this.intFields[e]!==t.intFields[e])return!1;return!0},r.NIL=(new r)._init(0,0,0,0,0,0),r.genV1=function(){null==r._state&&r.resetState();var t=(new Date).getTime(),e=r._state;t!=e.timestamp?(t>>8|128,a=255&e.sequence;return(new r)._init(i,n.mid,o,s,a,e.node)},r.resetState=function(){r._state=new i},r._tsRatio=1/4,r._state=null,r._getTimeFieldValues=function(t){var e=t-Date.UTC(1582,9,15),n=e/4294967296*1e4&268435455;return{low:1e4*(268435455&e)%4294967296,mid:65535&n,hi:n>>>16,timestamp:e}},\"object\"==typeof t.exports&&(t.exports=r),r}(i)},function(t,e){},function(t){t.exports=JSON.parse('{\"name\":\"tsignaling\",\"version\":\"1.0.3\",\"description\":\"腾讯云 Web 信令 SDK\",\"main\":\"./src/index.ts\",\"scripts\":{\"lint\":\"./node_modules/.bin/eslint ./src\",\"fix\":\"./node_modules/.bin/eslint --fix ./src\",\"ts2js\":\"tsc src/index.ts --outDir build/ts2js\",\"doc\":\"npm run ts2js && npm run doc:clean && npm run doc:build\",\"doc:build\":\"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js\",\"doc:clean\":\"node ./build/jsdoc/clean-doc.js\",\"build:wx\":\"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js\",\"build:web\":\"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js\",\"build:package\":\"node build/package-bundle.js\",\"prerelease\":\"npm run changelog && npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js\",\"start:wx\":\"cross-env NODE_ENV=wx webpack-dev-server --config webpack.config.js\",\"start:web\":\"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js\",\"build_withcopy\":\"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js\",\"build_withcopy:mp\":\"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js\",\"changelog\":\"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md\"},\"husky\":{\"hooks\":{\"pre-commit\":\"npm run lint\"}},\"lint-staged\":{\"*.{.ts,.tsx}\":[\"eslint\",\"git add\"]},\"keywords\":[\"腾讯云\",\"即时通信\",\"信令\"],\"author\":\"\",\"license\":\"ISC\",\"devDependencies\":{\"conventional-changelog-cli\":\"^2.1.1\",\"cross-env\":\"^7.0.2\",\"fs-extra\":\"^9.0.1\",\"html-webpack-plugin\":\"^4.3.0\",\"ts-loader\":\"^7.0.5\",\"typescript\":\"^3.9.9\",\"webpack\":\"^4.43.0\",\"webpack-cli\":\"^3.3.11\",\"webpack-dev-server\":\"^3.11.0\"},\"dependencies\":{\"@typescript-eslint/eslint-plugin\":\"^4.22.1\",\"@typescript-eslint/parser\":\"^4.22.1\",\"EventEmitter\":\"^1.0.0\",\"docdash-blue\":\"^1.1.3\",\"eslint\":\"^5.16.0\",\"eslint-config-google\":\"^0.13.0\",\"eslint-plugin-classes\":\"^0.1.1\",\"jsdoc\":\"^3.6.4\",\"jsdoc-plugin-typescript\":\"^2.0.5\",\"pretty\":\"^2.0.0\",\"replace\":\"^1.2.0\",\"uuidjs\":\"^4.2.5\"}}')},function(t,e,n){var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},\"function\"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError(\"Generator is already executing.\");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0&&u.lastMessage.lastTime&&1e3*u.lastMessage.lastTime>this.currentTime-this.expiredTime&&t.push(u);return[2,t]}}))}))},e}(l),f=function(t){function e(e){var n=t.call(this)||this;return n.tim=null,n.expiredTime=3e4,n.tim=e.tim,n}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){var e,n,i,r,o,a,l,c,d=this;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,s.label=1;case 1:return nd.currentTime-d.expiredTime}))),s.label=3;case 3:return n++,[3,1];case 4:return[2,e.flat().sort((function(t,e){return t.time-e.time}))]}}))}))},e}(l),_=function(t){function e(){return t.call(this)||this}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,t.filter((function(t){var e=!1;try{e=JSON.parse(t.payload.data).businessID===a.BusinessID.SIGNAL}catch(t){}return e}))]}))}))},e}(l),p=function(t){function e(){return t.call(this)||this}return r(e,t),e.prototype.doFilter=function(t){return o(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(r){return Array.isArray(t)?0===t.length?[2,[]]:(e=new Map,t.forEach((function(t,n){var i=JSON.parse(t.payload.data),r=i.inviteID,o=i.actionType;!e.has(r)||e.get(r).actionType!==a.ActionType.INVITE||o!==a.ActionType.CANCEL_INVITE&&o!==a.ActionType.ACCEPT_INVITE&&o!==a.ActionType.REJECT_INVITE&&o!==a.ActionType.INVITE_TIMEOUT?e.set(r,{index:n,actionType:o}):e.delete(r)})),n=[],e.forEach((function(t){t.actionType===a.ActionType.INVITE&&n.push(t.index)})),0===n.length?[2,[]]:(i=[],n.sort((function(t,e){return t-e})).forEach((function(e){i.push(t[e])})),[2,i])):[2,[]]}))}))},e}(l),h=function(){function t(t){this.tim=null;var e=t.tim;this.tim=e}return t.prototype.getHistoricalSignaling=function(){return o(this,void 0,void 0,(function(){var t;return s(this,(function(e){return(t=new c).register(new d({tim:this.tim})),t.register(new f({tim:this.tim})),t.register(new _),t.register(new p),[2,t.run()]}))}))},t}();e.default=h}]).default}));"]} \ No newline at end of file +{"version":3,"sources":["tsignaling-wx.js"],"names":[],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"index.js","sourcesContent":["!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e(require(\"tim-wx-sdk\")):\"function\"==typeof define&&define.amd?define([\"tim-wx-sdk\"],e):\"object\"==typeof exports?exports.TSignaling=e(require(\"tim-wx-sdk\")):t.TSignaling=e(t.TIM)}(window,(function(t){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=7)}([function(t,e,n){n.d(e,\"e\",(function(){return I})),n.d(e,\"g\",(function(){return h})),n.d(e,\"c\",(function(){return g})),n.d(e,\"f\",(function(){return v})),n.d(e,\"b\",(function(){return m})),n.d(e,\"d\",(function(){return T})),n.d(e,\"a\",(function(){return S})),n.d(e,\"h\",(function(){return b}));const i=\"undefined\"!=typeof window,o=(\"undefined\"!=typeof wx&&wx.getSystemInfoSync,i&&window.navigator&&window.navigator.userAgent||\"\"),r=/AppleWebKit\\/([\\d.]+)/i.exec(o),s=(r&&parseFloat(r.pop()),/iPad/i.test(o)),a=/iPhone/i.test(o)&&!s,u=/iPod/i.test(o),l=a||s||u,c=(function(){const t=o.match(/OS (\\d+)_/i);t&&t[1]&&t[1]}(),/Android/i.test(o)),d=function(){const t=o.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);if(!t)return null;const e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);return e&&n?parseFloat(t[1]+\".\"+t[2]):e||null}(),f=(c&&/webkit/i.test(o),/Firefox/i.test(o),/Edge/i.test(o)),_=!f&&/Chrome/i.test(o),p=(function(){const t=o.match(/Chrome\\/(\\d+)/);t&&t[1]&&parseFloat(t[1])}(),/MSIE/.test(o),/MSIE\\s8\\.0/.test(o),function(){const t=/MSIE\\s(\\d+)\\.\\d/.exec(o);let e=t&&parseFloat(t[1]);!e&&/Trident\\/7.0/i.test(o)&&/rv:11.0/.test(o)&&(e=11)}(),/Safari/i.test(o),/TBS\\/\\d+/i.test(o));(function(){const t=o.match(/TBS\\/(\\d+)/i);if(t&&t[1])t[1]})(),!p&&/MQQBrowser\\/\\d+/i.test(o),!p&&/ QQBrowser\\/\\d+/i.test(o),/(micromessenger|webbrowser)/i.test(o),/Windows/i.test(o),/MAC OS X/i.test(o),/MicroMessenger/i.test(o);n(2),n(1);const I=function(t){return\"map\"===y(t)},h=function(t){return\"set\"===y(t)},g=function(t){return\"file\"===y(t)},v=function(t){if(\"object\"!=typeof t||null===t)return!1;const e=Object.getPrototypeOf(t);if(null===e)return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},E=function(t){return\"function\"==typeof Array.isArray?Array.isArray(t):\"array\"===y(t)},m=function(t){return E(t)||function(t){return null!==t&&\"object\"==typeof t}(t)},T=function(t){return t instanceof Error},y=function(t){return Object.prototype.toString.call(t).match(/^\\[object (.*)\\]$/)[1].toLowerCase()};let D=0;Date.now||(Date.now=function(){return(new Date).getTime()});const S={now:function(){0===D&&(D=Date.now()-1);const t=Date.now()-D;return t>4294967295?(D+=4294967295,Date.now()-D):t},utc:function(){return Math.round(Date.now()/1e3)}},b=function(t){return JSON.stringify(t,[\"message\",\"code\"])}},function(t,e,n){n.r(e);var i=n(3),o=n(0);let r=0;const s=new Map;function a(){const t=new Date;return\"TSignaling \"+t.toLocaleTimeString(\"en-US\",{hour12:!1})+\".\"+function(t){let e;switch(t.toString().length){case 1:e=\"00\"+t;break;case 2:e=\"0\"+t;break;default:e=t}return e}(t.getMilliseconds())+\":\"}const u={_data:[],_length:0,_visible:!1,arguments2String(t){let e;if(1===t.length)e=a()+t[0];else{e=a();for(let n=0,i=t.length;n0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]0:o.length>0&&o.includes(this._userID))},t.prototype._startTimer=function(t,e){var n=this;void 0===e&&(e=!0);var i=t.timeout;if(d.default.log(\"TSignaling._startTimer timeout=\"+i+\" isInvitator=\"+e+\" timeoutStatus=\"+(0===i)),0!==i)var o=e?i+5:i,r=1,s=setInterval((function(){var i=n._hasLocalInviteInfo(t,e);d.default.log(\"TSignaling.setInterval hasInviteInfo=\"+i),r0||a||(i&&r||!i)&&(this._updateLocalInviteInfo(t),this._outerEmitter.emit(l.default.INVITATION_TIMEOUT,{inviteID:e,inviter:n,groupID:i,inviteeList:t.inviteeList,isSelfTimeout:!1}))},t.prototype._updateLocalInviteInfo=function(t){var e=t.inviteID,n=t.inviter,i=t.inviteeList,o=t.groupID;if(d.default.log(\"TSignaling._updateLocalInviteInfo inviteID=\"+e+\" inviter=\"+n+\" groupID=\"+o),o){if(this._inviteInfoMap.has(e)){var r=i[0],s=this._inviteInfoMap.get(e).inviteeList;s.includes(r)&&(s.splice(s.indexOf(r),1),d.default.log(\"TSignaling._updateLocalInviteInfo remove \"+r+\" from localInviteeList. \"+s.length+\" invitees left\")),0===s.length&&this._deleteInviteInfoByID(e)}}else this._deleteInviteInfoByID(e)},t.prototype._deleteInviteInfoByID=function(t){this._inviteInfoMap.has(t)&&(d.default.log(\"TSignaling._deleteInviteInfoByID remove \"+t+\" from inviteInfoMap.\"),this._inviteInfoMap.delete(t))},t.prototype._sendCustomMessage=function(t,e,n){var s,u,c,f;return o(this,void 0,void 0,(function(){var o,_,p,I,g,v;return r(this,(function(r){switch(r.label){case 0:return o=e.groupID,_=this._tim.createCustomMessage({to:t,conversationType:o?h.TYPES.CONV_GROUP:h.TYPES.CONV_C2C,priority:h.TYPES.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}}),e.actionType!==a.ActionType.INVITE?[3,2]:(I={title:(p=n||{}).title||\"\",description:p.description||\"您有一个通话请求\",androidOPPOChannelID:p.androidOPPOChannelID||\"\",extension:this._handleOfflineInfo(e,p.extension||\"\")},d.default.log(\"TSignaling.offlinePushInfo \"+JSON.stringify(I)),[4,this._tim.sendMessage(_,i({offlinePushInfo:{title:I.title,description:I.description,androidOPPOChannelID:I.androidOPPOChannelID,extension:I.extension}},E))]);case 1:return g=r.sent(),(null===(s=null==g?void 0:g.data)||void 0===s?void 0:s.message)&&this._outerEmitter.emit(l.default.MESSAGE_SENT_BY_ME,null===(u=null==g?void 0:g.data)||void 0===u?void 0:u.message),[2,g];case 2:return[4,this._tim.sendMessage(_,E)];case 3:return v=r.sent(),(null===(c=null==v?void 0:v.data)||void 0===c?void 0:c.message)&&this._outerEmitter.emit(l.default.MESSAGE_SENT_BY_ME,null===(f=null==v?void 0:v.data)||void 0===f?void 0:f.message),[2,v]}}))}))},t.prototype._sendCustomMessageSync=function(t,e,n,i,s){return o(this,void 0,void 0,(function(){var o;return r(this,(function(r){switch(r.label){case 0:return[4,this._sendCustomMessage(t,e,s)];case 1:return 0===(o=r.sent()).code?(this._inviteInfoMap.set(e.inviteID,e),this._startTimer(e,!0),n()):i(o.code,o.message||\"\"),[2]}}))}))},t.prototype._handleOfflineInfo=function(t,e){var n=JSON.parse(t.data),i={action:t.actionType,call_type:n.call_type,room_id:n.room_id,call_id:t.inviteID,timeout:n.timeout,version:4,invited_list:t.inviteeList};t.groupID&&(i.group_id=t.groupID);var o={entity:{action:2,chatType:t.groupID?2:1,content:JSON.stringify(i),sendTime:parseInt(Date.now()/1e3+\"\"),sender:t.inviter,version:1},userData:e||\"\"},r=JSON.stringify(o);return d.default.log(\"TSignaling._handleOfflineInfo \"+r),r},t.EVENT=l.default,t.TYPES=c.default,t}();e.default=m},function(t,e,n){n.r(e),n.d(e,\"default\",(function(){return s}));const i=Function.prototype.apply,o=new WeakMap;function r(t){return o.has(t)||o.set(t,{}),o.get(t)}class s{constructor(t=null,e=console){const n=r(this);return n._events=new Set,n._callbacks={},n._console=e,n._maxListeners=null===t?null:parseInt(t,10),this}_addCallback(t,e,n,i){return this._getCallbacks(t).push({callback:e,context:n,weight:i}),this._getCallbacks(t).sort((t,e)=>t.weight>e.weight),this}_getCallbacks(t){return r(this)._callbacks[t]}_getCallbackIndex(t,e){return this._has(t)?this._getCallbacks(t).findIndex(t=>t.callback===e):null}_achieveMaxListener(t){return null!==r(this)._maxListeners&&r(this)._maxListeners<=this.listenersNumber(t)}_callbackIsExists(t,e,n){const i=this._getCallbackIndex(t,e),o=-1!==i?this._getCallbacks(t)[i]:void 0;return-1!==i&&o&&o.context===n}_has(t){return r(this)._events.has(t)}on(t,e,n=null,i=1){const o=r(this);if(\"function\"!=typeof e)throw new TypeError(e+\" is not a function\");return this._has(t)?(this._achieveMaxListener(t)&&o._console.warn(`Max listeners (${o._maxListeners}) for event \"${t}\" is reached!`),this._callbackIsExists(...arguments)&&o._console.warn(`Event \"${t}\" already has the callback ${e}.`)):(o._events.add(t),o._callbacks[t]=[]),this._addCallback(...arguments),this}once(t,e,n=null,o=1){const r=(...o)=>(this.off(t,r),i.call(e,n,o));return this.on(t,r,n,o)}off(t,e=null){const n=r(this);let i;return this._has(t)&&(null===e?(n._events.delete(t),n._callbacks[t]=null):(i=this._getCallbackIndex(t,e),-1!==i&&(n._callbacks[t].splice(i,1),this.off(...arguments)))),this}emit(t,...e){return this._has(t)&&this._getCallbacks(t).forEach(t=>i.call(t.callback,t.context,e)),this}clear(){const t=r(this);return t._events.clear(),t._callbacks={},this}listenersNumber(t){return this._has(t)?this._getCallbacks(t).length:null}}},function(t,e){var n;n=function(){return this}();try{n=n||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.r(e);var i=n(0);const o=Object.prototype.hasOwnProperty;e.default=function(t){if(null==t)return!0;if(\"boolean\"==typeof t)return!1;if(\"number\"==typeof t)return 0===t;if(\"string\"==typeof t)return 0===t.length;if(\"function\"==typeof t)return 0===t.length;if(Array.isArray(t))return 0===t.length;if(t instanceof Error)return\"\"===t.message;if(Object(i.f)(t)){for(const e in t)if(o.call(t,e))return!1;return!0}return!!(Object(i.e)(t)||Object(i.g)(t)||Object(i.c)(t))&&0===t.size}},function(t,e,n){n.r(e);class i extends Error{constructor(t){super(),this.code=t.code,this.message=t.message,this.data=t.data||{}}}e.default=i},function(t,e,n){n.r(e);var i=n(1),o=n(4),r=n.n(o);e.default=class{constructor(){this._funcMap=new Map}defense(t,e,n){if(\"string\"!=typeof t)return null;if(0===t.length)return null;if(\"function\"!=typeof e)return null;if(this._funcMap.has(t)&&this._funcMap.get(t).has(e))return this._funcMap.get(t).get(e);this._funcMap.has(t)||this._funcMap.set(t,new Map);let i=null;return this._funcMap.get(t).has(e)?i=this._funcMap.get(t).get(e):(i=this._pack(t,e,n),this._funcMap.get(t).set(e,i)),i}defenseOnce(t,e,n){return\"function\"!=typeof e?null:this._pack(t,e,n)}find(t,e){return\"string\"!=typeof t||0===t.length||\"function\"!=typeof e?null:this._funcMap.has(t)?this._funcMap.get(t).has(e)?this._funcMap.get(t).get(e):(i.default.log(`SafetyCallback.find: 找不到 func —— ${t}/${\"\"!==e.name?e.name:\"[anonymous]\"}`),null):(i.default.log(`SafetyCallback.find: 找不到 eventName-${t} 对应的 func`),null)}delete(t,e){return\"function\"==typeof e&&(!!this._funcMap.has(t)&&(!!this._funcMap.get(t).has(e)&&(this._funcMap.get(t).delete(e),0===this._funcMap.get(t).size&&this._funcMap.delete(t),!0)))}_pack(t,e,n){return function(){try{e.apply(n,Array.from(arguments))}catch(e){const n=Object.values(r.a).indexOf(t),o=Object.keys(r.a)[n];i.default.error(`接入侧事件 EVENT.${o} 对应的回调函数逻辑存在问题,请检查!`,e)}}}}},function(t,e,n){\n/**\n * UUID.js - RFC-compliant UUID Generator for JavaScript\n *\n * @file\n * @author LiosK\n * @version v4.2.12\n * @license Apache License 2.0: Copyright (c) 2010-2022 LiosK\n */\nvar i;i=function(e){function i(){var t=o._getRandomInt;this.timestamp=0,this.tick=0,this.sequence=t(14),this.node=1099511627776*(1|t(8))+t(40)}function o(){}return o.generate=function(){var t=o._getRandomInt,e=o._hexAligner;return e(t(32),8)+\"-\"+e(t(16),4)+\"-\"+e(16384|t(12),4)+\"-\"+e(32768|t(14),4)+\"-\"+e(t(48),12)},o._getRandomInt=function(t){if(t<0||t>53)return NaN;var e=0|1073741824*Math.random();return t>30?e+1073741824*(0|Math.random()*(1<>>30-t},o._hexAligner=function(t,e){for(var n=t.toString(16),i=e-n.length,o=\"0\";i>0;i>>>=1,o+=o)1&i&&(n=o+n);return n},o.overwrittenUUID=e,function(){var t=o._getRandomInt;o.useMathRandom=function(){o._getRandomInt=t};var e=null,i=t;\"undefined\"!=typeof window&&(e=window.crypto||window.msCrypto)?e.getRandomValues&&\"undefined\"!=typeof Uint32Array&&(i=function(t){if(t<0||t>53)return NaN;var n=new Uint32Array(t>32?2:1);return n=e.getRandomValues(n)||n,t>32?n[0]+4294967296*(n[1]>>>64-t):n[0]>>>32-t}):(e=n(14))&&e.randomBytes&&(i=function(t){if(t<0||t>53)return NaN;var n=e.randomBytes(t>32?8:4),i=n.readUInt32BE(0);return t>32?i+4294967296*(n.readUInt32BE(4)>>>64-t):i>>>32-t}),o._getRandomInt=i}(),o.FIELD_NAMES=[\"timeLow\",\"timeMid\",\"timeHiAndVersion\",\"clockSeqHiAndReserved\",\"clockSeqLow\",\"node\"],o.FIELD_SIZES=[32,16,16,8,8,48],o.genV4=function(){var t=o._getRandomInt;return(new o)._init(t(32),t(16),16384|t(12),128|t(6),t(8),t(48))},o.parse=function(t){var e;if(e=/^\\s*(urn:uuid:|\\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(\\})?\\s*$/i.exec(t)){var n=e[1]||\"\",i=e[8]||\"\";if(n+i===\"\"||\"{\"===n&&\"}\"===i||\"urn:uuid:\"===n.toLowerCase()&&\"\"===i)return(new o)._init(parseInt(e[2],16),parseInt(e[3],16),parseInt(e[4],16),parseInt(e[5],16),parseInt(e[6],16),parseInt(e[7],16))}return null},o.prototype._init=function(){var t=o.FIELD_NAMES,e=o.FIELD_SIZES,n=o._binAligner,i=o._hexAligner;this.intFields=new Array(6),this.bitFields=new Array(6),this.hexFields=new Array(6);for(var r=0;r<6;r++){var s=parseInt(arguments[r]||0);this.intFields[r]=this.intFields[t[r]]=s,this.bitFields[r]=this.bitFields[t[r]]=n(s,e[r]),this.hexFields[r]=this.hexFields[t[r]]=i(s,e[r]>>>2)}return this.version=this.intFields.timeHiAndVersion>>>12&15,this.bitString=this.bitFields.join(\"\"),this.hexNoDelim=this.hexFields.join(\"\"),this.hexString=this.hexFields[0]+\"-\"+this.hexFields[1]+\"-\"+this.hexFields[2]+\"-\"+this.hexFields[3]+this.hexFields[4]+\"-\"+this.hexFields[5],this.urn=\"urn:uuid:\"+this.hexString,this},o._binAligner=function(t,e){for(var n=t.toString(2),i=e-n.length,o=\"0\";i>0;i>>>=1,o+=o)1&i&&(n=o+n);return n},o.prototype.toString=function(){return this.hexString},o.prototype.equals=function(t){if(!(t instanceof o))return!1;for(var e=0;e<6;e++)if(this.intFields[e]!==t.intFields[e])return!1;return!0},o.NIL=(new o)._init(0,0,0,0,0,0),o.genV1=function(){null==o._state&&o.resetState();var t=(new Date).getTime(),e=o._state;t!=e.timestamp?(t>>8|128,a=255&e.sequence;return(new o)._init(i,n.mid,r,s,a,e.node)},o.resetState=function(){o._state=new i},o._tsRatio=1/4,o._state=null,o._getTimeFieldValues=function(t){var e=t-Date.UTC(1582,9,15),n=e/4294967296*1e4&268435455;return{low:1e4*(268435455&e)%4294967296,mid:65535&n,hi:n>>>16,timestamp:e}},\"object\"==typeof t.exports&&(t.exports=o),o}(i)},function(t,e){},function(t){t.exports=JSON.parse('{\"name\":\"tsignaling\",\"version\":\"1.0.6\",\"description\":\"腾讯云 Web 信令 SDK\",\"main\":\"./src/index.ts\",\"scripts\":{\"lint\":\"./node_modules/.bin/eslint ./src\",\"fix\":\"./node_modules/.bin/eslint --fix ./src\",\"ts2js\":\"tsc src/index.ts --outDir build/ts2js\",\"doc\":\"npm run ts2js && npm run doc:clean && npm run doc:build\",\"doc:build\":\"./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json && node ./build/jsdoc/fix-doc.js\",\"doc:clean\":\"node ./build/jsdoc/clean-doc.js\",\"build:wx\":\"cross-env NODE_ENV=wx webpack --config webpack.prod.config.js\",\"build:web\":\"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack/bin/webpack.js --config webpack.prod.config.js\",\"build:package\":\"node build/package-bundle.js\",\"prerelease\":\"npm run changelog && npm run build:web && npm run build:wx && npm run build:package && node ./build/copy.js\",\"start:wx\":\"cross-env NODE_ENV=wx webpack-dev-server --config webpack.config.js\",\"start:web\":\"node node_modules/cross-env/src/bin/cross-env.js NODE_ENV=web node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.dev.config.js\",\"build_withcopy\":\"npm run build:web && cp dist/npm/tsignaling-js.js ../TIM-demo-web/node_modules/tsignaling/tsignaling-js.js\",\"build_withcopy:mp\":\"npm run build:wx && cp dist/npm/tsignaling-wx.js ../TIM-demo-mini/static/component/TRTCCalling/utils/tsignaling-wx.js\",\"changelog\":\"cp CHANGELOG.md build/jsdoc/tutorials/CHANGELOG.md\"},\"husky\":{\"hooks\":{\"pre-commit\":\"npm run lint\"}},\"lint-staged\":{\"*.{.ts,.tsx}\":[\"eslint\",\"git add\"]},\"keywords\":[\"腾讯云\",\"即时通信\",\"信令\"],\"author\":\"\",\"license\":\"ISC\",\"devDependencies\":{\"conventional-changelog-cli\":\"^2.1.1\",\"cross-env\":\"^7.0.2\",\"fs-extra\":\"^9.0.1\",\"html-webpack-plugin\":\"^4.3.0\",\"ts-loader\":\"^7.0.5\",\"typescript\":\"^3.9.9\",\"webpack\":\"^4.43.0\",\"@types/node\":\"18.11.9\",\"webpack-cli\":\"^3.3.11\",\"webpack-dev-server\":\"^3.11.0\"},\"dependencies\":{\"@typescript-eslint/eslint-plugin\":\"^4.22.1\",\"@typescript-eslint/parser\":\"^4.22.1\",\"EventEmitter\":\"^1.0.0\",\"docdash-blue\":\"1.1.9\",\"eslint\":\"^5.16.0\",\"eslint-config-google\":\"^0.13.0\",\"eslint-plugin-classes\":\"^0.1.1\",\"jsdoc\":\"^3.6.4\",\"jsdoc-plugin-typescript\":\"^2.0.5\",\"pretty\":\"^2.0.0\",\"replace\":\"^1.2.0\",\"uuidjs\":\"^4.2.5\"}}')},function(t,e,n){var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{u(i.next(t))}catch(t){r(t)}}function a(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var n,i,o,r,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},\"function\"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(n)throw new TypeError(\"Generator is already executing.\");for(;s;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]0&&u.lastMessage.lastTime&&1e3*u.lastMessage.lastTime>this.currentTime-this.expiredTime&&t.push(u);return[2,t]}}))}))},e}(l),f=function(t){function e(e){var n=t.call(this)||this;return n.tim=null,n.expiredTime=3e4,n.tim=e.tim,n}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){var e,n,i,o,r,a,l,c,d=this;return s(this,(function(s){switch(s.label){case 0:e=[],n=0,s.label=1;case 1:return nd.currentTime-d.expiredTime}))),s.label=3;case 3:return n++,[3,1];case 4:return[2,e.flat().sort((function(t,e){return t.time-e.time}))]}}))}))},e}(l),_=function(t){function e(){return t.call(this)||this}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){return s(this,(function(e){return[2,t.filter((function(t){var e=!1;try{e=JSON.parse(t.payload.data).businessID===a.BusinessID.SIGNAL}catch(t){}return e}))]}))}))},e}(l),p=function(t){function e(){return t.call(this)||this}return o(e,t),e.prototype.doFilter=function(t){return r(this,void 0,void 0,(function(){var e,n,i;return s(this,(function(o){return Array.isArray(t)?0===t.length?[2,[]]:(e=new Map,t.forEach((function(t,n){var i=JSON.parse(t.payload.data),o=i.inviteID,r=i.actionType;!e.has(o)||e.get(o).actionType!==a.ActionType.INVITE||r!==a.ActionType.CANCEL_INVITE&&r!==a.ActionType.ACCEPT_INVITE&&r!==a.ActionType.REJECT_INVITE&&r!==a.ActionType.INVITE_TIMEOUT?e.set(o,{index:n,actionType:r}):e.delete(o)})),n=[],e.forEach((function(t){t.actionType===a.ActionType.INVITE&&n.push(t.index)})),0===n.length?[2,[]]:(i=[],n.sort((function(t,e){return t-e})).forEach((function(e){i.push(t[e])})),[2,i])):[2,[]]}))}))},e}(l),I=function(){function t(t){this.tim=null;var e=t.tim;this.tim=e}return t.prototype.getHistoricalSignaling=function(){return r(this,void 0,void 0,(function(){var t;return s(this,(function(e){return(t=new c).register(new d({tim:this.tim})),t.register(new f({tim:this.tim})),t.register(new _),t.register(new p),[2,t.run()]}))}))},t}();e.default=I}]).default}));"]} \ No newline at end of file diff --git a/TUICallKit/min-npm/tuicall-engine-wx/index.js b/TUICallKit/min-npm/tuicall-engine-wx/index.js index c8d4d86..d346b75 100644 --- a/TUICallKit/min-npm/tuicall-engine-wx/index.js +++ b/TUICallKit/min-npm/tuicall-engine-wx/index.js @@ -4,7 +4,7 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; -__DEFINE__(1704939160521, function(require, module, exports) { +__DEFINE__(1710723475378, function(require, module, exports) { var __TEMP__ = require('tsignaling-wx');var t = __REQUIRE_DEFAULT__(__TEMP__);var __TEMP__ = require('trtc-wx-sdk');var e = __REQUIRE_DEFAULT__(__TEMP__);var __TEMP__ = require('tim-wx-sdk');var n = __REQUIRE_DEFAULT__(__TEMP__);function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(c&&l){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:k(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function o(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function c(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function l(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(t){c(a,r,i,o,s,"next",t)}function s(t){c(a,r,i,o,s,"throw",t)}o(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t){var e=y();return function(){var n,r=v(t);if(e){var i=v(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _(t)}(this,n)}}function C(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&K[0]<4?1:+(K[0]+K[1])),!z&&wt&&(!(K=wt.match(/Edge\/(\d+)/))||K[1]>=74)&&(K=wt.match(/Chrome\/(\d+)/))&&(z=+K[1]);var kt=z,At=kt,Nt=N,Ut=k.String,Pt=!!Object.getOwnPropertySymbols&&!Nt((function(){var t=Symbol("symbol detection");return!Ut(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&At&&At<41})),Mt=Pt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,jt=Ct,Vt=yt,Gt=bt,Ht=Object,Bt=Mt?function(t){return"symbol"==typeof t}:function(t){var e=jt("Symbol");return Vt(e)&&Gt(e.prototype,Ht(t))},Ft=String,Kt=function(t){try{return Ft(t)}catch(t){return"Object"}},zt=yt,Jt=Kt,Wt=TypeError,$t=function(t){if(zt(t))return t;throw new Wt(Jt(t)+" is not a function")},qt=$t,Yt=st,Xt=function(t,e){var n=t[e];return Yt(n)?void 0:qt(n)},Qt=V,Zt=yt,te=Et,ee=TypeError,ne={exports:{}},re=k,ie=Object.defineProperty,ae=function(t,e){try{ie(re,t,{value:e,configurable:!0,writable:!0})}catch(n){re[t]=e}return e},oe=ae,se="__core-js_shared__",ce=k[se]||oe(se,{}),le=ce;(ne.exports=function(t,e){return le[t]||(le[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.34.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.34.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ue=ut,he=Object,fe=function(t){return he(ue(t))},de=fe,pe=X({}.hasOwnProperty),ve=Object.hasOwn||function(t,e){return pe(de(t),e)},ge=X,ye=0,Ie=Math.random(),me=ge(1..toString),Ee=function(t){return"Symbol("+(void 0===t?"":t)+")_"+me(++ye+Ie,36)},_e=k,Te=ne.exports,Ce=ve,be=Ee,De=Pt,Re=Mt,we=_e.Symbol,Se=Te("wks"),xe=Re?we.for||we:we&&we.withoutSetter||be,Le=function(t){return Ce(Se,t)||(Se[t]=De&&Ce(we,t)?we[t]:xe("Symbol."+t)),Se[t]},Oe=V,ke=Et,Ae=Bt,Ne=Xt,Ue=function(t,e){var n,r;if("string"===e&&Zt(n=t.toString)&&!te(r=Qt(n,t)))return r;if(Zt(n=t.valueOf)&&!te(r=Qt(n,t)))return r;if("string"!==e&&Zt(n=t.toString)&&!te(r=Qt(n,t)))return r;throw new ee("Can't convert object to primitive value")},Pe=TypeError,Me=Le("toPrimitive"),je=function(t,e){if(!ke(t)||Ae(t))return t;var n,r=Ne(t,Me);if(r){if(void 0===e&&(e="default"),n=Oe(r,t,e),!ke(n)||Ae(n))return n;throw new Pe("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ue(t,e)},Ve=je,Ge=Bt,He=function(t){var e=Ve(t,"string");return Ge(e)?e:e+""},Be=Et,Fe=k.document,Ke=Be(Fe)&&Be(Fe.createElement),ze=function(t){return Ke?Fe.createElement(t):{}},Je=ze,We=!U&&!N((function(){return 7!==Object.defineProperty(Je("div"),"a",{get:function(){return 7}}).a})),$e=U,qe=V,Ye=G,Xe=J,Qe=dt,Ze=He,tn=ve,en=We,nn=Object.getOwnPropertyDescriptor;A.f=$e?nn:function(t,e){if(t=Qe(t),e=Ze(e),en)try{return nn(t,e)}catch(t){}if(tn(t,e))return Xe(!qe(Ye.f,t,e),t[e])};var rn={},an=U&&N((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),on=Et,sn=String,cn=TypeError,ln=function(t){if(on(t))return t;throw new cn(sn(t)+" is not an object")},un=U,hn=We,fn=an,dn=ln,pn=He,vn=TypeError,gn=Object.defineProperty,yn=Object.getOwnPropertyDescriptor,In="enumerable",mn="configurable",En="writable";rn.f=un?fn?function(t,e,n){if(dn(t),e=pn(e),dn(n),"function"==typeof t&&"prototype"===e&&"value"in n&&En in n&&!n[En]){var r=yn(t,e);r&&r[En]&&(t[e]=n.value,n={configurable:mn in n?n[mn]:r[mn],enumerable:In in n?n[In]:r[In],writable:!1})}return gn(t,e,n)}:gn:function(t,e,n){if(dn(t),e=pn(e),dn(n),hn)try{return gn(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new vn("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var _n=rn,Tn=J,Cn=U?function(t,e,n){return _n.f(t,e,Tn(1,n))}:function(t,e,n){return t[e]=n,t},bn={exports:{}},Dn=U,Rn=ve,wn=Function.prototype,Sn=Dn&&Object.getOwnPropertyDescriptor,xn=Rn(wn,"name"),Ln={EXISTS:xn,PROPER:xn&&"something"===function(){}.name,CONFIGURABLE:xn&&(!Dn||Dn&&Sn(wn,"name").configurable)},On=yt,kn=ce,An=X(Function.toString);On(kn.inspectSource)||(kn.inspectSource=function(t){return An(t)});var Nn,Un,Pn,Mn=kn.inspectSource,jn=yt,Vn=k.WeakMap,Gn=jn(Vn)&&/native code/.test(String(Vn)),Hn=ne.exports,Bn=Ee,Fn=Hn("keys"),Kn=function(t){return Fn[t]||(Fn[t]=Bn(t))},zn={},Jn=Gn,Wn=k,$n=Et,qn=Cn,Yn=ve,Xn=ce,Qn=Kn,Zn=zn,tr="Object already initialized",er=Wn.TypeError,nr=Wn.WeakMap;if(Jn||Xn.state){var rr=Xn.state||(Xn.state=new nr);rr.get=rr.get,rr.has=rr.has,rr.set=rr.set,Nn=function(t,e){if(rr.has(t))throw new er(tr);return e.facade=t,rr.set(t,e),e},Un=function(t){return rr.get(t)||{}},Pn=function(t){return rr.has(t)}}else{var ir=Qn("state");Zn[ir]=!0,Nn=function(t,e){if(Yn(t,ir))throw new er(tr);return e.facade=t,qn(t,ir,e),e},Un=function(t){return Yn(t,ir)?t[ir]:{}},Pn=function(t){return Yn(t,ir)}}var ar={set:Nn,get:Un,has:Pn,enforce:function(t){return Pn(t)?Un(t):Nn(t,{})},getterFor:function(t){return function(e){var n;if(!$n(e)||(n=Un(e)).type!==t)throw new er("Incompatible receiver, "+t+" required");return n}}},or=X,sr=N,cr=yt,lr=ve,ur=U,hr=Ln.CONFIGURABLE,fr=Mn,dr=ar.enforce,pr=ar.get,vr=String,gr=Object.defineProperty,yr=or("".slice),Ir=or("".replace),mr=or([].join),Er=ur&&!sr((function(){return 8!==gr((function(){}),"length",{value:8}).length})),_r=String(String).split("String"),Tr=bn.exports=function(t,e,n){"Symbol("===yr(vr(e),0,7)&&(e="["+Ir(vr(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!lr(t,"name")||hr&&t.name!==e)&&(ur?gr(t,"name",{value:e,configurable:!0}):t.name=e),Er&&n&&lr(n,"arity")&&t.length!==n.arity&&gr(t,"length",{value:n.arity});try{n&&lr(n,"constructor")&&n.constructor?ur&&gr(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=dr(t);return lr(r,"source")||(r.source=mr(_r,"string"==typeof e?e:"")),t};Function.prototype.toString=Tr((function(){return cr(this)&&pr(this).source||fr(this)}),"toString");var Cr=yt,br=rn,Dr=bn.exports,Rr=ae,wr=function(t,e,n,r){r||(r={});var i=r.enumerable,a=void 0!==r.name?r.name:e;if(Cr(n)&&Dr(n,a,r),r.global)i?t[e]=n:Rr(e,n);else{try{r.unsafe?t[e]&&(i=!0):delete t[e]}catch(t){}i?t[e]=n:br.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Sr={},xr=Math.ceil,Lr=Math.floor,Or=Math.trunc||function(t){var e=+t;return(e>0?Lr:xr)(e)},kr=function(t){var e=+t;return e!=e||0===e?0:Or(e)},Ar=kr,Nr=Math.max,Ur=Math.min,Pr=function(t,e){var n=Ar(t);return n<0?Nr(n+e,0):Ur(n,e)},Mr=kr,jr=Math.min,Vr=function(t){return t>0?jr(Mr(t),9007199254740991):0},Gr=Vr,Hr=function(t){return Gr(t.length)},Br=dt,Fr=Pr,Kr=Hr,zr=function(t){return function(e,n,r){var i,a=Br(e),o=Kr(a),s=Fr(r,o);if(t&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}},Jr={includes:zr(!0),indexOf:zr(!1)},Wr=ve,$r=dt,qr=Jr.indexOf,Yr=zn,Xr=X([].push),Qr=function(t,e){var n,r=$r(t),i=0,a=[];for(n in r)!Wr(Yr,n)&&Wr(r,n)&&Xr(a,n);for(;e.length>i;)Wr(r,n=e[i++])&&(~qr(a,n)||Xr(a,n));return a},Zr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ti=Qr,ei=Zr.concat("length","prototype");Sr.f=Object.getOwnPropertyNames||function(t){return ti(t,ei)};var ni={};ni.f=Object.getOwnPropertySymbols;var ri=Ct,ii=Sr,ai=ni,oi=ln,si=X([].concat),ci=ri("Reflect","ownKeys")||function(t){var e=ii.f(oi(t)),n=ai.f;return n?si(e,n(t)):e},li=ve,ui=ci,hi=A,fi=rn,di=N,pi=yt,vi=/#|\.prototype\./,gi=function(t,e){var n=Ii[yi(t)];return n===Ei||n!==mi&&(pi(e)?di(e):!!e)},yi=gi.normalize=function(t){return String(t).replace(vi,".").toLowerCase()},Ii=gi.data={},mi=gi.NATIVE="N",Ei=gi.POLYFILL="P",_i=gi,Ti=k,Ci=A.f,bi=Cn,Di=wr,Ri=ae,wi=function(t,e,n){for(var r=ui(e),i=fi.f,a=hi.f,o=0;o9007199254740991)throw ki("Maximum allowed index exceeded");return t},Ni=He,Ui=rn,Pi=J,Mi=function(t,e,n){var r=Ni(e);r in t?Ui.f(t,r,Pi(0,n)):t[r]=n},ji={};ji[Le("toStringTag")]="z";var Vi="[object z]"===String(ji),Gi=Vi,Hi=yt,Bi=et,Fi=Le("toStringTag"),Ki=Object,zi="Arguments"===Bi(function(){return arguments}()),Ji=Gi?Bi:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ki(t),Fi))?n:zi?Bi(e):"Object"===(r=Bi(e))&&Hi(e.callee)?"Arguments":r},Wi=X,$i=N,qi=yt,Yi=Ji,Xi=Mn,Qi=function(){},Zi=[],ta=Ct("Reflect","construct"),ea=/^\s*(?:class|function)\b/,na=Wi(ea.exec),ra=!ea.test(Qi),ia=function(t){if(!qi(t))return!1;try{return ta(Qi,Zi,t),!0}catch(t){return!1}},aa=function(t){if(!qi(t))return!1;switch(Yi(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ra||!!na(ea,Xi(t))}catch(t){return!0}};aa.sham=!0;var oa=!ta||$i((function(){var t;return ia(ia.call)||!ia(Object)||!ia((function(){t=!0}))||t}))?aa:ia,sa=Oi,ca=oa,la=Et,ua=Le("species"),ha=Array,fa=function(t){var e;return sa(t)&&(e=t.constructor,(ca(e)&&(e===ha||sa(e.prototype))||la(e)&&null===(e=e[ua]))&&(e=void 0)),void 0===e?ha:e},da=function(t,e){return new(fa(t))(0===e?0:e)},pa=N,va=kt,ga=Le("species"),ya=function(t){return va>=51||!pa((function(){var e=[];return(e.constructor={})[ga]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},Ia=xi,ma=N,Ea=Oi,_a=Et,Ta=fe,Ca=Hr,ba=Ai,Da=Mi,Ra=da,wa=ya,Sa=kt,xa=Le("isConcatSpreadable"),La=Sa>=51||!ma((function(){var t=[];return t[xa]=!1,t.concat()[0]!==t})),Oa=function(t){if(!_a(t))return!1;var e=t[xa];return void 0!==e?!!e:Ea(t)};Ia({target:"Array",proto:!0,arity:1,forced:!La||!wa("concat")},{concat:function(t){var e,n,r,i,a,o=Ta(this),s=Ra(o,0),c=0;for(e=-1,r=arguments.length;e1?arguments[1]:void 0;return Za?Qa(this,t,e)||0:Ya(this,t,e)}});var to=$t,eo=P,no=Ja(Ja.bind),ro=function(t,e){return to(t),void 0===e?t:eo?no(t,e):function(){return t.apply(e,arguments)}},io=ro,ao=ot,oo=fe,so=Hr,co=da,lo=X([].push),uo=function(t){var e=1===t,n=2===t,r=3===t,i=4===t,a=6===t,o=7===t,s=5===t||a;return function(c,l,u,h){for(var f,d,p=oo(c),v=ao(p),g=so(v),y=io(l,u),I=0,m=h||co,E=e?m(c,g):n||o?m(c,0):void 0;g>I;I++)if((s||I in v)&&(d=y(f=v[I],I,p),t))if(e)E[I]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return I;case 2:lo(E,f)}else switch(t){case 4:return!1;case 7:lo(E,f)}return a?-1:r||i?i:E}},ho={forEach:uo(0),map:uo(1),filter:uo(2),some:uo(3),every:uo(4),find:uo(5),findIndex:uo(6),filterReject:uo(7)},fo=ho.filter;xi({target:"Array",proto:!0,forced:!ya("filter")},{filter:function(t){return fo(this,t,arguments.length>1?arguments[1]:void 0)}});var po=Ji,vo=Vi?{}.toString:function(){return"[object "+po(this)+"]"};Vi||wr(Object.prototype,"toString",vo,{unsafe:!0});var go=ho.map;xi({target:"Array",proto:!0,forced:!ya("map")},{map:function(t){return go(this,t,arguments.length>1?arguments[1]:void 0)}});var yo=xi,Io=Date,mo=X(Io.prototype.getTime);yo({target:"Date",stat:!0},{now:function(){return mo(new Io)}});var Eo=U,_o=X,To=V,Co=N,bo=Ha,Do=ni,Ro=G,wo=fe,So=ot,xo=Object.assign,Lo=Object.defineProperty,Oo=_o([].concat),ko=!xo||Co((function(){if(Eo&&1!==xo({b:1},xo(Lo({},"a",{enumerable:!0,get:function(){Lo(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection"),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!==xo({},t)[n]||bo(xo({},e)).join("")!==r}))?function(t,e){for(var n=wo(t),r=arguments.length,i=1,a=Do.f,o=Ro.f;r>i;)for(var s,c=So(arguments[i++]),l=a?Oo(bo(c),a(c)):bo(c),u=l.length,h=0;u>h;)s=l[h++],Eo&&!To(o,c,s)||(n[s]=c[s]);return n}:xo,Ao=ko;xi({target:"Object",stat:!0,arity:2,forced:Object.assign!==Ao},{assign:Ao});var No,Uo,Po,Mo,jo="process"===et(k.process),Vo=X,Go=$t,Ho=yt,Bo=String,Fo=TypeError,Ko=function(t,e,n){try{return Vo(Go(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}},zo=ln,Jo=function(t){if("object"==typeof t||Ho(t))return t;throw new Fo("Can't set "+Bo(t)+" as a prototype")},Wo=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Ko(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return zo(n),Jo(r),e?t(n,r):n.__proto__=r,n}}():void 0),$o=rn.f,qo=ve,Yo=Le("toStringTag"),Xo=function(t,e,n){t&&!n&&(t=t.prototype),t&&!qo(t,Yo)&&$o(t,Yo,{configurable:!0,value:e})},Qo=bn.exports,Zo=rn,ts=function(t,e,n){return n.get&&Qo(n.get,e,{getter:!0}),n.set&&Qo(n.set,e,{setter:!0}),Zo.f(t,e,n)},es=Ct,ns=ts,rs=U,is=Le("species"),as=function(t){var e=es(t);rs&&e&&!e[is]&&ns(e,is,{configurable:!0,get:function(){return this}})},os=bt,ss=TypeError,cs=function(t,e){if(os(e,t))return t;throw new ss("Incorrect invocation")},ls=oa,us=Kt,hs=TypeError,fs=ln,ds=function(t){if(ls(t))return t;throw new hs(us(t)+" is not a constructor")},ps=st,vs=Le("species"),gs=P,ys=Function.prototype,Is=ys.apply,ms=ys.call,Es="object"==typeof Reflect&&Reflect.apply||(gs?ms.bind(Is):function(){return ms.apply(Is,arguments)}),_s=Ct("document","documentElement"),Ts=X([].slice),Cs=TypeError,bs=function(t,e){if(ta;a++)if((s=y(t[a]))&&Iu(bu,s))return s;return new Cu(!1)}r=mu(t,i)}for(c=f?t.next:r.next;!(l=du(c,r)).done;){try{s=y(l.value)}catch(t){_u(r,"throw",t)}if("object"==typeof s&&s&&Iu(bu,s))return s}return new Cu(!1)},Ru=Le("iterator"),wu=!1;try{var Su=0,xu={next:function(){return{done:!!Su++}},return:function(){wu=!0}};xu[Ru]=function(){return this},Array.from(xu,(function(){throw 2}))}catch(t){}var Lu=function(t,e){try{if(!e&&!wu)return!1}catch(t){return!1}var n=!1;try{var r={};r[Ru]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},Ou=wc,ku=Fc.CONSTRUCTOR||!Lu((function(t){Ou.all(t).then(void 0,(function(){}))})),Au=V,Nu=$t,Uu=Kc,Pu=Rc,Mu=Du;xi({target:"Promise",stat:!0,forced:ku},{all:function(t){var e=this,n=Uu.f(e),r=n.resolve,i=n.reject,a=Pu((function(){var n=Nu(e.resolve),a=[],o=0,s=1;Mu(t,(function(t){var c=o++,l=!1;s++,Au(n,e,t).then((function(t){l||(l=!0,a[c]=t,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise}});var ju=xi,Vu=Fc.CONSTRUCTOR,Gu=wc,Hu=Ct,Bu=yt,Fu=wr,Ku=Gu&&Gu.prototype;if(ju({target:"Promise",proto:!0,forced:Vu,real:!0},{catch:function(t){return this.then(void 0,t)}}),Bu(Gu)){var zu=Hu("Promise").prototype.catch;Ku.catch!==zu&&Fu(Ku,"catch",zu,{unsafe:!0})}var Ju=V,Wu=$t,$u=Kc,qu=Rc,Yu=Du;xi({target:"Promise",stat:!0,forced:ku},{race:function(t){var e=this,n=$u.f(e),r=n.reject,i=qu((function(){var i=Wu(e.resolve);Yu(t,(function(t){Ju(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var Xu=V,Qu=Kc;xi({target:"Promise",stat:!0,forced:Fc.CONSTRUCTOR},{reject:function(t){var e=Qu.f(this);return Xu(e.reject,void 0,t),e.promise}});var Zu=ln,th=Et,eh=Kc,nh=xi,rh=Fc.CONSTRUCTOR,ih=function(t,e){if(Zu(t),th(e)&&e.constructor===t)return e;var n=eh.f(t);return(0,n.resolve)(e),n.promise};Ct("Promise"),nh({target:"Promise",stat:!0,forced:rh},{resolve:function(t){return ih(this,t)}});var ah="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,oh=k,sh=Es,ch=yt,lh=ah,uh=Dt,hh=Ts,fh=bs,dh=oh.Function,ph=/MSIE .\./.test(uh)||lh&&function(){var t=oh.Bun.version.split(".");return t.length<3||"0"===t[0]&&(t[1]<3||"3"===t[1]&&"0"===t[2])}(),vh=function(t,e){var n=e?2:1;return ph?function(r,i){var a=fh(arguments.length,1)>n,o=ch(r)?r:dh(r),s=a?hh(arguments,n):[],c=a?function(){sh(o,this,s)}:o;return e?t(c,i):t(c)}:t},gh=xi,yh=k,Ih=vh(yh.setInterval,!0);gh({global:!0,bind:!0,forced:yh.setInterval!==Ih},{setInterval:Ih});var mh=xi,Eh=k,_h=vh(Eh.setTimeout,!0);mh({global:!0,bind:!0,forced:Eh.setTimeout!==_h},{setTimeout:_h});var Th=Ji,Ch=String,bh=function(t){if("Symbol"===Th(t))throw new TypeError("Cannot convert a Symbol value to a string");return Ch(t)},Dh=X,Rh=kr,wh=bh,Sh=ut,xh=Dh("".charAt),Lh=Dh("".charCodeAt),Oh=Dh("".slice),kh=function(t){return function(e,n){var r,i,a=wh(Sh(e)),o=Rh(n),s=a.length;return o<0||o>=s?t?"":void 0:(r=Lh(a,o))<55296||r>56319||o+1===s||(i=Lh(a,o+1))<56320||i>57343?t?xh(a,o):r:t?Oh(a,o,o+2):i-56320+(r-55296<<10)+65536}},Ah={codeAt:kh(!1),charAt:kh(!0)},Nh={},Uh=U,Ph=an,Mh=rn,jh=ln,Vh=dt,Gh=Ha;Nh.f=Uh&&!Ph?Object.defineProperties:function(t,e){jh(t);for(var n,r=Vh(e),i=Gh(e),a=i.length,o=0;a>o;)Mh.f(t,n=i[o++],r[n]);return t};var Hh,Bh=ln,Fh=Nh,Kh=Zr,zh=zn,Jh=_s,Wh=ze,$h="prototype",qh="script",Yh=Kn("IE_PROTO"),Xh=function(){},Qh=function(t){return"<"+qh+">"+t+""},Zh=function(t){t.write(Qh("")),t.close();var e=t.parentWindow.Object;return t=null,e},tf=function(){try{Hh=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;tf="undefined"!=typeof document?document.domain&&Hh?Zh(Hh):(e=Wh("iframe"),n="java"+qh+":",e.style.display="none",Jh.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Qh("document.F=Object")),t.close(),t.F):Zh(Hh);for(var r=Kh.length;r--;)delete tf[$h][Kh[r]];return tf()};zh[Yh]=!0;var ef,nf,rf,af=Object.create||function(t,e){var n;return null!==t?(Xh[$h]=Bh(t),n=new Xh,Xh[$h]=null,n[Yh]=t):n=tf(),void 0===e?n:Fh.f(n,e)},of=!N((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),sf=ve,cf=yt,lf=fe,uf=of,hf=Kn("IE_PROTO"),ff=Object,df=ff.prototype,pf=uf?ff.getPrototypeOf:function(t){var e=lf(t);if(sf(e,hf))return e[hf];var n=e.constructor;return cf(n)&&e instanceof n?n.prototype:e instanceof ff?df:null},vf=N,gf=yt,yf=Et,If=pf,mf=wr,Ef=Le("iterator"),_f=!1;[].keys&&("next"in(rf=[].keys())?(nf=If(If(rf)))!==Object.prototype&&(ef=nf):_f=!0);var Tf=!yf(ef)||vf((function(){var t={};return ef[Ef].call(t)!==t}));Tf&&(ef={}),gf(ef[Ef])||mf(ef,Ef,(function(){return this}));var Cf={IteratorPrototype:ef,BUGGY_SAFARI_ITERATORS:_f},bf=Cf.IteratorPrototype,Df=af,Rf=J,wf=Xo,Sf=Kl,xf=function(){return this},Lf=xi,Of=V,kf=yt,Af=function(t,e,n,r){var i=e+" Iterator";return t.prototype=Df(bf,{next:Rf(+!r,n)}),wf(t,i,!1),Sf[i]=xf,t},Nf=pf,Uf=Wo,Pf=Xo,Mf=Cn,jf=wr,Vf=Kl,Gf=Ln.PROPER,Hf=Ln.CONFIGURABLE,Bf=Cf.IteratorPrototype,Ff=Cf.BUGGY_SAFARI_ITERATORS,Kf=Le("iterator"),zf="keys",Jf="values",Wf="entries",$f=function(){return this},qf=function(t,e,n,r,i,a,o){Af(n,e,r);var s,c,l,u=function(t){if(t===i&&v)return v;if(!Ff&&t&&t in d)return d[t];switch(t){case zf:case Jf:case Wf:return function(){return new n(this,t)}}return function(){return new n(this)}},h=e+" Iterator",f=!1,d=t.prototype,p=d[Kf]||d["@@iterator"]||i&&d[i],v=!Ff&&p||u(i),g="Array"===e&&d.entries||p;if(g&&(s=Nf(g.call(new t)))!==Object.prototype&&s.next&&(Nf(s)!==Bf&&(Uf?Uf(s,Bf):kf(s[Kf])||jf(s,Kf,$f)),Pf(s,h,!0)),Gf&&i===Jf&&p&&p.name!==Jf&&(Hf?Mf(d,"name",Jf):(f=!0,v=function(){return Of(p,this)})),i)if(c={values:u(Jf),keys:a?v:u(zf),entries:u(Wf)},o)for(l in c)(Ff||f||!(l in d))&&jf(d,l,c[l]);else Lf({target:e,proto:!0,forced:Ff||f},c);return d[Kf]!==v&&jf(d,Kf,v,{name:i}),Vf[e]=v,c},Yf=function(t,e){return{value:t,done:e}},Xf=Ah.charAt,Qf=bh,Zf=ar,td=qf,ed=Yf,nd="String Iterator",rd=Zf.set,id=Zf.getterFor(nd);td(String,"String",(function(t){rd(this,{type:nd,string:Qf(t),index:0})}),(function(){var t,e=id(this),n=e.string,r=e.index;return r>=n.length?ed(void 0,!0):(t=Xf(n,r),e.index+=t.length,ed(t,!1))}));var ad=Le,od=af,sd=rn.f,cd=ad("unscopables"),ld=Array.prototype;void 0===ld[cd]&&sd(ld,cd,{configurable:!0,value:od(null)});var ud=function(t){ld[cd][t]=!0},hd=dt,fd=ud,dd=Kl,pd=ar,vd=rn.f,gd=qf,yd=Yf,Id=U,md="Array Iterator",Ed=pd.set,_d=pd.getterFor(md),Td=gd(Array,"Array",(function(t,e){Ed(this,{type:md,target:hd(t),index:0,kind:e})}),(function(){var t=_d(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=void 0,yd(void 0,!0);switch(t.kind){case"keys":return yd(n,!1);case"values":return yd(e[n],!1)}return yd([n,e[n]],!1)}),"values"),Cd=dd.Arguments=dd.Array;if(fd("keys"),fd("values"),fd("entries"),Id&&"values"!==Cd.name)try{vd(Cd,"name",{value:"values"})}catch(t){}var bd={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Dd=ze("span").classList,Rd=Dd&&Dd.constructor&&Dd.constructor.prototype,wd=Rd===Object.prototype?void 0:Rd,Sd=k,xd=bd,Ld=wd,Od=Td,kd=Cn,Ad=Xo,Nd=Le("iterator"),Ud=Od.values,Pd=function(t,e){if(t){if(t[Nd]!==Ud)try{kd(t,Nd,Ud)}catch(e){t[Nd]=Ud}if(Ad(t,e,!0),xd[e])for(var n in Od)if(t[n]!==Od[n])try{kd(t,n,Od[n])}catch(e){t[n]=Od[n]}}};for(var Md in xd)Pd(Sd[Md]&&Sd[Md].prototype,Md);Pd(Ld,"DOMTokenList");var jd=xi,Vd=Oi,Gd=oa,Hd=Et,Bd=Pr,Fd=Hr,Kd=dt,zd=Mi,Jd=Le,Wd=Ts,$d=ya("slice"),qd=Jd("species"),Yd=Array,Xd=Math.max;jd({target:"Array",proto:!0,forced:!$d},{slice:function(t,e){var n,r,i,a=Kd(this),o=Fd(a),s=Bd(t,o),c=Bd(void 0===e?o:e,o);if(Vd(a)&&(n=a.constructor,(Gd(n)&&(n===Yd||Vd(n.prototype))||Hd(n)&&null===(n=n[qd]))&&(n=void 0),n===Yd||void 0===n))return Wd(a,s,c);for(r=new(void 0===n?Yd:n)(Xd(c-s,0)),i=0;s1?arguments[1]:void 0)};xi({target:"Array",proto:!0,forced:[].forEach!==Zd},{forEach:Zd});var tp=k,ep=bd,np=wd,rp=Zd,ip=Cn,ap=function(t){if(t&&t.forEach!==rp)try{ip(t,"forEach",rp)}catch(e){t.forEach=rp}};for(var op in ep)ep[op]&&ap(tp[op]&&tp[op].prototype);ap(np);var sp=ln,cp=hu,lp=ro,up=V,hp=fe,fp=function(t,e,n,r){try{return r?e(sp(n)[0],n[1]):e(n)}catch(e){cp(t,"throw",e)}},dp=$l,pp=oa,vp=Hr,gp=Mi,yp=su,Ip=tu,mp=Array,Ep=function(t){var e=hp(t),n=pp(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=lp(i,r>2?arguments[2]:void 0));var o,s,c,l,u,h,f=Ip(e),d=0;if(!f||this===mp&&dp(f))for(o=vp(e),s=n?new this(o):mp(o);o>d;d++)h=a?i(e[d],d):e[d],gp(s,d,h);else for(u=(l=yp(e,f)).next,s=n?new this:[];!(c=up(u,l)).done;d++)h=a?fp(l,i,[c.value,d],!0):c.value,gp(s,d,h);return s.length=d,s};xi({target:"Array",stat:!0,forced:!Lu((function(t){Array.from(t)}))},{from:Ep});var _p={exports:{}},Tp={},Cp=Pr,bp=Hr,Dp=Mi,Rp=Array,wp=Math.max,Sp=et,xp=dt,Lp=Sr.f,Op=function(t,e,n){for(var r=bp(t),i=Cp(e,r),a=Cp(void 0===n?r:n,r),o=Rp(wp(a-i,0)),s=0;i1?arguments[1]:void 0);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Rv(a,n?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),Nv&&Dv(a,"size",{configurable:!0,get:function(){return o(this).size}}),i},setStrong:function(t,e,n){var r=e+" Iterator",i=Mv(e),a=Mv(r);Ov(t,e,(function(t,e){Pv(this,{type:r,target:t,state:i(t),kind:e,last:void 0})}),(function(){for(var t=a(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?kv("keys"===e?n.key:"values"===e?n.value:[n.key,n.value],!1):(t.target=void 0,kv(void 0,!0))}),n?"entries":"values",!n,!0),Av(e)}};_v("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),jv);var Vv=U,Gv=Oi,Hv=TypeError,Bv=Object.getOwnPropertyDescriptor,Fv=Vv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(Gv(t)&&!Bv(t,"length").writable)throw new Hv("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e},Kv=Kt,zv=TypeError,Jv=xi,Wv=fe,$v=Pr,qv=kr,Yv=Hr,Xv=Fv,Qv=Ai,Zv=da,tg=Mi,eg=function(t,e){if(!delete t[e])throw new zv("Cannot delete property "+Kv(e)+" of "+Kv(t))},ng=ya("splice"),rg=Math.max,ig=Math.min;Jv({target:"Array",proto:!0,forced:!ng},{splice:function(t,e){var n,r,i,a,o,s,c=Wv(this),l=Yv(c),u=$v(t,l),h=arguments.length;for(0===h?n=r=0:1===h?(n=0,r=l-u):(n=h-2,r=ig(rg(qv(e),0),l-u)),Qv(l+n-r),i=Zv(c,r),a=0;al-r+n;a--)eg(c,a-1)}else if(n>r)for(a=l-r;a>u;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:eg(c,s);for(a=0;a 标签),请使用真机调试或者扫码预览。",Lg={RECORD:"scope.record",CAMERA:"scope.camera"},Og="https://buy.cloud.tencent.com/avc?addRavLicense=1",kg="https://buy.tencentcloud.com/avc?addRavLicense=1",Ag=1,Ng=9,Ug=17,Pg=18,Mg=21,jg=15,Vg="\t\n\v\f\r                 \u2028\u2029\ufeff",Gg=ut,Hg=bh,Bg=Vg,Fg=X("".replace),Kg=RegExp("^["+Bg+"]+"),zg=RegExp("(^|[^"+Bg+"])["+Bg+"]+$"),Jg=function(t){return function(e){var n=Hg(Gg(e));return 1&t&&(n=Fg(n,Kg,"")),2&t&&(n=Fg(n,zg,"$1")),n}},Wg={start:Jg(1),end:Jg(2),trim:Jg(3)},$g=k,qg=N,Yg=X,Xg=bh,Qg=Wg.trim,Zg=Vg,ty=$g.parseInt,ey=$g.Symbol,ny=ey&&ey.iterator,ry=/^[+-]?0x/i,iy=Yg(ry.exec),ay=8!==ty(Zg+"08")||22!==ty(Zg+"0x16")||ny&&!qg((function(){ty(Object(ny))}))?function(t,e){var n=Qg(Xg(t));return ty(n,e>>>0||(iy(ry,n)?16:10))}:ty;function oy(t){var e=new Date(t);return"".concat(e.getFullYear(),"-")+"".concat(e.getMonth()+1<10?"0".concat(e.getMonth()+1):e.getMonth()+1,"-")+sy(e.getDate()," ")+sy(e.getHours(),":")+sy(e.getMinutes(),":")+sy(e.getSeconds(),"")}function sy(t,e){return"".concat(t<10?"0".concat(t).concat(e):"".concat(t).concat(e))}xi({global:!0,forced:parseInt!==ay},{parseInt:ay});var cy={exports:{}};self;var ly=L(cy.exports=(()=>(()=>{var t={530:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=void 0;var r=n(928);e.formatClsLog=function(){return function(t,e){try{e({logs:null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else"time"===n&&(e[n]=new Date(t[n]).toISOString()),e[n]=t[n]+""})),{contents:e,time:t.time}})),source:""})}catch(t){console.debug(t)}}}},597:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatESLog=void 0;var r=n(928);e.formatESLog=function(t){var e=t.table;return function(t,n){try{var i=null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else e[n]="level"===n?t[n]+"":"time"===n?new Date(t[n]).toISOString():t[n]})),e}));n({table:e,report:i})}catch(t){console.debug(t)}}}},150:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=e.formatESLog=void 0;var r=n(314);Object.defineProperty(e,"formatClsLog",{enumerable:!0,get:function(){return r.formatClsLog}});var i=n(597);Object.defineProperty(e,"formatESLog",{enumerable:!0,get:function(){return i.formatESLog}})},757:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPipeline=void 0;var r=n(928);e.createPipeline=function(t){if(!t||!t.reduce||!t.length)throw new TypeError("createPipeline need at least one function param");return 1===t.length?function(e,n){t[0](e,n||r.noop)}:t.reduce((function(t,e){return function(n,i){return void 0===i&&(i=r.noop),t(n,(function(t){return null==e?void 0:e(t,i)}))}}))}},758:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.limitLengthPipe=e.MAX_LOG_LENGTH=void 0;var r=n(928);e.MAX_LOG_LENGTH=102400,e.limitLengthPipe=function(){return function(t,n){try{var i=(t=t||{}).logs,a=void 0===i?[]:i;t.logs=null==a?void 0:a.map((function(t){var n=e.MAX_LOG_LENGTH,i=t.contents;return Object.keys(i).forEach((function(t){var e=i[t];try{e&&e.length>n&&(i[t]=null==e?void 0:e.substring(0,n))}catch(a){console.debug("size of content > limitSize"),i[t]=(0,r.stringifyPlus)(e).substring(0,n)}})),t})),n(t)}catch(t){console.debug(t)}}}},23:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createThrottlePipe=void 0,e.createThrottlePipe=function(t,e){var n,r=[];return function(i,a){if(Array.isArray(i)?r=r.concat(i):r.push(i),e&&r.length>=e||t.sendNow&&r.length>0)return a(r.splice(0,r.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout((function(){n=null,r.length>0&&a(r.splice(0,r.length))}),t.delay||1e3)}}},434:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=2?[4,(0,o.startBlocking)()]:[3,3];case 2:return n.sent(),[3,1];case 3:return s++,[4,new Promise((function(e,n){wx.request(r(r({},t),{success:function(t){e(t)},fail:function(t){n(t)}}))}))];case 4:return[2,n.sent()];case 5:return e=n.sent(),[2,Promise.reject(e)];case 6:return s--,(0,o.resolveFirstBlock)(),[7];case 7:return[2]}}))}))}},310:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=2?[4,(0,o.startBlocking)()]:[3,2];case 1:return i.sent(),[3,0];case 2:return s++,r=n.method,u=n.headers,f=void 0===u?{}:u,d=n.responseType,p=void 0===d?"json":d,r=(r||"get").toUpperCase(),Object.assign(f,{"Content-type":"application/json"}),(v=new window.XMLHttpRequest).responseType=p,v.timeout=1e4,v.onreadystatechange=function(){4===v.readyState&&(200===v.status?l({data:v.response}):h({code:v.status,msg:v.statusText}))},v.ontimeout=function(t){h({code:v.status,msg:v.statusText})},v.onloadend=function(){v&&(c((function(t){l(t)}),(function(t){h(t)}),{status:v.status,statusText:v.statusText}),v=null)},v.onabort=function(){v&&(h(new Error("Request aborted")),v=null)},v.onerror=function(){h(new Error("Network Error")),v=null},"GET"===r?t="url".concat(-1===t.indexOf("?")?"?":"&").concat(a.default.stringify(e)):"POST"===r&&(e=JSON.stringify(e)),v.open(r,t,!0),Object.keys(f).forEach((function(t){v.setRequestHeader(t,f[t])})),v.send("POST"===r?e:null),[2]}}))}))}))];case 1:return[2,h.sent()];case 2:throw l=h.sent(),new Error(l);case 3:return s--,(0,o.resolveFirstBlock)(),[7];case 4:return[2]}}))}))}},928:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.date2ISOString=e.stringifyPlus=e.noop=e.isBrowser=e.isMiniProgram=e.isPlainObject=e.appendParams=void 0,e.appendParams=function(t,n){void 0===n&&(n={});var r=[];return Object.keys(n).forEach((function(t){var i=n[t];if(void 0!==i){if((0,e.isPlainObject)(i))try{i=JSON.stringify(i)}catch(t){}r.push("".concat(t,"=").concat(encodeURIComponent(i)))}})),r.length?(t.indexOf("?")>-1?"".concat(t,"&"):"".concat(t,"?"))+r.join("&"):t},e.isPlainObject=function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},e.isMiniProgram=function(){try{return!(!(null===wx||void 0===wx?void 0:wx.request)||!(null===wx||void 0===wx?void 0:wx.connectSocket))}catch(t){return!1}},e.isBrowser=function(){try{return!(0,e.isMiniProgram)()&&"undefined"!=typeof window&&void 0!==window.document}catch(t){return!1}},e.noop=function(){};var n=function(){var t=new WeakSet;return function(e,n){if(n instanceof Error)return"Error.message: ".concat(n.message," \n Error.stack: ").concat(n.stack);if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular ".concat(e||"root","]");t.add(n)}return n}};e.stringifyPlus=function(t){if("string"==typeof t)return t;try{return t instanceof Error?(JSON.stringify(t,n())||"undefined").replace(/"/gim,""):JSON.stringify(t,n())||"undefined"}catch(t){return"error happen when aegis stringify: \n ".concat(t.message," \n ").concat(t.stack)}},e.date2ISOString=function(){var t,e=new Date,n=e.toISOString(),r=e.getTimezoneOffset()/60;return t=r<0?r>-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",t)}},580:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=n(928);e.default={stringify:function(t){return t?Object.keys(t).map((function(e){var n=t[e];if((0,r.isPlainObject)(n))n=JSON.stringify(n);else{if("string"!=typeof n&&"number"!=typeof n)return"";n=+n}return encodeURIComponent(e)+"="+encodeURIComponent(n)})).filter((function(t){return t.length>0})).join("&"):""}}},690:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.startBlocking=e.resolveFirstBlock=void 0;var n=[];e.startBlocking=function(){var t,e=new Promise((function(e){t=e}));return n.push({promise:e,resolve:t}),e},e.resolveFirstBlock=function(){n.length&&(n[0].resolve(),n.shift())}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0});var e=n(530),i={debug:console.debug,info:console.info,warn:console.warn,error:console.error,updateGetReportData:function(t){console.debug(t)}},a=null;t.default=function(t){if(!a){var n=t||{},r=n.clsConfig,o=(n.esConfig,r.endpoint),s=r.topicId;if(!o||!s)return console.debug("endpoint and topicId must not be null"),i;a=new e.default(t)}return a}})(),r})())()),uy=U,hy=Ln.EXISTS,fy=X,dy=ts,py=Function.prototype,vy=fy(py.toString),gy=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,yy=fy(gy.exec);uy&&!hy&&dy(py,"name",{configurable:!0,get:function(){try{return yy(gy,vy(this))[1]}catch(t){return""}}});var Iy={UNKNOWN:65535,NO_NETWORK:2805,FAILURE_SWITCH_TO_AUDIO:60001,FAILURE_SWITCH_TO_VIDEO:60002,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_BLACKLIST:20007},my="未连接到网络",Ey="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}",_y="The package you purchased does not support this ability. You can refer to here to purchase: ${purchaseAddress}",Ty="TIM SDK version is too old. Please upgrade version",Cy="init 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",by="The API is support use in the state of. Please go to: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",Dy={NO_NETWORK:"未连接到网络",FAILURE_SWITCH_TO_AUDIO:"切换语音通话失败",FAILURE_SWITCH_TO_VIDEO:"切换视频通话失败",ERROR_NULL:"成功",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://cloud.tencent.com/document/product/647/78770",ERROR_GET_DEVICE_LIST_FAIL:"获取设备列表失败",ERROR_INIT_FAIL:"TUICallEngine init 未完成,需要在 init 完成后使用此 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:"inviteID 无效或邀请已处理。解决方案请前往: 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:"参数错误"},Ry=function(t){p(n,m(Error));var e=T(n);function n(t){var r,i=t.message,a=t.code,o=void 0===a?Iy.UNKNOWN:a;return u(this,n),r=e.call(this,"".concat(i).concat(function(t){for(var e=0,n=Object.keys(Dy);e")),r.code=o,r.name="TUICallEngineError",r.message_=i,r}return f(n,[{key:"getCode",value:function(){return this.code}}]),n}(),wy=["inviteID","type"],Sy=function(){function t(e){u(this,t),this.TSignaling=e.TSignaling,this._logger=ly()}var e,n,r,o,s,c,h;return f(t,[{key:"handleNewSignaling",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._logger.info("TSignaling.handleNewSignaling.start",{text:{data:{data:t,params:e,userData:n}},type:"api"}),i(i({userData:n||""},t),{},{version:4,businessID:"av_call",platform:"MiniApp",data:i({cmd:_g[t.call_type],room_id:t.room_id,message:""},e)})}},{key:"extractCallingInfoFromMessage",value:function(t){if(!t||"TIMCustomElem"!==t.type)return"";var e=JSON.parse(t.payload.data);if(e.businessID!==dg)return"";switch(e.actionType){case cg:var n=JSON.parse(e.data);return n.call_end>0&&!e.groupID?n.call_end:0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case lg:return"取消通话";case ug:return"已接听";case hg:return"拒绝通话";case fg:return"无应答";default:return""}}},{key:"handleError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.code,n=void 0===e?"":e,r=t.message;if(n)throw new Ry({message:void 0===r?"":r,code:n})}},{key:"_handleInviteData",value:function(t){var e=t.type,n=t.roomID,r=t.userIDList,i=t.hangup,a=t.switchMode,o=t.userData;if(i)return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:i.callEnd},{cmd:"hangup"}));if(a){var s={version:0,call_type:e,room_id:n},c={cmd:"switchToVideo"};return a===Tg&&(s.switch_to_audio_call="switch_to_audio_call",c.cmd="switchToAudio"),JSON.stringify(this.handleNewSignaling(s,c))}return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n},{userIDs:r},o))}},{key:"_handleInviteGroupData",value:function(t){var e=t.type,n=t.roomID,r=t.hangup,i=t.userData;return r?JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:r.call_end},{cmd:"hangup"},i)):JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n}))}},{key:"invite",value:(h=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.invite.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.offlinePushInfo,i=e.hangup,o=e.switchMode,t.prev=2,t.next=5,this.TSignaling.invite({userID:n,data:this._handleInviteData(e),timeout:i?0:30,offlinePushInfo:r});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.invite.fail",{text:{data:{hangup:i,switchMode:o},error:t.t0},type:"api"}),!i){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup C2C"));case 13:if(!o){t.next=15;break}return t.abrupt("return",this.handleError(t.t0,o));case 15:return t.abrupt("return",this.handleError(t.t0,"invite"));case 16:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return h.apply(this,arguments)})},{key:"inviteGroup",value:(c=l(a().mark((function t(e){var n,r,i,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.inviteGroup.start",{text:{data:{params:e}},type:"api"}),n=e.groupID,r=e.userIDList,i=e.offlinePushInfo,o=e.hangup,s=e.inCallUserIDs,c=void 0===s?[]:s,t.prev=2,t.next=5,this.TSignaling.inviteInGroup({groupID:n,inviteeList:r,timeout:o?0:30,data:this._handleInviteGroupData(e),offlinePushInfo:i,inCallUserIDs:c});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.inviteGroup.fail",{text:{data:{hangup:o},error:t.t0},type:"api"}),!o){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup group"));case 13:return t.abrupt("return",this.handleError(t.t0,"inviteGroup"));case 14:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return c.apply(this,arguments)})},{key:"accept",value:(s=l(a().mark((function t(e,n){var r,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.accept.start",{text:{data:{params:e,supportParams:n}},type:"api"}),r=e.inviteID,o=e.type,s=E(e,wy),t.prev=2,t.next=5,this.TSignaling.accept({inviteID:r,data:JSON.stringify(this.handleNewSignaling(i({version:0,call_type:o},s),n))});case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.accept.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"accept"));case 12:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t,e){return s.apply(this,arguments)})},{key:"reject",value:(o=l(a().mark((function t(e){var n,r,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.reject.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.type,i=e.lineBusy,o={version:0,call_type:r},s=null,i?(o.line_busy=i,s=JSON.stringify(this.handleNewSignaling(o,{message:"lineBusy"}))):s=JSON.stringify(this.handleNewSignaling(o)),t.prev=5,t.next=8,this.TSignaling.reject({inviteID:n,data:s});case 8:return t.abrupt("return",t.sent);case 11:if(t.prev=11,t.t0=t.catch(5),this._logger.error("TSignaling.reject.fail",{text:{error:t.t0},type:"api"}),!i){t.next=16;break}return t.abrupt("return",this.handleError(t.t0,"line_busy"));case 16:return t.abrupt("return",this.handleError(t.t0,"reject"));case 17:case"end":return t.stop()}}),t,this,[[5,11]])}))),function(t){return o.apply(this,arguments)})},{key:"cancel",value:(r=l(a().mark((function t(e){var n,r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.cancel.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.callType,t.prev=2,t.next=5,this.TSignaling.cancel({inviteID:n,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:r}))});case 5:return i=t.sent,t.abrupt("return",i);case 9:return t.prev=9,t.t0=t.catch(2),this._logger.error("TSignaling.cancel.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"cancel"));case 13:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return r.apply(this,arguments)})},{key:"hangup",value:(n=l(a().mark((function t(e){var n,r,i,o,s,c,l,u,h,f,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.hangup.start",{text:{data:{params:e}},type:"api"}),n=e.userIDList,r=e.callType,i=e.callEnd,o=void 0===i?0:i,s=e.isGroupCall,c=void 0!==s&&s,l=e.groupID,u=void 0===l?"":l,h={version:0,call_type:r,call_end:o},f={cmd:"hangup"},d=JSON.stringify(this.handleNewSignaling(h,f)),!c||!u){t.next=10;break}return t.next=8,this.TSignaling.inviteInGroup({inviteeList:n,groupID:u,data:d,timeout:0});case 8:t.next=12;break;case 10:return t.next=12,this.TSignaling.invite({userID:n[0],data:d,timeout:0});case 12:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"switchCallMode",value:(e=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.switchCallMode.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.callType,i=e.roomID,o=e.mode,t.abrupt("return",this.invite({userID:n,type:r,roomID:i,switchMode:o}));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"destroyed",value:function(){this._logger.info("TSignaling.destroyed.start",{type:"api"}),this.TSignaling=null}},{key:"setLogLevel",value:function(t){this.TSignaling.setLogLevel(t)}}]),t}(),xy=function(){function t(e){u(this,t),this._emitter=e.emitter,this._logger=ly()}return f(t,[{key:"onError",value:function(t){this._logger.error("TUICallEvent.onError",{text:{error:t},type:"event"}),this._emitter.emit(og.ERROR,t)}},{key:"onCallBegin",value:function(t){this._logger.info("TUICallEvent.onCallBegin",{text:{data:t},type:"event"}),this._emitter.emit(og.ON_CALL_BEGIN,t)}},{key:"onCallEnd",value:function(t){this._logger.info("TUICallEvent.onCallEnd",{text:{data:t},type:"event"});var e=t.userID,n=t.callEnd,r=t.message,i=t.roomID,a=t.callMediaType,o=t.callRole,s=t.totalTime;this._emitter.emit(og.CALL_END,{userID:e,callEnd:n,message:r,roomID:i,callMediaType:a,callRole:o,totalTime:s})}},{key:"onInvited",value:function(t){this._logger.info("TUICallEvent.onInvited",{text:{data:t},type:"event"}),this._emitter.emit(og.INVITED,t),this._emitter.emit(og.ON_CALL_RECEIVED,t)}},{key:"onLineBusy",value:function(t){this._logger.info("TUICallEvent.onLineBusy",{text:{data:t},type:"event"});var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(og.LINE_BUSY,{inviteID:e,invitee:n,userID:r,reason:"line busy"})}},{key:"onReject",value:function(t){var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(og.REJECT,{inviteID:e,invitee:n,userID:r,reason:"reject"})}},{key:"onNoResp",value:function(t){this._logger.info("TUICallEvent.onNoResp",{text:{data:t},type:"event"});var e=t.groupID,n=void 0===e?"":e,r=t.inviteID,i=t.sponsor,a=t.timeoutUserList,o=t.userIDList;this._emitter.emit(og.NO_RESP,{groupID:n,inviteID:r,sponsor:i,timeoutUserList:a,userIDList:o})}},{key:"onCancel",value:function(t){this._emitter.emit(og.CALLING_CANCEL,t),this._emitter.emit(og.ON_CALL_CANCELED,t)}},{key:"onTimeout",value:function(t){this._logger.info("TUICallEvent.onTimeout",{text:{data:t},type:"event"});var e=t.inviteID,n=t.groupID,r=t.sponsor,i=t.timeoutUserList;this._emitter.emit(og.CALLING_TIMEOUT,{groupID:n,inviteID:e,sponsor:r,timeoutUserList:i})}},{key:"onUserAccept",value:function(t){this._logger.info("TUICallEvent.onUserAccept",{text:{data:t},type:"event"});var e=t.userID,n=t.userList;this._emitter.emit(og.USER_ACCEPT,{userID:e,userList:n})}},{key:"onUserEnter",value:function(t){this._logger.info("TUICallEvent.onUserEnter",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(og.USER_ENTER,{userID:e,playerList:n})}},{key:"onUserLeave",value:function(t){this._logger.info("TUICallEvent.onUserLeave",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(og.USER_LEAVE,{userID:e,playerList:n})}},{key:"onUserUpdate",value:function(t){var e=t.pusher,n=t.playerList;this._emitter.emit(og.USER_UPDATE,{pusher:e,playerList:n})}},{key:"onSdkReady",value:function(t){this._logger.info("TUICallEvent.onSdkReady",{text:{data:t},type:"event"}),this._emitter.emit(og.SDK_READY,t)}},{key:"onKickedOut",value:function(t){this._logger.info("TUICallEvent.onKickedOut",{text:{data:t},type:"event"}),this._emitter.emit(og.KICKED_OUT,t)}},{key:"onCallMode",value:function(t){this._logger.info("TUICallEvent.onCallMode",{text:{data:t},type:"event"}),this._emitter.emit(og.CALL_MODE,t)}},{key:"onMessageSentByMe",value:function(t){this._logger.info("TUICallEvent.onMessageSentByMe",{text:{data:t},type:"event"}),this._emitter.emit(og.MESSAGE_SENT_BY_ME,t)}},{key:"destroyed",value:function(){this._logger.info("TUICallEvent.destroyed",{type:"api"}),this._emitter=null}}]),t}(),Ly="1.6.0";_v("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),jv);var Oy=ln,ky=function(){var t=Oy(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e},Ay=V,Ny=ve,Uy=bt,Py=ky,My=RegExp.prototype,jy=Ln.PROPER,Vy=wr,Gy=ln,Hy=bh,By=N,Fy=function(t){var e=t.flags;return void 0!==e||"flags"in My||Ny(t,"flags")||!Uy(My,t)?e:Ay(Py,t)},Ky="toString",zy=RegExp.prototype[Ky],Jy=By((function(){return"/a/b"!==zy.call({source:"a",flags:"b"})})),Wy=jy&&zy.name!==Ky;(Jy||Wy)&&Vy(RegExp.prototype,Ky,(function(){var t=Gy(this);return"/"+Hy(t.source)+"/"+Hy(Fy(t))}),{unsafe:!0});var $y,qy,Yy=Vp;xi({target:"Object",stat:!0,forced:Object.isExtensible!==Yy},{isExtensible:Yy}),$y="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Xy=function(){},Qy=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Zy=Qy.length-1;Zy;)qy=Qy[Zy],console[qy]||($y[qy]=Xy),Zy-=1;Object.isExtensible($y)&&($y.methods=Qy);var tI,eI,nI=$y,rI=N,iI=k.RegExp,aI=rI((function(){var t=iI("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),oI=aI||rI((function(){return!iI("a","y").sticky})),sI={BROKEN_CARET:aI||rI((function(){var t=iI("^r","gy");return t.lastIndex=2,null!==t.exec("str")})),MISSED_STICKY:oI,UNSUPPORTED_Y:aI},cI=N,lI=k.RegExp,uI=cI((function(){var t=lI(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})),hI=N,fI=k.RegExp,dI=hI((function(){var t=fI("(?b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")})),pI=V,vI=X,gI=bh,yI=ky,II=sI,mI=ne.exports,EI=af,_I=ar.get,TI=uI,CI=dI,bI=mI("native-string-replace",String.prototype.replace),DI=RegExp.prototype.exec,RI=DI,wI=vI("".charAt),SI=vI("".indexOf),xI=vI("".replace),LI=vI("".slice),OI=(eI=/b*/g,pI(DI,tI=/a/,"a"),pI(DI,eI,"a"),0!==tI.lastIndex||0!==eI.lastIndex),kI=II.BROKEN_CARET,AI=void 0!==/()??/.exec("")[1];(OI||AI||kI||TI||CI)&&(RI=function(t){var e,n,r,i,a,o,s,c=this,l=_I(c),u=gI(t),h=l.raw;if(h)return h.lastIndex=c.lastIndex,e=pI(RI,h,u),c.lastIndex=h.lastIndex,e;var f=l.groups,d=kI&&c.sticky,p=pI(yI,c),v=c.source,g=0,y=u;if(d&&(p=xI(p,"y",""),-1===SI(p,"g")&&(p+="g"),y=LI(u,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==wI(u,c.lastIndex-1))&&(v="(?: "+v+")",y=" "+y,g++),n=new RegExp("^(?:"+v+")",p)),AI&&(n=new RegExp("^"+v+"$(?!\\s)",p)),OI&&(r=c.lastIndex),i=pI(DI,d?n:c,y),d?i?(i.input=LI(i.input,g),i[0]=LI(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:OI&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),AI&&i&&i.length>1&&pI(bI,i[0],n,(function(){for(a=1;a2)if(l=Rm(l),43===(e=km(l,0))||45===e){if(88===(n=km(l,2))||120===n)return NaN}else if(48===e){switch(km(l,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+l}for(o=(a=Om(l,2)).length,s=0;si)return NaN;return parseInt(a,r)}return+l},Nm=vm(wm,!Sm(" 0o1")||!Sm("0b1")||Sm("+0x1")),Um=function(t){var e,n=arguments.length<1?0:Sm(function(t){var e=Em(t,"number");return"bigint"==typeof e?e:Am(e)}(t));return Im(xm,e=this)&&_m((function(){Dm(e)}))?ym(Object(n),this,Um):n};Um.prototype=xm,Nm&&(xm.constructor=Um),um({global:!0,constructor:!0,wrap:!0,forced:Nm},{Number:Um});Nm&&function(t,e){for(var n,r=hm?Tm(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;r.length>i;i++)gm(e,n=r[i])&&!gm(t,n)&&bm(t,n,Cm(e,n))}(dm[wm],Sm);var Pm=kr,Mm=bh,jm=ut,Vm=RangeError,Gm=function(t){var e=Mm(jm(this)),n="",r=Pm(t);if(r<0||r===1/0)throw new Vm("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n},Hm=X,Bm=Vr,Fm=bh,Km=ut,zm=Hm(Gm),Jm=Hm("".slice),Wm=Math.ceil,$m=function(t){return function(e,n,r){var i,a,o=Fm(Km(e)),s=Bm(n),c=o.length,l=void 0===r?" ":Fm(r);return s<=c||""===l?o:((a=zm(l,Wm((i=s-c)/l.length))).length>i&&(a=Jm(a,0,i)),t?o+a:a+o)}},qm=X,Ym=N,Xm={start:$m(!1),end:$m(!0)}.start,Qm=RangeError,Zm=isFinite,tE=Math.abs,eE=Date.prototype,nE=eE.toISOString,rE=qm(eE.getTime),iE=qm(eE.getUTCDate),aE=qm(eE.getUTCFullYear),oE=qm(eE.getUTCHours),sE=qm(eE.getUTCMilliseconds),cE=qm(eE.getUTCMinutes),lE=qm(eE.getUTCMonth),uE=qm(eE.getUTCSeconds),hE=Ym((function(){return"0385-07-25T07:06:39.999Z"!==nE.call(new Date(-50000000000001))}))||!Ym((function(){nE.call(new Date(NaN))}))?function(){if(!Zm(rE(this)))throw new Qm("Invalid time value");var t=this,e=aE(t),n=sE(t),r=e<0?"-":e>9999?"+":"";return r+Xm(tE(e),r?6:4,0)+"-"+Xm(lE(t)+1,2,0)+"-"+Xm(iE(t),2,0)+"T"+Xm(oE(t),2,0)+":"+Xm(cE(t),2,0)+":"+Xm(uE(t),2,0)+"."+Xm(n,3,0)+"Z"}:nE;xi({target:"Date",proto:!0,forced:Date.prototype.toISOString!==hE},{toISOString:hE});var fE=X,dE=fe,pE=Math.floor,vE=fE("".charAt),gE=fE("".replace),yE=fE("".slice),IE=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,mE=/\$([$&'`]|\d{1,2})/g,EE=Es,_E=V,TE=X,CE=FI,bE=N,DE=ln,RE=yt,wE=st,SE=kr,xE=Vr,LE=bh,OE=ut,kE=zI,AE=Xt,NE=function(t,e,n,r,i,a){var o=n+t.length,s=r.length,c=mE;return void 0!==i&&(i=dE(i),c=IE),gE(a,c,(function(a,c){var l;switch(vE(c,0)){case"$":return"$";case"&":return t;case"`":return yE(e,0,n);case"'":return yE(e,o);case"<":l=i[yE(c,1,-1)];break;default:var u=+c;if(0===u)return a;if(u>s){var h=pE(u/10);return 0===h?a:h<=s?void 0===r[h-1]?vE(c,1):r[h-1]+vE(c,1):a}l=r[u-1]}return void 0===l?"":l}))},UE=QI,PE=Le("replace"),ME=Math.max,jE=Math.min,VE=TE([].concat),GE=TE([].push),HE=TE("".indexOf),BE=TE("".slice),FE="$0"==="a".replace(/./,"$0"),KE=!!/./[PE]&&""===/./[PE]("a","$0");CE("replace",(function(t,e,n){var r=KE?"$":"$0";return[function(t,n){var r=OE(this),i=wE(t)?void 0:AE(t,PE);return i?_E(i,t,r,n):_E(e,LE(r),t,n)},function(t,i){var a=DE(this),o=LE(t);if("string"==typeof i&&-1===HE(i,r)&&-1===HE(i,"$<")){var s=n(e,a,o,i);if(s.done)return s.value}var c=RE(i);c||(i=LE(i));var l,u=a.global;u&&(l=a.unicode,a.lastIndex=0);for(var h,f=[];null!==(h=UE(a,o))&&(GE(f,h),u);){""===LE(h[0])&&(a.lastIndex=kE(o,xE(a.lastIndex),l))}for(var d,p="",v=0,g=0;g=v&&(p+=BE(o,v,m)+y,v=m+I.length)}return p+BE(o,v)}]}),!!bE((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!FE||KE);var zE,JE=Et,WE=et,$E=Le("match"),qE=function(t){var e;return JE(t)&&(void 0!==(e=t[$E])?!!e:"RegExp"===WE(t))},YE=TypeError,XE=function(t){if(qE(t))throw new YE("The method doesn't accept regular expressions");return t},QE=Le("match"),ZE=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[QE]=!1,"/./"[t](e)}catch(t){}}return!1},t_=xi,e_=Ja,n_=A.f,r_=Vr,i_=bh,a_=XE,o_=ut,s_=ZE,c_=e_("".startsWith),l_=e_("".slice),u_=Math.min,h_=s_("startsWith");function f_(t,e){t=t.split("."),e=e.split(".");for(var n=Math.max(t.length,e.length);t.lengtha)return 1;if(i1?arguments[1]:void 0,e.length)),r=i_(t);return c_?c_(e,r,n):l_(e,n,n+r.length)===r}});var d_="TRTC-ROOM",p_=wx||qq;p_||console.error(d_,"不支持当前小程序环境");var v_,g_=p_.getSystemInfoSync(),y_=g_.safeArea;("iOS 13.3"===g_.system||"iPhoneX"===g_.model&&"iOS 13.3.1"===g_.system)&&console.log("use media audio volume type"),console.log(d_,"SystemInfo",g_),"undefined"!=typeof qq?v_=!0:"undefined"!=typeof wx&&(v_=f_(g_.version,"7.0.8")>=0||f_(g_.version,"2.4.0")>=0&&f_(g_.version,"6.0.0")<0&&f_(g_.SDKVersion,"2.10.0")>=0);var I_=v_,m_="undefined"!=typeof uni,E_=/iOS/i.test(g_.system),__=/Android/i.test(g_.system);/mac/i.test(g_.system);var T_=g_.version,C_=g_.SDKBuild?"".concat(g_.SDKVersion,"-").concat(g_.SDKBuild):g_.SDKVersion;g_.screenHeight,y_.bottom,console.log(d_,"APP_VERSION:",T_," LIB_VERSION:",C_," is new version:",I_);var b_=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()}(t)},D_=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"===s(t)&&t.constructor===Number)},R_=function(t){return"string"==typeof t},w_=function(t){return null!==t&&"object"===s(t)},S_=function(t){return void 0===t},x_=0;Date.now||(Date.now=function(){return(new Date).getTime()});var L_=function(){0===x_&&(x_=Date.now()-1);var t=Date.now()-x_;return t>4294967295?(x_+=4294967295,Date.now()-x_):t},O_=function(t){return t instanceof Error},k_=function(t){return JSON.stringify(t,["message","code"])};function A_(){var t="unknown";return E_&&(t="ios"),__&&(t="android"),t}function N_(t){return U_.apply(this,arguments)}function U_(){return(U_=l(a().mark((function t(e){var n,r,i,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return",!1);case 2:return n=e.microphone,r=void 0!==n&&n,i=e.camera,o=void 0!==i&&i,t.prev=3,t.next=6,wx.getSetting();case 6:if(s=t.sent,c=s.authSetting[Lg.RECORD],l=s.authSetting[Lg.CAMERA],!r||!o){t.next=11;break}return t.abrupt("return",c&&l);case 11:if(!r){t.next=13;break}return t.abrupt("return",c);case 13:if(!o){t.next=15;break}return t.abrupt("return",l);case 15:return t.abrupt("return",!1);case 18:return t.prev=18,t.t0=t.catch(3),t.abrupt("return",!1);case 21:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}function P_(t){return t===wg.AV_CALL}function M_(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function j_(t){var e=String(t);return e.startsWith("14")||e.startsWith("16")||e.startsWith("17")}function V_(t){var e=j_(t)?Og:kg;return"".concat(e,"&position=").concat(t,"®ionId=").concat(function(t){return t>=2e7&&t<3e7||t>=172e7&&t<173e7?Ng:t>=3e7&&t<4e7||t>=173e7&&t<174e7?Pg:t>=4e7&&t<5e7||t>=174e7&&t<175e7?Ug:t>=5e7&&t<6e7||t>=175e7&&t<176e7?Mg:t>=7e7&&t<8e7||t>=177e7&&t<178e7?jg:Ag}(t))}var G_=0,H_=new Map;function B_(){var t=new Date;return"TUICallEngine ".concat(t.toLocaleTimeString("en-US",{hour12:!1}),".").concat(function(t){var e;switch(t.toString().length){case 1:e="00".concat(t);break;case 2:e="0".concat(t);break;default:e=t}return e}(t.getMilliseconds()),":")}var F_={_data:[],_length:0,_visible:!1,arguments2String:function(t){var e,n;if(1===t.length)e=B_()+t[0];else{e=B_();for(var r=0,i=t.length;r-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",i)),this.startts&&this.endts&&!this.timespan&&(this.timespan=Math.abs(this.endts-this.startts))}},{key:"setEnd",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.endts=Date.now(),e?this._eventStatController.pushIn(this):setTimeout((function(){t._eventStatController.pushIn(t)}),0)}},{key:"setError",value:function(t,e,n){return this.setNetworkType(n),e?(t.code&&this.setCode(t.code),t.message&&this.setMessage(t.message)):(this.setCode(Iy.NO_NETWORK),this.setMessage(my)),this}},{key:"setCode",value:function(t){return"ECONNABORTED"===t&&(this.codeint=103),D_(t)?this.codeint=t:F_.warn("SSOLogData.setCode value not a number, please check!",t,s(t)),this}},{key:"setMessage",value:function(t){return R_(t)?(this.message=t,this):this}},{key:"setText",value:function(t){return D_(t)?this.text=t.toString():R_(t)&&(this.text=t),this}},{key:"setTalkTime",value:function(t){return this.talktime=t,this}},{key:"setMessageType",value:function(t){return this.msgType=t,this}},{key:"setCallType",value:function(t){return this.calltype=t,this}},{key:"setNetworkType",value:function(t){return S_(t)?F_.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=t,this}}],[{key:"bindController",value:function(e){t.prototype._eventStatController=e}}]),t}(),z_="sdkConstruct",J_="quality_report",W_=function(){function t(){u(this,t),this._table="timweb-trtccalling",this._report=[]}return f(t,[{key:"pushIn",value:function(t){F_.debug("SSOLogBody.pushIn",this._report.length,t),this._report.push(t)}},{key:"backfill",value:function(t){var e;b_(t)&&0!==t.length&&(F_.debug("SSOLogBody.backfill",this._report.length,t.length),(e=this._report).unshift.apply(e,C(t)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getTable",value:function(){return this._table}},{key:"getLogsInMemory",value:function(){var t=this._report.slice();return this._reset(),t}}]),t}(),$_={CURRENT:{COMMON:"https://webim.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com"}},q_={IM_OPEN_STAT:"imopenstat"},Y_={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},X_={imopenstat:"v4"},Q_=function(){function t(){u(this,t),this.TAG="trtccalling-ssolog-event",this._reportBody=new W_,this._version=Ly,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}return f(t,[{key:"reportAtOnce",value:function(){F_.debug("EventStatController.reportAtOnce"),this._report()}},{key:"pushIn",value:function(t){t instanceof K_&&(t.setCommonInfo({SDKAppID:Number(wx.getStorageSync("sdkAppId")),version:this._version,userID:wx.getStorageSync("userId")}),this._reportBody.pushIn(t),this._report())}},{key:"_resetLastReportTime",value:function(){this._lastReportTime=Date.now()}},{key:"_startReportTimer",value:function(){var t=this;this._timerID=setInterval((function(){Date.now()0&&(clearInterval(this._timerID),this._timerID=0)}},{key:"_report",value:function(){var t=this;if(!this._reportBody.isEmpty()){var e=Math.ceil(+new Date/1e3),n=wx.getStorageSync("sdkAppId"),r=this._reportBody.getLogsInMemory(),i={table:this._reportBody.getTable(),report:r},a=$_.CURRENT.COMMON,o=X_.imopenstat,s=q_.IM_OPEN_STAT,c=Y_.TIM_WEB_TRTCCALLING_REPORT,l="".concat(a,"/").concat(o,"/").concat(s,"/").concat(c,"/?sdkappid=").concat(n,"&reqtime=").concat(e);wx.request({url:l,method:"POST",data:JSON.stringify(i),header:{"content-type":"application/json"},success:function(e){t._retryCount>0&&(F_.debug("EventStatController.report retry success"),t._retryCount=0)},fail:function(e){F_.warn("EventStatController.report, error:".concat(k_(e))),t._reportBody.backfill(r),t._reportBody.getLogsNumInMemory()>t.MAX_THRESHOLD||t._retryCount===t.MAX_RETRY_COUNT||0===t._timerID?t._retryCount=0:t._retryCount+=1}})}}},{key:"reset",value:function(){F_.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}]),t}(),Z_=Jr.includes,tT=ud;xi({target:"Array",proto:!0,forced:N((function(){return!Array(1).includes()}))},{includes:function(t){return Z_(this,t,arguments.length>1?arguments[1]:void 0)}}),tT("includes");var eT=xi,nT=XE,rT=ut,iT=bh,aT=ZE,oT=X("".indexOf);eT({target:"String",proto:!0,forced:!aT("includes")},{includes:function(t){return!!~oT(iT(rT(this)),iT(nT(t)),arguments.length>1?arguments[1]:void 0)}});var sT=X,cT=Cv,lT=_p.exports.getWeakData,uT=cs,hT=ln,fT=st,dT=Et,pT=Du,vT=ve,gT=ar.set,yT=ar.getterFor,IT=ho.find,mT=ho.findIndex,ET=sT([].splice),_T=0,TT=function(t){return t.frozen||(t.frozen=new CT)},CT=function(){this.entries=[]},bT=function(t,e){return IT(t.entries,(function(t){return t[0]===e}))};CT.prototype={get:function(t){var e=bT(this,t);if(e)return e[1]},has:function(t){return!!bT(this,t)},set:function(t,e){var n=bT(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=mT(this.entries,(function(e){return e[0]===t}));return~e&&ET(this.entries,e,1),!!~e}};var DT,RT={getConstructor:function(t,e,n,r){var i=t((function(t,i){uT(t,a),gT(t,{type:e,id:_T++,frozen:void 0}),fT(i)||pT(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=yT(e),s=function(t,e,n){var r=o(t),i=lT(hT(e),!0);return!0===i?TT(r).set(e,n):i[r.id]=n,t};return cT(a,{delete:function(t){var e=o(this);if(!dT(t))return!1;var n=lT(t);return!0===n?TT(e).delete(t):n&&vT(n,e.id)&&delete n[e.id]},has:function(t){var e=o(this);if(!dT(t))return!1;var n=lT(t);return!0===n?TT(e).has(t):n&&vT(n,e.id)}}),cT(a,n?{get:function(t){var e=o(this);if(dT(t)){var n=lT(t);return!0===n?TT(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return s(this,t,e)}}:{add:function(t){return s(this,t,!0)}}),i}},wT=Gp,ST=k,xT=X,LT=Cv,OT=_p.exports,kT=_v,AT=RT,NT=Et,UT=ar.enforce,PT=N,MT=Gn,jT=Object,VT=Array.isArray,GT=jT.isExtensible,HT=jT.isFrozen,BT=jT.isSealed,FT=jT.freeze,KT=jT.seal,zT={},JT={},WT=!ST.ActiveXObject&&"ActiveXObject"in ST,$T=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},qT=kT("WeakMap",$T,AT),YT=qT.prototype,XT=xT(YT.set);if(MT)if(WT){DT=AT.getConstructor($T,"WeakMap",!0),OT.enable();var QT=xT(YT.delete),ZT=xT(YT.has),tC=xT(YT.get);LT(YT,{delete:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),QT(this,t)||e.frozen.delete(t)}return QT(this,t)},has:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),ZT(this,t)||e.frozen.has(t)}return ZT(this,t)},get:function(t){if(NT(t)&&!GT(t)){var e=UT(this);return e.frozen||(e.frozen=new DT),ZT(this,t)?tC(this,t):e.frozen.get(t)}return tC(this,t)},set:function(t,e){if(NT(t)&&!GT(t)){var n=UT(this);n.frozen||(n.frozen=new DT),ZT(this,t)?XT(this,t,e):n.frozen.set(t,e)}else XT(this,t,e);return this}})}else wT&&PT((function(){var t=FT([]);return XT(new qT,t,1),!HT(t)}))&<(YT,{set:function(t,e){var n;return VT(t)&&(HT(t)?n=zT:BT(t)&&(n=JT)),XT(this,t,e),n===zT&&FT(t),n===JT&&KT(t),this}});var eC={exports:{}}; /*! * validate.js 0.13.1 @@ -16,7 +16,7 @@ var __TEMP__ = require('tsignaling-wx');var t = __REQUIRE_DEFAULT__(__TEMP__);va */(function(t,e,n){var r=function(t,e,n){n=i.extend({},i.options,n);var a=i.runValidations(t,e,n);if(a.some((function(t){return i.isPromise(t.error)})))throw new Error("Use validate.async if you want support for promises");return r.processValidationResults(a,n)},i=r;i.extend=function(t){return[].slice.call(arguments,1).forEach((function(e){for(var n in e)t[n]=e[n]})),t},i.extend(r,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var t=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(t+="+"+i.version.metadata),t}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(t,e,n){var r,a,o,s,c,l,u,h=[];for(r in(i.isDomElement(t)||i.isJqueryElement(t))&&(t=i.collectFormValues(t)),e)for(a in o=i.getDeepObjectValue(t,r),s=i.result(e[r],o,t,r,n,e)){if(!(c=i.validators[a]))throw u=i.format("Unknown validator %{name}",{name:a}),new Error(u);l=s[a],(l=i.result(l,o,t,r,n,e))&&h.push({attribute:r,value:o,validator:a,globalOptions:n,attributes:t,options:l,error:c.call(c,o,l,r,t,n)})}return h},processValidationResults:function(t,e){t=i.pruneEmptyErrors(t,e),t=i.expandMultipleErrors(t,e),t=i.convertErrorMessages(t,e);var n=e.format||"grouped";if("function"!=typeof i.formatters[n])throw new Error(i.format("Unknown format %{format}",e));return t=i.formatters[n](t),i.isEmpty(t)?void 0:t},async:function(t,e,n){var r=(n=i.extend({},i.async.options,n)).wrapErrors||function(t){return t};!1!==n.cleanAttributes&&(t=i.cleanAttributes(t,e));var a=i.runValidations(t,e,n);return new i.Promise((function(o,s){i.waitForResults(a).then((function(){var c=i.processValidationResults(a,n);c?s(new r(c,n,t,e)):o(t)}),(function(t){s(t)}))}))},single:function(t,e,n){return n=i.extend({},i.single.options,n,{format:"flat",fullMessages:!1}),i({single:t},{single:e},n)},waitForResults:function(t){return t.reduce((function(t,e){return i.isPromise(e.error)?t.then((function(){return e.error.then((function(t){e.error=t||null}))})):t}),new i.Promise((function(t){t()})))},result:function(t){var e=[].slice.call(arguments,1);return"function"==typeof t&&(t=t.apply(null,e)),t},isNumber:function(t){return"number"==typeof t&&!isNaN(t)},isFunction:function(t){return"function"==typeof t},isInteger:function(t){return i.isNumber(t)&&t%1==0},isBoolean:function(t){return"boolean"==typeof t},isObject:function(t){return t===Object(t)},isDate:function(t){return t instanceof Date},isDefined:function(t){return null!=t},isPromise:function(t){return!!t&&i.isFunction(t.then)},isJqueryElement:function(t){return t&&i.isString(t.jquery)},isDomElement:function(t){return!!t&&!(!t.querySelectorAll||!t.querySelector)&&(!(!i.isObject(document)||t!==document)||("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName))},isEmpty:function(t){var e;if(!i.isDefined(t))return!0;if(i.isFunction(t))return!1;if(i.isString(t))return i.EMPTY_STRING_REGEXP.test(t);if(i.isArray(t))return 0===t.length;if(i.isDate(t))return!1;if(i.isObject(t)){for(e in t)return!1;return!0}return!1},format:i.extend((function(t,e){return i.isString(t)?t.replace(i.format.FORMAT_REGEXP,(function(t,n,r){return"%"===n?"%{"+r+"}":String(e[r])})):t}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(t){return i.isNumber(t)?100*t%1==0?""+t:parseFloat(Math.round(100*t)/100).toFixed(2):i.isArray(t)?t.map((function(t){return i.prettify(t)})).join(", "):i.isObject(t)?i.isDefined(t.toString)?t.toString():JSON.stringify(t):(t=""+t).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(t,e,n){return e+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(t,e){return(e&&e.prettify||i.prettify)(t)},isString:function(t){return"string"==typeof t},isArray:function(t){return"[object Array]"==={}.toString.call(t)},isHash:function(t){return i.isObject(t)&&!i.isArray(t)&&!i.isFunction(t)},contains:function(t,e){return!!i.isDefined(t)&&(i.isArray(t)?-1!==t.indexOf(e):e in t)},unique:function(t){return i.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)==e})):t},forEachKeyInKeypath:function(t,e,n){if(i.isString(e)){var r,a="",o=!1;for(r=0;ro&&(r=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",c.push(i.format(r,{count:o}))),c.length>0?e.message||c:void 0):e.message||this.notValid||"has an incorrect length"}},numericality:function(t,e,n,r,a){if(i.isDefined(t)){var o,s,c=[],l={greaterThan:function(t,e){return t>e},greaterThanOrEqualTo:function(t,e){return t>=e},equalTo:function(t,e){return t===e},lessThan:function(t,e){return to&&(n=e.tooLate||e.message||this.tooLate||"must be no later than %{date}",n=i.format(n,{date:this.format(o,e),value:this.format(t,e)}),r.push(n)),r.length?i.unique(r):void 0)}}),{parse:null,format:null}),date:function(t,e){return e=i.extend({},e,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,t,e)},format:function(t,e){(i.isString(e)||e instanceof RegExp)&&(e={pattern:e});var n,r=(e=i.extend({},this.options,e)).message||this.message||"is invalid",a=e.pattern;if(i.isDefined(t))return i.isString(t)?(i.isString(a)&&(a=new RegExp(e.pattern,e.flags)),(n=a.exec(t))&&n[0].length==t.length?void 0:r):r},inclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),!i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is not included in the list";return i.format(n,{value:t})}},exclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is restricted";return i.isString(e.within[t])&&(t=e.within[t]),i.format(n,{value:t})}},email:i.extend((function(t,e){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid email";if(i.isDefined(t))return i.isString(t)&&this.PATTERN.exec(t)?void 0:n}),{PATTERN:/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(t,e,n,r,a){if(i.isDefined(t)){i.isString(e)&&(e={attribute:e});var o=(e=i.extend({},this.options,e)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(e.attribute)||!i.isString(e.attribute))throw new Error("The attribute must be a non empty string");var s=i.getDeepObjectValue(r,e.attribute),c=e.comparator||function(t,e){return t===e},l=e.prettify||a&&a.prettify||i.prettify;return c(t,s,e,n,r)?void 0:i.format(o,{attribute:l(e.attribute)})}},url:function(t,e){if(i.isDefined(t)){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid url",r=e.schemes||this.schemes||["http","https"],a=e.allowLocal||this.allowLocal||!1,o=e.allowDataUrl||this.allowDataUrl||!1;if(!i.isString(t))return n;var s="^(?:(?:"+r.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",c="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";return a?c+="?":s+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",s+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+c+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",o&&(s="(?:"+s+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"),new RegExp(s,"i").exec(t)?void 0:n}},type:i.extend((function(t,e,n,r,a){if(i.isString(e)&&(e={type:e}),i.isDefined(t)){var o,s=i.extend({},this.options,e),c=s.type;if(!i.isDefined(c))throw new Error("No type was specified");if(o=i.isFunction(c)?c:this.types[c],!i.isFunction(o))throw new Error("validate.validators.type.types."+c+" must be a function.");if(!o(t,s,n,r,a)){var l=e.message||this.messages[c]||this.message||s.message||(i.isFunction(c)?"must be of the correct type":"must be of type %{type}");return i.isFunction(l)&&(l=l(t,e,n,r,a)),i.format(l,{attribute:i.prettify(n),type:c})}}}),{types:{object:function(t){return i.isObject(t)&&!i.isArray(t)},array:i.isArray,integer:i.isInteger,number:i.isNumber,string:i.isString,date:i.isDate,boolean:i.isBoolean},messages:{}})},r.formatters={detailed:function(t){return t},flat:i.flattenErrorsToArray,grouped:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=i.flattenErrorsToArray(t[e]);return t},constraint:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=t[e].map((function(t){return t.validator})).sort();return t}},r.exposeModule(r,this,t,e,n)}).call(x,eC.exports,eC,null);var nC=eC.exports,rC="number",iC="string",aC="object",oC="function",sC="array",cC={createInstance:{sdkAppID:{presence:!0,type:rC},tim:{type:aC}},destroyInstance:{},init:{userID:{presence:!0,type:iC},userSig:{presence:!0,type:iC}},on:{eventCode:{presence:!0,type:iC},handler:{presence:!0,type:oC},context:{presence:!0,type:aC}},off:{eventCode:{presence:!0,type:iC},handler:{presence:!0,type:oC}},call:{userID:{presence:!0,type:iC},type:{presence:!0,type:rC},roomID:{presence:!1,type:rC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Rg}}},groupCall:{groupID:{presence:!0,type:iC},type:{presence:!0,type:rC},userIDList:{presence:!0,type:sC},roomID:{presence:!1,type:rC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Rg}}},joinInGroupCall:{groupID:{presence:!0,type:iC},type:{presence:!0,type:rC},roomID:{presence:!0,type:rC}},inviteUser:{userIDList:{presence:!0,type:sC}},accept:{},reject:{},hangup:{},switchCallMediaType:{type:{presence:!0,type:rC}},openCamera:{},closeCamera:{},switchCamera:{},openMicrophone:{},closeMicrophone:{},selectAudioPlaybackDevice:{type:{presence:!0,type:iC}},setSelfInfo:{nickName:{presence:!0,type:iC},avatar:{presence:!0,type:iC}}},lC={createInstance:"",destroyInstance:"",init:"",on:"",off:"",call:[sg.IDLE],groupCall:[sg.IDLE],accept:[sg.CALLING],reject:[sg.CALLING],hangup:[sg.CALLING,sg.CONNECTED],switchCallMediaType:[sg.CALLING,sg.CONNECTED],joinInGroupCall:[sg.IDLE],inviteUser:[sg.CALLING,sg.CONNECTED],openCamera:[sg.CALLING,sg.CONNECTED],closeCamera:[sg.CALLING,sg.CONNECTED],switchCamera:[sg.CALLING,sg.CONNECTED],openMicrophone:[sg.CALLING,sg.CONNECTED],closeMicrophone:[sg.CALLING,sg.CONNECTED],selectAudioPlaybackDevice:[sg.CALLING,sg.CONNECTED],setSelfInfo:""},uC={createInstance:!1,destroyInstance:!0,init:!1,off:!0,call:!0,groupCall:!0,joinInGroupCall:!0,inviteUser:!0,accept:!0,reject:!0,hangup:!0,switchCallMediaType:!0,openCamera:!0,closeCamera:!0,switchCamera:!0,openMicrophone:!0,closeMicrophone:!0,selectAudioPlaybackDevice:!0,setSelfInfo:!0},hC=function(t){p(n,m(Error));var e=T(n);function n(t,r,i){var a;return u(this,n),d(_(a=e.call(this,r)),"code",void 0),d(_(a),"message",void 0),d(_(a),"data",void 0),a.code=t,a.message=r,a.data=i,a}return f(n,null,[{key:"error",value:function(t,e,r){return r?new n(t,e,r):new n(t,e)}}]),n}();function fC(t){var e=j_(t)?"".concat(Dy.ERROR_PACKAGE_NOT_PURCHASED):"".concat(Ey);return e=e.replace("${purchaseAddress}",V_(t))}nC.validators.type.types.function=function(t){return t instanceof Function};var dC=function(){function t(){u(this,t),d(this,"paramsMatchedRule",cC),d(this,"statusMatchedRule",lC),d(this,"requireInit",uC)}return f(t,[{key:"getParamsMatchedRule",value:function(t){return this.paramsMatchedRule[t]}},{key:"getStatusMatchedRule",value:function(t){return this.statusMatchedRule[t]}},{key:"getInitReadyRule",value:function(t){return this.requireInit[t]}}]),t}(),pC=function(){function t(){u(this,t),this._logger=ly()}return f(t,[{key:"notify",value:function(t,e,n,r){throw this._logger.error("check:".concat(t.api),{text:{data:t,error:{code:e,message:n}}}),hC.error(e,"[TUICallEngine:".concat(t.api,",").concat(e,"]").concat(n).concat(r))}}]),t}(),vC=f((function t(e){u(this,t),d(this,"api",""),d(this,"attributes",{}),d(this,"callStatus",""),d(this,"capabilityCode",void 0),d(this,"initReady",void 0),this.api=e.api,this.attributes=e.attributes,this.callStatus=e.callStatus,this.capabilityCode=e.capabilityCode,this.initReady=e.initReady,this.sdkAppID=e.sdkAppID})),gC=new WeakMap,yC=function(){function t(){u(this,t),S(this,gC,{writable:!0,value:void 0}),R(this,gC,[])}var e;return f(t,[{key:"addAlertHandler",value:function(t){D(this,gC).push(t)}},{key:"check",value:(e=l(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r1&&void 0!==o[1]?o[1]:{},!e.capabilityCode){t.next=21;break}return t.prev=2,t.next=5,n.tim.callExperimentalAPI("isCommercialAbilityEnabled",e.capabilityCode);case 5:!1===t.sent.data.enabled&&this.notification.notify(e,Iy.ERROR_PACKAGE_NOT_SUPPORTED,_y,Dy.ERROR_PACKAGE_NOT_SUPPORTED),t.next=21;break;case 9:if(t.prev=9,t.t0=t.catch(2),wx.$TUICallEngine._callDataReport.setCodeAndMessage(Iy.ERROR_PACKAGE_NOT_SUPPORTED,JSON.stringify(t.t0)),wx.$TUICallEngine._callDataReport.uploadToKibana(),2905!==t.t0.code){t.next=17;break}this.notification.notify(e,Iy.ERROR_TIM_VERSION_OUTDATED,Ty,Dy.ERROR_TIM_VERSION_OUTDATED),t.next=21;break;case 17:throw r=null,i=0,e.capabilityCode===Dg.PRO?(r="".concat((a=e.sdkAppID,s=void 0,s=j_(a)?"".concat(Dy.ERROR_PACKAGE_NOT_SUPPORTED):"".concat(_y),s=s.replace("${purchaseAddress}",V_(a)))," "),i=Iy.ERROR_PACKAGE_NOT_SUPPORTED):(r="".concat(fC(e.sdkAppID)," "),i=Iy.ERROR_PACKAGE_NOT_PURCHASED),new hC(i,r);case 21:case"end":return t.stop()}var a,s}),t,this,[[2,9]])}))),function(t){return e.apply(this,arguments)})}]),r}(),TC=function(t){p(n,IC);var e=T(n);function n(t,r){return u(this,n),e.call(this,t,r)}return f(n,[{key:"check",value:function(t,e){void 0!==t.initReady&&this.rule.getInitReadyRule(t.api)!==t.initReady&&this.notification.notify(t,Iy.ERROR_INIT_FAIL,Cy,Dy.ERROR_INIT_FAIL)}}]),n}(),CC=function(){function t(){u(this,t),d(this,"alertRule",void 0),d(this,"notification",void 0),d(this,"alert",void 0)}return f(t,[{key:"initializeBeans",value:function(){this.alertRule=new dC,this.notification=new pC,this.alert=new yC,this.alert.addAlertHandler(new mC(this.alertRule,this.notification)),this.alert.addAlertHandler(new TC(this.alertRule,this.notification)),this.alert.addAlertHandler(new _C(this.alertRule,this.notification)),this.alert.addAlertHandler(new EC(this.alertRule,this.notification))}},{key:"getAlert",value:function(){return this.alert}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new t,this.instance.initializeBeans()),this.instance}}]),t}();d(CC,"instance",void 0);var bC=X,DC=$t,RC=Et,wC=ve,SC=Ts,xC=P,LC=Function,OC=bC([].concat),kC=bC([].join),AC={},NC=xC?LC.bind:function(t){var e=DC(this),n=e.prototype,r=SC(arguments,1),i=function(){var n=OC(r,SC(arguments));return this instanceof i?function(t,e,n){if(!wC(AC,e)){for(var r=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=t.version,n=void 0===e?"":e,r=t.sdkAppId,i=void 0===r?0:r,a=t.userID,o=void 0===a?"":a,s=A_(),c=m_?"uniminiprogram":"wxminiprogram";this._callData={version:n,platform:s,framework:c,sdkAppId:i,userID:o,roomID:0,inviteID:"",callRole:vg,callScene:"",callType:Ig,inviteeList:[],result:wg.UNKNOWN,totalTime:0,totalScore:0,code:0,message:"",abilityBit:!1,enterRoomTime:"",sendSignalingTime:"",callAcceptTime:"",exitRoomTime:"",callEndTime:"",network:0,audio:0,video:0}}},{key:"reset",value:function(){this.initializeCallData(),this._ssoLog=null}},{key:"clearCallDataAfterUpload",value:function(){var t=this.getCallData(),e=t.version,n=t.sdkAppId,r=t.userID;this.initializeCallData({version:e,sdkAppId:n,userID:r})}},{key:"uploadToKibana",value:function(){try{this._ssoLog.setText(this.packageCallDataToKibana()).setEnd(),this.clearCallDataAfterUpload()}catch(t){}}}]),t}(),jC=function(){function t(e,n){u(this,t),d(this,"_eventEmitter",void 0),d(this,"_callDataReport",void 0),this._eventEmitter=e.emitter,this._callDataReport=n,this.registerListener()}return f(t,[{key:"registerListener",value:function(){this._eventEmitter.on(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(og.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.off(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.off(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.off(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.off(og.REJECT,this.onReject.bind(this))}},{key:"onCallEnd",value:function(t){var e=t.data.totalTime,n=void 0===e?0:e;this._callDataReport.setTotalTime(n),this._callDataReport.setCallEndTime((new Date).getTime()),this._callDataReport.setResult(wg.NORMAL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onCallingCancel",value:function(){this._callDataReport.getResult()||this._callDataReport.setResult(wg.CANCEL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onNoResponse",value:function(){this._callDataReport.setResult(wg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._callDataReport.setResult(wg.BUSYLINE)}},{key:"onReject",value:function(){this._callDataReport.setResult(wg.REJECT)}}]),t}();function VC(t){return GC.apply(this,arguments)}function GC(){return GC=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e===pg.AUDIO||e===pg.VIDEO){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise(function(){var t=l(a().mark((function t(n,r){var i,o,s,c,l,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={microphone:!0,camera:e===pg.VIDEO},t.next=3,N_(i);case 3:if((o=t.sent)||e!==pg.AUDIO){t.next=16;break}return t.prev=5,t.next=8,wx.authorize({scope:Lg.RECORD});case 8:t.next=16;break;case 10:t.prev=10,t.t0=t.catch(5),s=Sg.MIC_TITLE,c=Sg.MIC_CONTENT,HC(s,c),r();case 16:if(o||e!==pg.VIDEO){t.next=30;break}return t.prev=17,t.next=20,wx.authorize({scope:Lg.RECORD});case 20:return t.next=22,wx.authorize({scope:Lg.CAMERA});case 22:t.next=30;break;case 24:t.prev=24,t.t1=t.catch(17),l=Sg.CAMERA_TITLE,u=Sg.CAMERA_CONTENT,HC(l,u),r();case 30:n();case 31:case"end":return t.stop()}}),t,null,[[5,10],[17,24]])})));return function(e,n){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)}))),GC.apply(this,arguments)}function HC(t,e){wx.showModal({title:t,content:e,confirmText:Sg.CONFIRM_TEXT,success:function(t){t.confirm&&wx.openSetting()}})}var BC=xi,FC=X,KC=kr,zC=lm,JC=Gm,WC=N,$C=RangeError,qC=String,YC=Math.floor,XC=FC(JC),QC=FC("".slice),ZC=FC(1..toFixed),tb=function(t,e,n){return 0===e?n:e%2==1?tb(t,e-1,n*t):tb(t*t,e/2,n)},eb=function(t,e,n){for(var r=-1,i=n;++r<6;)i+=e*t[r],t[r]=i%1e7,i=YC(i/1e7)},nb=function(t,e){for(var n=6,r=0;--n>=0;)r+=t[n],t[n]=YC(r/e),r=r%e*1e7},rb=function(t){for(var e=6,n="";--e>=0;)if(""!==n||0===e||0!==t[e]){var r=qC(t[e]);n=""===n?r:n+XC("0",7-r.length)+r}return n};BC({target:"Number",proto:!0,forced:WC((function(){return"0.000"!==ZC(8e-5,3)||"1"!==ZC(.9,0)||"1.25"!==ZC(1.255,2)||"1000000000000000128"!==ZC(0xde0b6b3a7640080,0)}))||!WC((function(){ZC({})}))},{toFixed:function(t){var e,n,r,i,a=zC(this),o=KC(t),s=[0,0,0,0,0,0],c="",l="0";if(o<0||o>20)throw new $C("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return qC(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(a*tb(2,69,1))-69)<0?a*tb(2,-e,1):a/tb(2,e,1),n*=4503599627370496,(e=52-e)>0){for(eb(s,0,n),r=o;r>=7;)eb(s,1e7,0),r-=7;for(eb(s,tb(10,r,1),0),r=e-1;r>=23;)nb(s,1<<23),r-=23;nb(s,1<0?c+((i=l.length)<=o?"0."+XC("0",o-i)+l:QC(l,0,i-o)+"."+QC(l,i-o)):c+l}});var ib=function(){function t(){u(this,t)}return f(t,null,[{key:"generateTaskID",value:function(){return this.currentTaskID+=1}},{key:"run",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:wg.TIMEOUT,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;n=i(i({},t===wg.INTERVAL?{delay:2e3,count:0,backgroundTask:!0}:t===wg.RAF?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0}),n),w_(e)&&(n=i(i({},n),e)),s(t)===wg.FUNCTION&&(e=t,t=wg.TIMEOUT);var r=i({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,taskName:t,callback:e},n);return this.taskMap.set(r.taskID,r),this[t](r),r.taskID}},{key:"interval",value:function(t){var e=this;return t.intervalID=setInterval((function(){t.callback(),t.loopCount+=1,e.isBreakLoop(t)}),t.delay)}},{key:"timeout",value:function(t){var e=this;return t.timeoutID=setTimeout((function n(){if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(n,t.delay)}),t.delay)}},{key:"raf",value:function(t){var e=this;t.delay=(1e3/t.fps).toFixed(2);var n,r=M_(),i=function i(){if(document.hidden&&t.backgroundTask){if(n=M_()-r,r=M_(),t.callback(),t.loopCount+=1,e.isBreakLoop(t))return;return t.timeoutID=setTimeout(i,t.delay-Math.floor(n%t.delay))}if((n=M_()-r)>=t.delay&&(r=M_()-Math.floor(n%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.rafID=requestAnimationFrame(i)};if(t.rafID=requestAnimationFrame(i),t.backgroundTask){var a=function(){if(document.hidden){var e=M_()-r;e>=t.delay?i():t.timeoutID=setTimeout(i,t.delay-e)}};document.addEventListener("visibilitychange",a),t.onVisibilitychange=a,document.hidden&&a()}return t.taskID}},{key:"hasTask",value:function(t){return this.taskMap.has(t)}},{key:"clearTask",value:function(t){if(!this.taskMap.has(t))return!0;var e=this.taskMap.get(t),n=e.intervalID,r=e.timeoutID,i=e.onVisibilitychange;return n&&clearInterval(n),r&&clearTimeout(r),i&&document.removeEventListener("visibilitychange",i),this.taskMap.delete(t),!0}},{key:"isBreakLoop",value:function(t){return!this.taskMap.has(t.taskID)||0!==t.count&&t.loopCount>=t.count&&(this.clearTask(t.taskID),!0)}}]),t}();d(ib,"taskMap",new Map),d(ib,"currentTaskID",1);var ab={serviceCommand:"".concat(wg.CALLKIT_RECORDS_SVR,".*")},ob="sendTRTCCustomData",sb=function(){function t(e){u(this,t),d(this,"_callRecordData",void 0),d(this,"_tim",void 0),d(this,"_heartbeat",void 0),d(this,"_lastHeartBeatTime",void 0),d(this,"_bodyStatus",void 0),this._tim=e.tim,this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=wg.WAITING,this.initializeCallData(e)}var e,n,r,o;return f(t,[{key:"getCallRecordData",value:function(){return this._callRecordData}},{key:"initializeCallData",value:function(t){var e=t||{},n=e.version,r=void 0===n?"":n,i=e.userID,a=void 0===i?"":i,o={name:g_.platform,version:g_.version},s={version:1,command:wg.EVENT_REPORT,sdk_version:r,seq:0,os_name:wg.MINI_PROGRAM,os_version:o.version||"",device_name:o.name||"",framework:wg.MINI_PROGRAM,call_type:"",media_type:"",client_ts:0,role:vg,user_id:a,room_id:"",call_id:""};this._callRecordData={head:s,body:{event_type:"",code:0,message:"",invitee_list:[]}}}},{key:"reset",value:function(){this.initializeCallData()}},{key:"_setCallType",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{call_type:t}))}},{key:"_setMediaType",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{media_type:UC(t)}))}},{key:"_setCallRole",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{role:t}))}},{key:"_setUserID",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{user_id:t}))}},{key:"_setRoomID",value:function(t){t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{room_id:"".concat(t)}))}},{key:"_setInviteID",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t&&(this._callRecordData.head=i(i({},this._callRecordData.head),{},{call_id:t}))}},{key:"_setEventType",value:function(t){t&&(this._callRecordData.body=i(i({},this._callRecordData.body),{},{event_type:t}))}},{key:"_setInviteeList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._callRecordData.body=i(i({},this._callRecordData.body),{},{invitee_list:t})}},{key:"_setSeq",value:function(){var t=this.getCallRecordData().head.seq;this._callRecordData.head=i(i({},this._callRecordData.head),{},{seq:t+1})}},{key:"setBodyStatus",value:function(t){if(t){var e=wg.WAITING;switch(t){case sg.CALLING:e=wg.WAITING;break;case sg.CONNECTED:e=wg.CALLING}this._bodyStatus=e}}},{key:"eventUpload",value:(o=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.userID,u=e.roomID,h=e.inviteID,f=e.inviteeList,d=void 0===f?[]:f,r){t.next=3;break}return t.abrupt("return");case 3:return this._callRecordData.head=i(i({},this._callRecordData.head),{},{command:wg.EVENT_REPORT,client_ts:Math.floor(Date.now()/1e3)}),this._setCallType(o),this._setMediaType(s),this._setCallRole(c),this._setUserID(l),this._setRoomID(u),this._setInviteID(h),this._setEventType(r),this._setInviteeList(d),this._setSeq(),p=this.getCallRecordData(),v=p.head,g=p.body,y={head:i(i({},v),{},{role:PC(v.role)}),body:g},I=i(i({},ab),{},{data:JSON.stringify(y)}),t.next=18,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ob,I);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"eventUploadNotSave",value:(r=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.roomID,u=e.inviteID,this._setSeq(),h=this.getCallRecordData(),f=h.head,d=h.body,p={head:i(i({},f),{},{role:PC(c),call_id:u,call_type:o,media_type:UC(s),room_id:"".concat(l),client_ts:Math.floor(Date.now()/1e3)}),body:i(i({},d),{},{event_type:r})},v=i(i({},ab),{},{data:JSON.stringify(p)}),t.next=7,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ob,v);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"heartBeatUpload",value:(n=l(a().mark((function t(){var e,n,r,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._setSeq(),n=this._callRecordData.head,r={head:i(i({},n),{},{role:PC(n.role),clientTs:Date.now(),command:wg.HEART_BEAT}),body:{status:this._bodyStatus}},o=i(i({},ab),{},{data:r}),t.next=6,null==this||null===(e=this._tim)||void 0===e?void 0:e.callExperimentalAPI(ob,o);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"startHeartbeat",value:function(){-1===this._heartbeat&&(F_.info("start heart beat..."),this.heartBeatUpload(),this._heartbeat=ib.run(wg.TIMEOUT,this.doHeartbeat.bind(this),{delay:2e3,count:0,backgroundTask:!0}))}},{key:"stopHeartbeat",value:function(){-1!==this._heartbeat&&(F_.info("stop heart beat"),ib.clearTask(this._heartbeat),this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=wg.WAITING)}},{key:"doHeartbeat",value:(e=l(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.heartBeatUpload(),e=Date.now(),this._lastHeartBeatTime>0&&e-this._lastHeartBeatTime>1e4&&F_.warn("heartbeat took ".concat(e-this._lastHeartBeatTime)),this._lastHeartBeatTime=e;case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),cb=function(){function t(e,n){u(this,t),d(this,"_eventEmitter",void 0),d(this,"_callRecordDataReport",void 0),d(this,"_isCallAccepted",void 0),this._eventEmitter=e,this._callRecordDataReport=n,this._isCallAccepted=!1,this.registerListener()}return f(t,[{key:"registerListener",value:function(){this._eventEmitter.on(og.ON_CALL_RECEIVED,this.onCallReceived.bind(this)),this._eventEmitter.on(og.USER_ACCEPT,this.onCallAccepted.bind(this)),this._eventEmitter.on(og.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(og.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(og.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(og.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(og.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(og.ON_CALL_RECEIVED,this.onCallReceived),this._eventEmitter.off(og.USER_ACCEPT,this.onCallAccepted),this._eventEmitter.off(og.CALL_END,this.onCallEnd),this._eventEmitter.off(og.CALLING_CANCEL,this.onCallingCancel),this._eventEmitter.off(og.NO_RESP,this.onNoResponse),this._eventEmitter.off(og.LINE_BUSY,this.onLineBusy),this._eventEmitter.off(og.REJECT,this.onReject)}},{key:"onCallReceived",value:function(){this._callRecordDataReport.startHeartbeat()}},{key:"onCallAccepted",value:function(){var t=this._callRecordDataReport.getCallRecordData().head;if((null==t?void 0:t.role)===wg.INVITER){if(this._isCallAccepted&&t.call_type===wg.GROUP)return;this._isCallAccepted=!0;var e={eventType:wg.CALL_ACCEPTED};this._callRecordDataReport.eventUpload(e),this._callRecordDataReport.setBodyStatus(sg.CONNECTED)}}},{key:"onCallEnd",value:function(){var t={eventType:wg.CALL_END};this._isCallAccepted=!1,this._callRecordDataReport.eventUpload(t),this._callRecordDataReport.stopHeartbeat()}},{key:"onCallingCancel",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head,n=e.role===wg.INVITER?wg.CANCEL_CALL:wg.CALL_CANCELED;this._isCallAccepted=!1;var r=(t.data||{}).reason;((void 0===r?"":r)===wg.NORMAL||e.role===wg.INVITER&&e.call_type===wg.GROUP)&&this._callRecordDataReport.eventUpload({eventType:n}),this._callRecordDataReport.stopHeartbeat()}},{key:"onNoResponse",value:function(){this._uploadInC2C(wg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._uploadInC2C(wg.BUSYLINE)}},{key:"onReject",value:function(){this._uploadInC2C(wg.REJECT)}},{key:"_uploadInC2C",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head;if((null==e?void 0:e.call_type)===wg.SINGLE){var n="";switch(t){case wg.TIMEOUT:n=e.role===wg.INVITER?wg.CALL_MISSED:wg.NOT_ANSWER_CALL;break;case wg.REJECT:n=e.role===wg.INVITER&&wg.CALL_REJECTED;break;case wg.BUSYLINE:n=e.role===wg.INVITER?wg.CALL_BUSY:wg.NOT_ANSWER_CALL;break;default:return}this._callRecordDataReport.eventUpload({eventType:n})}}}]),t}(),lb="TUICallEngine",ub=ly({clsConfig:{endpoint:"https://ap-nanjing.cls.tencentcs.com",topicId:"a1310e66-a3f5-4572-a1c3-7a327a27496d"}}),hb=function(){function r(i){u(this,r),d(this,"_initReady",!1),d(this,"_timExternal",!1),d(this,"_initialCallId",""),this.data={config:{sdkAppID:i.sdkAppID,userID:"",userSig:"",type:1}},this.initData(),this.EVENT=og,this.MEDIA_TYPE=pg,this.CALL_TYPE=pg,this._emitter=new ag,this.TRTC=new e(this,{TUIScene:"TUICallKit"});var a="TUICallKit";try{(wx&&wx._isTIMCallKit||wx&&wx.getStorageSync&&wx.getStorageSync("_isTIMCallKit")||getApp&&getApp()&&getApp().globalData&&getApp().globalData._isTIMCallKit)&&(a="TIMCallKit")}catch(t){console.error(t)}wx.TUIScene=a,this._callDataReport=new MC({version:Ly,sdkAppId:i.sdkAppID}),this._dataReportObserver=new jC({emitter:this._emitter},this._callDataReport),i.tim?(this.tim=i.tim,this._timExternal=!0):wx.$TIM?(this.tim=wx.$TIM,this._timExternal=!0):this.tim=n.create({SDKAppID:i.sdkAppID}),this._callRecordReport=new sb({version:Ly,tim:this.tim}),this._recordReportObserver=new cb(this._emitter,this._callRecordReport),wx.$TSignaling||(wx.$TSignaling=new t({SDKAppID:i.sdkAppID,tim:this.tim,isRejectNotifyAll:!0})),wx.getSystemInfoSync().platform===wg.DEVTOOLS&&F_.warn("".concat(xg)),wx.setStorageSync("sdkAppId",i.sdkAppID),this.TSignalingClient=new Sy({TSignaling:wx.$TSignaling}),this.TRTCCallingDelegate=new xy({emitter:this._emitter}),this._eventStatController=new Q_;var o=new K_(z_);K_.bindController(this._eventStatController),o.setText("version=".concat(Ly)).setEnd(),this._initLogger(i),F_.info("".concat(lb," SDK Version:").concat(Ly,", SDKAppID:").concat(i.sdkAppID))}var o,s,c,h,p,v,g,y,I,m,E,_,T,b,D,R,w,S,x,L,O,k,A,N,U,P,M,j,V,G,H,B,F,K,z,J,W;return f(r,[{key:"destroyInstance",value:function(){if(r.instance){this._callDataReport&&this._callDataReport.reset&&this._callDataReport.reset(),this._dataReportObserver&&this._dataReportObserver.reset&&this._dataReportObserver.removeLister(),this._callRecordReport&&this._callRecordReport.reset(),this._recordReportObserver&&this._recordReportObserver.removeLister(),r.instance.destroyed(),r.instance=null;try{wx.removeStorageSync("sdkAppId"),wx.removeStorageSync("userId")}catch(t){console.error(t)}}}},{key:"_initLogger",value:function(t){var e=this;wx.getSystemInfo({success:function(t){var e=t.brand,n=t.model,r=t.language,i=t.platform,a=t.version;ub.updateGetReportData((function(){return{useragent:{brand:e,model:n,language:r,platform:i,version:a}}}))}}),this._logger=ub,this._logger.updateGetReportData((function(){return{app:"TUICallEngine-mini",version:Ly,platform:wg.MINI_PROGRAM,sdkappid:t.sdkAppID,time:+new Date,userid:e.getUserID(),callinfo:{roomid:e.getRoomID(),inviteid:e.getInitialCallId(),callrole:e.isInviter()?wg.INVITER:wg.INVITEE,groupid:e.getGroupID(),calltype:e.getCallType(),handledInviteeList:e.getHandledInviteeList(),unHandledInviteeList:e.getUnHandledInviteeList()},callkitversion:t.callkitVersion||wg.UNKNOWN,framework:t.frameWork||wg.UNKNOWN,isfromchat:t.chat?"true":"false"}}))}},{key:"setLogLevel",value:function(t){"number"!=typeof t||isNaN(t)?F_.error("".concat(lb,",setLogLevel parameter must be a number(0~4)")):(F_.setLevel(t),this.TSignalingClient.setLogLevel(t),this.TRTC.setLogLevel(t))}},{key:"initData",value:function(){var t={callStatus:sg.IDLE,soundMode:this.data.config.type===pg.AUDIO?bg.EAR:bg.SPEAKER,active:!1,invitation:{inviteID:"",inviter:"",type:"",roomID:""},startTalkTime:0,localUser:null,remoteUsers:[],remoteID:"",timer:null,chatTimeNum:0,chatTime:"00:00:00",screen:"pusher",pusher:{},playerList:[],isInviter:!0,unHandledInviteeList:[],handledInviteeList:[],_inviterInviteID:{},_audioVideoSwitchIdList:[],_acceptedUserObject:{},isGroupCall:!1,groupID:"",switchCallModeStatus:!0,enterRoomStatus:!1,devicePermission:!1};this.data=i(i({},this.data),t)}},{key:"handleNewInvitationReceived",value:(W=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.NEW_INVITATION_RECEIVED",{text:{data:i(i({},e),{},{currentCallStatus:o})},type:"event"}),o=this.getCallStatus(),F_.log("".concat(lb,".onNewInvitationReceived - params:"),e,"currentCallStatus:".concat(o)),s=e.data,c=s.inviter,l=s.inviteeList,u=s.data,h=s.inviteID,f=s.groupID,P_((d=JSON.parse(u)).businessID)){t.next=7;break}return t.abrupt("return");case 7:if(p=(null==d||null===(n=d.data)||void 0===n?void 0:n.initialCallId)||"",this.getUserID()!==c){t.next=10;break}return t.abrupt("return");case 10:if(g={inviter:c,inviteeList:l,inviteID:h,isGroupCall:v=!!f,inviteData:d,groupID:f,initialCallId:p,currentCallStatus:o,inCallUserIDs:(null==d?void 0:d.inCallUserIDs)||[]},"hangup"!==(null==d||null===(r=d.data)||void 0===r?void 0:r.cmd)){t.next=19;break}if(F_.log("".concat(lb,".hangup - params:"),c,d,this.getHandledInviteeList(),this.getUnHandledInviteeList(),o,v),o!==sg.IDLE){t.next=16;break}return t.abrupt("return");case 16:return t.next=18,this.handleHangupSignal(g);case 18:return t.abrupt("return");case 19:if(v||!this.judgeSwitchCallMode(d)){t.next=25;break}if(o===sg.IDLE||d.room_id!==this.data.invitation.roomID){t.next=24;break}return t.next=23,this.handleSwitchCallModeTSignaling(h,d);case 23:this.addAudioVideoSwitchIdList(h);case 24:return t.abrupt("return");case 25:if(o===sg.IDLE){t.next=30;break}return t.next=28,this.TSignalingClient.reject({inviteID:h,type:u.call_type,lineBusy:"line_busy"});case 28:return this.getCallRecordReport().eventUploadNotSave({inviteID:p||h,callRole:wg.INVITEE,eventType:wg.IGNORE_CALL,roomID:d.room_id,mediaType:d.call_type,callType:f?wg.GROUP:wg.SINGLE}),t.abrupt("return");case 30:this.handleInvitedSignal(g);case 31:case"end":return t.stop()}}),t,this)}))),function(t){return W.apply(this,arguments)})},{key:"handleHangupSignal",value:(J=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.inviter,r=e.currentCallStatus,o=e.inviteData,s=e.inviteeList,c=this.isGroupCall(),l=this.isInviter(),r!==sg.CALLING){t.next=11;break}if(u=this.getUnHandledInviteeList(),h=this.getHandledInviteeList(),-1!==u.indexOf(n)&&this.deleteUnHandledInviteeList([n]),-1!==h.indexOf(n)){t.next=9;break}return t.abrupt("return");case 9:t.next=15;break;case 11:if(this.deleteHandledInviteeList([n]),!(-1===(f=this.getHandledInviteeList()).indexOf(n)&&f.length>1)){t.next=15;break}return t.abrupt("return");case 15:if(d=this.generateCallEndData({totalTime:o.call_end||0}),c){t.next=22;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=20,this._resetTUICallEngine();case 20:case 31:t.next=46;break;case 22:if(this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),!l){t.next=33;break}if(1!==p.length||0!==v.length){t.next=31;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=31,this._resetTUICallEngine();case 33:if(r!==sg.CALLING){t.next=41;break}if(-1!==s.indexOf(this.getUserID())&&this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),0!==p.length||1!==v.length){t.next=41;break}return g=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()},g),{},{reason:wg.NORMAL})),t.next=41,this._resetTUICallEngine();case 41:if(r!==sg.CONNECTED){t.next=46;break}if(1!==p.length||0!==v.length){t.next=46;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=46,this._resetTUICallEngine();case 46:case"end":return t.stop()}}),t,this)}))),function(t){return J.apply(this,arguments)})},{key:"handleSwitchCallModeTSignaling",value:(z=l(a().mark((function t(e,n){var r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={inviteID:e,type:n.call_type},i={cmd:"switchToVideo"},n.call_type===pg.VIDEO&&(r.switch_to_audio_call="switch_to_audio_call",i.cmd="switchToAudio"),t.next=5,this.TSignalingClient.accept(r,i);case 5:o=t.sent,this.setSwitchCallModeStatus(!1),this.handleCallMode(n.call_type,o);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return z.apply(this,arguments)})},{key:"judgeSwitchCallMode",value:function(t){return t.switch_to_audio_call&&"switch_to_audio_call"===t.switch_to_audio_call||t.data&&"switchToAudio"===t.data.cmd||t.data&&"switchToVideo"===t.data.cmd}},{key:"handleCallMode",value:function(t,e){F_.log("".concat(lb,".handleCallMode - type"),t);var n=t!==pg.VIDEO;this.setPusherAttributesHandler({enableCamera:n}),n?(this.data.config.type=pg.VIDEO,this.data.invitation.type=pg.VIDEO):(this.data.config.type=pg.AUDIO,this.data.invitation.type=pg.AUDIO),this.TRTCCallingDelegate.onCallMode({type:this.data.config.type,message:e.data.message}),this.setSwitchCallModeStatus(!0)}},{key:"handleInvitedSignal",value:(K=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviter,r=e.inviteeList,o=e.isGroupCall,s=e.groupID,c=e.inviteID,l=e.inviteData,u=e.inCallUserIDs,h=void 0===u?[]:u,f=e.initialCallId,d=void 0===f?"":f,this.data.remoteID=n,this.data.config.type=l.call_type,this.data.invitation.inviteID=c,this.data.invitation.inviter=n,this.data.invitation.type=l.call_type,this.data.invitation.roomID=l.room_id,this.data.isInviter=!1,this.data.isGroupCall=o,this.data.roomID=l.room_id,this.addHandledInviteeList([n]),this.addUnHandledInviteeList([].concat(C(r),C(h))),this.addAcceptedUserList(c,[n]),this.addInviterInviteId(c,[n].concat(C(r))),this.setInitialCallId(d),p=h.filter((function(t){return-1===r.indexOf(t)})),o&&(this.data.groupID=s),this.changeCallStatus(sg.CALLING),F_.log("".concat(lb," NEW_INVITATION_RECEIVED invitation: "),this.data.callStatus,this.data.invitation),v={sponsor:n,inviteeList:r,userIDList:[].concat(C(r),C(p)),isFromGroup:o,inviteID:c,groupID:s,inviteData:{version:l.version,callType:l.call_type,roomID:l.room_id},userData:l.userData,calleeIdList:r,callMediaType:l.call_type},this.setPusherAttributesHandler({enableCamera:this.data.config.type===pg.VIDEO}),g=i(i({},g=this.getCallDataReport().getCallData()),{},{userId:this.getUserID(),roomID:l.room_id,inviteID:c,callRole:yg,callType:l.call_type,inviteeList:r}),y={eventType:wg.RECEIVE_CALL,callType:s?wg.GROUP:wg.SINGLE,mediaType:l.call_type,callRole:wg.INVITEE,userID:this.getUserID(),roomID:l.room_id,inviteID:d||c},this.getCallRecordReport().eventUpload(y),this.getCallDataReport().setCallData(g),I=this.generateEventData()||{},this.TRTCCallingDelegate.onInvited(i(i({},I),v)),t.next=30,N_({camera:!0});case 30:this.data.devicePermission=t.sent,this.data.devicePermission&&this.data.config.type===pg.VIDEO&&wx.createLivePusherContext().startPreview();case 32:case"end":return t.stop()}}),t,this)}))),function(t){return K.apply(this,arguments)})},{key:"addInviterInviteId",value:function(t,e){0!==e.length&&(0===(this.data._inviterInviteID[t]||[]).length?this.data._inviterInviteID[t]=e:this.data._inviterInviteID[t]=[].concat(C(this.data._inviterInviteID[t]),C(e)))}},{key:"handleInviteeAccepted",value:(F=l(a().mark((function t(e){var n,r,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_ACCEPTED",{text:{data:i(i({},e),{},{currentCallStatus:this.data.callStatus}),type:"event"}}),F_.log("".concat(lb," onInviteeAccepted - params:"),e),P_(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=5;break}return t.abrupt("return");case 5:if(r=e.data.invitee,o=e.data.inviteID,-1!==this.getTotalInviterInviteIdList().indexOf(o)){t.next=9;break}return t.abrupt("return");case 9:if(this.data.callStatus!==sg.IDLE){t.next=11;break}return t.abrupt("return");case 11:if(this.isGroupCall()||!this.judgeSwitchCallMode(n)||this.data.switchCallModeStatus){t.next=14;break}return this.handleCallMode(this.data.invitation.type),t.abrupt("return");case 14:if(s=this.getCallStatus(),r!==this.getUserID()||s!==sg.CALLING){t.next=21;break}return c=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},c)),t.next=20,this._resetTUICallEngine();case 20:return t.abrupt("return");case 21:return this.isInviter()&&this.data.callStatus===sg.CALLING&&this.changeCallStatus(sg.CONNECTED),this.getCallDataReport().setCallAcceptTime((new Date).getTime()),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.addAcceptedUserList(o,[r]),t.next=28,this.getUserProfile(this.data.unHandledInviteeList.map((function(t){return{userID:t}})));case 28:l=t.sent,this.TRTCCallingDelegate.onUserAccept({userID:r,userList:l});case 30:case"end":return t.stop()}}),t,this)}))),function(t){return F.apply(this,arguments)})},{key:"handleInviteeRejected",value:(B=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_REJECTED",{text:{data:e},type:"event"}),F_.log("".concat(lb," onInviteeRejected - params"),e),r=e.data.inviteID,P_(null==(o=JSON.parse(e.data.data))?void 0:o.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.isGroupCall()||this.getSwitchCallModeStatus()||-1===this.getAudioVideoSwitchIdList().indexOf(r)){t.next=10;break}return F_.log("".concat(lb,".onInviteeRejected - Audio and video switching is not available")),this.setSwitchCallModeStatus(!0),t.abrupt("return");case 10:if(s=e.data.invitee,c=e.data.inviter,l=this.getUserID(),u=this.getCallStatus(),-1!==this.getInviterInviteIdList().indexOf(r)){t.next=19;break}if(!this.isInviter()||-1===this.getInviterInviteIdUserList().indexOf(s)){t.next=17;break}return t.abrupt("return");case 17:return this.deleteUnHandledInviteeList([s]),t.abrupt("return");case 19:if(u!==sg.IDLE){t.next=21;break}return t.abrupt("return");case 21:if(h=this.generateEventData(),l!==s||u!==sg.CALLING){t.next=27;break}return this.TRTCCallingDelegate.onCancel(i({inviteID:this.data.invitation.inviteID,invitee:s,userID:s},h)),t.next=26,this._resetTUICallEngine();case 26:return t.abrupt("return");case 27:if(f=this.isGroupCall(),d=this.isInviter(),this.deleteUnHandledInviteeList([s]),p=this.getUnHandledInviteeList(),v=this.getHandledInviteeList(),g=i({inviteID:this.data.invitation.inviteID,invitee:l,userID:l},h),y={inviteID:this.data.invitation.inviteID,invitee:s,userID:s},I=this.data.invitation,u!==sg.CONNECTED){t.next=38;break}if(-1===v.indexOf(s)){t.next=38;break}return t.abrupt("return");case 38:if(!("line_busy"===o.line_busy||""===o.line_busy||null!=o&&null!==(n=o.data)&&void 0!==n&&n.message&&"lineBusy"===o.data.message)){t.next=52;break}if(c===I.inviter&&this.TRTCCallingDelegate.onLineBusy({inviteID:this.data.invitation.inviteID,invitee:s,userID:s}),f){t.next=46;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.BUSYLINE})),t.next=44,this._resetTUICallEngine();case 44:t.next=50;break;case 46:if(0!==p.length||1!==v.length){t.next=50;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.BUSYLINE})),t.next=50,this._resetTUICallEngine();case 50:case 57:t.next=78;break;case 52:if(f){t.next=59;break}return this.TRTCCallingDelegate.onReject(y),this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=57,this._resetTUICallEngine();case 59:if(this.TRTCCallingDelegate.onReject(y),u!==sg.CALLING){t.next=72;break}if(!d){t.next=68;break}if(0!==p.length||1!==v.length){t.next=66;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=66,this._resetTUICallEngine();case 66:t.next=72;break;case 68:if(1!==p.length||0!==v.length){t.next=72;break}return this.TRTCCallingDelegate.onCancel(i(i({},g),{},{reason:wg.REJECT})),t.next=72,this._resetTUICallEngine();case 72:if(u!==sg.CONNECTED){t.next=78;break}if(0!==p.length||1!==v.length){t.next=78;break}return m=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(m),t.next=78,this._resetTUICallEngine();case 78:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"handleInvitationCancelled",value:(H=l(a().mark((function t(e){var n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_CANCELLED",{text:{data:e,type:"event"}}),this.data.invitation.inviteID===e.data.inviteID){t.next=3;break}return t.abrupt("return");case 3:if(P_(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.data.callStatus!==sg.IDLE){t.next=8;break}return t.abrupt("return");case 8:if(-1!==this.getInviterInviteIdList().indexOf(e.data.inviteID)){t.next=10;break}return t.abrupt("return");case 10:return F_.log(lb,"onInvitationCancelled","inviteID:".concat(e.data.inviteID," inviter:").concat(e.data.inviter," data:").concat(e.data.data)),r=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:e.data.inviter,userID:e.data.inviter},r),{},{reason:wg.NORMAL})),t.next=15,this._resetTUICallEngine();case 15:case"end":return t.stop()}}),t,this)}))),function(t){return H.apply(this,arguments)})},{key:"handleInvitationTimeout",value:(G=l(a().mark((function t(e){var n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m,E,_;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_TIMEOUT",{text:{data:e,type:"event"}}),r=e.data,o=r.inviter,s=r.inviteeList,c=void 0===s?[]:s,l=r.inviteID,u=this.getUserID(),h=this.isGroupCall(),f=this.isInviter(),d=this.getCallStatus(),this.deleteUnHandledInviteeList(c),F_.warn("".concat(lb,".onInvitationTimeout - params:"),e,"currentUserID:".concat(u," isInviter:").concat(f," isGroupCall:").concat(h," \n currentCallStatus:").concat(d," inviteID:").concat(null==this||null===(n=this._newInvitationData)||void 0===n?void 0:n.inviteID)),-1!==this.getInviterInviteIdList().indexOf(l)){t.next=10;break}return t.abrupt("return");case 10:if(d!==sg.IDLE){t.next=12;break}return t.abrupt("return");case 12:if(p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),g={groupID:this.data.groupID,inviteID:this.data.invitation.inviteID,sponsor:o,timeoutUserList:c,userIDList:c},y=this.generateEventData(),I=i(i({inviteID:this.data.invitation.inviteID,invitee:u,userID:u},y),{},{reason:wg.TIMEOUT}),h){t.next=23;break}return f?(this.TRTCCallingDelegate.onNoResp(g),this.TRTCCallingDelegate.onCancel(I)):(this.TRTCCallingDelegate.onCancel(I),m=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(i(i({},m),{},{eventType:wg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}))),t.next=21,this._resetTUICallEngine();case 21:t.next=48;break;case 23:if(d!==sg.CALLING){t.next=41;break}if(!f){t.next=32;break}if(this.TRTCCallingDelegate.onNoResp(g),0!==v.length){t.next=30;break}return this.TRTCCallingDelegate.onCancel(I),t.next=30,this._resetTUICallEngine();case 30:t.next=41;break;case 32:if(-1!==c.indexOf(u)){t.next=36;break}this.TRTCCallingDelegate.onNoResp(g),t.next=39;break;case 36:return this.TRTCCallingDelegate.onCancel(I),t.next=39,this._resetTUICallEngine();case 39:E=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(i(i({},E),{},{eventType:wg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}));case 41:if(d!==sg.CONNECTED){t.next=48;break}if(this.TRTCCallingDelegate.onNoResp(g),1!==p.length||0!==v.length){t.next=48;break}return _=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(_),t.next=48,this._resetTUICallEngine();case 48:case"end":return t.stop()}}),t,this)}))),function(t){return G.apply(this,arguments)})},{key:"handleSDKReady",value:function(){var t=this;this._logger.info("ChatSdkEvent.SDK_READY",{text:{type:"event"}}),F_.log(lb,"TSignaling SDK ready"),this.TSignalingResolve(),this.TRTCCallingDelegate.onSdkReady({message:"SDK ready"}),this.tim.getMyProfile().then((function(e){t.data.localUser=e.data})).catch((function(t){F_.warn("getMyProfile error:",t)}))}},{key:"handleKickedOut",value:(V=l(a().mark((function t(){var e,n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("ChatSdkEvent.KICKED_OUT",{text:{type:"event"}}),this.getCallStatus()!==sg.CONNECTED){t.next=6;break}return e=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(e),t.next=6,this._resetTUICallEngine();case 6:if(this.getCallStatus()!==sg.CALLING){t.next=14;break}return n=this.getUserID(),r=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:n,userID:n},r),{},{reason:wg.BANNED})),t.next=12,this.cancel();case 12:return t.next=14,this._resetTUICallEngine();case 14:this._initReady=!1,this.TRTCCallingDelegate.onKickedOut({message:"kicked out"});case 16:case"end":return t.stop()}}),t,this)}))),function(){return V.apply(this,arguments)})},{key:"_addTSignalingEvent",value:function(){wx.$TSignaling.on(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived,this),wx.$TSignaling.on(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted,this),wx.$TSignaling.on(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected,this),wx.$TSignaling.on(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled,this),wx.$TSignaling.on(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout,this),wx.$TSignaling.on(t.EVENT.SDK_READY,this.handleSDKReady,this),wx.$TSignaling.on(t.EVENT.KICKED_OUT,this.handleKickedOut,this),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.on(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"_removeTSignalingEvent",value:function(){wx.$TSignaling.off(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived),wx.$TSignaling.off(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted),wx.$TSignaling.off(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected),wx.$TSignaling.off(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled),wx.$TSignaling.off(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout),wx.$TSignaling.off(t.EVENT.SDK_READY,this.handleSDKReady),wx.$TSignaling.off(t.EVENT.KICKED_OUT,this.handleKickedOut),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.off(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"onLocalJoin",value:function(){var t=this.generateEventData();this.TRTCCallingDelegate.onCallBegin(t)}},{key:"onRemoteUserJoin",value:(j=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.data,r=n.userID,i=n.userList,o=n.playerList,F_.log(lb,"REMOTE_USER_JOIN",e,r),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.changeCallStatus(sg.CONNECTED),!(o.length>0)){t.next=11;break}return t.next=8,this.getUserProfile(o);case 8:t.t0=t.sent,t.next=12;break;case 11:t.t0=this.data.playerList;case 12:this.data.playerList=t.t0,this.data.startTalkTime||(this.data.startTalkTime=Date.now()),this.TRTCCallingDelegate.onUserEnter({userID:e.data.userID,playerList:this.data.playerList}),F_.log(lb,"REMOTE_USER_JOIN","playerList:",this.data.playerList,"userList:",i);case 16:case"end":return t.stop()}}),t,this)}))),function(t){return j.apply(this,arguments)})},{key:"onRemoteUserLeave",value:(M=l(a().mark((function t(e){var n,r,i,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.getCallStatus()!==sg.IDLE){t.next=2;break}return t.abrupt("return");case 2:if(n=e.data.userID,F_.log(lb,"REMOTE_USER_LEAVE",e,e.data.userID),this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),this.getCallDataReport().setExitRoomTime((new Date).getTime()),this.data.isGroupCall){t.next=17;break}return t.next=11,this.TSignalingClient.hangup({userIDList:[n],callType:this.data.config.type,callEnd:this.generateCallTotalTime()});case 11:return r=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(r),F_.log(lb,"REMOTE_USER_LEAVE","playerList:"),t.next=16,this._resetTUICallEngine();case 16:return t.abrupt("return");case 17:if(i=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=this.getUserID(),1!==i.length||i[0]!==s||0!==o.length){t.next=25;break}return c=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(c),t.next=25,this._resetTUICallEngine();case 25:case"end":return t.stop()}}),t,this)}))),function(t){return M.apply(this,arguments)})},{key:"onLocalNetStateUpdate",value:function(t){var e=t.data.pusher.netStatus;F_.log(lb,"onLocalNetStateUpdate",e),this.data.pusher=t.data.pusher,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onRemoteNetStateUpdate",value:(P=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.data.playerList,F_.log(lb,"onRemoteNetStateUpdate",n),this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return P.apply(this,arguments)})},{key:"onError",value:function(t){F_.warn(lb,"onError",t),this.TRTCCallingDelegate.onError(t)}},{key:"onRemoteVideoAdd",value:function(t){F_.log("* room REMOTE_VIDEO_ADD",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!1})}},{key:"onRemoteVideoRemove",value:function(t){F_.log("* room REMOTE_VIDEO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"onRemoteAudioAdd",value:(U=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return F_.log("* room REMOTE_AUDIO_ADD",e),t.next=3,this.getUserProfile([e.data.player]);case 3:n=t.sent,this.setPlayerAttributesHandler(n[0],{muteAudio:!1});case 5:case"end":return t.stop()}}),t,this)}))),function(t){return U.apply(this,arguments)})},{key:"onRemoteAudioRemove",value:function(t){F_.log("* room REMOTE_AUDIO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"onRemoteAudioVolumeUpdate",value:(N=l(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:F_.log("* room REMOTE_AUDIO_VOLUME_UPDATE",e),n=e.data.playerList,this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return N.apply(this,arguments)})},{key:"onLocalAudioVolumeUpdate",value:function(t){var e=t.data.pusher;this.data.pusher=e,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onMessageSentByMe",value:function(t){this.TRTCCallingDelegate.onMessageSentByMe(t)}},{key:"_addTRTCEvent",value:function(){this.TRTC.on(this.TRTC.EVENT.LOCAL_JOIN,this.onLocalJoin,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.ERROR,this.onError,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate,this)}},{key:"_removeTRTCEvent",value:function(){this.TRTC.off(this.TRTC.EVENT.LOCAL_JOIN,this.onLocalJoin),this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin),this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave),this.TRTC.off(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.ERROR,this.onError),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate),this.TRTC.off(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate)}},{key:"initTRTC",value:function(){var t={beautyLevel:5};this._logger.info("".concat(lb,".initTRTC.start"),{type:"api",data:{pusherConfig:t}});var e=this.TRTC.createPusher(t);this.data.pusher=e.pusherAttributes}},{key:"enterRoom",value:function(t){var e=+new Date;this._logger.info("".concat(lb,".enterRoom.start"),{text:{data:t},type:"api"}),this._addTRTCEvent();var n=t.roomID,r=Object.assign(this.data.config,{roomID:n,enableMic:!0,autopush:!0,enableAgc:!0,enableAns:!0,enableCamera:t.callType===pg.VIDEO});this.data.enterRoomStatus=!0,this.data.pusher=this.TRTC.enterRoom(r);var a=+new Date;this._logger.info("".concat(lb,".enterRoom.success"),{text:{data:i(i({},t),{},{cost:a-e})},type:"api"}),wx.createLivePusherContext().startPreview(),this.getCurrentPusherInstance().start()}},{key:"exitRoom",value:(A=l(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".exitRoom.start"),{type:"api"}),t.next=3,this.getCurrentPusherInstance().stop();case 3:return t.next=5,this.TRTC.exitRoom();case 5:e=t.sent,this.data.pusher=e.pusher,this.data.playerList=e.playerList,this.data.unHandledInviteeList=[],this.data.enterRoomStatus=!1,this.initTRTC(),this._removeTRTCEvent();case 12:case"end":return t.stop()}}),t,this)}))),function(){return A.apply(this,arguments)})},{key:"setPusherAttributesHandler",value:function(t){this._logger.info("".concat(lb,".setPusherAttributesHandler.start"),{text:{data:t},type:"api"}),this.data.pusher=this.TRTC.setPusherAttributes(t),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"setPlayerAttributesHandler",value:(k=l(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(lb,".setPlayerAttributesHandler.start"),{text:{data:n},type:"api"}),r=this.TRTC.setPlayerAttributes(e.streamID,n),F_.warn("setPlayerAttributesHandler",r),this.data.playerList=r.length>0?this._updateUserProfile(this.data.playerList,r):this.data.playerList,this.data.playerList.length>0&&0===r.length&&(this.data.playerList[0].hasAudio=!1,this.data.playerList[0].hasVideo=!1),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return k.apply(this,arguments)})},{key:"_mutePlayerAudio",value:function(t){this._logger.info("".concat(lb,"._mutePlayerAudio.start"),{text:{data:t},type:"api"});var e=t.currentTarget.dataset.value;e.hasAudio&&e.muteAudio?this.setPlayerAttributesHandler(e,{muteAudio:!1}):!e.hasAudio||e.muteAudio||this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"_mutePlayerVideo",value:function(t){this._logger.info("".concat(lb,"._mutePlayerVideo.start"),{text:{data:t},type:"api"});var e=t.currentTarget.dataset.value;e.hasVideo&&e.muteVideo?this.setPlayerAttributesHandler(e,{muteVideo:!1}):!e.hasVideo||e.muteVideo||this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"_pusherAudioHandler",value:function(){this._logger.info("".concat(lb,"._pusherAudioHandler.start"),{type:"api",text:{data:{enableMic:this.data.pusher.enableMic}}}),this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.getCurrentPusherInstance().setMICVolume({volume:0})):(this.setPusherAttributesHandler({enableMic:!0}),this.getCurrentPusherInstance().setMICVolume({volume:100}))}},{key:"_pusherVideoHandler",value:function(){this._logger.info("".concat(lb,"._pusherVideoHandler.start"),{type:"api",text:{data:{enableCamera:this.data.pusher.enableCamera}}}),this.data.pusher.enableCamera?this.setPusherAttributesHandler({enableCamera:!1}):this.setPusherAttributesHandler({enableCamera:!0})}},{key:"init",value:(O=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return CC.getInstance().getAlert().checkSync(new vC({api:"init",attributes:e})),t.next=3,this.login(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return O.apply(this,arguments)})},{key:"login",value:(L=l(a().mark((function t(e){var n=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.updateGetReportData((function(){return{userid:e.userID}})),this._logger.info("".concat(lb,".login.start"),{type:"api",text:i(i({},e),{},{userSig:""})}),this.data.config.userID=e.userID,this.data.config.userSig=e.userSig,t.abrupt("return",new Promise((function(t,r){wx.$TSignaling.login({userID:e.userID,userSig:e.userSig}).then((function(r){return F_.log(lb,"login","IM login success",r),wx.setStorageSync("userId","".concat(e.userID)),n._callDataReport.setUserID(e.userID),n._initReady=!0,n._resetTUICallEngine(),n._addTSignalingEvent(),n.initTRTC(),n.TSignalingResolve=t,r.data.repeatLogin&&t(null),null})).catch((function(t){n._logger.error("".concat(lb,".login.fail"),{type:"api",text:{error:t}}),F_.error("".concat(lb," init failed', error: ").concat(t)),r(t)}))})));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return L.apply(this,arguments)})},{key:"logout",value:(x=l(a().mark((function t(){var e,n,r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".logout.start"),{type:"api",text:{data:{userID:this.data.config.userID,initReady:this._initReady}}}),this._initReady){t.next=3;break}return t.abrupt("return");case 3:return e=this.data.config,n=e.userID,r=e.userSig,t.prev=4,t.next=7,wx.$TSignaling.logout({userID:n,userSig:r});case 7:F_.log(lb,"logout","IM logout success"),t.next=14;break;case 10:t.prev=10,t.t0=t.catch(4),this._logger.error("".concat(lb,".logout.fail"),{type:"api",text:{error:t.t0}}),F_.error(lb,"logout","IM logout failure");case 14:case"end":return t.stop()}}),t,this,[[4,10]])}))),function(){return x.apply(this,arguments)})},{key:"on",value:function(t,e,n){CC.getInstance().getAlert().checkSync(new vC({api:"on",attributes:{eventCode:t,handler:e,context:n}})),this._emitter.on(t,e,n)}},{key:"off",value:function(t,e){CC.getInstance().getAlert().checkSync(new vC({api:"off",attributes:{eventCode:t,handler:e}})),this._emitter.off(t,e)}},{key:"call",value:(S=l(a().mark((function t(e){var n,r,o,s,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".call.start"),{type:"api",text:{data:e}}),n=e.userID,r=e.type,t.next=4,CC.getInstance().getAlert().check(new vC({api:"call",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.BASE,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(r);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".call.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 13:if(this.getUserID()!==n){t.next=17;break}throw this._logger.error("".concat(lb,".call.fail"),{text:{error:"Called id can not be yourself. userId:".concat(this.getUserID(),", inviteeId:").concat(n)},type:"api"}),F_.log("".concat(lb,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n)),new Error("".concat(lb,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n));case 17:return this._callDataReport.setAbilityBit(!0),this._callDataReport.setCallScene(wg.SINGLE_CALL),o={callType:wg.SINGLE,mediaType:r,inviteeList:[n]},t.prev=20,s=e.roomID||Math.floor(2147483646*Math.random()+1),this.data.roomID=s,this.data.config.type=r,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=r,this.data.invitation.roomID=s,this.data.isInviter=!0,this.data.remoteID=n,this.changeCallStatus(sg.CALLING),t.next=32,this.TSignalingClient.invite(i(i({},e),{},{roomID:s}));case 32:if(c=t.sent,this.enterRoom({roomID:s,callType:r}),this._callDataReport.setEnterRoomTime((new Date).getTime()),l=i(i({},l=this._callDataReport.getCallData()),{},{userId:n,roomID:s,callRole:gg,callType:r,inviteeList:[n]}),this._callDataReport.setCallData(l),this._callDataReport.setSendSignalingTime((new Date).getTime()),F_.log("".concat(lb," call(userID: ").concat(n,", type: ").concat(r,") success, ").concat(c)),0!==c.code){t.next=51;break}this.data.invitation.inviteID=c.inviteID,this.addInviterInviteId(c.inviteID,[this.data.config.userID,n]),this.addUnHandledInviteeList([n]),this.addHandledInviteeList([this.getUserID()]),this._callDataReport.setInviteID(c.inviteID),this.setInitialCallId(c.inviteID),this._callRecordUpload(i({eventType:wg.START_CALL},o)),this._callRecordReport.startHeartbeat(),t.next=57;break;case 51:return this._callDataReport.setCodeAndMessage(c.code,c.message),this._callDataReport.uploadToKibana(),this._callRecordUpload(i({eventType:wg.CALL_FAILED},o)),this._logger.error("".concat(lb,".call.fail"),{text:{error:c},type:"api"}),t.next=57,this._resetTUICallEngine();case 57:return t.abrupt("return",{data:c.data,pusher:this.data.pusher});case 60:return t.prev=60,t.t1=t.catch(20),t.t1.code===Iy.ERROR_BLACKLIST?(this.TRTCCallingDelegate.onError(Iy.ERROR_BLACKLIST,t.t1.message),this._callDataReport.setCodeAndMessage(Iy.ERROR_BLACKLIST,t.t1.message)):this._callDataReport.setCodeAndMessage(Iy.UNKNOWN,JSON.stringify(t.t1)),this._callDataReport.uploadToKibana(),this._callRecordUpload(i({eventType:wg.CALL_FAILED},o)),this._logger.error("".concat(lb,".call.fail"),{text:{error:t.t1},type:"api"}),F_.error("".concat(lb," call(userID:").concat(n,",type:").concat(r,") failed', error: ").concat(t.t1)),t.next=69,this._resetTUICallEngine();case 69:throw new Error(t.t1);case 70:case"end":return t.stop()}}),t,this,[[4,9],[20,60]])}))),function(t){return S.apply(this,arguments)})},{key:"groupCall",value:(w=l(a().mark((function t(e){var n,r,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".groupCall.start"),{type:"api",text:{data:e}}),n=e.type,r=e.userIDList,t.next=4,CC.getInstance().getAlert().check(new vC({api:"groupCall",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(n);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:t.t0}}),t.abrupt("return");case 13:if(-1===r.indexOf(this.getUserID())){t.next=16;break}throw this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:"Called list can not contain yourself"}}),new Error("".concat(lb,".groupCall failed. Called list can't contain yourself. userID:").concat(this.getUserID(),", inviteeIDList:").concat(r));case 16:return this._callDataReport.setCallScene(wg.GROUP_CALL),o=e.roomID||Math.floor(2147483646*Math.random()+1),this.enterRoom({roomID:o,callType:n}),s={callType:wg.GROUP,mediaType:n,inviteeList:e.userIDList},this.data.config.type=e.type,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=o,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.changeCallStatus(sg.CALLING),t.prev=28,t.next=31,this.TSignalingClient.inviteGroup(i(i({},e),{},{roomID:o}));case 31:return c=t.sent,this.data.config.type=e.type,this.data.invitation.inviteID=c.inviteID,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=o,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.data.roomID=o,this.addUnHandledInviteeList(e.userIDList),this.addHandledInviteeList([this.getUserID()]),this.addInviterInviteId(c.inviteID,[this.data.config.userID].concat(C(e.userIDList))),this.setInitialCallId(c.inviteID),this._callRecordUpload(i({eventType:wg.START_CALL},s)),this._callRecordReport.startHeartbeat(),F_.log(lb,"groupCall OK",c),t.abrupt("return",{data:c.data,pusher:this.data.pusher});case 51:return t.prev=51,t.t1=t.catch(28),this._logger.error("".concat(lb,".groupCall.fail"),{type:"api",text:{error:t.t1}}),F_.error(lb,"groupCall failed",t.t1),this._callRecordUpload(i({eventType:wg.CALL_FAILED},s)),t.next=58,this._resetTUICallEngine();case 58:throw new Error(t.t1);case 59:case"end":return t.stop()}}),t,this,[[4,9],[28,51]])}))),function(t){return w.apply(this,arguments)})},{key:"joinInGroupCall",value:(R=l(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".joinInGroupCall.start"),{text:{data:e},type:"api"}),n=e.roomID,r=e.type,i=e.groupID,t.next=4,CC.getInstance().getAlert().check(new vC({api:"joinInGroupCall",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 4:return t.prev=4,t.next=7,VC(r);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(lb,".joinInGroupCall.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 13:return t.prev=13,this.data.config.type=r,this.data.invitation.type=r,F_.log("".concat(lb,".joinInGroupCall roomID:").concat(n,",type:").concat(r,",userID:").concat(this.getUserID())),this.changeCallStatus(sg.CALLING),this.addHandledInviteeList([this.getUserID()]),this.data.groupID=i,this.data.roomID=n,this.data.isGroupCall=!0,this.data.isInviter=!1,this.enterRoom({roomID:n,callType:r}),this.changeCallStatus(sg.CONNECTED),this.getCallRecordReport().setBodyStatus(sg.CONNECTED),o={eventType:wg.JOIN_IN_GROUP_CALL,callType:wg.GROUP,mediaType:this._callType},this._callRecordUpload(o),this._callRecordReport.startHeartbeat(),t.abrupt("return",this.data.pusher);case 32:return t.prev=32,t.t1=t.catch(13),this._logger.error("".concat(lb,".joinInGroupCall.fail"),{text:{error:t.t1},type:"api"}),t.next=37,this._resetTUICallEngine();case 37:throw new Error("".concat(lb,".joinInGroupCall failed error: ").concat(t.t1));case 38:case"end":return t.stop()}}),t,this,[[4,9],[13,32]])}))),function(t){return R.apply(this,arguments)})},{key:"inviteUser",value:(D=l(a().mark((function t(e){var n,r,i,o,s,c,l,u,h,f=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".inviteUser.start"),{text:{data:e},type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"inviteUser",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this.tim});case 3:if(n=e.userIDList,r=void 0===n?[]:n,this.isGroupCall()){t.next=8;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)},type:"api"}),F_.error("".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)),new Error("".concat(lb,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType));case 8:if(this.isInviter()||this.data.callStatus===sg.CONNECTED){t.next=12;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support")},type:"api"}),F_.error("".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support")),new Error("".concat(lb,".inviteUser - current status:").concat(this.data.callStatus," not support"));case 12:if(0!==r.length){t.next=16;break}throw this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:"userIDList is empty"},type:"api"}),F_.error("".concat(lb,".inviteUser - userIDList is empty")),new Error("".concat(lb,".inviteUser - userIDList is empty"));case 16:if(i=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=[].concat(C(i),C(o)),0!==(c=r.filter((function(t){return-1===s.indexOf(t)}))).length){t.next=24;break}return this._logger.error("".concat(lb,".inviteUser.fail"),{text:{data:{userIDList:r},error:"userIDList in call list"},type:"api"}),F_.error("".concat(lb,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))),t.abrupt("return",Promise.reject("".concat(lb,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))));case 24:return r=c,t.prev=25,l=this.data.handledInviteeList.filter((function(t){return t!==f.getUserID()})),t.next=29,this.TSignalingClient.inviteGroup({groupID:this.data.groupID,userIDList:r,type:this.data.invitation.type,roomID:this.data.roomID,timeout:this.data.callTimeout,inCallUserIDs:[].concat(C(this.data.unHandledInviteeList),C(l)),initialCallId:this.getInitialCallId()});case 29:if(u=t.sent,F_.log("inviteUser res",u),0!==u.code){t.next=38;break}return this.addUnHandledInviteeList(r),this.addInviterInviteId(u.inviteID,[this.data.config.userID].concat(C(r))),h={eventType:wg.INVITE_USER,callType:wg.GROUP,mediaType:this._callType,inviteeList:r},this._callRecordUpload(h),this._callRecordReport.startHeartbeat(),t.abrupt("return",u);case 38:t.next=44;break;case 40:throw t.prev=40,t.t0=t.catch(25),this._logger.error("".concat(lb,".inviteUser.fail"),{text:{error:t.t0},type:"api"}),new Error("".concat(lb,".inviteUser failed, userId:").concat(this.getUserID(),", inviteeIdList:").concat(r,", error: ").concat(t.t0));case 44:case"end":return t.stop()}}),t,this,[[25,40]])}))),function(t){return D.apply(this,arguments)})},{key:"accept",value:(b=l(a().mark((function t(){var e=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".accept.start"),{type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"accept",initReady:this._initReady,callStatus:this.data.callStatus,sdkAppID:this.data.config.sdkAppID}));case 3:return t.prev=3,t.next=6,VC(this.data.config.type);case 6:t.next=12;break;case 8:return t.prev=8,t.t0=t.catch(3),this._logger.error("".concat(lb,".accept.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 12:return t.abrupt("return",new Promise((function(t,n){if(F_.log(lb,"accept() inviteID: ",e.data.invitation.inviteID),e.data.config.type!==pg.VIDEO||e.data.isGroupCall)e.handleAccept(t,n);else if(e.data.devicePermission){wx.createLivePusherContext().stopPreview();var r=setTimeout(l(a().mark((function i(){return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(r),e.handleAccept(t,n);case 2:case"end":return i.stop()}}),i)}))),0)}else e.handleAccept(t,n)})));case 13:case"end":return t.stop()}}),t,this,[[3,8]])}))),function(){return b.apply(this,arguments)})},{key:"handleAccept",value:(T=l(a().mark((function t(e,n){var r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".handleAccept.start"),{type:"api"}),this._callDataReport.setEnterRoomTime((new Date).getTime()),this.enterRoom({roomID:this.data.invitation.roomID,callType:this.data.config.type}),r=this.data.invitation.inviteID,t.next=6,this.TSignalingClient.accept({inviteID:r,type:this.data.config.type});case 6:0===(i=t.sent).code?(F_.log(lb,"accept OK"),this.addHandledInviteeList([this.getUserID()]),this.deleteUnHandledInviteeList([this.getUserID()]),this.addAcceptedUserList(r,[this.getUserID()]),this._callRecordUpload({eventType:wg.ACCEPT_CALL}),e({message:i.data.message,pusher:this.data.pusher}),this.changeCallStatus(sg.CONNECTED),this.getCallRecordReport().setBodyStatus(sg.CONNECTED)):(this.isGroupCall()&&(this._callDataReport.setCodeAndMessage(Iy.NOT_MEDIA_ACCESS,JSON.stringify(i.data.message)),this._callDataReport.uploadToKibana()),this._logger.error("".concat(lb,".accept.fail"),{text:{error:i},type:"api"}),F_.error(lb,"accept failed",i),n(i),this._resetTUICallEngine());case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return T.apply(this,arguments)})},{key:"reject",value:(_=l(a().mark((function t(){var e,n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".reject.start"),{text:{data:{invitation:this.data.invitation,type:this.data.config.type}},type:"api"}),t.next=3,CC.getInstance().getAlert().checkSync(new vC({api:"reject",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(!this.data.invitation.inviteID){t.next=14;break}return t.next=6,this.TSignalingClient.reject({inviteID:this.data.invitation.inviteID,type:this.data.config.type});case 6:return e=t.sent,F_.log(lb,"reject OK",e),n=this.generateEventData(),this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()},n),{},{reason:wg.REJECT})),this._callRecordUpload({eventType:wg.REJECT_CALL}),t.next=13,this._resetTUICallEngine();case 13:return t.abrupt("return",e);case 14:return this._logger.error("".concat(lb,".reject.fail"),{text:{error:"未收到邀请,无法拒绝"},type:"api"}),F_.warn("".concat(lb," 未收到邀请,无法拒绝")),t.abrupt("return","未收到邀请,无法拒绝");case 17:case"end":return t.stop()}}),t,this)}))),function(){return _.apply(this,arguments)})},{key:"hangup",value:(E=l(a().mark((function t(){var e,n,r,o,s,c,l,u,h,f,d,p,v,g,y,I,m,E,_=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".hangup.start"),{text:{data:{isGroupCall:this.isGroupCall(),isInviter:this.isInviter(),currentUserID:this.getUserID(),totalTime:this.generateCallTotalTime(),callType:this.getCallType()}},type:"api"}),t.next=3,CC.getInstance().getAlert().checkSync(new vC({api:"hangup",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(F_.warn("".concat(lb,". - callStatus:").concat(this.data.callStatus," _inviterInviteID:").concat(JSON.stringify(this.data.invitation))),this.data.callStatus!==sg.IDLE){t.next=7;break}throw this._logger.error("".concat(lb,".hangup.fail"),{text:{data:{currentStatus:this.data.callStatus},error:"hangup failed. current status:"},type:"api"}),new Error("".concat(lb,".hangup failed. current status:").concat(this.data.callStatus));case 7:if(this.data.callStatus!==sg.CALLING||0!==this.getInviterInviteIdList().length){t.next=10;break}throw this._logger.error("".concat(lb,".hangup.fail"),{text:{error:"call/groupCall incomplete。please wait cancel"},type:"api"}),new Error("".concat(lb,".call/groupCall incomplete。please wait cancel"));case 10:if(e=this.isGroupCall(),n=this.isInviter(),r=this.getUserID(),o=this.generateCallTotalTime(),s=this.getCallType(),l=this.getInviterInviteIdList(),this.data.callStatus!==sg.CONNECTED){t.next=31;break}if(t.prev=17,0!==l.length){t.next=23;break}return u=this.generateCallEndData({callMediaType:s,totalTime:o}),this.TRTCCallingDelegate.onCallEnd(u),t.next=23,this._resetTUICallEngine();case 23:t.next=31;break;case 25:return t.prev=25,t.t0=t.catch(17),this._logger.error("".concat(lb,".hangup.fail"),{text:{error:t.t0},type:"api"}),t.next=30,this._resetTUICallEngine();case 30:throw new Error(t.t0);case 31:if(h=this.getHandledInviteeList(),f=this.getUnHandledInviteeList(),d=this.generateEventData(),t.prev=34,e){t.next=53;break}if(p=this.generateCallEndData(),!n){t.next=48;break}if(1!==f.length){t.next=45;break}return t.next=41,this.cancel();case 41:c=t.sent,this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},d),{},{reason:wg.NORMAL})),t.next=46;break;case 45:this.TRTCCallingDelegate.onCallEnd(p);case 46:t.next=49;break;case 48:this.TRTCCallingDelegate.onCallEnd(p);case 49:return t.next=51,this._resetTUICallEngine();case 51:t.next=82;break;case 53:if(v=this.getCallStatus(),g={callType:this.getCallType(),isGroupCall:this.isGroupCall(),groupID:this.data.groupID,userIDList:[].concat(C(h.filter((function(t){return t!==r}))),C(f)),callEnd:this.generateCallTotalTime()},!n){t.next=73;break}if(v!==sg.CALLING){t.next=63;break}return t.next=59,this.cancel(this.getInviterInviteIdList());case 59:return c=t.sent,this.TRTCCallingDelegate.onCancel(i(i({inviteID:this.data.invitation.inviteID,invitee:r,userID:r},d),{},{reason:wg.NORMAL})),t.next=63,this._resetTUICallEngine();case 63:if(v!==sg.CONNECTED){t.next=71;break}y=a().mark((function t(){var e,n,i,o,s,u,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l[I],n=_.getInviterInviteIdUserList(e),!((i=_.getAcceptedUserList(e)).length>0)){t.next=22;break}if(o=i.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==r})),F_.warn("inviter emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,_.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==r})),t.next=17,_.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=_.generateCallEndData(),_.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=_.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return F_.warn("inviter emit cancel signal, userIdList:".concat(n)),t.next=28,_.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),I=0;case 66:if(!(I0)){t.next=22;break}if(o=i.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==r})),F_.warn("invitee emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,_.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==r})),t.next=17,_.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=_.generateCallEndData(),_.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=_.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return F_.warn("invitee emit cancel signal, inviteID:".concat(e)),t.next=28,_.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),E=0;case 75:if(!(E=3600?(r=parseInt(o/3600)<10?"0".concat(parseInt(o/3600)):parseInt(o/3600),i=parseInt(o%60/60)<10?"0".concat(parseInt(o%60/60)):parseInt(o%60/60),(a=o%3600<10?"0".concat(o%3600):o%3600)>60&&(i=parseInt(a/60)<10?"0".concat(parseInt(a/60)):parseInt(a/60),a=a%60<10?"0".concat(a%60):a%60),n="".concat(r,":").concat(i,":").concat(a)):o>=60&&o<3600?(i=parseInt(o/60)<10?"0".concat(parseInt(o/60)):parseInt(o/60),a=o%60<10?"0".concat(o%60):o%60,n="00:".concat(i,":").concat(a)):o<60&&(a=o<10?"0".concat(o):o,n="00:00:".concat(a)),n),e.data.chatTimeNum+=1,e.data.pusher.chatTime=e.data.chatTime,e.data.pusher.chatTimeNum=e.data.chatTimeNum,e.TRTCCallingDelegate.onUserUpdate({pusher:e.data.pusher,playerList:e.data.playerList})}),1e3);break;case sg.IDLE:clearInterval(this.data.timer),this.data.timer=null,this.data.chatTime="00:00:00",this.data.chatTimeNum=0}}},{key:"_resetTUICallEngine",value:(I=l(a().mark((function t(e,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,"._resetTUICallEngine.start"),{text:{data:{callEnd:e,type:n}},type:"api"}),this.changeCallStatus(sg.IDLE),F_.log(lb," _resetTUICallEngine()",this.data.enterRoomStatus),!this.data.enterRoomStatus){t.next=6;break}return t.next=6,this.exitRoom(e,n);case 6:this.data.config.type=pg.AUDIO,this._initialCallId="",this.initData();case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return I.apply(this,arguments)})},{key:"startRemoteView",value:(y=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(lb,".startRemoteView.start"),{text:{data:{userID:e}},type:"api"}),this.data.playerList.forEach((function(t){if(t.userID===e)return t.muteVideo=!1,void F_.log("".concat(lb,", startRemoteView(").concat(e,")"))}));case 2:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"stopRemoteView",value:function(t){this._logger.info("".concat(lb,".stopRemoteView.start"),{text:{data:{userID:t}},type:"api"}),this.data.playerList.forEach((function(e){if(e.userID===t)return e.muteVideo=!0,void F_.log("".concat(lb,", stopRemoteView(").concat(t,")"))}))}},{key:"openCamera",value:function(){this._logger.info("".concat(lb,".openCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"openCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera||this._pusherVideoHandler(),F_.log("".concat(lb,", openCamera() pusher: ").concat(this.data.pusher))}},{key:"closeCamera",value:function(){this._logger.info("".concat(lb,".closeCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"closeCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera&&this._pusherVideoHandler(),F_.log("".concat(lb,", closeCamera() pusher: ").concat(this.data.pusher))}},{key:"switchCamera",value:function(){this._logger.info("".concat(lb,".switchCamera.start"),{text:{data:{frontCamera:this.data.pusher.frontCamera}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"switchCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.getCurrentPusherInstance().switchCamera(),F_.log("".concat(lb,", switchCamera(), frontCamera").concat(this.data.pusher.frontCamera))}},{key:"openMicrophone",value:function(){this._logger.info("".concat(lb,".openMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"openMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic||this._pusherAudioHandler(),F_.log("".concat(lb,", openMicrophone() pusher: ").concat(this.data.pusher))}},{key:"closeMicrophone",value:function(){this._logger.info("".concat(lb,".closeMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"closeMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic&&this._pusherAudioHandler(),F_.log("".concat(lb,", closeMicrophone() pusher: ").concat(this.data.pusher))}},{key:"selectAudioPlaybackDevice",value:function(t){this._logger.info("".concat(lb,".selectAudioPlaybackDevice.start"),{text:{data:{type:t}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"selectAudioPlaybackDevice",callStatus:this.data.callStatus,attributes:{type:t},initReady:this._initReady}));var e=!1;switch(t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(e)}},{key:"setHandsFree",value:function(t){return this.data.soundMode=t?"speaker":"ear",F_.log("".concat(lb,", setHandsFree() result: ").concat(this.data.soundMode)),this.data.soundMode}},{key:"switchAudioCall",value:(g=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".switchAudioCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.warn("".concat(lb,".switchToAudioCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==pg.AUDIO){t.next=9;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"the call mode is audio call"},type:"api"}),F_.warn("".concat(lb," Now the call mode is audio call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 13:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Tg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return g.apply(this,arguments)})},{key:"switchCallMediaType",value:(v=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(lb,".closeMicrophone.start"),{text:{data:{type:e}},type:"api"}),t.next=3,CC.getInstance().getAlert().check(new vC({api:"switchCallMediaType",attributes:{type:e},callStatus:this.data.callStatus,initReady:this._initReady,sdkAppID:this.data.config.sdkAppID}));case 3:if(!this.isGroupCall()){t.next=7;break}throw this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.error("".concat(lb,".switchToAudioCall is not applicable to groupCall.")),new hC(Iy.ERROR_SCENE_NOT_SUPPORTED,"".concat(lb,".switchToAudioCall is not applicable to groupCall."));case 7:if(this.data.switchCallModeStatus){t.next=11;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 11:t.t0=e,t.next=t.t0===pg.AUDIO?14:t.t0===pg.VIDEO?17:20;break;case 14:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Tg}));case 17:throw this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"Audio switching Video is not supported yet"},type:"api"}),F_.warn("".concat(lb," Audio switching Video is not supported yet")),new Error("".concat(lb," Audio switching Video is not supported yet"));case 20:case"end":return t.stop()}}),t,this)}))),function(t){return v.apply(this,arguments)})},{key:"setSwitchCallModeStatus",value:function(t){this.data.switchCallModeStatus=t}},{key:"switchVideoCall",value:(p=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".switchVideoCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),F_.warn("".concat(lb,".switchToVideoCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==pg.VIDEO){t.next=9;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"Now the call mode is video call"},type:"api"}),F_.warn("".concat(lb," Now the call mode is video call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(lb,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),F_.warn("".concat(lb," audio and video call switching.")),t.abrupt("return");case 13:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!0}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Cg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return p.apply(this,arguments)})},{key:"setSoundMode",value:function(t){var e=!1,n=!1;switch(t||(n=!0,t=this.data.soundMode),t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(n?!e:e)}},{key:"_hangUp",value:function(){this.hangup()}},{key:"getCurrentPusherInstance",value:function(){return this.TRTC.getPusherInstance().context=wx.createLivePusherContext(),this.TRTC.getPusherInstance()}},{key:"_pusherStateChangeHandler",value:function(t){this.TRTC.pusherEventHandler(t)}},{key:"_playerStateChange",value:function(t){this._emitter.emit(og.REMOTE_STATE_UPDATE,t)}},{key:"_playerAudioVolumeNotify",value:function(t){this.data.playerList.length>0&&this.TRTC.playerAudioVolumeNotify(t)}},{key:"_pusherAudioVolumeNotify",value:function(t){this.TRTC.pusherAudioVolumeNotify(t)}},{key:"_updateUserProfile",value:function(t,e){return 0===e.length||0===t.length?e:e.map((function(e){var n=e,r=t.filter((function(t){return t.userID===e.userID}));return n.avatar=r[0]&&r[0].avatar?r[0].avatar:"",n.nick=r[0]&&r[0].nick?r[0].nick:"",n}))}},{key:"_getUserProfile",value:function(t){var e=this;this.tim.getUserProfile({userIDList:t}).then((function(t){F_.log("getUserProfile success",t),F_.log(t.data),e.data.remoteUsers=t.data})).catch((function(t){F_.warn("getUserProfile error:",t)}))}},{key:"getUserProfile",value:(h=l(a().mark((function t(e){var n,r,i,o,s=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.length>1&&void 0!==s[1]?s[1]:"array",0!==e.length){t.next=3;break}return t.abrupt("return",[]);case 3:return r=e.map((function(t){return t.userID})),t.next=6,this.tim.getUserProfile({userIDList:r});case 6:i=t.sent,o=null,t.t0=n,t.next="array"===t.t0?11:"map"===t.t0?13:16;break;case 11:return o=e.map((function(t,e){return t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,t})),t.abrupt("break",16);case 13:return o={},e.forEach((function(t,e){t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,o[t.userID]=t})),t.abrupt("break",16);case 16:return t.abrupt("return",o);case 17:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"setSelfInfo",value:function(t,e){return this._logger.info("".concat(lb,".setSelfInfo.start"),{text:{data:{nickName:t,avatar:e}},type:"api"}),CC.getInstance().getAlert().checkSync(new vC({api:"setSelfInfo",attributes:{nickName:t,avatar:e},initReady:this._initReady})),this.tim.updateMyProfile({nick:t,avatar:e})}},{key:"deviceCheck",value:(c=l(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",N_(e));case 1:case"end":return t.stop()}}),t)}))),function(t){return c.apply(this,arguments)})},{key:"_pusherNetStatus",value:function(t){this.TRTC.pusherNetStatusHandler(t)}},{key:"_playNetStatus",value:function(t){this.TRTC.playerNetStatus(t)}},{key:"_toggleViewSize",value:function(t){var e=t.currentTarget.dataset.screen;return F_.log("get screen",e,t),1===this.data.playerList.length&&e!==this.data.screen&&this.data.invitation.type===pg.VIDEO&&(this.data.screen=e),this.data.screen}},{key:"getTim",value:function(){return this.tim}},{key:"destroyed",value:(s=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".destroyed.start"),{type:"api"}),this.getCallStatus()===sg.IDLE){t.next=4;break}return t.next=4,this.handleExceptionExit();case 4:if(this._resetTUICallEngine(),this._removeTSignalingEvent(),this._removeTRTCEvent(),this._timExternal){t.next=10;break}return t.next=10,this.logout();case 10:this._initReady=!1;case 11:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"handleExceptionExit",value:(o=l(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(lb,".handleExceptionExit.start"),{text:{data:{callStatus:this.getCallStatus()}},type:"api"}),t.prev=1,this.getCallStatus()!==sg.CALLING){t.next=10;break}if(!this.isInviter()){t.next=8;break}return t.next=6,this.hangup();case 6:t.next=10;break;case 8:return t.next=10,this.reject();case 10:if(this.getCallStatus()!==sg.CONNECTED){t.next=13;break}return t.next=13,this.hangup();case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(1),this._logger.error("".concat(lb,".handleExceptionExit.fail"),{text:{data:{error:t.t0}},type:"api"});case 18:case"end":return t.stop()}}),t,this,[[1,15]])}))),function(){return o.apply(this,arguments)})},{key:"_callRecordUpload",value:function(t){var e=i(i({},t),{},{callRole:this.isInviter()?wg.INVITER:wg.INVITEE,userID:this.getUserID(),roomID:this.getRoomID(),inviteID:this.getInitialCallId()});this._callRecordReport.eventUpload(e)}},{key:"generateCallEndData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.roomId,n=t.callMediaType,r=t.callRole,i=t.totalTime,a=t.userId;return e=e||this.getRoomID(),n=n||this.getCallType(),r||(r=this.isInviter()?gg:yg),{roomID:e,callMediaType:n,callRole:r,totalTime:i=S_(i)?this.generateCallTotalTime():i,userID:a=a||this.getUserID(),callEnd:i,message:t.message||""}}},{key:"generateEventData",value:function(){return{callID:this.getInviterInviteIdList()[0],roomID:this.getRoomID(),callRole:this.isInviter()?wg.INVITER:wg.INVITEE,callMediaType:this.getCallType()}}},{key:"setInitialCallId",value:function(t){this._initialCallId=t}},{key:"getInitialCallId",value:function(){return this._initialCallId}},{key:"getConnectStartTime",value:function(){return this.data.startTalkTime}},{key:"generateCallTotalTime",value:function(){return 0===this.getConnectStartTime()?0:Math.round((Date.now()-this.getConnectStartTime())/1e3)}}],[{key:"createInstance",value:function(t){return ub.updateEsConfig({url:"".concat("https://webim.tim.qq.com/v4/imopenstat/tweb_trtccalling_report","?sdkappid=").concat(null==t?void 0:t.sdkAppID),table:"timweb-trtccalling"}),CC.getInstance().getAlert().checkSync(new vC({api:"createInstance",attributes:t})),r.instance||(r.instance=new r(t)),r.instance.initData(),r.instance}}]),r}();d(hb,"instance",null),d(hb,"AUDIO_PLAYBACK_DEVICE",bg),d(hb,"MEDIA_TYPE",pg),d(hb,"EVENT",og),d(hb,"STATUS",sg);if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });Object.defineProperty(exports, 'AUDIO_PLAYBACK_DEVICE', { enumerable: true, configurable: true, get: function() { return bg; } });Object.defineProperty(exports, 'EVENT', { enumerable: true, configurable: true, get: function() { return og; } });Object.defineProperty(exports, 'MEDIA_TYPE', { enumerable: true, configurable: true, get: function() { return pg; } });Object.defineProperty(exports, 'STATUS', { enumerable: true, configurable: true, get: function() { return sg; } });Object.defineProperty(exports, 'TUICallEngine', { enumerable: true, configurable: true, get: function() { return hb; } });Object.defineProperty(exports, 'default', { enumerable: true, configurable: true, get: function() { return hb; } }); }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) -return __REQUIRE__(1704939160521); +return __REQUIRE__(1710723475378); })() //miniprogram-npm-outsideDeps=["tsignaling-wx","trtc-wx-sdk","tim-wx-sdk"] //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/TUICallKit/pages/globalCall/globalCall.js b/TUICallKit/pages/globalCall/globalCall.js index 6bcdc3f..29455fb 100644 --- a/TUICallKit/pages/globalCall/globalCall.js +++ b/TUICallKit/pages/globalCall/globalCall.js @@ -1,4 +1,9 @@ Page({ data: {}, - onShow() {}, + onShow() { + + }, + onHide(){ + console.log('接听页面隐藏'); + } }); diff --git a/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.js b/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.js index 59cde29..9f628f2 100644 --- a/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.js +++ b/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.js @@ -228,14 +228,13 @@ Component({ }]; return renderDom; } - //13 SEND_TALK - if (customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.SEND_TALK){ + //13 SEND_TALK 14 + if (customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.SEND_TALK || customMessage.message_type === GDXZ_CUSTOM_MSEEAGE.RECOMMEND_TALK){ const renderDom = [{ type: 'send_talk', title: customMessage.title, desc: customMessage.desc, - }]; return renderDom; } @@ -246,8 +245,7 @@ Component({ const renderDom = [{ type: 'video_time', title: customMessage.title, - desc: customMessage.desc, - + desc: customMessage.desc.replace(/text/g,'span') }]; return renderDom; } diff --git a/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.wxml b/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.wxml index 4e0efab..3dfac92 100644 --- a/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.wxml +++ b/TUIChatService/TUIKit/components/TUIChat/components/MessageElements/CustomMessage/index.wxml @@ -35,7 +35,9 @@ {{renderDom[0].text}} + {{renderDom[0].text}} + @@ -63,7 +63,7 @@ 问诊表 - + 赠送沟通 @@ -163,9 +163,9 @@ 立即发起 - + - + 赠送患者免费图文回合沟通数 回合数 @@ -208,7 +208,7 @@ z-index="9901" position="bottom" custom-style="height: 50%" > - diff --git a/TUIChatService/TUIKit/components/TUIChat/components/MessageInput/index.wxss b/TUIChatService/TUIKit/components/TUIChat/components/MessageInput/index.wxss index 848a943..fd4c279 100644 --- a/TUIChatService/TUIKit/components/TUIChat/components/MessageInput/index.wxss +++ b/TUIChatService/TUIKit/components/TUIChat/components/MessageInput/index.wxss @@ -282,4 +282,4 @@ color: #FFFFFF; display: flex; align-items: center; justify-content: center; -} \ No newline at end of file +} diff --git a/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.js b/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.js index 55910b7..3b904a0 100644 --- a/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.js +++ b/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.js @@ -59,6 +59,7 @@ Component({ unreadCount: '', conversation: {}, // 当前会话 baseInfo:{}, + sendTalkEnable:true, messageList: [], // 自己的 ID 用于区分历史消息中,哪部分是自己发出的 scrollView: '', @@ -344,11 +345,27 @@ Component({ let order_inquiry_id = cloudCustomDataJson.order_inquiry_id; let now_order_inquiry_id = this.data.order_inquiry_id + let payload = message.payload.data; if(order_inquiry_id != now_order_inquiry_id){ - return + return; + // if(payload){ + // const payload_Data = JSON.parse(message.payload.data); + // if( payload_Data && payload_Data.message_type!=13){ + // return + // }else{ + // this.setData({ + // message_rounds: 0 + // }) + // console.log('刷新refreshMessageRounds') + // var myEventOption = {} + // myEventOption.message_rounds = 0 + // this.triggerEvent('refreshMessageRounds', myEventOption) + // } + // } + } - let payload = message.payload.data; + if(payload){ const payloadData = JSON.parse(message.payload.data); if(payloadData){ @@ -390,20 +407,36 @@ Component({ let type = message.type; // console.log("message type: ", type); let show_avatar = true; + console.log("执行1——————————————————————") if(type === "TIMCustomElem"){ const customMessage = JSON.parse(message.payload.data); if(Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.PRESCRIBE && Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.PRESCRIBE_VERIFY && Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.SUGAR_CHECK && Number(customMessage.message_type) != GDXZ_CUSTOM_MSEEAGE.WENZHEN_FORM && message.cloudCustomData){ show_avatar = false; } + if(Number(customMessage.message_type) == GDXZ_CUSTOM_MSEEAGE.TRABECULA && refreshBaseInfo){ - const title = customMessage.title + const title = customMessage.title; + if(title.indexOf("问诊已结束") > -1){ setTimeout(() => { //收到横条消息去触发父组件getbase方法,演示1秒 this.triggerEvent('getInquiryMessageBasic'); }, 1000); } - } + }; + // if(Number(customMessage.message_type) == GDXZ_CUSTOM_MSEEAGE.SEND_TALK){ + // console.log("执行2——————————————————————") + // const title = customMessage.desc; + // console.log(title) + // if(title.indexOf("医生已赠送") > -1){ + // setTimeout(() => { + // console.log('已赠送') + // //收到横条消息去触发父组件getbase方法,演示1秒 + + // // this.triggerEvent('getInquiryMessageBasic', customMessage.data.order_inquiry_id); + // }, 1000); + // } + // } } @@ -493,6 +526,24 @@ Component({ } if(!this.checkShowAvatar(message, true)){ message.no_avatar = true; + }; + if(message.type=='TIMCustomElem'){ + const customMessage = JSON.parse(message.payload.data); + const info=JSON.parse(message.cloudCustomData); + console.log(customMessage); + console.log(info); + if(Number(customMessage.message_type) == GDXZ_CUSTOM_MSEEAGE.SEND_TALK){ + if(info){ + wx.showToast({ + title: info.inquiry_type, + }) + wx.redirectTo({ + url: '/TUIChatService/pages/index?order_inquiry_id='+customMessage.data.order_inquiry_id+"&from_account=end&inquiry_type="+info.inquiry_type, + }) + } + + } + } wx.$TUIKit.setMessageRead({ conversationID: this.data.conversation.conversationID }).then(() => { logger.log('| MessageList | setMessageRead | ok'); @@ -1006,7 +1057,7 @@ Component({ }, goMedinceList(){ wx.navigateTo({ - url: '/Pages/yishi/medince_list/index', + url: '/user/pages/yishi/medince_list/index', }) }, }, diff --git a/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.wxml b/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.wxml index 27b4d18..e08f316 100644 --- a/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.wxml +++ b/TUIChatService/TUIKit/components/TUIChat/components/MessageList/index.wxml @@ -5,7 +5,7 @@ 加载中... -