"use strict";!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).TencentCloudChat=t()}(this,function(){function o(t,e){var n,o=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)),o}function y(t){for(var e=1;ee.length)&&(t=e.length);for(var n=0,o=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};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 i,a=!0,s=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==o.return||o.return()}finally{if(s)throw i}}}}var G={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",ROOM_CUSTOM_DATA_RECEIVED:"onRoomCustomDataReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",MESSAGE_REACTIONS_UPDATED:"onMessageReactionsUpdated",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_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",MY_FOLLOWERS_LIST_UPDATED:"onMyFollowersListUpdated",MY_FOLLOWING_LIST_UPDATED:"onMyFollowingListUpdated",MUTUAL_FOLLOWERS_LIST_UPDATED:"onMutualFollowersListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange"},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},P={NEW_INVITATION_RECEIVED:"newInvitationReceived",INVITEE_ACCEPTED:"ts_invitee_accepted",INVITEE_REJECTED:"ts_invitee_rejected",INVITATION_CANCELLED:"ts_invitation_cancelled",INVITATION_TIMEOUT:"ts_invitation_timeout",INVITATION_MODIFIED:"ts_invitation_modified",ACTION_TYPE_UNKNOWN:0,ACTION_TYPE_INVITE:1,ACTION_TYPE_CANCEL_INVITE:2,ACTION_TYPE_ACCEPT_INVITE:3,ACTION_TYPE_REJECT_INVITE:4,ACTION_TYPE_INVITE_TIMEOUT:5},U=(e(W,[{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&&0=Math.pow(2,64)&&(s({api:t,paramName:n,desc:Gn("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(s({api:t,paramName:n,desc:en()}),!1)}},enableMark:y({},Nn)},createConversationGroup:{conversationIDList:y({},re),groupName:y(y({},ae),{},{validator:function(e,t,n){return!(!e||32>(-2*a&6))))i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);try{return decodeURIComponent(escape(n))}catch(e){return""}}var xo,Vo,Ho,Bo,Ko,Wo=["jpg","jpeg","gif","png","bmp","image","webp"],Yo=["mp4","quicktime","mov"],jo=(e(zi,[{key:"validate",value:function(e){var t,n=!0,o="";if(We(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var i=e.profileCustomField.length,a=null,s=0;se?(r.messageList=i.slice(s-e,s),r.nextReqMessageID=i[s-e].ID):(r.messageList=i.slice(0,s),r.isCompleted=!0):eo||n&&a.sequence>n)){if("in"===a.flow&&a.isRead)break;a.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1=i.MAX_CHECK_COUNT?(i._deleteCachedGroupTips(t),i._checkCountMap.delete(t)):i._checkCountMap.set(t,++n)})}},{key:"onNewGroupTips",value:function(e){A.d("".concat(this._n,".onReceiveGroupTips count:").concat(e.dataList.length));var e=this.newGroupTipsStoredAndSummary(e),t=e.eventDataList,n=e.result,e=e.AVChatRoomMessageList;0=i.MAX_CHECK_COUNT?(i._deleteCachedGroupMessage(t),i._checkCountMap.delete(t)):i._checkCountMap.set(t,++n)})}},{key:"handleUpdateGroupLastMessage",value:function(e){var t="".concat(this._n,".handleUpdateGroupLastMessage");if(0!==this._grpM.getGroupMap().size){for(var n,o,i,a,s=!1,r=0,c=e.length;r=this.CACHE_EXPIRE_TIME||r=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:a}).then(function(e){s.setMoreMessage("from remote. count:".concat(e.length)).end(),A.l("".concat(n," from remote. groupID:").concat(o));e=t._getLocalCounters(o,i);return In({counters:e})}).catch(function(e){return s.setError(e).end(),m(e)});s.setMoreMessage("from cache").end(),A.l("".concat(n," from cache. groupID:").concat(o));e=this._getLocalCounters(o,i);return yn({counters:e})}},{key:"_getRemoteGroupCounters",value:function(n){var o=this;return this._grpM.req({proto:v.GET_GRP_COUNTER,data:y({},n)}).then(function(e){var e=e.data,t=e.counterList,t=void 0===t?[]:t,e=e.groupCounterSeq;return o._updateLocalGroupCounters({groupID:n.groupID,counterList:t,groupCounterSeq:e}),A.l("".concat(o._n,"._getRemoteGroupCounters ok. groupID:").concat(n.groupID)),t}).catch(function(e){return m(e)})}},{key:"_convertObjectToList",value:function(t){var n=[];return Object.keys(t).forEach(function(e){n.push({key:e,value:t[e]})}),n}},{key:"_updateGroupCounters",value:function(e){var t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,o=e.avChatRoomKey,i=e.mode;return A.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(o," mode:").concat(i)),this._grpM.req({proto:v.UPDATE_GRP_COUNTER,data:y({},e)}).then(function(e){A.l("".concat(t," ok."));var e=e.data.counterList,n={};return(void 0===e?[]:e).forEach(function(e){var t=e.key,e=e.value;n[t]=e}),n}).catch(function(e){return m(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 n,t,o,i=e.groupID,a=e.counterList,a=void 0===a?[]:a,e=e.groupCounterSeq;this._hasLocalGroupCounters(i)&&(o=this._getLocalGroupCounters(i),n=o.counters,t=o.avChatRoomKey,o=o.groupCounterSeq,0this._startBroadcastSeq&&(this._startBroadcastSeq=c),Ze(s)&&01e3*t.expireTime&&1e4=o&&t.messageList.push(e)}),0===t.messageList.length&&i[0].sequencethis.MAX_QUERY_USER_COUNT&&(A.w("".concat(o," ").concat(Kt(this.MAX_QUERY_USER_COUNT))),t=i.slice(0,this.MAX_QUERY_USER_COUNT));var s=new M("getUserStatus");return this._userM.req({proto:v.GET_USER_STATUS,data:{userIDList:t}}).then(function(e){var e=e.data,t=e.successUserList,t=void 0===t?[]:t,e=e.failureUserList,e=void 0===e?[]:e,t=t.map(function(e){var t=e.userID,n=e.statusType,e=e.customStatus;return{userID:t,statusType:n,customStatus:qo(e)}}),e=e.map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:We(n)?t:n,code:o,message:e}}),n=(R(a)||t.unshift(a),"userID count:".concat(i.length,", success count:").concat(t.length,", fail count:").concat(e.length));return s.setMessage("".concat(n)).end(),A.l("".concat(o," ok. ").concat(n,".")),In({successUserList:t,failureUserList:e})}).catch(function(e){return s.setMessage("userID count:".concat(i.length)).setError(e).end(),A.e("".concat(o," failed. error:"),e),m(e)})}},{key:"subscribeUserStatus",value:function(e){var t="subscribeUserStatus";if(!this._userM.canIUse(H.USER_STATUS))return this._userM.cannotUseCommercialAbility(t);var n="".concat(this._n,".").concat(t),e=e.userIDList,e=void 0===e?[]:e,o=T(e),i=(o.length>this.MAX_SUBSCRIBE_USER_COUNT&&(A.w("".concat(n," ").concat(Kt(this.MAX_SUBSCRIBE_USER_COUNT))),o=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),new M(t)),a="userID count:".concat(e.length);return A.l("".concat(n," ").concat(a)),this._userM.req({proto:v.SUB_USER_STATUS,data:{userIDList:o}}).then(function(e){e=e.data.failureUserList,e=(void 0===e?[]:e).map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:We(n)?t:n,code:o,message:e}});return i.setMessage("".concat(a," fail count:").concat(e.length)).end(),A.l("".concat(n," ok. fail count:").concat(e.length,".")),In({failureUserList:e})}).catch(function(e){return i.setMessage(a).setError(e).end(),A.e("".concat(n," failed. error:"),e),m(e)})}},{key:"unsubscribeUserStatus",value:function(e){var t="unsubscribeUserStatus";if(!this._userM.canIUse(H.USER_STATUS))return this._userM.cannotUseCommercialAbility(t);var n="".concat(this._n,".").concat(t),e=(e||{}).userIDList,e=void 0===e?[]:e,o=T(e),i=(e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(A.w("".concat(n," ").concat(Kt(this.MAX_UNSUBSCRIBE_USER_COUNT))),o=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),new M(t)),a="userID count:".concat(e.length),t=(A.l("".concat(n," ").concat(a)),{userIDList:o});return 0===o.length&&(t.userIDList=void 0,t.unsubscribeAll=1),this._userM.req({proto:v.UNSUB_USER_STATUS,data:t}).then(function(e){e=e.data.failureUserList,e=(void 0===e?[]:e).map(function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,e=e.errorInfo;return{userID:We(n)?t:n,code:o,message:e}});return i.setMessage("".concat(a," fail count:").concat(e.length)).end(),A.l("".concat(n," ok. fail count:").concat(e.length,".")),In({failureUserList:e})}).catch(function(e){return i.setMessage("".concat(a)).setError(e).end(),A.e("".concat(n," failed. error:"),e),m(e)})}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),Ai),yi=(t(Si,On),Vo=f(Si),e(Si,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){A.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:Fe.NICK,value:e},{tag:Fe.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t,n,e=e.dataList;We(e)||(t=[],e.forEach(function(e){e.blackListDelAccount&&t.push.apply(t,T(e.blackListDelAccount))}),0=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()n.MAX_THRESHOLD&&n._flushAtOnce()})):this._lastReportTime=Date.now())}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");We(t)?(A.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):((n=n.concat(t)).length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),A.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){A.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),sa),na="none",oa="online",ia=(e(aa,[{key:"start",value:function(){var t=this,n="".concat(this._n,".start");te?(oe.getNetworkType({success:function(e){t._networkType=e.networkType||e.subtype||"",e.networkType===na?A.w("".concat(n," no network, please check!")):A.i("".concat(n," networkType:").concat(e.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),oe.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=oa,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:oa})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:na})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,e=e.networkType,n="".concat(this._n,"._onNetworkStatusChange"),o=!1,i="previous:".concat(this._networkType," current:").concat(e);t?(A.i("".concat(n," ").concat(i)),this._networkType!==e&&(o=!0,this._m.get(21).reConnect(!0))):this._networkType!==e&&(o=!0,A.w("".concat(n," no network, please check!")),this._m.get(21).offline()),o&&(new M("networkChange").setMessage("isConnected:".concat(t," ").concat(i)).end(),this._networkType=e)}},{key:"isOnline",value:function(){return this._networkType!==na}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){A.l("".concat(this._n,".reset")),te?null!==this._mpNetworkStatusCallback&&(oe.offNetworkStatusChange&&($||z?oe.offNetworkStatusChange(this._mpNetworkStatusCallback):oe.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))}}]),aa);function aa(e){u(this,aa),this._m=e,this._networkType=oa,this._n="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}function sa(e){u(this,sa),(e=Zi.call(this,e))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new ea,e.MIN_THRESHOLD=20,e.MAX_THRESHOLD=100,e.WAITING_TIME=6e4,e.REPORT_LEVEL=[4,5,6],e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._lastReportTime=Date.now();var t=e.getInnerEmitterInstance();return t.on(mo.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,g(e)),t.on(mo.CLOUD_CONFIG_UPDATED,e._onCloudConfigUpdated,g(e)),e}function ra(e){u(this,ra),this._n="SSOLogBody",this._report=[]}function ca(e){u(this,ca),this._m=e,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}Z=re={exports:{}},la=Object.prototype.hasOwnProperty,da="~",Object.create&&(ya.prototype=Object.create(null),(new ya).__proto__||(da=!1)),La.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)la.call(e,t)&&n.push(da?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},La.prototype.listeners=function(e){var e=da?da+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var n=0,o=t.length,i=new Array(o);n=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._relayFlag)return Promise.resolve();var t=this.get(26);switch(e.type){case S.MSG_IMAGE:return t.addTotalCount(Kn),this._uploadImage(e);case S.MSG_FILE:return t.addTotalCount(Kn),this._uploadFile(e);case S.MSG_AUDIO:return t.addTotalCount(Kn),this._uploadAudio(e);case S.MSG_VIDEO:return t.addTotalCount(Kn),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(v){var M=this,e=this.get(2),I=v.getElements()[0],t=e.getMessageOption(v.clientSequence);return this.doUploadImage({file:t.payload.file,to:t.to,message:v,onProgress:function(e){if(I.updatePercent(e),$e(t.onProgress))try{t.onProgress(e)}catch(e){return m({code:C.MSG_ONPROGRESS_FUNCTION_ERROR})}}}).then(function(e){var t=e.location,l=e.fileType,d=e.fileSize,n=e.width,o=e.height,p=e.smallImageUrl,_=e.smallImageWidth,g=e.smallImageHeight,h=e.largeImageUrl,f=e.largeImageWidth,m=e.largeImageHeight,i=e.imageInfoArray,e=M.isPrivateNetWork()?t:ct(t);I.updateImageFormat(l);var a,s,r={size:d,url:e,width:n,height:o};if(i&&0this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?m({code:C.MSG_F_IS_EMPTY}):(this._setUploadFileType(255),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?m({code:C.MSG_F_IS_EMPTY}):-1===Yo.indexOf(e.file.videoFile.type)?m({code:C.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),te?this.handleVideoUpload(y(y({},e),{},{file:e.file.videoFile})):ne?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(n){var o=this;return new Promise(function(t,e){o.uploadByCOS(n).then(function(e){t(e)}).catch(function(){o.uploadByCOS(n).then(function(e){t(e)}).catch(function(){e(new Fn({code:C.MSG_V_UPLOAD_FAIL}))})})})}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?m({code:C.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):m({code:C.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(t){var c=this;if(!$e(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),m({code:C.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(t);var u=new M("upload"),l="".concat(this._n,".uploadByCOS"),d=Date.now(),p=this._getFile(t);return new Promise(function(a,s){var e=te?c._createCosOptionsWXMiniApp(t):c._createCosOptionsWeb(t),r=c;c._cosUploadMethod(e,function(e,t){var n=Object.create(null);if(t){if(e||Ze(t.files)&&t.files[0].error)return o=new Fn({code:C.MSG_F_UPLOAD_FAIL}),u.setError(o).end(),A.l("".concat(l," failed. error:"),t.files[0].error),403===t.files[0].error.statusCode&&(A.w("".concat(l," failed. cos AccessKeyId was invalid, regain auth key!")),c._getAuthorizationKey()),void s(o);n.fileName=p.name,n.fileSize=p.size,n.fileType=p.type.slice(p.type.indexOf("/")+1).toLowerCase(),n.location=(te?t:t.files[0].data).Location;var o=Date.now()-d,t=r._formatFileSize(p.size),i=r._formatSpeed(1e3*p.size/o),t="size:".concat(t," time:").concat(o,"ms speed:").concat(i),i=(A.l("".concat(l," success. name:").concat(p.name," ").concat(t)),a(n),c.get(26));return i.addCost(Kn,o),i.addFileSize(Kn,p.size),void u.setMessage(t).end()}n=new Fn({code:C.MSG_F_UPLOAD_FAIL});u.setError(n).end(),A.w("".concat(l," failed. error:"),e),403===e.statusCode&&(A.w("".concat(l," failed. cos AccessKeyId was invalid, regain auth key!")),c._getAuthorizationKey()),s(n)})})}},{key:"_uploadWithPreSigUrl",value:function(e){var p=this,_="".concat(this._n,"._uploadWithPreSigUrl"),g=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(function(d){return new Promise(function(a,s){var r=new M("upload"),e=d.requestSnapshotUrl,c=void 0===e?void 0:e,u=h(d,_a),l=Date.now();p._cosUploadMethod(u,function(e,t){var n,o,i;return e||403===t.statusCode?(r.setError(new Fn(e)).end(),o={HttpStatusCode:9999,CostTime:Jt(l,!1),error:e,url:d.url},t.data&&t.data.uploadIP&&(o.uploadIP=t.data.uploadIP),p._uploadSSOLog(o),A.l("".concat(_," failed, error:"),e),void s(new Fn({code:C.MSG_F_UPLOAD_FAIL}))):(n=Object.create(null),o=t.data.location||"",p.isPrivateNetWork()||0!==o.indexOf("https://")&&0!==o.indexOf("http://")||(o=o.split("//")[1]),n.fileName=g.name,n.fileSize=g.size,n.fileType=g.type.slice(g.type.indexOf("/")+1).toLowerCase(),n.location=o,e=Jt(l,!1),o=p._formatFileSize(g.size),i=p._formatSpeed(1e3*g.size/e),o="size:".concat(o," time:").concat(e,"ms speed:").concat(i," res:").concat(JSON.stringify(t.data)),A.l("".concat(_," ok. name:").concat(g.name," ").concat(o)),r.setMessage(o).end(),i={HttpStatusCode:t.statusCode,FileSize:g.size,CostTime:e,url:d.url},t.data&&t.data.uploadIP&&(i.uploadIP=t.data.uploadIP),p._uploadSSOLog(i),(o=p.get(26)).addCost(Kn,e),o.addFileSize(Kn,g.size),i=[],u.thumbUrl&&u.largeUrl&&i.push.apply(i,[p._getSmallImageInfoByUrl(u.thumbUrl,n),p._getLargeImageInfoByUrl(u.largeUrl,n)]),1===p.uploadFileType&&p.isSimpleCos&&!p.isPrivateNetWork()&&(i.push(p._getImageInfoArray(u.downloadUrl,n)),t.data.uploadIP&&i.push(p._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],n))),c&&i.push(p._getSnapshotInfoByUrl(c,n)),0>>18,128|t>>>12&63,128|t>>>6&63,128|63&t)}else t=65533}else t<=57343&&(t=65533);return t<=2047?Qa(192|t>>>6,128|63&t):Qa(224|t>>>12,128|t>>>6&63,128|63&t)},$a=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Za),n=0|t.length,o=new Uint8Array(n),i=0;i=o&&(A.l("".concat(i._n,"._checkPromiseMap request timeout, delete requestID:").concat(t)),i._promiseMap.delete(t),n(new Fn({code:C.NETWORK_TIMEOUT})),i._chM.onRequestTimeout(t))})}},{key:"onOpen",value:function(e){var t,n;""!==this._readyState&&(this._onOpenTs=Date.now(),t=e.id,this._socketID=t,n=Jt(this._startTs,!1),A.l("".concat(this._n,"._onOpen cost:").concat(n," ms. socketID:").concat(t)),new M("wsOnOpen").setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=os,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen()))}},{key:"onClose",value:function(e){var t=new M("wsOnClose"),n=e.id,e=e.e,o="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(e.code," reason:").concat(e.reason),i=0;0!==this._onOpenTs&&(i=Date.now()-this._onOpenTs),t.setMessage(i).setCostTime(i).setMoreMessage(o).setCode(e.code).end(),A.l("".concat(this._n,"._onClose ").concat(o," onlineTime:").concat(i)),n===this._socketID&&(this._readyState=as,i<1e3?this._chM.onReconnectFailed():this._chM.onClose())}},{key:"onError",value:function(e){var t=e.id,e=e.e,n="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new M("wsOnError").setMessage(e.errMsg||ht(e)).setMoreMessage(n).setLevel("error").end(),A.w("".concat(this._n,"._onError"),e,n),t===this._socketID&&(this._readyState="",this._chM.onError())}},{key:"onMessage",value:function(t){var e;try{e=JSON.parse(t.data)}catch(e){new M("jsonParseError").setMessage(t.data).end()}if(e&&e.head){var n,o,i,t=this._getRequestIDFromHead(e.head),a=e.body;if(this._chM.get(30).isTRTCCommand(t)||(i=Ut(e.head),a=function t(e,n){return Ze(e)?e.map(function(e){return Xe(e)?t(e,n):e}):Xe(e)?(o=e,i=function(e,t){return R(n[t])?ja(t):n[t]},a={},Object.keys(o).forEach(function(e){a[i(o[e],e)]=o[e]}),At(a,function(e){return Ze(e)||Xe(e)?t(e,n):e})):void 0;var o,i,a}(e.body,this._getResponseKeyMap(i))),A.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(a)," requestID:").concat(t," has:").concat(this._promiseMap.has(t))),this._setNextPingTs(),this._promiseMap.has(t))return n=(i=this._promiseMap.get(t)).resolve,o=i.reject,i=i.timestamp,this._promiseMap.delete(t),this._calcRTT(i),void(a.errorCode&&0!==a.errorCode?(this._chM.onErrorCodeNotZero(a),o(new Fn({code:a.errorCode,message:a.errorInfo||"",data:t.includes(v.MODIFY_C2C_MSG)||t.includes(v.MODIFY_GRP_MSG)?{elements:a.elements,messageVersion:a.messageVersion,cloudCustomData:a.cloudCustomData}:void 0}))):n(In(a)));this._chM.onMessage({head:e.head,body:a})}}},{key:"_calcRTT",value:function(e){e=Date.now()-e;this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new es(this),this._socketID=this._socket.getID(),this._readyState=is,A.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new M("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=Nt(),t=((Q||Y&&"windows"===e||$)&&(this._canIUseBinaryFrame=!1),-1),n=("ios"===e?t=ue||-1:"android"===e&&(t=de||-1),this._chM.get(12)),o=this._chM.getPlatform(),i=n.getSDKAppID(),n=n.getInstanceID(),i="sdkappid=".concat(i,"&instanceid=").concat(n,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(e,"&version=").concat(t,"&sdkversion=").concat("3.2.4");return j&&(i+="&isminigame=1"),(this._canIUseBinaryFrame?"".concat(this._url,"/binfo?"):"".concat(this._url,"/info?")).concat(i)}},{key:"_closeConnection",value:function(e){A.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=as)}},{key:"_resend",value:function(){var i=this;if(A.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0=this._socketHandler.getNextPingTs()&&this._ping()}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1>>30-e}function Es(e,t){for(var n=e.toString(16),o=t-n.length,i="0";0>>=1,i+=i)1&o&&(n=i+n);return n}t(Yr,On),Fs=f(Yr),e(Yr,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(gs)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");R(e)||(e=JSON.parse(e),this._updateCommandFrequencyLimitMap(e))}},{key:"_updateCommandFrequencyLimitMap",value:function(e){var t=this;e.forEach(function(e){t._commandFrequencyLimitMap.set(e.cmd,{interval:e.interval,count:e.count})})}},{key:"updateProtocolConfig",value:function(){this._protocolHandler.update()}},{key:"req",value:function(e){A.d("".concat(this._n,".req options:"),e);var t=e.proto,n=e.tjgID;if(!this._protocolHandler.has(t))return A.w("".concat(this._n,".req unknown proto:").concat(t)),m({code:C.CANNOT_FIND_PROTOCOL});var e=this.getProtocolData(e),o=e.head.servcmd;if(this._isFrequencyOverLimit(o))return m({code:i=C.OVER_FREQUENCY_LIMIT,message:this.getErrorMessage(i,this._getCmd(o))});if(this._isServerOverload(o))return m({code:i=C.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrorMessage(i,this._getCmd(o))});We(n)||(e.head.tjgID=n);var i=this.get(21);return ps.includes(t)?i.simplySend(e):i.send(e)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:192371,sdkability_ext:Ds(""),cappid:e.getApplicationID(),tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:192371,sdkability_ext:Ds(""),cappid:e.getApplicationID()}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:x,websdkversion:q,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:192371,sdkability_ext:Ds(""),cappid:e.getApplicationID()}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"trans",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"sendComboMessage",value:function(e){var t=e.servcmd,e=e.data,t={head:y(y({},this.genCommonHead()),{},{servcmd:t}),body:e};return this.get(21).send(t)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===C.HELLO_ANSWER_KICKED_OUT&&(t=e.kickType,e=void 0===(e=e.newInstanceInfo)?{}:e,1===t?this.onMultipleAccountKickedOut(e):2===t?this.onMultipleDeviceKickedOut(e):3===t&&this.onRestApiKickedOut(e)),n!==C.MSG_A2KEY_EXPIRED&&n!==C.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(21).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,n=t.needAck,t=t.sessionData;1===(void 0===n?0:n)&&this._sendACK(t),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){A.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){A.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e,t,n=this,o="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(28)).canIUseOfflinePush()&&(e=t.getUniAppPlatform()),this.req({proto:v.LOGIN,data:{isWebUniapp:e}}).then(function(e){e=e.data.instanceID,n.get(12).setStatusInstanceID(e),A.l("".concat(o," ok. instanceID:").concat(e)),n.get(21).diagnose(),n.get(11).syncConversationList(n._incrementalPullContactFlag).then(function(){A.l("".concat(o,", sync conversation list ok.")),n.get(25).start()}),e=n.get(7),e&&e.updateLocalMainSequenceOnReconnected(),e=n.get(10),e.resetGetTopicTime(),e.getTopicListOnReconnected(),e=n.get(35);e&&e.getMyFollowInfoOnReconnected()}))}},{key:"onMultipleAccountKickedOut",value:function(e){this.get(1).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.get(1).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.get(1).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.get(1).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.req({proto:v.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFrequencyOverLimit",value:function(e){e=e.split(".")[1];if(!this._commandFrequencyLimitMap.has(e))return!1;if(!this._commandRequestInfoMap.has(e))return this._commandRequestInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;var t=this._commandFrequencyLimitMap.get(e),n=t.count,t=t.interval,o=this._commandRequestInfoMap.get(e),i=o.startTime,o=o.requestCount;return Date.now()-i>1e3*t?(this._commandRequestInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this._commandRequestInfoMap.set(e,{startTime:i,requestCount:o+=1}),n=this._expiredTime}},{key:"fetchConfig",value:function(){var t,n=this,e=this._canFetchConfig();A.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(e)),e&&(t=new M("fetchCloudControlConfig"),e=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({proto:v.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:e,version:this._version}}).then(function(e){n._isFetching=!1,t.setMessage("version:".concat(n._version," newVersion:").concat(e.data.version," config:").concat(e.data.cloudControlConfig)).end(),A.l("".concat(n._n,".fetchConfig ok")),n._parseCloudControlConfig(e.data)}).catch(function(e){n._isFetching=!1,t.setError(e).end(),A.l("".concat(n._n,".fetchConfig failed. error:"),e),n._setExpiredTimeOnResponseError(12e4)}))}},{key:"onPushedCloudControlConfig",value:function(e){A.l("".concat(this._n,".onPushedCloudControlConfig")),new M("pushedCloudControlConfig").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,i=e.errorMessage,a=e.cloudControlConfig,s=e.version,r=e.expiredTime;if(0===o){if(this._version!==s){var c=null;try{c=JSON.parse(a)}catch(e){this.isPrivateNetWork()||A.e("".concat(n," JSON parse error. cloudControlConfig:"),a)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach(function(e){t._cloudConfig.set(e,c[e])}),this._version=s,this.emitInnerEvent(mo.CLOUD_CONFIG_UPDATED))}this._expiredTime=Date.now()+1e3*r}else R(o)?(A.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(A.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(i)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){A.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),Wr),qs=(t(Kr,On),Ps=f(Kr),e(Kr,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var n,o,i,a,s=this,e=this._getLocalConversationList().filter(function(e){return e.type===S.CONV_GROUP&&e.groupProfile.type!==S.GRP_AVCHATROOM}),r=this.get(11),c=[];e.forEach(function(e){var t=e.conversationID,e=e.lastMessage;n=t.replace(S.CONV_GROUP,""),o=r.getLocalLastMessage(t),e&&0!==e.lastSequence&&o?(i=e.lastSequence,o=o.sequence,a=i-o,0o[0]&&n",e[i].tag)}this.timestamp=Date.now(),o.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){e=this.groupList.indexOf(e);-1 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),(t=this)._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,A.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");A.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),R(e)||"1"===e?!this._isWorkerEnabled&&ve&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&ve&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){A.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(){A.l("".concat(this._n,".reset"))}}]),Or),$s=(e(Nr,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._featureMap.clear();for(var t,n=e.length-1,o=0;0<=n;n--,o++)t=(o<32?new F(0,Math.pow(2,o)):new F(Math.pow(2,o-32),0)).toString(),"1"===e[n]?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else A.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._featureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t="".concat(this._n,".isFeatureEnabled"),n=parseInt(e).toString(2),o=void 0,i=!0,a=n.length-1,s=0;0<=a;a--,s++)if("1"===n.charAt(a)){if(o=(s<32?new F(0,Math.pow(2,s)):new F(Math.pow(2,s-32),0)).toString(),!this._featureMap.get(o)){i=!1;break}var r,c="",u=0;o===H.PLUGIN_TRANSLATE?(c="plugin_translate",u=16):o===H.PLUGIN_VOICE_TO_TEXT?(c="plugin_voice_to_text",u=17):o===H.PLUGIN_CS?(c="plugin_cs",u=14):o===H.PLUGIN_PUSH?(c="plugin_push",u=13):o===H.PLUGIN_BOT&&(c="plugin_bot",u=15),""!==c&&(r=this._commercialConfigM.get(12).getUIPlatform(),new M(c).setCode(u).setUIPlatform(r).end(),A.l("".concat(t," ").concat(c," code:").concat(u," uiPlatform:").concat(r)))}return A.l("".concat(t," decimalNumber:").concat(e," key:").concat(o," ret:").concat(i)),yn({enabled:i})}},{key:"clear",value:function(){this._featureMap.clear()}}]),Nr),er=(e(kr,[{key:"_canFetch",value:function(){return this.get(12).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 t,e,n=this,o=this._canFetch(),i="".concat(this._n,".fetchConfig");A.l("".concat(i," canFetch:").concat(o)),o&&(t=new M("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),e=this.get(20),this._isFetching=!0,e.req({proto:v.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:o}}).then(function(e){t.setMessage("purchaseBits:".concat(e.data.purchaseBits)).end(),A.l("".concat(i," ok.")),n._parseConfig(e.data),n._isFetching=!1}).catch(function(e){t.setError(e).end(),n._isFetching=!1}))}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));A.l("".concat(t)),new M("pushedCommercialConfig").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,i=e.purchaseBits,a=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(i),this._expiredTime=Date.now()+1e3*a):R(n)?(A.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(A.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:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){A.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),kr),tr=(t(Rr,On),ks=f(Rr),e(Rr,[{key:"registerPlugin",value:function(e){var t,n,o,i,a,s,r,c,l,d,p,_,u;$?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(u=e.offlinePushConfig||{}).huaweiBusinessID,n=u.xiaomiBusinessID,o=u.xiaomiAppID,i=u.xiaomiAppKey,a=u.meizuBusinessID,s=u.meizuAppID,r=u.meizuAppKey,c=u.vivoBusinessID,l=u.oppoBusinessID,d=u.oppoAppKey,p=u.oppoAppSecret,_=u.honorBusinessID,u=u.iosBusinessID,this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=o,this._androidPushConfig.xiaomiPushAppKey=i,this._androidPushConfig.meizuPushBussinessId=a,this._androidPushConfig.meizuPushAppId=s,this._androidPushConfig.meizuPushAppKey=r,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,this._androidPushConfig.honorPushBussinessId=_,new M("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!R(this._offlinePushPlugin))).end(!0),A.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=u,this._setAppShowListener()):this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var c,u=this,l="".concat(this._n,".").concat("_getDeviceToken");$e(this._offlinePushPlugin.getDeviceToken)?(c="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),A.l("".concat(l," start. ").concat(c)),new M("_getDeviceToken").setMessage("".concat(c)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(e){var t,n,o,i,a=new M("getDeviceTokenRes"),s=e.code,r=e.msg;0===s?(t=(i=e.data).deviceToken,n=i.deviceBrand,o=i.deviceType,i=i.bussinessId,u._deviceToken=t,u._businessID=i||u._iosBusinessID,c="deviceToken:".concat(t,", deviceBrand:").concat(n||o,", businessID:").concat(u._businessID),A.l("".concat(l," ok. ").concat(c)),a.setMessage(c).end(!0),u._setToken()):(a.setMessage("code:".concat(s,", msg:").concat(r)).end(!0),A.e("".concat(l," failed. error:"),e))})):A.e("".concat(l," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return $&&!R(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var t=this,n="".concat(this._n,".").concat("_setAppShowListener");R(this._offlinePushPlugin)?A.e("".concat(n," offlinePushPlugin is undefined")):$e(this._offlinePushPlugin.setAppShowListener)?(new M("_setAppShowListener").end(!0),A.l("".concat(n," start")),this._offlinePushPlugin.setAppShowListener(function(e){e=(e||{}).appShow;new M("setAppShowListenerRes").setMessage("appShow:".concat(e)).end(!0),A.l("".concat(n," ok. appShow:").concat(e)),t._m.isReady()&&(0===e?(t._getConvUnreadCount(),t._onBackground()):1===e&&t._onForeground())})):A.e("".concat(n," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!R(this._offlinePushPlugin)&&$e(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,A.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var t="".concat(this._n,"._setToken"),e=this.get(12),n=1,o="",i="",a=(We(this._deviceToken)&&(n=0),this.getUniAppPlatform()),s=this.getDeviceBrand(),r=(a===w.IOS||a===w.IPAD||a===w.MAC?i=this._deviceToken:a===w.ANDROID&&(o=this._deviceToken),new M("offlinePushSetToken")),a="deviceToken:".concat(i||o,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(s,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(a);return r.setMessage("".concat(a)),A.l("".concat(t," ").concat(a)),this.req({proto:v.SET_TOKEN,data:{tokenID:o,pushMsg:n,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:s,deviceToken:i,isWebUniapp:this._isWebUniapp}}).then(function(e){return r.end(),A.l("".concat(t," ok")),e}).catch(function(e){return r.setError(e).end(),A.e("".concat(t," failed. error:"),e),m(e)})}},{key:"_getConvUnreadCount",value:function(){var t=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConversationList().forEach(function(e){e.type===S.CONV_C2C&&(t._c2cUnreadCount+=e.unreadCount),e.type===S.CONV_GROUP&&(t._groupUnreadCount+=e.unreadCount)})}},{key:"_onBackground",value:function(){var t=this,n="".concat(this._n,".").concat("_onBackground"),o=new M("_onBackground");this.req({proto:v.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(e){return o.setMessage("c2cUnreadCount: ".concat(t._c2cUnreadCount,", groupUnreadCount: ").concat(t._groupUnreadCount)).end(),A.l("".concat(n," ok")),e}).catch(function(e){o.setError(e).end(),A.e("".concat(n," failed. error:"),e)})}},{key:"_onForeground",value:function(){var t="".concat(this._n,".").concat("_onForeground"),n=new M("_onForeground");this.req({proto:v.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(e){return n.end(),A.l("".concat(t," ok")),e}).catch(function(e){n.setError(e).end(),A.e("".concat(t," failed. error:"),e)})}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?w.IOS:"android"===e?w.ANDROID:1002===t?w.IPAD:1001===t?w.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,A.l("".concat(this._n,".reset"))}}]),Rr),nr=(t(Ar,On),Rs=f(Ar),e(Ar,[{key:"init",value:function(){var e=this.get(18).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:A,isArray:Ze,isMap:Ye,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 t=e.type,o=e.conversationType;if(t!==S.MSG_TEXT&&t!==S.MSG_CUSTOM)return n;var i,a="".concat(this._n,".filterMessage");if(A.l("".concat(a)),t===S.MSG_TEXT){if(o===S.CONV_C2C?i="c2c_text_message":o===S.CONV_GROUP&&(i="group_text_message"),!this._isConfigOn(i))return n;var s=this._plugin.filter(e.payload.text),r=s.type,s=s.modifiedText;1===r?n=!1:2===r&&(e.payload.text=s)}else if(t===S.MSG_CUSTOM){if(o===S.CONV_C2C?i="c2c_custom_message":o===S.CONV_GROUP&&(i="group_custom_message"),!this._isConfigOn(i))return n;r=this._plugin.filter(e.payload.data),s=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension);1===r.type||1===s.type||1===t.type?n=!1:(2===r.type&&(e.payload.data=r.modifiedText),2===s.type&&(e.payload.description=s.modifiedText),2===t.type&&(e.payload.extension=t.modifiedText))}return A.l("".concat(a," 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;A.l("".concat(n));t=this._plugin.filter(e),e=t.type,t=t.modifiedText;return 1===e?o.isAllowedToSend=!1:2===e&&(o.modifiedText=t),A.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var l=this,d=new M("profanityFilter"),p="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({proto:v.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then(function(e){var e=e.data,t=e.errorInfo,n=e.filterConfig,o=e.lexicon,i=e.strToken,a=e.completeFlag,s=e.nextStartIndex,r=e.version,e=e.expiredTime,c=t.errorCode,u=t.errorMessage;return 0!==c?(l._isFetching=!1,A.w("".concat(p," failed. error:"),t),void d.setCode(c).setMessage(u).end()):(l._onFilterConfig(n),l._getToken(i),1===a?(A.l("".concat(p," done. version:").concat(r," expiredTime:").concat(e)),l._version=r,l._canIUseLexicon=!0,l._isFetching=!1,l._expiredTime=Date.now()+1e3*e,void l._plugin.onLexiconCompleted(o)):(l._startIndex=s,l._plugin.onLexiconSliced(o),void l._getLexicon()))}).catch(function(e){d.setError(e).end(),l._isFetching=!1,A.l("".concat(p," failed. error:"),e)})}},{key:"_onFilterConfig",value:function(t){var n=this;We(t)||(this._filterConfigMap.clear(),Object.keys(t).forEach(function(e){n._filterConfigMap.set(e,t[e])}),A.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(dt(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n=(n+=e[o+1])+e[o];else{for(var i=0;i=this.STORAGE_EXPIRES_TIME,e=!e||"3.2.4"!==e;return A.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(e)),t||e}},{key:"_fetch",value:function(){var e,t,n,o,i,a;this._m.get(12).isPrivateNetWork()||(e="https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.4/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this,te?oe.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),A.l("".concat(n," mini program"))},fail:function(){}}):(i=new XMLHttpRequest,a=setTimeout(function(){i.abort()},3e3),i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(a),200!==i.status&&304!==i.status||(A.l("".concat(n," browser")),o._fillAndSave(i.responseText)))},i.open("GET",e,!0),i.setRequestHeader("Content-type",t),i.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:"3.2.4"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.get(13)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o=e.split(";\n"),i=o.length,a=new RegExp(/'/g),s=0;s(new Date).getTime()-this.EXPIRED_TIME}},{key:"_getValidConversationList",value:function(e){for(var t=[],n=0;nthis.MAX_COUNT?this.MAX_COUNT:e,this._myFollowersList.clear(),this._myFollowingList.clear(),this._myMutualFollowersList.clear())}},{key:"getMyFollowInfoOnReconnected",value:function(){this.getUserFollowInfo()}},{key:"onFollowInfoNotify",value:function(e){var e=e.dataList||{},t=e.followAddList,t=void 0===t?[]:t,n=e.followDeleteList,n=void 0===n?[]:n,o=e.pushType,e=e.from,i=this._initFollowInfo();1===o?this._handleFollowAddList({from:e,followAddList:t,followInfo:i}):this._handleFollowDeleteList({from:e,followDeleteList:n,followInfo:i}),this._setMyFollowInfo({followersCount:i[pr.FOLLOWERS].count,followingCount:i[pr.FOLLOWING].count,mutualFollowersCount:i[pr.MUTUAL].count}),this._emitEvent(i),A.l("".concat(this._n,".onFollowInfoNotify from:").concat(e," pushType:").concat(o," followAddList:").concat(t.length," followDeleteList:").concat(n.length))}},{key:"_initFollowInfo",value:function(){var e,t=this._getMyFollowInfo(),n=t.followersCount,o=t.followingCount,o=void 0===o?0:o,t=t.mutualFollowersCount,t=void 0===t?0:t;return c(e={},pr.FOLLOWERS,{count:void 0===n?0:n,addList:[],deleteList:[]}),c(e,pr.FOLLOWING,{count:o,addList:[],deleteList:[]}),c(e,pr.MUTUAL,{count:t,addList:[],deleteList:[]}),e}},{key:"_handleFollowAddList",value:function(e){var t=this,n=e.from,o=e.followAddList,i=e.followInfo;o.forEach(function(e){e.followType===pr.MUTUAL&&(n===t.getMyUserID()?(i[pr.FOLLOWERS].count--,i[pr.FOLLOWERS].deleteList.push(e.userID)):(i[pr.FOLLOWING].count--,i[pr.FOLLOWING].deleteList.push(e.userID))),i[e.followType].count++,i[e.followType].addList.push(e)})}},{key:"_handleFollowDeleteList",value:function(e){var t=this,n=e.from,o=e.followDeleteList,i=e.followInfo;o.forEach(function(e){e.followType===pr.NONE&&(n===t.getMyUserID()?(i[pr.FOLLOWING].count--,i[pr.FOLLOWING].deleteList.push(e.userID)):(i[pr.FOLLOWERS].count--,i[pr.FOLLOWERS].deleteList.push(e.userID))),e.followType!==pr.FOLLOWERS&&e.followType!==pr.FOLLOWING||(n===t.getMyUserID()?(i[pr.FOLLOWERS].count++,i[pr.FOLLOWERS].addList.push(e)):(i[pr.FOLLOWING].count++,i[pr.FOLLOWING].addList.push(e)),i[pr.MUTUAL].count--,i[pr.MUTUAL].deleteList.push(e.userID))})}},{key:"_emitEvent",value:function(n){var o=this;Object.values(pr).forEach(function(e){var t={totalCount:n[e].count<0?0:n[e].count,addUserInfoList:n[e].addList,deleteUserIDList:n[e].deleteList};(0"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log("IM SDK API ->",t)),(t=this.getErrorMessage("DOCS_GUIDE"))&&console.log(t),t=this.getErrorMessage("IOS_WEBVIEW_WARNING"),ye&&t&&console.warn(t)),A.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._get(2).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._get(2).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._get(2).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._get(2).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._get(2).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._get(2).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._get(2).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._get(2).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==S.MSG_MERGER?m({code:C.MSG_MERGER_TYPE_INVALID}):We(e.payload.downloadKey)?m({code:C.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch(function(e){return m({code:C.MSG_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof go?this._get(2).sendMessageInstance(e,t):m({code:C.MSG_INSTANCE_REQUIRED})}},{key:"searchCloudMessages",value:function(e){return this._get(2).searchCloudMessages(e)}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._get(31).sendMessage(t):"handleGroupInvitation"===e?this._get(7).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(27).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(30).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):"getServerConfig"===e?this._get(23).getServerConfig(t):m({code:C.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof go?this._get(2).resendMessage(e,t):m({code:C.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._get(2).deleteMessage(e)}},{key:"translateText",value:function(e){return this._get(2).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._get(2).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._get(3).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._get(3).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._get(3).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._get(34).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._get(34).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._get(34).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._get(34).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._get(2).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._get(11).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._get(11).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._get(11).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._get(11).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._get(7);return t?t.getReadReceiptDetail(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConversationDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():m({code:C.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():m({code:C.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():m({code:C.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():m({code:C.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():m({code:C.CANNOT_FIND_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._get(10).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._get(10).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._get(10).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._get(10).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._get(10).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var o=this._get(33);o&&o.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var o,i=this._safetyCallbackFactory.find(e,t);null===i||(o=this._get(33))&&(o.removeSignalingListener(e,i,n),this._safetyCallbackFactory.delete(e,t))}},{key:"invite",value:function(e){var t=this._get(33);return t?t.invite(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"inviteSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._get(33);return t?t.invite(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._get(33);return t?t.cancel(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):m({code:C.CANNOT_FIND_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._get(33);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._get(33);return t?t.modifyInvitation(e):m({code:C.CANNOT_FIND_MODULE})}}]),vr),mr={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function vr(e){u(this,vr);e={SDKAppID:e.SDKAppID,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,instanceID:kt(),devMode:e.devMode||!1,proxyServer:e.proxyServer||void 0,fileUploadProxy:e.fileUploadProxy||void 0,fileDownloadProxy:e.fileDownloadProxy||e.fileUploadProxy||void 0,modules:e.modules||void 0};this._m=new gr(e),this._vendorMap=new Map,this._safetyCallbackFactory=new hr(this._m)}function Mr(e){u(this,Mr),this._funcMap=new Map,this._m=e,this._n="SafetyCallback",this._reportCount=0}function Ir(t){var n=this;u(this,Ir);var o,e=new M("sdkConstruct"),i=(this._n="ModuleManager",this._isReady=!1,this._reason=C.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(12,new Ci(this,t)),this._moduleMap.set(15,new ia(this)),this._moduleMap.set(27,new er(this)),this._moduleMap.set(23,new ws(this)),this._moduleMap.set(24,new Zs(this)),this._moduleMap.set(26,new Ks(this)),this._moduleMap.set(21,new cs(this)),this._moduleMap.set(20,new bs(this)),this._moduleMap.set(1,new Di(this)),this._moduleMap.set(2,new Pa(this)),this._moduleMap.set(3,new Ua(this)),this._moduleMap.set(34,new Fa(this)),this._moduleMap.set(31,new ba(this)),this._moduleMap.set(4,new yi(this)),this._moduleMap.set(6,new ho(this)),this._moduleMap.set(11,new ti(this)),this._moduleMap.set(7,new _i(this)),this._moduleMap.set(10,new fi(this)),this._moduleMap.set(13,new $i(this)),this._moduleMap.set(32,new ir(this)),this._moduleMap.set(14,new ta(this)),this._moduleMap.set(17,new ga(this)),this._moduleMap.set(18,new wa(this)),this._moduleMap.set(19,new qa(this)),this._moduleMap.set(25,new qs(this)),this._moduleMap.set(8,new Qs(this)),this._moduleMap.set(28,new tr(this)),this._moduleMap.set(29,new nr(this)),this._moduleMap.set(30,new or(this)),this._moduleMap.set(33,new dr(this)),this._moduleMap.set(35,new _r(this)),this._eventThrottleMap=new Map,Qe(t.modules)?(Object.keys(t.modules).forEach(function(e){o=t.modules[e],"group-module"===e?n._moduleMap.set(7,new o(n)):"relationship-module"===e?n._moduleMap.set(8,new o(n)):"signaling-module"===e?n._moduleMap.set(33,new o(n)):"follow-module"===e&&n._moduleMap.set(35,new o(n))}),this._moduleMap.get(12).setUsingChatCore(!0)):this._moduleMap.has(7)||this._moduleMap.get(12).setUsingChatCore(!0),t.instanceID),a=t.SDKAppID,s=this._moduleMap.get(12).isIntl(),r=this._moduleMap.get(12).isUsingChatCore(),i="instanceID:".concat(i," SDKAppID:").concat(a," isIntl:").concat(s," isUsingChatCore:").concat(r," host:").concat(Nt()," isIOSWebView:").concat(ye)+" inBrowser:".concat(ne," inMiniApp:").concat(te)+" workerAvailable:".concat(ve," UserAgent:").concat(ie);M.bindEventStatModule(this._moduleMap.get(14)),M.bindNetMonitorModule(this._moduleMap.get(15)),e.setMessage("".concat(i," ").concat(function(){var t="";if(te)try{var e=oe.getSystemInfoSync(),n=e.model,o=e.version,i=e.system,a=e.platform,s=e.SDKVersion,t="model:".concat(n," version:").concat(o," system:").concat(i," platform:").concat(a," SDKVersion:").concat(s)}catch(e){t=""}return t}())).end(),A.i("SDK ".concat(i)),Fn.prototype._getErrorMessage=this.getErrorMessage.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}function yr(e){u(this,yr),(e=Ss.call(this,e))._n="FollowModule",e._myFollowersList=new Map,e._myFollowingList=new Map,e._myMutualFollowersList=new Map,e._myFollowInfo=new Map,e.MAX_CATCH_TIME=6e5,e.FIRST_PAGE_INDEX=st(),e.DEFAULT_COUNT=100,e.MAX_COUNT=1e3;var t=e.getInnerEmitterInstance();return t.on(mo.A2KEY_AND_TINYID_UPDATED,e._init,g(e)),t.on(mo.CLOUD_CONFIG_UPDATED,e._onCloudConfigUpdated,g(e)),e}function Cr(e){return u(this,Cr),(e=As.call(this,e))._n="SignalingModule",e._inviteInfoMap=new Map,e._outerEmitter=new pa,e._outerEmitter._emit=e._outerEmitter.emit,e._outerEmitter.emit=function(){this._outerEmitter._emit.apply(this._outerEmitter,[].concat([arguments.length<=0?void 0:arguments[0],{name:arguments.length<=0?void 0:arguments[0],data:arguments.length<=1?void 0:arguments[1]}]))}.bind(g(e)),e._canIUseSignaling=!1,e._isHandling=!1,e._remoteSignalingHandler=new ar(g(e)),e._localSignalingHandler=new sr(g(e)),e._historySignalingHandler=new rr(g(e)),e._isC2CUnreadHandleCompleted=!1,e._isConvSyncCompleted=!1,e._isSyncCompleted=!1,e.getInnerEmitterInstance().on(mo.C2C_UNREAD_HANDLE_COMPLETED,e.onC2CUnreadHandleCompleted,g(e)),e.getInnerEmitterInstance().on(mo.CONV_SYNC_COMPLETED,e.onConvSyncCompleted,g(e)),e}function Tr(e){u(this,Tr),this._n="HistorySignalingHandler",this._sigM=e,this.EXPIRED_TIME=3e4,this.COUNT=20,this._signalingMap=new Map,this._signalingRelatedToMeMap=new Map}function Dr(e){u(this,Dr),this._n="LocalSignalingHandler",this._sigM=e}function Lr(e){u(this,Lr),this._n="RemoteSignalingHandler",this._sigM=e}function Er(e){u(this,Er),this._m=e,this._n="ErrorMessageModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this._map=new Map,this._init()}function Sr(e){u(this,Sr),this._m=e,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getInnerEmitterInstance().on(mo.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}function Ar(e){return u(this,Ar),(e=Rs.call(this,e))._n="ProfanityFilterModule",e._plugin=null,e._filterConfigMap=new Map,e._startIndex=0,e._version=0,e._canIUseLexicon=!1,e._isFetching=!1,e._expiredTime=0,e}function Rr(e){var t;return u(this,Rr),(t=ks.call(this,e))._m=e,t._n="OfflinePushModule",t._offlinePushPlugin=void 0,t._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},t._deviceToken="",t._businessID=0,t._iosBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t}function kr(e){u(this,kr),this._m=e,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new $s(this)}function Nr(e){u(this,Nr),this._commercialConfigM=e,this._n="PurchasedFeatureHandler",this._featureMap=new Map}function Or(e){return u(this,Or),(e=Ns.call(this,e))._n="WorkerTimerModule",e._isWorkerEnabled=!0,e._workerTimer=null,e._timerID=-1,e._init(),e.getInnerEmitterInstance().on(mo.CLOUD_CONFIG_UPDATED,e._onCloudConfigUpdated,g(e)),e}function Gr(e){return u(this,Gr),(e=Os.call(this,e))._n="SnsModule",e._friendHandler=new Js(g(e)),e._friendApplicationHandler=new Ys(g(e)),e._friendGroupHandler=new Xs(g(e)),e.getInnerEmitterInstance().on(mo.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,g(e)),e}function Pr(e){u(this,Pr),this._snsM=e,this._n="FriendGroupHandler",this._friendGroupMap=new Map}function Ur(e){u(this,Ur),We(e)||(this.name=e.name||"",this.userIDList=e.userIDList||[],this.count=this.userIDList.length||0)}function Fr(e){u(this,Fr),this._snsM=e,this._n="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}function br(e,t){u(this,br),this.userID=e,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var n={},o=[];if(n.userID=e,!We(t))for(var i,a="",s=0,r=t.length;s",t[s].tag)}this.profile=new jo(y(y({},n),{},{profileCustomField:o}))}function wr(e){u(this,wr),this._snsM=e,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}function qr(e){u(this,qr),(e=Gs.call(this,e))._n="QualityStatModule",e.TAG="im-ssolog-quality-stat",e.reportIndex=0,e.wholePeriod=!1,e._qualityItems=[wn,qn,xn,Vn,Hn,Bn,Kn,Wn,Yn,jn],e._messageSentItems=[xn,Vn,Hn,Bn,Kn],e._messageReceivedItems=[Wn,Yn,jn],e.REPORT_INTERVAL=120,e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._statInfoArr=[],e._avgRTT=new Vs,e._avgE2EDelay=new xs,e._rateMessageSent=new Hs,e._rateMessageReceived=new Bs;var t=e.getInnerEmitterInstance();return t.on(mo.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,g(e)),t.on(mo.CLOUD_CONFIG_UPDATED,e._onCloudConfigUpdated,g(e)),e}function xr(){u(this,xr),this._lastMap=new Map,this._currentMap=new Map}function Vr(){u(this,Vr),this._map=new Map}function Hr(){u(this,Hr),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}function Br(){u(this,Br),this._n="AvgE2EDelay",this._e2eDelayArray=[]}function Kr(e){return u(this,Kr),(e=Ps.call(this,e))._n="RecoverMessageModule",e.PULL_LIMIT_COUNT=15,e}function Wr(e){return u(this,Wr),(e=Us.call(this,e))._n="CloudControlModule",e._cloudConfig=new Map,e._expiredTime=0,e._version=0,e._isFetching=!1,e}function Yr(e){return u(this,Yr),(e=Fs.call(this,e))._n="SessionModule",e._platform=e.getPlatform(),e._protocolHandler=new ds(g(e)),e._messageDispatcher=new _s(g(e)),e._commandFrequencyLimitMap=new Map,e._commandRequestInfoMap=new Map,e._serverOverloadInfoMap=new Map,e._incrementalPullContactFlag=!0,e._init(),e.getInnerEmitterInstance().on(mo.CLOUD_CONFIG_UPDATED,e._onCloudConfigUpdated,g(e)),e}var jr={},ae={};return ae.create=function(e){var t="TencentCloudChat.create",n=0,o=e.SDKAppID;if(ze(o))n=o;else if(n=parseInt(o),isNaN(o))return A.e("".concat(t," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&jr[n])return jr[n];A.l("".concat(t));var i,a,o=new fr(y(y({},e),{},{SDKAppID:n})),e=(o.on(G.SDK_DESTROY,function(e){jr[e.data.SDKAppID]=null,delete jr[e.data.SDKAppID]}),i=o,a=Object.create(null),Object.keys(Un).forEach(function(o){var t;i[o]&&(t=new U,a[o]=function(){var e=Array.from(arguments);return t.use(function(e,t){var n=function(e,t){if(e.isReady()||1===mr[t])return!0;var n={code:n=e.getNotReadyReason(),message:"".concat(e.getErrorMessage(n)," | ").concat(t," | ").concat(e.getErrorMessage(C.SDK_IS_NOT_READY))};return e.onError(n),n}(i,o);return!0===n?t():m(n)}).use(function(e,t){if(!0===function(n,o,i){if(void 0===o)return!0;var a=!0;if(Qe(o))Object.keys(o).forEach(function(e){var t=1===n.length?n[0][e]:void 0;a=!!Xt(t,o[e],i,e)&&a});else if(Ze(o))for(var e=0;e