1 line
454 KiB
JavaScript
1 line
454 KiB
JavaScript
"use strict";const e={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",ALL_RECEIVE_MESSAGE_OPT_UPDATED:"onAllReceiveMessageOptUpdated"},t={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_ROOM:"Room",GRP_LIVE:"Live",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",RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",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,IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"};class s{constructor(){this.cache=[],this.options=null}use(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}next(e){if(this.middlewares&&0<this.middlewares.length)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}run(e){return this.middlewares=this.cache.map(function(e){return e}),this.options=e,this.next()}}class i{constructor(e=0,t=0){this.high=e,this.low=t}equal(e){return null!==e&&this.low===e.low&&this.high===e.high}toString(){var e=Number(this.high).toString(16);let t=Number(this.low).toString(16);if(t.length<8){let e=8-t.length;for(;e;)t="0"+t,e--}return e+t}}const n={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"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},o={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,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},r="1.7.3",a=537048168,c="CHINA",l="OVERSEA",u="SINGAPORE",d="KOREA",_="GERMANY",h="IND",p="JPN",g="USA",m="INDONESIA",f={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent(e=c){this.CURRENT=n.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_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_MSG:"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",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},M={SEARCH_GRP_SNS:new i(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new i(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new i(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new i(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new i(0,Math.pow(2,6)).toString(),USER_STATUS:new i(0,Math.pow(2,7)).toString(),CONV_MARK:new i(0,Math.pow(2,9)).toString(),CONV_GROUP:new i(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new i(0,Math.pow(2,11)).toString(),MSG_EXT:new i(0,Math.pow(2,13)).toString(),GRP_COUNTER:new i(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new i(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new i(Math.pow(2,7)).toString(),PLUGIN_CS:new i(Math.pow(2,8)).toString(),PLUGIN_PUSH:new i(Math.pow(2,9)).toString(),PLUGIN_BOT:new i(Math.pow(2,10)).toString(),MSG_REACTION:new i(Math.pow(2,16)).toString(),FOLLOW:new i(Math.pow(2,20)).toString()},I="c2c_text_message",C="c2c_custom_message",T="group_text_message",y="group_custom_message",v="user_profile",E="group_profile",S=(f.HOST.setCurrent(c),"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting)),D=S&&"function"==typeof wx.createGamePortal,R="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),L="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),A="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),O="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),N="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,P="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,U=S&&"object"==typeof wx.miniapp,G="undefined"!=typeof uni,k=S||R||L||A||O||P||N,w="undefined"==typeof window&&!k&&"undefined"!=typeof global&&void 0!==global.NativeScriptGlobals,b="undefined"!=typeof global&&(void 0!==global.nativeModuleProxy||void 0!==global.ReactNative),F="undefined"!=typeof uni?!k:"undefined"!=typeof window&&!k&&!b,$=R?qq:L?tt:A?swan:O?my:S?wx:P?uni:N?jd:{},q=F&&window&&window.navigator&&window.navigator.userAgent||"",x=/(micromessenger|webbrowser)/i.test(q),V=function(){let e="WEB";return x?e="WEB":R?e="QQ_MP":L?e="TT_MP":A?e="BAIDU_MP":O?e="ALI_MP":S?e=U?"DONUT_NATIVE_APP":"WX_MP":P?e="UNI_NATIVE_APP":w?e="NS_NATIVE_APP":b&&(e="RN_NATIVE_APP"),o[e]}(),B=/iPad/i.test(q),K=/iPhone/i.test(q)&&!B,H=/iPod/i.test(q),W=K||B||H,Y=function(){var e=q.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),z=/Android/i.test(q),j=function(){var e=q.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),s=e[2]&&parseFloat(e[2]);return t&&s?parseFloat(e[1]+"."+e[2]):t||null}(),J=/Edge/i.test(q),X=!J&&/Chrome/i.test(q),Z=/MSIE/.test(q)||-1<q.indexOf("Trident")&&-1<q.indexOf("rv:11.0"),Q=function(){var e=/MSIE\s(\d+)\.\d/.exec(q);let t=e&&parseFloat(e[1]);return t=!t&&/Trident\/7.0/i.test(q)&&/rv:11.0/.test(q)?11:t}(),ee=/Safari/i.test(q)&&!X&&!z&&!J,te=/Windows/i.test(q),se=/MAC OS X/i.test(q),ie=F&&"undefined"!=typeof Worker&&!Z,ne=z||W,oe=F&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,re=function(){if("undefined"==typeof window||void 0===window.navigator)return!1;var e=window.navigator.standalone;return!(!W||e||ee)}();let ae,ce;ae="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};const le=function(){},ue=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];let de=ue.length;for(;de--;)ce=ue[de],console[ce]||(ae[ce]=le);var _e=ae;let he=0;const pe=function(){return(new Date).getTime()+he},ge=function(){he=0},me=function(){return Math.floor(pe()/1e3)};let fe=0;function Me(){return Et()?"%c Chat %c":"Chat"}function Ie(){const e=function(){const e=new Date;return e.setTime(pe()),e}();return e.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){let t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(e.getMilliseconds())}const Ce={arguments2String(s){let i="";if(1===s.length)i=s[0];else for(let e=0,t=s.length;e<t;e++){if(qe(s[e]))try{i+=Ve(s[e])?JSON.stringify(s[e],["message","code"]):JSON.stringify(s[e])}catch(e){i+=e?e.message:"";break}else i+=s[e];i+=" "}return i},_exec(e,t){Et()?_e[e](Me(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Ie(),t):_e[e](`${Me()} ${Ie()} `+t)},d:function(){var e;fe<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;fe<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;fe<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;fe<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;fe<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;fe<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+fe+" to "+e),fe=e},getLevel:function(){return fe}},Te={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},ye={NICK:"Tag_Profile_IM_Nick",GENDER:"Tag_Profile_IM_Gender",BIRTHDAY:"Tag_Profile_IM_BirthDay",LOCATION:"Tag_Profile_IM_Location",SELFSIGNATURE:"Tag_Profile_IM_SelfSignature",ALLOWTYPE:"Tag_Profile_IM_AllowType",LANGUAGE:"Tag_Profile_IM_Language",AVATAR:"Tag_Profile_IM_Image",MESSAGESETTINGS:"Tag_Profile_IM_MsgSettings",ADMINFORBIDTYPE:"Tag_Profile_IM_AdminForbidType",LEVEL:"Tag_Profile_IM_Level",ROLE:"Tag_Profile_IM_Role"},ve="Gender_Type_",Ee={UNKNOWN:ve+"Unknown",FEMALE:ve+"Female",MALE:ve+"Male"},Se={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},De={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Re="@TGS#_",Le="@TOPIC#_",Ae=Object.prototype.hasOwnProperty;function Oe(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(be(e)){for(const t in e)if(Ae.call(e,t))return!1;return!0}return!!(Ne(e)||Pe(e)||Ue(e))&&0===e.size}const Ne=function(e){return"map"===Ke(e)},Pe=function(e){return"set"===Ke(e)},Ue=function(e){return"file"===Ke(e)},Ge=function(e){return null!==e&&("number"==typeof e&&!isNaN(+e)||"object"==typeof e&&e.constructor===Number)},ke=function(e){return"string"==typeof e},we=function(e){return null!==e&&"object"==typeof e},be=function(e){if("object"!=typeof e||null===e)return!1;e=Object.getPrototypeOf(e);if(null===e)return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return e===t},Fe=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===Ke(e)},$e=function(e){return void 0===e},qe=function(e){return Fe(e)||we(e)},xe=function(e){return"function"==typeof e},Ve=function(e){return e instanceof Error},Be=function(e){return"filelist"===Ke(e)},Ke=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},He=function(e){if("string"!=typeof e)return!1;e=e[0];return!/[^a-zA-Z0-9]/.test(e)},We=(Date.now||(Date.now=function(){return(new Date).getTime()}),function(s,i,n,o){if(!qe(s)||!qe(i))return 0;let r=0;var a,c=Object.keys(i);for(let e=0,t=c.length;e<t;e++)if(a=c[e],!($e(i[a])||n&&n.includes(a)))if(qe(s[a])&&qe(i[a]))r+=We(s[a],i[a],n,o);else{if(o&&o.includes(i[a]))continue;s[a]!==i[a]&&(s[a]=i[a],r+=1)}return r}),Ye=function(e,t){const s=new Map;for(var[i,n]of e.entries())n&&s.set(i,t?JSON.stringify(n):JSON.parse(JSON.stringify(n)));return s},ze=function(e){if(0===e.length)return 0;let t=0,s=0,i;for(var n="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)i=e[t++].charCodeAt[t]<=255?1:!1===n?3:2,s+=i;return s},je=function(e){e=e||99999999;return Math.round(Math.random()*e)},Je="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Xe=Je.length,Ze=function(e,t){for(const s in e)if(e[s]===t)return!0;return!1},Qe={},et=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")};function st(i,e){if(!Fe(i)||!Fe(e))return!1;let n=!1;return e.forEach(({key:t,value:e})=>{const s=i.find(e=>e.key===t);s?s.value!==e&&(s.value=e,n=!0):(i.push({key:t,value:e}),n=!0)}),n}function it(e){if(be(e)&&be(e.webhookInfo)){const t=[];return e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),0!==t.length?t:void 0}}const nt=e=>e===t.GRP_AVCHATROOM,ot=({type:e,groupID:s})=>e===t.GRP_COMMUNITY||(""+s).startsWith(Re)&&!(""+s).includes(Le),rt=e=>(""+e).startsWith(Re)&&(""+e).includes(Le),at=e=>ke(e)&&e.slice(0,3)===t.CONV_C2C,ct=e=>ke(e)&&e.slice(0,5)===t.CONV_GROUP,lt=e=>ke(e)&&e===t.CONV_SYSTEM;function ut(t,s){const i={};return Object.keys(t).forEach(e=>{i[e]=s(t[e],e)}),i}function dt(i){return b?Promise.resolve({width:0,height:0}):k?new Promise((t,e)=>{$.getImageInfo({src:i,success(e){t({width:e.width,height:e.height})},fail(){t({width:0,height:0})}})}):Z&&9===Q?Promise.resolve({width:0,height:0}):new Promise((e,t)=>{let s=new Image;s.onload=function(){e({width:this.width,height:this.height}),s=null},s.onerror=function(){e({width:0,height:0}),s=null},s.src=i})}function _t(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return""+(e()+e())+e()+e()+e()+e()+e()+e()}function ht(){let e="unknown";if(se&&(e="mac"),te&&(e="windows"),W&&(e="ios"),z&&(e="android"),k)try{var t=$.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(e){}return e}function pt(t,s){t=t.split("."),s=s.split(".");const i=Math.max(t.length,s.length);for(;t.length<i;)t.push("0");for(;s.length<i;)s.push("0");for(let e=0;e<i;e++){const i=parseInt(t[e]),n=parseInt(s[e]);if(i>n)return 1;if(i<n)return-1}return 0}function gt(e){const{originUrl:t,originWidth:s,originHeight:i,min:n=198}=e,o=parseInt(s),r=parseInt(i),a={url:void 0,width:0,height:0};if((o<=r?o:r)<=n)a.url=t,a.width=o,a.height=r;else{r<=o?(a.width=Math.ceil(o*n/r),a.height=n):(a.width=n,a.height=Math.ceil(r*n/o));const e=t&&-1<t.indexOf("?")?t+"&":t+"?";a.url=198===n?e+"imageView2/3/w/198/h/198":e+"imageView2/3/w/720/h/720"}if($e(t)){const{url:e,...t}=a;return t}return a}function mt(t){var e=t[2];t[2]=t[1],t[1]=e;for(let e=0;e<t.length;e++)t[e].setType(e)}function ft(e){const t=e["servcmd"];return t.slice(t.indexOf(".")+1)}function Mt(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function It(e,t){return e.includes(t)}function Ct(e,t){return e.includes(t)}function Tt(e){return e.split(Le)[0]}const yt=function(e,s,i){if($e(s))return"";switch(e){case t.MSG_TEXT:return s.text;case t.MSG_IMAGE:return i?"[Image]":"[图片]";case t.MSG_LOCATION:return i?"[Location]":"[位置]";case t.MSG_AUDIO:return i?"[Voice]":"[语音]";case t.MSG_VIDEO:return i?"[Video]":"[视频]";case t.MSG_FILE:return i?"[File]":"[文件]";case t.MSG_CUSTOM:return i?"[Custom Messages]":"[自定义消息]";case t.MSG_GRP_TIP:return i?"[Group Notification]":"[群提示消息]";case t.MSG_GRP_SYS_NOTICE:return i?"[Group System Message]":"[群系统通知]";case t.MSG_FACE:return i?"[Animated Sticker]":"[动画表情]";case t.MSG_MERGER:return i?"[Chat Record]":"[聊天记录]";default:return""}};function vt(t){const s=[];if(!ke(t))return s;var i=t.length;if(0===i)return s;for(let e=i-1;0<=e;e--)"1"===t[e]&&s.push(Math.pow(2,i-e-1));return s}function Et(){return!Z&&!k}function St(e){return"the length of userIDList cannot exceed "+e}function Dt(e,t=!0,s=!0){var i=Date.now();return t?s?i-e+" ms":Math.round((i-e)/1e3)+" s":s?i-e:Math.round((i-e)/1e3)}function Rt(e){let t=e&&1<e?!0:!1;return t}function Lt(s,i,n){if(void 0===i)return!0;let o=!0;if(be(i))Object.keys(i).forEach(e=>{var t=1===s.length?s[0][e]:void 0;o=!!At(t,i[e],n,e)&&o});else if(Fe(i))for(let e=0;e<i.length;e++)o=!!At(s[e],i[e],n,i[e].name)&&o;if(o)return o;throw new Error("Params validate failed.")}function At(e,t,s,i){if(void 0===t)return!0;let n=!0;var o,r;return t.required&&Oe(e)&&(Ce.e(`[${s}] Missing required params: "${i}".`),n=!1),Oe(e)||(o=Ke(e))!==(r=t.type.toLowerCase())&&("asyncfunction"===o&&"function"===r||(Ce.e(`[${s}] Invalid params: type check failed for "${i}". Expected ${t.type}.`),n=!1)),t.validator&&!t.validator(e,s,i)&&(Ce.e(`[${s}] Invalid params: custom validator check failed for "${i}".`),n=!1),n}const Ot="unSend",Nt="success",Pt="fail",Ut="notStart",Gt="pending",kt="resolved",wt="rejected",bt=function(e){if(!e)return!1;if(at(e)||ct(e)||lt(e))return!0;e=gs("InvalidConversationID",e);return e&&Ce.w(e),!1},Ft=function(e){""!==e.desc&&""!==gs("API_REFER")&&Ce.w(`[${e.api}] | ${e.paramName} | ${e.desc}, `+gs("API_REFER")+e.api)},$t=function(){return gs("StringRequiredLog")},qt=function(e){return gs("NonEmptyStringRequiredLog",e)},xt=function(){return gs("NumberRequiredLog")},Vt=function(){return gs("UndefinedNotAllowedLog")},Bt=function(){return gs("FileRequiredLog")},Kt=function(){return gs("FunctionRequiredLog")},Ht=function(){return gs("ArrayRequiredLog")},Wt=function(){return gs("NonEmptyArrayLog")},Yt=function(){return gs("CallbackMissingLog")},zt=function(){return gs("PositiveIntegerRequiredLog")},jt=function(e,t){return gs("StringNotLongerThanLog",e,t)},Jt=function(e,t){return gs("NumberGreaterThanLog",e,t)},Xt=function(e,t){return gs("NumberGreaterOrEqualLog",e,t)},Zt=function(e){return gs("KeyValueStringRequiredLog",e)},Qt=function(){return gs("PlainObjectRequiredLog")},es=function(){return gs("NonEmptyContentRequiredLog")},ts=function(){return gs("FileNotSelectedLog")},ss=function(){return gs("MessageInstanceRequiredLog")},is=function(){return gs("NonAnonymousFunctionLog")},ns=function(){return gs("MessageExtensionNotAvailableLog")},os=function(){return gs("MessageReactionRequiredLog")},rs=function(e,t){return gs("ContainsUnsupportedTypeLog",e,t)},as={type:"String",required:!0},cs={type:"Array",required:!0},ls={type:"Object",required:!0},us={type:"Boolean",required:!0},ds={type:"number",required:!0},_s=function(e,t,s,{allowUndefined:i,allowEmpty:n,maxLength:o}){return $e(e)?!!i||(Ft({api:t,paramName:s,desc:Vt()}),!1):Fe(e)?!(0===e.length&&(Ft({api:t,paramName:s,desc:Wt()}),!n)||o&&e.length>o&&(Ft({api:t,paramName:s,desc:(i=s,n=o,gs("MaximumArrayLengthLog",i,n))}),1)):(Ft({api:t,paramName:s,desc:Ht()}),!1)},hs=function(e,t,s,{allowUndefined:i,min:n,max:o}){return $e(e)?!!i||(Ft({api:t,paramName:s,desc:Vt()}),!1):Ge(e)?Ge(n)&&e<n?(Ft({api:t,paramName:s,desc:0===n?Xt(s,n):Jt(s,n-1)}),!1):!(Ge(o)&&o<e&&(Ft({api:t,paramName:s,desc:(i=s,n=o,gs("MaximumNumberLog",i,n))}),1)):(Ft({api:t,paramName:s,desc:xt()}),!1)},ps={keywordListForMsg:{type:"Array",required:!1,validator:(e,t,s)=>_s(e,t,s,{allowUndefined:!0,allowEmpty:!0,maxLength:5})},keywordListExceptMsg:{type:"Array",required:!0,validator:(e,t,s)=>_s(e,t,s,{allowUndefined:!1,allowEmpty:!1,maxLength:5})},keywordListMatchType:{type:"String",required:!1,validator:(e,t,s)=>!e||"or"===e||"and"===e||Ft({api:t,paramName:s,desc:e+" is invalid match type"})},cursor:{type:"String",required:!1},count:{type:"Number",required:!1,validator:(e,t,s)=>hs(e,t,s,{allowUndefined:!0,min:1,max:100})},groupTypeList:{type:"Array",required:!1,validator:(e,s,i)=>{if(!e)return!0;if(!_s(e,s,i,{allowUndefined:!0,allowEmpty:!0}))return!1;const n=[t.GRP_PUBLIC,t.GRP_COMMUNITY,t.GRP_WORK,t.GRP_MEETING];return!(0<e.filter(e=>-1===n.indexOf(e)).length&&(Ft({api:s,paramName:i,desc:rs(i,"group")}),1))}}};let gs=null;const ms={hookGetAPITips:function(e){gs=e},login:{userID:as,userSig:as},addToBlacklist:{userIDList:cs},removeFromBlacklist:{userIDList:cs},on:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:qt(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Kt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:is()}),!0)}],once:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:qt(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Kt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:is()}),!0)}],off:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:qt(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Kt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:is()}),!0)}],sendMessage:[{name:"message",...ls}],setMessageExtensions:[{name:"message",...ls,validator:(e,t,s)=>e.status===Nt&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:ns()}),!1)},{name:"extensions",...cs}],getMessageExtensions:[{name:"message",...ls,validator:(e,t,s)=>e.status===Nt&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:ns()}),!1)}],deleteMessageExtensions:[{name:"message",...ls,validator:(e,t,s)=>e.status===Nt&&!0===e.isSupportExtension||(Ft({api:t,paramName:s,desc:ns()}),!1)}],addMessageReaction:[{name:"message",...ls,validator:(e,t,s)=>e.status===Nt||(Ft({api:t,paramName:s,desc:os()}),!1)},{name:"reactionID",...as}],removeMessageReaction:[{name:"message",...ls,validator:(e,t,s)=>e.status===Nt||(Ft({api:t,paramName:s,desc:os()}),!1)},{name:"reactionID",...as}],getMessageReactions:{messageList:{...cs}},getAllUserListOfMessageReaction:{message:{...ls,validator:(e,t,s)=>e.status===Nt||(Ft({api:t,paramName:s,desc:os()}),!1)},reactionID:{...as},nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:{...as,validator:e=>bt(e)},nextReqMessageID:{type:"String"},count:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&!/^[1-9][0-9]*$/.test(e)&&(Ft({api:t,paramName:s,desc:zt()}),1))}},getMessageListHopping:{conversationID:{...as,validator:e=>bt(e)},sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&0!==e&&1!==e&&(Ft({api:t,paramName:s,desc:gs("0Or1RequiredLog")}),1))},count:{type:"Number",validator:(e,t,s)=>!(!$e(e)&&!/^[1-9][0-9]*$/.test(e)&&(Ft({api:t,paramName:s,desc:zt}),1))}},setMessageRead:{conversationID:{...as,validator:e=>bt(e)}},setAllMessageRead:{scope:{type:"String",required:!1,validator:(e,s,i)=>!e||-1!==[t.READ_ALL_C2C_MSG,t.READ_ALL_GROUP_MSG,t.READ_ALL_MSG].indexOf(e)||(Ft({api:s,paramName:i,desc:gs("ValidScopeRequired")}),!1)}},getConversationProfile:[{name:"conversationID",...as,validator:e=>bt(e)}],clearHistoryMessage:[{name:"conversationID",...as,validator:e=>bt(e)}],pinConversation:{conversationID:{...as,validator:e=>bt(e)},isPinned:{...us}},setConversationDraft:{conversationID:{...as,validator:e=>bt(e)},draftText:{type:"String",validator:(e,t,s)=>!!ke(e)||(Ft({api:t,paramName:s,desc:$t()}),!1)}},setConversationCustomData:{conversationIDList:{...cs},customData:{type:"String",validator:(e,t,s)=>ke(e)?!(256<e.length&&(Ft({api:t,paramName:s,desc:jt(s,256)}),1)):(Ft({api:t,paramName:s,desc:$t()}),!1)}},markConversation:{conversationIDList:{...cs},markType:{type:"number",validator:(e,t,s)=>{return Ge(e)?e<=0?(Ft({api:t,paramName:s,desc:Jt(s,0)}),!1):!(e>=Math.pow(2,64)&&(Ft({api:t,paramName:s,desc:(e=s,gs("NumberLessThanLog",e,"Math.pow(2,64)"))}),1)):(Ft({api:t,paramName:s,desc:xt()}),!1)}},enableMark:{...us}},createConversationGroup:{conversationIDList:{...cs},groupName:{...as,validator:(e,t,s)=>!(!e||32<e.length&&(Ft({api:t,paramName:s,desc:jt(s,32)}),1))}},deleteConversationGroup:[{name:"groupName",...as}],renameConversationGroup:{oldName:{...as},newName:{...as,validator:(e,t,s)=>!(!e||32<e.length&&(Ft({api:t,paramName:s,desc:jt(s,32)}),1))}},addConversationsToGroup:{conversationIDList:{...cs},groupName:{...as}},deleteConversationsFromGroup:{conversationIDList:{...cs},groupName:{...as}},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:as,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:cs},createGroup:{name:as},joinGroup:{groupID:as,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[{name:"groupID",...as}],handleApplication:{message:ls,handleAction:as,handleMessage:{type:"String"}},changeGroupOwner:{groupID:as,newOwnerID:as},updateGroupProfile:{groupID:as,muteAllMembers:{type:"Boolean"}},dismissGroup:[{name:"groupID",...as}],searchGroupByID:[{name:"groupID",...as}],getGroupOnlineMemberCount:[{name:"groupID",...as}],initGroupAttributes:{groupID:as,groupAttributes:{...ls,validator:(t,s,i)=>{let n=!0;return Object.keys(t).forEach(e=>{if(!ke(t[e]))return Ft({api:s,paramName:i,desc:Zt("value")}),n=!1}),n}}},setGroupAttributes:{groupID:as,groupAttributes:{...ls,validator:(t,s,i)=>{let n=!0;return Object.keys(t).forEach(e=>{if(!ke(t[e]))return Ft({api:s,paramName:i,desc:Zt("value")}),n=!1}),n}}},deleteGroupAttributes:{groupID:as,keyList:{type:"Array",validator:(e,s,i)=>{if($e(e)||!Fe(e))return Ft({api:s,paramName:i,desc:Ht()}),!1;if(Oe(e))return!0;{let t=!0;return e.forEach(e=>{if(!ke(e))return Ft({api:s,paramName:i,desc:gs("StringArrayRequiredLog")}),t=!1}),t}}}},getGroupAttributes:{groupID:as,keyList:{type:"Array",validator:(e,s,i)=>{if($e(e)||!Fe(e))return Ft({api:s,paramName:i,desc:Ht()}),!1;if(Oe(e))return!0;{let t=!0;return e.forEach(e=>{if(!ke(e))return Ft({api:s,paramName:i,desc:Zt("key")}),t=!1}),t}}}},setGroupCounters:{groupID:as,counters:ls},increaseGroupCounter:{groupID:as,key:as,value:ds},decreaseGroupCounter:{groupID:as,key:as,value:ds},getGroupCounters:{groupID:as},getGroupMemberList:{groupID:as,count:{type:"Number"}},getGroupMemberProfile:{groupID:as,userIDList:cs,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:as,userIDList:cs},setGroupMemberRole:{groupID:as,userID:as,role:as},setGroupMemberMuteTime:{groupID:as,userID:as,muteTime:{type:"Number",validator:e=>0<=e}},setGroupMemberNameCard:{groupID:as,userID:{type:"String"},nameCard:{type:"String",validator:(e,t,s)=>ke(e)?(e.length,!0):(Ft({api:t,paramName:s,desc:$t()}),!1)}},setGroupMemberCustomField:{groupID:as,userID:{type:"String"},memberCustomField:cs},deleteGroupMember:{groupID:as},markGroupMemberList:{groupID:as,markType:{type:"number",validator:(e,t,s)=>Ge(e)?!(e<1e3&&(Ft({api:t,paramName:s,desc:Xt(s,1e3)}),1)):(Ft({api:t,paramName:s,desc:xt()}),!1)},userIDList:{...cs},enableMark:{...us}},createTextMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>be(e)?ke(e.text)?0!==e.text.length||(Ft({api:t,paramName:"payload.text",desc:es()}),!1):(Ft({api:t,paramName:"payload.text",desc:$t()}),!1):(Ft({api:t,paramName:s,desc:Qt()}),!1)}},createTextAtMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>be(e)?ke(e.text)?0===e.text.length?(Ft({api:t,paramName:"payload.text",desc:es()}),!1):!(e.atUserList&&!Fe(e.atUserList)&&(Ft({api:t,paramName:"payload.atUserList",desc:Ht()}),1)):(Ft({api:t,paramName:"payload.text",desc:$t()}),!1):(Ft({api:t,paramName:s,desc:Qt()}),!1)}},createCustomMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>be(e)?e.data&&!ke(e.data)?(Ft({api:t,paramName:"payload.data",desc:$t()}),!1):e.description&&!ke(e.description)?(Ft({api:t,paramName:"payload.description",desc:$t()}),!1):!(e.extension&&!ke(e.extension)&&(Ft({api:t,paramName:"payload.extension",desc:$t()}),1)):(Ft({api:t,paramName:"payload",desc:Qt()}),!1)}},createImageMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>{if(!be(e))return Ft({api:t,paramName:s,desc:Qt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:Vt()}),!1;if(F){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return be(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ft({api:t,paramName:"payload.file",desc:ts()}),!1):(Ft({api:t,paramName:"payload.file",desc:Bt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:ts()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Yt()}),!0)}}},createAudioMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>!!be(e)||(Ft({api:t,paramName:s,desc:Qt()}),!1)},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Yt()}),!0)}},createVideoMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>{if(!be(e))return Ft({api:t,paramName:s,desc:Qt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:Vt()}),!1;if(F){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return be(e.file)&&"undefined"!=typeof uni?!!Ue(e.file.tempFile)||(Ft({api:t,paramName:"payload.file",desc:ts()}),!1):(Ft({api:t,paramName:"payload.file",desc:Bt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:ts()}),!1}return!0}},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Yt()}),!0)}},createFaceMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>be(e)?Ge(e.index)?!!ke(e.data)||(Ft({api:t,paramName:"payload.data",desc:$t()}),!1):(Ft({api:t,paramName:"payload.index",desc:xt()}),!1):(Ft({api:t,paramName:s,desc:Qt()}),!1)}},createFileMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>{if(!be(e))return Ft({api:t,paramName:s,desc:Qt()}),!1;if($e(e.file))return Ft({api:t,paramName:"payload.file",desc:Vt()}),!1;if(F){if(!(e.file instanceof HTMLInputElement||Ue(e.file)))return be(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Ft({api:t,paramName:"payload.file",desc:ts()}),!1):(Ft({api:t,paramName:"payload.file",desc:Bt()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Ft({api:t,paramName:"payload.file",desc:ts()}),!1}return!0}},onProgress:{type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Yt()}),!0)}},createLocationMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>be(e)?ke(e.description)?Ge(e.longitude)?!!Ge(e.latitude)||(Ft({api:t,paramName:"payload.latitude",desc:xt()}),!1):(Ft({api:t,paramName:"payload.longitude",desc:xt()}),!1):(Ft({api:t,paramName:"payload.description",desc:$t()}),!1):(Ft({api:t,paramName:s,desc:Qt()}),!1)}},createMergerMessage:{to:as,conversationType:as,payload:{...ls,validator:(e,t,s)=>{if(Oe(e.messageList))return Ft({api:t,paramName:"payload.messageList",desc:Wt()}),!1;if(Oe(e.compatibleText))return Ft({api:t,paramName:"payload.compatibleText",desc:qt("compatibleText")}),!1;let i=!1;return e.messageList.forEach(e=>{e.status===Pt&&(i=!0)}),!i||(Ft({api:t,paramName:"payload.messageList",desc:gs("MergeFailedMessageLog")}),!1)}}},revokeMessage:[{name:"message",...ls,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ss()}),!1):e.conversationType===t.CONV_SYSTEM?(Ft({api:s,paramName:i,desc:gs("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(Ft({api:s,paramName:i,desc:gs("MessageRevokedLog")}),!1)}],deleteMessage:[{name:"messageList",...cs,validator:(e,t,s)=>!Oe(e)||(Ft({api:t,paramName:s,desc:Wt()}),!1)}],translateText:{sourceTextList:cs,sourceLanguage:as,targetLanguage:as},convertVoiceToText:{message:{...ls,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ss()}),!1):e.type===t.MSG_AUDIO&&e.status===Nt||(Ft({api:s,paramName:i,desc:gs("AudioMessageRequiredLog")}),!1)}},modifyMessage:[{name:"message",...ls,validator:(e,s,i)=>Oe(e)?(Ft({api:s,paramName:i,desc:ss()}),!1):e.conversationType===t.CONV_SYSTEM?(Ft({api:s,paramName:i,desc:gs("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(Ft({api:s,paramName:i,desc:gs("OnlineMessageNotSupportLog")}),!1)}],searchCloudMessages:{keywordList:ps.keywordListForMsg,keywordListMatchType:ps.keywordListMatchType,cursor:ps.cursor,senderUserIDList:{type:"Array",required:!1,validator:(e,t,s)=>_s(e,t,s,{allowUndefined:!0,allowEmpty:!0,maxLength:5})},messageTypeList:{type:"Array",required:!1,validator:(e,s,i)=>{if(!e)return!0;if(!_s(e,s,i,{allowUndefined:!0,allowEmpty:!0}))return!1;const n=[t.MSG_TEXT,t.MSG_IMAGE,t.MSG_AUDIO,t.MSG_FILE,t.MSG_VIDEO,t.MSG_LOCATION,t.MSG_CUSTOM,t.MSG_MERGER];return!(0<e.filter(e=>-1===n.indexOf(e)).length&&(Ft({api:s,paramName:i,desc:rs(i,"message")}),1))}},conversationID:{type:"String",required:!1,validator:e=>!e||bt(e)},timePosition:{type:"number",required:!1,validator:(e,t,s)=>hs(e,t,s,{allowUndefined:!0,min:0})},timePeriod:{type:"number",required:!1,validator:(e,t,s)=>hs(e,t,s,{allowUndefined:!0,min:0})}},searchCloudUsers:{keywordList:ps.keywordListExceptMsg,keywordListMatchType:ps.keywordListMatchType,cursor:ps.cursor,count:ps.count,miniBirthday:{type:"Number",required:!1,validator:(e,t,s)=>hs(e,t,s,{allowUndefined:!0,min:0})},maxBirthday:{type:"Number",required:!1,validator:(e,t,s)=>hs(e,t,s,{allowUndefined:!0,min:0})},gender:{type:"String",required:!1,validator:(e,s,i)=>!e||e===t.GENDER_FEMALE||e===t.GENDER_MALE||Ft({api:s,paramName:i,desc:e+" is invalid match type"})}},searchCloudGroups:{keywordList:ps.keywordListExceptMsg,keywordListMatchType:ps.keywordListMatchType,cursor:ps.cursor,count:ps.count,groupTypeList:ps.groupTypeList},searchCloudGroupMembers:{keywordList:ps.keywordListExceptMsg,keywordListMatchType:ps.keywordListMatchType,cursor:ps.cursor,count:ps.count,groupTypeList:ps.groupTypeList,groupIDList:{type:"Array",required:!1,validator:(e,t,s)=>_s(e,t,s,{allowUndefined:!0,allowEmpty:!0})}},getUserProfile:{userIDList:{type:"Array",validator:(e,t,s)=>Fe(e)?(0===e.length&&Ft({api:t,paramName:s,desc:Wt()}),!0):(Ft({api:t,paramName:s,desc:Ht()}),!1)}},updateMyProfile:{profileCustomField:{type:"Array",validator:(e,t,s)=>!!$e(e)||!!Fe(e)||(Ft({api:t,paramName:s,desc:Ht()}),!1)}},setSelfStatus:{customStatus:{type:"String",validator:(e,t,s)=>!!ke(e)||(Ft({api:t,paramName:s,desc:$t()}),!1)}},getUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>Fe(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Wt()}),!1):(Ft({api:t,paramName:s,desc:Ht()}),!1)}},subscribeUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>Fe(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Wt()}),!1):(Ft({api:t,paramName:s,desc:Ht()}),!1)}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:(e,t,s)=>!e||!!Fe(e)||(Ft({api:t,paramName:s,desc:Ht()}),!1)}},addFriend:{to:as,source:{type:"String",required:!0,validator:(e,t,s)=>!!e&&(e.startsWith("AddSource_Type_")?!(8<e.replace("AddSource_Type_","").length&&(Ft({api:t,paramName:s,desc:jt("keyword",8)}),1)):(Ft({api:t,paramName:s,desc:gs("SourcePrefixLog")}),!1))},remark:{type:"String",required:!1,validator:(e,t,s)=>!(ke(e)&&96<e.length&&(Ft({api:t,paramName:s,desc:jt(s,96)}),1))}},deleteFriend:{userIDList:cs},checkFriend:{userIDList:cs},getFriendProfile:{userIDList:cs},updateFriend:{userID:as,remark:{type:"String",required:!1,validator:(e,t,s)=>!(ke(e)&&96<e.length&&(Ft({api:t,paramName:s,desc:jt(s,96)}),1))},friendCustomField:{type:"Array",required:!1,validator:(e,s,i)=>{if(e){if(!Fe(e))return Ft({api:s,paramName:i,desc:Ht()}),!1;let t=!0;return e.forEach(e=>ke(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?ke(e.value)?8<e.key.replace("Tag_SNS_Custom_","").length?(Ft({api:s,paramName:i,desc:jt("keyword",8)}),t=!1):void 0:(Ft({api:s,paramName:i,desc:Zt("value")}),t=!1):(Ft({api:s,paramName:i,desc:gs("FriendCustomFieldPrefixLog")}),t=!1)),t}return!0}}},acceptFriendApplication:{userID:as},refuseFriendApplication:{userID:as},deleteFriendApplication:{userID:as},createFriendGroup:{name:as},deleteFriendGroup:{name:as},addToFriendGroup:{name:as,userIDList:cs},removeFromFriendGroup:{name:as,userIDList:cs},renameFriendGroup:{oldName:as,newName:as},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:(e,t,s)=>Fe(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Wt()}),!1):(Ft({api:t,paramName:s,desc:Ht()}),!1)}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:(e,t,s)=>Fe(e)?0!==e.length||(Ft({api:t,paramName:s,desc:Wt()}),!1):(Ft({api:t,paramName:s,desc:Ht()}),!1)}],createTopicInCommunity:{groupID:as,topicName:as},deleteTopicFromCommunity:{groupID:as,topicIDList:{type:"Array",validator:(e,t,s)=>!e||!!Fe(e)||(Ft({api:t,paramName:s,desc:Ht()}),!1)}},updateTopicProfile:{groupID:as,topicID:as},getTopicList:{groupID:as,topicIDList:{type:"Array",validator:(e,t,s)=>!e||!!Fe(e)||(Ft({api:t,paramName:s,desc:Ht()}),!1)}},followUser:[{name:"userIDList",...cs}],unfollowUser:[{name:"userIDList",...cs}],getMyFollowingList:[{name:"startIndex",...as,required:!1}],getMyFollowersList:[{name:"startIndex",...as,required:!1}],getMutualFollowersList:[{name:"startIndex",...as,required:!1}],getUserFollowInfo:[{name:"userIDList",...cs,required:!1}],checkFollowType:[{name:"userIDList",...cs}],addSignalingListener:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:qt(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Kt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:is()}),!0)}],removeSignalingListener:[{name:"eventName",type:"String",validator:(e,t,s)=>"string"==typeof e&&0!==e.length||(Ft({api:t,paramName:s,desc:qt(s)}),!1)},{name:"handler",type:"Function",validator:(e,t,s)=>"function"!=typeof e?(Ft({api:t,paramName:s,desc:Kt()}),!1):(""===e.name&&Ft({api:t,paramName:s,desc:is()}),!0)}],invite:{userID:as},inviteSync:[{...ls,validator:(e,t,s)=>be(e)?!!ke(e.userID)||(Ft({api:t,paramName:"options.userID",desc:$t()}),!1):(Ft({api:t,paramName:"options",desc:Qt()}),!1)},{name:"successCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Kt()}),!0)},{name:"errorCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Kt()}),!0)}],inviteInGroup:{groupID:as,inviteeList:cs},inviteInGroupSync:[{...ls,validator:(e,t,s)=>be(e)?ke(e.groupID)?!!Fe(e.inviteeList)||(Ft({api:t,paramName:"options.inviteeList",desc:Ht()}),!1):(Ft({api:t,paramName:"options.groupID",desc:$t()}),!1):(Ft({api:t,paramName:"options",desc:Qt()}),!1)},{name:"successCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Kt()}),!0)},{name:"errorCb",type:"Function",required:!1,validator:(e,t,s)=>($e(e)&&Ft({api:t,paramName:s,desc:Kt()}),!0)}],accept:{inviteID:as},reject:{inviteID:as},getSignalingInfo:[{name:"message",...ls,validator:(e,t,s)=>!Oe(e)||(Ft({api:t,paramName:s,desc:ss()}),!1)}],modifyInvitation:{inviteID:as,data:as}},fs={login:1,logout:1,getLoginUser:1,getServerTime:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,isReady: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,convertVoiceToText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,setConversationDraft:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,setMessageRemindType:1,setAllReceiveMessageOpt:1,getAllReceiveMessageOpt:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID: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,searchCloudMessages:1,searchCloudUsers:1,searchCloudGroups:1,searchCloudGroupMembers: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,followUser:1,unfollowUser:1,getMyFollowingList:1,getMyFollowersList:1,getMutualFollowersList:1,getUserFollowInfo:1,checkFollowType:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},Ms=1,Is=2,Cs=3,Ts=4,ys=6,vs=7,Es=8,Ss=10,Ds=11,Rs=12,Ls=13,As=14,Os=15,Ns=17,Ps=18,Us=19,Gs=20,ks=21,ws=23,bs=24,Fs=25,$s=26,qs=27,xs=28,Vs=29,Bs=30,Ks=31,Hs=32,Ws=33,Ys=34,zs=35,js=36,Js=37,Xs=38,Zs=function(e){return{code:0,data:e||{}}};class Qs extends Error{constructor(e){super();var{code:e,message:t,data:s}=e;this.code=e,t?this.message=t:this._getErrMsg&&(this.message=this._getErrMsg(this.code)),this.data=s||{}}}const ei={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,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_ERR:2109,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,VOICE_TO_TEXT_FAIL:2118,UNSUPPORTED_VOICE_FORMAT:2119,MSG_I_SELECT_F_FIRST:2251,MSG_I_TYPES_LIMIT:2252,MSG_I_SIZE_LIMIT:2253,MSG_A_UPLOAD_FAIL:2300,MSG_A_SIZE_LIMIT:2301,MSG_V_UPLOAD_FAIL:2350,MSG_V_SIZE_LIMIT:2351,MSG_V_TYPES_LIMIT:2352,MSG_F_UPLOAD_FAIL:2400,MSG_F_SELECT_F_FIRST:2401,MSG_F_SIZE_LIMIT:2402,MSG_F_URL_IS_EMPTY:2403,MSG_MERGER_TYPE_INVALID:2450,MSG_MERGER_KEY_INVALID:2451,MSG_MERGER_DOWNLOAD_FAIL:2452,MSG_FORWARD_TYPE_INVALID:2453,MSG_FORWARD_INVALID_ELEMENTS:2454,MSG_MODIFY_CONFLICT:2480,MSG_MODIFY_DISABLED_IN_AV:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AV:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AV:2661,CANNOT_JOIN_NON_AV_WITHOUT_LOGIN:2662,NOT_OWNER:2681,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AV:2687,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GRP_EXISTED:2710,FRIEND_GRP_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,NO_PROTOCOL:2997,NO_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,NO_USE:3122,PROFANITY_FOUND:3123,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022,SIGNALING_INVALID_INVITE_ID:8010,SIGNALING_NO_PERMISSION:8011,SIGNALING_ALREADY_EXISTS:8012,INVALID_CANCEL_MESSAGE:8020};let ti=null;const si=function(e){ti=e},ii=function(e){return Promise.resolve(Zs(e))},ni=function(t,s=!1){if(t instanceof Qs)return s&&null!==ti&&ti.emit(e.ERROR,t),Promise.reject(t);if(t instanceof Error){const t=new Qs({code:ei.UNCAUGHT_ERROR});return s&&null!==ti&&ti.emit(e.ERROR,t),Promise.reject(t)}if($e(t)||$e(t.code))return Promise.reject(new Qs({code:ei.UNCAUGHT_ERROR}));t=new Qs(t);return s&&null!==ti&&ti.emit(e.ERROR,t),Promise.reject(t)};class oi{constructor(e){this._m=e,this._n=""}isLoggedIn(){return this._m.get(Rs).isLoggedIn()}isOversea(){return this._m.get(Rs).isOversea()}isPrivateNetWork(){const e=this._m.get(Rs);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}getFileDownloadProxy(){return this._m.get(Rs).getFileDownloadProxy()}getDowloadFileAuthKey(){return this._m.get(Rs).getDowloadFileAuthKey()}getMyUserID(){return this._m.get(Rs).getUserID()}getMyTinyID(){return this._m.get(Rs).getTinyID()}getSDKAppID(){return this._m.get(Rs).getSDKAppID()}isIntl(){return this._m.get(Rs).isIntl()}isUsingChatCore(){return this._m.get(Rs).isUsingChatCore()}isDevMode(){return this._m.get(Rs).isDevMode()}get(e){return this._m.get(e)}getPlatform(){return V}getCloudConfig(e){return this._m.get(ws).getCloudConfig(e)}emitOEvt(e,t){this._m.getOEmitInst().emit(e,t)}emitIEvt(e,t){this._m.getIEmitInst().emit(e,t)}getIEmitInst(){return this._m.getIEmitInst()}req(e){return this._m.get(Gs).req(e)}canIUse(e){return this._m.get(qs).canIUse(e)}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Ce.w(e)}noUse(e){var t=ei.NO_USE;return ni({code:t,message:this.getErrMsg(t,e)})}}const ri={LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MSG:"getmsg",SEND_C2C_MSG:"sendmsg",SEND_GRP_MSG:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BL:"black_list_get",ADD_TO_BL:"black_list_add",RM_FROM_BL:"black_list_delete",GET_FD_LIST:"friend_get",GET_FD_PROFILE:"friend_get_specified",CHECK_FD:"friend_check",DEL_FD:"friend_delete",ADD_FD:"friend_add",UPDATE_FD:"friend_update",RESPOND_FD_APPLICATION:"friend_response",GET_FD_APPLICATION_LIST:"pendency_get",DEL_FD_APPLICATION:"pendency_delete",REFUSE_FD_APPLICATION:"pendency_refuse",REPORT_FD_APPLICATION:"pendency_report",GET_FD_GRP_LIST:"group_get",CREATE_FD_GRP:"group_add",DEL_FD_GRP:"group_delete",UPDATE_FD_GRP:"group_update",REVOKE_C2C_MSG:"msgwithdraw",SET_C2C_MSG_READ:"msgreaded",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_C2C_ROAMING_MSG:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DEL_C2C_MSG:"delete_c2c_msg_ramble",MODIFY_C2C_MSG:"modify_c2c_msg",MODIFY_C2C_MSG_EXT:"set_key_values",GET_C2C_MSG_EXT:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",RM_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONV_LIST:"page_get",DEL_CONV:"batch_delete",CLEAR_HISTORY_MSG:"clear_msg",PIN_CONV:"top",DEL_GROUP_AT_TIPS:"deletemsg",SET_CONV_CUSTOM_DATA:"set_conv_custom_data",MARK_CONV:"mark_contact",CREATE_CONV_GRP:"create_contact_group",DEL_CONV_GRP:"del_contact_group",RENAME_CONV_GRP:"update_contact_group",ADD_CONV_TO_GRP:"add_conv_to_group",DEL_CONV_FROM_GRP:"del_conv_from_group",GET_CONV_GRP_LIST:"get_contact_group",SEARCH_CONV_GRP_MARK:"search_contact_group",GET_GRP_LIST:"get_joined_group_list",GET_GRP_PROFILE:"get_group_self_member_info",CREATE_GRP:"create_group",DISMISS_GRP:"destroy_group",UPDATE_GRP_PROFILE:"modify_group_base_info",APPLY_JOIN_GRP:"apply_join_group",APPLY_JOIN_GRP_NOAUTH:"apply_join_group_noauth",QUIT_GRP:"quit_group",SEARCH_GRP:"get_group_public_info",CHANGE_GRP_OWNER:"change_group_owner",HANDLE_GRP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GRP:"handle_invite_join_permission_group",HANDLE_GRP_INVITATION:"handle_invite_join_group",REVOKE_GRP_MSG:"group_msg_recall",SET_GRP_MSG_READ:"msg_read_report",SET_ALL_MSG_READ:"read_all_unread_msg",GET_GRP_ROAMING_MSG:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",GET_GRP_PENDENCY:"get_pendency",DEL_GRP_SYSTEM_NOTICE:"deletemsg",AV_POLLING:"get_msg",AV_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MBR_NUM:"get_online_member_num",DEL_GRP_MSG:"delete_group_ramble_msg_by_seq",MODIFY_GRP_MSG:"modify_group_msg",SET_GRP_ATTR:"set_group_attr",MODIFY_GRP_ATTR:"modify_group_attr",DEL_GRP_ATTR:"delete_group_attr",CLEAR_GRP_ATTR:"clear_group_attr",GET_GRP_ATTR:"get_group_attr",MODIFY_GRP_MSG_EXT:"group_set_key_values",GET_GRP_MSG_EXT:"group_get_key_values",GET_GRP_NOTIFY:"batch_get_group_notify",UPDATE_GRP_COUNTER:"update_group_counter",GET_GRP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",RM_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",GET_GRP_MBR_LIST:"get_group_member_info",GET_AV_MBR_LIST:"get_members",GET_GRP_MBR_PROFILE:"get_specified_group_member_info",ADD_GRP_MBR:"add_group_member",DEL_GRP_MBR:"delete_group_member",BAN_AV_MBR:"ban_group_member",MODIFY_GRP_MBR_INFO:"modify_group_member_info",MARK_AV_MBR_INFO:"modify_user_info",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",SIMPLE_COS_PRE_SIG:"simple_sig",GET_IMAGE_INFO:"get_imageinfo",GET_IP:"get_final_ip",VIDEO_COVER:"video_cover",SSO_STAT:"tim_web_report_v2",PING:"alive",MSG_PUSH:"msg_push",CS:"query",GRP_CS:"query_grp",MBR_CS:"query_grp_member",USER_CS:"query_user",MULTI_MSG_PUSH:"multi_msg_push_ws",MSG_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MSG:"save_relay_json_msg",DOWNLOAD_MERGER_MSG:"get_relay_json_msg",FETCH_CLOUD_CTRL_CONFIG:"fetch_config",PUSHED_CLOUD_CTRL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DEL_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",SUB_USER_STATUS:"ws_status_subscribe",UNSUB_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PUSH_REPORT:"uniapp_sdk_report",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition",FOLLOW:"follow_add",UNFOLLOW:"follow_delete",GET_FOLLOW:"follow_get",GET_FOLLOW_INFO:"follow_get_info",CHECK_FOLLOW_TYPE:"follow_check",SET_ALL_RECEIVE_MSG_OPT:"ws_set_do_not_disturb",GET_ALL_RECEIVE_MSG_OPT:"ws_get_do_not_disturb"},ai="networkRTT",ci="messageE2EDelay",li="sendMessageC2C",ui="sendMessageGroup",di="sendMessageGroupAV",_i="sendMessageRichMedia",hi="cosUpload",pi="messageReceivedGroup",gi="messageReceivedGroupAVPush",mi="messageReceivedGroupAVPull",fi={[ai]:2,[ci]:3,[li]:4,[ui]:5,[di]:6,[_i]:7,[pi]:8,[gi]:9,[mi]:10,[hi]:11},Mi={info:4,warning:5,error:6},Ii={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Ci={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16};class Ti{constructor(e){this._n="SSOLogData",this.eventType=Ci[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=pe()}static bindEventStatModule(e){Ti.prototype._eventStatModule=e}static bindNetMonitorModule(e){Ti.prototype._netMonitorModule=e}updateTimeStamp(){this.timestamp=pe()}start(e){return this._startts=e,this}end(e=!1){if(!this._sentFlag){if(this._netMonitorModule){const e=this._netMonitorModule.getNetworkType();this.setNetworkType(e)}var t=pe();0===this.costTime&&(this.costTime=t-this._startts),this.setMoreMessage(`startts:${this._startts} endts:`+t),e?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(()=>{this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)},0)}}setError(e){if(!(e instanceof Error))return Ce.w(this._n+".setError value not instanceof Error, please check!"),this;if(this._sentFlag)return this;let t=!0;if(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{const e=ei.NO_NETWORK;this.setCode(e)}return this.setLevel("error"),this}setCode(e){return $e(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),Ge(e)?this.code=e:Ce.w(this._n+".setCode value not a number, please check!",e,typeof e)),this}setMessage(e){return $e(e)||this._sentFlag||(Ge(e)&&(this.message=e.toString()),ke(e)&&(this.message=e)),this}setCostTime(e){return this.costTime=e,this}setLevel(e){return $e(e)||this._sentFlag||(this.level=Mi[e]),this}setMoreMessage(e){return Oe(this.moreMessage)?this.moreMessage=""+e:this.moreMessage+=" "+e,this}setNetworkType(e){return $e(e)?Ce.w(this._n+".setNetworkType value is undefined, please check!"):(e=Ii[e.toLowerCase()],$e(e)||(this.networkType=e)),this}getStartTs(){return this._startts}setUIPlatform(e){return this.uiPlatform=e,this}setExtension(e){return this.extension=e,this}setEventType(e){return this.eventType=e,this}}class yi{constructor(e){this.type=t.MSG_TEXT,this.content={text:e.text||""}}setText(e){this.content.text=e}sendable(){return 0!==this.content.text.length}}function vi(t,s,i,n=[]){if(t){let e=t;return s&&(t.startsWith("http://")?e=t.replace(/^http:\/\/[^/]+/,s):t.startsWith("https://")&&(e=t.replace(/^https:\/\/[^/]+/,s))),e=i&&-1===e.indexOf("authKey=")&&Di(e,n)?-1<e.indexOf("?")?e+"&authKey="+i:e+"?authKey="+i:e}}function Ei(e,s,i=[]){if(e===t.MSG_VIDEO)Di((s[0].content||s[0].payload).snapshotUrl,i)&&(s[0].content?(s[0].content.snapshotUrl=Si(s[0].content.snapshotUrl),s[0].content.thumbUrl=Si(s[0].content.thumbUrl)):(s[0].payload.snapshotUrl=Si(s[0].payload.snapshotUrl),s[0].payload.thumbUrl=Si(s[0].payload.thumbUrl)));else if(e===t.MSG_FILE)Di((s[0].content||s[0].payload).fileUrl,i)&&(s[0].content?s[0].content.fileUrl=Si(s[0].content.fileUrl):s[0].payload.fileUrl=Si(s[0].payload.fileUrl));else if(e===t.MSG_MERGER){const{downloadKey:e="",messageList:t=[]}=s[0].content||s[0].payload;Oe(e)&&t.forEach(e=>{Ei(e.messageBody[0].type,e.messageBody)})}return s}function Si(e){if(!e)return e;if(-1===e.indexOf("authKey="))return e;const t=e.split("?"),s=t[1].split("&");let i=0;for(let e=0;e<s.length;e++)if(-1<s[e].indexOf("authKey=")){i=e;break}return s.splice(i,1),0<s.length?t[0]+"?"+s.join("&"):t[0]}function Di(e,t){let s=!1;if(e){const i=e.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),n=i&&i[2]||"";if(n.includes("rich-dev"))return!0;for(let e=0;e<t.length;e++)if(n.endsWith(t[e])){s=!0;break}}return s}class Ri{constructor(e,s,i,n){this._imageMemoryURL="",this._fileDownloadProxy=s,this._authKey=i,this._fileDNList=n,k||b?this.createImageDataASURL(e.file):this.createImageDataASURLInWeb(e.file),this._initImageInfoModel(),this.type=t.MSG_IMAGE,this._percent=0,this.content={imageFormat:e.imageFormat||Te.UNKNOWN,uuid:e.uuid,imageInfoArray:[]},this.initImageInfoArray(e.imageInfoArray),this._autoFixUrl()}_initImageInfoModel(){const t=this;this._ImageInfoModel=function(e){this.instanceID=je(9999999),this.sizeType=e.type||0,this.type=0,this.size=e.size||0,this.width=e.width||0,this.height=e.height||0,this.imageUrl=e.imageUrl||e.url||"",this.url=vi(e.url||t._imageMemoryURL,t._fileDownloadProxy,t._authKey,t._fileDNList)},this._ImageInfoModel.prototype={setSizeType(e){this.sizeType=e},setType(e){this.type=e},setImageUrl(e){e&&(this.imageUrl=e)},getImageUrl(){return this.imageUrl}}}initImageInfoArray(e){let t=0,s=null,i;for(;t<=2;)i=$e(e)||$e(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(s=new this._ImageInfoModel(i)).setSizeType(t+1),s.setType(t),this.addImageInfo(s),t++;this.updateAccessSideImageInfoArray()}updateImageInfoArray(t){var s=this.content.imageInfoArray.length;let i;for(let e=0;e<s;e++)i=this.content.imageInfoArray[e],t[e].size&&(i.size=t[e].size),t[e].url&&i.setImageUrl(t[e].url),t[e].width&&(i.width=t[e].width),t[e].height&&(i.height=t[e].height)}_autoFixUrl(){var t=this.content.imageInfoArray.length;let s="",i="";const n=["http","https"];let o=null;for(let e=0;e<t;e++)this.content.imageInfoArray[e].url&&(""!==(o=this.content.imageInfoArray[e]).imageUrl&&(i=o.imageUrl.slice(0,o.imageUrl.indexOf("://")+1),s=o.imageUrl.slice(o.imageUrl.indexOf("://")+1),n.indexOf(i)<0&&(i="https:"),this.content.imageInfoArray[e].setImageUrl([i,s].join(""))))}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateImageFormat(e){this.content.imageFormat=Te[e.toUpperCase()]||Te.UNKNOWN}createImageDataASURLInWeb(e){void 0!==e&&0<e.files.length&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}createImageDataASURL(e){e&&e.url&&(this._imageMemoryURL=e.url)}replaceImageInfo(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}addImageInfo(e){3<=this.content.imageInfoArray.length||this.content.imageInfoArray.push(e)}updateAccessSideImageInfoArray(){var e=this.content.imageInfoArray,{width:t=0,height:s=0}=e[0];0!==t&&0!==s&&(mt(e),Object.assign(e[2],gt({originWidth:t,originHeight:s,min:720})))}sendable(){return 0!==this.content.imageInfoArray.length&&""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size}}class Li{constructor(e){this.type=t.MSG_FACE,this.content=e||null}sendable(){return null!==this.content}}class Ai{constructor(e,s,i,n){this.type=t.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:e.second,size:e.size,url:vi(e.url,s,i,n),remoteAudioUrl:e.url||"",uuid:e.uuid}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateAudioUrl(e){this.content.remoteAudioUrl=e}sendable(){return""!==this.content.remoteAudioUrl}}const Oi={from:!0,groupID:!0,groupName:!0,to:!0};class Ni{constructor(e){this.type=t.MSG_GRP_TIP,this.content={},this._initContent(e)}_initContent(t){Object.keys(t).forEach(e=>{switch(e){case"remarkInfo":break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;case"operatorInfo":this.content.operatorInfo={},this._initOperatorInfo(t[e]);break;case"memberInfoList":case"msgMemberInfo":this._updateMemberList(t[e]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":this.content[e]=t[e],this.content.memberCount=t[e];break;case"newGroupProfile":this.content.newGroupProfile={},this._initNewGroupProfile(t[e]);break;default:this.content[e]=t[e]}}),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var i=s[e];Oi[i]&&(this.content.groupProfile[i]=t[i])}}_initOperatorInfo(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var i=s[e];this.content.operatorInfo[i]=t[i]}}_updateMemberList(e){Oe(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach(t=>{e.forEach(e=>{t.userID===e.userID&&Object.assign(t,e)})})}_initNewGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var i=s[e];this.content.newGroupProfile[i]="muteAllMembers"!==i?t[i]:1===t[i]}}}const Pi={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0};class Ui{constructor(e){this.type=t.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(e)}_initContent(t){Object.keys(t).forEach(e=>{switch(e){case"memberInfoList":break;case"remarkInfo":this.content.handleMessage=t[e];break;case"groupProfile":this.content.groupProfile={},this._initGroupProfile(t[e]);break;default:this.content[e]=t[e]}})}_initGroupProfile(t){var s=Object.keys(t);for(let e=0;e<s.length;e++){var i=s[e];Pi[i]&&("groupName"===i?this.content.groupProfile.name=t[i]:this.content.groupProfile[i]=t[i])}}}class Gi{constructor(e,s,i,n){this.type=t.MSG_FILE,this._percent=0;var o=this._getFileInfo(e);this.content={downloadFlag:2,fileUrl:vi(e.url||e.fileUrl,s,i,n)||"",uuid:e.uuid,fileName:o.name||"",fileSize:o.size||0}}_getFileInfo(e){if(!$e(e.fileName)&&!$e(e.fileSize))return{size:e.fileSize,name:e.fileName};const t=e.file.files[0];if(P){if(t.path&&-1!==t.path.indexOf(".")){const e=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=e,t.name||(t.name=je(999999)+"."+e)}t.name||(t.type="",t.name=t.path.slice(t.path.lastIndexOf("/")+1).toLowerCase()),t.suffix&&(t.type=t.suffix),t.url||(t.url=t.path)}return{size:t.size,name:t.name}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateFileUrl(e){this.content.fileUrl=e}sendable(){return""!==this.content.fileUrl&&""!==this.content.fileName&&0!==this.content.fileSize}}class ki{constructor(e){this.type=t.MSG_CUSTOM,this.content={data:e.data||"",description:e.description||"",extension:e.extension||""}}setData(e){return this.content.data=e,this}setDescription(e){return this.content.description=e,this}setExtension(e){return this.content.extension=e,this}sendable(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}class wi{constructor(e,s,i,n){this.type=t.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:e.remoteVideoUrl||e.videoUrl||"",videoFormat:e.videoFormat,videoSecond:parseInt(e.videoSecond,10),videoSize:e.videoSize,videoUrl:vi(e.videoUrl,s,i,n),videoDownloadFlag:2,videoUUID:e.videoUUID,thumbUUID:e.thumbUUID,thumbFormat:e.thumbFormat,thumbWidth:e.thumbWidth,snapshotWidth:e.thumbWidth,thumbHeight:e.thumbHeight,snapshotHeight:e.thumbHeight,thumbSize:e.thumbSize,snapshotSize:e.thumbSize,thumbDownloadFlag:2,thumbUrl:vi(e.thumbUrl,s,i,n),snapshotUrl:vi(e.thumbUrl,s,i,n)}}updatePercent(e){this._percent=e,1<this._percent&&(this._percent=1)}updateVideoUrl(e){e&&(this.content.remoteVideoUrl=e)}updateSnapshotInfo(e){var{snapshotUrl:e,snapshotWidth:t,snapshotHeight:s}=e;Oe(e)||(this.content.thumbUrl=this.content.snapshotUrl=e),Oe(t)||(this.content.thumbWidth=this.content.snapshotWidth=Number(t)),Oe(s)||(this.content.thumbHeight=this.content.snapshotHeight=Number(s))}sendable(){return""!==this.content.remoteVideoUrl}}class bi{constructor(e){this.type=t.MSG_LOCATION;var{description:e,longitude:s,latitude:i}=e;this.content={description:e,longitude:s,latitude:i}}sendable(){return!0}}class Fi{constructor(e,s,i,n){var o,r;this.from=e.from,this.messageSender=e.from,this.time=e.time,this.messageSequence=e.sequence,this.clientSequence=e.clientSequence||e.sequence,this.messageRandom=e.random,this.cloudCustomData=e.cloudCustomData||"",this.clientTime=e.clientTime||void 0,e.ID?(this.ID=e.ID||"",this.nick=e.nick||"",this.avatar=e.avatar||"",e.messageBody?this.messageBody=JSON.parse(JSON.stringify(e.messageBody)):this.messageBody=[{type:e.type,payload:e.payload}],e.conversationType?e.conversationType.startsWith(t.CONV_C2C)?this.receiverUserID=e.to:e.conversationType.startsWith(t.CONV_GROUP)&&(this.receiverGroupID=e.to):e.receiverGroupID?this.receiverGroupID=e.receiverGroupID:e.receiverUserID&&(this.receiverUserID=e.receiverUserID),this.messageReceiver=e.to||e.messageReceiver):(this.nick=e.nick||"",this.avatar=e.avatar||"",this.messageBody=[],o=e.elements[0].type,r=e.elements[0].content,this._patchRichMediaPayload(o,r),this._updateRichMediaDownloadUrl(o,r,s,i,n),o===t.MSG_MERGER?this.messageBody.push({type:o,payload:new $i(r,s,i,n).content}):this.messageBody.push({type:o,payload:r}),e.groupID&&(this.receiverGroupID=e.groupID,this.messageReceiver=e.groupID),e.to&&(this.receiverUserID=e.to,this.messageReceiver=e.to),this.ID=`${e.tinyID}-${e.clientTime}-`+e.random)}_patchRichMediaPayload(e,s){e===t.MSG_IMAGE?s.imageInfoArray.forEach(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===t.MSG_VIDEO?!s.remoteVideoUrl&&s.videoUrl&&(s.remoteVideoUrl=s.videoUrl):e===t.MSG_AUDIO?!s.remoteAudioUrl&&s.url&&(s.remoteAudioUrl=s.url):e===t.MSG_FILE&&!s.fileUrl&&s.url&&(s.fileUrl=s.url,s.url=void 0)}_updateRichMediaDownloadUrl(e,s,i,n,o){(i||n)&&(e===t.MSG_IMAGE?s.imageInfoArray.forEach(e=>{e.url=vi(e.url,i,n,o)}):e===t.MSG_VIDEO?(s.videoUrl=vi(s.videoUrl,i,n,o),s.snapshotUrl=vi(s.thumbUrl,i,n,o),s.snapshotHeight=s.thumbHeight,s.snapshotWidth=s.thumbWidth):e===t.MSG_AUDIO?s.url=vi(s.url,i,n,o):e===t.MSG_FILE&&(s.fileUrl=vi(s.fileUrl,i,n,o)))}}var $i=class{constructor(e,s,i,n){if(this.type=t.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},e.downloadKey){const{downloadKey:t,pbDownloadKey:s,title:i,abstractList:n,compatibleText:o,version:r}=e;this.content.downloadKey=t,this.content.pbDownloadKey=s,this.content.title=i,this.content.abstractList=n,this.content.compatibleText=o,this.content.version=r||0}else if(Oe(e.messageList))1===e.layersOverLimit&&(this.content.layersOverLimit=!0);else{const{messageList:t,title:a,abstractList:c,compatibleText:l,version:_}=e,d=[];t.forEach(e=>{Oe(e)||(e=new Fi(e,s,i,n),d.push(e))}),this.content.messageList=d,this.content.title=a,this.content.abstractList=c,this.content.compatibleText=l,this.content.version=_||0}}sendable(){return!Oe(this.content.messageList)||!Oe(this.content.downloadKey)}};const qi={1:t.MSG_PRIORITY_HIGH,2:t.MSG_PRIORITY_NORMAL,3:t.MSG_PRIORITY_LOW,4:t.MSG_PRIORITY_LOWEST};class xi{constructor(e){this.ID="",this.conversationID=e.conversationID||null,this.conversationType=e.conversationType||t.CONV_C2C,this.conversationSubType=e.conversationSubType,this.time=e.time||Math.ceil(Date.now()/1e3),this.sequence=e.sequence||0,this.clientSequence=e.clientSequence||e.sequence||0,this.random=e.random||0===e.random?e.random:je(),this.priority=this._computePriority(e.priority),this.nick=e.nick||"",this.avatar=e.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=Rt(e.checkResult),this._elements=[],this.isPlaceMessage=e.isPlaceMessage||0,this.isRevoked=2===e.isPlaceMessage||8===e.msgFlagBits,this.from=e.from||null,this.to=e.to||null,this.flow="",this.isSystemMessage=e.isSystemMessage||!1,this.protocol=e.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=e.status||Nt,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=e.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!e.messageVersion,this._isExcludedFromUnreadCount=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!e.messageControlInfo||1!==e.messageControlInfo.excludedFromLastMessage),this.clientTime=e.clientTime||me()||0,this.senderTinyID=e.senderTinyID||e.tinyID||"",this.readReceiptInfo=e.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=!0===e.needReadReceipt||1===e.needReadReceipt,this.version=e.messageVersion||0,this.isBroadcastMessage=e.isBroadcastMessage||!1,this._receiverList=e.receiverList||void 0,this.isSupportExtension=!0===e.isSupportExtension||1===e.isSupportExtension,this._cmConfigID=e.customModerationConfigurationID,this.revoker=e.revokerInfo&&e.revokerInfo.revoker||"",this.revokerInfo=e.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=e.revokeReason||"",this.reInitialize(e.currentUser),this.extractGroupInfo(e.groupProfile||null),this.handleGroupAtInfo(e),this.initC2CReadReceiptInfo(e)}get elements(){return this._elements}getElements(){return this._elements}extractGroupInfo(e){null!==e&&(ke(e.nick)&&(this.nick=e.nick),ke(e.avatar)&&(this.avatar=e.avatar),e=e["messageFromAccountExtraInformation"],be(e)&&ke(e.nameCard)&&(this.nameCard=e.nameCard))}handleGroupAtInfo(e){e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(e=>{e!==t.MSG_AT_ALL?(this._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),this.atUserList.push(e)):(this._groupAtInfoList.push({groupAtAllFlag:1}),this.atUserList.push(t.MSG_AT_ALL))}),Fe(e.groupAtInfo)&&e.groupAtInfo.forEach(e=>{0===e.groupAtAllFlag?this.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&this.atUserList.push(t.MSG_AT_ALL)})}getGroupAtInfoList(){return this._groupAtInfoList}_initProxy(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}reInitialize(e){e&&(this.status=this.from?Nt:Ot,this.from||(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}isSendable(){return 0!==this._elements.length&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}_initTo(e){this.conversationType===t.CONV_GROUP&&(this.to=e.groupID)}_initSequence(e){0===this.clientSequence&&e&&(this.clientSequence=function(i){if(!i)return!1;if(void 0===Qe[i]){const n=new Date;let e=("3"+n.getHours()).slice(-2),t=("0"+n.getMinutes()).slice(-2),s=("0"+n.getSeconds()).slice(-2);Qe[i]=parseInt([e,t,s,"0001"].join("")),e=null,t=null,s=null,Ce.l("autoIncrementIndex start index:"+Qe[i])}return Qe[i]++}(e)),0===this.sequence&&this.conversationType===t.CONV_C2C&&(this.sequence=this.clientSequence)}generateMessageID(){this.from===t.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID=`${this.senderTinyID}-${this.clientTime}-`+this.random}_initFlow(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}_concatConversationID(e){var s=this["to"],i=this.conversationType;i!==t.CONV_SYSTEM?(e=i===t.CONV_C2C?e===this.from?s:this.from:this.to,this.conversationID=e?""+i+e:null):this.conversationID=t.CONV_SYSTEM}isElement(e){return e instanceof yi||e instanceof Ri||e instanceof Li||e instanceof Ai||e instanceof Gi||e instanceof wi||e instanceof Ni||e instanceof Ui||e instanceof ki||e instanceof bi||e instanceof $i}setElement(s,i,n,o){if(this.isElement(s))return this._elements=[s],void this._initProxy();var r=e=>{if(e.type&&e.content)switch(e.type){case t.MSG_TEXT:this.setTextElement(e.content);break;case t.MSG_IMAGE:this.setImageElement(e.content,i,n,o);break;case t.MSG_AUDIO:this.setAudioElement(e.content,i,n,o);break;case t.MSG_FILE:this.setFileElement(e.content,i,n,o);break;case t.MSG_VIDEO:this.setVideoElement(e.content,i,n,o);break;case t.MSG_CUSTOM:this.setCustomElement(e.content);break;case t.MSG_LOCATION:this.setLocationElement(e.content);break;case t.MSG_GRP_TIP:this.setGroupTipElement(e.content);break;case t.MSG_GRP_SYS_NOTICE:this.setGroupSystemNoticeElement(e.content);break;case t.MSG_FACE:this.setFaceElement(e.content);break;case t.MSG_MERGER:this.setMergerElement(e.content,i,n,o)}};if(Fe(s))for(let e=0;e<s.length;e++)r(s[e]);else r(s);this._initProxy()}clearElement(){this._elements.length=0}setTextElement(e){e="string"==typeof e?e:e.text,e=new yi({text:e});this._elements.push(e)}setImageElement(e,t,s,i){e=new Ri(e,t,s,i);this._elements.push(e)}setAudioElement(e,t,s,i){e=new Ai(e,t,s,i);this._elements.push(e)}setFileElement(e,t,s,i){e=new Gi(e,t,s,i);this._elements.push(e)}setVideoElement(e,t,s,i){e=new wi(e,t,s,i);this._elements.push(e)}setLocationElement(e){e=new bi(e);this._elements.push(e)}setCustomElement(e){e=new ki(e);this._elements.push(e)}setGroupTipElement(e){let s={};var i=e.operationType;if(Oe(e.memberInfoList)?e.operatorInfo&&(s=e.operatorInfo):i!==t.GRP_TIP_MBR_JOIN&&i!==t.GRP_TIP_MBR_KICKED_OUT&&i!==t.GRP_TIP_MBR_SET_ADMIN&&i!==t.GRP_TIP_MBR_CANCELED_ADMIN||(s=e.memberInfoList[0]),!Oe(e.memberExtraInfo)){const t=e.memberExtraInfo["reason"];e.msgMemberInfo.forEach(e=>{e.reason=t})}var{nick:i,avatar:n}=s,i=(ke(i)&&(this.nick=i),ke(n)&&(this.avatar=n),new Ni(e));this._elements.push(i)}setGroupSystemNoticeElement(e){e=new Ui(e);this._elements.push(e)}setFaceElement(e){e=new Li(e);this._elements.push(e)}setMergerElement(e,t,s,i){e=new $i(e,t,s,i);this._elements.push(e)}setIsRead(e){this.isRead=e}setRelayFlag(e){this._relayFlag=e}_computePriority(e){if($e(e))return t.MSG_PRIORITY_NORMAL;if(ke(e)&&-1!==Object.values(qi).indexOf(e))return e;if(Ge(e)){const t=""+e;if(-1!==Object.keys(qi).indexOf(t))return qi[t]}return t.MSG_PRIORITY_NORMAL}setNickAndAvatar(e){var{nick:e,avatar:t}=e;ke(e)&&(this.nick=e),ke(t)&&(this.avatar=t)}setNameCard(e){ke(e)&&(this.nameCard=e)}initC2CReadReceiptInfo(e){var{readReceiptSentByPeer:e,timestamp:s=0}=e;this.conversationType===t.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e,this.readReceiptInfo.timestamp=s)}}function Vi(e){var t=e.lastIndexOf(".");return-1===t?e:e.slice(0,t)}function Bi(e){const{androidInfo:t={},androidOPPOChannelID:s=""}=e,i=t.OPPOChannelID||s,{sound:n="",FCMChannelID:o="",...r}=t;return{...r,Sound:Vi(n),OPPOChannelID:i,GoogleChannelID:o}}function Ki(e){var{apnsInfo:e={},ignoreIOSBadge:t=!1,disableVoipPush:s}=e,t=!0===e.ignoreIOSBadge||!0===t?1:0;let i=void 0;return $e(s)||(i=!1===s?1:0),$e(e.disableVoipPush)||(i=!1===e.disableVoipPush?1:0),{...e,badgeMode:t,isVoipPush:i}}function Hi(e){if(be(e))return{pushFlag:!0===e.disablePush?1:0,title:e.title||"",desc:e.description||"",ext:e.extension||"",apnsInfo:Ki(e),androidInfo:Bi(e)}}class Wi extends oi{constructor(e){super(e),this._n="C2CModule",this._msgFromUnreadDBMap=new Map,this._noticeFromUnreadDBList=[]}onNewMessage(t){var{dataList:t,isInstantMessage:s,C2CRemainingUnreadList:i,C2CPairUnreadList:n,isSyncingEnded:o}=t;s||Ce.l(this._n+".onNewMessage C2CPairUnreadList:",n,"C2CRemainingUnreadList:",i);const{conversationOptionsList:r,messageList:a,isUnreadC2CMessage:c}=this._assembly({dataList:t,C2CRemainingUnreadList:i,C2CPairUnreadList:n,isInstantMessage:s}),l=Oe(t=a)?[]:t.filter(e=>!0===e.isModified);0<l.length&&this.emitOEvt(e.MESSAGE_MODIFIED,l),this.get(Ds).onNewMessage({conversationOptionsList:r,isInstantMessage:s,isUnreadC2CMessage:c,isSyncingEnded:o});n=Oe(i=a)?[]:i.filter(e=>!1===e.isModified);s&&0<n.length&&this.emitOEvt(e.MESSAGE_RECEIVED,n),a.length=0}_assembly({dataList:n,C2CRemainingUnreadList:o,C2CPairUnreadList:r,isInstantMessage:a}){let c=null;const l=[],d=[],s={},h=this.get($s);let _=!1;const u=this.get(Ds),p=this.get(Ts),e=this.get(Ns),g=this.getFileDownloadProxy(),m=this.getDowloadFileAuthKey(),f=e.getFileDNList();for(let i=0,e=n.length;i<e;i++)if(this._isC2CNotice(n[i]))this._noticeFromUnreadDBList.push(n[i].eventArray[0].c2CNotifyMsgArray[0]);else{const o=n[i],r=(o.currentUser=this.getMyUserID(),o.conversationType=t.CONV_C2C,o.isSystemMessage=!!o.isSystemMessage,($e(o.nick)||$e(o.avatar))&&(_=!0),(c=new xi(o)).setElement(o.elements,g,m,f),c.setNickAndAvatar({nick:o.nick,avatar:o.avatar}),c)["conversationID"];if(a){if(this._msgFromUnreadDBMap.get(c.ID))continue;let e=!1;if(c.from!==this.getMyUserID()){const n=u.getLatestMessageSentByPeer(r);if(n){const{nick:o,avatar:r}=n;_?c.setNickAndAvatar({nick:o,avatar:r}):o===c.nick&&r===c.avatar||(e=!0)}}else{const n=u.getLatestMessageSentByMe(r);if(n){const{nick:t,avatar:o}=n;t===c.nick&&o===c.avatar||(u.modifyMessageSentByMe({conversationID:r,latestNick:c.nick,latestAvatar:c.avatar}),p.mockOnNickAvatarModified(c.nick,c.avatar))}}let s=1===n[i].isModified;if(u.isMessageSentByCurrentInstance(c)?c.isModified=s:s=!1,0===o.msgLifeTime)c._onlineOnlyFlag=!0,u.isMessageSentByCurrentInstance(c)||d.push(c);else{if(!u.pushIntoMessageList(d,c,s))continue;e&&(u.modifyMessageSentByPeer({conversationID:r,latestNick:c.nick,latestAvatar:c.avatar}),u.updateUserProfileSpecifiedKey({conversationID:r,nick:c.nick,avatar:c.avatar}))}a&&0<c.clientTime&&h.addMessageDelay(c.clientTime)}else this._msgFromUnreadDBMap.set(c.ID,c);if(0!==o.msgLifeTime){if(!1===c._onlineOnlyFlag){const n=u.getLastMessageTime(r);if(!(Ge(n)&&c.time<n)&&a)if($e(s[r])){let e=0;"in"===c.flow&&(c._isExcludedFromUnreadCount||(e=1)),s[r]=l.push({conversationID:r,unreadCount:e,type:c.conversationType,subType:c.conversationSubType,lastMessage:c._isExcludedFromLastMessage?"":c})-1}else{const n=s[r];l[n].type=c.conversationType,l[n].subType=c.conversationSubType,l[n].lastMessage=c._isExcludedFromLastMessage?"":c,"in"===c.flow&&(c._isExcludedFromUnreadCount||l[n].unreadCount++)}}}else c._onlineOnlyFlag=!0}this._handleNoticeFromUnreadDB();let i=!1;if(Fe(r)&&0<r.length)for(let s=0,e=r.length;s<e;s++)if(r[s].from!==t.CONV_SYSTEM){i=!0;const n=l.find(({conversationID:e})=>e===""+t.CONV_C2C+r[s].from);n?n.unreadCount=r[s].unreadCount:l.push({conversationID:""+t.CONV_C2C+r[s].from,unreadCount:r[s].unreadCount,type:t.CONV_C2C})}if(Fe(o))for(let s=0,e=o.length;s<e;s++)l.find(({conversationID:e})=>e===""+t.CONV_C2C+o[s].from)||l.push({conversationID:""+t.CONV_C2C+o[s].from,type:t.CONV_C2C,lastMsgTime:o[s].lastMsgTime});return{conversationOptionsList:l,messageList:d,isUnreadC2CMessage:i}}getMessageListFromUnreadDB(){return[...this._msgFromUnreadDBMap.values()]}_isC2CNotice(e){e=e.eventArray;return!(!Fe(e)||10!==e[0].event)}_handleNoticeFromUnreadDB(){var e=this._noticeFromUnreadDBList.length;if(0!==e){Ce.l(this._n+"._handleNoticeFromUnreadDB count:"+e);const t=[];this._noticeFromUnreadDBList.forEach(e=>{e.hasOwnProperty("c2cMessageRevokedNotify")&&t.push(e)}),this.onMsgRevoked({dataList:t}),this._noticeFromUnreadDBList.length=0,t.length=0}}onMsgRevoked(s,i){const r=this.get(Ds),a=[];let c;s.dataList.forEach(e=>{if(e.c2cMessageRevokedNotify){const s=e.c2cMessageRevokedNotify["revokedInfos"];$e(s)||s.forEach(e=>{var s=this.getMyUserID()===e.from?""+t.CONV_C2C+e.to:""+t.CONV_C2C+e.from,i=(c=r.revoke(s,e.sequence,e.random),e.revokerInfo&&e.revokerInfo.revoker),n=e.revokerInfo&&e.revokerInfo.reason||"";let o;c?o=c:(o={conversationID:s,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(o.ID=`${e.tinyID}-${e.clientTime}-`+e.random),e.time&&(o.time=e.time)),o&&(o.revoker=i,o.revokeReason=n,o.revokerInfo={userID:i,nick:"",avatar:""},a.push(o))})}}),0!==a.length&&(Ce.l(`${this._n}.onMsgRevoked count:${a.length} updateUnreadCount:`+i),r.onMessageRevoked(a,i),r.updateRevokerInfo(a).then(t=>{this.emitOEvt(e.MESSAGE_REVOKED,t)}))}onMsgReadReceipt(e){e.dataList.forEach(e=>{if(!Oe(e.c2cMessageReadReceipt)){const n=e.c2cMessageReadReceipt["to"];e.c2cMessageReadReceipt.uinPairReadArray.forEach(e=>{e=e.peerReadTime;Ce.l(`${this._n}.onMsgReadReceipt to:${n} peerReadTime:`+e);const s=""+t.CONV_C2C+n,i=this.get(Ds);i.recordPeerReadTime(s,e),i.updateMsgIsPeerReadProp(s,e)})}})}onMsgReadNotice(e){e.dataList.forEach(e=>{if(!Oe(e.c2cMessageReadNotice)){const i=this.get(Ds);e.c2cMessageReadNotice.uinPairReadArray.forEach(e=>{var{from:e,peerReadTime:s}=e,e=(Ce.l(this._n+`.onMsgReadNotice from:${e} lastReadTime:`+s),""+t.CONV_C2C+e);i.updateIsReadAfterReadReport({conversationID:e,lastMessageTime:s}),i.updateUnreadCount(e)})}})}onMsgModified(e){Ce.l(this._n+".onMsgModified options:",e);const s=this.get(Ds);e.dataList.forEach(e=>{s.onMessageModified({...e,conversationType:t.CONV_C2C})})}onReadReceiptList(e){Ce.l(this._n+".onReadReceiptList options:",e),this.get(Ds).updateReadReceiptInfo(e.dataList)}sendMessage(e,t){e=this._createC2CMessagePack(e,t);return this.req(e)}_createC2CMessagePack(e,t){let s=null,i=(t&&(t.offlinePushInfo&&(s=t.offlinePushInfo),!0===t.onlineUserOnly&&(s?s.disablePush=!0:s={disablePush:!0})),"");ke(e.cloudCustomData)&&0<e.cloudCustomData.length&&(i=e.cloudCustomData);const n=[];if(be(t)&&be(t.messageControlInfo)){const{excludedFromUnreadCount:e,excludedFromLastMessage:s,excludedFromContentModeration:i}=t.messageControlInfo;!0===e&&n.push("NoUnread"),!0===s&&n.push("NoLastMsg"),!0===i&&n.push("NoMsgCheck")}var o=this.isOnlineMessage(e,t)?0:void 0,r=JSON.parse(JSON.stringify(e.getElements())),a=this.get(Ns).getFileDNList();return{P:ri.SEND_C2C_MSG,data:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:Ei(e.type,r,a),cloudCustomData:i,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:o,nick:e.nick,avatar:e.avatar,offlinePushInfo:Hi(s),messageControlInfo:0!==o?n:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:it(t)}}}isOnlineMessage(e,t){return!(!t||!0!==t.onlineUserOnly)}revokeMessage(e){return this.req({P:ri.REVOKE_C2C_MSG,data:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}deleteMessage(e){var{to:e,keyList:t}=e;return Ce.l(this._n+`.deleteMessage toAccount:${e} count:`+t.length),this.req({P:ri.DEL_C2C_MSG,data:{fromAccount:this.getMyUserID(),to:e,keyList:t}})}modifyRemoteMessage(e){const{from:s,to:i,version:n=0,sequence:o,random:r,time:a,payload:_,type:c,cloudCustomData:u,_elements:l}=e;let d=void 0;return(e=c)!==t.MSG_TEXT&&e!==t.MSG_CUSTOM&&e!==t.MSG_LOCATION&&e!==t.MSG_FACE||(1<l.length&&l.splice(0,1,{type:c,content:_}),d=l),this.req({P:ri.MODIFY_C2C_MSG,data:{from:s,to:i,version:n,sequence:o,random:r,time:a,elements:d,cloudCustomData:u}})}setMessageRead({conversationID:t,lastMessageTime:s}){const i=this._n+".setMessageRead",e=`convID:${t} lastMessageTime:`+s,n=(Ce.l(i+" "+e),Ge(s)||this.warn("DoNotModifyLastTime"),new Ti("setMessageRead"));return n.setMessage(e),this.req({P:ri.SET_C2C_MSG_READ,data:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:t.replace("C2C",""),lastMessageTime:s,receipt:1}]}}}).then(()=>{n.end(),Ce.l(i+" ok");const e=this.get(Ds);return e.updateIsReadAfterReadReport({conversationID:t,lastMessageTime:s}),e.updateUnreadCount(t),Zs()}).catch(e=>(n.setError(e).end(),Ce.l(i+" failed. error:",e),ni(e)))}getRoamingMessage(e){const c=this._n+".getRoamingMessage",{peerAccount:s,conversationID:l,count:i,lastMessageTime:n,messageKey:o}=e,d=`peerAccount:${s} count:${i||15} lastMessageTime:${n||0} messageKey:`+o,_=(Ce.l(c+" "+d),new Ti("getRoamingMessage"));return this.req({P:ri.GET_C2C_ROAMING_MSG,data:{peerAccount:s,count:i||15,lastMessageTime:n||0,messageKey:o}}).then(e=>{var{complete:e,messageList:s,messageKey:i,lastMessageTime:n}=e.data;$e(s)?Ce.l(c+` ok. complete:${e} but messageList is undefined!`):Ce.l(c+` ok. complete:${e} count:`+s.length),_.setMessage(d+` complete:${e} length:`+s.length).end();const o=this.get(Ds),r=1===e;r&&o.setCompleted(l);e=[],s=o.onRoamingMessage(s,l,!0,e),o.modifyMessageList(l),o.updateIsRead(l),o.updateRoamingMsgKeyAndTime(l,i,n),i=o.getPeerReadTime(l);if(Ce.l(c+` update isPeerRead property. convID:${l} peerReadTime:`+i),i)o.updateMsgIsPeerReadProp(l,i);else{const e=l.replace(t.CONV_C2C,"");this.getRemotePeerReadTime([e]).then(()=>{o.updateMsgIsPeerReadProp(l,o.getPeerReadTime(l))})}let a="";if(0<s.length)a=s[0].ID;else{const e=o.getLocalOldestMessage(l);e&&(a=e.ID)}return Ce.l(c+` nextReqID:${a} storedMsgCount:`+s.length),{nextReqID:a,storedMessageList:s,assembledMessageList:e,isPullingCompleted:r}}).catch(e=>(_.setMessage(d).setError(e).end(),Ce.w(c+" failed. error:",e),ni(e)))}getRoamingMessagesHopping(e){const l=this._n+".getRoamingMessagesHopping",{peerAccount:s,time:i=0,count:n,direction:d}=e,_=""+t.CONV_C2C+s,u=`peerAccount:${s} count:${n} time:${i} direction:`+d,h=(Ce.l(l+" "+u),new Ti("getRoamingMessagesHopping"));return this.req({P:ri.GET_C2C_ROAMING_MSG,data:{peerAccount:s,count:n+1,lastMessageTime:i,direction:d}}).then(e=>{const{complete:s,messageList:i=[],lastMessageTime:n}=e.data,o=`complete:${s} count:`+i.length,r=(Ce.l(l+" ok. "+o),h.setMessage(u+" "+o).end(),1!==s&&(1===d?i.pop():i.shift()),this.get(Ds)),a=r.onRoamingMessage(i,_,!1);this._modifyMessageList(_,a);var e=this._computeResult({complete:s,lastMessageTime:n,resultList:a}),c=(r.storeHoppingMessageList(e.messageList),r.getPeerReadTime(_));if(Ce.l(l+` update isPeerRead property. convID:${_} peerReadTime:`+c),c)r.updateMsgIsPeerReadProp(_,c);else{const e=_.replace(t.CONV_C2C,"");this.getRemotePeerReadTime([e]).then(()=>{r.updateMsgIsPeerReadProp(_,r.getPeerReadTime(_))})}return Zs(e)}).catch(e=>(h.setMessage(u).setError(e).end(),Ce.w(l+" failed. error:",e),ni(e)))}_computeResult(e){const{complete:t=0,lastMessageTime:s,resultList:i=[]}=e,n={messageList:[...i],isCompleted:!1,nextMessageTime:""};return 1===t?n.isCompleted=!0:n.nextMessageTime=s,n}_modifyMessageList(t,s){t=this.get(Ds).getLocalConversation(t);if(t){var i=t.userProfile.nick,n=t.userProfile.avatar,t=this.get(Ts).getNickAndAvatarByUserID(this.getMyUserID()),o=t.nick,r=t.avatar;for(let e=s.length-1;0<=e;e--){const t=s[e];"in"===t.flow&&(t.nick!==i&&t.setNickAndAvatar({nick:i}),t.avatar!==n&&t.setNickAndAvatar({avatar:n})),"out"===t.flow&&(t.nick!==o&&t.setNickAndAvatar({nick:o}),t.avatar!==r&&t.setNickAndAvatar({avatar:r}))}}}getRemotePeerReadTime(o){const r=this._n+".getRemotePeerReadTime";if(Oe(o))return Promise.resolve();const a=new Ti("getRemotePeerReadTime");return Ce.l(r+" userIDList:"+o),this.req({P:ri.GET_C2C_PEER_READ_TIME,data:{userIDList:o}}).then(e=>{var s=e.data["peerReadTimeList"];Ce.l(r+" ok. peerReadTimeList:"+s);let i="";const n=this.get(Ds);for(let e=0;e<o.length;e++)i+=`${o[e]}-${s[e]} `,0<s[e]&&n.recordPeerReadTime(""+t.CONV_C2C+o[e],s[e]);a.setMessage(i).end()}).catch(e=>{a.setError(e).end(),Ce.w(r+" failed. error:",e)})}sendReadReceipt(e){const s=e[0].conversationID.replace(t.CONV_C2C,""),i=new Ti("sendReadReceipt"),n=(i.setMessage("peerAccount:"+s),this.getMyUserID()),o=e.filter(e=>e.from!==n&&!0===e.needReadReceipt).map(e=>{var{from:e,to:t,sequence:s,random:i,time:n,clientTime:o}=e;return{fromAccount:e,toAccount:t,sequence:s,random:i,time:n,clientTime:o}});if(0===o.length)return ni({code:ei.READ_RECEIPT_MSG_LIST_EMPTY});const r=this._n+".sendReadReceipt";return Ce.l(r+`. peerAccount:${s} length:`+o.length),this.req({P:ri.SEND_C2C_READ_RECEIPT,data:{peerAccount:s,messageInfoList:o}}).then(e=>(i.end(),Ce.l(r+" ok"),Zs())).catch(e=>(i.setError(e).end(),Ce.w(r+" failed. error:",e),ni(e)))}getReadReceiptList(e){var s=e[0].conversationID.replace(t.CONV_C2C,"");return Ce.l(this._n+`.getReadReceiptList peerAccount:${s} msgCount:`+e.length),ii({messageList:e})}getMessageExtensions(e,t){return Ce.l(this._n+".getMessageExtensions startSequence:"+t),this.req({P:ri.GET_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}modifyMsgExts(e,t,s=1){return Ce.l(this._n+".modifyMsgExts operateType:"+s),this.req({P:ri.MODIFY_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:s}})}getMessageKey(e){var{clientSequence:e,random:t,time:s}=e;return e+`_${t}_`+s}reset(){Ce.l(this._n+".reset"),this._msgFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0}}const Yi={A2KEY_AND_TINYID_UPDATED:"_inner1",CLOUD_CONFIG:"_inner2",PROFILE_UPDATED:"_inner3",CONV_SYNC_COMPLETED:"_inner4",C2C_UNREAD_HANDLE_COMPLETED:"_inner5"};class zi{constructor(e){this._convM=e,this._map=new Map,this._n="MsgListHandler",this._latestMsgSentByPeerMap=new Map,this._latestMsgSentByMeMap=new Map,this._hoppingMsgMap=new Map,this.TOPIC_MSG_LIMIT=1e3,this._convM.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var e=this._convM.getCloudConfig("topic_msg_limit");$e(e)||(this.TOPIC_MSG_LIMIT=Number(e)),Ce.l(this._n+"._onCloudConfig topicMsgLimit:"+this.TOPIC_MSG_LIMIT)}onCheckTimer(e){if(e%20==0&&0<this._map.size)for(var[t,s]of this._map)t.includes(Le)&&s.size>=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(t,!0)}pushIn(e,t=!1){var s=e["conversationID"];let i=!0;this._map.has(s)||this._map.set(s,new Map);var n=this._getUniqueIDOfMsg(e);if(this._map.get(s).has(n)){const e=this._map.get(s).get(n);if(!t||!0===e.isModified)return i=!1}return this._map.get(s).set(n,e),this._setLatestMsgSentByPeer(s,e),this._setLatestMsgSentByMe(s,e),i}unshift(s,i){let n;if(Fe(s)?0<s.length&&(n=s[0].conversationID,this._unshiftMultipleMsgs(s,i)):(n=s.conversationID,this._unshiftSingleMsg(s,i)),n){const s=Array.from(this._map.get(n).values()),i=s.length;if(0!==i){for(let e=i-1;0<=e;e--)if("out"===s[e].flow){this._setLatestMsgSentByMe(n,s[e]);break}if(n.startsWith(t.CONV_C2C))for(let e=i-1;0<=e;e--)if("in"===s[e].flow){this._setLatestMsgSentByPeer(n,s[e]);break}}}}_unshiftSingleMsg(e,t){var s=e["conversationID"],i=this._getUniqueIDOfMsg(e);if(!this._map.has(s))return this._map.set(s,new Map),this._map.get(s).set(i,e),void t.push(e);const n=this._map.get(s),o=Array.from(n);n.has(i)||(o.unshift([i,e]),this._map.set(s,new Map(o)),t.push(e))}_unshiftMultipleMsgs(t,s){const i=t.length,n=[],e=t[0].conversationID,o=this._map.get(e),r=this._map.has(e)?Array.from(o):[];for(let e=0;e<i;e++){const i=this._getUniqueIDOfMsg(t[e]);o&&o.has(i)||(n.push([i,t[e]]),s.push(t[e]))}this._map.set(e,new Map(n.concat(r)))}remove(e){var t=e["conversationID"],e=this._getUniqueIDOfMsg(e);this._map.has(t)&&this._map.get(t).delete(e)}revoke(e,t,s){var i;return this._map.has(e)?(i=this._map.get(e),this._updateMsgIsRevoked(i,t,s)):this._hoppingMsgMap.has(e)?(i=this._hoppingMsgMap.get(e),this._updateMsgIsRevoked(i,t,s)):null}_updateMsgIsRevoked(e,t,s){for(var[,i]of e)if(i.sequence===t&&($e(s)||i.random===s))return i.isRevoked||(i.isRevoked=!0),i}removeByConvID(e){var t=this._map.has(e);Ce.l(this._n+`.removeByConvID convID:${e} has:`+t),t&&(this._map.delete(e),this._latestMsgSentByPeerMap.delete(e),this._latestMsgSentByMeMap.delete(e))}findMessage(e){let t=null;return t=(t=this._findMsg(e,this._map))||this._findMsg(e,this._hoppingMsgMap)}_findMsg(t,s){let i=null;for(var[,e]of s){const s=[...e.values()],n=s.length;for(let e=0;e<n;e++)if(s[e].ID===t){i=s[e];break}}return i}updateMsgIsPeerReadProp(e,t){let s=[];var i;return this._map.has(e)?(i=this._map.get(e),s=this._updateMsgIsPeerReadProp(i,t)):this._hoppingMsgMap.has(e)&&(i=this._hoppingMsgMap.get(e),s=this._updateMsgIsPeerReadProp(i,t)),Ce.l(this._n+`.updateMsgIsPeerReadProp convID:${e} peerReadTime:${t} count:`+s.length),s}_updateMsgIsPeerReadProp(e,t){const s=[];for(var[,i]of e)i.time<=t&&!i.isPeerRead&&"out"===i.flow&&(i.isPeerRead=!0,s.push(i));return s}updateMsgIsModifiedProp(e){var t=e["conversationID"];if(this._map.has(t)){const s=this._getUniqueIDOfMsg(e),i=this._map.get(t).get(s);i&&(i.isModified=!0)}}hasLocalMsgList(e){return this._map.has(e)}getLocalMsgList(e){return this.hasLocalMsgList(e)?[...this._map.get(e).values()]:[]}getLocalMaxSeq(e){if(!this.hasLocalMsgList(e))return 0;e=[...this._map.get(e).values()].map(e=>e.sequence);return Math.max(...e)}getLocalMaxTime(e){if(!this.hasLocalMsgList(e))return 0;e=[...this._map.get(e).values()].map(e=>e.time);return Math.max(...e)}hasLocalMsg(e,t){let s=!1;var i=this.getLocalMsgList(e),n=i.length;for(let e=0;e<n;e++)i[e].ID===t&&(s=!0);return s}getLocalMsg(e,t){let s=null;var i=this.getLocalMsgList(e),n=i.length;for(let e=0;e<n;e++)if(i[e].ID===t){s=i[e];break}return s}getLocalLastMsg(e){e=this.getLocalMsgList(e);return e[e.length-1]}getLocalSecondLastMsg(e){e=this.getLocalMsgList(e);return e[e.length-2]}getLocalOldestMsg(e){return this.getLocalMsgList(e)[0]}_setLatestMsgSentByPeer(e,s){e.startsWith(t.CONV_C2C)&&"in"===s.flow&&this._latestMsgSentByPeerMap.set(e,s)}_setLatestMsgSentByMe(e,t){"out"===t.flow&&this._latestMsgSentByMeMap.set(e,t)}getLatestMsgSentByPeer(e){return this._latestMsgSentByPeerMap.get(e)}getLatestMsgSentByMe(e){return this._latestMsgSentByMeMap.get(e)}modifyMsgSentByPeer(n){const{conversationID:e,latestNick:o,latestAvatar:r}=n,t=this._map.get(e);if(!Oe(t)){var a=Array.from(t.values()),n=a.length;if(0!==n){let t=null,s=0,i=!1;for(let e=n-1;0<=e;e--)"in"===a[e].flow&&((t=a[e]).nick!==o&&(t.setNickAndAvatar({nick:o}),i=!0),t.avatar!==r&&(t.setNickAndAvatar({avatar:r}),i=!0),i&&(s+=1));Ce.l(this._n+`.modifyMsgSentByPeer convID:${e} count:`+s)}}}modifyMsgSentByMe(n){const{conversationID:e,latestNick:o,latestAvatar:r}=n,t=this._map.get(e);if(!Oe(t)){var a=Array.from(t.values()),n=a.length;if(0!==n){let t=null,s=0,i=!1;for(let e=n-1;0<=e;e--)"out"===a[e].flow&&((t=a[e]).nick!==o&&(t.setNickAndAvatar({nick:o}),i=!0),t.avatar!==r&&(t.setNickAndAvatar({avatar:r}),i=!0),i&&(s+=1));Ce.l(this._n+`.modifyMsgSentByMe convID:${e} count:`+s)}}}getTopicConvIDList(s){return[...this._map.keys()].filter(e=>e.startsWith(""+t.CONV_GROUP+s))}onMsgModified(e,t){if(!this._map.has(e)&&!this._hoppingMsgMap.has(e))return{isUpdated:!1,message:null};const s=this._n+".onMsgModified",i=this._getUniqueIDOfMsg(t),n=this._getTargetMsg(e,i),o=!!n;if(Ce.l(s+` convID:${e} uniqueID:${i} has:`+o),o){const{messageVersion:e,elements:i,cloudCustomData:o,checkResult:r}=t;return Ce.l(s+` localVersion:${n.version} remoteVersion:`+e),n.version<e?(n.version=e,n._elements=JSON.parse(JSON.stringify(i)),n.payload=n._elements[0].content,n.type=n._elements[0].type,n.cloudCustomData=o,n.isModified=!0,n.hasRiskContent=Rt(r),{isUpdated:!0,message:n}):{isUpdated:!1,message:n}}return{isUpdated:!1,message:null}}_getUniqueIDOfMsg(e){var{from:e,to:t,random:s,sequence:i,time:n}=e;return e+`-${t}-${s}-${i}-`+n}_getTargetMsg(e,t){if(this._map.has(e))return this._map.get(e).get(t);let s=void 0;if(this._hoppingMsgMap.has(e)){var i=[...this._hoppingMsgMap.get(e).values()];for(let e=0;e<i.length;e++)if(this._getUniqueIDOfMsg(i[e])===t){s=i[e];break}}return s}storeHoppingMsgList(t){if(0!==t.length){const s=t[0]["conversationID"],i=t.length,n=(this._hoppingMsgMap.has(s)||this._hoppingMsgMap.set(s,new Map),this._hoppingMsgMap.get(s));for(let e=0;e<i;e++){const s=t[e];n.has(s.ID)||n.set(s.ID,s)}}}getHoppingMsg(e,t){if(this._hoppingMsgMap.has(e))return this._hoppingMsgMap.get(e).get(t)}reset(){this._map.clear(),this._latestMsgSentByPeerMap.clear(),this._latestMsgSentByMeMap.clear(),this._hoppingMsgMap.clear()}}function ji(e){this.mixin(e)}ji.mixin=function(e){const t=e.prototype||e;t._isReady=!1,t.ready=function(e,t=!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(){this._isReady=!0,setTimeout(()=>{const e=this._readyQueue;this._readyQueue=[],e&&0<e.length&&e.forEach(function(e){e.call(this)},this)},1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};const Ji=["jpg","jpeg","gif","png","bmp","image","webp"],Xi=["mp4","quicktime","mov"],Zi=1,Qi=2,en=3,tn=255;class sn{constructor(e){Oe(e)||(this.userID=e.userID||"",this.nick=e.nick||"",this.gender=e.gender||"",this.birthday=e.birthday||0,this.location=e.location||"",this.selfSignature=e.selfSignature||"",this.allowType=e.allowType||t.ALLOW_TYPE_ALLOW_ANY,this.language=e.language||0,this.avatar=e.avatar||"",this.messageSettings=e.messageSettings||0,this.adminForbidType=e.adminForbidType||t.FORBID_TYPE_NONE,this.level=e.level||0,this.role=e.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],Oe(e.profileCustomField)||e.profileCustomField.forEach(e=>{this.profileCustomField.push({key:e.key,value:e.value})}))}validate(s){let i=!0,e="";if(Oe(s))return{valid:!1,tips:"empty options"};if(s.profileCustomField){const i=s.profileCustomField.length;let t=null;for(let e=0;e<i;e++){if(t=s.profileCustomField[e],!ke(t.key)||-1===t.key.indexOf("Tag_Profile_Custom"))return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!ke(t.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}}for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)){if("profileCustomField"===t)continue;if(Oe(s[t])&&!ke(s[t])&&!Ge(s[t])){e="key:"+t+", invalid value:"+s[t],i=!1;continue}switch(t){case"nick":ke(s[t])||(e="nick must be a string",i=!1),500<ze(s[t])&&(e=`nick name limited: must less than or equal to 500 bytes, current size: ${ze(s[t])} bytes`,i=!1);break;case"gender":Ze(Ee,s.gender)||(e="key:gender, invalid value:"+s.gender,i=!1);break;case"birthday":Ge(s.birthday)||(e="birthday must be a number",i=!1);break;case"location":ke(s.location)||(e="location must be a string",i=!1);break;case"selfSignature":ke(s.selfSignature)||(e="selfSignature must be a string",i=!1);break;case"allowType":Ze(De,s.allowType)||(e="key:allowType, invalid value:"+s.allowType,i=!1);break;case"language":Ge(s.language)||(e="language must be a number",i=!1);break;case"avatar":ke(s.avatar)||(e="avatar must be a string",i=!1);break;case"messageSettings":0!==s.messageSettings&&1!==s.messageSettings&&(e="messageSettings must be 0 or 1",i=!1);break;case"adminForbidType":Ze(Se,s.adminForbidType)||(e="key:adminForbidType, invalid value:"+s.adminForbidType,i=!1);break;case"level":Ge(s.level)||(e="level must be a number",i=!1);break;case"role":Ge(s.role)||(e="role must be a number",i=!1);break;default:e="unknown key:"+t+" "+s[t],i=!1}}return{valid:i,tips:e}}}class nn{constructor(e){this.MAX_LENGTH=e,this.map=new Map}set(e){if(this.map.size>=this.MAX_LENGTH){const e=this.map.entries().next().value[0];this.map.delete(e)}this.map.set(e,1)}has(e){return this.map.has(e)}delete(e){this.has(e)&&this.map.delete(e)}reset(){this.map.clear()}}const on=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"];class rn{constructor(e){this.groupID="",this.name="",this.avatar="",this.type="",this.introduction="",this.notification="",this.ownerID="",this.createTime="",this.infoSequence="",this.lastInfoTime="",this.selfInfo={messageRemindType:"",joinTime:"",nameCard:"",role:"",userID:"",memberCustomField:void 0,readedSequence:0,excludedUnreadSequenceList:void 0},this.lastMessage={lastTime:"",lastSequence:"",fromAccount:"",messageForShow:""},this.nextMessageSeq="",this.memberNum="",this.memberCount="",this.maxMemberNum="",this.maxMemberCount="",this.joinOption="",this.inviteOption="",this.groupCustomField=[],this.muteAllMembers=!1,this.isSupportTopic=!1,this._lastRevokedTime=0,this._initGroup(e)}set memberNum(e){}set maxMemberNum(e){}get memberNum(){return this.memberCount}get maxMemberNum(){return this.maxMemberCount}_initGroup(e){for(const t in e)on.indexOf(t)<0||("selfInfo"!==t?("memberNum"===t&&(this.memberCount=e[t]),"maxMemberNum"===t&&(this.maxMemberCount=e[t]),"isSupportTopic"!==t?this[t]=e[t]:this.isSupportTopic=1===e[t]):this.updateSelfInfo(e[t]))}updateGroup(e){e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0);const t=JSON.parse(JSON.stringify(e));t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),$e(t.muteAllMembers)||("On"===t.muteAllMembers?t.muteAllMembers=!0:t.muteAllMembers=!1),t.groupCustomField&&st(this.groupCustomField,t.groupCustomField),$e(t.memberNum)||(this.memberCount=t.memberNum),$e(t.maxMemberNum)||(this.maxMemberCount=t.maxMemberNum),$e(t.isSupportTopic)||(this.isSupportTopic=Ge(t.isSupportTopic)?1===t.isSupportTopic:t.isSupportTopic),We(this,t,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),Fe(t.members)&&0<t.members.length&&t.members.forEach(e=>{e.userID===this.selfInfo.userID&&We(this.selfInfo,e,["sequence"])})}updateSelfInfo({nameCard:e,joinTime:t,role:s,messageRemindType:i,readedSequence:n,excludedUnreadSequenceList:o}){e={nameCard:e,joinTime:t,role:s,messageRemindType:i,readedSequence:n,excludedUnreadSequenceList:o};We(this.selfInfo,{...e},[],["",null,void 0,0,NaN])}setSelfNameCard(e){this.selfInfo.nameCard=e}}const an=function(e,t,s){return $e(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:s&&e.ID||e instanceof xi?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:yt(e.type,e.payload,t),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}:{...e,messageForShow:yt(e.type,e.payload,t)}};class cn{constructor(e,t,s=!1){this.conversationID=e.conversationID||"",this.unreadCount=e.unreadCount||0,this.type=e.type||"",this.lastMessage=an(e.lastMessage,t,s),e.lastMsgTime&&(this.lastMessage.lastTime=e.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=e.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=e.isPinned||!1,this.messageRemindType=e.messageRemindType,this.markList=e.markList||[],this.customData=e.customData||"",this.conversationGroupList=e.conversationGroupList||[],this.draftText=e.draftText||"",this._initProfile(e),this.subType=this.groupProfile?this.groupProfile.type:""}get toAccount(){return this.conversationID.startsWith(t.CONV_C2C)?this.conversationID.replace(t.CONV_C2C,""):this.conversationID.startsWith(t.CONV_GROUP)?this.conversationID.replace(t.CONV_GROUP,""):""}_initProfile(s){Object.keys(s).forEach(e=>{switch(e){case"userProfile":this.userProfile=s.userProfile;break;case"groupProfile":this.groupProfile=s.groupProfile}}),$e(this.userProfile)&&this.type===t.CONV_C2C?this.userProfile=new sn({userID:s.conversationID.replace("C2C","")}):$e(this.groupProfile)&&this.type===t.CONV_GROUP&&(this.groupProfile=new rn({groupID:s.conversationID.replace("GROUP","")}))}updateUnreadCount(e){var{nextUnreadCount:e,isFromGetConversations:s,isUnreadC2CMessage:i}=e;$e(e)||(nt(this.subType)?this.unreadCount=0:s&&this.type===t.CONV_GROUP||s&&this.type===t.CONV_TOPIC||i&&this.type===t.CONV_C2C?this.unreadCount=e:this.unreadCount=this.unreadCount+e)}updateLastMessage(e){this.lastMessage=an(e)}updateGroupAtInfoList(s){if(!this._isNeedMergeGroupAtInfo(s)){let[...e]=s.groupAtType;-1!==e.indexOf(t.CONV_AT_ME)&&-1!==e.indexOf(t.CONV_AT_ALL)&&(e=[t.CONV_AT_ALL_AT_ME]);s={from:s.from,groupID:s.groupID,topicID:s.topicID,messageSequence:s.sequence,atTypeArray:e,__random:s.__random,__sequence:s.__sequence};this.groupAtInfoList.push(s)}}_isNeedMergeGroupAtInfo(s){const{groupID:e,sequence:i}=s;if(!ot({groupID:e}))return!1;let n=!1;return this.groupAtInfoList.forEach(e=>{e.messageSequence===i&&(-1<e.atTypeArray.indexOf(t.CONV_AT_ME)&&-1<s.groupAtType.indexOf(t.CONV_AT_ALL)&&(e.atTypeArray=[t.CONV_AT_ALL_AT_ME]),-1<e.atTypeArray.indexOf(t.CONV_AT_ALL)&&-1<s.groupAtType.indexOf(t.CONV_AT_ME)&&(e.atTypeArray=[t.CONV_AT_ALL_AT_ME],e.__random=s.__random,e.__sequence=s.__sequence),n=!0)}),n}clearGroupAtInfoList(){this.groupAtInfoList.length=0}reduceUnreadCount(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}isLastMessageRevoked({sequence:e,time:s}){return this.type===t.CONV_C2C&&e===this.lastMessage.lastSequence&&s===this.lastMessage.lastTime||this.type===t.CONV_GROUP&&e===this.lastMessage.lastSequence}setLastMessageRevoked(e){this.lastMessage.isRevoked=e}setLastMessageRevoker(e){this.lastMessage.revoker=e}setDraftText(e){this.draftText=e}}const ln={[t.MSG_REMIND_ACPT_AND_NOTE]:0,[t.MSG_REMIND_DISCARD]:1,[t.MSG_REMIND_ACPT_NOT_NOTE]:2};class un{constructor(e){this._convM=e,this._n="MsgRemindHandler"}onAllRcvMsgOptNotify(t){t=this._handleResult(t);this._convM.emitOEvt(e.ALL_RECEIVE_MESSAGE_OPT_UPDATED,t)}getC2CMsgRemindType(t){const s=this._n+".getC2CMsgRemindType";return this._convM.req({P:ri.GET_C2C_PEER_MUTE_NOTIFICATIONS,data:{toAccount:this._convM.getMyUserID(),userIDList:t}}).then(e=>{Ce.l(s+" ok. userIDList:"+t);e=e.data.muteFlagList;this._convM.onC2CMsgRemindTypeFetched(e)}).catch(e=>{Ce.e(s+" failed. error:",e)})}set(e){return e.groupID?this._setGroupMsgRemindType(e):Fe(e.userIDList)?this._setC2CMsgRemindType(e):void 0}_setGroupMsgRemindType(t){const s=this._n+"._setGroupMsgRemindType",{groupID:e,messageRemindType:i}=t,n=`groupID:${e} messageRemindType:`+i,o=new Ti("_setGroupMsgRemindType"),r=(o.setMessage(n),this._get(vs));return r?r.modifyGroupMemberInfo({groupID:e,messageRemindType:i,userID:this._convM.getMyUserID()}).then(()=>{o.end(),Ce.l(s+" ok. "+n);var e=this.onGroupMsgRemindTypeUpdated(t);return this._convM.onTotalUnreadCountUpdate(),Zs(e)}).catch(e=>(o.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e))):ni({code:ei.NO_MODULE})}onGroupMsgRemindTypeUpdated(t){var{groupID:s,messageRemindType:i}=t;Ce.l(this._n+`.onGroupMsgRemindTypeUpdated groupID:${s} messageRemindType:`+i);const n=this._get(vs).getLocalGroupProfile(s);if(n&&(n.selfInfo.messageRemindType=i),rt(s)){const t=s,n=Tt(t),o=this._get(Ss).getLocalTopic(n,t);return o&&o.updateSelfInfo({messageRemindType:i})&&this._convM.emitOEvt(e.TOPIC_UPDATED,{groupID:n,topic:o}),{topic:o}}return this._convM.patchMsgRemindType({ID:s,isC2CConversation:!1,messageRemindType:i})&&this._emitConvUpdate(),{group:n}}_setC2CMsgRemindType(e){const r=this._n+"._setC2CMsgRemindType",{userIDList:t,messageRemindType:a}=e,c=t.slice(0,30),s=ln[a]||0,l=`userIDList:${c} messageRemindType:`+a,d=new Ti("_setC2CMsgRemindType");return d.setMessage(l),this._convM.req({P:ri.SET_C2C_PEER_MUTE_NOTIFICATIONS,data:{userIDList:c,muteFlag:s}}).then(e=>{d.end();const t=e.data["errorList"],s=[],i=[],n=(Fe(t)&&t.forEach(e=>{s.push(e.userID),i.push({userID:e.userID,code:e.errorCode})}),c.filter(e=>-1===s.indexOf(e)));Ce.l(r+` ok. ${l} successUserIDList:${n} failureUserIDList:`+JSON.stringify(i));let o=0;return n.forEach(e=>{this._convM.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:a})&&(o+=1)}),1<=o&&this._emitConvUpdate(),c.length=s.length=0,this._convM.onTotalUnreadCountUpdate(),ii({successUserIDList:n.map(e=>({userID:e})),failureUserIDList:i})}).catch(e=>(d.setError(e).end(),Ce.e(r+" failed. error:",e),ni(e)))}_get(e){return this._convM.get(e)}_emitConvUpdate(){this._convM.emitConvUpdate(!0,!1)}setAllRcvMsgOpt(e){const s=this._n+".setAllRcvMsgOpt",{messageRemindType:i=t.MSG_REMIND_ACPT_NOT_NOTE,isRepeated:n=!0}=e,{startTime:o=0,endTime:r=0}=this._calcStartAndEndTime(e),a=JSON.stringify(e),c=new Ti("setAllRcvMsgOpt");return c.setMessage(a),Ce.l(s+" options:"+a),this._convM.req({P:ri.SET_ALL_RECEIVE_MSG_OPT,data:{messageRemindType:ln[i],startTime:o,endTime:r,isRepeated:n?1:0}}).then(e=>(c.end(),Ce.l(s+" ok."),Zs(e))).catch(e=>(c.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}_calcStartAndEndTime(e){const{startHour:t=0,startMinute:s=0,startSecond:i=0,duration:n=0,isRepeated:o=!0}=e,r=new Date,a=r.getFullYear(),c=r.getMonth(),d=r.getDate(),l=Math.round(new Date(a,c,d,t,s,i).getTime()/1e3);let _=o&&86400<=n?l+86400:l+n;return{startTime:l,endTime:_}}getAllRcvMsgOpt(){const t=this._n+".getAllRcvMsgOpt",s=new Ti("getAllRcvMsgOpt");return this._convM.req({P:ri.GET_ALL_RECEIVE_MSG_OPT,data:{toAccount:this._convM.getMyUserID()}}).then(e=>{e=e.data,s.setMessage(JSON.stringify(e)).end(),Ce.l(t+" ok. data:"+JSON.stringify(e)),e=this._handleResult(e);return Zs(e)}).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)))}_handleResult(e){var{messageRemindType:e,startTime:s,endTime:i,isRepeated:n}=e;let o=t.MSG_REMIND_ACPT_AND_NOTE;return 1===e&&(o=t.MSG_REMIND_DISCARD),{messageRemindType:o=2===e?t.MSG_REMIND_ACPT_NOT_NOTE:o,startTime:s,endTime:i,isRepeated:1===n}}reset(){Ce.l(this._n+".reset")}}class dn{constructor(e){this._convM=e,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=Ut}setConvCustomData(e){const s=this._n+".setConvCustomData",{conversationIDList:i,customData:o}=e,r=(Ce.l(s+" options:",e),new Ti("setConvCustomData")),n=(r.setMessage(JSON.stringify(e)),{fromAccount:this._getMyUserID(),itemList:[]}),a=[],c=[];return i.forEach(e=>{if(!this._hasLocalConv(e))return this._onConvNotFound(c,e),!0;if(!at(e)&&!ct(e))return this._onConvIDInvalid(c,e),!0;const s={operationType:2,contactItem:void 0,customMark:o};at(e)?s.contactItem={type:1,toAccount:e.replace(t.CONV_C2C,"")}:ct(e)&&(s.contactItem={type:2,groupID:e.replace(t.CONV_GROUP,"")}),n.itemList.push(s)}),c.length===i.length?ii({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ri.SET_CONV_CUSTOM_DATA,data:n}).then(e=>{r.end(),Ce.l(s+" ok");const n=e.data["resultItem"];if(Fe(n)){let t,s,i=!1;n.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(a.push(t),(s=this._getLocalConv(t))&&s.customData!==o&&(s.customData=o,i=!0)):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&this._emitConvUpdate()}return Zs({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(r.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}markConv(e){if(!this._convM.canIUse(M.CONV_MARK))return this._convM.noUse("markConv");const s=this._n+".markConv",{conversationIDList:i,markType:o,enableMark:r}=e,a=(Ce.l(s+" options:",e),new Ti("markConv"));a.setMessage(JSON.stringify(e));let n=void 0,c=void 0;e=this._getFlagBit(o);!0===r?c=[e]:n=[e];const _={fromAccount:this._getMyUserID(),itemList:[]},l=[],d=[];return i.forEach(e=>{if(!this._hasLocalConv(e))return this._onConvNotFound(d,e),!0;if(!at(e)&&!ct(e))return this._onConvIDInvalid(d,e),!0;const s={operationType:1,contactItem:void 0,clearMark:n,setMark:c};at(e)?s.contactItem={type:1,toAccount:e.replace(t.CONV_C2C,"")}:ct(e)&&(s.contactItem={type:2,groupID:e.replace(t.CONV_GROUP,"")}),_.itemList.push(s)}),d.length===i.length?ii({successConversationIDList:l,failureConversationIDList:d}):this._convM.req({P:ri.MARK_CONV,data:_}).then(e=>{a.end(),Ce.l(s+" ok");const n=e.data["resultItem"];if(Fe(n)){let t,s,i=!1;n.forEach(e=>{if(t=this._concatConvID(e.contactItem),0===e.resultCode){if(l.push(t),s=this._getLocalConv(t)){const t=s.markList.indexOf(o);!0===r?-1===t&&(s.markList.push(o),i=!0):-1!==t&&(s.markList.splice(t,1),i=!0)}}else d.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&this._emitConvUpdate()}return Zs({successConversationIDList:l,failureConversationIDList:d})}).catch(e=>(a.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}getLocalConvGroupList(){return Ce.l(this._n+".getLocalConvGroupList pagingStatus:"+this._pagingStatus),this._pagingStatus===wt?this.getRemoteConvGroupList().then(()=>Zs([...this._convGroupMap.values()])):ii([...this._convGroupMap.values()])}searchConvGroupAndMark(e,t){const s=this._n+".searchConvGroupAndMark",i=[];return e.forEach(e=>{1===t?i.push({type:1,toAccount:e}):2===t&&i.push({type:2,groupID:e})}),Ce.l(s+` type:${t} list:`,e),this._convM.req({P:ri.SEARCH_CONV_GRP_MARK,data:{fromAccount:this._getMyUserID(),contactItem:i}}).then(e=>{var{contactItem:e,groupItem:t}=e.data;Ce.l(s+" ok. contactItem:",e,"groupItem:",t),this._fillConvGroupMap(t),this._handleContactItem(e),this._emitConvUpdate()}).catch(e=>{Ce.w(s+" failed. error:",e)})}_fillConvGroupMap(e){Fe(e)&&e.forEach(e=>{var{convGroupID:e,groupName:t}=e;this._convGroupMap.set(e,t)})}_handleContactItem(e){if(Fe(e)){let o,r;e.forEach(e=>{const t=[],{standardMark:s,customData:i,convGroupIDList:n}=e;Fe(n)&&n.forEach(e=>{this._convGroupMap.has(e)&&t.push(this._convGroupMap.get(e))}),r=this._concatConvID(e),(o=this._getLocalConv(r))&&(o.markList=vt(s),o.customData=i||"",o.conversationGroupList=[...t])})}}getRemoteConvGroupList(){const n=this._n+".getRemoteConvGroupList";return this._pagingStatus=Gt,this._convM.req({P:ri.GET_CONV_GRP_LIST,data:{fromAccount:this._getMyUserID(),startIndex:this._startIndex}}).then(e=>{var{completeFlag:e,contactItem:t,nextStartIndex:s=0,groupItem:i}=e.data;if(this._startIndex=s,Ce.l(n+` completeFlag:${e} nextStartIndex:${s}, groupItem:`,i,"contactItem:",t),this._fillConvGroupMap(i),this._handleContactItem(t),0===e)return this.getRemoteConvGroupList();1===e&&(this._pagingStatus=kt,this._emitConvUpdate(),this._emitConvGroupListUpdate())}).catch(e=>{this._pagingStatus=wt,Ce.w(n+" failed. error:",e)})}createConvGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("createConvGroup");const i=this._n+".createConvGroup",o=(Ce.l(i+" options:",e),new Ti("createConvGroup")),{groupName:r,conversationIDList:s}=(o.setMessage(JSON.stringify(e)),e),n={fromAccount:this._getMyUserID(),itemList:[{groupName:r,contactItem:[]}]},a=[],c=[];return s.forEach(e=>this._hasLocalConv(e)?at(e)||ct(e)?void(at(e)?n.itemList[0].contactItem.push({type:1,toAccount:e.replace(t.CONV_C2C,"")}):ct(e)&&n.itemList[0].contactItem.push({type:2,groupID:e.replace(t.CONV_GROUP,"")})):(this._onConvIDInvalid(c,e),!0):(this._onConvNotFound(c,e),!0)),c.length===s.length?ii({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ri.CREATE_CONV_GRP,data:n}).then(e=>{o.end(),Ce.l(i+" ok");const t=e.data["groupResultItem"],{groupItem:s,resultItem:n}=t[0];if(be(s)&&(this._convGroupMap.set(s.convGroupID,s.groupName),this._emitConvGroupListUpdate()),Fe(n)){let t,s,i=!1;n.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(a.push(t),(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(r)&&(s.conversationGroupList.push(r),i=!0)):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvGroupListUpdate())}return Zs({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(o.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}deleteConvGroup(t){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("deleteConvGroup");const i=this._n+".deleteConvGroup",n=(Ce.l(i+" groupName:"+t),new Ti("deleteConvGroup"));return n.setMessage(t),this._convM.req({P:ri.DEL_CONV_GRP,data:{fromAccount:this._getMyUserID(),groupName:[t]}}).then(e=>{n.end(),Ce.l(i+" ok");const s=e.data["groupItem"];if(Fe(s)){let t=!1;s.forEach(e=>{this._convGroupMap.has(e.convGroupID)&&(this._convGroupMap.delete(e.convGroupID),t=!0)}),!0===t&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList([t])}).catch(e=>(n.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}renameConvGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("renameConvGroup");const o=this._n+".renameConvGroup",r=(Ce.l(o+" options:",e),new Ti("renameConvGroup")),{oldName:a,newName:c}=(r.setMessage(JSON.stringify(e)),e);return this._convM.req({P:ri.RENAME_CONV_GRP,data:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:a,newName:c}}}).then(e=>{r.end(),Ce.l(o+" ok");e=e.data.updateGroupResult,e=e.convGroupID;this._convGroupMap.set(e,c),this._emitConvGroupListUpdate();const t=this._convM.getLocalConvList();let s,i,n=!1;t.forEach(e=>{s=e.conversationGroupList,-1!==(i=s.indexOf(a))&&(s.splice(i,1,c),n=!0)}),!0===n&&this._emitConvUpdate()}).catch(e=>(r.setError(e).end(),Ce.e(o+" failed. error:",e),ni(e)))}addConvsToGroup(e){if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse("addConvsToGroup");const s=this._n+".addConvsToGroup",i=(Ce.l(s+" options:",e),new Ti("addConvsToGroup")),{conversationIDList:n,groupName:o}=(i.setMessage(JSON.stringify(e)),e),r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:o,updateItem:[]}},a=[],c=[];return n.forEach(e=>this._hasLocalConv(e)?at(e)||ct(e)?void(at(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(t.CONV_C2C,"")}}):ct(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(t.CONV_GROUP,"")}})):(this._onConvIDInvalid(c,e),!0):(this._onConvNotFound(c,e),!0)),c.length===n.length?ii({successConversationIDList:a,failureConversationIDList:c}):this._convM.req({P:ri.ADD_CONV_TO_GRP,data:r}).then(e=>{i.end(),Ce.l(s+" ok");const n=e.data.updateGroupResult["contactResultItem"];if(Fe(n)){let t,s,i=!1;n.forEach(e=>{t=this._concatConvID(e.contactItem),0===e.resultCode?(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(o)&&(s.conversationGroupList.push(o),a.push(t),i=!0):c.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(o))}return Zs({successConversationIDList:a,failureConversationIDList:c})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}deleteConvsFromGroup(e){var s="deleteConvsFromGroup";if(!this._convM.canIUse(M.CONV_GROUP))return this._convM.noUse(s);const i=this._n+"."+s,o=(Ce.l(i+" options:",e),new Ti(s)),{conversationIDList:n,groupName:r}=(o.setMessage(JSON.stringify(e)),e),a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:r,updateItem:[]}},c=[],l=[];return n.forEach(e=>this._hasLocalConv(e)?at(e)||ct(e)?void(at(e)?a.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(t.CONV_C2C,"")}}):ct(e)&&a.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(t.CONV_GROUP,"")}})):(this._onConvIDInvalid(l,e),!0):(this._onConvNotFound(l,e),!0)),l.length===n.length?ii({successConversationIDList:c,failureConversationIDList:l}):this._convM.req({P:ri.DEL_CONV_FROM_GRP,data:a}).then(e=>{o.end(),Ce.l(i+" ok");const n=e.data.updateGroupResult["contactResultItem"];if(Fe(n)){let t,s,i=!1;n.forEach(e=>{if(t=this._concatConvID(e.contactItem),0===e.resultCode){if(s=this._getLocalConv(t)){const e=s.conversationGroupList.indexOf(r);-1!==e&&(s.conversationGroupList.splice(e,1),c.push(t),i=!0)}}else l.push({conversationID:t,code:e.resultCode,message:e.resultInfo})}),!0===i&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(r))}return Zs({successConversationIDList:c,failureConversationIDList:l})}).catch(e=>(o.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}onConvMarkUpdated(e){if(!Oe(e)){let n,o,r=(Ce.l(this._n+".onConvMarkUpdated markItemList:",e),!1);e.forEach(e=>{var{recentContactItem:e,optType:t,standardMark:s,customMark:i}=e;if(n=this._concatConvID(e),o=this._getLocalConv(n))if(1===t)r=this._diffStandardMark(o,s);else if(2===t)r=this._diffCustomMark(o,i);else if(3===t){const e=this._diffStandardMark(o,s),n=this._diffCustomMark(o,i);r=e||n}}),!0===r&&this._emitConvUpdate()}}_diffStandardMark(e,t){t=vt(t);let s=!1;return!0!==function(s,i){if(s===i)return!0;if(!s||!i)return!1;if(s.length!==i.length)return!1;for(let e=0,t=s.length;e<t;e++)if(s[e]!==i[e])return!1;return!0}(e.markList,t)&&(e.markList=t,s=!0),s}_diffCustomMark(e,t){let s=!1;return e.customData!==t&&void 0!==t&&(e.customData=t,s=!0),s}onConvGroupCreated(e){Ce.l(this._n+".onConvGroupCreated resultList:",e);let o=!1,s=!1;Fe(e)&&(e.forEach(e=>{const{groupID:t,groupName:i}=e.msgGroupItem,n=(this._convGroupMap.get(t)!==i&&(this._convGroupMap.set(t,i),s=!0),e.msgRecentContactItem);if(Fe(n)){let t,s;n.forEach(e=>{t=this._concatConvID(e),(s=this._getLocalConv(t))&&-1===s.conversationGroupList.indexOf(i)&&(s.conversationGroupList.push(i),o=!0)})}}),!0===o&&this._emitConvUpdate(),!0===s&&this._emitConvGroupListUpdate())}onConvGroupDeleted(e){Ce.l(this._n+".onConvGroupDeleted groupItemList:",e);const i=[];if(Fe(e)){let s=!1;e.forEach(e=>{var{groupID:e,groupName:t}=e;this._convGroupMap.has(e)&&(this._convGroupMap.delete(e),s=!0,i.push(t))}),!0===s&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList(i)}_eraseFromConversationGroupList(t){Oe(t)||(this._convM.getLocalConvList().forEach(e=>{e.conversationGroupList=e.conversationGroupList.filter(e=>!t.includes(e))}),this._emitConvUpdate())}onConvGroupNameUpdated(e){Ce.l(this._n+".onConvGroupNameUpdated options:",e);const{groupID:n,groupName:o,oldGroupName:r}=e;if(this._convGroupMap.get(n)!==o){this._convGroupMap.set(n,o),this._emitConvGroupListUpdate();const a=this._convM.getLocalConvList();let t,s,i=!1;a.forEach(e=>{t=e.conversationGroupList,-1!==(s=t.indexOf(r))&&(t.splice(s,1,o),i=!0)}),!0===i&&this._emitConvUpdate()}}onConvInGroupUpdated(e){Ce.l(this._n+".onConvInGroupUpdated options:",e);const{oldGroupName:r,recentContactUpdateGroupItem:t}=e;if(Fe(t)){let s,i,n,o=!1;t.forEach(e=>{var{contactOptType:e,recentContactItem:t}=e;s=this._concatConvID(t),(i=this._getLocalConv(s))&&(n=i.conversationGroupList.indexOf(r),1===e?-1===n&&(i.conversationGroupList.push(r),o=!0):2===e&&-1!==n&&(i.conversationGroupList.splice(n,1),o=!0))}),!0===o&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(r))}}onConvAddedToOrDeletedFromGroup(e){Ce.l(this._n+".onConvAddedToOrDeletedFromGroup options:",e);const{msgRecentContactItem:t,msgRecentContactUpdateContactItem:n}=e,s=this._concatConvID(t),o=this._getLocalConv(s);if(o&&Fe(n)){let s,i=!1;n.forEach(e=>{var{groupOptType:e,recentContactGroupItem:t}=e,t=t["groupName"];s=o.conversationGroupList.indexOf(t),1===e?-1===s&&(o.conversationGroupList.push(t),i=!0):2===e&&-1!==s&&(o.conversationGroupList.splice(s,1),i=!0),!0===i&&this._emitConvInGroupUpdate(t)}),!0===i&&this._emitConvUpdate()}}onConvGroupListSynced(e){Fe(e)&&0!==e.length&&(Ce.l(this._n+".onConvGroupListSynced groupItem:",e),this._fillConvGroupMap(e))}getConvGroupListByID(e){if(!Oe(e)){const t=[];return e.forEach(e=>{this._convGroupMap.has(e)&&t.push(this._convGroupMap.get(e))}),t}}_onConvNotFound(e,t){e.push({conversationID:t,code:ei.CONV_NOT_FOUND,message:this._convM.getErrMsg(ei.CONV_NOT_FOUND)})}_onConvIDInvalid(e,t){e.push({conversationID:t,code:ei.INVALID_CONV_ID,message:this._convM.getErrMsg(ei.INVALID_CONV_ID)})}_getFlagBit(e){var t=e.toString(2),s=t.length;for(let e=s-1;0<=e;e--)if("1"===t[e])return s-e-1}_concatConvID(e){var{type:e,to:s,groupID:i,userID:n}=e;let o;return 1===e?$e(n)?$e(s)||(o=""+t.CONV_C2C+s):o=""+t.CONV_C2C+n:2===e&&(o=""+t.CONV_GROUP+i),o}_getMyUserID(){return this._convM.getMyUserID()}_getLocalConv(e){return this._convM.getLocalConversation(e)}_hasLocalConv(e){return this._convM.hasLocalConversation(e)}_emitConvUpdate(){this._convM.emitConvUpdate(!0,!1)}_emitConvGroupListUpdate(){this._convM.emitOEvt(e.CONVERSATION_GROUP_LIST_UPDATED,[...this._convGroupMap.values()])}_emitConvInGroupUpdate(t){const s={groupName:t,conversationList:[]},i=this._convM.getLocalConvList();s.conversationList=i.filter(e=>e.conversationGroupList.includes(t)),this._convM.emitOEvt(e.CONVERSATION_IN_GROUP_UPDATED,s)}reset(){Ce.l(this._n+".reset"),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=Ut}}class _n extends oi{constructor(e){super(e),this._n="ConvModule",ji.mixin(this),this._msgListHandler=new zi(this),this._msgRemindHandler=new un(this),this._convGroupHandler=new dn(this),this._sll=new nn(100),this._pagingStatus=Ut,this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._pagingConvIDMap=new Map,this._convIDFromUnreadDBMap=new Map,this._convMap=new Map,this._tmpGroupList=[],this._tmpGroupAtTipsList=[],this._peerReadTimeMap=new Map,this._completedMap=new Map,this._roamingMsgKeyAndTimeMap=new Map,this._remoteGroupReadSeqMap=new Map,this._convTotalUnreadCount=0,this._pagingGetCostList=[],this._convMapForDiff=new Map,this._partialUpdatedConvMap=new Map,this._everClearedMap=new Map,this._bPullOnInvite=!0,this._initListeners()}_initListeners(){const e=this.getIEmitInst();e.on(Yi.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(Yi.PROFILE_UPDATED,this._onProfileUpdated,this),e.on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_init(){Ce.l(this._n+"._init");var t=this.get(Ls).getItem("conversationMap"),s=this.isIntl(),i=this.isUsingChatCore();if(t){var n=t.length;for(let e=0;e<n;e++){var o=t[e];if(o){if(this._isNonExistentAccount(o.conversationID))continue;if(o.groupProfile&&nt(o.groupProfile.type))continue}this._convMap.set(o.conversationID,new cn(t[e],s,i))}this.emitConvUpdate(!0,!1)}this.ready(()=>{0<this._tmpGroupList.length&&(this.updateConvGroupProfile(this._tmpGroupList),this._tmpGroupList.length=0)}),this.syncConvList()}_isNonExistentAccount(e){let s;return"@TLS#ERROR"===(s=e.startsWith(t.CONV_C2C)?e.replace(t.CONV_C2C,""):s)||"@TLS#NOT_FOUND"===s}onCheckTimer(e){this.isLoggedIn()&&this._msgListHandler.onCheckTimer(e)}onMessageSent(e){this._onSendOrRcvMsg({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}onNewMessage(e){this._onSendOrRcvMsg(e)}_onSendOrRcvMsg(e){const{conversationOptionsList:t,isInstantMessage:s=!0,isUnreadC2CMessage:i=!1,updateUnreadCount:n=!0,isSyncingEnded:o=!1}=e;this._isReady?0!==t.length?(!0===s&&this._checkNewConv(t),this._updateLocalConvList({conversationOptionsList:t,isInstantMessage:s,isUnreadC2CMessage:i,isFromGetConversations:!1,updateUnreadCount:n}),s||(this._convIDFromUnreadDBMap=new Map([...this._convIDFromUnreadDBMap,...t.map(e=>[e.conversationID,1])]),this._diffAndDeleteConv(),o&&this.emitIEvt(Yi.C2C_UNREAD_HANDLE_COMPLETED)),0<t.filter(e=>!this._isConvNeedShow(e.conversationID)).length||this.emitConvUpdate()):o&&this.emitIEvt(Yi.C2C_UNREAD_HANDLE_COMPLETED):this.ready(()=>{this._onSendOrRcvMsg(e)})}updateConvGroupProfile(e){if(!Fe(e)||0!==e.length)if(0!==this._convMap.size){let i=!1;e.forEach(e=>{var s=""+t.CONV_GROUP+e.groupID;if(this._convMap.has(s)){i=!0;const t=this._convMap.get(s);t.groupProfile=JSON.parse(JSON.stringify(e)),t.lastMessage.lastSequence<e.nextMessageSeq&&(t.lastMessage.lastSequence=e.nextMessageSeq-1),t.subType||(t.subType=e.type)}}),i&&this.emitConvUpdate(!0,!1)}else this._tmpGroupList=e}onMessageRevoked(e,n){if(0!==e.length){let s=null,i=!1;const o=[];e.forEach(e=>{(s=this._convMap.get(e.conversationID))&&(n&&s.reduceUnreadCount()&&(i=s.type!==t.CONV_TOPIC),s.type===t.CONV_TOPIC?o.push(e):s.isLastMessageRevoked({sequence:e.sequence,time:e.time})&&(s.setLastMessageRevoked(!0),s.setLastMessageRevoker(e.revoker),i=!0))}),this.get(Ss).onMessageRevoked(o),i&&this.emitConvUpdate(!0,!1)}}updateRevokerInfo(n){const t=new Set;for(let e=0;e<n.length;e++){const s=n[e]["revoker"];t.add(s)}const s=[...t],e=this.get(Ts);return new Promise(i=>{e.getUserProfile({userIDList:s}).then(e=>{e=e.data;if(!Fe(e)||0===e.length)return i(n);const s={};for(const{userID:n,nick:i,avatar:t}of e)s[n]={nick:i,avatar:t};n.forEach(e=>{var t=e["revoker"];s[t]&&(e.revokerInfo.nick=s[t].nick||"",e.revokerInfo.avatar=s[t].avatar||"")}),i(n)}).catch(()=>{i(n)})})}isLastMessageRevoked(e){let s=!1;const{conversationID:i,sequence:n,time:o}=e,r=this._convMap.get(i);return r&&(s=r.type===t.CONV_TOPIC?this.get(Ss).isLastMessageRevoked({topicID:i.replace(t.CONV_GROUP,""),sequence:n}):r.isLastMessageRevoked({sequence:n,time:o})),Ce.l(this._n+".isLastMessageRevoked options:",e,"ret:"+s),s}onMessageDeleted(e){if(0!==e.length){let s=null;e.forEach(e=>{(s=this._msgListHandler.getLocalMsg(e.conversationID,e.ID))&&(s.isDeleted=!0),e!==s&&(e.isDeleted=!0)});const n=e[0].conversationID,o=this._msgListHandler.getLocalMsgList(n);let i={};for(let e=o.length-1;0<=e;e--)if(!o[e].isDeleted){i=o[e];break}const r=this._convMap.get(n);if(r){let e=!1;r.lastMessage.lastSequence===i.sequence&&r.lastMessage.lastTime===i.time||(Oe(i)&&(i=void 0),r.updateLastMessage(i),r.type!==t.CONV_TOPIC&&(e=!0),Ce.l(`${this._n}.onMessageDeleted. update convID:${n} with lastMessage:`,r.lastMessage)),n.startsWith(t.CONV_C2C)&&this.updateUnreadCount(n),e&&this.emitConvUpdate(!0,!1)}}}onMessageModified(s){var i=this._n+".onMessageModified",{conversationType:n,from:o,to:r,time:u,sequence:h,elements:a,cloudCustomData:p,messageVersion:c}=s;let l=""+n+r;r===this.getMyUserID()&&n===t.CONV_C2C&&(l=""+n+o);var{isUpdated:n,message:d}=this._msgListHandler.onMsgModified(l,s),_=(!0===n&&this.emitOEvt(e.MESSAGE_MODIFIED,[d]),this._isTopicConv(l));if(null===d?Ce.l(i+" message is null! options:",s):Ce.l(i+` isUpdated:${n} isTopicMessage:${_} from:${o} to:${r} sequence:${d.sequence} time:`+d.time),_)this.get(Ss).onMessageModified(s);else{const e=this._convMap.get(l);if(e){const t=e.lastMessage;t&&t.lastTime===u&&t.lastSequence===h&&t.version!==c&&(Ce.l(i+` convID:${l} lastMessage updated`),t.type=a[0].type,t.payload=a[0].content,t.messageForShow=yt(t.type,t.payload,this.isIntl()),t.cloudCustomData=p,t.version=c,this.emitConvUpdate(!0,!1))}}return d}onNewGroupAtTips(e){const t=e.dataList;let s=null;t.forEach(e=>{e.groupAtTips?s=e.groupAtTips:e.elements?s={...e.elements,sync:!0}:e.groupAtType&&(s={...e,sync:!0}),s.__random=e.random,s.__sequence=e.clientSequence,this._tmpGroupAtTipsList.push(s)}),Ce.l(this._n+".onNewGroupAtTips isReady:"+this._isReady,this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}_handleGroupAtTipsList(){if(0!==this._tmpGroupAtTipsList.length){let r=!1;this._tmpGroupAtTipsList.forEach(e=>{const{groupID:s,from:i,topicID:n,sync:o=!1}=e;if(i!==this.getMyUserID())if($e(n)){const i=this._convMap.get(""+t.CONV_GROUP+s);i&&(i.updateGroupAtInfoList(e),r=!0)}else{const r=this._convMap.get(""+t.CONV_GROUP+n);r&&(r.updateGroupAtInfoList(e),this.get(Ss).onAtInfoUpdated({topicID:n,groupAtInfoList:r.groupAtInfoList})),Oe(r)&&o&&(this.updateTopicConversation([{conversationID:""+t.CONV_GROUP+n,type:t.CONV_TOPIC}]),this._convMap.get(""+t.CONV_GROUP+n).updateGroupAtInfoList(e))}}),r&&this.emitConvUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}_checkNewConv(e){let s=[],i=[];e.forEach(e=>{this._convMap.has(e.conversationID)||(e.type===t.CONV_C2C?s.push(e.conversationID.replace(t.CONV_C2C,"")):e.type===t.CONV_GROUP&&i.push(e.conversationID.replace(t.CONV_GROUP,"")))}),0<s.length&&(this._onNewC2CConv(s),s=null),0<i.length&&(this._onNewGroupConv(i),i=null)}_onNewC2CConv(e){const t=this.get(ys);return Promise.all([t.getRemotePeerReadTime(e),this._msgRemindHandler.getC2CMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,1)])}_onNewGroupConv(e){const t=this.get(vs);return t?Promise.all([t.getMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,2)]):Promise.resolve()}_setStorageConvList(e=!1){var s=this.getLocalConvList().filter(e=>e.type===t.CONV_C2C||e.type===t.CONV_GROUP&&e.lastMessage.type!==t.MSG_GRP_TIP).slice(0,20).map(e=>({conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}));this.get(Ls).setItem("conversationMap",s,e)}emitConvUpdate(t=!0,s=!0){var i=this.getLocalConvList();if(s){const e=this.get(vs);e&&e.updateGroupLastMessage(i)}t&&(this.get(Rs).isPartialUpdatedConvs()?(this._diffConvMap(this._convMapForDiff,this._convMap),0<this._partialUpdatedConvMap.size&&(this.emitOEvt(e.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate(),this._convMapForDiff.clear(),this._convMapForDiff=Ye(this._convMap,!0)),0===this._convMapForDiff.size&&(this._convMapForDiff=Ye(this._convMap,!0))):(this.emitOEvt(e.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate()))}_diffConvMap(e,t){for(var[s,i]of t)e.has(s)&&JSON.stringify(i)===e.get(s)||this._partialUpdatedConvMap.set(s,i)}getPartialUpdatedConvs(){var e=[...Ye(this._partialUpdatedConvMap,!1).values()];return this._partialUpdatedConvMap.clear(),e}getLocalConvList(){return[...this._convMap.values()].filter(e=>this._isConvNeedShow(e.conversationID))}getLocalConversation(e){return this._convMap.get(e)}hasLocalConversation(e){return this._convMap.has(e)}getLocalOldestMessage(e){return this._msgListHandler.getLocalOldestMsg(e)}syncConvList(e=!0){const i=new Ti("syncConvList");return this._pagingStatus===Ut&&this._convMap.clear(),this._pagingGetConvList(e).then(e=>{var t=function(e){if(Fe(e)&&0!==e.length){let t=0;return e.forEach(e=>{t+=e}),(t/e.length).toFixed(0)}}(this._pagingGetCostList),s=function(e){if(Fe(e)&&0!==e.length){let t=0;return e.forEach(e=>{t+=e}),t.toFixed(0)}}(this._pagingGetCostList),s=(this._pagingGetCostList.length=0,this._pagingStatus=kt,this._diffAndDeleteConv(),this.emitConvUpdate(!0,!1),this._setStorageConvList(),this._handleC2CPeerReadTime(),this.emitIEvt(Yi.CONV_SYNC_COMPLETED),`count:${this._convMap.size} sum:${s} avg:`+t);return Ce.l(this._n+".syncConvList. "+s),i.setMessage(s).end(),e}).catch(e=>(this._pagingStatus=wt,i.setMessage(this._pagingTs).setError(e).end(),ni(e)))}_diffAndDeleteConv(){if(this._isSyncCompleted()){let s=[];this._convMap.forEach((e,t)=>{!this._pagingConvIDMap.has(t)&&this._convIDFromUnreadDBMap.has(t)&&(this._convMap.delete(t),s.push(t))}),Ce.l(this._n+"._diffAndDeleteConv list:"+s),s=null}}_pagingGetConvList(e=!0){const a=this._n+"._pagingGetConvList",c=(Ce.l(a+` incrementalPullFlag:${e} ts:${this._pagingTs} startIdx:${this._pagingStartIdx} pinnedTs:${this._pagingPinnedTs} pinnedStartIdx:`+this._pagingPinnedStartIdx),Date.now());return this._pagingStatus=Gt,this.req({P:ri.PAGING_GET_CONV_LIST,data:{fromAccount:this.getMyUserID(),timeStamp:e?this._pagingTs:0,startIndex:e?this._pagingStartIdx:0,pinnedTimeStamp:e?this._pagingPinnedTs:0,pinnedStartIndex:e?this._pagingPinnedStartIdx:0,orderType:1}}).then(e=>{var{completeFlag:e,conversations:t=[],timeStamp:s,startIndex:i,pinnedTimeStamp:n,pinnedStartIndex:o,groupItem:r}=e.data;if(this._pagingGetCostList.push(Dt(c,!1)),Ce.l(a+` ok. completeFlag:${e} count:${t.length} cost:`+Dt(c)),this._convGroupHandler.onConvGroupListSynced(r),0<t.length){const e=this._getConvOptions(t);this._pagingConvIDMap=new Map([...this._pagingConvIDMap,...e.map(e=>[e.conversationID,1])]),this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0}),this.isLoggedIn()&&this.emitConvUpdate()}if(!this._isReady){if(!this.isLoggedIn())return ii();this.triggerReady()}return this._pagingTs=s,this._pagingStartIdx=i,this._pagingPinnedTs=n,this._pagingPinnedStartIdx=o,1!==e?this._pagingGetConvList():(this._handleGroupAtTipsList(),this._convGroupHandler.getRemoteConvGroupList(),ii())}).catch(e=>{throw this.isLoggedIn()&&(this._isReady||(Ce.w(a+" failed. error:",e),this.triggerReady())),e})}_updateLocalConvList(e){var t=e["isFromGetConversations"],s=Date.now(),e=this._getTmpConvListMapping(e)["newConvList"];this._convMap=new Map(this._sortConvList([...this._convMap])),t||this._updateUserOrGroupProfile(e),Ce.l(this._n+"._updateLocalConvList cost:"+Dt(s))}_getTmpConvListMapping(i){const{conversationOptionsList:n,isFromGetConversations:o,isInstantMessage:r,isUnreadC2CMessage:h=!1,updateUnreadCount:p}=i,a=[],c=[],l=this.get(vs),d=this.get(Es),g=this.isIntl(),m=this.isUsingChatCore();for(let e=0,s=n.length;e<s;e++){const i=new cn(n[e],g,m),{conversationID:_,type:u}=i;if(!this._isNonExistentAccount(_)){if(this._convMap.has(_)){const a=this._convMap.get(_);if(o&&u!==t.CONV_TOPIC){this._convMap.set(_,i),u===t.CONV_C2C?i.unreadCount=a.unreadCount:u===t.CONV_GROUP&&(i.groupProfile=JSON.parse(JSON.stringify(a.groupProfile)));continue}const c=["unreadCount","allowType","adminForbidType","payload"],l=(!1===r&&c.push("lastMessage"),"boolean"==typeof r&&c.push("isPinned"),n[e].lastMessage),d=!$e(l);d||n[e].type===t.CONV_TOPIC||this._onLastMsgNotExist(n[e]),$e(r)&&d&&null===a.lastMessage.payload&&(a.lastMessage.payload=l.payload),Oe(a.lastMessage.revoker)||(a.lastMessage.revoker=null),We(a,i,c,[null,void 0,"",0,NaN]),!0===p&&a.updateUnreadCount({nextUnreadCount:i.unreadCount,isFromGetConversations:o,isUnreadC2CMessage:h}),r&&d&&(l.payload&&(a.lastMessage.payload=l.payload),a.type===t.CONV_GROUP&&(a.lastMessage.nameCard=l.nameCard,a.lastMessage.nick=l.nick)),d&&a.lastMessage.cloudCustomData!==l.cloudCustomData&&(a.lastMessage.cloudCustomData=l.cloudCustomData||"")}else{if(u===t.CONV_GROUP&&l){const t=i.groupProfile["groupID"],n=l.getLocalGroupProfile(t);n&&(i.groupProfile=n,!0===p&&i.updateUnreadCount({nextUnreadCount:0}))}else if(u===t.CONV_C2C){const n=_.replace(t.CONV_C2C,"");d&&d.isMyFriend(n)&&(i.remark=d.getFriendRemark(n))}a.push(i),this._convMap.set(_,i)}this._convMap.get(_).type===t.CONV_TOPIC&&c.push(this._convMap.get(_))}}const _=this.get(Ss);for(let e=0,s=c.length;e<s;e++){const{conversationID:i,groupAtInfoList:n}=c[e];Oe(n)||_.onAtInfoUpdated({topicID:i.replace(t.CONV_GROUP,""),groupAtInfoList:n})}return{newConvList:a}}_onLastMsgNotExist(e){new Ti("lastMsgNotExist").setMessage(JSON.stringify(e)).end()}_sortConvList(e){const t=[],s=[],i=[],n=[];return e.forEach(e=>{(!0===e[1].isPinned?Oe(e[1].lastMessage.lastTime)?s:t:Oe(e[1].lastMessage.lastTime)?n:i).push(e)}),t.sort((e,t)=>t[1].lastMessage.lastTime-e[1].lastMessage.lastTime).concat(s).concat(i.sort((e,t)=>t[1].lastMessage.lastTime-e[1].lastMessage.lastTime)).concat(n)}_sortConvListAndEmitEvent(){this._convMap=new Map(this._sortConvList([...this._convMap])),this.emitConvUpdate(!0,!1)}_updateUserOrGroupProfile(e){if(0!==e.length){const s=[],i=[],n=this.get(Ts),o=this.get(vs);e.forEach(e=>{if(e.type===t.CONV_C2C)s.push(e.toAccount);else if(e.type===t.CONV_GROUP){const t=e.toAccount;o.hasLocalGroup(t)?e.groupProfile=o.getLocalGroupProfile(t):i.push(t)}}),Ce.l(`${this._n}._updateUserOrGroupProfile userIDList:${s} groupIDList:`+i),0<s.length&&n.getUserProfile({userIDList:s}).then(({data:e})=>{Fe(e)?e.forEach(e=>{this._doUpdateUserProfile(""+t.CONV_C2C+e.userID,e)}):this._doUpdateUserProfile(""+t.CONV_C2C+e.userID,e)}),0<i.length&&o.getGroupProfileAdvance({groupIDList:i,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then(({data:{successGroupList:e}})=>{let i=!1;e.forEach(e=>{var s=""+t.CONV_GROUP+e.groupID;if(this._convMap.has(s)){const t=this._convMap.get(s);We(t.groupProfile,e,[],[null,void 0,"",0,NaN]),!t.subType&&e.type&&(t.subType=e.type),i=!0}}),i&&this.emitConvUpdate()})}}_doUpdateUserProfile(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t,this.emitConvUpdate())}_getConvOptions(e){const i=[],s=e.filter(({type:e,userID:t})=>1===e&&!this._isNonExistentAccount(t)||2===e),n=this.getMyUserID(),o=s.map(e=>{var s;return $e(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type?(s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar},i.push(s),{conversationID:""+t.CONV_C2C+e.userID,type:t.CONV_C2C,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?this._amendLayersOverLimitProp(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===n&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},unreadCount:0,userProfile:new sn(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,customData:e.customMark||"",markList:vt(e.standardMark),conversationGroupList:this._convGroupHandler.getConvGroupListByID(e.contactGroupId),remark:e.friendRemark||"",messageRemindType:this._transMsgRemindType(e.messageRemindType)}):{conversationID:""+t.CONV_GROUP+e.groupID,type:t.CONV_GROUP,lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,...this._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 rn({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage,type:e.groupType,nextMessageSeq:e.nextMessageSeq}),unreadCount:this._computeGroupUnreadCount(e),peerReadTime:0,isPinned:1===e.isPinned,version:0,customData:e.customMark||"",markList:vt(e.standardMark),conversationGroupList:this._convGroupHandler.getConvGroupListByID(e.contactGroupId),messageRemindType:this._transMsgRemindType(e.messageRemindType)}});return 0<i.length&&this.get(Ts).onConvProfileUpdated(i),o}_transMsgRemindType(e){let s="";return 0===e?s=t.MSG_REMIND_ACPT_AND_NOTE:1===e?s=t.MSG_REMIND_DISCARD:2===e?s=t.MSG_REMIND_ACPT_NOT_NOTE:3===e&&(s=t.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),s}_computeGroupUnreadCount(e){var{unreadCount:e=0,noUnreadCount:t=0}=e,e=e-t;return 0<e?e:0}_patchTypeAndPayload(e){const{event:s,elements:i=[],groupTips:n={}}=e.lastMsg;if($e(s)||Oe(n))return{type:i[0]?i[0].type:null,payload:i[0]?this._amendLayersOverLimitProp(i[0].content):null};{let e=new xi(n);e.setElement({type:t.MSG_GRP_TIP,content:{...n.elements,groupProfile:n.groupProfile}});const s=JSON.parse(JSON.stringify(e.payload));return e=null,{type:t.MSG_GRP_TIP,payload:s}}}_amendLayersOverLimitProp(e){var t=e["layersOverLimit"];return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}getLocalMessageList(e){return this._msgListHandler.getLocalMsgList(e)}deleteLocalMessage(e){e instanceof xi&&this._msgListHandler.remove(e)}onConvDeleted(e){Fe(e)&&(e=e.map(e=>{var{type:e,userID:s,groupID:i}=e;return 1===e?""+t.CONV_C2C+s:2===e?""+t.CONV_GROUP+i:void 0}),Ce.l(this._n+".onConvDeleted convIDList:"+e),this.deleteLocalConvList(e))}onConvPinnedStatus(e,r){if(Fe(e)){let o=!1;e.forEach(e=>{var{type:e,userID:s,groupID:i}=e;let n;1===e?n=this.getLocalConversation(""+t.CONV_C2C+s):2===e&&(n=this.getLocalConversation(""+t.CONV_GROUP+i)),n&&(Ce.l(`${this._n}.onConvPinnedStatus convID:${n.conversationID} localPinned:${n.isPinned} remotePinned:`+r),r?n.isPinned||(n.isPinned=!0,o=!0):n.isPinned&&(n.isPinned=!1,o=!0))}),o&&this._sortConvListAndEmitEvent()}}getMessageList({conversationID:a,nextReqMessageID:e,count:t}){const c=this._n+".getMessageList",s=this.getLocalConversation(a);let i="";if(s&&s.groupProfile&&(i=s.groupProfile.type),nt(i))return Ce.l(c+` not available in ${i}. convID:`+a),ii({messageList:[],nextReqMessageID:"",isCompleted:!0});($e(t)||15<t)&&(t=15),e||this._isMeInCommunity(a)||this.clearMemMsg(a);const l=this._computeRemainingCount({conversationID:a,nextReqMessageID:e}),n=this._completedMap.has(a);if(Ce.l(c+` convID:${a} isEverCleared:${this._isEverCleared(a)} nextReqMessageID:${e} remainingCount:${l} count:${t} isCompleted:`+n),this._needGetHistory({conversationID:a,remainingCount:l,count:t}))return this.getHistoryMessages({conversationID:a,nextReqMessageID:e,count:20}).then(e=>{var{nextReqID:e,storedMessageList:t,assembledMessageList:s,isPullingCompleted:i}=e,n=this._completedMap.has(a);let o=t;0<l&&(o=this._msgListHandler.getLocalMsgList(a).slice(0,t.length+l));const r={nextReqMessageID:void 0,messageList:void 0,isCompleted:void 0};this._isEverCleared(a)?(r.nextReqMessageID=e,r.messageList=s,r.isCompleted=i):(r.nextReqMessageID=n?"":e,r.messageList=o,r.isCompleted=n);t=r.messageList.filter(e=>e.isRevoked)||[],s=r.messageList.map(e=>e.sequence);return Ce.l(c+` ret.nextReqMessageID:${r.nextReqMessageID} ret.isCompleted:${r.isCompleted} sequenceList:`,s),Fe(t)&&0!==t.length?this.updateRevokerInfo(t).then(e=>(e.forEach(t=>{const s=t["revokerInfo"];r.messageList=r.messageList.map(e=>(e.ID===t.ID&&s&&(e.revokeReason=s.reason||"",e.revokerInfo={userID:s.revoker||e.revoker,nick:s.nick,avatar:s.avatar}),e))}),Zs(r))):Zs(r)});this.modifyMessageList(a);e=this._getMsgListFromMem({conversationID:a,nextReqMessageID:e,count:t});return ii(e)}_isEverCleared(e){return this._everClearedMap.has(e)}_getMsgListFromMem({conversationID:e,nextReqMessageID:t,count:s}){const i=this._n+"._getMsgListFromMem",n=this._msgListHandler.getLocalMsgList(e),o=n.length,r=at(e);let a=0;const c={isCompleted:!1,nextReqMessageID:"",messageList:[]};t?(a=r?n.findIndex(e=>e.ID===t):n.findIndex(e=>e.sequence+""===t))>s?(c.messageList=n.slice(a-s,a),c.nextReqMessageID=r?n[a-s].ID:n[a-s].sequence+""):(c.messageList=n.slice(0,a),c.isCompleted=!0):s<o?(a=o-s,c.messageList=n.slice(a,o),c.nextReqMessageID=r?n[a].ID:n[a].sequence+""):(c.messageList=n.slice(0,o),c.isCompleted=!0);s=c.messageList.map(e=>e.sequence);return Ce.l(i+` convID:${e} ret.nextReqMessageID:${c.nextReqMessageID} ret.isCompleted:${c.isCompleted} sequenceList:`+s),c}getMessageListHopping(e){let{conversationID:s,sequence:i,time:n,count:o,direction:r=0}=e;if(($e(o)||15<o)&&(o=15),s.startsWith(t.CONV_C2C)){const e=this.get(ys),i=s.replace(t.CONV_C2C,"");return e.getRoamingMessagesHopping({peerAccount:i,time:n,count:o,direction:r})}if(s.startsWith(t.CONV_GROUP)){const e=this.get(vs),n=s.replace(t.CONV_GROUP,"");return e.getRoamingMessagesHopping({groupID:n,sequence:i,count:o,direction:r})}}_computeRemainingCount({conversationID:e,nextReqMessageID:t}){const s=this._msgListHandler.getLocalMsgList(e),i=s.length;if(Ce.l(this._n+`._computeRemainingCount convID:${e} nextReqMessageID:${t} length:`+i),!t)return i;let n=0;return at(e)?n=s.findIndex(e=>e.ID===t):ct(e)&&(n=-1!==t.indexOf("-")?s.findIndex(e=>e.ID===t):s.findIndex(e=>e.sequence+""===t)),n=-1===n?0:n}_needGetHistory({conversationID:e,remainingCount:t,count:s}){var i=this.getLocalConversation(e);let n="";if(i&&i.groupProfile&&(n=i.groupProfile.type),lt(e)||nt(n))return!1;if(this._isEverCleared(e))return!0;i=t<=s&&!this._completedMap.has(e);return Ce.l(this._n+`._needGetHistory convID:${e} ret:`+i),i}_isTopicConv(e){e=e.replace(t.CONV_GROUP,"");return rt(e)}getHistoryMessages(n){const{conversationID:o,count:e,nextReqMessageID:r}=n;if(o===t.CONV_SYSTEM)return ii();let a=15,c=(20<e&&(a=20),null);if(at(o)){let e=0,s="",i=!1;n=this._roamingMsgKeyAndTimeMap.has(o);if(r)if(i=!0,n)e=this._roamingMsgKeyAndTimeMap.get(o).lastMessageTime,s=this._roamingMsgKeyAndTimeMap.get(o).messageKey;else{const t=this._msgListHandler.findMessage(r);t&&(e=t.time,Ce.l(`${this._n}.getHistoryMessages convID:${o} isRelayInfoExisted:${n} lastMessageTime:`+e))}return(c=this.get(ys)).getRoamingMessage({conversationID:o,peerAccount:o.replace(t.CONV_C2C,""),count:a,lastMessageTime:i?e:0,messageKey:i?s:""})}if(ct(o)){if(!(c=this.get(vs)))return ni({code:ei.NO_MODULE});const n=o.replace(t.CONV_GROUP,"");let e=null,s=(this._convMap.has(o)&&!rt(n)&&(e=this._convMap.get(o).lastMessage),0);return r?s=Number(r):e&&(s=e.lastSequence),c.getRoamingMessage({conversationID:o,groupID:n,count:a,sequence:s})}return ii()}patchConvLastMessage(e,t=!1){const s=this.getLocalConversation(e);if(s){const{messageForShow:i,payload:n}=s.lastMessage;if(Oe(i)||Oe(n)||t){const i=this._msgListHandler.getLocalMsgList(e);if(0!==i.length){const n=i[i.length-1];Ce.l(this._n+`.patchConvLastMessage bForceUpdate:${t} convID:${e} payload:`,n.payload),s.updateLastMessage(n)}}}}onRoamingMessage(e=[],_,u=!0,s){var i=_.startsWith(t.CONV_C2C)?t.CONV_C2C:t.CONV_GROUP;let n=null,o=[],r=[],a=0,c=e.length,l;const d=i===t.CONV_GROUP,h=this.getFileDownloadProxy(),p=this.getDowloadFileAuthKey(),g=Fe(s),m=this.get(Ns).getFileDNList();let f=()=>{d?--a:++a},M=()=>d?a>=c:a<c;for(a=d?e.length-1:0,c=d?0:e.length;M();f())if(1!==e[a].isPlaceMessage)if((n=new xi(e[a])).to=e[a].to,i!==t.CONV_GROUP||$e(e[a].topicID)||(n.to=e[a].topicID),n.isSystemMessage=!!e[a].isSystemMessage,n.conversationType=i,l=4===e[a].event?{type:t.MSG_GRP_TIP,content:{...e[a].elements,groupProfile:e[a].groupProfile}}:e[a].elements,d||n.setNickAndAvatar({nick:e[a].nick,avatar:e[a].avatar}),Oe(l)){const t=new Ti("emptyMessageBody");t.setMessage(`from:${n.from} to:${n.to} sequence:${n.sequence} event:`+e[a].event),t.setLevel("warning").end()}else n.setElement(l,h,p,m),n.reInitialize(this.getMyUserID()),o.push(n),g&&s.push(n);return f=M=null,u?(this._msgListHandler.unshift(o,r),o=null,r):(r=null,o)}findMessage(e){return this._msgListHandler.findMessage(e)}_isMeInCommunity(e){let s=!0;return this._isTopicConv(e)&&(e=Tt(e.replace(t.CONV_GROUP,"")),this.get(vs).hasLocalGroup(e)||(s=!1,Ce.l(this._n+`._isMeInCommunity groupID:${e} ret:`+s))),s}deleteTopicRoamingInfo(e){ot({groupID:e})&&this._msgListHandler.getTopicConvIDList(e).forEach(e=>{this.clearMemMsg(e)})}deleteGroupRoamingInfo(e){e=""+t.CONV_GROUP+e;0<this._msgListHandler.getLocalMsgList(e).length&&this.clearMemMsg(e)}setMessageRead({conversationID:e}){const s=this.getLocalConversation(e),i=this._n+".setMessageRead";if(Ce.l(i+` convID:${e} unreadCount:`+(s?s.unreadCount:0)),!s)return ii();if(s.type!==t.CONV_GROUP&&s.type!==t.CONV_TOPIC||Oe(s.groupAtInfoList)||this.deleteGroupAtTips(e),0===s.unreadCount)return ii();const n=this._msgListHandler.getLocalLastMsg(e);let o=s.lastMessage.lastTime;var r=this._msgListHandler.getLocalMaxTime(e),r=(o<r&&(Ce.l(`${i} update lastMessageTime from ${o} to `+r),o=r),this._msgListHandler.getLocalMaxSeq(e));let a=s.lastMessage.lastSequence;if(a<r&&(Ce.l(`${i} update lastMessageSeq from ${a} to `+r),a=r),s.type===t.CONV_TOPIC&&$e(n)){const s=this.get(Ss),i=e.replace(t.CONV_GROUP,""),n=Tt(i),o=s.getLocalTopic(n,i);o&&(a=o.nextMessageSeq-1)}let c=null;switch(s.type){case t.CONV_C2C:return(c=this.get(ys))?c.setMessageRead({conversationID:e,lastMessageTime:o}):ni({code:ei.NO_MODULE});case t.CONV_GROUP:case t.CONV_TOPIC:return(c=this.get(vs))?c.setMessageRead({conversationID:e,lastMessageSeq:a}):ni({code:ei.NO_MODULE});case t.CONV_SYSTEM:return s.unreadCount=0,this.emitConvUpdate(!0,!1),ii();default:return ii()}}setAllMessageRead(s={}){const i=this._n+".setAllMessageRead";s.scope||(s.scope=t.READ_ALL_MSG),Ce.l(i+" options:",s);var e=this._createSetAllMessageReadPack(s);if(0===e.readAllC2CMessage&&0===e.groupMessageReadInfoList.length)return ii();const n=new Ti("setAllMessageRead");return this.req({P:ri.SET_ALL_MSG_READ,data:e}).then(e=>{e=e.data,e=this._handleAllMsgRead(e);return n.setMessage(`scope:${s.scope} failureGroups:`+JSON.stringify(e)).end(),ii()}).catch(e=>(n.setError(e).end(),Ce.w(i+" failed. error:",e),ni({code:e&&e.code?e.code:ei.MSG_UNREAD_ALL_FAIL,message:e&&e.message?e.message:void 0})))}setConvCustomData(e){return this._convGroupHandler.setConvCustomData(e)}markConv(e){return this._convGroupHandler.markConv(e)}getConvGroupList(){return this._convGroupHandler.getLocalConvGroupList()}createConvGroup(e){return this._convGroupHandler.createConvGroup(e)}deleteConvGroup(e){return this._convGroupHandler.deleteConvGroup(e)}renameConvGroup(e){return this._convGroupHandler.renameConvGroup(e)}addConvsToGroup(e){return this._convGroupHandler.addConvsToGroup(e)}deleteConvsFromGroup(e){return this._convGroupHandler.deleteConvsFromGroup(e)}onConvMarkUpdated(e){this._convGroupHandler.onConvMarkUpdated(e)}onConvGroupCreated(e){this._convGroupHandler.onConvGroupCreated(e)}onConvGroupDeleted(e){this._convGroupHandler.onConvGroupDeleted(e)}onConvGroupNameUpdated(e){this._convGroupHandler.onConvGroupNameUpdated(e)}onConvInGroupUpdated(e){this._convGroupHandler.onConvInGroupUpdated(e)}onConvAddedToOrDeletedFromGroup(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}_getConvLastMessageSeq(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID);let s=e.lastMessage.lastSequence;return s=t&&s<t.sequence?t.sequence:s}_getConvLastMessageTime(e){var t=this._msgListHandler.getLocalLastMsg(e.conversationID);let s=e.lastMessage.lastTime;return s=t&&s<t.time?t.time:s}_createSetAllMessageReadPack(e){const s={readAllC2CMessage:0,groupMessageReadInfoList:[]},i=e["scope"];for(var[,n]of this._convMap)if(0<n.unreadCount)if(n.type===t.CONV_C2C&&0===s.readAllC2CMessage){if(i===t.READ_ALL_MSG)s.readAllC2CMessage=1;else if(i===t.READ_ALL_C2C_MSG){s.readAllC2CMessage=1;break}}else if(n.type===t.CONV_GROUP&&(i===t.READ_ALL_GROUP_MSG||i===t.READ_ALL_MSG)){const e=this._getConvLastMessageSeq(n);s.groupMessageReadInfoList.push({groupID:n.groupProfile.groupID,messageSequence:e})}return s}onPushedAllMessageRead(e){this._handleAllMsgRead(e)}_handleAllMsgRead(e){var{groupMessageReadInfoList:e,readAllC2CMessage:t}=e,e=this._parseGroupReadInfo(e);return 1<=this._updateAllConvUnreadCount({readAllC2CMessage:t})&&this.emitConvUpdate(!0,!1),e}_parseGroupReadInfo(s){const i=[];if(s&&s.length)for(let e=0,t=s.length;e<t;e++){var{groupID:n,sequence:o,retCode:r,lastMessageSeq:a}=s[e];$e(r)?this._remoteGroupReadSeqMap.set(n,a):(this._remoteGroupReadSeqMap.set(n,o),0!==r&&i.push(n+`-${o}-`+r))}return i}_updateAllConvUnreadCount(e){const s=e["readAllC2CMessage"];let i=0;for(var[n,o]of this._convMap)if(1<=o.unreadCount){if(1===s&&o.type===t.CONV_C2C){const e=this._getConvLastMessageTime(o);this.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:e})}else if(o.type===t.CONV_GROUP){const e=n.replace(t.CONV_GROUP,"");if(this._remoteGroupReadSeqMap.has(e)){const t=this._remoteGroupReadSeqMap.get(e),s=this._getConvLastMessageSeq(o);this.updateIsReadAfterReadReport({conversationID:n,remoteReadSequence:t}),s>=t&&this._remoteGroupReadSeqMap.delete(e)}}this.updateUnreadCount(n,!1)&&(i+=1)}return i}isRemoteRead(e){const{conversationID:s,sequence:i}=e,n=s.replace(t.CONV_GROUP,"");let o=!1;if(this._remoteGroupReadSeqMap.has(n)){const e=this._remoteGroupReadSeqMap.get(n);i<=e&&(o=!0,Ce.l(`${this._n}.isRemoteRead convID:${s} msgSeq:${i} remoteReadSeq:`+e)),i>=e+10&&this._remoteGroupReadSeqMap.delete(n)}return o}updateIsReadAfterReadReport({conversationID:e,lastMessageSeq:s,lastMessageTime:i}){var n=this._msgListHandler.getLocalMsgList(e);if(0!==n.length){let t;for(let e=n.length-1;0<=e;e--)if(t=n[e],!(i&&t.time>i||s&&t.sequence>s)){if("in"===t.flow&&t.isRead)break;t.setIsRead(!0)}}}updateUnreadCount(e,s=!0){let i=!1;const n=this.getLocalConversation(e),o=this._msgListHandler.getLocalMsgList(e);if(n){var r=n.unreadCount,a=o.filter(e=>!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted).length;if(r!==a&&(n.unreadCount=a,i=!0,Ce.l(this._n+`.updateUnreadCount from ${r} to ${a}, convID:`+e),!0===s&&this.emitConvUpdate(!0,!1)),i&&n.type===t.CONV_TOPIC){const s=n["unreadCount"],i=this.get(Ss),o=e.replace(t.CONV_GROUP,"");i.onUnreadCountUpdatedFromConv(o,s)}return i}}clearGroupAtInfoList(e,s=!0){const i=this.getLocalConversation(e);if(i&&0<i.groupAtInfoList.length){if(i.clearGroupAtInfoList(),Ce.l(this._n+".clearGroupAtInfoList convID:"+e),i.type===t.CONV_TOPIC){const s=i["groupAtInfoList"],n=this.get(Ss),o=e.replace(t.CONV_GROUP,"");n.onAtInfoUpdated({topicID:o,groupAtInfoList:s})}!0===s&&this.emitConvUpdate(!0,!1)}}updateReadReceiptInfo(s){const{userID:a,groupID:d,readReceiptList:i,timestamp:c=0}=s;if(!Oe(i)){const _=[];if($e(a)){if(!$e(d)){const e=""+t.CONV_GROUP+d;i.forEach(t=>{const{tinyID:s,clientTime:i,random:n,readCount:o,unreadCount:r}=t,a=s+`-${i}-`+n,c=this._msgListHandler.getLocalMsg(e,a)||this._msgListHandler.getHoppingMsg(e,a),l={groupID:d,messageID:a,readCount:0,unreadCount:0};c&&(Ge(o)&&(c.readReceiptInfo.readCount=o,l.readCount=o),Ge(r)&&(c.readReceiptInfo.unreadCount=r,l.unreadCount=r),_.push(l))})}}else{const e=""+t.CONV_C2C+a;i.forEach(t=>{const{tinyID:s,clientTime:i,random:n}=t,o=s+`-${i}-`+n,r=this._msgListHandler.getLocalMsg(e,o)||this._msgListHandler.getHoppingMsg(e,o);if(r&&!r.readReceiptInfo.isPeerRead){r.readReceiptInfo.isPeerRead=!0,r.readReceiptInfo.timestamp=c;const e={userID:a,messageID:o,isPeerRead:!0,timestamp:c};_.push(e)}})}0<_.length&&this.emitOEvt(e.MESSAGE_READ_RECEIPT_RECEIVED,_)}}updateIsRead(e){const i=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(i&&0!==n.length&&!lt(i.type)){const o=[];for(let e=0,t=n.length;e<t;e++)"in"!==n[e].flow?"out"!==n[e].flow||n[e].isRead||n[e].setIsRead(!0):o.push(n[e]);let s=0;if(i.type===t.CONV_C2C){const e=o.slice(-i.unreadCount).filter(e=>e.isRevoked).length;s=o.length-i.unreadCount-e}else s=o.length-i.unreadCount;for(let e=0;e<s&&!o[e].isRead;e++)o[e].setIsRead(!0)}}deleteGroupAtTips(e){const s=this._n+".deleteGroupAtTips";Ce.l(s);var i=this._convMap.get(e);if(!i)return Promise.resolve();const n=i.groupAtInfoList;if(0===n.length)return Promise.resolve();let o=void 0,r=(e.startsWith(t.CONV_GROUP)&&(o=e.replace(t.CONV_GROUP,"")),[...n]);if((ot({groupID:o})||rt(o))&&0===(r=n.filter(e=>!e.atTypeArray.includes(t.CONV_AT_ALL))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();const a=this.getMyUserID();return this.req({P:ri.DEL_GROUP_AT_TIPS,data:{messageListToDelete:r.map(e=>({from:e.from,to:a,messageSeq:e.__sequence,messageRandom:e.__random,groupID:$e(e.topicID)?e.groupID:e.topicID}))}}).then(()=>(Ce.l(s+" ok. count:"+n.length),this.clearGroupAtInfoList(e,!1),Promise.resolve())).catch(e=>(Ce.e(s+" failed. error:",e),ni(e)))}appendToMessageList(e){return this._msgListHandler.pushIn(e)}setMessageRandom(e){this._sll.set(e.random)}deleteMessageRandom(e){this._sll.delete(e.random)}pushIntoMessageList(e,t,s){return!(!this._msgListHandler.pushIn(t,s)||this._sll.has(t.random)&&!s||(e.push(t),0))}revoke(e,t,s){return this._msgListHandler.revoke(e,t,s)}getPeerReadTime(e){return this._peerReadTimeMap.get(e)}recordPeerReadTime(e,t){(!this._peerReadTimeMap.has(e)||this._peerReadTimeMap.get(e)<t)&&this._peerReadTimeMap.set(e,t)}updateMsgIsPeerReadProp(s,i){if(s.startsWith(t.CONV_C2C)&&0<i){const t=this._msgListHandler.updateMsgIsPeerReadProp(s,i);if(0<t.length&&this.emitOEvt(e.MESSAGE_READ_BY_PEER,t),this._convMap.has(s)){const e=this._convMap.get(s).lastMessage;Oe(e)||e.fromAccount===this.getMyUserID()&&e.lastTime<=i&&!e.isPeerRead&&(e.isPeerRead=!0,this.emitConvUpdate(!0,!1))}}}updateMsgIsModifiedProp(e){this._msgListHandler.updateMsgIsModifiedProp(e)}setCompleted(e){Ce.l(this._n+".setCompleted convID:"+e),this._completedMap.set(e,!0)}updateRoamingMsgKeyAndTime(e,t,s){this._roamingMsgKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:s})}getConvList(t){const s=this._n+".getConvList",e=`pagingStatus:${this._pagingStatus}, local conversation count:${this._convMap.size}, options:`+JSON.stringify(t);if(Ce.l(s+". "+e),this._pagingStatus===wt){const i=new Ti("getConvList");return i.setMessage(e),this.syncConvList().then(()=>{i.end();var e=this._getConvList(t);return Zs({conversationList:e,isSyncCompleted:this._isSyncCompleted()})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}const i=this._getConvList(t);return Ce.l(s+". returned conversation count:"+i.length),ii({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}_getConvList(t){if($e(t))return this.getLocalConvList();if(Fe(t))return 0===t.length?[]:this.getLocalConvList().filter(e=>t.includes(e.conversationID));if(be(t)){const{type:s,markType:i,groupName:n,hasUnreadCount:o,hasGroupAtInfo:r}=t;return this.getLocalConvList().filter(e=>this._filterType(e,s)&&this._filterMarkType(e,i)&&this._filterGroupName(e,n)&&this._filterUnreadCount(e,o)&&this._filterGroupAtInfo(e,r))}return[]}_filterType(e,s){return s!==t.CONV_C2C&&s!==t.CONV_GROUP||e.type===s}_filterGroupName(e,t){return!ke(t)||(""===t?0===e.conversationGroupList.length:e.conversationGroupList.includes(t))}_filterMarkType(e,t){return!Ge(t)||(0===t?0===e.markList.length:e.markList.includes(t))}_filterUnreadCount(e,t){let s=!0;return!0===t?s=1<=e.unreadCount:!1===t&&(s=0===e.unreadCount),s}_filterGroupAtInfo(e,t){let s=!0;return!0===t?s=1<=e.groupAtInfoList.length:!1===t&&(s=0===e.groupAtInfoList.length),s}_handleC2CPeerReadTime(){for(var[e,s]of this._convMap)s.type===t.CONV_C2C&&this.recordPeerReadTime(e,s.peerReadTime)}_isPagingGetGroupListCompleted(){const e=this.get(vs);return!e||e.isPagingGetCompleted()}_getLocalGroupCount(){const e=this.get(vs);return e?e.getLocalGroupList().length:0}_hasLocalGroup(e){const s=this.get(vs);return!!s&&s.hasLocalGroup(e.replace(t.CONV_GROUP,""))}getConversationProfile(i){let n,o=!1;if(this._convMap.has(i)?n=this._convMap.get(i):(n=new cn({conversationID:i,type:at(i)?t.CONV_C2C:t.CONV_GROUP},this.isIntl(),this.isUsingChatCore()),o=!0),n._isInfoCompleted||n.type===t.CONV_SYSTEM)return ii({conversation:n});if(ct(i)){if(!this.get(vs))return ni({code:ei.NO_MODULE});if(!this._hasLocalGroup(i))return ii({conversation:n})}const r=this._n+".getConversationProfile",a=new Ti("getConversationProfile");return Ce.l(r+`. convID:${i} remark:${n.remark} lastMessage:`,n.lastMessage),this._getUserOrGroupProfile(n).then(e=>{a.setMessage(`convID:${i} unreadCount:`+e.data.conversation.unreadCount).end();const s=this.get(Es);if(s&&n.type===t.CONV_C2C){const o=i.replace(t.CONV_C2C,"");if(s.isMyFriend(o)){const t=s.getFriendRemark(o);n.remark!==t&&(n.remark=t,Ce.l(r+`. convID:${i} patch remark:`+n.remark))}}if(Ce.l(r+` ok. isNewConv:${o} convID:`+i),o){if(n.type===t.CONV_C2C)return this._onNewC2CConv([i.replace(t.CONV_C2C,"")]).then(()=>ii({conversation:n}));if(n.type===t.CONV_GROUP)return this._onNewGroupConv([i.replace(t.CONV_GROUP,"")]).then(()=>ii({conversation:n}))}return e}).catch(e=>(a.setError(e).setMessage("convID:"+i).end(),Ce.e(r+" failed. error:",e),ni(e)))}_getUserOrGroupProfile(s){return s.type===t.CONV_C2C?this.get(Ts).getUserProfile({userIDList:[s.toAccount]}).then(e=>{e=e.data;return 0===e.length?ni({code:ei.USER_OR_GRP_NOT_FOUND}):(s.userProfile=e[0],s._isInfoCompleted=!0,this._insertConvAfterTopmost(s),ii({conversation:s}))}):this.get(vs).getGroupProfile({groupID:s.toAccount}).then(e=>(s.groupProfile=e.data.group,s._isInfoCompleted=!0,this._insertConvAfterTopmost(s),ii({conversation:s})))}_insertConvAfterTopmost(e){if(e instanceof cn&&!this._convMap.has(e.conversationID)){const t=[...this._convMap],s=t.findIndex(e=>!1===e[1].isPinned);t.splice(s,0,[e.conversationID,e]),this._convMap=new Map(t),this._setStorageConvList(),this.emitConvUpdate(!0,!1)}}_onProfileUpdated(e){e.data.forEach(e=>{var s=e["userID"];if(s===this.getMyUserID())this._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{const i=this._convMap.get(""+t.CONV_C2C+s);i&&(i.userProfile=e)}})}_onCloudConfig(e){"0"===this.getCloudConfig("pull_on_invite")&&(this._bPullOnInvite=!1),Ce.l(this._n+"._onCloudConfig bPullOnInvite:"+this._bPullOnInvite)}disableMsgPullOnInvite(){this._bPullOnInvite=!1}_isSyncCompleted(){return this._pagingStatus===kt}_errorLog(e,t,s,i){var n=new Error("Params validate failed."),o=""+this.getErrMsg("API_REFER")+e;throw Ce.w(`[${e}] | ${t} | ${this.getErrMsg(s,i)}, `+o),Ce.e(`[${e}] Invalid ${t}: type check failed for ${t}.`),n}_isValidConvID(e){return at(e)||ct(e)||lt(e)}deleteConversation(e){const t="deleteConversation";return ke(e)||we(e)||this._errorLog(t,"options","StringOrObjectRequiredLog"),ke(e)?(this._isValidConvID(e)||this._errorLog(t,"options","InvalidConversationID",e),Ce.l(`${this._n}.${t} convID:`+e),this.deleteConvList({conversationIDList:[e],flag:1})):(Fe(e.conversationIDList)||this._errorLog(t,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(t,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach(e=>{this._isValidConvID(e)||this._errorLog(t,"conversationIDList","InvalidConversationID",e)}),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(t,"clearHistoryMessage","BooleanRequiredLog"),100<e.conversationIDList.length&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConvList(e))}deleteConvList(e){const{conversationIDList:t=[],clearHistoryMessage:s=!0,flag:i=0}=e,n=this._n+".deleteConvList",o=`convIDList:${t} clearHistoryMessage:`+s,r=(Ce.l(n+" "+o),new Ti("deleteConvList"));return r.setMessage(o),Promise.all([this.rmLocalOnlyConvList(t),this.rmLocalAndRemoteConvList(t,s)]).then(e=>{r.end();e=[...e[0],...e[1]];return 0===e.length?ni(new Qs({code:ei.CONV_NOT_FOUND})):(Ce.l(n+" ok"),ii(1===i?{conversationID:e[0]}:{conversationIDList:e}))}).catch(e=>(r.setError(e).end(),Ce.e(n+" failed. error:",e),ni(e)))}rmLocalOnlyConvList(e){return e.filter(e=>{if(!this._convMap.has(e))return!1;var s=this.getLocalConversation(e).type;return s!==t.CONV_GROUP||this._hasLocalGroup(e)?s===t.CONV_SYSTEM&&(this.get(vs).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(e)}),this.deleteLocalConv(e),!0):(this.deleteLocalConv(e),!0)})}rmLocalAndRemoteConvList(e,s){const i={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:s?1:0};return e.forEach(e=>{var s;this._convMap.has(e)&&((s=this.getLocalConversation(e).type)===t.CONV_C2C?i.conversationList.push({toAccount:e.replace(s,""),type:1}):s===t.CONV_GROUP&&this._hasLocalGroup(e)&&i.conversationList.push({toGroupID:e.replace(s,""),type:2}))}),0===i.conversationList.length?[]:this.req({P:ri.DEL_CONV,data:i}).then(e=>{const s=[];return 0<e.data.resultList.length&&e.data.resultList.map(e=>{0===e.code&&(e=1===e.type?""+t.CONV_C2C+e.to:""+t.CONV_GROUP+e.groupID,s.push(e))}),this.deleteLocalConvList(s),s})}setConvDraft(e){var{conversationID:e,draftText:t}=e,s=this._n+".setConvDraft";if(Ce.l(s+` convID:${e} draftText:`+t),!this._convMap.has(e))return ni({code:ei.CONV_NOT_FOUND});const i=this._convMap.get(e);return i.setDraftText(t),this.emitConvUpdate(),ii({code:0,conversation:i})}clearHistoryMessage(s){const e={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._convMap.has(s))return ni({code:ei.CONV_NOT_FOUND});var i=this._convMap.get(s).type;if(i===t.CONV_C2C)e.type=1,e.toAccount=s.replace(t.CONV_C2C,"");else{if(i!==t.CONV_GROUP)return i===t.CONV_SYSTEM?(this.get(vs).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(s)}),ii({conversationID:s})):ni({code:ei.CONV_UN_RECORDED_TYPE});e.type=2,e.toGroupID=s.replace(t.CONV_GROUP,"")}const n=this._n+".clearHistoryMessage",o=new Ti("clearHistoryMessage");return o.setMessage("convID:"+s),Ce.l(n+". convID:"+s),this.setMessageRead({conversationID:s}).then(()=>this.req({P:ri.CLEAR_HISTORY_MSG,data:e})).then(()=>{o.end(),Ce.l(n+" ok"),this.clearMemMsg(s);const e=this.getLocalConversation(s);return e&&(e.updateLastMessage(),this._sortConvListAndEmitEvent()),ii({conversationID:s})}).catch(e=>(o.setError(e).end(),Ce.e(n+" failed. error:",e),ni(e)))}pinConversation(e){const{conversationID:s,isPinned:i}=e,n=this.getLocalConversation(s);if(n&&n.isPinned===i)return ii({conversationID:s});if(lt(s))return n&&(n.isPinned=i),this._sortConvListAndEmitEvent(),ii({conversationID:s});let o=null;if(at(s)?o={type:1,toAccount:s.replace(t.CONV_C2C,"")}:ct(s)&&(o={type:2,groupID:s.replace(t.CONV_GROUP,"")}),null===o)return ni({code:ei.INVALID_CONV_ID});const r=this._n+".pinConversation",a=`convID:${s} isPinned:`+i,c=new Ti("pinConversation");return c.setMessage(a),Ce.l(r+". "+a),this.req({P:ri.PIN_CONV,data:{fromAccount:this.getMyUserID(),operationType:!0===i?1:2,itemList:[o]}}).then(()=>(c.end(),Ce.l(r+" ok"),n?n.isPinned!==i&&(n.isPinned=i):this._convMap.set(s,new cn({conversationID:s,type:at(s)?t.CONV_C2C:t.CONV_GROUP,isPinned:i},this.isIntl(),this.isUsingChatCore())),this._sortConvListAndEmitEvent(),Zs({conversationID:s}))).catch(e=>(c.setError(e).end(),Ce.e(r+" failed. error:",e),ni(e)))}setMessageRemindType(e){return this._msgRemindHandler.set(e)}patchMsgRemindType(e){var{ID:s,isC2CConversation:i,messageRemindType:n}=e;let o=!1;const r=this.getLocalConversation(i?""+t.CONV_C2C+s:""+t.CONV_GROUP+s);return r&&r.messageRemindType!==n&&(r.messageRemindType=n,o=!0),Ce.l(this._n+".patchMsgRemindType options:",e,"ret:"+o),o}onC2CMsgRemindTypeFetched(e){if(Fe(e)&&0<e.length){let s=0;e.forEach(e=>{var{userID:e,muteFlag:t}=e,t=this._transMsgRemindType(t);!0===this.patchMsgRemindType({ID:e,isC2CConversation:!0,messageRemindType:t})&&(s+=1)}),Ce.l(this._n+".onC2CMsgRemindTypeFetched updateCount:"+s),1<=s&&this.emitConvUpdate(!0,!1)}}onC2CMsgRemindTypeSynced(e){const i=this._n+".onC2CMsgRemindTypeSynced";e.dataList.forEach(t=>{if(!Oe(t.muteNotificationsSync)){var{to:t,muteFlag:s}=t.muteNotificationsSync,s=this._transMsgRemindType(s);let e=0;this.patchMsgRemindType({ID:t,isC2CConversation:!0,messageRemindType:s})&&(e+=1),Ce.l(i+" updateCount:"+e),1<=e&&this.emitConvUpdate(!0,!1)}})}onGroupMsgRemindTypeUpdated(e){this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e)}deleteLocalConv(e,t=!0){var s=this._convMap.has(e);if(Ce.l(this._n+`.deleteLocalConv convID:${e} has:`+s),s&&(this._convMap.delete(e),this._convMapForDiff.delete(e),this.clearMemMsg(e),this._setStorageConvList(!0),t)){const t=!this._isTopicConv(e);this.emitConvUpdate(t,!1)}}pullMsgOnInvite(i){const n=this.get(vs);if(n){var o=this._n+".pullMsgOnInvite";if(Ce.l(o+" flag:"+this._bPullOnInvite),this._bPullOnInvite){var r=this.getLocalLastMessage(i),a=this.getLocalSecondLastMessage(i);let e=1,s=1;r&&(e=r.sequence),a&&(s=a.sequence);r=n.getGroupRemoteLastSeq(i.replace(t.CONV_GROUP,""));Ce.l(o+` convID:${i} localLastSeq:${e} localSecondLastSeq:${s} remoteLastSeq:`+r),this.clearMemMsg(i),1<e-s?this._recursiveGetMsgList([],i,!1,e,s):1<r-e&&this._recursiveGetMsgList([],i,!0,r,e)}}}_recursiveGetMsgList(o,r,a,c,l,e){this.getMessageList({conversationID:r,nextReqMessageID:e}).then(e=>{const{messageList:t,isCompleted:s,nextReqMessageID:i}=e.data,n=t.filter(e=>a?e.sequence>l&&e.sequence<=c:e.sequence>l&&e.sequence<c);o.unshift(...n),!s&&0<t.length&&t[0].sequence>l&&o.length<60?this._recursiveGetMsgList(o,r,a,c,l,i):this._emitMsgReceived(r,o)})}_emitMsgReceived(t,s){if(0<s.length){const i=s.filter((t,e,s)=>e===s.findIndex(e=>e.sequence===t.sequence)),n=this.hasLocalConversation(t),o=i.map(e=>e.sequence);Ce.l(`${this._n}._emitMsgReceived convID:${t} has:${n} count:${o.length} sequenceList:`,o),this.emitOEvt(e.MESSAGE_RECEIVED,i),n?this.patchConvLastMessage(t,!0):this.getConversationProfile(t).then(()=>{this.patchConvLastMessage(t,!0)})}}deleteLocalConvList(e){let t=!1;e.forEach(e=>{this._convMap.has(e)&&(this.deleteLocalConv(e,!1),t=!0)}),Ce.l(this._n+`.deleteLocalConvList convID:${e} isConvIDExisted:`+t),t&&this.emitConvUpdate(!0,!1)}isMessageSentByCurrentInstance(e){return!(!this._msgListHandler.hasLocalMsg(e.conversationID,e.ID)&&!this._sll.has(e.random))}modifyMessageList(e){var s,i;e.startsWith(t.CONV_C2C)&&this._convMap.has(e)&&(i=this._convMap.get(e),s=Date.now(),this._msgListHandler.modifyMsgSentByPeer({conversationID:e,latestNick:i.userProfile.nick,latestAvatar:i.userProfile.avatar}),i=this.get(Ts).getNickAndAvatarByUserID(this.getMyUserID()),this._msgListHandler.modifyMsgSentByMe({conversationID:e,latestNick:i.nick,latestAvatar:i.avatar}),Ce.l(this._n+`.modifyMessageList convID:${e} cost:`+Dt(s)))}updateUserProfileSpecifiedKey(e){Ce.l(this._n+".updateUserProfileSpecifiedKey options:",e);var{conversationID:t,nick:s,avatar:i}=e;if(this._convMap.has(t)){const e=this._convMap.get(t).userProfile;ke(s)&&e.nick!==s&&(e.nick=s),ke(i)&&e.avatar!==i&&(e.avatar=i),this.emitConvUpdate(!0,!1)}}_onMyProfileModified(t){const e=this.getLocalConvList(),s=Date.now();e.forEach(e=>{this.modifyMessageSentByMe({conversationID:e.conversationID,...t})}),Ce.l(this._n+"._onMyProfileModified. modify all messages sent by me, cost:"+Dt(s))}modifyMessageSentByMe(e){this._msgListHandler.modifyMsgSentByMe(e)}getLatestMessageSentByMe(e){return this._msgListHandler.getLatestMsgSentByMe(e)}modifyMessageSentByPeer(e){this._msgListHandler.modifyMsgSentByPeer(e)}getLatestMessageSentByPeer(e){return this._msgListHandler.getLatestMsgSentByPeer(e)}pushIntoNoticeResult(e,t){return!(!this._msgListHandler.pushIn(t)||this._sll.has(t.random)||(e.push(t),0))}getLocalLastMessage(e){return this._msgListHandler.getLocalLastMsg(e)}getLocalSecondLastMessage(e){return this._msgListHandler.getLocalSecondLastMsg(e)}checkAndPatchRemark(){const n=this.get(Es);if(0!==this._convMap.size&&n){const e=[...this._convMap.values()].filter(e=>e.type===t.CONV_C2C);if(0!==e.length){let i=0;e.forEach(e=>{var s=e.conversationID.replace(t.CONV_C2C,"");if(n.isMyFriend(s)){const t=n.getFriendRemark(s);e.remark!==t&&(e.remark=t,i+=1)}}),Ce.l(`${this._n}.checkAndPatchRemark. c2cConvCount:${e.length} patchedCount:`+i),0<i&&this.emitConvUpdate(!0,!1)}}}updateTopicConversation(e){this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0})}sendReadReceipt(e){var s=e[0];let i=null;return s.conversationType===t.CONV_C2C?i=this._m.get(ys):s.conversationType===t.CONV_GROUP&&(i=this._m.get(vs)),i?i.sendReadReceipt(e):ni({code:ei.NO_MODULE})}getReadReceiptList(e){var s=e[0];let i=null;return s.conversationType===t.CONV_C2C?i=this._m.get(ys):s.conversationType===t.CONV_GROUP&&(i=this._m.get(vs)),i?i.getReadReceiptList(e):ni({code:ei.NO_MODULE})}getLastMessageTime(e){e=this.getLocalConversation(e);return e?e.lastMessage.lastTime:0}getTotalUnreadCount(){const e=this.getLocalConvList();let s=0;return e.forEach(e=>{e.type!==t.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==t.MSG_REMIND_ACPT_AND_NOTE||(s+=e.unreadCount))}),s}onTotalUnreadCountUpdate(){var t=this.getTotalUnreadCount();this._convTotalUnreadCount!==t&&(Ce.l(`${this._n}.onTotalUnreadCountUpdate from ${this._convTotalUnreadCount} to `+t),this._convTotalUnreadCount=t,this.emitOEvt(e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}_isConvNeedShow(e){e=this.getLocalConversation(e);if($e(e))return!0;var s=e.type===t.CONV_TOPIC,i=e.type===t.CONV_GROUP&&e.groupProfile.type===t.GRP_ROOM,e=e.type===t.CONV_GROUP&&e.groupProfile.type===t.GRP_LIVE;return!(s||i||e)}setAllRcvMsgOpt(e){return this._msgRemindHandler.setAllRcvMsgOpt(e)}getAllRcvMsgOpt(){return this._msgRemindHandler.getAllRcvMsgOpt()}onAllRcvMsgOptNotify(e){this._msgRemindHandler.onAllRcvMsgOptNotify(e)}clearUnreadCount(e){const t=this.getLocalConversation(e);t&&0<t.unreadCount&&(t.unreadCount=0,this.emitConvUpdate(!0,!1))}storeHoppingMessageList(e){this._msgListHandler.storeHoppingMsgList(e)}clearMemMsg(e,t=!1){Ce.l(this._n+`.clearMemMsg convID:${e} isOverLimit:`+t),this._msgListHandler.removeByConvID(e),this._completedMap.delete(e),this._roamingMsgKeyAndTimeMap.delete(e),this._everClearedMap.set(e,1)}reset(){Ce.l(this._n+".reset"),this._setStorageConvList(!0),this._pagingStatus=Ut,this._msgListHandler.reset(),this._msgRemindHandler.reset(),this._roamingMsgKeyAndTimeMap.clear(),this._sll.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._convMap.clear(),this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._remoteGroupReadSeqMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this._pagingConvIDMap.clear(),this._convIDFromUnreadDBMap.clear(),this._pagingGetCostList.length=0,this._convMapForDiff.clear(),this._partialUpdatedConvMap.clear(),this._everClearedMap.clear(),this._bPullOnInvite=!0,this._convGroupHandler.reset(),this.resetReady()}}const hn=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],pn=function(e,t){return Oe(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",avatar:"",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:yt(e.type,e.payload,t),nick:e.nick||"",avatar:e.avatar||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}};class gn{constructor(e,t){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=pn(e.lastMessage,t),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(e)}_initTopic(e){for(const t in e)hn.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}updateUnreadCount(e=0){this.unreadCount=e}updateNextMessageSeq(e){this.nextMessageSeq=e}updateLastMessage(e){this.lastMessage=pn(e)}updateGroupAtInfoList(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}updateTopic(e){$e(e.selfInfo)||this.updateSelfInfo(e.selfInfo),$e(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),We(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}updateSelfInfo(e){return 0===We(this.selfInfo,e,[],[""])}reduceUnreadCount(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}isLastMessageRevoked({sequence:e}){return e===this.lastMessage.lastSequence}setLastMessageRevoked(e){this.lastMessage.isRevoked=e}setLastMessageRevoker(e){this.lastMessage.revoker=e}}class mn extends oi{constructor(e){super(e),this._n="TopicModule",this._topicMap=new Map,this._getTopicTimeMap=new Map,this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600,this.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");$e(e)||(this.TOPIC_CACHE_TIME=Number(e)),$e(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}onTopicCreated(t){var s=t["groupID"];this.resetGetTopicTime(s),this.emitOEvt(e.TOPIC_CREATED,t)}onTopicDeleted(t){const{groupID:s,topicIDList:i=[]}=t;i.forEach(e=>{this._deleteLocalTopic(s,e)}),this.emitOEvt(e.TOPIC_DELETED,t)}onTopicProfileUpdated(t){const{groupID:s,topicID:i}=t,n=this.getLocalTopic(s,i);n&&(n.updateTopic(t),this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:n}))}onTopicLatestMsg(e){const{topicLatestMessage:s,excludedUnreadSequenceList:i}=e||{};if(!Oe(s)){const{topicID:e}=s["groupProfile"],n=(s.conversationType=t.CONV_GROUP,s.to=e,new xi(s));n.setElement(s.elements),this.updateUnreadCountAndLastMsg(e,n,i)}}onMessageRemindTypeUpdated(t){const{groupID:s,topicID:i,messageRemindType:n}=t,o=this.getLocalTopic(s,i);if(o){const t=o.updateSelfInfo({messageRemindType:n});t&&this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:o}),Ce.l(this._n+`.onMessageRemindTypeUpdated topicID:${i} messageRemindType:${n} isUpdated:`+t)}}onAtInfoUpdated(t){const{topicID:s,groupAtInfoList:i}=t,n=Tt(s),o=this.getLocalTopic(n,s);o&&!$e(i)&&(o.updateGroupAtInfoList(i),this.emitOEvt(e.TOPIC_UPDATED,{groupID:n,topic:o}))}onUnreadCountUpdatedFromConv(t,s=0){const i=Tt(t),n=this.getLocalTopic(i,t);n&&n.unreadCount!==s&&(n.updateUnreadCount(s),0===s&&n.updateSelfInfo({readedSequence:n.lastMessage.lastSequence}),this.emitOEvt(e.TOPIC_UPDATED,{groupID:i,topic:n}))}onMessageSent(t){const{groupID:s,topicID:i,lastMessage:n}=t,o=this.getLocalTopic(s,i);if(o){const{sequence:t=0}=n,i=t+1;i>o.nextMessageSeq&&(o.updateNextMessageSeq(i),o.updateLastMessage(n),o.updateSelfInfo({readedSequence:t}),o.updateUnreadCount(0),this.emitOEvt(e.TOPIC_UPDATED,{groupID:s,topic:o}))}}onMessageModified(t){var{to:s,time:i,sequence:n,elements:o,cloudCustomData:r,messageVersion:a}=t,c=Tt(s),l=this.getLocalTopic(c,s);if(l){const d=l.lastMessage;Ce.d(this._n+`.onMessageModified topicID:${s} lastMessage:`,JSON.stringify(d),"options:",JSON.stringify(t)),d&&(null===d.payload||d.lastTime===i&&d.lastSequence===n&&d.version!==a)&&(d.type=o[0].type,d.payload=o[0].content,d.messageForShow=yt(d.type,d.payload,this.isIntl()),d.cloudCustomData=r,d.version=a,d.lastSequence=n,d.lastTime=i,this.emitOEvt(e.TOPIC_UPDATED,{groupID:c,topic:l}))}}onMessageRevoked(t){if(0!==t.length){let s=null,i=null,n=!1;t.forEach(e=>{const t=e.to;if(i=Tt(t),s=this.getLocalTopic(i,t)){s.reduceUnreadCount()&&(n=!0),s.isLastMessageRevoked(e)&&(s.setLastMessageRevoked(!0),s.setLastMessageRevoker(e.revoker),n=!0);const t=s.selfInfo.excludedUnreadSequenceList||[];t.push(e.sequence),s.updateSelfInfo({excludedUnreadSequenceList:t})}}),n&&this.emitOEvt(e.TOPIC_UPDATED,{groupID:i,topic:s})}}isLastMessageRevoked(e){const{topicID:t,sequence:s}=e,i=Tt(t),n=this.getLocalTopic(i,t);let o=!1;return o=n?n.isLastMessageRevoked({sequence:s}):o}updateUnreadCountAndLastMsg(i,n,o){const r=Tt(i),a=this.getLocalTopic(r,i);if(a){let s=a.selfInfo.excludedUnreadSequenceList||[];if($e(o)||(s=o),n._isExcludedFromUnreadCount&&s.push(n.sequence),a.updateSelfInfo({excludedUnreadSequenceList:s}),Ce.l(`${this._n}.updateUnreadCountAndLastMsg seq:${n.sequence} lastSeq:`+a.lastMessage.lastSequence),n.sequence>a.lastMessage.lastSequence){a.updateLastMessage(n);const o=n.sequence+1;a.updateNextMessageSeq(o);n=this._computeUnreadCount(a);a.updateUnreadCount(n);const c=this.get(Ds).getLocalConversation(""+t.CONV_GROUP+i);c&&c.updateUnreadCount({nextUnreadCount:n,isFromGetConversations:!0}),this.emitOEvt(e.TOPIC_UPDATED,{groupID:r,topic:a})}}}getJoinedCommunityList(){return this.get(vs).syncCommunityWithTopic()}createTopicInCommunity(t){const s=this._n+".createTopicInCommunity",e=t["topicID"];if(!$e(e)&&!rt(e))return ni({code:ei.ILLEGAL_TOPIC_ID});if(t.topicName&&!1===this._filterProfanity("topicName",t))return ni({code:ei.PROFANITY_FOUND});if(t.introduction&&!1===this._filterProfanity("introduction",t))return ni({code:ei.PROFANITY_FOUND});if(t.notification&&!1===this._filterProfanity("notification",t))return ni({code:ei.PROFANITY_FOUND});const i=new Ti("createTopicInCommunity");return this.req({P:ri.CREATE_TOPIC,data:{...t}}).then(e=>{e=e.data.topicID;return i.setMessage("topicID:"+e).end(),Ce.l(s+" ok. topicID:"+e),this._updateTopicMap([{...t,topicID:e}]),Zs({topicID:e})}).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}deleteTopicFromCommunity(e){const s=this._n+".deleteTopicFromCommunity",{groupID:o,topicIDList:t=[]}=e,r=new Ti("deleteTopicFromCommunity");return r.setMessage(`groupID:${o} topicIDList:`+t),this.req({P:ri.DEL_TOPIC,data:{groupID:o,topicIDList:t}}).then(e=>{const{resultList:t=[]}=e.data,i=[],n=[];t.forEach(e=>{var{topicID:e,errorCode:t,errorInfo:s}=e;0===t?i.push({topicID:e}):n.push({topicID:e,code:t,message:s})});e=`success count:${i.length}, fail count:`+n.length;return r.setMoreMessage(e).end(),Ce.l(s+" ok. "+e),i.forEach(e=>{this._deleteLocalTopic(o,e.topicID)}),Zs({successTopicList:i,failureTopicList:n})}).catch(e=>(r.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}updateTopicProfile(e){const t=this._n+".updateTopicProfile";if(Ce.l(t+" options:",e),e.topicName&&!1===this._filterProfanity("topicName",e))return ni({code:ei.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return ni({code:ei.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return ni({code:ei.PROFANITY_FOUND});const s=new Ti("updateTopicProfile");return s.setMessage(`groupID:${e.groupID} topicID:`+e.topicID),$e(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.req({P:ri.UPDATE_TOPIC_PROFILE,data:{...e}}).then(()=>(s.end(),Ce.l(t+" ok"),this._updateTopicMap([e]),Zs({topic:this.getLocalTopic(e.groupID,e.topicID)}))).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)))}getTopicList(e){const i=this._n+".getTopicList",{groupID:n,topicIDList:t=[]}=e,c=0===t.length,l=new Ti("getTopicList");if(l.setMessage("groupID:"+n),this._getTopicTimeMap.has(n)){const{isGetAll:e,time:s}=this._getTopicTimeMap.get(n);if((e||!e&&!c)&&Date.now()-s<1e3*this.TOPIC_CACHE_TIME){const e=this._getLocalTopicList(n,t);if(c||e.length===t.length)return l.setMoreMessage("from cache, topic count:"+e.length).end(),Ce.l(i+` groupID:${n} from cache, topic count:`+e.length),ii({successTopicList:e,failureTopicList:[]})}}return this.req({P:ri.GET_TOPIC_LIST,data:{groupID:n,topicIDList:t}}).then(e=>{const{topicInfoList:t=[]}=e.data,o=[],r=[],a=[];t.forEach(e=>{var{topic:e,selfInfo:t,errorCode:s,errorInfo:i}=e,n=e["topicID"];0===s?(o.push({...e,selfInfo:t}),r.push(n)):a.push({topicID:n,code:s,message:i})}),this._updateTopicMap(o),this._handleTopicAtInfo(o);e=`success count:${r.length}, fail count:`+a.length;l.setMoreMessage(e).end(),Ce.l(i+` groupID:${n} from remote, `+e);let s=[];return Oe(r)||(this._getTopicTimeMap.set(n,{time:Date.now(),isGetAll:c}),s=this._getLocalTopicList(n,r)),Zs({successTopicList:s,failureTopicList:a})}).catch(e=>(l.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}hasLocalTopic(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}getLocalTopic(e,t){let s=null;return s=this._topicMap.has(e)?this._topicMap.get(e).get(t):s}_getLocalTopicList(e,t=[]){const s=this._topicMap.get(e);let i=[];return s&&(i=[...s.values()]),0===t.length?i:i.filter(e=>t.includes(e.topicID))}_deleteLocalTopic(e,t){this._topicMap.has(e)&&this._topicMap.get(e).has(t)&&(this._topicMap.get(e).delete(t),Ce.l(this._n+`._deleteLocalTopic groupID:${e} topicID:`+t))}_updateTopicMap(e){const o=[];e.forEach(e=>{var{groupID:s,topicID:i}=e;let n=null;this._topicMap.has(s)||this._topicMap.set(s,new Map),this._topicMap.get(s).has(i)?(n=this._topicMap.get(s).get(i)).updateTopic(e):(this._getTopicLastMessage(e),n=new gn(e,this.isIntl()),this._topicMap.get(s).set(i,n));e=this._computeUnreadCount(n);n.updateUnreadCount(e),o.push({conversationID:""+t.CONV_GROUP+i,type:t.CONV_TOPIC,unreadCount:e})}),0<o.length&&this.get(Ds).updateTopicConversation(o)}resetGetTopicTime(e){$e(e)?[...this._getTopicTimeMap.keys()].forEach(e=>{this._getTopicTimeMap.set(e,0)}):this._getTopicTimeMap.set(e,0)}getTopicListOnReconnected(){const e=[...this._topicMap.keys()],i=[],n=this.get(Ds);e.forEach(e=>{const s=[],t=this._getLocalTopicList(e);n.deleteTopicRoamingInfo(e),t.forEach(e=>{var{lastMessage:{lastTime:t=0}}=e;Date.now()-1e3*t<1e3*this.TOPIC_LAST_ACTIVE_TIME&&s.push(e.topicID)}),0<s.length&&i.push({groupID:e,topicIDList:s})}),Ce.l(this._n+".getTopicListOnReconnected. active community count:"+i.length),this._relayGetTopicList(i)}_relayGetTopicList(t){if(0!==t.length){const e=t.shift(),s=5<e.topicIDList.length?"topicIDList.length:"+e.topicIDList.length:"topicIDList:"+e.topicIDList,i=new Ti("relayGetTopicList");i.setMessage(s),Ce.l(this._n+"._relayGetTopicList. "+s),this.getTopicList(e).then(()=>{i.end(),this._relayGetTopicList(t)}).catch(e=>{i.setError(e).end(),this._relayGetTopicList(t)})}}_handleTopicAtInfo(e){0!==e.length&&e.forEach(e=>{const{groupID:t,topicID:s,groupAtInfoList:i}=e,n=[];$e(i)||(i.forEach(e=>{n.push({...e,groupID:t,topicID:s})}),this.get(Ds).onNewGroupAtTips({dataList:n}))})}_getTopicLastMessage(e){var t;$e(e.lastMsg)||(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,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:Oe(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker},e.lastMessage=t)}deleteTopicListInCommunity(s){const e=this._getLocalTopicList(s),i=this.get(Ds);e.forEach(e=>{e=e.topicID;this._deleteLocalTopic(s,e),this._getTopicTimeMap.delete(s),i.deleteLocalConv(""+t.CONV_GROUP+e)})}_computeUnreadCount(s){const{excludedUnreadSequenceList:e,readedSequence:i}=s.selfInfo;let n=s.nextMessageSeq-s.selfInfo.readedSequence-1;if(Fe(e)){let t=0;e.forEach(e=>{e>i&&e<=s.nextMessageSeq-1&&(t+=1)}),1<=t&&(n-=t)}return n<0?0:n}_filterProfanity(e,t){const s=this.get(Vs);if(!s)return!0;var{isAllowedToSend:i,modifiedText:n}=s.filterText(t[e],E);return!0===i&&(t[e]=n,!0)}getMessageExtensions(e,t){Ce.l(this._n+".getMessageExtensions startSequence:"+t);var s=Tt(e.to);return this.req({P:ri.GET_GRP_MSG_EXT,data:{groupID:s,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}modifyMsgExts(e,t,s=1){Ce.l(this._n+".modifyMsgExts operateType:"+s);var i=Tt(e.to);return this.req({P:ri.MODIFY_GRP_MSG_EXT,data:{groupID:i,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:s}})}reset(){Ce.l(this._n+".reset"),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}class fn{constructor(e){this._userM=e,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}setExpirationTime(e){this.expirationTime=e}getUserProfile(e){const t=this._n+".getUserProfile",s=e.userIDList,i=(e.fromAccount=this._userM.getMyAccount(),100<s.length&&(Ce.w(t+" "+St(100)),s.length=100),[]),n=[];var o;for(let e=0,t=s.length;e<t;e++)o=s[e],this._userM.isMyFriend(o)&&this._contains(o)?n.push(this._getProfileFromMap(o)):i.push(o);if(0===i.length)return ii(n);e.toAccount=i;const r=e.bFromGetMyProfile||!1,a=[],c=(e.toAccount.forEach(e=>{a.push({toAccount:e,standardSequence:0,customSequence:0})}),e.userItem=a,new Ti("getUserProfile"));return c.setMessage(5<s.length?"userIDList.length:"+s.length:"userIDList:"+s),this._userM.req({P:ri.GET_USER_PROFILE,data:e}).then(e=>{c.end(),Ce.i(t+" ok");e=this._handleResponse(e).concat(n);return Zs(r?e[0]:e)}).catch(e=>(c.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)))}getMyProfile(){var e,t=this._userM.getMyAccount(),s=this._n+".getMyProfile";return Ce.l(s+" myAccount:"+t),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),Ce.d(s+" from cache, myProfile:"+JSON.stringify(e)),ii(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}_handleResponse(s){var i,n=s.data["userProfileItem"];if(!Fe(n))return[];const o=[],r=Date.now();for(let e=0,t=n.length;e<t;e++){const{to:s,profileItem:r}=n[e];"@TLS#NOT_FOUND"!==s&&""!==s&&(i=this._update(s,this._getLatestProfileFromResponse(s,r))["latestProfile"],o.push(i))}return Ce.l(this._n+"._handleResponse cost:"+Dt(r)),o}_getLatestProfileFromResponse(e,s){const i={userID:e,profileCustomField:[]};if(!Oe(s))for(let e=0,t=s.length;e<t;e++)if(-1<s[e].tag.indexOf("Tag_Profile_Custom"))i.profileCustomField.push({key:s[e].tag,value:s[e].value});else switch(s[e].tag){case ye.NICK:i.nick=s[e].value;break;case ye.GENDER:i.gender=s[e].value;break;case ye.BIRTHDAY:i.birthday=s[e].value;break;case ye.LOCATION:i.location=s[e].value;break;case ye.SELFSIGNATURE:i.selfSignature=s[e].value;break;case ye.ALLOWTYPE:i.allowType=s[e].value;break;case ye.LANGUAGE:i.language=s[e].value;break;case ye.AVATAR:i.avatar=s[e].value;break;case ye.MESSAGESETTINGS:i.messageSettings=s[e].value;break;case ye.ADMINFORBIDTYPE:i.adminForbidType=s[e].value;break;case ye.LEVEL:i.level=s[e].value;break;case ye.ROLE:i.role=s[e].value;break;default:Ce.w(this._n+"._getLatestProfileFromResponse unknown tag:",s[e].tag,s[e].value)}return i}updateMyProfile(n){const o=this._n+".updateMyProfile";if(n.nick&&!1===this._userM.filterProfanity("nick",n))return ni({code:ei.PROFANITY_FOUND});if(n.selfSignature&&!1===this._userM.filterProfanity("selfSignature",n))return ni({code:ei.PROFANITY_FOUND});const r=new Ti("updateMyProfile");r.setMessage(JSON.stringify(n));var t=(new sn).validate(n);if(!t.valid)return r.setCode(ei.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:"+t.tips).end(),Ce.e(o+" info:"+t.tips),ni({code:ei.UPDATE_PROFILE_INVALID_PARAM});const s=[];for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&("profileCustomField"===e?n.profileCustomField.forEach(e=>{s.push({tag:e.key,value:e.value})}):s.push({tag:ye[e.toUpperCase()],value:n[e]}));if(0===s.length){const e=new Qs({code:ei.UPDATE_PROFILE_NO_KEY});return r.setError(e).end(),Ce.e(o+" failed. error:",e),ni(e)}const a=this._userM.getMyAccount();return this._userM.req({P:ri.UPDATE_MY_PROFILE,data:{fromAccount:a,profileItem:s}}).then(t=>{r.end(),Ce.i(o+" ok");var{isProfileUpdated:s,latestProfile:i}=this._update(a,n);return!0===s&&this._userM.emitOEvt(e.PROFILE_UPDATED,[i]),ii(i)}).catch(e=>(r.setError(e).end(),Ce.e(o+" failed. error:",e),ni(e)))}onProfileModified(t){var s,i=t.dataList;if(!Oe(i)){const n=i.length;Ce.d(`${this._n}.onProfileModified count:${n} dataList:`,t.dataList);const o=[];for(let e=0;e<n;e++){s=i[e].userID;const{isProfileUpdated:t,latestProfile:n}=this._update(s,this._getLatestProfileFromResponse(s,i[e].profileList));!0===t&&o.push(n)}0<o.length&&(this._userM.emitIEvt(Yi.PROFILE_UPDATED,o),this._userM.emitOEvt(e.PROFILE_UPDATED,o))}}_fill(){if(0===this.accountProfileMap.size){var s=this._getCachedProfiles(),i=Date.now();for(let e=0,t=s.length;e<t;e++)i-s[e].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(s[e].userID,s[e]);Ce.l(this._n+"._fill from cache, size:"+this.accountProfileMap.size)}}_update(e,t){let s,i=!1;var n=Date.now();return this._contains(e)?(s=this._getProfileFromMap(e),t.profileCustomField&&!0===st(s.profileCustomField,t.profileCustomField)&&(s.lastUpdatedTime=n,i=!0),0<We(s,t,["profileCustomField"])&&(s.lastUpdatedTime=n,i=!0)):(s=new sn(t),!this._userM.isMyFriend(e)&&e!==this._userM.getMyAccount()||(s.lastUpdatedTime=n,i=!0,this.accountProfileMap.set(e,s))),this._flush(e===this._userM.getMyAccount()),!0===i&&Ce.l(this._n+`._update account:${e} isUpdated:`+i),{isProfileUpdated:i,latestProfile:s}}_flush(e){const t=[...this.accountProfileMap.values()],s=this._userM.getStorageModule();Ce.d(this._n+`._flush length:${t.length} flushAtOnce:`+e),s.setItem(this.TAG,t,e)}_contains(e){return this.accountProfileMap.has(e)}_getProfileFromMap(e){return this.accountProfileMap.get(e)}_getCachedProfiles(){var e=this._userM.getStorageModule().getItem(this.TAG);return Oe(e)?[]:e}onConvProfileUpdated(s){var i,n,o;const r=[];for(let e=0,t=s.length;e<t;e++)n=(i=s[e]).userID,this._userM.isMyFriend(n)&&(this._contains(n)?(o=this._getProfileFromMap(n),0<We(o,i)&&r.push(n)):r.push(i.userID));0!==r.length&&(Ce.l(this._n+".onConvProfileUpdated toAccountList:"+r),this.getUserProfile({userIDList:r}))}getNickAndAvatarByUserID(e){return this._contains(e)?{nick:(e=this._getProfileFromMap(e)).nick,avatar:e.avatar}:{nick:"",avatar:""}}getUserNickAndAvatar(e){var t=[...new Set(e)];Ce.l(`${this._n}.getUserNickAndAvatar userIDList.length:${e.length} uniqueUserIDList.length:`+t.length);const s=[];if(0===e.length)return Promise.resolve(s);const i=this._createUserIDListGroup(t),n=[];return i.forEach(e=>{n.push(this.getUserProfile({userIDList:e}))}),Promise.all(n).then(e=>(e.forEach(e=>{e=e.data.map(({userID:e,nick:t,avatar:s})=>({userID:e,nick:t,avatar:s}));s.push(...e)}),s))}_createUserIDListGroup(e){const t=[];let s=0;for(;s<e.length;)t.push(e.slice(s,s+=100));return t}reset(){this._flush(!0),this.accountProfileMap.clear()}}class Mn{constructor(e){Oe||(this.userID=e.userID||"",this.timeStamp=e.timeStamp||0)}}class In{constructor(e){this._userM=e,this._n="BlacklistHandler",this._blacklistMap=new Map,this._startIndex=0}getLocalBlacklist(){return[...this._blacklistMap.keys()]}getBlacklist(){const n=this._n+".getBlacklist",t={fromAccount:this._userM.getMyAccount(),maxLimited:100,startIndex:this._startIndex},o=new Ti("getBlacklist");return this._userM.req({P:ri.GET_BL,data:t}).then(t=>{var{blackListItem:t,startIndex:s}=t.data,i=Oe(t)?0:t.length;o.setMessage("count:"+i).end(),Ce.i(n+" ok"),this._startIndex=s,this._handleResponse(t,!0),this._userM.emitOEvt(e.BLACKLIST_UPDATED,[...this._blacklistMap.keys()]),0!==this._startIndex&&this.getBlacklist()}).catch(e=>(o.setError(e).end(),Ce.e(n+" failed. error:",e),ni(e)))}addBlacklist(t){const s=new Ti("addToBlacklist"),i=this._n+".addBlacklist",n=this._userM.getMyAccount();if(1!==t.userIDList.length||t.userIDList[0]!==n)return t.userIDList.includes(n)&&(t.userIDList=t.userIDList.filter(e=>e!==n)),t.fromAccount=this._userM.getMyAccount(),t.toAccount=t.userIDList,this._userM.req({P:ri.ADD_TO_BL,data:t}).then(e=>(s.setMessage(5<t.userIDList.length?"userIDList.length:"+t.userIDList.length:"userIDList:"+t.userIDList).end(),Ce.i(i+" ok"),this._handleResponse(e.resultItem,!0),Zs([...this._blacklistMap.keys()]))).catch(e=>(s.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)));{const t=ei.CANNOT_ADD_SELF_TO_BLACKLIST,n=this._userM.getErrMsg(t);s.setCode(t).setMessage(n).end();var e=new Qs({code:t});return Ce.e(i+" failed. error:",e),ni(e)}}_handleResponse(o,r){if(!Oe(o)){let s,i,n;for(let e=0,t=o.length;e<t;e++)i=o[e].to,n=o[e].resultCode,!$e(n)&&0!==n||(r?((s=this._blacklistMap.has(i)?this._blacklistMap.get(i):new Mn).userID=i,Oe(o[e].addBlackTimeStamp)||(s.timeStamp=o[e].addBlackTimeStamp),this._blacklistMap.set(i,s)):this._blacklistMap.has(i)&&(s=this._blacklistMap.get(i),this._blacklistMap.delete(i)))}Ce.l(`${this._n}._handleResponse total:${this._blacklistMap.size} bAdd:`+r)}deleteBlacklist(t){const s=this._n+".deleteBlacklist",i=new Ti("removeFromBlacklist");return t.fromAccount=this._userM.getMyAccount(),t.toAccount=t.userIDList,this._userM.req({P:ri.RM_FROM_BL,data:t}).then(e=>(i.setMessage(5<t.userIDList.length?"userIDList.length:"+t.userIDList.length:"userIDList:"+t.userIDList).end(),Ce.i(s+" ok"),this._handleResponse(e.data.resultItem,!1),Zs([...this._blacklistMap.keys()]))).catch(e=>(i.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}onAccountDeleted(s){for(let e=0,t=s.length;e<t;e++){const i=s[e];this._blacklistMap.has(i)&&this._blacklistMap.delete(i)}const i=s.length;0<i&&(Ce.l(`${this._n}.onAccountDeleted count:${i} `+(i<30?"userIDList:"+s:"")),this._userM.emitOEvt(e.BLACKLIST_UPDATED,[...this._blacklistMap.keys()]))}onAccountAdded(s){const i=[];var n;for(let e=0,t=s.length;e<t;e++)n=s[e],this._blacklistMap.has(n)||(this._blacklistMap.set(n,new Mn({userID:n})),i.push(n));0<i.length&&(Ce.l(`${this._n}.onAccountAdded count:${i.length} userIDList:`,i),this._userM.emitOEvt(e.BLACKLIST_UPDATED,[...this._blacklistMap.keys()]))}reset(){this._blacklistMap.clear(),this._startIndex=0}}const Cn=function(e){const n=String(e).replace(/[=]+$/,"");let o="";if(n.length%4==1)return"";for(let e,t,s=0,i=0;t=n.charAt(i++);~t&&(e=s%4?64*e+t:t,s++%4)&&(o+=String.fromCharCode(255&e>>(-2*s&6))))t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(t);try{return decodeURIComponent(escape(o))}catch(e){return""}};class Tn{constructor(e){this._userM=e,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userM.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){var e=this._userM.getCloudConfig("status_query_count"),t=this._userM.getCloudConfig("status_sub_count"),s=this._userM.getCloudConfig("status_unsub_count");Ce.l(this._n+`._onCloudConfig statusQueryCount:${e} statusSubscribeCount:${t} statusUnsubscribeCount:`+s),$e(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),$e(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),$e(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(s,10))}onUserStatusUpdated(t){const s=t["dataList"],i=this._userM.getMyUserID(),n=this._userM.get(Rs),o=s.map(e=>{var{to:e,statusType:t,customStatus:s}=e,s=Cn(s);return e===i&&n.setCustomStatus(s),{userID:e,statusType:t,customStatus:s}});Ce.l(this._n+".onUserStatusUpdated list:"+JSON.stringify(o)),this._userM.emitOEvt(e.USER_STATUS_UPDATED,o)}setSelfStatus(e){const t=this._n+".setSelfStatus";if(!1===this._userM.filterProfanity("customStatus",e))return ni({code:ei.PROFANITY_FOUND});const s=new Ti("setSelfStatus"),i=e["customStatus"];return this._userM.req({P:ri.SET_SELF_STATUS,data:{customStatus:i}}).then(e=>(s.setMessage("customStatus:"+i).end(),Ce.l(t+" ok. customStatus:"+i),this._userM.get(Rs).setCustomStatus(i),Zs({userID:this._userM.getMyUserID(),statusType:1,customStatus:i}))).catch(e=>(s.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)))}getUserStatus(e){const o=this._n+".getUserStatus",{userIDList:r=[]}=e,t=this._userM.getMyUserID();let s=[...r],a=void 0;var i=s.indexOf(t);if(-1<i){s.splice(i,1);const e=this._userM.get(Rs).getCustomStatus();a={userID:t,statusType:1,customStatus:e}}if(0===s.length)return ii({successUserList:[a],failureUserList:[]});if(!this._userM.canIUse(M.USER_STATUS))return this._userM.noUse("getUserStatus");s.length>this.MAX_QUERY_USER_COUNT&&(Ce.w(o+" "+St(this.MAX_QUERY_USER_COUNT)),s=r.slice(0,this.MAX_QUERY_USER_COUNT));const c=new Ti("getUserStatus");return this._userM.req({P:ri.GET_USER_STATUS,data:{userIDList:s}}).then(e=>{const{successUserList:t=[],failureUserList:s=[]}=e.data,i=t.map(e=>{var{userID:e,statusType:t,customStatus:s}=e;return{userID:e,statusType:t,customStatus:Cn(s)}}),n=s.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}});$e(a)||i.unshift(a);e=`userID count:${r.length}, success count:${i.length}, fail count:`+n.length;return c.setMessage(e).end(),Ce.l(o+` ok. ${e}.`),Zs({successUserList:i,failureUserList:n})}).catch(e=>(c.setMessage("userID count:"+r.length).setError(e).end(),Ce.e(o+" failed. error:",e),ni(e)))}subscribeUserStatus(e){var t="subscribeUserStatus";if(!this._userM.canIUse(M.USER_STATUS))return this._userM.noUse(t);const i=this._n+"."+t,{userIDList:s=[]}=e;let n=[...s];n.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ce.w(i+" "+St(this.MAX_SUBSCRIBE_USER_COUNT)),n=s.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));const o=new Ti(t),r="userID count:"+s.length;return Ce.l(i+" "+r),this._userM.req({P:ri.SUB_USER_STATUS,data:{userIDList:n}}).then(e=>{const{failureUserList:t=[]}=e.data,s=t.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}});return o.setMessage(r+" fail count:"+s.length).end(),Ce.l(i+` ok. fail count:${s.length}.`),Zs({failureUserList:s})}).catch(e=>(o.setMessage(r).setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}unsubscribeUserStatus(e){var t="unsubscribeUserStatus";if(!this._userM.canIUse(M.USER_STATUS))return this._userM.noUse(t);const i=this._n+"."+t,{userIDList:s=[]}=e||{};let n=[...s];s.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ce.w(i+" "+St(this.MAX_UNSUBSCRIBE_USER_COUNT)),n=s.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));const o=new Ti(t),r="userID count:"+s.length,a=(Ce.l(i+" "+r),{userIDList:n});return 0===n.length&&(a.userIDList=void 0,a.unsubscribeAll=1),this._userM.req({P:ri.UNSUB_USER_STATUS,data:a}).then(e=>{const{failureUserList:t=[]}=e.data,s=t.map(e=>{var{userID:e,invalidUserID:t,errorCode:s,errorInfo:i}=e;return{userID:Oe(t)?e:t,code:s,message:i}});return o.setMessage(r+" fail count:"+s.length).end(),Ce.l(i+` ok. fail count:${s.length}.`),Zs({failureUserList:s})}).catch(e=>(o.setMessage(r).setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}reset(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}class yn extends oi{constructor(e){super(e),this._n="UserModule",this._profileHandler=new fn(this),this._blacklistHandler=new In(this),this._userStatusHandler=new Tn(this),this.getIEmitInst().on(Yi.A2KEY_AND_TINYID_UPDATED,this.onContextUpdated,this)}onContextUpdated(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}mockOnNickAvatarModified(e,t){Ce.l(this._n+`._mockOnNickAvatarModified nick:${e} avatar:`+t),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:ye.NICK,value:e},{tag:ye.AVATAR,value:t}]}]})}onProfileModified(e){this._profileHandler.onProfileModified(e)}onRelationChainModified(e){const t=e["dataList"];if(!Oe(t)){const s=[],i=(t.forEach(e=>{e.blackListDelAccount&&s.push(...e.blackListDelAccount)}),0<s.length&&this._blacklistHandler.onAccountDeleted(s),[]);t.forEach(e=>{e.blackListAddAccount&&i.push(...e.blackListAddAccount)}),0<i.length&&this._blacklistHandler.onAccountAdded(i)}}onConvProfileUpdated(e){this._profileHandler.onConvProfileUpdated(e)}getMyAccount(){return this.getMyUserID()}getMyNick(){return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick}getMyProfile(){return this._profileHandler.getMyProfile()}getStorageModule(){return this.get(Ls)}filterProfanity(e,t){const s=this.get(Vs);if(!s)return!0;var{isAllowedToSend:i,modifiedText:n}=s.filterText(t[e],v);return!0===i&&(t[e]=n,!0)}isMyFriend(e){const t=this.get(Es);return!!t&&t.isMyFriend(e)}getUserProfile(e){return this._profileHandler.getUserProfile(e)}updateMyProfile(e){return this._profileHandler.updateMyProfile(e)}getNickAndAvatarByUserID(e){return this._profileHandler.getNickAndAvatarByUserID(e)}getUserNickAndAvatar(e){return this._profileHandler.getUserNickAndAvatar(e)}getLocalBlacklist(){var e=this._blacklistHandler.getLocalBlacklist();return ii(e)}addBlacklist(e){return this._blacklistHandler.addBlacklist(e)}deleteBlacklist(e){return this._blacklistHandler.deleteBlacklist(e)}onUserStatusUpdated(e){this._userStatusHandler.onUserStatusUpdated(e)}setSelfStatus(e){return this._userStatusHandler.setSelfStatus(e)}getUserStatus(e){return this._userStatusHandler.getUserStatus(e)}subscribeUserStatus(e){return this._userStatusHandler.subscribeUserStatus(e)}unsubscribeUserStatus(e){return this._userStatusHandler.unsubscribeUserStatus(e)}reset(){Ce.l(this._n+".reset"),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}class vn{constructor(e,t){this._m=e,this._isLoggedIn=!1,this._SDKAppID=t.SDKAppID,this._userID=t.userID||"",this._userSig=t.userSig||"",this._version="3.5.2",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=t.unlimitedAVChatRoom,this._scene=t.scene||"",this._oversea=t.oversea,this._instanceID=t.instanceID,this._statusInstanceID=0,this._isDevMode=t.devMode,this._isTestEnv=t.testEnv,this._proxyServer=t.proxyServer,this._fileUploadProxy=t.fileUploadProxy,this._fileDownloadProxy=t.fileDownloadProxy,this._applicationID=0,this._isPartialUpdatedConvs=t.partialUpdatedConversations,this._isIndependentDomainDisabled=t.disableIndependentDomain,this._isUsingChatCore=!1,this._uiPlatform=0,this._authKey="",this._customLoginInfo=""}isLoggedIn(){return this._isLoggedIn}isOversea(){return this._oversea}isPrivateNetWork(){return this._proxyServer}isDevMode(){return this._isDevMode}isTestEnv(){return this._isTestEnv}isPartialUpdatedConvs(){return this._isPartialUpdatedConvs}isIndependentDomainDisabled(){return this._isIndependentDomainDisabled}isSingaporeSite(){return 2e7<=this._SDKAppID&&this._SDKAppID<3e7||172e7<=this._SDKAppID&&this._SDKAppID<173e7}isKoreaSite(){return 3e7<=this._SDKAppID&&this._SDKAppID<4e7||173e7<=this._SDKAppID&&this._SDKAppID<174e7}isGermanySite(){return 4e7<=this._SDKAppID&&this._SDKAppID<5e7||174e7<=this._SDKAppID&&this._SDKAppID<175e7}isIndiaSite(){return 5e7<=this._SDKAppID&&this._SDKAppID<6e7||175e7<=this._SDKAppID&&this._SDKAppID<176e7}isJapanSite(){return 6e7<=this._SDKAppID&&this._SDKAppID<7e7||176e7<=this._SDKAppID&&this._SDKAppID<177e7}isUSASite(){return 7e7<=this._SDKAppID&&this._SDKAppID<8e7||177e7<=this._SDKAppID&&this._SDKAppID<178e7}isIndonesiaSite(){return 8e7<=this._SDKAppID&&this._SDKAppID<9e7||178e7<=this._SDKAppID&&this._SDKAppID<179e7}isIntl(){return 0===(e=this._SDKAppID)||2e7<=e&&e<9e7||172e7<=e&&e<179e7;var e}isUnlimitedAVChatRoom(){return this._unlimitedAVChatRoom}isUsingChatCore(){return this._isUsingChatCore}setUsingChatCore(e){this._isUsingChatCore=e}getUIPlatform(){return this._uiPlatform}setUIPlatform(e){this._uiPlatform=e}setUserID(e){this._userID=e}getUserID(){return this._userID}setUserSig(e){this._userSig=e}getUserSig(){return this._userSig}getSDKAppID(){return this._SDKAppID}setTinyID(e){this._tinyID=e,this._isLoggedIn=!0}getTinyID(){return this._tinyID}setCustomStatus(e){this._customStatus=e}getCustomStatus(){return this._customStatus}getScene(){return oe?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}getInstanceID(){return this._instanceID}getStatusInstanceID(){return this._statusInstanceID}setStatusInstanceID(e){this._statusInstanceID=e}getVersion(){return this._version}getA2Key(){return this._a2Key}setA2Key(e){this._a2Key=e}getContentType(){return this._contentType}getProxyServer(){return this._proxyServer}getFileUploadProxy(){return this._fileUploadProxy}getFileDownloadProxy(){return this._fileDownloadProxy}setApplicationID(e){this._applicationID=e}getApplicationID(){return this._applicationID}setDowloadFileAuthKey(e){this._authKey=e}getDowloadFileAuthKey(){return this._authKey}setCustomLoginInfo(e){this._customLoginInfo=e}getCustomLoginInfo(){return this._customLoginInfo}_isTUIKit(){let s=!1,e=!1,t=!1,i=!1,n=[];k&&(n=Object.keys($));for(let e=0,t=(n=F?G?Object.keys(uni):Object.keys(window):n).length;e<t;e++)if(n[e].toLowerCase().includes("uikit")){s=!0;break}if(n=null,k&&!xe($.createGamePortal)&&xe(getApp)&&!$e(getApp())){const s=getApp().globalData;be(s)&&!0===s.isTUIKit&&(e=!0)}!0===this._m.get(Ls).getStorageSync(`TIM_${this._SDKAppID}_isTUIKit`)&&(t=!0);let o=null;if(S&&!L&&"undefined"==typeof uni&&__wxConfig&&(o=__wxConfig.pages),R&&"undefined"==typeof uni&&__qqConfig&&(o=__qqConfig.pages),Fe(o)&&0<o.length){for(let e=0,t=o.length;e<t;e++)if(o[e].toLowerCase().includes("tui")){i=!0;break}o=null}return s||e||t||i}reset(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}const En={"k-vue2-pc":1,"k-vue2-h5":2,"k-vue2-h5-uni":3,"k-vue2-app-uni":4,"k-vue2-mp-uni":5,"k-vue2-pc-uni":6,"k-vue3-pc":7,"k-vue3-h5":8,"k-vue3-h5-uni":9,"k-vue3-app-uni":10,"k-vue3-mp-uni":11,"k-vue3-pc-uni":12,"k-rn":13};class Sn extends oi{constructor(e){super(e),this._n="SignModule",this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0,ji.mixin(this)}onCheckTimer(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}getPushModule(){let e=void 0;const t=this.get(js),s=this.get(xs);return t.canIUseTIMPush()?e=t:s.canIUseOfflinePush()&&(e=s),e}login(e){if(this.isLoggedIn()){const e=this.getMyUserID();return(t=this.getErrMsg("RepeatLogin",e))&&Ce.w(t),ii({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return this.warn("LoggingIn",e.userID),ni({code:ei.REPEAT_LOGIN});Ce.l(this._n+".login userID:"+e.userID);var t=this._checkLoginInfo(e);if(0!==t.code)return ni(t);const s=this.get(Rs),{userID:i,userSig:n}=e;return s.setUserID(i),s.setUserSig(n),this.get(Gs).updateProtocolConfig(),this._login()}_login(){const f=this.get(Rs);let M=f.getScene(),e=0,t=M;M&&M.startsWith("k-")&&(t=En[M],M="tuikit");const I=new Ti("login");I.setMessage(""+t).setMoreMessage("identifier:"+this.getMyUserID());var s="tuikit"===M;let i=0;G?i=s?3===t||4===t||5===t||6===t?31:9===t||10===t||11===t||12===t?32:4:3:k?i=D?36:"tuikit"===M?12:11:F?i=oe?"flutter_web_uikit"===M?21:20:this._isReactUIKit()?ne?25:24:s?1===t||2===t?29:7===t||8===t?30:ne?17:14:ne?16:13:13===t&&(i=38),I.setUIPlatform(i),f.setUIPlatform(i);const n=this.getPushModule();if(n){this._isWebUniapp=n.getUniAppPlatform();const M=this._getStatusInstanceID();f.setStatusInstanceID(M),this.get(Gs).updateProtocolConfig(),e=n.getDeviceBrand()}const C=this._n+"._login";return this._lastLoginTs=Date.now(),this.req({P:ri.LOGIN,data:{deviceBrand:e,isWebUniapp:this._isWebUniapp,customInfo:f.getCustomLoginInfo()}}).then(e=>{this._lastLoginTs=0;var t=Date.now();let s=null;var{a2Key:i,tinyID:n,helloInterval:d,instanceID:o,timeStamp:_,customStatus:r="",purchaseBits:u,authKey:h=""}=e.data,a=1e3*_,c=t-I.getStartTs(),c=a+parseInt(c/2)-t,t=I.getStartTs()+c;I.start(t);{t=a,a=c,he=a;const l=new Date;l.setTime(t),Ce.i(`baseTime from server:${l} offset:`+he)}if(!n)throw s=new Qs({code:ei.NO_TINYID}),I.setError(s).end(),s;if(!i)throw s=new Qs({code:ei.NO_A2KEY}),I.setError(s).end(),s;a=this.get(ks).getSocketID(),t=Cn(r),r=`socketID:${a} scene:${M} helloInterval:${d} instanceID:${o} timeStamp:${_} offset:${c} customStatus:${t} isWebUniapp:`+this._isWebUniapp;Ce.l(C+" ok. "+r);let p="",g="";if(S&&xe($.getAccountInfoSync)){const f=$.getAccountInfoSync().miniProgram;f&&(p=f.appId,g=f.envVersion)}I.setMoreMessage(r+` href:${F?window.location.href:""} mpAppId:${p} envVersion:${g} authKey:`+h).end(),f.setA2Key(i),f.setTinyID(n),f.setStatusInstanceID(o),f.setCustomStatus(t),f.setDowloadFileAuthKey(h),u&&this.get(qs).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:u}),this.get(Gs).updateProtocolConfig(),this.emitIEvt(Yi.A2KEY_AND_TINYID_UPDATED),this._helloInterval=d,this.triggerReady();const m=this.getPushModule();return m&&(uni.setStorageSync("timUniAppInstanceID",o),m.init()),this._fetchCloudControlConfig(),this.get(Vs).init(),e}).catch(e=>(I.setError(e).end(!0),this._m.setNotReadyReason(ei.LOGIN_FAILED),Ce.e(C+" failed. error:",e),this._lastLoginTs=0,this._m.onLoginFailed(),ni(e)))}logout(e=0){const t=this._n+".logout",s=this.isLoggedIn();return Ce.i(t+` type:${e} isLoggedIn:${s} isWebUniapp:`+this._isWebUniapp),s?(new Ti("logout").setMessage("identifier:"+this.getMyUserID()).end(!0),0===e&&this._m.setNotReadyReason(ei.LOGGED_OUT),this.req({P:ri.LOGOUT,data:{type:e,isWebUniapp:this._isWebUniapp}}).then(()=>(this.resetReady(),ii({}))).catch(e=>(Ce.e(t+" error:",e),this.resetReady(),ii({})))):ni({code:ei.USER_NOT_LOGGED_IN})}getLoginUser(){return this.isLoggedIn()?this.getMyUserID():""}_fetchCloudControlConfig(){this.get(ws).fetchConfig()}_getStatusInstanceID(){return uni.getStorageSync("timUniAppInstanceID")||0}_hello(){this._lastWsHelloTs=Date.now(),this.req({P:ri.HELLO,data:{isWebUniapp:this._isWebUniapp}}).catch(e=>{Ce.w(this._n+"._hello error:",e)})}getLastWsHelloTs(){return this._lastWsHelloTs}_checkLoginInfo(e){let t=0;return Oe(this.get(Rs).getSDKAppID())?t=ei.NO_SDKAPPID:Oe(e.userID)?t=ei.NO_IDENTIFIER:Oe(e.userSig)&&(t=ei.NO_USERSIG),{code:t}}_isReactUIKit(){return F&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}onMultipleAccountKickedOut(s){new Ti("kickedOut").setMessage(`type:${t.KICKED_OUT_MULT_ACCOUNT} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onMultipleAccountKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),this.logout(1).then(()=>{this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_MULT_ACCOUNT}),this._m.setNotReadyReason(ei.KICKED_OUT_MULT_ACCOUNT),this._m.reset()})}onMultipleDeviceKickedOut(s){new Ti("kickedOut").setMessage(`type:${t.KICKED_OUT_MULT_DEVICE} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onMultipleDeviceKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),this.logout(1).then(()=>{this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_MULT_DEVICE}),this._m.setNotReadyReason(ei.KICKED_OUT_MULT_DEVICE),this._m.reset()})}onUserSigExpired(){new Ti("kickedOut").setMessage(t.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ce.w(this._n+".onUserSigExpired userID:"+this.getMyUserID()),0!==this.get(Rs).getStatusInstanceID()&&(this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(ei.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}onRestApiKickedOut(s){new Ti("kickedOut").setMessage(`type:${t.KICKED_OUT_REST_API} newInstanceInfo:`+JSON.stringify(s)).end(!0),Ce.w(`${this._n}.onRestApiKickedOut userID:${this.getMyUserID()} newInstanceInfo:`,s),0!==this.get(Rs).getStatusInstanceID()&&(this.emitOEvt(e.KICKED_OUT,{type:t.KICKED_OUT_REST_API}),this._m.setNotReadyReason(ei.KICKED_OUT_REST_API),this._m.reset(),this.get(ks).onRestApiKickedOut())}reset(){Ce.l(this._n+".reset"),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}function Dn(){return null}class Rn{constructor(e){this._m=e,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}_errorTolerantHandle(){k||"undefined"!=typeof window&&this._canIUseCookies()||(this.getItem=Dn,this.setItem=Dn,this.removeItem=Dn,this.clear=Dn)}onCheckTimer(e){e%20==0&&0!==this._storageQueue.size&&this._doFlush()}_doFlush(){try{for(var[e,t]of this._storageQueue)this._setStorageSync(this._getKey(e),t);this._storageQueue.clear()}catch(e){Ce.w(this._n+"._doFlush error:",e)}}_getPrefix(){const e=this._m.get(Rs);return`TIM_${e.getSDKAppID()}_${e.getUserID()}_`}_getKey(e){return""+this._getPrefix()+e}getItem(e,t=!0){try{var s=t?this._getKey(e):e;return this.getStorageSync(s)}catch(e){return Ce.w(this._n+".getItem error:",e),{}}}setItem(e,t,s=!1,i=!0){if(s){const s=i?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}clear(){try{k?$.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ce.w(this._n+".clear error:",e)}}removeItem(e,t=!0){try{var s=t?this._getKey(e):e;this._removeStorageSync(s)}catch(e){Ce.w(this._n+".removeItem error:",e)}}getSize(e,t="b"){try{const s={size:0,limitSize:5242880,unit:t};if(Object.defineProperty(s,"leftSize",{enumerable:!0,get:()=>s.limitSize-s.size}),k&&(s.limitSize=1024*$.getStorageInfoSync().limitSize),e)s.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(k){const e=$.getStorageInfoSync()["keys"];e.forEach(e=>{s.size+=JSON.stringify(this.getStorageSync(e)).length+this._getKey(e).length})}else if(this._canIUseCookies())for(const e in localStorage)localStorage.hasOwnProperty(e)&&(s.size+=localStorage.getItem(e).length+e.length);return this._convertUnit(s)}catch(e){Ce.w(this._n+" error:",e)}}_convertUnit(e){const t={},s=e["unit"];t.unit=s;for(const i in e)"number"==typeof e[i]&&("kb"===s.toLowerCase()?t[i]=Math.round(e[i]/1024):"mb"===s.toLowerCase()?t[i]=Math.round(e[i]/1024/1024):t[i]=e[i]);return t}_setStorageSync(e,t){k?O?my.setStorageSync({key:e,data:t}):$.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}getStorageSync(e){return k?O?my.getStorageSync({key:e}).data:$.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}_removeStorageSync(e){k?O?my.removeStorageSync({key:e}):$.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}_canIUseCookies(){return"undefined"!=typeof window&&navigator&&navigator.cookieEnabled&&localStorage}reset(){Ce.l(this._n+".reset"),this._doFlush()}}class Ln{constructor(e){this._n="SSOLogBody",this._report=[]}pushIn(e){Ce.d(this._n+".pushIn",this._report.length,e),this._report.push(e)}backfill(e){Fe(e)&&0!==e.length&&(Ce.d(this._n+".backfill",this._report.length,e.length),this._report.unshift(...e))}getLogsNumInMemory(){return this._report.length}isEmpty(){return 0===this._report.length}_reset(){this._report.length=0,this._report=[]}getLogsInMemory(){var e=this._report.slice();return this._reset(),e}}const An=function(e){const t=e.get(Rs);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:pe()}};class On extends oi{constructor(e){super(e),this._n="EventStatModule",this.TAG="im-ssolog-event",this._reportBody=new Ln,this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.REPORT_LEVEL=[4,5,6],this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._lastReportTime=Date.now();const t=this.getIEmitInst();t.on(Yi.A2KEY_AND_TINYID_UPDATED,this._onLoginSuccess,this),t.on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}reportAtOnce(){this._report()}_onLoginSuccess(){const e=this.get(Ls),t=e.getItem(this.TAG,!1);!Oe(t)&&xe(t.forEach)&&(Ce.l(this._n+"._onLoginSuccess. logs count:"+t.length),t.forEach(e=>{this._reportBody.pushIn(e)}),e.removeItem(this.TAG,!1))}_onCloudConfig(){const e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),s=this.getCloudConfig("evt_rpt_level"),i=this.getCloudConfig("evt_rpt_sdkappid_bl"),n=this.getCloudConfig("evt_rpt_tinyid_wl");$e(e)||(this.MIN_THRESHOLD=Number(e)),$e(t)||(this.WAITING_TIME=Number(t)),$e(s)||(this.REPORT_LEVEL=s.split(",").map(e=>Number(e))),$e(i)||(this.REPORT_SDKAPPID_BLACKLIST=i.split(",").map(e=>Number(e))),$e(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}pushIn(e){e instanceof Ti&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}onCheckTimer(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}_filterLogs(e){const t=this.get(Rs),s=t.getSDKAppID(),i=t.getTinyID();return It(this.REPORT_SDKAPPID_BLACKLIST,s)&&!Ct(this.REPORT_TINYID_WHITELIST,i)?[]:e.filter(e=>this.REPORT_LEVEL.includes(e.level))}_report(){if(!this._reportBody.isEmpty()){const t=this._reportBody.getLogsInMemory(),s=this._filterLogs(t);var e;0!==s.length?(e={header:An(this),event:s},this.req({P:ri.SSO_STAT,data:{...e}}).then(()=>{this._lastReportTime=Date.now()}).catch(e=>{Ce.w(this._n+"._report failed. error:",e),this._lastReportTime=Date.now(),this._reportBody.backfill(t),this._reportBody.getLogsNumInMemory()>this.MAX_THRESHOLD&&this._flushAtOnce()})):this._lastReportTime=Date.now()}}_flushAtOnce(){const t=this.get(Ls),s=t.getItem(this.TAG,!1),i=this._reportBody.getLogsInMemory(),n=this._n+"._flushAtOnce";if(Oe(s))Ce.l(n+" count:"+i.length),t.setItem(this.TAG,i,!0,!1);else{let e=i.concat(s);e.length>this.MAX_THRESHOLD&&(e=e.slice(0,this.MAX_THRESHOLD)),Ce.l(n+" count:"+e.length),t.setItem(this.TAG,e,!0,!1)}}reset(){Ce.l(this._n+".reset"),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}const Nn="none",Pn="online";class Un{constructor(e){this._m=e,this._networkType=Pn,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(Yi.A2KEY_AND_TINYID_UPDATED,this._startRN,this)}_startRN(){if(b){const e=this._m.get(Ps).getPlugin("chat-network-monitor");e&&(this._removeListener=e.addEventListener(e=>{var{isConnected:e=!1,type:t}=e;this._networkType!==t&&this._onNetworkStatusChange({isConnected:e,networkType:t})}))}}start(){const t=this._n+".start";k?($.getNetworkType({success:e=>{this._networkType=e.networkType||e.subtype||"",e.networkType===Nn?Ce.w(t+" no network, please check!"):Ce.i(t+" networkType:"+e.networkType)}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),$.onNetworkStatusChange(this._mpNetworkStatusCallback)):F&&(this._networkType=Pn,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}_onWebOnline(){this._onNetworkStatusChange({isConnected:!0,networkType:Pn})}_onWebOffline(){this._onNetworkStatusChange({isConnected:!1,networkType:Nn})}_onNetworkStatusChange(e){var{isConnected:e,networkType:t}=e,s=this._n+"._onNetworkStatusChange";let i=!1;var n=`previous:${this._networkType} current:`+t;e?(Ce.i(s+" "+n),this._networkType!==t&&(i=!0,this._networkType=t,this._m.get(ks).reConnect(!0))):this._networkType!==t&&(i=!0,this._networkType=t,Ce.w(s+" no network, please check!"),this._m.get(ks).offline()),i&&new Ti("networkChange").setMessage(`isConnected:${e} `+n).end()}isOnline(){return this._networkType!==Nn}getNetworkType(){return this._networkType}reset(){Ce.l(this._n+".reset"),k?null!==this._mpNetworkStatusCallback&&($.offNetworkStatusChange&&$.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):F?(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):b&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}function Gn(e,t){return e(t={exports:{}},t.exports),t.exports}var kn=Gn(function(e){var i=Object.prototype.hasOwnProperty,h="~";function s(){}function o(e,t,s){this.fn=e,this.context=t,this.once=s||!1}function n(e,t,s,i,n){if("function"!=typeof s)throw new TypeError("The listener must be a function");s=new o(s,i||e,n),i=h?h+t:t;return e._events[i]?e._events[i].fn?e._events[i]=[e._events[i],s]:e._events[i].push(s):(e._events[i]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function t(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(h=!1)),t.prototype.eventNames=function(){var e,t,s=[];if(0===this._eventsCount)return s;for(t in e=this._events)i.call(e,t)&&s.push(h?t.slice(1):t);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},t.prototype.listeners=function(e){var e=h?h+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var s=0,i=t.length,n=new Array(i);s<i;s++)n[s]=t[s].fn;return n},t.prototype.listenerCount=function(e){e=h?h+e:e,e=this._events[e];return e?e.fn?1:e.length:0},t.prototype.emit=function(e,t,s,i,l,d){var _=h?h+e:e;if(!this._events[_])return!1;var n,o=this._events[_],r=arguments.length;if(o.fn){switch(o.once&&this.removeListener(e,o.fn,void 0,!0),r){case 1:return o.fn.call(o.context),!0;case 2:return o.fn.call(o.context,t),!0;case 3:return o.fn.call(o.context,t,s),!0;case 4:return o.fn.call(o.context,t,s,i),!0;case 5:return o.fn.call(o.context,t,s,i,l),!0;case 6:return o.fn.call(o.context,t,s,i,l,d),!0}for(c=1,n=new Array(r-1);c<r;c++)n[c-1]=arguments[c];o.fn.apply(o.context,n)}else for(var a,u=o.length,c=0;c<u;c++)switch(o[c].once&&this.removeListener(e,o[c].fn,void 0,!0),r){case 1:o[c].fn.call(o[c].context);break;case 2:o[c].fn.call(o[c].context,t);break;case 3:o[c].fn.call(o[c].context,t,s);break;case 4:o[c].fn.call(o[c].context,t,s,i);break;default:if(!n)for(a=1,n=new Array(r-1);a<r;a++)n[a-1]=arguments[a];o[c].fn.apply(o[c].context,n)}return!0},t.prototype.on=function(e,t,s){return n(this,e,t,s,!1)},t.prototype.once=function(e,t,s){return n(this,e,t,s,!0)},t.prototype.removeListener=function(e,t,s,i){e=h?h+e:e;if(!this._events[e])return this;if(!t)return c(this,e),this;var n=this._events[e];if(n.fn)n.fn!==t||i&&!n.once||s&&n.context!==s||c(this,e);else{for(var o=0,r=[],a=n.length;o<a;o++)(n[o].fn!==t||i&&!n[o].once||s&&n[o].context!==s)&&r.push(n[o]);r.length?this._events[e]=1===r.length?r[0]:r:c(this,e)}return this},t.prototype.removeAllListeners=function(e){return e?(e=h?h+e:e,this._events[e]&&c(this,e)):(this._events=new s,this._eventsCount=0),this},t.prototype.off=t.prototype.removeListener,t.prototype.addListener=t.prototype.on,t.prefixed=h,e.exports=t.EventEmitter=t});const wn=["rich.my-imcloud.com","imrich.qcloud.com"],bn=9999,Fn=1e4;class $n extends oi{constructor(e){super(e),this._n="UploadModule",this.TIMUploadPlugin=null,this.timUploadPlugin=null,this.COSSDK=null,this._cosUploadMethod=null,this.expiredTimeLimit=600,this.appid=0,this.bucketName="",this.ciUrl="",this.directory="",this.downloadUrl="",this.uploadUrl="",this.region="ap-shanghai",this.cos=null,this.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},this.uploadFileType="",this.duration=900,this.tryCount=0,this.UPLOAD_SIZE_LIMIT={A:20971520,F:104857600,I:20971520,V:104857600},this.isSimpleCos=!1,this._fileDownloadProxy="",this._authKey="",this._fileDNList=wn;const t=this.getIEmitInst();t.on(Yi.A2KEY_AND_TINYID_UPDATED,this._init,this),t.on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_init(){this._fileDownloadProxy=this.getFileDownloadProxy(),this._authKey=this.getDowloadFileAuthKey();const e=this.get(Ps);var t;this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin?this._initUploaderMethod():(t=k?"cos-wx-sdk":"cos-js-sdk",this.COSSDK=e.getPlugin(t),this.COSSDK?(this._getAuthorizationKey(),this.warn("CosReplacement",t)):this.warn("PluginUndetected"))}_onCloudConfig(){const e=this._n+"._onCloudConfig",t=this.getCloudConfig("upload_size_limit"),s=this.getCloudConfig("simple_cos"),i=this.getCloudConfig("file_dn_list");if(Ce.l(e+` uploadSizeLimit:${t} simpleCos:`+s),!$e(t))try{const e=JSON.parse(t);this.UPLOAD_SIZE_LIMIT={A:e.a?1048576*parseInt(e.a):this.UPLOAD_SIZE_LIMIT.A,F:e.f?1048576*parseInt(e.f):this.UPLOAD_SIZE_LIMIT.F,I:e.i?1048576*parseInt(e.i):this.UPLOAD_SIZE_LIMIT.I,V:e.v?1048576*parseInt(e.v):this.UPLOAD_SIZE_LIMIT.V}}catch(e){}if($e(s)||(this.isSimpleCos="1"===s),!$e(i))try{JSON.parse(i).forEach(e=>{this._fileDNList.includes(e)||this._fileDNList.push(e)})}catch(e){}}_getAuthorizationKey(){const s=this._n+"._getAuthorizationKey",i=new Ti("_getAuthorizationKey"),n=Math.ceil(Date.now()/1e3);this.req({P:ri.COS_SIGN,data:{duration:this.expiredTimeLimit}}).then(e=>{var e=e["data"],t=(Ce.l(s+" ok. data:",e),e.expiredTime-n);i.setMessage(`requestId:${e.requestId} requestTime:${n} expiredTime:${e.expiredTime} diff:${t}s`).end(),!k&&e.region&&(this.region=e.region),this.appid=e.appid,this.bucketName=e.bucketName,this.ciUrl=e.ciUrl,this.directory=e.directory,this.downloadUrl=e.downloadUrl,this.uploadUrl=e.uploadUrl,this.cosOptions={secretId:e.secretId,secretKey:e.secretKey,sessionToken:e.sessionToken,expiredTime:e.expiredTime},Ce.l(s+` ok. region:${this.region} bucketName:`+this.bucketName),this._initUploaderMethod()}).catch(e=>{i.setError(e).end(),Ce.w(s+" failed. error:",e)})}_getCosPreSigUrl(t){const i=this._n+"._getCosPreSigUrl",n=Math.ceil(Date.now()/1e3),o=new Ti("_getCosPreSigUrl");let e={uploadMethod:t.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:t.userID,conversationType:t.conversationType,uploadConfig:[{fileID:1,fileType:t.fileType,fileName:t.fileName}]},s=ri.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(e={fileType:t.fileType,fileName:t.fileName,uploadMethod:t.uploadMethod,duration:t.duration},s=ri.COS_PRE_SIG),this.req({P:s,data:e}).then(e=>{this.tryCount=0;var t=e.data||{};Ce.l(`${i} ok. isSimpleCos:${this.isSimpleCos} data:`,t);let s="";if(this.isSimpleCos){const{uploadUrl:e,fileKey:i}=t.preSig[0];s=`uploadIP:${t.uploadIP} uploadUrl:${e} fileKey:${i} cost:`+Dt(n)}else s=`requestId:${t.requestId} expiredTime:${t.expiredTime} diff:${t.expiredTime-n}s`;return o.setMessage(s).end(),t}).catch(e=>(-1===e.code&&(e.code=ei.COS_GET_SIG_FAIL),o.setError(e).end(),Ce.w(i+" failed. error:",e),this.tryCount<1?(this.tryCount++,this._getCosPreSigUrl(t)):(this.tryCount=0,ni({code:ei.COS_GET_SIG_FAIL}))))}_initUploaderMethod(){if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=(e,t)=>{this.timUploadPlugin.uploadFile(e,t)});this.appid&&(this.cos=k?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=k?(e,t)=>{this.cos.postObject(e,t)}:(e,t)=>{this.cos.uploadFiles(e,t)})}onCheckTimer(e){this.COSSDK&&(this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}getFileDNList(){return this._fileDNList}_getAuthorization(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}upload(e){if(!0===e._relayFlag)return Promise.resolve();const s=this.get($s);switch(e.type){case t.MSG_IMAGE:return s.addTotalCount(hi),this._uploadImage(e);case t.MSG_FILE:return s.addTotalCount(hi),this._uploadFile(e);case t.MSG_AUDIO:return s.addTotalCount(hi),this._uploadAudio(e);case t.MSG_VIDEO:return s.addTotalCount(hi),this._uploadVideo(e);default:return Promise.resolve()}}_uploadImage(g){const e=this.get(Is),m=g.getElements()[0],t=e.getMessageOption(g.clientSequence);return this.doUploadImage({file:t.payload.file,to:t.to,message:g,onProgress:e=>{if(m.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return ni({code:ei.MSG_ONPROGRESS_ERR})}}}).then(t=>{var{location:t,fileType:e,fileSize:d,width:s,height:i,smallImageUrl:n,smallImageWidth:_,smallImageHeight:u,largeImageUrl:o,largeImageWidth:h,largeImageHeight:p,imageInfoArray:r}=t,t=this.isPrivateNetWork()?t:et(t);m.updateImageFormat(e);let a,c,l={size:d,url:t,width:s,height:i};if(r&&0<r.length)for(let e=0;e<r.length;e++){const t=r[e];1===t.type?a=t:2===t.type?c=t:l={...l,...t}}else c=n&&o?(a={url:n,width:_,height:u},{url:o,width:h,height:p}):(a=gt({originUrl:t,originWidth:s,originHeight:i,min:198}),gt({originUrl:t,originWidth:s,originHeight:i,min:720}));return m.updateImageInfoArray([{...l},{...c},{...a}]),g})}_uploadFile(s){const e=this.get(Is),i=s.getElements()[0],t=e.getMessageOption(s.clientSequence);return this.doUploadFile({file:t.payload.file,to:t.to,message:s,onProgress:e=>{if(i.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return ni({code:ei.MSG_ONPROGRESS_ERR})}}}).then(({location:e})=>{let t=e;return this.isPrivateNetWork()||(t=vi(t=et(e),this._fileDownloadProxy,this._authKey,this._fileDNList)),i.updateFileUrl(t),s})}_uploadAudio(t){const e=this.get(Is),s=t.getElements()[0],i=e.getMessageOption(t.clientSequence);return this.doUploadAudio({file:i.payload.file,to:i.to,message:t,onProgress:e=>{if(s.updatePercent(e),xe(i.onProgress))try{i.onProgress(e)}catch(e){return ni({code:ei.MSG_ONPROGRESS_ERR})}}}).then(({location:e})=>{e=this.isPrivateNetWork()?e:et(e);return s.updateAudioUrl(e),t})}_uploadVideo(s){const e=this.get(Is),i=s.getElements()[0],t=e.getMessageOption(s.clientSequence);return this.doUploadVideo({file:t.payload.file,to:t.to,message:s,onProgress:e=>{if(i.updatePercent(e),xe(t.onProgress))try{t.onProgress(e)}catch(e){return ni({code:ei.MSG_ONPROGRESS_ERR})}}}).then(e=>{var{location:e,snapshotInfo:t}=e,e=this.isPrivateNetWork()?e:et(e);return i.updateVideoUrl(e),Oe(t)||i.updateSnapshotInfo(t),s})}_checkSizeError(e){let t="";return"A"===e?t="audio":"I"===e?t="image":"V"===e?t="video":"F"===e&&(t="file"),ni({code:ei[`MSG_${e}_SIZE_LIMIT`],message:this.getErrMsg("UploadSizeLimit",t,this.UPLOAD_SIZE_LIMIT[e]/1048576+"MB")})}doUploadImage(s){if(!s.file||this._isEmptyFileList(s.file.files))return ni({code:ei.MSG_I_SELECT_F_FIRST});var e=this._checkImageType(s.file);if(!0!==e)return e;e=this._checkImageSize(s.file);if(!0!==e)return e;let i=null;return this._setUploadFileType(Zi),this.uploadByCOS(s).then(e=>{if(i=e,this.isPrivateNetWork())return dt(t);if(Fe(i.imageInfoArray)){const s=i.imageInfoArray.find(e=>3===e.type);if(s)return s}if(b)return{width:s.file.width,height:s.file.height};let t=et(e.location);return dt(t=this.COSSDK?t:vi(t,this._fileDownloadProxy,this._authKey,this._fileDNList))}).then(e=>(i.width=e.width,i.height=e.height,Promise.resolve(i)))}_checkImageType(e){let t="";return t=k?e.url.slice(e.url.lastIndexOf(".")+1):b?e.type.split("/")[1]:e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),0<=Ji.indexOf(t.toLowerCase())||ni({code:ei.MSG_I_TYPES_LIMIT})}_checkImageSize(e){return 0===(e=(k||b?e:e.files[0]).size)?ni({code:ei.MSG_F_IS_EMPTY}):e<this.UPLOAD_SIZE_LIMIT.I||this._checkSizeError("I")}doUploadFile(e){let t=null;return!e.file||this._isEmptyFileList(e.file.files)?(t={code:ei.MSG_F_SELECT_F_FIRST},ni(t)):e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?(t={code:ei.MSG_F_IS_EMPTY},ni(t)):(this._setUploadFileType(tn),this.uploadByCOS(e))}doUploadVideo(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?ni({code:ei.MSG_F_IS_EMPTY}):-1===Xi.indexOf(e.file.videoFile.type)?ni({code:ei.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(Qi),k||b?this.handleVideoUpload({...e,file:e.file.videoFile}):F?this.handleVideoUpload(e):void 0)}handleVideoUpload(s){return new Promise((t,e)=>{this.uploadByCOS(s).then(e=>{t(e)}).catch(()=>{this.uploadByCOS(s).then(e=>{t(e)}).catch(()=>{e(new Qs({code:ei.MSG_V_UPLOAD_FAIL}))})})})}doUploadAudio(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?ni({code:ei.MSG_F_IS_EMPTY}):(this._setUploadFileType(en),this.uploadByCOS(e)):ni({code:ei.MSG_A_UPLOAD_FAIL})}uploadByCOS(t){if(!xe(this._cosUploadMethod))return this.warn("PluginUndetected"),ni({code:ei.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(t);const l=new Ti("upload"),d=this._n+".uploadByCOS",_=Date.now(),u=this._getFile(t);return new Promise((r,a)=>{const e=k?this._createCosOptionsWXMiniApp(t):this._createCosOptionsWeb(t),c=this;this._cosUploadMethod(e,(e,t)=>{const s=Object.create(null);if(t){if(e||Fe(t.files)&&t.files[0].error){const e=new Qs({code:ei.MSG_F_UPLOAD_FAIL});return l.setError(e).end(),Ce.l(d+" failed. error:",t.files[0].error),403===t.files[0].error.statusCode&&this._getAuthorizationKey(),void a(e)}s.fileName=u.name,s.fileSize=u.size,s.fileType=u.type.slice(u.type.indexOf("/")+1).toLowerCase(),s.location=(k?t:t.files[0].data).Location;const i=Date.now()-_,n=`size:${c._formatFileSize(u.size)} time:${i}ms speed:`+c._formatSpeed(1e3*u.size/i),o=(Ce.l(d+` success. name:${u.name} `+n),r(s),this.get($s));return o.addCost(hi,i),o.addFileSize(hi,u.size),void l.setMessage(n).end()}const i=new Qs({code:ei.MSG_F_UPLOAD_FAIL});l.setError(i).end(),Ce.w(d+" failed. error:",e),403===e.statusCode&&this._getAuthorizationKey(),a(i)})})}_uploadWithPreSigUrl(e){const g=this._n+"._uploadWithPreSigUrl",m=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(p=>new Promise((c,l)=>{const d=new Ti("upload"),{requestSnapshotUrl:_,...u}=p,h=Date.now();this._cosUploadMethod(u,(e,t)=>{if(e||403===t.statusCode){d.setError(new Qs(e)).end();const m={HttpStatusCode:bn,CostTime:Dt(h,!1),error:e,url:p.url};return t.data&&t.data.uploadIP&&(m.uploadIP=t.data.uploadIP),this._uploadSSOLog(m),Ce.l(g+" failed, error:",e),void l(new Qs({code:ei.MSG_F_UPLOAD_FAIL}))}const s=Object.create(null);let i=t.data.location||"";this.isPrivateNetWork()||0!==i.indexOf("https://")&&0!==i.indexOf("http://")||(i=i.split("//")[1]),s.fileName=m.name,s.fileSize=m.size,s.fileType=m.type.slice(m.type.indexOf("/")+1).toLowerCase(),s.location=i;var e=Dt(h,!1),n=`size:${this._formatFileSize(m.size)} time:${e}ms speed:${this._formatSpeed(1e3*m.size/e)} res:`+JSON.stringify(t.data);Ce.l(g+` ok. name:${m.name} `+n),d.setMessage(n).end();const o={HttpStatusCode:t.statusCode,FileSize:m.size,CostTime:e,url:p.url},r=(t.data&&t.data.uploadIP&&(o.uploadIP=t.data.uploadIP),this._uploadSSOLog(o),this.get($s)),a=(r.addCost(hi,e),r.addFileSize(hi,m.size),[]);if(u.thumbUrl&&u.largeUrl&&a.push(this._getSmallImageInfoByUrl(u.thumbUrl,s),this._getLargeImageInfoByUrl(u.largeUrl,s)),this.uploadFileType===Zi&&this.isSimpleCos&&!this.isPrivateNetWork()&&(a.push(this._getImageInfoArray(u.downloadUrl,s)),t.data.uploadIP&&a.push(this._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],s))),_&&a.push(this._getSnapshotInfoByUrl(_,s)),0<a.length)return Promise.all(a).then(()=>{c(s)});c(s)})}))}_getDownloadIP(e,s){const i=this._n+"._getDownloadIP",n=Date.now();return this.req({P:ri.GET_IP,data:{domainName:e}}).then(e=>{if(e.data&&e.data.ip){Ce.l(i+` ok. downloadIP:${e.data.ip} cost:`+Dt(n));const t=s.location.split("/");t[0]=e.data.ip,s.location=t.join("/")}}).catch(e=>{})}_getImageInfoArray(t,s){const i=this._n+"._getImageInfoArray",n=Date.now();return this.req({P:ri.GET_IMAGE_INFO,data:{imageUrl:t}}).then(e=>{e=e.data||{};return Ce.l(i+` ok. data: ${JSON.stringify(e)} cost:`+Dt(n)),s.imageInfoArray=e.imageInfoArray,e}).catch(e=>{s.imageInfoArray=void 0,this._uploadSSOLog({HttpStatusCode:Fn,CostTime:Dt(n,!1),url:t})})}_uploadSSOLog(t){if(this.isSimpleCos){const s=new Ti;s.setEventType(18),t.error&&s.setError(new Qs(t.error));let e=`HttpStatusCode:${t.HttpStatusCode}|CosRequestId:${t.CosRequestId||""}|FileAlreadyExist:${t.FileAlreadyExist||0}|FileSize:${t.FileSize||0}|CostTime:`+t.CostTime;t.uploadIP&&(e+="|FinalIP:"+t.uploadIP),s.setMessage("OK").setMoreMessage(t.url).setExtension(e).end()}}_getRawOrUploadProxyUrl(e){var t=this.get(Rs).getFileUploadProxy();let s=e;return s=t?e.replace(/^https:\/\/[^/]+/,t):s}_getFile(e){return Fe(e.file.files)||Be(e.file.files)?e.file.files[0]:e.file}_formatFileSize(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}_formatSpeed(e){return e<=1048576?Mt(e/1024,1)+"KB/s":Mt(e/1048576,1)+"MB/s"}_createCosOptionsWeb(t){const e=this._getFile(t),s=e.name,i=s.slice(s.lastIndexOf(".")),n=this._genFileName(""+je(999999)+i);return{files:[{Bucket:this.bucketName+"-"+this.appid,Region:this.region,Key:this.directory+"/"+n,Body:e}],SliceSize:1048576,onProgress:e=>{if("function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e)}},onFileFinish:(e,t,s)=>{}}}_createCosOptionsWXMiniApp(t){var e=this._getFile(t),s=this._genFileName(e.name),e=e.url;return{Bucket:this.bucketName+"-"+this.appid,Region:this.region,Key:this.directory+"/"+s,FilePath:e,onProgress:e=>{if(Ce.l(JSON.stringify(e)),"function"==typeof t.onProgress)try{t.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e)}}}}_createCosOptionsPreSigUrl(a){let c="",l="",e=0;var s=this._getFile(a);if(k||b){if(a.message.type===t.MSG_FILE){const a=s.name,t=a.slice(a.lastIndexOf("."));c=this._genFileName(""+je(999999)+t)}else c=this._genFileName(s.name);l=s.url,e=1}else{const a=s.name,t=a.slice(a.lastIndexOf("."));c=this._genFileName(""+je(999999)+t),l=s,e=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:c,uploadMethod:e,duration:this.duration,userID:a.message.from,conversationType:at(a.message.conversationID)?1:2}).then(e=>{var{uploadUrl:t,downloadUrl:s,requestSnapshotUrl:i,thumbUrl:n,largeUrl:o,fileKey:r}=this.isSimpleCos?e.preSig[0]:e,{uploadIP:e=""}=e;return{url:this._getRawOrUploadProxyUrl(t),fileType:this.uploadFileType,fileName:c,resources:l,downloadUrl:s,requestSnapshotUrl:i,thumbUrl:n,largeUrl:o,fileKey:r,uploadIP:!this.isPrivateNetWork()&&e,onProgress:e=>{if("function"==typeof a.onProgress)try{a.onProgress(e.percent)}catch(e){Ce.w("onProgress callback error:",e),Ce.e(e)}}}})}_genFileName(e){return _t()+"-"+e}_setUploadFileType(e){this.uploadFileType=e}_getSnapshotInfoByUrl(e,s){const i="_getSnapshotInfoByUrl",n=new Ti(i);return this.req({P:ri.VIDEO_COVER,data:{platform:this.getPlatform(),coverName:this._genFileName(je(99999)),requestSnapshotUrl:e}}).then(e=>{e=(e.data||{}).snapshotUrl;if(Ce.l(`${this._n}.${i} ok. snapshotUrl:`+e),n.setMessage("snapshotUrl:"+e).end(),Oe(e))return{};const t=vi(e,this._fileDownloadProxy,this._authKey,this._fileDNList);return dt(t).then(e=>{s.snapshotInfo={snapshotUrl:t,snapshotWidth:e.width,snapshotHeight:e.height}})}).catch(e=>(Ce.w(`${this._n}.${i} failed. error:`,e),n.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}))}_getSmallImageInfoByUrl(t,s){return dt(vi(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(e=>{s.smallImageUrl=t,s.smallImageWidth=e.width,s.smallImageHeight=e.height})}_getLargeImageInfoByUrl(t,s){return dt(vi(t,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(e=>{s.largeImageUrl=t,s.largeImageWidth=e.width,s.largeImageHeight=e.height})}_isEmptyFileList(e){return!(!Be(e)||0!==e.length)}reset(){Ce.l(this._n+".reset")}}class qn{constructor(e){this._n="MergerMessageHandler",this._msgM=e}uploadMergerMessage(e,s){const i=this._n+".uploadMergerMessage",t=(Ce.d(i+" message:",e,"messageBytes:"+s),JSON.parse(JSON.stringify(e.payload)))["messageList"],n=t.length,o=this._msgM.get(Ns).getFileDNList(),r=new Ti("uploadMergerMessage");return t.forEach(e=>{Ei(e.messageBody[0].type,e.messageBody,o)}),this._msgM.req({P:ri.UPLOAD_MERGER_MSG,data:{messageList:t}}).then(e=>{Ce.d(i+" ok. response:",e.data);var{pbDownloadKey:e,downloadKey:t}=e.data,e={pbDownloadKey:e,downloadKey:t,messageNumber:n};return r.setMessage(n+`-${s}-`+t).end(),e}).catch(e=>{throw Ce.w(i+" failed. error:",e),r.setError(e).end(),e})}downloadMergerMessage(n){const o=this._n+".downloadMergerMessage",t=(Ce.d(o+" message:",n),n.payload)["downloadKey"],r=this._msgM.getFileDownloadProxy(),a=this._msgM.getDowloadFileAuthKey(),c=new Ti("downloadMergerMessage");return c.setMessage("downloadKey:"+t),this._msgM.req({P:ri.DOWNLOAD_MERGER_MSG,data:{downloadKey:t}}).then(e=>{Ce.d(o+" ok. response:",e.data);const t=this._msgM.get(Ns).getFileDNList();if(xe(n.clearElement)){const{downloadKey:o,pbDownloadKey:c,messageList:s,...i}=n.payload;n.clearElement(),n.setElement({type:n.type,content:{messageList:e.data.messageList,...i}},r,a,t)}else{const o=[];e.data.messageList.forEach(e=>{Oe(e)||(e=new Fi(e,r,a,t),o.push(e))}),n.payload.messageList=o,n.payload.downloadKey="",n.payload.pbDownloadKey=""}return c.end(),n}).catch(e=>{throw Ce.w(`${o} failed. key:${t} error:`,e),c.setError(e).end(),e})}createMergerMessagePack(e,s,i){return e.conversationType===t.CONV_C2C?this._createC2CMergerMessagePack(e,s,i):this._createGroupMergerMessagePack(e,s,i)}_createC2CMergerMessagePack(e,t,s){let i=null;t&&(t.offlinePushInfo&&(i=t.offlinePushInfo),!0===t.onlineUserOnly&&(i?i.disablePush=!0:i={disablePush:!0}));const n=[];if(be(t)&&be(t.messageControlInfo)){const{excludedFromUnreadCount:e,excludedFromLastMessage:s,excludedFromContentModeration:i}=t.messageControlInfo;!0===e&&n.push("NoUnread"),!0===s&&n.push("NoLastMsg"),!0===i&&n.push("NoMsgCheck")}let o="";ke(e.cloudCustomData)&&0<e.cloudCustomData.length&&(o=e.cloudCustomData);const{pbDownloadKey:r,downloadKey:a,messageNumber:d}=s,{title:_,abstractList:u,compatibleText:h}=e.payload,c=this._msgM.get(ys),l=c&&c.isOnlineMessage(e,t)?0:void 0;return{P:ri.SEND_C2C_MSG,data:{fromAccount:this._msgM.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:r,downloadKey:a,title:_,abstractList:u,compatibleText:h,messageNumber:d}}],cloudCustomData:o,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:l,offlinePushInfo:Hi(i),messageControlInfo:0!==l?n:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}_createGroupMergerMessagePack(e,t,s){let i=null;t&&t.offlinePushInfo&&(i=t.offlinePushInfo);const n=[];if(be(t)&&be(t.messageControlInfo)){const{excludedFromUnreadCount:e,excludedFromLastMessage:s,excludedFromContentModeration:i}=t.messageControlInfo;!0===e&&n.push("NoUnread"),!0===s&&n.push("NoLastMsg"),!0===i&&n.push("NoMsgCheck")}let o="";ke(e.cloudCustomData)&&0<e.cloudCustomData.length&&(o=e.cloudCustomData);const{pbDownloadKey:r,downloadKey:a,messageNumber:d}=s,{title:_,abstractList:u,compatibleText:h}=e.payload,c=this._msgM.get(vs),l=c&&c.isOnlineMessage(e,t)?1:0;return{P:ri.SEND_GRP_MSG,data:{fromAccount:this._msgM.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:r,downloadKey:a,title:_,abstractList:u,compatibleText:h,messageNumber:d}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:o,onlineOnlyFlag:l,offlinePushInfo:Hi(i),clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||c.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0==l?n:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}}const xn={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,MSG_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Vn=[ei.MSG_ONPROGRESS_ERR,ei.MSG_I_SELECT_F_FIRST,ei.MSG_I_TYPES_LIMIT,ei.MSG_F_IS_EMPTY,ei.MSG_I_SIZE_LIMIT,ei.MSG_F_SELECT_F_FIRST,ei.MSG_F_SIZE_LIMIT,ei.MSG_V_SIZE_LIMIT,ei.MSG_V_TYPES_LIMIT,ei.MSG_A_UPLOAD_FAIL,ei.MSG_A_SIZE_LIMIT,ei.COS_UNDETECTED];function Bn(e){let t=!1;return Object.values(xn).includes(e)&&(t=!0),t=120001<=e&&e<=13e4||10100<=e&&e<=10200?!0:t}class Kn extends oi{constructor(e){super(e),this._n="MessageModule",this._messageOptionsMap=new Map,this._mergerMessageHandler=new qn(this)}createTextMessage(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();const s=new xi(e),i=ke(e.payload)?e.payload:e.payload.text,n=new yi({text:i}),o=this._getNickAndAvatarByUserID(t);return s.setElement(n),s.setNickAndAvatar(o),s.setNameCard(this._getNameCardByGroupID(s)),s}createImageMessage(e){const t=this.getMyUserID(),s=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new xi(e));if(k){const t=e.payload["file"];if(Ue(t))return void this.warn("FileUnsupportedInMP","createImageMessage");const s=t.tempFiles[0].path||t.tempFiles[0].tempFilePath,i={url:s,name:s.slice(s.lastIndexOf("/")+1),size:t.tempFiles&&t.tempFiles[0].size||1,type:s.slice(s.lastIndexOf(".")+1).toLowerCase()};e.payload.file=i}else if(b){const t=e.payload["file"],s={url:t.uri,name:t.fileName,size:t.fileSize||1,type:t.type,width:t.width,height:t.height};e.payload.file=s}else if(F)if(Ue(e.payload.file)){const t=e.payload.file;e.payload.file={files:[t]}}else if(be(e.payload.file)&&"undefined"!=typeof uni){const t=e.payload.file.tempFiles[0];e.payload.file={files:[t]}}const i=new Ri({imageFormat:Te.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),n=this._getNickAndAvatarByUserID(t);return s.setElement(i),s.setNickAndAvatar(n),s.setNameCard(this._getNameCardByGroupID(s)),this._messageOptionsMap.set(s.clientSequence,e),s}createAudioMessage(e){const t=e.payload["file"];if(k){const s={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=s}if(b){const s={url:t.uri,name:t.uri.slice(t.uri.lastIndexOf("/")+1),size:t.fileSize||1,second:Math.floor(t.duration/1e3),type:t.uri.slice(t.uri.lastIndexOf(".")+1).toLowerCase()};e.payload.file=s,Oe(t.uri)&&this.warn("VoiceFileInRN")}const s=this.getMyUserID(),i=(e.currentUser=s,e.senderTinyID=this.getMyTinyID(),new xi(e)),n=new Ai({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size||1,url:t.tempFilePath||t.uri,uuid:this._generateUUID(e.payload.file)}),o=this._getNickAndAvatarByUserID(s);return i.setElement(n),i.setNickAndAvatar(o),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}createVideoMessage(t){const e=this.getMyUserID(),s=(t.currentUser=e,t.senderTinyID=this.getMyTinyID(),t.payload.file.thumbUrl="",t.payload.file.thumbSize=0,{});if(k){if(O)return void this.warn("VideoUnsupportedInAlipay");if(Ue(t.payload.file))return void this.warn("FileUnsupportedInMP","createVideoMessage");let e=t.payload["file"];Fe(e.tempFiles)&&(e=e.tempFiles[0]),s.url=e.tempFilePath,s.name=e.tempFilePath.slice(e.tempFilePath.lastIndexOf("/")+1),s.size=e.size||1,s.second=e.duration||0,s.type=e.tempFilePath.slice(e.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(b){const e=t.payload["file"];s.url=e.uri,s.name=e.fileName,s.size=e.fileSize||1,s.second=e.duration||0,s.type=e.type.split("/")[1]}else if(F){if(Ue(t.payload.file)){const e=t.payload.file;t.payload.file.files=[e]}else if(be(t.payload.file)&&"undefined"!=typeof uni){const e=t.payload.file.tempFile;t.payload.file.files=[e]}const e=t.payload["file"];s.url=window.URL.createObjectURL(e.files[0]),s.name=e.files[0].name,s.size=e.files[0].size||1,s.second=e.files[0].duration||0,s.type=e.files[0].type.split("/")[1]}t.payload.file.videoFile=s;const i=new xi(t),n=new wi({videoFormat:s.type,videoSecond:Mt(s.second,0),videoSize:s.size,remoteVideoUrl:"",videoUrl:s.url,videoUUID:this._generateUUID(t.payload.file.videoFile),thumbUUID:this._generateUUID(t.payload.file.videoFile),thumbWidth:t.payload.file.width||200,thumbHeight:t.payload.file.height||200,thumbUrl:t.payload.file.thumbUrl,thumbSize:t.payload.file.thumbSize,thumbFormat:t.payload.file.thumbUrl.slice(t.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),o=this._getNickAndAvatarByUserID(e);return i.setElement(n),i.setNickAndAvatar(o),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,t),i}createCustomMessage(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();const s=new xi(e),i=new ki({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),n=this._getNickAndAvatarByUserID(t);return s.setElement(i),s.setNickAndAvatar(n),s.setNameCard(this._getNameCardByGroupID(s)),s}createFaceMessage(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();const s=new xi(e),i=new Li(e.payload),n=this._getNickAndAvatarByUserID(t);return s.setElement(i),s.setNickAndAvatar(n),s.setNameCard(this._getNameCardByGroupID(s)),s}createMergerMessage(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();const s=this._getNickAndAvatarByUserID(t),i=new xi(e),n=new $i(e.payload);return i.setElement(n),i.setNickAndAvatar(s),i.setNameCard(this._getNameCardByGroupID(i)),i.setRelayFlag(!0),i}createForwardMessage(e){var{to:s,conversationType:i,priority:n,payload:o,needReadReceipt:r,receiverList:a}=e;if(!Fe(o._elements))return ni({code:ei.MSG_FORWARD_INVALID_ELEMENTS});var c=this.getMyUserID(),l=this._getNickAndAvatarByUserID(c);if(o.type===t.MSG_GRP_TIP)return ni({code:ei.MSG_FORWARD_TYPE_INVALID});const _={to:s,conversationType:i,conversationID:""+i+s,priority:n,isPlaceMessage:0,status:Ot,currentUser:c,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||o.cloudCustomData||"",needReadReceipt:r,receiverList:a,isSupportExtension:e.isSupportExtension||!1},d=new xi(_);return d.setElement(o._elements[0]),d.setNickAndAvatar(l),d.setNameCard(this._getNameCardByGroupID(o)),d.setRelayFlag(!0),d}downloadMergerMessage(e){return this._mergerMessageHandler.downloadMergerMessage(e)}createFileMessage(t){if(k){if(!S&&!R&&!P)return;let e;const s=$.getSystemInfoSync().SDKVersion;if(S&&pt(s,e="2.5.0")<0)return void this.warn("WXChooseMessageFile");if(R&&pt(s,e="1.18.0")<0)return void this.warn("QQChooseMessageFile")}if(F||P){if(Ue(t.payload.file)){const s=t.payload.file;t.payload.file={files:[s]}}else if(be(t.payload.file)&&"undefined"!=typeof uni){const{tempFiles:s,files:i}=t.payload.file;let e=null;Fe(s)?e=s[0]:Fe(i)&&(e=i[0]),t.payload.file={files:[e]}}}else if(S||R){const s=t.payload.file["tempFiles"],i={...s[0],url:s[0].path};t.payload.file={files:[i]}}else if(b){const s=t.payload["file"],i={...s,url:s.uri};t.payload.file={files:[i]}}const s=this.getMyUserID(),i=(t.currentUser=s,t.senderTinyID=this.getMyTinyID(),new xi(t)),e=new Gi({uuid:this._generateUUID(t.payload.file),file:t.payload.file}),n=this._getNickAndAvatarByUserID(s);return i.setElement(e),i.setNickAndAvatar(n),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,t),i}createLocationMessage(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();const s=new xi(e),i=new bi(e.payload),n=this._getNickAndAvatarByUserID(t);return s.setElement(i),s.setNickAndAvatar(n),s.setNameCard(this._getNameCardByGroupID(s)),s}_onNoModule(){return ni({code:ei.NO_MODULE})}sendMessageInstance(r,a){if(!1===this.get(Vs).filterMessage(r,a))return r.hasRiskContent=!0,this._onSendMessageFailed(r,new Qs({code:ei.PROFANITY_FOUND}));let s=null;if(r.conversationType===t.CONV_C2C)s=this.get(ys);else{if(r.conversationType!==t.CONV_GROUP)return ni({code:ei.MSG_INVALID_CONV_TYPE});s=this.get(vs)}if(!s)return this._onNoModule();const c=this._n+".sendMessageInstance",l=this.get(Ds),d=s.isOnlineMessage(r,a);let _;return this.get(Ns).upload(r).then(()=>(this._getSendMessageSpecifiedKey(r)===_i&&this.get($s).addSuccessCount(hi),this._guardForGroup(r).then(()=>{if(!r.isSendable())return ni({code:ei.MSG_F_URL_IS_EMPTY});this._addSendMessageTotalCount(r),_=Date.now();var e=function(t){let e="utf-8";F&&document&&(e=document.charset.toLowerCase());let s,i=0,n;if(n=t.length,"utf-8"===e||"utf8"===e)for(let e=0;e<n;e++)(s=t.codePointAt(e))<=127?i+=1:s<=2047?i+=2:s<=65535?i+=3:(i+=4,e++);else if("utf-16"===e||"utf16"===e)for(let e=0;e<n;e++)(s=t.codePointAt(e))<=65535?i+=2:(i+=4,e++);else i=t.replace(/[^\x00-\xff]/g,"aa").length;return i}(JSON.stringify(r));return r.type===t.MSG_MERGER&&11264<e?this._mergerMessageHandler.uploadMergerMessage(r,e).then(e=>{e=this._mergerMessageHandler.createMergerMessagePack(r,a,e);return this.req(e)}):(l.setMessageRandom(r),s.sendMessage(r,a))}).then(e=>{var{time:e,sequence:s,readReceiptCode:i,messageDropReason:n}=e.data;if(Ge(i)&&0!==i&&(new Ti("sendMessageWithReceipt").setMessage(`from:${r.from} to:${r.to} sequence:${s} readReceiptCode:`+i).end(),Ce.w(c+` readReceiptCode:${i} message:`+this.getErrMsg(i))),n){const t=new Ti("messageDropReason"),a=`from:${r.from} to:${r.to} sequence:${s} messageDropReason:`+n;t.setMessage(a).end(),Ce.w(c+" "+a)}if(this._addSendMessageSuccessCount(r,_),this._messageOptionsMap.delete(r.clientSequence),!0===r.isResend){const t=l.findMessage(r.ID);t&&(Ce.l(c+" resend ok. ID:"+t.ID),l.deleteLocalMessage(t))}r.status=Nt,r.time=e;let o=!1;if(r.conversationType===t.CONV_GROUP)r.sequence=s;else if(r.conversationType===t.CONV_C2C){const t=l.getLatestMessageSentByMe(r.conversationID);if(t){const{nick:a,avatar:e}=t;a===r.nick&&e===r.avatar||(o=!0)}}if(o&&l.modifyMessageSentByMe({conversationID:r.conversationID,latestNick:r.nick,latestAvatar:r.avatar}),!0===d)r._onlineOnlyFlag=!0;else{l.appendToMessageList(r);let e=r,s=(be(a)&&be(a.messageControlInfo)&&(!0===a.messageControlInfo.excludedFromLastMessage&&(r._isExcludedFromLastMessage=!0,e=""),!0===a.messageControlInfo.excludedFromUnreadCount&&(r._isExcludedFromUnreadCount=!0)),r.conversationType);rt(r.to)&&(s=t.CONV_TOPIC,this.get(Ss).onMessageSent({groupID:Tt(r.to),topicID:r.to,lastMessage:e})),l.onMessageSent({conversationOptionsList:[{conversationID:r.conversationID,unreadCount:0,type:s,subType:r.conversationSubType,lastMessage:e}]})}return r._relayFlag||"TIMImageElem"!==r.type||mt(r.payload.imageInfoArray),Zs({message:r})}))).catch(e=>this._onSendMessageFailed(r,e,d))}_guardForGroup(e){if(e.conversationType!==t.CONV_GROUP)return Promise.resolve();const s=this.get(vs);if(!s)return this._onNoModule();if(ot({groupID:e.to})){const t=s.getLocalGroupProfile(e.to);if(t&&t.isSupportTopic)return ni({code:ei.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return s.guardForAVChatRoom(e)}_onSendMessageFailed(e,t,s=!1){var i=this._n+"._onSendMessageFailed";e.status=Pt,80001!==t.code&&80004!==t.code||(e.hasRiskContent=!0);const n=this.get(Ds);n.deleteMessageRandom(e);var o=10100<=t.code&&t.code<=10200||120001<=t.code&&t.code<=13e4;s||o||!0===n.appendToMessageList(e)&&Ce.l(i+" message stored, ID:"+e.ID),this._addSendMessageFailCountOnUser(e,t);const r=new Ti("sendMessage");let a=`head.seq:${t.data.headSeq} type:${e.type} from:${e.from} to:`+e.to;if(F){if("connection"in navigator){const e=navigator.connection;a+=` downlink:${e.downlink} effectiveType:${e.effectiveType} rtt:`+e.rtt}if("memory"in window.performance){const e=window.performance.memory;a+=` usedJSHeapSize:${e.usedJSHeapSize} totalJSHeapSize:${e.totalJSHeapSize} jsHeapSizeLimit:`+e.jsHeapSizeLimit}}return r.setMessage(a).setError(t).end(),Ce.e(i+` ${a} error:`,t),ni(new Qs({code:t&&t.code?t.code:ei.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}_getSendMessageSpecifiedKey(e){if([t.MSG_IMAGE,t.MSG_AUDIO,t.MSG_VIDEO,t.MSG_FILE].includes(e.type))return _i;if(e.conversationType===t.CONV_C2C)return li;if(e.conversationType===t.CONV_GROUP){const t=this.get(vs);if(t){var e=t.getLocalGroupProfile(e.to);if(e)return e=e.type,nt(e)?di:ui}}}_addSendMessageTotalCount(e){e=this._getSendMessageSpecifiedKey(e);e&&this.get($s).addTotalCount(e)}_addSendMessageSuccessCount(e,t){var s=this._getSendMessageSpecifiedKey(e);if(s){const e=this.get($s);e.addSuccessCount(s),e.addCost(s,Dt(t,!1))}}_addSendMessageFailCountOnUser(e,t){const{code:s=-1}=t,i=this.get($s),n=this._getSendMessageSpecifiedKey(e);n===_i&&function(e){let t=!1;return t=Vn.includes(e)?!0:t}(s)?i.addFailedCountOfUserSide(hi):Bn(s)&&n&&i.addFailedCountOfUserSide(n)}resendMessage(e,t){return e.isResend=!0,e.status=Ot,this.sendMessageInstance(e,t)}revokeMessage(s){let e=null;if(s.conversationType===t.CONV_C2C?e=this.get(ys):s.conversationType===t.CONV_GROUP&&(e=this.get(vs)),!e)return this._onNoModule();const i=new Ti("revokeMessage"),n=(i.setMessage(`type:${s.type} from:${s.from} to:`+s.to),this._n+".revokeMessage");return e.revokeMessage(s).then(e=>{var t=e.data.recallRetList;if(Oe(t)||0===t[0].retCode)return Ce.i(n+" ok. ID:"+s.ID),s.isRevoked=!0,i.end(),this.get(Ds).onMessageRevoked([s]),Zs({message:s});{const e=new Qs({code:t[0].retCode,data:{message:s}});return i.setCode(e.code).setMoreMessage(e.message).end(),ni(e)}}).catch(e=>{i.setError(e).end();var t=new Qs({code:e&&e.code?e.code:ei.MSG_REVOKE_FAIL,message:e&&e.message?e.message:void 0,data:{message:s}});return Ce.w(n+" failed. error:",e),ni(t)})}deleteMessage(e){let s=null;const i=e[0],n=i.conversationID;let o="",r=[],a=[];if(i.conversationType===t.CONV_C2C)s=this.get(ys),o=n.replace(t.CONV_C2C,""),e.forEach(e=>{e&&e.status===Nt&&e.conversationID===n&&(e._onlineOnlyFlag||r.push(`${e.sequence}_${e.random}_`+e.time),a.push(e))});else if(i.conversationType===t.CONV_GROUP)s=this.get(vs),o=n.replace(t.CONV_GROUP,""),e.forEach(e=>{e&&e.status===Nt&&e.conversationID===n&&(e._onlineOnlyFlag||r.push(""+e.sequence),a.push(e))});else if(i.conversationType===t.CONV_SYSTEM)return ni({code:ei.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!s)return this._onNoModule();if(0===r.length)return this._onMessageDeleted(a);30<r.length&&(r=r.slice(0,30),a=a.slice(0,30));const c=new Ti("deleteMessage"),l=(c.setMessage(`to:${o} count:`+r.length),this._n+".deleteMessage");return s.deleteMessage({to:o,keyList:r}).then(e=>(c.end(),Ce.i(l+" ok"),this._onMessageDeleted(a))).catch(e=>{c.setError(e).end(),Ce.w(l+" failed. error:",e);e=new Qs({code:e&&e.code?e.code:ei.MSG_DELETE_FAIL,message:e&&e.message?e.message:void 0});return ni(e)})}_onMessageDeleted(e){return this.get(Ds).onMessageDeleted(e),ii({messageList:e})}translateText(e){const n=this._n+".translateText",{sourceTextList:t,sourceLanguage:s,targetLanguage:i}=e,o=new Ti("translateText");return o.setMessage(`sourceLanguage:${s} targetLanguage:`+i),this.req({P:ri.TRANSLATE_TEXT,data:{sourceTextList:t,source:s||"auto",target:i,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then(e=>{var{error:e,requestID:t,translatedTextList:s}=e.data,i=e["code"];if(0===i)return o.end(),Ce.i(n+" ok. requestID:"+t),Zs({translatedTextList:s});throw{...e,requestID:t}}).catch(e=>(o.setCode(e.code).setMoreMessage(e.requestID).end(),Ce.w(n+" failed. error:",e),ni({code:ei.TRANSLATE_TEXT_FAIL})))}convertVoiceToText(e){var{message:e,language:t}=e;let s=e.payload.url;e.from===this.getMyUserID()&&"out"===e.flow&&(s=e.payload.remoteAudioUrl);const i=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/;if(!i.test(s))return ni({code:ei.UNSUPPORTED_VOICE_FORMAT});e=i.exec(s)[1]||"mp3";let n="16k_zh-PY";t?"zh (cmn-Hans-CN)"===t?n="16k_zh":"en-US"===t?n="16k_en":"yue-Hant-HK"===t?n="16k_yue":"ja-JP"===t&&(n="16k_ja"):n="16k_zh-PY";const o=`serviceType:${n} url:`+s,r=this._n+".convertVoiceToText",a=(Ce.i(r+" "+o),new Ti("convertVoiceToText"));return a.setMessage(o),this.req({P:ri.VOICE_TO_TEXT,data:{url:s,language:n,SDKAppID:this.getSDKAppID(),format:e}}).then(e=>{var{error:e,requestID:t,result:s}=e.data,i=e["code"];if(0===i)return a.end(),Ce.i(r+" ok. requestID:"+t),Zs({result:s});throw{...e,requestID:t}}).catch(e=>(a.setCode(e.code).setMoreMessage(e.requestID||"").end(),Ce.w(r+" failed. error:",e),ni({code:ei.VOICE_TO_TEXT_FAIL})))}modifyRemoteMessage(s){if(!1===this.get(Vs).filterMessage(s))return s.hasRiskContent=!0,ni({code:ei.PROFANITY_FOUND,data:{message:s}});let e=null;var{conversationType:i,to:n}=s;if(i===t.CONV_C2C)e=this.get(ys);else if(i===t.CONV_GROUP){if(!(e=this.get(vs)))return this._onNoModule();if(e.isMessageFromOrToAVChatroom(n))return ni({code:ei.MSG_MODIFY_DISABLED_IN_AV,data:{message:s}})}const o=new Ti("modifyMessage"),r=(o.setMessage("to:"+n),this._n+".modifyRemoteMessage");return e.modifyRemoteMessage(s).then(e=>{o.end(),Ce.i(r+" ok");e=this._onModifyRemoteMessageResp(s,e.data);return Zs({message:e})}).catch(e=>{var t;return o.setCode(e.code).setMoreMessage(e.message).end(),Ce.w(r+" failed. error:",e),20027===e.code?(t=this._onModifyRemoteMessageResp(s,e.data),ni({code:ei.MSG_MODIFY_CONFLICT,data:{message:t}})):ni({code:e.code,message:e.message,data:{message:s}})})}_onModifyRemoteMessageResp(e,t){Ce.d(this._n+"._onModifyRemoteMessageResp options:",t);var{conversationType:e,from:s,to:i,random:n,sequence:o,time:r}=e,{elements:t,messageVersion:a,cloudCustomData:c=""}=t;return this.get(Ds).onMessageModified({conversationType:e,from:s,to:i,time:r,random:n,sequence:o,elements:t,cloudCustomData:c,messageVersion:a})}_generateUUID(e){const t=this.get(Rs);let s=`${t.getSDKAppID()}-${t.getUserID()}-`+function(){let t="";for(let e=32;0<e;--e)t+=Je[Math.floor(Math.random()*Xe)];return t}();const i=e.name||e.value||e.url||e.tempFilePath,n=i&&i.slice(i.lastIndexOf(".")+1);return s=n?s+"."+n:s}getMessageOption(e){return this._messageOptionsMap.get(e)}_getNickAndAvatarByUserID(e){return this.get(Ts).getNickAndAvatarByUserID(e)}_getNameCardByGroupID(e){if(e.conversationType===t.CONV_GROUP){const t=this.get(vs);if(t)return t.getMyNameCardByGroupID(e.to)}return""}reset(){Ce.l(this._n+".reset"),this._messageOptionsMap.clear()}}class Hn extends oi{constructor(e){super(e),this._n="MsgExtModule",this.msgExtMap=new Map,this.globalSeqMap=new Map,this.getMsgExtsMap=new Map}onMsgExtNotify(t){const{messageInfo:s,operateType:i,operateResultList:n,tinyID:_,globalSequence:o}=t.dataList,{clientTime:u,random:h}=s,r=_+`-${u}-`+h,a=[],c=[];Ce.l(`${this._n}.onMsgExtNotify messageID:${r} operateType:${i} globalSequence:`+o),this._updateGlobalSeq(r,o);let l=!1,d=!1;n.forEach(e=>{const{extensions:t=[],clearSequence:s}=e;1===i?(l=!0,t.forEach(e=>{a.push({key:e.key,value:e.value})}),this._updateLocalExt(r,t)):2===i?(d=!0,t.forEach(e=>{c.push(e.key)}),this._updateLocalExt(r,t)):3===i&&(d=!0,this._hasLocalExt(r)&&this._getLocalExt(r).forEach((e,t)=>{e.seq<=s&&!Oe(e.value)&&c.push(t)}),this._clearLocalExt(r,s))}),l&&this.emitOEvt(e.MESSAGE_EXTENSIONS_UPDATED,{messageID:r,extensions:a}),d&&this.emitOEvt(e.MESSAGE_EXTENSIONS_DELETED,{messageID:r,keyList:c})}setMessageExtensions(e,t){var s="setMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(s);const i=this._n+"."+s,{ID:n,conversationID:o,sequence:r,time:d}=e;let a=[...t];20<t.length&&(a=t.slice(0,20),Ce.w(i+". the length of extensions cannot exceed 20."));const c=`convID:${o} messageID:${n} sequence:${r} time:${d} count:`+a.length,l=new Ti(s);return l.setMessage(c),Ce.l(i+" "+c),this._modifyMsgExts(e,a).then(e=>{var{resultList:e,successCount:t,failureCount:s}=e,t=`successCount:${t} failCount:`+s;return l.setMoreMessage(t).end(),Ce.l(i+" ok. "+t),Zs({extensions:e})}).catch(e=>(l.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}getMessageExtensions(e){var t="getMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(t);const s=this._n+"."+t,{ID:i,conversationID:n,sequence:o,time:r}=e,a=`convID:${n} messageID:${i} sequence:${o} time:`+r,c=new Ti(t);c.setMessage(a),Ce.l(s+" "+a);let l=void 0;return this.getMsgExtsMap.has(i)&&(l=this._getGlobalSeq(i)),this._getMsgExts(e,l).then(e=>(c.end(),Ce.l(s+" ok. extCount:"+e.length),$e(l)&&0<e.length&&this.getMsgExtsMap.set(i,1),Zs({extensions:e}))).catch(e=>(c.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}deleteMessageExtensions(e,t){var s="deleteMessageExtensions";if(!this.canIUse(M.MSG_EXT))return this.noUse(s);const n=this._n+"."+s,i=[];let o=3;Oe(t)||(o=2,t.forEach(e=>{i.push({key:e,value:"",seq:0})}));const{ID:r,conversationID:a,sequence:d,time:_}=e,c=`convID:${a} messageID:${r} sequence:${d} time:${_} operateType:`+o,l=new Ti(s);return l.setMessage(c),Ce.l(n+" "+c),this._modifyMsgExts(e,i,o).then(e=>{var{resultList:e,successCount:t,failureCount:s}=e;let i="";return 2===o&&(i=`success count:${t} fail count:`+s),l.setMoreMessage(""+i).end(),Ce.l(n+" ok. "+i),Zs({extensions:e})}).catch(e=>(l.setError(e).end(),Ce.e(n+" failed. error:",e),ni(e)))}_modifyMsgExts(i,e,s=1){var n=rt(i.to)?t.CONV_TOPIC:i.conversationType;let o=void 0,r=(3!==s&&(o=this._getReqExts(i,e)),null);switch(n){case t.CONV_C2C:r=this.get(ys);break;case t.CONV_GROUP:r=this.get(vs);break;case t.CONV_TOPIC:r=this.get(Ss);break;default:return ni({code:ei.NO_MODULE})}return r.modifyMsgExts(i,o,s).then(e=>{let{extensions:t,seq:s}=e.data;const n=[];let o=0,r=0,a=[];return(t=Oe(t)?[]:t).forEach(e=>{var{errorCode:e,extension:t}=e,{key:t,value:s,seq:i}=t;n.push({code:e,key:t,value:s}),0===e?o++:r++,a.push({key:t,value:s,seq:i})}),this._updateGlobalSeq(i.ID,s),0<a.length&&(this._updateLocalExt(i.ID,a),a=null),{resultList:n,successCount:o,failureCount:r}}).catch(e=>ni(e))}_getReqExts(e,t){const i=[];if(this._hasLocalExt(e.ID)){const n=this._getLocalExt(e.ID);return t.forEach(e=>{var{key:e,value:t}=e;let s=0;n.has(e)&&(s=n.get(e).seq),i.push({key:e,value:t,seq:s})}),i}return t.forEach(e=>{var{key:e,value:t}=e;i.push({key:e,value:t,seq:0})}),i}_getMsgExts(o,e){const r=this._n+"._getMsgExts",{ID:a,to:s}=o;let i=null;switch(rt(s)?t.CONV_TOPIC:o.conversationType){case t.CONV_C2C:i=this.get(ys);break;case t.CONV_GROUP:i=this.get(vs);break;case t.CONV_TOPIC:i=this.get(Ss);break;default:return ni({code:ei.NO_MODULE})}return i.getMessageExtensions(o,e).then(e=>{let{extensions:t,completeFlag:s,globalSequence:i,clearSequence:n}=e.data;if(t=Oe(t)?[]:t,Ce.l(r+` ok. completeFlag:${s} globalSequence:${i} clearSequence:${n} count:`+t.length),this._updateLocalExt(a,t),this._clearLocalExt(a,n),this._updateGlobalSeq(a,i),1===s)return this._getLocalExtList(a);{const e=t.slice(-1)[0].seq+1;return this._getMsgExts(o,e)}}).catch(e=>ni(e))}_hasLocalExt(e){return this.msgExtMap.has(e)}_getLocalExt(e){return this.msgExtMap.get(e)}_updateLocalExt(e,t){this._hasLocalExt(e)||this.msgExtMap.set(e,new Map);const i=this._getLocalExt(e);t.forEach(e=>{var{key:e,value:t="",seq:s}=e;i.set(e,{value:t,seq:s})})}_clearLocalExt(e,s){if(!(s<=0)&&this._hasLocalExt(e)){const i=this._getLocalExt(e);i.forEach((e,t)=>{e.seq<=s&&i.delete(t)})}}_getLocalExtList(e){const s=[];return this._hasLocalExt(e)&&this._getLocalExt(e).forEach((e,t)=>{e=e.value;Oe(e)||s.push({key:t,value:e})}),s}_getGlobalSeq(e){return this.globalSeqMap.get(e)}_updateGlobalSeq(e,t){this.globalSeqMap.set(e,t)}reset(){Ce.l(this._n+".reset"),this.msgExtMap.clear(),this.globalSeqMap.clear(),this.getMsgExtsMap.clear()}}class Wn extends oi{constructor(e){super(e),this._n="MsgReactionModule",this._reactedByMyselfMap=new Map,this._reactionInfoMap=new Map}onReactionNotifyList(t){const{dataList:s=[]}=t||{};s.forEach(t=>{const{C2CMessageInfo:s={},groupMessageInfo:i={},reactionList:n=[]}=t,{tinyID:o,clientTime:r,random:a}={...s,...i},c=o+`-${r}-`+a,l=[];n.forEach(e=>{$e(e.userIDList)&&(e.userIDList=[],e.count=0),l.push(...e.userIDList)}),Ce.l(this._n+`.onReactionNotifyList messageID:${c} reactionList:`+n.length),this._handleReactionSummary([{messageID:c,reactionList:n}],l).then(t=>{this.emitOEvt(e.MESSAGE_REACTIONS_UPDATED,{...t[0]})})})}onReactionNotify(t){var{C2CMessageInfo:t={},groupMessageInfo:s={},reactionID:i,operateType:n}=t.dataList||{},{tinyID:t,clientTime:s,random:o}={...t,...s},s=t+`-${s}-`+o,o=(Ce.l(this._n+`.onReactionNotify messageID:${s} reactionID:${i} operateType:`+n),1===n?this._addReactedByMyselfMap(s,i):this._removeReactedByMyselfMap(s,i),s+"-"+i);if(this._reactionInfoMap.has(o)){const t=this._reactionInfoMap.get(o);t.reactedByMyself=1===n,this.emitOEvt(e.MESSAGE_REACTIONS_UPDATED,{messageID:s,reactionList:[t]})}}addMessageReaction(t,s){var e="addMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(e);const i=this._n+"."+e,{ID:n,conversationID:o}=t,r=`convID:${o} messageID:${n} reactionID:`+s,a=new Ti(e);a.setMessage(r),Ce.l(i+" "+r);e=this._createReactionOperationPack(t,s,1);return this._addReactedByMyselfMap(t.ID,s),this.req(e).then(()=>(a.end(),Ce.l(i+" ok."),Zs())).catch(e=>(this._removeReactedByMyselfMap(t.ID,s),a.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}removeMessageReaction(e,t){var s="removeMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(s);const i=this._n+"."+s,{ID:n,conversationID:o}=e,r=`convID:${o} messageID:${n} reactionID:`+t,a=new Ti(s);a.setMessage(r),Ce.l(i+" "+r);s=this._createReactionOperationPack(e,t,2);return this._removeReactedByMyselfMap(e.ID,t),this.req(s).then(()=>(a.end(),Ce.l(i+" ok."),Zs())).catch(e=>(a.setError(e).end(),Ce.e(i+" failed. error:",e),ni(e)))}getMessageReactions(e){var t="getMessageReactions";if(!this.canIUse(M.MSG_REACTION))return this.noUse(t);const s=this._n+"."+t,{messageList:i,maxUserCountPerReaction:n}=e,o=i[0]["conversationID"],r=`convID:${o} maxUserCountPerReaction:${n} msgCount:`+i.length,a=new Ti(t),c=(a.setMessage(r),Ce.l(s+" "+r),new Map),l=this._createReactionSummaryPack({...e,messageIDMap:c});return this.req(l).then(e=>{const{resultList:t=[]}=e.data,o=[],r=[];return t.forEach(e=>{const{messageKey:t,messageSequence:s,reactionList:i=[]}=e,n=$e(t)?c.get(s):c.get(t);o.push({messageID:n,reactionList:i}),i.forEach(e=>{r.push(...e.userIDList)})}),this._handleReactionSummary(o,r)}).then(e=>(a.end(),Ce.l(s+" ok."),c.clear(),Zs({resultList:e}))).catch(e=>(a.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}getAllUserListOfMessageReaction(e){var t="getAllUserListOfMessageReaction";if(!this.canIUse(M.MSG_REACTION))return this.noUse(t);const s=this._n+"."+t,{message:i,reactionID:n,nextSeq:o,count:r}=e,{ID:d,conversationID:_}=i,a=`convID:${_} messageID:${d} reactionID:${n} nextSeq:${o} count:`+r,c=new Ti(t),l=(c.setMessage(a),Ce.l(s+" "+a),{userList:[],nextSeq:0,isCompleted:!1}),u=this._createReactionUserListPack(e);return this.req(u).then(e=>{var{userIDList:e=[],nextSeq:t=0}=e.data;return l.nextSeq=t,l.isCompleted=0===t,this.get(Ts).getUserNickAndAvatar(e)}).then(e=>(l.userList=e,c.end(),Ce.l(s+" ok."),Zs(l))).catch(e=>(c.setError(e).end(),Ce.e(s+" failed. error:",e),ni(e)))}_createReactionOperationPack(s,e,i){let n=void 0;const o={reactionID:e,userIDList:[this.getMyUserID()]};if(s.conversationType===t.CONV_C2C){const t=this.get(ys);n=1===i?ri.ADD_C2C_MSG_REACTION:ri.RM_C2C_MSG_REACTION,o.from=s.from,o.to=s.to,o.messageKey=t.getMessageKey(s)}if(s.conversationType===t.CONV_GROUP){let e=void 0,t=s.to;rt(s.to)&&(e=s.to,t=Tt(e)),n=1===i?ri.ADD_GRP_MSG_REACTION:ri.RM_GRP_MSG_REACTION,o.groupID=t,o.topicID=e,o.messageSequence=s.sequence}return{P:n,data:o}}_createReactionSummaryPack(s){const{messageList:i,maxUserCountPerReaction:n=10,messageIDMap:o}=s,r=i[0];let a=void 0,c=void 0;if(r.conversationType===t.CONV_C2C){const s=this.get(ys),t=i.map(e=>{var t=s.getMessageKey(e);return o.set(t,e.ID),t});a=ri.GET_C2C_MSG_REACTIONS,c={from:r.from,to:r.to,messageKeyList:t,count:n}}if(r.conversationType===t.CONV_GROUP){let e=void 0,t=r.to;rt(r.to)&&(e=r.to,t=Tt(e));s=i.map(e=>(o.set(e.sequence,e.ID),e.sequence));a=ri.GET_GRP_MSG_REACTIONS,c={groupID:t,topicID:e,messageSequenceList:s,count:n}}return{P:a,data:c}}_createReactionUserListPack(e){var{message:s,reactionID:e,nextSeq:i=0,count:n=100}=e;let o=void 0;const r={reactionID:e,nextSeq:i,count:100<n?100:n};if(s.conversationType===t.CONV_C2C){const e=this.get(ys);o=ri.GET_C2C_MSG_REACTION_USER_LIST,r.from=s.from,r.to=s.to,r.messageKey=e.getMessageKey(s)}if(s.conversationType===t.CONV_GROUP){let e=void 0,t=s.to;rt(s.to)&&(e=s.to,t=Tt(e)),o=ri.GET_GRP_MSG_REACTION_USER_LIST,r.groupID=t,r.topicID=e,r.messageSequence=s.sequence}return{P:o,data:r}}_handleReactionSummary(t,e){return this.get(Ts).getUserNickAndAvatar(e).then(c=>{const e=[];return t.forEach(r=>{const a=[];r.reactionList.forEach(e=>{const{reactionID:t,count:s,userIDList:i,reactedByMyself:n}=e,o=[];i.forEach(t=>{c.forEach(e=>{t===e.userID&&o.push(e)})});e={reactionID:t,totalUserCount:s,partialUserList:o,reactedByMyself:this._computeReactedByMyself({reactedByMyself:n,messageID:r.messageID,reactionID:t})};if(a.push(e),$e(n)&&!this._reactedByMyselfMap.has(r.messageID)){const c=r.messageID+"-"+t;this._reactionInfoMap.set(c,e)}}),e.push({messageID:r.messageID,reactionList:a})}),e})}_addReactedByMyselfMap(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]);const s=this._reactedByMyselfMap.get(e);-1===s.indexOf(t)&&s.push(t)}_removeReactedByMyselfMap(e,t){if(this._reactedByMyselfMap.has(e)){const s=this._reactedByMyselfMap.get(e),i=s.indexOf(t);-1<i&&s.splice(i,1)}}_computeReactedByMyself({reactedByMyself:e,messageID:t,reactionID:s}){return $e(e)?!!this._reactedByMyselfMap.has(t)&&this._reactedByMyselfMap.get(t).includes(s):1===e}reset(){Ce.l(this._n+".reset"),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}class Yn extends oi{constructor(e){super(e),this._n="ComboMsgModule"}sendMessage(e){const r=this._createMsg(e);if(null===r)return ni({code:ei.MSG_SEND_FAIL});this._addSendMessageTotalCount(r);const a=Date.now();return this.get(Ds).setMessageRandom(r),this._sendComboMessage(r,e).then(e=>{var{time:e,sequence:s,readReceiptCode:i}=e.data;Ge(i)&&0!==i&&(new Ti("sendMessageWithReceipt").setMessage(`from:${r.from} to:${r.to} sequence:${s} readReceiptCode:`+i).end(),Ce.w(this._n+`.sendMessage readReceiptCode:${i} message:`+this.getErrMsg(i))),this._addSendMessageSuccessCount(r,a);const n=this.get(Ds);r.status=Nt,r.time=e,r.conversationType===t.CONV_GROUP&&(r.sequence=s),n.appendToMessageList(r);let o=r;return!0===r._isExcludedFromLastMessage&&(o=""),n.onMessageSent({conversationOptionsList:[{conversationID:r.conversationID,unreadCount:0,type:r.conversationType,subType:r.conversationSubType,lastMessage:o}]}),Zs({message:r})}).catch(e=>this._onSendMessageFailed(r,e))}_sendComboMessage(e,s){const i=this._m.get(Gs);let n="";return e.conversationType===t.CONV_C2C&&(n=f.NAME.OPEN_IM+"."+ri.SEND_C2C_MSG),e.conversationType===t.CONV_GROUP&&(n=f.NAME.GRP+"."+ri.SEND_GRP_MSG),i.sendComboMessage({servcmd:n,data:s})}_createMsg(s){var i=this._n+"._createMsg";let n=null;try{const a=this.getMyUserID(),c={};if(c.senderTinyID=this.getMyTinyID(),c.currentUser=a,c.from=s.From_Account||a,s.GroupId?(c.conversationID=""+t.CONV_GROUP+s.GroupId,c.conversationType=t.CONV_GROUP,c.to=s.GroupId):s.To_Account&&(c.conversationID=""+t.CONV_C2C+s.To_Account,c.conversationType=t.CONV_C2C,c.to=s.To_Account),c.time=s.MsgTimeStamp||0,c.random=s.Random||s.MsgRandom||0,c.priority=s.MsgPriority,ke(s.CloudCustomData)&&0<s.CloudCustomData.length&&(c.cloudCustomData=s.CloudCustomData),Fe(s.SendMsgControl)&&(c.messageControlInfo={},s.SendMsgControl.includes("NoUnread")&&(c.messageControlInfo.excludedFromUnreadCount=1),s.SendMsgControl.includes("NoLastMsg")&&(c.messageControlInfo.excludedFromLastMessage=1)),c.conversationType===t.CONV_GROUP&&Fe(s.To_Account)&&0<s.To_Account.length){let e=s.To_Account;50<s.To_Account.length&&(e=s.To_Account.slice(0,50),Ce.w(i+" To_Account must be less than or equal to 50.")),c.receiverList=[...e],s.To_Account=[...e]}1!==s.IsNeedReadReceipt&&1!==s.NeedReadReceipt||(c.needReadReceipt=!0),1===s.SupportMessageExtension&&(c.isSupportExtension=!0),(n=new xi(c)).status=Ot,s.MsgClientTime=n.clientTime,n.conversationType===t.CONV_C2C&&(s.MsgSeq=n.sequence);var o,r=s.MsgBody.length;for(let e=0;e<r;e++)"TIMTextElem"===(o=s.MsgBody[e]).MsgType?n.setTextElement(o.MsgContent.Text):"TIMCustomElem"===o.MsgType?n.setCustomElement({data:o.MsgContent.Data||"",description:o.MsgContent.Desc||"",extension:o.MsgContent.Ext||""}):"TIMFaceElem"===o.MsgType&&n.setFaceElement({index:o.MsgContent.Index,data:o.MsgContent.Data});var e=n.getElements();n.payload=e[0].content,n.type=e[0].type}catch(e){n=null,Ce.e(i+" failed. error:",e)}return n}_onSendMessageFailed(e,t){e.status=Pt,this.get(Ds).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);const s=new Ti("sendMessage"),i=`head.seq:${t.data.headSeq} type:${e.type} from:${e.from} to:`+e.to;return s.setMessage(i).setError(t).end(),Ce.e(this._n+`._onSendMessageFailed ${i} error:`,t),ni(new Qs({code:t&&t.code?t.code:ei.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}_getSendMessageSpecifiedKey(e){if(e.conversationType===t.CONV_C2C)return li;if(e.conversationType===t.CONV_GROUP){const t=this.get(vs).getLocalGroupProfile(e.to);if(t)return e=t.type,nt(e)?di:ui}}_addSendMessageTotalCount(e){e=this._getSendMessageSpecifiedKey(e);e&&this.get($s).addTotalCount(e)}_addSendMessageSuccessCount(e,t){var s=this._getSendMessageSpecifiedKey(e);if(s){const e=this.get($s);e.addSuccessCount(s),e.addCost(s,Dt(t,!1))}}_addSendMessageFailCountOnUser(e,t){const{code:s=-1}=t,i=this.get($s),n=this._getSendMessageSpecifiedKey(e);Bn(s)&&n&&i.addFailedCountOfUserSide(n)}}class zn extends oi{constructor(e){super(e),this._n="PluginModule",this.plugins={}}registerPlugin(t){let s="0";Object.keys(t).forEach(e=>{this.plugins[e]=t[e],"tim-upload-plugin"===e&&"function"==typeof t[e].getVersion&&(s=t[e].getVersion())}),new Ti("registerPlugin").setMessage(""+Object.keys(t)).setMoreMessage("version:"+s).end()}getPlugin(e){return this.plugins[e]}reset(){}}class jn extends oi{constructor(e){super(e),this._n="SyncUnreadMsgModule",this._cookie="",this._onlineSyncFlag=!1,this.getIEmitInst().on(Yi.A2KEY_AND_TINYID_UPDATED,this._init,this)}_init(){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}_startSync(e){const{cookie:t,syncFlag:s,isOnlineSync:i}=e,n=this._n+"._startSync",o=(Ce.l(n+" options:",e),new Ti("syncUnread"));o.setMessage(JSON.stringify(e)),this.req({P:ri.SYNC_UNREAD_MSG,data:{cookie:t,syncFlag:s,isOnlineSync:i}}).then(e=>{var{cookie:t,syncFlag:s}=e.data,i=`$cookie:${t} syncFlag:`+s;Ce.l(n+" ok. "+i),this._cookie=t,o.setMoreMessage(i).end(),Oe(t)||(0===s||1===s?(this._dispatch({...e.data,isSyncingEnded:!1}),this._startSync({cookie:t,syncFlag:s,isOnlineSync:0})):2===s&&this._dispatch({...e.data,isSyncingEnded:!0}))}).catch(e=>{o.setError(e).end(),Ce.e(n+" failed. error:",e)})}_dispatch(e){e.eventArray&&this.get(Gs).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.get(ys).onNewMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded})}syncOnNeed(){Ce.l(this._n+".syncOnNeed cookie:"+this._cookie),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}syncOnReconnected(){Ce.l(this._n+".syncOnReconnected cookie:"+this._cookie),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}reset(){Ce.l(this._n+".reset"),this._onlineSyncFlag=!1,this._cookie=""}}const Jn={req:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",fileUrl:"Url",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic",isWebUniapp:"is_web_uniapp",isSupportExtension:"SupportMessageExtension",messageSequence:"MsgSeq",messageKey:"MsgKey",startSequence:"startSeq",simplifiedMessage:"DownsizeFlag",isRelayMessage:"IsRelayMsg",reactionID:"Reaction",messageSequenceList:"MsgSeqList",messageKeyList:"MsgKeyList",cmConfigID:"CustomModerationConfigID"},res:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"isWithChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence",BanDuration:"duration",BanDescription:"reason",NotVisible:"invisible",BytesTag:"tag",BytesValue:"value",RptBytesValue:"value",LatestSeq:"globalSequence",ClearSeq:"clearSequence",SupportMessageExtension:"isSupportExtension",ExtensionList:"extensions",GroupCounter:"counterList",Revoker_Account:"revoker",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence",InviteJoinOption:"inviteOption",MemberList_Account:"inviteeList",MsgMemberExtraInfoList:"inviteeInfoList",E:"event",GInf:"groupProfile",MCT:"clientTime",MR:"random",MP:"priority",MTS:"time",GId:"groupID",MS:"sequence",CCD:"cloudCustomData",F_Account:"from",F_Hd:"avatar",F_NN:"nick",GN:"groupName",GT:"groupType",IsSys:"isSystemMessage",OpInf:"operatorInfo",Img:"avatar",NN:"nick",OnlineInf:"onlineMemberInfo",ET:"expireTime",Num:"onlineMemberNum",Opt:"operationType",O_Account:"operatorID",RT:"operationType",UDF:"userDefinedField",L_Account:"userIDList",IsPlaceMsg:"isPlaceMessage",MsgCheckResult:"checkResult",Results:"resultList",Reaction:"reactionID",Reaction_Account:"userIDList",MsgReactionNotifyList:"messageReactionNotifyList",MsgReactionNotify:"messageReactionNotify",MsgReactionSummary:"reactionList",C2CMsgInfo:"C2CMessageInfo",GroupMsgInfo:"groupMessageInfo",int32_err_code:"errorCode",str_err_msg:"errorMsg",MsgDropReason:"messageDropReason",ReactedByMe:"reactedByMyself",Level:"messageRemindType",PeerReadTime:"timestamp",NoUnreadSeqList:"excludedUnreadSequenceList",NewMsg:"topicLatestMessage"},ignoreKeyWord:["C2C","ID","USP"]};function Xn(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");return t=Object.assign({pascalCase:!1},t),0===(e=Array.isArray(e)?e.map(e=>e.trim()).filter(e=>e.length).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e=e=(e=e!==e.toLowerCase()?Zn(e):e).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(e,t)=>t.toUpperCase()).replace(/\d+(\w|$)/g,e=>e.toUpperCase()),t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e)}const Zn=t=>{let s=!1,i=!1,n=!1;for(let e=0;e<t.length;e++){const o=t[e];s&&/[a-zA-Z]/.test(o)&&o.toUpperCase()===o?(t=t.slice(0,e)+"-"+t.slice(e),s=!1,n=i,i=!0,e++):i&&n&&/[a-zA-Z]/.test(o)&&o.toLowerCase()===o?(t=t.slice(0,e-1)+"-"+t.slice(e-1),n=i,i=!1,s=!0):(s=o.toLowerCase()===o&&o.toUpperCase()!==o,n=i,i=o.toUpperCase()===o&&o.toLowerCase()!==o)}return t};function Qn(e,t){let i=0;return function s(e,n){return 100<++i?(i--,e):Fe(e)?(t=e.map(e=>we(e)?s(e,n):e),i--,t):we(e)?(t=ut(t=function(s){const i=Object.create(null);return Object.keys(s).forEach(e=>{var t=(t=>{if(!He(t))return!1;if(t!==Xn(t))for(let e=0;e<Jn.ignoreKeyWord.length&&!t.includes(Jn.ignoreKeyWord[e]);e++);var e,s;if($e(n[t]))return s=t,s[0].toUpperCase()+Xn(s).slice(1);else return n[t]})((s[e],e));t&&(i[t]=s[e])}),i}(e),(e,t)=>Fe(e)||we(e)?s(e,n):e),i--,t):void 0;var t}(e,t)}function eo(e,n){return Fe(e)?e.map(e=>we(e)?eo(e,n):e):we(e)?ut(function(s){const i={};return Object.keys(s).forEach(e=>{var t;i[s[e],t=e,$e(n[t])?Xn(t):n[t]]=s[e]}),i}(e),e=>Fe(e)||we(e)?eo(e,n):e):void 0}const to=String.fromCharCode,so=function(e){let t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){e=0|e.charCodeAt(1);if(56320<=e&&e<=57343){if(65535<(t=(t<<10)+e-56613888|0))return to(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?to(192|t>>>6,128|63&t):to(224|t>>>12,128|t>>>6&63,128|63&t)},io=function(e){const t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,so),s=0|t.length,i=new Uint8Array(s);let n=0;for(;n<s;n=n+1|0)i[n]=0|t.charCodeAt(n);return i};class no{constructor(e){var t=(this._handler=e).getURL();if(this._socket=null,this._workerSocket=null,this._id=je(),this._handler.getIsWorkerEnabled()){const e=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen", extensions: _socket.extensions }); }; _socket.onclose = function(e) { postMessage({ callback: "onOpen", e: { code: e.code, reason: e.reason } }); }; _socket.onmessage = function(e) { postMessage({ callback: "onMessage", data: e.data }); }; _socket.onerror = function(e) { postMessage({ callback: "onError", e: { isTrusted: "true" } }); }; } else if (event.data.cmd === "sendMessage") { if (_socket !== null) { _socket.send(event.data.data); } } else if (event.data.cmd === "stop") { if (_socket !== null) { _socket.close(event.data.code); _socket = null; } }};'],{type:"application/javascript; charset=utf-8"})),n=(this._workerSocket=new Worker(e),this);this._workerSocket.onmessage=function(e){var{callback:t,e:s,extensions:i}=e.data;"onOpen"===t?n._onOpen(i):"onClose"===t?n._onClose(s):"onError"===t?n._onError(s):"onMessage"===t&&n._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:t})}else k?O?($.connectSocket({url:t,header:{"content-type":"application/json"}}),$.onSocketClose(this._onClose.bind(this)),$.onSocketOpen(this._onOpen.bind(this)),$.onSocketMessage(this._onMessage.bind(this)),$.onSocketError(this._onError.bind(this))):(this._socket=$.connectSocket({url:t,header:{"content-type":"application/json"},complete:()=>{}}),this._socket.onClose(this._onClose.bind(this)),this._socket.onOpen(this._onOpen.bind(this)),this._socket.onMessage(this._onMessage.bind(this)),this._socket.onError(this._onError.bind(this))):(this._socket=new WebSocket(t),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this,this._socket.extensions),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this));this._canIUseBinaryFrame=e.canIUseBinaryFrame()}getID(){return this._id}_onOpen(e){this._handler.onOpen({id:this._id,res:JSON.stringify(e)})}_onClose(e){this._handler.onClose({id:this._id,e:e})}_onMessage(e){e=this._canIUseBinaryFrame?this._isAppCompressedData(e.data)?this._handler.inflate(e.data):function(e){var n=new Uint8Array(e);let o="",r=0;for(var a=n.length;r<a;){let t=n[r],s=0,i=0;if(t<=127?(s=0,i=255&t):t<=223?(s=1,i=31&t):t<=239?(s=2,i=15&t):t<=244&&(s=3,i=7&t),0<a-r-s){let e=0;for(;e<s;)t=n[r+e+1],i=i<<6|63&t,e+=1}else i=65533,s=a-r;o+=String.fromCodePoint(i),r+=s+1}return o}(e.data):e.data;this._handler.onMessage({data:e})}_isAppCompressedData(e){e=new Uint8Array(e);return 67===e[0]&&79===e[1]&&77===e[2]&&80===e[3]}_onError(e){this._handler.onError({id:this._id,e:e})}setIsWorkerEnabled(e){this._isWorkerEnabled=!0}close(e){if(this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),O)return $.offSocketClose(),$.offSocketMessage(),$.offSocketOpen(),$.offSocketError(),void $.closeSocket();this._socket&&(k?(this._socket.onClose(()=>{}),this._socket.onOpen(()=>{}),this._socket.onMessage(()=>{}),this._socket.onError(()=>{})):(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),A?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}send(e){this._workerSocket?this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?io(e.data).buffer:e.data}):O?$.sendSocketMessage({data:e.data,fail:()=>{e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket&&(k?this._socket.send({data:this._canIUseBinaryFrame?io(e.data).buffer:e.data,fail:()=>{e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket.send(this._canIUseBinaryFrame?io(e.data):e.data))}}const oo=4e3,ro=4001,ao="connected",co="connecting",lo="disconnected";class uo{constructor(e){this._chM=e,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=lo,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=je(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._currentSite=c,this._setWebsocketHost(),this._initConnection()}_setWebsocketHost(){const e=this._chM.get(Rs);this._currentSite=c,this._chM.isOversea()&&(this._currentSite=l),e.isSingaporeSite()?this._currentSite=u:e.isKoreaSite()?this._currentSite=d:e.isGermanySite()?this._currentSite=_:e.isIndiaSite()?this._currentSite=h:e.isJapanSite()?this._currentSite=p:e.isUSASite()?this._currentSite=g:e.isIndonesiaSite()&&(this._currentSite=m),f.HOST.setCurrent(this._currentSite)}_initConnection(){var e=this._chM.get(Rs).getSDKAppID()+"",t=this._chM.get(Rs).isIndependentDomainDisabled();$e(f.HOST.CURRENT.BACKUP)?this._url=f.HOST.CURRENT.DEFAULT:""===this._url?this._url=t?f.HOST.CURRENT.DEFAULT:f.HOST.CURRENT.DEFAULT0.replace("*",e):-1<this._url.indexOf(e)?this._url=f.HOST.CURRENT.DEFAULT:this._url===f.HOST.CURRENT.DEFAULT?this._url=f.HOST.CURRENT.IPV6||f.HOST.CURRENT.BACKUP:this._url===f.HOST.CURRENT.IPV6?this._url=f.HOST.CURRENT.BACKUP:this._url===f.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?f.HOST.CURRENT.ANYCAST:f.HOST.CURRENT.DEFAULT:this._url===f.HOST.CURRENT.ANYCAST&&(f.HOST.CURRENT.ANYCAST="",this._url=f.HOST.CURRENT.DEFAULT);const s=this._chM.get(Rs),i=s.getProxyServer();Oe(i)||(this._url=i),s.isTestEnv()&&(this._url=n.TEST[this._currentSite].DEFAULT),this._connect(),this._nextPingTs=0}_canIUseAnyCast(){return F&&f.HOST.CURRENT.ANYCAST}onCheckTimer(e){e%1==0&&(this._checkPromiseMap(),this._checkNativeAppWS())}_checkPromiseMap(){0!==this._promiseMap.size&&this._promiseMap.forEach((e,t)=>{const{reject:s,timestamp:i,headSeq:n}=e;let o=15e3;-1!==t.indexOf(ri.LOGIN)?o=9e4:-1!==t.indexOf(ri.PING)&&(o=3e3),Date.now()-i>=o&&(Ce.l(this._n+"._checkPromiseMap request timeout, delete requestID:"+t),this._promiseMap.delete(t),s(new Qs({code:ei.NETWORK_TIMEOUT,data:{headSeq:n}})),this._chM.onRequestTimeout())})}_checkNativeAppWS(){P&&!this.isConnected()&&this._reConnect()}onOpen(e){var t,s;this._readyState!==lo&&(this._onOpenTs=Date.now(),{id:e,res:t}=e,this._socketID=e,s=Dt(this._startTs,!1),e=`socketID:${e} res:`+t,Ce.l(this._n+`._onOpen cost:${s} ms. `+e),new Ti("wsOnOpen").setMessage(s).setCostTime(s).setMoreMessage(e).end(),this._readyState=ao,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}onClose(e){const t=new Ti("wsOnClose"),{id:s,e:i}=e,n=`sourceSocketID:${s} currentSocketID:${this._socketID} code:${i.code} reason:`+i.reason;let o=0;0!==this._onOpenTs&&(o=Date.now()-this._onOpenTs),t.setMessage(o).setCostTime(o).setMoreMessage(n).setCode(i.code).end(!0),Ce.l(this._n+`._onClose ${n} onlineTime:`+o),s===this._socketID&&(this._readyState=lo,o<1e3?this._chM.onReconnectFailed():this._chM.onClose())}onError(e){var{id:e,e:t}=e,s=`sourceSocketID:${e} currentSocketID:`+this._socketID;new Ti("wsOnError").setMessage(t.errMsg||JSON.stringify(t,["message","code"])).setMoreMessage(s).setLevel("error").end(!0),Ce.w(this._n+"._onError",t,s),e===this._socketID&&(this._readyState=lo,this._chM.onError())}onMessage(t){let s;try{s=JSON.parse(t.data)}catch(e){new Ti("jsonParseError").setMessage(t.data).end()}if(s&&s.head){const i=this._getRequestIDFromHead(s.head);let e=s.body;if(!this._chM.get(Bs).isTRTCCommand(i)){const t=ft(s.head);e=eo(s.body,this._getResKeyMap(t))}if(Ce.d(`${this._n}.onMessage ret:${JSON.stringify(e)} requestID:${i} has:`+this._promiseMap.has(i)),this._setNextPingTs(),this._promiseMap.has(i)){const{resolve:t,reject:s,timestamp:n,headSeq:o}=this._promiseMap.get(i);return this._promiseMap.delete(i),this._calcRTT(n),void(e.errorCode&&0!==e.errorCode?(this._chM.onErrorCodeNotZero(e),s(new Qs({code:e.errorCode,message:e.errorInfo||"",data:i.includes(ri.MODIFY_C2C_MSG)||i.includes(ri.MODIFY_GRP_MSG)?{elements:e.elements,messageVersion:e.messageVersion,cloudCustomData:e.cloudCustomData,headSeq:o}:{headSeq:o}}))):t(Zs(e)))}this._chM.onMessage({head:s.head,body:e})}}_calcRTT(e){e=Date.now()-e;this._chM.get($s).addRTT(e)}_connect(){this._readyState!==co&&this._readyState!==ao&&(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=co,this._socket=new no(this),this._socketID=this._socket.getID(),Ce.l(`${this._n}._connect isWorkerEnabled:${this.getIsWorkerEnabled()} socketID:${this._socketID} url:`+this.getURL()),new Ti("wsConnect").setMessage(`socketID:${this._socketID} url:`+this.getURL()).end())}getURL(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=ht();(O||S&&"windows"===e||P)&&(this._canIUseBinaryFrame=!1);let t=-1;"ios"===e?t=Y||-1:"android"===e&&(t=j||-1);const s=this._chM.get(Rs),i=this._chM.getPlatform();let n=`sdkappid=${s.getSDKAppID()}&instanceid=${s.getInstanceID()}&random=${this._getRandom()}&platform=${i}&host=${e}&version=${t}&sdkversion=3.5.2`;return D&&(n+="&isminigame=1"),this._chM.canIUseInflate()&&(n+="&compress=gzip"),this._canIUseBinaryFrame?this._url+"/binfo?"+n:this._url+"/info?"+n}_closeConnection(e){Ce.l(this._n+"._closeConnection socketID:"+this._socketID),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=lo)}_resend(){if(Ce.l(this._n+"._resend reConnectFlag:"+this._reConnectFlag,`promiseMap.size:${this._promiseMap.size} simpleRequestMap.size:`+this._simpleRequestMap.size),0<this._promiseMap.size&&this._promiseMap.forEach((e,t)=>{var{uplinkData:e,resolve:s,reject:i}=e;-1!==t.indexOf(ri.AV_POLLING)?this._promiseMap.delete(t):(this._promiseMap.set(t,{resolve:s,reject:i,timestamp:Date.now(),uplinkData:e}),this._execute(t,e))}),0<this._simpleRequestMap.size){for(var[e,t]of this._simpleRequestMap)this._execute(e,t);this._simpleRequestMap.clear()}}send(s){s.head.seq=this._getSequence(),s.head.reqtime=Math.floor(Date.now()/1e3),s.head.cs=this._calcCheckSum(s.head.servcmd,s.body);const{keyMap:e,...i}=s,n=this._getRequestIDFromHead(s.head),o=JSON.stringify(i);return new Promise((e,t)=>{this._promiseMap.set(n,{resolve:e,reject:t,timestamp:Date.now(),uplinkData:o,headSeq:s.head.seq}),Ce.d(`${this._n}.send uplinkData:${JSON.stringify(i)} requestID:${n} readyState:`+this._readyState),this._readyState!==ao?this._reConnect():(this._execute(n,o),this._chM.get($s).addRequestCount())})}simplySend(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3);const{keyMap:t,...s}=e,i=this._getRequestIDFromHead(e.head),n=JSON.stringify(s);this._readyState!==ao?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(i,n):Ce.l(this._n+".simplySend. simpleRequestMap is full, drop request!"),this._reConnect()):this._execute(i,n)}_execute(e,t){this._socket.send({data:t,fail:k?this._onSendFail.bind(this):void 0,requestID:e})}_onSendFail(e){Ce.l(this._n+"._onSendFail requestID:"+e),this._chM.onSendFail()}_getSequence(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=je()),e}_getRequestIDFromHead(e){var{servcmd:e,seq:t}=e;return e+t}_getResKeyMap(e){e=this._chM.getKeyMap(e);return{...Jn.res,...e.res}}_reConnect(){this._readyState!==ao&&this._readyState!==co&&this.forcedReconnect()}forcedReconnect(){var e=this._n+".forcedReconnect";Ce.l(e+` count:${this._reConnectCount} readyState:`+this._readyState),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(ro),this._initConnection()):(this._reConnectCount=0,this._chM.get(Os).isOnline()?(Ce.w(e+" disconnected from wsserver but network is ok, continue..."),this._closeConnection(ro),this._initConnection()):this._chM.onReconnectFailed())}getReconnectFlag(){return this._reConnectFlag}_setNextPingTs(){this._nextPingTs=P?Date.now()+5e3:Date.now()+1e4}getNextPingTs(){return this._nextPingTs}isConnected(){return this._readyState===ao}canIUseBinaryFrame(){return this._canIUseBinaryFrame}getSocketID(){return this._socketID}inflate(e){if(this._chM.canIUseInflate())return this._chM.get(Js).inflate(e)}setIsWorkerEnabled(e){Ce.l(this._n+".setIsWorkerEnabled flag:"+e),this._isWorkerEnabled=e}getIsWorkerEnabled(){return this._isWorkerEnabled&&ie}_getRandom(){return 0===this._random&&(this._random=Math.random()),this._random}_resetRandom(){this._random=0}_calcCheckSum(e,t){if(-1!==e.indexOf(ri.PING)||-1!==e.indexOf(ri.LOGIN)||-1!==e.indexOf(ri.LOGOUT)||-1!==e.indexOf(ri.AV_POLLING)||-1!==e.indexOf(ri.AV_NOAUTH_POLLING))return 0;var s=io(JSON.stringify(t));let i=4294967295;for(let e=0,t=s.length;e<t;e++){i^=s[e];for(let e=0;e<8;e++)1==(1&i)?i=i>>>1^3988292384:i>>>=1}return(4294967295^i)>>>0}close(){Ce.l(this._n+".close"),this._closeConnection(oo),this._promiseMap.clear(),this._startSequence=je(),this._readyState=lo,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}const _o=function(o,r,a){return new Promise((t,e)=>{var s="application/x-www-form-urlencoded;charset=UTF-8";if(k)$.request({url:r,data:a,method:o,timeout:3e3,header:{"content-type":s},success:e=>{e&&e.data&&e.data.NetCheckInfo&&Ce.l("getconninfo ok in miniapp. ret:",e.data),t()},fail:()=>{e(new Qs({code:ei.NETWORK_ERROR}))}});else{const i=new XMLHttpRequest,n=setTimeout(()=>{i.abort(),e(new Qs({code:ei.NETWORK_TIMEOUT}))},3e3);i.onreadystatechange=function(){4===i.readyState&&(n&&clearTimeout(n),200===i.status||304===i.status?(i.responseText&&-1<i.responseText.indexOf("NetCheckInfo")&&Ce.l("getconninfo ok in web. ret:",JSON.parse(i.responseText)),t()):e(new Qs({code:ei.NETWORK_ERROR})))},i.open(o,r,!0),i.setRequestHeader("Content-type",s),a?i.send(a):i.send()}})};class ho extends oi{constructor(e){super(e),this._n="ChannelModule",this._socketHandler=new uo(this),this._probing=!1,this._isAppShowing=!0,this._previousState=t.NET_STATE_CONNECTED,this._timerForNotLoggedIn=-1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._fatalErrorFlag=!1,this._disconnectedTS=0,this._lastDiagnoseTS=0}onCheckTimer(e){this._socketHandler&&(this.isLoggedIn()?(0<this._timerForNotLoggedIn&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}onErrorCodeNotZero(e){this.get(Gs).onErrorCodeNotZero(e)}onMessage(e){this.get(Gs).onMessage(e)}send(e){return this._socketHandler?this._previousState!==t.NET_STATE_CONNECTED&&e.head.servcmd.includes(ri.SSO_STAT)?(this.reConnect(),this.isPrivateNetWork()?Promise.resolve():this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}_sendLogViaHTTP(e){var t=`${f.HOST.CURRENT.STAT}/v4/imopenstat/tim_web_report_v2?sdkappid=${e.head.sdkappid}&reqtime=`+Date.now(),e=JSON.stringify(e.body);return _o("POST",t,e)}simplySend(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}onOpen(){this._ping()}onClose(){this._socketHandler&&this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED),this.reConnect()}onError(){k&&!P&&this.warn("DomainNameInMP"),this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}getKeyMap(e){return this.get(Gs).getKeyMap(e)}onRequestTimeout(){3e4<=Date.now()-this._lastDiagnoseTS&&this.diagnose()}onSendFail(){this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}onReconnected(){Ce.l(this._n+".onReconnected cost:"+Dt(this._disconnectedTS,!0,!0)),this._m.restartTimer(),this.get(Gs).onReconnected(Dt(this._disconnectedTS,!1,!1)),this._disconnectedTS=0,this._emitNetStateChangeEvent(t.NET_STATE_CONNECTED)}onReconnectFailed(){Ce.l(this._n+".onReconnectFailed"),this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}setIsWorkerEnabled(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}offline(){this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}reConnect(e=!1){let s=!1;this._socketHandler&&(s=this._socketHandler.getReconnectFlag());var i=`forcedFlag:${e} fatalErrorFlag:${this._fatalErrorFlag} previousState:${this._previousState} reconnectFlag:`+s;if(Ce.l(this._n+".reConnect "+i),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===t.NET_STATE_CONNECTING&&s)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(t.NET_STATE_CONNECTING)}}_emitNetStateChangeEvent(s){this._previousState!==s&&(Ce.l(`${this._n}._emitNetStateChangeEvent from ${this._previousState} to `+s),s===t.NET_STATE_DISCONNECTED&&0===this._disconnectedTS&&(this._disconnectedTS=Date.now(),this.diagnose()),this._previousState=s,this.emitOEvt(e.NET_STATE_CHANGE,{state:s}))}_ping(){var e;!0!==this._probing&&(this._probing=!0,e=this.get(Gs).getProtocolData({P:ri.PING}),this.send(e).then(()=>{this._probing=!1}).catch(e=>{this._probing=!1;var s=this.get(Os).isOnline();if(Ce.w(this._n+`._ping failed. bOnline:${s} error:`,e),e&&60002===e.code)return new Ti("error").setMessage(`code:${e.code} message:`+e.message).end(),this._fatalErrorFlag=!0,void this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED);s?this.reConnect():this._emitNetStateChangeEvent(t.NET_STATE_DISCONNECTED)}))}_checkNextPing(){this._socketHandler&&this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping()}dealloc(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),-1<this._timerForNotLoggedIn&&clearInterval(this._timerForNotLoggedIn)}onRestApiKickedOut(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}canIUseInflate(){return this._m.canIUseInflate()}getSocketID(){if(this._socketHandler)return this._socketHandler.getSocketID()}diagnose(){this.isPrivateNetWork()||(this._lastDiagnoseTS=Date.now(),this._diagnoseBySSO(),this._diagnoseByCDN())}_diagnoseBySSO(){const e=this._socketHandler.getURL(),t=e.split("/")[2];var s;t.startsWith("ws")&&(s=`https://${t}/v3/netcheck/getconninfo?${e.slice(e.indexOf("info?")+5)}&reqtime=`+Date.now(),_o("GET",s).catch(e=>{Ce.w(this._n+"._diagnoseBySSO failed. error:",e)}))}_diagnoseByCDN(){const e=this._socketHandler.getURL(),t=`https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?${e.slice(e.indexOf("info?")+5)}&reqtime=`+Date.now();_o("GET",t).catch(e=>{Ce.w(this._n+"._diagnoseByCDN failed. error:",e)})}reset(){Ce.l(this._n+".reset"),this._previousState=t.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0,this._lastDiagnoseTS=0}}class po{constructor(e){this._n="PHandler",this._sessionM=e,this._map=new Map,this._fillMap()}_fillMap(){this._map.clear();var i=this._sessionM.genCommonHead(),e=this._sessionM.genCosSpecifiedHead(),t=this._sessionM.genSSOReportHead();this._map.set(ri.LOGIN,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.LOGIN},body:{state:"Online",isWebUniapp:0,deviceBrand:0,customInfo:""},keyMap:{req:{deviceBrand:"InstType"},res:{InstId:"instanceID",HelloInterval:"helloInterval",RichMsgAuthKey:"authKey"}}}),this._map.set(ri.LOGOUT,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.LOGOUT},body:{type:0,isWebUniapp:0},keyMap:{req:{type:"wslogout_type"}}}),this._map.set(ri.HELLO,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.HELLO},body:{isWebUniapp:0},keyMap:{res:{NewInstInfo:"newInstanceInfo"}}}),this._map.set(ri.KICK_OTHER,{head:{...i,servcmd:f.NAME.STAT_SERVICE+"."+ri.KICK_OTHER},body:{}}),this._map.set(ri.COS_SIGN,{head:{...e,servcmd:f.NAME.IM_COS_SIGN+"."+ri.COS_SIGN},body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{req:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},res:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}),this._map.set(ri.COS_PRE_SIG,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ri.COS_PRE_SIG},body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{req:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},res:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}),this._map.set(ri.SIMPLE_COS_PRE_SIG,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ri.SIMPLE_COS_PRE_SIG},body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{req:{platform:"uint32_platform",SDKAppID:"uint32_sdkappid",userID:"str_user_id",uploadMethod:"uint32_upload_method",conversationType:"uint32_scene",uploadConfig:"rpt_upload_object",fileID:"uint32_file_id",fileType:"uint32_file_type",fileName:"str_file_name"},res:{str_final_ip:"uploadIP",rpt_pre_sig:"preSig",uint32_file_id:"fileID",uint32_exist_flag:"existFlag",str_download_url:"downloadUrl",str_upload_url:"uploadUrl",str_snapshot_url:"requestSnapshotUrl",str_file_key:"fileKey"}}}),this._map.set(ri.GET_IMAGE_INFO,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ri.GET_IMAGE_INFO},body:{imageUrl:""},keyMap:{req:{imageUrl:"str_image_url"},res:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(ri.GET_IP,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ri.GET_IP},body:{domainName:""},keyMap:{req:{domainName:"str_domain"},res:{str_final_ip:"ip"}}}),this._map.set(ri.VIDEO_COVER,{head:{...e,servcmd:f.NAME.CUSTOM_UPLOAD+"."+ri.VIDEO_COVER},body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{req:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},res:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}),this._map.set(ri.FETCH_COMMERCIAL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ri.FETCH_COMMERCIAL_CONFIG},body:{SDKAppID:0},keyMap:{req:{SDKAppID:"uint32_sdkappid"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(ri.PUSHED_COMMERCIAL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ri.PUSHED_COMMERCIAL_CONFIG},body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(ri.FETCH_CLOUD_CTRL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ri.FETCH_CLOUD_CTRL_CONFIG},body:{SDKAppID:0,version:0},keyMap:{req:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(ri.PUSHED_CLOUD_CTRL_CONFIG,{head:{...i,servcmd:f.NAME.IM_CONFIG_MANAGER+"."+ri.PUSHED_CLOUD_CTRL_CONFIG},body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(ri.OVERLOAD_NOTIFY,{head:{...i,servcmd:f.NAME.OVERLOAD_PUSH+"."+ri.OVERLOAD_NOTIFY},body:{},keyMap:{res:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}),this._map.set(ri.SYNC_UNREAD_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SYNC_UNREAD_MSG},body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1,needCachedMsg:1},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},res:{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"}}}),this._map.set(ri.GET_PROFANITY_LIST,{head:{...i,servcmd:f.NAME.IM_MSG_AUDIT_MGR+"."+ri.GET_PROFANITY_LIST},body:{version:0,deviceID:"",startIndex:void 0},keyMap:{req:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},res:{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"}}}),this._map.set(ri.SEND_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SEND_C2C_MSG},body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{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",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance"}}}),this._map.set(ri.SEND_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ri.SEND_GRP_MSG},body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:""},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{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",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance"},res:{MsgTime:"time",MsgSeq:"sequence"}}}),this._map.set(ri.REVOKE_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.REVOKE_C2C_MSG},body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{req:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}),this._map.set(ri.REVOKE_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ri.REVOKE_GRP_MSG},body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{req:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}),this._map.set(ri.GET_C2C_ROAMING_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.GET_C2C_ROAMING_MSG},body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{req:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},res:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}),this._map.set(ri.MODIFY_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.MODIFY_C2C_MSG},body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(ri.GET_GRP_ROAMING_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_ROAMING_MSG},body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{req:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",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",NextReqMsgSeq:"nextSequence"}}}),this._map.set(ri.SET_C2C_MSG_READ,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SET_C2C_MSG_READ},body:{C2CMsgReaded:void 0},keyMap:{req:{lastMessageTime:"LastedMsgTime"}}}),this._map.set(ri.SET_C2C_PEER_MUTE_NOTIFICATIONS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SET_C2C_PEER_MUTE_NOTIFICATIONS},body:{userIDList:void 0,muteFlag:0},keyMap:{req:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}),this._map.set(ri.GET_C2C_PEER_MUTE_NOTIFICATIONS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.GET_C2C_PEER_MUTE_NOTIFICATIONS},body:{toAccount:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Peer_Account"},res:{MuteNotificationsList:"muteFlagList"}}}),this._map.set(ri.SET_GRP_MSG_READ,{head:{...i,servcmd:f.NAME.GRP+"."+ri.SET_GRP_MSG_READ},body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{req:{messageReadSeq:"MsgReadedSeq"}}}),this._map.set(ri.SET_ALL_MSG_READ,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SET_ALL_MSG_READ},body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{req:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},res:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}),this._map.set(ri.DEL_C2C_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.DEL_C2C_MSG},body:{fromAccount:"",to:"",keyList:void 0},keyMap:{req:{keyList:"MsgKeyList"}}}),this._map.set(ri.DEL_GRP_MSG,{head:{...i,servcmd:f.NAME.GRP+"."+ri.DEL_GRP_MSG},body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{req:{deleter:"Deleter_Account",keyList:"Seqs"}}}),this._map.set(ri.TRANSLATE_TEXT,{head:{...i,servcmd:f.NAME.IM_OPEN_TRANSLATE+"."+ri.TRANSLATE_TEXT},body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{req:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},res:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(ri.VOICE_TO_TEXT,{head:{...i,servcmd:f.NAME.IM_OPEN_SPEECH+"."+ri.VOICE_TO_TEXT},body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{req:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},res:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(ri.MODIFY_GRP_MSG,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.MODIFY_GRP_MSG},body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(ri.GET_READ_RECEIPT,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_READ_RECEIPT},body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequence:"MsgSeq"}}}),this._map.set(ri.SEND_C2C_READ_RECEIPT,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.SEND_C2C_READ_RECEIPT},body:{peerAccount:"",messageInfoList:void 0},keyMap:{req:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}),this._map.set(ri.SEND_READ_RECEIPT,{head:{...i,servcmd:f.NAME.GRP+"."+ri.SEND_READ_RECEIPT},body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}),this._map.set(ri.GET_READ_RECEIPT_DETAIL,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_READ_RECEIPT_DETAIL},body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{req:{sequence:"MsgSeq",count:"Num"},res:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}),this._map.set(ri.MODIFY_C2C_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.MODIFY_C2C_MSG_EXT},body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(ri.GET_C2C_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_C2C_MSG_EXT},body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}),this._map.set(ri.MODIFY_GRP_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.MODIFY_GRP_MSG_EXT},body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(ri.GET_GRP_MSG_EXT,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_GRP_MSG_EXT},body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}),this._map.set(ri.ADD_C2C_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.ADD_C2C_MSG_REACTION},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(ri.RM_C2C_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.RM_C2C_MSG_REACTION},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(ri.GET_C2C_MSG_REACTIONS,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_C2C_MSG_REACTIONS},body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}),this._map.set(ri.GET_C2C_MSG_REACTION_USER_LIST,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_C2C_MSG_REACTION_USER_LIST},body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}),this._map.set(ri.ADD_GRP_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.ADD_GRP_MSG_REACTION},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(ri.RM_GRP_MSG_REACTION,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.RM_GRP_MSG_REACTION},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(ri.GET_GRP_MSG_REACTIONS,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_GRP_MSG_REACTIONS},body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{res:{MsgSeq:"messageSequence"}}}),this._map.set(ri.GET_GRP_MSG_REACTION_USER_LIST,{head:{...i,servcmd:f.NAME.OPEN_IM_MSG_EXT+"."+ri.GET_GRP_MSG_REACTION_USER_LIST},body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,nextSeq:void 0,count:void 0}}),this._map.set(ri.GET_C2C_PEER_READ_TIME,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.GET_C2C_PEER_READ_TIME},body:{userIDList:void 0},keyMap:{req:{userIDList:"To_Account"},res:{ReadTime:"peerReadTimeList"}}}),this._map.set(ri.PAGING_GET_CONV_LIST,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.PAGING_GET_CONV_LIST},body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:15,assistFlag:31},keyMap:{req:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},res:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}),this._map.set(ri.DEL_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.DEL_CONV},body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{req:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},res:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}),this._map.set(ri.CLEAR_HISTORY_MSG,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.CLEAR_HISTORY_MSG},body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{req:{toGroupID:"ToGroupid"}}}),this._map.set(ri.PIN_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.PIN_CONV},body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{req:{itemList:"RecentContactItem"}}}),this._map.set(ri.DEL_GROUP_AT_TIPS,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.DEL_GROUP_AT_TIPS},body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(ri.SET_CONV_CUSTOM_DATA,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.MARK_CONV},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ri.MARK_CONV,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.MARK_CONV},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ri.CREATE_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.CREATE_CONV_GRP},body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"GroupContactItem",groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(ri.DEL_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.DEL_CONV_GRP},body:{fromAccount:"",groupName:void 0},keyMap:{res:{GroupId:"convGroupID"}}}),this._map.set(ri.RENAME_CONV_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{req:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},res:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}),this._map.set(ri.ADD_CONV_TO_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}}}),this._map.set(ri.DEL_CONV_FROM_GRP,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.RENAME_CONV_GRP},body:{fromAccount:"",updateType:void 0,updateGroup:void 0}}),this._map.set(ri.GET_CONV_GRP_LIST,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.GET_CONV_GRP_LIST},body:{fromAccount:"",startIndex:void 0},keyMap:{res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}),this._map.set(ri.SEARCH_CONV_GRP_MARK,{head:{...i,servcmd:f.NAME.RECENT_CONTACT+"."+ri.SEARCH_CONV_GRP_MARK},body:{fromAccount:"",contactItem:void 0},keyMap:{req:{groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList",ContactResultItem:"contactItem"}}}),this._map.set(ri.GET_USER_PROFILE,{head:{...i,servcmd:f.NAME.PROFILE+"."+ri.GET_USER_PROFILE},body:{fromAccount:"",userItem:[]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(ri.UPDATE_MY_PROFILE,{head:{...i,servcmd:f.NAME.PROFILE+"."+ri.UPDATE_MY_PROFILE},body:{fromAccount:"",profileItem:[{tag:ye.NICK,value:""},{tag:ye.GENDER,value:""},{tag:ye.ALLOWTYPE,value:""},{tag:ye.AVATAR,value:""}]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(ri.GET_BL,{head:{...i,servcmd:f.NAME.FD+"."+ri.GET_BL},body:{fromAccount:"",startIndex:0,maxLimited:30}}),this._map.set(ri.ADD_TO_BL,{head:{...i,servcmd:f.NAME.FD+"."+ri.ADD_TO_BL},body:{fromAccount:"",toAccount:[]}}),this._map.set(ri.RM_FROM_BL,{head:{...i,servcmd:f.NAME.FD+"."+ri.RM_FROM_BL},body:{fromAccount:"",toAccount:[]}}),this._map.set(ri.SET_SELF_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.SET_SELF_STATUS},body:{customStatus:""}}),this._map.set(ri.GET_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.GET_USER_STATUS},body:{userIDList:void 0},keyMap:{res:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}),this._map.set(ri.SUB_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.SUB_USER_STATUS},body:{userIDList:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(ri.UNSUB_USER_STATUS,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.UNSUB_USER_STATUS},body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(ri.GET_FD_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ri.GET_FD_LIST},body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{res:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}),this._map.set(ri.ADD_FD,{head:{...i,servcmd:f.NAME.FD+"."+ri.ADD_FD},body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{req:{source:"AddSource",wording:"AddWording",type:"AddType"},res:{ResultItem:"resultList"}}}),this._map.set(ri.UPDATE_FD,{head:{...i,servcmd:f.NAME.FD+"."+ri.UPDATE_FD},body:{fromAccount:"",updateItem:void 0},keyMap:{req:{snsItem:"SnsItem"},res:{ResultItem:"resultList"}}}),this._map.set(ri.DEL_FD,{head:{...i,servcmd:f.NAME.FD+"."+ri.DEL_FD},body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"DeleteType"},res:{ResultItem:"resultList"}}}),this._map.set(ri.GET_FD_PROFILE,{head:{...i,servcmd:f.NAME.FD+"."+ri.GET_FD_PROFILE},body:{fromAccount:"",userIDList:void 0},keyMap:{res:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}),this._map.set(ri.CHECK_FD,{head:{...i,servcmd:f.NAME.FD+"."+ri.CHECK_FD},body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"CheckType"},res:{InfoItem:"resultList"}}}),this._map.set(ri.GET_FD_APPLICATION_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ri.GET_FD_APPLICATION_LIST},body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{res:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}),this._map.set(ri.RESPOND_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ri.RESPOND_FD_APPLICATION},body:{fromAccount:"",responseFriendItem:[]},keyMap:{req:{tag:"TagName",action:"ResponseAction"},res:{ResultItem:"resultList"}}}),this._map.set(ri.DEL_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ri.DEL_FD_APPLICATION},body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{req:{type:"PendencyType",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(ri.REPORT_FD_APPLICATION,{head:{...i,servcmd:f.NAME.FD+"."+ri.REPORT_FD_APPLICATION},body:{fromAccount:"",latestTimeStamp:""},keyMap:{req:{latestTimeStamp:"LatestPendencyTimeStamp"}}}),this._map.set(ri.CREATE_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ri.CREATE_FD_GRP},body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{req:{groupName:"GroupName",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(ri.DEL_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ri.DEL_FD_GRP},body:{fromAccount:"",nameList:void 0},keyMap:{req:{nameList:"GroupName"}}}),this._map.set(ri.GET_FD_GRP_LIST,{head:{...i,servcmd:f.NAME.FD+"."+ri.GET_FD_GRP_LIST},body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{res:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}),this._map.set(ri.UPDATE_FD_GRP,{head:{...i,servcmd:f.NAME.FD+"."+ri.UPDATE_FD_GRP},body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{req:{oldName:"GroupOldName",newName:"GroupNewName"},res:{UpdateType:"type",ResultItem:"resultList"}}}),this._map.set(ri.GET_GRP_LIST,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_LIST},body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0,needAppDefineData:1},keyMap:{req:{memberAccount:"Member_Account"},res:{GroupIdList:"groups",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime",AppDefinedData:"groupCustomField"}}}),this._map.set(ri.GET_GRP_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_PROFILE},body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{req:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(ri.CREATE_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.CREATE_GRP},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:{req:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},res:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}),this._map.set(ri.DISMISS_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.DISMISS_GRP},body:{groupID:void 0}}),this._map.set(ri.UPDATE_GRP_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ri.UPDATE_GRP_PROFILE},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:{req:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},res:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(ri.APPLY_JOIN_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.APPLY_JOIN_GRP},body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{req:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},res:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}),this._map.set(ri.APPLY_JOIN_GRP_NOAUTH,function(){const{a2:e,tinyid:t,...s}=i;return{head:{...s,servcmd:f.NAME.BIG_GRP_NO_AUTH+"."+ri.APPLY_JOIN_GRP},body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{req:{applyMessage:"ApplyMsg"},res:{HugeGroupFlag:"avChatRoomFlag"}}}}()),this._map.set(ri.QUIT_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.QUIT_GRP},body:{groupID:void 0}}),this._map.set(ri.SEARCH_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.SEARCH_GRP},body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}}}),this._map.set(ri.CHANGE_GRP_OWNER,{head:{...i,servcmd:f.NAME.GRP+"."+ri.CHANGE_GRP_OWNER},body:{groupID:void 0,newOwnerID:void 0},keyMap:{req:{newOwnerID:"NewOwner_Account"}}}),this._map.set(ri.HANDLE_GRP_APPLICATION,{head:{...i,servcmd:f.NAME.GRP+"."+ri.HANDLE_GRP_APPLICATION},body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(ri.HANDLE_INVITE_JOIN_GRP,{head:{...i,servcmd:f.NAME.GRP+"."+ri.HANDLE_INVITE_JOIN_GRP},body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}),this._map.set(ri.HANDLE_GRP_INVITATION,{head:{...i,servcmd:f.NAME.GRP+"."+ri.HANDLE_GRP_INVITATION},body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(ri.GET_GRP_PENDENCY,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_PENDENCY},body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{req:{handleAccount:"Handle_Account"},res:{To_Account:"userID",ApplyInviteMsg:"note"}}}),this._map.set(ri.DEL_GRP_SYSTEM_NOTICE,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.DEL_GRP_SYSTEM_NOTICE},body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(ri.AV_POLLING,{head:{...i,servcmd:f.NAME.BIG_GRP_POLLING+"."+ri.AV_POLLING},body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}),this._map.set(ri.AV_NOAUTH_POLLING,function(){const{a2:e,tinyid:t,...s}=i;return{head:{...s,servcmd:f.NAME.BIG_GRP_POLLING_NO_AUTH+"."+ri.AV_POLLING},body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}()),this._map.set(ri.GET_ONLINE_MBR_NUM,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_ONLINE_MBR_NUM},body:{groupID:void 0},keyMap:{res:{OnlineMemberNum:"memberCount"}}}),this._map.set(ri.SET_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.SET_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(ri.MODIFY_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.MODIFY_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(ri.DEL_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.DEL_GRP_ATTR},body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key"}}}),this._map.set(ri.CLEAR_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.CLEAR_GRP_ATTR},body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}),this._map.set(ri.GET_GRP_ATTR,{head:{...i,servcmd:f.NAME.GRP_ATTR+"."+ri.GET_GRP_ATTR},body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{req:{avChatRoomKey:"Key",groupType:"GroupType"}}}),this._map.set(ri.GET_GRP_NOTIFY,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_NOTIFY},body:{notifyReqList:[]},keyMap:{req:{notifyReqList:"NotifyReqList"},res:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}),this._map.set(ri.UPDATE_GRP_COUNTER,{head:{...i,servcmd:f.NAME.GRP+"."+ri.UPDATE_GRP_COUNTER},body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{req:{counterList:"GroupCounter"}}}),this._map.set(ri.GET_GRP_COUNTER,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_COUNTER},body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{req:{keyList:"GroupCounterKeys"}}}),this._map.set(ri.CREATE_TOPIC,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ri.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:{req:{avatar:"FaceUrl"}}}),this._map.set(ri.DEL_TOPIC,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ri.DEL_TOPIC},body:{groupID:void 0,topicIDList:void 0},keyMap:{req:{topicIDList:"TopicIdList"},res:{DestroyResultItem:"resultList"}}}),this._map.set(ri.UPDATE_TOPIC_PROFILE,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ri.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:{req:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}),this._map.set(ri.GET_TOPIC_LIST,{head:{...i,servcmd:f.NAME.GRP_COMMUNITY+"."+ri.GET_TOPIC_LIST},body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{req:{topicIDList:"TopicIdList"},res:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}),this._map.set(ri.GET_GRP_MBR_LIST,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_MBR_LIST},body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}),this._map.set(ri.GET_AV_MBR_LIST,{head:{...i,servcmd:f.NAME.GRP_AV+"."+ri.GET_AV_MBR_LIST},body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{req:{offset:"Timestamp",filter:"Mark"},res:{NextTimestamp:"offset"}}}),this._map.set(ri.GET_GRP_MBR_PROFILE,{head:{...i,servcmd:f.NAME.GRP+"."+ri.GET_GRP_MBR_PROFILE},body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}),this._map.set(ri.ADD_GRP_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.ADD_GRP_MBR},body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{req:{userID:"Member_Account",userIDList:"MemberList"},res:{MemberList:"members"}}}),this._map.set(ri.DEL_GRP_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.DEL_GRP_MBR},body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{req:{userIDList:"MemberToDel_Account"}}}),this._map.set(ri.BAN_AV_MBR,{head:{...i,servcmd:f.NAME.GRP+"."+ri.BAN_AV_MBR},body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{req:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}),this._map.set(ri.MODIFY_GRP_MBR_INFO,{head:{...i,servcmd:f.NAME.GRP+"."+ri.MODIFY_GRP_MBR_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:{req:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}),this._map.set(ri.MARK_AV_MBR_INFO,{head:{...i,servcmd:f.NAME.GRP_AV+"."+ri.MARK_AV_MBR_INFO},body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{req:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},res:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}),this._map.set(ri.CS,{head:{...i,servcmd:f.NAME.MSG_SEARCH+"."+ri.CS},body:{keywordList:void 0,keywordListMatchType:"or",account:void 0,groupID:void 0,count:100,cursor:void 0,messageTypeList:void 0,senderUserIDList:void 0,startTime:void 0,endTime:void 0},keyMap:{req:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList",keywords:"Keywords",keywordMatchType:"KeywordMatchType",count:"Count",miniBirthday:"UserBirthStart",maxBirthday:"UserBirthEnd",gender:"UserGenderType",groupTypeList:"GroupType",groupIDList:"GroupIdList"},res:{GroupID:"groupID",UserID:"userID",ErrorCode:"code",ErrorInfo:"message",TotalCount:"totalCount",Count:"messageCount",LastMsgTime:"lastMessageTime",ConversationMsgs:"searchResult",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer",MsgSeq:"sequence",ReqMsgSeq:"sequence",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgContent:"content",ClientSeq:"clientSequence",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",Users:"userList",ProfileItems:"profileItems",StrValue:"value",IntValue:"value",Groups:"groupList",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupOwnerUserID:"ownerID",GroupOwnerUserName:"ownerNick",GroupOwnerTinyID:"ownerTinyID",GroupMemberNum:"memberNum",GroupName:"name",GroupType:"type",GroupMembers:"groupMemberList",GroupMemberUserID:"userID",GroupMemberTinyID:"userTinyID",GroupMemberUserName:"nick",GroupMemberNameCard:"nameCard"}}}),this._map.set(ri.USER_CS,{head:{...i,servcmd:f.NAME.USER_SEARCH+"."+ri.CS},body:{keywords:void 0,keywordMatchType:0,miniBirthday:void 0,maxBirthday:void 0,gender:void 0,count:20,cursor:void 0}}),this._map.set(ri.GRP_CS,{head:{...i,servcmd:f.NAME.GRP_SEARCH+"."+ri.CS},body:{keywords:void 0,keywordMatchType:0,groupType:void 0,count:20,cursor:void 0}}),this._map.set(ri.MBR_CS,{head:{...i,servcmd:f.NAME.GRP_MEMBER_SEARCH+"."+ri.CS},body:{keywords:void 0,keywordMatchType:0,groupType:void 0,groupIDList:void 0,count:20,cursor:void 0}}),this._map.set(ri.SSO_STAT,{head:{...t,servcmd:f.NAME.IM_OPEN_STAT+"."+ri.SSO_STAT},body:{header:{},event:[],quality:[]},keyMap:{req:{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"}}}),this._map.set(ri.PING,{head:{...i,servcmd:f.NAME.HEARTBEAT+"."+ri.PING},body:{}}),this._map.set(ri.MSG_PUSH,{head:{...i,servcmd:f.NAME.IM_OPEN_PUSH+"."+ri.MSG_PUSH},body:{},keyMap:{res:{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"}}}),this._map.set(ri.MULTI_MSG_PUSH,{head:{...i,servcmd:f.NAME.IM_OPEN_PUSH+"."+ri.MULTI_MSG_PUSH},body:{},keyMap:{res:{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"}}}),this._map.set(ri.MSG_PUSH_ACK,{head:{...i,servcmd:f.NAME.OPEN_IM+"."+ri.MSG_PUSH_ACK},body:{sessionData:void 0},keyMap:{req:{sessionData:"SessionData"}}}),this._map.set(ri.STATUS_FORCE_OFFLINE,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.STATUS_FORCE_OFFLINE},body:{},keyMap:{res:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}),this._map.set(ri.DOWNLOAD_MERGER_MSG,{head:{...i,servcmd:f.NAME.IM_LONG_MSG+"."+ri.DOWNLOAD_MERGER_MSG},body:{downloadKey:""},keyMap:{res:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(ri.UPLOAD_MERGER_MSG,{head:{...i,servcmd:f.NAME.IM_LONG_MSG+"."+ri.UPLOAD_MERGER_MSG},body:{messageList:[]},keyMap:{req:{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"}}}),this._map.set(ri.FOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ri.FOLLOW},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"FollowItem"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ri.UNFOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ri.UNFOLLOW},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ri.GET_FOLLOW_INFO,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ri.GET_FOLLOW_INFO},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{FollowInfo:"followInfoList",To_Account:"userID",FollowerCount:"followersCount",FollowingCount:"followingCount",MutualFollowingCount:"mutualFollowersCount"}}}),this._map.set(ri.GET_FOLLOW,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ri.GET_FOLLOW},body:{fromAccount:"",type:1,nextCursor:"",count:500},keyMap:{req:{type:"FollowType",nextCursor:"StartCursor",count:"WantNum"},res:{FollowItem:"resultList",To_Account:"userID",ProfileItem:"profileList"}}}),this._map.set(ri.CHECK_FOLLOW_TYPE,{head:{...i,servcmd:f.NAME.FOLLOW+"."+ri.CHECK_FOLLOW_TYPE},body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(ri.SET_TOKEN,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.SET_TOKEN},body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0,notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:""},keyMap:{req:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns",notificationStatus:"NotificationStatus",deviceModel:"DeviceModel",systemVersion:"SystemVersion",pushVersion:"PushPluginVersion"}}}),this._map.set(ri.STAT_FOREGROUND,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.STAT_FOREGROUND},body:{isWebUniapp:0}}),this._map.set(ri.STAT_BACKGROUND,{head:{...i,servcmd:f.NAME.IM_OPEN_STATUS+"."+ri.STAT_BACKGROUND},body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{req:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}),this._map.set(ri.PUSH_REPORT,{head:{...i,servcmd:f.NAME.OFFLINE_PUSH_REPORT+"."+ri.PUSH_REPORT},body:{eventList:[]},keyMap:{req:{eventList:"UinappPushEvents",type:"EventType",time:"EventTime",pushId:"ClickExt"}}}),this._map.set(ri.SET_ALL_RECEIVE_MSG_OPT,{head:{...i,servcmd:f.NAME.IM_MSG_LOGIC+"."+ri.SET_ALL_RECEIVE_MSG_OPT},body:{startTime:0,endTime:0,isRepeated:0,messageRemindType:0},keyMap:{req:{messageRemindType:"Level"}}}),this._map.set(ri.GET_ALL_RECEIVE_MSG_OPT,{head:{...i,servcmd:f.NAME.IM_MSG_LOGIC+"."+ri.GET_ALL_RECEIVE_MSG_OPT},body:{toAccount:void 0}})}has(e){return this._map.has(e)}get(e){return this._map.get(e)}update(){this._fillMap()}getKeyMap(e){return this.has(e)?this.get(e).keyMap||{}:(Ce.w(this._n+".getKeyMap unknown P:"+e),{})}getProtocolData(e){const{P:t,data:s}=e,i=this.get(t);let n=null;if(s){const e=this._simpleDeepCopy(i),t=this._updateService(s,e),o=t.body,r=Object.create(null);for(const i in o)if(Object.prototype.hasOwnProperty.call(o,i)){if(r[i]=o[i],void 0===s[i])continue;r[i]=s[i]}t.body=r,n=this._getUplinkData(t)}else n=this._getUplinkData(i);return n}_getUplinkData(e){const t=this._dataCleaner(e),s=ft(t.head),i=Qn(t.body,this._getReqKeyMap(s));return t.body=i,t}_updateService(i,n){var o=ft(n.head);if(this._isFromGroupRequest(n)){let{type:e,groupID:t,groupIDList:s=[]}=i;$e(t)&&(t=s[0]||""),ot({type:e,groupID:t})&&(n.head.servcmd=f.NAME.GRP_COMMUNITY+"."+o)}return n}_isFromGroupRequest(e){return e.head.servcmd.includes(f.NAME.GRP)||e.head.servcmd.includes(f.NAME.GRP_ATTR)}_getReqKeyMap(e){e=this.getKeyMap(e);return{...Jn.req,...e.req}}_dataCleaner(e){const t=Array.isArray(e)?[]:Object.create(null);for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&He(s)&&null!==e[s]&&void 0!==e[s]&&("object"!=typeof e[s]?t[s]=e[s]:t[s]=this._dataCleaner.bind(this)(e[s]));return t}_simpleDeepCopy(s){const i=Object.keys(s),n={};var o;for(let e=0,t=i.length;e<t;e++)o=i[e],Fe(s[o])?n[o]=Array.from(s[o]):we(s[o])?n[o]=this._simpleDeepCopy(s[o]):n[o]=s[o];return n}}const go=[ri.MSG_PUSH_ACK];class mo{constructor(e){this._sessionM=e,this._n="MsgDispatcher",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._onC2CMsgArray.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._onGroupMsgArray.bind(this)),this._eventHandlerMap.set("groupTips",this._onGroupTips.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._onC2CNotifyMsgArray.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._onC2CReadReceiptArray.bind(this)),this._eventHandlerMap.set("profileModify",this._onProfileModified.bind(this)),this._eventHandlerMap.set("friendListMod",this._onRelationChainModified.bind(this)),this._eventHandlerMap.set("recentContactMod",this._onRecentContact.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._onAllMsgRead.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._onC2CMsgModified.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._onGroupMsgModified.bind(this)),this._eventHandlerMap.set("userStatusList",this._onUserStatusList.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._onMsgExtNotify.bind(this)),this._eventHandlerMap.set("messageReactionNotifyList",this._onMsgReactionNotifyList.bind(this)),this._eventHandlerMap.set("messageReactionNotify",this._onMsgReactionNotify.bind(this)),this._eventHandlerMap.set("followChangeList",this._onFollowNotify.bind(this)),this._keys=[...this._eventHandlerMap.keys()]}_onC2CMsgArray(e){const t=this._sessionM.get(ys);e.dataList.forEach(e=>{var t;1===e.isSyncMessage&&(t=e.from,e.from=e.to,e.to=t)}),1===e.needSync&&this._sessionM.get(Us).syncOnNeed(),t.onNewMessage({dataList:e.dataList,isInstantMessage:!0})}_onC2CMsgModified(e){this._sessionM.get(ys).onMsgModified(e)}_onGroupMsgArray(e){const t=this._sessionM.get(vs);t&&t.onNewMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}_onGroupMsgModified(e){const t=this._sessionM.get(vs);t&&t.onMsgModified(e)}_onGroupTips(e){const t=this._sessionM.get(vs);if(t){var{event:s,dataList:i,isInstantMessage:n=!0,isSyncingEnded:o}=e;switch(s){case 4:case 6:t.onNewGroupTips({event:s,dataList:i});break;case 5:for(let e=0;e<i.length;e++)if(Fe(i[e].elements.revokedInfos))t.onMsgRevoked({dataList:i});else if(Fe(i[e].elements.groupMessageReadNotice))t.onMsgReadNotice({dataList:i});else{if(!Fe(i[e].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:i,isInstantMessage:n,isSyncingEnded:o});break}t.onReadReceiptList({dataList:i})}break;case 12:this._sessionM.get(Ds).onNewGroupAtTips({dataList:i});break;default:Ce.l(this._n+`._onGroupTips unknown event:${s} dataList:`,i)}}}_onC2CNotifyMsgArray(e){const t=e["dataList"];if(Fe(t)){const s=this._sessionM.get(ys);t.forEach(e=>{if(be(e))if(e.hasOwnProperty("kickoutMsgNotify")){const{kickoutMsgNotify:{kickType:t,newInstanceInfo:s={}}}=e;1===t?this._sessionM.onMultipleAccountKickedOut(s):2===t?this._sessionM.onMultipleDeviceKickedOut(s):3===t&&this._sessionM.onRestApiKickedOut(s)}else e.hasOwnProperty("c2cMessageRevokedNotify")?s&&s.onMsgRevoked({dataList:t},!0):e.hasOwnProperty("c2cMessageReadReceipt")?s&&s.onMsgReadReceipt({dataList:t}):e.hasOwnProperty("c2cMessageReadNotice")?s&&s.onMsgReadNotice({dataList:t}):e.hasOwnProperty("muteNotificationsSync")&&this._sessionM.get(Ds).onC2CMsgRemindTypeSynced({dataList:t})})}}_onC2CReadReceiptArray(e){this._sessionM.get(ys).onReadReceiptList(e)}_onProfileModified(e){this._sessionM.get(Ts).onProfileModified({dataList:e.dataList});const t=this._sessionM.get(Es);t&&t.onFriendProfileModified({dataList:e.dataList})}_onRelationChainModified(e){this._sessionM.get(Ts).onRelationChainModified({dataList:e.dataList});const t=this._sessionM.get(Es);t&&t.onRelationChainModified({dataList:e.dataList})}_onRecentContact(e){const t=e["dataList"];if(Fe(t)){const o=this._sessionM.get(Ds);o&&t.forEach(e=>{const t=e["pushType"];if(1===t){const t=e["recentContactDeleteItem"];o.onConvDeleted(t.recentContactList)}else if(2===t){const t=e["recentContactTopItem"];o.onConvPinnedStatus(t.recentContactList,!0)}else if(3===t){const t=e["recentContactTopItem"];o.onConvPinnedStatus(t.recentContactList,!1)}else if(4===t){const t=e["recentContactMarkContact"];o.onConvMarkUpdated(t.recentContactMarkContactItem)}else if(5===t){const t=e["recentContactCreateContactGroup"];o.onConvGroupCreated(t.msgContactGroupContactItem)}else if(6===t){const t=e["recentContactDelContactGroup"];o.onConvGroupDeleted(t.msgGroupItem)}else if(7===t){const t=e["recentContactUpdateContactGroup"],{updateType:s,msgUpdateGroup:i,msgUpdateContact:n}=t;if(1===s){const e=i["updateGroupType"];1===e?o.onConvGroupNameUpdated(i):2===e&&o.onConvInGroupUpdated(i)}else 2===s&&o.onConvAddedToOrDeletedFromGroup(n)}})}}_onAllMsgRead(e){const t=e["dataList"],s=this._sessionM.get(Ds);s&&s.onPushedAllMessageRead(t)}_onUserStatusList(e){this._sessionM.get(Ts).onUserStatusUpdated(e)}_onMsgExtNotify(e){this._sessionM.get(Cs).onMsgExtNotify(e)}_onMsgReactionNotifyList(e){this._sessionM.get(Ys).onReactionNotifyList(e)}_onMsgReactionNotify(e){this._sessionM.get(Ys).onReactionNotify(e)}_onFollowNotify(e){this._sessionM.get(zs).onFollowNotify(e)}_onTopicLatestMsg(e){this._sessionM.get(Ss).onTopicLatestMsg(e)}onMessage(s){var e=s["body"];if(this._filterMsgFromIMOpenPush(s)){var{eventArray:i,isInstantMessage:n,isSyncingEnded:o,needSync:r}=e;if(Fe(i)){var a,c,l;for(let e=0,t=i.length;e<t;e++)if(100!==(l=(a=i[e]).event))if(24!==l)if(26!==l){const s=Object.keys(a).find(e=>-1!==this._keys.indexOf(e));s?(c=14===l?{readAllC2CMessage:a[s],groupMessageReadInfoList:a.groupMessageReadNotice||[]}:16===l?{userID:a.userID,timestamp:a.timestamp,readReceiptList:a[s]}:a[s],this._eventHandlerMap.get(s)({event:l,dataList:c,isInstantMessage:n,isSyncingEnded:o,needSync:r})):Ce.l(this._n+".onMessage unknown eventItem:",a)}else this._onTopicLatestMsg(a);else this._onAllRcvMsgOptNotify(a);else this._onRoomCustomData(a.content)}}}_onRoomCustomData(e){this._sessionM.get(Bs).onRoomCustomDataReceived(e),Ce.l(this._n+"._onRoomCustomData data:"+e)}_onAllRcvMsgOptNotify(e){this._sessionM.get(Ds).onAllRcvMsgOptNotify(e)}_filterMsgFromIMOpenPush(e){const{head:t,body:s}=e,i=t["servcmd"];let n=!1;if(!(n=$e(i)?n:i.includes(f.NAME.IM_CONFIG_MANAGER)||i.includes(f.NAME.OVERLOAD_PUSH)||i.includes(f.NAME.STAT_SERVICE)))return!0;if(i.includes(ri.PUSHED_CLOUD_CTRL_CONFIG))this._sessionM.get(ws).onPushedConfig(s);else if(i.includes(ri.PUSHED_COMMERCIAL_CONFIG))this._sessionM.get(qs).onPushedConfig(s);else if(i.includes(ri.OVERLOAD_NOTIFY))this._sessionM.onPushedServerOverload(s);else if(i.includes(ri.KICK_OTHER)){const e=Date.now(),t=(this._sessionM.reLoginOnKickOther(),new Ti("kickOther")),s=this._sessionM.get(Ms).getLastWsHelloTs(),i=e-s;t.setMessage(`last wshello time:${s} diff:${i}ms`).end()}return!1}}const fo=[{cmd:ri.GET_GRP_PROFILE,interval:1,count:8},{cmd:ri.UPDATE_GRP_PROFILE,interval:1,count:8},{cmd:ri.GET_AV_MBR_LIST,interval:3,count:1},{cmd:ri.GET_GRP_PENDENCY,interval:1,count:15},{cmd:ri.GET_TOPIC_LIST,interval:1,count:10},{cmd:ri.SET_GRP_ATTR,interval:5,count:10},{cmd:ri.MODIFY_GRP_ATTR,interval:5,count:10},{cmd:ri.DEL_GRP_ATTR,interval:5,count:10},{cmd:ri.CLEAR_GRP_ATTR,interval:5,count:10},{cmd:ri.GET_GRP_ATTR,interval:5,count:20},{cmd:ri.UPDATE_GRP_COUNTER,interval:5,count:20},{cmd:ri.GET_GRP_COUNTER,interval:5,count:20},{cmd:ri.SET_ALL_MSG_READ,interval:1,count:1},{cmd:ri.GET_USER_STATUS,interval:5,count:20},{cmd:ri.SUB_USER_STATUS,interval:5,count:20},{cmd:ri.UNSUB_USER_STATUS,interval:5,count:20},{cmd:ri.CS,interval:5,count:20},{cmd:ri.GRP_CS,interval:5,count:20},{cmd:ri.MBR_CS,interval:5,count:20},{cmd:ri.USER_CS,interval:5,count:20},{cmd:ri.CHECK_FOLLOW_TYPE,interval:5,count:20},{cmd:ri.GET_GRP_ROAMING_MSG,interval:1,count:20},{cmd:ri.GET_C2C_ROAMING_MSG,interval:1,count:20}],Mo=new Map,Io=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];for(let e=0,t=Io.length;e<t;e++)Mo.set(e,Io[e]);function Co(s){let i,n,o=s,r="";for(let e=0,t=(o=s.length%8!=0?"0".repeat(8-s.length%8)+s:o).length;e<t;e+=8)i=parseInt(o.slice(e,e+4),2),n=parseInt(o.slice(e+4,e+8),2),r+=Mo.get(i)+Mo.get(n);return r}class To extends oi{constructor(e){super(e),this._n="SessionModule",this._platform=this.getPlatform(),this._pHandler=new po(this),this._msgDispatcher=new mo(this),this._cmdFreqLimitMap=new Map,this._cmdReqInfoMap=new Map,this._serverOverloadInfoMap=new Map,this._incrementalPullContactFlag=!0,this._init(),this.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_init(){this._updateCmdFreqLimitMap(fo)}_onCloudConfig(){var e=this.getCloudConfig("cmd_frequency_limit");$e(e)||(e=JSON.parse(e),this._updateCmdFreqLimitMap(e))}_updateCmdFreqLimitMap(e){e.forEach(e=>{this._cmdFreqLimitMap.set(e.cmd,{interval:e.interval,count:e.count})})}updateProtocolConfig(){this._pHandler.update()}req(e){Ce.d(this._n+".req options:",e);var t=e["P"];if(!this._pHandler.has(t))return Ce.w(this._n+".req unknown P:"+t),ni({code:ei.NO_PROTOCOL});var e=this.getProtocolData(e),s=e.head["servcmd"];let i;if(this._isFreqOverLimit(s))return i=ei.OVER_FREQUENCY_LIMIT,ni({code:i,message:this.getErrMsg(i,this._getCmd(s))});if(this._isServerOverload(s))return i=ei.OPEN_SERVICE_OVERLOAD_ERROR,ni({code:i,message:this.getErrMsg(i,this._getCmd(s))});const n=this.get(ks);return go.includes(t)?n.simplySend(e):n.send(e)}getKeyMap(e){return this._pHandler.getKeyMap(e)}genCommonHead(){const e=this.get(Rs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,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:12775283,sdkability_ext:Co(""),cappid:e.getApplicationID(),cs:0}}genCosSpecifiedHead(){const e=this.get(Rs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Co(""),cappid:e.getApplicationID(),cs:0}}genSSOReportHead(){const e=this.get(Rs);return{ver:"v4",platform:this._platform,websdkappid:a,websdkversion:r,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:12775283,sdkability_ext:Co(""),cappid:e.getApplicationID(),cs:0}}getProtocolData(e){return this._pHandler.getProtocolData(e)}trans(e){var{servcmd:e,data:t}=e,e={head:{...this.genCommonHead(),servcmd:e},body:t};return this.get(ks).send(e)}sendComboMessage(e){var{servcmd:e,data:t}=e,e={head:{...this.genCommonHead(),servcmd:e},body:t};return this.get(ks).send(e)}onErrorCodeNotZero(e){const t=e["errorCode"];if(t===ei.HELLO_ANSWER_KICKED_OUT){const{kickType:t,newInstanceInfo:s={}}=e;1===t?this.onMultipleAccountKickedOut(s):2===t?this.onMultipleDeviceKickedOut(s):3===t&&this.onRestApiKickedOut(s)}t!==ei.MSG_A2KEY_EXPIRED&&t!==ei.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(ks).reConnect())}onMessage(e){var t=e["body"],{needAck:t=0,sessionData:s}=t;1===t&&this._sendACK(s),this._msgDispatcher.onMessage(e)}onReconnected(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}reLoginOnKickOther(){Ce.l(this._n+".reLoginOnKickOther"),this._reLogin()}_reLoginOnReconnected(){Ce.l(this._n+"._reLoginOnReconnected"),this._reLogin()}_reLogin(){const _=this._n+"._reLogin";if(this.isLoggedIn()){let e=0;const s=this.get(Ms).getPushModule(),u=(s&&(e=s.getUniAppPlatform()),new Ti("reLogin"));this.req({P:ri.LOGIN,data:{isWebUniapp:e,customInfo:this.get(Rs).getCustomLoginInfo()}}).then(e=>{const{instanceID:s,customStatus:i}=e.data,n=this.get(Rs),o=Cn(i),r=(n.setStatusInstanceID(s),this.get(ks)),a=`socketID:${r.getSocketID()} instanceID:${s} customStatus:`+o,c=(u.setMessage(a).end(!0),Ce.l(_+" ok. "+a),n.getCustomStatus()!==o&&this.get(Ts).onUserStatusUpdated({dataList:[{to:this.getMyUserID(),statusType:t.USER_STATUS_ONLINE,customStatus:i}]}),r.diagnose(),this.get(Ds).syncConvList(this._incrementalPullContactFlag).then(()=>{Ce.l(_+", sync conv list ok."),this.get(Fs).start()}),this.get(vs)),l=(c&&c.updateLocalMainSequenceOnReconnected(),this.get(Ss)),d=(l.resetGetTopicTime(),l.getTopicListOnReconnected(),this.get(zs));d&&d.clearCacheOnReconnected()})}}onMultipleAccountKickedOut(e){this.get(Ms).onMultipleAccountKickedOut(e)}onMultipleDeviceKickedOut(e){this.get(Ms).onMultipleDeviceKickedOut(e)}_onUserSigExpired(){this.get(Ms).onUserSigExpired()}onRestApiKickedOut(e){this.get(Ms).onRestApiKickedOut(e)}_sendACK(e){this.req({P:ri.MSG_PUSH_ACK,data:{sessionData:e}})}_isFreqOverLimit(e){e=e.split(".")[1];if(!this._cmdFreqLimitMap.has(e))return!1;if(!this._cmdReqInfoMap.has(e))return this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;var{count:t,interval:s}=this._cmdFreqLimitMap.get(e),{startTime:i,requestCount:n}=this._cmdReqInfoMap.get(e);if(Date.now()-i>1e3*s)return this._cmdReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1;this._cmdReqInfoMap.set(e,{startTime:i,requestCount:n+=1});let o=t<n?!0:!1;return o}_isServerOverload(e){if(!this._serverOverloadInfoMap.has(e))return!1;var{overloadTime:t,waitingTime:s}=this._serverOverloadInfoMap.get(e);let i=!1;return i=Date.now()-t<=1e3*s||(this._serverOverloadInfoMap.delete(e),!1)}_getCmd(e){let t="";if(!e.includes("."))return t;var s=e.split(".")[1];for(const i in ri)if(ri[i]===s){t=i;break}return t}onPushedServerOverload(e){var{overloadCommand:e,waitingTime:t}=e;this._serverOverloadInfoMap.set(e,{overloadTime:Date.now(),waitingTime:t}),Ce.w(this._n+`.onPushedServerOverload waitingTime:${t}s cmd:`+this._getCmd(e))}reset(){Ce.l(this._n+".reset"),this._updateCmdFreqLimitMap(fo),this._cmdReqInfoMap.clear(),this._serverOverloadInfoMap.clear(),this._incrementalPullContactFlag=!0}}class yo extends oi{constructor(e){super(e),this._n="CloudControlModule",this._cloudConfig=new Map,this._expiredTime=0,this._version=0,this._isFetching=!1}getCloudConfig(e){return $e(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}getServerConfig(e){const t={code:0,data:""};return!$e(e)&&this._cloudConfig.has(e)&&(t.data=this._cloudConfig.get(e)),Promise.resolve(t)}_canFetch(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}fetchConfig(){const i=this._n+".fetchConfig",e=this._canFetch();if(Ce.l(i+" canFetch:"+e),e){const n=new Ti("fetchCloudCtrlConfig"),t=this.get(Rs).getSDKAppID();this._isFetching=!0,this.req({P:ri.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:t,version:this._version}}).then(e=>{this._isFetching=!1;var{version:t,cloudControlConfig:s}=e.data;n.setMessage(`version:${this._version} newVersion:${t} config:`+s).end(),Ce.l(i+" ok"),this._parse(e.data)}).catch(e=>{this._isFetching=!1,n.setError(e).end(),Ce.l(i+" failed. error:",e),this._setExpiredTime(12e4)})}}onPushedConfig(e){Ce.l(this._n+".onPushedConfig config:",e),new Ti("pushedCloudCtrlConfig").setMessage(`newVersion:${e.version} config:`+e.cloudControlConfig).end(),this._parse(e)}onCheckTimer(e){this._canFetch()&&this.fetchConfig()}_parse(e){var s=this._n+"._parse",{errorCode:t,errorMessage:i,cloudControlConfig:n,version:o,expiredTime:r}=e;if(0===t){if(this._version!==o){let t=null;try{t=JSON.parse(n)}catch(e){this.isPrivateNetWork()||Ce.e(s+" failed. config:",n)}t&&(this._cloudConfig.clear(),Object.keys(t).forEach(e=>{this._cloudConfig.set(e,t[e])}),this._version=o,this.emitIEvt(Yi.CLOUD_CONFIG))}this._setExpiredTime(1e3*r)}else $e(t)?(Ce.l(s+" failed. Invalid message format:",e),this._setExpiredTime(36e5)):(Ce.e(s+` errorCode:${t} errorMessage:`+i),this._setExpiredTime(12e4))}_setExpiredTime(e){this._expiredTime=Date.now()+e}reset(){Ce.l(this._n+".reset"),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}class vo extends oi{constructor(e){super(e),this._n="RecoverMsgModule",this.PULL_LIMIT_COUNT=15}start(){this._recoverGroupChat(),this._recoverC2CChat()}_recoverGroupChat(){const e=this._getLocalConvList().filter(e=>e.type===t.CONV_GROUP&&e.groupProfile.type!==t.GRP_AVCHATROOM),n=this.get(Ds);let o,r,a,c,l;const d=[];e.forEach(e=>{const{conversationID:s,lastMessage:i}=e;r=s.replace(t.CONV_GROUP,""),o=n.getLocalLastMessage(s),i&&0!==i.lastSequence&&o?(c=i.lastSequence,a=o.sequence,l=c-a,0<a&&1<=l&&l<300?this._recoverGroupMsg({groupID:r,localLastMessageSequence:a,remoteLastMessageSequence:c}):d.push(r)):d.push(r)}),this._getGroupNotice(d)}_recoverC2CChat(){const e=this._getLocalConvList().filter(e=>e.type===t.CONV_C2C),s=this.get(Ds);let i,n,o,r;const a=[Promise.resolve()];e.forEach(e=>{var{conversationID:e,lastMessage:t}=e;i=s.getLocalLastMessage(e),t&&0!==t.lastTime&&i&&(o=t.lastTime,n=i.time,r=o-n,0<n&&1<=r&&r<=600&&a.push(this._recoverC2CMsg({conversationID:e,localLastMessageTime:n,remoteLastMessageTime:o})))}),Promise.all(a).then(()=>{Ce.l(this._n+"._recoverC2CChat all done"),this.get(Us).syncOnReconnected()})}_getLocalConvList(){return this.get(Ds).getLocalConvList()}_recoverGroupMsg(e){const c=this._n+"._recoverGroupMsg",{groupID:l,localLastMessageSequence:d,remoteLastMessageSequence:_}=(Ce.l(c+" options:",e),e),u=JSON.stringify(e),h=new Ti("_recoverGroupMsg");h.setMessage(u),this._getGroupRoamingMsg({groupID:l,sequence:d}).then(n=>{const{complete:e,messageList:o}=n.data;if(!$e(o)){const n=o[0].sequence,s=o.map(e=>e.sequence),r=u+` complete:${e} sequenceList:`+s,a=(Ce.l(c+" "+r),n!==d&&n<_&&2!==e&&this._recoverGroupMsg({groupID:l,localLastMessageSequence:n,remoteLastMessageSequence:_}),h.setMessage(r).end(),this.get(vs));1<o.length&&o.sort((e,t)=>e.sequence-t.sequence);let i=!1;for(let e=0,s=o.length;e<s;e++)if(o[e].from===t.CONV_SYSTEM){i=!0;break}if(i)for(let e=0,s=o.length;e<s;e++){const n=o[e];n.from!==t.CONV_SYSTEM?a.onNewMessage({dataList:[n],isInstantMessage:!1,updateUnreadCount:!1}):a.onNewGroupTips({event:n.event,dataList:[n]})}else a.onNewMessage({dataList:o,isInstantMessage:!1,updateUnreadCount:!1})}}).catch(e=>{h.setError(e).end(),Ce.w(c+" failed. error:",e)})}_getGroupNotice(s){var e=s.length;if(Ce.l(this._n+"._getGroupNotice length:"+e),0!==e){const i=this.get(vs);if(e<=10)i.getNotice(s);else{let t=Math.floor(e/10);5<=t&&(t=5);for(let e=0;e<=t;e++)i.getNotice(s.slice(10*e,10*(e+1)))}}}_getGroupRoamingMsg(e){var{groupID:e,sequence:t}=e;return this.req({P:ri.GET_GRP_ROAMING_MSG,data:{groupID:e,count:this.PULL_LIMIT_COUNT,sequence:t+this.PULL_LIMIT_COUNT-1}})}_recoverC2CMsg(e){const o=this._n+"._recoverC2CMsg",{conversationID:r,localLastMessageTime:t,remoteLastMessageTime:a}=(Ce.l(o+" options:",e),e),c=JSON.stringify(e),l=new Ti("_recoverC2CMsg");return l.setMessage(c),this._getC2CRoamingMsg({conversationID:r,time:t}).then(e=>{const{complete:t,messageList:s}=e.data;if(!$e(s)){const e=s.length;this.get(ys).onNewMessage({dataList:s,isInstantMessage:!0});var i=s[e-1].time,n=s.map(e=>e.random),n=c+` complete:${t} randomList:`+n;if(Ce.l(o+" "+n),l.setMessage(n).end(),i<a&&1!==t)return this._recoverC2CMsg({conversationID:r,localLastMessageTime:i,remoteLastMessageTime:a})}}).catch(e=>{l.setError(e).end(),Ce.w(o+" failed. error:",e)})}_getC2CRoamingMsg(e){const{conversationID:s,time:i}=e;return this.req({P:ri.GET_C2C_ROAMING_MSG,data:{peerAccount:s.replace(t.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:i,direction:1}})}reset(){Ce.l(this._n+".reset")}}class Eo{constructor(){this._n="AvgE2EDelay",this._e2eDelayArray=[]}addMessageDelay(e){e=me()-e;0<=e&&this._e2eDelayArray.push(e)}_calcAvg(e,t){if(0===t)return 0;let s=0;return e.forEach(e=>{s+=e}),Mt(s/t,1)}_calcCountWithLimit(e){const{e2eDelayArray:t,min:s,max:i}=e;return t.filter(e=>s<=e&&e<i).length}_calcPercent(e,t){let s=Mt(e/t*100,2);return s=100<s?100:s}_checkE2EDelayException(e,t){var s=e.filter(e=>t<e);if(0<s.length){const t=s.length,i=Math.min(...s),n=Math.max(...s),o=this._calcAvg(s,t),r=Mt(t/e.length*100,2);50<r&&new Ti("messageE2EDelayException").setMessage(`count:${t} min:${i} max:${n} avg:${o} percent:`+r).setLevel("warning").end()}}getStatResult(){var e=this._e2eDelayArray.length;if(0===e)return null;const t=[...this._e2eDelayArray],s=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),i=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),n=this._calcPercent(s,e),o=this._calcPercent(i,e),r=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:s,percentOfCountLessThan1Second:n,countLessThan3Second:i,percentOfCountLessThan3Second:o,avgDelay:r}}reset(){this._e2eDelayArray.length=0}}class So{constructor(){this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}addRequestCount(){this._requestCount+=1}addRTT(e){this._rttArray.push(e)}_calcTotalCount(){return this._requestCount}_calcRTTCount(e){return e.length}_calcSuccessRateOfRequest(e,t){if(0===t)return 0;let s=Mt(e/t*100,2);return s=100<s?100:s}_calcAvg(e,t){if(0===t)return 0;let s=0;return e.forEach(e=>{s+=e}),parseInt(s/t)}_calcMax(){return Math.max(...this._rttArray)}_calcMin(){return Math.min(...this._rttArray)}getStatResult(){var e=this._calcTotalCount(),t=[...this._rttArray];if(0===e)return null;var s=this._calcRTTCount(t),i=this._calcSuccessRateOfRequest(s,e),t=this._calcAvg(t,s);return Ce.l(`${this._n}.getStatResult max:${this._calcMax()} min:${this._calcMin()} avg:`+t),this.reset(),{totalCount:e,rttCount:s,successRateOfRequest:i,avgRTT:t}}reset(){this._requestCount=0,this._rttArray.length=0}}class Do{constructor(){this._map=new Map}initMap(e){e.forEach(e=>{this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})})}addTotalCount(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).totalCount+=1,0))}addSuccessCount(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).successCount+=1,0))}addFailedCountOfUserSide(e){return!($e(e)||!this._map.has(e)||(this._map.get(e).failedCountOfUserSide+=1,0))}addCost(e,t){return!($e(e)||!this._map.has(e)||(this._map.get(e).costArray.push(t),0))}addFileSize(e,t){return!($e(e)||!this._map.has(e)||(this._map.get(e).fileSizeArray.push(t),0))}_calcSuccessRateOfBusiness(e){if($e(e)||!this._map.has(e))return-1;e=this._map.get(e);let t=Mt(e.successCount/e.totalCount*100,2);return t=100<t?100:t}_calcSuccessRateOfPlatform(e){if($e(e)||!this._map.has(e))return-1;var t=this._map.get(e);let s=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return s=100<(s=Mt(s,2))?100:s}_calcTotalCount(e){return $e(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}_calcSuccessCountOfBusiness(e){return $e(e)||!this._map.has(e)?-1:this._map.get(e).successCount}_calcSuccessCountOfPlatform(e){if($e(e)||!this._map.has(e))return-1;e=this._map.get(e);return e.successCount+e.failedCountOfUserSide}_calcAvg(e){return $e(e)||!this._map.has(e)?-1:e===hi?this._calcAvgSpeed(e):this._calcAvgCost(e)}_calcAvgCost(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;let s=0;return this._map.get(e).costArray.forEach(e=>{s+=e}),parseInt(s/t)}_calcAvgSpeed(e){let t=0,s=0;return this._map.get(e).costArray.forEach(e=>{t+=e}),this._map.get(e).fileSizeArray.forEach(e=>{s+=e}),parseInt(1e3*s/t)}getStatResult(e){var t=this._calcTotalCount(e);if(0===t)return null;var s=this._calcSuccessCountOfBusiness(e),i=this._calcSuccessRateOfBusiness(e),n=this._calcSuccessCountOfPlatform(e),o=this._calcSuccessRateOfPlatform(e),r=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:s,successRateOfBusiness:i,successCountOfPlatform:n,successRateOfPlatform:o,avgValue:r}}reset(e){$e(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}class Ro{constructor(){this._lastMap=new Map,this._currentMap=new Map}initMap(e){e.forEach(e=>{this._lastMap.set(e,new Map),this._currentMap.set(e,new Map)})}addMessageSequence(e){const{key:s,message:i}=e;if($e(s)||!this._lastMap.has(s)||!this._currentMap.has(s))return!1;const{conversationID:n,sequence:o}=i,r=n.replace(t.CONV_GROUP,"");if(0===this._lastMap.get(s).size)this._addCurrentMap(e);else if(this._lastMap.get(s).has(r)){const t=this._lastMap.get(s).get(r),i=t.length-1;o>t[0]&&o<t[i]?(t.push(o),t.sort(),this._lastMap.get(s).set(r,t)):this._addCurrentMap(e)}else this._addCurrentMap(e);return!0}_addCurrentMap(e){const{key:s,message:i}=e,{conversationID:n,sequence:o}=i,r=n.replace(t.CONV_GROUP,"");this._currentMap.get(s).has(r)||this._currentMap.get(s).set(r,[]),this._currentMap.get(s).get(r).push(o)}_copyData(t){if(!$e(t)){this._lastMap.set(t,new Map);let e=this._lastMap.get(t);for(var[s,i]of this._currentMap.get(t))e.set(s,i);e=null,this._currentMap.set(t,new Map)}}getStatResult(e){if($e(this._currentMap.get(e))||$e(this._lastMap.get(e)))return null;if(0===this._lastMap.get(e).size)return this._copyData(e),null;let i=0,n=0;if(this._lastMap.get(e).forEach((e,t)=>{var e=[...e.values()],s=e.length;i+=e[s-1]-e[0]+1,n+=s}),0===i)return null;let t=Mt(n/i*100,2);return 100<t&&(t=100),this._copyData(e),{totalCount:i,successCountOfMessageReceived:n,successRateOfMessageReceived:t}}reset(){this._currentMap.clear(),this._lastMap.clear()}}class Lo extends oi{constructor(e){super(e),this._n="QualityStatModule",this.TAG="im-ssolog-quality-stat",this.reportIndex=0,this.wholePeriod=!1,this._qualityItems=[ai,ci,li,ui,di,_i,hi,pi,gi,mi],this._messageSentItems=[li,ui,di,_i,hi],this._messageReceivedItems=[pi,gi,mi],this.REPORT_INTERVAL=120,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._statInfoArr=[],this._avgRTT=new So,this._avgE2EDelay=new Eo,this._rateMessageSent=new Do,this._rateMessageReceived=new Ro;const t=this.getIEmitInst();t.on(Yi.A2KEY_AND_TINYID_UPDATED,this._onLoginSuccess,this),t.on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_onLoginSuccess(){this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);const e=this.get(Ls),t=e.getItem(this.TAG,!1);!Oe(t)&&xe(t.forEach)&&(Ce.l(this._n+"._onLoginSuccess. logs count:"+t.length),t.forEach(e=>{this._statInfoArr.push(e)}),e.removeItem(this.TAG,!1))}_onCloudConfig(){const e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),s=this.getCloudConfig("q_rpt_tinyid_wl");$e(e)||(this.REPORT_INTERVAL=Number(e)),$e(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map(e=>Number(e))),$e(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}onCheckTimer(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}addRequestCount(){this._avgRTT.addRequestCount()}addRTT(e){this._avgRTT.addRTT(e)}addMessageDelay(e){this._avgE2EDelay.addMessageDelay(e)}addTotalCount(e){this._rateMessageSent.addTotalCount(e)||Ce.w(this._n+".addTotalCount invalid key:",e)}addSuccessCount(e){this._rateMessageSent.addSuccessCount(e)||Ce.w(this._n+".addSuccessCount invalid key:",e)}addFailedCountOfUserSide(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ce.w(this._n+".addFailedCountOfUserSide invalid key:",e)}addCost(e,t){this._rateMessageSent.addCost(e,t)||Ce.w(this._n+".addCost invalid key or cost:",e,t)}addFileSize(e,t){this._rateMessageSent.addFileSize(e,t)||Ce.w(this._n+".addFileSize invalid key or size:",e,t)}addMessageSequence(e){this._rateMessageReceived.addMessageSequence(e)||Ce.w(this._n+".addMessageSequence invalid key:",e.key)}_getQualityItem(e){let t={},s=Ii[this.get(Os).getNetworkType()];$e(s)&&(s=8);var i={qualityType:fi[e],timestamp:pe(),networkType:s,extension:""};switch(e){case ai:t=this._avgRTT.getStatResult();break;case ci:t=this._avgE2EDelay.getStatResult();break;case li:case ui:case di:case _i:case hi:t=this._rateMessageSent.getStatResult(e);break;case pi:case gi:case mi:t=this._rateMessageReceived.getStatResult(e)}return null===t?null:{...i,...t}}_report(e){let t=[],s=null;$e(e)?this._qualityItems.forEach(e=>{null!==(s=this._getQualityItem(e))&&(s.reportIndex=this.reportIndex,s.wholePeriod=this.wholePeriod,t.push(s))}):null!==(s=this._getQualityItem(e))&&(s.reportIndex=this.reportIndex,s.wholePeriod=this.wholePeriod,t.push(s)),Ce.d(this._n+"._report",t),0<this._statInfoArr.length&&(t=t.concat(this._statInfoArr),this._statInfoArr=[]);const i=this.get(Rs),n=i.getSDKAppID(),o=i.getTinyID();0<(t=It(this.REPORT_SDKAPPID_BLACKLIST,n)&&!Ct(this.REPORT_TINYID_WHITELIST,o)?[]:t).length&&this._doReport(t)}_doReport(t){var e={header:An(this),quality:t};this.req({P:ri.SSO_STAT,data:{...e}}).then(()=>{this.reportIndex++,this.wholePeriod=!1}).catch(e=>{Ce.w(this._n+"._doReport failed. error:",e),this._statInfoArr=this._statInfoArr.concat(t),this._flushAtOnce()})}_flushAtOnce(){const t=this.get(Ls),s=t.getItem(this.TAG,!1),i=this._statInfoArr,n=this._n+"._flushAtOnce";if(Oe(s))Ce.l(n+" count:"+i.length),t.setItem(this.TAG,i,!0,!1);else{let e=i.concat(s);10<e.length&&(e=e.slice(0,10)),Ce.l(n+" count:"+e.length),t.setItem(this.TAG,e,!0,!1)}this._statInfoArr=[]}reset(){Ce.l(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()}}class Ao extends oi{constructor(e){super(e),this._n="WorkerTimerModule",this._isWorkerEnabled=!0,this._workerTimer=null,this._timerID=-1,this._init(),this.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}isWorkerEnabled(){return this._isWorkerEnabled&&ie}startWorkerTimer(){Ce.l(this._n+".startWorkerTimer"),this._workerTimer&&this._workerTimer.postMessage("start")}stopWorkerTimer(){Ce.l(this._n+".stopWorkerTimer"),this._workerTimer&&this._workerTimer.postMessage("stop")}_init(){if(ie){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);const t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,Ce.l(t._n+"._init seed:"+t._timerID)):t._m.onCheckTimer()}}}_onCloudConfig(){var e=this.getCloudConfig("enable_worker");Ce.l(this._n+"._onCloudConfig enableWorker:"+e),$e(e)||"1"===e?!this._isWorkerEnabled&&ie&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&ie&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}terminate(){Ce.l(this._n+".terminate"),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}getTimerID(){return this._timerID}reset(){Ce.l(this._n+".reset")}}class Oo{constructor(e){this._commercialConfigM=e,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map}isValidPurchaseBits(e){return e&&"string"==typeof e&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}parsePurchaseBits(s){if(this.isValidPurchaseBits(s)){this._featureMap.clear();var n;for(let e=s.length-1,t=0;0<=e;e--,t++)n=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),"1"===s[e]?this._featureMap.set(n,!0):this._featureMap.set(n,!1)}else Ce.w(this._n+".parsePurchaseBits invalid purchasebits:"+s)}hasPurchasedFeature(e){return!!this._featureMap.get(e)}isFeatureEnabled(e){const s=parseInt(e).toString(2);let n=void 0,o=!0;for(let e=s.length-1,t=0;0<=e;e--,t++)if("1"===s.charAt(e)&&(n=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),!this._featureMap.get(n))){o=!1;break}return Ce.l(`${this._n}.isFeatureEnabled decimalNumber:${e} key:${n} ret:`+o),ii({enabled:o})}isFeatureEnabledForStat(e){const s=parseInt(e).toString(2);let n=void 0;for(let e=s.length-1,t=0;0<=e;e--,t++)if("1"===s.charAt(e)){if(n=(t<32?new i(0,Math.pow(2,t)):new i(Math.pow(2,t-32),0)).toString(),!this._featureMap.get(n))break;{let e="",t=0;if(n===M.PLUGIN_TRANSLATE?(e="plugin_translate",t=16):n===M.PLUGIN_VOICE_TO_TEXT?(e="plugin_voice_to_text",t=17):n===M.PLUGIN_CS?(e="plugin_cs",t=14):n===M.PLUGIN_PUSH?(e="plugin_push",t=13):n===M.PLUGIN_BOT?(e="plugin_bot",t=15):n===M.MSG_REACTION&&(e="plugin_emoji_reaction",t=18),""!==e){const n=this._commercialConfigM.get(Rs).getUIPlatform();new Ti(e).setCode(t).setUIPlatform(n).end(),Ce.l(`${this._n}.isFeatureEnabledForStat ${e} code:${t} uiPlatform:`+n)}}}}isCSPluginEnabled(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(Rs).getUIPlatform(),new Ti("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}clear(){this._featureMap.clear(),this._isCSPluginReported=!1}}class No{constructor(e){this._m=e,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Oo(this)}_canFetch(){return this.get(Rs).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}onCheckTimer(e){this._canFetch()&&this.fetchConfig()}fetchConfig(){const e=this._canFetch(),t=this._n+".fetchConfig";if(Ce.l(t+" canFetch:"+e),e){const s=new Ti("fetchCommercialConfig"),i=this.get(Rs).getSDKAppID(),n=this.get(Gs);this._isFetching=!0,n.req({P:ri.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:i}}).then(e=>{s.setMessage("purchaseBits:"+e.data.purchaseBits).end(),Ce.l(t+" ok."),this._parseConfig(e.data),this._isFetching=!1}).catch(e=>{s.setError(e).end(),this._isFetching=!1})}}onPushedConfig(e){var t=this._n+".onPushedConfig data:"+JSON.stringify(e);Ce.l(t),new Ti("pushedCommercialConfig").setMessage("purchaseBits:"+e.purchaseBits).end(),this._parseConfig(e)}_parseConfig(e){var t=this._n+"._parseConfig",{errorCode:s,errorMessage:i,purchaseBits:n,expiredTime:o}=e;0===s?(this._purchasedFeatureHandler.parsePurchaseBits(n),this._expiredTime=Date.now()+1e3*o):$e(s)?(Ce.l(t+" failed. Invalid message format:",e),this._setExpiredTimeOnResponseError(36e5)):(Ce.e(t+` errorCode:${s} errorMessage:`+i),this._setExpiredTimeOnResponseError(12e4))}_setExpiredTimeOnResponseError(e){this._expiredTime=Date.now()+e}canIUse(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}isFeatureEnabled(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}isFeatureEnabledForStat(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}isCSPluginEnabled(){this._purchasedFeatureHandler.isCSPluginEnabled()}get(e){return this._m.get(e)}reset(){Ce.l(this._n+".reset"),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}class Po extends oi{constructor(e){super(e),this._m=e,this._n="OfflinePushModule",this._offlinePushPlugin=void 0,this._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},this._deviceToken="",this._businessID=0,this._iosBusinessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0}registerPlugin(e){var t,s,i,n,o,r,a,c,l,d,_,u,h;P?(this._offlinePushPlugin=e["tim-offline-push-plugin"],{huaweiBusinessID:t,xiaomiBusinessID:s,xiaomiAppID:i,xiaomiAppKey:n,meizuBusinessID:o,meizuAppID:r,meizuAppKey:a,vivoBusinessID:c,oppoBusinessID:l,oppoAppKey:d,oppoAppSecret:_,honorBusinessID:u,iosBusinessID:h}=e.offlinePushConfig||{},this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=s,this._androidPushConfig.xiaomiPushAppId=i,this._androidPushConfig.xiaomiPushAppKey=n,this._androidPushConfig.meizuPushBussinessId=o,this._androidPushConfig.meizuPushAppId=r,this._androidPushConfig.meizuPushAppKey=a,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=_,this._androidPushConfig.honorPushBussinessId=u,new Ti("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:"+!$e(this._offlinePushPlugin)).end(!0),Ce.l(this._n+".registerPlugin ok. offlinePushConfig:"+JSON.stringify(e.offlinePushConfig)),this._iosBusinessID=h,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}init(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}_getDeviceToken(){const a=this._n+"._getDeviceToken";if(xe(this._offlinePushPlugin.getDeviceToken)){let r=`androidPushConfig:${JSON.stringify(this._androidPushConfig)}, iosBusinessID:`+this._iosBusinessID;Ce.l(a+" start. "+r),new Ti("_getDeviceToken").setMessage(r).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,e=>{const t=new Ti("getDeviceTokenRes"),{code:s,msg:i}=e;if(0===s){const{deviceToken:s,deviceBrand:i,deviceType:n,bussinessId:o}=e.data;this._deviceToken=s,this._businessID=o||this._iosBusinessID,r=`deviceToken:${s}, deviceBrand:${i||n}, businessID:`+this._businessID,Ce.l(a+" ok. "+r),t.setMessage(r).end(!0),this._setToken()}else t.setMessage(`code:${s}, msg:`+i).end(!0),Ce.e(a+" failed. error:",e)})}else Ce.e(a+" getDeviceToken is not a function")}canIUseOfflinePush(){return P&&!$e(this._offlinePushPlugin)}_setAppShowListener(){const t=this._n+"._setAppShowListener";$e(this._offlinePushPlugin)?Ce.e(t+" offlinePushPlugin is undefined"):xe(this._offlinePushPlugin.setAppShowListener)?(new Ti("_setAppShowListener").end(!0),Ce.l(t+" start"),this._offlinePushPlugin.setAppShowListener(e=>{e=(e||{}).appShow;new Ti("setAppShowListenerRes").setMessage("appShow:"+e).end(!0),Ce.l(t+" ok. appShow:"+e),this._m.isReady()&&(0===e?(this._getConvUnreadCount(),this._onBackground()):1===e&&this._onForeground())})):Ce.e(t+" setAppShowListener is not a function")}getDeviceBrand(){var e;if(!$e(this._offlinePushPlugin)&&xe(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{})["deviceType"],Ce.l(this._n+".getDeviceBrand ok. deviceType:"+e),e}_setToken(){const t=this._n+"._setToken",e=this.get(Rs);let s,i=1,n="",r="";Oe(this._deviceToken)&&(i=0);var a=this.getUniAppPlatform(),c=this.getDeviceBrand();a===o.IOS||a===o.IPAD||a===o.MAC?r=this._deviceToken:a===o.ANDROID&&(n=this._deviceToken);const l=new Ti("offlinePushSetToken");return s=`deviceToken:${r||n}, businessID:${this._businessID}, deviceBrand:${c}, isWebUniapp:${this._isWebUniapp}, pushMsg:${i}, platform:`+a,l.setMessage(s),Ce.l(t+" "+s),this.req({P:ri.SET_TOKEN,data:{tokenID:n,pushMsg:i,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:r,isWebUniapp:this._isWebUniapp}}).then(e=>(l.end(),Ce.l(t+" ok"),e)).catch(e=>(l.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)))}_getConvUnreadCount(){this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(Ds).getLocalConvList().forEach(e=>{e.type===t.CONV_C2C&&(this._c2cUnreadCount+=e.unreadCount),e.type===t.CONV_GROUP&&(this._groupUnreadCount+=e.unreadCount)})}_onBackground(){const t=this._n+"._onBackground",s=new Ti("_onBackground");this.req({P:ri.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(e=>(s.setMessage(`c2cUnreadCount: ${this._c2cUnreadCount}, groupUnreadCount: `+this._groupUnreadCount).end(),Ce.l(t+" ok"),e)).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_onForeground(){const t=this._n+"._onForeground",s=new Ti("_onForeground");this.req({P:ri.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(e=>(s.end(),Ce.l(t+" ok"),e)).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}getUniAppPlatform(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?o.IOS:"android"===e?o.ANDROID:1002===t?o.IPAD:1001===t?o.MAC:void 0}reset(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ce.l(this._n+".reset")}}class Uo extends oi{constructor(e){super(e),this._m=e,this._n="TIMPushModule",this._pluginName="TIMPush",this._pushPlugin=void 0,this._androidPushConfig={},this._deviceToken="",this._businessID=0,this._iOSBusinessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,this._deviceInfo={notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:"1.0.1",packageName:""}}registerPlugin(e){var t,s,i;P?(t=this._n+".registerPlugin",{androidConfig:s,iOSConfig:i}=(this._pushPlugin=e["tim-push"],this._getDeviceInfo(),e.pushConfig||{}),we(s)&&(this._androidPushConfig=s[this._deviceInfo.packageName]),s=(i||{}).iOSBusinessID,this._iOSBusinessID=s,i=!$e(this._pushPlugin),new Ti("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:"+i).end(!0),Ce.l(t+" ok. pushConfig:"+JSON.stringify(e.pushConfig)),i?(this._setAppShowListener(),this._setPushEventReportListener()):Ce.e(t+` ${this._pluginName} is undefined`)):this.warn("TIMPushInUniapp")}init(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(qs).isFeatureEnabledForStat(Math.pow(2,41))}_reportEventCacheList(){const r=this._n+"._reportEventCacheList";xe(this._pushPlugin.getPushEventCacheList)?(new Ti("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(e=>{const{code:t,data:{eventList:s}}=e,i=new Ti("getPushEventCacheListRes");if(i.setCode(t),0!==t)i.setMessage("res:"+JSON.stringify(e)).end(!0),Ce.e(r+" failed. error:"+JSON.stringify(e));else{var n=s.length<10?"eventList:"+JSON.stringify(s):"eventList.length:"+s.length;Ce.l(r+" ok. "+n),i.setMessage(n).end(!0);const o={...e.data,eventList:[]};for(;0<s.length;)o.eventList=s.splice(0,40),this._pushReport(o)}})):Ce.e(this._pluginName+".getPushEventCacheList is not a function")}_getDeviceToken(){const a=this._n+"._getDeviceToken";if(xe(this._pushPlugin.getDeviceToken)){let r=`androidPushConfig:${JSON.stringify(this._androidPushConfig)} iOSBusinessID:`+this._iOSBusinessID;Ce.l(a+" start. "+r),new Ti("_getDeviceToken").setMessage(r).end(!0),this._pushPlugin.getDeviceToken(this._androidPushConfig,e=>{const{code:t,msg:s}=e,i=new Ti("getDeviceTokenRes");if(i.setCode(t),0===t){const{deviceToken:t,deviceBrand:s,deviceType:n,bussinessId:o}=e.data;return this._deviceToken=t,this._businessID=o||this._iOSBusinessID,r=`deviceToken:${t} deviceBrand:${s||n} businessID:`+this._businessID,Ce.l(a+" ok. "+r),i.setMessage(r).end(!0),void this._setToken()}i.setMessage(s).end(!0),Ce.e(a+" failed. error:"+JSON.stringify(e))})}else Ce.e(this._pluginName+".getDeviceToken is not a function")}_getDeviceInfo(){var e=this._n+"._getDeviceInfo";if(xe(this._pushPlugin.getDeviceInfo)){const t=this._pushPlugin.getDeviceInfo(),{code:s,data:i}=t,n=new Ti("_getDeviceInfo");if(n.setCode(s),0===s){this._deviceInfo={...this._deviceInfo,...i},this._deviceInfo.pushVersion||(this._deviceInfo.pushVersion="1.0.1");const t="deviceInfo:"+JSON.stringify(this._deviceInfo);return Ce.l(e+" ok. "+t),void n.setMessage(t).end(!0)}n.setMessage("deviceInfoRes:"+JSON.stringify(t)).end(!0),Ce.e(e+" failed. error:"+JSON.stringify(t))}else Ce.e(this._pluginName+".getDeviceInfo is not a function")}canIUseTIMPush(){return P&&!$e(this._pushPlugin)}_setAppShowListener(){const t=this._n+"._setAppShowListener";xe(this._pushPlugin.setAppShowListener)?(new Ti("_setAppShowListener").end(!0),Ce.l(t+" start"),this._pushPlugin.setAppShowListener(e=>{e=(e||{}).appShow;new Ti("setAppShowListenerRes").setMessage("appShow:"+e).end(!0),Ce.l(t+" ok. appShow:"+e),this._m.isReady()&&(0===e?(this._getConvUnreadCount(),this._onBackground()):1===e&&this._onForeground())})):Ce.e(this._pluginName+".setAppShowListener is not a function")}_setPushEventReportListener(){const o=this._n+"._setPushEventReportListener";xe(this._pushPlugin.setPushEventReportListener)?(new Ti("_setPushEventReportListener").end(!0),this._pushPlugin.setPushEventReportListener(e=>{const{code:t,data:s}=e,i=s["eventList"],n=new Ti("setPushEventReportListenerRes");if(n.setCode(t),0===t){const e="eventList:"+JSON.stringify(i);return Ce.l(o+" ok. "+e),n.setMessage(e).end(!0),void(this._m.isReady()&&Fe(i)&&0<i.length&&this._pushReport(s))}n.setMessage("res:"+JSON.stringify(e)).end(!0),Ce.e(o+" failed. error:"+JSON.stringify(e))})):Ce.e(this._pluginName+".setPushEventReportListener is not a function")}getDeviceBrand(){var e;if(!$e(this._pushPlugin)&&xe(this._pushPlugin.getDeviceType))return e=(this._pushPlugin.getDeviceType()||{})["deviceType"],Ce.l(this._n+".getDeviceBrand ok. deviceType:"+e),e}_setToken(){const t=this._n+"._setToken",e=this.get(Rs);let s,i=1,n="",r="";Oe(this._deviceToken)&&(i=0);var a=this.getUniAppPlatform(),c=this.getDeviceBrand();a===o.IOS||a===o.IPAD||a===o.MAC?r=this._deviceToken:a===o.ANDROID&&(n=this._deviceToken);const l={tokenID:n,pushMsg:i,sdkAppID:e.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:r,isWebUniapp:this._isWebUniapp,...this._deviceInfo},d=new Ti("_setToken");s="data:"+JSON.stringify(l),d.setMessage(s),Ce.l(t+" "+s),this.req({P:ri.SET_TOKEN,data:l}).then(()=>{d.end(),Ce.w(t+" ok")}).catch(e=>{d.setError(e).end(),Ce.e(t+" failed. error:",e),ni(e)})}_getConvUnreadCount(){this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(Ds).getLocalConvList().forEach(e=>{e.type===t.CONV_C2C&&(this._c2cUnreadCount+=e.unreadCount),e.type===t.CONV_GROUP&&(this._groupUnreadCount+=e.unreadCount)})}_onBackground(){const t=this._n+"._onBackground",s=new Ti("_onBackground");this.req({P:ri.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(()=>{s.setMessage(`c2cUnreadCount:${this._c2cUnreadCount} groupUnreadCount:`+this._groupUnreadCount).end(),Ce.l(t+" ok")}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_onForeground(){const t=this._n+"._onForeground",s=new Ti("_onForeground");this.req({P:ri.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(()=>{s.end(),Ce.l(t+" ok")}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_pushReport(e){const t=this._n+"._pushReport",s=new Ti("_pushReport");this.req({P:ri.PUSH_REPORT,data:{eventList:e.eventList}}).then(()=>{s.end(),this._notifyReportSuccess(e)}).catch(e=>{s.setError(e).end(),Ce.e(t+" failed. error:",e)})}_notifyReportSuccess(e){!$e(this._pushPlugin)&&xe(this._pushPlugin.notifyReportSuccess)&&(this._pushPlugin.notifyReportSuccess(e),Ce.l(this._n+"._notifyReportSuccess ok"))}getUniAppPlatform(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?o.IOS:"android"===e?o.ANDROID:1002===t?o.IPAD:1001===t?o.MAC:void 0}reset(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ce.l(this._n+".reset")}}class Go extends oi{constructor(e){super(e),this._n="ProfanityFilterModule",this._plugin=null,this._filterConfigMap=new Map,this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}init(){const e=this.get(Ps).getPlugin("tim-profanity-filter-plugin");e&&(this._plugin=new e({logger:Ce,isArray:Fe,isMap:Ne,isDevMode:this.isDevMode()}),this._getLexicon())}onCheckTimer(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}filterMessage(e,s){let i=!0;if(!this._plugin||!this._canIUseLexicon)return i;if(s&&s.messageControlInfo&&!0===s.messageControlInfo.excludedFromContentModeration)return i;const{type:n,conversationType:o}=e;if(n!==t.MSG_TEXT&&n!==t.MSG_CUSTOM)return i;const r=this._n+".filterMessage";let a;if(Ce.l(""+r),n===t.MSG_TEXT){if(o===t.CONV_C2C?a=I:o===t.CONV_GROUP&&(a=T),!this._isConfigOn(a))return i;const{type:s,modifiedText:n}=this._plugin.filter(e.payload.text);1===s?i=!1:2===s&&(e.payload.text=n)}else if(n===t.MSG_CUSTOM){if(o===t.CONV_C2C?a=C:o===t.CONV_GROUP&&(a=y),!this._isConfigOn(a))return i;const s=this._plugin.filter(e.payload.data),n=this._plugin.filter(e.payload.description),r=this._plugin.filter(e.payload.extension);1===s.type||1===n.type||1===r.type?i=!1:(2===s.type&&(e.payload.data=s.modifiedText),2===n.type&&(e.payload.description=n.modifiedText),2===r.type&&(e.payload.extension=r.modifiedText))}return Ce.l(r+" done. isAllowedToSend:"+i),i}filterText(e,t){const s=this._n+".filterText",i={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return i;if(!this._isConfigOn(t))return i;Ce.l(s);var{type:t,modifiedText:e}=this._plugin.filter(e);return 1===t?i.isAllowedToSend=!1:2===t&&(i.modifiedText=e),Ce.l(s+" done. ret:",i),i}_getLexicon(){const d=new Ti("profanityFilter"),_=this._n+"._getLexicon";this._isFetching=!0,this.req({P:ri.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then(e=>{var{errorInfo:e,filterConfig:t,lexicon:s,strToken:i,completeFlag:n,nextStartIndex:o,version:r,expiredTime:a}=e.data,{errorCode:c,errorMessage:l}=e;return 0!==c?(this._isFetching=!1,Ce.w(_+" failed. error:",e),void d.setCode(c).setMessage(l).end()):(this._onFilterConfig(t),this._getToken(i),1===n?(Ce.l(_+` done. version:${r} expiredTime:`+a),this._version=r,this._canIUseLexicon=!0,this._isFetching=!1,this._expiredTime=Date.now()+1e3*a,void this._plugin.onLexiconCompleted(s)):(this._startIndex=o,this._plugin.onLexiconSliced(s),void this._getLexicon()))}).catch(e=>{d.setError(e).end(),this._isFetching=!1,Ce.l(_+" failed. error:",e)})}_onFilterConfig(t){Oe(t)||(this._filterConfigMap.clear(),Object.keys(t).forEach(e=>{this._filterConfigMap.set(e,t[e])}),Ce.l(`${this._n}._onFilterConfig. keys:${Array.from(this._filterConfigMap.keys())} values:`+Array.from(this._filterConfigMap.values())))}_isConfigOn(e){return 1===this._filterConfigMap.get(e)}_getToken(s){if(ke(s)){var i=s.length;let t="";if(i%2==0)for(let e=0;e<=i-1;e+=2)t=(t+=s[e+1])+s[e];else{for(let e=0;e<i-1;e+=2)t=(t+=s[e+1])+s[e];t+=s[i-1]}this._plugin.onToken(t)}}reset(){Ce.l(this._n+".reset"),this._plugin&&(this._plugin.reset(),this._plugin=null),this._filterConfigMap.clear(),this._startIndex=0,this._version=0,this._canIUseLexicon=!1,this._isFetching=!1,this._expiredTime=0}}class ko{constructor(e){this._m=e,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getIEmitInst().on(Yi.CLOUD_CONFIG,this._onCloudConfig,this)}_onCloudConfig(){let e=this._m.get(ws).getCloudConfig("rtc_cmd");$e(e)||((e=JSON.parse(e)).forEach(e=>{this._TRTCCommandList.includes(e)||this._TRTCCommandList.push(e)}),this._setTRTCCommandMap())}_setTRTCCommandMap(){var s;for(let e=0,t=this._TRTCCommandList.length;e<t;e++)s=this._TRTCCommandList[e].split(".")[0],this._TRTCCommandMap.set(s,1)}onRoomCustomDataReceived(t){this._m.getOEmitInst().emit(e.ROOM_CUSTOM_DATA_RECEIVED,t)}sendTRTCCustomData(e){var{serviceCommand:e,data:t}=e;let s=f.NAME.TUIROOM_SVR+".*";return $e(e)||(s=e),this._isValidServiceCommand(s)?this._trans({servcmd:s,data:t}):ni({code:ei.INVALID_TRTC_CMD})}_trans(e){Ce.d(this._n+"._trans. options:"+JSON.stringify(e));var{servcmd:e,data:t}=e;return this._m.get(Gs).trans({servcmd:e,data:ke(t)?JSON.parse(t):t})}_isValidServiceCommand(e){if(e.endsWith(".*"))return this._TRTCCommandList.includes(e);e=e.split(".")[0];return this._TRTCCommandMap.has(e)}isTRTCCommand(e){e=e.split(".")[0];return this._TRTCCommandMap.has(e)}reset(){Ce.l(this._n+".reset")}}class wo{constructor(e){this._m=e,this._n="ErrMsgModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this._map=new Map,this._init()}_init(){var t=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(t){let e;try{e=JSON.parse(t)}catch(e){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),Ce.w(this._n+"._init error:",e)}e&&(this._needToUpdate(e)?this._fetch():this._fillMap(e.message))}else this._fetch()}_needToUpdate(e){var{localSavedTime:e,localSavedVersion:t}=e,e=e&&(new Date).getTime()-e>=this.STORAGE_EXPIRES_TIME,t=!t||"3.5.2"!==t;return Ce.l(this._n+`._needToUpdate isTimeout:${e} isDifferentVersion:`+t),e||t}_fetch(){if(!this._m.get(Rs).isPrivateNetWork()){const e="https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.7/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",s=this._n+"._fetch ok in",i=this;if(k)$.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:e=>{i._fillAndSave(e.data),Ce.l(s+" mini program")},fail:()=>{}});else{const n=new XMLHttpRequest,o=setTimeout(()=>{n.abort()},3e3);n.onreadystatechange=function(){4===n.readyState&&(o&&clearTimeout(o),200!==n.status&&304!==n.status||(Ce.l(s+" browser"),i._fillAndSave(n.responseText)))},n.open("GET",e,!0),n.setRequestHeader("Content-type",t),n.send()}}}_fillAndSave(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.5.2"}),!0,!1)}_getStorageModule(){return this._m.get(Ls)}_fillMap(e){this._map.clear();const t=e.split(";\n"),s=t.length;let i,n,o;var r=new RegExp(/'/g);for(let e=0;e<s;e++)if(i=t[e].indexOf(":"),n=t[e].slice(0,i),o=t[e].slice(i+1,t[e].length),!n.startsWith("//")){if($e(o))continue;this._map.set(n,o.replace(r,""))}}get(e){var{isIntl:e,key:t,replacement1:s,replacement2:i}=e;let n=e?t+"_en":t+"_cn",o=(!this._map.has(n)&&this._map.has(t)&&(n=t),"");return this._map.has(n)&&(o=this._map.get(n),$e(s)||(o=o.replace("$replacement1",s)),$e(i)||(o=o.replace("$replacement2",i))),o}reset(){Ce.l(this._n+".reset")}}var bo=Gn(function(e,t){var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;t.assign=function(e){for(var t,s,i=Array.prototype.slice.call(arguments,1);i.length;){var n=i.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var o in n)t=n,s=o,Object.prototype.hasOwnProperty.call(t,s)&&(e[o]=n[o])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,s,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+i),n);else for(var o=0;o<i;o++)e[n+o]=t[s+o]},flattenChunks:function(e){for(var t,s,i,n=0,o=0,r=e.length;o<r;o++)n+=e[o].length;for(i=new Uint8Array(n),o=t=0,r=e.length;o<r;o++)s=e[o],i.set(s,t),t+=s.length;return i}},n={arraySet:function(e,t,s,i,n){for(var o=0;o<i;o++)e[n+o]=t[s+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,n))},t.setTyped(s)}),Fo=(bo.assign,bo.shrinkBuf,bo.setTyped,bo.Buf8,bo.Buf16,bo.Buf32,function(e,t,s,i){for(var n=65535&e|0,o=e>>>16&65535|0,r=0;0!==s;){for(s-=r=2e3<s?2e3:s;o=o+(n=n+t[i++]|0)|0,--r;);n%=65521,o%=65521}return n|o<<16|0}),$o=function(){for(var e=[],t=0;t<256;t++){for(var s=t,i=0;i<8;i++)s=1&s?3988292384^s>>>1:s>>>1;e[t]=s}return e}(),qo=function(e,t,s,i){var n=$o,o=i+s;e^=-1;for(var r=i;r<o;r++)e=e>>>8^n[255&(e^t[r])];return-1^e},xo=function(e,d){var _,t,s,u,i,h,n=e.state,o=e.next_in,p=e.input,g=o+(e.avail_in-5),r=e.next_out,a=e.output,m=r-(d-e.avail_out),f=r+(e.avail_out-257),M=n.dmax,I=n.wsize,C=n.whave,T=n.wnext,v=n.window,c=n.hold,l=n.bits,y=n.lencode,E=n.distcode,D=(1<<n.lenbits)-1,S=(1<<n.distbits)-1;e:do{for(l<15&&(c+=p[o++]<<l,l+=8,c+=p[o++]<<l,l+=8),_=y[c&D];;){if(c>>>=t=_>>>24,l-=t,0==(t=_>>>16&255))a[r++]=65535&_;else{if(!(16&t)){if(0==(64&t)){_=y[(65535&_)+(c&(1<<t)-1)];continue}if(32&t){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}for(s=65535&_,(t&=15)&&(l<t&&(c+=p[o++]<<l,l+=8),s+=c&(1<<t)-1,c>>>=t,l-=t),l<15&&(c+=p[o++]<<l,l+=8,c+=p[o++]<<l,l+=8),_=E[c&S];;){if(c>>>=t=_>>>24,l-=t,!(16&(t=_>>>16&255))){if(0==(64&t)){_=E[(65535&_)+(c&(1<<t)-1)];continue}e.msg="invalid distance code",n.mode=30;break e}if(u=65535&_,l<(t&=15)&&(c+=p[o++]<<l,(l+=8)<t&&(c+=p[o++]<<l,l+=8)),(u+=c&(1<<t)-1)>M){e.msg="invalid distance too far back",n.mode=30;break e}if(c>>>=t,l-=t,u>(t=r-m)){if((t=u-t)>C&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(h=v,(i=0)===T){if(i+=I-t,t<s){for(s-=t;a[r++]=v[i++],--t;);i=r-u,h=a}}else if(T<t){if(i+=I+T-t,(t-=T)<s){for(s-=t;a[r++]=v[i++],--t;);if(i=0,T<s){for(s-=t=T;a[r++]=v[i++],--t;);i=r-u,h=a}}}else if(i+=T-t,t<s){for(s-=t;a[r++]=v[i++],--t;);i=r-u,h=a}for(;2<s;)a[r++]=h[i++],a[r++]=h[i++],a[r++]=h[i++],s-=3;s&&(a[r++]=h[i++],1<s&&(a[r++]=h[i++]))}else{for(i=r-u;a[r++]=a[i++],a[r++]=a[i++],a[r++]=a[i++],2<(s-=3););s&&(a[r++]=a[i++],1<s&&(a[r++]=a[i++]))}break}}break}}while(o<g&&r<f);o-=s=l>>3,c&=(1<<(l-=s<<3))-1,e.next_in=o,e.next_out=r,e.avail_in=o<g?g-o+5:5-(o-g),e.avail_out=r<f?f-r+257:257-(r-f),n.hold=c,n.bits=l},Vo=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Bo=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],Ko=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],Ho=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],Wo=function(d,_,u,h,p,g,e,m){for(var t,f,M,I,C,T,v,y,E,D=m.bits,s=0,i=0,n=0,o=0,r=0,a=0,c=0,S=0,R=0,l=0,O=null,L=0,A=new bo.Buf16(16),N=new bo.Buf16(16),P=null,U=0,s=0;s<=15;s++)A[s]=0;for(i=0;i<h;i++)A[_[u+i]]++;for(r=D,o=15;1<=o&&0===A[o];o--);if(o<r&&(r=o),0===o)return p[g++]=20971520,p[g++]=20971520,m.bits=1,0;for(n=1;n<o&&0===A[n];n++);for(r<n&&(r=n),s=S=1;s<=15;s++)if((S=(S<<1)-A[s])<0)return-1;if(0<S&&(0===d||1!==o))return-1;for(N[1]=0,s=1;s<15;s++)N[s+1]=N[s]+A[s];for(i=0;i<h;i++)0!==_[u+i]&&(e[N[_[u+i]]++]=i);if(T=0===d?(O=P=e,19):1===d?(O=Vo,L-=257,P=Bo,U-=257,256):(O=Ko,P=Ho,-1),s=n,C=g,c=i=l=0,M=-1,I=(R=1<<(a=r))-1,1===d&&852<R||2===d&&592<R)return 1;for(;;){for(E=e[i]<T?(y=0,e[i]):e[i]>T?(y=P[U+e[i]],O[L+e[i]]):(y=96,0),t=1<<(v=s-c),n=f=1<<a;p[C+(l>>c)+(f-=t)]=v<<24|y<<16|E|0,0!==f;);for(t=1<<s-1;l&t;)t>>=1;if(0!==t?l=(l&t-1)+t:l=0,i++,0==--A[s]){if(s===o)break;s=_[u+e[i]]}if(r<s&&(l&I)!==M){for(C+=n,S=1<<(a=s-(c=0===c?r:c));a+c<o&&!((S-=A[a+c])<=0);)a++,S<<=1;if(R+=1<<a,1===d&&852<R||2===d&&592<R)return 1;p[M=l&I]=r<<24|a<<16|C-g|0}}return 0!==l&&(p[C+l]=s-c<<24|64<<16|0),m.bits=r,0};function Yo(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function zo(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new bo.Buf16(320),this.work=new bo.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function jo(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new bo.Buf32(852),t.distcode=t.distdyn=new bo.Buf32(592),t.sane=1,t.back=-1,0):-2}function Jo(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,jo(e)):-2}function Xo(e,t){var s,i;return e&&e.state?(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?-2:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=s,i.wbits=t,Jo(e))):-2}function Zo(e,t){var s;return e?(s=new zo,(e.state=s).window=null,0!==(s=Xo(e,t))&&(e.state=null),s):-2}var Qo,er,tr=!0;function sr(e){if(tr){var t;for(Qo=new bo.Buf32(512),er=new bo.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wo(1,e.lens,0,288,Qo,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wo(2,e.lens,0,32,er,0,e.work,{bits:5}),tr=!1}e.lencode=Qo,e.lenbits=9,e.distcode=er,e.distbits=5}function ir(e,t,s,i){var n,e=e.state;return null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new bo.Buf8(e.wsize)),i>=e.wsize?(bo.arraySet(e.window,t,s-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):((n=e.wsize-e.wnext)>i&&(n=i),bo.arraySet(e.window,t,s-i,n,e.wnext),(i-=n)?(bo.arraySet(e.window,t,s-i,i,0),e.wnext=i,e.whave=e.wsize):(e.wnext+=n,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=n))),0}var nr={inflateReset:Jo,inflateReset2:Xo,inflateResetKeep:jo,inflateInit:function(e){return Zo(e,15)},inflateInit2:Zo,inflate:function(e,d){var t,s,_,i,u,n,h,o,r,p,g,a,m,f,c,M,I,C,T,v,l,y,E,D,S=0,R=new bo.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(t=e.state).mode&&(t.mode=13),u=e.next_out,_=e.output,h=e.avail_out,i=e.next_in,s=e.input,n=e.avail_in,o=t.hold,r=t.bits,p=n,g=h,y=0;e:for(;;)switch(t.mode){case 1:if(0===t.wrap){t.mode=13;break}for(;r<16;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(2&t.wrap&&35615===o){R[t.check=0]=255&o,R[1]=o>>>8&255,t.check=qo(t.check,R,2,0),r=o=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&o)<<8)+(o>>8))%31){e.msg="incorrect header check",t.mode=30;break}if(8!=(15&o)){e.msg="unknown compression method",t.mode=30;break}if(r-=4,l=8+(15&(o>>>=4)),0===t.wbits)t.wbits=l;else if(l>t.wbits){e.msg="invalid window size",t.mode=30;break}t.dmax=1<<l,e.adler=t.check=1,t.mode=512&o?10:12,r=o=0;break;case 2:for(;r<16;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(t.flags=o,8!=(255&t.flags)){e.msg="unknown compression method",t.mode=30;break}if(57344&t.flags){e.msg="unknown header flags set",t.mode=30;break}t.head&&(t.head.text=o>>8&1),512&t.flags&&(R[0]=255&o,R[1]=o>>>8&255,t.check=qo(t.check,R,2,0)),r=o=0,t.mode=3;case 3:for(;r<32;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.head&&(t.head.time=o),512&t.flags&&(R[0]=255&o,R[1]=o>>>8&255,R[2]=o>>>16&255,R[3]=o>>>24&255,t.check=qo(t.check,R,4,0)),r=o=0,t.mode=4;case 4:for(;r<16;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.head&&(t.head.xflags=255&o,t.head.os=o>>8),512&t.flags&&(R[0]=255&o,R[1]=o>>>8&255,t.check=qo(t.check,R,2,0)),r=o=0,t.mode=5;case 5:if(1024&t.flags){for(;r<16;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.length=o,t.head&&(t.head.extra_len=o),512&t.flags&&(R[0]=255&o,R[1]=o>>>8&255,t.check=qo(t.check,R,2,0)),r=o=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&((a=(a=t.length)>n?n:a)&&(t.head&&(l=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),bo.arraySet(t.head.extra,s,i,a,l)),512&t.flags&&(t.check=qo(t.check,s,a,i)),n-=a,i+=a,t.length-=a),t.length))break e;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===n)break e;for(a=0;l=s[i+a++],t.head&&l&&t.length<65536&&(t.head.name+=String.fromCharCode(l)),l&&a<n;);if(512&t.flags&&(t.check=qo(t.check,s,a,i)),n-=a,i+=a,l)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=8;case 8:if(4096&t.flags){if(0===n)break e;for(a=0;l=s[i+a++],t.head&&l&&t.length<65536&&(t.head.comment+=String.fromCharCode(l)),l&&a<n;);if(512&t.flags&&(t.check=qo(t.check,s,a,i)),n-=a,i+=a,l)break e}else t.head&&(t.head.comment=null);t.mode=9;case 9:if(512&t.flags){for(;r<16;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(o!==(65535&t.check)){e.msg="header crc mismatch",t.mode=30;break}r=o=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),e.adler=t.check=0,t.mode=12;break;case 10:for(;r<32;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}e.adler=t.check=Yo(o),r=o=0,t.mode=11;case 11:if(0===t.havedict)return e.next_out=u,e.avail_out=h,e.next_in=i,e.avail_in=n,t.hold=o,t.bits=r,2;e.adler=t.check=1,t.mode=12;case 12:if(5===d||6===d)break e;case 13:if(t.last){o>>>=7&r,r-=7&r,t.mode=27;break}for(;r<3;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}switch(t.last=1&o,--r,3&(o>>>=1)){case 0:t.mode=14;break;case 1:if(sr(t),t.mode=20,6!==d)break;o>>>=2,r-=2;break e;case 2:t.mode=17;break;case 3:e.msg="invalid block type",t.mode=30}o>>>=2,r-=2;break;case 14:for(o>>>=7&r,r-=7&r;r<32;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if((65535&o)!=(o>>>16^65535)){e.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&o,r=o=0,t.mode=15,6===d)break e;case 15:t.mode=16;case 16:if(a=t.length){if(0===(a=h<(a=n<a?n:a)?h:a))break e;bo.arraySet(_,s,i,a,u),n-=a,i+=a,h-=a,u+=a,t.length-=a;break}t.mode=12;break;case 17:for(;r<14;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(t.nlen=257+(31&o),o>>>=5,r-=5,t.ndist=1+(31&o),o>>>=5,r-=5,t.ncode=4+(15&o),o>>>=4,r-=4,286<t.nlen||30<t.ndist){e.msg="too many length or distance symbols",t.mode=30;break}t.have=0,t.mode=18;case 18:for(;t.have<t.ncode;){for(;r<3;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.lens[O[t.have++]]=7&o,o>>>=3,r-=3}for(;t.have<19;)t.lens[O[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,E={bits:t.lenbits},y=Wo(0,t.lens,0,19,t.lencode,0,t.work,E),t.lenbits=E.bits,y){e.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have<t.nlen+t.ndist;){for(;M=(S=t.lencode[o&(1<<t.lenbits)-1])>>>16&255,I=65535&S,!((c=S>>>24)<=r);){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(I<16)o>>>=c,r-=c,t.lens[t.have++]=I;else{if(16===I){for(D=c+2;r<D;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(o>>>=c,r-=c,0===t.have){e.msg="invalid bit length repeat",t.mode=30;break}l=t.lens[t.have-1],a=3+(3&o),o>>>=2,r-=2}else if(17===I){for(D=c+3;r<D;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}l=0,a=3+(7&(o>>>=c)),o>>>=3,r=r-c-3}else{for(D=c+7;r<D;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}l=0,a=11+(127&(o>>>=c)),o>>>=7,r=r-c-7}if(t.have+a>t.nlen+t.ndist){e.msg="invalid bit length repeat",t.mode=30;break}for(;a--;)t.lens[t.have++]=l}}if(30===t.mode)break;if(0===t.lens[256]){e.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,E={bits:t.lenbits},y=Wo(1,t.lens,0,t.nlen,t.lencode,0,t.work,E),t.lenbits=E.bits,y){e.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,E={bits:t.distbits},y=Wo(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,E),t.distbits=E.bits,y){e.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===d)break e;case 20:t.mode=21;case 21:if(6<=n&&258<=h){e.next_out=u,e.avail_out=h,e.next_in=i,e.avail_in=n,t.hold=o,t.bits=r,xo(e,g),u=e.next_out,_=e.output,h=e.avail_out,i=e.next_in,s=e.input,n=e.avail_in,o=t.hold,r=t.bits,12===t.mode&&(t.back=-1);break}for(t.back=0;M=(S=t.lencode[o&(1<<t.lenbits)-1])>>>16&255,I=65535&S,!((c=S>>>24)<=r);){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(M&&0==(240&M)){for(C=c,T=M,v=I;M=(S=t.lencode[v+((o&(1<<C+T)-1)>>C)])>>>16&255,I=65535&S,!(C+(c=S>>>24)<=r);){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}o>>>=C,r-=C,t.back+=C}if(o>>>=c,r-=c,t.back+=c,t.length=I,0===M){t.mode=26;break}if(32&M){t.back=-1,t.mode=12;break}if(64&M){e.msg="invalid literal/length code",t.mode=30;break}t.extra=15&M,t.mode=22;case 22:if(t.extra){for(D=t.extra;r<D;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.length+=o&(1<<t.extra)-1,o>>>=t.extra,r-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;M=(S=t.distcode[o&(1<<t.distbits)-1])>>>16&255,I=65535&S,!((c=S>>>24)<=r);){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(0==(240&M)){for(C=c,T=M,v=I;M=(S=t.distcode[v+((o&(1<<C+T)-1)>>C)])>>>16&255,I=65535&S,!(C+(c=S>>>24)<=r);){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}o>>>=C,r-=C,t.back+=C}if(o>>>=c,r-=c,t.back+=c,64&M){e.msg="invalid distance code",t.mode=30;break}t.offset=I,t.extra=15&M,t.mode=24;case 24:if(t.extra){for(D=t.extra;r<D;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}t.offset+=o&(1<<t.extra)-1,o>>>=t.extra,r-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){e.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(0===h)break e;if(t.offset>(a=g-h)){if((a=t.offset-a)>t.whave&&t.sane){e.msg="invalid distance too far back",t.mode=30;break}m=a>t.wnext?(a-=t.wnext,t.wsize-a):t.wnext-a,a>t.length&&(a=t.length),f=t.window}else f=_,m=u-t.offset,a=t.length;for(h-=a=h<a?h:a,t.length-=a;_[u++]=f[m++],--a;);0===t.length&&(t.mode=21);break;case 26:if(0===h)break e;_[u++]=t.length,h--,t.mode=21;break;case 27:if(t.wrap){for(;r<32;){if(0===n)break e;n--,o|=s[i++]<<r,r+=8}if(g-=h,e.total_out+=g,t.total+=g,g&&(e.adler=t.check=(t.flags?qo:Fo)(t.check,_,g,u-g)),g=h,(t.flags?o:Yo(o))!==t.check){e.msg="incorrect data check",t.mode=30;break}r=o=0}t.mode=28;case 28:if(t.wrap&&t.flags){for(;r<32;){if(0===n)break e;n--,o+=s[i++]<<r,r+=8}if(o!==(4294967295&t.total)){e.msg="incorrect length check",t.mode=30;break}r=o=0}t.mode=29;case 29:y=1;break e;case 30:y=-3;break e;case 31:return-4;default:return-2}return e.next_out=u,e.avail_out=h,e.next_in=i,e.avail_in=n,t.hold=o,t.bits=r,(t.wsize||g!==e.avail_out&&t.mode<30&&(t.mode<27||4!==d))&&ir(e,e.output,e.next_out,g-e.avail_out),p-=e.avail_in,g-=e.avail_out,e.total_in+=p,e.total_out+=g,t.total+=g,t.wrap&&g&&(e.adler=t.check=(t.flags?qo:Fo)(t.check,_,g,e.next_out-g)),e.data_type=t.bits+(t.last?64:0)+(12===t.mode?128:0)+(20===t.mode||15===t.mode?256:0),y=(0==p&&0===g||4===d)&&0===y?-5:y},inflateEnd:function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},inflateGetHeader:function(e,t){var s;return!e||!e.state||0==(2&(s=e.state).wrap)?-2:((s.head=t).done=!1,0)},inflateSetDictionary:function(e,t){var s,i=t.length;return!e||!e.state||0!==(s=e.state).wrap&&11!==s.mode?-2:11===s.mode&&Fo(1,t,i,0)!==s.check?-3:ir(e,t,i,i)?(s.mode=31,-4):(s.havedict=1,0)},inflateInfo:"pako inflate (from Nodeca project)"},or=!0,rr=!0;try{String.fromCharCode.apply(null,[0])}catch(e){or=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){rr=!1}for(var ar=new bo.Buf8(256),cr=0;cr<256;cr++)ar[cr]=252<=cr?6:248<=cr?5:240<=cr?4:224<=cr?3:192<=cr?2:1;function lr(e,t){if(t<65534&&(e.subarray&&rr||!e.subarray&&or))return String.fromCharCode.apply(null,bo.shrinkBuf(e,t));for(var s="",i=0;i<t;i++)s+=String.fromCharCode(e[i]);return s}ar[254]=ar[254]=1;var ur=function(e){for(var t,s,i,n,o=e.length,r=0,a=0;a<o;a++)55296==(64512&(s=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(i=e.charCodeAt(a+1)))&&(s=65536+(s-55296<<10)+(i-56320),a++),r+=s<128?1:s<2048?2:s<65536?3:4;for(t=new bo.Buf8(r),a=n=0;n<r;a++)55296==(64512&(s=e.charCodeAt(a)))&&a+1<o&&56320==(64512&(i=e.charCodeAt(a+1)))&&(s=65536+(s-55296<<10)+(i-56320),a++),s<128?t[n++]=s:(s<2048?t[n++]=192|s>>>6:(s<65536?t[n++]=224|s>>>12:(t[n++]=240|s>>>18,t[n++]=128|s>>>12&63),t[n++]=128|s>>>6&63),t[n++]=128|63&s);return t},dr=function(e){for(var t=new bo.Buf8(e.length),s=0,i=t.length;s<i;s++)t[s]=e.charCodeAt(s);return t},_r=function(e,t){for(var s,i,n=t||e.length,o=new Array(2*n),r=0,a=0;a<n;)if((s=e[a++])<128)o[r++]=s;else if(4<(i=ar[s]))o[r++]=65533,a+=i-1;else{for(s&=2===i?31:3===i?15:7;1<i&&a<n;)s=s<<6|63&e[a++],i--;1<i?o[r++]=65533:s<65536?o[r++]=s:(s-=65536,o[r++]=55296|s>>10&1023,o[r++]=56320|1023&s)}return lr(o,r)},hr=function(e,t){for(var s=(t=(t=t||e.length)>e.length?e.length:t)-1;0<=s&&128==(192&e[s]);)s--;return!(s<0||0===s)&&s+ar[e[s]]>t?s:t},pr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},gr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},mr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},fr=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Mr=Object.prototype.toString;function Ir(e){if(!(this instanceof Ir))return new Ir(e);this.options=bo.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options,e=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mr,this.strm.avail_out=0,nr.inflateInit2(this.strm,t.windowBits));if(e!==pr.Z_OK)throw new Error(gr[e]);if(this.header=new fr,nr.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=ur(t.dictionary):"[object ArrayBuffer]"===Mr.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=nr.inflateSetDictionary(this.strm,t.dictionary))!==pr.Z_OK))throw new Error(gr[e])}function Cr(e,t){t=new Ir(t);if(t.push(e,!0),t.err)throw t.msg||gr[t.err];return t.result}Ir.prototype.push=function(e,t){var s,i,n,o,r,a=this.strm,c=this.options.chunkSize,d=this.options.dictionary,l=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?pr.Z_FINISH:pr.Z_NO_FLUSH,"string"==typeof e?a.input=dr(e):"[object ArrayBuffer]"===Mr.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new bo.Buf8(c),a.next_out=0,a.avail_out=c),(s=(s=nr.inflate(a,pr.Z_NO_FLUSH))===pr.Z_NEED_DICT&&d?nr.inflateSetDictionary(this.strm,d):s)===pr.Z_BUF_ERROR&&!0===l&&(s=pr.Z_OK,l=!1),s!==pr.Z_STREAM_END&&s!==pr.Z_OK)return this.onEnd(s),!(this.ended=!0)}while(a.next_out&&(0!==a.avail_out&&s!==pr.Z_STREAM_END&&(0!==a.avail_in||i!==pr.Z_FINISH&&i!==pr.Z_SYNC_FLUSH)||("string"===this.options.to?(n=hr(a.output,a.next_out),o=a.next_out-n,r=_r(a.output,n),a.next_out=o,a.avail_out=c-o,o&&bo.arraySet(a.output,a.output,n,o,0),this.onData(r)):this.onData(bo.shrinkBuf(a.output,a.next_out)))),0===a.avail_in&&0===a.avail_out&&(l=!0),(0<a.avail_in||0===a.avail_out)&&s!==pr.Z_STREAM_END);return(i=s===pr.Z_STREAM_END?pr.Z_FINISH:i)===pr.Z_FINISH?(s=nr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===pr.Z_OK):i!==pr.Z_SYNC_FLUSH||(this.onEnd(pr.Z_OK),!(a.avail_out=0))},Ir.prototype.onData=function(e){this.chunks.push(e)},Ir.prototype.onEnd=function(e){e===pr.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=bo.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Tr={Inflate:Ir,inflate:Cr,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Cr(e,t)},ungzip:Cr},yr={},vr=((0,bo.assign)(yr,Tr,pr),yr);class Er{constructor(e){this._m=e,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1}inflate(e){var e=new Uint8Array(e).slice(4),t=Date.now();let s;try{s=vr.inflate(e,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new Ti("inflateOK").end())}catch(e){return this._bLogForInflateError?void 0:(this._bLogForInflateError=!0,void new Ti("inflateError").setMessage(e).end())}var e=e.length+4,i=s.length;return Ce.d(`inflate ok. zipped:${e} unzipped:${i} compression ratio:${Math.round(100*(i-e)/i)}% cost:`+(Date.now()-t)),s}reset(){Ce.l(this._n+".reset"),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}class Sr{constructor(s){const e=new Ti("sdkConstruct");if(this._n="ModuleManager",this._isReady=!1,this._reason=ei.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._map=new Map,this._optionalModuleMap=new Map,this._codeMsgForTUIMap=new Map,this._iEmitter=null,this._oEmitter=null,this._checkCount=0,this._checkTimer=-1,this._map.set(Rs,new vn(this,s)),this._map.set(Js,new Er(this)),this._map.set(Os,new Un(this)),this._map.set(qs,new No(this)),this._map.set(ws,new yo(this)),this._map.set(bs,new Ao(this)),this._map.set($s,new Lo(this)),this._map.set(ks,new ho(this)),this._map.set(Gs,new To(this)),this._map.set(Ms,new Sn(this)),this._map.set(Is,new Kn(this)),this._map.set(Cs,new Hn(this)),this._map.set(Ys,new Wn(this)),this._map.set(Ks,new Yn(this)),this._map.set(Ts,new yn(this)),this._map.set(ys,new Wi(this)),this._map.set(Ds,new _n(this)),this._map.set(Ss,new mn(this)),this._map.set(Ls,new Rn(this)),this._map.set(Hs,new wo(this)),this._map.set(As,new On(this)),this._map.set(Ns,new $n(this)),this._map.set(Ps,new zn(this)),this._map.set(Us,new jn(this)),this._map.set(Fs,new vo(this)),this._map.set(xs,new Po(this)),this._map.set(js,new Uo(this)),this._map.set(Vs,new Go(this)),this._map.set(Bs,new ko(this)),this._eventThrottleMap=new Map,this._eventThrottling=s.eventThrottling,this._map.get(Rs).isPartialUpdatedConvs()&&(this._eventThrottling=!1),be(s.modules)){let t;Object.keys(s.modules).forEach(e=>{t=s.modules[e],"group-module"===e?this._map.set(vs,new t(this)):"relationship-module"===e?this._map.set(Es,new t(this)):"signaling-module"===e?this._map.set(Ws,new t(this)):"follow-module"===e?this._map.set(zs,new t(this)):"cloud-search-module"===e&&this._map.set(Xs,new t(this)),this._optionalModuleMap.set(e,1)}),this._map.get(Rs).setUsingChatCore(!0)}else this._map.has(vs)||this._map.get(Rs).setUsingChatCore(!0);var{instanceID:t,SDKAppID:i}=s,t=`instanceID:${t} SDKAppID:${i} isIntl:${this._map.get(Rs).isIntl()} isUsingChatCore:${this._map.get(Rs).isUsingChatCore()} host:${ht()} isIOSWebView:${re} platform:${V} canIUseInflate:${this.canIUseInflate()} workerAvailable:${ie} eventThrottling:${this._eventThrottling} UserAgent:`+q;Ti.bindEventStatModule(this._map.get(As)),Ti.bindNetMonitorModule(this._map.get(Os)),e.setMessage(t+" "+function(){let t="";if(k)try{var{model:e,version:s,system:i,platform:n,SDKVersion:o}=$.getSystemInfoSync();t=`model:${e} version:${s} system:${i} platform:${n} SDKVersion:`+o}catch(e){t=""}return t}()).end(),Ce.i("SDK "+t),Qs.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}_startTimer(){const e=this._map.get(bs),t=e.isWorkerEnabled();Ce.l(this._n+`.startTimer isWorkerEnabled:${t} seed:`+this._checkTimer),t?e.startWorkerTimer():this._startMainThreadTimer()}_startMainThreadTimer(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),Ce.l(this._n+"._startMainThreadTimer seed:"+this._checkTimer)}stopTimer(){const e=this._map.get(bs),t=e.isWorkerEnabled();Ce.l(this._n+`.stopTimer isWorkerEnabled:${t} seed:`+this._checkTimer),t?e.stopWorkerTimer():this._stopMainThreadTimer()}_stopMainThreadTimer(){Ce.l(this._n+"._stopMainThreadTimer"),0<this._checkTimer&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}_stopMainThreadSocket(){Ce.l(this._n+"._stopMainThreadSocket");const e=this._map.get(ks);e.setIsWorkerEnabled(!0),e.reConnect()}_startMainThreadSocket(){Ce.l(this._n+"._startMainThreadSocket");const e=this._map.get(ks);e.setIsWorkerEnabled(!1),e.reConnect()}onWorkerTimerEnabled(){Ce.l(this._n+".onWorkerTimerEnabled, disable main thread timer and socket"),this._stopMainThreadTimer(),this._stopMainThreadSocket()}onWorkerTimerDisabled(){Ce.l(this._n+".onWorkerTimerDisabled, enable main thread timer and socket"),this._startMainThreadTimer(),this._startMainThreadSocket()}onCheckTimer(){this._checkCount+=1;for(var[,e]of this._map)e.onCheckTimer&&e.onCheckTimer(this._checkCount)}_initReadyList(){this._readyList=[this._map.get(Ms)],this._readyList.forEach(e=>{e.ready(()=>this._onModuleReady())})}_onModuleReady(){let t=!0;if(this._readyList.forEach(e=>{e.isReady()||(t=!1)}),t&&!this._isReady){this._isReady=!0,this._oEmitter.emit(e.SDK_READY);const t=Date.now()-this._startLoginTs;Ce.w(`SDK is ready. cost ${t} ms`),this._startLoginTs=Date.now();var s=this._ssoLogForReady.getStartTs()+he;this._ssoLogForReady.setMessage(t).start(s).end()}}login(){0===this._startLoginTs&&(ge(),this._startLoginTs=Date.now(),this._startTimer(),this._map.get(Os).start(),this._ssoLogForReady=new Ti("sdkReady"),this._reason=ei.LOGGING_IN)}onLoginFailed(){this._startLoginTs=0}getOEmitInst(){return null===this._oEmitter&&(this._oEmitter=new kn,si(this._oEmitter),this._oEmitter._emit=this._oEmitter.emit,this._oEmitter.emit=function(t,s){if(this._canIUseSignaling()&&(t===e.MESSAGE_RECEIVED&&this.get(Ws).onNewMessageList(s),t===e.MESSAGE_MODIFIED&&this.get(Ws).onMessageModified(s)),t===e.CONVERSATION_LIST_UPDATED||t===e.FRIEND_LIST_UPDATED||t===e.GROUP_LIST_UPDATED||t===e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(!1!==this._eventThrottling)if(this._eventThrottleMap.has(t)){const e=Date.now(),s=this._eventThrottleMap.get(t);e-s.last<=1e3?(-1<s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout(()=>{s.last=Date.now(),this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}])},1e3)):(s.last=e,this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]))}else this._eventThrottleMap.set(t,{last:Date.now(),timeoutID:-1}),this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]);else this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:this._getEventData(t)}]);else this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:s}])}.bind(this)),this._oEmitter}_canIUseSignaling(){const e=this.get(Ws);return!!e&&e.canIUseSignaling()}_getEventData(t){return t===e.CONVERSATION_LIST_UPDATED?this._map.get(Rs).isPartialUpdatedConvs()?this._map.get(Ds).getPartialUpdatedConvs():this._map.get(Ds).getLocalConvList():t===e.FRIEND_LIST_UPDATED?this._map.get(Es).getLocalFriendList(!1):t===e.GROUP_LIST_UPDATED?this._map.get(vs).getLocalGroupList():t===e.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._map.get(Ds).getTotalUnreadCount():t===e.CONVERSATION_ID_LIST_UPDATED?this._map.get(Ds).getUpdatedConvIDList():void 0}getIEmitInst(){return null===this._iEmitter&&(this._iEmitter=new kn,this._iEmitter._emit=this._iEmitter.emit,this._iEmitter.emit=function(e,t){e=be(t)&&t.data?[e,{name:e,data:t.data}]:[e,{name:e,data:t}];this._iEmitter._emit.apply(this._iEmitter,e)}.bind(this)),this._iEmitter}hasModule(e){return this._map.has(e)}get(e){return this._map.get(e)}canIUseModule(e){return!this._map.get(Rs).isUsingChatCore()||this._optionalModuleMap.has(e)}canIUseInflate(){return!!this._map.get(Js)}isReady(){return this._isReady}isIntl(){return this.get(Rs).isIntl()}getNotReadyReason(){return this._reason}setNotReadyReason(e){this._reason=e}getErrMsg(e,t,s){return this._map.get(Hs).get({key:e,replacement1:t,replacement2:s,isIntl:this.isIntl()})}warn(e,t,s){e=this.getErrMsg(e,t,s);e&&Ce.w(e)}onError(t){var s=`code:${t.code} message:`+t.message;Ce.w("Oops! "+s),new Ti("error").setMessage(s).setLevel("error").end(),this.getOEmitInst().emit(e.ERROR,t)}restartTimer(){Ce.l(this._n+".restartTimer"),this.stopTimer(),this._startTimer();const e=this.get(vs);e&&e.restartPolling()}getTimerID(){const e=this._map.get(bs);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}getPollingTimerID(e){return this._map.get(vs).getPollingTimerID(e)}statTUIKeyFeatures(e){var{code:e,msg:t=""}=e,s=e+t;this._codeMsgForTUIMap.has(s)||(this._codeMsgForTUIMap.set(s,1),s=this.get(Rs).getUIPlatform(),new Ti("tui_key_features").setCode(e).setMessage(t).setUIPlatform(s).end())}reset(){Ce.l(this._n+".reset"),ge();for(const[,e]of this._map)e.reset&&e.reset();this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._oEmitter.emit(e.SDK_NOT_READY);for(const[,e]of this._eventThrottleMap)-1<e.timeoutID&&clearTimeout(e.timeoutID);this._eventThrottleMap.clear(),this._codeMsgForTUIMap.clear()}}class Dr{constructor(e){this._funcMap=new Map,this._m=e,this._n="SafetyCallback",this._reportCount=0}defense(e,t,s){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);let i=null;return this._funcMap.get(e).has(t)?i=this._funcMap.get(e).get(t):(i=this._pack(e,t,s),this._funcMap.get(e).set(t,i)),i}defenseOnce(e,t,s){return"function"!=typeof t?null:this._pack(e,t,s)}find(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.warn("ListenerFnNotFound",e),null)}delete(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)}_pack(s,i,n){const o=this;return function(){try{i.apply(n,Array.from(arguments))}catch(t){const i=Object.values(e).indexOf(s),n="CallbackError";if(-1!==i){const s=Object.keys(e)[i];o._m.warn(n,s,t)}o._reportCount<5&&(new Ti(n).setMessage("eventName:"+s).setMoreMessage(t.message).end(),o._reportCount+=1)}}}destroy(){this._funcMap.clear()}reset(){Ce.l(this._n+".reset"),this._reportCount=0}}class Rr{constructor(e){e={SDKAppID:e.SDKAppID,unlimitedAVChatRoom:e.unlimitedAVChatRoom||!1,scene:e.scene||"",oversea:e.oversea||!1,instanceID:_t(),devMode:e.devMode||!1,testEnv:e.testEnv||!1,proxyServer:e.proxyServer||void 0,fileUploadProxy:e.fileUploadProxy||void 0,fileDownloadProxy:e.fileDownloadProxy||e.fileUploadProxy||void 0,eventThrottling:!1!==e.eventThrottling,partialUpdatedConversations:!0===e.partialUpdatedConversations,disableIndependentDomain:!0===e.disableIndependentDomain,modules:e.modules||void 0};this._m=new Sr(e),this._safetyCallbackFactory=new Dr(this._m)}onError(e){this._m.onError(e)}login(e){return this._m.login(),this._get(Ms).login(e)}logout(){return this._get(Ms).logout().then(e=>(this._safetyCallbackFactory.reset(),this._m.reset(),e))}getLoginUser(){return this._get(Ms).getLoginUser()}getServerTime(){return pe()}isReady(){return this._m.isReady()}isIntl(){return this._m.isIntl()}getNotReadyReason(){return this._m.getNotReadyReason()}getErrMsg(e,t,s){return this._m.getErrMsg(e,t,s)}_get(e){return this._m.get(e)}destroy(){const t=this._get(Rs),s=t.getSDKAppID();return Ce.w(`destroy ${s} `+t.getInstanceID()),this.logout().finally(()=>{this._safetyCallbackFactory.destroy(),this._m.stopTimer(),this._get(bs).terminate(),this._get(ks).dealloc(),this._m.getOEmitInst().emit(e.SDK_DESTROY,{SDKAppID:s})})}on(e,t,s){Ce.d("on","eventName:"+e),this._m.getOEmitInst().on(e,this._safetyCallbackFactory.defense(e,t,s),s)}once(e,t,s){Ce.d("once","eventName:"+e),this._m.getOEmitInst().once(e,this._safetyCallbackFactory.defenseOnce(e,t,s),s||this)}off(e,t,s,i){Ce.d("off","eventName:"+e);var n=this._safetyCallbackFactory.find(e,t);null!==n&&(this._m.getOEmitInst().off(e,n,s,i),this._safetyCallbackFactory.delete(e,t))}registerPlugin(e){($e(e["tim-push"])?$e(e["tim-offline-push-plugin"])?this._get(Ps):this._get(xs):this._get(js)).registerPlugin(e)}setLogLevel(e){if(e<=0){const e=this.getErrMsg("TIM_ASCII_ART");e&&console.log(e);var t=this.getErrMsg("API_REFER");if(t){const e="IM SDK API ->";Et()?console.log(`%c ${e} %c`,"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log(e,t)}t=this.getErrMsg("DOCS_GUIDE"),t=(t&&console.log(t),this.getErrMsg("IOS_WEBVIEW_WARNING"));re&&t&&console.warn(t)}Ce.setLevel(e)}createTextMessage(e){return this._get(Is).createTextMessage(e)}createTextAtMessage(e){return this._get(Is).createTextMessage(e)}createImageMessage(e){return this._get(Is).createImageMessage(e)}createAudioMessage(e){return this._get(Is).createAudioMessage(e)}createVideoMessage(e){return this._get(Is).createVideoMessage(e)}createCustomMessage(e){return this._get(Is).createCustomMessage(e)}createFaceMessage(e){return this._get(Is).createFaceMessage(e)}createFileMessage(e){return this._get(Is).createFileMessage(e)}createLocationMessage(e){return this._get(Is).createLocationMessage(e)}createMergerMessage(e){return this._get(Is).createMergerMessage(e)}downloadMergerMessage(e){return e.type!==t.MSG_MERGER?ni({code:ei.MSG_MERGER_TYPE_INVALID}):Oe(e.payload.downloadKey)?ni({code:ei.MSG_MERGER_KEY_INVALID}):this._get(Is).downloadMergerMessage(e).catch(e=>ni({code:ei.MSG_MERGER_DOWNLOAD_FAIL}))}createForwardMessage(e){return this._get(Is).createForwardMessage(e)}sendMessage(e,t){return e instanceof xi?this._get(Is).sendMessageInstance(e,t):ni({code:ei.MSG_INSTANCE_REQUIRED})}callExperimentalAPI(e,t){return"sendComboMessage"===e?this._get(Ks).sendMessage(t):"handleGroupInvitation"===e?this._get(vs).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._get(qs).isFeatureEnabled(t):"isFeatureEnabledForStat"===e?this._get(qs).isFeatureEnabledForStat(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._get(Bs).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"!==e?"getServerConfig"===e?this._get(ws).getServerConfig(t):"canIUseModule"===e?this._m.canIUseModule(t):"startMessageLongPolling"===e?this._get(vs).startMessageLongPolling(t):"stopMessageLongPolling"===e?this._get(vs).stopMessageLongPolling(t):"disableMessagePullOnInvite"===e?this._get(Ds).disableMsgPullOnInvite(t):"clearLocalMessage"===e?this._get(Ds).clearMemMsg(t,!1):"setCustomLoginInfo"===e?this._get(Rs).setCustomLoginInfo(t):"statTUIKeyFeatures"===e?this._m.statTUIKeyFeatures(t):ni({code:ei.INVALID_OPERATION}):(this._get(Rs).setApplicationID(t),void this._get(Gs).updateProtocolConfig())}revokeMessage(e){return this._get(Is).revokeMessage(e)}resendMessage(e,t){return e instanceof xi?this._get(Is).resendMessage(e,t):ni({code:ei.MSG_INSTANCE_REQUIRED})}deleteMessage(e){return this._get(Is).deleteMessage(e)}translateText(e){return this._get(Is).translateText(e)}convertVoiceToText(e){return this._get(Is).convertVoiceToText(e)}setMessageExtensions(e,t){return this._get(Cs).setMessageExtensions(e,t)}getMessageExtensions(e){return this._get(Cs).getMessageExtensions(e)}deleteMessageExtensions(e,t){return this._get(Cs).deleteMessageExtensions(e,t)}addMessageReaction(e,t){return this._get(Ys).addMessageReaction(e,t)}removeMessageReaction(e,t){return this._get(Ys).removeMessageReaction(e,t)}getMessageReactions(e){return this._get(Ys).getMessageReactions(e)}getAllUserListOfMessageReaction(e){return this._get(Ys).getAllUserListOfMessageReaction(e)}modifyMessage(e){return this._get(Is).modifyRemoteMessage(e)}getMessageList(e){return this._get(Ds).getMessageList(e)}getMessageListHopping(e){return this._get(Ds).getMessageListHopping(e)}sendMessageReadReceipt(e){return this._get(Ds).sendReadReceipt(e)}getMessageReadReceiptList(e){return this._get(Ds).getReadReceiptList(e)}getGroupMessageReadMemberList(e){const t=this._get(vs);return t?t.getReadReceiptDetail(e):ni({code:ei.NO_MODULE})}findMessage(e){return this._get(Ds).findMessage(e)}setMessageRead(e){return this._get(Ds).setMessageRead(e)}getConversationList(e){return this._get(Ds).getConvList(e)}getConversationProfile(e){return this._get(Ds).getConversationProfile(e)}deleteConversation(e){return this._get(Ds).deleteConversation(e)}setConversationDraft(e){return this._get(Ds).setConvDraft(e)}clearHistoryMessage(e){return this._get(Ds).clearHistoryMessage(e)}pinConversation(e){return this._get(Ds).pinConversation(e)}setAllMessageRead(e){return this._get(Ds).setAllMessageRead(e)}setMessageRemindType(e){return this._get(Ds).setMessageRemindType(e)}setAllReceiveMessageOpt(e){return this._get(Ds).setAllRcvMsgOpt(e)}getAllReceiveMessageOpt(){return this._get(Ds).getAllRcvMsgOpt()}getTotalUnreadMessageCount(){return this._get(Ds).getTotalUnreadCount()}setConversationCustomData(e){return this._get(Ds).setConvCustomData(e)}markConversation(e){return this._get(Ds).markConv(e)}getConversationGroupList(){return this._get(Ds).getConvGroupList()}createConversationGroup(e){return this._get(Ds).createConvGroup(e)}deleteConversationGroup(e){return this._get(Ds).deleteConvGroup(e)}renameConversationGroup(e){return this._get(Ds).renameConvGroup(e)}addConversationsToGroup(e){return this._get(Ds).addConvsToGroup(e)}deleteConversationsFromGroup(e){return this._get(Ds).deleteConvsFromGroup(e)}searchCloudMessages(e){const t=this._get(Xs);return t?t.searchCloudMessages(e):ni({code:ei.NO_MODULE})}searchCloudUsers(e){const t=this._get(Xs);return t?t.searchCloudUsers(e):ni({code:ei.NO_MODULE})}searchCloudGroups(e){const t=this._get(Xs);return t?t.searchCloudGroups(e):ni({code:ei.NO_MODULE})}searchCloudGroupMembers(e){const t=this._get(Xs);return t?t.searchCloudGroupMembers(e):ni({code:ei.NO_MODULE})}getMyProfile(){return this._get(Ts).getMyProfile()}getUserProfile(e){return this._get(Ts).getUserProfile(e)}updateMyProfile(e){return this._get(Ts).updateMyProfile(e)}getBlacklist(){return this._get(Ts).getLocalBlacklist()}addToBlacklist(e){return this._get(Ts).addBlacklist(e)}removeFromBlacklist(e){return this._get(Ts).deleteBlacklist(e)}setSelfStatus(e){return this._get(Ts).setSelfStatus(e)}getUserStatus(e){return this._get(Ts).getUserStatus(e)}subscribeUserStatus(e){return this._get(Ts).subscribeUserStatus(e)}unsubscribeUserStatus(e){return this._get(Ts).unsubscribeUserStatus(e)}getFriendList(){const e=this._get(Es);return e?e.getLocalFriendList():ni({code:ei.NO_MODULE})}addFriend(e){const t=this._get(Es);return t?t.addFriend(e):ni({code:ei.NO_MODULE})}deleteFriend(e){const t=this._get(Es);return t?t.deleteFriend(e):ni({code:ei.NO_MODULE})}checkFriend(e){const t=this._get(Es);return t?t.checkFriend(e):ni({code:ei.NO_MODULE})}getFriendProfile(e){const t=this._get(Es);return t?t.getFriendProfile(e):ni({code:ei.NO_MODULE})}updateFriend(e){const t=this._get(Es);return t?t.updateFriend(e):ni({code:ei.NO_MODULE})}getFriendApplicationList(){const e=this._get(Es);return e?e.getLocalFriendApplicationList():ni({code:ei.NO_MODULE})}acceptFriendApplication(e){const t=this._get(Es);return t?t.acceptFriendApplication(e):ni({code:ei.NO_MODULE})}refuseFriendApplication(e){const t=this._get(Es);return t?t.refuseFriendApplication(e):ni({code:ei.NO_MODULE})}deleteFriendApplication(e){const t=this._get(Es);return t?t.deleteFriendApplication(e):ni({code:ei.NO_MODULE})}setFriendApplicationRead(){const e=this._get(Es);return e?e.setFriendApplicationRead():ni({code:ei.NO_MODULE})}getFriendGroupList(){const e=this._get(Es);return e?e.getLocalFriendGroupList():ni({code:ei.NO_MODULE})}createFriendGroup(e){const t=this._get(Es);return t?t.createFriendGroup(e):ni({code:ei.NO_MODULE})}deleteFriendGroup(e){const t=this._get(Es);return t?t.deleteFriendGroup(e):ni({code:ei.NO_MODULE})}addToFriendGroup(e){const t=this._get(Es);return t?t.addToFriendGroup(e):ni({code:ei.NO_MODULE})}removeFromFriendGroup(e){const t=this._get(Es);return t?t.removeFromFriendGroup(e):ni({code:ei.NO_MODULE})}renameFriendGroup(e){const t=this._get(Es);return t?t.renameFriendGroup(e):ni({code:ei.NO_MODULE})}followUser(e){const t=this._get(zs);return t?t.followUser(e):ni({code:ei.NO_MODULE})}unfollowUser(e){const t=this._get(zs);return t?t.unfollowUser(e):ni({code:ei.NO_MODULE})}getMyFollowersList(e){const t=this._get(zs);return t?t.getMyFollowersList(e):ni({code:ei.NO_MODULE})}getMyFollowingList(e){const t=this._get(zs);return t?t.getMyFollowingList(e):ni({code:ei.NO_MODULE})}getMutualFollowersList(e){const t=this._get(zs);return t?t.getMutualFollowersList(e):ni({code:ei.NO_MODULE})}getUserFollowInfo(e){const t=this._get(zs);return t?t.getUserFollowInfo(e):ni({code:ei.NO_MODULE})}checkFollowType(e){const t=this._get(zs);return t?t.checkFollowType(e):ni({code:ei.NO_MODULE})}getGroupList(){const e=this._get(vs);return e?e.getGroupList():ni({code:ei.NO_MODULE})}getGroupProfile(e){const t=this._get(vs);return t?t.getGroupProfile(e):ni({code:ei.NO_MODULE})}createGroup(e){const t=this._get(vs);return t?t.createGroup(e):ni({code:ei.NO_MODULE})}dismissGroup(e){const t=this._get(vs);return t?t.dismissGroup(e):ni({code:ei.NO_MODULE})}updateGroupProfile(e){const t=this._get(vs);return t?t.updateGroupProfile(e):ni({code:ei.NO_MODULE})}joinGroup(e){const t=this._get(vs);return t?t.joinGroup(e):ni({code:ei.NO_MODULE})}quitGroup(e){const t=this._get(vs);return t?t.quitGroup(e):ni({code:ei.NO_MODULE})}searchGroupByID(e){const t=this._get(vs);return t?t.searchGroupByID(e):ni({code:ei.NO_MODULE})}getGroupOnlineMemberCount(e){const t=this._get(vs);return t?t.getGroupOnlineMemberCount(e):ni({code:ei.NO_MODULE})}changeGroupOwner(e){const t=this._get(vs);return t?t.changeGroupOwner(e):ni({code:ei.NO_MODULE})}getGroupApplicationList(){const e=this._get(vs);return e?e.getGroupApplicationList():ni({code:ei.NO_MODULE})}handleGroupApplication(e){const t=this._get(vs);return t?t.handleGroupApplication(e):ni({code:ei.NO_MODULE})}initGroupAttributes(e){const t=this._get(vs);return t?t.initGroupAttributes(e):ni({code:ei.NO_MODULE})}setGroupAttributes(e){const t=this._get(vs);return t?t.setGroupAttributes(e):ni({code:ei.NO_MODULE})}deleteGroupAttributes(e){const t=this._get(vs);return t?t.deleteGroupAttributes(e):ni({code:ei.NO_MODULE})}getGroupAttributes(e){const t=this._get(vs);return t?t.getGroupAttributes(e):ni({code:ei.NO_MODULE})}setGroupCounters(e){const t=this._get(vs);return t?t.setGroupCounters(e):ni({code:ei.NO_MODULE})}increaseGroupCounter(e){const t=this._get(vs);return t?t.increaseGroupCounter(e):ni({code:ei.NO_MODULE})}decreaseGroupCounter(e){const t=this._get(vs);return t?t.decreaseGroupCounter(e):ni({code:ei.NO_MODULE})}getGroupCounters(e){const t=this._get(vs);return t?t.getGroupCounters(e):ni({code:ei.NO_MODULE})}getGroupMemberList(e){const t=this._get(vs);return t?t.getGroupMemberList(e):ni({code:ei.NO_MODULE})}getGroupMemberProfile(e){const t=this._get(vs);return t?t.getGroupMemberProfile(e):ni({code:ei.NO_MODULE})}addGroupMember(e){const t=this._get(vs);return t?t.addGroupMember(e):ni({code:ei.NO_MODULE})}deleteGroupMember(e){const t=this._get(vs);return t?t.deleteGroupMember(e):ni({code:ei.NO_MODULE})}setGroupMemberMuteTime(e){const t=this._get(vs);return t?t.setGroupMemberMuteTime(e):ni({code:ei.NO_MODULE})}setGroupMemberRole(e){const t=this._get(vs);return t?t.setGroupMemberRole(e):ni({code:ei.NO_MODULE})}setGroupMemberNameCard(e){const t=this._get(vs);return t?t.setGroupMemberNameCard(e):ni({code:ei.NO_MODULE})}setGroupMemberCustomField(e){const t=this._get(vs);return t?t.setGroupMemberCustomField(e):ni({code:ei.NO_MODULE})}markGroupMemberList(e){const t=this._get(vs);return t?t.markGroupMemberList(e):ni({code:ei.NO_MODULE})}getJoinedCommunityList(){return this._get(Ss).getJoinedCommunityList()}createTopicInCommunity(e){return this._get(Ss).createTopicInCommunity(e)}deleteTopicFromCommunity(e){return this._get(Ss).deleteTopicFromCommunity(e)}updateTopicProfile(e){return this._get(Ss).updateTopicProfile(e)}getTopicList(e){return this._get(Ss).getTopicList(e)}addSignalingListener(e,t,s){const i=this._get(Ws);i&&i.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,s),s)}removeSignalingListener(e,t,s){var i=this._safetyCallbackFactory.find(e,t);if(null!==i){const n=this._get(Ws);n&&(n.removeSignalingListener(e,i,s),this._safetyCallbackFactory.delete(e,t))}}invite(e){const t=this._get(Ws);return t?t.invite(e):ni({code:ei.NO_MODULE})}inviteSync(e,t,s){const i=this._get(Ws);return i?i.inviteSync(e,t,s):""}inviteInGroup(e){const t=this._get(Ws);return t?t.invite(e):ni({code:ei.NO_MODULE})}inviteInGroupSync(e,t,s){const i=this._get(Ws);return i?i.inviteSync(e,t,s):""}cancel(e){const t=this._get(Ws);return t?t.cancel(e):ni({code:ei.NO_MODULE})}accept(e){const t=this._get(Ws);return t?t.accept(e):ni({code:ei.NO_MODULE})}reject(e){const t=this._get(Ws);return t?t.reject(e):ni({code:ei.NO_MODULE})}getSignalingInfo(e){const t=this._get(Ws);return t?t.getSignalingInfo(e):null}modifyInvitation(e){const t=this._get(Ws);return t?t.modifyInvitation(e):ni({code:ei.NO_MODULE})}}const Lr={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 Ar(e,t){if(e.isReady()||1===Lr[t])return!0;var s=e.getNotReadyReason(),s={code:s,message:e.getErrMsg(s)+` | ${t} | `+e.getErrMsg(ei.SDK_IS_NOT_READY)};return e.onError(s),s}const Or={},Nr={create:function(t){var i="TencentCloudChat.create";let n=0;var o=t["SDKAppID"];if(Ge(o))n=o;else if(n=parseInt(o),isNaN(o))return Ce.e(i+" failed. Failed to parse the SDKAppID, please check the arguments"),null;if(n&&Or[n])return Or[n];Ce.l(i);const r=new Rr({...t,SDKAppID:n});r.on(e.SDK_DESTROY,e=>{Or[e.data.SDKAppID]=null,delete Or[e.data.SDKAppID]});o=function(n){const e=Object.create(null);return Object.keys(fs).forEach(i=>{if(n[i]){const t=new s;e[i]=function(){var e=Array.from(arguments);return t.use(function(e,t){var s=Ar(n,i);return!0===s?t():ni(s)}).use(function(e,t){if(!0===Lt(e,ms[i],i))return t()}).use(function(e,t){return n[i].apply(n,e)}),t.run(e)}}}),e}(r);return Or[n]=o,ms.hookGetAPITips(r.getErrMsg.bind(r)),Ce.l(i+" ok"),o}};Nr.TYPES=t,Nr.EVENT=e,Nr.TSignaling={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},Nr.VERSION="3.5.2",Ce.l("TencentCloudChat.VERSION:"+Nr.VERSION);export{Nr as default}; |