zoujiandong 360c1bb977 视频
2024-01-12 09:38:24 +08:00

14 lines
672 KiB
JavaScript

module.exports = (function() {
var __MODS__ = {};
var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1704768242895, function(require, module, exports) {
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TencentCloudChat=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){s(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function d(e,t,n){return(d=l()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var a=new(Function.bind.apply(e,o));return n&&u(a,n.prototype),a}).apply(null,arguments)}function p(e){var t="function"==typeof Map?new Map:void 0;return(p=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,o)}function o(){return d(e,arguments,c(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),u(o,e)})(e)}function _(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return g(e)}function f(e){var t=l();return function(){var n,o=c(e);if(t){var a=c(this).constructor;n=Reflect.construct(o,arguments,a)}else n=o.apply(this,arguments);return h(this,n)}}function v(e,t){return M(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,a,i=[],s=!0,r=!1;try{for(n=n.call(e);!(s=(o=n.next()).done)&&(i.push(o.value),!t||i.length!==t);s=!0);}catch(c){r=!0,a=c}finally{try{s||null==n.return||n.return()}finally{if(r)throw a}}return i}(e,t)||y(e,t)||C()}function m(e){return function(e){if(Array.isArray(e))return T(e)}(e)||I(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e){if(Array.isArray(e))return e}function I(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function y(e,t){if(e){if("string"==typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw i}}}}var 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",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange"},S={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3},N={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},k=function(){function e(){o(this,e),this.cache=[],this.options=null}return i(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),A=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return i(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),L={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:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.18.188"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT:"wss://wssidn.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},R={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15},O="1.7.3",G=537048168,P="CHINA",U="OVERSEA",b="SINGAPORE",w="KOREA",F="GERMANY",q="IND",x="JPN",V="USA",H="INDONESIA",B={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P;this.CURRENT=L.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MESSAGE_SEARCH:"message_search"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},K={SEARCH_MSG:new A(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new A(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new A(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new A(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new A(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new A(0,Math.pow(2,6)).toString(),USER_STATUS:new A(0,Math.pow(2,7)).toString(),CONV_MARK:new A(0,Math.pow(2,9)).toString(),CONV_GROUP:new A(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new A(0,Math.pow(2,11)).toString(),MSG_EXT:new A(0,Math.pow(2,13)).toString(),GRP_COUNTER:new A(0,Math.pow(2,15)).toString(),MSG_REACTION:new A(Math.pow(2,16)).toString()},Y="c2c_text_message",W="c2c_custom_message",j="group_text_message",J="group_custom_message",z="user_profile",X="sns",Q="group_profile",Z="group_member_profile";B.HOST.setCurrent(P);var $="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),ee=$&&"function"==typeof wx.createGamePortal,te="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),ne="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),oe="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),ae="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ie="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,se="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,re="undefined"!=typeof uni,ce=$||te||ne||oe||ae||se||ie,ue=("undefined"!=typeof uni||"undefined"!=typeof window)&&!ce,le=te?qq:ne?tt:oe?swan:ae?my:$?wx:se?uni:ie?jd:{},de=ue&&window&&window.navigator&&window.navigator.userAgent||"",pe=/(micromessenger|webbrowser)/i.test(de),_e=/AppleWebKit\/([\d.]+)/i.exec(de);_e&&parseFloat(_e.pop());var ge,he,fe=(ge="WEB",pe?ge="WEB":te?ge="QQ_MP":ne?ge="TT_MP":oe?ge="BAIDU_MP":ae?ge="ALI_MP":$?ge="WX_MP":se&&(ge="UNI_NATIVE_APP"),R[ge]),ve=/iPad/i.test(de),me=/iPhone/i.test(de)&&!ve,Me=/iPod/i.test(de),Ie=me||ve||Me,ye=(he=de.match(/OS (\d+)_/i))&&he[1]?he[1]:null,Te=/Android/i.test(de),Ce=function(){var e=de.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),De=/Edge/i.test(de),Ee=!De&&/Chrome/i.test(de);!function(){var e=de.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Se=/MSIE/.test(de)||de.indexOf("Trident")>-1&&de.indexOf("rv:11.0")>-1,Ne=function(){var e=/MSIE\s(\d+)\.\d/.exec(de),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(de)&&/rv:11.0/.test(de)&&(t=11),t}(),ke=/Safari/i.test(de)&&!Ee&&!Te&&!De;!function(){var e=de.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Ae,Le,Re=/Windows/i.test(de),Oe=/MAC OS X/i.test(de),Ge=ue&&"undefined"!=typeof Worker&&!Se,Pe=Te||Ie,Ue=ue&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy,be=function(){if("undefined"==typeof window)return!1;var e=window.navigator.standalone;return!(!Ie||e||ke)}();Ae="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var we=function(){},Fe=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],qe=Fe.length;qe--;)Le=Fe[qe],console[Le]||(Ae[Le]=we);var xe=Ae,Ve=0,He=function(){return(new Date).getTime()+Ve},Be=function(){Ve=0},Ke=function(){return Math.floor(He()/1e3)},Ye=0;function We(){return on()?"%c Chat %c":"Chat"}function je(){var e,t=((e=new Date).setTime(He()),e);return t.toLocaleTimeString("en-US",{hour12:!1})+"."+function(e){var t;switch(e.toString().length){case 1:t="00"+e;break;case 2:t="0"+e;break;default:t=e}return t}(t.getMilliseconds())}var Je={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n<o;n++)Mt(e[n])?yt(e[n])?t+=St(e[n]):t+=JSON.stringify(e[n]):t+=e[n],t+=" ";return t},_exec:function(e,t){on()?xe[e](We(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",je(),t):xe[e]("".concat(We()," ").concat(je()," ").concat(t))},d:function(){if(Ye<=-1){var e=this.arguments2String(arguments);this._exec("debug",e)}},l:function(){if(Ye<=0){var e=this.arguments2String(arguments);this._exec("log",e)}},log:function(){if(Ye<=0){var e=this.arguments2String(arguments);this._exec("log",e)}},i:function(){if(Ye<=1){var e=this.arguments2String(arguments);this._exec("info",e)}},w:function(){if(Ye<=2){var e=this.arguments2String(arguments);this._exec("warn",e)}},e:function(){if(Ye<=3){var e=this.arguments2String(arguments);this._exec("error",e)}},setLevel:function(e){e<4&&this._exec("log","set level from "+Ye+" to "+e),Ye=e},getLevel:function(){return Ye}},ze={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Xe={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"},Qe="Tag_SNS_IM_Group",Ze="Tag_SNS_IM_Remark",$e="Tag_SNS_IM_AddSource",et="Tag_SNS_IM_AddWording",nt="Tag_SNS_IM_AddTime",ot={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},at={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},it={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},st="JoinedSuccess",rt="WaitAdminApproval",ct="@TGS#_",ut="@TOPIC#_",lt=["url"],dt=function(e){return"map"===Ct(e)},pt=function(e){return"file"===Ct(e)},_t=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"===n(e)&&e.constructor===Number)},gt=function(e){return"string"==typeof e},ht=function(e){return null!==e&&"object"===n(e)},ft=function(e){if("object"!==n(e)||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return t===o},vt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===Ct(e)},mt=function(e){return void 0===e},Mt=function(e){return vt(e)||ht(e)},It=function(e){return"function"==typeof e},yt=function(e){return e instanceof Error},Tt=function(e){return"filelist"===Ct(e)},Ct=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},Dt=function(e){if("string"!=typeof e)return!1;var t=e[0];return!/[^a-zA-Z0-9]/.test(t)};Date.now||(Date.now=function(){return(new Date).getTime()});var Et=function e(t,n,o,a){if(!Mt(t)||!Mt(n))return 0;for(var i,s=0,r=Object.keys(n),c=0,u=r.length;c<u;c++)if(i=r[c],!(mt(n[i])||o&&o.includes(i)))if(Mt(t[i])&&Mt(n[i]))s+=e(t[i],n[i],o,a);else{if(a&&a.includes(n[i]))continue;t[i]!==n[i]&&(t[i]=n[i],s+=1)}return s},St=function(e){return JSON.stringify(e,["message","code"])},Nt=function(e){if(0===e.length)return 0;for(var t=0,n=0,o="undefined"!=typeof document&&void 0!==document.characterSet?document.characterSet:"UTF-8";void 0!==e[t];)n+=e[t++].charCodeAt[t]<=255?1:!1===o?3:2;return n},kt=function(e){var t=e||99999999;return Math.round(Math.random()*t)},At="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Lt=At.length,Rt=function(e,t){for(var n in e)if(e[n]===t)return!0;return!1},Ot={},Gt=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")},Pt=function e(t){if(0===Object.getOwnPropertyNames(t).length)return Object.create(null);var o=Array.isArray(t)?[]:Object.create(null),a="";for(var i in t)null!==t[i]?void 0!==t[i]?(a=n(t[i]),["string","number","function","boolean"].indexOf(a)>=0?o[i]=t[i]:o[i]=e(t[i])):o[i]=void 0:o[i]=null;return o};function Ut(e,t){if(!vt(e)||!vt(t))return!1;var n=!1;return t.forEach((function(t){var o=t.key,a=t.value,i=e.find((function(e){return e.key===o}));i?i.value!==a&&(i.value=a,n=!0):(e.push({key:o,value:a}),n=!0)})),n}var bt=function(e){return e===S.GRP_AVCHATROOM},wt=function(e){var t=e.type,n=e.groupID;return t===S.GRP_COMMUNITY||"".concat(n).startsWith(ct)&&!"".concat(n).includes(ut)},Ft=function(e){return"".concat(e).startsWith(ct)&&"".concat(e).includes(ut)},qt=function(e){return gt(e)&&e.slice(0,3)===S.CONV_C2C},xt=function(e){return gt(e)&&e.slice(0,5)===S.CONV_GROUP},Vt=function(e){return gt(e)&&e===S.CONV_SYSTEM};function Ht(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function Bt(e){return ce?new Promise((function(t,n){le.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):Se&&9===Ne?Promise.resolve({width:0,height:0}):new Promise((function(t,n){var o=new Image;o.onload=function(){t({width:this.width,height:this.height}),o=null},o.onerror=function(){t({width:0,height:0}),o=null},o.src=e}))}function Kt(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return"".concat(e()+e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e()).concat(e())}function Yt(){var e="unknown";if(Oe&&(e="mac"),Re&&(e="windows"),Ie&&(e="ios"),Te&&(e="android"),ce)try{var t=le.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function Wt(e,t){e=e.split("."),t=t.split(".");for(var n=Math.max(e.length,t.length);e.length<n;)e.push("0");for(;t.length<n;)t.push("0");for(var o=0;o<n;o++){var a=parseInt(e[o]),i=parseInt(t[o]);if(a>i)return 1;if(a<i)return-1}return 0}function jt(e){var t=e.originUrl,n=void 0===t?void 0:t,o=e.originWidth,a=e.originHeight,i=e.min,s=void 0===i?198:i,r=parseInt(o),c=parseInt(a),u={url:void 0,width:0,height:0};if((r<=c?r:c)<=s)u.url=n,u.width=r,u.height=c;else{c<=r?(u.width=Math.ceil(r*s/c),u.height=s):(u.width=s,u.height=Math.ceil(c*s/r));var l=n&&n.indexOf("?")>-1?"".concat(n,"&"):"".concat(n,"?");u.url="".concat(l,198===s?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return mt(n)?(u.url,_(u,lt)):u}function Jt(e){var t=e[2];e[2]=e[1],e[1]=t;for(var n=0;n<e.length;n++)e[n].setType(n)}function zt(e){var t=e.servcmd;return t.slice(t.indexOf(".")+1)}function Xt(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function Qt(e,t){return e.includes(t)}function Zt(e,t){return e.includes(t)}function $t(e){return e.split(ut)[0]}var en=function(e,t,n){if(mt(t))return"";switch(e){case S.MSG_TEXT:return t.text;case S.MSG_IMAGE:return n?"[Image]":"[图片]";case S.MSG_LOCATION:return n?"[Location]":"[位置]";case S.MSG_AUDIO:return n?"[Voice]":"[语音]";case S.MSG_VIDEO:return n?"[Video]":"[视频]";case S.MSG_FILE:return n?"[File]":"[文件]";case S.MSG_CUSTOM:return n?"[Custom Messages]":"[自定义消息]";case S.MSG_GRP_TIP:return n?"[Group Notification]":"[群提示消息]";case S.MSG_GRP_SYS_NOTICE:return n?"[Group System Message]":"[群系统通知]";case S.MSG_FACE:return n?"[Animated Sticker]":"[动画表情]";case S.MSG_MERGER:return n?"[Chat Record]":"[聊天记录]";default:return""}};function tn(e){return e===S.MSG_TEXT||e===S.MSG_CUSTOM||e===S.MSG_LOCATION||e===S.MSG_FACE}function nn(e){var t=[];if(!gt(e))return t;var n=e.length;if(0===n)return t;for(var o=n-1;o>=0;o--)"1"===e[o]&&t.push(Math.pow(2,n-o-1));return t}function on(){return!Se&&!ce}function an(e){return"the length of userIDList cannot exceed ".concat(e)}function sn(e,t){if(e){var n=e;return t&&(e.startsWith("http://")?n=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(n=e.replace(/^https:\/\/[^/]+/,t))),n}}function rn(e){if(vt(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t.toFixed(0)}}function cn(e){if(vt(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}}function un(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=Date.now();return t?n?"".concat(o-e," ms"):"".concat(Math.round((o-e)/1e3)," s"):n?o-e:Math.round((o-e)/1e3)}function ln(e){var t=!1;return e&&e>1&&(t=!0),t}var dn=Object.prototype.hasOwnProperty;function pn(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(ft(e)){for(var t in e)if(dn.call(e,t))return!1;return!0}return!(!dt(e)&&(n=e,"set"!==Ct(n))&&!pt(e))&&0===e.size;var n}function _n(e,t,n){if(void 0===t)return!0;var o=!0;if(ft(t))Object.keys(t).forEach((function(a){var i=1===e.length?e[0][a]:void 0;o=!!gn(i,t[a],n,a)&&o}));else if(vt(t))for(var a=0;a<t.length;a++)o=!!gn(e[a],t[a],n,t[a].name)&&o;if(o)return o;throw new Error("Params validate failed.")}function gn(e,t,n,o){if(void 0===t)return!0;var a=!0;if(t.required&&pn(e)&&(Je.e("[".concat(n,'] Missing required params: "').concat(o,'".')),a=!1),!pn(e)){var i=Ct(e),s=t.type.toLowerCase();i!==s&&("asyncfunction"===i&&"function"===s||(Je.e("[".concat(n,'] Invalid params: type check failed for "').concat(o,'". Expected ').concat(t.type,".")),a=!1))}return t.validator&&!t.validator(e,n,o)&&(Je.e("[".concat(n,'] Invalid params: custom validator check failed for "').concat(o,'".')),a=!1),a}var hn,fn={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},vn={NOT_START:"notStart",PENDING:"pending",RESOLVED:"resolved",REJECTED:"rejected"},mn=function(e){if(!e)return!1;if(qt(e)||xt(e)||Vt(e))return!0;var t=jn("InvalidConversationID",e);return t&&Je.w(t),!1},Mn=function(e){""!==e.desc&&""!==jn("API_REFER")&&Je.w("[".concat(e.api,"] | ").concat(e.paramName," | ").concat(e.desc,", ").concat(jn("API_REFER")).concat(e.api))},In=function(){return jn("StringRequiredLog")},yn=function(e){return jn("NonEmptyStringRequiredLog",e)},Tn=function(){return jn("NumberRequiredLog")},Cn=function(){return jn("UndefinedNotAllowedLog")},Dn=function(){return jn("FileRequiredLog")},En=function(){return jn("FunctionRequiredLog")},Sn=function(){return jn("ArrayRequiredLog")},Nn=function(){return jn("NonEmptyArrayLog")},kn=function(){return jn("CallbackMissingLog")},An=function(){return jn("PositiveIntegerRequiredLog")},Ln=function(e,t){return jn("StringNotLongerThanLog",e,t)},Rn=function(e,t){return jn("NumberLessThanLog",e,t)},On=function(e,t){return jn("NumberGreaterOrEqualLog",e,t)},Gn=function(e){return jn("KeyValueStringRequiredLog",e)},Pn=function(){return jn("PlainObjectRequiredLog")},Un=function(){return jn("NonEmptyContentRequiredLog")},bn=function(){return jn("FileNotSelectedLog")},wn=function(){return jn("MessageInstanceRequiredLog")},Fn=function(){return jn("NonAnonymousFunctionLog")},qn=function(){return jn("MessageExtensionNotAvailableLog")},xn=function(){return jn("MessageReactionRequiredLog")},Vn=function(e,t){return jn("MaximumArrayLengthLog",e,t)},Hn={type:"String",required:!0},Bn={type:"Array",required:!0},Kn={type:"Object",required:!0},Yn={type:"Boolean",required:!0},Wn={type:"number",required:!0},jn=null,Jn={hookGetAPITips:function(e){jn=e},login:{userID:Hn,userSig:Hn},addToBlacklist:{userIDList:Bn},removeFromBlacklist:{userIDList:Bn},on:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Mn({api:t,paramName:n,desc:yn(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Mn({api:t,paramName:n,desc:En()}),!1):(""===e.name&&Mn({api:t,paramName:n,desc:Fn()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Mn({api:t,paramName:n,desc:yn(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Mn({api:t,paramName:n,desc:En()}),!1):(""===e.name&&Mn({api:t,paramName:n,desc:Fn()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Mn({api:t,paramName:n,desc:yn(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Mn({api:t,paramName:n,desc:En()}),!1):(""===e.name&&Mn({api:t,paramName:n,desc:Fn()}),!0)}}],sendMessage:[t({name:"message"},Kn)],setMessageExtensions:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS&&!0===e.isSupportExtension||(Mn({api:t,paramName:n,desc:qn()}),!1)}}),t({name:"extensions"},Bn)],getMessageExtensions:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS&&!0===e.isSupportExtension||(Mn({api:t,paramName:n,desc:qn()}),!1)}})],deleteMessageExtensions:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS&&!0===e.isSupportExtension||(Mn({api:t,paramName:n,desc:qn()}),!1)}})],addMessageReaction:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS||(Mn({api:t,paramName:n,desc:xn()}),!1)}}),t({name:"reactionID"},Hn)],removeMessageReaction:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS||(Mn({api:t,paramName:n,desc:xn()}),!1)}}),t({name:"reactionID"},Hn)],getMessageReactions:{messageList:t({},Bn)},getAllUserListOfMessageReaction:{message:t(t({},Kn),{},{validator:function(e,t,n){return e.status===fn.SUCCESS||(Mn({api:t,paramName:n,desc:xn()}),!1)}}),reactionID:t({},Hn),nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:t(t({},Hn),{},{validator:function(e){return mn(e)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e,t,n){return!(!mt(e)&&!/^[1-9][0-9]*$/.test(e))||(Mn({api:t,paramName:n,desc:An()}),!1)}}},getMessageListHopping:{conversationID:t(t({},Hn),{},{validator:function(e){return mn(e)}}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e,t,n){return!(!mt(e)&&0!==e&&1!==e)||(Mn({api:t,paramName:n,desc:jn("0Or1RequiredLog")}),!1)}},count:{type:"Number",validator:function(e,t,n){return!(!mt(e)&&!/^[1-9][0-9]*$/.test(e))||(Mn({api:t,paramName:n,desc:An}),!1)}}},setMessageRead:{conversationID:t(t({},Hn),{},{validator:function(e){return mn(e)}})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e,t,n){return!e||-1!==[S.READ_ALL_C2C_MSG,S.READ_ALL_GROUP_MSG,S.READ_ALL_MSG].indexOf(e)||(Mn({api:t,paramName:n,desc:jn("ValidScopeRequired")}),!1)}}},getConversationProfile:[t(t({name:"conversationID"},Hn),{},{validator:function(e){return mn(e)}})],clearHistoryMessage:[t(t({name:"conversationID"},Hn),{},{validator:function(e){return mn(e)}})],pinConversation:{conversationID:t(t({},Hn),{},{validator:function(e){return mn(e)}}),isPinned:t({},Yn)},setConversationDraft:{conversationID:t(t({},Hn),{},{validator:function(e){return mn(e)}}),draftText:{type:"String",validator:function(e,t,n){return!!gt(e)||(Mn({api:t,paramName:n,desc:In()}),!1)}}},setConversationCustomData:{conversationIDList:t({},Bn),customData:{type:"String",validator:function(e,t,n){return gt(e)?!(e.length>256)||(Mn({api:t,paramName:n,desc:Ln(n,256)}),!1):(Mn({api:t,paramName:n,desc:In()}),!1)}}},markConversation:{conversationIDList:t({},Bn),markType:{type:"number",validator:function(e,t,n){return _t(e)?e<=0?(Mn({api:t,paramName:n,desc:(o=n,a=0,jn("NumberGreaterThanLog",o,a))}),!1):!(e>=Math.pow(2,64))||(Mn({api:t,paramName:n,desc:Rn(n,"Math.pow(2,64)")}),!1):(Mn({api:t,paramName:n,desc:Tn()}),!1);var o,a}},enableMark:t({},Yn)},createConversationGroup:{conversationIDList:t({},Bn),groupName:t(t({},Hn),{},{validator:function(e,t,n){return!!e&&(!(e.length>32)||(Mn({api:t,paramName:n,desc:Ln(n,32)}),!1))}})},deleteConversationGroup:[t({name:"groupName"},Hn)],renameConversationGroup:{oldName:t({},Hn),newName:t(t({},Hn),{},{validator:function(e,t,n){return!!e&&(!(e.length>32)||(Mn({api:t,paramName:n,desc:Ln(n,32)}),!1))}})},addConversationsToGroup:{conversationIDList:t({},Bn),groupName:t({},Hn)},deleteConversationsFromGroup:{conversationIDList:t({},Bn),groupName:t({},Hn)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Hn,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Bn},createGroup:{name:Hn},joinGroup:{groupID:Hn,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Hn)],handleApplication:{message:Kn,handleAction:Hn,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Hn,newOwnerID:Hn},updateGroupProfile:{groupID:Hn,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Hn)],searchGroupByID:[t({name:"groupID"},Hn)],getGroupOnlineMemberCount:[t({name:"groupID"},Hn)],initGroupAttributes:{groupID:Hn,groupAttributes:t(t({},Kn),{},{validator:function(e,t,n){var o=!0;return Object.keys(e).forEach((function(a){if(!gt(e[a]))return Mn({api:t,paramName:n,desc:Gn("value")}),o=!1})),o}})},setGroupAttributes:{groupID:Hn,groupAttributes:t(t({},Kn),{},{validator:function(e,t,n){var o=!0;return Object.keys(e).forEach((function(a){if(!gt(e[a]))return Mn({api:t,paramName:n,desc:Gn("value")}),o=!1})),o}})},deleteGroupAttributes:{groupID:Hn,keyList:{type:"Array",validator:function(e,t,n){if(mt(e)||!vt(e))return Mn({api:t,paramName:n,desc:Sn()}),!1;if(!pn(e)){var o=!0;return e.forEach((function(e){if(!gt(e))return Mn({api:t,paramName:n,desc:jn("StringArrayRequiredLog")}),o=!1})),o}return!0}}},getGroupAttributes:{groupID:Hn,keyList:{type:"Array",validator:function(e,t,n){if(mt(e)||!vt(e))return Mn({api:t,paramName:n,desc:Sn()}),!1;if(!pn(e)){var o=!0;return e.forEach((function(e){if(!gt(e))return Mn({api:t,paramName:n,desc:Gn("key")}),o=!1})),o}return!0}}},setGroupCounters:{groupID:Hn,counters:Kn},increaseGroupCounter:{groupID:Hn,key:Hn,value:Wn},decreaseGroupCounter:{groupID:Hn,key:Hn,value:Wn},getGroupCounters:{groupID:Hn},getGroupMemberList:{groupID:Hn,count:{type:"Number"}},getGroupMemberProfile:{groupID:Hn,userIDList:Bn,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Hn,userIDList:Bn},setGroupMemberRole:{groupID:Hn,userID:Hn,role:Hn},setGroupMemberMuteTime:{groupID:Hn,userID:Hn,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Hn,userID:{type:"String"},nameCard:{type:"String",validator:function(e,t,n){return gt(e)?(e.length,!0):(Mn({api:t,paramName:n,desc:In()}),!1)}}},setGroupMemberCustomField:{groupID:Hn,userID:{type:"String"},memberCustomField:Bn},deleteGroupMember:{groupID:Hn},markGroupMemberList:{groupID:Hn,markType:{type:"number",validator:function(e,t,n){return _t(e)?!(e<1e3)||(Mn({api:t,paramName:n,desc:On(n,1e3)}),!1):(Mn({api:t,paramName:n,desc:Tn()}),!1)}},userIDList:t({},Bn),enableMark:t({},Yn)},createTextMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?gt(e.text)?0!==e.text.length||(Mn({api:t,paramName:"payload.text",desc:Un()}),!1):(Mn({api:t,paramName:"payload.text",desc:In()}),!1):(Mn({api:t,paramName:n,desc:Pn()}),!1)}})},createTextAtMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?gt(e.text)?0===e.text.length?(Mn({api:t,paramName:"payload.text",desc:Un()}),!1):!(e.atUserList&&!vt(e.atUserList))||(Mn({api:t,paramName:"payload.atUserList",desc:Sn()}),!1):(Mn({api:t,paramName:"payload.text",desc:In()}),!1):(Mn({api:t,paramName:n,desc:Pn()}),!1)}})},createCustomMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?e.data&&!gt(e.data)?(Mn({api:t,paramName:"payload.data",desc:In()}),!1):e.description&&!gt(e.description)?(Mn({api:t,paramName:"payload.description",desc:In()}),!1):!(e.extension&&!gt(e.extension))||(Mn({api:t,paramName:"payload.extension",desc:In()}),!1):(Mn({api:t,paramName:"payload",desc:Pn()}),!1)}})},createImageMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){if(!ft(e))return Mn({api:t,paramName:n,desc:Pn()}),!1;if(mt(e.file))return Mn({api:t,paramName:"payload.file",desc:Cn()}),!1;if(ue){if(!(e.file instanceof HTMLInputElement||pt(e.file)))return ft(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Mn({api:t,paramName:"payload.file",desc:bn()}),!1):(Mn({api:t,paramName:"payload.file",desc:Dn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Mn({api:t,paramName:"payload.file",desc:bn()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:kn()}),!0}}})},createAudioMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return!!ft(e)||(Mn({api:t,paramName:n,desc:Pn()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:kn()}),!0}}},createVideoMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){if(!ft(e))return Mn({api:t,paramName:n,desc:Pn()}),!1;if(mt(e.file))return Mn({api:t,paramName:"payload.file",desc:Cn()}),!1;if(ue){if(!(e.file instanceof HTMLInputElement||pt(e.file)))return ft(e.file)&&"undefined"!=typeof uni?!!pt(e.file.tempFile)||(Mn({api:t,paramName:"payload.file",desc:bn()}),!1):(Mn({api:t,paramName:"payload.file",desc:Dn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Mn({api:t,paramName:"payload.file",desc:bn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:kn()}),!0}}},createFaceMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?_t(e.index)?!!gt(e.data)||(Mn({api:t,paramName:"payload.data",desc:In()}),!1):(Mn({api:t,paramName:"payload.index",desc:Tn()}),!1):(Mn({api:t,paramName:n,desc:Pn()}),!1)}})},createFileMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){if(!ft(e))return Mn({api:t,paramName:n,desc:Pn()}),!1;if(mt(e.file))return Mn({api:t,paramName:"payload.file",desc:Cn()}),!1;if(ue){if(!(e.file instanceof HTMLInputElement||pt(e.file)))return ft(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(Mn({api:t,paramName:"payload.file",desc:bn()}),!1):(Mn({api:t,paramName:"payload.file",desc:Dn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return Mn({api:t,paramName:"payload.file",desc:bn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:kn()}),!0}}},createLocationMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?gt(e.description)?_t(e.longitude)?!!_t(e.latitude)||(Mn({api:t,paramName:"payload.latitude",desc:Tn()}),!1):(Mn({api:t,paramName:"payload.longitude",desc:Tn()}),!1):(Mn({api:t,paramName:"payload.description",desc:In()}),!1):(Mn({api:t,paramName:n,desc:Pn()}),!1)}})},createMergerMessage:{to:Hn,conversationType:Hn,payload:t(t({},Kn),{},{validator:function(e,t,n){if(pn(e.messageList))return Mn({api:t,paramName:"payload.messageList",desc:Nn()}),!1;if(pn(e.compatibleText))return Mn({api:t,paramName:"payload.compatibleText",desc:yn("compatibleText")}),!1;var o=!1;return e.messageList.forEach((function(e){e.status===fn.FAIL&&(o=!0)})),!o||(Mn({api:t,paramName:"payload.messageList",desc:jn("MergeFailedMessageLog")}),!1)}})},revokeMessage:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return pn(e)?(Mn({api:t,paramName:n,desc:wn()}),!1):e.conversationType===S.CONV_SYSTEM?(Mn({api:t,paramName:n,desc:jn("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(Mn({api:t,paramName:n,desc:jn("MessageRevokedLog")}),!1)}})],deleteMessage:[t(t({name:"messageList"},Bn),{},{validator:function(e,t,n){return!pn(e)||(Mn({api:t,paramName:n,desc:Nn()}),!1)}})],translateText:{sourceTextList:Bn,sourceLanguage:Hn,targetLanguage:Hn},convertVoiceToText:{message:t(t({},Kn),{},{validator:function(e,t,n){return pn(e)?(Mn({api:t,paramName:n,desc:wn()}),!1):e.type===S.MSG_AUDIO&&e.status===fn.SUCCESS||(Mn({api:t,paramName:n,desc:jn("AudioMessageRequiredLog")}),!1)}})},modifyMessage:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return pn(e)?(Mn({api:t,paramName:n,desc:wn()}),!1):e.conversationType===S.CONV_SYSTEM?(Mn({api:t,paramName:n,desc:jn("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(Mn({api:t,paramName:n,desc:jn("OnlineMessageNotSupportLog")}),!1)}})],searchCloudMessages:{keywordList:{type:"Array",required:!1,validator:function(e,t,n){return!e||(vt(e)?0===e.length?(Mn({api:t,paramName:n,desc:Nn()}),!1):!(e.length>5)||(Mn({api:t,paramName:n,desc:Vn(n,5)}),!1):(Mn({api:t,paramName:n,desc:Sn()}),!1))}},keywordListMatchType:{type:"String",required:!1,validator:function(e,t,n){return!e||("or"===e||"and"===e||Mn({api:t,paramName:n,desc:"".concat(e," is invalid match type")}))}},senderUserIDList:{type:"Array",required:!1,validator:function(e,t,n){return!e||(vt(e)?(0===e.length&&Mn({api:t,paramName:n,desc:Nn()}),!(e.length>5)||(Mn({api:t,paramName:n,desc:Vn(n,5)}),!1)):(Mn({api:t,paramName:n,desc:Sn()}),!1))}},messageTypeList:{type:"Array",required:!1,validator:function(e,t,n){if(!e)return!0;if(!vt(e))return Mn({api:t,paramName:n,desc:Sn()}),!1;0===e.length&&Mn({api:t,paramName:n,desc:Nn()});var o,a=[S.MSG_TEXT,S.MSG_IMAGE,S.MSG_AUDIO,S.MSG_FILE,S.MSG_VIDEO,S.MSG_LOCATION,S.MSG_CUSTOM,S.MSG_MERGER];return!(e.filter((function(e){return-1===a.indexOf(e)})).length>0)||(Mn({api:t,paramName:n,desc:(o=n,jn("ContainsUnsupportedMessageTypeLog",o))}),!1)}},conversationID:{type:"String",required:!1,validator:function(e){return!e||mn(e)}},timePosition:{type:"number",required:!1,validator:function(e,t,n){return!e||(!(e<0)||(Mn({api:t,paramName:n,desc:On(n,0)}),!1))}},timePeriod:{type:"number",required:!1,validator:function(e,t,n){return!e||(!(e<0)||(Mn({api:t,paramName:n,desc:On(n,0)}),!1))}},cursor:{type:"String",required:!1}},getUserProfile:{userIDList:{type:"Array",validator:function(e,t,n){return vt(e)?(0===e.length&&Mn({api:t,paramName:n,desc:Nn()}),!0):(Mn({api:t,paramName:n,desc:Sn()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e,t,n){return!!mt(e)||(!!vt(e)||(Mn({api:t,paramName:n,desc:Sn()}),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e,t,n){return!!gt(e)||(Mn({api:t,paramName:n,desc:In()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return vt(e)?0!==e.length||(Mn({api:t,paramName:n,desc:Nn()}),!1):(Mn({api:t,paramName:n,desc:Sn()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return vt(e)?0!==e.length||(Mn({api:t,paramName:n,desc:Nn()}),!1):(Mn({api:t,paramName:n,desc:Sn()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return!e||(!!vt(e)||(Mn({api:t,paramName:n,desc:Sn()}),!1))}}},addFriend:{to:Hn,source:{type:"String",required:!0,validator:function(e,t,n){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(Mn({api:t,paramName:n,desc:Ln("keyword",8)}),!1):(Mn({api:t,paramName:n,desc:jn("SourcePrefixLog")}),!1))}},remark:{type:"String",required:!1,validator:function(e,t,n){return!(gt(e)&&e.length>96)||(Mn({api:t,paramName:n,desc:Ln(n,96)}),!1)}}},deleteFriend:{userIDList:Bn},checkFriend:{userIDList:Bn},getFriendProfile:{userIDList:Bn},updateFriend:{userID:Hn,remark:{type:"String",required:!1,validator:function(e,t,n){return!(gt(e)&&e.length>96)||(Mn({api:t,paramName:n,desc:Ln(n,96)}),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e,t,n){if(e){if(!vt(e))return Mn({api:t,paramName:n,desc:Sn()}),!1;var o=!0;return e.forEach((function(e){return gt(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?gt(e.value)?e.key.replace("Tag_SNS_Custom_","").length>8?(Mn({api:t,paramName:n,desc:Ln("keyword",8)}),o=!1):void 0:(Mn({api:t,paramName:n,desc:Gn("value")}),o=!1):(Mn({api:t,paramName:n,desc:jn("FriendCustomFieldPrefixLog")}),o=!1)})),o}return!0}}},acceptFriendApplication:{userID:Hn},refuseFriendApplication:{userID:Hn},deleteFriendApplication:{userID:Hn},createFriendGroup:{name:Hn},deleteFriendGroup:{name:Hn},addToFriendGroup:{name:Hn,userIDList:Bn},removeFromFriendGroup:{name:Hn,userIDList:Bn},renameFriendGroup:{oldName:Hn,newName:Hn},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e,t,n){return vt(e)?0!==e.length||(Mn({api:t,paramName:n,desc:Nn()}),!1):(Mn({api:t,paramName:n,desc:Sn()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e,t,n){return vt(e)?0!==e.length||(Mn({api:t,paramName:n,desc:Nn()}),!1):(Mn({api:t,paramName:n,desc:Sn()}),!1)}}],createTopicInCommunity:{groupID:Hn,topicName:Hn},deleteTopicFromCommunity:{groupID:Hn,topicIDList:{type:"Array",validator:function(e,t,n){return!e||(!!vt(e)||(Mn({api:t,paramName:n,desc:Sn()}),!1))}}},updateTopicProfile:{groupID:Hn,topicID:Hn},getTopicList:{groupID:Hn,topicIDList:{type:"Array",validator:function(e,t,n){return!e||(!!vt(e)||(Mn({api:t,paramName:n,desc:Sn()}),!1))}}},addSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Mn({api:t,paramName:n,desc:yn(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Mn({api:t,paramName:n,desc:En()}),!1):(""===e.name&&Mn({api:t,paramName:n,desc:Fn()}),!0)}}],removeSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return"string"==typeof e&&0!==e.length||(Mn({api:t,paramName:n,desc:yn(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return"function"!=typeof e?(Mn({api:t,paramName:n,desc:En()}),!1):(""===e.name&&Mn({api:t,paramName:n,desc:Fn()}),!0)}}],invite:{userID:Hn},inviteSync:[t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?!!gt(e.userID)||(Mn({api:t,paramName:"options.userID",desc:In()}),!1):(Mn({api:t,paramName:"options",desc:Pn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:En()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:En()}),!0}}],inviteInGroup:{groupID:Hn,inviteeList:Bn},inviteInGroupSync:[t(t({},Kn),{},{validator:function(e,t,n){return ft(e)?gt(e.groupID)?!!vt(e.inviteeList)||(Mn({api:t,paramName:"options.inviteeList",desc:Sn()}),!1):(Mn({api:t,paramName:"options.groupID",desc:In()}),!1):(Mn({api:t,paramName:"options",desc:Pn()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:En()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return mt(e)&&Mn({api:t,paramName:n,desc:En()}),!0}}],accept:{inviteID:Hn},reject:{inviteID:Hn},getSignalingInfo:[t(t({name:"message"},Kn),{},{validator:function(e,t,n){return!pn(e)||(Mn({api:t,paramName:n,desc:wn()}),!1)}})],modifyInvitation:{inviteID:Hn,data:Hn}},zn={login:1,logout:1,getLoginUser: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,searchCloudMessages: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,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},Xn=1,Qn=2,Zn=3,$n=4,eo=6,to=7,no=8,oo=10,ao=11,io=12,so=13,ro=14,co=15,uo=17,lo=18,po=19,_o=20,go=21,ho=23,fo=24,vo=25,mo=26,Mo=27,Io=28,yo=29,To=30,Co=31,Do=32,Eo=33,So=34,No=function(e){return{code:0,data:e||{}}},ko=function(e){r(n,e);var t=f(n);function n(e){var a;o(this,n),a=t.call(this);var i=e.code,s=e.message,r=e.data;return a.code=i,a.message=s||a._getErrorMessage(a.code),a.data=r||{},a}return i(n)}(p(Error)),Ao={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_AVCHATROOM:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_FUNCTION_ERROR: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_AVCHATROOM:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AVCHATROOM: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,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,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,MSG_SEARCH_CURSOR_INVALID:27002,MSG_SEARCH_CURSOR_EXPIRED:27003},Lo=null,Ro=function(e){Lo=e},Oo=function(e){return Promise.resolve(No(e))},Go=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof ko)return t&&null!==Lo&&Lo.emit(E.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new ko({code:Ao.UNCAUGHT_ERROR});return t&&null!==Lo&&Lo.emit(E.ERROR,n),Promise.reject(n)}if(mt(e)||mt(e.code))return Promise.reject(new ko({code:Ao.UNCAUGHT_ERROR}));var o=new ko(e);return t&&null!==Lo&&Lo.emit(E.ERROR,o),Promise.reject(o)},Po=function(){function e(t){o(this,e),this._m=t,this._n=""}return i(e,[{key:"isLoggedIn",value:function(){return this._m.getModule(io).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.getModule(io).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._m.getModule(io).isPrivateNetWork()}},{key:"getFileDownloadProxy",value:function(){return this._m.getModule(io).getFileDownloadProxy()}},{key:"getMyUserID",value:function(){return this._m.getModule(io).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.getModule(io).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.getModule(io).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.getModule(io).isIntl()}},{key:"isUsingChatCore",value:function(){return this._m.getModule(io).isUsingChatCore()}},{key:"isDevMode",value:function(){return this._m.getModule(io).isDevMode()}},{key:"getModule",value:function(e){return this._m.getModule(e)}},{key:"getPlatform",value:function(){return fe}},{key:"getNetworkType",value:function(){return this._m.getModule(co).getNetworkType()}},{key:"probeNetwork",value:function(e){return this._m.getModule(co).probe(e)}},{key:"getCloudConfig",value:function(e){return this._m.getModule(ho).getCloudConfig(e)}},{key:"emitOuterEvent",value:function(e,t){this._m.getOuterEmitterInstance().emit(e,t)}},{key:"emitInnerEvent",value:function(e,t){this._m.getInnerEmitterInstance().emit(e,t)}},{key:"getInnerEmitterInstance",value:function(){return this._m.getInnerEmitterInstance()}},{key:"generateTjgID",value:function(e){return this._m.getModule(io).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!pn(e)){var t=e.filter((function(e){return!0===e.isModified}));t.length>0&&this.emitOuterEvent(E.MESSAGE_MODIFIED,t)}}},{key:"filterUnmodifiedMessage",value:function(e){return pn(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._m.getModule(_o).request(e)}},{key:"canIUse",value:function(e){return this._m.getModule(Mo).canIUse(e)}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&Je.w(o)}},{key:"cannotUseCommercialAbility",value:function(e){var t=Ao.CANNOT_USE_COMMERCIAL_ABILITY;return Go({code:t,message:this.getErrorMessage(t,e)})}}]),e}(),Uo={LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MESSAGE:"getmsg",SEND_C2C_MESSAGE:"sendmsg",SEND_GROUP_MESSAGE:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BLACKLIST:"black_list_get",ADD_TO_BLACKLIST:"black_list_add",REMOVE_FROM_BLACKLIST:"black_list_delete",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_specified",CHECK_FRIEND:"friend_check",DELETE_FRIEND:"friend_delete",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REFUSE_FRIEND_APPLICATION:"pendency_refuse",REPORT_FRIEND_APPLICATION:"pendency_report",GET_FRIEND_GROUP_LIST:"group_get",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",REVOKE_C2C_MESSAGE:"msgwithdraw",SET_C2C_MESSAGE_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_MESSAGE:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",REMOVE_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"batch_delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",DELETE_GROUP_AT_TIPS:"deletemsg",SET_CONVERSATION_CUSTOM_DATA:"set_conv_custom_data",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",RENAME_CONVERSATION_GROUP:"update_contact_group",ADD_CONVERSATIONS_TO_GROUP:"add_conv_to_group",DELETE_CONVERSATIONS_FROM_GROUP:"del_conv_from_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_GROUP_LIST:"get_joined_group_list",GET_GROUP_PROFILE:"get_group_self_member_info",CREATE_GROUP:"create_group",DISMISS_GROUP:"destroy_group",UPDATE_GROUP_PROFILE:"modify_group_base_info",APPLY_JOIN_GROUP:"apply_join_group",APPLY_JOIN_GROUP_NOAUTH:"apply_join_group_noauth",QUIT_GROUP:"quit_group",SEARCH_GROUP:"get_group_public_info",CHANGE_GROUP_OWNER:"change_group_owner",HANDLE_GROUP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GROUP:"handle_invite_join_permission_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",REVOKE_GROUP_MESSAGE:"group_msg_recall",SET_GROUP_MESSAGE_READ:"msg_read_report",SET_ALL_MESSAGE_READ:"read_all_unread_msg",GET_GROUP_ROAMING_MESSAGE:"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_GROUP_PENDENCY:"get_pendency",DELETE_GROUP_SYSTEM_NOTICE:"deletemsg",AVCHATROOM_POLLING:"get_msg",AVCHATROOM_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MEMBER_NUM:"get_online_member_num",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_NOTIFY:"batch_get_group_notify",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",REMOVE_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",GET_GROUP_MEMBER_PROFILE:"get_specified_group_member_info",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",MARK_AVCHATROOM_MEMBER_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",MESSAGE_PUSH:"msg_push",MESSAGE_CLOUD_SEARCH:"query",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition"},bo="networkRTT",wo="messageE2EDelay",Fo="sendMessageC2C",qo="sendMessageGroup",xo="sendMessageGroupAV",Vo="sendMessageRichMedia",Ho="cosUpload",Bo="messageReceivedGroup",Ko="messageReceivedGroupAVPush",Yo="messageReceivedGroupAVPull",Wo=(s(hn={},bo,2),s(hn,wo,3),s(hn,Fo,4),s(hn,qo,5),s(hn,xo,6),s(hn,Vo,7),s(hn,Bo,8),s(hn,Ko,9),s(hn,Yo,10),s(hn,Ho,11),hn),jo={info:4,warning:5,error:6},Jo={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},zo={login:4},Xo=function(){function e(t){o(this,e),this._n="SSOLogData",this.eventType=zo[t]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=t,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=He()}return i(e,[{key:"updateTimeStamp",value:function(){this.timestamp=He()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._sentFlag){var n=He();0===this.costTime&&(this.costTime=n-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(n)),t?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout((function(){e._sentFlag=!0,e._eventStatModule&&e._eventStatModule.pushIn(e)}),0)}}},{key:"setError",value:function(e,t,n){if(!(e instanceof Error))return Je.w("".concat(this._n,".setError value not instanceof Error, please check!")),this;if(this._sentFlag)return this;if(this.setNetworkType(n),t)e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message);else{var o=Ao.NO_NETWORK;this.setCode(o)}return this.setLevel("error"),this}},{key:"setCode",value:function(e){return mt(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),_t(e)?this.code=e:Je.w("".concat(this._n,".setCode value not a number, please check!"),e,n(e))),this}},{key:"setMessage",value:function(e){return mt(e)||this._sentFlag||(_t(e)&&(this.message=e.toString()),gt(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return mt(e)||this._sentFlag||(this.level=jo[e]),this}},{key:"setMoreMessage",value:function(e){return pn(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(mt(e))Je.w("".concat(this._n,".setNetworkType value is undefined, please check!"));else{var t=Jo[e.toLowerCase()];mt(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}},{key:"setExtension",value:function(e){return this.extension=e,this}},{key:"setEventType",value:function(e){return this.eventType=e,this}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),Qo=function(){function e(t){o(this,e),this.type=S.MSG_TEXT,this.content={text:t.text||""}}return i(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),Zo=function(){function e(t,n){o(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,ce?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=S.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||ze.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return i(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=kt(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.imageUrl||t.url||"",this.url=sn(t.url||e._imageMemoryURL,e._fileDownloadProxy)},this._ImageInfoModel.prototype={setSizeType:function(e){this.sizeType=e},setType:function(e){this.type=e},setImageUrl:function(e){e&&(this.imageUrl=e)},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t=0,n=null,o=null;t<=2;)o=mt(e)||mt(e[t])?{type:0,size:0,width:0,height:0,url:""}:e[t],(n=new this._ImageInfoModel(o)).setSizeType(t+1),n.setType(t),this.addImageInfo(n),t++;this.updateAccessSideImageInfoArray()}},{key:"updateImageInfoArray",value:function(e){for(var t,n=this.content.imageInfoArray.length,o=0;o<n;o++)t=this.content.imageInfoArray[o],e[o].size&&(t.size=e[o].size),e[o].url&&t.setImageUrl(e[o].url),e[o].width&&(t.width=e[o].width),e[o].height&&(t.height=e[o].height)}},{key:"_autoFixUrl",value:function(){for(var e=this.content.imageInfoArray.length,t="",n="",o=["http","https"],a=null,i=0;i<e;i++)this.content.imageInfoArray[i].url&&""!==(a=this.content.imageInfoArray[i]).imageUrl&&(n=a.imageUrl.slice(0,a.imageUrl.indexOf("://")+1),t=a.imageUrl.slice(a.imageUrl.indexOf("://")+1),o.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[i].setImageUrl([n,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=ze[e.toUpperCase()]||ze.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,a=t.height,i=void 0===a?0:a;0!==o&&0!==i&&(Jt(e),Object.assign(e[2],jt({originWidth:o,originHeight:i,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),$o=function(){function e(t){o(this,e),this.type=S.MSG_FACE,this.content=t||null}return i(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),ea=function(){function e(t,n){o(this,e),this.type=S.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:sn(t.url,n),remoteAudioUrl:t.url||"",uuid:t.uuid}}return i(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=e}},{key:"sendable",value:function(){return""!==this.content.remoteAudioUrl}}]),e}(),ta={from:!0,groupID:!0,groupName:!0,to:!0},na=function(){function e(t){o(this,e),this.type=S.MSG_GRP_TIP,this.content={},this._initContent(t)}return i(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"remarkInfo":break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;case"operatorInfo":break;case"memberInfoList":case"msgMemberInfo":t._updateMemberList(e[n]);break;case"memberExtraInfo":case"onlineMemberInfo":break;case"memberNum":t.content[n]=e[n],t.content.memberCount=e[n];break;case"newGroupProfile":t.content.newGroupProfile={},t._initNewGroupProfile(e[n]);break;default:t.content[n]=e[n]}})),this.content.userIDList||(this.content.userIDList=[this.content.operatorID])}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];ta[o]&&(this.content.groupProfile[o]=e[o])}}},{key:"_updateMemberList",value:function(e){pn(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach((function(t){e.forEach((function(e){t.userID===e.userID&&Object.assign(t,e)}))}))}},{key:"_initNewGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];"muteAllMembers"!==o?this.content.newGroupProfile[o]=e[o]:this.content.newGroupProfile[o]=1===e[o]}}}]),e}(),oa={from:!0,groupID:!0,groupName:!0,to:!0},aa=function(){function e(t){o(this,e),this.type=S.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return i(e,[{key:"_initContent",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"memberInfoList":break;case"remarkInfo":t.content.handleMessage=e[n];break;case"groupProfile":t.content.groupProfile={},t._initGroupProfile(e[n]);break;default:t.content[n]=e[n]}}))}},{key:"_initGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];oa[o]&&("groupName"===o?this.content.groupProfile.name=e[o]:this.content.groupProfile[o]=e[o])}}}]),e}(),ia=function(){function e(t,n){o(this,e),this.type=S.MSG_FILE,this._percent=0;var a=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:sn(t.url||t.fileUrl,n)||"",uuid:t.uuid,fileName:a.name||"",fileSize:a.size||0}}return i(e,[{key:"_getFileInfo",value:function(e){if(!mt(e.fileName)&&!mt(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(se){if(t.path&&-1!==t.path.indexOf(".")){var n=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase();t.type=n,t.name||(t.name="".concat(kt(999999),".").concat(n))}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}}},{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateFileUrl",value:function(e){this.content.fileUrl=e}},{key:"sendable",value:function(){return""!==this.content.fileUrl&&(""!==this.content.fileName&&0!==this.content.fileSize)}}]),e}(),sa=function(){function e(t){o(this,e),this.type=S.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return i(e,[{key:"setData",value:function(e){return this.content.data=e,this}},{key:"setDescription",value:function(e){return this.content.description=e,this}},{key:"setExtension",value:function(e){return this.content.extension=e,this}},{key:"sendable",value:function(){return 0!==this.content.data.length||0!==this.content.description.length||0!==this.content.extension.length}}]),e}(),ra=function(){function e(t,n){o(this,e),this.type=S.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:sn(t.videoUrl,n),videoDownloadFlag:2,videoUUID:t.videoUUID,thumbUUID:t.thumbUUID,thumbFormat:t.thumbFormat,thumbWidth:t.thumbWidth,snapshotWidth:t.thumbWidth,thumbHeight:t.thumbHeight,snapshotHeight:t.thumbHeight,thumbSize:t.thumbSize,snapshotSize:t.thumbSize,thumbDownloadFlag:2,thumbUrl:sn(t.thumbUrl,n),snapshotUrl:sn(t.thumbUrl,n)}}return i(e,[{key:"updatePercent",value:function(e){this._percent=e,this._percent>1&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=e)}},{key:"updateSnapshotInfo",value:function(e){var t=e.snapshotUrl,n=e.snapshotWidth,o=e.snapshotHeight;pn(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),pn(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),pn(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),ca=function(){function e(t){o(this,e),this.type=S.MSG_LOCATION;var n=t.description,a=t.longitude,i=t.latitude;this.content={description:n,longitude:a,latitude:i}}return i(e,[{key:"sendable",value:function(){return!0}}]),e}(),ua=function(){function e(t,n){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",t.messageBody?this.messageBody=JSON.parse(JSON.stringify(t.messageBody)):this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType?t.conversationType.startsWith(S.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(S.CONV_GROUP)&&(this.receiverGroupID=t.to):t.receiverGroupID?this.receiverGroupID=t.receiverGroupID:t.receiverUserID&&(this.receiverUserID=t.receiverUserID),this.messageReceiver=t.to||t.messageReceiver;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var a=t.elements[0].type,i=t.elements[0].content;this._patchRichMediaPayload(a,i),this._updateRichMediaDownloadUrl(a,i,n),a===S.MSG_MERGER?this.messageBody.push({type:a,payload:new la(i).content}):this.messageBody.push({type:a,payload:i}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random)}}return i(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){!e.imageUrl&&e.url&&(e.imageUrl=e.url,e.sizeType=e.type,1===e.type?e.type=0:3===e.type&&(e.type=1))})):e===S.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===S.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===S.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n){n&&(e===S.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.url=sn(e.url,n)})):e===S.MSG_VIDEO?(t.videoUrl=sn(t.videoUrl,n),t.snapshotUrl=sn(t.thumbUrl,n),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===S.MSG_AUDIO?t.url=sn(t.url,n):e===S.MSG_FILE&&(t.fileUrl=sn(t.fileUrl,n)))}}]),e}(),la=function(){function e(t,n){if(o(this,e),this.type=S.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var a=t.downloadKey,i=t.pbDownloadKey,s=t.title,r=t.abstractList,c=t.compatibleText,u=t.version;this.content.downloadKey=a,this.content.pbDownloadKey=i,this.content.title=s,this.content.abstractList=r,this.content.compatibleText=c,this.content.version=u||0}else if(pn(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var l=t.messageList,d=t.title,p=t.abstractList,_=t.compatibleText,g=t.version,h=[];l.forEach((function(e){if(!pn(e)){var t=new ua(e,n);h.push(t)}})),this.content.messageList=h,this.content.title=d,this.content.abstractList=p,this.content.compatibleText=_,this.content.version=g||0}}return i(e,[{key:"sendable",value:function(){return!pn(this.content.messageList)||!pn(this.content.downloadKey)}}]),e}(),da={1:S.MSG_PRIORITY_HIGH,2:S.MSG_PRIORITY_NORMAL,3:S.MSG_PRIORITY_LOW,4:S.MSG_PRIORITY_LOWEST},pa=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||S.CONV_C2C,this.conversationSubType=t.conversationSubType,this.time=t.time||Math.ceil(Date.now()/1e3),this.sequence=t.sequence||0,this.clientSequence=t.clientSequence||t.sequence||0,this.random=t.random||0===t.random?t.random:kt(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=ln(t.checkResult),this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||fn.SUCCESS,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!1,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromUnreadCount),this._isExcludedFromLastMessage=!(!t.messageControlInfo||1!==t.messageControlInfo.excludedFromLastMessage),this.clientTime=t.clientTime||Ke()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||"",this.revokerInfo=t.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=t.revokeReason||"",this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return i(e,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){gt(e.nick)&&(this.nick=e.nick),gt(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ft(t)&&gt(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==S.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(S.MSG_AT_ALL))})),vt(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(S.MSG_AT_ALL)}))}},{key:"getGroupAtInfoList",value:function(){return this._groupAtInfoList}},{key:"_initProxy",value:function(){this._elements[0]&&(this.payload=this._elements[0].content,this.type=this._elements[0].type)}},{key:"reInitialize",value:function(e){e&&(this.status=this.from?fn.SUCCESS:fn.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&(!0===this._relayFlag||"function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===S.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){0===this.clientSequence&&e&&(this.clientSequence=function(e){if(!e)return!1;if(void 0===Ot[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),a="0".concat(t.getSeconds()).slice(-2);Ot[e]=parseInt([n,o,a,"0001"].join("")),n=null,o=null,a=null,Je.l("autoIncrementIndex start index:".concat(Ot[e]))}return Ot[e]++}(e)),0===this.sequence&&this.conversationType===S.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===S.CONV_SYSTEM&&(this.senderTinyID="144115198244471703"),this.ID="".concat(this.senderTinyID,"-").concat(this.clientTime,"-").concat(this.random)}},{key:"_initFlow",value:function(e){""!==e&&(e===this.from?(this.flow="out",this.isRead=!0):this.flow="in")}},{key:"_concatConversationID",value:function(e){var t=this.to,n="",o=this.conversationType;o!==S.CONV_SYSTEM?(n=o===S.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=n?"".concat(o).concat(n):null):this.conversationID=S.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Qo||e instanceof Zo||e instanceof $o||e instanceof ea||e instanceof ia||e instanceof ra||e instanceof na||e instanceof aa||e instanceof sa||e instanceof ca||e instanceof la}},{key:"setElement",value:function(e,t){var n=this;if(this.isElement(e))return this._elements=[e],void this._initProxy();var o=function(e){if(e.type&&e.content)switch(e.type){case S.MSG_TEXT:n.setTextElement(e.content);break;case S.MSG_IMAGE:n.setImageElement(e.content,t);break;case S.MSG_AUDIO:n.setAudioElement(e.content,t);break;case S.MSG_FILE:n.setFileElement(e.content,t);break;case S.MSG_VIDEO:n.setVideoElement(e.content,t);break;case S.MSG_CUSTOM:n.setCustomElement(e.content);break;case S.MSG_LOCATION:n.setLocationElement(e.content);break;case S.MSG_GRP_TIP:n.setGroupTipElement(e.content);break;case S.MSG_GRP_SYS_NOTICE:n.setGroupSystemNoticeElement(e.content);break;case S.MSG_FACE:n.setFaceElement(e.content);break;case S.MSG_MERGER:n.setMergerElement(e.content,t)}};if(vt(e))for(var a=0;a<e.length;a++)o(e[a]);else o(e);this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){var t="string"==typeof e?e:e.text,n=new Qo({text:t});this._elements.push(n)}},{key:"setImageElement",value:function(e,t){var n=new Zo(e,t);this._elements.push(n)}},{key:"setAudioElement",value:function(e,t){var n=new ea(e,t);this._elements.push(n)}},{key:"setFileElement",value:function(e,t){var n=new ia(e,t);this._elements.push(n)}},{key:"setVideoElement",value:function(e,t){var n=new ra(e,t);this._elements.push(n)}},{key:"setLocationElement",value:function(e){var t=new ca(e);this._elements.push(t)}},{key:"setCustomElement",value:function(e){var t=new sa(e);this._elements.push(t)}},{key:"setGroupTipElement",value:function(e){var t={},n=e.operationType;if(pn(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):n!==S.GRP_TIP_MBR_JOIN&&n!==S.GRP_TIP_MBR_KICKED_OUT&&n!==S.GRP_TIP_MBR_SET_ADMIN&&n!==S.GRP_TIP_MBR_CANCELED_ADMIN||(t=e.memberInfoList[0]),!pn(e.memberExtraInfo)){var o=e.memberExtraInfo.reason;e.msgMemberInfo.forEach((function(e){e.reason=o}))}var a=t,i=a.nick,s=a.avatar;gt(i)&&(this.nick=i),gt(s)&&(this.avatar=s);var r=new na(e);this._elements.push(r)}},{key:"setGroupSystemNoticeElement",value:function(e){var t=new aa(e);this._elements.push(t)}},{key:"setFaceElement",value:function(e){var t=new $o(e);this._elements.push(t)}},{key:"setMergerElement",value:function(e,t){var n=new la(e,t);this._elements.push(n)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"_computePriority",value:function(e){if(mt(e))return S.MSG_PRIORITY_NORMAL;if(gt(e)&&-1!==Object.values(da).indexOf(e))return e;if(_t(e)){var t=""+e;if(-1!==Object.keys(da).indexOf(t))return da[t]}return S.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,n=e.avatar;gt(t)&&(this.nick=t),gt(n)&&(this.avatar=n)}},{key:"setNameCard",value:function(e){gt(e)&&(this.nameCard=e)}},{key:"initC2CReadReceiptInfo",value:function(e){this.conversationType===S.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e)}}]),e}(),_a=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="C2CModule",t._messageFromUnreadDBMap=new Map,t._noticeFromUnreadDBList=[],t}return i(a,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,a=e.C2CPairUnreadList,i=e.isSyncingEnded;Je.d("".concat(this._n,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var s=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:a,isInstantMessage:n}),r=s.conversationOptionsList,c=s.messageList,u=s.isUnreadC2CMessage;this.filterModifiedMessage(c),this.getModule(ao).onNewMessage({conversationOptionsList:r,isInstantMessage:n,isUnreadC2CMessage:u,isSyncingEnded:i});var l=this.filterUnmodifiedMessage(c);n&&l.length>0&&this.emitOuterEvent(E.MESSAGE_RECEIVED,l),c.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,a=e.isInstantMessage,i=null,s=[],r=[],c={},u=this.getModule(mo),l=!1,d=this.getModule(ao),p=this.getModule($n),_=this.getFileDownloadProxy(),g=0,h=t.length;g<h;g++)if(this._isC2CNotice(t[g]))this._noticeFromUnreadDBList.push(t[g].eventArray[0].c2CNotifyMsgArray[0]);else{var f=t[g];f.currentUser=this.getMyUserID(),f.conversationType=S.CONV_C2C,f.isSystemMessage=!!f.isSystemMessage,(mt(f.nick)||mt(f.avatar))&&(l=!0,Je.d("".concat(this._n,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),(i=new pa(f)).setElement(f.elements,_),i.setNickAndAvatar({nick:f.nick,avatar:f.avatar});var v=i.conversationID;if(a){if(1===this._messageFromUnreadDBMap.get(i.ID))continue;var m=!1;if(i.from!==this.getMyUserID()){var M=d.getLatestMessageSentByPeer(v);if(M){var I=M.nick,y=M.avatar;l?i.setNickAndAvatar({nick:I,avatar:y}):I===i.nick&&y===i.avatar||(m=!0)}}else{var T=d.getLatestMessageSentByMe(v);if(T){var C=T.nick,D=T.avatar;C===i.nick&&D===i.avatar||(d.modifyMessageSentByMe({conversationID:v,latestNick:i.nick,latestAvatar:i.avatar}),p.mockOnNickAvatarModified(i.nick,i.avatar))}}var E=1===t[g].isModified;if(d.isMessageSentByCurrentInstance(i)?i.isModified=E:E=!1,0===f.msgLifeTime)i._onlineOnlyFlag=!0,d.isMessageSentByCurrentInstance(i)||r.push(i);else{if(!d.pushIntoMessageList(r,i,E))continue;m&&(d.modifyMessageSentByPeer({conversationID:v,latestNick:i.nick,latestAvatar:i.avatar}),d.updateUserProfileSpecifiedKey({conversationID:v,nick:i.nick,avatar:i.avatar}))}a&&i.clientTime>0&&u.addMessageDelay(i.clientTime)}else this._messageFromUnreadDBMap.set(i.ID,1);if(0!==f.msgLifeTime){if(!1===i._onlineOnlyFlag){var N=d.getLastMessageTime(v);if(_t(N)&&i.time<N)continue;if(mt(c[v])){var k=0;"in"===i.flow&&(i._isExcludedFromUnreadCount||(k=1)),c[v]=s.push({conversationID:v,unreadCount:k,type:i.conversationType,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1}else{var A=c[v];s[A].type=i.conversationType,s[A].subType=i.conversationSubType,s[A].lastMessage=i._isExcludedFromLastMessage?"":i,"in"===i.flow&&(i._isExcludedFromUnreadCount||s[A].unreadCount++)}}}else i._onlineOnlyFlag=!0}this._handleRevokedNoticeFromUnreadDB();var L=!1;if(vt(o))for(var R=function(e,t){if(o[e].unreadCount>0){L=!0;var n=s.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:s.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:S.CONV_C2C})}},O=0,G=o.length;O<G;O++)R(O);if(vt(n))for(var P=function(e,t){s.find((function(t){return t.conversationID==="C2C".concat(n[e].from)}))||s.push({conversationID:"C2C".concat(n[e].from),type:S.CONV_C2C,lastMsgTime:n[e].lastMsgTime})},U=0,b=n.length;U<b;U++)P(U);return{conversationOptionsList:s,messageList:r,isUnreadC2CMessage:L}}},{key:"_isC2CNotice",value:function(e){var t=e.eventArray;return!(!vt(t)||10!==t[0].event)}},{key:"_handleRevokedNoticeFromUnreadDB",value:function(){var e=this._noticeFromUnreadDBList.length;if(0!==e){Je.l("".concat(this._n,"._handleRevokedNoticeFromUnreadDB count:").concat(e));var t=[];this._noticeFromUnreadDBList.forEach((function(e){e.hasOwnProperty("c2cMessageRevokedNotify")&&t.push(e)})),this.onC2CMessageRevoked({dataList:t}),this._noticeFromUnreadDBList.length=0,t.length=0}}},{key:"onC2CMessageRevoked",value:function(e){var t=this,n=this.getModule(ao),o=[],a=null;e.dataList.forEach((function(e){if(e.c2cMessageRevokedNotify){var i=e.c2cMessageRevokedNotify.revokedInfos;mt(i)||i.forEach((function(e){var i=t.getMyUserID()===e.from?"".concat(S.CONV_C2C).concat(e.to):"".concat(S.CONV_C2C).concat(e.from);a=n.revoke(i,e.sequence,e.random);var s,r=e.revokerInfo&&e.revokerInfo.revoker,c=e.revokerInfo&&e.revokerInfo.reason||"";a?s=a:(s={conversationID:i,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(s.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(s.time=e.time)),s&&(s.revoker=r,s.revokeReason=c,s.revokerInfo={userID:r,nick:"",avatar:""},o.push(s))}))}})),0!==o.length&&(n.onMessageRevoked(o),Je.l("".concat(this._n,".onC2CMessageRevoked count:").concat(o.length)),n.updateRevokerInfo(o).then((function(e){t.emitOuterEvent(E.MESSAGE_REVOKED,e)})))}},{key:"onC2CMessageReadReceipt",value:function(e){var t=this;e.dataList.forEach((function(e){if(!pn(e.c2cMessageReadReceipt)){var n=e.c2cMessageReadReceipt.to;e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){var o=e.peerReadTime;Je.d("".concat(t._n,"._onC2CMessageReadReceipt to:").concat(n," peerReadTime:").concat(o));var a="".concat(S.CONV_C2C).concat(n),i=t.getModule(ao);i.recordPeerReadTime(a,o),i.updateMessageIsPeerReadProperty(a,o)}))}}))}},{key:"onC2CMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){if(!pn(e.c2cMessageReadNotice)){var n=t.getModule(ao);e.c2cMessageReadNotice.uinPairReadArray.forEach((function(e){var o=e.from,a=e.peerReadTime;Je.d("".concat(t._n,".onC2CMessageReadNotice from:").concat(o," lastReadTime:").concat(a));var i="".concat(S.CONV_C2C).concat(o);n.updateIsReadAfterReadReport({conversationID:i,lastMessageTime:a}),n.updateUnreadCount(i)}))}}))}},{key:"onC2CMessageModified",value:function(e){Je.d("".concat(this._n,".onC2CMessageModified options:"),JSON.stringify(e));var n=this.getModule(ao);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:S.CONV_C2C}))}))}},{key:"onReadReceiptList",value:function(e){Je.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e));var t=e.dataList,n=t.userID,o=t.readReceiptList;this.getModule(ao).updateReadReceiptInfo({userID:n,readReceiptList:o})}},{key:"sendMessage",value:function(e,t){var n=this._createC2CMessagePack(e,t);return this.request(n)}},{key:"_createC2CMessagePack",value:function(e,t){var n=null;t&&(t.offlinePushInfo&&(n=t.offlinePushInfo),!0===t.onlineUserOnly&&(n?n.disablePush=!0:n={disablePush:!0}));var o="";gt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var a=[];if(ft(t)&&ft(t.messageControlInfo)){var i=t.messageControlInfo,s=i.excludedFromUnreadCount,r=i.excludedFromLastMessage,c=i.excludedFromContentModeration;!0===s&&a.push("NoUnread"),!0===r&&a.push("NoLastMsg"),!0===c&&a.push("NoMsgCheck")}var u=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:Uo.SEND_C2C_MESSAGE,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:u,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==u?a:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}},{key:"_isVoipPush",value:function(e){var t=void 0;return mt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:Uo.REVOKE_C2C_MESSAGE,requestData:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;return Je.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:Uo.DELETE_C2C_MESSAGE,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,a=void 0===o?0:o,i=e.sequence,s=e.random,r=e.time,c=e.payload,u=e.type,l=e.cloudCustomData,d=void 0;return tn(u)&&(d=[]).push({type:u,content:c}),this.request({protocolName:Uo.MODIFY_C2C_MESSAGE,requestData:{from:t,to:n,version:a,sequence:i,random:s,time:r,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,a="".concat(this._n,".setMessageRead");Je.l("".concat(a," conversationID:").concat(n," lastMessageTime:").concat(o)),_t(o)||this.outputWarning("DoNotModifyLastTime");var i=new Xo("setC2CMessageRead");return i.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:Uo.SET_C2C_MESSAGE_READ,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){i.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(a," ok"));var e=t.getModule(ao);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),No()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.l("".concat(a," failed. error:"),e),Go(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.peerAccount,a=e.conversationID,i=e.count,s=e.lastMessageTime,r=e.messageKey,c="peerAccount:".concat(o," count:").concat(i||15," lastMessageTime:").concat(s||0," messageKey:").concat(r);Je.l("".concat(n," ").concat(c));var u=new Xo("getC2CRoamingMessages");return this.request({protocolName:Uo.GET_C2C_ROAMING_MESSAGE,requestData:{peerAccount:o,count:i||15,lastMessageTime:s||0,messageKey:r}}).then((function(e){var o=e.data,i=o.complete,s=o.messageList,r=o.messageKey,l=o.lastMessageTime;mt(s)?Je.l("".concat(n," ok. complete:").concat(i," but messageList is undefined!")):Je.l("".concat(n," ok. complete:").concat(i," count:").concat(s.length)),u.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(i," length:").concat(s.length)).end();var d=t.getModule(ao);1===i&&d.setCompleted(a);var p=d.onRoamingMessage(s,a);d.modifyMessageList(a),d.updateIsRead(a),d.updateRoamingMessageKeyAndTime(a,r,l);var _=d.getPeerReadTime(a);if(Je.l("".concat(n," update isPeerRead property. conversationID:").concat(a," peerReadTime:").concat(_)),_)d.updateMessageIsPeerReadProperty(a,_);else{var g=a.replace(S.CONV_C2C,"");t.getRemotePeerReadTime([g]).then((function(){d.updateMessageIsPeerReadProperty(a,d.getPeerReadTime(a))}))}var h="";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(a);f&&(h=f.ID)}return Je.l("".concat(n," nextReqID:").concat(h," stored message count:").concat(p.length)),{nextReqID:h,storedMessageList:p}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setMessage(c).setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=e.peerAccount,a=e.time,i=void 0===a?0:a,s=e.count,r=e.direction,c="".concat(S.CONV_C2C).concat(o),u="peerAccount:".concat(o," count:").concat(s," time:").concat(i," direction:").concat(r);Je.l("".concat(n," ").concat(u));var l=new Xo("getC2CRoamingMessagesHopping");return this.request({protocolName:Uo.GET_C2C_ROAMING_MESSAGE,requestData:{peerAccount:o,count:s+1,lastMessageTime:i,direction:r}}).then((function(e){var o=e.data,a=o.complete,i=o.messageList,s=void 0===i?[]:i,d=o.lastMessageTime;Je.l("".concat(n," ok. complete:").concat(a," count:").concat(s.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(a," length:").concat(s.length)).end(),1!==a&&(1===r?s.pop():s.shift());var p=t.getModule(ao).onRoamingMessage(s,c,!1);t._modifyMessageList(c,p);var _=t._computeResult({complete:a,lastMessageTime:d,resultList:p});return No(_)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setMessage(u).setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,a=e.resultList,i={messageList:m(void 0===a?[]:a),isCompleted:!1,nextMessageTime:""};return 1===n?(i.isCompleted=!0,i):(i.nextMessageTime=o,i)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(ao).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,a=n.userProfile.avatar,i=this.getModule($n).getNickAndAvatarByUserID(this.getMyUserID()),s=i.nick,r=i.avatar,c=t.length-1;c>=0;c--){var u=t[c];"in"===u.flow&&(u.nick!==o&&u.setNickAndAvatar({nick:o}),u.avatar!==a&&u.setNickAndAvatar({avatar:a})),"out"===u.flow&&(u.nick!==s&&u.setNickAndAvatar({nick:s}),u.avatar!==r&&u.setNickAndAvatar({avatar:r}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._n,".getRemotePeerReadTime");if(pn(e))return Je.w("".concat(n," userIDList is empty!")),Promise.resolve();var o=new Xo("getPeerReadTime");return Je.l("".concat(n," userIDList:").concat(e)),this.request({protocolName:Uo.GET_C2C_PEER_READ_TIME,requestData:{userIDList:e}}).then((function(a){var i=a.data.peerReadTimeList;Je.l("".concat(n," ok. peerReadTimeList:").concat(i));for(var s="",r=t.getModule(ao),c=0;c<e.length;c++)s+="".concat(e[c],"-").concat(i[c]," "),i[c]>0&&r.recordPeerReadTime("C2C".concat(e[c]),i[c]);o.setNetworkType(t.getNetworkType()).setMessage(s).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.w("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(S.CONV_C2C,""),o=new Xo("sendC2CReadReceipt");o.setMessage("peerAccount:".concat(n));var a=this.getMyUserID(),i=e.filter((function(e){return e.from!==a&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===i.length)return Go({code:Ao.READ_RECEIPT_MSG_LIST_EMPTY});var s="".concat(this._n,".sendReadReceipt");return Je.l("".concat(s,". peerAccount:").concat(n," messageInfoList length:").concat(i.length)),this.request({protocolName:Uo.SEND_C2C_READ_RECEIPT,requestData:{peerAccount:n,messageInfoList:i}}).then((function(e){return o.end(),Je.l("".concat(s," ok")),No()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.w("".concat(s," failed. error:"),e),Go(e)}))}},{key:"getReadReceiptList",value:function(e){var t="".concat(this._n,".getReadReceiptList"),n=this.getMyUserID(),o=e.filter((function(e){return e.from===n&&!0===e.needReadReceipt}));return Je.l("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),Oo({messageList:o})}},{key:"getMessageExtensions",value:function(e,t){return Je.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Uo.GET_C2C_MESSAGE_EXTENSIONS,requestData:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Je.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Uo.MODIFY_C2C_MESSAGE_EXTENSIONS,requestData:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:n}})}},{key:"getMessageKey",value:function(e){var t=e.clientSequence,n=e.random,o=e.time;return"".concat(t,"_").concat(n,"_").concat(o)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._messageFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0}}]),a}(Po),ga=function(){function e(){o(this,e),this.list=new Map,this._n="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return i(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var a=this._getUniqueIDOfMessage(e),i=this.list.get(n).has(a);if(i){var s=this.list.get(n).get(a);if(!t||!0===s.isModified)return o=!1}return this.list.get(n).set(a,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(vt(e)?e.length>0&&(n=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(n=e.conversationID,this._unshiftSingleMessage(e,t)),n){var o=Array.from(this.list.get(n).values()),a=o.length;if(0===a)return;for(var i=a-1;i>=0;i--)if("out"===o[i].flow){this._setLatestMessageSentByMe(n,o[i]);break}if(n.startsWith(S.CONV_C2C))for(var s=a-1;s>=0;s--)if("in"===o[s].flow){this._setLatestMessageSentByPeer(n,o[s]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var a=this.list.get(n),i=Array.from(a);a.has(o)||(i.unshift([o,e]),this.list.set(n,new Map(i)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],a=e[0].conversationID,i=this.list.get(a),s=this.list.has(a)?Array.from(i):[],r=0;r<n;r++){var c=this._getUniqueIDOfMessage(e[r]);i&&i.has(c)||(o.push([c,e[r]]),t.push(e[r]))}this.list.set(a,new Map(o.concat(s)))}},{key:"remove",value:function(e){var t=e.conversationID,n=this._getUniqueIDOfMessage(e);this.list.has(t)&&this.list.get(t).delete(n)}},{key:"revoke",value:function(e,t,n){if(Je.d("revoke message",e,t,n),this.list.has(e)){var o,a=D(this.list.get(e));try{for(a.s();!(o=a.n()).done;){var i=v(o.value,2)[1];if(i.sequence===t&&(mt(n)||i.random===n))return i.isRevoked||(i.isRevoked=!0),i}}catch(s){a.e(s)}finally{a.f()}}return null}},{key:"removeByConversationID",value:function(e){var t=this.list.has(e);Je.l("".concat(this._n,".removeByConversationID conversationID:").concat(e," has:").concat(t)),t&&(this.list.delete(e),this._latestMessageSentByPeerMap.delete(e),this._latestMessageSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){var t,n=null,o=D(this.list);try{for(o.s();!(t=o.n()).done;)for(var a=m(v(t.value,2)[1].values()),i=a.length,s=0;s<i;s++)if(a[s].ID===e){n=a[s];break}}catch(r){o.e(r)}finally{o.f()}return n}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){var n=[];if(this.list.has(e)){var o,a=D(this.list.get(e));try{for(a.s();!(o=a.n()).done;){var i=v(o.value,2)[1];i.time<=t&&!i.isPeerRead&&"out"===i.flow&&(i.isPeerRead=!0,n.push(i))}}catch(s){a.e(s)}finally{a.f()}Je.l("".concat(this._n,".updateMessageIsPeerReadProperty conversationID:").concat(e," peerReadTime:").concat(t," count:").concat(n.length))}return n}},{key:"updateMessageIsModifiedProperty",value:function(e){var t=e.conversationID;if(this.list.has(t)){var n=this._getUniqueIDOfMessage(e),o=this.list.get(t).get(n);o&&(o.isModified=!0)}}},{key:"hasLocalMessageList",value:function(e){return this.list.has(e)}},{key:"getLocalMessageList",value:function(e){return this.hasLocalMessageList(e)?m(this.list.get(e).values()):[]}},{key:"hasLocalMessage",value:function(e,t){for(var n=!1,o=this.getLocalMessageList(e),a=o.length,i=0;i<a;i++)o[i].ID===t&&(n=!0);return n}},{key:"getLocalMessage",value:function(e,t){for(var n=null,o=this.getLocalMessageList(e),a=o.length,i=0;i<a;i++)if(o[i].ID===t){n=o[i];break}return n}},{key:"getLocalLastMessage",value:function(e){var t=this.getLocalMessageList(e);return t[t.length-1]}},{key:"getLocalOldestMessage",value:function(e){return this.getLocalMessageList(e)[0]}},{key:"_setLatestMessageSentByPeer",value:function(e,t){e.startsWith(S.CONV_C2C)&&"in"===t.flow&&this._latestMessageSentByPeerMap.set(e,t)}},{key:"_setLatestMessageSentByMe",value:function(e,t){"out"===t.flow&&this._latestMessageSentByMeMap.set(e,t)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._latestMessageSentByPeerMap.get(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._latestMessageSentByMeMap.get(e)}},{key:"modifyMessageSentByPeer",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,a=this.list.get(t);if(!pn(a)){var i=Array.from(a.values()),s=i.length;if(0!==s){for(var r=null,c=0,u=!1,l=s-1;l>=0;l--)"in"===i[l].flow&&((r=i[l]).nick!==n&&(r.setNickAndAvatar({nick:n}),u=!0),r.avatar!==o&&(r.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));Je.l("".concat(this._n,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(c))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,a=this.list.get(t);if(!pn(a)){var i=Array.from(a.values()),s=i.length;if(0!==s){for(var r=null,c=0,u=!1,l=s-1;l>=0;l--)"out"===i[l].flow&&((r=i[l]).nick!==n&&(r.setNickAndAvatar({nick:n}),u=!0),r.avatar!==o&&(r.setNickAndAvatar({avatar:o}),u=!0),u&&(c+=1));Je.l("".concat(this._n,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(c))}}}},{key:"getTopicConversationIDList",value:function(e){return m(this.list.keys()).filter((function(t){return t.startsWith("".concat(S.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===Je.getLevel()){console.group("conversationID-messageCount");var e,t=D(this.list);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],a=n[1];console.log("".concat(o,"-").concat(a.size))}}catch(i){t.e(i)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n="".concat(this._n,".onMessageModified"),o=this._getUniqueIDOfMessage(t),a=this.list.get(e).has(o);if(Je.l("".concat(n," conversationID:").concat(e," uniqueID:").concat(o," has:").concat(a)),a){var i=this.list.get(e).get(o),s=t.messageVersion,r=t.elements,c=t.cloudCustomData,u=t.checkResult;return Je.l("".concat(n," localVersion:").concat(i.version," remoteVersion:").concat(s)),i.version<s?(i.version=s,i._elements=JSON.parse(JSON.stringify(r)),i.payload=JSON.parse(JSON.stringify(r[0].content)),i.type=r[0].type,i.cloudCustomData=c,i.isModified=!0,i.hasRiskContent=ln(u),{isUpdated:!0,message:i}):{isUpdated:!1,message:i}}return{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMessage",value:function(e){var t=e.from,n=e.to,o=e.random,a=e.sequence,i=e.time;return"".concat(t,"-").concat(n,"-").concat(o,"-").concat(a,"-").concat(i)}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear()}}]),e}(),ha={A2KEY_AND_TINYID_UPDATED:"_inner".concat(1),CLOUD_CONFIG_UPDATED:"_inner".concat(2),PROFILE_UPDATED:"_inner".concat(3),CONV_SYNC_COMPLETED:"_inner".concat(4),C2C_UNREAD_HANDLE_COMPLETED:"_inner".concat(5)};function fa(e){this.mixin(e)}fa.mixin=function(e){var t=e.prototype||e;t._isReady=!1,t.ready=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)return this._isReady?void(t?e.call(this):setTimeout(e,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(e))},t.triggerReady=function(){var e=this;this._isReady=!0,setTimeout((function(){var t=e._readyQueue;e._readyQueue=[],t&&t.length>0&&t.forEach((function(e){e.call(this)}),e)}),1)},t.resetReady=function(){this._isReady=!1,this._readyQueue=[]},t.isReady=function(){return this._isReady}};var va=["jpg","jpeg","gif","png","bmp","image","webp"],ma=["mp4","quicktime","mov"],Ma=1,Ia=2,ya=3,Ta=255,Ca=function(){function e(t){var n=this;o(this,e),pn(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.gender=t.gender||"",this.birthday=t.birthday||0,this.location=t.location||"",this.selfSignature=t.selfSignature||"",this.allowType=t.allowType||S.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||S.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],pn(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return i(e,[{key:"validate",value:function(e){var t=!0,n="";if(pn(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,a=null,i=0;i<o;i++){if(a=e.profileCustomField[i],!gt(a.key)||-1===a.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(!gt(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if("profileCustomField"===s)continue;if(pn(e[s])&&!gt(e[s])&&!_t(e[s])){n="key:"+s+", invalid value:"+e[s],t=!1;continue}switch(s){case"nick":gt(e[s])||(n="nick must be a string",t=!1),Nt(e[s])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Nt(e[s])," bytes"),t=!1);break;case"gender":Rt(ot,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":_t(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":gt(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":gt(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":Rt(it,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":_t(e.language)||(n="language must be a number",t=!1);break;case"avatar":gt(e.avatar)||(n="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":Rt(at,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":_t(e.level)||(n="level must be a number",t=!1);break;case"role":_t(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+s+" "+e[s],t=!1}}return{valid:t,tips:n}}}]),e}(),Da=i((function e(t){o(this,e),this.value=t,this.next=null})),Ea=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return i(e,[{key:"set",value:function(e){var t=new Da(e);if(this.map.size<this.MAX_LENGTH)null===this.pTail?(this.pTail=t,this.pNodeToDel=t):(this.pTail.next=t,this.pTail=t),this.map.set(e,1);else{var n=this.pNodeToDel;this.pNodeToDel=this.pNodeToDel.next,this.map.delete(n.value),n.next=null,n=null,this.pTail.next=t,this.pTail=t,this.map.set(e,1)}}},{key:"has",value:function(e){return this.map.has(e)}},{key:"delete",value:function(e){this.has(e)&&this.map.delete(e)}},{key:"tail",value:function(){return this.pTail}},{key:"size",value:function(){return this.map.size}},{key:"data",value:function(){return Array.from(this.map.keys())}},{key:"reset",value:function(){for(var e;null!==this.pNodeToDel;)e=this.pNodeToDel,this.pNodeToDel=this.pNodeToDel.next,e.next=null,e=null;this.pTail=null,this.map.clear()}}]),e}(),Sa=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],Na=function(){function e(t){o(this,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(t)}return i(e,[{key:"memberNum",get:function(){return this.memberCount},set:function(e){}},{key:"maxMemberNum",get:function(){return this.maxMemberCount},set:function(e){}},{key:"_initGroup",value:function(e){for(var t in e)Sa.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]))}},{key:"updateGroup",value:function(e){var t=this;e.appid=void 0,e.grossTopicNextMsgSeq=void 0,e.selfInfo&&(e.selfInfo.grossTopicReadSeq=void 0);var n=JSON.parse(JSON.stringify(e));n.lastMsgTime&&(this.lastMessage.lastTime=n.lastMsgTime),mt(n.muteAllMembers)||("On"===n.muteAllMembers?n.muteAllMembers=!0:n.muteAllMembers=!1),n.groupCustomField&&Ut(this.groupCustomField,n.groupCustomField),mt(n.memberNum)||(this.memberCount=n.memberNum),mt(n.maxMemberNum)||(this.maxMemberCount=n.maxMemberNum),mt(n.isSupportTopic)||(this.isSupportTopic=_t(n.isSupportTopic)?1===n.isSupportTopic:n.isSupportTopic),Et(this,n,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),vt(n.members)&&n.members.length>0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&Et(t.selfInfo,e,["sequence"])}))}},{key:"updateSelfInfo",value:function(e){var n={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList};Et(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),ka=function(e,n,o){return mt(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:o&&e.ID||e instanceof pa?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:en(e.type,e.payload,n),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:t(t({},e),{},{messageForShow:en(e.type,e.payload,n)})},Aa=function(){function e(t,n){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=ka(t.lastMessage,n,a),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType=t.messageRemindType,this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this.draftText=t.draftText||"",this._initProfile(t),this.subType=this.groupProfile?this.groupProfile.type:""}return i(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(S.CONV_C2C)?this.conversationID.replace(S.CONV_C2C,""):this.conversationID.startsWith(S.CONV_GROUP)?this.conversationID.replace(S.CONV_GROUP,""):""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),mt(this.userProfile)&&this.type===S.CONV_C2C?this.userProfile=new Ca({userID:e.conversationID.replace("C2C","")}):mt(this.groupProfile)&&this.type===S.CONV_GROUP&&(this.groupProfile=new Na({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;mt(t)||(bt(this.subType)?this.unreadCount=0:n&&this.type===S.CONV_GROUP||n&&this.type===S.CONV_TOPIC||o&&this.type===S.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=ka(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t=function(e){return M(e)||I(e)||y(e)||C()}(e.groupAtType).slice(0);-1!==t.indexOf(S.CONV_AT_ME)&&-1!==t.indexOf(S.CONV_AT_ALL)&&(t=[S.CONV_AT_ALL_AT_ME]);var n={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:t,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(n)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!wt({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(S.CONV_AT_ME)>-1&&e.groupAtType.indexOf(S.CONV_AT_ALL)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(S.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(S.CONV_AT_ME)>-1&&(t.atTypeArray=[S.CONV_AT_ALL_AT_ME],t.__random=e.__random,t.__sequence=e.__sequence),o=!0)})),o}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){var t=e.sequence,n=e.time;return this.type===S.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===S.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}},{key:"setDraftText",value:function(e){this.draftText=e}}]),e}(),La=function(){function e(t){o(this,e),this._conversationModule=t,this._n="MessageRemindHandler"}return i(e,[{key:"getC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._n,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:Uo.GET_C2C_PEER_MUTE_NOTIFICATIONS,requestData:{toAccount:this._conversationModule.getMyUserID(),userIDList:e}}).then((function(o){Je.l("".concat(n," ok. userIDList:").concat(e));var a=o.data.muteFlagList;t._conversationModule.onC2CMessageRemindTypeFetched(a)})).catch((function(e){Je.e("".concat(n," failed. error:"),e)}))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):vt(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setGroupMessageRemindType"),o=e.groupID,a=e.messageRemindType,i="groupID:".concat(o," messageRemindType:").concat(a),s=new Xo("setMessageRemindType");s.setMessage(i);var r=this._getModule(to);return r?r.modifyGroupMemberInfo({groupID:o,messageRemindType:a,userID:this._conversationModule.getMyUserID()}).then((function(){s.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(n," ok. ").concat(i));var o=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),No(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)})):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType;Je.l("".concat(this._n,".onGroupMessageRemindTypeUpdated groupID:").concat(t," messageRemindType:").concat(n));var o=this._getModule(to).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),Ft(t)){var a=t,i=$t(a),s=this._getModule(oo).getLocalTopic(i,a);return s&&(s.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:s})),{topic:s}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setC2CMessageRemindType"),o=e.userIDList,a=e.messageRemindType,i=o.slice(0,30),s=0;a===S.MSG_REMIND_DISCARD?s=1:a===S.MSG_REMIND_ACPT_NOT_NOTE&&(s=2);var r="userIDList:".concat(i," messageRemindType:").concat(a),c=new Xo("setMessageRemindType");return c.setMessage(r),this._conversationModule.request({protocolName:Uo.SET_C2C_PEER_MUTE_NOTIFICATIONS,requestData:{userIDList:i,muteFlag:s}}).then((function(e){c.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data.errorList,s=[],u=[];vt(o)&&o.forEach((function(e){s.push(e.userID),u.push({userID:e.userID,code:e.errorCode})}));var l=i.filter((function(e){return-1===s.indexOf(e)}));Je.l("".concat(n," ok. ").concat(r," successUserIDList:").concat(l," failureUserIDList:").concat(JSON.stringify(u)));var d=0;return l.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:a})&&(d+=1)})),d>=1&&t._emitConversationUpdate(),i.length=s.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),Oo({successUserIDList:l.map((function(e){return{userID:e}})),failureUserIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),e}(),Ra=function(){function e(t){o(this,e),this._conversationModule=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=vn.NOT_START}return i(e,[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),o=e.conversationIDList,a=e.customData;Je.l("".concat(n," options:"),e);var i=new Xo("setConvCustomData");i.setMessage(JSON.stringify(e));var s={fromAccount:this._getMyUserID(),itemList:[]},r=[],c=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(c,e),!0;if(!qt(e)&&!xt(e))return t._onConversationIDInvalid(c,e),!0;var n={operationType:2,contactItem:void 0,customMark:a};qt(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,"")}:xt(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,"")}),s.itemList.push(n)})),c.length===o.length?Oo({successConversationIDList:r,failureConversationIDList:c}):this._conversationModule.request({protocolName:Uo.SET_CONVERSATION_CUSTOM_DATA,requestData:s}).then((function(e){i.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(n," ok"));var o=e.data.resultItem;if(vt(o)){var s,u,l=!1;o.forEach((function(e){s=t._concatConversationID(e.contactItem),0===e.resultCode?(r.push(s),(u=t._getLocalConversation(s))&&u.customData!==a&&(u.customData=a,l=!0)):c.push({conversationID:s,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return No({successConversationIDList:r,failureConversationIDList:c})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"markConversation",value:function(e){var t=this;if(!this._conversationModule.canIUse(K.CONV_MARK))return this._conversationModule.cannotUseCommercialAbility("markConversation");var n="".concat(this._n,".").concat("markConversation"),o=e.conversationIDList,a=e.markType,i=e.enableMark;Je.l("".concat(n," options:"),e);var s=new Xo("markConversation");s.setMessage(JSON.stringify(e));var r=void 0,c=void 0,u=this._getFlagBit(a);!0===i?c=[u]:r=[u];var l={fromAccount:this._getMyUserID(),itemList:[]},d=[],p=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(p,e),!0;if(!qt(e)&&!xt(e))return t._onConversationIDInvalid(p,e),!0;var n={operationType:1,contactItem:void 0,clearMark:r,setMark:c};qt(e)?n.contactItem={type:1,toAccount:e.replace(S.CONV_C2C,"")}:xt(e)&&(n.contactItem={type:2,groupID:e.replace(S.CONV_GROUP,"")}),l.itemList.push(n)})),p.length===o.length?Oo({successConversationIDList:d,failureConversationIDList:p}):this._conversationModule.request({protocolName:Uo.MARK_CONVERSATION,requestData:l}).then((function(e){s.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(n," ok"));var o=e.data.resultItem;if(vt(o)){var r,c,u=!1;o.forEach((function(e){if(r=t._concatConversationID(e.contactItem),0===e.resultCode){if(d.push(r),c=t._getLocalConversation(r)){var n=c.markList.indexOf(a);!0===i?-1===n&&(c.markList.push(a),u=!0):-1!==n&&(c.markList.splice(n,1),u=!0)}}else p.push({conversationID:r,code:e.resultCode,message:e.resultInfo})})),!0===u&&t._emitConversationUpdate()}return No({successConversationIDList:d,failureConversationIDList:p})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"getLocalConvGroupList",value:function(){var e=this;return Je.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===vn.REJECTED?this.getRemoteConvGroupList().then((function(){return No(m(e._convGroupMap.values()))})):Oo(m(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=vn.PENDING,this._conversationModule.request({protocolName:Uo.GET_CONVERSATION_GROUP_LIST,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:Ke()}}).then((function(n){var o,a,i=n.data,s=i.completeFlag,r=i.contactItem,c=i.nextStartIndex,u=void 0===c?0:c,l=i.groupItem;(e._startIndex=u,Je.l("".concat(t," completeFlag:").concat(s," nextStartIndex:").concat(u)),vt(l)&&l.forEach((function(t){var n=t.convGroupID,o=t.groupName;e._convGroupMap.set(n,o)})),vt(r))&&r.forEach((function(t){var n=t.standardMark,i=t.customData,s=t.convGroupIDList;if(o=e._concatConversationID(t),(a=e._getLocalConversation(o))&&(a.markList=nn(n),a.customData=i||"",vt(s))){var r=[];s.forEach((function(t){e._convGroupMap.has(t)&&r.push(e._convGroupMap.get(t))})),a.conversationGroupList=[].concat(r),r.length=0}}));if(0===s)return e.getRemoteConvGroupList();1===s&&(e._pagingStatus=vn.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=vn.REJECTED,Je.w("".concat(t," failed. error:"),n)}))}},{key:"createConvGroup",value:function(e){var t=this,n="createConversationGroup";if(!this._conversationModule.canIUse(K.CONV_GROUP))return this._conversationModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n);Je.l("".concat(o," options:"),e);var a=new Xo(n);a.setMessage(JSON.stringify(e));var i=e.groupName,s=e.conversationIDList,r={fromAccount:this._getMyUserID(),itemList:[{groupName:i,contactItem:[]}]},c=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?qt(e)||xt(e)?void(qt(e)?r.itemList[0].contactItem.push({type:1,toAccount:e.replace(S.CONV_C2C,"")}):xt(e)&&r.itemList[0].contactItem.push({type:2,groupID:e.replace(S.CONV_GROUP,"")})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?Oo({successConversationIDList:c,failureConversationIDList:u}):this._conversationModule.request({protocolName:Uo.CREATE_CONVERSATION_GROUP,requestData:r}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var n=e.data.groupResultItem[0],s=n.groupItem,r=n.resultItem;if(ft(s)&&(t._convGroupMap.set(s.convGroupID,s.groupName),t._emitConvGroupListUpdate()),vt(r)){var l,d,p=!1;r.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(c.push(l),(d=t._getLocalConversation(l))&&-1===d.conversationGroupList.indexOf(i)&&(d.conversationGroupList.push(i),p=!0)):u.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===p&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return No({successConversationIDList:c,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"deleteConvGroup",value:function(e){var t=this,n="deleteConversationGroup";if(!this._conversationModule.canIUse(K.CONV_GROUP))return this._conversationModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n);Je.l("".concat(o," groupName:").concat(e));var a=new Xo(n);return a.setMessage(e),this._conversationModule.request({protocolName:Uo.DELETE_CONVERSATION_GROUP,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(n){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var i=n.data.groupItem;if(vt(i)){var s=!1;i.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),s=!0)})),!0===s&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"renameConvGroup",value:function(e){var t=this,n="renameConversationGroup";if(!this._conversationModule.canIUse(K.CONV_GROUP))return this._conversationModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n);Je.l("".concat(o," options:"),e);var a=new Xo(n);a.setMessage(JSON.stringify(e));var i=e.oldName,s=e.newName;return this._conversationModule.request({protocolName:Uo.RENAME_CONVERSATION_GROUP,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:i,newName:s}}}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var n=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(n,s),t._emitConvGroupListUpdate();var r,c,u=t._conversationModule.getLocalConversationList(),l=!1;u.forEach((function(e){r=e.conversationGroupList,-1!==(c=r.indexOf(i))&&(r.splice(c,1,s),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"addConvsToGroup",value:function(e){var t=this,n="addConversationsToGroup";if(!this._conversationModule.canIUse(K.CONV_GROUP))return this._conversationModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n);Je.l("".concat(o," options:"),e);var a=new Xo(n);a.setMessage(JSON.stringify(e));var i=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},c=[],u=[];return i.forEach((function(e){return t._hasLocalConversation(e)?qt(e)||xt(e)?void(qt(e)?r.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,"")}}):xt(e)&&r.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===i.length?Oo({successConversationIDList:c,failureConversationIDList:u}):this._conversationModule.request({protocolName:Uo.ADD_CONVERSATIONS_TO_GROUP,requestData:r}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var n=e.data.updateGroupResult.contactResultItem;if(vt(n)){var i,r,l=!1;n.forEach((function(e){i=t._concatConversationID(e.contactItem),0===e.resultCode?(r=t._getLocalConversation(i))&&-1===r.conversationGroupList.indexOf(s)&&(r.conversationGroupList.push(s),c.push(i),l=!0):u.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return No({successConversationIDList:c,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"deleteConvsFromGroup",value:function(e){var t=this,n="deleteConversationsFromGroup";if(!this._conversationModule.canIUse(K.CONV_GROUP))return this._conversationModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n);Je.l("".concat(o," options:"),e);var a=new Xo(n);a.setMessage(JSON.stringify(e));var i=e.conversationIDList,s=e.groupName,r={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},c=[],u=[];return i.forEach((function(e){return t._hasLocalConversation(e)?qt(e)||xt(e)?void(qt(e)?r.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(S.CONV_C2C,"")}}):xt(e)&&r.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(S.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===i.length?Oo({successConversationIDList:c,failureConversationIDList:u}):this._conversationModule.request({protocolName:Uo.DELETE_CONVERSATIONS_FROM_GROUP,requestData:r}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var n=e.data.updateGroupResult.contactResultItem;if(vt(n)){var i,r,l=!1;n.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(r=t._getLocalConversation(i)){var n=r.conversationGroupList.indexOf(s);-1!==n&&(r.conversationGroupList.splice(n,1),c.push(i),l=!0)}}else u.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(s))}return No({successConversationIDList:c,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"onConvMarkUpdated",value:function(e){var t=this;if(!pn(e)){var n,o;Je.d("".concat(this._n,".onConvMarkUpdated markItemList:"),e);var a=!1;e.forEach((function(e){var i=e.recentContactItem,s=e.optType,r=e.standardMark,c=e.customMark;n=t._concatConversationID(i),(o=t._getLocalConversation(n))&&(1===s?a=t._diffStandardMark(o,r):2===s?a=t._diffCustomMark(o,c):3===s&&(a=t._diffStandardMark(o,r)||t._diffCustomMark(o,c)))})),!0===a&&this._emitConversationUpdate()}}},{key:"_diffStandardMark",value:function(e,t){var n=nn(t),o=!1;return!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!1;return!0}(e.markList,n)&&(e.markList=n,o=!0),o}},{key:"_diffCustomMark",value:function(e,t){var n=!1;return e.customData!==t&&void 0!==t&&(e.customData=t,n=!0),n}},{key:"onConvGroupCreated",value:function(e){var t=this;Je.d("".concat(this._n,".onConvGroupCreated resultList:"),e);var n=!1,o=!1;vt(e)&&(e.forEach((function(e){var a=e.msgGroupItem,i=a.groupID,s=a.groupName;t._convGroupMap.get(i)!==s&&(t._convGroupMap.set(i,s),o=!0);var r,c,u=e.msgRecentContactItem;vt(u)&&u.forEach((function(e){r=t._concatConversationID(e),(c=t._getLocalConversation(r))&&-1===c.conversationGroupList.indexOf(s)&&(c.conversationGroupList.push(s),n=!0)}))})),!0===n&&this._emitConversationUpdate(),!0===o&&this._emitConvGroupListUpdate())}},{key:"onConvGroupDeleted",value:function(e){var t=this;Je.d("".concat(this._n,".onConvGroupDeleted groupItemList:"),e);var n=[];if(vt(e)){var o=!1;e.forEach((function(e){var a=e.groupID,i=e.groupName;t._convGroupMap.has(a)&&(t._convGroupMap.delete(a),o=!0,n.push(i))})),!0===o&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList(n)}},{key:"_eraseFromConversationGroupList",value:function(e){pn(e)||(this._conversationModule.getLocalConversationList().forEach((function(t){t.conversationGroupList=t.conversationGroupList.filter((function(t){return!e.includes(t)}))})),this._emitConversationUpdate())}},{key:"onConvGroupNameUpdated",value:function(e){Je.d("".concat(this._n,".onConvGroupNameUpdated options:"),e);var t=e.groupID,n=e.groupName,o=e.oldGroupName;if(this._convGroupMap.get(t)!==n){this._convGroupMap.set(t,n),this._emitConvGroupListUpdate();var a,i,s=this._conversationModule.getLocalConversationList(),r=!1;s.forEach((function(e){a=e.conversationGroupList,-1!==(i=a.indexOf(o))&&(a.splice(i,1,n),r=!0)})),!0===r&&this._emitConversationUpdate()}}},{key:"onConvInGroupUpdated",value:function(e){var t=this;Je.d("".concat(this._n,".onConvInGroupUpdated options:"),e);var n=e.oldGroupName,o=e.recentContactUpdateGroupItem;if(vt(o)){var a,i,s,r=!1;o.forEach((function(e){var o=e.contactOptType,c=e.recentContactItem;a=t._concatConversationID(c),(i=t._getLocalConversation(a))&&(s=i.conversationGroupList.indexOf(n),1===o?-1===s&&(i.conversationGroupList.push(n),r=!0):2===o&&-1!==s&&(i.conversationGroupList.splice(s,1),r=!0))})),!0===r&&(this._emitConversationUpdate(),this._emitConvInGroupUpdate(n))}}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){var t=this;Je.d("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),e);var n=e.msgRecentContactItem,o=e.msgRecentContactUpdateContactItem,a=this._concatConversationID(n),i=this._getLocalConversation(a);if(i&&vt(o)){var s,r=!1;o.forEach((function(e){var n=e.groupOptType,o=e.recentContactGroupItem.groupName;s=i.conversationGroupList.indexOf(o),1===n?-1===s&&(i.conversationGroupList.push(o),r=!0):2===n&&-1!==s&&(i.conversationGroupList.splice(s,1),r=!0),!0===r&&t._emitConvInGroupUpdate(o)})),!0===r&&this._emitConversationUpdate()}}},{key:"onConvGroupListSynced",value:function(e){var t=this;vt(e)&&0!==e.length&&(Je.l("".concat(this._n,".onConvGroupListSynced groupItemList:"),e),e.forEach((function(e){t._convGroupMap.set(e.convGroupID,e.groupName)})))}},{key:"getConvGroupListByID",value:function(e){var t=this;if(!pn(e)){var n=[];return e.forEach((function(e){t._convGroupMap.has(e)&&n.push(t._convGroupMap.get(e))})),n}}},{key:"_onConversationNotFound",value:function(e,t){e.push({conversationID:t,code:Ao.CONV_NOT_FOUND,message:this._conversationModule.getErrorMessage(Ao.CONV_NOT_FOUND)})}},{key:"_onConversationIDInvalid",value:function(e,t){e.push({conversationID:t,code:Ao.INVALID_CONV_ID,message:this._conversationModule.getErrorMessage(Ao.INVALID_CONV_ID)})}},{key:"_getFlagBit",value:function(e){for(var t=e.toString(2),n=t.length,o=n-1;o>=0;o--)if("1"===t[o])return n-o-1}},{key:"_concatConversationID",value:function(e){var t,n=e.type,o=e.to,a=e.groupID,i=e.userID;return 1===n?mt(i)?mt(o)||(t="".concat(S.CONV_C2C).concat(o)):t="".concat(S.CONV_C2C).concat(i):2===n&&(t="".concat(S.CONV_GROUP).concat(a)),t}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(e,t){var n=this._getLocalConversation(e);if(n){var o=n.conversationGroupList;-1===o.indexOf(t)&&o.push(t)}}},{key:"_getLocalConversation",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:"_hasLocalConversation",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(E.CONVERSATION_GROUP_LIST_UPDATED,m(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},n=this._conversationModule.getLocalConversationList();t.conversationList=n.filter((function(t){return t.conversationGroupList.includes(e)})),this._conversationModule.emitOuterEvent(E.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=vn.NOT_START}}]),e}(),Oa=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="ConversationModule",fa.mixin(g(t)),t._messageListHandler=new ga,t._messageRemindHandler=new La(g(t)),t._convGroupHandler=new Ra(g(t)),t.singlyLinkedList=new Ea(100),t._pagingStatus=vn.NOT_START,t._pagingTimeStamp=0,t._pagingStartIndex=0,t._pagingPinnedTimeStamp=0,t._pagingPinnedStartIndex=0,t._pagingConvIDMap=new Map,t._convIDFromUnreadDBMap=new Map,t._conversationMap=new Map,t._tmpGroupList=[],t._tmpGroupAtTipsList=[],t._peerReadTimeMap=new Map,t._completedMap=new Map,t._roamingMessageKeyAndTimeMap=new Map,t._roamingMessageSequenceMap=new Map,t._remoteGroupReadSequenceMap=new Map,t._convTotalUnreadCount=0,t._pagingGetCostList=[],t._initListeners(),t}return i(a,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(ha.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(ha.PROFILE_UPDATED,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_init",value:function(){var e=this;Je.l("".concat(this._n,"._init"));var t=this.getModule(so).getItem("conversationMap"),n=this.isIntl(),o=this.isUsingChatCore();if(t){for(var a=t.length,i=0;i<a;i++){var s=t[i];if(s){if(this._isNonExistentAccount(s.conversationID))continue;if(s.groupProfile){var r=s.groupProfile.type;if(bt(r))continue}}this._conversationMap.set(s.conversationID,new Aa(t[i],n,o))}this.emitConversationUpdate(!0,!1)}this.ready((function(){e._tmpGroupList.length>0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"_isNonExistentAccount",value:function(e){var t;return e.startsWith(S.CONV_C2C)&&(t=e.replace(S.CONV_C2C,"")),"@TLS#ERROR"===t||"@TLS#NOT_FOUND"===t}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,a=void 0===o||o,i=e.isUnreadC2CMessage,s=void 0!==i&&i,r=e.updateUnreadCount,c=void 0===r||r,u=e.isSyncingEnded,l=void 0!==u&&u;this._isReady?0!==n.length?(!0===a&&this._checkNewConversation(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:a,isUnreadC2CMessage:s,isFromGetConversations:!1,updateUnreadCount:c}),a||(this._convIDFromUnreadDBMap=new Map([].concat(m(this._convIDFromUnreadDBMap),m(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConversation(),l&&this.emitInnerEvent(ha.C2C_UNREAD_HANDLE_COMPLETED)),n.filter((function(e){return e.type===S.CONV_TOPIC})).length>0||this.emitConversationUpdate()):l&&this.emitInnerEvent(ha.C2C_UNREAD_HANDLE_COMPLETED):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!vt(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var a=t._conversationMap.get(o);a.groupProfile=JSON.parse(JSON.stringify(e)),a.lastMessage.lastSequence<e.nextMessageSeq&&(a.lastMessage.lastSequence=e.nextMessageSeq-1),a.subType||(a.subType=e.type)}})),n&&this.emitConversationUpdate(!0,!1)}else this._tmpGroupList=e}},{key:"_updateConversationUserProfile",value:function(e){var t=this;e.data.forEach((function(e){var n="C2C".concat(e.userID);t._conversationMap.has(n)&&(t._conversationMap.get(n).userProfile=e)})),this.emitConversationUpdate(!0,!1)}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=!1,a=[];e.forEach((function(e){(n=t._conversationMap.get(e.conversationID))&&(n.type===S.CONV_TOPIC?a.push(e):(n.reduceUnreadCount()&&(o=!0),n.isLastMessageRevoked({sequence:e.sequence,time:e.time})&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),o=!0)))})),this.getModule(oo).onMessageRevoked(a),o&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())}}},{key:"updateRevokerInfo",value:function(e){for(var t=new Set,n=0;n<e.length;n++){var o=e[n].revoker;t.add(o)}var a=m(t),i=this.getModule($n);return new Promise((function(t){i.getUserProfile({userIDList:a}).then((function(n){var o=n.data;if(!vt(o)||0===o.length)return t(e);var a,i={},s=D(o);try{for(s.s();!(a=s.n()).done;){var r=a.value,c=r.userID,u=r.nick,l=r.avatar;i[c]={nick:u,avatar:l}}}catch(d){s.e(d)}finally{s.f()}e.forEach((function(e){var t=e.revoker;i[t]&&(e.revokerInfo.nick=i[t].nick||"",e.revokerInfo.avatar=i[t].avatar||"")})),t(e)})).catch((function(){t(e)}))}))}},{key:"isLastMessageRevoked",value:function(e){var t=!1,n=e.conversationID,o=e.sequence,a=e.time,i=this._conversationMap.get(n);i&&(t=i.type===S.CONV_TOPIC?this.getModule(oo).isLastMessageRevoked({topicID:n.replace(S.CONV_GROUP,""),sequence:o}):i.isLastMessageRevoked({sequence:o,time:a}));return Je.l("".concat(this._n,".isLastMessageRevoked options:").concat(JSON.stringify(e)," ret:").concat(t)),t}},{key:"onMessageDeleted",value:function(e){var t=this;if(0!==e.length){var n=null;e.forEach((function(e){(n=t._messageListHandler.getLocalMessage(e.conversationID,e.ID))&&(n.isDeleted=!0),e!==n&&(e.isDeleted=!0)}));for(var o=e[0].conversationID,a=this._messageListHandler.getLocalMessageList(o),i={},s=a.length-1;s>=0;s--)if(!a[s].isDeleted){i=a[s];break}var r=this._conversationMap.get(o);if(r){var c=!1;r.lastMessage.lastSequence===i.sequence&&r.lastMessage.lastTime===i.time||(pn(i)&&(i=void 0),r.updateLastMessage(i),r.type!==S.CONV_TOPIC&&(c=!0),Je.l("".concat(this._n,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),r.lastMessage)),o.startsWith(S.CONV_C2C)&&this.updateUnreadCount(o),c&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t="".concat(this._n,".onMessageModified"),n=e.conversationType,o=e.from,a=e.to,i=e.time,s=e.sequence,r=e.elements,c=e.cloudCustomData,u=e.messageVersion,l=this.getMyUserID(),d="".concat(n).concat(a);a===l&&n===S.CONV_C2C&&(d="".concat(n).concat(o));var p=this._messageListHandler.onMessageModified(d,e),_=p.isUpdated,g=p.message;!0===_&&this.emitOuterEvent(E.MESSAGE_MODIFIED,[g]);var h=this._isTopicConversation(d);if(null===g?Je.l("".concat(t," message is null! options:").concat(JSON.stringify(e),"}")):Je.l("".concat(t," isUpdated:").concat(_," isTopicMessage:").concat(h," from:").concat(o," to:").concat(a," sequence:").concat(g.sequence," time:").concat(g.time)),h){this.getModule(oo).onMessageModified(e)}else{var f=this._conversationMap.get(d);if(f){var v=f.lastMessage;v&&v.lastTime===i&&v.lastSequence===s&&v.version!==u&&(Je.l("".concat(t," conversationID:").concat(d," lastMessage updated")),v.type=r[0].type,v.payload=r[0].content,v.messageForShow=en(v.type,v.payload,this.isIntl()),v.cloudCustomData=c,v.version=u,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,a=null;o.forEach((function(e){e.groupAtTips?a=e.groupAtTips:e.elements?a=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(a=t(t({},e),{},{sync:!0})),a.__random=e.random,a.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(a)})),Je.d("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,a=n.from,i=n.topicID,s=void 0===i?void 0:i,r=n.sync,c=void 0!==r&&r;if(a!==e.getMyUserID())if(mt(s)){var u=e._conversationMap.get("".concat(S.CONV_GROUP).concat(o));u&&(u.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(S.CONV_GROUP).concat(s));if(l){l.updateGroupAtInfoList(n);var d=e.getModule(oo),p=l.groupAtInfoList;d.onConversationProxy({topicID:s,groupAtInfoList:p})}if(pn(l)&&c)e.updateTopicConversation([{conversationID:"".concat(S.CONV_GROUP).concat(s),type:S.CONV_TOPIC}]),e._conversationMap.get("".concat(S.CONV_GROUP).concat(s)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_checkNewConversation",value:function(e){var t=this,n=[],o=[];e.forEach((function(e){t._conversationMap.has(e.conversationID)||(e.type===S.CONV_C2C?n.push(e.conversationID.replace(S.CONV_C2C,"")):e.type===S.CONV_GROUP&&o.push(e.conversationID.replace(S.CONV_GROUP,"")))})),n.length>0&&(this._onNewC2CConversation(n),n=null),o.length>0&&(this._onNewGroupConversation(o),o=null)}},{key:"_onNewC2CConversation",value:function(e){this.getModule(eo).getRemotePeerReadTime(e),this._messageRemindHandler.getC2CMessageRemindType(e)}},{key:"_onNewGroupConversation",value:function(e){var t=this.getModule(to);t&&t.getMessageRemindType(e)}},{key:"_setStorageConversationList",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getLocalConversationList(),n=t.filter((function(e){return e.type===S.CONV_C2C||e.type===S.CONV_GROUP&&e.lastMessage.type!==S.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}})),o=this.getModule(so);o.setItem("conversationMap",n,e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(to);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(E.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return m(this._conversationMap.values()).filter((function(e){return e.type!==S.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n="syncConversationList",o=new Xo(n);return this._pagingStatus===vn.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList(t).then((function(t){var a=cn(e._pagingGetCostList),i=rn(e._pagingGetCostList);e._pagingGetCostList.length=0,e._pagingStatus=vn.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e.emitInnerEvent(ha.CONV_SYNC_COMPLETED);var s="count:".concat(e._conversationMap.size," sum:").concat(i," avg:").concat(a);return Je.l("".concat(e._n,".").concat(n,". ").concat(s)),o.setMessage(s).setNetworkType(e.getNetworkType()).end(),t})).catch((function(t){return e._pagingStatus=vn.REJECTED,o.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var n=v(e,2),a=n[0],i=n[1];o.setError(t,a,i).end()})),Go(t)}))}},{key:"_diffAndDeleteConversation",value:function(){var e=this;if(this._isSyncCompleted()){var t=[];this._conversationMap.forEach((function(n,o){!e._pagingConvIDMap.has(o)&&e._convIDFromUnreadDBMap.has(o)&&(e._conversationMap.delete(o),t.push(o))})),Je.l("".concat(this._n,"._diffAndDeleteConversation list:").concat(t)),t=null}}},{key:"_pagingGetConversationList",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n="".concat(this._n,"._pagingGetConversationList");Je.l("".concat(n," incrementalPullFlag:").concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex));var o=Date.now();return this._pagingStatus=vn.PENDING,this.request({protocolName:Uo.PAGING_GET_CONVERSATION_LIST,requestData:{fromAccount:this.getMyUserID(),timeStamp:t?this._pagingTimeStamp:0,startIndex:t?this._pagingStartIndex:0,pinnedTimeStamp:t?this._pagingPinnedTimeStamp:0,pinnedStartIndex:t?this._pagingPinnedStartIndex:0,orderType:1}}).then((function(t){var a=t.data,i=a.completeFlag,s=a.conversations,r=void 0===s?[]:s,c=a.timeStamp,u=a.startIndex,l=a.pinnedTimeStamp,d=a.pinnedStartIndex,p=a.groupItem;if(e._pagingGetCostList.push(un(o,!1)),Je.l("".concat(n," ok. completeFlag:").concat(i," count:").concat(r.length," cost:").concat(un(o))),e._convGroupHandler.onConvGroupListSynced(p),r.length>0){var _=e._getConversationOptions(r);e._pagingConvIDMap=new Map([].concat(m(e._pagingConvIDMap),m(_.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConversationList({conversationOptionsList:_,isFromGetConversations:!0,updateUnreadCount:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return Oo();e.triggerReady()}return e._pagingTimeStamp=c,e._pagingStartIndex=u,e._pagingPinnedTimeStamp=l,e._pagingPinnedStartIndex=d,1!==i?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),Oo())})).catch((function(t){throw e.isLoggedIn()&&(e._isReady||(Je.w("".concat(n," failed. error:"),t),e.triggerReady())),t}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=e.isInstantMessage,a=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(m(t.toBeUpdatedConversationList),m(this._conversationMap)))),n||(this._updateUserOrGroupProfile(t.newConversationList),o&&this.emitTotalUnreadMessageCountUpdate()),Je.l("".concat(this._n,"._updateLocalConversationList cost:").concat(un(a)))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,a=e.isUnreadC2CMessage,i=void 0!==a&&a,s=e.updateUnreadCount,r=[],c=[],u=this.getModule(to),l=this.getModule(no),d=this.isIntl(),p=this.isUsingChatCore(),_=0,g=t.length;_<g;_++){var h=new Aa(t[_],d,p),f=h.conversationID;if(!this._isNonExistentAccount(f))if(this._conversationMap.has(f)){var v=this._conversationMap.get(f),m=["unreadCount","allowType","adminForbidType","payload"];!1===o?m.push("lastMessage"):m.push("isPinned");var M=t[_].lastMessage,I=!mt(M);I||t[_].type===S.CONV_TOPIC||this._onLastMessageNotExist(t[_]),mt(o)&&I&&null===v.lastMessage.payload&&(v.lastMessage.payload=M.payload),pn(v.lastMessage.revoker)||(v.lastMessage.revoker=null),Et(v,h,m,[null,void 0,"",0,NaN]),!0===s&&v.updateUnreadCount({nextUnreadCount:h.unreadCount,isFromGetConversations:n,isUnreadC2CMessage:i}),o&&I&&(M.payload&&(v.lastMessage.payload=M.payload),v.type===S.CONV_GROUP&&(v.lastMessage.nameCard=M.nameCard,v.lastMessage.nick=M.nick)),I&&v.lastMessage.cloudCustomData!==M.cloudCustomData&&(v.lastMessage.cloudCustomData=M.cloudCustomData||""),this._conversationMap.delete(f),r.push([f,v])}else{if(h.type===S.CONV_GROUP&&u){var y=h.groupProfile.groupID,T=u.getLocalGroupProfile(y);T&&(h.groupProfile=T,!0===s&&h.updateUnreadCount({nextUnreadCount:0}))}else if(h.type===S.CONV_C2C){var C=f.replace(S.CONV_C2C,"");l&&l.isMyFriend(C)&&(h.remark=l.getFriendRemark(C))}c.push(h),r.push([f,h])}}for(var D=this.getModule(oo),E=r.length,N=0;N<E;N++)if(r[N][1].type===S.CONV_TOPIC){var k=r[N][1],A=k.conversationID,L=k.unreadCount,R=k.groupAtInfoList;D.onConversationProxy({topicID:A.replace(S.CONV_GROUP,""),unreadCount:L,groupAtInfoList:pn(R)?void 0:R})}return{toBeUpdatedConversationList:r,newConversationList:c}}},{key:"_onLastMessageNotExist",value:function(e){new Xo("lastMessageNotExist").setMessage(JSON.stringify(e)).setNetworkType(this.getNetworkType()).end()}},{key:"_sortConversationList",value:function(e){var t=[],n=[],o=[],a=[];return e.forEach((function(e){!0===e[1].isPinned?pn(e[1].lastMessage.lastTime)?n.push(e):t.push(e):pn(e[1].lastMessage.lastTime)?a.push(e):o.push(e)})),t.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})).concat(n).concat(o.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime}))).concat(a)}},{key:"_sortConversationListAndEmitEvent",value:function(){this._conversationMap=new Map(this._sortConversationList(m(this._conversationMap))),this.emitConversationUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t=this;if(0!==e.length){var n=[],o=[],a=this.getModule($n),i=this.getModule(to);e.forEach((function(e){if(e.type===S.CONV_C2C)n.push(e.toAccount);else if(e.type===S.CONV_GROUP){var t=e.toAccount;i.hasLocalGroup(t)?e.groupProfile=i.getLocalGroupProfile(t):o.push(t)}})),Je.l("".concat(this._n,"._updateUserOrGroupProfile c2cUserIDList:").concat(n," groupIDList:").concat(o)),n.length>0&&a.getUserProfile({userIDList:n}).then((function(e){var n=e.data;vt(n)?n.forEach((function(e){t._doUpdateUserProfile("C2C".concat(e.userID),e)})):t._doUpdateUserProfile("C2C".concat(n.userID),n)})),o.length>0&&i.getGroupProfileAdvance({groupIDList:o,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then((function(e){e.data.successGroupList.forEach((function(e){var n="GROUP".concat(e.groupID);if(t._conversationMap.has(n)){var o=t._conversationMap.get(n);Et(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t)}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],a=e.filter((function(e){var t=e.type,o=e.userID;return 1===t&&!n._isNonExistentAccount(o)||2===t})),i=this.getMyUserID(),s=a.map((function(e){if(mt(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var a={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(a),{conversationID:"C2C".concat(e.userID),type:"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]?n._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===i&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new Ca(a),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,customData:e.customMark||"",markList:nn(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId),remark:e.friendRemark||"",messageRemindType:n._transMessageRemindType(e.messageRemindType)}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new Na({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage,type:e.groupType,nextMessageSeq:e.nextMessageSeq}),unreadCount:n._computeGroupUnreadCount(e),peerReadTime:0,isPinned:1===e.isPinned,version:0,customData:e.customMark||"",markList:nn(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId),messageRemindType:n._transMessageRemindType(e.messageRemindType)}}));o.length>0&&this.getModule($n).onConversationsProfileUpdated(o);return s}},{key:"_transMessageRemindType",value:function(e){var t="";return 0===e?t=S.MSG_REMIND_ACPT_AND_NOTE:1===e?t=S.MSG_REMIND_DISCARD:2===e&&(t=S.MSG_REMIND_ACPT_NOT_NOTE),t}},{key:"_computeGroupUnreadCount",value:function(e){var t=e.unreadCount,n=void 0===t?0:t,o=e.noUnreadCount,a=n-(void 0===o?0:o);return a>0?a:0}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,a=void 0===o?void 0:o,i=n.elements,s=void 0===i?[]:i,r=n.groupTips,c=void 0===r?{}:r;if(!mt(a)&&!pn(c)){var u=new pa(c);u.setElement({type:S.MSG_GRP_TIP,content:t(t({},c.elements),{},{groupProfile:c.groupProfile})});var l=JSON.parse(JSON.stringify(u.payload));return u=null,{type:S.MSG_GRP_TIP,payload:l}}return{type:s[0]?s[0].type:null,payload:s[0]?this._amendLayersOverLimitProperty(s[0].content):null}}},{key:"_amendLayersOverLimitProperty",value:function(e){var t=e.layersOverLimit;return 0===t?e.layersOverLimit=!1:1===t&&(e.layersOverLimit=!0),e}},{key:"getLocalMessageList",value:function(e){return this._messageListHandler.getLocalMessageList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof pa&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){if(vt(e)){var t=e.map((function(e){var t=e.type,n=e.userID,o=e.groupID;return 1===t?"".concat(S.CONV_C2C).concat(n):2===t?"".concat(S.CONV_GROUP).concat(o):void 0}));Je.l("".concat(this._n,".onConversationDeleted conversationIDList:").concat(t)),this.deleteLocalConversationList(t)}}},{key:"onConversationPinned",value:function(e){var t=this;if(vt(e)){var n=!1;e.forEach((function(e){var o,a=e.type,i=e.userID,s=e.groupID;1===a?o=t.getLocalConversation("".concat(S.CONV_C2C).concat(i)):2===a&&(o=t.getLocalConversation("".concat(S.CONV_GROUP).concat(s))),o&&(Je.l("".concat(t._n,".onConversationPinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned||(o.isPinned=!0,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"onConversationUnpinned",value:function(e){var t=this;if(vt(e)){var n=!1;e.forEach((function(e){var o,a=e.type,i=e.userID,s=e.groupID;1===a?o=t.getLocalConversation("".concat(S.CONV_C2C).concat(i)):2===a&&(o=t.getLocalConversation("".concat(S.CONV_GROUP).concat(s))),o&&(Je.l("".concat(t._n,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,a=e.count,i="".concat(this._n,".getMessageList"),s=this.getLocalConversation(n),r="";if(s&&s.groupProfile&&(r=s.groupProfile.type),bt(r))return Je.l("".concat(i," not available in avchatroom. conversationID:").concat(n)),Oo({messageList:[],nextReqMessageID:"",isCompleted:!0});(mt(a)||a>15)&&(a=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var c=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),u=this._completedMap.has(n);if(Je.l("".concat(i," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(c," count:").concat(a," isCompleted:").concat(u)),this._needGetHistory({conversationID:n,remainingCount:c,count:a}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,a=e.storedMessageList,s=t._completedMap.has(n),r=a;c>0&&(r=t._messageListHandler.getLocalMessageList(n).slice(0,a.length+c));var u={nextReqMessageID:s?"":o,messageList:r,isCompleted:s},l=u.messageList.filter((function(e){return e.isRevoked}))||[],d=r.map((function(e){return e.sequence}));return Je.l("".concat(i," ret.nextReqMessageID:").concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(r.length," sequenceList:").concat(d)),vt(l)&&0!==l.length?t.updateRevokerInfo(l).then((function(e){return e.forEach((function(e){var t=e.revokerInfo;u.messageList=u.messageList.map((function(n){return n.ID===e.ID&&t&&(n.revokeReason=t.reason||"",n.revokerInfo={userID:t.revoker||n.revoker,nick:t.nick,avatar:t.avatar}),n}))})),No(u)})):No(u)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:a});return Oo(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,a="".concat(this._n,"._getMessageListFromMemory"),i=this._messageListHandler.getLocalMessageList(t),s=i.length,r=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(r=i.findIndex((function(e){return e.ID===n})))>o?(c.messageList=i.slice(r-o,r),c.nextReqMessageID=i[r-o].ID):(c.messageList=i.slice(0,r),c.isCompleted=!0):s>o?(r=s-o,c.messageList=i.slice(r,s),c.nextReqMessageID=i[r].ID):(c.messageList=i.slice(0,s),c.isCompleted=!0),Je.l("".concat(a," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(c.messageList.length)),c}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,a=e.count,i=e.direction,s=void 0===i?0:i;if((mt(a)||a>15)&&(a=15),t.startsWith(S.CONV_C2C)){var r=this.getModule(eo),c=t.replace(S.CONV_C2C,"");return r.getRoamingMessagesHopping({peerAccount:c,time:o,count:a,direction:s})}if(t.startsWith(S.CONV_GROUP)){var u=this.getModule(to),l=t.replace(S.CONV_GROUP,"");return u.getRoamingMessagesHopping({groupID:l,sequence:n,count:a,direction:s})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),a=o.length;if(!n)return a;var i=0;return qt(t)?i=o.findIndex((function(e){return e.ID===n})):xt(t)&&(i=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===i&&(i=0),i}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,a=this.getLocalConversation(t),i="";if(a&&a.groupProfile&&(i=a.groupProfile.type),Vt(t)||bt(i))return!1;var s=!1,r="".concat(this._n,"._needGetHistory conversationID:").concat(t);if(xt(t)){var c=this._isPagingGetGroupListCompleted(),u=this._getLocalGroupCount(),l=this._hasLocalGroup(t),d=this._isTopicConversation(t);if(Je.l("".concat(r," isGroupListCompleted:").concat(c," localGroupCount:").concat(u)+" isGroupInList:".concat(l," isTopic:").concat(d)),c&&u<=500&&!l&&!d)return s}return s=n<=o&&!this._completedMap.has(t),Je.l("".concat(r," ret:").concat(s)),s}},{key:"_isTopicConversation",value:function(e){var t=e.replace(S.CONV_GROUP,"");return Ft(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===S.CONV_SYSTEM)return Oo();var o=15;n>20&&(o=20);var a=null;if(qt(t)){var i=this._roamingMessageKeyAndTimeMap.has(t);return(a=this.getModule(eo))?a.getRoamingMessage({conversationID:t,peerAccount:t.replace(S.CONV_C2C,""),count:o,lastMessageTime:i?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:i?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):Go({code:Ao.CANNOT_FIND_MODULE})}if(xt(t)){if(!(a=this.getModule(to)))return Go({code:Ao.CANNOT_FIND_MODULE});var s=t.replace(S.CONV_GROUP,""),r=null;this._conversationMap.has(t)&&!Ft(s)&&(r=this._conversationMap.get(t).lastMessage);var c=0;r&&(c=r.lastSequence);var u=this._roamingMessageSequenceMap.get(t);return a.getRoamingMessage({conversationID:t,groupID:s,count:o,sequence:u||c})}return Oo()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,a=n.payload;if(pn(o)||pn(a)){var i=this._messageListHandler.getLocalMessageList(e);if(0===i.length)return;var s=i[i.length-1];Je.l("".concat(this._n,".patchConversationLastMessage conversationID:").concat(e," payload:"),s.payload),t.updateLastMessage(s)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=n.startsWith(S.CONV_C2C)?S.CONV_C2C:S.CONV_GROUP,i=null,s=[],r=[],c=0,u=e.length,l=null,d=a===S.CONV_GROUP,p=this.getFileDownloadProxy(),_=function(){c=d?e.length-1:0,u=d?0:e.length},g=function(){d?--c:++c},h=function(){return d?c>=u:c<u};for(_();h();g())if(d&&1===e[c].sequence&&o&&this.setCompleted(n),1!==e[c].isPlaceMessage)if((i=new pa(e[c])).to=e[c].to,a!==S.CONV_GROUP||mt(e[c].topicID)||(i.to=e[c].topicID),i.isSystemMessage=!!e[c].isSystemMessage,i.conversationType=a,l=4===e[c].event?{type:S.MSG_GRP_TIP,content:t(t({},e[c].elements),{},{groupProfile:e[c].groupProfile})}:e[c].elements,d||i.setNickAndAvatar({nick:e[c].nick,avatar:e[c].avatar}),pn(l)){var f=new Xo("emptyMessageBody");f.setMessage("from:".concat(i.from," to:").concat(i.to," sequence:").concat(i.sequence," event:").concat(e[c].event)),f.setNetworkType(this.getNetworkType()).setLevel("warning").end()}else i.setElement(l,p),i.reInitialize(this.getMyUserID()),s.push(i);return _=g=h=null,o?(this._messageListHandler.unshift(s,r),s=null,r):(r=null,s)}},{key:"findMessage",value:function(e){return this._messageListHandler.findMessage(e)}},{key:"_isNotInCommunity",value:function(e){var t=!1;if(e.startsWith(S.CONV_GROUP)&&this._isTopicConversation(e)){var n=$t(e.replace(S.CONV_GROUP,""));this.getModule(to).hasLocalGroup(n)||(t=!0)}return t}},{key:"deleteTopicRoamingMessageInfo",value:function(e){var t=this;wt({groupID:e})&&this._messageListHandler.getTopicConversationIDList(e).forEach((function(e){t._completedMap.delete(e),t._roamingMessageSequenceMap.delete(e)}))}},{key:"deleteGroupRoamingMessageInfo",value:function(e){var t="".concat(S.CONV_GROUP).concat(e);this._completedMap.delete(t),this._roamingMessageSequenceMap.delete(t)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,n=this.getLocalConversation(t);if(Je.l("".concat(this._n,".setMessageRead conversationID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n)return Oo();if(n.type!==S.CONV_GROUP&&n.type!==S.CONV_TOPIC||pn(n.groupAtInfoList)||this.deleteGroupAtTips(t),0===n.unreadCount)return Oo();if(n.type===S.CONV_GROUP&&!this._hasLocalGroup(t))return 0!==n.unreadCount&&(n.unreadCount=0,this.emitConversationUpdate(!0,!1)),Oo();var o=this._messageListHandler.getLocalLastMessage(t),a=n.lastMessage.lastTime;o&&a<o.time&&(a=o.time);var i=n.lastMessage.lastSequence;if(o&&i<o.sequence&&(i=o.sequence),n.type===S.CONV_TOPIC&&mt(o)){var s=this.getModule(oo),r=t.replace(S.CONV_GROUP,""),c=$t(r),u=s.getLocalTopic(c,r);u&&(i=u.nextMessageSeq-1)}var l=null;switch(n.type){case S.CONV_C2C:return(l=this.getModule(eo))?l.setMessageRead({conversationID:t,lastMessageTime:a}):Go({code:Ao.CANNOT_FIND_MODULE});case S.CONV_GROUP:case S.CONV_TOPIC:return(l=this.getModule(to))?l.setMessageRead({conversationID:t,lastMessageSeq:i}):Go({code:Ao.CANNOT_FIND_MODULE});case S.CONV_SYSTEM:return n.unreadCount=0,this.emitConversationUpdate(!0,!1),Oo();default:return Oo()}}},{key:"setAllMessageRead",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="setAllMessageRead",o="".concat(this._n,".").concat(n);t.scope||(t.scope=S.READ_ALL_MSG),Je.l("".concat(o," options:"),t);var a=this._createSetAllMessageReadPack(t);if(0===a.readAllC2CMessage&&0===a.groupMessageReadInfoList.length)return Oo();var i=new Xo(n);return this.request({protocolName:Uo.SET_ALL_MESSAGE_READ,requestData:a}).then((function(n){var o=n.data,a=e._handleAllMessageRead(o);return i.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(a))).setNetworkType(e.getNetworkType()).end(),Oo()})).catch((function(t){return e.probeNetwork().then((function(e){var n=v(e,2),o=n[0],a=n[1];i.setError(t,o,a).end()})),Je.w("".concat(o," failed. error:"),t),Go({code:t&&t.code?t.code:Ao.MSG_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&n<t.sequence&&(n=t.sequence),n}},{key:"_getConversationLastMessageTime",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastTime;return t&&n<t.time&&(n=t.time),n}},{key:"_createSetAllMessageReadPack",value:function(e){var t,n={readAllC2CMessage:0,groupMessageReadInfoList:[]},o=e.scope,a=D(this._conversationMap);try{for(a.s();!(t=a.n()).done;){var i=v(t.value,2)[1];if(i.unreadCount>0)if(i.type===S.CONV_C2C&&0===n.readAllC2CMessage){if(o===S.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===S.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(i.type===S.CONV_GROUP&&(o===S.READ_ALL_GROUP_MSG||o===S.READ_ALL_MSG)){var s=this._getConversationLastMessageSequence(i);n.groupMessageReadInfoList.push({groupID:i.groupProfile.groupID,messageSequence:s})}}}catch(r){a.e(r)}finally{a.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n<o;n++){var a=e[n],i=a.groupID,s=a.sequence,r=a.retCode,c=a.lastMessageSeq;mt(r)?this._remoteGroupReadSequenceMap.set(i,c):(this._remoteGroupReadSequenceMap.set(i,s),0!==r&&t.push("".concat(i,"-").concat(s,"-").concat(r)))}return t}},{key:"_updateAllConversationUnreadCount",value:function(e){var t,n=e.readAllC2CMessage,o=0,a=D(this._conversationMap);try{for(a.s();!(t=a.n()).done;){var i=v(t.value,2),s=i[0],r=i[1];if(r.unreadCount>=1){if(1===n&&r.type===S.CONV_C2C){var c=this._getConversationLastMessageTime(r);this.updateIsReadAfterReadReport({conversationID:s,lastMessageTime:c})}else if(r.type===S.CONV_GROUP){var u=s.replace(S.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(u)){var l=this._remoteGroupReadSequenceMap.get(u),d=this._getConversationLastMessageSequence(r);this.updateIsReadAfterReadReport({conversationID:s,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(u)}}this.updateUnreadCount(s,!1)&&(o+=1)}}}catch(p){a.e(p)}finally{a.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(S.CONV_GROUP,""),a=!1;if(this._remoteGroupReadSequenceMap.has(o)){var i=this._remoteGroupReadSequenceMap.get(o);n<=i&&(a=!0,Je.l("".concat(this._n,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(i))),n>=i+10&&this._remoteGroupReadSequenceMap.delete(o)}return a}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,a=this._messageListHandler.getLocalMessageList(t);if(0!==a.length)for(var i,s=a.length-1;s>=0;s--)if(i=a[s],!(o&&i.time>o||n&&i.sequence>n)){if("in"===i.flow&&i.isRead)break;i.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),a=this._messageListHandler.getLocalMessageList(e);if(o){var i=o.unreadCount,s=a.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(i!==s&&(o.unreadCount=s,n=!0,Je.l("".concat(this._n,".updateUnreadCount from ").concat(i," to ").concat(s,", conversationID:").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),n&&o.type===S.CONV_TOPIC){var r=o.unreadCount,c=this.getModule(oo),u=e.replace(S.CONV_GROUP,"");c.onConversationProxy({topicID:u,unreadCount:r})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),Je.l("".concat(this._n,".clearGroupAtInfoList conversationID:").concat(e)),n.type===S.CONV_TOPIC){var o=n.groupAtInfoList,a=this.getModule(oo),i=e.replace(S.CONV_GROUP,"");a.onConversationProxy({topicID:i,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,a=e.groupID,i=void 0===a?void 0:a,s=e.readReceiptList;if(!pn(s)){var r=[];if(mt(o)){if(!mt(i)){var c="".concat(S.CONV_GROUP).concat(i);s.forEach((function(e){var n=e.tinyID,o=e.clientTime,a=e.random,s=e.readCount,u=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(a),d=t._messageListHandler.getLocalMessage(c,l),p={groupID:i,messageID:l,readCount:0,unreadCount:0};d&&(_t(s)&&(d.readReceiptInfo.readCount=s,p.readCount=s),_t(u)&&(d.readReceiptInfo.unreadCount=u,p.unreadCount=u),r.push(p))}))}}else{var u="".concat(S.CONV_C2C).concat(o);s.forEach((function(e){var n=e.tinyID,a=e.clientTime,i=e.random,s="".concat(n,"-").concat(a,"-").concat(i),c=t._messageListHandler.getLocalMessage(u,s);if(c){c.readReceiptInfo.isPeerRead=!0;var l={userID:o,messageID:s,isPeerRead:!0};r.push(l)}}))}r.length>0&&this.emitOuterEvent(E.MESSAGE_READ_RECEIPT_RECEIVED,r)}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Vt(t.type)){for(var o=[],a=0,i=n.length;a<i;a++)"in"!==n[a].flow?"out"!==n[a].flow||n[a].isRead||n[a].setIsRead(!0):o.push(n[a]);var s=0;if(t.type===S.CONV_C2C){var r=o.slice(-t.unreadCount).filter((function(e){return e.isRevoked})).length;s=o.length-t.unreadCount-r}else s=o.length-t.unreadCount;for(var c=0;c<s&&!o[c].isRead;c++)o[c].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t=this,n="".concat(this._n,".deleteGroupAtTips");Je.l("".concat(n));var o=this._conversationMap.get(e);if(!o)return Promise.resolve();var a=o.groupAtInfoList;if(0===a.length)return Promise.resolve();var i=void 0;e.startsWith(S.CONV_GROUP)&&(i=e.replace(S.CONV_GROUP,""));var s=m(a);if((wt({groupID:i})||Ft(i))&&0===(s=a.filter((function(e){return!e.atTypeArray.includes(S.CONV_AT_ALL)}))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var r=this.getMyUserID();return this.request({protocolName:Uo.DELETE_GROUP_AT_TIPS,requestData:{messageListToDelete:s.map((function(e){return{from:e.from,to:r,messageSeq:e.__sequence,messageRandom:e.__random,groupID:mt(e.topicID)?e.groupID:e.topicID}}))}}).then((function(){return Je.l("".concat(n," ok. count:").concat(a.length)),t.clearGroupAtInfoList(e,!1),Promise.resolve()})).catch((function(e){return Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"appendToMessageList",value:function(e){return this._messageListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this.singlyLinkedList.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this.singlyLinkedList.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,n){return!(!this._messageListHandler.pushIn(t,n)||this._isMessageFromCurrentInstance(t)&&!n)&&(e.push(t),!0)}},{key:"_isMessageFromCurrentInstance",value:function(e){return this.singlyLinkedList.has(e.random)}},{key:"revoke",value:function(e,t,n){return this._messageListHandler.revoke(e,t,n)}},{key:"getPeerReadTime",value:function(e){return this._peerReadTimeMap.get(e)}},{key:"recordPeerReadTime",value:function(e,t){this._peerReadTimeMap.has(e)?this._peerReadTimeMap.get(e)<t&&this._peerReadTimeMap.set(e,t):this._peerReadTimeMap.set(e,t)}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){if(e.startsWith(S.CONV_C2C)&&t>0){var n=this._messageListHandler.updateMessageIsPeerReadProperty(e,t);if(n.length>0&&this.emitOuterEvent(E.MESSAGE_READ_BY_PEER,n),this._conversationMap.has(e)){var o=this._conversationMap.get(e).lastMessage;pn(o)||o.fromAccount===this.getMyUserID()&&o.lastTime<=t&&!o.isPeerRead&&(o.isPeerRead=!0,this.emitConversationUpdate(!0,!1))}}}},{key:"updateMessageIsModifiedProperty",value:function(e){this._messageListHandler.updateMessageIsModifiedProperty(e)}},{key:"setCompleted",value:function(e){Je.l("".concat(this._n,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="".concat(this._n,".").concat("getConversationList"),o="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(Je.l("".concat(n,". ").concat(o)),this._pagingStatus===vn.REJECTED){var a=new Xo("getConversationList");return a.setMessage(o),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return No({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}var i=this._getConversationList(e);return Je.l("".concat(n,". returned conversation count:").concat(i.length)),Oo({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(mt(e))return this.getLocalConversationList();if(vt(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ft(e)){var t=e.type,n=e.markType,o=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==S.CONV_C2C&&t!==S.CONV_GROUP||e.type===t)&&(!gt(o)||e.conversationGroupList.includes(o))&&(!_t(n)||e.markList.includes(n))}))}return[]}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=D(this._conversationMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],a=n[1];a.type===S.CONV_C2C&&(Je.d("".concat(this._n,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(a.peerReadTime)),this.recordPeerReadTime(o,a.peerReadTime))}}catch(i){t.e(i)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){var e=this.getModule(to);return!e||e.isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){var e=this.getModule(to);return e?e.getLocalGroupList().length:0}},{key:"_hasLocalGroup",value:function(e){var t=this.getModule(to);return!!t&&t.hasLocalGroup(e.replace(S.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new Aa({conversationID:e,type:e.slice(0,3)===S.CONV_C2C?S.CONV_C2C:S.CONV_GROUP},this.isIntl(),this.isUsingChatCore()))._isInfoCompleted||t.type===S.CONV_SYSTEM)return Oo({conversation:t});if(xt(e)&&!this._hasLocalGroup(e))return Oo({conversation:t});var o="".concat(this._n,".").concat("getConversationProfile"),a=new Xo("getConversationProfile");return Je.l("".concat(o,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(i){a.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(i.data.conversation.unreadCount)).end();var s=n.getModule(no);if(s&&t.type===S.CONV_C2C){var r=e.replace(S.CONV_C2C,"");if(s.isMyFriend(r)){var c=s.getFriendRemark(r);t.remark!==c&&(t.remark=c,Je.l("".concat(o,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return Je.l("".concat(o," ok. conversationID:").concat(e)),i})).catch((function(t){return n.probeNetwork().then((function(n){var o=v(n,2),i=o[0],s=o[1];a.setError(t,i,s).setMessage("conversationID:".concat(e)).end()})),Je.e("".concat(o," failed. error:"),t),Go(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===S.CONV_C2C?this.getModule($n).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?Go(new ko({code:Ao.USER_OR_GRP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),Oo({conversation:e}))})):this.getModule(to).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),Oo({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Aa&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(m(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(S.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===vn.RESOLVED}},{key:"_errorLog",value:function(e,t,n,o){var a=new Error("Params validate failed."),i="".concat(this.getErrorMessage("API_REFER")).concat(e);throw Je.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrorMessage(n,o),", ").concat(i)),Je.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),a}},{key:"_isValidConversationID",value:function(e){return qt(e)||xt(e)||Vt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return gt(e)||ht(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),gt(e)?(this._isValidConversationID(e)||this._errorLog(n,"options","InvalidConversationID",e),Je.l("".concat(this._n,".").concat(n," conversationID:").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(vt(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach((function(e){t._isValidConversationID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)})),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:"deleteConversationList",value:function(e){var t=this,n=e.conversationIDList,o=void 0===n?[]:n,a=e.clearHistoryMessage,i=void 0===a||a,s=e.flag,r=void 0===s?0:s,c="".concat(this._n,".").concat("deleteConversationList");Je.l("".concat(c," conversationIDList.length:").concat(o.length," clearHistoryMessage:").concat(i));var u=new Xo("deleteConversationList");return u.setMessage("conversationIDList:".concat(o)),Promise.all([this.rmLocalOnlyConversationList(o),this.rmLocalAndRemoteConversationList(o,i)]).then((function(e){u.setNetworkType(t.getNetworkType()).end();var n=[].concat(m(e[0]),m(e[1]));return 0===n.length?Go(new ko({code:Ao.CONV_NOT_FOUND})):(Je.l("".concat(c," ok")),Oo(1===r?{conversationID:n[0]}:{conversationIDList:n}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(c," failed. error:"),e),Go(e)}))}},{key:"rmLocalOnlyConversationList",value:function(e){var t=this;return e.filter((function(e){if(!t._conversationMap.has(e))return!1;var n=t.getLocalConversation(e).type;return n!==S.CONV_GROUP||t._hasLocalGroup(e)?n===S.CONV_SYSTEM&&(t.getModule(to).deleteGroupSystemNotice({messageList:t._messageListHandler.getLocalMessageList(e)}),t.deleteLocalConversation(e),!0):(t.deleteLocalConversation(e),!0)}))}},{key:"rmLocalAndRemoteConversationList",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach((function(e){if(n._conversationMap.has(e)){var t=n.getLocalConversation(e).type;t===S.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,""),type:1}):t===S.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,""),type:2})}})),0===o.conversationList.length?[]:this.request({protocolName:Uo.DELETE_CONVERSATION,requestData:o}).then((function(e){var t=[];return e.data.resultList.length>0&&e.data.resultList.map((function(e){if(0===e.code){var n=1===e.type?"".concat(S.CONV_C2C).concat(e.to):"".concat(S.CONV_GROUP).concat(e.groupID);t.push(n)}})),n.deleteLocalConversationList(t),t}))}},{key:"setConversationDraft",value:function(e){var t=e.conversationID,n=e.draftText,o="".concat(this._n,".").concat("setConversationDraft");if(Je.l("".concat(o," conversationID:").concat(t," draftText:").concat(n)),!this._conversationMap.has(t))return Go({code:Ao.CONV_NOT_FOUND});var a=this._conversationMap.get(t);return a.setDraftText(n),Oo({code:0,conversation:a})}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return Go({code:Ao.CONV_NOT_FOUND});var o=this._conversationMap.get(e).type;if(o===S.CONV_C2C)n.type=1,n.toAccount=e.replace(S.CONV_C2C,"");else{if(o!==S.CONV_GROUP)return o===S.CONV_SYSTEM?(this.getModule(to).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),Oo({conversationID:e})):Go({code:Ao.CONV_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(S.CONV_GROUP,"")}var a="".concat(this._n,".").concat("clearHistoryMessage"),i=new Xo("clearHistoryMessage");return i.setMessage("conversationID:".concat(e)),Je.l("".concat(a,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:Uo.CLEAR_HISTORY_MESSAGE,requestData:n})})).then((function(){i.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(a," ok")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConversationListAndEmitEvent()),Oo({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.e("".concat(a," failed. error:"),e),Go(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return Go({code:Ao.CONV_NOT_FOUND});var a=this.getLocalConversation(n);if(a.isPinned===o)return Oo({conversationID:n});var i="".concat(this._n,".").concat("pinConversation"),s=new Xo("pinConversation");s.setMessage("conversationID:".concat(n," isPinned:").concat(o)),Je.l("".concat(i,". conversationID:").concat(n," isPinned:").concat(o));var r=null;return qt(n)?r={type:1,toAccount:n.replace(S.CONV_C2C,"")}:xt(n)&&(r={type:2,groupID:n.replace(S.CONV_GROUP,"")}),this.request({protocolName:Uo.PIN_CONVERSATION,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[r]}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(i," ok")),a.isPinned!==o&&(a.isPinned=o,t._sortConversationListAndEmitEvent()),No({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(i," failed. error:"),e),Go(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,a=!1,i=this.getLocalConversation(n?"".concat(S.CONV_C2C).concat(t):"".concat(S.CONV_GROUP).concat(t));return i&&i.messageRemindType!==o&&(i.messageRemindType=o,a=!0),Je.d("".concat(this._n,".patchMessageRemindType options:"),e,"ret:".concat(a)),a}},{key:"onC2CMessageRemindTypeFetched",value:function(e){var t=this;if(vt(e)&&e.length>0){var n=0;e.forEach((function(e){var o=e.userID,a=e.muteFlag,i=t._transMessageRemindType(a);!0===t.patchMessageRemindType({ID:o,isC2CConversation:!0,messageRemindType:i})&&(n+=1)})),Je.l("".concat(this._n,".onC2CMessageRemindTypeFetched updateCount:").concat(n)),n>=1&&this.emitConversationUpdate(!0,!1)}}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMessageRemindTypeSynced");Je.d(n,e),e.dataList.forEach((function(e){if(!pn(e.muteNotificationsSync)){var o=e.muteNotificationsSync,a=o.to,i=o.muteFlag,s=t._transMessageRemindType(i),r=0;t.patchMessageRemindType({ID:a,isC2CConversation:!0,messageRemindType:s})&&(r+=1),Je.l("".concat(n," updateCount:").concat(r)),r>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){Je.d("".concat(this._n,".onGroupMessageRemindTypeUpdated options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._conversationMap.has(e);if(Je.d("".concat(this._n,".deleteLocalConversation conversationID:").concat(e," has:").concat(n)),n&&(this._conversationMap.delete(e),this._roamingMessageKeyAndTimeMap.has(e)&&this._roamingMessageKeyAndTimeMap.delete(e),this._roamingMessageSequenceMap.has(e)&&this._roamingMessageSequenceMap.delete(e),this._setStorageConversationList(),this._messageListHandler.removeByConversationID(e),this._completedMap.delete(e),t)){var o=!this._isTopicConversation(e);this.emitConversationUpdate(o,!1)}}},{key:"deleteLocalConversationList",value:function(e){var t=this,n=0,o=!1;e.forEach((function(e){t._conversationMap.has(e)&&(n+=t._conversationMap.get(e).unreadCount||0,t.deleteLocalConversation(e,!1),o=!0)})),Je.l("".concat(this._n,".deleteLocalConversationList conversationIDList.length:").concat(e.length," isConvIDExisted:").concat(o)),o&&(this.emitConversationUpdate(!0,!1),n>0&&this.emitTotalUnreadMessageCountUpdate())}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._messageListHandler.hasLocalMessage(e.conversationID,e.ID)&&!this.singlyLinkedList.has(e.random))}},{key:"modifyMessageList",value:function(e){if(e.startsWith(S.CONV_C2C)&&this._conversationMap.has(e)){var t=this._conversationMap.get(e),n=Date.now();this._messageListHandler.modifyMessageSentByPeer({conversationID:e,latestNick:t.userProfile.nick,latestAvatar:t.userProfile.avatar});var o=this.getModule($n).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),Je.l("".concat(this._n,".modifyMessageList conversationID:").concat(e," cost:").concat(un(n)))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){Je.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var a=this._conversationMap.get(t).userProfile;gt(n)&&a.nick!==n&&(a.nick=n),gt(o)&&a.avatar!==o&&(a.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),a=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),Je.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost:").concat(un(a)))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=this.getModule(no);if(0!==this._conversationMap.size&&e){var t=m(this._conversationMap.values()).filter((function(e){return e.type===S.CONV_C2C}));if(0!==t.length){var n=0;t.forEach((function(t){var o=t.conversationID.replace(S.CONV_C2C,"");if(e.isMyFriend(o)){var a=e.getFriendRemark(o);t.remark!==a&&(t.remark=a,n+=1)}})),Je.l("".concat(this._n,".checkAndPatchRemark. c2c conversation count:").concat(t.length,", patched count:").concat(n))}}}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(eo):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(to)),n?n.sendReadReceipt(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===S.CONV_C2C?n=this._m.getModule(eo):t.conversationType===S.CONV_GROUP&&(n=this._m.getModule(to)),n?n.getReadReceiptList(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getLastMessageTime",value:function(e){var t=this.getLocalConversation(e);return t?t.lastMessage.lastTime:0}},{key:"getTotalUnreadMessageCount",value:function(){var e=this.getLocalConversationList(),t=0;return e.forEach((function(e){e.type!==S.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==S.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(Je.l("".concat(this._n,".emitTotalUnreadMessageCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOuterEvent(E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._setStorageConversationList(!0),this._pagingStatus=vn.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this._pagingConvIDMap.clear(),this._convIDFromUnreadDBMap.clear(),this._pagingGetCostList.length=0,this.resetReady()}}]),a}(Po),Ga=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map}return i(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),a=e._groupModule.hasLocalGroup(n);Je.l("".concat(e._n,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(a," checkCount:").concat(o)),a?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){Je.d("".concat(this._n,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(ao).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,a=e.dataList,i=null,s=[],r=[],c={},u=[],l=function(e,l){var d=Pt(a[e]);if(6===o){if(n._groupModule.isGroupAttributesUpdatedNotice(d))return"continue";if(n._groupModule.isGroupCountersNotice(d))return"continue"}var p=d.groupProfile,_=p.groupID,g=p.communityType,h=void 0===g?0:g,f=p.topicID,v=void 0===f?void 0:f,m=p.invisible,M=void 0,I=n._groupModule.isMessageFromTopic(h,v);if(I){M=S.CONV_TOPIC,d.to=v;var y=n._groupModule.getModule(oo);y.hasLocalTopic(_,v)||n._getTopicPendingMap.has(v)||(n._getTopicPendingMap.set(v,1),y.getTopicList({groupID:_,topicIDList:[v]}).finally((function(){n._getTopicPendingMap.delete(v)})))}var T=n._groupModule.hasLocalGroup(_);if(!T&&n._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!T&&!I)return n._cacheGroupTipsAndProbe({groupID:_,event:o,item:d}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(_))return d.event=o,u.push(d),"continue";if(d.currentUser=n._groupModule.getMyUserID(),d.conversationType=S.CONV_GROUP,(i=new pa(d)).setElement({type:S.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),i.isSystemMessage=!1,1===m)return n._qualityStat(i),"continue";var C=n._groupModule.getModule(ao),D=i,E=D.conversationID,N=D.sequence;if(6===o)i._onlineOnlyFlag=!0,r.push(i);else if(!C.pushIntoNoticeResult(r,i))return"continue";if(n._groupModule.isMessageFromCommunityOfTopic(h,v))return"continue";if(6===o&&C.getLocalConversation(E))return"continue";6!==o&&n._qualityStat(i);var k=C.isRemoteRead({conversationID:E,sequence:N});if(mt(c[E])){var A=0;"in"===i.flow&&(i._isExcludedFromUnreadCount||i._onlineOnlyFlag||k||(A=1)),c[E]=s.push({conversationID:E,unreadCount:A,type:mt(M)?i.conversationType:M,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1}else{var L=c[E];s[L].type=i.conversationType,s[L].subType=i.conversationSubType,s[L].lastMessage=i._isExcludedFromLastMessage?"":i,"in"===i.flow&&(i._isExcludedFromUnreadCount||i._onlineOnlyFlag||k||s[L].unreadCount++)}},d=0,p=a.length;d<p;d++)l(d);return{eventDataList:s,result:r,AVChatRoomMessageList:u}}},{key:"_qualityStat",value:function(e){this._groupModule.getModule(mo).addMessageSequence({key:Bo,message:e})}},{key:"handleMessageList",value:function(e){var t=this;e.forEach((function(e){switch(e.payload.operationType){case 1:t._onNewMemberComeIn(e);break;case 2:t._onMemberQuit(e);break;case 3:t._onMemberKickedOut(e);break;case 4:t._onMemberSetAdmin(e);break;case 5:t._onMemberCancelledAdmin(e);break;case 6:t._onGroupProfileModified(e);break;case 7:t._onMemberInfoModified(e);break;case 8:t._onTopicProfileUpdated(e);break;default:Je.w("".concat(t._n,".handleMessageList unknown operationType:").concat(e.payload.operationType))}}))}},{key:"_onNewMemberComeIn",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(o);a&&_t(n)&&a.memberCount!==n&&(a.memberCount=n,this._updateConversationGroupProfile(a))}},{key:"_onMemberQuit",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(o);a&&_t(n)&&a.memberCount!==n&&(a.memberCount=n,this._updateConversationGroupProfile(a)),this._groupModule.getGroupMemberHandler().deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,a=this._groupModule.getLocalGroupProfile(o);a&&_t(n)&&a.memberCount!==n&&(a.memberCount=n,this._updateConversationGroupProfile(a)),this._groupModule.getGroupMemberHandler().deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_updateConversationGroupProfile",value:function(e){this._groupModule.getModule(ao).updateConversationGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getGroupMemberHandler();n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(S.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getGroupMemberHandler();n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(S.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,n=e.payload,o=n.newGroupProfile,a=n.groupProfile.groupID,i=this._groupModule.getLocalGroupProfile(a);Object.keys(o).forEach((function(e){switch(e){case"ownerID":t._ownerChanged(i,o);break;case"groupName":i.name=o[e];break;default:i[e]=o[e]}}));var s=!i.isSupportTopic;this._groupModule.emitGroupListUpdate(!0,s)}},{key:"_ownerChanged",value:function(e,t){var n=e.groupID,o=this._groupModule.getLocalGroupProfile(n),a=this._groupModule.getMyUserID();if(a===t.ownerID){o.updateGroup({selfInfo:{role:S.GRP_MBR_ROLE_OWNER}});var i=this._groupModule.getGroupMemberHandler(),s=i.getLocalGroupMemberInfo(n,a),r=this._groupModule.getLocalGroupProfile(n).ownerID,c=i.getLocalGroupMemberInfo(n,r);s&&s.updateRole(S.GRP_MBR_ROLE_OWNER),c&&c.updateRole(S.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,a=n.memberList,i=o.groupID;Ft(t)&&this._updateTopicMuteTime(e);var s=this._groupModule.getGroupMemberHandler();a.forEach((function(e){var t=s.getLocalGroupMemberInfo(i,e.userID);t&&_t(e.muteTime)&&t.updateMuteUntil(e.muteTime)}))}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,a=n.memberList,i=void 0===a?[]:a,s=this._groupModule.getModule(oo),r=o.groupID,c=s.getLocalTopic(r,t);if(c){for(var u=!1,l=0;l<i.length;l++){var d=i[l];if(d.userID===this._groupModule.getMyUserID()&&d.muteTime>=0){c.updateSelfInfo({muteTime:d.muteTime}),u=!0;break}}u&&this._groupModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:r,topic:c})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,a=n.newTopicInfo;this._groupModule.getModule(oo).onTopicProfileUpdated(t({groupID:o,topicID:e.to},a))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Je.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,a=e.item;this._cacheGroupTips(n,{event:o,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupTips(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupTips(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Je.l("".concat(this._n,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),Pa=function(){function e(t){o(this,e),this._groupModule=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this.PAGING_GRP_COUNT_LIMIT=200,this._getTopicPendingMap=new Map,this._pagingStatus=vn.NOT_START,this._pagingGetCostList=[],t.getInnerEmitterInstance().on(ha.A2KEY_AND_TINYID_UPDATED,this.syncGroupList,this)}return i(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),a=e._groupModule.hasLocalGroup(n);Je.l("".concat(e._n,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(a," checkCount:").concat(o)),a?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"handleUpdateGroupLastMessage",value:function(e){var n="".concat(this._n,".handleUpdateGroupLastMessage");if(0!==this._groupModule.getGroupMap().size){for(var o,a,i,s,r,c=!1,u=0,l=e.length;u<l;u++)(o=e[u]).type===S.CONV_GROUP&&0!==o.lastMessage.lastSequence&&null!==o.lastMessage.payload&&(a=o.conversationID.split(/^GROUP/)[1],(i=this._groupModule.getLocalGroupProfile(a))&&(s=i.lastMessage,r=o.lastMessage,JSON.stringify(s)!==JSON.stringify(r)&&(i.lastMessage=t({},o.lastMessage),c=!0)));Je.l("".concat(n," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length," isGroupListUpdated:").concat(c)),c&&(this._groupModule.sortLocalGroupList(),this._groupModule.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewGroupMessage",value:function(e){Je.d("".concat(this._n,".onNewGroupMessage count:").concat(e.dataList.length));var t=this._newGroupMessageStoredAndSummary(e),n=t.conversationOptionsList,o=t.messageList,a=t.AVChatRoomMessageList;(a.length>0&&this._groupModule.onAVChatRoomMessage(a),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(ao).onNewMessage({conversationOptionsList:n,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var i=this._groupModule.filterUnmodifiedMessage(o);i.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,i),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,a=e.isInstantMessage,i=null,s=[],r=[],c=[],u={},l=this._groupModule.getFileDownloadProxy(),d=n.length;d>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var p=this._groupModule.getModule(ao),_=this._groupModule.getModule($n),g=function(e){var d=Pt(n[e]),g=d.groupProfile,h=g.groupID,f=g.communityType,v=void 0===f?0:f,m=g.topicID,M=void 0===m?void 0:m,I=g.invisible,y=void 0,T=t._groupModule.isMessageFromTopic(v,M);if(T){y=S.CONV_TOPIC,d.to=M;var C=t._groupModule.getModule(oo);C.hasLocalTopic(h,M)||t._getTopicPendingMap.has(M)||(t._getTopicPendingMap.set(M,1),C.getTopicList({groupID:h,topicIDList:[M]}).finally((function(){t._getTopicPendingMap.delete(M)})))}var D=t._groupModule.hasLocalGroup(h);if(!D&&t._groupModule.isUnjoinedAVChatRoom(h))return"continue";if(!D&&!T)return t._cacheGroupMessageAndProbe({groupID:h,event:o,item:d}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(h))return d.event=o,c.push(d),"continue";if(d.currentUser=t._groupModule.getMyUserID(),d.conversationType=S.CONV_GROUP,d.isSystemMessage=!!d.isSystemMessage,(i=new pa(d)).setElement(d.elements,l),1===I)return t._qualityStat(a,i),"continue";var E=1===n[e].isModified;if(p.isMessageSentByCurrentInstance(i)?i.isModified=E:E=!1,1===d.onlineOnlyFlag)i._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(i)||r.push(i);else{if(t._groupModule.isMessageFromCommunityOfTopic(v,M))return r.push(i),"continue";if(i.from===t._groupModule.getMyUserID()){var N=p.getLatestMessageSentByMe(i.conversationID);if(N){var k=N.nick,A=N.avatar;k===i.nick&&A===i.avatar||(p.modifyMessageSentByMe({conversationID:R,latestNick:i.nick,latestAvatar:i.avatar}),_.mockOnNickAvatarModified(i.nick,i.avatar))}}if(!p.pushIntoMessageList(r,i,E))return"continue";t._qualityStat(a,i);var L=i,R=L.conversationID,O=L.sequence,G=p.isRemoteRead({conversationID:R,sequence:O});if(mt(u[R])){var P=0;"in"===i.flow&&(i._isExcludedFromUnreadCount||G||(P=1)),u[R]=s.push({conversationID:R,unreadCount:P,type:mt(y)?i.conversationType:y,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1}else{var U=u[R];s[U].type=mt(y)?i.conversationType:y,s[U].subType=i.conversationSubType,s[U].lastMessage=i._isExcludedFromLastMessage?"":i,"in"===i.flow&&(i._isExcludedFromUnreadCount||G||s[U].unreadCount++)}}},h=0;h<d;h++)g(h);return{conversationOptionsList:s,messageList:r,AVChatRoomMessageList:c}}},{key:"_qualityStat",value:function(e,t){var n=this._groupModule.getModule(mo);n.addMessageSequence({key:Bo,message:t}),e&&t.clientTime>0&&n.addMessageDelay(t.clientTime)}},{key:"onGroupMessageRevoked",value:function(e){var t=this,n=this._groupModule.getModule(ao),o=[];e.dataList.forEach((function(e){var t=e.elements.revokedInfos,a=e.revokerInfo;mt(t)||t.forEach((function(e){var t,i=pn(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID),s=n.getLocalConversation(i),r=e.revokerInfo&&e.revokerInfo.revoker||a&&a.revoker,c=a&&a.reason||"";if(bt(s.type))t={conversationID:i,sequence:e.sequence,ID:"".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)};else{var u=n.revoke(i,e.sequence,e.random);u?t=u:(t={conversationID:i,sequence:e.sequence},e.tinyID&&e.clientTime&&e.random&&(t.ID="".concat(e.tinyID,"-").concat(e.clientTime,"-").concat(e.random)),e.time&&(t.time=e.time))}t&&(t.revoker=r,t.revokeReason=c,t.revokerInfo={userID:r,nick:"",avatar:""},o.push(t))}))})),0!==o.length&&(n.onMessageRevoked(o),n.updateRevokerInfo(o).then((function(e){t._groupModule.emitOuterEvent(E.MESSAGE_REVOKED,e)})))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(m(this._groupModule.getGroupMap())),n=0,o=e.length;n<o;n++)t.delete(e[n].groupID);this._groupModule.hasJoinedAVChatRoom()&&this._groupModule.getJoinedAVChatRoom().forEach((function(e){t.delete(e)}));this._groupModule.getGroupMap().forEach((function(e,n){e.isSupportTopic&&t.delete(n)}));for(var a=m(t.keys()),i=0,s=a.length;i<s;i++)this._groupModule.deleteGroup(a[i])}},{key:"syncGroupList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._pagingStatus===vn.NOT_START&&this._groupModule.clearGroupMap();var n=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime","AtInfoList","LastRecallTime"],o=this.PAGING_GRP_COUNT_LIMIT,a=0,i=[];if(!0===t)return this._pagingGetGroupListWithTopic({limit:o,offset:a,groupBaseInfoFilter:n,groupList:i});var s="syncGroupList",r="".concat(this._n,".").concat(s),c=new Xo(s);return this._pagingGetGroupList({limit:o,offset:a,groupBaseInfoFilter:n,groupList:i}).then((function(){var t=cn(e._pagingGetCostList),n=rn(e._pagingGetCostList);e._pagingGetCostList.length=0,e._pagingStatus=vn.RESOLVED,e._groupListTreeShaking(i),e._groupModule.updateGroupMap(i);var o=e._groupModule.getLocalGroupList().length,a="count:".concat(o," sum:").concat(n," avg:").concat(t);return Je.l("".concat(r," ok. ").concat(a)),c.setNetworkType(e._groupModule.getNetworkType()).setMessage(a).end(),e.tempConversationList&&(e.handleUpdateGroupLastMessage(e.tempConversationList),e.tempConversationList=null),e._groupModule.emitGroupListUpdate(!0,!0),No({groupList:e._groupModule.getLocalGroupList()})})).catch((function(t){return e._pagingStatus=vn.REJECTED,e._groupModule.probeNetwork().then((function(e){var n=v(e,2),o=n[0],a=n[1];c.setError(t,o,a).end()})),Je.e("".concat(r," failed. error:"),t),Go(t)}))}},{key:"getGroupList",value:function(){var e=this,t="".concat(this._n,".").concat("getGroupList");if(Je.l("".concat(t," pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===vn.REJECTED||this._pagingStatus===vn.NOT_START)return this.syncGroupList().then((function(){var t=e._groupModule.getLocalGroupList();return No({groupList:t,isSyncCompleted:e.isPagingGetCompleted()})})).catch((function(e){return Je.e("".concat(t," failed. error:"),e),Go(e)}));var n=this._groupModule.getLocalGroupList();return Je.l("".concat(t,". returned group count:").concat(n.length)),Oo({groupList:n,isSyncCompleted:this.isPagingGetCompleted()})}},{key:"isPagingGetCompleted",value:function(){return this._pagingStatus===vn.RESOLVED}},{key:"_pagingGetGroupList",value:function(e){var t=this,n="".concat(this._n,".").concat("_pagingGetGroupList"),o=e.isCommunityRelay,a=void 0!==o&&o,i=e.limit,s=e.offset,r=e.groupBaseInfoFilter,c=e.groupList,u=Date.now();return this._groupModule.request({protocolName:Uo.GET_GROUP_LIST,requestData:{type:a?S.GRP_COMMUNITY:void 0,memberAccount:this._groupModule.getMyUserID(),limit:i,offset:s,responseFilter:{groupBaseInfoFilter:r,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then((function(e){var o=e.data,l=o.groups,d=void 0===l?[]:l,p=o.totalCount;c.push.apply(c,m(d)),t._handleGroupAtInfoWithoutTopic(a,d);var _=s+i,g=!(p>_),h="offset:".concat(s," limit:").concat(i," totalCount:").concat(p," isCompleted:").concat(g," ")+"currentCount:".concat(c.length," isCommunityRelay:").concat(a);return t._pagingGetCostList.push(un(u,!1)),Je.l("".concat(n," ok. ").concat(h," cost:").concat(un(u))),a||g?!a&&g?(Je.l("".concat(n," start to get community list")),s=0,t._pagingGetGroupList({limit:i,offset:s,groupBaseInfoFilter:r,groupList:c,isCommunityRelay:!0})):a&&!g?(s=_,t._pagingGetGroupList({limit:i,offset:s,groupBaseInfoFilter:r,groupList:c,isCommunityRelay:!0})):No({groupList:c}):(s=_,t._pagingGetGroupList({limit:i,offset:s,groupBaseInfoFilter:r,groupList:c}))})).catch((function(e){return 10018===e.code?(Je.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(i)),i=50,t._pagingGetGroupList({limit:i,offset:s,groupBaseInfoFilter:r,groupList:c,isCommunityRelay:a})):a?(11e3===e.code&&Je.l("".concat(n," ok. community unavailable")),Oo({groupList:c})):Go(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),o=e.limit,a=e.offset,i=e.groupBaseInfoFilter,s=e.groupList,r=Date.now();return this._groupModule.request({protocolName:Uo.GET_GROUP_LIST,requestData:{type:S.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:a,responseFilter:{groupBaseInfoFilter:i,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var c=e.data,u=c.groups,l=void 0===u?[]:u,d=c.totalCount;s.push.apply(s,m(l));var p=a+o,_=!(d>p);if(Je.l("".concat(n," ok. offset:").concat(a," limit:").concat(o," totalCount:").concat(d," isCompleted:").concat(_," currentCount:").concat(s.length," cost:").concat(un(r))),!_)return a=p,t._pagingGetGroupListWithTopic({limit:o,offset:a,groupBaseInfoFilter:i,groupList:s});t._groupModule.updateGroupMap(s),t._groupModule.emitGroupListUpdate(!0,!1);var g=t._groupModule.getLocalGroupList().filter((function(e){return!0===e.isSupportTopic}));return No({groupList:g})})).catch((function(e){return 10018===e.code?(Je.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(o)),o=50,t._pagingGetGroupListWithTopic({limit:o,offset:a,groupBaseInfoFilter:i,groupList:s})):Go(e)}))}},{key:"_cacheGroupMessage",value:function(e,t){this._cachedGroupMessageMap.has(e)||this._cachedGroupMessageMap.set(e,[]),this._cachedGroupMessageMap.get(e).push(t)}},{key:"_deleteCachedGroupMessage",value:function(e){this._cachedGroupMessageMap.has(e)&&this._cachedGroupMessageMap.delete(e)}},{key:"_notifyCachedGroupMessage",value:function(e){var t=this,n=this._cachedGroupMessageMap.get(e)||[];n.forEach((function(e){t.onNewGroupMessage(e)})),this._deleteCachedGroupMessage(e),Je.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,a=e.item;this._cacheGroupMessage(n,{event:o,dataList:[a]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===S.GRP_AVCHATROOM?t._groupModule.hasLocalGroup(n)?t._notifyCachedGroupMessage(n):t._groupModule.setUnjoinedAVChatRoom(n):(t._groupModule.updateGroupMap([e]),t._notifyCachedGroupMessage(n))})),this._checkCountMap.has(n)||this._checkCountMap.set(n,0),Je.l("".concat(this._n,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,a=e.groupAtInfoList,i=[];mt(a)||(a.forEach((function(e){i.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(ao).onNewGroupAtTips({dataList:i}))}))}},{key:"setPagingGroupCount",value:function(e){mt(e)||(this.PAGING_GRP_COUNT_LIMIT=parseInt(e,10))}},{key:"reset",value:function(){this.PAGING_GRP_COUNT_LIMIT=200,this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._pagingStatus=vn.NOT_START,this._pagingGetCostList=[]}}]),e}(),Ua=1,ba=2,wa=3,Fa=4,qa=5,xa=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}return i(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");mt(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,n=e.elements.newGroupProfile,o=!mt(n)&&!pn(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,a=o.mainSequence,i=o.isWithChangedAttributeInfo,s=o.groupAttributeList,r=void 0===s?[]:s,c=o.operationType;if(Je.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(n," isWithChangedAttributeInfo:").concat(i," operationType:").concat(c)),!mt(c)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var u=a-this._getLocalGroupAttributes(n).localMainSequence;if(0!==u){if(1===i&&1===u)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:a,groupAttributeList:r,operationType:c}),void this._emitGroupAttributesUpdated(n);if(this._hasLocalGroupAttributes(n)){var l=this._getLocalGroupAttributes(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey,o=void 0===n?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),Je.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,a=this._getLocalGroupAttributes(n),i=a.remoteMainSequence,s=a.avChatRoomKey,r=new Xo("initGroupAttributes");return r.setMessage("groupID:".concat(n," avChatRoomKey:").concat(s," mainSequence:").concat(i)),this._groupModule.request({protocolName:Uo.SET_GROUP_ATTRIBUTES,requestData:{groupID:n,avChatRoomKey:s,mainSequence:i,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){Je.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n));var a=e.data,i=a.mainSequence,s=m(a.groupAttributeList);return s.forEach((function(e){e.value=o[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:i,groupAttributeList:s,operationType:Ua}),t._emitGroupAttributesUpdated(n),r.setNetworkType(t._groupModule.getNetworkType()).end(),No({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Go(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),o=e.groupID,a=e.groupAttributes,i=this._getLocalGroupAttributes(o),s=i.remoteMainSequence,r=i.avChatRoomKey,c=i.attributes,u=this._transformGroupAttributes(a);u.forEach((function(e){var t=e.key;e.sequence=0,c.has(t)&&(e.sequence=c.get(t).sequence)}));var l=new Xo("setGroupAttributes");return l.setMessage("groupID:".concat(o," groupAttributes:").concat(JSON.stringify(a))),Je.l("".concat(n,". groupID:").concat(o," mainSequence:").concat(s)),this._groupModule.request({protocolName:Uo.MODIFY_GROUP_ATTRIBUTES,requestData:{groupID:o,avChatRoomKey:r,mainSequence:s,groupAttributeList:u}}).then((function(e){Je.l("".concat(n," ok."));var i=e.data,s=i.mainSequence,r=m(i.groupAttributeList);return r.forEach((function(e){e.value=a[e.key]})),t._groupAttributesCopy=t._getCachedAttributes({groupID:o}),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:r,operationType:ba}),t._emitGroupAttributesUpdated(o),l.setNetworkType(t._groupModule.getNetworkType()).end(),No({groupAttributes:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),Go(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,a=void 0===o?[]:o,i=this._getLocalGroupAttributes(n),s=i.remoteMainSequence,r=i.avChatRoomKey,c=i.attributes,u=m(c.keys()),l=Uo.CLEAR_GROUP_ATTRIBUTES,d=wa,p={groupID:n,avChatRoomKey:r,mainSequence:s},_=[];a.length>0&&(u=[],l=Uo.DELETE_GROUP_ATTRIBUTES,d=Fa,a.forEach((function(e){var t=0;c.has(e)&&(t=c.get(e).sequence,u.push(e)),_.push({key:e,sequence:t})})),p.groupAttributeList=_);var g=new Xo("deleteGroupAttributes");return g.setMessage("groupID:".concat(n," mainSequence:").concat(s," keyList:").concat(a," protocolName:").concat(l)),this._groupModule.request({protocolName:l,requestData:p}).then((function(e){Je.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n));var o=e.data.mainSequence;return t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:_,operationType:d}),t._emitGroupAttributesUpdated(n),g.setNetworkType(t._groupModule.getNetworkType()).end(),No({keyList:u})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];g.setError(e,o,a).end()})),Go(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),o=e.groupID,a=this._getLocalGroupAttributes(o),i=a.avChatRoomKey,s=a.lastUpdateTime,r=a.localMainSequence,c=a.remoteMainSequence,u=new Xo("getGroupAttributes");if(u.setMessage("groupID:".concat(o," localMainSequence:").concat(r," remoteMainSequence:").concat(c," keyList:").concat(e.keyList)),Date.now()-s>=this.CACHE_EXPIRE_TIME||r<c)return this._getGroupAttributes({groupID:o,avChatRoomKey:i}).then((function(a){u.setMoreMessage("get attributes from remote. count:".concat(a.length)).setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(n," from remote. groupID:").concat(o));var i=t._getCachedAttributes(e);return No({groupAttributes:i})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Go(e)}));u.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(),Je.l("".concat(n," from cache. groupID:").concat(o));var l=this._getCachedAttributes(e);return Oo({groupAttributes:l})}},{key:"_getGroupAttributes",value:function(e){var n=this,o=0;return mt(e.avChatRoomKey)||(o=1),this._groupModule.request({protocolName:Uo.GET_GROUP_ATTRIBUTES,requestData:t(t({},e),{},{groupType:o})}).then((function(t){Je.l("".concat(n._n,"._getGroupAttributes ok. groupID:").concat(e.groupID));var o=t.data,a=o.mainSequence,i=o.groupAttributeList,s=m(i);return mt(a)||n._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:a,groupAttributeList:s,operationType:qa}),i})).catch((function(e){return Go(e)}))}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,o=e.groupAttributeList,a=e.operationType;if(this._hasLocalGroupAttributes(t)){var i=this._getLocalGroupAttributes(t),s=i.localMainSequence;if(a===qa||n-s==1)i.remoteMainSequence=n,i.localMainSequence=n,i.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:i,groupAttributeList:o,operationType:a});else{if(s===n)return;i.remoteMainSequence=n}this._groupAttributesMap.set(t,i);var r="operationType:".concat(a," localMainSequence:").concat(s," remoteMainSequence:").concat(n);Je.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(r))}}},{key:"_getCachedAttributes",value:function(e){var t=e.groupID,n=e.keyList,o=void 0===n?[]:n,a={};if(this._hasLocalGroupAttributes(t)){var i=this._getLocalGroupAttributes(t).attributes;if(o.length>0)o.forEach((function(e){i.has(e)&&(a[e]=i.get(e).value)}));else{var s,r=D(i.keys());try{for(r.s();!(s=r.n()).done;){var c=s.value;a[c]=i.get(c).value}}catch(u){r.e(u)}finally{r.f()}}}return a}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;o!==wa?o!==Fa?(o===Ua&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,a=e.sequence;t.attributes.set(n,{value:o,sequence:a})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,a=n.deletedKeyList;Je.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(o.length,", delete:").concat(a.length)),0===o.length&&0===a.length||this._groupModule.emitOuterEvent(E.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:a})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach((function(o){e[o]!==t._groupAttributesCopy[o]&&n.push(o)})),Object.keys(this._groupAttributesCopy).forEach((function(t){mt(e[t])&&o.push(t)})),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:o}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),e}(),Va="Set",Ha="Increase",Ba="Decrease",Ka=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._groupModule.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}return i(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_counter_expire_time");mt(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,n=e.elements.groupCounterInfo,o=!1;return pn(n)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:n}),o=!0),o}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var o=e.type,a=e.groupCounterSeq,i=e.counterList,s=void 0===i?[]:i;0!==o&&2!==o||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:a,counterList:s}),s.forEach((function(e){t._groupModule.emitOuterEvent(E.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===o&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:a,counterList:s})})),Je.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(n))}},{key:"initGroupCountersCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:n}),Je.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"setGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(K.GRP_COUNTER))return this._groupModule.cannotUseCommercialAbility("setGroupCounters");var n="".concat(this._n,".").concat("setGroupCounters"),o=e.groupID,a=e.counters,i=this._convertObjectToList(a),s=this._getLocalGroupCounters(o).avChatRoomKey,r="groupID:".concat(o," count:").concat(i.length),c=new Xo("setGroupCounters");return c.setMessage("".concat(r)),Je.l("".concat(n,". ").concat(r)),this._updateGroupCounters({groupID:o,counterList:i,avChatRoomKey:s,mode:Va}).then((function(e){return c.end(),Je.l("".concat(n," ok.")),No({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"increaseGroupCounter",value:function(e){var t=this,n="increaseGroupCounter";if(!this._groupModule.canIUse(K.GRP_COUNTER))return this._groupModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=e.groupID,i=e.key,s=e.value,r=this._getLocalGroupCounters(a).avChatRoomKey,c="groupID:".concat(a," key:").concat(i," value:").concat(s),u=new Xo(n);u.setMessage("".concat(c)),Je.l("".concat(o,". ").concat(c));var l=[{key:i,value:s}];return this._updateGroupCounters({groupID:a,counterList:l,avChatRoomKey:r,mode:Ha}).then((function(e){return u.end(),Je.l("".concat(o," ok.")),No({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"decreaseGroupCounter",value:function(e){var t=this,n="decreaseGroupCounter";if(!this._groupModule.canIUse(K.GRP_COUNTER))return this._groupModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=e.groupID,i=e.key,s=e.value,r=this._getLocalGroupCounters(a).avChatRoomKey,c="groupID:".concat(a," key:").concat(i," value:").concat(s),u=new Xo(n);u.setMessage("".concat(c)),Je.l("".concat(o,". ").concat(c));var l=[{key:i,value:s}];return this._updateGroupCounters({groupID:a,counterList:l,avChatRoomKey:r,mode:Ba}).then((function(e){return u.end(),Je.l("".concat(o," ok.")),No({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(K.GRP_COUNTER))return this._groupModule.cannotUseCommercialAbility("getGroupCounters");var n="".concat(this._n,".").concat("getGroupCounters"),o=e.groupID,a=e.keyList,i=void 0===a?[]:a,s=this._getLocalGroupCounters(o),r=s.avChatRoomKey,c=s.lastUpdateTime,u=new Xo("getGroupCounters");if(u.setMessage("groupID:".concat(o)),Date.now()-c>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:r}).then((function(e){u.setMoreMessage("from remote. count:".concat(e.length)).end(),Je.l("".concat(n," from remote. groupID:").concat(o));var a=t._getLocalCounters(o,i);return No({counters:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Go(e)}));u.setMoreMessage("from cache").end(),Je.l("".concat(n," from cache. groupID:").concat(o));var l=this._getLocalCounters(o,i);return Oo({counters:l})}},{key:"_getRemoteGroupCounters",value:function(e){var n=this;return this._groupModule.request({protocolName:Uo.GET_GROUP_COUNTER,requestData:t({},e)}).then((function(t){var o=t.data,a=o.counterList,i=void 0===a?[]:a,s=o.groupCounterSeq;return n._updateLocalGroupCounters({groupID:e.groupID,counterList:i,groupCounterSeq:s}),Je.l("".concat(n._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),i})).catch((function(e){return Go(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var n="".concat(this._n,"._updateGroupCounters"),o=e.groupID,a=e.avChatRoomKey,i=e.mode;return Je.l("".concat(n,". groupID:").concat(o," avChatRoomKey:").concat(a," mode:").concat(i)),this._groupModule.request({protocolName:Uo.UPDATE_GROUP_COUNTER,requestData:t({},e)}).then((function(e){Je.l("".concat(n," ok."));var t=e.data.counterList,o={};return(void 0===t?[]:t).forEach((function(e){var t=e.key,n=e.value;o[t]=n})),o})).catch((function(e){return Go(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,a=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var i=this._getLocalGroupCounters(t),s=i.counters,r=i.avChatRoomKey,c=i.groupCounterSeq;if(a>0&&a<c)return;o.forEach((function(e){var t=e.key,n=e.value;s.set(t,n)})),this._groupCountersMap.set(t,{lastUpdateTime:Date.now(),groupCounterSeq:a,counters:s,avChatRoomKey:r})}}},{key:"_deleteLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,a=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var i=this._getLocalGroupCounters(t),s=i.counters,r=i.avChatRoomKey;o.forEach((function(e){s.delete(e.key)})),this._groupCountersMap.set(t,{lastUpdateTime:Date.now(),groupCounterSeq:a,counters:s,avChatRoomKey:r})}}},{key:"_getLocalCounters",value:function(e,t){var n={};if(!this._hasLocalGroupCounters(e))return n;var o=this._getLocalGroupCounters(e).counters;if(t.length>0)t.forEach((function(e){o.has(e)&&(n[e]=o.get(e))}));else{var a,i=D(o.keys());try{for(i.s();!(a=i.n()).done;){var s=a.value;n[s]=o.get(s)}}catch(r){i.e(r)}finally{i.f()}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Ya=function(){function e(t){o(this,e);var n=t.manager,a=t.groupID,i=t.onInit,s=t.onSuccess,r=t.onFail;this._n="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=i,this._onSuccess=s,this._onFail=r,this._groupID=a,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Uo.AVCHATROOM_POLLING}return i(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Uo.AVCHATROOM_NOAUTH_POLLING),Je.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval()," isLoggedIn:").concat(e)),this._isRunning=!0,this._request()}},{key:"isRunning",value:function(){return this._isRunning}},{key:"_request",value:function(){var e=this,t=this._onInit(this._groupID);this._groupModule.request({protocolName:this._protocolName,requestData:t}).then((function(t){e._onSuccess(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval()))})).catch((function(t){e._onFail(e._groupID,t),e.isRunning()&&(clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))}))}},{key:"stop",value:function(){Je.l("".concat(this._n,".stop")),this._timeoutID>0&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),e}(),Wa={3:!0,4:!0,5:!0,6:!0,17:!0,20:!0,21:!0},ja=function(){function e(t){o(this,e),this._groupModule=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this.sequencesLinkedList=new Ea(200),this.messageIDLinkedList=new Ea(100),this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return i(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?m(this._joinedGroupMap.keys()):[]}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===m(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):t(t({},n),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,a=n.nextSeq,i=n.rspMsgList,s=n.errorCode,r=n.nextBroadcastSeq,c=n.broadcastMessageList;if(0!==s){var u=this._pollingRequestInfoMap.get(e),l=new Xo("longPollingAVError"),d=u?"".concat(u.key,"-").concat(u.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;gt(o)&&_t(a)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:a}),_t(r)&&r>this._startBroadcastSeq&&(this._startBroadcastSeq=r),vt(i)&&i.length>0?(i.forEach((function(e){e.to=e.groupID})),this.onMessage(i,e)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(c)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e,t){if(vt(e)&&0!==e.length){var n="".concat(this._n,".onMessage");t&&(n+=" groupID:".concat(t)),0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var o=null,a=[],i=this._getModule(ao),s=this._getModule(mo),r=e.length;r>1&&e.sort((function(e,t){return e.sequence-t.sequence}));var c=this._getModule(io).isUnlimitedAVChatRoom(),u=!1;if(Je.getLevel()<=0){var l=e.map((function(e){return e.sequence}));Je.l("".concat(n," count:").concat(l.length," sequenceList:").concat(l)),l.length=0}for(var d=0;d<r;d++){var p=this.restoreMessageFromSimplified(e[d]);if(Wa[p.event]){if(6===p.event){if(this._groupModule.isGroupAttributesUpdatedNotice(p))continue;if(this._groupModule.isGroupCountersNotice(p))continue}if(20!==p.event)if(21!==p.event){o=this.packMessage(p,p.event);var _=1===p.isModified;if(u=1===p.isHistoryMessage,!c){if(this.sequencesLinkedList.has(o.sequence))continue;this.sequencesLinkedList.set(o.sequence)}var g=this.messageIDLinkedList.has(o.ID);if(g)Je.w("".concat(n," ID:").concat(o.ID," has:").concat(g));else{this.messageIDLinkedList.set(o.ID);var h=!1;if(this._isMessageSentByCurrentInstance(o)?_&&(h=!0,o.isModified=_,i.updateMessageIsModifiedProperty(o)):h=!0,h){if(o.conversationType===S.CONV_SYSTEM&&5===o.payload.operationType&&this._onGroupDismissed(o.payload.groupProfile.groupID),!u&&o.conversationType!==S.CONV_SYSTEM){var f=o.conversationID.replace(S.CONV_GROUP,"");this._pollingInstanceMap.has(f)?this._groupModule.isLoggedIn()&&s.addMessageSequence({key:Yo,message:o}):(o.type!==S.MSG_GRP_TIP&&o.clientTime>0&&s.addMessageDelay(o.clientTime),s.addMessageSequence({key:Ko,message:o}))}a.push(o)}}}else{this._getModule(So).onMessageReactionNotify({event:21,dataList:p.elements.messageReactionNotifyList})}else this.handleMessageRevokedNotice(p)}else Je.w("".concat(n,". unknown event:").concat(p.event))}if(0!==a.length){if(this._groupModule.filterModifiedMessage(a),!u){var v=this.packConversationOption(a);v.length>0&&i.onNewMessage({conversationOptionsList:v,isInstantMessage:!0})}this._checkMessageStacked(a);var m=this._groupModule.filterUnmodifiedMessage(a);m.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,m),a.length=0}}}},{key:"handleMessageRevokedNotice",value:function(e){var t=this,n=e.groupID,o=e.elements.revokeMsgList,a=e.revokerInfo,i=[];(o.forEach((function(e){var t=e.tinyID,o=e.clientTime,s=e.random,r=e.sequence,c={conversationID:"".concat(S.CONV_GROUP).concat(n),ID:"".concat(t,"-").concat(o,"-").concat(s),revoker:a.revoker,revokeReason:a.reason||"",revokerInfo:{userID:a.revoker,nick:"",avatar:""},sequence:r};i.push(c)})),0!==i.length)&&this._getModule(ao).updateRevokerInfo(i).then((function(e){t._groupModule.emitOuterEvent(E.MESSAGE_REVOKED,e)}))}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.operatorInfo,n=void 0===t?{}:t,o=e.operatorID,a=e.userIDList,i=void 0===a?[]:a,s=e.operationType;_t(e.groupJoinType)||1!==s&&2!==s||(e.groupJoinType=2===s?0:1);var r=n.userID,c=void 0===r?o:r,u=n.avatar,l=void 0===u?"":u,d=n.nick,p=void 0===d?"":d;e.operatorInfo={userID:c,avatar:l,nick:p};var _=i.map((function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||_,e}},{key:"restoreMessageFromSimplified",value:function(e){var n=e.event;if(this.isBroadcastOrNormal(n)&&(e.cloudCustomData=e.cloudCustomData||"",e.elements=e.elements.map((function(e){if(e.type===S.MSG_CUSTOM){var n=e.content,o=void 0===n?{}:n;e.content=t({data:"",description:"",extension:""},o)}return e}))),(this.isGroupTip(n)||this.isGroupSystemNotice(n))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(n)){e.elements=this.restoreGroupTipElements(e.elements);var o=e.elements,a=void 0===o?{}:o,i=a.operationType,r=a.operatorInfo;if(1===i){var c=[{userID:(void 0===r?{}:r).userID}];a.memberInfoList=a.memberInfoList||c}}if(this.isGroupSystemNotice(n)){var u=e.elements,l=u.memberInfoList,d=u.operatorInfo;l||(l=void 0===d?{}:d),e.elements.memberInfoList=t({userID:e.elements.operatorID,avatar:"",nick:""},l),e.elements=t({authentication:"",remarkInfo:"",messageKey:1e3*e.time},e.elements);var p=Object.keys(e.elements).filter((function(e){return"operatorInfo"!==e})).reduce((function(n,o){return t(t({},n),{},s({},o,e.elements[o]))}),{});e.elements=p}return e}},{key:"_onGroupDismissed",value:function(e){Je.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._groupModule.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(e){var t="MessageStacked",n=e.length;n>=100&&(this._groupModule.outputWarning(t,n),this._reportMessageStackedCount<5&&(new Xo(t).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(n," groupID:").concat(m(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(ao).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?S.CONV_SYSTEM:S.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new pa(e),o=this.packElements(e,t);return n.setElement(o,this._groupModule.getFileDownloadProxy()),n}},{key:"packElements",value:function(e,n){return 4===n||6===n?(this._updateMemberCountByGroupTips(e),{type:S.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:S.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:e.elements}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var o=e[n],a=o.conversationID;if(t.has(a)){var i=t.get(a);i.lastMessage=o,"in"===o.flow&&i.unreadCount++}else t.set(a,{conversationID:o.conversationID,unreadCount:"out"===o.flow?0:1,type:o.conversationType,subType:o.conversationSubType,lastMessage:o})}return m(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t=e.groupProfile.groupID,n=e.elements.onlineMemberInfo,o=void 0===n?void 0:n;if(!pn(o)){var a=o.onlineMemberNum,i=void 0===a?0:a,s=o.expireTime,r=void 0===s?this.DEFAULT_EXPIRE_TIME:s,c=this._onlineMemberCountMap.get(t)||{},u=Date.now();pn(c)?Object.assign(c,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:u,memberCount:i,expireTime:r}):(c.latestUpdateTime=u,c.memberCount=i),this._onlineMemberCountMap.set(t,c)}}},{key:"_onBroadcastMessage",value:function(e){if(!pn(e)){for(var t=[],n=e.length,o=null,a=0;a<n;a++){var i=this.restoreMessageFromSimplified(e[a]);Wa[i.event]?((o=this.packMessage(i,i.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(o.ID)||(t.push(o),this._broadcastMessageIDMap.set(o.ID,1))):Je.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(i.event))}t.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){if(this._pollingInstanceMap.has(e)){var t=this._pollingInstanceMap.get(e);t.isRunning()||t.start()}else{var n=new Ya({manager:this,groupID:e,onInit:this._updateRequestData.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)});n.start(),this._pollingInstanceMap.set(e,n),Je.l("".concat(this._n,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,a=o.groupID;return t._joinedGroupMap.set(a,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(a),t._groupModule.emitGroupListUpdate(!0,!1),mt(n)?Oo({status:st,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,a=e.startSeq,i=void 0===a?0:a,s=o.groupID;return t._pollingRequestInfoMap.set(s,{key:n,startSeq:i}),t.start(s),t._groupModule.isLoggedIn()?Oo({status:st,group:o}):Oo({status:st})}))}},{key:"_preCheck",value:function(){if(this._getModule(io).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=v(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===S.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._n,".").concat("joinWithoutAuth"),a=new Xo("joinWithoutAuth");return this._groupModule.request({protocolName:Uo.APPLY_JOIN_GROUP_NOAUTH,requestData:e}).then((function(e){var i=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=v(e,2);t[0];var o=t[1];a.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(i)).end(!0)})),mt(i))return Go({code:Ao.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});Je.l("".concat(o," ok. groupID:").concat(n)),t._getModule(ao).setCompleted("".concat(S.CONV_GROUP).concat(n));var s=new Na({groupID:n});return t.startRunLoop({group:s,longPollingKey:i}),No({status:st})})).catch((function(e){return Je.e("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=v(t,2),i=o[0],s=o[1];a.setError(e,i,s).setMessage("groupID:".concat(n)).end(!0)})),Go(e)})).finally((function(){t._groupModule.getModule(ro).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return pn(t)||n-t.lastSyncTime>1e3*t.expireTime&&n-t.latestUpdateTime>1e4&&n-t.lastReqTime>3e3?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then((function(e){return No({memberCount:e.memberCount})})).catch((function(e){return Go(e)}))):Oo({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount");return this._groupModule.requestOnlineCount(e).then((function(o){var a=t._onlineMemberCountMap.get(e)||{},i=o.data,s=i.memberCount,r=void 0===s?0:s,c=i.expireTime,u=void 0===c?t.DEFAULT_EXPIRE_TIME:c;Je.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(r," expireTime:").concat(u));var l=Date.now();return pn(a)&&(a.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(a,{lastSyncTime:l,latestUpdateTime:l,memberCount:r,expireTime:u})),{memberCount:r}})).catch((function(o){return Je.w("".concat(n," failed. error:"),o),new Xo("_getGroupOnlineMemberCount").setCode(o.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(o))).setNetworkType(t._groupModule.getNetworkType()).end(),Promise.reject(o)}))}},{key:"_getModule",value:function(e){return this._groupModule.getModule(e)}},{key:"setPollingInterval",value:function(e){mt(e)||(_t(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){mt(e)||(_t(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){mt(e)||(_t(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){mt(e)||"0"!==e&&"1"!==e||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(){return this._pollingInterval}},{key:"onAVChatRoomMemberBanned",value:function(e){var t=e.payload.groupProfile.groupID;Je.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"restartPolling",value:function(){Je.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=D(this._pollingInstanceMap.values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.stop(),n.start()}}catch(o){t.e(o)}finally{t.f()}}},{key:"getPollingTimerID",value:function(e){if(!this._pollingInstanceMap.has(e))return-1;var t=this._pollingInstanceMap.get(e).getPollingTimerID();return Je.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t}},{key:"reset",value:function(e){if(e){Je.l("".concat(this._n,".reset groupID:").concat(e));var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._onlineMemberCountMap.delete(e)}else{Je.l("".concat(this._n,".reset all"));var n,o=D(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(a){o.e(a)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),Ja=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline="Online"===t.onlineStatus,this._initMember(t)}return i(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&Ut(this.memberCustomField,e.memberCustomField),Et(this,e,["memberCustomField","marks","onlineStatus"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){mt(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){mt(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&Ut(this.memberCustomField,e)}}]),e}(),za=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupMemberHandler",this.groupMemberListMap=new Map,this.DEFAULT_MEMBER_INFO_FILTER=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],this._groupModule.getInnerEmitterInstance().on(ha.PROFILE_UPDATED,this._onProfileUpdated,this)}return i(e,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},a=0;a<n.length;a++)o(a)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t,n=this,o=e.groupID,a=e.role,i=void 0===a?void 0:a,s=e.offset,r=void 0===s?0:s,c=e.count,u=void 0===c?15:c,l=e.filter,d=void 0===l?void 0:l,p="".concat(this._n,".").concat("getGroupMemberList"),_=this._groupModule.hasLocalGroup(o);if(Je.l("".concat(p," groupID:").concat(o," role:").concat(i," offset:").concat(r," count:").concat(u," hasLocalGroup:").concat(_)),!_)return Oo({memberList:[],offset:0});if(this._groupModule.getLocalGroupProfile(o).type===S.GRP_AVCHATROOM){if(this._groupModule.canIUse(K.AVCHATROOM_MBR_LIST))return this._getAVChatRoomMemberList({groupID:o,offset:r,filter:d});this._groupModule.outputWarning("LiveOnlineMember")}i!==S.GRP_MBR_ROLE_ADMIN&&i!==S.GRP_MBR_ROLE_OWNER&&i!==S.GRP_MBR_ROLE_MEMBER||(t=i);var g=new Xo("getGroupMemberList"),h=0,f={groupID:o,limit:u>100?100:u,memberRoleFilter:t?[t]:void 0,memberInfoFilter:this.DEFAULT_MEMBER_INFO_FILTER};wt({groupID:o})?f.next="".concat(r):(f.offset=r,h=r+u);var m=[];return this._groupModule.request({protocolName:Uo.GET_GROUP_MEMBER_LIST,requestData:f}).then((function(e){var t=e.data,a=t.members,i=t.memberNum,s=t.next,r=void 0===s?void 0:s;return mt(r)||(h=pn(r)?0:r),vt(a)&&0!==a.length?(n._groupModule.hasLocalGroup(o)&&(n._groupModule.getLocalGroupProfile(o).memberNum=i),m=n._updateLocalGroupMemberMap(o,a),n._groupModule.getModule($n).getUserProfile({userIDList:a.map((function(e){return e.userID})),tagList:[Xe.NICK,Xe.AVATAR]})):(h=0,Promise.resolve([]))})).then((function(e){var t=e.data;if(!vt(t)||0===t.length)return Oo({memberList:[],offset:h});var a=t.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return n._updateLocalGroupMemberMap(o,a),m.length<u&&(h=0),g.setNetworkType(n._groupModule.getNetworkType()).setMessage("groupID:".concat(o," offset:").concat(r," count:").concat(u)).end(),Je.l("".concat(p," ok.")),No({memberList:m,offset:h})})).catch((function(e){return n._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];g.setError(e,o,a).end()})),Je.e("".concat(p," failed. error:"),e),Go(e)}))}},{key:"_getAVChatRoomMemberList",value:function(e){var n=this,o=e.groupID,a=e.offset,i=e.filter,s="".concat(this._n,".").concat("_getAVChatRoomMemberList"),r=new Xo("_getAVChatRoomMemberList");return r.setMessage("groupID:".concat(o," offset:").concat(a," filter:").concat(i)),this._groupModule.request({protocolName:Uo.GET_AVCHATROOM_MEMBER_LIST,requestData:{groupID:o,offset:a,filter:i}}).then((function(e){var a=e.data,i=a.memberList,c=void 0===i?[]:i,u=a.offset,l=void 0===u?0:u;r.setNetworkType(n._groupModule.getNetworkType()).end(),Je.l("".concat(s," ok. member count:").concat(c.length,", next request timestamp:").concat(l));var d=c.map((function(e){return t(t({},e),{},{onlineStatus:"Online"})})),p=n._updateLocalGroupMemberMap(o,d);return No({memberList:p,offset:l})})).catch((function(e){return n._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Je.e("".concat(s," failed. error:"),e),Go(e)}))}},{key:"getGroupMemberProfile",value:function(e){var n=this,o="getGroupMemberProfile",a="".concat(this._n,".").concat(o),i="groupID:".concat(e.groupID);e.userIDList.length>5?i+=" userIDList.length:".concat(e.userIDList.length):i+=" userIDList:".concat(e.userIDList),Je.l("".concat(a," ").concat(i)),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var s=e.groupID,r=e.userIDList,c=this._groupModule.getLocalGroupProfile(s);if(c&&bt(c.type)){var u=Ao.OPERATION_NOT_SUPPORTED_IN_AVCHATROOM;return Go({code:u,message:this._groupModule.getErrorMessage(u,o)})}var l=new Xo(o);return l.setMessage(i),this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:r})).then((function(e){var t=e.data.members;return vt(t)&&0!==t.length?(n._updateLocalGroupMemberMap(s,t),n._groupModule.getModule($n).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Xe.NICK,Xe.AVATAR]})):Oo([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(s,t);var o=r.filter((function(e){return n.hasLocalGroupMember(s,e)})).map((function(e){return n.getLocalGroupMemberInfo(s,e)}));return l.setNetworkType(n._groupModule.getNetworkType()).end(),No({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),o=e.groupID,a=this._groupModule.getLocalGroupProfile(o),i=a.type,s=new Xo("addGroupMember");if(s.setMessage("groupID:".concat(o," groupType:").concat(i)),bt(i)){var r=new ko({code:Ao.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return s.setError(r,!0,this._groupModule.getNetworkType()).end(),Go(r)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Je.l("".concat(n," groupID:").concat(o)),this._groupModule.request({protocolName:Uo.ADD_GROUP_MEMBER,requestData:e}).then((function(o){var i=o.data.members;Je.l("".concat(n," ok"));var r=i.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),c=i.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),u=i.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=i.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(r,", ")+"failureUserIDList:".concat(c,", ")+"existedUserIDList:".concat(u,", ")+"overLimitUserIDList:".concat(l);return s.setNetworkType(t._groupModule.getNetworkType()).setMoreMessage(d).end(),0===r.length?No({successUserIDList:r,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l}):(a.memberCount+=r.length,t._updateConversationGroupProfile(a),No({successUserIDList:r,failureUserIDList:c,existedUserIDList:u,overLimitUserIDList:l,group:a}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,a=e.userIDList,i=this._groupModule.getLocalGroupProfile(o);if(mt(i))return Go({code:Ao.CANNOT_FIND_GRP});if(bt(i.type))return this._groupModule.canIUse(K.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):this._groupModule.cannotUseCommercialAbility("deleteGroupMember");var s="groupID:".concat(o," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a));Je.l("".concat(n," groupID:").concat(o," userIDList:"),a);var r=new Xo("deleteGroupMember");return r.setMessage(s),this._groupModule.request({protocolName:Uo.DELETE_GROUP_MEMBER,requestData:e}).then((function(){return r.setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(n," ok")),i.memberCount-=1,t._updateConversationGroupProfile(i),t.deleteLocalGroupMembers(o,a),No({group:i,userIDList:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this._groupModule.getModule(ao).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("_banAVChatRoomMember"),o=e.groupID,a=e.userIDList,i="groupID:".concat(o," ").concat(a.length>5?"userIDList.length:".concat(a.length):"userIDList:".concat(a)),s=new Xo("_banAVChatRoomMember");s.setMessage(i),Je.l("".concat(n," groupID:").concat(o," userIDList:"),a);var r=this._groupModule.getLocalGroupProfile(o);return mt(e.duration)||0===e.duration?Go({code:Ao.BAN_DURATION_INVALID}):this._groupModule.request({protocolName:Uo.BAN_AVCHATROOM_MEMBER,requestData:e}).then((function(){return s.setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,a),No({group:r,userIDList:a})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,a=e.muteTime,i="".concat(this._n,".").concat("setGroupMemberMuteTime");if(o===this._groupModule.getMyUserID())return Go({code:Ao.CANNOT_MUTE_SELF});var s="groupID:".concat(n," userID:").concat(o," muteTime:").concat(a);Je.l("".concat(i," ").concat(s));var r=new Xo("setGroupMemberMuteTime");return r.setMessage(s),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:a}).then((function(e){r.setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(i," ok"));var o=t._groupModule.getLocalGroupProfile(n);return No({group:o,member:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Je.e("".concat(i," failed. error:"),e),Go(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberRole"),o=e.groupID,a=e.userID,i=e.role,s="groupID:".concat(o," userID:").concat(a," role:").concat(i),r=this._groupModule.getLocalGroupProfile(o);if(!r||r.type===S.GRP_WORK||r.type===S.GRP_AVCHATROOM)return Go({code:Ao.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});if(r&&r.selfInfo.role!==S.GRP_MBR_ROLE_OWNER)return Go({code:Ao.NOT_OWNER});var c=[S.GRP_MBR_ROLE_ADMIN,S.GRP_MBR_ROLE_MEMBER];if(wt({groupID:o})&&c.push(S.GRP_MBR_ROLE_CUSTOM),c.indexOf(i)<0)return Go({code:Ao.INVALID_MEMBER_ROLE});if(a===this._groupModule.getMyUserID())return Go({code:Ao.CANNOT_SET_SELF_MEMBER_ROLE});var u=new Xo("setGroupMemberRole");return u.setMessage(s),Je.l("".concat(n," ").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:a,role:i}).then((function(e){return u.setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(n," ok")),No({group:r,member:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this._groupModule.getModule(yo);if(!n)return!0;var o=n.filterText(t[e],Z),a=o.isAllowedToSend,i=o.modifiedText;return!0===a&&(t[e]=i,!0)}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="setGroupMemberNameCard",o="".concat(this._n,".").concat(n);if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return Go({code:Ao.PROFANITY_FOUND});var a=e.groupID,i=e.userID,s=void 0===i?this._groupModule.getMyUserID():i,r=e.nameCard,c="groupID:".concat(a," userID:").concat(s," nameCard:").concat(r);Je.l("".concat(o," ").concat(c));var u=this._groupModule.getLocalGroupProfile(a);if(u&&bt(u.type)){var l=Ao.OPERATION_NOT_SUPPORTED_IN_AVCHATROOM;return Go({code:l,message:this._groupModule.getErrorMessage(l,n)})}var d=new Xo(n);return d.setMessage(c),this.modifyGroupMemberInfo({groupID:a,userID:s,nameCard:r}).then((function(e){Je.l("".concat(o," ok")),d.setNetworkType(t._groupModule.getNetworkType()).end();var n=t._groupModule.getLocalGroupProfile(a);return s===t._groupModule.getMyUserID()&&n&&n.setSelfNameCard(r),No({group:n,member:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="setGroupMemberCustomField",o="".concat(this._n,".").concat(n),a=e.groupID,i=e.userID,s=void 0===i?this._groupModule.getMyUserID():i,r=e.memberCustomField,c="groupID:".concat(a," userID:").concat(s," memberCustomField:").concat(JSON.stringify(r));Je.l("".concat(o," ").concat(c));var u=this._groupModule.getLocalGroupProfile(a);if(u&&bt(u.type)){var l=Ao.OPERATION_NOT_SUPPORTED_IN_AVCHATROOM;return Go({code:l,message:this._groupModule.getErrorMessage(l,n)})}var d=new Xo(n);return d.setMessage(c),this.modifyGroupMemberInfo({groupID:a,userID:s,memberCustomField:r}).then((function(e){d.setNetworkType(t._groupModule.getNetworkType()).end(),Je.l("".concat(o," ok"));var n=t._groupModule.getLocalGroupProfile(a);return No({group:n,member:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,a=e.userID,i=void 0;return Ft(o)&&(o=$t(i=o)),this._groupModule.request({protocolName:Uo.MODIFY_GROUP_MEMBER_INFO,requestData:t(t({},e),{},{groupID:o,topicID:i})}).then((function(){if(n.hasLocalGroupMember(o,a)){var t=n.getLocalGroupMemberInfo(o,a);return mt(e.muteTime)||t.updateMuteUntil(e.muteTime),mt(e.role)||t.updateRole(e.role),mt(e.nameCard)||t.updateNameCard(e.nameCard),mt(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}var i=n._groupModule.getLocalGroupProfile(o);if(i&&!bt(i.type))return n.getGroupMemberProfile({groupID:o,userIDList:[a]}).then((function(e){return v(e.data.memberList,1)[0]}))}))}},{key:"markGroupMemberList",value:function(e){var t=this,n="".concat(this._n,".").concat("markGroupMemberList"),o=e.groupID,a=e.markType,i=e.enableMark,s=e.userIDList,r=void 0===s?[]:s,c="groupID:".concat(o," markType:").concat(a," enableMark:").concat(i," userIDList count:").concat(r.length);Je.l("".concat(n," ").concat(c));var u=2,l=[];!0===i&&(u=1);var d=m(r);r.length>500&&(d=r.slice(0,500),Je.w("".concat(n," ").concat(an(500)))),d.forEach((function(e){l.push({userID:e,markType:[a]})})),d=null;var p=new Xo("markGroupMemberList");return p.setMessage(c),this._groupModule.request({protocolName:Uo.MARK_AVCHATROOM_MEMBER_INFO,requestData:{groupID:o,operationType:u,memberList:l}}).then((function(e){var o=e.data.memberList,a=void 0===o?[]:o,i=[],s=[];a.length===r.length?i.push.apply(i,m(r)):(a.forEach((function(e){i.push(e.userID)})),r.forEach((function(e){i.includes(e)||s.push(e)})));var c="success count:".concat(i.length," fail count:").concat(s.length);return p.setNetworkType(t._groupModule.getNetworkType()).setMessage(c).end(),Je.l("".concat(n," ok. ").concat(c)),No({successUserIDList:i,failureUserIDList:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];p.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this._groupModule.request({protocolName:Uo.GET_GROUP_MEMBER_PROFILE,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:this.DEFAULT_MEMBER_INFO_FILTER})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return vt(t)&&0!==t.length?t.map((function(t){return n.hasLocalGroupMember(e,t.userID)?n.getLocalGroupMemberInfo(e,t.userID).updateMember(t):n.setLocalGroupMember(e,new Ja(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),e}(),Xa=1,Qa=15,Za=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}return i(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;Je.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length));var a=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),i=a.eventDataList,s=a.result;i.length>0&&(this._groupModule.getModule(ao).onNewMessage({conversationOptionsList:i,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:s,isInstantMessage:o}));o?s.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,s):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,a=null,i=n.length,s=0,r=[],c={conversationID:S.CONV_SYSTEM,unreadCount:0,type:S.CONV_SYSTEM,subType:null,lastMessage:null};for(s=0;s<i;s++){var u=n[s],l=u.groupProfile,d=l.communityType,p=void 0===d?0:d,_=l.topicID,g=void 0===_?void 0:_,h=u.elements,f=h.topicIDList,v=void 0===f?void 0:f,m=h.operationType;if(!(2!==p||pn(g)&&pn(v))){if([17,18,20].includes(m)){this._handleTopicSystemNotice(u);continue}pn(g)||(u.to=g)}if(u.elements.operationType!==Qa)u.currentUser=this._groupModule.getMyUserID(),u.conversationType=S.CONV_SYSTEM,u.conversationID=S.CONV_SYSTEM,(a=new pa(u)).setElement({type:S.MSG_GRP_SYS_NOTICE,content:t(t({},u.elements),{},{groupProfile:t({},u.groupProfile)})}),a.isSystemMessage=!0,(1===a.sequence&&1===a.random||2===a.sequence&&2===a.random)&&(a.sequence=kt(),a.random=kt(),a.generateMessageID(),Je.l("".concat(this._n,".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(a.ID))),this._groupModule.getModule(ao).pushIntoNoticeResult(r,a)&&(o?c.unreadCount++:a.setIsRead(!0),c.subType=a.conversationSubType)}return c.lastMessage=r[r.length-1],{eventDataList:r.length>0?[c]:[],result:r}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(ao).getLocalMessageList(S.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,a=n.operatorID,i=n.operationType,s=n.groupProfile;if(i===Xa){var r="".concat(a,"_").concat(s.groupID,"_").concat(s.to),c=e.pendencyMap.get(r);c&&_t(c.handled)&&0!==c.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return vt(e.messageList)&&0!==e.messageList.length?(Je.l("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Uo.DELETE_GROUP_SYSTEM_NOTICE,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:S.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Je.l("".concat(n," ok"));var o=t._groupModule.getModule(ao);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),No()})).catch((function(e){return Je.e("".concat(n," error:"),e),Go(e)}))):Oo()}},{key:"_getPendencyList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,o=void 0===n?void 0:n,a=t.startTime,i=void 0===a?0:a,s=t.limit,r=void 0===s?20:s;return this._groupModule.request({protocolName:Uo.GET_GROUP_PENDENCY,requestData:{type:o,startTime:i,limit:r,handleAccount:this._groupModule.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(m(n),m(e))})):n}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:S.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,m(n)),e._handlePendencyResult(t)})).catch((function(n){return e._handlePendencyResult(t)}))}))}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach((function(e){t.pendencyMap.set("".concat(e.from,"_").concat(e.groupID,"_").concat(e.to),e),0===e.handled&&n.push({applicant:e.from,applicantNick:e.fromUserNickName,groupName:e.groupName,groupID:e.groupID,authentication:e.authentication,messageKey:e.time,applicationType:e.applicationType,userID:e.userID,note:e.note})})),Oo({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,a=this._groupModule.getGroupMemberHandler().getLocalGroupMemberInfo(o,n);a&&a.updateRole(S.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,a=this._groupModule.getGroupMemberHandler().getLocalGroupMemberInfo(o,n);a&&a.updateRole(S.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(ao).onGroupMessageRemindTypeUpdated({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,a=e.elements,i=a.operationType,s=a.topicIDList,r=a.messageRemindType,c=this._groupModule.getModule(oo);17===i?c.onTopicCreated({groupID:n,topicID:o}):18===i?c.onTopicDeleted({groupID:n,topicIDList:s}):20===i&&c.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:r})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),$a=["relayFlag"],ei=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="GroupModule",t._commonGroupHandler=new Pa(g(t)),t._groupAttributesHandler=new xa(g(t)),t._groupCountersHandler=new Ka(g(t)),t._AVChatRoomHandler=new ja(g(t)),t._groupTipsHandler=new Ga(g(t)),t._groupSystemNoticeHandler=new Za(g(t)),t._groupMemberHandler=new za(g(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t._onlineMemberCountMap=new Map,t._timeoutIDs=[],t.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),o=this.getCloudConfig("polling_simplified_msg"),a=this.getCloudConfig("paging_grp_count");Je.l("".concat(this._n,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o," pagingGroupCount:").concat(a)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o),this._commonGroupHandler.setPagingGroupCount(a)}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===S.CONV_GROUP){var n=Ft(e.to)?$t(e.to):e.to;return this.hasLocalGroup(n)?Oo():this.getGroupProfile({groupID:n}).then((function(o){var a=o.data.group.type;if(Je.l("".concat(t._n,".guardForAVChatRoom. groupID:").concat(n," type:").concat(a)),a===S.GRP_AVCHATROOM){var i=Ao.MSG_SEND_FAIL_NOT_IN_AVCHATROOM;return Go(new ko({code:i,message:t.getErrorMessage(i,e.from,n),data:{message:e}}))}return Oo()}))}return Oo()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(vt(e)){var n=this.getModule(oo);e.forEach((function(e){var o=e.conversationID.replace(S.CONV_GROUP,"");Ft(o)&&n.updateLastMessage(o,e.lastMessage),t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!mt(n)){var o=t.getModule(ao);n.forEach((function(e){var n=e.groupID,a=e.topicID,i=void 0===a?void 0:a,s=e.lastMessageSeq;Je.d("".concat(t._n,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(s));var r="".concat(S.CONV_GROUP).concat(n),c=!0;pn(i)||(r="".concat(S.CONV_GROUP).concat(i),c=!1),o.updateIsReadAfterReadReport({conversationID:r,lastMessageSeq:s}),o.updateUnreadCount(r,c),o.clearGroupAtInfoList(r,c)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;Je.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,a=n.groupID,i=t.getModule(ao),s=o.readReceiptList;i.updateReadReceiptInfo({groupID:a,readReceiptList:s})}))}},{key:"onGroupMessageModified",value:function(e){Je.d("".concat(this._n,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(ao);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:S.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new Na(e))}},{key:"clearGroupMap",value:function(){this.groupMap.clear()}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(ao);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new Na(e)),o.deleteGroupRoamingMessageInfo(t))}));var a,i=this.getMyUserID(),s=D(this.groupMap);try{for(s.s();!(a=s.n()).done;){var r=v(a.value,2)[1];r.selfInfo.userID=i,"Owner"===r.selfInfo.role&&(r.ownerID=i)}}catch(c){s.e(c)}finally{s.f()}}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return m(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=m(this.groupMap).filter((function(e){var t=v(e,2);return t[0],!pn(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(m(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(E.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),a=this.getModule(ao);a.updateConversationGroupProfile(o)}}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return this._commonGroupHandler.isPagingGetCompleted()}},{key:"getMessageRemindType",value:function(e){var t=this;if(vt(e)&&0!==e.length){var n=e.filter((function(e){return!bt(t.getLocalGroupProfile(e).type)}));0!==n.length&&(Je.l("".concat(this._n,".getMessageRemindType groupIDList:").concat(n)),this.getGroupProfileAdvance({groupIDList:n,responseFilter:{memberInfoFilter:["MsgFlag"]}}).then((function(e){var n=e.data.successGroupList,o=t.getModule(ao);n.forEach((function(e){o.onGroupMessageRemindTypeUpdated({groupID:e.groupID,messageRemindType:vt(e.members)?e.members[0].messageRemindType:""})}))})))}}},{key:"getGroupList",value:function(){return this._commonGroupHandler.getGroupList()}},{key:"syncCommunityWithTopic",value:function(){return this._commonGroupHandler.syncGroupList(!0)}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),o=new Xo("getGroupProfile"),a=e.groupID,i=e.groupCustomFieldFilter;Je.l("".concat(n," groupID:").concat(a));var s={groupIDList:[a],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],groupCustomFieldFilter:i,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(s).then((function(e){var i,s=e.data,r=s.successGroupList,c=s.failureGroupList;if(Je.l("".concat(n," ok")),c.length>0)return Go(c[0]);(bt(r[0].type)&&!t.hasLocalGroup(a)?i=new Na(r[0]):(t.updateGroupMap(r),i=t.getLocalGroupProfile(a)),i.isSupportTopic)||t.getModule(ao).updateConversationGroupProfile([i]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," type:").concat(i.type," muteAllMembers:").concat(i.muteAllMembers," ownerID:").concat(i.ownerID)).end(),No({group:i})})).catch((function(a){return t.probeNetwork().then((function(t){var n=v(t,2),i=n[0],s=n[1];o.setError(a,i,s).setMessage("groupID:".concat(e.groupID)).end()})),Je.e("".concat(n," failed. error:"),a),Go(a)}))}},{key:"getGroupProfileAdvance",value:function(e){var n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList;vt(o)&&o.length>50&&(this.outputWarning("GetGroupProfileLimit"),o.length=50);var a=[],i=[];o.forEach((function(e){wt({groupID:e})?i.push(e):a.push(e)}));var s=[];if(a.length>0){var r=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:a}));s.push(r)}if(i.length>0){var c=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:i,relayFlag:a.length>0}));s.push(c)}return Promise.all(s).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,m(e.successGroupList)),n.push.apply(n,m(e.failureGroupList))})),No({successGroupList:t,failureGroupList:n})})).catch((function(e){return Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,a=_(e,$a);return this.request({protocolName:Uo.GET_GROUP_PROFILE,requestData:a}).then((function(e){Je.l("".concat(t._n,"._getGroupProfileAdvance ok. options:"),a);var n=e.data.groups;return{successGroupList:n.filter((function(e){return mt(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new ko({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&wt({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:Go(t)}))}},{key:"createGroup",value:function(e){var n=this,o=[S.GRP_PUBLIC,S.GRP_WORK,S.GRP_MEETING,S.GRP_AVCHATROOM,S.GRP_COMMUNITY],a="".concat(this._n,".").concat("createGroup"),i=e.type,s=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return Go({code:Ao.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Go({code:Ao.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Go({code:Ao.PROFANITY_FOUND});if(!o.includes(i))return Go({code:Ao.ILLEGAL_GRP_TYPE});if(!wt({type:i})){if(!pn(s)&&wt({groupID:s}))return Go({code:Ao.ILLEGAL_GRP_ID});e.isSupportTopic=void 0}if(bt(i)&&!mt(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(i)||mt(e.joinOption)||(e.joinOption=void 0),wt({type:i})){if(!pn(s)&&!wt({groupID:s}))return Go({code:Ao.ILLEGAL_GRP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var r=new Xo("createGroup");Je.l("".concat(a," options:"),e);var c=null,u=[];return this.request({protocolName:Uo.CREATE_GROUP,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(o){var i=o.data,s=i.groupID,l=i.overLimitUserIDList,d=void 0===l?[]:l;c=s,u=d;var p="groupType:".concat(e.type," groupID:").concat(s," overLimitUserIDList:").concat(d);if(r.setNetworkType(n.getNetworkType()).setMessage(p).end(),Je.l("".concat(a," ok. ").concat(p)),e.type===S.GRP_AVCHATROOM)return n.getGroupProfile({groupID:s});if(e.type===S.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:s});pn(e.memberList)||pn(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:s})]);var _=n.getModule(Qn),g="",h=0;e.type===S.GRP_COMMUNITY?(g=n.isIntl()?"Create Community":"创建社群",h=1):g=n.isIntl()?"Create Group":"创建群组";var f=n.getModule($n).getMyNick(),v=_.createCustomMessage({to:s,conversationType:S.CONV_GROUP,payload:{data:JSON.stringify({businessID:"group_create",content:g,cmd:h,opUser:f||n.getMyUserID(),version:4})}});return _.sendMessageInstance(v),n.emitGroupListUpdate(),n.getGroupProfile({groupID:s})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,a=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:a,messageRemindType:S.MSG_REMIND_ACPT_AND_NOTE,role:S.GRP_MBR_ROLE_OWNER}),No({group:t,overLimitUserIDList:u})})).catch((function(o){if(r.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var t=v(e,2),n=t[0],a=t[1];r.setError(o,n,a).end()})),10010===o.code||10007===o.code){n._silentlyGetGroupProfile(o.code,c),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var i=n.getLocalGroupProfile(c);return i.selfInfo.role=S.GRP_MBR_ROLE_OWNER,No({group:i,overLimitUserIDList:u})}return Je.e("".concat(a," failed. error:"),o),Go(o)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup"),o="groupID:".concat(e);if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===S.GRP_WORK)return Go(new ko({code:Ao.CANNOT_DISMISS_WORK}));var a=new Xo("dismissGroup");return a.setMessage(o),Je.l("".concat(n," ").concat(o)),this.request({protocolName:Uo.DISMISS_GROUP,requestData:{groupID:e}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),No({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"updateGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateGroupProfile");if(this.hasLocalGroup(e.groupID)){var o=this.getLocalGroupProfile(e.groupID).type;this._canIUseJoinOption(o)||mt(e.joinOption)||(Je.w("".concat(n," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)}if(mt(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return Go({code:Ao.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Go({code:Ao.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Go({code:Ao.PROFANITY_FOUND});var a=new Xo("updateGroupProfile");return a.setMessage(JSON.stringify(e)),Je.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:Uo.UPDATE_GROUP_PROFILE,requestData:e}).then((function(){(a.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&t.groupMap.get(e.groupID).updateGroup(e);return No({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.l("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(yo);if(!n)return!0;var o=n.filterText(t[e],Q),a=o.isAllowedToSend,i=o.modifiedText;return!0===a&&(t[e]=i,!0)}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,a="".concat(this._n,".joinGroup");if(o===S.GRP_WORK)return Go({code:Ao.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return Oo({status:S.JOIN_STATUS_ALREADY_IN_GROUP});var i=new Xo("applyJoinGroup");return this.getGroupProfile({groupID:n}).then((function(){return i.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(S.JOIN_STATUS_ALREADY_IN_GROUP)).end(),Oo({status:S.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return i.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),Je.w("".concat(a," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return Je.l("".concat(a," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("applyJoinGroup"),a=e.groupID;if(!pn(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return Go({code:Ao.PROFANITY_FOUND});var i=new Xo("applyJoinGroup"),s=t({},e),r=this.canIUse(K.AVCHATROOM_HISTORY_MSG);return r&&(s.historyMessageFlag=1),this.getModule(ao).deleteTopicRoamingMessageInfo(a),this.request({protocolName:Uo.APPLY_JOIN_GROUP,requestData:s}).then((function(e){var t=e.data,s=t.joinedStatus,c=t.longPollingKey,u=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,_="groupID:".concat(a," joinedStatus:").concat(s," longPollingKey:").concat(c," startSeq:").concat(u)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(r,",")+" history message count:".concat(pn(p)?0:p.length);switch(i.setNetworkType(n.getNetworkType()).setMessage("".concat(_)).end(),Je.l("".concat(o," ok. ").concat(_)),s){case rt:return No({status:rt});case st:return n.getGroupProfile({groupID:a}).then((function(e){var t=e.data.group;return n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:c,startSeq:u,avChatRoomKey:d,messageList:p})})).catch((function(e){if(10010===e.code||10007===e.code){n._silentlyGetGroupProfile(e.code,a);var t=new Na({groupID:a});return n.updateGroupMap([t]),n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:c,startSeq:u,avChatRoomKey:d,messageList:p})}return Je.e("".concat(o," failed. error:"),e),Go(e)}));default:var g=new ko({code:Ao.JOIN_GRP_FAIL});return Je.e("".concat(o," failed. error:"),g),Go(g)}})).catch((function(e){return i.setMessage("groupID:".concat(a)),n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"_handleJoinResult",value:function(e){var t,n=this,o=e.group,a=e.avChatRoomFlag,i=e.longPollingKey,s=e.startSeq,r=e.avChatRoomKey,c=e.messageList,u=o.groupID;return 1===a?(this.getModule(ao).setCompleted("".concat(S.CONV_GROUP).concat(u)),this._groupAttributesHandler.initGroupAttributesCache({groupID:u,avChatRoomKey:r}),this._groupCountersHandler.initGroupCountersCache({groupID:u,avChatRoomKey:r}),(t=mt(i)?this._AVChatRoomHandler.handleJoinResult({group:o}):this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:i,startSeq:s})).then((function(){n._onAVChatRoomHistoryMessage(c,u)})),t):(this.emitGroupListUpdate(!0,!1),No({status:st,group:o}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("quitGroup"),o="groupID:".concat(e);Je.l("".concat(n," ").concat(o));var a=this.checkJoinedAVChatRoomByID(e);if(!a&&!this.hasLocalGroup(e))return Go({code:Ao.MEMBER_NOT_IN_GRP});if(a&&!this.isLoggedIn())return Je.l("".concat(n," anonymously ok. ").concat(o)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),Oo({groupID:e});var i=new Xo("quitGroup");return i.setMessage(o),this.request({protocolName:Uo.QUIT_GROUP,requestData:{groupID:e}}).then((function(){return i.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),a&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),No({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._n,".").concat("searchGroupByID"),o={groupIDList:[e]},a=new Xo("searchGroupByID");return a.setMessage("groupID:".concat(e)),Je.l("".concat(n," groupID:").concat(e)),this.request({protocolName:Uo.SEARCH_GROUP,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new ko({code:o[0].errorCode,message:o[0].errorInfo});return a.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok")),No({group:new Na(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"changeGroupOwner",value:function(e){var t=this,n="".concat(this._n,".").concat("changeGroupOwner");if(this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===S.GRP_AVCHATROOM)return Go({code:Ao.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return Go({code:Ao.CANNOT_CHANGE_OWNER_TO_SELF});var o=new Xo("changeGroupOwner");return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),Je.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:Uo.CHANGE_GROUP_OWNER,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok"));var a=e.groupID,i=e.newOwnerID;t.groupMap.get(a).ownerID=i;var s=t._groupMemberHandler.getLocalGroupMemberList(a);if(s instanceof Map){var r=s.get(t.getMyUserID());mt(r)||(r.updateRole("Member"),t.groupMap.get(a).selfInfo.role="Member");var c=s.get(i);mt(c)||c.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),No({group:t.groupMap.get(a)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,a,i,s=this,r="".concat(this._n,".").concat("handleGroupApplication"),c=e.handleAction,u=e.handleMessage,l=e.message,d=e.application;l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,a=l.payload.messageKey):d&&(t=d.applicant,n=d.groupID,o=d.authentication,a=d.messageKey);var p=Uo.HANDLE_GROUP_APPLICATION;d&&2===d.applicationType&&(p=Uo.HANDLE_INVITE_JOIN_GROUP,i=d.userID);var _=new Xo("handleGroupApplication");return _.setMessage("groupID:".concat(n)),Je.l("".concat(r," groupID:").concat(n)),this.request({protocolName:p,requestData:{handleAction:c,handleMessage:u,applicant:t,invitee:i,groupID:n,authentication:o,messageKey:a}}).then((function(){return _.setNetworkType(s.getNetworkType()).end(),Je.l("".concat(r," ok")),l&&s._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),No({group:s.getLocalGroupProfile(n)})})).catch((function(e){return s.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];_.setError(e,o,a).end()})),Je.e("".concat(r," failed. error"),e),Go(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._n,".").concat("handleGroupInvitation"),a=e.message.payload,i=a.groupProfile.groupID,s=a.authentication,r=a.messageKey,c=a.operatorID,u=e.handleAction,l=new Xo("handleGroupInvitation");return l.setMessage("groupID:".concat(i," inviter:").concat(c," handleAction:").concat(u)),Je.l("".concat(o," groupID:").concat(i," inviter:").concat(c," handleAction:").concat(u)),this.request({protocolName:Uo.HANDLE_GROUP_INVITATION,requestData:t(t({},e),{},{inviter:c,groupID:i,authentication:s,messageKey:r})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),Je.l("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),No({group:n.getLocalGroupProfile(i)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),Je.e("".concat(o," failed. error"),e),Go(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".getGroupOnlineMemberCount"),o=this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e),a=this.hasLocalGroup(e);if(Je.l("".concat(n," groupID:").concat(e," isAVChatRoom:").concat(o," has:").concat(a)),o)return this._AVChatRoomHandler.getGroupOnlineMemberCount(e);if(!a)return Oo({memberCount:0});var i=Date.now();if(this._onlineMemberCountMap.has(e)){var s=this._onlineMemberCountMap.get(e);if(i-s.lastReqTime<=6e4)return Oo({memberCount:s.memberCount});s.lastReqTime=i}return this.requestOnlineCount(e).then((function(o){var a=o.data.memberCount,i=void 0===a?0:a;return t._onlineMemberCountMap.set(e,{lastReqTime:Date.now(),memberCount:i}),Je.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i)),Oo({memberCount:i})})).catch((function(e){return Je.w("".concat(n," failed. error:"),e),Promise.reject(e)}))}},{key:"requestOnlineCount",value:function(e){return this.request({protocolName:Uo.GET_ONLINE_MEMBER_NUM,requestData:{groupID:e}})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Je.l("".concat(this._n,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(ao).deleteLocalConversation("".concat(S.CONV_GROUP).concat(e));if(wt({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(oo).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this._onlineMemberCountMap.delete(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this._groupMemberHandler.deleteGroupMemberList(e)}},{key:"sendMessage",value:function(e,t){if(vt(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(K.MSG_TO_SPECIFIED_GRP_MBR))return this.cannotUseCommercialAbility("group direct messages");var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";gt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var a=[];if(ft(t)&&ft(t.messageControlInfo)){var i=t.messageControlInfo,s=i.excludedFromUnreadCount,r=i.excludedFromLastMessage,c=i.excludedFromContentModeration;!0===s&&a.push("NoUnread"),!0===r&&a.push("NoLastMsg"),!0===c&&a.push("NoMsgCheck")}var u=void 0;vt(e._receiverList)&&e._receiverList.length>0&&(u=e._receiverList,e._receiverList.length>50&&(u=e._receiverList.slice(0,50),this.outputWarning("ReceiverListLimit")));var l=this.isOnlineMessage(e,t)?1:0,d=e.getGroupAtInfoList(),p={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:e.getElements(),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==S.MSG_TEXT||pn(d)?void 0:d,onlineOnlyFlag:l,clientTime:e.clientTime,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0===l?a:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:u,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0};return Ft(e.to)&&(p.groupID=$t(e.to),p.topicID=e.to),{protocolName:Uo.SEND_GROUP_MESSAGE,tjgID:this.generateTjgID(e),requestData:p}}},{key:"_isVoipPush",value:function(e){var t=void 0;return mt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Ft(e.to)&&(t.groupID=$t(e.to),t.topicID=e.to),this.request({protocolName:Uo.REVOKE_GROUP_MESSAGE,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;Je.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return Ft(t)&&(o.groupID=$t(t),o.topicID=t),this.request({protocolName:Uo.DELETE_GROUP_MESSAGE,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,a=e.type,i=e.version,s=void 0===i?0:i,r=e.cloudCustomData,c=t,u=void 0;Ft(t)&&(c=$t(t),u=t);var l=void 0;return tn(a)&&(l=[]).push({type:a,content:o}),this.request({protocolName:Uo.MODIFY_GROUP_MESSAGE,requestData:{groupID:c,topicID:u,sequence:n,version:s,elements:l,cloudCustomData:r}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.conversationID,a=e.groupID,i=e.sequence,s=new Xo("getGroupRoamingMessages"),r=0,c=void 0;return Ft(a)&&(a=$t(c=a)),this._computeLastSequence({groupID:a,topicID:c,sequence:i}).then((function(e){return r=e,Je.l("".concat(n," groupID:").concat(a," startSequence:").concat(r)),t.request({protocolName:Uo.GET_GROUP_ROAMING_MESSAGE,requestData:{groupID:a,count:21,sequence:r,topicID:c}})})).then((function(e){var i=e.data,u=i.messageList,l=i.complete,d=i.invisibleSequenceList,p=void 0===d?[]:d,_=e.data.nextSequence,g=void 0===_?0:_;mt(u)?Je.l("".concat(n," ok. complete:").concat(l," nextSequence:").concat(g," but messageList is undefined!")):Je.l("".concat(n," ok. complete:").concat(l," nextSequence:").concat(g," count:").concat(u.length)),s.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(r," complete:").concat(l," nextSequence:").concat(g)).end();var h=t.getModule(ao),f=[];return pn(u)?g>=1&&h.updateRoamingMessageSequence(o,g):(h.updateRoamingMessageSequence(o,g),f=h.onRoamingMessage(u,o),h.updateIsRead(o),h.patchConversationLastMessage(o)),(2===l||g<1)&&(h.setCompleted(o),g=""),Je.l("".concat(n," nextReqID:").concat(g,", stored message count:").concat(f.length,", invisible sequence count:").concat(p.length)),{nextReqID:g+"",storedMessageList:f}})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];s.setError(e,o,i).setMessage("groupID:".concat(a," topicID:").concat(c," startSequence:").concat(r)).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(S.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t=this,n="".concat(this._n,".").concat("getReadReceiptList"),o=this._getGroupIDOfMessage(e[0]),a=this.getMyUserID(),i=e.filter((function(e){return e.from===a&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(Je.l("".concat(n," groupID:").concat(o," sequenceList:").concat(JSON.stringify(i))),0===i.length)return Oo({messageList:e});var s=new Xo("getReadReceiptList");return s.setMessage("groupID:".concat(o)),this.request({protocolName:Uo.GET_READ_RECEIPT,requestData:{groupID:o,sequenceList:i}}).then((function(t){s.end(),Je.l("".concat(n," ok"));var o=t.data.readReceiptList;return vt(o)&&o.forEach((function(t){e.forEach((function(e){0===t.code&&t.sequence===e.sequence&&(e.readReceiptInfo.readCount=t.readCount,e.readReceiptInfo.unreadCount=t.unreadCount)}))})),No({messageList:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n="".concat(this._n,".").concat("sendReadReceipt"),o=this._getGroupIDOfMessage(e[0]),a=new Xo("sendReadReceipt");a.setMessage("groupID:".concat(o));var i=this.getMyUserID(),s=e.filter((function(e){return e.from!==i&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));return 0===s.length?Go({code:Ao.READ_RECEIPT_MSG_LIST_EMPTY}):(Je.l("".concat(n,". sequenceList:").concat(JSON.stringify(s))),this.request({protocolName:Uo.SEND_READ_RECEIPT,requestData:{groupID:o,sequenceList:s}}).then((function(e){return a.end(),Je.l("".concat(n," ok")),No()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)})))}},{key:"getReadReceiptDetail",value:function(e){var t=this,n=e.message,o=e.filter,a=e.cursor,i=e.count,s=this._getGroupIDOfMessage(n),r=n.ID,c=n.sequence,u="".concat(this._n,".").concat("getReadReceiptDetail"),l=this._receiptDetailCompleteMap.get(r)||!1,d=0!==o&&1!==o?0:o,p=gt(a)?a:"",_=!_t(i)||i<=0||i>=100?100:i,g="groupID:".concat(s," sequence:").concat(c," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);Je.l("".concat(u," ").concat(g));var h={cursor:"",isCompleted:!1,messageID:r,unreadUserIDList:[],readUserIDList:[]},f=new Xo("getReadReceiptDetail");return f.setMessage(g),this.request({protocolName:Uo.GET_READ_RECEIPT_DETAIL,requestData:{groupID:s,sequence:c,flag:d,cursor:p,count:_}}).then((function(e){f.end();var n=e.data,o=n.cursor,a=n.isCompleted,i=n.unreadUserIDList,s=n.readUserIDList;return h.cursor=o,1===a&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(r,!0)),0===d?h.readUserIDList=s.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=i.map((function(e){return e.userID}))),Je.l("".concat(u," ok")),No(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];f.setError(e,o,a).end()})),Je.w("".concat(u," failed. error:"),e),Go(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=e.groupID,a=e.count,i=e.sequence,s=e.direction,r=i;if(mt(i)){if(1===s)return Oo({messageList:[],isCompleted:!0,nextMessageSeq:""});if(this.hasLocalGroup(o)){var c=this.getLocalGroupProfile(o).nextMessageSeq;r=c>1?c-1:0}Ft(o)&&(r=0)}else 1===s&&(r=i+a-1);var u=void 0;Ft(o)&&(o=$t(u=o));var l="".concat(u?"topicID:".concat(u):"groupID:".concat(o)," sequence:").concat(i," direction:").concat(s);Je.l("".concat(n," ").concat(l));var d=new Xo("getGroupRoamingMessagesHopping");return this.request({protocolName:Uo.GET_GROUP_ROAMING_MESSAGE,requestData:{groupID:o,topicID:u,count:a,sequence:r}}).then((function(o){var a=o.data,r=a.messageList,c=a.complete,u="complete:".concat(c," count:").concat(r?r.length:0);if(Je.l("".concat(n," ok. ").concat(u)),d.setNetworkType(t.getNetworkType()).setMessage("".concat(l," ").concat(u)).end(),2===c||pn(r)){var p=t._computeResult();return No(p)}var _="".concat(S.CONV_GROUP).concat(e.groupID),g=t.getModule(ao).onRoamingMessage(r,_,!1),h=t._computeResult({direction:s,sequence:i,remoteMessageList:r,processedMessageList:g});return No(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),s=n[0],r=n[1];d.setError(e,s,r).setMessage("groupID:".concat(o," sequence:").concat(i," count:").concat(a)).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(mt(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,a=e.remoteMessageList,i=void 0===a?[]:a,s=e.processedMessageList,r=void 0===s?[]:s,c=i.length;return 1===n?(t.nextMessageSeq=i[0].sequence+1,r.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),0===t.messageList.length&&i[0].sequence<o&&(t.isCompleted=!0,t.nextMessageSeq=""),t):(t.nextMessageSeq=i[c-1].sequence-1,t.messageList=m(r),0===t.nextMessageSeq&&(t.isCompleted=!0,t.nextMessageSeq=""),t)}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageSeq,a="".concat(this._n,".setMessageRead");Je.l("".concat(a," conversationID:").concat(n," lastMessageSeq:").concat(o)),_t(o)||this.outputWarning("DoNotModifyLastSeq");var i=new Xo("setGroupMessageRead");i.setMessage("".concat(n,"-").concat(o));var s=n.replace(S.CONV_GROUP,""),r=void 0;return Ft(s)&&(s=$t(r=s)),this.request({protocolName:Uo.SET_GROUP_MESSAGE_READ,requestData:{groupID:s,topicID:r,messageReadSeq:o}}).then((function(){i.setNetworkType(t.getNetworkType()).end(),Je.l("".concat(a," ok."));var e=t.getModule(ao);e.updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:o});var c=!0;if(!mt(r)){c=!1;var u=t.getModule(oo).getLocalTopic(s,r);u&&u.updateSelfInfo({readedSequence:o})}return e.updateUnreadCount(n,c),No()})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.l("".concat(a," failed. error:"),e),Go(e)}))}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,n=e.topicID,o=void 0===n?void 0:n,a=e.sequence;return a>0?Promise.resolve(a):mt(o)?this.getGroupLastSequence(t):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupLastSequence"),o=new Xo("getGroupLastSequence"),a=0,i="",s="groupID:".concat(e);if(this.hasLocalGroup(e)){var r=this.getLocalGroupProfile(e),c=r.lastMessage;if(c.lastSequence>0&&!1===c.onlineOnlyFlag)return a=c.lastSequence,i="".concat(s,", ").concat(a," from group.lastMessage.lastSequence"),Je.l("".concat(n," ").concat(i)),o.setNetworkType(this.getNetworkType()).setMessage(i).end(),Promise.resolve(a);if(r.nextMessageSeq>1)return a=r.nextMessageSeq-1,i="".concat(s,", ").concat(a," from group.nextMessageSeq"),Je.l("".concat(n," ").concat(i)),o.setNetworkType(this.getNetworkType()).setMessage(i).end(),Promise.resolve(a)}var u=this.getModule(ao).getLocalConversation("GROUP".concat(e));if(u&&u.lastMessage.lastSequence&&!1===u.lastMessage.onlineOnlyFlag)return a=u.lastMessage.lastSequence,i="".concat(s,", ").concat(a," from conversation.lastMessage.lastSequence"),Je.l("".concat(n," ").concat(i)),o.setNetworkType(this.getNetworkType()).setMessage(i).end(),Promise.resolve(a);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(e){var r=e.data.successGroupList;return pn(r)?Je.w("".concat(n," ").concat(s,", empty successGroupList")):(a=r[0].nextMessageSeq-1,i="".concat(s,", ").concat(a," from remote"),Je.l("".concat(n," ").concat(i))),o.setNetworkType(t.getNetworkType()).setMessage(i).end(),a})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).setMessage(s).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.hasJoinedAVChatRoom()}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.getJoinedAVChatRoom()}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==S.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e,n){if(!pn(e)){Je.l("".concat(this._n,"._onAVChatRoomHistoryMessage groupID:").concat(n," count:").concat(e.length));var o=[];e.forEach((function(e){o.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(o,n)}}},{key:"onAVChatRoomMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this._AVChatRoomHandler.onMessage(e,t)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new Xo("getGroupSimplifiedInfo"),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var a=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(a[0].type)).end(),a[0]})).catch((function(o){t.probeNetwork().then((function(t){var a=v(t,2),i=a[0],s=a[1];n.setError(o,i,s).setMessage("groupID:".concat(e)).end()}))}))}},{key:"setUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.set(e,1)}},{key:"deleteUnjoinedAVChatRoom",value:function(e){this._unjoinedAVChatRoomList.has(e)&&this._unjoinedAVChatRoomList.delete(e)}},{key:"isUnjoinedAVChatRoom",value:function(e){return this._unjoinedAVChatRoomList.has(e)}},{key:"isGroupAttributesUpdatedNotice",value:function(e){return this._groupAttributesHandler.isGroupAttributesUpdatedNotice(e)}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesHandler.updateLocalMainSequenceOnReconnected()}},{key:"initGroupAttributes",value:function(e){return this._groupAttributesHandler.initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._groupAttributesHandler.setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._groupAttributesHandler.deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._groupAttributesHandler.getGroupAttributes(e)}},{key:"isMessageFromTopic",value:function(e,t){return 2===e&&!pn(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&pn(t)}},{key:"getMessageExtensions",value:function(e,t){return Je.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Uo.GET_GROUP_MESSAGE_EXTENSIONS,requestData:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Je.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Uo.MODIFY_GROUP_MESSAGE_EXTENSIONS,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"_genNotifyReqList",value:function(e){for(var t=[],n=0,o=e.length;n<o;n++){var a=e[n],i=this.getLocalGroupProfile(a).type,s=this._getGroupLastRevokedTime(a),r=1e3*He(),c={notifyType:1,limit:20,type:wt({type:i,groupID:a})?S.GRP_COMMUNITY:void 0,groupID:a,beginTime:s,endTime:r};t.push(c)}return t}},{key:"getGroupNotify",value:function(e){var t=this,n="".concat(this._n,".getGroupNotify"),o=e.filter((function(e){var n=t.getLocalGroupProfile(e),o=n.type,a=n.isSupportTopic;return t.hasLocalGroup(e)&&!bt(o)&&!a})),a="filteredGroupIDList.length:".concat(o.length);o.length<=10&&(a="filteredGroupIDList:".concat(JSON.stringify(o))),Je.l("".concat(n," ").concat(a)),0!==o.length&&this.request({protocolName:Uo.GET_GROUP_NOTIFY,requestData:{notifyReqList:this._genNotifyReqList(e)}}).then((function(e){var o=e.data.notifyRspList,a=[];if(vt(o)){var i={dataList:[]};o.forEach((function(e){var n=e.nextRevokedTime,o=e.groupID;i.dataList.push({elements:{revokedInfos:t._genRevokedInfos(e)}}),0!==n?(t._setGroupLastRevokedTime(o,n),a.push(o)):t._setGroupLastRevokedTime(o,1e3*He())})),t.onGroupMessageRevoked(i)}a.length>0&&t.getGroupNotify(a);var s="nextGroupIDList.length:".concat(a.length);a.length<=10&&(s="nextGroupIDList:".concat(JSON.stringify(a))),Je.l("".concat(n," ").concat(s))})).catch((function(e){Je.e("".concat(n," failed. error:"),e)}))}},{key:"_genRevokedInfos",value:function(e){var n=e.notifyList,o=e.groupID,a=[];return vt(n)&&n.forEach((function(e){a.push({groupID:o,sequence:e.sequence,random:e.random,revokerInfo:t({},e.revokerInfo)})})),a}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"getGroupMemberHandler",value:function(){return this._groupMemberHandler}},{key:"getGroupMemberList",value:function(e){return this._groupMemberHandler.getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._groupMemberHandler.getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._groupMemberHandler.addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._groupMemberHandler.deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._groupMemberHandler.setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._groupMemberHandler.setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._groupMemberHandler.setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._groupMemberHandler.setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._groupMemberHandler.markGroupMemberList(e)}},{key:"modifyGroupMemberInfo",value:function(e){return this._groupMemberHandler.modifyGroupMemberInfo(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&bt(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return function(e){return e===S.GRP_PUBLIC}(e)||wt({type:e})}},{key:"_silentlyGetGroupProfile",value:function(e,t){var n=setTimeout(this.getGroupProfile.bind(this,{groupID:t}),3e3);this._timeoutIDs.push(n),Je.l("".concat(this._n,"._silentlyGetGroupProfile errorCode:").concat(e," groupID:").concat(t," timeoutIDs:").concat(this._timeoutIDs))}},{key:"_clearTimeoutIDs",value:function(){this._timeoutIDs.forEach((function(e){clearTimeout(e)})),this._timeoutIDs=[]}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._onlineMemberCountMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler.reset(),this._groupMemberHandler.reset(),this._clearTimeoutIDs()}}]),a}(Po),ti=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],ni=function(e,t){return pn(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:en(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}},oi=function(){function e(t,n){o(this,e),this.topicID="",this.topicName="",this.avatar="",this.introduction="",this.notification="",this.unreadCount=0,this.muteAllMembers=!1,this.customData="",this.groupAtInfoList=[],this.nextMessageSeq=0,this.lastMessage=ni(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return i(e,[{key:"_initTopic",value:function(e){for(var t in e)ti.indexOf(t)<0||("selfInfo"===t?this.updateSelfInfo(e[t]):this[t]="muteAllMembers"===t?1===e[t]:e[t])}},{key:"updateUnreadCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.unreadCount=e}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=ni(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){mt(e.selfInfo)||this.updateSelfInfo(e.selfInfo),mt(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),Et(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0!==Et(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),ai=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");mt(e)||(this.TOPIC_CACHE_TIME=Number(e)),mt(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(E.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(E.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,a=this.getLocalTopic(t,n);if(a){var i=a.updateSelfInfo({messageRemindType:o});i&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:a}),Je.d("".concat(this._n,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(i))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,a=$t(t),i=this.getLocalTopic(a,t),s=!1;i&&(mt(n)||i.unreadCount===n||(i.updateUnreadCount(n),s=!0),mt(o)||(i.updateGroupAtInfoList(o),s=!0)),s&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:a,topic:i})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,a=this.getLocalTopic(t,n);a&&(a.nextMessageSeq+=1,a.updateLastMessage(o),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:a}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,a=e.elements,i=e.cloudCustomData,s=e.messageVersion,r=$t(t),c=this.getLocalTopic(r,t);if(c){var u=c.lastMessage;Je.d("".concat(this._n,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(u),"options:",JSON.stringify(e)),u&&(null===u.payload||u.lastTime===n&&u.lastSequence===o&&u.version!==s)&&(u.type=a[0].type,u.payload=a[0].content,u.messageForShow=en(u.type,u.payload,this.isIntl()),u.cloudCustomData=i,u.version=s,u.lastSequence=o,u.lastTime=n,this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:r,topic:c}))}}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=null,a=!1;e.forEach((function(e){var i=e.to;o=$t(i),(n=t.getLocalTopic(o,i))&&(n.reduceUnreadCount()&&(a=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),a=!0))})),a&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=e.sequence,o=$t(t),a=this.getLocalTopic(o,t),i=!1;return a&&(i=a.isLastMessageRevoked({sequence:n})),i}},{key:"getJoinedCommunityList",value:function(){return this.getModule(to).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),a=e.topicID;if(!mt(a)&&!Ft(a))return Go({code:Ao.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity("topicName",e))return Go({code:Ao.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Go({code:Ao.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Go({code:Ao.PROFANITY_FOUND});var i=new Xo("createTopicInCommunity");return this.request({protocolName:Uo.CREATE_TOPIC,requestData:t({},e)}).then((function(a){var s=a.data.topicID;return i.setMessage("topicID:".concat(s)).setNetworkType(n.getNetworkType()).end(),Je.l("".concat(o," ok. topicID:").concat(s)),n._updateTopicMap([t(t({},e),{},{topicID:s})]),No({topicID:s})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),o=e.groupID,a=e.topicIDList,i=void 0===a?[]:a,s=new Xo("deleteTopicFromCommunity");return s.setMessage("groupID:".concat(o," topicIDList:").concat(i)),this.request({protocolName:Uo.DELETE_TOPIC,requestData:{groupID:o,topicIDList:i}}).then((function(e){var a=e.data.resultList,i=[],r=[];(void 0===a?[]:a).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?i.push({topicID:t}):r.push({topicID:t,code:n,message:o})}));var c="success count:".concat(i.length,", fail count:").concat(r.length);return s.setMoreMessage(c).setNetworkType(t.getNetworkType()).end(),Je.l("".concat(n," ok. ").concat(c)),i.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),No({successTopicList:i,failureTopicList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateTopicProfile");if(Je.l("".concat(o," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return Go({code:Ao.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return Go({code:Ao.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return Go({code:Ao.PROFANITY_FOUND});var a=new Xo("updateTopicProfile");return a.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),mt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:Uo.UPDATE_TOPIC_PROFILE,requestData:t({},e)}).then((function(){return a.setNetworkType(n.getNetworkType()).end(),Je.l("".concat(o," ok")),n._updateTopicMap([e]),No({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._n,".").concat("getTopicList"),a=e.groupID,i=e.topicIDList,s=void 0===i?[]:i,r=0===s.length,c=new Xo("getTopicList");if(c.setMessage("groupID:".concat(a)),this._getTopicTimeMap.has(a)){var u=this._getTopicTimeMap.get(a),l=u.isGetAll,d=u.time;if((l||!l&&!r)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(a,s);if(r||p.length===s.length)return c.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),Je.l("".concat(o," groupID:").concat(a," from cache, topic count:").concat(p.length)),Oo({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:Uo.GET_TOPIC_LIST,requestData:{groupID:a,topicIDList:s}}).then((function(e){var i=e.data.topicInfoList,s=[],u=[],l=[];(void 0===i?[]:i).forEach((function(e){var n=e.topic,o=e.selfInfo,a=e.errorCode,i=e.errorInfo,r=n.topicID;0===a?(s.push(t(t({},n),{},{selfInfo:o})),u.push(r)):l.push({topicID:r,code:a,message:i})})),n._updateTopicMap(s),n._handleTopicAtInfo(s);var d="success count:".concat(u.length,", fail count:").concat(l.length);c.setNetworkType(n.getNetworkType()).setMoreMessage(d).end(),Je.l("".concat(o," groupID:").concat(a," from remote, ").concat(d));var p=[];return pn(u)||(n._getTopicTimeMap.set(a,{time:Date.now(),isGetAll:r}),p=n._getLocalTopicList(a,u)),No({successTopicList:p,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=v(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"hasLocalTopic",value:function(e,t){return!!this._topicMap.has(e)&&this._topicMap.get(e).has(t)}},{key:"getLocalTopic",value:function(e,t){var n=null;return this._topicMap.has(e)&&(n=this._topicMap.get(e).get(t)),n}},{key:"_getLocalTopicList",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=this._topicMap.get(e),o=[];return n&&(o=m(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&this._topicMap.get(e).has(t)&&(this._topicMap.get(e).delete(t),Je.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,a=e.topicID,i=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(a)?(i=t._topicMap.get(o).get(a)).updateTopic(e):(t._getTopicLastMessage(e),i=new oi(e,t.isIntl()),t._topicMap.get(o).set(a,i));var s=t._computeUnreadCount(i);i.updateUnreadCount(s),n.push({conversationID:"".concat(S.CONV_GROUP).concat(a),type:S.CONV_TOPIC,unreadCount:s})})),n.length>0)&&this.getModule(ao).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;mt(e)?m(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=m(this._topicMap.keys()),n=[],o=this.getModule(ao);t.forEach((function(t){var a=[],i=e._getLocalTopicList(t);o.deleteTopicRoamingMessageInfo(t),i.forEach((function(t){var n=t.lastMessage.lastTime,o=void 0===n?0:n;Date.now()-1e3*o<1e3*e.TOPIC_LAST_ACTIVE_TIME&&a.push(t.topicID)})),a.length>0&&n.push({groupID:t,topicIDList:a})})),Je.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),a=new Xo("relayGetTopicList");a.setMessage(o),Je.l("".concat(this._n,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){a.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),o=t[0],i=t[1];a.setError(n,o,i).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,a=e.topicID,i=e.groupAtInfoList,s=[];mt(i)||(i.forEach((function(e){s.push(t(t({},e),{},{groupID:o,topicID:a}))})),n.getModule(ao).onNewGroupAtTips({dataList:s}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!mt(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:pn(e.lastMsg.revokerInfo)?null:e.lastMsg.revokerInfo.revoker};e.lastMessage=t}}},{key:"deleteTopicListInCommunity",value:function(e){var t=this,n=this._getLocalTopicList(e),o=this.getModule(ao);n.forEach((function(n){var a=n.topicID;t._deleteLocalTopic(e,a),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(S.CONV_GROUP).concat(a))}))}},{key:"_computeUnreadCount",value:function(e){var t=e.selfInfo,n=t.excludedUnreadSequenceList,o=t.readedSequence,a=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(vt(n)){var i=0;n.forEach((function(t){t>=o&&t<=e.nextMessageSeq-1&&(i+=1)})),i>=1&&(a-=i)}return a<0?0:a}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(yo);if(!n)return!0;var o=n.filterText(t[e],Q),a=o.isAllowedToSend,i=o.modifiedText;return!0===a&&(t[e]=i,!0)}},{key:"updateLastMessage",value:function(e,t){var n=$t(e),o=this.getLocalTopic(n,e);if(o){var a=t.sequence+1;o.updateNextMessageSeq(a),o.updateLastMessage(t),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"getMessageExtensions",value:function(e,t){Je.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=$t(e.to);return this.request({protocolName:Uo.GET_GROUP_MESSAGE_EXTENSIONS,requestData:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMessageExtensions",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;Je.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n));var o=$t(e.to);return this.request({protocolName:Uo.MODIFY_GROUP_MESSAGE_EXTENSIONS,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),a}(Po),ii=function(){function e(t){o(this,e),this._userModule=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return i(e,[{key:"setExpirationTime",value:function(e){this.expirationTime=e}},{key:"getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserProfile"),o=e.userIDList;e.fromAccount=this._userModule.getMyAccount(),o.length>100&&(Je.w("".concat(n," ").concat(an(100))),o.length=100);for(var a,i=[],s=[],r=0,c=o.length;r<c;r++)a=o[r],this._userModule.isMyFriend(a)&&this._contains(a)?s.push(this._getProfileFromMap(a)):i.push(a);if(0===i.length)return Oo(s);e.toAccount=i;var u=e.bFromGetMyProfile||!1,l=[];e.toAccount.forEach((function(e){l.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=l;var d=new Xo("getUserProfile");return d.setMessage(o.length>5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:Uo.GET_USER_PROFILE,requestData:e}).then((function(e){d.setNetworkType(t._userModule.getNetworkType()).end(),Je.i("".concat(n," ok"));var o=t._handleResponse(e).concat(s);return No(u?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount(),t="".concat(this._n,".getMyProfile");if(Je.l("".concat(t," myAccount:").concat(e)),this._fill(),this._contains(e)){var n=this._getProfileFromMap(e);return Je.d("".concat(t," from cache, myProfile:").concat(JSON.stringify(n))),Oo(n)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!vt(t))return[];for(var n=[],o=Date.now(),a=0,i=t.length;a<i;a++){var s=t[a],r=s.to,c=s.profileItem;if("@TLS#NOT_FOUND"!==r&&""!==r){var u=this._update(r,this._getLatestProfileFromResponse(r,c)).latestProfile;n.push(u)}}return Je.l("".concat(this._n,"._handleResponse cost:").concat(un(o))),n}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={userID:e,profileCustomField:[]};if(!pn(t))for(var o=0,a=t.length;o<a;o++)if(t[o].tag.indexOf("Tag_Profile_Custom")>-1)n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case Xe.NICK:n.nick=t[o].value;break;case Xe.GENDER:n.gender=t[o].value;break;case Xe.BIRTHDAY:n.birthday=t[o].value;break;case Xe.LOCATION:n.location=t[o].value;break;case Xe.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Xe.ALLOWTYPE:n.allowType=t[o].value;break;case Xe.LANGUAGE:n.language=t[o].value;break;case Xe.AVATAR:n.avatar=t[o].value;break;case Xe.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Xe.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Xe.LEVEL:n.level=t[o].value;break;case Xe.ROLE:n.role=t[o].value;break;default:Je.w("".concat(this._n,"._getLatestProfileFromResponse unknown tag:"),t[o].tag,t[o].value)}return n}},{key:"updateMyProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("updateMyProfile");if(e.nick&&!1===this._userModule.filterProfanity("nick",e))return Go({code:Ao.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity("selfSignature",e))return Go({code:Ao.PROFANITY_FOUND});var o=new Xo("updateMyProfile");o.setMessage(JSON.stringify(e));var a=(new Ca).validate(e);if(!a.valid)return o.setCode(Ao.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(a.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Je.e("".concat(n," info:").concat(a.tips)),Go({code:Ao.UPDATE_PROFILE_INVALID_PARAM});var i=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&("profileCustomField"===s?e.profileCustomField.forEach((function(e){i.push({tag:e.key,value:e.value})})):i.push({tag:Xe[s.toUpperCase()],value:e[s]}));if(0===i.length){var r=new ko({code:Ao.UPDATE_PROFILE_NO_KEY});return o.setError(r,!0,this._userModule.getNetworkType()).end(),Je.e("".concat(n," failed. error:"),r),Go(r)}var c=this._userModule.getMyAccount();return this._userModule.request({protocolName:Uo.UPDATE_MY_PROFILE,requestData:{fromAccount:c,profileItem:i}}).then((function(a){o.setNetworkType(t._userModule.getNetworkType()).end(),Je.i("".concat(n," ok"));var i=t._update(c,e),s=i.isProfileUpdated,r=i.latestProfile;return!0===s&&t._userModule.emitOuterEvent(E.PROFILE_UPDATED,[r]),Oo(r)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!pn(t)){var n,o=t.length;Je.d("".concat(this._n,".onProfileModified count:").concat(o," dataList:"),e.dataList);for(var a=[],i=0;i<o;i++){n=t[i].userID;var s=this._update(n,this._getLatestProfileFromResponse(n,t[i].profileList)),r=s.isProfileUpdated,c=s.latestProfile;!0===r&&a.push(c)}a.length>0&&(this._userModule.emitInnerEvent(ha.PROFILE_UPDATED,a),this._userModule.emitOuterEvent(E.PROFILE_UPDATED,a))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n<o;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);Je.l("".concat(this._n,"._fill from cache, size:").concat(this.accountProfileMap.size))}}},{key:"_update",value:function(e,t){var n,o=!1,a=Date.now();this._contains(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&!0===Ut(n.profileCustomField,t.profileCustomField)&&(n.lastUpdatedTime=a,o=!0),Et(n,t,["profileCustomField"])>0&&(n.lastUpdatedTime=a,o=!0)):(n=new Ca(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=a,o=!0,this.accountProfileMap.set(e,n)));return this._flush(e===this._userModule.getMyAccount()),!0===o&&Je.l("".concat(this._n,"._update account:").concat(e," isProfileUpdated:").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=m(this.accountProfileMap.values()),n=this._userModule.getStorageModule();Je.d("".concat(this._n,"._flush length:").concat(t.length," flushAtOnce:").concat(e)),n.setItem(this.TAG,t,e)}},{key:"_contains",value:function(e){return this.accountProfileMap.has(e)}},{key:"_getProfileFromMap",value:function(e){return this.accountProfileMap.get(e)}},{key:"_getCachedProfiles",value:function(){var e=this._userModule.getStorageModule().getItem(this.TAG);return pn(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,o,a=[],i=0,s=e.length;i<s;i++)n=(t=e[i]).userID,this._userModule.isMyFriend(n)&&(this._contains(n)?(o=this._getProfileFromMap(n),Et(o,t)>0&&a.push(n)):a.push(t.userID));0!==a.length&&(Je.i("".concat(this._n,".onConversationsProfileUpdated toAccountList:").concat(a)),this.getUserProfile({userIDList:a}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._contains(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"getUserNickAndAvatar",value:function(e){var t=this,n=m(new Set(e));Je.l("".concat(this._n,".getUserNickAndAvatar userIDList.length:").concat(e.length," uniqueUserIDList.length:").concat(n.length));var o=[];if(0===e.length)return Promise.resolve(o);var a=this._createUserIDListGroup(n),i=[];return a.forEach((function(e){i.push(t.getUserProfile({userIDList:e}))})),Promise.all(i).then((function(e){return e.forEach((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));o.push.apply(o,m(t))})),o}))}},{key:"_createUserIDListGroup",value:function(e){for(var t=[],n=0;n<e.length;)t.push(e.slice(n,n+=100));return t}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),e}(),si=i((function e(t){o(this,e),pn||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),ri=function(){function e(t){o(this,e),this._userModule=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this.startIndex=0,this.maxLimited=100,this.currentSequence=0}return i(e,[{key:"getLocalBlacklist",value:function(){return m(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._n,".getBlacklist"),n={fromAccount:this._userModule.getMyAccount(),maxLimited:this.maxLimited,startIndex:0,lastSequence:this.currentSequence},o=new Xo("getBlacklist");return this._userModule.request({protocolName:Uo.GET_BLACKLIST,requestData:n}).then((function(n){var a=n.data,i=a.blackListItem,s=a.currentSequence,r=pn(i)?0:i.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("count:".concat(r)).end(),Je.i("".concat(t," ok")),e.currentSequence=s,e._handleResponse(i,!0),e._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];o.setError(n,a,i).end()})),Je.e("".concat(t," failed. error:"),n),Go(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n=new Xo("addToBlacklist"),o="".concat(this._n,".addBlacklist"),a=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===a){var i=Ao.CANNOT_ADD_SELF_TO_BLACKLIST,s=this._userModule.getErrorMessage(i);n.setCode(i).setMessage(s).setNetworkType(this._userModule.getNetworkType()).end();var r=new ko({code:i});return Je.e("".concat(o," failed. error:"),r),Go(r)}return e.userIDList.includes(a)&&(e.userIDList=e.userIDList.filter((function(e){return e!==a}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Uo.ADD_TO_BLACKLIST,requestData:e}).then((function(a){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Je.i("".concat(o," ok")),t._handleResponse(a.resultItem,!0),No(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=v(t,2),a=o[0],i=o[1];n.setError(e,a,i).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"_handleResponse",value:function(e,t){if(!pn(e))for(var n,o,a,i=0,s=e.length;i<s;i++)o=e[i].to,a=e[i].resultCode,(mt(a)||0===a)&&(t?((n=this._blacklistMap.has(o)?this._blacklistMap.get(o):new si).userID=o,!pn(e[i].addBlackTimeStamp)&&(n.timeStamp=e[i].addBlackTimeStamp),this._blacklistMap.set(o,n)):this._blacklistMap.has(o)&&(n=this._blacklistMap.get(o),this._blacklistMap.delete(o)));Je.l("".concat(this._n,"._handleResponse total:").concat(this._blacklistMap.size," bAdd:").concat(t))}},{key:"deleteBlacklist",value:function(e){var t=this,n="".concat(this._n,".deleteBlacklist"),o=new Xo("removeFromBlacklist");return e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Uo.REMOVE_FROM_BLACKLIST,requestData:e}).then((function(a){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Je.i("".concat(n," ok")),t._handleResponse(a.data.resultItem,!1),No(m(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t=0,n=e.length;t<n;t++){var o=e[t];this._blacklistMap.has(o)&&this._blacklistMap.delete(o)}var a=e.length;a>0&&(Je.l("".concat(this._n,".onAccountDeleted count:").concat(a," ").concat(a<30?"userIDList:".concat(e):"")),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,a=e.length;o<a;o++)t=e[o],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new si({userID:t})),n.push(t));n.length>0&&(Je.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,m(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),ci=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,a,i=0,s=0;a=t.charAt(s++);~a&&(o=i%4?64*o+a:a,i++%4)?n+=String.fromCharCode(255&o>>(-2*i&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);try{return decodeURIComponent(escape(n))}catch(r){return""}},ui=function(){function e(t){o(this,e),this._userModule=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userModule.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}return i(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._userModule.getCloudConfig("status_query_count"),t=this._userModule.getCloudConfig("status_sub_count"),n=this._userModule.getCloudConfig("status_unsub_count");Je.l("".concat(this._n,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),mt(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),mt(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),mt(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(io),a=t.map((function(e){var t=e.to,a=e.statusType,i=e.customStatus,s=ci(i);return t===n&&o.setCustomStatus(s),{userID:t,statusType:a,customStatus:s}}));this._userModule.emitOuterEvent(E.USER_STATUS_UPDATED,a)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._n,".setSelfStatus");if(!1===this._userModule.filterProfanity("customStatus",e))return Go({code:Ao.PROFANITY_FOUND});var o=new Xo("setSelfStatus"),a=e.customStatus;return this._userModule.request({protocolName:Uo.SET_SELF_STATUS,requestData:{customStatus:a}}).then((function(e){return o.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(a)).end(),Je.l("".concat(n," ok. customStatus:").concat(a)),t._userModule.getModule(io).setCustomStatus(a),No({userID:t._userModule.getMyUserID(),statusType:1,customStatus:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),a=n[0],i=n[1];o.setError(e,a,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._n,".").concat("getUserStatus"),o=e.userIDList,a=void 0===o?[]:o,i=this._userModule.getMyUserID(),s=m(a),r=void 0,c=s.indexOf(i);if(c>-1){s.splice(c,1);var u=this._userModule.getModule(io).getCustomStatus();r={userID:i,statusType:1,customStatus:u}}if(0===s.length)return Oo({successUserList:[r],failureUserList:[]});if(!this._userModule.canIUse(K.USER_STATUS))return this._userModule.cannotUseCommercialAbility("getUserStatus");s.length>this.MAX_QUERY_USER_COUNT&&(Je.w("".concat(n," ").concat(an(this.MAX_QUERY_USER_COUNT))),s=a.slice(0,this.MAX_QUERY_USER_COUNT));var l=new Xo("getUserStatus");return this._userModule.request({protocolName:Uo.GET_USER_STATUS,requestData:{userIDList:s}}).then((function(e){var o=e.data,i=o.successUserList,s=void 0===i?[]:i,c=o.failureUserList,u=void 0===c?[]:c,d=s.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:ci(o)}})),p=u.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:pn(n)?t:n,code:o,message:a}}));mt(r)||d.unshift(r);var _="userID count:".concat(a.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(_)).end(),Je.l("".concat(n," ok. ").concat(_,".")),No({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];l.setMessage("userID count:".concat(a.length)).setError(e,o,i).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this,n="subscribeUserStatus";if(!this._userModule.canIUse(K.USER_STATUS))return this._userModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=e.userIDList,i=void 0===a?[]:a,s=m(i);s.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Je.w("".concat(o," ").concat(an(this.MAX_SUBSCRIBE_USER_COUNT))),s=i.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var r=new Xo(n),c="userID count:".concat(i.length);return Je.l("".concat(o," ").concat(c)),this._userModule.request({protocolName:Uo.SUBSCRIBE_USER_STATUS,requestData:{userIDList:s}}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:pn(n)?t:n,code:o,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(c," fail count:").concat(a.length)).end(),Je.l("".concat(o," ok. fail count:").concat(a.length,".")),No({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setMessage("".concat(c)).setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this,n="unsubscribeUserStatus";if(!this._userModule.canIUse(K.USER_STATUS))return this._userModule.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=(e||{}).userIDList,i=void 0===a?[]:a,s=m(i);i.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Je.w("".concat(o," ").concat(an(this.MAX_UNSUBSCRIBE_USER_COUNT))),s=i.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var r=new Xo(n),c="userID count:".concat(i.length);Je.l("".concat(o," ").concat(c));var u={userIDList:s};return 0===s.length&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:Uo.UNSUBSCRIBE_USER_STATUS,requestData:u}).then((function(e){var n=e.data.failureUserList,a=(void 0===n?[]:n).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,a=e.errorInfo;return{userID:pn(n)?t:n,code:o,message:a}}));return r.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(c," fail count:").concat(a.length)).end(),Je.l("".concat(o," ok. fail count:").concat(a.length,".")),No({failureUserList:a})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setMessage("".concat(c)).setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),li=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="UserModule",a._profileHandler=new ii(g(a)),a._blacklistHandler=new ri(g(a)),a._userStatusHandler=new ui(g(a)),a.getInnerEmitterInstance().on(ha.A2KEY_AND_TINYID_UPDATED,a.onContextUpdated,g(a)),a}return i(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){Je.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:Xe.NICK,value:e},{tag:Xe.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!pn(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,m(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,m(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyNick",value:function(){return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(so)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(yo);if(!n)return!0;var o=n.filterText(t[e],z),a=o.isAllowedToSend,i=o.modifiedText;return!0===a&&(t[e]=i,!0)}},{key:"isMyFriend",value:function(e){var t=this.getModule(no);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getUserNickAndAvatar",value:function(e){return this._profileHandler.getUserNickAndAvatar(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return Oo(e)}},{key:"addBlacklist",value:function(e){return this._blacklistHandler.addBlacklist(e)}},{key:"deleteBlacklist",value:function(e){return this._blacklistHandler.deleteBlacklist(e)}},{key:"onUserStatusUpdated",value:function(e){this._userStatusHandler.onUserStatusUpdated(e)}},{key:"setSelfStatus",value:function(e){return this._userStatusHandler.setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._userStatusHandler.getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._userStatusHandler.subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._userStatusHandler.unsubscribeUserStatus(e)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(Po),di=function(){function e(t,n){o(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="3.2.3",this._a2Key="",this._tinyID="",this._customStatus="",this._contentType="json",this._unlimitedAVChatRoom=n.unlimitedAVChatRoom,this._scene=n.scene||"",this._oversea=n.oversea,this._instanceID=n.instanceID,this._statusInstanceID=0,this._isDevMode=n.devMode,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy,this._applicationID=0,this._isUsingChatCore=!1}return i(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIndonesiaSite",value:function(){return this._SDKAppID>=8e7&&this._SDKAppID<9e7||this._SDKAppID>=178e7&&this._SDKAppID<179e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||e>=2e7&&e<9e7||e>=172e7&&e<179e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"isUsingChatCore",value:function(){return this._isUsingChatCore}},{key:"setUsingChatCore",value:function(e){this._isUsingChatCore=e}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Ue?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"setApplicationID",value:function(e){this._applicationID=e}},{key:"getApplicationID",value:function(){return this._applicationID}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,a=[];ce&&(a=Object.keys(le)),ue&&(a=re?Object.keys(uni):Object.keys(window));for(var i=0,s=a.length;i<s;i++)if(a[i].toLowerCase().includes("uikit")){e=!0;break}if(a=null,ce&&!It(le.createGamePortal)&&It(getApp)&&!mt(getApp())){var r=getApp().globalData;ft(r)&&!0===r.isTUIKit&&(t=!0)}!0===this._m.getModule(so).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(n=!0);var c=null;if($&&!ne&&"undefined"==typeof uni&&__wxConfig&&(c=__wxConfig.pages),te&&"undefined"==typeof uni&&__qqConfig&&(c=__qqConfig.pages),vt(c)&&c.length>0){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){o=!0;break}c=null}return e||t||n||o}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),e}(),pi={"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},_i=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="SignModule",a._helloInterval=120,a._lastLoginTs=0,a._lastWsHelloTs=0,a._isWebUniapp=0,fa.mixin(g(a)),a}return i(n,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"login",value:function(e){var t="";if(this.isLoggedIn()){var n=this.getMyUserID();return(t=this.getErrorMessage("RepeatLogin",n))&&Je.w(t),Oo({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return this.outputWarning("LoggingIn",e.userID),Go({code:Ao.REPEAT_LOGIN});Je.l("".concat(this._n,".login userID:").concat(e.userID));var o=this._checkLoginInfo(e);if(0!==o.code)return Go(o);var a=this.getModule(io),i=e.userID,s=e.userSig;return a.setUserID(i),a.setUserSig(s),this.getModule(_o).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var e=this,t=this.getModule(io),n=t.getScene(),o=0,a=n;n&&n.startsWith("k-")&&(a=pi[n],n="tuikit");var i=new Xo("login");i.setMessage("".concat(a)).setMoreMessage("identifier:".concat(this.getMyUserID()));var s="tuikit"===n;re?s?3===a||4===a||5===a||6===a?i.setUIPlatform(31):9===a||10===a||11===a||12===a?i.setUIPlatform(32):i.setUIPlatform(4):i.setUIPlatform(3):ce?"tuikit"===n?i.setUIPlatform(12):i.setUIPlatform(11):ue&&(Ue?"flutter_web_uikit"===n?i.setUIPlatform(21):i.setUIPlatform(20):this._isReactUIKit()?Pe?i.setUIPlatform(25):i.setUIPlatform(24):s?1===a||2===a?i.setUIPlatform(29):7===a||8===a?i.setUIPlatform(30):Pe?i.setUIPlatform(17):i.setUIPlatform(14):Pe?i.setUIPlatform(16):i.setUIPlatform(13));var r=this.getModule(Io);if(r.canIUseOfflinePush()){this._isWebUniapp=r.getUniAppPlatform();var c=this._getStatusInstanceID();t.setStatusInstanceID(c),this.getModule(_o).updateProtocolConfig(),o=r.getDeviceBrand()}var u="".concat(this._n,"._login");return this._lastLoginTs=Date.now(),this.request({protocolName:Uo.LOGIN,requestData:{deviceBrand:o,isWebUniapp:this._isWebUniapp}}).then((function(o){e._lastLoginTs=0;var a=Date.now(),s=null,r=o.data,c=r.a2Key,l=r.tinyID,d=r.helloInterval,p=r.instanceID,_=r.timeStamp,g=r.customStatus,h=void 0===g?"":g,f=r.purchaseBits,v=1e3*_,m=a-i.getStartTs(),M=v+parseInt(m/2)-a,I=i.getStartTs()+M;if(i.start(I),function(e,t){Ve=t;var n=new Date;n.setTime(e),Je.i("baseTime from server:".concat(n," offset:").concat(Ve))}(v,M),!l)throw s=new ko({code:Ao.NO_TINYID}),i.setError(s,!0,e.getNetworkType()).end(),s;if(!c)throw s=new ko({code:Ao.NO_A2KEY}),i.setError(s,!0,e.getNetworkType()).end(),s;var y=ci(h),T="scene:".concat(n," helloInterval:").concat(d," instanceID:").concat(p," timeStamp:").concat(_," offset:").concat(M," customStatus:").concat(y," ");Je.l("".concat(u," ok. ").concat(T));var C="",D="";if($&&It(le.getAccountInfoSync)){var E=le.getAccountInfoSync().miniProgram;E&&(C=E.appId,D=E.envVersion)}(i.setNetworkType(e.getNetworkType()).setMoreMessage("".concat(T," href:").concat(ue?window.location.href:""," mpAppId:").concat(C," envVersion:").concat(D)).end(),t.setA2Key(c),t.setTinyID(l),t.setStatusInstanceID(p),t.setCustomStatus(y),f)&&e.getModule(Mo).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:f});e.getModule(_o).updateProtocolConfig(),e.emitInnerEvent(ha.A2KEY_AND_TINYID_UPDATED),e._helloInterval=d,e.triggerReady();var S=e.getModule(Io);return S.canIUseOfflinePush()&&(uni.setStorageSync("timUniAppInstanceID",p),S.init()),e._fetchCloudControlConfig(),e.getModule(yo).init(),o})).catch((function(t){return e.probeNetwork().then((function(e){var n=v(e,2),o=n[0],a=n[1];i.setError(t,o,a).end(!0)})),e._m.setNotReadyReason(Ao.LOGIN_FAILED),Je.e("".concat(u," failed. error:"),t),e._lastLoginTs=0,e._m.onLoginFailed(),Go(t)}))}},{key:"logout",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return Go({code:Ao.USER_NOT_LOGGED_IN});var n=new Xo("logout");n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0);var o="".concat(this._n,".logout");return Je.i("".concat(o," type:").concat(t)),0===t&&this._m.setNotReadyReason(Ao.LOGGED_OUT),this.request({protocolName:Uo.LOGOUT,requestData:{type:t}}).then((function(){return e.resetReady(),Oo({})})).catch((function(t){return Je.e("".concat(o," error:"),t),e.resetReady(),Oo({})}))}},{key:"getLoginUser",value:function(){return this.isLoggedIn()?this.getMyUserID():""}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(ho).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:Uo.HELLO,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){Je.w("".concat(e._n,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return pn(this.getModule(io).getSDKAppID())?t=Ao.NO_SDKAPPID:pn(e.userID)?t=Ao.NO_IDENTIFIER:pn(e.userSig)&&(t=Ao.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return ue&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new Xo("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Je.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(Ao.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new Xo("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Je.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(Ao.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:"onUserSigExpired",value:function(){new Xo("kickedOut").setNetworkType(this.getNetworkType()).setMessage(S.KICKED_OUT_USERSIG_EXPIRED).end(!0),Je.w("".concat(this._n,".onUserSigExpired userID:").concat(this.getMyUserID())),0!==this.getModule(io).getStatusInstanceID()&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(Ao.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){(new Xo("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(S.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Je.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(io).getStatusInstanceID())&&(this.emitOuterEvent(E.KICKED_OUT,{type:S.KICKED_OUT_REST_API}),this._m.setNotReadyReason(Ao.KICKED_OUT_REST_API),this._m.reset(),this.getModule(go).onRestApiKickedOut())}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),n}(Po);function gi(){return null}var hi=function(){function e(t){o(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return i(e,[{key:"_errorTolerantHandle",value:function(){ce||!mt(window)&&this._canIUseCookies()||(this.getItem=gi,this.setItem=gi,this.removeItem=gi,this.clear=gi)}},{key:"onCheckTimer",value:function(e){if(e%20==0){if(0===this._storageQueue.size)return;this._doFlush()}}},{key:"_doFlush",value:function(){try{var e,t=D(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2),o=n[0],a=n[1];this._setStorageSync(this._getKey(o),a)}}catch(i){t.e(i)}finally{t.f()}this._storageQueue.clear()}catch(s){Je.w("".concat(this._n,"._doFlush error:"),s)}}},{key:"_getPrefix",value:function(){var e=this._m.getModule(io);return"TIM_".concat(e.getSDKAppID(),"_").concat(e.getUserID(),"_")}},{key:"_getKey",value:function(e){return"".concat(this._getPrefix()).concat(e)}},{key:"getItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return Je.w("".concat(this._n,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var a=o?this._getKey(e):e;this._setStorageSync(a,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{ce?le.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Je.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){Je.w("".concat(this._n,".removeItem error:"),o)}}},{key:"getSize",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"b";try{var o={size:0,limitSize:5242880,unit:n};if(Object.defineProperty(o,"leftSize",{enumerable:!0,get:function(){return o.limitSize-o.size}}),ce&&(o.limitSize=1024*le.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(ce){var a=le.getStorageInfoSync(),i=a.keys;i.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var s in localStorage)localStorage.hasOwnProperty(s)&&(o.size+=localStorage.getItem(s).length+s.length);return this._convertUnit(o)}catch(r){Je.w("".concat(this._n," error:"),r)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){ce?ae?my.setStorageSync({key:e,data:t}):le.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return ce?ae?my.getStorageSync({key:e}).data:le.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){ce?ae?my.removeStorageSync({key:e}):le.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._doFlush()}}]),e}(),fi=function(){function e(t){o(this,e),this._n="SSOLogBody",this._report=[]}return i(e,[{key:"pushIn",value:function(e){Je.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;vt(e)&&0!==e.length&&(Je.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,m(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),vi=function(e){var t=e.getModule(io);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:He()}},mi=function(e){r(a,e);var n=f(a);function a(e){var t;o(this,a),(t=n.call(this,e))._n="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new fi,t.MIN_THRESHOLD=20,t.MAX_THRESHOLD=100,t.WAITING_TIME=6e4,t.REPORT_LEVEL=[4,5,6],t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._lastReportTime=Date.now();var i=t.getInnerEmitterInstance();return i.on(ha.A2KEY_AND_TINYID_UPDATED,t._onLoginSuccess,g(t)),i.on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"reportAtOnce",value:function(){this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(so),n=t.getItem(this.TAG,!1);!pn(n)&&It(n.forEach)&&(Je.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),a=this.getCloudConfig("evt_rpt_tinyid_wl");mt(e)||(this.MIN_THRESHOLD=Number(e)),mt(t)||(this.WAITING_TIME=Number(t)),mt(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),mt(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),mt(a)||(this.REPORT_TINYID_WHITELIST=a.split(","))}},{key:"pushIn",value:function(e){e instanceof Xo&&(e.updateTimeStamp(),this._reportBody.pushIn(e),this._reportBody.getLogsNumInMemory()>=this.MIN_THRESHOLD&&this._report())}},{key:"onCheckTimer",value:function(){Date.now()<this._lastReportTime+this.WAITING_TIME||this._reportBody.isEmpty()||this._report()}},{key:"_filterLogs",value:function(e){var t=this,n=this.getModule(io),o=n.getSDKAppID(),a=n.getTinyID();return Qt(this.REPORT_SDKAPPID_BLACKLIST,o)&&!Zt(this.REPORT_TINYID_WHITELIST,a)?[]:e.filter((function(e){return t.REPORT_LEVEL.includes(e.level)}))}},{key:"_report",value:function(){var e=this;if(!this._reportBody.isEmpty()){var n=this._reportBody.getLogsInMemory(),o=this._filterLogs(n);if(0!==o.length){var a={header:vi(this),event:o};this.request({protocolName:Uo.SSO_STAT,requestData:t({},a)}).then((function(){e._lastReportTime=Date.now()})).catch((function(t){Je.w("".concat(e._n,"._report failed. networkType:").concat(e.getNetworkType()," error:"),t),e._lastReportTime=Date.now(),e._reportBody.backfill(n),e._reportBody.getLogsNumInMemory()>e.MAX_THRESHOLD&&e._flushAtOnce()}))}else this._lastReportTime=Date.now()}}},{key:"_flushAtOnce",value:function(){var e=this.getModule(so),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");if(pn(t))Je.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var a=n.concat(t);a.length>this.MAX_THRESHOLD&&(a=a.slice(0,this.MAX_THRESHOLD)),Je.l("".concat(o," count:").concat(a.length)),e.setItem(this.TAG,a,!0,!1)}}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),a}(Po),Mi="none",Ii="online",yi=[Ao.OVER_FREQUENCY_LIMIT,Ao.OPEN_SERVICE_OVERLOAD_ERROR],Ti=function(){function e(t){o(this,e),this._m=t,this._networkType="",this._n="NetMonitorModule",this.MAX_WAIT_TIME=3e3,this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null}return i(e,[{key:"start",value:function(){var e=this;ce?(le.getNetworkType({success:function(t){e._networkType=t.networkType||t.subtype||"",t.networkType===Mi?Je.w("".concat(e._n,".start no network, please check!")):Je.i("".concat(e._n,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),le.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Ii,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window&&(window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback)))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:Ii})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Mi})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o="".concat(this._n,"._onNetworkStatusChange"),a=!1;t?(Je.i("".concat(o," previous:").concat(this._networkType," current:").concat(n)),this._networkType!==n&&(a=!0,this._m.getModule(go).reConnect(!0))):this._networkType!==n&&(a=!0,Je.w("".concat(o," no network, please check!")),this._m.getModule(go).offline());a&&(new Xo("networkChange").setMessage("isConnected:".concat(t," previousNetworkType:").concat(this._networkType," networkType:").concat(n)).end(),this._networkType=n)}},{key:"probe",value:function(e){var t=this;if(!mt(e)&&yi.includes(e.code))return Promise.resolve([!0,this._networkType]);var n="".concat(this._n,".probe");return new Promise((function(e,o){ce?le.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===Mi?(Je.w("".concat(n," no network, please check!")),e([!1,o.networkType])):(Je.i("".concat(n," networkType:").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===Mi?e([!1,Mi]):e([!0,Ii])}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),ce?null!==this._mpNetworkStatusCallback&&(le.offNetworkStatusChange&&(se||ne?le.offNetworkStatusChange(this._mpNetworkStatusCallback):le.offNetworkStatusChange()),this._mpNetworkStatusCallback=null):window&&(null!==this._webOnlineCallback&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),null!==this._onWebOffline&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null))}}]),e}();var Ci=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,o,i,s){if("function"!=typeof o)throw new TypeError("The listener must be a function");var r=new a(o,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],r]:e._events[c].push(r):(e._events[c]=r,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function r(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),r.prototype.eventNames=function(){var e,o,a=[];if(0===this._eventsCount)return a;for(o in e=this._events)t.call(e,o)&&a.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},r.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var a=0,i=o.length,s=new Array(i);a<i;a++)s[a]=o[a].fn;return s},r.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},r.prototype.emit=function(e,t,o,a,i,s){var r=n?n+e:e;if(!this._events[r])return!1;var c,u,l=this._events[r],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,o),!0;case 4:return l.fn.call(l.context,t,o,a),!0;case 5:return l.fn.call(l.context,t,o,a,i),!0;case 6:return l.fn.call(l.context,t,o,a,i,s),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,_=l.length;for(u=0;u<_;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,o);break;case 4:l[u].fn.call(l[u].context,t,o,a);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];l[u].fn.apply(l[u].context,c)}}return!0},r.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},r.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},r.prototype.removeListener=function(e,t,o,a){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return s(this,i),this;var r=this._events[i];if(r.fn)r.fn!==t||a&&!r.once||o&&r.context!==o||s(this,i);else{for(var c=0,u=[],l=r.length;c<l;c++)(r[c].fn!==t||a&&!r[c].once||o&&r[c].context!==o)&&u.push(r[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},r.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&s(this,t)):(this._events=new o,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=n,r.EventEmitter=r,e.exports=r})),Di=["requestSnapshotUrl"],Ei=9999,Si=1e4,Ni=function(e){r(a,e);var n=f(a);function a(e){var t;o(this,a),(t=n.call(this,e))._n="UploadModule",t.TIMUploadPlugin=null,t.timUploadPlugin=null,t.COSSDK=null,t._cosUploadMethod=null,t.expiredTimeLimit=600,t.appid=0,t.bucketName="",t.ciUrl="",t.directory="",t.downloadUrl="",t.uploadUrl="",t.region="ap-shanghai",t.cos=null,t.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},t.uploadFileType="",t.duration=900,t.tryCount=0,t.UPLOAD_SIZE_LIMIT={A:20971520,F:104857600,I:20971520,V:104857600},t.isSimpleCos=!1;var i=t.getInnerEmitterInstance();return i.on(ha.A2KEY_AND_TINYID_UPDATED,t._init,g(t)),i.on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"_init",value:function(){var e=this.getModule(lo);if(this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var t=ce?"cos-wx-sdk":"cos-js-sdk";this.COSSDK=e.getPlugin(t),this.COSSDK?(this._getAuthorizationKey(),this.outputWarning("CosReplacement",t)):this.outputWarning("PluginUndetected")}}},{key:"_onCloudConfigUpdated",value:function(){var e="".concat(this._n,"._onCloudConfigUpdated"),t=this.getCloudConfig("upload_size_limit"),n=this.getCloudConfig("simple_cos");if(Je.l("".concat(e," uploadSizeLimit:").concat(t," simpleCos:").concat(n)),!mt(t))try{var o=JSON.parse(t);this.UPLOAD_SIZE_LIMIT={A:o.a?1048576*parseInt(o.a):this.UPLOAD_SIZE_LIMIT.A,F:o.f?1048576*parseInt(o.f):this.UPLOAD_SIZE_LIMIT.F,I:o.i?1048576*parseInt(o.i):this.UPLOAD_SIZE_LIMIT.I,V:o.v?1048576*parseInt(o.v):this.UPLOAD_SIZE_LIMIT.V}}catch(a){}mt(n)||(this.isSimpleCos="1"===n)}},{key:"_getAuthorizationKey",value:function(){var e=this,t="".concat(this._n,".").concat("_getAuthorizationKey"),n=new Xo("_getAuthorizationKey"),o=Math.ceil(Date.now()/1e3);this.request({protocolName:Uo.COS_SIGN,requestData:{duration:this.expiredTimeLimit}}).then((function(a){var i=a.data;Je.l("".concat(t," ok. data:"),i);var s=i.expiredTime-o;n.setMessage("requestId:".concat(i.requestId," requestTime:").concat(o," expiredTime:").concat(i.expiredTime," diff:").concat(s,"s")).setNetworkType(e.getNetworkType()).end(),!ce&&i.region&&(e.region=i.region),e.appid=i.appid,e.bucketName=i.bucketName,e.ciUrl=i.ciUrl,e.directory=i.directory,e.downloadUrl=i.downloadUrl,e.uploadUrl=i.uploadUrl,e.cosOptions={secretId:i.secretId,secretKey:i.secretKey,sessionToken:i.sessionToken,expiredTime:i.expiredTime},Je.l("".concat(t," ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.w("".concat(t," failed. error:"),o)}))}},{key:"_getCosPreSigUrl",value:function(e){var t=this,n="".concat(this._n,".").concat("_getCosPreSigUrl"),o=Math.ceil(Date.now()/1e3),a=new Xo("_getCosPreSigUrl"),i={uploadMethod:e.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:e.userID,conversationType:e.conversationType,uploadConfig:[{fileID:1,fileType:e.fileType,fileName:e.fileName}]},s=Uo.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(i={fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration},s=Uo.COS_PRE_SIG),this.request({protocolName:s,requestData:i}).then((function(e){t.tryCount=0;var i=e.data||{};Je.l("".concat(n," ok. isSimpleCos:").concat(t.isSimpleCos," data:"),i);var s="";if(t.isSimpleCos){var r=i.preSig[0],c=r.uploadUrl,u=r.fileKey;s="uploadIP:".concat(i.uploadIP," uploadUrl:").concat(c," fileKey:").concat(u," cost:").concat(un(o))}else s="requestId:".concat(i.requestId," expiredTime:").concat(i.expiredTime," diff:").concat(i.expiredTime-o,"s");return a.setMessage(s).setNetworkType(t.getNetworkType()).end(),i})).catch((function(o){return-1===o.code&&(o.code=Ao.COS_GET_SIG_FAIL),t.probeNetwork().then((function(e){var t=v(e,2),n=t[0],i=t[1];a.setError(o,n,i).end()})),Je.w("".concat(n," failed. error:"),o),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,Go({code:Ao.COS_GET_SIG_FAIL}))}))}},{key:"_initUploaderMethod",value:function(){var e=this;if(this.TIMUploadPlugin)return this.timUploadPlugin=new this.TIMUploadPlugin,void(this._cosUploadMethod=function(t,n){e.timUploadPlugin.uploadFile(t,n)});this.appid&&(this.cos=ce?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=ce?function(t,n){e.cos.postObject(t,n)}:function(t,n){e.cos.uploadFiles(t,n)})}},{key:"onCheckTimer",value:function(e){this.COSSDK&&(this.TIMUploadPlugin||this.isLoggedIn()&&e%60==0&&Math.ceil(Date.now()/1e3)>=this.cosOptions.expiredTime-120&&this._getAuthorizationKey())}},{key:"_getAuthorization",value:function(e,t){t({TmpSecretId:this.cosOptions.secretId,TmpSecretKey:this.cosOptions.secretKey,XCosSecurityToken:this.cosOptions.sessionToken,ExpiredTime:this.cosOptions.expiredTime})}},{key:"upload",value:function(e){if(!0===e._relayFlag)return Promise.resolve();var t=this.getModule(mo);switch(e.type){case S.MSG_IMAGE:return t.addTotalCount(Ho),this._uploadImage(e);case S.MSG_FILE:return t.addTotalCount(Ho),this._uploadFile(e);case S.MSG_AUDIO:return t.addTotalCount(Ho),this._uploadAudio(e);case S.MSG_VIDEO:return t.addTotalCount(Ho),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(Qn),a=e.getElements()[0],i=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:i.payload.file,to:i.to,message:e,onProgress:function(e){if(a.updatePercent(e),It(i.onProgress))try{i.onProgress(e)}catch(t){return Go({code:Ao.MSG_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var i=o.location,s=o.fileType,r=o.fileSize,c=o.width,u=o.height,l=o.smallImageUrl,d=o.smallImageWidth,p=o.smallImageHeight,_=o.largeImageUrl,g=o.largeImageWidth,h=o.largeImageHeight,f=o.imageInfoArray,v=n.isPrivateNetWork()?i:Gt(i);a.updateImageFormat(s);var m,M,I={size:r,url:v,width:c,height:u};if(f&&f.length>0)for(var y=0;y<f.length;y++){var T=f[y];1===T.type?m=T:2===T.type?M=T:I=t(t({},I),T)}else l&&_?(m={url:l,width:d,height:p},M={url:_,width:g,height:h}):(m=jt({originUrl:v,originWidth:c,originHeight:u,min:198}),M=jt({originUrl:v,originWidth:c,originHeight:u,min:720}));return a.updateImageInfoArray([t({},I),t({},M),t({},m)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(Qn),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:a.payload.file,to:a.to,message:e,onProgress:function(e){if(o.updatePercent(e),It(a.onProgress))try{a.onProgress(e)}catch(t){return Go({code:Ao.MSG_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,i=t.isPrivateNetWork()?a:Gt(a);return o.updateFileUrl(i),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(Qn),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:a.payload.file,to:a.to,message:e,onProgress:function(e){if(o.updatePercent(e),It(a.onProgress))try{a.onProgress(e)}catch(t){return Go({code:Ao.MSG_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,i=t.isPrivateNetWork()?a:Gt(a);return o.updateAudioUrl(i),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(Qn),o=e.getElements()[0],a=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:a.payload.file,to:a.to,message:e,onProgress:function(e){if(o.updatePercent(e),It(a.onProgress))try{a.onProgress(e)}catch(t){return Go({code:Ao.MSG_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var a=n.location,i=n.snapshotInfo,s=t.isPrivateNetWork()?a:Gt(a);return o.updateVideoUrl(s),pn(i)||o.updateSnapshotInfo(i),e}))}},{key:"_checkSizeError",value:function(e){var t="";return"A"===e?t="audio":"I"===e?t="image":"V"===e?t="video":"F"===e&&(t="file"),Go({code:Ao["MSG_".concat(e,"_SIZE_LIMIT")],message:this.getErrorMessage("UploadSizeLimit",t,"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576,"MB"))})}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file||this._isEmptyFileList(e.file.files))return Go({code:Ao.MSG_I_SELECT_F_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var a=null;return this._setUploadFileType(Ma),this.uploadByCOS(e).then((function(e){if(a=e,t.isPrivateNetWork())return Bt(e.location);if(vt(a.imageInfoArray)){var n=a.imageInfoArray.find((function(e){return 3===e.type}));if(n)return n}return Bt("https://".concat(e.location))})).then((function(e){return a.width=e.width,a.height=e.height,Promise.resolve(a)}))}},{key:"_checkImageType",value:function(e){var t="";return t=ce?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),va.indexOf(t.toLowerCase())>=0||Go({code:Ao.MSG_I_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=ce?e.size:e.files[0].size)?Go({code:Ao.MSG_F_IS_EMPTY}):t<this.UPLOAD_SIZE_LIMIT.I||this._checkSizeError("I")}},{key:"doUploadFile",value:function(e){return!e.file||this._isEmptyFileList(e.file.files)?Go({code:Ao.MSG_F_SELECT_F_FIRST}):e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):0===e.file.files[0].size?Go({code:Ao.MSG_F_IS_EMPTY}):(this._setUploadFileType(Ta),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):0===e.file.videoFile.size?Go({code:Ao.MSG_F_IS_EMPTY}):-1===ma.indexOf(e.file.videoFile.type)?Go({code:Ao.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(Ia),ce?this.handleVideoUpload(t(t({},e),{},{file:e.file.videoFile})):ue?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new ko({code:Ao.MSG_V_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):0===e.file.size?Go({code:Ao.MSG_F_IS_EMPTY}):(this._setUploadFileType(ya),this.uploadByCOS(e)):Go({code:Ao.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t=this;if(!It(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),Go({code:Ao.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new Xo("upload"),o="".concat(this._n,".uploadByCOS"),a=Date.now(),i=this._getFile(e);return new Promise((function(s,r){var c=ce?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),u=t;t._cosUploadMethod(c,(function(e,c){var l=Object.create(null);if(c){if(e||vt(c.files)&&c.files[0].error){var d=new ko({code:Ao.MSG_F_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),Je.l("".concat(o," failed. error:"),c.files[0].error),403===c.files[0].error.statusCode&&(Je.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void r(d)}l.fileName=i.name,l.fileSize=i.size,l.fileType=i.type.slice(i.type.indexOf("/")+1).toLowerCase(),l.location=ce?c.Location:c.files[0].data.Location;var p=Date.now()-a,_=u._formatFileSize(i.size),g=u._formatSpeed(1e3*i.size/p),h="size:".concat(_," time:").concat(p,"ms speed:").concat(g);Je.l("".concat(o," success. name:").concat(i.name," ").concat(h)),s(l);var f=t.getModule(mo);return f.addCost(Ho,p),f.addFileSize(Ho,i.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var v=new ko({code:Ao.MSG_F_UPLOAD_FAIL});n.setError(v,!0,u.getNetworkType()).end(),Je.w("".concat(o," failed. error:"),e),403===e.statusCode&&(Je.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),r(v)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(a,i){var s=new Xo("upload"),r=e.requestSnapshotUrl,c=void 0===r?void 0:r,u=_(e,Di),l=Date.now();t._cosUploadMethod(u,(function(r,d){if(r||403===d.statusCode){s.setError(new ko(r),!0,t.getNetworkType()).end();var p={HttpStatusCode:Ei,CostTime:un(l,!1),error:r,url:e.url};return d.data&&d.data.uploadIP&&(p.uploadIP=d.data.uploadIP),t._uploadSSOLog(p),Je.l("".concat(n," failed, error:"),r),void i(new ko({code:Ao.MSG_F_UPLOAD_FAIL}))}var _=Object.create(null),g=d.data.location||"";t.isPrivateNetWork()||0!==g.indexOf("https://")&&0!==g.indexOf("http://")||(g=g.split("//")[1]),_.fileName=o.name,_.fileSize=o.size,_.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),_.location=g;var h=un(l,!1),f=t._formatFileSize(o.size),v=t._formatSpeed(1e3*o.size/h),m="size:".concat(f," time:").concat(h,"ms speed:").concat(v," res:").concat(JSON.stringify(d.data));Je.l("".concat(n," ok. name:").concat(o.name," ").concat(m)),s.setNetworkType(t.getNetworkType()).setMessage(m).end();var M={HttpStatusCode:d.statusCode,FileSize:o.size,CostTime:h,url:e.url};d.data&&d.data.uploadIP&&(M.uploadIP=d.data.uploadIP),t._uploadSSOLog(M);var I=t.getModule(mo);I.addCost(Ho,h),I.addFileSize(Ho,o.size);var y=[];if(u.thumbUrl&&u.largeUrl&&y.push.apply(y,[t._getSmallImageInfoByUrl(u.thumbUrl,_),t._getLargeImageInfoByUrl(u.largeUrl,_)]),t.uploadFileType===Ma&&t.isSimpleCos&&(y.push(t._getImageInfoArray(u.downloadUrl,_)),d.data.uploadIP&&y.push(t._getDownloadIP(u.downloadUrl.split("//")[1].split("/")[0],_))),c&&y.push(t._getSnapshotInfoByUrl(c,_)),y.length>0)return Promise.all(y).then((function(){a(_)}));a(_)}))}))}))}},{key:"_getDownloadIP",value:function(e,t){var n="".concat(this._n,"._getDownloadIP"),o=Date.now();return this.request({protocolName:Uo.GET_IP,requestData:{domainName:e}}).then((function(e){if(e.data&&e.data.ip){Je.l("".concat(n," ok. downloadIP:").concat(e.data.ip," cost:").concat(un(o)));var a=t.location.split("/");a[0]=e.data.ip,t.location=a.join("/")}})).catch((function(e){}))}},{key:"_getImageInfoArray",value:function(e,t){var n=this,o="".concat(this._n,"._getImageInfoArray"),a=Date.now();return this.request({protocolName:Uo.GET_IMAGE_INFO,requestData:{imageUrl:e}}).then((function(e){var n=e.data||{};return Je.l("".concat(o," ok. data: ").concat(JSON.stringify(n)," cost:").concat(un(a))),t.imageInfoArray=n.imageInfoArray,n})).catch((function(o){t.imageInfoArray=void 0,n._uploadSSOLog({HttpStatusCode:Si,CostTime:un(a,!1),url:e})}))}},{key:"_uploadSSOLog",value:function(e){if(this.isSimpleCos){var t=new Xo;t.setEventType(18),e.error?t.setError(new ko(e.error),!0,this.getNetworkType()):t.setNetworkType(this.getNetworkType());var n="HttpStatusCode:".concat(e.HttpStatusCode,"|CosRequestId:").concat(e.CosRequestId||"","|")+"FileAlreadyExist:".concat(e.FileAlreadyExist||0,"|FileSize:").concat(e.FileSize||0,"|CostTime:").concat(e.CostTime);e.uploadIP&&(n+="|FinalIP:".concat(e.uploadIP)),t.setMessage("OK").setMoreMessage(e.url).setExtension(n).end()}}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.getModule(io).getFileUploadProxy(),n=e;return t&&(n=e.replace(/^https:\/\/[^/]+/,t)),n}},{key:"_getFile",value:function(e){return vt(e.file.files)||Tt(e.file.files)?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?Xt(e/1024,1)+"KB/s":Xt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(".")),a=this._genFileName("".concat(kt(999999)).concat(o));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(a),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Je.w("onProgress callback error:",n)}},onFileFinish:function(e,t,n){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var t=this._getFile(e),n=this._genFileName(t.name),o=t.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),FilePath:o,onProgress:function(t){if(Je.l(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Je.w("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",a=0,i=this._getFile(e);if(ce){if(e.message.type===S.MSG_FILE){var s=i.name,r=s.slice(s.lastIndexOf("."));n=this._genFileName("".concat(kt(999999)).concat(r))}else n=this._genFileName(i.name);o=i.url,a=1}else{var c=i.name,u=c.slice(c.lastIndexOf("."));n=this._genFileName("".concat(kt(999999)).concat(u)),o=i,a=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:a,duration:this.duration,userID:e.message.from,conversationType:qt(e.message.conversationID)?1:2}).then((function(a){var i=t.isSimpleCos?a.preSig[0]:a,s=i.uploadUrl,r=i.downloadUrl,c=i.requestSnapshotUrl,u=void 0===c?void 0:c,l=i.thumbUrl,d=i.largeUrl,p=i.fileKey,_=a.uploadIP,g=void 0===_?"":_;return{url:t._getRawOrUploadProxyUrl(s),fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:r,requestSnapshotUrl:u,thumbUrl:l,largeUrl:d,fileKey:p,uploadIP:!t.isPrivateNetWork()&&g,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Je.w("onProgress callback error:",n),Je.e(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(Kt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,o="_getSnapshotInfoByUrl",a=new Xo(o);return this.request({protocolName:Uo.VIDEO_COVER,requestData:{platform:this.getPlatform(),coverName:this._genFileName(kt(99999)),requestSnapshotUrl:e}}).then((function(e){var i=(e.data||{}).snapshotUrl;return Je.l("".concat(n._n,".").concat(o," ok. snapshotUrl:").concat(i)),a.setMessage("snapshotUrl:".concat(i)).end(),pn(i)?{}:Bt(i).then((function(e){t.snapshotInfo={snapshotUrl:i,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Je.w("".concat(n._n,".").concat(o," failed. error:"),e),a.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return Bt(e).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return Bt(e).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:"_isEmptyFileList",value:function(e){return!(!Tt(e)||0!==e.length)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),a}(Po),ki=["downloadKey","pbDownloadKey","messageList"],Ai=function(){function e(t){o(this,e),this._n="MergerMessageHandler",this._messageModule=t}return i(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this,o="".concat(this._n,".").concat("uploadMergerMessage");Je.d("".concat(o," message:"),e,"messageBytes:".concat(t));var a=e.payload.messageList,i=a.length,s=new Xo("uploadMergerMessage");return this._messageModule.request({protocolName:Uo.UPLOAD_MERGER_MESSAGE,requestData:{messageList:a}}).then((function(e){Je.d("".concat(o," ok. response:"),e.data);var a=e.data,r=a.pbDownloadKey,c=a.downloadKey,u={pbDownloadKey:r,downloadKey:c,messageNumber:i};return s.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(i,"-").concat(t,"-").concat(c)).end(),u})).catch((function(e){throw Je.w("".concat(o," failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this,o="".concat(this._n,".").concat("downloadMergerMessage");Je.d("".concat(o," message:"),e);var a=e.payload.downloadKey,i=this._messageModule.getFileDownloadProxy(),s=new Xo("downloadMergerMessage");return s.setMessage("downloadKey:".concat(a)),this._messageModule.request({protocolName:Uo.DOWNLOAD_MERGER_MESSAGE,requestData:{downloadKey:a}}).then((function(a){if(Je.d("".concat(o," ok. response:"),a.data),It(e.clearElement)){var r=e.payload;r.downloadKey,r.pbDownloadKey,r.messageList;var c=_(r,ki);e.clearElement(),e.setElement({type:e.type,content:t({messageList:a.data.messageList},c)},i)}else{var u=[];a.data.messageList.forEach((function(e){if(!pn(e)){var t=new ua(e,i);u.push(t)}})),e.payload.messageList=u,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return s.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Je.w("".concat(o," failed. key:").concat(a," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===S.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var a=[];if(ft(t)&&ft(t.messageControlInfo)){var i=t.messageControlInfo,s=i.excludedFromUnreadCount,r=i.excludedFromLastMessage,c=i.excludedFromContentModeration;!0===s&&a.push("NoUnread"),!0===r&&a.push("NoLastMsg"),!0===c&&a.push("NoMsgCheck")}var u="";gt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(u=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,_=e.payload,g=_.title,h=_.abstractList,f=_.compatibleText,v=this._messageModule.getModule(eo),m=v&&v.isOnlineMessage(e,t)?0:void 0;return{protocolName:Uo.SEND_C2C_MESSAGE,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:g,abstractList:h,compatibleText:f,messageNumber:p}}],cloudCustomData:u,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==m?a:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var a=[];if(ft(t)&&ft(t.messageControlInfo)){var i=t.messageControlInfo,s=i.excludedFromUnreadCount,r=i.excludedFromLastMessage,c=i.excludedFromContentModeration;!0===s&&a.push("NoUnread"),!0===r&&a.push("NoLastMsg"),!0===c&&a.push("NoMsgCheck")}var u="";gt(e.cloudCustomData)&&e.cloudCustomData.length>0&&(u=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,_=e.payload,g=_.title,h=_.abstractList,f=_.compatibleText,v=this._messageModule.getModule(to),m=v&&v.isOnlineMessage(e,t)?1:0;return{protocolName:Uo.SEND_GROUP_MESSAGE,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:g,abstractList:h,compatibleText:f,messageNumber:p}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:u,onlineOnlyFlag:m,offlinePushInfo:o?{pushFlag:!0===o.disablePush?1:0,title:o.title||"",desc:o.description||"",ext:o.extension||"",apnsInfo:{badgeMode:!0===o.ignoreIOSBadge?1:0},androidInfo:{OPPOChannelID:o.androidOPPOChannelID||""}}:void 0,clientTime:e.clientTime,needReadReceipt:!0!==e.needReadReceipt||v.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===m?a:void 0,isSupportExtension:!0===e.isSupportExtension?1:0,isRelayMessage:!0===e._relayFlag?1:0}}}}]),e}(),Li={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},Ri=[Ao.MSG_ONPROGRESS_FUNCTION_ERROR,Ao.MSG_I_SELECT_F_FIRST,Ao.MSG_I_TYPES_LIMIT,Ao.MSG_F_IS_EMPTY,Ao.MSG_I_SIZE_LIMIT,Ao.MSG_F_SELECT_F_FIRST,Ao.MSG_F_SIZE_LIMIT,Ao.MSG_V_SIZE_LIMIT,Ao.MSG_V_TYPES_LIMIT,Ao.MSG_A_UPLOAD_FAIL,Ao.MSG_A_SIZE_LIMIT,Ao.COS_UNDETECTED];function Oi(e){var t=!1;return Object.values(Li).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var Gi=["conversationID","timePosition","timePeriod"],Pi=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Ai(g(t)),t}return i(a,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new pa(e),o=gt(e.payload)?e.payload:e.payload.text,a=new Qo({text:o}),i=this._getNickAndAvatarByUserID(t);return n.setElement(a),n.setNickAndAvatar(i),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new pa(e);if(ce){var o=e.payload.file;if(pt(o))return void this.outputWarning("FileUnsupportedInMP","createImageMessage");var a=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,i={url:a,name:a.slice(a.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:a.slice(a.lastIndexOf(".")+1).toLowerCase()};e.payload.file=i}else if(ue)if(pt(e.payload.file)){var s=e.payload.file;e.payload.file={files:[s]}}else if(ft(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file.tempFiles[0];e.payload.file={files:[r]}}var c=new Zo({imageFormat:ze.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),u=this._getNickAndAvatarByUserID(t);return n.setElement(c),n.setNickAndAvatar(u),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(ce){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var a=new pa(e),i=new ea({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID(e.payload.file)}),s=this._getNickAndAvatarByUserID(o);return a.setElement(i),a.setNickAndAvatar(s),a.setNameCard(this._getNameCardByGroupID(a)),this._messageOptionsMap.set(a.clientSequence,e),a}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0;var n={};if(ce){if(ae)return void this.outputWarning("VideoUnsupportedInAlipay");if(pt(e.payload.file))return void this.outputWarning("FileUnsupportedInMP","createVideoMessage");var o=e.payload.file;vt(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ue){if(pt(e.payload.file)){var a=e.payload.file;e.payload.file.files=[a]}else if(ft(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFile;e.payload.file.files=[i]}var s=e.payload.file;n.url=window.URL.createObjectURL(s.files[0]),n.name=s.files[0].name,n.size=s.files[0].size||1,n.second=s.files[0].duration||0,n.type=s.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var r=new pa(e),c=new ra({videoFormat:n.type,videoSecond:Xt(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),u=this._getNickAndAvatarByUserID(t);return r.setElement(c),r.setNickAndAvatar(u),r.setNameCard(this._getNameCardByGroupID(r)),this._messageOptionsMap.set(r.clientSequence,e),r}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new pa(e),o=new sa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new pa(e),o=new $o(e.payload),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new pa(e),a=new la(e.payload);return o.setElement(a),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,a=e.payload,i=e.needReadReceipt,s=e.receiverList;if(!vt(a._elements))return Go({code:Ao.MSG_FORWARD_INVALID_ELEMENTS});var r=this.getMyUserID(),c=this._getNickAndAvatarByUserID(r);if(a.type===S.MSG_GRP_TIP)return Go({code:Ao.MSG_FORWARD_TYPE_INVALID});var u={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:fn.UNSEND,currentUser:r,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||a.cloudCustomData||"",needReadReceipt:i,receiverList:s,isSupportExtension:e.isSupportExtension||!1},l=new pa(u);return l.setElement(a._elements[0]),l.setNickAndAvatar(c),l.setNameCard(this._getNameCardByGroupID(a)),l.setRelayFlag(!0),l}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(ce){if(!$&&!te&&!se)return;var n=le.getSystemInfoSync().SDKVersion;if($&&Wt(n,"2.5.0")<0)return void this.outputWarning("WXChooseMessageFile");if(te&&Wt(n,"1.18.0")<0)return void this.outputWarning("QQChooseMessageFile")}if(ue||se){if(pt(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(ft(e.payload.file)&&"undefined"!=typeof uni){var a=e.payload.file,i=a.tempFiles,s=a.files,r=null;vt(i)?r=i[0]:vt(s)&&(r=s[0]),e.payload.file={files:[r]}}}else if($||te){var c=e.payload.file.tempFiles,u=t(t({},c[0]),{},{url:c[0].path});e.payload.file={files:[u]}}var l=this.getMyUserID();e.currentUser=l,e.senderTinyID=this.getMyTinyID();var d=new pa(e),p=new ia({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),_=this._getNickAndAvatarByUserID(l);return d.setElement(p),d.setNickAndAvatar(_),d.setNameCard(this._getNameCardByGroupID(d)),this._messageOptionsMap.set(d.clientSequence,e),d}},{key:"createLocationMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new pa(e),o=new ca(e.payload),a=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(a),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(!1===this.getModule(yo).filterMessage(e,t))return e.hasRiskContent=!0,this._onSendMessageFailed(e,new ko({code:Ao.PROFANITY_FOUND}));var o=null;if(e.conversationType===S.CONV_C2C)o=this.getModule(eo);else{if(e.conversationType!==S.CONV_GROUP)return Go({code:Ao.MSG_INVALID_CONV_TYPE});o=this.getModule(to)}var a,i="".concat(this._n,".sendMessageInstance"),s=this.getModule(ao),r=o.isOnlineMessage(e,t);return this.getModule(uo).upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===Vo&&n.getModule(mo).addSuccessCount(Ho);return n._guardForGroup(e).then((function(){if(!e.isSendable())return Go({code:Ao.MSG_F_URL_IS_EMPTY});n._addSendMessageTotalCount(e),a=Date.now();var i=function(e){var t="utf-8";ue&&document&&(t=document.charset.toLowerCase());var n,o,a=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var i=0;i<o;i++)(n=e.codePointAt(i))<=127?a+=1:n<=2047?a+=2:n<=65535?a+=3:(a+=4,i++);else if("utf-16"===t||"utf16"===t)for(var s=0;s<o;s++)(n=e.codePointAt(s))<=65535?a+=2:(a+=4,s++);else a=e.replace(/[^\x00-\xff]/g,"aa").length;return a}(JSON.stringify(e));return e.type===S.MSG_MERGER&&i>11264?n._mergerMessageHandler.uploadMergerMessage(e,i).then((function(o){var a=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(a)})):(s.setMessageRandom(e),o.sendMessage(e,t))})).then((function(o){var c=o.data,u=c.time,l=c.sequence,d=c.readReceiptCode,p=c.messageDropReason;_t(d)&&0!==d&&(new Xo("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(l," readReceiptCode:").concat(d)).end(),Je.w("".concat(i," readReceiptCode:").concat(d," message:").concat(n.getErrorMessage(d))));if(p){var _=new Xo("messageDropReason"),g="from:".concat(e.from," to:").concat(e.to," sequence:").concat(l," messageDropReason:").concat(p);_.setMessage(g).end(),Je.w("".concat(i," ").concat(g))}if(n._addSendMessageSuccessCount(e,a),n._messageOptionsMap.delete(e.clientSequence),!0===e.isResend){var h=s.findMessage(e.ID);h&&(Je.l("".concat(i," resend ok. ID:").concat(h.ID)),s.deleteLocalMessage(h))}e.status=fn.SUCCESS,e.time=u;var f=!1;if(e.conversationType===S.CONV_GROUP)e.sequence=l;else if(e.conversationType===S.CONV_C2C){var v=s.getLatestMessageSentByMe(e.conversationID);if(v){var m=v.nick,M=v.avatar;m===e.nick&&M===e.avatar||(f=!0)}}if(f&&s.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),!0===r)e._onlineOnlyFlag=!0;else{s.appendToMessageList(e);var I=e;ft(t)&&ft(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,I=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var y=e.conversationType;if(Ft(e.to))y=S.CONV_TOPIC,n.getModule(oo).onMessageSent({groupID:$t(e.to),topicID:e.to,lastMessage:I});s.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:y,subType:e.conversationSubType,lastMessage:I}]})}return e._relayFlag||"TIMImageElem"!==e.type||Jt(e.payload.imageInfoArray),No({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t,r)}))}},{key:"_guardForGroup",value:function(e){if(e.conversationType!==S.CONV_GROUP)return Promise.resolve();var t=this.getModule(to);if(!t)return this._onCannotFindModule();if(wt({groupID:e.to})){var n=t.getLocalGroupProfile(e.to);if(n&&n.isSupportTopic)return Go({code:Ao.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return t.guardForAVChatRoom(e)}},{key:"_onSendMessageFailed",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o="".concat(this._n,"._onSendMessageFailed");e.status=fn.FAIL,80001!==t.code&&80004!==t.code||(e.hasRiskContent=!0);var a=this.getModule(ao);a.deleteMessageRandom(e);var i=t.code>=10100&&t.code<=10200||t.code>=120001&&t.code<=13e4;if(!n&&!i){var s=a.appendToMessageList(e);!0===s&&Je.l("".concat(o," message stored, ID:").concat(e.ID))}this._addSendMessageFailCountOnUser(e,t);var r=new Xo("sendMessage");return r.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var n=v(e,2),o=n[0],a=n[1];r.setError(t,o,a).end()})),Je.e("".concat(o," error:"),t),Go(new ko({code:t&&t.code?t.code:Ao.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([S.MSG_IMAGE,S.MSG_AUDIO,S.MSG_VIDEO,S.MSG_FILE].includes(e.type))return Vo;if(e.conversationType===S.CONV_C2C)return Fo;if(e.conversationType===S.CONV_GROUP){var t=this.getModule(to);if(!t)return;var n=t.getLocalGroupProfile(e.to);if(!n)return;var o=n.type;return bt(o)?xo:qo}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(mo).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=this._getSendMessageSpecifiedKey(e);if(n){var o=this.getModule(mo);o.addSuccessCount(n),o.addCost(n,un(t,!1))}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,a=t.code,i=void 0===a?-1:a,s=this.getModule(mo),r=this._getSendMessageSpecifiedKey(e);r===Vo&&(n=i,o=!1,Ri.includes(n)&&(o=!0),o)?s.addFailedCountOfUserSide(Ho):Oi(i)&&r&&s.addFailedCountOfUserSide(r)}},{key:"resendMessage",value:function(e,t){return e.isResend=!0,e.status=fn.UNSEND,this.sendMessageInstance(e,t)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===S.CONV_C2C?n=this.getModule(eo):e.conversationType===S.CONV_GROUP&&(n=this.getModule(to)),!n)return this._onCannotFindModule();var o=new Xo("revokeMessage");o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to));var a="".concat(this._n,".").concat("revokeMessage");return n.revokeMessage(e).then((function(n){var i=n.data.recallRetList;if(!pn(i)&&0!==i[0].retCode){var s=new ko({code:i[0].retCode,data:{message:e}});return o.setCode(s.code).setMoreMessage(s.message).end(),Go(s)}return Je.i("".concat(a," ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(ao).onMessageRevoked([e]),No({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];o.setError(n,a,i).end()}));var i=new ko({code:n&&n.code?n.code:Ao.MSG_REVOKE_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}});return Je.w("".concat(a," failed. error:"),n),Go(i)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],a=o.conversationID,i="",s=[],r=[];if(o.conversationType===S.CONV_C2C)n=this.getModule(eo),i=a.replace(S.CONV_C2C,""),e.forEach((function(e){e&&e.status===fn.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||s.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),r.push(e))}));else if(o.conversationType===S.CONV_GROUP)n=this.getModule(to),i=a.replace(S.CONV_GROUP,""),e.forEach((function(e){e&&e.status===fn.SUCCESS&&e.conversationID===a&&(e._onlineOnlyFlag||s.push("".concat(e.sequence)),r.push(e))}));else if(o.conversationType===S.CONV_SYSTEM)return Go({code:Ao.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===s.length)return this._onMessageDeleted(r);s.length>30&&(s=s.slice(0,30),r=r.slice(0,30));var c=new Xo("deleteMessage");c.setMessage("to:".concat(i," count:").concat(s.length));var u="".concat(this._n,".").concat("deleteMessage");return n.deleteMessage({to:i,keyList:s}).then((function(e){return c.end(),Je.i("".concat(u," ok")),t._onMessageDeleted(r)})).catch((function(e){t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),Je.w("".concat(u," failed. error:"),e);var n=new ko({code:e&&e.code?e.code:Ao.MSG_DELETE_FAIL,message:e&&e.message?e.message:void 0});return Go(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(ao).onMessageDeleted(e),Oo({messageList:e})}},{key:"translateText",value:function(e){var n="".concat(this._n,".").concat("translateText"),o=e.sourceTextList,a=e.sourceLanguage,i=e.targetLanguage,s=new Xo("translateText");return s.setMessage("sourceLanguage:".concat(a," targetLanguage:").concat(i)),this.request({protocolName:Uo.TRANSLATE_TEXT,requestData:{sourceTextList:o,source:a||"auto",target:i,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var o=e.data,a=o.error,i=o.requestID,r=o.translatedTextList;if(0===a.code)return s.end(),Je.i("".concat(n," ok. requestID:").concat(i)),No({translatedTextList:r});throw t(t({},a),{},{requestID:i})})).catch((function(e){return s.setCode(e.code).setMoreMessage(e.requestID).end(),Je.w("".concat(n," failed. error:"),e),Go({code:Ao.TRANSLATE_TEXT_FAIL})}))}},{key:"convertVoiceToText",value:function(e){var n=e.message,o=e.language,a=n.payload.url;n.from===this.getMyUserID()&&"out"===n.flow&&(a=n.payload.remoteAudioUrl);var i=/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/;if(!i.test(a))return Go({code:Ao.UNSUPPORTED_VOICE_FORMAT});var s=i.exec(a)[1]||"mp3",r="16k_zh-PY";o?"zh (cmn-Hans-CN)"===o?r="16k_zh":"en-US"===o?r="16k_en":"yue-Hant-HK"===o?r="16k_yue":"ja-JP"===o&&(r="16k_ja"):r="16k_zh-PY";var c="serviceType:".concat(r," url:").concat(a),u="".concat(this._n,".").concat("convertVoiceToText");Je.i("".concat(u," ").concat(c));var l=new Xo("convertVoiceToText");return l.setMessage(c),this.request({protocolName:Uo.VOICE_TO_TEXT,requestData:{url:a,language:r,SDKAppID:this.getSDKAppID(),format:s}}).then((function(e){var n=e.data,o=n.error,a=n.requestID,i=n.result;if(0===o.code)return l.end(),Je.i("".concat(u," ok. requestID:").concat(a)),No({result:i});throw t(t({},o),{},{requestID:a})})).catch((function(e){return l.setCode(e.code).setMoreMessage(e.requestID||"").end(),Je.w("".concat(u," failed. error:"),e),Go({code:Ao.VOICE_TO_TEXT_FAIL})}))}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,a=e.to,i=this.getModule(to);if(!i)return this._onCannotFindModule();if(i.isMessageFromOrToAVChatroom(a))return Go({code:Ao.MSG_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(yo).filterMessage(e))return e.hasRiskContent=!0,Go({code:Ao.PROFANITY_FOUND,data:{message:e}});o===S.CONV_C2C?n=this.getModule(eo):o===S.CONV_GROUP&&(n=this.getModule(to));var s=new Xo("modifyMessage");s.setMessage("to:".concat(a));var r="".concat(this._n,".modifyRemoteMessage");return n.modifyRemoteMessage(e).then((function(n){s.end(),Je.i("".concat(r," ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return No({message:o})})).catch((function(n){if(s.setCode(n.code).setMoreMessage(n.message).end(),Je.w("".concat(r," failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return Go({code:Ao.MSG_MODIFY_CONFLICT,data:{message:o}})}return Go({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_generateSearchRequestData",value:function(e){var t=e.conversationID,n=e.timePosition,o=e.timePeriod,a=_(e,Gi);return mt(t)||(qt(t)&&(a.account=t.replace(S.CONV_C2C,"")),xt(t)&&(a.groupID=t.replace(S.CONV_GROUP,""))),_t(o)&&o>0&&(_t(n)&&n>0?a.startTime=n-o:a.startTime=Ke()-o),a.startTime&&a.startTime<0&&(a.startTime=void 0),_t(n)&&n>0&&(a.endTime=n),a}},{key:"searchCloudMessages",value:function(e){var t=this,n="searchCloudMessages",o="".concat(this._n,".").concat(n);if(!e)return Go({code:Ao.OPTIONS_IS_EMPTY,message:this.getErrorMessage(Ao.OPTIONS_IS_EMPTY,n)});var a=e.keywordList,i=e.keywordListMatchType,s=e.conversationID,r=e.cursor,c=vt(e.senderUserIDList)&&e.senderUserIDList.length>0,u=vt(e.messageTypeList)&&e.messageTypeList.length>0;if(!a&&!c&&!u)throw Je.e("[".concat(n,'] Missing required params: "keywordList".')),new Error("Params validate failed.");var l=Date.now(),d=new Xo(n),p="keywordList:".concat(a," keywordListMatchType:").concat(i," ")+"conversationID:".concat(s," cursor:").concat(r);return Je.l("".concat(o," ").concat(p)),this.request({protocolName:Uo.MESSAGE_CLOUD_SEARCH,requestData:this._generateSearchRequestData(e)}).then((function(n){var a=n.data,i=a.code,s=a.message;if(0!==i){var r=i;60020===i&&(r="SearchCloudMessagesUnavailable");var c=t.getErrorMessage(r)||s,u=new ko({code:i,message:c});return t.probeNetwork().then((function(e){var t=v(e,2),n=t[0],o=t[1];d.setMessage(p).setError(u,n,o).end()})),Go(u)}var _=n.data,g=_.cursor,h=_.totalCount,f=_.searchResult,m="totalCount:".concat(h," cost:").concat(un(l));Je.l("".concat(o," ok. cursor:").concat(g," ").concat(m)),d.setNetworkType(t.getNetworkType()).setMessage("".concat(p," ").concat(m)).end();var M=t._handleSearchResults(f,!e.conversationID);return No({searchResultList:M,cursor:g,totalCount:h})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setMessage(p).setError(e,o,a).end()})),Go(e)}))}},{key:"_handleSearchResults",value:function(e,t){var n=this.getModule(ao);return vt(e)&&0!==e.length?e.map((function(e){var o=e.groupID,a=e.userID,i=e.messageCount,s=e.messageList,r=o?"".concat(S.CONV_GROUP).concat(o):"".concat(S.CONV_C2C).concat(a),c={conversationID:r,messageCount:i,messageList:[]};if(t&&i>1)return c;if(s&&s.length>0){var u=n.onRoamingMessage(s,r,!1);o&&u.reverse(),c.messageList=u}return c})):[]}},{key:"_onModifyRemoteMessageResp",value:function(e,t){Je.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,a=e.to,i=e.random,s=e.sequence,r=e.time,c=t.elements,u=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(ao).onMessageModified({conversationType:n,from:o,to:a,time:r,random:i,sequence:s,elements:c,cloudCustomData:d,messageVersion:u})}},{key:"_generateUUID",value:function(e){var t=this.getModule(io),n="".concat(t.getSDKAppID(),"-").concat(t.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=At[Math.floor(Math.random()*Lt)];return e}()),o=e.name||e.value||e.url||e.tempFilePath,a=o&&o.slice(o.lastIndexOf(".")+1);return a&&(n="".concat(n,".").concat(a)),n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule($n).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===S.CONV_GROUP){var t=this.getModule(to);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),a}(Po),Ui=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="MessageExtensionModule",a.messageExtensionMap=new Map,a.globalSeqMap=new Map,a.getMessageExtensionsMap=new Map,a}return i(n,[{key:"onMessageExtensionNotify",value:function(e){var t=this,n=e.dataList,o=n.messageInfo,a=n.operateType,i=n.operateResultList,s=n.tinyID,r=n.globalSequence,c=o.clientTime,u=o.random,l="".concat(s,"-").concat(c,"-").concat(u),d=[],p=[];Je.l("".concat(this._n,".onMessageExtensionNotify messageID:").concat(l," operateType:").concat(a," globalSequence:").concat(r)),this._updateGlobalSequence(l,r);var _=!1,g=!1;i.forEach((function(e){var n=e.extensions,o=void 0===n?[]:n,i=e.clearSequence;if(1===a)_=!0,o.forEach((function(e){d.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,o);else if(2===a)g=!0,o.forEach((function(e){p.push(e.key)})),t._updateLocalExtension(l,o);else if(3===a){if(g=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=i&&!pn(e.value)&&p.push(t)}));t._clearLocalExtension(l,i)}})),_&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),g&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:p})}},{key:"setMessageExtensions",value:function(e,t){var n=this,o="setMessageExtensions";if(!this.canIUse(K.MSG_EXT))return this.cannotUseCommercialAbility(o);var a="".concat(this._n,".").concat(o),i=e.ID,s=e.conversationID,r=e.sequence,c=e.time,u=m(t);t.length>20&&(u=t.slice(0,20),Je.w("".concat(a,". the length of extensions cannot exceed 20.")));var l="conversationID:".concat(s," messageID:").concat(i," sequence:").concat(r," time:").concat(c," count:").concat(u.length),d=new Xo(o);return d.setMessage(l),Je.l("".concat(a," ").concat(l)),this._modifyMessageExtensions(e,u).then((function(e){var t=e.resultList,n=e.successCount,o=e.failureCount,i="success count:".concat(n," fail count:").concat(o);return d.setMoreMessage(i).end(),Je.l("".concat(a," ok. ").concat(i)),No({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setError(e,o,a).end()})),Je.e("".concat(a," failed. error:"),e),Go(e)}))}},{key:"getMessageExtensions",value:function(e){var t=this,n="getMessageExtensions";if(!this.canIUse(K.MSG_EXT))return this.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=e.ID,i=e.conversationID,s=e.sequence,r=e.time,c="conversationID:".concat(i," messageID:").concat(a," sequence:").concat(s," time:").concat(r),u=new Xo(n);u.setMessage(c),Je.l("".concat(o," ").concat(c));var l=void 0;return this.getMessageExtensionsMap.has(a)&&(l=this._getGlobalSequence(a)),this._getMessageExtensions(e,l).then((function(e){return u.end(),Je.l("".concat(o," ok. total count:").concat(e.length)),mt(l)&&e.length>0&&t.getMessageExtensionsMap.set(a,1),No({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"deleteMessageExtensions",value:function(e,t){var n=this,o="deleteMessageExtensions";if(!this.canIUse(K.MSG_EXT))return this.cannotUseCommercialAbility(o);var a="".concat(this._n,".").concat(o),i=[],s=3;pn(t)||(s=2,t.forEach((function(e){i.push({key:e,value:"",seq:0})})));var r=e.ID,c=e.conversationID,u=e.sequence,l=e.time,d="conversationID:".concat(c," messageID:").concat(r," sequence:").concat(u," time:").concat(l," operateType:").concat(s),p=new Xo(o);return p.setMessage(d),Je.l("".concat(a," ").concat(d)),this._modifyMessageExtensions(e,i,s).then((function(e){var t=e.resultList,n=e.successCount,o=e.failureCount,i="";return 2===s&&(i="success count:".concat(n," fail count:").concat(o)),p.setMoreMessage("".concat(i)).end(),Je.l("".concat(a," ok. ").concat(i)),No({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];p.setError(e,o,a).end()})),Je.e("".concat(a," failed. error:"),e),Go(e)}))}},{key:"_modifyMessageExtensions",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=Ft(e.to)?S.CONV_TOPIC:e.conversationType,i=void 0;3!==o&&(i=this._getRequestExtensions(e,t));var s=null;switch(a){case S.CONV_C2C:s=this.getModule(eo);break;case S.CONV_GROUP:s=this.getModule(to);break;case S.CONV_TOPIC:s=this.getModule(oo);break;default:return Go({code:Ao.CANNOT_FIND_MODULE})}return s.modifyMessageExtensions(e,i,o).then((function(t){var o=t.data,a=o.extensions,i=o.seq,s=[],r=0,c=0,u=[];return(a=pn(a)?[]:a).forEach((function(e){var t=e.errorCode,n=e.extension,o=n.key,a=n.value,i=n.seq;s.push({code:t,key:o,value:a}),0===t?r++:c++,u.push({key:o,value:a,seq:i})})),n._updateGlobalSequence(e.ID,i),u.length>0&&(n._updateLocalExtension(e.ID,u),u=null),{resultList:s,successCount:r,failureCount:c}})).catch((function(e){return Go(e)}))}},{key:"_getRequestExtensions",value:function(e,t){var n=[];if(this._hasLocalExtension(e.ID)){var o=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,a=e.value,i=0;o.has(t)&&(i=o.get(t).seq),n.push({key:t,value:a,seq:i})})),n}return t.forEach((function(e){var t=e.key,o=e.value;n.push({key:t,value:o,seq:0})})),n}},{key:"_getMessageExtensions",value:function(e,t){var n=this,o="".concat(this._n,"._getMessageExtensions"),a=e.ID,i=e.to,s=null;switch(Ft(i)?S.CONV_TOPIC:e.conversationType){case S.CONV_C2C:s=this.getModule(eo);break;case S.CONV_GROUP:s=this.getModule(to);break;case S.CONV_TOPIC:s=this.getModule(oo);break;default:return Go({code:Ao.CANNOT_FIND_MODULE})}return s.getMessageExtensions(e,t).then((function(t){var i=t.data,s=i.extensions,r=i.completeFlag,c=i.globalSequence,u=i.clearSequence;if(s=pn(s)?[]:s,Je.l("".concat(o," ok. completeFlag:").concat(r," globalSequence:").concat(c," clearSequence:").concat(u," count:").concat(s.length)),n._updateLocalExtension(a,s),n._clearLocalExtension(a,u),n._updateGlobalSequence(a,c),1!==r){var l=s.slice(-1)[0].seq+1;return n._getMessageExtensions(e,l)}return n._getLocalExtensions(a)})).catch((function(e){return Go(e)}))}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var n=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,o=e.value,a=void 0===o?"":o,i=e.seq;n.set(t,{value:a,seq:i})}))}},{key:"_clearLocalExtension",value:function(e,t){if(!(t<=0)&&this._hasLocalExtension(e)){var n=this._getLocalExtension(e);n.forEach((function(e,o){e.seq<=t&&n.delete(o)}))}}},{key:"_getLocalExtensions",value:function(e){var t=[];this._hasLocalExtension(e)&&this._getLocalExtension(e).forEach((function(e,n){var o=e.value;pn(o)||t.push({key:n,value:o})}));return t}},{key:"_getGlobalSequence",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSequence",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),n}(Po),bi=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="MessageReactionModule",t._reactedByMyselfMap=new Map,t._reactionInfoMap=new Map,t}return i(a,[{key:"onMessageReactionNotifyList",value:function(e){var n=this,o=(e||{}).dataList;(void 0===o?[]:o).forEach((function(e){var o=e.C2CMessageInfo,a=void 0===o?{}:o,i=e.groupMessageInfo,s=void 0===i?{}:i,r=e.reactionList,c=void 0===r?[]:r,u=t(t({},a),s),l=u.tinyID,d=u.clientTime,p=u.random,_="".concat(l,"-").concat(d,"-").concat(p),g=[];c.forEach((function(e){mt(e.userIDList)&&(e.userIDList=[],e.count=0),g.push.apply(g,m(e.userIDList))})),Je.l("".concat(n._n,".onMessageReactionNotifyList messageID:").concat(_," reactionList:").concat(c.length)),n._handleReactionSummary([{messageID:_,reactionList:c}],g).then((function(e){n.emitOuterEvent(E.MESSAGE_REACTIONS_UPDATED,t({},e[0]))}))}))}},{key:"onMessageReactionNotify",value:function(e){var n=e.dataList||{},o=n.C2CMessageInfo,a=void 0===o?{}:o,i=n.groupMessageInfo,s=void 0===i?{}:i,r=n.reactionID,c=n.operateType,u=t(t({},a),s),l=u.tinyID,d=u.clientTime,p=u.random,_="".concat(l,"-").concat(d,"-").concat(p);Je.l("".concat(this._n,".onMessageReactionNotify messageID:").concat(_," reactionID:").concat(r," operateType:").concat(c)),1===c?this._addReactedByMyselfMap(_,r):this._removeReactedByMyselfMap(_,r);var g="".concat(_,"-").concat(r);if(this._reactionInfoMap.has(g)){var h=this._reactionInfoMap.get(g);h.reactedByMyself=1===c,this.emitOuterEvent(E.MESSAGE_REACTIONS_UPDATED,{messageID:_,reactionList:[h]})}}},{key:"addMessageReaction",value:function(e,t){var n=this,o="addMessageReaction";if(!this.canIUse(K.MSG_REACTION))return this.cannotUseCommercialAbility(o);var a="".concat(this._n,".").concat(o),i=e.ID,s=e.conversationID,r="conversationID:".concat(s," messageID:").concat(i," reactionID:").concat(t),c=new Xo(o);c.setMessage(r),Je.l("".concat(a," ").concat(r));var u=this._createReactionOperationPack(e,t,1);return this._addReactedByMyselfMap(e.ID,t),this.request(u).then((function(){return c.end(),Je.l("".concat(a," ok.")),No()})).catch((function(o){return n._removeReactedByMyselfMap(e.ID,t),n.probeNetwork().then((function(e){var t=v(e,2),n=t[0],a=t[1];c.setError(o,n,a).end()})),Je.e("".concat(a," failed. error:"),o),Go(o)}))}},{key:"removeMessageReaction",value:function(e,t){var n=this,o="removeMessageReaction";if(!this.canIUse(K.MSG_REACTION))return this.cannotUseCommercialAbility(o);var a="".concat(this._n,".").concat(o),i=e.ID,s=e.conversationID,r="conversationID:".concat(s," messageID:").concat(i," reactionID:").concat(t),c=new Xo(o);c.setMessage(r),Je.l("".concat(a," ").concat(r));var u=this._createReactionOperationPack(e,t,2);return this._removeReactedByMyselfMap(e.ID,t),this.request(u).then((function(){return c.end(),Je.l("".concat(a," ok.")),No()})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];c.setError(e,o,a).end()})),Je.e("".concat(a," failed. error:"),e),Go(e)}))}},{key:"getMessageReactions",value:function(e){var n=this,o="getMessageReactions";if(!this.canIUse(K.MSG_REACTION))return this.cannotUseCommercialAbility(o);var a="".concat(this._n,".").concat(o),i=e.messageList,s=e.maxUserCountPerReaction,r=i[0].conversationID,c="conversationID:".concat(r," maxUserCountPerReaction:").concat(s," messageList:").concat(i.length),u=new Xo(o);u.setMessage(c),Je.l("".concat(a," ").concat(c));var l=new Map,d=this._createReactionSummaryPack(t(t({},e),{},{messageIDMap:l}));return this.request(d).then((function(e){var t=e.data.resultList,o=[],a=[];return(void 0===t?[]:t).forEach((function(e){var t=e.messageKey,n=void 0===t?void 0:t,i=e.messageSequence,s=void 0===i?void 0:i,r=e.reactionList,c=void 0===r?[]:r,u=mt(n)?l.get(s):l.get(n);o.push({messageID:u,reactionList:c}),c.forEach((function(e){a.push.apply(a,m(e.userIDList))}))})),n._handleReactionSummary(o,a)})).then((function(e){return u.end(),Je.l("".concat(a," ok.")),l.clear(),No({resultList:e})})).catch((function(e){return n.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(a," failed. error:"),e),Go(e)}))}},{key:"getAllUserListOfMessageReaction",value:function(e){var t=this,n="getAllUserListOfMessageReaction";if(!this.canIUse(K.MSG_REACTION))return this.cannotUseCommercialAbility(n);var o="".concat(this._n,".").concat(n),a=e.message,i=e.reactionID,s=e.nextSeq,r=e.count,c=a.ID,u=a.conversationID,l="conversationID:".concat(u," messageID:").concat(c," reactionID:").concat(i," nextSeq:").concat(s," count:").concat(r),d=new Xo(n);d.setMessage(l),Je.l("".concat(o," ").concat(l));var p={userList:[],nextSeq:0,isCompleted:!1},_=this._createReactionUserListPack(e);return this.request(_).then((function(e){var n=e.data,o=n.userIDList,a=void 0===o?[]:o,i=n.nextSeq,s=void 0===i?0:i;return p.nextSeq=s,p.isCompleted=0===s,t.getModule($n).getUserNickAndAvatar(a)})).then((function(e){return p.userList=e,d.end(),Je.l("".concat(o," ok.")),No(p)})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];d.setError(e,o,a).end()})),Je.e("".concat(o," failed. error:"),e),Go(e)}))}},{key:"_createReactionOperationPack",value:function(e,t,n){var o=void 0,a={reactionID:t,userIDList:[this.getMyUserID()]};if(e.conversationType===S.CONV_C2C){var i=this.getModule(eo);o=1===n?Uo.ADD_C2C_MSG_REACTION:Uo.REMOVE_C2C_MSG_REACTION,a.from=e.from,a.to=e.to,a.messageKey=i.getMessageKey(e)}if(e.conversationType===S.CONV_GROUP){var s=void 0,r=e.to;Ft(e.to)&&(r=$t(s=e.to)),o=1===n?Uo.ADD_GRP_MSG_REACTION:Uo.REMOVE_GRP_MSG_REACTION,a.groupID=r,a.topicID=s,a.messageSequence=e.sequence}return{protocolName:o,requestData:a}}},{key:"_createReactionSummaryPack",value:function(e){var t=e.messageList,n=e.maxUserCountPerReaction,o=void 0===n?10:n,a=e.messageIDMap,i=t[0],s=void 0,r=void 0;if(i.conversationType===S.CONV_C2C){var c=this.getModule(eo),u=t.map((function(e){var t=c.getMessageKey(e);return a.set(t,e.ID),t}));s=Uo.GET_C2C_MSG_REACTIONS,r={from:i.from,to:i.to,messageKeyList:u,count:o}}if(i.conversationType===S.CONV_GROUP){var l=void 0,d=i.to;Ft(i.to)&&(d=$t(l=i.to));var p=t.map((function(e){return a.set(e.sequence,e.ID),e.sequence}));s=Uo.GET_GRP_MSG_REACTIONS,r={groupID:d,topicID:l,messageSequenceList:p,count:o}}return{protocolName:s,requestData:r}}},{key:"_createReactionUserListPack",value:function(e){var t=e.message,n=e.reactionID,o=e.nextSeq,a=void 0===o?0:o,i=e.count,s=void 0===i?100:i,r=void 0,c={reactionID:n,nextSeq:a,count:s>100?100:s};if(t.conversationType===S.CONV_C2C){var u=this.getModule(eo);r=Uo.GET_C2C_MSG_REACTION_USER_LIST,c.from=t.from,c.to=t.to,c.messageKey=u.getMessageKey(t)}if(t.conversationType===S.CONV_GROUP){var l=void 0,d=t.to;Ft(t.to)&&(d=$t(l=t.to)),r=Uo.GET_GRP_MSG_REACTION_USER_LIST,c.groupID=d,c.topicID=l,c.messageSequence=t.sequence}return{protocolName:r,requestData:c}}},{key:"_handleReactionSummary",value:function(e,t){var n=this;return this.getModule($n).getUserNickAndAvatar(t).then((function(t){var o=[];return e.forEach((function(e){var a=[];e.reactionList.forEach((function(o){var i=o.reactionID,s=o.count,r=o.userIDList,c=o.reactedByMyself,u=void 0===c?void 0:c,l=[];r.forEach((function(e){t.forEach((function(t){e===t.userID&&l.push(t)}))}));var d={reactionID:i,totalUserCount:s,partialUserList:l,reactedByMyself:n._computeReactedByMyself({reactedByMyself:u,messageID:e.messageID,reactionID:i})};if(a.push(d),mt(u)&&!n._reactedByMyselfMap.has(e.messageID)){var p="".concat(e.messageID,"-").concat(i);n._reactionInfoMap.set(p,d)}})),o.push({messageID:e.messageID,reactionList:a})})),o}))}},{key:"_addReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]);var n=this._reactedByMyselfMap.get(e);-1===n.indexOf(t)&&n.push(t)}},{key:"_removeReactedByMyselfMap",value:function(e,t){if(this._reactedByMyselfMap.has(e)){var n=this._reactedByMyselfMap.get(e),o=n.indexOf(t);o>-1&&n.splice(o,1)}}},{key:"_computeReactedByMyself",value:function(e){var t=e.reactedByMyself,n=e.messageID,o=e.reactionID;return mt(t)?!!this._reactedByMyselfMap.has(n)&&this._reactedByMyselfMap.get(n).includes(o):1===t}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}]),a}(Po),wi=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="ComboMessageModule",a}return i(n,[{key:"sendMessage",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return Go({code:Ao.MSG_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.getModule(ao).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var a=e.data,i=a.time,s=a.sequence,r=a.readReceiptCode;_t(r)&&0!==r&&(new Xo("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(s," readReceiptCode:").concat(r)).end(),Je.w("".concat(t._n,".sendMessage readReceiptCode:").concat(r," message:").concat(t.getErrorMessage(r))));t._addSendMessageSuccessCount(n,o);var c=t.getModule(ao);n.status=fn.SUCCESS,n.time=i,n.conversationType===S.CONV_GROUP&&(n.sequence=s),c.appendToMessageList(n);var u=n;return!0===n._isExcludedFromLastMessage&&(u=""),c.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:u}]}),No({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.getModule(_o),o="";return e.conversationType===S.CONV_C2C&&(o="".concat(B.NAME.OPEN_IM,".").concat(Uo.SEND_C2C_MESSAGE)),e.conversationType===S.CONV_GROUP&&(o="".concat(B.NAME.GROUP,".").concat(Uo.SEND_GROUP_MESSAGE)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_constructMessageInstance",value:function(e){var t="".concat(this._n,"._constructMessageInstance"),n=null;try{var o=this.getMyUserID(),a={};if(a.senderTinyID=this.getMyTinyID(),a.currentUser=o,a.from=e.From_Account||o,e.GroupId?(a.conversationID="".concat(S.CONV_GROUP).concat(e.GroupId),a.conversationType=S.CONV_GROUP,a.to=e.GroupId):e.To_Account&&(a.conversationID="".concat(S.CONV_C2C).concat(e.To_Account),a.conversationType=S.CONV_C2C,a.to=e.To_Account),a.time=e.MsgTimeStamp||0,a.random=e.Random||e.MsgRandom||0,a.priority=e.MsgPriority,gt(e.CloudCustomData)&&e.CloudCustomData.length>0&&(a.cloudCustomData=e.CloudCustomData),vt(e.SendMsgControl)&&(a.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(a.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(a.messageControlInfo.excludedFromLastMessage=1)),a.conversationType===S.CONV_GROUP&&vt(e.To_Account)&&e.To_Account.length>0){var i=e.To_Account;e.To_Account.length>50&&(i=e.To_Account.slice(0,50),Je.w("".concat(t," To_Account must be less than or equal to 50."))),a.receiverList=m(i),e.To_Account=m(i)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(a.needReadReceipt=!0),1===e.SupportMessageExtension&&(a.isSupportExtension=!0),(n=new pa(a)).status=fn.UNSEND,e.MsgClientTime=n.clientTime,n.conversationType===S.CONV_C2C&&(e.MsgSeq=n.sequence);for(var s,r=e.MsgBody.length,c=0;c<r;c++)"TIMTextElem"===(s=e.MsgBody[c]).MsgType?n.setTextElement(s.MsgContent.Text):"TIMCustomElem"===s.MsgType?n.setCustomElement({data:s.MsgContent.Data||"",description:s.MsgContent.Desc||"",extension:s.MsgContent.Ext||""}):"TIMFaceElem"===s.MsgType&&n.setFaceElement({index:s.MsgContent.Index,data:s.MsgContent.Data});var u=n.getElements();n.payload=u[0].content,n.type=u[0].type}catch(l){n=null,Je.e("".concat(t," failed. error:"),l)}return n}},{key:"_onSendMessageFailed",value:function(e,t){e.status=fn.FAIL,this.getModule(ao).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new Xo("sendMessage");return n.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to)),this.probeNetwork().then((function(e){var o=v(e,2),a=o[0],i=o[1];n.setError(t,a,i).end()})),Je.e("".concat(this._n,"._onSendMessageFailed error:"),t),Go(new ko({code:t&&t.code?t.code:Ao.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===S.CONV_C2C)return Fo;if(e.conversationType===S.CONV_GROUP){var t=this.getModule(to).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return bt(n)?xo:qo}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(mo).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=this._getSendMessageSpecifiedKey(e);if(n){var o=this.getModule(mo);o.addSuccessCount(n),o.addCost(n,un(t,!1))}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n=t.code,o=void 0===n?-1:n,a=this.getModule(mo),i=this._getSendMessageSpecifiedKey(e);Oi(o)&&i&&a.addFailedCountOfUserSide(i)}}]),n}(Po),Fi=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="PluginModule",a.plugins={},a}return i(n,[{key:"registerPlugin",value:function(e){var t=this;Object.keys(e).forEach((function(n){t.plugins[n]=e[n]})),new Xo("registerPlugin").setMessage("".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}]),n}(Po),qi=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="SyncUnreadMessageModule",t._cookie="",t._onlineSyncFlag=!1,t.getInnerEmitterInstance().on(ha.A2KEY_AND_TINYID_UPDATED,t._onLoginSuccess,g(t)),t}return i(a,[{key:"_onLoginSuccess",value:function(e){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var n=this,o=e.cookie,a=e.syncFlag,i=e.isOnlineSync,s="".concat(this._n,"._startSync");Je.l("".concat(s," cookie:").concat(o," syncFlag:").concat(a," isOnlineSync:").concat(i)),this.request({protocolName:Uo.SYNC_UNREAD_MESSAGE,requestData:{cookie:o,syncFlag:a,isOnlineSync:i}}).then((function(e){var o=e.data,a=o.cookie,i=o.syncFlag;n._cookie=a,pn(a)||(0===i||1===i?(n._dispatchUnreadMessage(t(t({},e.data),{},{isSyncingEnded:!1})),n._startSync({cookie:a,syncFlag:i,isOnlineSync:0})):2===i&&n._dispatchUnreadMessage(t(t({},e.data),{},{isSyncingEnded:!0})))})).catch((function(e){Je.e("".concat(s," failed. error:"),e)}))}},{key:"_dispatchUnreadMessage",value:function(e){e.eventArray&&this.getModule(_o).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}});this.getModule(eo).onNewC2CMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded})}},{key:"startOnlineSync",value:function(){Je.l("".concat(this._n,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){Je.l("".concat(this._n,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),a}(Po),xi={request:{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"},response:{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"},ignoreKeyWord:["C2C","ID","USP"]};function Vi(e,t){if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("Expected the input to be `string | string[]`");t=Object.assign({pascalCase:!1},t);var n;return 0===(e=Array.isArray(e)?e.map((function(e){return e.trim()})).filter((function(e){return e.length})).join("-"):e.trim()).length?"":1===e.length?t.pascalCase?e.toUpperCase():e.toLowerCase():(e!==e.toLowerCase()&&(e=Hi(e)),e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(e,t){return t.toUpperCase()})).replace(/\d+(\w|$)/g,(function(e){return e.toUpperCase()})),n=e,t.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n)}var Hi=function(e){for(var t=!1,n=!1,o=!1,a=0;a<e.length;a++){var i=e[a];t&&/[a-zA-Z]/.test(i)&&i.toUpperCase()===i?(e=e.slice(0,a)+"-"+e.slice(a),t=!1,o=n,n=!0,a++):n&&o&&/[a-zA-Z]/.test(i)&&i.toLowerCase()===i?(e=e.slice(0,a-1)+"-"+e.slice(a-1),o=n,n=!1,t=!0):(t=i.toLowerCase()===i&&i.toUpperCase()!==i,o=n,n=i.toUpperCase()===i&&i.toLowerCase()!==i)}return e};function Bi(e,t){var n=0;return function e(t,o){if(++n>100)return n--,t;if(vt(t)){var a=t.map((function(t){return ht(t)?e(t,o):t}));return n--,a}if(ht(t)){var i=(s=t,r=function(e,t){if(!Dt(t))return!1;if((a=t)!==Vi(a))for(var n=0;n<xi.ignoreKeyWord.length&&!t.includes(xi.ignoreKeyWord[n]);n++);var a;return mt(o[t])?function(e){return"OPPOChannelID"===e?e:e[0].toUpperCase()+Vi(e).slice(1)}(t):o[t]},c=Object.create(null),Object.keys(s).forEach((function(e){var t=r(s[e],e);t&&(c[t]=s[e])})),c);return i=Ht(i,(function(t,n){return vt(t)||ht(t)?e(t,o):t})),n--,i}var s,r,c}(e,t)}function Ki(e,t){if(vt(e))return e.map((function(e){return ht(e)?Ki(e,t):e}));if(ht(e)){var n=(o=e,a=function(e,n){return mt(t[n])?Vi(n):t[n]},i={},Object.keys(o).forEach((function(e){i[a(o[e],e)]=o[e]})),i);return n=Ht(n,(function(e){return vt(e)||ht(e)?Ki(e,t):e}))}var o,a,i}for(var Yi=String.fromCharCode,Wi=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320){var n=0|e.charCodeAt(1);if(56320<=n&&n<=57343){if((t=(t<<10)+n-56613888|0)>65535)return Yi(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?Yi(192|t>>>6,128|63&t):Yi(224|t>>>12,128|t>>>6&63,128|63&t)},ji=function(e){for(var t=void 0===e?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,Wi),n=0|t.length,o=new Uint8Array(n),a=0;a<n;a=a+1|0)o[a]=0|t.charCodeAt(a);return o},Ji=function(e){for(var t=new Uint8Array(e),n="",o=0,a=t.length;o<a;){var i=t[o],s=0,r=0;if(i<=127?(s=0,r=255&i):i<=223?(s=1,r=31&i):i<=239?(s=2,r=15&i):i<=244&&(s=3,r=7&i),a-o-s>0)for(var c=0;c<s;)r=r<<6|63&(i=t[o+c+1]),c+=1;else r=65533,s=a-o;n+=String.fromCodePoint(r),o+=s+1}return n},zi=function(){function e(t){o(this,e),this._handler=t;var n=t.getURL();if(this._socket=null,this._workerSocket=null,this._id=kt(),this._handler.getIsWorkerEnabled()){var a=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" }); }; _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"}));this._workerSocket=new Worker(a);var i=this;this._workerSocket.onmessage=function(e){var t=e.data,n=t.callback,o=t.e;"onOpen"===n?i._onOpen():"onClose"===n?i._onClose(o):"onError"===n?i._onError(o):"onMessage"===n&&i._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:n})}else ce?ae?(le.connectSocket({url:n,header:{"content-type":"application/json"}}),le.onSocketClose(this._onClose.bind(this)),le.onSocketOpen(this._onOpen.bind(this)),le.onSocketMessage(this._onMessage.bind(this)),le.onSocketError(this._onError.bind(this))):(this._socket=le.connectSocket({url:n,header:{"content-type":"application/json"},complete:function(){}}),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))):ue&&(this._socket=new WebSocket(n),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this));this._canIUseBinaryFrame=t.canIUseBinaryFrame()}return i(e,[{key:"getID",value:function(){return this._id}},{key:"_onOpen",value:function(){this._handler.onOpen({id:this._id})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e:e})}},{key:"_onMessage",value:function(e){this._handler.onMessage({data:this._canIUseBinaryFrame?Ji(e.data):e.data})}},{key:"_onError",value:function(e){this._handler.onError({id:this._id,e:e})}},{key:"setIsWorkerEnabled",value:function(e){this._isWorkerEnabled=!0}},{key:"close",value:function(e){if(this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),ae)return le.offSocketClose(),le.offSocketMessage(),le.offSocketOpen(),le.offSocketError(),void le.closeSocket();this._socket&&(ce?(this._socket.onClose((function(){})),this._socket.onOpen((function(){})),this._socket.onMessage((function(){})),this._socket.onError((function(){}))):ue&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),oe?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){if(this._workerSocket)this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?ji(e.data).buffer:e.data});else{if(ae)return void le.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}});this._socket&&(ce?this._socket.send({data:this._canIUseBinaryFrame?ji(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):ue&&this._socket.send(this._canIUseBinaryFrame?ji(e.data).buffer:e.data))}}}]),e}(),Xi=4e3,Qi=4001,Zi=["keyMap"],$i=["keyMap"],es="connected",ts="connecting",ns="disconnected",os=function(){function e(t){o(this,e),this._channelModule=t,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=ns,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=kt(),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._setWebsocketHost(),this._initConnection()}return i(e,[{key:"_setWebsocketHost",value:function(){var e=this._channelModule.getModule(io),t=P;this._channelModule.isOversea()&&(t=U),e.isSingaporeSite()?t=b:e.isKoreaSite()?t=w:e.isGermanySite()?t=F:e.isIndiaSite()?t=q:e.isJapanSite()?t=x:e.isUSASite()?t=V:e.isIndonesiaSite()&&(t=H),B.HOST.setCurrent(t)}},{key:"_initConnection",value:function(){mt(B.HOST.CURRENT.BACKUP)||""===this._url?this._url=B.HOST.CURRENT.DEFAULT:this._url===B.HOST.CURRENT.DEFAULT?this._url=B.HOST.CURRENT.BACKUP:this._url===B.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?B.HOST.CURRENT.ANYCAST:B.HOST.CURRENT.DEFAULT:this._url===B.HOST.CURRENT.ANYCAST&&(B.HOST.CURRENT.ANYCAST="",this._url=B.HOST.CURRENT.DEFAULT);var e=this._channelModule.getModule(io).getProxyServer();pn(e)||(this._url=e),this._connect(),this._nextPingTs=0}},{key:"_canIUseAnyCast",value:function(){return ue&&B.HOST.CURRENT.ANYCAST}},{key:"onCheckTimer",value:function(e){e%1==0&&this._checkPromiseMap()}},{key:"_checkPromiseMap",value:function(){var e=this;0!==this._promiseMap.size&&this._promiseMap.forEach((function(t,n){var o=t.reject,a=t.timestamp,i=15e3;-1!==n.indexOf(Uo.LOGIN)&&(i=9e4),Date.now()-a>=i&&(Je.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new ko({code:Ao.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=un(this._startTs,!1);Je.l("".concat(this._n,"._onOpen cost:").concat(n," ms. socketID:").concat(t)),new Xo("wsOnOpen").setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=es,this._reConnectCount=0,this._resend(),!0===this._reConnectFlag&&(this._channelModule.onReconnected(),this._reConnectFlag=!1),this._channelModule.onOpen())}}},{key:"onClose",value:function(e){var t=new Xo("wsOnClose"),n=e.id,o=e.e,a="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),i=0;0!==this._onOpenTs&&(i=Date.now()-this._onOpenTs),t.setMessage(i).setCostTime(i).setMoreMessage(a).setCode(o.code).end(),Je.l("".concat(this._n,"._onClose ").concat(a," onlineTime:").concat(i)),n===this._socketID&&(this._readyState=ns,i<1e3?this._channelModule.onReconnectFailed():this._channelModule.onClose())}},{key:"onError",value:function(e){var t=e.id,n=e.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new Xo("wsOnError").setMessage(n.errMsg||St(n)).setMoreMessage(o).setLevel("error").end(),Je.w("".concat(this._n,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(u){new Xo("jsonParseError").setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=t.body;if(!this._channelModule.getModule(To).isTRTCCommand(n)){var a=zt(t.head);o=Ki(t.body,this._getResponseKeyMap(a))}if(Je.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(o)," requestID:").concat(n," has:").concat(this._promiseMap.has(n))),this._setNextPingTs(),this._promiseMap.has(n)){var i=this._promiseMap.get(n),s=i.resolve,r=i.reject,c=i.timestamp;return this._promiseMap.delete(n),this._calcRTT(c),void(o.errorCode&&0!==o.errorCode?(this._channelModule.onErrorCodeNotZero(o),r(new ko({code:o.errorCode,message:o.errorInfo||"",data:n.includes(Uo.MODIFY_C2C_MESSAGE)||n.includes(Uo.MODIFY_GROUP_MESSAGE)?{elements:o.elements,messageVersion:o.messageVersion,cloudCustomData:o.cloudCustomData}:void 0}))):s(No(o)))}this._channelModule.onMessage({head:t.head,body:o})}}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(mo).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new zi(this),this._socketID=this._socket.getID(),this._readyState=ts,Je.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new Xo("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){this._channelModule.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=Yt();(ae||$&&"windows"===e||se)&&(this._canIUseBinaryFrame=!1);var t=-1;"ios"===e?t=ye||-1:"android"===e&&(t=Ce||-1);var n=this._channelModule.getModule(io),o=this._channelModule.getPlatform(),a=n.getSDKAppID(),i=n.getInstanceID(),s="sdkappid=".concat(a,"&instanceid=").concat(i,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(e,"&version=").concat(t,"&sdkversion=").concat("3.2.3");return ee&&(s+="&isminigame=1"),this._canIUseBinaryFrame?"".concat(this._url,"/binfo?").concat(s):"".concat(this._url,"/info?").concat(s)}},{key:"_closeConnection",value:function(e){Je.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=ns)}},{key:"_resend",value:function(){var e=this;if(Je.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),this._promiseMap.size>0&&this._promiseMap.forEach((function(t,n){var o=t.uplinkData,a=t.resolve,i=t.reject;e._promiseMap.set(n,{resolve:a,reject:i,timestamp:Date.now(),uplinkData:o}),e._execute(n,o)})),this._simpleRequestMap.size>0){var t,n=D(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=v(t.value,2),a=o[0],i=o[1];this._execute(a,i)}}catch(s){n.e(s)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var n=_(e,Zi),o=this._getRequestIDFromHead(e.head),a=JSON.stringify(n);return new Promise((function(e,i){(t._promiseMap.set(o,{resolve:e,reject:i,timestamp:Date.now(),uplinkData:a}),Je.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==es)?t._reConnect():(t._execute(o,a),t._channelModule.getModule(mo).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=_(e,$i),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==es?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(n,o):Je.l("".concat(this._n,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(n,o)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:ce?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){Je.l("".concat(this._n,"._onSendFail requestID:").concat(e))}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,2415919103===this._startSequence&&(this._startSequence=kt()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResponseKeyMap",value:function(e){var n=this._channelModule.getKeyMap(e);return t(t({},xi.response),n.response)}},{key:"_reConnect",value:function(){this._readyState!==es&&this._readyState!==ts&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e=this,t="".concat(this._n,".forcedReconnect");Je.l("".concat(t," count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(Qi),this._initConnection()):(this._reConnectCount=0,this._channelModule.probeNetwork().then((function(n){var o=v(n,2),a=o[0];o[1],a?(Je.w("".concat(t," disconnected from wsserver but network is ok, continue...")),e._closeConnection(Qi),e._initConnection()):e._channelModule.onReconnectFailed()})))}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===es}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"setIsWorkerEnabled",value:function(e){Je.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&Ge}},{key:"_getRandom",value:function(){return 0===this._random&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"close",value:function(){Je.l("".concat(this._n,".close")),this._closeConnection(Xi),this._promiseMap.clear(),this._startSequence=kt(),this._readyState=ns,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),e}(),as=function(e){r(n,e);var t=f(n);function n(e){var a;if(o(this,n),(a=t.call(this,e))._n="ChannelModule",a._socketHandler=new os(g(a)),a._probing=!1,a._isAppShowing=!0,a._previousState=S.NET_STATE_CONNECTED,ce&&"function"==typeof le.onAppShow&&"function"==typeof le.onAppHide){var i=a._onAppHide.bind(g(a)),s=a._onAppShow.bind(g(a));"function"==typeof le.offAppHide&&le.offAppHide(i),"function"==typeof le.offAppShow&&le.offAppShow(s),le.onAppHide(i),le.onAppShow(s)}return a._timerForNotLoggedIn=-1,a._timerForNotLoggedIn=setInterval(a.onCheckTimer.bind(g(a)),1e3),a._fatalErrorFlag=!1,a._disconnectedTS=0,a}return i(n,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(this._timerForNotLoggedIn>0&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.getModule(_o).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule(_o).onMessage(e)}},{key:"send",value:function(e){if(!this._socketHandler)return Promise.reject();if(this._previousState!==S.NET_STATE_CONNECTED&&e.head.servcmd.includes(Uo.SSO_STAT))return this.reConnect(),this.getModule(io).getProxyServer()?Promise.resolve():this._sendLogViaHTTP(e);return this._socketHandler.send(e)}},{key:"_sendLogViaHTTP",value:function(e){var t=B.HOST.CURRENT.STAT;return new Promise((function(n,o){var a="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),i=JSON.stringify(e.body),s="application/x-www-form-urlencoded;charset=UTF-8";if(ce)le.request({url:a,data:i,method:"POST",timeout:3e3,header:{"content-type":s},success:function(){n()},fail:function(){o(new ko({code:Ao.NETWORK_ERROR}))}});else{var r=new XMLHttpRequest,c=setTimeout((function(){r.abort(),o(new ko({code:Ao.NETWORK_TIMEOUT}))}),3e3);r.onreadystatechange=function(){4===r.readyState&&(clearTimeout(c),200===r.status||304===r.status?n():o(new ko({code:Ao.NETWORK_ERROR})))},r.open("POST",a,!0),r.setRequestHeader("Content-type",s),r.send(i)}}))}},{key:"simplySend",value:function(e){return this._socketHandler?this._socketHandler.simplySend(e):Promise.reject()}},{key:"onOpen",value:function(){this._ping()}},{key:"onClose",value:function(){this._socketHandler&&(this._socketHandler.getReconnectFlag()&&this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){ce&&!se&&this.outputWarning("DomainNameInMP"),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule(_o).getKeyMap(e)}},{key:"_onAppHide",value:function(){this._isAppShowing=!1}},{key:"_onAppShow",value:function(){this._isAppShowing=!0}},{key:"onRequestTimeout",value:function(e){}},{key:"onReconnected",value:function(){Je.l("".concat(this._n,".onReconnected cost:").concat(un(this._disconnectedTS,!0,!1))),this._m.restartTimer(),this.getModule(_o).onReconnected(un(this._disconnectedTS,!1,!1)),this._disconnectedTS=0,this._emitNetStateChangeEvent(S.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){Je.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this._socketHandler&&(t=this._socketHandler.getReconnectFlag());var n="forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t);if(Je.l("".concat(this._n,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===S.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(S.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(Je.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),e===S.NET_STATE_DISCONNECTED&&0===this._disconnectedTS&&(this._disconnectedTS=Date.now()),this._previousState=e,this.emitOuterEvent(E.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule(_o).getProtocolData({protocolName:Uo.PING});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Je.w("".concat(e._n,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new Xo("error").setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(co).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];Je.l("".concat(e._n,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(a)),o?e.reConnect():e._emitNetStateChangeEvent(S.NET_STATE_DISCONNECTED)}))}))}}},{key:"_checkNextPing",value:function(){this._socketHandler&&(this._socketHandler.isConnected()&&Date.now()>=this._socketHandler.getNextPingTs()&&this._ping())}},{key:"dealloc",value:function(){this._socketHandler&&(this._socketHandler.close(),this._socketHandler=null),this._timerForNotLoggedIn>-1&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._previousState=S.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0}}]),n}(Po),is=["a2","tinyid"],ss=["a2","tinyid"],rs=function(){function e(t){o(this,e),this._n="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return i(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead();this._configMap.set(Uo.LOGIN,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(Uo.LOGOUT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(Uo.HELLO,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Uo.KICK_OTHER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.STAT_SERVICE,".").concat(Uo.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(Uo.COS_SIGN,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_COS_SIGN,".").concat(Uo.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(Uo.COS_PRE_SIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(Uo.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(Uo.SIMPLE_COS_PRE_SIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(Uo.SIMPLE_COS_PRE_SIG)}),body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{request:{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"},response:{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"}}}}(n)),this._configMap.set(Uo.GET_IMAGE_INFO,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(Uo.GET_IMAGE_INFO)}),body:{imageUrl:""},keyMap:{request:{imageUrl:"str_image_url"},response:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}}(n)),this._configMap.set(Uo.GET_IP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(Uo.GET_IP)}),body:{domainName:""},keyMap:{request:{domainName:"str_domain"},response:{str_final_ip:"ip"}}}}(n)),this._configMap.set(Uo.VIDEO_COVER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.CUSTOM_UPLOAD,".").concat(Uo.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(Uo.FETCH_COMMERCIAL_CONFIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(Uo.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(Uo.PUSHED_COMMERCIAL_CONFIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(Uo.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(Uo.FETCH_CLOUD_CONTROL_CONFIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(Uo.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(Uo.PUSHED_CLOUD_CONTROL_CONFIG,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_CONFIG_MANAGER,".").concat(Uo.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(Uo.OVERLOAD_NOTIFY,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OVERLOAD_PUSH,".").concat(Uo.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(Uo.SYNC_UNREAD_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SYNC_UNREAD_MESSAGE)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),this._configMap.set(Uo.GET_PROFANITY_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_MSG_AUDIT_MGR,".").concat(Uo.GET_PROFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(e)),this._configMap.set(Uo.SEND_C2C_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SEND_C2C_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(Uo.SEND_GROUP_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(Uo.REVOKE_C2C_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(Uo.REVOKE_GROUP_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(Uo.GET_C2C_ROAMING_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.GET_C2C_ROAMING_MESSAGE)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(e)),this._configMap.set(Uo.MODIFY_C2C_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(Uo.GET_GROUP_ROAMING_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_ROAMING_MESSAGE)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",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"}}}}(e)),this._configMap.set(Uo.SET_C2C_MESSAGE_READ,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(Uo.SET_C2C_PEER_MUTE_NOTIFICATIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Uo.GET_C2C_PEER_MUTE_NOTIFICATIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{toAccount:void 0,userIDList:void 0},keyMap:{request:{userIDList:"Peer_Account"},response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(Uo.SET_GROUP_MESSAGE_READ,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(Uo.SET_ALL_MESSAGE_READ,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(Uo.DELETE_C2C_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(Uo.DELETE_GROUP_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(Uo.TRANSLATE_TEXT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_TRANSLATE,".").concat(Uo.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(Uo.VOICE_TO_TEXT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_SPEECH,".").concat(Uo.VOICE_TO_TEXT)}),body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{request:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},response:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(Uo.MODIFY_GROUP_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(Uo.GET_READ_RECEIPT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(Uo.SEND_C2C_READ_RECEIPT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(Uo.SEND_READ_RECEIPT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(Uo.GET_READ_RECEIPT_DETAIL,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(Uo.MODIFY_C2C_MESSAGE_EXTENSIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Uo.GET_C2C_MESSAGE_EXTENSIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Uo.MODIFY_GROUP_MESSAGE_EXTENSIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Uo.GET_GROUP_MESSAGE_EXTENSIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(Uo.MESSAGE_CLOUD_SEARCH,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.MESSAGE_SEARCH,".").concat(Uo.MESSAGE_CLOUD_SEARCH)}),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:{request:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList"},response:{GroupID:"groupID",UserID:"userID",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",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(Uo.ADD_C2C_MSG_REACTION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.ADD_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{request:{userIDList:"Add_Account"}}}}(e)),this._configMap.set(Uo.REMOVE_C2C_MSG_REACTION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.REMOVE_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{request:{userIDList:"Del_Account"}}}}(e)),this._configMap.set(Uo.GET_C2C_MSG_REACTIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.GET_C2C_MSG_REACTIONS)}),body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}}(e)),this._configMap.set(Uo.GET_C2C_MSG_REACTION_USER_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.GET_C2C_MSG_REACTION_USER_LIST)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}}(e)),this._configMap.set(Uo.ADD_GRP_MSG_REACTION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.ADD_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{request:{userIDList:"Add_Account"}}}}(e)),this._configMap.set(Uo.REMOVE_GRP_MSG_REACTION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.REMOVE_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{request:{userIDList:"Del_Account"}}}}(e)),this._configMap.set(Uo.GET_GRP_MSG_REACTIONS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.GET_GRP_MSG_REACTIONS)}),body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{response:{MsgSeq:"messageSequence"}}}}(e)),this._configMap.set(Uo.GET_GRP_MSG_REACTION_USER_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM_MSG_EXT,".").concat(Uo.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}}}(e)),this._configMap.set(Uo.GET_C2C_PEER_READ_TIME,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.GET_C2C_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Uo.PAGING_GET_CONVERSATION_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.PAGING_GET_CONVERSATION_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:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}}(e)),this._configMap.set(Uo.DELETE_CONVERSATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.DELETE_CONVERSATION)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},response:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}}(e)),this._configMap.set(Uo.CLEAR_HISTORY_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(e)),this._configMap.set(Uo.PIN_CONVERSATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(Uo.DELETE_GROUP_AT_TIPS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Uo.SET_CONVERSATION_CUSTOM_DATA,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Uo.MARK_CONVERSATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Uo.CREATE_CONVERSATION_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.RENAME_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(Uo.DELETE_CONVERSATION_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(e)),this._configMap.set(Uo.RENAME_CONVERSATION_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.RENAME_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(e)),this._configMap.set(Uo.ADD_CONVERSATIONS_TO_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.RENAME_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Uo.DELETE_CONVERSATIONS_FROM_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.RENAME_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(Uo.GET_CONVERSATION_GROUP_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.RECENT_CONTACT,".").concat(Uo.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(e)),this._configMap.set(Uo.GET_USER_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.PROFILE,".").concat(Uo.GET_USER_PROFILE)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Uo.UPDATE_MY_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.PROFILE,".").concat(Uo.UPDATE_MY_PROFILE)}),body:{fromAccount:"",profileItem:[{tag:Xe.NICK,value:""},{tag:Xe.GENDER,value:""},{tag:Xe.ALLOWTYPE,value:""},{tag:Xe.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Uo.GET_BLACKLIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Uo.ADD_TO_BLACKLIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.ADD_TO_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Uo.REMOVE_FROM_BLACKLIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.REMOVE_FROM_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Uo.SET_SELF_STATUS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(Uo.GET_USER_STATUS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(Uo.SUBSCRIBE_USER_STATUS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(Uo.UNSUBSCRIBE_USER_STATUS,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(Uo.GET_FRIEND_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.GET_FRIEND_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{response:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}}(e)),this._configMap.set(Uo.ADD_FRIEND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.ADD_FRIEND)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{request:{source:"AddSource",wording:"AddWording",type:"AddType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.UPDATE_FRIEND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.UPDATE_FRIEND)}),body:{fromAccount:"",updateItem:void 0},keyMap:{request:{snsItem:"SnsItem"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.DELETE_FRIEND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.DELETE_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"DeleteType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.GET_FRIEND_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.GET_FRIEND_PROFILE)}),body:{fromAccount:"",userIDList:void 0},keyMap:{response:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}}(e)),this._configMap.set(Uo.CHECK_FRIEND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.CHECK_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"CheckType"},response:{InfoItem:"resultList"}}}}(e)),this._configMap.set(Uo.GET_FRIEND_APPLICATION_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.GET_FRIEND_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{response:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}}(e)),this._configMap.set(Uo.RESPOND_FRIEND_APPLICATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.RESPOND_FRIEND_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{request:{tag:"TagName",action:"ResponseAction"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.DELETE_FRIEND_APPLICATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.DELETE_FRIEND_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{request:{type:"PendencyType",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.REPORT_FRIEND_APPLICATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.REPORT_FRIEND_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{request:{latestTimeStamp:"LatestPendencyTimeStamp"}}}}(e)),this._configMap.set(Uo.CREATE_FRIEND_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.CREATE_FRIEND_GROUP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{request:{groupName:"GroupName",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.DELETE_FRIEND_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.DELETE_FRIEND_GROUP)}),body:{fromAccount:"",nameList:void 0},keyMap:{request:{nameList:"GroupName"}}}}(e)),this._configMap.set(Uo.GET_FRIEND_GROUP_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.GET_FRIEND_GROUP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{response:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}}(e)),this._configMap.set(Uo.UPDATE_FRIEND_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.FRIEND,".").concat(Uo.UPDATE_FRIEND_GROUP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{request:{oldName:"GroupOldName",newName:"GroupNewName"},response:{UpdateType:"type",ResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.GET_GROUP_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_LIST)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(e)),this._configMap.set(Uo.GET_GROUP_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_PROFILE)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Uo.CREATE_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(Uo.DISMISS_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.DISMISS_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Uo.UPDATE_GROUP_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.UPDATE_GROUP_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:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(Uo.APPLY_JOIN_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(Uo.APPLY_JOIN_GROUP_NOAUTH,function(e){return e.a2,e.tinyid,{head:t(t({},_(e,is)),{},{servcmd:"".concat(B.NAME.BIG_GROUP_NO_AUTH,".").concat(Uo.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(Uo.QUIT_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Uo.SEARCH_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.SEARCH_GROUP)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(Uo.CHANGE_GROUP_OWNER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(Uo.HANDLE_GROUP_APPLICATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.HANDLE_GROUP_APPLICATION)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Uo.HANDLE_INVITE_JOIN_GROUP,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}}(e)),this._configMap.set(Uo.HANDLE_GROUP_INVITATION,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Uo.GET_GROUP_PENDENCY,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_PENDENCY)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"},response:{To_Account:"userID",ApplyInviteMsg:"note"}}}}(e)),this._configMap.set(Uo.DELETE_GROUP_SYSTEM_NOTICE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.DELETE_GROUP_SYSTEM_NOTICE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Uo.AVCHATROOM_POLLING,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.BIG_GROUP_LONG_POLLING,".").concat(Uo.AVCHATROOM_POLLING)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(Uo.AVCHATROOM_NOAUTH_POLLING,function(e){return e.a2,e.tinyid,{head:t(t({},_(e,ss)),{},{servcmd:"".concat(B.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(Uo.AVCHATROOM_POLLING)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(Uo.GET_ONLINE_MEMBER_NUM,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0},keyMap:{response:{OnlineMemberNum:"memberCount"}}}}(e)),this._configMap.set(Uo.SET_GROUP_ATTRIBUTES,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Uo.MODIFY_GROUP_ATTRIBUTES,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Uo.DELETE_GROUP_ATTRIBUTES,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(Uo.CLEAR_GROUP_ATTRIBUTES,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(Uo.GET_GROUP_ATTRIBUTES,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_ATTR,".").concat(Uo.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(Uo.GET_GROUP_NOTIFY,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_NOTIFY)}),body:{notifyReqList:[]},keyMap:{request:{notifyReqList:"NotifyReqList"},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}}(e)),this._configMap.set(Uo.UPDATE_GROUP_COUNTER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(e)),this._configMap.set(Uo.GET_GROUP_COUNTER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(e)),this._configMap.set(Uo.CREATE_TOPIC,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(Uo.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(Uo.DELETE_TOPIC,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(Uo.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(Uo.UPDATE_TOPIC_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(Uo.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(Uo.GET_TOPIC_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_COMMUNITY,".").concat(Uo.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(e)),this._configMap.set(Uo.GET_GROUP_MEMBER_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(Uo.GET_AVCHATROOM_MEMBER_LIST,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_AVCHATROOM,".").concat(Uo.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(e)),this._configMap.set(Uo.GET_GROUP_MEMBER_PROFILE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.GET_GROUP_MEMBER_PROFILE)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Uo.ADD_GROUP_MEMBER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set(Uo.DELETE_GROUP_MEMBER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(Uo.BAN_AVCHATROOM_MEMBER,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(e)),this._configMap.set(Uo.MODIFY_GROUP_MEMBER_INFO,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP,".").concat(Uo.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(Uo.MARK_AVCHATROOM_MEMBER_INFO,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.GROUP_AVCHATROOM,".").concat(Uo.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(e)),this._configMap.set(Uo.SSO_STAT,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STAT,".").concat(Uo.SSO_STAT)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(Uo.PING,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.HEARTBEAT,".").concat(Uo.PING)}),body:{}}}(e)),this._configMap.set(Uo.MESSAGE_PUSH,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_PUSH,".").concat(Uo.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(Uo.MULTI_MESSAGE_PUSH,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_PUSH,".").concat(Uo.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(Uo.MESSAGE_PUSH_ACK,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.OPEN_IM,".").concat(Uo.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(Uo.STATUS_FORCE_OFFLINE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(Uo.DOWNLOAD_MERGER_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_LONG_MESSAGE,".").concat(Uo.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(Uo.UPLOAD_MERGER_MESSAGE,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_LONG_MESSAGE,".").concat(Uo.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e)),this._configMap.set(Uo.SET_TOKEN,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(e)),this._configMap.set(Uo.STAT_FOREGROUND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(Uo.STAT_BACKGROUND,function(e){return{head:t(t({},e),{},{servcmd:"".concat(B.NAME.IM_OPEN_STATUS,".").concat(Uo.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Je.w("".concat(this._n,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),a=null;if(n){var i=this._simpleDeepCopy(o),s=this._updateService(n,i),r=s.body,c=Object.create(null);for(var u in r)if(Object.prototype.hasOwnProperty.call(r,u)){if(c[u]=r[u],void 0===n[u])continue;c[u]=n[u]}s.body=c,a=this._getUplinkData(s)}else a=this._getUplinkData(o);return a}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=zt(t.head),o=Bi(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=zt(t.head);if(this._isFromGroupRequest(t)){var o=e.type,a=e.groupID,i=void 0===a?void 0:a,s=e.groupIDList,r=void 0===s?[]:s;mt(i)&&(i=r[0]||""),wt({type:o,groupID:i})&&(t.head.servcmd="".concat(B.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(B.NAME.GROUP)||e.head.servcmd.includes(B.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},xi.request),n.request)}},{key:"_requestDataCleaner",value:function(e){var t=Array.isArray(e)?[]:Object.create(null);for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&Dt(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},a=0,i=n.length;a<i;a++)t=n[a],vt(e[t])?o[t]=Array.from(e[t]):ht(e[t])?o[t]=this._simpleDeepCopy(e[t]):o[t]=e[t];return o}}]),e}(),cs=[Uo.MESSAGE_PUSH_ACK],us=function(){function e(t){o(this,e),this._sessionModule=t,this._n="DownlinkHandler",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._c2cMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._groupMessageArrayHandler.bind(this)),this._eventHandlerMap.set("groupTips",this._groupTipsHandler.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._C2CNotifyMessageArrayHandler.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._C2CReadReceiptArrayHandler.bind(this)),this._eventHandlerMap.set("profileModify",this._profileHandler.bind(this)),this._eventHandlerMap.set("friendListMod",this._relationChainHandler.bind(this)),this._eventHandlerMap.set("recentContactMod",this._recentContactHandler.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._allMessageReadHandler.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._c2cMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._groupMessageModifiedHandler.bind(this)),this._eventHandlerMap.set("userStatusList",this._userStatusListHandler.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._messageExtensionNotifyHandler.bind(this)),this._eventHandlerMap.set("messageReactionNotifyList",this._messageReactionNotifyListHandler.bind(this)),this._eventHandlerMap.set("messageReactionNotify",this._messageReactionNotifyHandler.bind(this)),this._keys=m(this._eventHandlerMap.keys())}return i(e,[{key:"_c2cMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(eo);if(t){if(e.dataList.forEach((function(e){if(1===e.isSyncMessage){var t=e.from;e.from=e.to,e.to=t}})),1===e.needSync)this._sessionModule.getModule(po).startOnlineSync();t.onNewC2CMessage({dataList:e.dataList,isInstantMessage:!0})}}},{key:"_c2cMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(eo);t&&t.onC2CMessageModified(e)}},{key:"_groupMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(to);t&&t.onNewGroupMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_groupMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(to);t&&t.onGroupMessageModified(e)}},{key:"_groupTipsHandler",value:function(e){var t=this._sessionModule.getModule(to);if(t){var n=e.event,o=e.dataList,a=e.isInstantMessage,i=void 0===a||a,s=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:o});break;case 5:for(var r=0;r<o.length;r++)if(vt(o[r].elements.revokedInfos))t.onGroupMessageRevoked({dataList:o});else if(vt(o[r].elements.groupMessageReadNotice))t.onGroupMessageReadNotice({dataList:o});else{if(!vt(o[r].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:o,isInstantMessage:i,isSyncingEnded:s});break}t.onReadReceiptList({dataList:o})}break;case 12:this._sessionModule.getModule(ao).onNewGroupAtTips({dataList:o});break;default:Je.l("".concat(this._n,"._groupTipsHandler unknown event:").concat(n," dataList:"),o)}}}},{key:"_C2CNotifyMessageArrayHandler",value:function(e){var t=this,n=e.dataList;if(vt(n)){var o=this._sessionModule.getModule(eo);n.forEach((function(e){if(ft(e))if(e.hasOwnProperty("kickoutMsgNotify")){var a=e.kickoutMsgNotify,i=a.kickType,s=a.newInstanceInfo,r=void 0===s?{}:s;1===i?t._sessionModule.onMultipleAccountKickedOut(r):2===i?t._sessionModule.onMultipleDeviceKickedOut(r):3===i&&t._sessionModule.onRestApiKickedOut(r)}else if(e.hasOwnProperty("c2cMessageRevokedNotify"))o&&o.onC2CMessageRevoked({dataList:n});else if(e.hasOwnProperty("c2cMessageReadReceipt"))o&&o.onC2CMessageReadReceipt({dataList:n});else if(e.hasOwnProperty("c2cMessageReadNotice"))o&&o.onC2CMessageReadNotice({dataList:n});else if(e.hasOwnProperty("muteNotificationsSync")){t._sessionModule.getModule(ao).onC2CMessageRemindTypeSynced({dataList:n})}}))}}},{key:"_C2CReadReceiptArrayHandler",value:function(e){this._sessionModule.getModule(eo).onReadReceiptList(e)}},{key:"_profileHandler",value:function(e){this._sessionModule.getModule($n).onProfileModified({dataList:e.dataList});var t=this._sessionModule.getModule(no);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_relationChainHandler",value:function(e){this._sessionModule.getModule($n).onRelationChainModified({dataList:e.dataList});var t=this._sessionModule.getModule(no);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_recentContactHandler",value:function(e){var t=e.dataList;if(vt(t)){var n=this._sessionModule.getModule(ao);n&&t.forEach((function(e){var t=e.pushType;if(1===t){var o=e.recentContactDeleteItem;n.onConversationDeleted(o.recentContactList)}else if(2===t){var a=e.recentContactTopItem;n.onConversationPinned(a.recentContactList)}else if(3===t){var i=e.recentContactTopItem;n.onConversationUnpinned(i.recentContactList)}else if(4===t){var s=e.recentContactMarkContact;n.onConversationMarkUpdated(s.recentContactMarkContactItem)}else if(5===t){var r=e.recentContactCreateContactGroup;n.onConversationGroupCreated(r.msgContactGroupContactItem)}else if(6===t){var c=e.recentContactDelContactGroup;n.onConversationGroupDeleted(c.msgGroupItem)}else if(7===t){var u=e.recentContactUpdateContactGroup,l=u.updateType,d=u.msgUpdateGroup,p=u.msgUpdateContact;if(1===l){var _=d.updateGroupType;1===_?n.onConversationGroupNameUpdated(d):2===_&&n.onConversationInGroupUpdated(d)}else 2===l&&n.onConversationAddedToOrDeletedFromGroup(p)}}))}}},{key:"_allMessageReadHandler",value:function(e){var t=e.dataList,n=this._sessionModule.getModule(ao);n&&n.onPushedAllMessageRead(t)}},{key:"_userStatusListHandler",value:function(e){this._sessionModule.getModule($n).onUserStatusUpdated(e)}},{key:"_messageExtensionNotifyHandler",value:function(e){this._sessionModule.getModule(Zn).onMessageExtensionNotify(e)}},{key:"_messageReactionNotifyListHandler",value:function(e){this._sessionModule.getModule(So).onMessageReactionNotifyList(e)}},{key:"_messageReactionNotifyHandler",value:function(e){this._sessionModule.getModule(So).onMessageReactionNotify(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMessageFromIMOpenPush(e)){var o=n.eventArray,a=n.isInstantMessage,i=n.isSyncingEnded,s=n.needSync;if(vt(o))for(var r=null,c=null,u=0,l=0,d=o.length;l<d;l++)if(100!==(u=(r=o[l]).event)){var p=Object.keys(r).find((function(e){return-1!==t._keys.indexOf(e)}));p?(c=14===u?{readAllC2CMessage:r[p],groupMessageReadInfoList:r.groupMessageReadNotice||[]}:16===u?{userID:r.userID,readReceiptList:r[p]}:r[p],this._eventHandlerMap.get(p)({event:u,dataList:c,isInstantMessage:a,isSyncingEnded:i,needSync:s})):Je.l("".concat(this._n,".onMessage unknown eventItem:").concat(r))}else this._onRoomCustomData(r.content)}}},{key:"_onRoomCustomData",value:function(e){this._sessionModule.getModule(To).onRoomCustomDataReceived(e)}},{key:"_filterMessageFromIMOpenPush",value:function(e){var t=e.head,n=e.body,o=t.servcmd,a=!1;if(mt(o)||(a=o.includes(B.NAME.IM_CONFIG_MANAGER)||o.includes(B.NAME.OVERLOAD_PUSH)||o.includes(B.NAME.STAT_SERVICE)),!a)return!0;if(o.includes(Uo.PUSHED_CLOUD_CONTROL_CONFIG))this._sessionModule.getModule(ho).onPushedCloudControlConfig(n);else if(o.includes(Uo.PUSHED_COMMERCIAL_CONFIG)){this._sessionModule.getModule(Mo).onPushedConfig(n)}else if(o.includes(Uo.OVERLOAD_NOTIFY))this._sessionModule.onPushedServerOverload(n);else if(o.includes(Uo.KICK_OTHER)){var i=Date.now();this._sessionModule.reLoginOnKickOther();var s=new Xo("kickOther"),r=this._sessionModule.getModule(Xn).getLastWsHelloTs(),c=i-r;s.setMessage("last wshello time:".concat(r," diff:").concat(c,"ms")).setNetworkType(this._sessionModule.getNetworkType()).end()}return!1}}]),e}(),ls=[{cmd:Uo.GET_GROUP_PROFILE,interval:1,count:8},{cmd:Uo.UPDATE_GROUP_PROFILE,interval:1,count:8},{cmd:Uo.GET_AVCHATROOM_MEMBER_LIST,interval:3,count:1},{cmd:Uo.GET_GROUP_PENDENCY,interval:1,count:15},{cmd:Uo.GET_TOPIC_LIST,interval:1,count:10},{cmd:Uo.SET_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Uo.MODIFY_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Uo.DELETE_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Uo.CLEAR_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:Uo.GET_GROUP_ATTRIBUTES,interval:5,count:20},{cmd:Uo.UPDATE_GROUP_COUNTER,interval:5,count:20},{cmd:Uo.GET_GROUP_COUNTER,interval:5,count:20},{cmd:Uo.SET_ALL_MESSAGE_READ,interval:1,count:1},{cmd:Uo.GET_USER_STATUS,interval:5,count:20},{cmd:Uo.SUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:Uo.UNSUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:Uo.MESSAGE_CLOUD_SEARCH,interval:1,count:2}],ds=new Map,ps=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],_s=0,gs=ps.length;_s<gs;_s++)ds.set(_s,ps[_s]);function hs(e){var t,n,o=e;e.length%8!=0&&(o="0".repeat(8-e.length%8)+e);for(var a="",i=0,s=o.length;i<s;i+=8)t=parseInt(o.slice(i,i+4),2),n=parseInt(o.slice(i+4,i+8),2),a+=ds.get(t)+ds.get(n);return a}var fs=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="SessionModule",t._platform=t.getPlatform(),t._protocolHandler=new rs(g(t)),t._messageDispatcher=new us(g(t)),t._commandFrequencyLimitMap=new Map,t._commandRequestInfoMap=new Map,t._serverOverloadInfoMap=new Map,t._incrementalPullContactFlag=!0,t._init(),t.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(ls)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");mt(e)||(e=JSON.parse(e),this._updateCommandFrequencyLimitMap(e))}},{key:"_updateCommandFrequencyLimitMap",value:function(e){var t=this;e.forEach((function(e){t._commandFrequencyLimitMap.set(e.cmd,{interval:e.interval,count:e.count})}))}},{key:"updateProtocolConfig",value:function(){this._protocolHandler.update()}},{key:"request",value:function(e){Je.d("".concat(this._n,".request options:"),e);var t=e.protocolName,n=e.tjgID;if(!this._protocolHandler.has(t))return Je.w("".concat(this._n,".request unknown protocol:").concat(t)),Go({code:Ao.CANNOT_FIND_PROTOCOL});var o,a=this.getProtocolData(e),i=a.head.servcmd;if(this._isFrequencyOverLimit(i))return Go({code:o=Ao.OVER_FREQUENCY_LIMIT,message:this.getErrorMessage(o,this._getCmd(i))});if(this._isServerOverload(i))return Go({code:o=Ao.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrorMessage(o,this._getCmd(i))});pn(n)||(a.head.tjgID=n);var s=this.getModule(go);return cs.includes(t)?s.simplySend(a):s.send(a)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.getModule(io);return{ver:"v4",platform:this._platform,websdkappid:G,websdkversion:O,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:192371,sdkability_ext:hs(""),cappid:e.getApplicationID(),tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.getModule(io);return{ver:"v4",platform:this._platform,websdkappid:G,websdkversion:O,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:192371,sdkability_ext:hs(""),cappid:e.getApplicationID()}}},{key:"genSSOReportHead",value:function(){var e=this.getModule(io);return{ver:"v4",platform:this._platform,websdkappid:G,websdkversion:O,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:192371,sdkability_ext:hs(""),cappid:e.getApplicationID()}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"trans",value:function(e){var n=e.servcmd,o=e.data,a={head:t(t({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(go).send(a)}},{key:"sendComboMessage",value:function(e){var n=e.servcmd,o=e.data,a={head:t(t({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(go).send(a)}},{key:"onErrorCodeNotZero",value:function(e){var t=e.errorCode;if(t===Ao.HELLO_ANSWER_KICKED_OUT){var n=e.kickType,o=e.newInstanceInfo,a=void 0===o?{}:o;1===n?this.onMultipleAccountKickedOut(a):2===n?this.onMultipleDeviceKickedOut(a):3===n&&this.onRestApiKickedOut(a)}t!==Ao.MSG_A2KEY_EXPIRED&&t!==Ao.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.getModule(go).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,n=t.needAck,o=void 0===n?0:n,a=t.sessionData;1===o&&this._sendACK(a),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){Je.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){Je.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e=this,t="".concat(this._n,"._reLogin");if(this.isLoggedIn()){var n=0,o=this.getModule(Io);o.canIUseOfflinePush()&&(n=o.getUniAppPlatform()),this.request({protocolName:Uo.LOGIN,requestData:{isWebUniapp:n}}).then((function(n){var o=n.data.instanceID;e.getModule(io).setStatusInstanceID(o),Je.l("".concat(t," ok. instanceID:").concat(o)),e.getModule(ao).syncConversationList(e._incrementalPullContactFlag).then((function(){Je.l("".concat(t,", sync conversation list ok.")),e.getModule(vo).start()}));var a=e.getModule(to);a&&a.updateLocalMainSequenceOnReconnected();var i=e.getModule(oo);i.resetGetTopicTime(),i.getTopicListOnReconnected()}))}}},{key:"onMultipleAccountKickedOut",value:function(e){this.getModule(Xn).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.getModule(Xn).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.getModule(Xn).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.getModule(Xn).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.request({protocolName:Uo.MESSAGE_PUSH_ACK,requestData:{sessionData:e}})}},{key:"_isFrequencyOverLimit",value:function(e){var t=e.split(".")[1];if(!this._commandFrequencyLimitMap.has(t))return!1;if(!this._commandRequestInfoMap.has(t))return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;var n=this._commandFrequencyLimitMap.get(t),o=n.count,a=n.interval,i=this._commandRequestInfoMap.get(t),s=i.startTime,r=i.requestCount;if(Date.now()-s>1e3*a)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;r+=1,this._commandRequestInfoMap.set(t,{startTime:s,requestCount:r});var c=!1;return r>o&&(c=!0),c}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,a=!1;return Date.now()-n<=1e3*o?a=!0:(this._serverOverloadInfoMap.delete(e),a=!1),a}},{key:"_getCmd",value:function(e){var t="";if(!e.includes("."))return t;var n=e.split(".")[1];for(var o in Uo)if(Uo[o]===n){t=o;break}return t}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),Je.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(n,"s cmd:").concat(this._getCmd(t)))}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._updateCommandFrequencyLimitMap(ls),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear(),this._incrementalPullContactFlag=!0}}]),a}(Po),vs=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="CloudControlModule",a._cloudConfig=new Map,a._expiredTime=0,a._version=0,a._isFetching=!1,a}return i(n,[{key:"getCloudConfig",value:function(e){return mt(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"getServerConfig",value:function(e){var t={code:0,data:""};return!mt(e)&&this._cloudConfig.has(e)&&(t.data=this._cloudConfig.get(e)),Promise.resolve(t)}},{key:"_canFetchConfig",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(Je.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(t)),t){var n=new Xo("fetchCloudControlConfig"),o=this.getModule(io).getSDKAppID();this._isFetching=!0,this.request({protocolName:Uo.FETCH_CLOUD_CONTROL_CONFIG,requestData:{SDKAppID:o,version:this._version}}).then((function(t){e._isFetching=!1,n.setMessage("version:".concat(e._version," newVersion:").concat(t.data.version," config:").concat(t.data.cloudControlConfig)).setNetworkType(e.getNetworkType()).end(),Je.l("".concat(e._n,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=v(e,2),a=o[0],i=o[1];n.setError(t,a,i).end()})),Je.l("".concat(e._n,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){Je.l("".concat(this._n,".onPushedCloudControlConfig")),new Xo("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._n,"._parseCloudControlConfig"),o=e.errorCode,a=e.errorMessage,i=e.cloudControlConfig,s=e.version,r=e.expiredTime;if(0===o){if(this._version!==s){var c=null;try{c=JSON.parse(i)}catch(u){this.isPrivateNetWork()||Je.e("".concat(n," JSON parse error. cloudControlConfig:"),i)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach((function(e){t._cloudConfig.set(e,c[e])})),this._version=s,this.emitInnerEvent(ha.CLOUD_CONFIG_UPDATED))}this._expiredTime=Date.now()+1e3*r}else mt(o)?(Je.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Je.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(a)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(Po),ms=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="RecoverMessageModule",a.PULL_LIMIT_COUNT=15,a}return i(n,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n=this,o=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_GROUP&&e.groupProfile.type!==S.GRP_AVCHATROOM})),a=this.getModule(ao),i=0,s=0,r=0,c=[];o.forEach((function(o){var u=o.conversationID,l=o.lastMessage;t=u.replace(S.CONV_GROUP,""),e=a.getLocalLastMessage(u),l&&0!==l.lastSequence&&e?(s=l.lastSequence,i=e.sequence,r=s-i,i>0&&r>=1&&r<300?n._recoverGroupMessage({groupID:t,localLastMessageSequence:i,remoteLastMessageSequence:s}):c.push(t)):c.push(t)})),this._getGroupNotify(c)}},{key:"_recoverC2CChat",value:function(){var e,t=this,n=this._getLocalConversationList().filter((function(e){return e.type===S.CONV_C2C})),o=this.getModule(ao),a=0,i=0,s=0,r=[Promise.resolve()];n.forEach((function(n){var c=n.conversationID,u=n.lastMessage;e=o.getLocalLastMessage(c),u&&0!==u.lastTime&&e&&(i=u.lastTime,a=e.time,s=i-a,a>0&&s>=1&&s<=600&&r.push(t._recoverC2CMessage({conversationID:c,localLastMessageTime:a,remoteLastMessageTime:i})))})),Promise.all(r).then((function(){Je.l("".concat(t._n,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),t.getModule(po).startSyncOnReconnected()}))}},{key:"_getLocalConversationList",value:function(){return this.getModule(ao).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var t=this,n="".concat(this._n,"._recoverGroupMessage");Je.l("".concat(n," options:"),e);var o=e.groupID,a=e.localLastMessageSequence,i=e.remoteLastMessageSequence;this._getGroupRoamingMessage({groupID:o,sequence:a}).then((function(e){var a=e.data,s=a.complete,r=a.messageList;if(!mt(r)){var c=r[0].sequence,u="groupID:".concat(o," pkgLastSequence:").concat(c," remoteLastSequence:").concat(i," complete:").concat(s," count:").concat(r.length);Je.l("".concat(n," ").concat(u)),c<i&&2!==s&&t._recoverGroupMessage({groupID:o,localLastMessageSequence:c,remoteLastMessageSequence:i}),new Xo("recoverMessage").setNetworkType(t.getNetworkType()).setMessage(u).end();var l=t.getModule(to);r.length>1&&r.sort((function(e,t){return e.sequence-t.sequence}));for(var d=0;d<r.length;d++){var p=r[d];p.from!==S.CONV_SYSTEM?l.onNewGroupMessage({dataList:[p],isInstantMessage:!1,updateUnreadCount:!1}):l.onNewGroupTips({event:p.event,dataList:[p]})}t._getGroupNotify([o])}}))}},{key:"_genMultiGroupIDList",value:function(e,t){var n=t&&t>1?t:1,o=e.length,a=[];if(o>0)for(var i=0;i<o;i+=n)a.push(e.slice(i,i+n));return a}},{key:"_getGroupNotify",value:function(e){var t=this._genMultiGroupIDList(e,10);if(t.length>0)for(var n=this.getModule(to),o=0,a=t.length;o<a;o++)n.getGroupNotify(t[o])}},{key:"_getGroupRoamingMessage",value:function(e){var t=e.groupID,n=e.sequence;return this.request({protocolName:Uo.GET_GROUP_ROAMING_MESSAGE,requestData:{groupID:t,count:this.PULL_LIMIT_COUNT,sequence:n+this.PULL_LIMIT_COUNT-1}})}},{key:"_recoverC2CMessage",value:function(e){var t=this,n="".concat(this._n,"._recoverC2CMessage");Je.l("".concat(n," options:"),e);var o=e.conversationID,a=e.localLastMessageTime,i=e.remoteLastMessageTime;return this._getC2CRoamingMessage({conversationID:o,time:a}).then((function(e){var a=e.data,s=a.complete,r=a.messageList;if(!mt(r)){var c=r.length;t.getModule(eo).onNewC2CMessage({dataList:r,isInstantMessage:!0});var u=r[c-1].time,l=o.replace(S.CONV_C2C,""),d="peerAccount:".concat(l," pkgLastTime:").concat(u," remoteLastTime:").concat(i," complete:").concat(s," count:").concat(c);if(Je.l("".concat(n," ").concat(d)),new Xo("recoverMessage").setNetworkType(t.getNetworkType()).setMessage(d).end(),u<i&&1!==s)return t._recoverC2CMessage({conversationID:o,localLastMessageTime:u,remoteLastMessageTime:i})}}))}},{key:"_getC2CRoamingMessage",value:function(e){var t=e.conversationID,n=e.time;return this.request({protocolName:Uo.GET_C2C_ROAMING_MESSAGE,requestData:{peerAccount:t.replace(S.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:n,direction:1}})}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),n}(Po),Ms=function(){function e(){o(this,e),this._n="AvgE2EDelay",this._e2eDelayArray=[]}return i(e,[{key:"addMessageDelay",value:function(e){var t=Ke()-e;t>=0&&this._e2eDelayArray.push(t)}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),Xt(n/t,1)}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter((function(e){return n<=e&&e<o})).length}},{key:"_calcPercent",value:function(e,t){var n=Xt(e/t*100,2);return n>100&&(n=100),n}},{key:"_checkE2EDelayException",value:function(e,t){var n=e.filter((function(e){return e>t}));if(n.length>0){var o=n.length,a=Math.min.apply(Math,m(n)),i=Math.max.apply(Math,m(n)),s=this._calcAvg(n,o),r=Xt(o/e.length*100,2);if(r>50)new Xo("messageE2EDelayException").setMessage("count:".concat(o," min:").concat(a," max:").concat(i," avg:").concat(s," percent:").concat(r)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=m(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),a=this._calcPercent(n,e),i=this._calcPercent(o,e),s=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:a,countLessThan3Second:o,percentOfCountLessThan3Second:i,avgDelay:s}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),Is=function(){function e(){o(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}return i(e,[{key:"addRequestCount",value:function(){this._requestCount+=1}},{key:"addRTT",value:function(e){this._rttArray.push(e)}},{key:"_calcTotalCount",value:function(){return this._requestCount}},{key:"_calcRTTCount",value:function(e){return e.length}},{key:"_calcSuccessRateOfRequest",value:function(e,t){if(0===t)return 0;var n=Xt(e/t*100,2);return n>100&&(n=100),n}},{key:"_calcAvg",value:function(e,t){if(0===t)return 0;var n=0;return e.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcMax",value:function(){return Math.max.apply(Math,m(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,m(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=m(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),a=this._calcAvg(t,n);return Je.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(a)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:a}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),ys=function(){function e(){o(this,e),this._map=new Map}return i(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(mt(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(mt(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(mt(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(mt(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(mt(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(mt(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=Xt(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(mt(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=Xt(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return mt(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return mt(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(mt(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return mt(e)||!this._map.has(e)?-1:e===Ho?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),a=this._calcSuccessCountOfPlatform(e),i=this._calcSuccessRateOfPlatform(e),s=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:a,successRateOfPlatform:i,avgValue:s}}},{key:"reset",value:function(e){mt(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),Ts=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return i(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._lastMap.set(e,new Map),t._currentMap.set(e,new Map)}))}},{key:"addMessageSequence",value:function(e){var t=e.key,n=e.message;if(mt(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,a=n.sequence,i=o.replace(S.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(i)){var s=this._lastMap.get(t).get(i),r=s.length-1;a>s[0]&&a<s[r]?(s.push(a),s.sort(),this._lastMap.get(t).set(i,s)):this._addCurrentMap(e)}else this._addCurrentMap(e);return!0}},{key:"_addCurrentMap",value:function(e){var t=e.key,n=e.message,o=n.conversationID,a=n.sequence,i=o.replace(S.CONV_GROUP,"");this._currentMap.get(t).has(i)||this._currentMap.get(t).set(i,[]),this._currentMap.get(t).get(i).push(a)}},{key:"_copyData",value:function(e){if(!mt(e)){this._lastMap.set(e,new Map);var t,n=this._lastMap.get(e),o=D(this._currentMap.get(e));try{for(o.s();!(t=o.n()).done;){var a=v(t.value,2),i=a[0],s=a[1];n.set(i,s)}}catch(r){o.e(r)}finally{o.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){if(mt(this._currentMap.get(e))||mt(this._lastMap.get(e)))return null;if(0===this._lastMap.get(e).size)return this._copyData(e),null;var t=0,n=0;if(this._lastMap.get(e).forEach((function(e,o){var a=m(e.values()),i=a.length,s=a[i-1]-a[0]+1;t+=s,n+=i})),0===t)return null;var o=Xt(n/t*100,2);return o>100&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),e}(),Cs=function(e){r(a,e);var n=f(a);function a(e){var t;o(this,a),(t=n.call(this,e))._n="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[bo,wo,Fo,qo,xo,Vo,Ho,Bo,Ko,Yo],t._messageSentItems=[Fo,qo,xo,Vo,Ho],t._messageReceivedItems=[Bo,Ko,Yo],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new Is,t._avgE2EDelay=new Ms,t._rateMessageSent=new ys,t._rateMessageReceived=new Ts;var i=t.getInnerEmitterInstance();return i.on(ha.A2KEY_AND_TINYID_UPDATED,t._onLoginSuccess,g(t)),i.on(ha.CLOUD_CONFIG_UPDATED,t._onCloudConfigUpdated,g(t)),t}return i(a,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(so),n=t.getItem(this.TAG,!1);!pn(n)&&It(n.forEach)&&(Je.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");mt(e)||(this.REPORT_INTERVAL=Number(e)),mt(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),mt(n)||(this.REPORT_TINYID_WHITELIST=n.split(","))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this.REPORT_INTERVAL==0&&(this.wholePeriod=!0,this._report())}},{key:"addRequestCount",value:function(){this._avgRTT.addRequestCount()}},{key:"addRTT",value:function(e){this._avgRTT.addRTT(e)}},{key:"addMessageDelay",value:function(e){this._avgE2EDelay.addMessageDelay(e)}},{key:"addTotalCount",value:function(e){this._rateMessageSent.addTotalCount(e)||Je.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||Je.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Je.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||Je.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Je.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Je.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Jo[this.getNetworkType()];mt(o)&&(o=8);var a={qualityType:Wo[e],timestamp:He(),networkType:o,extension:""};switch(e){case bo:n=this._avgRTT.getStatResult();break;case wo:n=this._avgE2EDelay.getStatResult();break;case Fo:case qo:case xo:case Vo:case Ho:n=this._rateMessageSent.getStatResult(e);break;case Bo:case Ko:case Yo:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},a),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;mt(e)?this._qualityItems.forEach((function(e){null!==(o=t._getQualityItem(e))&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))})):null!==(o=this._getQualityItem(e))&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),Je.d("".concat(this._n,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var a=this.getModule(io),i=a.getSDKAppID(),s=a.getTinyID();Qt(this.REPORT_SDKAPPID_BLACKLIST,i)&&!Zt(this.REPORT_TINYID_WHITELIST,s)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:vi(this),quality:e};this.request({protocolName:Uo.SSO_STAT,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){Je.w("".concat(n._n,"._doReport failed. networkType:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(so),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");if(pn(t))Je.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var a=n.concat(t);a.length>10&&(a=a.slice(0,10)),Je.l("".concat(o," count:").concat(a.length)),e.setItem(this.TAG,a,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),a}(Po),Ds=i((function e(t){o(this,e),pn(t)||(this.userID=t.userID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.time=t.time||0,this.source=t.source||"",this.wording=t.wording||"",this.type=t.type||"")})),Es=function(){function e(t){o(this,e),this._snsModule=t,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSequence=0,this._friendApplicationMap=new Map,this._unreadCount=0}return i(e,[{key:"getLocalFriendApplicationList",value:function(){return{friendApplicationList:m(this._friendApplicationMap.values()),unreadCount:this._unreadCount}}},{key:"_onFriendApplicationListUpdated",value:function(){this._snsModule.emitOuterEvent(E.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:m(this._friendApplicationMap.values()),unreadCount:this._unreadCount})}},{key:"onFriendApplicationRead",value:function(){this._unreadCount=0,this._onFriendApplicationListUpdated()}},{key:"onFriendApplicationAdded",value:function(e,n){var o=this;if(!pn(e)){var a="";a=n===this._snsModule.getMyUserID()?S.SNS_APPLICATION_SENT_BY_ME:S.SNS_APPLICATION_SENT_TO_ME;var i=!1;e.forEach((function(e){var n="".concat(e.userID,"_").concat(a);a!==S.SNS_APPLICATION_SENT_TO_ME||o._friendApplicationMap.has(n)||(o._unreadCount+=1),o._friendApplicationMap.set(n,new Ds(t(t({},e),{},{type:a}))),i=!0})),i&&this._onFriendApplicationListUpdated()}}},{key:"onFriendApplicationDeleted",value:function(e){pn(e)||(this._startTime=0,this._currentSequence=0,this.getFriendApplicationList())}},{key:"getFriendApplicationList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendApplicationList"),n=new Xo("getFriendApplicationList");return this._snsModule.request({protocolName:Uo.GET_FRIEND_APPLICATION_LIST,requestData:{applicationType:S.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsModule.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then((function(o){var a=o.data,i=a.resultList,s=a.unreadCount,r=a.startTime,c=a.currentSequence;e._startTime=r,e._currentSequence=c,e._unreadCount=s;var u=vt(i)?i.length:0,l="applicationCount:".concat(u," unreadCount:").concat(s," startTime:").concat(r," currentSequence:").concat(c);n.setNetworkType(e._snsModule.getNetworkType()).setMessage(l).end(),Je.i("".concat(t," ok. ").concat(l)),e._friendApplicationMap.clear(),vt(i)&&i.forEach((function(t){var n=t.userID,o=t.type,a=new Ds(t);e._friendApplicationMap.set("".concat(n,"_").concat(o),a)})),e._onFriendApplicationListUpdated()})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.w("".concat(t," failed. error:"),o),Go(o)}))}},{key:"deleteFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriendApplication"),o=e.userID,a=e.type;if((!a||a!==S.SNS_APPLICATION_SENT_BY_ME&&a!==S.SNS_APPLICATION_SENT_TO_ME)&&(a=S.SNS_APPLICATION_SENT_TO_ME),!this._friendApplicationMap.has("".concat(o,"_").concat(a)))return Go({code:Ao.FRIEND_APPLICATION_NOT_EXIST});var i=new Xo("deleteFriendApplication");return i.setMessage("userID:".concat(o," type:").concat(a)),this._snsModule.request({protocolName:Uo.DELETE_FRIEND_APPLICATION,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:[o],type:a}}).then((function(e){var s=e.data.resultList,r=s[0],c=r.to,u=r.resultCode,l=r.resultInfo;return i.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(s))).end(),Je.i("".concat(n," ok. userID:").concat(o," type:").concat(a)),0===u?No():Go({userID:c,code:u,message:l})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"acceptFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("acceptFriendApplication"),o=e.userID,a=e.remark,i=e.tag,s=e.type;(!s||s!==S.SNS_APPLICATION_AGREE&&s!==S.SNS_APPLICATION_AGREE_AND_ADD)&&(s=S.SNS_APPLICATION_AGREE_AND_ADD);var r=new Xo("acceptFriendApplication");return r.setMessage("userID:".concat(o," type:").concat(s)),this._snsModule.request({protocolName:Uo.RESPOND_FRIEND_APPLICATION,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,remark:a,tag:i,action:s}]}}).then((function(e){r.setNetworkType(t._snsModule.getNetworkType()).end();var a=e.data.resultList[0],i=a.resultCode,c=a.resultInfo;if(0!==i)return Go({code:i,message:c});Je.i("".concat(n," ok. userID:").concat(o," type:").concat(s))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"refuseFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("refuseFriendApplication"),o=e.userID,a=new Xo("refuseFriendApplication");return a.setMessage("userID:".concat(o)),this._snsModule.request({protocolName:Uo.RESPOND_FRIEND_APPLICATION,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,action:"Response_Action_Reject"}]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end();var i=e.data.resultList[0],s=i.resultCode,r=i.resultInfo;if(0!==s)return Go({code:s,message:r});Je.i("".concat(n," ok. userID:").concat(o))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_onFriendApplicationProcessed",value:function(e){var t=this;if(0!==e.length){var n=!1;e.forEach((function(e){var o="".concat(e.to,"_").concat(S.SNS_APPLICATION_SENT_TO_ME);t._friendApplicationMap.has(o)&&(t._friendApplicationMap.delete(o),t._unreadCount-=1,n=!0)})),this._unreadCount<0&&(this._unreadCount=0),n&&this._onFriendApplicationListUpdated()}}},{key:"setFriendApplicationRead",value:function(){var e=this,t="".concat(this._n,".").concat("setFriendApplicationRead"),n=new Xo("setFriendApplicationRead");return this._snsModule.request({protocolName:Uo.REPORT_FRIEND_APPLICATION,requestData:{fromAccount:this._snsModule.getMyUserID(),latestTimeStamp:Xt(He()/1e3,0)}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end(),Je.i("".concat(t," ok")),e._unreadCount=0})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.w("".concat(t," failed. error:"),o),Go(o)}))}},{key:"reset",value:function(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}]),e}(),Ss=function(){function e(n,a){o(this,e),this.userID=n,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var i={},s=[];if(i.userID=n,!pn(a))for(var r="",c="",u=0,l=a.length;u<l;u++)if(r=a[u].tag,c=a[u].value,r.indexOf("Tag_SNS_Custom")>-1)this.friendCustomField.push({key:r,value:c});else if(r.indexOf("Tag_Profile_Custom")>-1)s.push({key:r,value:c});else switch(r){case Xe.NICK:i.nick=c;break;case Xe.GENDER:i.gender=c;break;case Xe.BIRTHDAY:i.birthday=c;break;case Xe.LOCATION:i.location=c;break;case Xe.SELFSIGNATURE:i.selfSignature=c;break;case Xe.ALLOWTYPE:i.allowType=c;break;case Xe.LANGUAGE:i.language=c;break;case Xe.AVATAR:i.avatar=c;break;case Xe.MESSAGESETTINGS:i.messageSettings=c;break;case Xe.ADMINFORBIDTYPE:i.adminForbidType=c;break;case Xe.LEVEL:i.level=c;break;case Xe.ROLE:i.role=c;break;case Ze:this.remark=c;break;case nt:this.addTime=c;break;case Qe:this.groupList=JSON.parse(JSON.stringify(c));break;case $e:this.source=c;break;case et:break;default:Je.l("snsProfileItem unknown tag->",a[u].tag)}this.profile=new Ca(t(t({},i),{},{profileCustomField:s}))}return i(e,[{key:"validate",value:function(e){var t=!0,n="";if(pn(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,a=null,i=0;i<o;i++){if(a=e.profileCustomField[i],!gt(a.key)||-1===a.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(!gt(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if("profileCustomField"===s)continue;if(pn(e[s])&&!gt(e[s])&&!_t(e[s])){n="key:"+s+", invalid value:"+e[s],t=!1;continue}switch(s){case"nick":gt(e[s])||(n="nick must be a string",t=!1),Nt(e[s])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Nt(e[s])," bytes"),t=!1);break;case"gender":Rt(ot,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":_t(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":gt(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":gt(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":Rt(it,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":_t(e.language)||(n="language must be a number",t=!1);break;case"avatar":gt(e.avatar)||(n="avatar must be a string",t=!1);break;case"messageSettings":0!==e.messageSettings&&1!==e.messageSettings&&(n="messageSettings must be 0 or 1",t=!1);break;case"adminForbidType":Rt(at,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":_t(e.level)||(n="level must be a number",t=!1);break;case"role":_t(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+s+" "+e[s],t=!1}}return{valid:t,tips:n}}},{key:"update",value:function(e){var t="",n="",o=[];this.friendCustomField.forEach((function(e){o.push(e.key)}));for(var a=0,i=e.length;a<i;a++)if(t=e[a].tag,n=e[a].value,t.indexOf("Tag_SNS_Custom")>-1)o.indexOf(t)>-1?this.friendCustomField.forEach((function(e){e.key===t&&(e.value=n)})):this.friendCustomField.push({key:t,value:n});else if(t.indexOf("Tag_Profile_Custom")>-1){var s=!1;this.profile.profileCustomField.forEach((function(e){e.key===t&&(e.value=n,s=!0)})),s||this.profile.profileCustomField.push({key:t,value:n})}else switch(t){case Xe.NICK:this.profile.nick=n;break;case Xe.GENDER:this.profile.gender=n;break;case Xe.BIRTHDAY:this.profile.birthday=n;break;case Xe.LOCATION:this.profile.location=n;break;case Xe.SELFSIGNATURE:this.profile.selfSignature=n;break;case Xe.ALLOWTYPE:this.profile.allowType=n;break;case Xe.LANGUAGE:this.profile.language=n;break;case Xe.AVATAR:this.profile.avatar=n;break;case Xe.MESSAGESETTINGS:this.profile.messageSettings=n;break;case Xe.ADMINFORBIDTYPE:this.profile.adminForbidType=n;break;case Xe.LEVEL:this.profile.level=n;break;case Xe.ROLE:this.profile.role=n;break;case Ze:this.remark=n;break;case nt:this.addTime=n;break;case Qe:this.groupList=JSON.parse(JSON.stringify(n));break;case $e:this.source=n;break;case et:break;default:Je.d("snsProfileItem unkown tag->",e[a].tag)}this.timestamp=Date.now(),o.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){-1===this.groupList.indexOf(e)&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){var t=this.groupList.indexOf(e);t>-1&&(this.groupList.splice(t,1),this.count=this.groupList.length)}}]),e}(),Ns=function(){function e(t){o(this,e),this._snsModule=t,this._n="FriendHandler",this._friendMap=new Map,this._startIndex=0,this._standardSequence=0,this._customSequence=0,this._expirationTime=18e4}return i(e,[{key:"getLocalFriendList",value:function(){return m(this._friendMap.values())}},{key:"getFriendRemark",value:function(e){return this._friendMap.has(e)?this._friendMap.get(e).remark:""}},{key:"onFriendProfileModified",value:function(e){var t=this,n=e.dataList;if(!pn(n)){var o=this._snsModule.getModule(ao);n.forEach((function(e){var n=e.userID,a=e.profileList;if(t.isMyFriend(n)){Je.l("".concat(t._n,".onFriendProfileModified. friend account:").concat(n,", profileList:").concat(JSON.stringify(a)));var i=t._friendMap.get(n);i.update(a),o.modifyMessageSentByPeer({conversationID:"".concat(S.CONV_C2C).concat(n),latestNick:i.profile.nick,latestAvatar:i.profile.avatar})}})),this._onFriendListUpdated()}}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(Je.l("".concat(this._n,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._friendMap.set(e,new Ss(e))})),this.getFriendProfile({userIDList:e}).then((function(n){e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendAdded({nameList:n.groupList,userID:e})})),t._onFriendListUpdated()})))}},{key:"onFriendDeleted",value:function(e){var t=this;0!==e.length&&(Je.l("".concat(this._n,".onFriendDeleted userIDList:").concat(e)),e.forEach((function(e){var n=t._friendMap.get(e);n.groupList.length>0&&t._snsModule.updateWhenFriendDeleted({nameList:n.groupList,userID:e}),t._friendMap.delete(e)})),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsModule.emitOuterEvent(E.FRIEND_LIST_UPDATED),this._snsModule.getModule(ao).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getFriendProfile"),o=e.userIDList,a=[],i=[],s=[];if(o.forEach((function(e){if(t._friendMap.has(e)){var n=t._friendMap.get(e);Date.now()-n.timestamp<t._expirationTime?i.push(n):s.push(e)}else a.push({userID:e,code:Ao.NOT_MY_FRIEND,message:t._snsModule.getErrorMessage(Ao.NOT_MY_FRIEND)})})),0===s.length)return Je.i("".concat(n," newUserIDList is empty")),Oo({friendList:i,failureUserIDList:a});var r=new Xo("getFriendProfile");return r.setMessage("userIDList:".concat(s)),Je.i("".concat(n," userIDList:").concat(s)),this._snsModule.request({protocolName:Uo.GET_FRIEND_PROFILE,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:s}}).then((function(e){return r.setNetworkType(t._snsModule.getNetworkType()).end(),Je.i("".concat(n," ok")),e.data.resultList.forEach((function(e){var n,o=e.to,s=e.resultCode,r=e.resultInfo,c=e.tagValueList;mt(s)||0===s?(t._friendMap.has(o)?(n=t._friendMap.get(o)).update(c):(n=new Ss(o,c),t._friendMap.set(o,n)),i.push(n)):a.push({userID:o,code:s,message:r})})),No({friendList:i,failureUserIDList:a})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];r.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"isMyFriend",value:function(e){return this._friendMap.has(e)}},{key:"pagingGetFriendList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendList"),n=new Xo("getFriendList"),o=Date.now();this._snsModule.request({protocolName:Uo.GET_FRIEND_LIST,requestData:{fromAccount:this._snsModule.getMyUserID(),startIndex:this._startIndex,standardSequence:this._standardSequence,customSequence:this._customSequence}}).then((function(a){var i=a.data,s=i.friendCount,r=i.resultList,c=i.nextStartIndex,u=i.standardSequence,l=i.customSequence,d=i.completeFlag;e._startIndex=c,e._standardSequence=u,e._customSequence=l;var p="friendCount:".concat(s," nextStartIndex:").concat(c," standardSequence:").concat(u," ")+"customSequence:".concat(l," completeFlag:").concat(d," cost:").concat(un(o));n.setNetworkType(e._snsModule.getNetworkType()).setMessage(p).end(),Je.i("".concat(t," ok."),p),pn(r)||r.forEach((function(t){var n=t.to,o=t.tagValueList;e._friendMap.set(n,new Ss(n,o))})),0===d?e.pagingGetFriendList():(e._snsModule.emitOuterEvent(E.FRIEND_LIST_UPDATED),e._pagingGetFriendProfile())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.w("".concat(t," failed. error:"),o),Go(o)}))}},{key:"_pagingGetFriendProfile",value:function(){var e=this,t=m(this._friendMap.keys()),n=this._snsModule.getModule($n),o=t.length,a=o<=100?1:Math.ceil(o/100);Je.l("".concat(this._n,"._pagingGetFriendProfile friendCount:").concat(o," pageCount:").concat(a));for(var i=0;i<a;i++)n.getUserProfile({userIDList:t.slice(100*i,100*(i+1))}).then((function(t){t.data.forEach((function(t){var n=e._friendMap.get(t.userID);n&&n.updateProfile(t)})),e._onFriendListUpdated()}))}},{key:"addFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("addFriend");if(this._friendMap.has(e.to))return Go({code:Ao.ALREADY_MY_FRIEND});if(e.wording&&!1===this._snsModule.filterProfanity("wording",e))return Go({code:Ao.PROFANITY_FOUND});var o=e.to,a=e.source,i=e.type,s=e.wording,r=e.remark,c=e.groupName,u=i;(!u||u!==S.SNS_ADD_TYPE_SINGLE&&u!==S.SNS_ADD_TYPE_BOTH)&&(u=S.SNS_ADD_TYPE_BOTH);var l=new Xo("addFriend");return l.setMessage("to:".concat(o," source:").concat(a," type:").concat(u)),this._snsModule.request({protocolName:Uo.ADD_FRIEND,requestData:{fromAccount:this._snsModule.getMyUserID(),addFriendItem:[{to:o,source:a,wording:s,remark:r,groupName:c}],type:u}}).then((function(e){var o=e.data.resultList;l.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(o))).end();var a=o[0],i=a.to,s=a.resultCode,r=a.resultInfo;return Je.i("".concat(n," ok. to:").concat(i," type:").concat(u," code:").concat(s)),mt(s)||0===s?No({userID:i,code:0}):30539===s?No({userID:i,code:s,message:t._snsModule.getErrorMessage(s)}):Go({userID:i,code:s,message:t._snsModule.getErrorMessage(s)||r})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];l.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"deleteFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriend"),o=e.userIDList,a=e.type;o.length>1e3&&(Je.w("".concat(n," ").concat(an(1e3))),o.length=1e3);var i=[],s=[],r=[];if(o.forEach((function(e){t._friendMap.has(e)?r.push(e):i.push({userID:e,code:Ao.NOT_MY_FRIEND,message:t._snsModule.getErrorMessage(Ao.NOT_MY_FRIEND)})})),0===r.length)return Oo({successUserIDList:s,failureUserIDList:i});var c=a;(!c||c!==S.SNS_DELETE_TYPE_SINGLE&&c!==S.SNS_DELETE_TYPE_BOTH)&&(c=S.SNS_DELETE_TYPE_BOTH);var u=new Xo("deleteFriend");return u.setMessage("userIDList:".concat(r," type:").concat(c)),this._snsModule.request({protocolName:Uo.DELETE_FRIEND,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:r,type:c}}).then((function(e){u.setNetworkType(t._snsModule.getNetworkType()).end(),Je.i("".concat(n," ok"));var o=e.data.resultList;return pn(o)||o.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;mt(n)||0===n?s.push({userID:t}):i.push({userID:t,code:n,message:o})})),No({successUserIDList:s,failureUserIDList:i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.w("".concat(n," error:"),e),Go(e)}))}},{key:"updateFriend",value:function(e){var t=this,n=e.userID,o=e.remark,a=e.friendCustomField;if(!this._friendMap.has(n))return Go({code:Ao.NOT_MY_FRIEND});var i="".concat(this._n,".").concat("updateFriend"),s=new Xo("updateFriend");s.setMessage("userID:".concat(n," remark:").concat(o," friendCustomField:").concat(a));var r=[];return mt(o)||r.push({tag:Ze,value:o}),vt(a)&&a.length>0&&a.forEach((function(e){r.push({tag:e.key,value:e.value})})),this._snsModule.request({protocolName:Uo.UPDATE_FRIEND,requestData:{fromAccount:this._snsModule.getMyUserID(),updateItem:[{to:n,snsItem:r}]}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end(),Je.i("".concat(i," ok"));var n=e.data.resultList[0],r=n.to,c=n.resultCode,u=n.resultInfo;if(mt(c)||0===c){var l=t._friendMap.get(r);return l&&(mt(o)||(l.remark=o),vt(a)&&a.length>0&&Ut(l.friendCustomField,a),t._onFriendListUpdated()),No(l)}return Go({code:c,message:u})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];s.setError(e,o,a).end()})),Je.w("".concat(i," failed. error:"),e),Go(e)}))}},{key:"checkFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("checkFriend"),o=e.userIDList,a=e.type;(!a||a!==S.SNS_CHECK_TYPE_SINGLE&&a!==S.SNS_CHECK_TYPE_BOTH)&&(a=S.SNS_CHECK_TYPE_BOTH);var i=new Xo("checkFriend");return i.setMessage("userIDList:".concat(o," type:").concat(a)),this._snsModule.request({protocolName:Uo.CHECK_FRIEND,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:o,type:a}}).then((function(e){i.setNetworkType(t._snsModule.getNetworkType()).end(),Je.i("".concat(n," ok. userIDList:").concat(o," type:").concat(a));var s=[],r=[],c=e.data.resultList;return vt(c)&&c.forEach((function(e){var t=e.to,n=e.relation,o=e.resultCode,a=e.resultInfo;mt(o)||0===o?s.push({userID:t,code:0,relation:n}):r.push({userID:t,code:o,message:a})})),No({successUserIDList:s,failureUserIDList:r})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"updateWhenAddedToFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;Je.l("".concat(this._n,".updateWhenAddedToFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!pn(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).addToGroupList(n)}))}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;Je.l("".concat(this._n,".updateWhenRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!pn(o)&&o.forEach((function(e){t._friendMap.has(e)&&t._friendMap.get(e).removeFromGroupList(n)}))}},{key:"reset",value:function(){this._friendMap.clear(),this._startIndex=0,this._standardSequence=0,this._customSequence=0}}]),e}(),ks=function(){function e(t){o(this,e),pn(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)}return i(e,[{key:"addToUserIDList",value:function(e){-1===this.userIDList.indexOf(e)&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){var t=this.userIDList.indexOf(e);t>-1&&(this.userIDList.splice(t,1),this.count=this.userIDList.length)}}]),e}(),As=function(){function e(t){o(this,e),this._snsModule=t,this._n="FriendGroupHandler",this._friendGroupMap=new Map}return i(e,[{key:"getLocalFriendGroupList",value:function(){return m(this._friendGroupMap.values())}},{key:"_emitFriendGroupListUpdated",value:function(){var e=m(this._friendGroupMap.values());this._snsModule.emitOuterEvent(E.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getFriendGroupList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendGroupList"),n=new Xo("getFriendGroupList");return this._snsModule.request({protocolName:Uo.GET_FRIEND_GROUP_LIST,requestData:{fromAccount:this._snsModule.getMyUserID()}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end();var a=o.data.resultList;pn(a)?Je.i("".concat(t," ok. friend group count:0")):(Je.i("".concat(t," ok. friend group count:").concat(a.length)),e._friendGroupMap.clear(),a.forEach((function(t){var n=new ks(t);e._friendGroupMap.set(t.name,n)})),e._emitFriendGroupListUpdated())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.w("".concat(t," error:"),o),Go(o)}))}},{key:"createFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("createFriendGroup"),o=e.name,a=e.userIDList;if(this._friendGroupMap.has(o))return Go({code:Ao.FRIEND_GRP_EXISTED});var i=new Xo("createFriendGroup");return i.setMessage("name:".concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:Uo.CREATE_FRIEND_GROUP,requestData:{fromAccount:this._snsModule.getMyUserID(),groupName:[o],userIDList:vt(a)?a:void 0}}).then((function(e){i.setNetworkType(t._snsModule.getNetworkType()).end(),Je.l("".concat(n," ok. name:").concat(o," userIDList:").concat(a));var s=e.data.resultList,r=[],c=[];s&&s.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;if(mt(n)||0===n)r.push(t);else{var a={userID:e.to,code:n,message:o};c.push(a)}}));var u=new ks({name:o,userIDList:r});return t._friendGroupMap.set(o,u),t._snsModule.updateWhenAddedToFriendGroup({name:o,userIDList:r}),t._emitFriendGroupListUpdated(),No({friendGroup:u,failureUserIDList:c})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"deleteFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriendGroup"),o=e.name;if(!this._friendGroupMap.has(o))return Go({code:Ao.FRIEND_GRP_NOT_EXIST});var a=new Xo("deleteFriendGroup");return a.setMessage("name:".concat(o)),this._snsModule.request({protocolName:Uo.DELETE_FRIEND_GROUP,requestData:{fromAccount:this._snsModule.getMyUserID(),nameList:[o]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),Je.l("".concat(n," ok. name:").concat(o));var i=t._friendGroupMap.get(o);return i&&(t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:i.userIDList}),t._friendGroupMap.delete(o),i.userIDList.length=0),t._emitFriendGroupListUpdated(),No(i)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],i=n[1];a.setError(e,o,i).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"renameFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("renameFriendGroup"),o=e.oldName,a=e.newName;if(!this._friendGroupMap.has(o))return Go({code:Ao.FRIEND_GRP_NOT_EXIST});var i=new Xo("renameFriendGroup");return i.setMessage("oldName:".concat(o," newName:").concat(a)),this._snsModule.request({protocolName:Uo.UPDATE_FRIEND_GROUP,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,newName:a}}).then((function(){if(i.setNetworkType(t._snsModule.getNetworkType()).end(),Je.l("".concat(n," ok. oldName:").concat(o," newName:").concat(a)),t._friendGroupMap.has(o)){var e=t._friendGroupMap.get(o);return e.name=a,t._friendGroupMap.delete(o),t._friendGroupMap.set(a,e),t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:e.userIDList}),t._snsModule.updateWhenAddedToFriendGroup({name:a,userIDList:e.userIDList}),t._emitFriendGroupListUpdated(),No(e)}return No()})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"addToFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("addToFriendGroup"),o=e.name,a=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var i=new Xo("addToFriendGroup");return i.setMessage("name:".concat(o," userIDList:").concat(a)),Je.l("".concat(n," name:").concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:Uo.UPDATE_FRIEND_GROUP,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:a.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Add"}}))}}).then((function(e){return i.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"removeFromFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("removeFromFriendGroup"),o=e.name,a=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var i=new Xo("removeFromFriendGroup");return i.setMessage("name:".concat(o," userIDList:").concat(a)),Je.l("".concat(n," name:").concat(o," userIDList:").concat(a)),this._snsModule.request({protocolName:Uo.UPDATE_FRIEND_GROUP,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:a.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Delete"}}))}}).then((function(e){return i.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];i.setError(e,o,a).end()})),Je.w("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_onFriendGroupUpdated",value:function(e,t){var n=t.data.resultList,o=this._friendGroupMap.get(e),a=[],i=[],s=[];return vt(n)&&n.forEach((function(e){var t=e.to,n=e.resultCode,r=e.resultInfo,c=e.type;0===n?"Update_Type_Add"===c?o&&(o.addToUserIDList(t),i.push(t)):"Update_Type_Delete"===c&&o&&(o.removeFromUserIDList(t),s.push(t)):a.push({to:e.to,code:n,message:r})})),Je.l("".concat(this._n,"._onFriendGroupUpdated name:").concat(e," userIDList:").concat(o.userIDList)),i.length>0&&this._snsModule.updateWhenAddedToFriendGroup({name:e,userIDList:i}),s.length>0&&this._snsModule.updateWhenRemovedFromFriendGroup({name:e,userIDList:s}),No({friendGroup:o,failureUserIDList:a})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,o=e.userID;Je.l("".concat(this._n,".updateWhenFriendAdded userID:").concat(o," nameList:").concat(n)),pn(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).addToUserIDList(o)}))}},{key:"updateWhenFriendDeleted",value:function(e){var t=this,n=e.nameList,o=e.userID;Je.l("".concat(this._n,".updateWhenFriendDeleted userID:").concat(o," nameList:").concat(n)),pn(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).removeFromUserIDList(o)}))}},{key:"reset",value:function(){this._friendGroupMap.clear()}}]),e}(),Ls=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="SnsModule",a._friendHandler=new Ns(g(a)),a._friendApplicationHandler=new Es(g(a)),a._friendGroupHandler=new As(g(a)),a.getInnerEmitterInstance().on(ha.A2KEY_AND_TINYID_UPDATED,a.onContextUpdated,g(a)),a}return i(n,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getFriendGroupList(),this._friendApplicationHandler.getFriendApplicationList()}},{key:"onRelationChainModified",value:function(e){var t=this,n=e.dataList;if(!pn(n)){var o=[],a=[],i=[],s=[],r=!1,c="";n.forEach((function(e){if(3!==e.pushType&&4!==e.pushType||!e.from||(c=e.from),e.friendAddAccount&&(o.push.apply(o,m(e.friendAddAccount)),s.push.apply(s,m(e.friendAddAccount))),e.friendDelAccount&&a.push.apply(a,m(e.friendDelAccount)),e.friendApplicationAdded&&i.push.apply(i,m(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&s.push.apply(s,m(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(r=!0),e.friendUpInfo){var n={dataList:[]};e.friendUpInfo.forEach((function(e){n.dataList.push({userID:e.friendAccount,profileList:m(e.sns)})})),t.onFriendProfileModified(n)}})),r&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(i,c),this._friendApplicationHandler.onFriendApplicationDeleted(s),this._friendHandler.onFriendAdded(o),this._friendHandler.onFriendDeleted(a)}}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(yo);if(!n)return!0;var o=n.filterText(t[e],X),a=o.isAllowedToSend,i=o.modifiedText;return!0===a&&(t[e]=i,!0)}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this._friendHandler.getLocalFriendList();return e?Oo(t):t}},{key:"getFriendRemark",value:function(e){return this._friendHandler.getFriendRemark(e)}},{key:"getFriendList",value:function(){return this._friendHandler.pagingGetFriendList()}},{key:"addFriend",value:function(e){return this._friendHandler.addFriend(e)}},{key:"deleteFriend",value:function(e){return this._friendHandler.deleteFriend(e)}},{key:"checkFriend",value:function(e){return this._friendHandler.checkFriend(e)}},{key:"getFriendProfile",value:function(e){return this._friendHandler.getFriendProfile(e)}},{key:"updateFriend",value:function(e){return this._friendHandler.updateFriend(e)}},{key:"updateWhenAddedToFriendGroup",value:function(e){this._friendHandler.updateWhenAddedToFriendGroup(e)}},{key:"updateWhenRemovedFromFriendGroup",value:function(e){this._friendHandler.updateWhenRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){var e=this._friendApplicationHandler.getLocalFriendApplicationList();return Oo(e)}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteFriendApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseFriendApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptFriendApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setFriendApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){var e=this._friendGroupHandler.getLocalFriendGroupList();return Oo(e)}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createFriendGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteFriendGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToFriendGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromFriendGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameFriendGroup(e)}},{key:"onAddToFriendGroup",value:function(e){return this._friendGroupHandler.onAddToFriendGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}]),n}(Po),Rs=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="WorkerTimerModule",a._isWorkerEnabled=!0,a._workerTimer=null,a._timerID=-1,a._init(),a.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,a._onCloudConfigUpdated,g(a)),a}return i(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Ge}},{key:"startWorkerTimer",value:function(){Je.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){Je.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Ge){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,Je.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");Je.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),mt(e)||"1"===e?!this._isWorkerEnabled&&Ge&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Ge&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){Je.l("".concat(this._n,".terminate")),this._workerTimer&&(this._workerTimer.terminate(),this._workerTimer=null,this._timerID=-1)}},{key:"getTimerID",value:function(){return this._timerID}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),n}(Po),Os=function(){function e(){o(this,e),this._n="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return i(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var t=null,n=e.length-1,o=0;n>=0;n--,o++)t=o<32?new A(0,Math.pow(2,o)).toString():new A(Math.pow(2,o-32),0).toString(),"1"===e[n]?this._purchasedFeatureMap.set(t,!0):this._purchasedFeatureMap.set(t,!1)}else Je.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,a=t.length-1,i=0;a>=0;a--,i++)if("1"===t.charAt(a)&&(n=i<32?new A(0,Math.pow(2,i)).toString():new A(Math.pow(2,i-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return Je.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(o)),Oo({enabled:o})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),Gs=function(){function e(t){o(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Os}return i(e,[{key:"_canFetch",value:function(){return this._getModule(io).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetch(),n="".concat(this._n,".fetchConfig");if(Je.l("".concat(n," canFetch:").concat(t)),t){var o=this._getModule(co),a=new Xo("fetchCommercialConfig");a.setNetworkType(o.getNetworkType());var i=this._getModule(io).getSDKAppID(),s=this._getModule(_o);this._isFetching=!0,s.request({protocolName:Uo.FETCH_COMMERCIAL_CONFIG,requestData:{SDKAppID:i}}).then((function(t){a.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),Je.l("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){o.probe().then((function(e){var n=v(e,2),o=n[0],i=n[1];a.setError(t,o,i).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));Je.l("".concat(t)),new Xo("pushedCommercialConfig").setNetworkType(this._getModule(co).getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,a=e.purchaseBits,i=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(a),this._expiredTime=Date.now()+1e3*i):mt(n)?(Je.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Je.e("".concat(t," errorCode:").concat(n," errorMessage:").concat(o)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"canIUse",value:function(e){return this._purchasedFeatureHandler.hasPurchasedFeature(e)}},{key:"isFeatureEnabled",value:function(e){return this._purchasedFeatureHandler.isFeatureEnabled(e)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),Ps=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._m=e,a._n="OfflinePushModule",a._offlinePushPlugin=void 0,a._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},a._deviceToken="",a._businessID=0,a._iosBusinessID=0,a._c2cUnreadCount=0,a._groupUnreadCount=0,a._isWebUniapp=0,a}return i(n,[{key:"registerPlugin",value:function(e){if(se){this._offlinePushPlugin=e["tim-offline-push-plugin"];var t=e.offlinePushConfig||{},n=t.huaweiBusinessID,o=t.xiaomiBusinessID,a=t.xiaomiAppID,i=t.xiaomiAppKey,s=t.meizuBusinessID,r=t.meizuAppID,c=t.meizuAppKey,u=t.vivoBusinessID,l=t.oppoBusinessID,d=t.oppoAppKey,p=t.oppoAppSecret,_=t.honorBusinessID,g=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=n,this._androidPushConfig.xiaomiPushBussinessId=o,this._androidPushConfig.xiaomiPushAppId=a,this._androidPushConfig.xiaomiPushAppKey=i,this._androidPushConfig.meizuPushBussinessId=s,this._androidPushConfig.meizuPushAppId=r,this._androidPushConfig.meizuPushAppKey=c,this._androidPushConfig.vivoPushBussinessId=u,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,this._androidPushConfig.honorPushBussinessId=_,new Xo("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!mt(this._offlinePushPlugin))).end(!0),Je.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=g,this._setAppShowListener()}else this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,t="".concat(this._n,".").concat("_getDeviceToken");if(It(this._offlinePushPlugin.getDeviceToken)){var n="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);Je.l("".concat(t," start. ").concat(n)),new Xo("_getDeviceToken").setMessage("".concat(n)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(o){var a=new Xo("getDeviceTokenRes"),i=o.code,s=o.msg;if(0===i){var r=o.data,c=r.deviceToken,u=r.deviceBrand,l=r.deviceType,d=r.bussinessId;e._deviceToken=c,e._businessID=d||e._iosBusinessID,n="deviceToken:".concat(c,", deviceBrand:").concat(u||l,", businessID:").concat(e._businessID),Je.l("".concat(t," ok. ").concat(n)),a.setMessage(n).end(!0),e._setToken()}else a.setMessage("code:".concat(i,", msg:").concat(s)).end(!0),Je.e("".concat(t," failed. error:"),o)}))}else Je.e("".concat(t," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return se&&!mt(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");mt(this._offlinePushPlugin)?Je.e("".concat(t," offlinePushPlugin is undefined")):It(this._offlinePushPlugin.setAppShowListener)?(new Xo("_setAppShowListener").end(!0),Je.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){var o=(n||{}).appShow;new Xo("setAppShowListenerRes").setMessage("appShow:".concat(o)).end(!0),Je.l("".concat(t," ok. appShow:").concat(o)),e._m.isReady()&&(0===o?(e._getConvUnreadCount(),e._onBackground()):1===o&&e._onForeground())}))):Je.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!mt(this._offlinePushPlugin)&&It(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return Je.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}}},{key:"_setToken",value:function(){var e,t=this,n="".concat(this._n,"._setToken"),o=this.getModule(io),a=1,i="",s="";pn(this._deviceToken)&&(a=0);var r=this.getUniAppPlatform(),c=this.getDeviceBrand();r===R.IOS||r===R.IPAD||r===R.MAC?s=this._deviceToken:r===R.ANDROID&&(i=this._deviceToken);var u=new Xo("offlinePushSetToken");return e="deviceToken:".concat(s||i,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(c,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(a,", platform:").concat(r),u.setMessage("".concat(e)),Je.l("".concat(n," ").concat(e)),this.request({protocolName:Uo.SET_TOKEN,requestData:{tokenID:i,pushMsg:a,sdkAppID:o.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:c,deviceToken:s,isWebUniapp:this._isWebUniapp}}).then((function(e){return u.end(),Je.l("".concat(n," ok")),e})).catch((function(e){return t.probeNetwork().then((function(t){var n=v(t,2),o=n[0],a=n[1];u.setError(e,o,a).end()})),Je.e("".concat(n," failed. error:"),e),Go(e)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(ao).getLocalConversationList().forEach((function(t){t.type===S.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===S.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new Xo("_onBackground");this.request({protocolName:Uo.STAT_BACKGROUND,requestData:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then((function(o){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),Je.l("".concat(t," ok")),o})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.e("".concat(t," failed. error:"),o)}))}},{key:"_onForeground",value:function(){var e=this,t="".concat(this._n,".").concat("_onForeground"),n=new Xo("_onForeground");this.request({protocolName:Uo.STAT_FOREGROUND,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return n.end(),Je.l("".concat(t," ok")),e})).catch((function(o){e.probeNetwork().then((function(e){var t=v(e,2),a=t[0],i=t[1];n.setError(o,a,i).end()})),Je.e("".concat(t," failed. error:"),o)}))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?R.IOS:"android"===e?R.ANDROID:1002===t?R.IPAD:1001===t?R.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Je.l("".concat(this._n,".reset"))}}]),n}(Po),Us=function(e){r(n,e);var t=f(n);function n(e){var a;return o(this,n),(a=t.call(this,e))._n="ProfanityFilterModule",a._plugin=null,a._filterConfigMap=new Map,a._startIndex=0,a._version=0,a._canIUseLexicon=!1,a._isFetching=!1,a._expiredTime=0,a}return i(n,[{key:"init",value:function(){var e=this.getModule(lo).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:Je,isArray:vt,isMap:dt,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning("ProfanityPluginNotFound")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var o=e.type,a=e.conversationType;if(o!==S.MSG_TEXT&&o!==S.MSG_CUSTOM)return n;var i,s="".concat(this._n,".filterMessage");if(Je.l("".concat(s)),o===S.MSG_TEXT){if(a===S.CONV_C2C?i=Y:a===S.CONV_GROUP&&(i=j),!this._isConfigOn(i))return n;var r=this._plugin.filter(e.payload.text),c=r.type,u=r.modifiedText;1===c?n=!1:2===c&&(e.payload.text=u)}else if(o===S.MSG_CUSTOM){if(a===S.CONV_C2C?i=W:a===S.CONV_GROUP&&(i=J),!this._isConfigOn(i))return n;var l=this._plugin.filter(e.payload.data),d=this._plugin.filter(e.payload.description),p=this._plugin.filter(e.payload.extension);1===l.type||1===d.type||1===p.type?n=!1:(2===l.type&&(e.payload.data=l.modifiedText),2===d.type&&(e.payload.description=d.modifiedText),2===p.type&&(e.payload.extension=p.modifiedText))}return Je.l("".concat(s," done. isAllowedToSend:").concat(n)),n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;Je.l("".concat(n));var a=this._plugin.filter(e),i=a.type,s=a.modifiedText;return 1===i?o.isAllowedToSend=!1:2===i&&(o.modifiedText=s),Je.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var e=this,t=new Xo("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.request({protocolName:Uo.GET_PROFANITY_LIST,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(o){var a=o.data,i=a.errorInfo,s=a.filterConfig,r=a.lexicon,c=a.strToken,u=a.completeFlag,l=a.nextStartIndex,d=a.version,p=a.expiredTime,_=i.errorCode,g=i.errorMessage;return 0!==_?(e._isFetching=!1,Je.w("".concat(n," failed. error:"),i),void t.setCode(_).setMessage(g).end()):(e._onFilterConfig(s),e._getToken(c),1===u?(Je.l("".concat(n," done. version:").concat(d," expiredTime:").concat(p)),e._version=d,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*p,void e._plugin.onLexiconCompleted(r)):(e._startIndex=l,e._plugin.onLexiconSliced(r),void e._getLexicon()))})).catch((function(o){e.probeNetwork().then((function(e){var n=v(e,2),a=n[0],i=n[1];t.setError(o,a,i).end()})),e._isFetching=!1,Je.l("".concat(n," failed. error:"),o)}))}},{key:"_onFilterConfig",value:function(e){var t=this;pn(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),Je.l("".concat(this._n,"._onFilterConfig. keys:").concat(Array.from(this._filterConfigMap.keys())," values:").concat(Array.from(this._filterConfigMap.values()))))}},{key:"_isConfigOn",value:function(e){return 1===this._filterConfigMap.get(e)}},{key:"_getToken",value:function(e){if(gt(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n+=e[o+1],n+=e[o];else{for(var a=0;a<t-1;a+=2)n+=e[a+1],n+=e[a];n+=e[t-1]}this._plugin.onToken(n)}}},{key:"reset",value:function(){Je.l("".concat(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}}]),n}(Po),bs=function(){function e(t){o(this,e),this._m=t,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getInnerEmitterInstance().on(ha.CLOUD_CONFIG_UPDATED,this._onCloudConfigUpdated,this)}return i(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this,t=this._m.getModule(ho).getCloudConfig("rtc_cmd");mt(t)||((t=JSON.parse(t)).forEach((function(t){e._TRTCCommandList.includes(t)||e._TRTCCommandList.push(t)})),this._setTRTCCommandMap())}},{key:"_setTRTCCommandMap",value:function(){for(var e=null,t=0,n=this._TRTCCommandList.length;t<n;t++)e=this._TRTCCommandList[t].split(".")[0],this._TRTCCommandMap.set(e,1)}},{key:"onRoomCustomDataReceived",value:function(e){this._m.getOuterEmitterInstance().emit(E.ROOM_CUSTOM_DATA_RECEIVED,e)}},{key:"sendTRTCCustomData",value:function(e){var t=e.serviceCommand,n=e.data,o="".concat(B.NAME.TUIROOM_SVR,".*");return mt(t)||(o=t),this._isValidServiceCommand(o)?this._trans({servcmd:o,data:n}):Go({code:Ao.INVALID_TRTC_CMD})}},{key:"_trans",value:function(e){Je.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(e)));var t=e.servcmd,n=e.data;return this._m.getModule(_o).trans({servcmd:t,data:gt(n)?JSON.parse(n):n})}},{key:"_isValidServiceCommand",value:function(e){if(e.endsWith(".*"))return this._TRTCCommandList.includes(e);var t=e.split(".")[0];return this._TRTCCommandMap.has(t)}},{key:"isTRTCCommand",value:function(e){var t=e.split(".")[0];return this._TRTCCommandMap.has(t)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),e}(),ws=function(){function e(t){o(this,e),this._m=t,this._n="ErrorMessageModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this._map=new Map,this._init()}return i(e,[{key:"_init",value:function(){var e=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(e){var t;try{t=JSON.parse(e)}catch(n){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),Je.w("".concat(this._n,"._init error:"),n)}t&&(this._needToUpdate(t)?this._fetch():this._fillMap(t.message))}else this._fetch()}},{key:"_needToUpdate",value:function(e){var t=e.localSavedTime,n=e.localSavedVersion,o=t&&(new Date).getTime()-t>=this.STORAGE_EXPIRES_TIME,a=!n||"3.2.3"!==n;return Je.l("".concat(this._n,"._needToUpdate isTimeout:").concat(o," isDifferentVersion:").concat(a)),o||a}},{key:"_fetch",value:function(){if(!this._m.getModule(io).isPrivateNetWork()){var e="https://web.sdk.qcloud.com/im/download/error-message/v3/0.0.4/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this;if(ce)le.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),Je.l("".concat(n," mini program"))},fail:function(){}});else{var a=new XMLHttpRequest,i=setTimeout((function(){a.abort()}),3e3);a.onreadystatechange=function(){4===a.readyState&&(clearTimeout(i),200!==a.status&&304!==a.status||(Je.l("".concat(n," browser")),o._fillAndSave(a.responseText)))},a.open("GET",e,!0),a.setRequestHeader("Content-type",t),a.send()}}}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"3.2.3"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.getModule(so)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o,a=e.split(";\n"),i=a.length,s=new RegExp(/'/g),r=0;r<i;r++)if(t=a[r].indexOf(":"),n=a[r].slice(0,t),o=a[r].slice(t+1,a[r].length),!n.startsWith("//")){if(mt(o))continue;this._map.set(n,o.replace(s,""))}}},{key:"get",value:function(e){var t=e.isIntl,n=e.key,o=e.replacement1,a=e.replacement2,i="".concat(n,t?"_en":"_cn");!this._map.has(i)&&this._map.has(n)&&(i=n);var s="";return this._map.has(i)?(s=this._map.get(i),mt(o)||(s=s.replace("$replacement1",o)),mt(a)||(s=s.replace("$replacement2",a)),s):s}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset"))}}]),e}(),Fs=function(){function e(t){o(this,e),this._n="RemoteSignalingHandler",this._signalingModule=t}return i(e,[{key:"onNewMessageList",value:function(e){var t=this,n=this._signalingModule.filterMessageList(e);n.length>0&&n.forEach((function(e){var n=t.getPayloadData(e);n&&t._handleActionType(n,e)}))}},{key:"onMessageModified",value:function(e){var t=this,n=this._signalingModule.filterMessageList(e);n.length>0&&n.forEach((function(e){var n=t.getPayloadData(e);n&&t._onInvitationModified(n,e)}))}},{key:"getPayloadData",value:function(e){var t="".concat(this._n,".getPayloadData"),n=e.payload.data;try{return JSON.parse(n)}catch(o){return Je.e("".concat(t," JSON parse error. signalingData:").concat(n)),null}}},{key:"_handleActionType",value:function(e,t){switch(e.actionType){case N.ACTION_TYPE_INVITE:this._onNewInvitationReceived(e,t);break;case N.ACTION_TYPE_REJECT_INVITE:this._onInviteeRejected(e);break;case N.ACTION_TYPE_ACCEPT_INVITE:this._onInviteeAccepted(e);break;case N.ACTION_TYPE_CANCEL_INVITE:this._onInvitationCancelled(e);break;case N.ACTION_TYPE_INVITE_TIMEOUT:this._onInvitationTimeout(e)}}},{key:"_createDefaultEmitData",value:function(e){return{inviteID:e.inviteID,inviter:e.inviter,groupID:e.groupID,data:e.data||""}}},{key:"_onNewInvitationReceived",value:function(e,n){var o="".concat(this._n,"._onNewInvitationReceived"),a=e.inviteID,i=e.inviteeList,s=e.groupID,r=e.inviter,c=this._signalingModule.getMyUserID(),u=i.includes(c),l=Math.round(e.timeout-((new Date).getTime()-1e3*n.time)/1e3);if(Je.l("".concat(o," myselfIncluded:").concat(u," groupID:").concat(s," timeout:").concat(l,"s signalObj:").concat(JSON.stringify(e))),s&&u||!s){var d=this._signalingModule.getInviteInfo(a);if(d&&d===e)return;d||this._signalingModule.setInviteInfo(a,t(t({},e),{},{message:n})),this._signalingModule.emitEvent(N.NEW_INVITATION_RECEIVED,t(t({},this._createDefaultEmitData(e)),{},{inviteeList:i})),r!==c&&this._signalingModule.startTimer(t(t({},e),{},{timeout:l}))}}},{key:"_onInviteeRejected",value:function(e){var n="".concat(this._n,"._onInviteeRejected"),o=e.inviteID,a=e.inviter,i=e.groupID,s=this._signalingModule.hasInviteInfo(o);Je.l("".concat(n," inviteID:").concat(o," hasInviteID:").concat(s," inviter:").concat(a," groupID:").concat(i)),(i&&s||!i)&&(this._signalingModule.updateInviteInfo(e),this._signalingModule.emitEvent(N.INVITEE_REJECTED,t(t({},this._createDefaultEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInviteeAccepted",value:function(e){var n="".concat(this._n,"._onInviteeAccepted"),o=e.inviteID,a=e.inviter,i=e.groupID,s=this._signalingModule.hasInviteInfo(o);Je.l("".concat(n," inviteID:").concat(o," hasInviteID:").concat(s," inviter:").concat(a," groupID:").concat(i)),(i&&s||!i)&&(this._signalingModule.updateInviteInfo(e),this._signalingModule.emitEvent(N.INVITEE_ACCEPTED,t(t({},this._createDefaultEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInvitationCancelled",value:function(e){var t="".concat(this._n,"._onInvitationCancelled"),n=e.inviteID,o=e.inviter,a=e.groupID,i=this._signalingModule.hasInviteInfo(n);Je.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(i," inviter:").concat(o," groupID:").concat(a)),(a&&i||!a)&&(this._signalingModule.deleteInviteInfo(n),this._signalingModule.emitEvent(N.INVITATION_CANCELLED,this._createDefaultEmitData(e)))}},{key:"_onInvitationTimeout",value:function(e){var n="".concat(this._n,"._onInvitationTimeout"),o=e.inviteID,a=e.inviter,i=e.groupID,s=e.inviteeList,r=this._signalingModule.hasInviteInfo(o);Je.l("".concat(n," inviteID:").concat(o," hasInviteID:").concat(r," inviter:").concat(a," groupID:").concat(i," data:").concat(e.data)),(i&&r||!i)&&(this._signalingModule.updateInviteInfo(e),this._signalingModule.emitEvent(N.INVITATION_TIMEOUT,t(t({},this._createDefaultEmitData(e)),{},{inviteeList:s,isSelfTimeout:!1})))}},{key:"_onInvitationModified",value:function(e,n){var o="".concat(this._n,"._onInvitationModified"),a=e.inviteID,i=e.data;Je.l("".concat(o," inviteID:").concat(a," data:").concat(i)),this._signalingModule.setInviteInfo(a,t(t({},e),{},{message:n})),this._signalingModule.emitEvent(N.INVITATION_MODIFIED,{inviteID:a,data:i})}}]),e}(),qs=function(e){if(e<0||e>53)return NaN;var t=0|1073741824*Math.random();return e>30?t+1073741824*(0|Math.random()*(1<<e-30)):t>>>30-e},xs=function(e,t){for(var n=e.toString(16),o=t-n.length,a="0";o>0;o>>>=1,a+=a)1&o&&(n=a+n);return n},Vs=function(){function e(t){o(this,e),this._n="LocalSignalingHandler",this._signalingModule=t}return i(e,[{key:"generateInviteID",value:function(){var e,t,n=(t=xs)((e=qs)(32),8)+"-"+t(e(16),4)+"-"+t(16384|e(12),4)+"-"+t(32768|e(14),4)+"-"+t(e(48),12);return Je.l("".concat(this._n,".generateInviteID inviteID:").concat(n)),n}},{key:"createInviteInfo",value:function(e){var n=this.generateInviteID(),o=this.createInviteCustomData(t(t({},e),{},{inviteID:n})),a=o.groupID,i=o.inviteeList,s=a||i[0];return{customData:o,message:this.createSignalingMessage(o,s),inviteID:n}}},{key:"_createDefaultCustomData",value:function(e){var t=e.data,n=void 0===t?"":t,o=e.inviteID,a=void 0===o?"":o,i=e.groupID;return{businessID:1,timeout:0,data:n,inviteID:a,groupID:void 0===i?"":i}}},{key:"createInviteCustomData",value:function(e){var n=e.userID,o=e.timeout,a=void 0===o?0:o,i=e.groupID,s=void 0===i?"":i,r=this._signalingModule.getMyUserID(),c=t(t({},this._createDefaultCustomData(e)),{},{actionType:N.ACTION_TYPE_INVITE,inviter:r,inviteeList:s?e.inviteeList:[n],timeout:a});return Je.l("".concat(this._n,".createInviteCustomData customData:").concat(JSON.stringify(c))),c}},{key:"createCancelCustomData",value:function(e){var n,o="".concat(this._n,".createCancelCustomData"),a=e.inviteID,i=this._signalingModule.getMyUserID(),s=this._signalingModule.getInviteInfo(a),r=s.inviteeList,c=s.groupID,u=s.inviter;return u===i?n=t(t({},this._createDefaultCustomData(e)),{},{actionType:N.ACTION_TYPE_CANCEL_INVITE,groupID:c,inviter:i,inviteeList:r}):Je.e("".concat(o," unmatched inviter:").concat(u," and my userID:").concat(i)),Je.l("".concat(o," customData:").concat(JSON.stringify(n))),n}},{key:"createAcceptCustomData",value:function(e){var n,o="".concat(this._n,".createAcceptCustomData"),a=e.inviteID,i=this._signalingModule.getMyUserID(),s=this._signalingModule.getInviteInfo(a),r=s.inviter,c=s.groupID;return s.inviteeList.includes(i)?n=t(t({},this._createDefaultCustomData(e)),{},{actionType:N.ACTION_TYPE_ACCEPT_INVITE,groupID:c,inviter:r,inviteeList:[i]}):Je.e("".concat(o," userID:").concat(i," not in inviteeList. inviteID:").concat(a," groupID:").concat(c)),Je.l("".concat(o," customData:").concat(JSON.stringify(n))),n}},{key:"createRejectCustomData",value:function(e){var n,o="".concat(this._n,".createRejectCustomData"),a=e.inviteID,i=this._signalingModule.getMyUserID(),s=this._signalingModule.getInviteInfo(a),r=s.inviter,c=s.groupID;return s.inviteeList.includes(i)?n=t(t({},this._createDefaultCustomData(e)),{},{actionType:N.ACTION_TYPE_REJECT_INVITE,groupID:c,inviter:r,inviteeList:[i]}):Je.e("".concat(o," userID:").concat(i," not in inviteeList. inviteID:").concat(a," groupID:").concat(c)),Je.l("".concat(o," customData:").concat(JSON.stringify(n))),n}},{key:"createTimeoutCustomData",value:function(e){var n="".concat(this._n,".createTimeoutCustomData"),o=e.inviteeList,a=e.inviter,i=e.isInviter,s=void 0!==i&&i,r=this._signalingModule.getMyUserID(),c=t(t({},this._createDefaultCustomData(e)),{},{actionType:N.ACTION_TYPE_INVITE_TIMEOUT,inviter:a,inviteeList:s?o:[r]});return Je.l("".concat(n," customData:").concat(JSON.stringify(c))),c}},{key:"createSignalingMessage",value:function(e,t){var n=e.groupID,o=e.inviter,a=this._signalingModule.getModule(Qn),i={to:t||n||o,conversationType:n?S.CONV_GROUP:S.CONV_C2C,priority:S.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}},s=a.createCustomMessage(i);return Je.d("".concat(this._n,".createSignalingMessage. message:").concat(JSON.stringify(s))),s}}]),e}(),Hs=function(){function e(t){o(this,e),this._n="HistorySignalingHandler",this._signalingModule=t,this.EXPIRED_TIME=3e4,this.COUNT=20,this._signalingMap=new Map,this._signalingRelatedToMeMap=new Map}return i(e,[{key:"getHistorySignaling",value:function(){var e=this,t=this._signalingModule.getModule(ao).getLocalConversationList();pn(t)||this._getSignalingList(t).then((function(t){e._handleSignalingList(t)}))}},{key:"_getSignalingList",value:function(e){var t=this,n=this._getValidConversationList(e),o=this._createPromiseList(n);return pn(o)?Promise.resolve([]):this._concurrentGetMessageList(o).then((function(e){var n=new Map;return e.forEach((function(e){var o=e.signalingList,a=t._getSignalingRelatedToMeMap(o);n=new Map([].concat(m(n),m(a)))})),t._sortSignaling(n)}))}},{key:"_handleSignalingList",value:function(e){pn(e)||(Je.d("".concat(this._n,"._handleSignalingList signalingList:").concat(JSON.stringify(e))),this._signalingModule.onNewMessageList(e))}},{key:"_isSignalingNotExpired",value:function(e,t){return e[t]&&1e3*e[t]>(new Date).getTime()-this.EXPIRED_TIME}},{key:"_getValidConversationList",value:function(e){for(var t=[],n=0;n<e.length;n++){var o=e[n],a=o.type,i=o.unreadCount,s=o.lastMessage,r=this._isSignalingNotExpired(s,"lastTime");a!==S.CONV_SYSTEM&&i>0&&r&&t.push(e[n])}return t}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;n<e.length;n++){var o=e[n],a=o.conversationID,i=o.unreadCount,s=o.type===S.CONV_C2C?i:this.COUNT;this._signalingMap.set(a,{needMessageCount:s,signalingList:[]});var r=this._signalingModule.getModule(ao).getMessageList({conversationID:a});t.push(r)}return t}},{key:"_concurrentGetMessageList",value:function(e){var t=this,n=[];return Promise.all(e).then((function(e){for(var o=0;o<e.length;o++){var a=e[o],i=a.code,s=a.data;if(0===i&&0!==s.messageList.length){t._handleMessageList(s.messageList);var r=t._relayGetMessageList(s);r&&n.push(r)}}return n.length>0?t._concurrentGetMessageList(n):t._signalingMap}))}},{key:"_relayGetMessageList",value:function(e){var t=e.messageList,n=e.nextReqMessageID,o=e.isCompleted,a=t.length;if(0===a)return null;var i=t[0],s=i.conversationID,r=i.conversationType,c=this._signalingMap.get(s).needMessageCount,u=r===S.CONV_GROUP,l=0===c||o,d=this._isSignalingNotExpired(t[a-1],"time");return u||l||!d?null:this._signalingModule.getModule(ao).getMessageList({conversationID:s,nextReqMessageID:n,count:c})}},{key:"_handleMessageList",value:function(e){for(var t=e.length,n=e[0].conversationID,o=this._signalingMap.get(n),a=o.needMessageCount,i=o.signalingList,s=a-t>0?a-t:0,r=[],c=0;c<e.length;c++){var u=e[c];this._isSignalingNotExpired(u,"time")&&r.push(u)}var l=this._signalingModule.filterMessageList(r);this._signalingMap.set(n,{needMessageCount:s,signalingList:i.concat(l)})}},{key:"_getSignalingRelatedToMeMap",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];this._saveSignalingRelatedToMe(n)}return this._signalingRelatedToMeMap}},{key:"_saveSignalingRelatedToMe",value:function(e){var n=this._signalingModule.getRemoteSignalingHandler().getPayloadData(e)||{},o=n.actionType,a=void 0===o?"":o,i=n.inviteID,s=void 0===i?"":i,r=n.inviteeList,c=void 0===r?[]:r,u=this._signalingModule.getMyUserID();switch(a){case N.ACTION_TYPE_INVITE:c.includes(u)&&this._signalingRelatedToMeMap.set(s,t(t({},n),{},{messageList:[e]}));break;case N.ACTION_TYPE_REJECT_INVITE:case N.ACTION_TYPE_ACCEPT_INVITE:this.updateHistoryInviteInfo(e);break;case N.ACTION_TYPE_CANCEL_INVITE:this.deleteHistoryInviteInfo(s);break;case N.ACTION_TYPE_INVITE_TIMEOUT:this.updateHistoryInviteInfo(e)}}},{key:"deleteHistoryInviteInfo",value:function(e){this._signalingRelatedToMeMap.has(e)&&this._signalingRelatedToMeMap.delete(e)}},{key:"updateHistoryInviteInfo",value:function(e){var t=this._signalingModule.getRemoteSignalingHandler().getPayloadData(e)||{},n=t.inviteID,o=void 0===n?"":n,a=t.inviteeList,i=void 0===a?[]:a;if(this._signalingRelatedToMeMap.has(o)){for(var s=this._signalingRelatedToMeMap.get(o),r=s.inviteeList,c=s.messageList,u=0;u<i.length;u++){var l=i[u];r.includes(l)&&r.splice(r.indexOf(l),1)}0===r.length?this.deleteHistoryInviteInfo(o):c.push(e)}else this.deleteHistoryInviteInfo(o)}},{key:"_sortSignaling",value:function(e){var t=[];return e.forEach((function(e){t=[].concat(m(t),m(e.messageList))})),t.sort((function(e,t){return(e.time?e.time:0)-(t.time?t.time:0)}))}},{key:"reset",value:function(){this._signalingMap.clear(),this._signalingRelatedToMeMap.clear()}}]),e}(),Bs=i((function e(t,n){o(this,e),this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||N.ACTION_TYPE_INVITE,this.timeout=t.timeout||0})),Ks=["message"],Ys=["message"],Ws=function(e){r(a,e);var n=f(a);function a(e){var t;return o(this,a),(t=n.call(this,e))._n="SignalingModule",t._inviteInfoMap=new Map,t._outerEmitter=new Ci,t._outerEmitter._emit=t._outerEmitter.emit,t._outerEmitter.emit=function(){var e=arguments.length<=0?void 0:arguments[0],t=[e,{name:arguments.length<=0?void 0:arguments[0],data:arguments.length<=1?void 0:arguments[1]}];this._outerEmitter._emit.apply(this._outerEmitter,[].concat(t))}.bind(g(t)),t._canIUseSignaling=!1,t._isHandling=!1,t._remoteSignalingHandler=new Fs(g(t)),t._localSignalingHandler=new Vs(g(t)),t._historySignalingHandler=new Hs(g(t)),t._isC2CUnreadHandleCompleted=!1,t._isConvSyncCompleted=!1,t._isSyncCompleted=!1,t.getInnerEmitterInstance().on(ha.C2C_UNREAD_HANDLE_COMPLETED,t.onC2CUnreadHandleCompleted,g(t)),t.getInnerEmitterInstance().on(ha.CONV_SYNC_COMPLETED,t.onConvSyncCompleted,g(t)),t}return i(a,[{key:"onC2CUnreadHandleCompleted",value:function(){this._isC2CUnreadHandleCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onConvSyncCompleted",value:function(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onReady",value:function(){Je.l("".concat(this._n,".onReady")),this._isSyncCompleted=!0,this._historySignalingHandler.getHistorySignaling()}},{key:"onNewMessageList",value:function(e){return this._remoteSignalingHandler.onNewMessageList(e)}},{key:"onMessageModified",value:function(e){return this._remoteSignalingHandler.onMessageModified(e)}},{key:"hasInviteInfo",value:function(e){return this._inviteInfoMap.has(e)}},{key:"getInviteInfo",value:function(e){return this._inviteInfoMap.get(e)}},{key:"setInviteInfo",value:function(e,n){var o=n.message,a=_(n,Ks);Je.l("".concat(this._n,".setInviteInfo inviteID:").concat(e," data:").concat(JSON.stringify(a))),this._inviteInfoMap.set(e,t(t({},a),{},{message:o}))}},{key:"deleteInviteInfo",value:function(e){this.hasInviteInfo(e)&&(Je.l("".concat(this._n,".deleteInviteInfo inviteID:").concat(e,".")),this._inviteInfoMap.delete(e))}},{key:"updateInviteInfo",value:function(e){var t="".concat(this._n,".updateInviteInfo"),n=e.inviteID,o=e.inviter,a=e.inviteeList,i=e.groupID;if(Je.l("".concat(t," inviteID:").concat(n," inviter:").concat(o," groupID:").concat(i)),i&&this.hasInviteInfo(n)){var s=a[0],r=this.getInviteInfo(n).inviteeList;r.includes(s)&&(r.splice(r.indexOf(s),1),Je.l("".concat(t," remove ").concat(s,". localInviteeList.length:").concat(r.length))),0===r.length&&this.deleteInviteInfo(n)}else this.deleteInviteInfo(n)}},{key:"getLocalSignalingHandler",value:function(){return this._localSignalingHandler}},{key:"getRemoteSignalingHandler",value:function(){return this._remoteSignalingHandler}},{key:"canIUseSignaling",value:function(){return this._canIUseSignaling}},{key:"emitEvent",value:function(e,t){this._outerEmitter.emit(e,t)}},{key:"addSignalingListener",value:function(e,t,n){this._canIUseSignaling||(this._canIUseSignaling=!0),this._outerEmitter.on(e,t,n)}},{key:"removeSignalingListener",value:function(e,t,n){this._outerEmitter.off(e,t,n),0===this._outerEmitter.eventNames().length&&(this._canIUseSignaling=!1)}},{key:"invite",value:function(e){var n=this,o="".concat(this._n,".").concat("invite"),a=this._localSignalingHandler.createInviteInfo(e),i=a.message,s=a.customData,r=a.inviteID;return Je.l("".concat(o," options:").concat(JSON.stringify(e)," inviteID:").concat(r)),this.sendSignaling(i,e).then((function(e){return e&&0===e.code?(n.setInviteInfo(r,t(t({},s),{},{message:i})),n.startTimer(t(t({},s),{},{inviteID:r})),t(t({},e),{},{inviteID:r})):e})).catch((function(e){return Go(e)}))}},{key:"inviteSync",value:function(e,n,o){var a=this,i="".concat(this._n,".").concat("inviteSync"),s=this._localSignalingHandler.createInviteInfo(e),r=s.message,c=s.customData,u=s.inviteID;return Je.l("".concat(i," options:").concat(JSON.stringify(e)," inviteID:").concat(u)),this.sendSignaling(r,e).then((function(e){if(e&&0===e.code)return a.setInviteInfo(u,t(t({},c),{},{message:r})),a.startTimer(t(t({},c),{},{inviteID:u})),n&&n({inviteID:u}),{inviteID:u};o&&o(0===e.code,e.message||"")})).catch((function(e){return o&&o(e.code,e.message),Go(e)})),u}},{key:"_handleImResponse",value:function(e,t,n){t&&0===t.code&&(this._isHandling=!1,n?this.deleteInviteInfo(e.inviteID):this.updateInviteInfo(e))}},{key:"cancel",value:function(e){var n=this,o="".concat(this._n,".").concat("cancel");if(Je.l("".concat(o," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return Go({code:Ao.INVALID_CANCEL_MESSAGE});this._isHandling=!0;var a=this._localSignalingHandler.createCancelCustomData(e);if(!a)return this._isHandling=!1,Go({code:Ao.SIGNALING_NO_PERMISSION});var i=a.groupID,s=a.inviteeList,r=i||s[0],c=this._localSignalingHandler.createSignalingMessage(a,r);return this.sendSignaling(c,e).then((function(o){return n._handleImResponse(a,o,!0),0===o.code?t(t({},o),{},{inviteID:e.inviteID}):o})).catch((function(e){return Go(e)}))}},{key:"accept",value:function(e){var n=this,o="".concat(this._n,".").concat("accept");if(Je.l("".concat(o," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return Go({code:Ao.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var a=this._localSignalingHandler.createAcceptCustomData(e);if(!a)return this._isHandling=!1,Go({code:Ao.SIGNALING_NO_PERMISSION});var i=this._localSignalingHandler.createSignalingMessage(a);return this.sendSignaling(i,e).then((function(o){return n._handleImResponse(a,o),0===o.code?t(t({},o),{},{inviteID:e.inviteID}):o})).catch((function(e){return Go(e)}))}},{key:"reject",value:function(e){var n=this,o="".concat(this._n,".").concat("reject");if(Je.l("".concat(o," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return Go({code:Ao.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var a=this._localSignalingHandler.createRejectCustomData(e);if(!a)return this._isHandling=!1,Go({code:Ao.SIGNALING_NO_PERMISSION});var i=this._localSignalingHandler.createSignalingMessage(a);return this.sendSignaling(i,e).then((function(o){return n._handleImResponse(a,o,!0),0===o.code?t(t({},o),{},{inviteID:e.inviteID}):o})).catch((function(e){return Go(e)}))}},{key:"getSignalingInfo",value:function(e){var t="".concat(this._n,".getSignalingInfo"),n=e.ID,o=e.from,a=e.to,i=this._filterSignalingMessage(e),s=null;if(i){var r=this._remoteSignalingHandler.getPayloadData(e);s=new Bs(r)}var c=i?"actionType:".concat(s.actionType):"";return Je.l("".concat(t," messageID:").concat(n," from:").concat(o," to:").concat(a," ")+"".concat(c," isSignaling:").concat(i)),s}},{key:"modifyInvitation",value:function(e){var n=this,o=e.inviteID,a=e.data;if(!this.hasInviteInfo(e.inviteID)||this._isHandling)return Go({code:Ao.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var i=this.getInviteInfo(o),s=i.message,r=_(i,Ys),c=s.payload.data;return r.data=a,s.payload.data=JSON.stringify(r),this.getModule(Qn).modifyRemoteMessage(s).then((function(e){return n.setInviteInfo(o,t(t({},r),{},{message:s})),n._isHandling=!1,e})).catch((function(e){return n._isHandling=!1,s.payload.data=c,Go(e)}))}},{key:"_genMessageControlInfo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.data,n=void 0===t?"":t,o=e.onlineUserOnly,a=e.inviteID,i=void 0===a?"":a,s=e.offlinePushInfo,r=e.actionType,c={_onlineOnlyFlag:!1};i&&this.getInviteInfo(i)&&(c=this.getInviteInfo(i).message);var u={onlineUserOnly:c._onlineOnlyFlag||o||!1,offlinePushInfo:s,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};if(r===N.ACTION_TYPE_INVITE_TIMEOUT){var l=!!n.match(/excludeTimeoutSignalingFromHistoryMessage/);return u.messageControlInfo.excludedFromUnreadCount=l,u.messageControlInfo.excludedFromLastMessage=l,u}var d=!!n.match(/excludeFromHistoryMessage/),p=!!n.match(/excludeOriginalSignalingFromHistoryMessage/);return u.messageControlInfo.excludedFromUnreadCount=d||p,u.messageControlInfo.excludedFromLastMessage=d||p,u}},{key:"sendSignaling",value:function(e,t){var n=this;return this.getModule(Qn).sendMessageInstance(e,this._genMessageControlInfo(t)).catch((function(e){return n._isHandling=!1,Go(e)}))}},{key:"filterMessageList",value:function(e){var t=this;return e.filter((function(e){return t._filterSignalingMessage(e)}))}},{key:"_filterSignalingMessage",value:function(e){var t=!1;if(e.type&&e.type===S.MSG_CUSTOM){var n=e.cloudCustomData,o=void 0===n?"":n,a=e.payload.data,i=void 0===a?"":a,s=o.match(/"type":"tsignaling"/),r=i.match(/inviteID/),c=i.match(/actionType/);t=s||r&&c}return!!t}},{key:"startTimer",value:function(e){var t=this,n="".concat(this._n,".startTimer"),o=e.timeout,a=e.inviteID,i=e.inviter,s=e.groupID,r=i===this.getMyUserID();if(Je.l("".concat(n," timeout:").concat(o," isInviter:").concat(r," groupID:").concat(s)),!(o<=0))var c=r?o+5:o,u=1,l=setInterval((function(){var o=t._hasLocalInviteInfo(e,r);u<c&&o?++u:(o&&t._sendTimeoutNotice(a,r),Je.l("".concat(n," end.")),clearInterval(l))}),1e3)}},{key:"_hasLocalInviteInfo",value:function(e,t){var n=e.inviteID,o=e.groupID;if(!this.hasInviteInfo(n))return!1;var a="".concat(this._n,"._hasLocalInviteInfo"),i=this.getInviteInfo(n).inviteeList;return Je.l("".concat(a," inviteID:").concat(n," inviteeList:").concat(i," groupID:").concat(o)),!o||(t?i.length>0:i.length>0&&i.includes(this.getMyUserID()))}},{key:"_getReceiver",value:function(e,t){var n=t.groupID,o=t.inviteeList,a=t.inviter;return e?n||o[0]:n||a}},{key:"_sendTimeoutNotice",value:function(e,n){var o=this,a=this.getInviteInfo(e),i=this._getReceiver(n,a);Je.l("".concat(this._n,"._sendTimeoutNotice inviteID:").concat(e," to:").concat(i," isInviter:").concat(n));var s=this._localSignalingHandler.createTimeoutCustomData(t(t({},a),{},{isInviter:n})),r=this._localSignalingHandler.createSignalingMessage(s,i);return this.sendSignaling(r,s).then((function(t){if(t&&0===t.code){var a=s.data,i=s.groupID,c=s.inviteeList,u=s.inviter;o.emitEvent(N.INVITATION_TIMEOUT,{data:a,groupID:i,inviteID:e,inviteeList:c,inviter:u,isSelfTimeout:!0,message:r}),n?o.deleteInviteInfo(e):o.updateInviteInfo(s)}}))}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1}}]),a}(Po),js=function(){function e(t){var n=this;o(this,e);var a,i=new Xo("sdkConstruct");(this._n="ModuleManager",this._isReady=!1,this._reason=Ao.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._moduleMap=new Map,this._innerEmitter=null,this._outerEmitter=null,this._checkCount=0,this._checkTimer=-1,this._moduleMap.set(io,new di(this,t)),this._moduleMap.set(Mo,new Gs(this)),this._moduleMap.set(ho,new vs(this)),this._moduleMap.set(fo,new Rs(this)),this._moduleMap.set(mo,new Cs(this)),this._moduleMap.set(go,new as(this)),this._moduleMap.set(_o,new fs(this)),this._moduleMap.set(Xn,new _i(this)),this._moduleMap.set(Qn,new Pi(this)),this._moduleMap.set(Zn,new Ui(this)),this._moduleMap.set(So,new bi(this)),this._moduleMap.set(Co,new wi(this)),this._moduleMap.set($n,new li(this)),this._moduleMap.set(eo,new _a(this)),this._moduleMap.set(ao,new Oa(this)),this._moduleMap.set(to,new ei(this)),this._moduleMap.set(oo,new ai(this)),this._moduleMap.set(so,new hi(this)),this._moduleMap.set(Do,new ws(this)),this._moduleMap.set(ro,new mi(this)),this._moduleMap.set(co,new Ti(this)),this._moduleMap.set(uo,new Ni(this)),this._moduleMap.set(lo,new Fi(this)),this._moduleMap.set(po,new qi(this)),this._moduleMap.set(vo,new ms(this)),this._moduleMap.set(no,new Ls(this)),this._moduleMap.set(Io,new Ps(this)),this._moduleMap.set(yo,new Us(this)),this._moduleMap.set(To,new bs(this)),this._moduleMap.set(Eo,new Ws(this)),this._eventThrottleMap=new Map,ft(t.modules))?(Object.keys(t.modules).forEach((function(e){a=t.modules[e],"group-module"===e?n._moduleMap.set(to,new a(n)):"relationship-module"===e?n._moduleMap.set(no,new a(n)):"signaling-module"===e&&n._moduleMap.set(Eo,new a(n))})),this._moduleMap.get(io).setUsingChatCore(!0)):this._moduleMap.has(to)||this._moduleMap.get(io).setUsingChatCore(!0);var s=t.instanceID,r=t.SDKAppID,c=this._moduleMap.get(io).isIntl(),u=this._moduleMap.get(io).isUsingChatCore(),l="instanceID:".concat(s," SDKAppID:").concat(r," isIntl:").concat(c," isUsingChatCore:").concat(u," host:").concat(Yt()," isIOSWebView:").concat(be)+" inBrowser:".concat(ue," inMiniApp:").concat(ce)+" workerAvailable:".concat(Ge," UserAgent:").concat(de);Xo.bindEventStatModule(this._moduleMap.get(ro)),i.setMessage("".concat(l," ").concat(function(){var e="";if(ce)try{var t=le.getSystemInfoSync(),n=t.model,o=t.version,a=t.system,i=t.platform,s=t.SDKVersion;e="model:".concat(n," version:").concat(o," system:").concat(a," platform:").concat(i," SDKVersion:").concat(s)}catch(r){e=""}return e}())).end(),Je.i("SDK ".concat(l)),ko.prototype._getErrorMessage=this.getErrorMessage.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return i(e,[{key:"_startTimer",value:function(){var e=this._moduleMap.get(fo),t=e.isWorkerEnabled();Je.l("".concat(this._n,".startTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.startWorkerTimer():this._startMainThreadTimer()}},{key:"_startMainThreadTimer",value:function(){this._checkTimer<0&&(this._checkTimer=setInterval(this.onCheckTimer.bind(this),1e3)),Je.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._moduleMap.get(fo),t=e.isWorkerEnabled();Je.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){Je.l("".concat(this._n,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){Je.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._moduleMap.get(go);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){Je.l("".concat(this._n,"._startMainThreadSocket"));var e=this._moduleMap.get(go);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){Je.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){Je.l("".concat(this._n,".onWorkerTimerDisabled, enable main thread timer and socket")),this._startMainThreadTimer(),this._startMainThreadSocket()}},{key:"onCheckTimer",value:function(){this._checkCount+=1;var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.onCheckTimer&&n.onCheckTimer(this._checkCount)}}catch(o){t.e(o)}finally{t.f()}}},{key:"_initReadyList",value:function(){var e=this;this._readyList=[this._moduleMap.get(Xn)],this._readyList.forEach((function(t){t.ready((function(){return e._onModuleReady()}))}))}},{key:"_onModuleReady",value:function(){var e=!0;if(this._readyList.forEach((function(t){t.isReady()||(e=!1)})),e&&!this._isReady){this._isReady=!0,this._outerEmitter.emit(E.SDK_READY);var t=Date.now()-this._startLoginTs;Je.w("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(co).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Ve;this._ssoLogForReady.setNetworkType(n).setMessage(t).start(o).end()}}},{key:"login",value:function(){0===this._startLoginTs&&(Be(),this._startLoginTs=Date.now(),this._startTimer(),this._moduleMap.get(co).start(),this._ssoLogForReady=new Xo("sdkReady"),this._reason=Ao.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new Ci,Ro(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(this._canIUseSignaling()){if(e===E.MESSAGE_RECEIVED){var o=this.getModule(Eo);o.onNewMessageList(t)}if(e===E.MESSAGE_MODIFIED){var a=this.getModule(Eo);a.onMessageModified(t)}}if(e===E.CONVERSATION_LIST_UPDATED||e===E.FRIEND_LIST_UPDATED||e===E.GROUP_LIST_UPDATED||e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var i=Date.now(),s=this._eventThrottleMap.get(e);i-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout((function(){s.last=Date.now(),n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),1e3)):(s.last=i,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_canIUseSignaling",value:function(){var e=this.getModule(Eo);return!!e&&e.canIUseSignaling()}},{key:"_getEventData",value:function(e){return e===E.CONVERSATION_LIST_UPDATED?this._moduleMap.get(ao).getLocalConversationList():e===E.FRIEND_LIST_UPDATED?this._moduleMap.get(no).getLocalFriendList(!1):e===E.GROUP_LIST_UPDATED?this._moduleMap.get(to).getLocalGroupList():e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(ao).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new Ci,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;n=ft(arguments[1])&&arguments[1].data?[e,{name:arguments[0],data:arguments[1].data}]:[e,{name:arguments[0],data:arguments[1]}],this._innerEmitter._emit.apply(this._innerEmitter,n)}.bind(this)),this._innerEmitter}},{key:"hasModule",value:function(e){return this._moduleMap.has(e)}},{key:"getModule",value:function(e){return this._moduleMap.get(e)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.getModule(io).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrorMessage",value:function(e,t,n){return this._moduleMap.get(Do).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"outputWarning",value:function(e,t,n){var o=this.getErrorMessage(e,t,n);o&&Je.w(o)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);Je.w("Oops! ".concat(t)),new Xo("error").setMessage(t).setNetworkType(this.getModule(co).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(E.ERROR,e)}},{key:"restartTimer",value:function(){Je.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer();var e=this.getModule(to);e&&e.restartPolling()}},{key:"getTimerID",value:function(){var e=this._moduleMap.get(fo);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._moduleMap.get(to).getPollingTimerID(e)}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),Be();var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=v(e.value,2)[1];n.reset&&n.reset()}}catch(s){t.e(s)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(E.SDK_NOT_READY);var o,a=D(this._eventThrottleMap);try{for(a.s();!(o=a.n()).done;){var i=v(o.value,2)[1];i.timeoutID&&clearTimeout(i.timeoutID)}}catch(s){a.e(s)}finally{a.f()}this._eventThrottleMap.clear()}}]),e}(),Js=function(){function e(t){o(this,e),this._funcMap=new Map,this._m=t,this._n="SafetyCallback",this._reportCount=0}return i(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.outputWarning("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){var o=this;return function(){try{t.apply(n,Array.from(arguments))}catch(c){var a=Object.values(E).indexOf(e),i="CallbackError";if(-1!==a){var s=Object.keys(E)[a];o._m.outputWarning(i,s,c)}if(o._reportCount<5){var r=new Xo(i);r.setMessage("eventName:".concat(e)).setMoreMessage(c.message).end(),o._reportCount+=1}}}}},{key:"destroy",value:function(){this._funcMap.clear()}},{key:"reset",value:function(){Je.l("".concat(this._n,".reset")),this._reportCount=0}}]),e}(),zs=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:Kt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0,modules:t.modules||void 0};this._m=new js(n),this._vendorMap=new Map,this._safetyCallbackFactory=new Js(this._m)}return i(e,[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._getModule(Xn).login(e)}},{key:"logout",value:function(){var e=this;return this._getModule(Xn).logout().then((function(t){return e._safetyCallbackFactory.reset(),e._m.reset(),t}))}},{key:"getLoginUser",value:function(){return this._getModule(Xn).getLoginUser()}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._safetyCallbackFactory.destroy(),e._m.stopTimer(),e._getModule(fo).terminate(),e._getModule(go).dealloc();var t=e._m.getOuterEmitterInstance(),n=e._getModule(io);t.emit(E.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){Je.d("on","eventName:".concat(e)),this._m.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){Je.d("once","eventName:".concat(e)),this._m.getOuterEmitterInstance().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){Je.d("off","eventName:".concat(e));var a=this._safetyCallbackFactory.find(e,t);null!==a&&(this._m.getOuterEmitterInstance().off(e,a,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){mt(e["tim-offline-push-plugin"])?this._getModule(lo).registerPlugin(e):this._getModule(Io).registerPlugin(e)}},{key:"setLogLevel",value:function(e){if(e<=0){var t=this.getErrorMessage("TIM_ASCII_ART");t&&console.log(t);var n=this.getErrorMessage("API_REFER");if(n){on()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",n):console.log("IM SDK API ->",n)}var o=this.getErrorMessage("DOCS_GUIDE");o&&console.log(o);var a=this.getErrorMessage("IOS_WEBVIEW_WARNING");be&&a&&console.warn(a)}Je.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._getModule(Qn).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._getModule(Qn).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._getModule(Qn).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._getModule(Qn).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._getModule(Qn).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._getModule(Qn).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._getModule(Qn).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._getModule(Qn).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._getModule(Qn).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._getModule(Qn).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==S.MSG_MERGER?Go({code:Ao.MSG_MERGER_TYPE_INVALID}):pn(e.payload.downloadKey)?Go({code:Ao.MSG_MERGER_KEY_INVALID}):this._getModule(Qn).downloadMergerMessage(e).catch((function(e){return Go({code:Ao.MSG_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._getModule(Qn).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof pa?this._getModule(Qn).sendMessageInstance(e,t):Go({code:Ao.MSG_INSTANCE_REQUIRED})}},{key:"searchCloudMessages",value:function(e){return this._getModule(Qn).searchCloudMessages(e)}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._getModule(Co).sendMessage(t):"handleGroupInvitation"===e?this._getModule(to).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._getModule(Mo).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e||"sendRoomCustomData"===e?this._getModule(To).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):"setApplicationID"===e?(this._getModule(io).setApplicationID(t),void this._getModule(_o).updateProtocolConfig()):"getServerConfig"===e?this._getModule(ho).getServerConfig(t):Go({code:Ao.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._getModule(Qn).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof pa?this._getModule(Qn).resendMessage(e,t):Go({code:Ao.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._getModule(Qn).deleteMessage(e)}},{key:"translateText",value:function(e){return this._getModule(Qn).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._getModule(Qn).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._getModule(Zn).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._getModule(Zn).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._getModule(Zn).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._getModule(So).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._getModule(So).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._getModule(So).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._getModule(So).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._getModule(Qn).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._getModule(ao).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._getModule(ao).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._getModule(ao).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._getModule(ao).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._getModule(to);return t?t.getReadReceiptDetail(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"findMessage",value:function(e){return this._getModule(ao).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._getModule(ao).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._getModule(ao).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._getModule(ao).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._getModule(ao).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._getModule(ao).setConversationDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._getModule(ao).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._getModule(ao).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._getModule(ao).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._getModule(ao).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._getModule(ao).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._getModule(ao).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._getModule(ao).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._getModule(ao).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._getModule(ao).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._getModule(ao).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._getModule(ao).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._getModule(ao).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._getModule(ao).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._getModule($n).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._getModule($n).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._getModule($n).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._getModule($n).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._getModule($n).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._getModule($n).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._getModule($n).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._getModule($n).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._getModule($n).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._getModule($n).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._getModule(no);return e?e.getLocalFriendList():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._getModule(no);return t?t.addFriend(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._getModule(no);return t?t.deleteFriend(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._getModule(no);return t?t.checkFriend(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._getModule(no);return t?t.getFriendProfile(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._getModule(no);return t?t.updateFriend(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._getModule(no);return e?e.getLocalFriendApplicationList():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._getModule(no);return t?t.acceptFriendApplication(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._getModule(no);return t?t.refuseFriendApplication(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._getModule(no);return t?t.deleteFriendApplication(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._getModule(no);return e?e.setFriendApplicationRead():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._getModule(no);return e?e.getLocalFriendGroupList():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._getModule(no);return t?t.createFriendGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._getModule(no);return t?t.deleteFriendGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._getModule(no);return t?t.addToFriendGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._getModule(no);return t?t.removeFromFriendGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._getModule(no);return t?t.renameFriendGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(){var e=this._getModule(to);return e?e.getGroupList():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._getModule(to);return t?t.getGroupProfile(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"createGroup",value:function(e){var t=this._getModule(to);return t?t.createGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._getModule(to);return t?t.dismissGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._getModule(to);return t?t.updateGroupProfile(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"joinGroup",value:function(e){var t=this._getModule(to);return t?t.joinGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"quitGroup",value:function(e){var t=this._getModule(to);return t?t.quitGroup(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._getModule(to);return t?t.searchGroupByID(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._getModule(to);return t?t.getGroupOnlineMemberCount(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._getModule(to);return t?t.changeGroupOwner(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._getModule(to);return e?e.getGroupApplicationList():Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._getModule(to);return t?t.handleGroupApplication(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._getModule(to);return t?t.initGroupAttributes(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._getModule(to);return t?t.setGroupAttributes(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._getModule(to);return t?t.deleteGroupAttributes(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._getModule(to);return t?t.getGroupAttributes(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._getModule(to);return t?t.setGroupCounters(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._getModule(to);return t?t.increaseGroupCounter(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._getModule(to);return t?t.decreaseGroupCounter(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._getModule(to);return t?t.getGroupCounters(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._getModule(to);return t?t.getGroupMemberList(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._getModule(to);return t?t.getGroupMemberProfile(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._getModule(to);return t?t.addGroupMember(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._getModule(to);return t?t.deleteGroupMember(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._getModule(to);return t?t.setGroupMemberMuteTime(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._getModule(to);return t?t.setGroupMemberRole(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._getModule(to);return t?t.setGroupMemberNameCard(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._getModule(to);return t?t.setGroupMemberCustomField(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._getModule(to);return t?t.markGroupMemberList(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._getModule(oo).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._getModule(oo).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._getModule(oo).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._getModule(oo).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._getModule(oo).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var o=this._getModule(Eo);o&&o.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var o=this._safetyCallbackFactory.find(e,t);if(null!==o){var a=this._getModule(Eo);a&&(a.removeSignalingListener(e,o,n),this._safetyCallbackFactory.delete(e,t))}}},{key:"invite",value:function(e){var t=this._getModule(Eo);return t?t.invite(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"inviteSync",value:function(e,t,n){var o=this._getModule(Eo);return o?o.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._getModule(Eo);return t?t.invite(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var o=this._getModule(Eo);return o?o.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._getModule(Eo);return t?t.cancel(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"accept",value:function(e){var t=this._getModule(Eo);return t?t.accept(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"reject",value:function(e){var t=this._getModule(Eo);return t?t.reject(e):Go({code:Ao.CANNOT_FIND_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._getModule(Eo);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._getModule(Eo);return t?t.modifyInvitation(e):Go({code:Ao.CANNOT_FIND_MODULE})}}]),e}(),Xs={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 Qs(e,t){if(e.isReady()||1===Xs[t])return!0;var n=e.getNotReadyReason(),o={code:n,message:"".concat(e.getErrorMessage(n)," | ").concat(t," | ").concat(e.getErrorMessage(Ao.SDK_IS_NOT_READY))};return e.onError(o),o}var Zs={},$s={};return $s.create=function(e){var n="TencentCloudChat.create",o=0,a=e.SDKAppID;if(_t(a))o=a;else if(o=parseInt(a),isNaN(a))return Je.e("".concat(n," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(o&&Zs[o])return Zs[o];Je.l("".concat(n));var i=new zs(t(t({},e),{},{SDKAppID:o}));i.on(E.SDK_DESTROY,(function(e){Zs[e.data.SDKAppID]=null,delete Zs[e.data.SDKAppID]}));var s=function(e){var t=Object.create(null);return Object.keys(zn).forEach((function(n){if(e[n]){var o=new k;t[n]=function(){var t=Array.from(arguments);return o.use((function(t,o){var a=Qs(e,n);return!0===a?o():Go(a)})).use((function(e,t){if(!0===_n(e,Jn[n],n))return t()})).use((function(t,o){return e[n].apply(e,t)})),o.run(t)}}})),t}(i);return Zs[o]=s,Jn.hookGetAPITips(i.getErrorMessage.bind(i)),Je.l("".concat(n," ok")),s},$s.TYPES=S,$s.EVENT=E,$s.TSignaling=N,$s.VERSION="3.2.3",Je.l("TencentCloudChat.VERSION:".concat($s.VERSION)),$s}));
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1704768242895);
})()
//miniprogram-npm-outsideDeps=[]
//# sourceMappingURL=index.js.map