1 |
- 'use strict';!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).TIM=t()}(this,(function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach((function(e){a(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 s(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 r(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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&&c(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||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:function(e,t,n){var o=[null];o.push.apply(o,t);var s=new(Function.bind.apply(e,o));return n&&c(s,n.prototype),s}).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,u(this).constructor)}return o.prototype=Object.create(e.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),c(o,e)})(e)}function g(e,t){if(null==e)return{};var n,o,s=function(e,t){if(null==e)return{};var n,o,s={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _(e)}function f(e){var t=l();return function(){var n,o=u(e);if(t){var s=u(this).constructor;n=Reflect.construct(o,arguments,s)}else n=o.apply(this,arguments);return h(this,n)}}function m(e,t){return M(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var o,s,r=[],a=!0,i=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(u){i=!0,s=u}finally{try{a||null==n.return||n.return()}finally{if(i)throw s}}return r}(e,t)||I(e,t)||T()}function v(e){return function(e){if(Array.isArray(e))return C(e)}(e)||y(e)||I(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e){if(Array.isArray(e))return e}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function T(){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=I(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,s=function(){};return{s:s,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,i=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){i=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(i)throw r}}}}var E={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_SYSTEM_NOTICE_RECEIVED:"receiveGroupSystemNotice",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",SDK_RELOAD:"sdkReload"},k={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},S=function(){function e(){o(this,e),this.cache=[],this.options=null}return r(e,[{key:"use",value:function(e){if("function"!=typeof e)throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&this.middlewares.length>0)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}]),e}(),L=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;o(this,e),this.high=t,this.low=n}return r(e,[{key:"equal",value:function(e){return null!==e&&(this.low===e.low&&this.high===e.high)}},{key:"toString",value:function(){var e=Number(this.high).toString(16),t=Number(this.low).toString(16);if(t.length<8)for(var n=8-t.length;n;)t="0"+t,n--;return e+t}}]),e}(),A={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT:"wss://wss.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT:"wss://wsssgp.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",STAT:"https://apisgp.my-imcloud.com"},KOREA:{DEFAULT:"wss://wsskr.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",STAT:"https://apikr.my-imcloud.com"},GERMANY:{DEFAULT:"wss://wssger.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",STAT:"https://apiger.my-imcloud.com"},IND:{DEFAULT:"wss://wssind.my-imcloud.com",BACKUP:"wss://wssind.im.qcloud.com",STAT:"https://apiind.my-imcloud.com"},JPN:{DEFAULT:"wss://wssjpn.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",STAT:"https://apijpn.my-imcloud.com"},USA:{DEFAULT:"wss://wssusa.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",STAT:"https://apiusa.my-imcloud.com"}}},N={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},R="1.7.3",O=537048168,G="CHINA",U="OVERSEA",P="SINGAPORE",b="KOREA",w="GERMANY",F="IND",q="JPN",x="USA",V={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:G;this.CURRENT=A.PRODUCTION[e]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GROUP:"group_open_http_svc",GROUP_AVCHATROOM:"group_open_avchatroom_http_svc",GROUP_COMMUNITY:"million_group_open_http_svc",GROUP_ATTR:"group_open_attr_http_svc",FRIEND:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",PIC:"openpic",BIG_GROUP_NO_AUTH:"group_open_http_noauth_svc",BIG_GROUP_LONG_POLLING:"group_open_long_polling_http_svc",BIG_GROUP_LONG_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",WEB_IM:"webim",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MESSAGE:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate"},CMD:{LOGIN:"wslogin",LOGOUT_LONG_POLL:"longpollinglogout",LOGOUT:"wslogout",HELLO:"wshello",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PORTRAIT_GET:"portrait_get_all",PORTRAIT_SET:"portrait_set",GET_LONG_POLL_ID:"getlongpollingid",LONG_POLL:"longpolling",AVCHATROOM_LONG_POLL:"get_msg",ADD_FRIEND:"friend_add",UPDATE_FRIEND:"friend_update",GET_FRIEND_LIST:"friend_get",GET_FRIEND_PROFILE:"friend_get_specified",DELETE_FRIEND:"friend_delete",CHECK_FRIEND:"friend_check",GET_FRIEND_GROUP_LIST:"group_get",RESPOND_FRIEND_APPLICATION:"friend_response",GET_FRIEND_APPLICATION_LIST:"pendency_get",DELETE_FRIEND_APPLICATION:"pendency_delete",REPORT_FRIEND_APPLICATION:"pendency_report",GET_GROUP_APPLICATION:"get_pendency",CREATE_FRIEND_GROUP:"group_add",DELETE_FRIEND_GROUP:"group_delete",UPDATE_FRIEND_GROUP:"group_update",GET_BLACKLIST:"black_list_get",ADD_BLACKLIST:"black_list_add",DELETE_BLACKLIST:"black_list_delete",CREATE_GROUP:"create_group",GET_JOINED_GROUPS:"get_joined_group_list",SET_GROUP_ATTRIBUTES:"set_group_attr",MODIFY_GROUP_ATTRIBUTES:"modify_group_attr",DELETE_GROUP_ATTRIBUTES:"delete_group_attr",CLEAR_GROUP_ATTRIBUTES:"clear_group_attr",GET_GROUP_ATTRIBUTES:"get_group_attr",SEND_MESSAGE:"sendmsg",REVOKE_C2C_MESSAGE:"msgwithdraw",DELETE_C2C_MESSAGE:"delete_c2c_msg_ramble",MODIFY_C2C_MESSAGE:"modify_c2c_msg",MODIFY_C2C_MESSAGE_EXTENSIONS:"set_key_values",GET_C2C_MESSAGE_EXTENSIONS:"get_key_values",SEND_GROUP_MESSAGE:"send_group_msg",REVOKE_GROUP_MESSAGE:"group_msg_recall",DELETE_GROUP_MESSAGE:"delete_group_ramble_msg_by_seq",MODIFY_GROUP_MESSAGE:"modify_group_msg",MODIFY_GROUP_MESSAGE_EXTENSIONS:"group_set_key_values",GET_GROUP_MESSAGE_EXTENSIONS:"group_get_key_values",GET_GROUP_INFO:"get_group_self_member_info",GET_GROUP_MEMBER_INFO:"get_specified_group_member_info",GET_GROUP_MEMBER_LIST:"get_group_member_info",GET_AVCHATROOM_MEMBER_LIST:"get_members",MARK_AVCHATROOM_MEMBER_INFO:"modify_user_info",QUIT_GROUP:"quit_group",CHANGE_GROUP_OWNER:"change_group_owner",DESTROY_GROUP:"destroy_group",ADD_GROUP_MEMBER:"add_group_member",DELETE_GROUP_MEMBER:"delete_group_member",BAN_AVCHATROOM_MEMBER:"ban_group_member",SEARCH_GROUP_BY_ID:"get_group_public_info",APPLY_JOIN_GROUP:"apply_join_group",HANDLE_APPLY_JOIN_GROUP:"handle_apply_join_group",HANDLE_INVITE_JOIN_GROUP:"handle_invite_join_permission_group",HANDLE_GROUP_INVITATION:"handle_invite_join_group",MODIFY_GROUP_INFO:"modify_group_base_info",MODIFY_GROUP_MEMBER_INFO:"modify_group_member_info",DELETE_GROUP_SYSTEM_MESSAGE:"deletemsg",DELETE_GROUP_AT_TIPS:"deletemsg",GET_GROUP_NOTIFY:"get_group_notify",GET_CONVERSATION_LIST:"get",PAGING_GET_CONVERSATION_LIST:"page_get",DELETE_CONVERSATION:"batch_delete",CLEAR_HISTORY_MESSAGE:"clear_msg",PIN_CONVERSATION:"top",SET_CONVERSATION_CUSTOM_DATA:"mark_contact",MARK_CONVERSATION:"mark_contact",CREATE_CONVERSATION_GROUP:"create_contact_group",DELETE_CONVERSATION_GROUP:"del_contact_group",UPDATE_CONVERSATION_GROUP:"update_contact_group",GET_CONVERSATION_GROUP_LIST:"get_contact_group",GET_MESSAGES:"getmsg",GET_C2C_ROAM_MESSAGES:"getroammsg",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_GROUP_ROAM_MESSAGES:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",SET_C2C_MESSAGE_READ:"msgreaded",GET_PEER_READ_TIME:"get_peer_read_time",SET_GROUP_MESSAGE_READ:"msg_read_report",FILE_READ_AND_WRITE_AUTHKEY:"authkey",FILE_UPLOAD:"pic_up",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",VIDEO_COVER:"video_cover",TIM_WEB_REPORT_V2:"tim_web_report_v2",BIG_DATA_HALLWAY_AUTH_KEY:"authkey",GET_ONLINE_MEMBER_NUM:"get_online_member_num",ALIVE:"alive",MESSAGE_PUSH:"msg_push",MULTI_MESSAGE_PUSH:"multi_msg_push_ws",MESSAGE_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",DOWNLOAD_MERGER_MESSAGE:"get_relay_json_msg",UPLOAD_MERGER_MESSAGE:"save_relay_json_msg",FETCH_CLOUD_CONTROL_CONFIG:"fetch_config",PUSHED_CLOUD_CONTROL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",KICK_OTHER:"KickOther",OVERLOAD_NOTIFY:"notify2",SET_ALL_MESSAGE_READ:"read_all_unread_msg",CREATE_TOPIC:"create_topic",DELETE_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUBSCRIBE_USER_STATUS:"ws_status_subscribe",UNSUBSCRIBE_USER_STATUS:"ws_status_unsubscribe",GET_RPOFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",UPDATE_GROUP_COUNTER:"update_group_counter",GET_GROUP_COUNTER:"get_group_counter"},CHANNEL:{SOCKET:1,XHR:2,AUTO:0},NAME_VERSION:{openim:"v4",group_open_http_svc:"v4",sns:"v4",profile:"v4",recentcontact:"v4",openpic:"v4",group_open_http_noauth_svc:"v4",group_open_long_polling_http_svc:"v4",group_open_long_polling_http_noauth_svc:"v4",imopenstat:"v4",im_cos_sign_svr:"v4",im_cos_msg:"v4",webim:"v4",im_open_push:"v4",im_open_status:"v4"}},H={SEARCH_MSG:new L(0,Math.pow(2,0)).toString(),SEARCH_GRP_SNS:new L(0,Math.pow(2,1)).toString(),AVCHATROOM_HISTORY_MSG:new L(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new L(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new L(0,Math.pow(2,4)).toString(),AVCHATROOM_MBR_LIST:new L(0,Math.pow(2,6)).toString(),USER_STATUS:new L(0,Math.pow(2,7)).toString(),CONV_MARK:new L(0,Math.pow(2,9)).toString(),CONV_GROUP:new L(0,Math.pow(2,10)).toString(),AVCHATROOM_BAN_MBR:new L(0,Math.pow(2,11)).toString(),MSG_EXT:new L(0,Math.pow(2,13)).toString(),GRP_COUNTER:new L(0,Math.pow(2,15)).toString()},B="c2c_text_message",K="c2c_custom_message",W="group_text_message",Y="group_custom_message",j="user_profile",J="sns",z="group_profile",X="group_member_profile";V.HOST.setCurrent(G);var Q="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Z="undefined"!=typeof qq&&"function"==typeof qq.getSystemInfoSync&&Boolean(qq.getSystemInfoSync().fontSizeSetting),$="undefined"!=typeof tt&&"function"==typeof tt.getSystemInfoSync&&Boolean(tt.getSystemInfoSync().fontSizeSetting),ee="undefined"!=typeof swan&&"function"==typeof swan.getSystemInfoSync&&Boolean(swan.getSystemInfoSync().fontSizeSetting),te="undefined"!=typeof my&&"function"==typeof my.getSystemInfoSync&&Boolean(my.getSystemInfoSync().fontSizeSetting),ne="undefined"!=typeof jd&&"function"==typeof jd.getSystemInfoSync,oe="undefined"!=typeof uni&&"undefined"==typeof window&&"function"==typeof uni.requireNativePlugin,se="undefined"!=typeof uni,re=Q||Z||$||ee||te||oe||ne,ae=("undefined"!=typeof uni||"undefined"!=typeof window)&&!re,ie=Z?qq:$?tt:ee?swan:te?my:Q?wx:oe?uni:ne?jd:{},ue=ae&&window&&window.navigator&&window.navigator.userAgent||"",ce=/(micromessenger|webbrowser)/i.test(ue),le=/AppleWebKit\/([\d.]+)/i.exec(ue);le&&parseFloat(le.pop());var de,pe,ge=(de="WEB",ce?de="WEB":Z?de="QQ_MP":$?de="TT_MP":ee?de="BAIDU_MP":te?de="ALI_MP":Q?de="WX_MP":oe&&(de="UNI_NATIVE_APP"),N[de]),_e=/iPad/i.test(ue),he=/iPhone/i.test(ue)&&!_e,fe=/iPod/i.test(ue),me=he||_e||fe,ve=(pe=ue.match(/OS (\d+)_/i))&&pe[1]?pe[1]:null,Me=/Android/i.test(ue),ye=function(){var e=ue.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}();!function(){var e=ue.match(/Chrome\/(\d+)/);e&&e[1]&&parseFloat(e[1])}();var Ie=/MSIE/.test(ue)||ue.indexOf("Trident")>-1&&ue.indexOf("rv:11.0")>-1,Ce=function(){var e=/MSIE\s(\d+)\.\d/.exec(ue),t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(ue)&&/rv:11.0/.test(ue)&&(t=11),t}();!function(){var e=ue.match(/TBS\/(\d+)/i);if(e&&e[1])e[1]}();var Te,De,Ee=/Windows/i.test(ue),ke=/MAC OS X/i.test(ue),Se=ae&&"undefined"!=typeof Worker&&!Ie,Le=Me||me,Ae=ae&&void 0!==window.tencent_cloud_im_csig_flutter_for_web_25F_cy;Te="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Ne=function(){},Re=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Oe=Re.length;Oe--;)De=Re[Oe],console[De]||(Te[De]=Ne);var Ge=Te,Ue=0,Pe=function(){return(new Date).getTime()+Ue},be=function(){Ue=0},we=function(){return Math.floor(Pe()/1e3)},Fe=0;function qe(){return zt()?"%c TIM %c":"TIM"}function xe(){var e,t=((e=new Date).setTime(Pe()),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 Ve={arguments2String:function(e){var t="";if(1===e.length)t=e[0];else for(var n=0,o=e.length;n<o;n++)pt(e[n])?_t(e[n])?t+=vt(e[n]):t+=JSON.stringify(e[n]):t+=e[n],t+=" ";return t},_exec:function(e,t){zt()?Ge[e](qe(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",xe(),t):Ge[e]("".concat(qe()," ").concat(xe()," ").concat(t))},d:function(){if(Fe<=-1){var e=this.arguments2String(arguments);this._exec("debug",e)}},l:function(){if(Fe<=0){var e=this.arguments2String(arguments);this._exec("log",e)}},log:function(){if(Fe<=0){var e=this.arguments2String(arguments);this._exec("log",e)}},i:function(){if(Fe<=1){var e=this.arguments2String(arguments);this._exec("info",e)}},w:function(){if(Fe<=2){var e=this.arguments2String(arguments);this._exec("warn",e)}},e:function(){if(Fe<=3){var e=this.arguments2String(arguments);this._exec("error",e)}},setLevel:function(e){e<4&&this._exec("log","set level from "+Fe+" to "+e),Fe=e},getLevel:function(){return Fe}},He={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},Be={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"},Ke="Tag_SNS_IM_Group",We="Tag_SNS_IM_Remark",Ye="Tag_SNS_IM_AddSource",je="Tag_SNS_IM_AddWording",Je="Tag_SNS_IM_AddTime",ze={UNKNOWN:"Gender_Type_Unknown",FEMALE:"Gender_Type_Female",MALE:"Gender_Type_Male"},Xe={NONE:"AdminForbid_Type_None",SEND_OUT:"AdminForbid_Type_SendOut"},Qe={NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_ANY:"AllowType_Type_AllowAny",DENY_ANY:"AllowType_Type_DenyAny"},Ze="JoinedSuccess",$e="WaitAdminApproval",et="@TGS#_",nt="@TOPIC#_",ot=["url"],st=function(e){return"map"===ht(e)},rt=function(e){return"file"===ht(e)},at=function(e){return null!==e&&("number"==typeof e&&!isNaN(e-0)||"object"===n(e)&&e.constructor===Number)},it=function(e){return"string"==typeof e},ut=function(e){return null!==e&&"object"===n(e)},ct=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},lt=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"array"===ht(e)},dt=function(e){return void 0===e},pt=function(e){return lt(e)||ut(e)},gt=function(e){return"function"==typeof e},_t=function(e){return e instanceof Error},ht=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},ft=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 mt=function e(t,n,o,s){if(!pt(t)||!pt(n))return 0;for(var r,a=0,i=Object.keys(n),u=0,c=i.length;u<c;u++)if(r=i[u],!(dt(n[r])||o&&o.includes(r)))if(pt(t[r])&&pt(n[r]))a+=e(t[r],n[r],o,s);else{if(s&&s.includes(n[r]))continue;t[r]!==n[r]&&(t[r]=n[r],a+=1)}return a},vt=function(e){return JSON.stringify(e,["message","code"])},Mt=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},yt=function(e){var t=e||99999999;return Math.round(Math.random()*t)},It="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",Ct=It.length,Tt=function(e,t){for(var n in e)if(e[n]===t)return!0;return!1},Dt={},Et=function(e){return-1===e.indexOf("http://")||-1===e.indexOf("https://")?"https://"+e:e.replace(/https|http/,"https")},kt=function e(t){if(0===Object.getOwnPropertyNames(t).length)return Object.create(null);var o=Array.isArray(t)?[]:Object.create(null),s="";for(var r in t)null!==t[r]?void 0!==t[r]?(s=n(t[r]),["string","number","function","boolean"].indexOf(s)>=0?o[r]=t[r]:o[r]=e(t[r])):o[r]=void 0:o[r]=null;return o};function St(e,t){if(!lt(e)||!lt(t))return!1;var n=!1;return t.forEach((function(t){var o=t.key,s=t.value,r=e.find((function(e){return e.key===o}));r?r.value!==s&&(r.value=s,n=!0):(e.push({key:o,value:s}),n=!0)})),n}var Lt=function(e){return e===k.GRP_AVCHATROOM},At=function(e){var t=e.type,n=e.groupID;return t===k.GRP_COMMUNITY||"".concat(n).startsWith(et)&&!"".concat(n).includes(nt)},Nt=function(e){return"".concat(e).startsWith(et)&&"".concat(e).includes(nt)},Rt=function(e){return it(e)&&e.slice(0,3)===k.CONV_C2C},Ot=function(e){return it(e)&&e.slice(0,5)===k.CONV_GROUP},Gt=function(e){return it(e)&&e===k.CONV_SYSTEM};function Ut(e,t){var n={};return Object.keys(e).forEach((function(o){n[o]=t(e[o],o)})),n}function Pt(e){return re?new Promise((function(t,n){ie.getImageInfo({src:e,success:function(e){t({width:e.width,height:e.height})},fail:function(){t({width:0,height:0})}})})):Ie&&9===Ce?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 bt(){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 wt(){var e="unknown";if(ke&&(e="mac"),Ee&&(e="windows"),me&&(e="ios"),Me&&(e="android"),re)try{var t=ie.getSystemInfoSync().platform;void 0!==t&&(e=t)}catch(n){}return e}function Ft(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 s=parseInt(e[o]),r=parseInt(t[o]);if(s>r)return 1;if(s<r)return-1}return 0}function qt(e){var t=e.originUrl,n=void 0===t?void 0:t,o=e.originWidth,s=e.originHeight,r=e.min,a=void 0===r?198:r,i=parseInt(o),u=parseInt(s),c={url:void 0,width:0,height:0};if((i<=u?i:u)<=a)c.url=n,c.width=i,c.height=u;else{u<=i?(c.width=Math.ceil(i*a/u),c.height=a):(c.width=a,c.height=Math.ceil(u*a/i));var l=n&&n.indexOf("?")>-1?"".concat(n,"&"):"".concat(n,"?");c.url="".concat(l,198===a?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")}return dt(n)?(c.url,g(c,ot)):c}function xt(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 Vt(e){var t=e.servcmd;return t.slice(t.indexOf(".")+1)}function Ht(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function Bt(e,t){return e.includes(t)}function Kt(e,t){return e.includes(t)}function Wt(e){return e.split(nt)[0]}var Yt=function(e,t,n){if(dt(t))return"";switch(e){case k.MSG_TEXT:return t.text;case k.MSG_IMAGE:return n?"[Image]":"[图片]";case k.MSG_LOCATION:return n?"[Location]":"[位置]";case k.MSG_AUDIO:return n?"[Voice]":"[语音]";case k.MSG_VIDEO:return n?"[Video]":"[视频]";case k.MSG_FILE:return n?"[File]":"[文件]";case k.MSG_CUSTOM:return n?"[Custom Messages]":"[自定义消息]";case k.MSG_GRP_TIP:return n?"[Group Notification]":"[群提示消息]";case k.MSG_GRP_SYS_NOTICE:return n?"[Group System Message]":"[群系统通知]";case k.MSG_FACE:return n?"[Animated Sticker]":"[动画表情]";case k.MSG_MERGER:return n?"[Chat Record]":"[聊天记录]";default:return""}};function jt(e){return e===k.MSG_TEXT||e===k.MSG_CUSTOM||e===k.MSG_LOCATION||e===k.MSG_FACE}function Jt(e){var t=[];if(!it(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 zt(){return!Ie&&!re}function Xt(e){return"the length of userIDList cannot exceed ".concat(e)}function Qt(e,t){if(e){var n=e;return t&&(e.startsWith("http://")?n=e.replace(/^http:\/\/[^/]+/,t):e.startsWith("https://")&&(n=e.replace(/^https:\/\/[^/]+/,t))),n}}var Zt=Object.prototype.hasOwnProperty;function $t(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(ct(e)){for(var t in e)if(Zt.call(e,t))return!1;return!0}return!(!st(e)&&(n=e,"set"!==ht(n))&&!rt(e))&&0===e.size;var n}function en(e,t,n){if(void 0===t)return!0;var o=!0;if(ct(t))Object.keys(t).forEach((function(s){var r=1===e.length?e[0][s]:void 0;o=!!tn(r,t[s],n,s)&&o}));else if(lt(t))for(var s=0;s<t.length;s++)o=!!tn(e[s],t[s],n,t[s].name)&&o;if(o)return o;throw new Error("Params validate failed.")}function tn(e,t,n,o){if(void 0===t)return!0;var s=!0;if(t.required&&$t(e)&&(Ve.e("[".concat(n,'] Missing required params: "').concat(o,'".')),s=!1),!$t(e)){var r=ht(e),a=t.type.toLowerCase();r!==a&&("asyncfunction"===r&&"function"===a||(Ve.e("[".concat(n,'] Invalid params: type check failed for "').concat(o,'".Expected ').concat(t.type,".")),s=!1))}return t.validator&&!t.validator(e)&&(Ve.e("[".concat(n,"] Invalid params: custom validator check failed for params.")),s=!1),s}var nn,on={UNSEND:"unSend",SUCCESS:"success",FAIL:"fail"},sn={NOT_START:"notStart",PENDING:"pending",RESOLVED:"resolved",REJECTED:"rejected"},rn=function(e){if(!e)return!1;if(Rt(e)||Ot(e)||Gt(e))return!0;var t=On("InvalidConversationID",e);return t&&Ve.w(t),!1},an=function(e){""!==e.desc&&""!==On("API_REFER")&&Ve.w("[".concat(e.api,"] | ").concat(e.param," | ").concat(e.desc,", ").concat(On("API_REFER")).concat(e.api))},un=function(){return On("StringRequiredLog")},cn=function(e){return On("NonEmptyStringRequiredLog",e)},ln=function(){return On("NumberRequiredLog")},dn=function(){return On("UndefinedNotAllowedLog")},pn=function(){return On("FileRequiredLog")},gn=function(){return On("FunctionRequiredLog")},_n=function(){return On("ArrayRequiredLog")},hn=function(){return On("NonEmptyArrayLog")},fn=function(){return On("CallbackMissingLog")},mn=function(){return On("PositiveIntegerRequiredLog")},vn=function(e,t){return On("StringNotLongerThanLog",e,t)},Mn=function(e,t){return On("NumberLessThanLog",e,t)},yn=function(e){return On("KeyValueStringRequiredLog",e)},In=function(){return On("PlainObjectRequiredLog")},Cn=function(){return On("NonEmptyContentRequiredLog")},Tn=function(){return On("FileNotSelectedLog")},Dn=function(){return On("MessageInstanceRequiredLog")},En=function(){return On("NonAnonymousFunctionLog")},kn=function(){return On("MessageExtensionNotAvailableLog")},Sn={type:"String",required:!0},Ln={type:"Array",required:!0},An={type:"Object",required:!0},Nn={type:"Boolean",required:!0},Rn={type:"number",required:!0},On=null,Gn={hookGetAPITips:function(e){On=e},login:{userID:Sn,userSig:Sn},addToBlacklist:{userIDList:Ln},removeFromBlacklist:{userIDList:Ln},on:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(an({api:"on",param:"eventName",desc:cn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(an({api:"on",param:"handler",desc:gn()}),!1):(""===e.name&&an({api:"on",param:"handler",desc:En()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(an({api:"once",param:"eventName",desc:cn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(an({api:"once",param:"handler",desc:gn()}),!1):(""===e.name&&an({api:"once",param:"handler",desc:En()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(e){return"string"==typeof e&&0!==e.length||(an({api:"off",param:"eventName",desc:cn("eventName")}),!1)}},{name:"handler",type:"Function",validator:function(e){return"function"!=typeof e?(an({api:"off",param:"handler",desc:gn()}),!1):(""===e.name&&an({api:"off",param:"handler",desc:En()}),!0)}}],sendMessage:[t({name:"message"},An)],setMessageExtensions:[t(t({name:"message"},An),{},{validator:function(e){return e.status===on.SUCCESS&&!0===e.isSupportExtension||(an({api:"setMessageExtensions",param:"message",desc:kn()}),!1)}}),t({name:"extensions"},Ln)],getMessageExtensions:[t(t({name:"message"},An),{},{validator:function(e){return e.status===on.SUCCESS&&!0===e.isSupportExtension||(an({api:"getMessageExtensions",param:"message",desc:kn()}),!1)}})],deleteMessageExtensions:[t(t({name:"message"},An),{},{validator:function(e){return e.status===on.SUCCESS&&!0===e.isSupportExtension||(an({api:"deleteMessageExtensions",param:"message",desc:kn()}),!1)}})],getMessageList:{conversationID:t(t({},Sn),{},{validator:function(e){return rn(e)}}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e){return!(!dt(e)&&!/^[1-9][0-9]*$/.test(e))||(an({api:"getMessageList",param:"count",desc:mn()}),!1)}}},getMessageListHopping:{conversationID:t(t({},Sn),{},{validator:function(e){return rn(e)}}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e){return!(!dt(e)&&0!==e&&1!==e)||(an({api:"getMessageListHopping",param:"direction",desc:On("0Or1RequiredLog")}),!1)}},count:{type:"Number",validator:function(e){return!(!dt(e)&&!/^[1-9][0-9]*$/.test(e))||(an({api:"getMessageListHopping",param:"count",desc:mn}),!1)}}},setMessageRead:{conversationID:t(t({},Sn),{},{validator:function(e){return rn(e)}})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e){return!e||-1!==[k.READ_ALL_C2C_MSG,k.READ_ALL_GROUP_MSG,k.READ_ALL_MSG].indexOf(e)||(an({api:"setAllMessageRead",param:"scope",desc:"TIM.TYPES.READ_ALL_C2C_MSG or TIM.TYPES.READ_ALL_GROUP_MSG or TIM.TYPES.READ_ALL_MSG required"}),!1)}}},getConversationProfile:[t(t({name:"conversationID"},Sn),{},{validator:function(e){return rn(e)}})],clearHistoryMessage:[t(t({name:"conversationID"},Sn),{},{validator:function(e){return rn(e)}})],pinConversation:{conversationID:t(t({},Sn),{},{validator:function(e){return rn(e)}}),isPinned:t({},Nn)},setConversationCustomData:{conversationIDList:t({},Ln),customData:{type:"String",validator:function(e){return it(e)?!(e.length>256)||(an({api:"setConversationCustomData",param:"customData",desc:vn("customData",256)}),!1):(an({api:"setConversationCustomData",param:"customData",desc:un()}),!1)}}},markConversation:{conversationIDList:t({},Ln),markType:{type:"number",validator:function(e){return at(e)?e<=0?(an({api:"markConversation",param:"markType",desc:(t="markType",n=0,On("NumberGreaterThanLog",t,n))}),!1):!(e>=Math.pow(2,64))||(an({api:"markConversation",param:"markType",desc:Mn("markType","Math.pow(2,64)")}),!1):(an({api:"markConversation",param:"markType",desc:ln()}),!1);var t,n}},enableMark:t({},Nn)},createConversationGroup:{conversationIDList:t({},Ln),groupName:t(t({},Sn),{},{validator:function(e){return!!e&&(!(e.length>32)||(an({api:"createConversationGroup",param:"groupName",desc:vn("groupName",32)}),!1))}})},deleteConversationGroup:[t({name:"groupName"},Sn)],renameConversationGroup:{oldName:t({},Sn),newName:t(t({},Sn),{},{validator:function(e){return!!e&&(!(e.length>32)||(an({api:"renameConversationGroup",param:"newName",desc:vn("newName",32)}),!1))}})},addConversationsToGroup:{conversationIDList:t({},Ln),groupName:t({},Sn)},deleteConversationsFromGroup:{conversationIDList:t({},Ln),groupName:t({},Sn)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:Sn,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:Ln},createGroup:{name:Sn},joinGroup:{groupID:Sn,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[t({name:"groupID"},Sn)],handleApplication:{message:An,handleAction:Sn,handleMessage:{type:"String"}},changeGroupOwner:{groupID:Sn,newOwnerID:Sn},updateGroupProfile:{groupID:Sn,muteAllMembers:{type:"Boolean"}},dismissGroup:[t({name:"groupID"},Sn)],searchGroupByID:[t({name:"groupID"},Sn)],initGroupAttributes:{groupID:Sn,groupAttributes:t(t({},An),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!it(e[n]))return an({api:"initGroupAttributes",param:"groupAttributes",desc:yn("value")}),t=!1})),t}})},setGroupAttributes:{groupID:Sn,groupAttributes:t(t({},An),{},{validator:function(e){var t=!0;return Object.keys(e).forEach((function(n){if(!it(e[n]))return an({api:"setGroupAttributes",param:"groupAttributes",desc:yn("value")}),t=!1})),t}})},deleteGroupAttributes:{groupID:Sn,keyList:{type:"Array",validator:function(e){if(dt(e)||!lt(e))return an({api:"deleteGroupAttributes",param:"keyList",desc:_n()}),!1;if(!$t(e)){var t=!0;return e.forEach((function(e){if(!it(e))return an({api:"deleteGroupAttributes",param:"keyList",desc:On("StringArrayRequiredLog")}),t=!1})),t}return!0}}},getGroupAttributes:{groupID:Sn,keyList:{type:"Array",validator:function(e){if(dt(e)||!lt(e))return an({api:"getGroupAttributes",param:"keyList",desc:_n()}),!1;if(!$t(e)){var t=!0;return e.forEach((function(e){if(!it(e))return an({api:"getGroupAttributes",param:"keyList",desc:yn("key")}),t=!1})),t}return!0}}},setGroupCounters:{groupID:Sn,counters:An},increaseGroupCounter:{groupID:Sn,key:Sn,value:Rn},decreaseGroupCounter:{groupID:Sn,key:Sn,value:Rn},getGroupCounters:{groupID:Sn},getGroupMemberList:{groupID:Sn,count:{type:"Number"}},getGroupMemberProfile:{groupID:Sn,userIDList:Ln,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:Sn,userIDList:Ln},setGroupMemberRole:{groupID:Sn,userID:Sn,role:Sn},setGroupMemberMuteTime:{groupID:Sn,userID:Sn,muteTime:{type:"Number",validator:function(e){return e>=0}}},setGroupMemberNameCard:{groupID:Sn,userID:{type:"String"},nameCard:{type:"String",validator:function(e){return it(e)?(e.length,!0):(an({api:"setGroupMemberNameCard",param:"nameCard",desc:un()}),!1)}}},setGroupMemberCustomField:{groupID:Sn,userID:{type:"String"},memberCustomField:Ln},deleteGroupMember:{groupID:Sn},markGroupMemberList:{groupID:Sn,markType:{type:"number",validator:function(e){return at(e)?!(e<1e3)||(an({api:"markGroupMemberList",param:"markType",desc:(t="markType",n=1e3,On("NumberGreaterOrEqualLog",t,n))}),!1):(an({api:"markGroupMemberList",param:"markType",desc:ln()}),!1);var t,n}},userIDList:t({},Ln),enableMark:t({},Nn)},createTextMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return ct(e)?it(e.text)?0!==e.text.length||(an({api:"createTextMessage",param:"payload.text",desc:Cn()}),!1):(an({api:"createTextMessage",param:"payload.text",desc:un()}),!1):(an({api:"createTextMessage",param:"payload",desc:In()}),!1)}})},createTextAtMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return ct(e)?it(e.text)?0===e.text.length?(an({api:"createTextAtMessage",param:"payload.text",desc:Cn()}),!1):!(e.atUserList&&!lt(e.atUserList))||(an({api:"createTextAtMessage",param:"payload.atUserList",desc:_n()}),!1):(an({api:"createTextAtMessage",param:"payload.text",desc:un()}),!1):(an({api:"createTextAtMessage",param:"payload",desc:In()}),!1)}})},createCustomMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return ct(e)?e.data&&!it(e.data)?(an({api:"createCustomMessage",param:"payload.data",desc:un()}),!1):e.description&&!it(e.description)?(an({api:"createCustomMessage",param:"payload.description",desc:un()}),!1):!(e.extension&&!it(e.extension))||(an({api:"createCustomMessage",param:"payload.extension",desc:un()}),!1):(an({api:"createCustomMessage",param:"payload",desc:In()}),!1)}})},createImageMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){if(!ct(e))return an({api:"createImageMessage",param:"payload",desc:In()}),!1;if(dt(e.file))return an({api:"createImageMessage",param:"payload.file",desc:dn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||rt(e.file)))return ct(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(an({api:"createImageMessage",param:"payload.file",desc:Tn()}),!1):(an({api:"createImageMessage",param:"payload.file",desc:pn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return an({api:"createImageMessage",param:"payload.file",desc:Tn()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&an({api:"createImageMessage",param:"onProgress",desc:fn()}),!0}}})},createAudioMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return!!ct(e)||(an({api:"createAudioMessage",param:"payload",desc:In()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&an({api:"createAudioMessage",param:"onProgress",desc:fn()}),!0}}},createVideoMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){if(!ct(e))return an({api:"createVideoMessage",param:"payload",desc:In()}),!1;if(dt(e.file))return an({api:"createVideoMessage",param:"payload.file",desc:dn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||rt(e.file)))return ct(e.file)&&"undefined"!=typeof uni?!!rt(e.file.tempFile)||(an({api:"createVideoMessage",param:"payload.file",desc:Tn()}),!1):(an({api:"createVideoMessage",param:"payload.file",desc:pn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return an({api:"createVideoMessage",param:"payload.file",desc:Tn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&an({api:"createVideoMessage",param:"onProgress",desc:fn()}),!0}}},createFaceMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return ct(e)?at(e.index)?!!it(e.data)||(an({api:"createFaceMessage",param:"payload.data",desc:un()}),!1):(an({api:"createFaceMessage",param:"payload.index",desc:ln()}),!1):(an({api:"createFaceMessage",param:"payload",desc:In()}),!1)}})},createFileMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){if(!ct(e))return an({api:"createFileMessage",param:"payload",desc:In()}),!1;if(dt(e.file))return an({api:"createFileMessage",param:"payload.file",desc:dn()}),!1;if(ae){if(!(e.file instanceof HTMLInputElement||rt(e.file)))return ct(e.file)&&"undefined"!=typeof uni?0!==e.file.tempFilePaths.length&&0!==e.file.tempFiles.length||(an({api:"createFileMessage",param:"payload.file",desc:Tn()}),!1):(an({api:"createFileMessage",param:"payload.file",desc:pn()}),!1);if(e.file instanceof HTMLInputElement&&0===e.file.files.length)return an({api:"createFileMessage",param:"payload.file",desc:Tn()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e){return dt(e)&&an({api:"createFileMessage",param:"onProgress",desc:fn()}),!0}}},createLocationMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){return ct(e)?it(e.description)?at(e.longitude)?!!at(e.latitude)||(an({api:"createLocationMessage",param:"payload.latitude",desc:ln()}),!1):(an({api:"createLocationMessage",param:"payload.longitude",desc:ln()}),!1):(an({api:"createLocationMessage",param:"payload.description",desc:un()}),!1):(an({api:"createLocationMessage",param:"payload",desc:In()}),!1)}})},createMergerMessage:{to:Sn,conversationType:Sn,payload:t(t({},An),{},{validator:function(e){if($t(e.messageList))return an({api:"createMergerMessage",param:"payload.messageList",desc:hn()}),!1;if($t(e.compatibleText))return an({api:"createMergerMessage",param:"payload.compatibleText",desc:cn("compatibleText")}),!1;var t=!1;return e.messageList.forEach((function(e){e.status===on.FAIL&&(t=!0)})),!t||(an({api:"createMergerMessage",param:"payload.messageList",desc:On("MergeFailedMessageLog")}),!1)}})},revokeMessage:[t(t({name:"message"},An),{},{validator:function(e){return $t(e)?(an({api:"revokeMessage",param:"message",desc:Dn()}),!1):e.conversationType===k.CONV_SYSTEM?(an({api:"revokeMessage",param:"message",desc:On("MessageCanBeRevokedDesc")}),!1):!0!==e.isRevoked||(an({api:"revokeMessage",param:"message",desc:On("MessageRevokedLog")}),!1)}})],deleteMessage:[t(t({name:"messageList"},Ln),{},{validator:function(e){return!$t(e)||(an({api:"deleteMessage",param:"messageList",desc:hn()}),!1)}})],translateText:{sourceTextList:Ln,sourceLanguage:Sn,targetLanguage:Sn},modifyMessage:[t(t({name:"message"},An),{},{validator:function(e){return $t(e)?(an({api:"modifyMessage",param:"message",desc:Dn()}),!1):e.conversationType===k.CONV_SYSTEM?(an({api:"modifyMessage",param:"message",desc:On("MessageCanBeModifiedLog")}),!1):!0!==e._onlineOnlyFlag||(an({api:"modifyMessage",param:"message",desc:On("OnlineMessageNotSupportLog")}),!1)}})],getUserProfile:{userIDList:{type:"Array",validator:function(e){return lt(e)?(0===e.length&&an({api:"getUserProfile",param:"userIDList",desc:hn()}),!0):(an({api:"getUserProfile",param:"userIDList",desc:_n()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e){return!!dt(e)||(!!lt(e)||(an({api:"updateMyProfile",param:"profileCustomField",desc:_n()}),!1))}}},setSelfStatus:{customStatus:{type:"String",validator:function(e){return!!it(e)||(an({api:"setSelfStatus",param:"customStatus",desc:un()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e){return lt(e)?0!==e.length||(an({api:"getUserStatus",param:"userIDList",desc:hn()}),!1):(an({api:"getUserStatus",param:"userIDList",desc:_n()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return lt(e)?0!==e.length||(an({api:"subscribeUserStatus",param:"userIDList",desc:hn()}),!1):(an({api:"subscribeUserStatus",param:"userIDList",desc:_n()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(an({api:"subscribeUserStatus",param:"userIDList",desc:_n()}),!1))}}},addFriend:{to:Sn,source:{type:"String",required:!0,validator:function(e){return!!e&&(e.startsWith("AddSource_Type_")?!(e.replace("AddSource_Type_","").length>8)||(an({api:"addFriend",param:"source",desc:vn("keyword",8)}),!1):(an({api:"addFriend",param:"source",desc:On("SourcePrefixLog")}),!1))}},remark:{type:"String",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(an({api:"addFriend",param:"remark",desc:vn("remark",96)}),!1)}}},deleteFriend:{userIDList:Ln},checkFriend:{userIDList:Ln},getFriendProfile:{userIDList:Ln},updateFriend:{userID:Sn,remark:{type:"String",required:!1,validator:function(e){return!(it(e)&&e.length>96)||(an({api:"updateFriend",param:"remark",desc:vn("remark",96)}),!1)}},friendCustomField:{type:"Array",required:!1,validator:function(e){if(e){if(!lt(e))return an({api:"updateFriend",param:"friendCustomField",desc:_n()}),!1;var t=!0;return e.forEach((function(e){return it(e.key)&&-1!==e.key.indexOf("Tag_SNS_Custom")?it(e.value)?e.key.replace("Tag_SNS_Custom_","").length>8?(an({api:"updateFriend",param:"friendCustomField",desc:vn("keyword",8)}),t=!1):void 0:(an({api:"updateFriend",param:"friendCustomField",desc:yn("value")}),t=!1):(an({api:"updateFriend",param:"friendCustomField",desc:On("FriendCustomFieldPrefixLog")}),t=!1)})),t}return!0}}},acceptFriendApplication:{userID:Sn},refuseFriendApplication:{userID:Sn},deleteFriendApplication:{userID:Sn},createFriendGroup:{name:Sn},deleteFriendGroup:{name:Sn},addToFriendGroup:{name:Sn,userIDList:Ln},removeFromFriendGroup:{name:Sn,userIDList:Ln},renameFriendGroup:{oldName:Sn,newName:Sn},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e){return lt(e)?0!==e.length||(an({api:"sendMessageReadReceipt",param:"messageList",desc:hn()}),!1):(an({api:"sendMessageReadReceipt",param:"messageList",desc:_n()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e){return lt(e)?0!==e.length||(an({api:"getMessageReadReceiptList",param:"messageList",desc:hn()}),!1):(an({api:"getMessageReadReceiptList",param:"messageList",desc:_n()}),!1)}}],createTopicInCommunity:{groupID:Sn,topicName:Sn},deleteTopicFromCommunity:{groupID:Sn,topicIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(an({api:"deleteTopicFromCommunity",param:"topicIDList",desc:_n()}),!1))}}},updateTopicProfile:{groupID:Sn,topicID:Sn},getTopicList:{groupID:Sn,topicIDList:{type:"Array",validator:function(e){return!e||(!!lt(e)||(an({api:"getTopicList",param:"topicIDList",desc:_n()}),!1))}}}},Un={login:1,logout:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,setMessageRemindType:1,getGroupApplicationList:1,handleGroupApplication:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,callExperimentalAPI:1},Pn=1,bn=2,wn=3,Fn=4,qn=6,xn=7,Vn=8,Hn=9,Bn=10,Kn=11,Wn=12,Yn=13,jn=14,Jn=15,zn=16,Xn=17,Qn=18,Zn=19,$n=20,eo=21,to=22,no=23,oo=24,so=25,ro=26,ao=27,io=28,uo=29,co=30,lo=31,po=32,go=function(){function e(t){o(this,e),this._m=t,this._n=""}return r(e,[{key:"isLoggedIn",value:function(){return this._m.getModule(Wn).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.getModule(Wn).isOversea()}},{key:"isPrivateNetWork",value:function(){return this._m.getModule(Wn).isPrivateNetWork()}},{key:"getFileDownloadProxy",value:function(){return this._m.getModule(Wn).getFileDownloadProxy()}},{key:"getMyUserID",value:function(){return this._m.getModule(Wn).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.getModule(Wn).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.getModule(Wn).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.getModule(Wn).isIntl()}},{key:"isDevMode",value:function(){return this._m.getModule(Wn).isDevMode()}},{key:"getModule",value:function(e){return this._m.getModule(e)}},{key:"getPlatform",value:function(){return ge}},{key:"getNetworkType",value:function(){return this._m.getModule(Jn).getNetworkType()}},{key:"probeNetwork",value:function(e){return this._m.getModule(Jn).probe(e)}},{key:"getCloudConfig",value:function(e){return this._m.getModule(no).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(Wn).getTinyID()+"-"+e.random}},{key:"filterModifiedMessage",value:function(e){if(!$t(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 $t(e)?[]:e.filter((function(e){return!1===e.isModified}))}},{key:"request",value:function(e){return this._m.getModule($n).request(e)}},{key:"canIUse",value:function(e){return this._m.getModule(ao).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&&Ve.w(o)}}]),e}(),_o="wslogin",ho="wslogout",fo="wshello",mo="KickOther",vo="getmsg",Mo="authkey",yo="sendmsg",Io="send_group_msg",Co="portrait_get_all",To="portrait_set",Do="black_list_get",Eo="black_list_add",ko="black_list_delete",So="friend_get",Lo="friend_get_specified",Ao="friend_check",No="friend_delete",Ro="friend_add",Oo="friend_update",Go="friend_response",Uo="pendency_get",Po="pendency_delete",bo="pendency_report",wo="group_get",Fo="group_add",qo="group_delete",xo="group_update",Vo="msgwithdraw",Ho="msgreaded",Bo="set_c2c_peer_mute_notifications",Ko="get_c2c_peer_mute_notifications",Wo="getroammsg",Yo="get_peer_read_time",jo="delete_c2c_msg_ramble",Jo="modify_c2c_msg",zo="set_key_values",Xo="get_key_values",Qo="page_get",Zo="get",$o="batch_delete",es="clear_msg",ts="top",ns="deletemsg",os="set_conv_custom_data",ss="mark_contact",rs="create_contact_group",as="del_contact_group",is="update_contact_group",us="add_conv_to_group",cs="del_conv_from_group",ls="get_contact_group",ds="get_joined_group_list",ps="get_group_self_member_info",gs="create_group",_s="destroy_group",hs="modify_group_base_info",fs="apply_join_group",ms="apply_join_group_noauth",vs="quit_group",Ms="get_group_public_info",ys="change_group_owner",Is="handle_apply_join_group",Cs="handle_invite_join_permission_group",Ts="handle_invite_join_group",Ds="group_msg_recall",Es="msg_read_report",ks="read_all_unread_msg",Ss="group_msg_get",Ls="get_group_msg_receipt",As="group_msg_receipt",Ns="c2c_msg_read_receipt",Rs="get_group_msg_receipt_detail",Os="get_pendency",Gs="deletemsg",Us="get_msg",Ps="get_msg_noauth",bs="get_online_member_num",ws="delete_group_ramble_msg_by_seq",Fs="modify_group_msg",qs="set_group_attr",xs="modify_group_attr",Vs="delete_group_attr",Hs="clear_group_attr",Bs="get_group_attr",Ks="group_set_key_values",Ws="group_get_key_values",Ys="get_group_notify",js="update_group_counter",Js="get_group_counter",zs="get_group_member_info",Xs="get_members",Qs="get_specified_group_member_info",Zs="add_group_member",$s="delete_group_member",er="ban_group_member",tr="modify_group_member_info",nr="modify_user_info",or="cos",sr="pre_sig",rr="video_cover",ar="tim_web_report_v2",ir="alive",ur="msg_push",cr="multi_msg_push_ws",lr="ws_msg_push_ack",dr="stat_forceoffline",pr="save_relay_json_msg",gr="get_relay_json_msg",_r="fetch_config",hr="push_configv2",fr="fetch_imsdk_purchase_bitsv2",mr="push_imsdk_purchase_bitsv2",vr="notify2",Mr="create_topic",yr="destroy_topic",Ir="modify_topic",Cr="get_topic",Tr="ws_set_custom_status",Dr="ws_get_user_status",Er="ws_status_subscribe",kr="ws_status_unsubscribe",Sr="ws_stat_background",Lr="ws_stat_foreground",Ar="ws_stat_settoken",Nr="get_local_words",Rr="ws_batch_trans_text",Or={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MESSAGE_SEND_FAIL:2100,MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM:2101,MESSAGE_SEND_NEED_MESSAGE_INSTANCE:2105,MESSAGE_SEND_INVALID_CONVERSATION_TYPE:2106,MESSAGE_FILE_IS_EMPTY:2108,MESSAGE_ONPROGRESS_FUNCTION_ERROR:2109,MESSAGE_REVOKE_FAIL:2110,MESSAGE_DELETE_FAIL:2111,MESSAGE_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MESSAGE_LIST_EMPTY:2114,MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GROUP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,MESSAGE_IMAGE_SELECT_FILE_FIRST:2251,MESSAGE_IMAGE_TYPES_LIMIT:2252,MESSAGE_IMAGE_SIZE_LIMIT:2253,MESSAGE_AUDIO_UPLOAD_FAIL:2300,MESSAGE_AUDIO_SIZE_LIMIT:2301,MESSAGE_VIDEO_UPLOAD_FAIL:2350,MESSAGE_VIDEO_SIZE_LIMIT:2351,MESSAGE_VIDEO_TYPES_LIMIT:2352,MESSAGE_FILE_UPLOAD_FAIL:2400,MESSAGE_FILE_SELECT_FILE_FIRST:2401,MESSAGE_FILE_SIZE_LIMIT:2402,MESSAGE_FILE_URL_IS_EMPTY:2403,MESSAGE_MERGER_TYPE_INVALID:2450,MESSAGE_MERGER_KEY_INVALID:2451,MESSAGE_MERGER_DOWNLOAD_FAIL:2452,MESSAGE_FORWARD_TYPE_INVALID:2453,MESSAGE_MODIFY_CONFLICT:2480,MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM:2481,CONVERSATION_NOT_FOUND:2500,USER_OR_GROUP_NOT_FOUND:2501,CONVERSATION_UN_RECORDED_TYPE:2502,INVALID_CONVERSATION_ID:2503,ILLEGAL_GROUP_TYPE:2600,CANNOT_JOIN_WORK:2601,ILLEGAL_GROUP_ID:2602,CANNOT_FIND_GROUP:2603,CANNOT_CHANGE_OWNER_IN_AVCHATROOM:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,CANNOT_DISMISS_WORK:2622,MEMBER_NOT_IN_GROUP:2623,JOIN_GROUP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AVCHATROOM:2661,CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN:2662,NOT_OWNER:2681,CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM:2682,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GROUP_EXISTED:2710,FRIEND_GROUP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,CANNOT_FIND_PROTOCOL:2997,CANNOT_FIND_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,CANNOT_USE_COMMERCIAL_ABILITY:3122,PROFANITY_FOUND:3123,MESSAGE_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022},Gr="networkRTT",Ur="messageE2EDelay",Pr="sendMessageC2C",br="sendMessageGroup",wr="sendMessageGroupAV",Fr="sendMessageRichMedia",qr="cosUpload",xr="messageReceivedGroup",Vr="messageReceivedGroupAVPush",Hr="messageReceivedGroupAVPull",Br=(a(nn={},Gr,2),a(nn,Ur,3),a(nn,Pr,4),a(nn,br,5),a(nn,wr,6),a(nn,Fr,7),a(nn,xr,8),a(nn,Vr,9),a(nn,Hr,10),a(nn,qr,11),nn),Kr={info:4,warning:5,error:6},Wr={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},Yr={login:4},jr=function(){function e(t){o(this,e),this._n="SSOLogData",this.eventType=Yr[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=Pe()}return r(e,[{key:"updateTimeStamp",value:function(){this.timestamp=Pe()}},{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=Pe();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 Ve.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=Or.NO_NETWORK;this.setCode(o)}return this.setLevel("error"),this}},{key:"setCode",value:function(e){return dt(e)||this._sentFlag||("ECONNABORTED"===e&&(this.code=103),at(e)?this.code=e:Ve.w("".concat(this._n,".setCode value not a number, please check!"),e,n(e))),this}},{key:"setMessage",value:function(e){return dt(e)||this._sentFlag||(at(e)&&(this.message=e.toString()),it(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return dt(e)||this._sentFlag||(this.level=Kr[e]),this}},{key:"setMoreMessage",value:function(e){return $t(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){if(dt(e))Ve.w("".concat(this._n,".setNetworkType value is undefined, please check!"));else{var t=Wr[e.toLowerCase()];dt(t)||(this.networkType=t)}return this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){this.uiPlatform=e}}],[{key:"bindEventStatModule",value:function(t){e.prototype._eventStatModule=t}}]),e}(),Jr=function(){function e(t){o(this,e),this.type=k.MSG_TEXT,this.content={text:t.text||""}}return r(e,[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return 0!==this.content.text.length}}]),e}(),zr=function(){function e(t,n){o(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,re?this.createImageDataASURLInWXMiniApp(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=k.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||He.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()}return r(e,[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=yt(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.url||"",this.url=Qt(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=dt(e)||dt(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"],s=null,r=0;r<e;r++)this.content.imageInfoArray[r].url&&""!==(s=this.content.imageInfoArray[r]).imageUrl&&(n=s.imageUrl.slice(0,s.imageUrl.indexOf("://")+1),t=s.imageUrl.slice(s.imageUrl.indexOf("://")+1),o.indexOf(n)<0&&(n="https:"),this.content.imageInfoArray[r].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=He[e.toUpperCase()]||He.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){void 0!==e&&e.files.length>0&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURLInWXMiniApp",value:function(e){e&&e.url&&(this._imageMemoryURL=e.url)}},{key:"replaceImageInfo",value:function(e,t){this.content.imageInfoArray[t]instanceof this._ImageInfoModel||(this.content.imageInfoArray[t]=e)}},{key:"addImageInfo",value:function(e){this.content.imageInfoArray.length>=3||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,t=e[0],n=t.width,o=void 0===n?0:n,s=t.height,r=void 0===s?0:s;0!==o&&0!==r&&(xt(e),Object.assign(e[2],qt({originWidth:o,originHeight:r,min:720})))}},{key:"sendable",value:function(){return 0!==this.content.imageInfoArray.length&&(""!==this.content.imageInfoArray[0].imageUrl&&0!==this.content.imageInfoArray[0].size)}}]),e}(),Xr=function(){function e(t){o(this,e),this.type=k.MSG_FACE,this.content=t||null}return r(e,[{key:"sendable",value:function(){return null!==this.content}}]),e}(),Qr=function(){function e(t,n){o(this,e),this.type=k.MSG_AUDIO,this._percent=0,this.content={downloadFlag:2,second:t.second,size:t.size,url:Qt(t.url,n),remoteAudioUrl:t.url||"",uuid:t.uuid}}return r(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}(),Zr={from:!0,groupID:!0,groupName:!0,to:!0},$r=function(){function e(t){o(this,e),this.type=k.MSG_GRP_TIP,this.content={},this._initContent(t)}return r(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];Zr[o]&&(this.content.groupProfile[o]=e[o])}}},{key:"_updateMemberList",value:function(e){$t(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}(),ea={from:!0,groupID:!0,groupName:!0,to:!0},ta=function(){function e(t){o(this,e),this.type=k.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)}return r(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];ea[o]&&("groupName"===o?this.content.groupProfile.name=e[o]:this.content.groupProfile[o]=e[o])}}}]),e}(),na=function(){function e(t,n){o(this,e),this.type=k.MSG_FILE,this._percent=0;var s=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:Qt(t.url,n)||"",uuid:t.uuid,fileName:s.name||"",fileSize:s.size||0}}return r(e,[{key:"_getFileInfo",value:function(e){if(!dt(e.fileName)&&!dt(e.fileSize))return{size:e.fileSize,name:e.fileName};var t=e.file.files[0];if(oe){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(yt(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}(),oa=function(){function e(t){o(this,e),this.type=k.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}}return r(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}(),sa=function(){function e(t,n){o(this,e),this.type=k.MSG_VIDEO,this._percent=0,this.content={remoteVideoUrl:t.remoteVideoUrl||t.videoUrl||"",videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:Qt(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:Qt(t.thumbUrl,n),snapshotUrl:Qt(t.thumbUrl,n)}}return r(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;$t(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),$t(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),$t(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o))}},{key:"sendable",value:function(){return""!==this.content.remoteVideoUrl}}]),e}(),ra=function(){function e(t){o(this,e),this.type=k.MSG_LOCATION;var n=t.description,s=t.longitude,r=t.latitude;this.content={description:n,longitude:s,latitude:r}}return r(e,[{key:"sendable",value:function(){return!0}}]),e}(),aa=function(){function e(t,n){if(o(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID)this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType.startsWith(k.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(k.CONV_GROUP)&&(this.receiverGroupID=t.to),this.messageReceiver=t.to;else{this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[];var s=t.elements[0].type,r=t.elements[0].content;this._patchRichMediaPayload(s,r),this._updateRichMediaDownloadUrl(s,r,n),s===k.MSG_MERGER?this.messageBody.push({type:s,payload:new ia(r).content}):this.messageBody.push({type:s,payload:r}),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 r(e,[{key:"_patchRichMediaPayload",value:function(e,t){e===k.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===k.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===k.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===k.MSG_FILE&&!t.fileUrl&&t.url&&(t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n){n&&(e===k.MSG_IMAGE?t.imageInfoArray.forEach((function(e){e.url=Qt(e.url,n)})):e===k.MSG_VIDEO?(t.videoUrl=Qt(t.videoUrl,n),t.snapshotUrl=Qt(t.thumbUrl,n),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===k.MSG_AUDIO?t.url=Qt(t.url,n):e===k.MSG_FILE&&(t.fileUrl=Qt(t.fileUrl,n)))}}]),e}(),ia=function(){function e(t,n){if(o(this,e),this.type=k.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey){var s=t.downloadKey,r=t.pbDownloadKey,a=t.title,i=t.abstractList,u=t.compatibleText,c=t.version;this.content.downloadKey=s,this.content.pbDownloadKey=r,this.content.title=a,this.content.abstractList=i,this.content.compatibleText=u,this.content.version=c||0}else if($t(t.messageList))1===t.layersOverLimit&&(this.content.layersOverLimit=!0);else{var l=t.messageList,d=t.title,p=t.abstractList,g=t.compatibleText,_=t.version,h=[];l.forEach((function(e){if(!$t(e)){var t=new aa(e,n);h.push(t)}})),this.content.messageList=h,this.content.title=d,this.content.abstractList=p,this.content.compatibleText=g,this.content.version=_||0}}return r(e,[{key:"sendable",value:function(){return!$t(this.content.messageList)||!$t(this.content.downloadKey)}}]),e}(),ua={1:k.MSG_PRIORITY_HIGH,2:k.MSG_PRIORITY_NORMAL,3:k.MSG_PRIORITY_LOW,4:k.MSG_PRIORITY_LOWEST},ca=function(){function e(t){o(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||k.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:yt(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=2===t.isPlaceMessage||8===t.msgFlagBits,this.from=t.from||null,this.to=t.to||null,this.flow="",this.isSystemMessage=t.isSystemMessage||!1,this.protocol=t.protocol||"JSON",this.isResend=!1,this.isRead=!1,this.status=t.status||on.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||we()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0},this.needReadReceipt=!0===t.needReadReceipt||1===t.needReadReceipt,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=!0===t.isSupportExtension||1===t.isSupportExtension,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||null,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t.readReceiptSentByPeer)}return r(e,[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){if(null!==e){it(e.nick)&&(this.nick=e.nick),it(e.avatar)&&(this.avatar=e.avatar);var t=e.messageFromAccountExtraInformation;ct(t)&&it(t.nameCard)&&(this.nameCard=t.nameCard)}}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach((function(e){e!==k.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:e}),t.atUserList.push(e)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(k.MSG_AT_ALL))})),lt(e.groupAtInfo)&&e.groupAtInfo.forEach((function(e){0===e.groupAtAllFlag?t.atUserList.push(e.groupAtUserID):1===e.groupAtAllFlag&&t.atUserList.push(k.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?on.SUCCESS:on.UNSEND,!this.from&&(this.from=e)),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return 0!==this._elements.length&&("function"==typeof this._elements[0].sendable&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===k.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===Dt[e]){var t=new Date,n="3".concat(t.getHours()).slice(-2),o="0".concat(t.getMinutes()).slice(-2),s="0".concat(t.getSeconds()).slice(-2);Dt[e]=parseInt([n,o,s,"0001"].join("")),n=null,o=null,s=null,Ve.l("autoIncrementIndex start index:".concat(Dt[e]))}return Dt[e]++}(e)),0===this.sequence&&this.conversationType===k.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===k.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!==k.CONV_SYSTEM?(n=o===k.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=n?"".concat(o).concat(n):null):this.conversationID=k.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Jr||e instanceof zr||e instanceof Xr||e instanceof Qr||e instanceof na||e instanceof sa||e instanceof $r||e instanceof ta||e instanceof oa||e instanceof ra||e instanceof ia}},{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 k.MSG_TEXT:n.setTextElement(e.content);break;case k.MSG_IMAGE:n.setImageElement(e.content,t);break;case k.MSG_AUDIO:n.setAudioElement(e.content,t);break;case k.MSG_FILE:n.setFileElement(e.content,t);break;case k.MSG_VIDEO:n.setVideoElement(e.content,t);break;case k.MSG_CUSTOM:n.setCustomElement(e.content);break;case k.MSG_LOCATION:n.setLocationElement(e.content);break;case k.MSG_GRP_TIP:n.setGroupTipElement(e.content);break;case k.MSG_GRP_SYS_NOTICE:n.setGroupSystemNoticeElement(e.content);break;case k.MSG_FACE:n.setFaceElement(e.content);break;case k.MSG_MERGER:n.setMergerElement(e.content,t)}};if(lt(e))for(var s=0;s<e.length;s++)o(e[s]);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 Jr({text:t});this._elements.push(n)}},{key:"setImageElement",value:function(e,t){var n=new zr(e,t);this._elements.push(n)}},{key:"setAudioElement",value:function(e,t){var n=new Qr(e,t);this._elements.push(n)}},{key:"setFileElement",value:function(e,t){var n=new na(e,t);this._elements.push(n)}},{key:"setVideoElement",value:function(e,t){var n=new sa(e,t);this._elements.push(n)}},{key:"setLocationElement",value:function(e){var t=new ra(e);this._elements.push(t)}},{key:"setCustomElement",value:function(e){var t=new oa(e);this._elements.push(t)}},{key:"setGroupTipElement",value:function(e){var t={},n=e.operationType;if($t(e.memberInfoList)?e.operatorInfo&&(t=e.operatorInfo):n!==k.GRP_TIP_MBR_JOIN&&n!==k.GRP_TIP_MBR_KICKED_OUT&&n!==k.GRP_TIP_MBR_SET_ADMIN&&n!==k.GRP_TIP_MBR_CANCELED_ADMIN||(t=e.memberInfoList[0]),!$t(e.memberExtraInfo)){var o=e.memberExtraInfo.reason;e.msgMemberInfo.forEach((function(e){e.reason=o}))}var s=t,r=s.nick,a=s.avatar;it(r)&&(this.nick=r),it(a)&&(this.avatar=a);var i=new $r(e);this._elements.push(i)}},{key:"setGroupSystemNoticeElement",value:function(e){var t=new ta(e);this._elements.push(t)}},{key:"setFaceElement",value:function(e){var t=new Xr(e);this._elements.push(t)}},{key:"setMergerElement",value:function(e,t){var n=new ia(e,t);this._elements.push(n)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"getRelayFlag",value:function(){return this._relayFlag}},{key:"_computePriority",value:function(e){if(dt(e))return k.MSG_PRIORITY_NORMAL;if(it(e)&&-1!==Object.values(ua).indexOf(e))return e;if(at(e)){var t=""+e;if(-1!==Object.keys(ua).indexOf(t))return ua[t]}return k.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(e){var t=e.nick,n=e.avatar;it(t)&&(this.nick=t),it(n)&&(this.avatar=n)}},{key:"setNameCard",value:function(e){it(e)&&(this.nameCard=e)}},{key:"initC2CReadReceiptInfo",value:function(e){this.conversationType===k.CONV_C2C&&!0===this.needReadReceipt&&(this.readReceiptInfo.isPeerRead=1===e)}}]),e}(),la=function(e){return{code:0,data:e||{}}},da=function(e){i(n,e);var t=f(n);function n(e){var s;o(this,n),s=t.call(this);var r=e.code,a=e.message,i=e.data;return s.code=r,s.message=a||s._getErrorMessage(s.code),s.data=i||{},s}return r(n)}(p(Error)),pa=null,ga=function(e){pa=e},_a=function(e){return Promise.resolve(la(e))},ha=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof da)return t&&null!==pa&&pa.emit(E.ERROR,e),Promise.reject(e);if(e instanceof Error){var n=new da({code:Or.UNCAUGHT_ERROR});return t&&null!==pa&&pa.emit(E.ERROR,n),Promise.reject(n)}if(!dt(e)&&!dt(e.code)){var o=new da(e);return t&&null!==pa&&pa.emit(E.ERROR,o),Promise.reject(o)}},fa=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="C2CModule",t._messageFromUnreadDBMap=new Map,t._signalingFromUnreadDBList=[],t}return r(s,[{key:"onNewC2CMessage",value:function(e){var t=e.dataList,n=e.isInstantMessage,o=e.C2CRemainingUnreadList,s=e.C2CPairUnreadList;Ve.d("".concat(this._n,".onNewC2CMessage count:").concat(t.length," isInstantMessage:").concat(n));var r=this._newC2CMessageStoredAndSummary({dataList:t,C2CRemainingUnreadList:o,C2CPairUnreadList:s,isInstantMessage:n}),a=r.conversationOptionsList,i=r.messageList,u=r.isUnreadC2CMessage;(this.filterModifiedMessage(i),a.length>0)&&this.getModule(Kn).onNewMessage({conversationOptionsList:a,isInstantMessage:n,isUnreadC2CMessage:u});var c=this.filterUnmodifiedMessage(i);n&&c.length>0&&this.emitOuterEvent(E.MESSAGE_RECEIVED,c),i.length=0}},{key:"_newC2CMessageStoredAndSummary",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=e.isInstantMessage,r=null,a=[],i=[],u={},c=this.getModule(zn),l=this.getModule(ro),d=!1,p=this.getModule(Kn),g=this.getFileDownloadProxy(),_=0,h=t.length;_<h;_++)if(this._isSignaling(t[_]))this._signalingFromUnreadDBList.push(t[_].eventArray[0].c2CNotifyMsgArray[0]);else{var f=t[_];f.currentUser=this.getMyUserID(),f.conversationType=k.CONV_C2C,f.isSystemMessage=!!f.isSystemMessage,(dt(f.nick)||dt(f.avatar))&&(d=!0,Ve.d("".concat(this._n,"._newC2CMessageStoredAndSummary nick or avatar missing!"))),r=new ca(f),f.elements=c.parseElements(f.elements,f.from),r.setElement(f.elements,g),r.setNickAndAvatar({nick:f.nick,avatar:f.avatar});var m=r.conversationID;if(s){if(1===this._messageFromUnreadDBMap.get(r.ID))continue;var v=!1;if(r.from!==this.getMyUserID()){var M=p.getLatestMessageSentByPeer(m);if(M){var y=M.nick,I=M.avatar;d?r.setNickAndAvatar({nick:y,avatar:I}):y===r.nick&&I===r.avatar||(v=!0)}}else{var C=p.getLatestMessageSentByMe(m);if(C){var T=C.nick,D=C.avatar;T===r.nick&&D===r.avatar||p.modifyMessageSentByMe({conversationID:m,latestNick:r.nick,latestAvatar:r.avatar})}}var E=1===t[_].isModified;if(p.isMessageSentByCurrentInstance(r)?r.isModified=E:E=!1,0===f.msgLifeTime)r._onlineOnlyFlag=!0,p.isMessageSentByCurrentInstance(r)||i.push(r);else{if(!p.pushIntoMessageList(i,r,E))continue;v&&(p.modifyMessageSentByPeer({conversationID:m,latestNick:r.nick,latestAvatar:r.avatar}),p.updateUserProfileSpecifiedKey({conversationID:m,nick:r.nick,avatar:r.avatar}))}s&&r.clientTime>0&&l.addMessageDelay(r.clientTime)}else this._messageFromUnreadDBMap.set(r.ID,1);if(0!==f.msgLifeTime){if(!1===r._onlineOnlyFlag){var S=p.getLastMessageTime(m);if(at(S)&&r.time<S)continue;if(dt(u[m])){var L=0;"in"===r.flow&&(r._isExcludedFromUnreadCount||(L=1)),u[m]=a.push({conversationID:m,unreadCount:L,type:r.conversationType,subType:r.conversationSubType,lastMessage:r._isExcludedFromLastMessage?"":r})-1}else{var A=u[m];a[A].type=r.conversationType,a[A].subType=r.conversationSubType,a[A].lastMessage=r._isExcludedFromLastMessage?"":r,"in"===r.flow&&(r._isExcludedFromUnreadCount||a[A].unreadCount++)}}}else r._onlineOnlyFlag=!0}this._handleSignalingFromUnreadDB();var N=!1;if(lt(o))for(var R=function(e,t){if(o[e].unreadCount>0){N=!0;var n=a.find((function(t){return t.conversationID==="C2C".concat(o[e].from)}));n?n.unreadCount=o[e].unreadCount:a.push({conversationID:"C2C".concat(o[e].from),unreadCount:o[e].unreadCount,type:k.CONV_C2C})}},O=0,G=o.length;O<G;O++)R(O);if(lt(n))for(var U=function(e,t){a.find((function(t){return t.conversationID==="C2C".concat(n[e].from)}))||a.push({conversationID:"C2C".concat(n[e].from),type:k.CONV_C2C,lastMsgTime:n[e].lastMsgTime})},P=0,b=n.length;P<b;P++)U(P);return{conversationOptionsList:a,messageList:i,isUnreadC2CMessage:N}}},{key:"_isSignaling",value:function(e){var t=e.eventArray;return!(!lt(t)||10!==t[0].event)}},{key:"_handleSignalingFromUnreadDB",value:function(){var e=this._signalingFromUnreadDBList.length;if(Ve.l("".concat(this._n,"._handleSignalingFromUnreadDB signalingCount:").concat(e)),0!==e){var t=[];this._signalingFromUnreadDBList.forEach((function(e){e.hasOwnProperty("c2cMessageRevokedNotify")&&t.push(e)})),this.onC2CMessageRevoked({dataList:t}),this._signalingFromUnreadDBList.length=0,t.length=0}}},{key:"onC2CMessageRevoked",value:function(e){var t=this,n=this.getModule(Kn),o=[],s=null,r=!0;e.dataList.forEach((function(e){if(e.c2cMessageRevokedNotify){var a=e.c2cMessageRevokedNotify.revokedInfos;dt(a)||a.forEach((function(e){var a=t.getMyUserID()===e.from?"".concat(k.CONV_C2C).concat(e.to):"".concat(k.CONV_C2C).concat(e.from);s=n.revoke(a,e.sequence,e.random);var i=e.revokerInfo&&e.revokerInfo.revoker;if(s)s.revoker||(s.revoker=i,o.push(s));else{var u={conversationID:a,sequence:e.sequence,time:e.time,revoker:i};n.isLastMessageRevoked(u)&&(o.push(u),r=!1)}}))}})),0!==o.length&&(n.onMessageRevoked(o),!0===r&&(Ve.l("".concat(this._n,".onC2CMessageRevoked count:").concat(o.length)),this.emitOuterEvent(E.MESSAGE_REVOKED,o)))}},{key:"onC2CMessageReadReceipt",value:function(e){var t=this;e.dataList.forEach((function(e){if(!$t(e.c2cMessageReadReceipt)){var n=e.c2cMessageReadReceipt.to;e.c2cMessageReadReceipt.uinPairReadArray.forEach((function(e){var o=e.peerReadTime;Ve.d("".concat(t._n,"._onC2CMessageReadReceipt to:").concat(n," peerReadTime:").concat(o));var s="".concat(k.CONV_C2C).concat(n),r=t.getModule(Kn);r.recordPeerReadTime(s,o),r.updateMessageIsPeerReadProperty(s,o)}))}}))}},{key:"onC2CMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){if(!$t(e.c2cMessageReadNotice)){var n=t.getModule(Kn);e.c2cMessageReadNotice.uinPairReadArray.forEach((function(e){var o=e.from,s=e.peerReadTime;Ve.d("".concat(t._n,".onC2CMessageReadNotice from:").concat(o," lastReadTime:").concat(s));var r="".concat(k.CONV_C2C).concat(o);n.updateIsReadAfterReadReport({conversationID:r,lastMessageTime:s}),n.updateUnreadCount(r)}))}}))}},{key:"onC2CMessageModified",value:function(e){Ve.d("".concat(this._n,".onC2CMessageModified options:"),JSON.stringify(e));var n=this.getModule(Kn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:k.CONV_C2C}))}))}},{key:"onReadReceiptList",value:function(e){Ve.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e));var t=e.dataList,n=t.userID,o=t.readReceiptList;this.getModule(Kn).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="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var s=[];if(ct(t)&&ct(t.messageControlInfo)){var r=t.messageControlInfo,a=r.excludedFromUnreadCount,i=r.excludedFromLastMessage,u=r.excludedFromContentModeration;!0===a&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=this.isOnlineMessage(e,t)?0:void 0;return{protocolName:yo,tjgID:this.generateTjgID(e),requestData:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:e.getElements(),cloudCustomData:o,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:c,nick:e.nick,avatar:e.avatar,offlinePushInfo:n?{pushFlag:!0===n.disablePush?1:0,title:n.title||"",desc:n.description||"",ext:n.extension||"",apnsInfo:{badgeMode:!0===n.ignoreIOSBadge?1:0,isVoipPush:this._isVoipPush(n)},androidInfo:{OPPOChannelID:n.androidOPPOChannelID||""}}:void 0,messageControlInfo:0!==c?s:void 0,clientTime:e.clientTime,needReadReceipt:!0===e.needReadReceipt?1:0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_isVoipPush",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"isOnlineMessage",value:function(e,t){return!(!t||!0!==t.onlineUserOnly)}},{key:"revokeMessage",value:function(e){return this.request({protocolName:Vo,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 Ve.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.request({protocolName:jo,requestData:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(e){var t=e.from,n=e.to,o=e.version,s=void 0===o?0:o,r=e.sequence,a=e.random,i=e.time,u=e.payload,c=e.type,l=e.cloudCustomData,d=void 0;return jt(c)&&(d=[]).push({type:c,content:u}),this.request({protocolName:Jo,requestData:{from:t,to:n,version:s,sequence:r,random:a,time:i,elements:d,cloudCustomData:l}})}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageTime,s="".concat(this._n,".setMessageRead");Ve.l("".concat(s," conversationID:").concat(n," lastMessageTime:").concat(o)),at(o)||this.outputWarning("DoNotModifyLastTime");var r=new jr("setC2CMessageRead");return r.setMessage("conversationID:".concat(n," lastMessageTime:").concat(o)),this.request({protocolName:Ho,requestData:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then((function(){r.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(s," ok"));var e=t.getModule(Kn);return e.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),e.updateUnreadCount(n),la()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.l("".concat(s," failed. error:"),e),ha(e)}))}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.peerAccount,s=e.conversationID,r=e.count,a=e.lastMessageTime,i=e.messageKey,u="peerAccount:".concat(o," count:").concat(r||15," lastMessageTime:").concat(a||0," messageKey:").concat(i);Ve.l("".concat(n," ").concat(u));var c=new jr("getC2CRoamingMessages");return this.request({protocolName:Wo,requestData:{peerAccount:o,count:r||15,lastMessageTime:a||0,messageKey:i}}).then((function(e){var o=e.data,r=o.complete,a=o.messageList,i=o.messageKey,l=o.lastMessageTime;dt(a)?Ve.l("".concat(n," ok. complete:").concat(r," but messageList is undefined!")):Ve.l("".concat(n," ok. complete:").concat(r," count:").concat(a.length)),c.setNetworkType(t.getNetworkType()).setMessage("".concat(u," complete:").concat(r," length:").concat(a.length)).end();var d=t.getModule(Kn);1===r&&d.setCompleted(s);var p=d.onRoamingMessage(a,s);d.modifyMessageList(s),d.updateIsRead(s),d.updateRoamingMessageKeyAndTime(s,i,l);var g=d.getPeerReadTime(s);if(Ve.l("".concat(n," update isPeerRead property. conversationID:").concat(s," peerReadTime:").concat(g)),g)d.updateMessageIsPeerReadProperty(s,g);else{var _=s.replace(k.CONV_C2C,"");t.getRemotePeerReadTime([_]).then((function(){d.updateMessageIsPeerReadProperty(s,d.getPeerReadTime(s))}))}var h="";if(p.length>0)h=p[0].ID;else{var f=d.getLocalOldestMessage(s);f&&(h=f.ID)}return Ve.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=m(t,2),o=n[0],s=n[1];c.setMessage(u).setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=e.peerAccount,s=e.time,r=void 0===s?0:s,a=e.count,i=e.direction,u="".concat(k.CONV_C2C).concat(o),c="peerAccount:".concat(o," count:").concat(a," time:").concat(r," direction:").concat(i);Ve.l("".concat(n," ").concat(c));var l=new jr("getC2CRoamingMessagesHopping");return this.request({protocolName:Wo,requestData:{peerAccount:o,count:a+1,lastMessageTime:r,direction:i}}).then((function(e){var o=e.data,s=o.complete,r=o.messageList,a=void 0===r?[]:r,d=o.lastMessageTime;Ve.l("".concat(n," ok. complete:").concat(s," count:").concat(a.length)),l.setNetworkType(t.getNetworkType()).setMessage("".concat(c," complete:").concat(s," length:").concat(a.length)).end(),1!==s&&(1===i?a.pop():a.shift());var p=t.getModule(Kn).onRoamingMessage(a,u,!1);t._modifyMessageList(u,p);var g=t._computeResult({complete:s,lastMessageTime:d,resultList:p});return la(g)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setMessage(c).setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_computeResult",value:function(e){var t=e.complete,n=void 0===t?0:t,o=e.lastMessageTime,s=e.resultList,r={messageList:v(void 0===s?[]:s),isCompleted:!1,nextMessageTime:""};return 1===n?(r.isCompleted=!0,r):(r.nextMessageTime=o,r)}},{key:"_modifyMessageList",value:function(e,t){var n=this.getModule(Kn).getLocalConversation(e);if(n)for(var o=n.userProfile.nick,s=n.userProfile.avatar,r=this.getModule(Fn).getNickAndAvatarByUserID(this.getMyUserID()),a=r.nick,i=r.avatar,u=t.length-1;u>=0;u--){var c=t[u];"in"===c.flow&&(c.nick!==o&&c.setNickAndAvatar({nick:o}),c.avatar!==s&&c.setNickAndAvatar({avatar:s})),"out"===c.flow&&(c.nick!==a&&c.setNickAndAvatar({nick:a}),c.avatar!==i&&c.setNickAndAvatar({avatar:i}))}}},{key:"getRemotePeerReadTime",value:function(e){var t=this,n="".concat(this._n,".getRemotePeerReadTime");if($t(e))return Ve.w("".concat(n," userIDList is empty!")),Promise.resolve();var o=new jr("getPeerReadTime");return Ve.l("".concat(n," userIDList:").concat(e)),this.request({protocolName:Yo,requestData:{userIDList:e}}).then((function(s){var r=s.data.peerReadTimeList;Ve.l("".concat(n," ok. peerReadTimeList:").concat(r));for(var a="",i=t.getModule(Kn),u=0;u<e.length;u++)a+="".concat(e[u],"-").concat(r[u]," "),r[u]>0&&i.recordPeerReadTime("C2C".concat(e[u]),r[u]);o.setNetworkType(t.getNetworkType()).setMessage(a).end()})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.w("".concat(n," failed. error:"),e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n=e[0].conversationID.replace(k.CONV_C2C,""),o=new jr("sendC2CReadReceipt");o.setMessage("peerAccount:".concat(n));var s=this.getMyUserID(),r=e.filter((function(e){return e.from!==s&&!0===e.needReadReceipt})).map((function(e){return{fromAccount:e.from,toAccount:e.to,sequence:e.sequence,random:e.random,time:e.time,clientTime:e.clientTime}}));if(0===r.length)return ha({code:Or.READ_RECEIPT_MESSAGE_LIST_EMPTY});var a="".concat(this._n,".sendReadReceipt");return Ve.l("".concat(a,". peerAccount:").concat(n," messageInfoList length:").concat(r.length)),this.request({protocolName:Ns,requestData:{peerAccount:n,messageInfoList:r}}).then((function(e){return o.end(),Ve.l("".concat(a," ok")),la()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.w("".concat(a," failed. error:"),e),ha(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 Ve.l("".concat(t," userID:").concat(n," messageList length:").concat(o.length)),_a({messageList:o})}},{key:"getMessageExtensions",value:function(e,t){return Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Xo,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 Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:zo,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(){Ve.l("".concat(this._n,".reset")),this._messageFromUnreadDBMap.clear(),this._signalingFromUnreadDBList.length=0}}]),s}(go),ma=function(){function e(){o(this,e),this.list=new Map,this._n="MessageListHandler",this._latestMessageSentByPeerMap=new Map,this._latestMessageSentByMeMap=new Map}return r(e,[{key:"getLocalOldestMessageByConversationID",value:function(e){if(!e)return null;if(!this.list.has(e))return null;var t=this.list.get(e).values();return t?t.next().value:null}},{key:"pushIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.conversationID,o=!0;this.list.has(n)||this.list.set(n,new Map);var s=this._getUniqueIDOfMessage(e),r=this.list.get(n).has(s);if(r){var a=this.list.get(n).get(s);if(!t||!0===a.isModified)return o=!1}return this.list.get(n).set(s,e),this._setLatestMessageSentByPeer(n,e),this._setLatestMessageSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(lt(e)?e.length>0&&(n=e[0].conversationID,this._unshiftMultipleMessages(e,t)):(n=e.conversationID,this._unshiftSingleMessage(e,t)),n&&n.startsWith(k.CONV_C2C)){var o=Array.from(this.list.get(n).values()),s=o.length;if(0===s)return;for(var r=s-1;r>=0;r--)if("out"===o[r].flow){this._setLatestMessageSentByMe(n,o[r]);break}for(var a=s-1;a>=0;a--)if("in"===o[a].flow){this._setLatestMessageSentByPeer(n,o[a]);break}}}},{key:"_unshiftSingleMessage",value:function(e,t){var n=e.conversationID,o=this._getUniqueIDOfMessage(e);if(!this.list.has(n))return this.list.set(n,new Map),this.list.get(n).set(o,e),void t.push(e);var s=this.list.get(n),r=Array.from(s);s.has(o)||(r.unshift([o,e]),this.list.set(n,new Map(r)),t.push(e))}},{key:"_unshiftMultipleMessages",value:function(e,t){for(var n=e.length,o=[],s=e[0].conversationID,r=this.list.get(s),a=this.list.has(s)?Array.from(r):[],i=0;i<n;i++){var u=this._getUniqueIDOfMessage(e[i]);r&&r.has(u)||(o.push([u,e[i]]),t.push(e[i]))}this.list.set(s,new Map(o.concat(a)))}},{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(Ve.d("revoke message",e,t,n),this.list.has(e)){var o,s=D(this.list.get(e));try{for(s.s();!(o=s.n()).done;){var r=m(o.value,2)[1];if(r.sequence===t&&(dt(n)||r.random===n))return r.isRevoked||(r.isRevoked=!0),r}}catch(a){s.e(a)}finally{s.f()}}return null}},{key:"removeByConversationID",value:function(e){this.list.has(e)&&(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 s=v(m(t.value,2)[1].values()),r=s.length,a=0;a<r;a++)if(s[a].ID===e){n=s[a];break}}catch(i){o.e(i)}finally{o.f()}return n}},{key:"updateMessageIsPeerReadProperty",value:function(e,t){var n=[];if(this.list.has(e)){var o,s=D(this.list.get(e));try{for(s.s();!(o=s.n()).done;){var r=m(o.value,2)[1];r.time<=t&&!r.isPeerRead&&"out"===r.flow&&(r.isPeerRead=!0,n.push(r))}}catch(a){s.e(a)}finally{s.f()}Ve.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)?v(this.list.get(e).values()):[]}},{key:"hasLocalMessage",value:function(e,t){for(var n=!1,o=this.getLocalMessageList(e),s=o.length,r=0;r<s;r++)o[r].ID===t&&(n=!0);return n}},{key:"getLocalMessage",value:function(e,t){for(var n=null,o=this.getLocalMessageList(e),s=o.length,r=0;r<s;r++)if(o[r].ID===t){n=o[r];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(k.CONV_C2C)&&"in"===t.flow&&this._latestMessageSentByPeerMap.set(e,t)}},{key:"_setLatestMessageSentByMe",value:function(e,t){e.startsWith(k.CONV_C2C)&&"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,s=this.list.get(t);if(!$t(s)){var r=Array.from(s.values()),a=r.length;if(0!==a){for(var i=null,u=0,c=!1,l=a-1;l>=0;l--)"in"===r[l].flow&&((i=r[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));Ve.l("".concat(this._n,".modifyMessageSentByPeer conversationID:").concat(t," count:").concat(u))}}}},{key:"modifyMessageSentByMe",value:function(e){var t=e.conversationID,n=e.latestNick,o=e.latestAvatar,s=this.list.get(t);if(!$t(s)){var r=Array.from(s.values()),a=r.length;if(0!==a){for(var i=null,u=0,c=!1,l=a-1;l>=0;l--)"out"===r[l].flow&&((i=r[l]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c&&(u+=1));Ve.l("".concat(this._n,".modifyMessageSentByMe conversationID:").concat(t," count:").concat(u))}}}},{key:"getTopicConversationIDList",value:function(e){return v(this.list.keys()).filter((function(t){return t.startsWith("".concat(k.CONV_GROUP).concat(e))}))}},{key:"traversal",value:function(){if(0!==this.list.size&&-1===Ve.getLevel()){console.group("conversationID-messageCount");var e,t=D(this.list);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2),o=n[0],s=n[1];console.log("".concat(o,"-").concat(s.size))}}catch(r){t.e(r)}finally{t.f()}console.groupEnd()}}},{key:"onMessageModified",value:function(e,t){if(!this.list.has(e))return{isUpdated:!1,message:null};var n=this._getUniqueIDOfMessage(t),o=this.list.get(e).has(n);if(Ve.d("".concat(this._n,".onMessageModified conversationID:").concat(e," uniqueID:").concat(n," has:").concat(o)),o){var s=this.list.get(e).get(n),r=t.messageVersion,a=t.elements,i=t.cloudCustomData;return s.version<r?(s.version=r,s._elements=JSON.parse(JSON.stringify(a)),s.payload=JSON.parse(JSON.stringify(a[0].content)),s.type=a[0].type,s.cloudCustomData=i,s.isModified=!0,{isUpdated:!0,message:s}):{isUpdated:!1,message:s}}return{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMessage",value:function(e){var t=e.from,n=e.to,o=e.random,s=e.sequence,r=e.time;return"".concat(t,"-").concat(n,"-").concat(o,"-").concat(s,"-").concat(r)}},{key:"reset",value:function(){this.list.clear(),this._latestMessageSentByPeerMap.clear(),this._latestMessageSentByMeMap.clear()}}]),e}(),va="_a2KeyAndTinyIDUpdated",Ma="_cloudConfigUpdated",ya="_profileUpdated";function Ia(e){this.mixin(e)}Ia.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 Ca=["jpg","jpeg","gif","png","bmp","image","webp"],Ta=["mp4","quicktime","mov"],Da=1,Ea=2,ka=3,Sa=255,La=function(){function e(t){var n=this;o(this,e),$t(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||k.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||k.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=0,this.profileCustomField=[],$t(t.profileCustomField)||t.profileCustomField.forEach((function(e){n.profileCustomField.push({key:e.key,value:e.value})})))}return r(e,[{key:"validate",value:function(e){var t=!0,n="";if($t(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,r=0;r<o;r++){if(s=e.profileCustomField[r],!it(s.key)||-1===s.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(!it(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if("profileCustomField"===a)continue;if($t(e[a])&&!it(e[a])&&!at(e[a])){n="key:"+a+", invalid value:"+e[a],t=!1;continue}switch(a){case"nick":it(e[a])||(n="nick must be a string",t=!1),Mt(e[a])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Mt(e[a])," bytes"),t=!1);break;case"gender":Tt(ze,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":at(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":it(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":it(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":Tt(Qe,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":at(e.language)||(n="language must be a number",t=!1);break;case"avatar":it(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":Tt(Xe,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":at(e.level)||(n="level must be a number",t=!1);break;case"role":at(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+a+" "+e[a],t=!1}}return{valid:t,tips:n}}}]),e}(),Aa=r((function e(t){o(this,e),this.value=t,this.next=null})),Na=function(){function e(t){o(this,e),this.MAX_LENGTH=t,this.pTail=null,this.pNodeToDel=null,this.map=new Map}return r(e,[{key:"set",value:function(e){var t=new Aa(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}(),Ra=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],Oa=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 r(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)Ra.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),dt(n.muteAllMembers)||("On"===n.muteAllMembers?n.muteAllMembers=!0:n.muteAllMembers=!1),n.groupCustomField&&St(this.groupCustomField,n.groupCustomField),dt(n.memberNum)||(this.memberCount=n.memberNum),dt(n.maxMemberNum)||(this.maxMemberCount=n.maxMemberNum),dt(n.isSupportTopic)||(this.isSupportTopic=at(n.isSupportTopic)?1===n.isSupportTopic:n.isSupportTopic),mt(this,n,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),lt(n.members)&&n.members.length>0&&n.members.forEach((function(e){e.userID===t.selfInfo.userID&&mt(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};mt(this.selfInfo,t({},n),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),e}(),Ga=function(e,n){return dt(e)?{lastTime:0,lastSequence:0,fromAccount:0,messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:e instanceof ca?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:Yt(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:Yt(e.type,e.payload,n)})},Ua=function(){function e(t,n){o(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Ga(t.lastMessage,n),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark="",this.isPinned=t.isPinned||!1,this.messageRemindType="",this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this._initProfile(t)}return r(e,[{key:"toAccount",get:function(){return this.conversationID.startsWith(k.CONV_C2C)?this.conversationID.replace(k.CONV_C2C,""):this.conversationID.startsWith(k.CONV_GROUP)?this.conversationID.replace(k.CONV_GROUP,""):""}},{key:"subType",get:function(){return this.groupProfile?this.groupProfile.type:""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach((function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}})),dt(this.userProfile)&&this.type===k.CONV_C2C?this.userProfile=new La({userID:e.conversationID.replace("C2C","")}):dt(this.groupProfile)&&this.type===k.CONV_GROUP&&(this.groupProfile=new Oa({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(e){var t=e.nextUnreadCount,n=e.isFromGetConversations,o=e.isUnreadC2CMessage;dt(t)||(Lt(this.subType)?this.unreadCount=0:n&&this.type===k.CONV_GROUP||n&&this.type===k.CONV_TOPIC||o&&this.type===k.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Ga(e)}},{key:"updateGroupAtInfoList",value:function(e){if(!this._isNeedMergeGroupAtInfo(e)){var t,n=(M(t=e.groupAtType)||y(t)||I(t)||T()).slice(0);-1!==n.indexOf(k.CONV_AT_ME)&&-1!==n.indexOf(k.CONV_AT_ALL)&&(n=[k.CONV_AT_ALL_AT_ME]);var o={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:n,__random:e.__random,__sequence:e.__sequence};this.groupAtInfoList.push(o)}}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t=e.groupID,n=e.sequence;if(!At({groupID:t}))return!1;var o=!1;return this.groupAtInfoList.forEach((function(t){t.messageSequence===n&&(t.atTypeArray.indexOf(k.CONV_AT_ME)>-1&&e.groupAtType.indexOf(k.CONV_AT_ALL)>-1&&(t.atTypeArray=[k.CONV_AT_ALL_AT_ME]),t.atTypeArray.indexOf(k.CONV_AT_ALL)>-1&&e.groupAtType.indexOf(k.CONV_AT_ME)>-1&&(t.atTypeArray=[k.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===k.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===k.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),Pa=function(){function e(t){o(this,e),this._conversationModule=t,this._n="MessageRemindHandler",this._updateSequence=0}return r(e,[{key:"getC2CMessageRemindType",value:function(){var e=this,t="".concat(this._n,".getC2CMessageRemindType");return this._conversationModule.request({protocolName:Ko,updateSequence:this._updateSequence}).then((function(n){Ve.l("".concat(t," ok"));var o=n.data,s=o.updateSequence,r=o.muteFlagList;e._updateSequence=s,e._patchC2CMessageRemindType(r)})).catch((function(e){Ve.e("".concat(t," failed. error:"),e)}))}},{key:"_patchC2CMessageRemindType",value:function(e){var t=this,n=0,o="";lt(e)&&e.length>0&&e.forEach((function(e){var s=e.userID,r=e.muteFlag;0===r?o=k.MSG_REMIND_ACPT_AND_NOTE:1===r?o=k.MSG_REMIND_DISCARD:2===r&&(o=k.MSG_REMIND_ACPT_NOT_NOTE),!0===t._conversationModule.patchMessageRemindType({ID:s,isC2CConversation:!0,messageRemindType:o})&&(n+=1)})),Ve.l("".concat(this._n,"._patchC2CMessageRemindType count:").concat(n))}},{key:"set",value:function(e){return e.groupID?this._setGroupMessageRemindType(e):lt(e.userIDList)?this._setC2CMessageRemindType(e):void 0}},{key:"_setGroupMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setGroupMessageRemindType"),o=e.groupID,s=e.messageRemindType,r="groupID:".concat(o," messageRemindType:").concat(s),a=new jr("setMessageRemindType");return a.setMessage(r),this._getModule(Hn).modifyGroupMemberInfo({groupID:o,messageRemindType:s,userID:this._conversationModule.getMyUserID()}).then((function(){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok. ").concat(r));var o=t.onGroupMessageRemindTypeUpdated(e);return t._conversationModule.emitTotalUnreadMessageCountUpdate(),la(o)})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"onGroupMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.messageRemindType,o=this._getModule(xn).getLocalGroupProfile(t);if(o&&(o.selfInfo.messageRemindType=n),Nt(t)){var s=t,r=Wt(s),a=this._getModule(Bn).getLocalTopic(r,s);return a&&(a.updateSelfInfo({messageRemindType:n}),this._conversationModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:r,topic:a})),{topic:a}}return this._conversationModule.patchMessageRemindType({ID:t,isC2CConversation:!1,messageRemindType:n})&&this._emitConversationUpdate(),{group:o}}},{key:"_setC2CMessageRemindType",value:function(e){var t=this,n="".concat(this._n,"._setC2CMessageRemindType"),o=e.userIDList,s=e.messageRemindType,r=o.slice(0,30),a=0;s===k.MSG_REMIND_DISCARD?a=1:s===k.MSG_REMIND_ACPT_NOT_NOTE&&(a=2);var i="userIDList:".concat(r," messageRemindType:").concat(s),u=new jr("setMessageRemindType");return u.setMessage(i),this._conversationModule.request({protocolName:Bo,requestData:{userIDList:r,muteFlag:a}}).then((function(e){u.setNetworkType(t._conversationModule.getNetworkType()).end();var o=e.data,a=o.updateSequence,i=o.errorList;t._updateSequence=a;var c=[],l=[];lt(i)&&i.forEach((function(e){c.push(e.userID),l.push({userID:e.userID,code:e.errorCode})}));var d=r.filter((function(e){return-1===c.indexOf(e)}));Ve.l("".concat(n," ok. successUserIDList:").concat(d," failureUserIDList:").concat(JSON.stringify(l)));var p=0;return d.forEach((function(e){t._conversationModule.patchMessageRemindType({ID:e,isC2CConversation:!0,messageRemindType:s})&&(p+=1)})),p>=1&&t._emitConversationUpdate(),r.length=c.length=0,t._conversationModule.emitTotalUnreadMessageCountUpdate(),_a({successUserIDList:d.map((function(e){return{userID:e}})),failureUserIDList:l})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_getModule",value:function(e){return this._conversationModule.getModule(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"setUpdateSequence",value:function(e){this._updateSequence=e}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._updateSequence=0}}]),e}(),ba=function(){function e(t){o(this,e),this._conversationModule=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=sn.NOT_START}return r(e,[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),o=e.conversationIDList,s=e.customData;Ve.l("".concat(n," options:"),e);var r=new jr("setConvCustomData");r.setMessage(JSON.stringify(e));var a={fromAccount:this._getMyUserID(),itemList:[]},i=[],u=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(u,e),!0;if(!Rt(e)&&!Ot(e))return t._onConversationIDInvalid(u,e),!0;var n={operationType:2,contactItem:void 0,customMark:s};Rt(e)?n.contactItem={type:1,toAccount:e.replace(k.CONV_C2C,"")}:Ot(e)&&(n.contactItem={type:2,groupID:e.replace(k.CONV_GROUP,"")}),a.itemList.push(n)})),u.length===o.length?_a({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:os,requestData:a}).then((function(e){r.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var o=e.data.resultItem;if(lt(o)){var a,c,l=!1;o.forEach((function(e){a=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(a),(c=t._getLocalConversation(a))&&c.customData!==s&&(c.customData=s,l=!0)):u.push({conversationID:a,code:e.resultCode,message:e.resultInfo})})),!0===l&&t._emitConversationUpdate()}return la({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"markConversation",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_MARK))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("markConversation"),o=e.conversationIDList,s=e.markType,r=e.enableMark;Ve.l("".concat(n," options:"),e);var a=new jr("markConversation");a.setMessage(JSON.stringify(e));var i=void 0,u=void 0,c=this._getFlagBit(s);!0===r?u=[c]:i=[c];var l={fromAccount:this._getMyUserID(),itemList:[]},d=[],p=[];return o.forEach((function(e){if(!t._hasLocalConversation(e))return t._onConversationNotFound(p,e),!0;if(!Rt(e)&&!Ot(e))return t._onConversationIDInvalid(p,e),!0;var n={operationType:1,contactItem:void 0,clearMark:i,setMark:u};Rt(e)?n.contactItem={type:1,toAccount:e.replace(k.CONV_C2C,"")}:Ot(e)&&(n.contactItem={type:2,groupID:e.replace(k.CONV_GROUP,"")}),l.itemList.push(n)})),p.length===o.length?_a({successConversationIDList:d,failureConversationIDList:p}):this._conversationModule.request({protocolName:ss,requestData:l}).then((function(e){a.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var o=e.data.resultItem;if(lt(o)){var i,u,c=!1;o.forEach((function(e){if(i=t._concatConversationID(e.contactItem),0===e.resultCode){if(d.push(i),u=t._getLocalConversation(i)){var n=u.markList.indexOf(s);!0===r?-1===n&&(u.markList.push(s),c=!0):-1!==n&&(u.markList.splice(n,1),c=!0)}}else p.push({conversationID:i,code:e.resultCode,message:e.resultInfo})})),!0===c&&t._emitConversationUpdate()}return la({successConversationIDList:d,failureConversationIDList:p})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getLocalConvGroupList",value:function(){var e=this;return Ve.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===sn.REJECTED?this.getRemoteConvGroupList().then((function(){return la(v(e._convGroupMap.values()))})):_a(v(this._convGroupMap.values()))}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=sn.PENDING,this._conversationModule.request({protocolName:ls,requestData:{fromAccount:this._getMyUserID(),startIndex:this._startIndex,startTime:we()}}).then((function(n){var o,s,r=n.data,a=r.completeFlag,i=r.contactItem,u=r.nextStartIndex,c=void 0===u?0:u,l=r.groupItem;(e._startIndex=c,Ve.l("".concat(t," completeFlag:").concat(a," nextStartIndex:").concat(c)),lt(l)&&l.forEach((function(t){var n=t.convGroupID,o=t.groupName;e._convGroupMap.set(n,o)})),lt(i))&&i.forEach((function(t){var n=t.standardMark,r=t.customData,a=t.convGroupIDList;if(o=e._concatConversationID(t),(s=e._getLocalConversation(o))&&(s.markList=Jt(n),s.customData=r||"",lt(a))){var i=[];a.forEach((function(t){e._convGroupMap.has(t)&&i.push(e._convGroupMap.get(t))})),s.conversationGroupList=[].concat(i),i.length=0}}));if(0===a)return e.getRemoteConvGroupList();1===a&&(e._pagingStatus=sn.RESOLVED,e._emitConversationUpdate(),e._emitConvGroupListUpdate())})).catch((function(n){e._pagingStatus=sn.REJECTED,Ve.w("".concat(t," failed. error:"),n)}))}},{key:"createConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_GROUP))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("createConvGroup");Ve.l("".concat(n," options:"),e);var o=new jr("createConvGroup");o.setMessage(JSON.stringify(e));var s=e.groupName,r=e.conversationIDList,a={fromAccount:this._getMyUserID(),itemList:[{groupName:s,contactItem:[]}]},i=[],u=[];return r.forEach((function(e){return t._hasLocalConversation(e)?Rt(e)||Ot(e)?void(Rt(e)?a.itemList[0].contactItem.push({type:1,toAccount:e.replace(k.CONV_C2C,"")}):Ot(e)&&a.itemList[0].contactItem.push({type:2,groupID:e.replace(k.CONV_GROUP,"")})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===r.length?_a({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:rs,requestData:a}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var r=e.data.groupResultItem[0],a=r.groupItem,c=r.resultItem;if(ct(a)&&(t._convGroupMap.set(a.convGroupID,a.groupName),t._emitConvGroupListUpdate()),lt(c)){var l,d,p=!1;c.forEach((function(e){l=t._concatConversationID(e.contactItem),0===e.resultCode?(i.push(l),(d=t._getLocalConversation(l))&&-1===d.conversationGroupList.indexOf(s)&&(d.conversationGroupList.push(s),p=!0)):u.push({conversationID:l,code:e.resultCode,message:e.resultInfo})})),!0===p&&(t._emitConversationUpdate(),t._emitConvGroupListUpdate())}return la({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_GROUP))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvGroup");Ve.l("".concat(n," groupName:").concat(e));var o=new jr("deleteConvGroup");return o.setMessage(e),this._conversationModule.request({protocolName:as,requestData:{fromAccount:this._getMyUserID(),groupName:[e]}}).then((function(s){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var r=s.data.groupItem;if(lt(r)){var a=!1;r.forEach((function(e){t._convGroupMap.has(e.convGroupID)&&(t._convGroupMap.delete(e.convGroupID),a=!0)})),!0===a&&t._emitConvGroupListUpdate()}t._eraseFromConversationGroupList([e])})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"renameConvGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_GROUP))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("renameConvGroup");Ve.l("".concat(n," options:"),e);var o=new jr("renameConvGroup");o.setMessage(JSON.stringify(e));var s=e.oldName,r=e.newName;return this._conversationModule.request({protocolName:is,requestData:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:s,newName:r}}}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var a=e.data.updateGroupResult.convGroupID;t._convGroupMap.set(a,r),t._emitConvGroupListUpdate();var i,u,c=t._conversationModule.getLocalConversationList(),l=!1;c.forEach((function(e){i=e.conversationGroupList,-1!==(u=i.indexOf(s))&&(i.splice(u,1,r),l=!0)})),!0===l&&t._emitConversationUpdate()})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"addConvsToGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_GROUP))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("addConvsToGroup");Ve.l("".concat(n," options:"),e);var o=new jr("addConvsToGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,r=e.groupName,a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:r,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Rt(e)||Ot(e)?void(Rt(e)?a.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:e.replace(k.CONV_C2C,"")}}):Ot(e)&&a.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:e.replace(k.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?_a({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:us,requestData:a}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(lt(s)){var a,c,l=!1;s.forEach((function(e){a=t._concatConversationID(e.contactItem),0===e.resultCode?(c=t._getLocalConversation(a))&&-1===c.conversationGroupList.indexOf(r)&&(c.conversationGroupList.push(r),i.push(a),l=!0):u.push({conversationID:a,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(r))}return la({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteConvsFromGroup",value:function(e){var t=this;if(!this._conversationModule.canIUse(H.CONV_GROUP))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("deleteConvsFromGroup");Ve.l("".concat(n," options:"),e);var o=new jr("deleteConvsFromGroup");o.setMessage(JSON.stringify(e));var s=e.conversationIDList,r=e.groupName,a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:r,updateItem:[]}},i=[],u=[];return s.forEach((function(e){return t._hasLocalConversation(e)?Rt(e)||Ot(e)?void(Rt(e)?a.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:e.replace(k.CONV_C2C,"")}}):Ot(e)&&a.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:e.replace(k.CONV_GROUP,"")}})):(t._onConversationIDInvalid(u,e),!0):(t._onConversationNotFound(u,e),!0)})),u.length===s.length?_a({successConversationIDList:i,failureConversationIDList:u}):this._conversationModule.request({protocolName:cs,requestData:a}).then((function(e){o.setNetworkType(t._conversationModule.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.data.updateGroupResult.contactResultItem;if(lt(s)){var a,c,l=!1;s.forEach((function(e){if(a=t._concatConversationID(e.contactItem),0===e.resultCode){if(c=t._getLocalConversation(a)){var n=c.conversationGroupList.indexOf(r);-1!==n&&(c.conversationGroupList.splice(n,1),i.push(a),l=!0)}}else u.push({conversationID:a,code:e.resultCode,message:e.resultInfo})})),!0===l&&(t._emitConversationUpdate(),t._emitConvInGroupUpdate(r))}return la({successConversationIDList:i,failureConversationIDList:u})})).catch((function(e){return t._conversationModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"onConvMarkUpdated",value:function(e){var t=this;if(!$t(e)){var n,o;Ve.d("".concat(this._n,".onConvMarkUpdated markItemList:"),e);var s=!1;e.forEach((function(e){var r=e.recentContactItem,a=e.optType,i=e.standardMark,u=e.customMark;if(n=t._concatConversationID(r),o=t._getLocalConversation(n))if(1===a){var c=Jt(i);!0!==function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!1;return!0}(o.markList,c)&&(o.markList=c,s=!0)}else 2===a&&o.customData!==u&&void 0!==u&&(o.customData=u,s=!0)})),!0===s&&this._emitConversationUpdate()}}},{key:"onConvGroupCreated",value:function(e){var t=this;Ve.d("".concat(this._n,".onConvGroupCreated resultList:"),e);var n=!1,o=!1;lt(e)&&(e.forEach((function(e){var s=e.msgGroupItem,r=s.groupID,a=s.groupName;t._convGroupMap.get(r)!==a&&(t._convGroupMap.set(r,a),o=!0);var i,u,c=e.msgRecentContactItem;lt(c)&&c.forEach((function(e){i=t._concatConversationID(e),(u=t._getLocalConversation(i))&&-1===u.conversationGroupList.indexOf(a)&&(u.conversationGroupList.push(a),n=!0)}))})),!0===n&&this._emitConversationUpdate(),!0===o&&this._emitConvGroupListUpdate())}},{key:"onConvGroupDeleted",value:function(e){var t=this;Ve.d("".concat(this._n,".onConvGroupDeleted groupItemList:"),e);var n=[];if(lt(e)){var o=!1;e.forEach((function(e){var s=e.groupID,r=e.groupName;t._convGroupMap.has(s)&&(t._convGroupMap.delete(s),o=!0,n.push(r))})),!0===o&&this._emitConvGroupListUpdate()}this._eraseFromConversationGroupList(n)}},{key:"_eraseFromConversationGroupList",value:function(e){$t(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){Ve.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 s,r,a=this._conversationModule.getLocalConversationList(),i=!1;a.forEach((function(e){s=e.conversationGroupList,-1!==(r=s.indexOf(o))&&(s.splice(r,1,n),i=!0)})),!0===i&&this._emitConversationUpdate()}}},{key:"onConvInGroupUpdated",value:function(e){var t=this;Ve.d("".concat(this._n,".onConvInGroupUpdated options:"),e);var n=e.oldGroupName,o=e.recentContactUpdateGroupItem;if(lt(o)){var s,r,a,i=!1;o.forEach((function(e){var o=e.contactOptType,u=e.recentContactItem;s=t._concatConversationID(u),(r=t._getLocalConversation(s))&&(a=r.conversationGroupList.indexOf(n),1===o?-1===a&&(r.conversationGroupList.push(n),i=!0):2===o&&-1!==a&&(r.conversationGroupList.splice(a,1),i=!0))})),!0===i&&(this._emitConversationUpdate(),this._emitConvInGroupUpdate(n))}}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){var t=this;Ve.d("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),e);var n=e.msgRecentContactItem,o=e.msgRecentContactUpdateContactItem,s=this._concatConversationID(n),r=this._getLocalConversation(s);if(r&<(o)){var a,i=!1;o.forEach((function(e){var n=e.groupOptType,o=e.recentContactGroupItem.groupName;a=r.conversationGroupList.indexOf(o),1===n?-1===a&&(r.conversationGroupList.push(o),i=!0):2===n&&-1!==a&&(r.conversationGroupList.splice(a,1),i=!0),!0===i&&t._emitConvInGroupUpdate(o)})),!0===i&&this._emitConversationUpdate()}}},{key:"onConvGroupListSynced",value:function(e){var t=this;lt(e)&&0!==e.length&&(Ve.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(!$t(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:Or.CONVERSATION_NOT_FOUND,message:this._conversationModule.getErrorMessage(Or.CONVERSATION_NOT_FOUND)})}},{key:"_onConversationIDInvalid",value:function(e,t){e.push({conversationID:t,code:Or.INVALID_CONVERSATION_ID,message:this._conversationModule.getErrorMessage(Or.INVALID_CONVERSATION_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,s=e.groupID,r=e.userID;return 1===n?dt(r)?dt(o)||(t="".concat(k.CONV_C2C).concat(o)):t="".concat(k.CONV_C2C).concat(r):2===n&&(t="".concat(k.CONV_GROUP).concat(s)),t}},{key:"_getMyUserID",value:function(){return this._conversationModule.getMyUserID()}},{key:"_insertConversationGroup",value:function(e,t){var n=this._getLocalConversation(e);if(n){var o=n.conversationGroupList;-1===o.indexOf(t)&&o.push(t)}}},{key:"_getLocalConversation",value:function(e){return this._conversationModule.getLocalConversation(e)}},{key:"_hasLocalConversation",value:function(e){return this._conversationModule.hasLocalConversation(e)}},{key:"_emitConversationUpdate",value:function(){this._conversationModule.emitConversationUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._conversationModule.emitOuterEvent(E.CONVERSATION_GROUP_LIST_UPDATED,v(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(){Ve.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=sn.NOT_START}}]),e}(),wa=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="ConversationModule",Ia.mixin(_(t)),t._messageListHandler=new ma,t._messageRemindHandler=new Pa(_(t)),t._convGroupHandler=new ba(_(t)),t.singlyLinkedList=new Na(100),t._pagingStatus=sn.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 r(s,[{key:"_initListeners",value:function(){var e=this.getInnerEmitterInstance();e.on(va,this._initLocalConversationList,this),e.on(ya,this._onProfileUpdated,this)}},{key:"onCheckTimer",value:function(e){e%60==0&&this._messageListHandler.traversal()}},{key:"_initLocalConversationList",value:function(){var e=this,t=new jr("_initLocalConversationList");Ve.l("".concat(this._n,".").concat("_initLocalConversationList"));var n="",o=this._getStorageConversationList(),s=this.isIntl();if(o){for(var r=o.length,a=0;a<r;a++){var i=o[a];if(i){if(i.conversationID==="".concat(k.CONV_C2C,"@TLS#ERROR")||i.conversationID==="".concat(k.CONV_C2C,"@TLS#NOT_FOUND"))continue;if(i.groupProfile){var u=i.groupProfile.type;if(Lt(u))continue}}this._conversationMap.set(o[a].conversationID,new Ua(o[a],s))}this.emitConversationUpdate(!0,!1),n="count:".concat(r)}else n="count:0";t.setNetworkType(this.getNetworkType()).setMessage(n).end(),this.getModule(qn)||this.triggerReady(),this.ready((function(){e._tmpGroupList.length>0&&(e.updateConversationGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)})),this.syncConversationList()}},{key:"onMessageSent",value:function(e){this._onSendOrReceiveMessage({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrReceiveMessage(e)}},{key:"_onSendOrReceiveMessage",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,s=void 0===o||o,r=e.isUnreadC2CMessage,a=void 0!==r&&r,i=e.updateUnreadCount,u=void 0===i||i;this._isReady?0!==n.length&&(this._getC2CPeerReadTime(n),this._updateLocalConversationList({conversationOptionsList:n,isInstantMessage:s,isUnreadC2CMessage:a,isFromGetConversations:!1,updateUnreadCount:u}),s||(this._convIDFromUnreadDBMap=new Map([].concat(v(this._convIDFromUnreadDBMap),v(n.map((function(e){return[e.conversationID,1]}))))),this._diffAndDeleteConversation()),this._setStorageConversationList(),n.filter((function(e){return e.type===k.CONV_TOPIC})).length>0||this.emitConversationUpdate()):this.ready((function(){t._onSendOrReceiveMessage(e)}))}},{key:"updateConversationGroupProfile",value:function(e){var t=this;if(!lt(e)||0!==e.length)if(0!==this._conversationMap.size){var n=!1;e.forEach((function(e){var o="GROUP".concat(e.groupID);if(t._conversationMap.has(o)){n=!0;var s=t._conversationMap.get(o);s.groupProfile=JSON.parse(JSON.stringify(e)),s.lastMessage.lastSequence<e.nextMessageSeq&&(s.lastMessage.lastSequence=e.nextMessageSeq-1),s.subType||(s.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,s=[];e.forEach((function(e){(n=t._conversationMap.get(e.conversationID))&&(n.type===k.CONV_TOPIC?s.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(Bn).onMessageRevoked(s),o&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())}}},{key:"isLastMessageRevoked",value:function(e){var t=!1,n=e.conversationID,o=e.sequence,s=e.time,r=this._conversationMap.get(n);r&&(t=r.type===k.CONV_TOPIC?this.getModule(Bn).isLastMessageRevoked({topicID:n.replace(k.CONV_GROUP,""),sequence:o}):r.isLastMessageRevoked({sequence:o,time:s}));return Ve.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,s=this._messageListHandler.getLocalMessageList(o),r={},a=s.length-1;a>=0;a--)if(!s[a].isDeleted){r=s[a];break}var i=this._conversationMap.get(o);if(i){var u=!1;i.lastMessage.lastSequence===r.sequence&&i.lastMessage.lastTime===r.time||($t(r)&&(r=void 0),i.updateLastMessage(r),i.type!==k.CONV_TOPIC&&(u=!0),Ve.l("".concat(this._n,".onMessageDeleted. update conversationID:").concat(o," with lastMessage:"),i.lastMessage)),o.startsWith(k.CONV_C2C)&&this.updateUnreadCount(o),u&&this.emitConversationUpdate(!0,!1)}}}},{key:"onMessageModified",value:function(e){var t=e.conversationType,n=e.from,o=e.to,s=e.time,r=e.sequence,a=e.elements,i=e.cloudCustomData,u=e.messageVersion,c=this.getMyUserID(),l="".concat(t).concat(o);o===c&&t===k.CONV_C2C&&(l="".concat(t).concat(n));var d=this._messageListHandler.onMessageModified(l,e),p=d.isUpdated,g=d.message;!0===p&&this.emitOuterEvent(E.MESSAGE_MODIFIED,[g]);var _=this._isTopicConversation(l);if(Ve.l("".concat(this._n,".onMessageModified isUpdated:").concat(p," isTopicMessage:").concat(_," from:").concat(n," to:").concat(o)),_){this.getModule(Bn).onMessageModified(e)}else{var h=this._conversationMap.get(l);if(h){var f=h.lastMessage;Ve.d("".concat(this._n.onMessageModified," lastMessage:"),JSON.stringify(f),"options:",JSON.stringify(e)),f&&f.lastTime===s&&f.lastSequence===r&&f.version!==u&&(f.type=a[0].type,f.payload=a[0].content,f.messageForShow=Yt(f.type,f.payload,this.isIntl()),f.cloudCustomData=i,f.version=u,this.emitConversationUpdate(!0,!1))}}return g}},{key:"onNewGroupAtTips",value:function(e){var n=this,o=e.dataList,s=null;o.forEach((function(e){e.groupAtTips?s=e.groupAtTips:e.elements?s=t(t({},e.elements),{},{sync:!0}):e.groupAtType&&(s=t(t({},e),{},{sync:!0})),s.__random=e.random,s.__sequence=e.clientSequence,n._tmpGroupAtTipsList.push(s)})),Ve.d("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e=this;if(0!==this._tmpGroupAtTipsList.length){var t=!1;this._tmpGroupAtTipsList.forEach((function(n){var o=n.groupID,s=n.from,r=n.topicID,a=void 0===r?void 0:r,i=n.sync,u=void 0!==i&&i;if(s!==e.getMyUserID())if(dt(a)){var c=e._conversationMap.get("".concat(k.CONV_GROUP).concat(o));c&&(c.updateGroupAtInfoList(n),t=!0)}else{var l=e._conversationMap.get("".concat(k.CONV_GROUP).concat(a));if(l){l.updateGroupAtInfoList(n);var d=e.getModule(Bn),p=l.groupAtInfoList;d.onConversationProxy({topicID:a,groupAtInfoList:p})}if($t(l)&&u)e.updateTopicConversation([{conversationID:"".concat(k.CONV_GROUP).concat(a),type:k.CONV_TOPIC}]),e._conversationMap.get("".concat(k.CONV_GROUP).concat(a)).updateGroupAtInfoList(n)}})),t&&this.emitConversationUpdate(!0,!1),this._tmpGroupAtTipsList.length=0}}},{key:"_getC2CPeerReadTime",value:function(e){var t=this,n=[];if(e.forEach((function(e){t._conversationMap.has(e.conversationID)||e.type!==k.CONV_C2C||n.push(e.conversationID.replace(k.CONV_C2C,""))})),n.length>0){Ve.d("".concat(this._n,"._getC2CPeerReadTime userIDList:").concat(n));var o=this.getModule(qn);o&&o.getRemotePeerReadTime(n)}}},{key:"_getStorageConversationList",value:function(){return this.getModule(Yn).getItem("conversationMap")}},{key:"_setStorageConversationList",value:function(){var e=this.getLocalConversationList().filter((function(e){return e.type===k.CONV_C2C||e.type===k.CONV_GROUP&&e.lastMessage.type!==k.MSG_GRP_TIP})).slice(0,20).map((function(e){return{conversationID:e.conversationID,type:e.type,subType:e.subType,lastMessage:e.lastMessage,groupProfile:e.groupProfile,userProfile:e.userProfile}}));this.getModule(Yn).setItem("conversationMap",e)}},{key:"emitConversationUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversationList();if(t){var o=this.getModule(xn);o&&o.updateGroupLastMessage(n)}e&&this.emitOuterEvent(E.CONVERSATION_LIST_UPDATED)}},{key:"getLocalConversationList",value:function(){return v(this._conversationMap.values()).filter((function(e){return e.type!==k.CONV_TOPIC}))}},{key:"getLocalConversation",value:function(e){return this._conversationMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._conversationMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._messageListHandler.getLocalOldestMessage(e)}},{key:"syncConversationList",value:function(){var e=this,t=new jr("syncConversationList");return this._pagingStatus===sn.NOT_START&&this._conversationMap.clear(),this._pagingGetConversationList().then((function(n){var o=function(e){if(lt(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),(t/e.length).toFixed(0)}}(e._pagingGetCostList);return Ve.l("".concat(e._n,".").concat("syncConversationList",". sum ").concat(function(e){if(lt(e)&&0!==e.length){var t=0;return e.forEach((function(e){t+=e})),t.toFixed(0)}}(e._pagingGetCostList)," ms, average ").concat(o," ms")),e._pagingGetCostList.length=0,e._pagingStatus=sn.RESOLVED,e._diffAndDeleteConversation(),e.emitConversationUpdate(!0,!1),e._setStorageConversationList(),e._handleC2CPeerReadTime(),e._patchConversationProperties(),t.setMessage(e._conversationMap.size).setMoreMessage(o).setNetworkType(e.getNetworkType()).end(),n})).catch((function(n){return e._pagingStatus=sn.REJECTED,t.setMessage(e._pagingTimeStamp),e.probeNetwork().then((function(e){var o=m(e,2),s=o[0],r=o[1];t.setError(n,s,r).end()})),ha(n)}))}},{key:"_diffAndDeleteConversation",value:function(){var e=this;if(this._isSyncCompleted()){var t=[];this._conversationMap.forEach((function(n,o){!e._pagingConvIDMap.has(o)&&e._convIDFromUnreadDBMap.has(o)&&(e._conversationMap.delete(o),t.push(o))})),Ve.l("".concat(this._n,"._diffAndDeleteConversation list:").concat(t))}}},{key:"_patchConversationProperties",value:function(){var e=this,t=Date.now(),n=this.checkAndPatchRemark(),o=this._messageRemindHandler.getC2CMessageRemindType(),s=this.getModule(xn).getGroupList();Promise.all([n,o,s]).then((function(){var n=Date.now()-t;Ve.l("".concat(e._n,"._patchConversationProperties ok. cost ").concat(n," ms")),e.emitConversationUpdate(!0,!1),e.emitTotalUnreadMessageCountUpdate()}))}},{key:"_pagingGetConversationList",value:function(){var e=this,t="".concat(this._n,"._pagingGetConversationList");Ve.l("".concat(t," timeStamp:").concat(this._pagingTimeStamp," startIndex:").concat(this._pagingStartIndex)+" pinnedTimeStamp:".concat(this._pagingPinnedTimeStamp," pinnedStartIndex:").concat(this._pagingPinnedStartIndex));var n=Date.now();return this._pagingStatus=sn.PENDING,this.request({protocolName:Qo,requestData:{fromAccount:this.getMyUserID(),timeStamp:this._pagingTimeStamp,startIndex:this._pagingStartIndex,pinnedTimeStamp:this._pagingPinnedTimeStamp,pinnedStartIndex:this._pagingPinnedStartIndex,orderType:1}}).then((function(o){var s=o.data,r=s.completeFlag,a=s.conversations,i=void 0===a?[]:a,u=s.timeStamp,c=s.startIndex,l=s.pinnedTimeStamp,d=s.pinnedStartIndex,p=s.groupItem,g=Date.now()-n;if(e._pagingGetCostList.push(g),Ve.l("".concat(t," ok. completeFlag:").concat(r," count:").concat(i.length," cost ").concat(g," ms")),e._convGroupHandler.onConvGroupListSynced(p),i.length>0){var _=e._getConversationOptions(i);e._pagingConvIDMap=new Map([].concat(v(e._pagingConvIDMap),v(_.map((function(e){return[e.conversationID,1]}))))),e._updateLocalConversationList({conversationOptionsList:_,isFromGetConversations:!0}),e.isLoggedIn()&&e.emitConversationUpdate()}if(!e._isReady){if(!e.isLoggedIn())return _a();e.triggerReady()}return e._pagingTimeStamp=u,e._pagingStartIndex=c,e._pagingPinnedTimeStamp=l,e._pagingPinnedStartIndex=d,1!==r?e._pagingGetConversationList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),_a())})).catch((function(n){throw e.isLoggedIn()&&(e._isReady||(Ve.w("".concat(t," failed. error:"),n),e.triggerReady())),n}))}},{key:"_updateLocalConversationList",value:function(e){var t,n=e.isFromGetConversations,o=e.isInstantMessage,s=Date.now();t=this._getTmpConversationListMapping(e),this._conversationMap=new Map(this._sortConversationList([].concat(v(t.toBeUpdatedConversationList),v(this._conversationMap)))),n||(this._updateUserOrGroupProfile(t.newConversationList),o&&this.emitTotalUnreadMessageCountUpdate()),Ve.d("".concat(this._n,"._updateLocalConversationList cost ").concat(Date.now()-s," ms"))}},{key:"_getTmpConversationListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,s=e.isUnreadC2CMessage,r=void 0!==s&&s,a=e.updateUnreadCount,i=[],u=[],c=this.getModule(xn),l=this.getModule(Vn),d=this.isIntl(),p=0,g=t.length;p<g;p++){var _=new Ua(t[p],d),h=_.conversationID;if(h!=="".concat(k.CONV_C2C,"@TLS#ERROR")&&h!=="".concat(k.CONV_C2C,"@TLS#NOT_FOUND"))if(this._conversationMap.has(h)){var f=this._conversationMap.get(h),m=["unreadCount","allowType","adminForbidType","payload","isPinned"];!1===o&&m.push("lastMessage");var v=t[p].lastMessage,M=!dt(v);M||t[p].type===k.CONV_TOPIC||this._onLastMessageNotExist(t[p]),dt(o)&&M&&null===f.lastMessage.payload&&(f.lastMessage.payload=v.payload),$t(f.lastMessage.revoker)||(f.lastMessage.revoker=null),mt(f,_,m,[null,void 0,"",0,NaN]),!0===a&&f.updateUnreadCount({nextUnreadCount:_.unreadCount,isFromGetConversations:n,isUnreadC2CMessage:r}),o&&M&&(v.payload&&(f.lastMessage.payload=v.payload),f.type===k.CONV_GROUP&&(f.lastMessage.nameCard=v.nameCard,f.lastMessage.nick=v.nick)),M&&f.lastMessage.cloudCustomData!==v.cloudCustomData&&(f.lastMessage.cloudCustomData=v.cloudCustomData||""),this._conversationMap.delete(h),i.push([h,f])}else{if(_.type===k.CONV_GROUP&&c){var y=_.groupProfile.groupID,I=c.getLocalGroupProfile(y);I&&(_.groupProfile=I,!0===a&&_.updateUnreadCount({nextUnreadCount:0}))}else if(_.type===k.CONV_C2C){var C=h.replace(k.CONV_C2C,"");l&&l.isMyFriend(C)&&(_.remark=l.getFriendRemark(C))}u.push(_),i.push([h,_])}}var T=this.getModule(Bn);return i.forEach((function(e){if(e[1].type===k.CONV_TOPIC){var t=e[1],n=t.conversationID,o=t.unreadCount,s=t.groupAtInfoList;T.onConversationProxy({topicID:n.replace(k.CONV_GROUP,""),unreadCount:o,groupAtInfoList:$t(s)?void 0:s})}})),{toBeUpdatedConversationList:i,newConversationList:u}}},{key:"_onLastMessageNotExist",value:function(e){new jr("lastMessageNotExist").setMessage("".concat(JSON.stringify(e))).setNetworkType(this.getNetworkType()).end()}},{key:"_sortConversationList",value:function(e){var t=[],n=[],o=[],s=[];return e.forEach((function(e){!0===e[1].isPinned?$t(e[1].lastMessage.lastTime)?n.push(e):t.push(e):$t(e[1].lastMessage.lastTime)?s.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(s)}},{key:"_sortConversationListAndEmitEvent",value:function(){this._conversationMap=new Map(this._sortConversationList(v(this._conversationMap))),this.emitConversationUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t=this;if(0!==e.length){var n=[],o=[],s=this.getModule(Fn),r=this.getModule(xn);e.forEach((function(e){if(e.type===k.CONV_C2C)n.push(e.toAccount);else if(e.type===k.CONV_GROUP){var t=e.toAccount;r.hasLocalGroup(t)?e.groupProfile=r.getLocalGroupProfile(t):o.push(t)}})),Ve.l("".concat(this._n,"._updateUserOrGroupProfile c2cUserIDList:").concat(n," groupIDList:").concat(o)),n.length>0&&s.getUserProfile({userIDList:n}).then((function(e){var n=e.data;lt(n)?n.forEach((function(e){t._doUpdateUserProfile("C2C".concat(e.userID),e)})):t._doUpdateUserProfile("C2C".concat(n.userID),n)})),o.length>0&&r.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);mt(o.groupProfile,e,[],[null,void 0,"",0,NaN]),!o.subType&&e.type&&(o.subType=e.type)}}))}))}}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t)}},{key:"_getConversationOptions",value:function(e){var n=this,o=[],s=e.filter((function(e){var t=e.type,n=e.userID;return 1===t&&"@TLS#NOT_FOUND"!==n&&"@TLS#ERROR"!==n||2===t})),r=this.getMyUserID(),a=s.map((function(e){if(dt(e.lastMsg)&&(e.lastMsg={elements:[]}),1===e.type){var s={userID:e.userID,nick:e.peerNick,avatar:e.peerAvatar};return o.push(s),{conversationID:"C2C".concat(e.userID),type:"C2C",lastMessage:{lastTime:e.time,lastSequence:e.sequence,fromAccount:e.lastC2CMsgFromAccount,messageForShow:e.messageShow,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:null,payload:e.lastMsg.elements[0]?n._amendLayersOverLimitProperty(e.lastMsg.elements[0].content):null,cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:8===e.lastMessageFlag,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:e.lastC2CMsgFromAccount===r&&e.time<=e.c2cPeerReadTime,revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null},userProfile:new La(s),peerReadTime:e.c2cPeerReadTime,isPinned:1===e.isPinned,messageRemindType:"",customData:e.customMark||"",markList:Jt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}return{conversationID:"GROUP".concat(e.groupID),type:"GROUP",lastMessage:t(t({lastTime:e.time,lastSequence:e.sequence,fromAccount:e.msgGroupFromAccount,messageForShow:e.messageShow},n._patchTypeAndPayload(e)),{},{cloudCustomData:e.lastMsg.cloudCustomData||"",isRevoked:2===e.lastMessageFlag,onlineOnlyFlag:!1,nick:e.senderNick||"",nameCard:e.senderNameCard||"",revoker:e.lastMsg.revokerInfo?e.lastMsg.revokerInfo.revoker:null}),groupProfile:new Oa({groupID:e.groupID,name:e.groupNick,avatar:e.groupImage}),unreadCount:e.unreadCount,peerReadTime:0,isPinned:1===e.isPinned,messageRemindType:"",version:0,customData:e.customMark||"",markList:Jt(e.standardMark),conversationGroupList:n._convGroupHandler.getConvGroupListByID(e.contactGroupId)}}));o.length>0&&this.getModule(Fn).onConversationsProfileUpdated(o);return a}},{key:"_patchTypeAndPayload",value:function(e){var n=e.lastMsg,o=n.event,s=void 0===o?void 0:o,r=n.elements,a=void 0===r?[]:r,i=n.groupTips,u=void 0===i?{}:i;if(!dt(s)&&!$t(u)){var c=new ca(u);c.setElement({type:k.MSG_GRP_TIP,content:t(t({},u.elements),{},{groupProfile:u.groupProfile})});var l=JSON.parse(JSON.stringify(c.payload));return c=null,{type:k.MSG_GRP_TIP,payload:l}}return{type:a[0]?a[0].type:null,payload:a[0]?this._amendLayersOverLimitProperty(a[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 ca&&this._messageListHandler.remove(e)}},{key:"onConversationDeleted",value:function(e){if(lt(e)){var t=e.map((function(e){var t=e.type,n=e.userID,o=e.groupID;return 1===t?"".concat(k.CONV_C2C).concat(n):2===t?"".concat(k.CONV_GROUP).concat(o):void 0}));Ve.l("".concat(this._n,".onConversationDeleted conversationIDList:").concat(t)),this.deleteLocalConversationList(t)}}},{key:"onConversationPinned",value:function(e){var t=this;if(lt(e)){var n=!1;e.forEach((function(e){var o,s=e.type,r=e.userID,a=e.groupID;1===s?o=t.getLocalConversation("".concat(k.CONV_C2C).concat(r)):2===s&&(o=t.getLocalConversation("".concat(k.CONV_GROUP).concat(a))),o&&(Ve.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(lt(e)){var n=!1;e.forEach((function(e){var o,s=e.type,r=e.userID,a=e.groupID;1===s?o=t.getLocalConversation("".concat(k.CONV_C2C).concat(r)):2===s&&(o=t.getLocalConversation("".concat(k.CONV_GROUP).concat(a))),o&&(Ve.l("".concat(t._n,".onConversationUnpinned conversationID:").concat(o.conversationID," isPinned:").concat(o.isPinned)),o.isPinned&&(o.isPinned=!1,n=!0))})),n&&this._sortConversationListAndEmitEvent()}}},{key:"getMessageList",value:function(e){var t=this,n=e.conversationID,o=e.nextReqMessageID,s=e.count,r="".concat(this._n,".getMessageList"),a=this.getLocalConversation(n),i="";if(a&&a.groupProfile&&(i=a.groupProfile.type),Lt(i))return Ve.l("".concat(r," not available in avchatroom. conversationID:").concat(n)),_a({messageList:[],nextReqMessageID:"",isCompleted:!0});(dt(s)||s>15)&&(s=15),!o&&this._isNotInCommunity(n)&&(this._messageListHandler.removeByConversationID(n),this._completedMap.delete(n),this._roamingMessageSequenceMap.delete(n));var u=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),c=this._completedMap.has(n);if(Ve.l("".concat(r," conversationID:").concat(n," nextReqMessageID:").concat(o)+" remainingCount:".concat(u," count:").concat(s," isCompleted:").concat(c)),this._needGetHistory({conversationID:n,remainingCount:u,count:s}))return this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then((function(e){var o=e.nextReqID,s=e.storedMessageList,a=t._completedMap.has(n),i=s;u>0&&(i=t._messageListHandler.getLocalMessageList(n).slice(0,s.length+u));var c={nextReqMessageID:a?"":o,messageList:i,isCompleted:a};return Ve.l("".concat(r," ret.nextReqMessageID:").concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," ret.length:").concat(i.length)),la(c)}));this.modifyMessageList(n);var l=this._getMessageListFromMemory({conversationID:n,nextReqMessageID:o,count:s});return _a(l)}},{key:"_getMessageListFromMemory",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=e.count,s="".concat(this._n,"._getMessageListFromMemory"),r=this._messageListHandler.getLocalMessageList(t),a=r.length,i=0,u={isCompleted:!1,nextReqMessageID:"",messageList:[]};return n?(i=r.findIndex((function(e){return e.ID===n})))>o?(u.messageList=r.slice(i-o,i),u.nextReqMessageID=r[i-o].ID):(u.messageList=r.slice(0,i),u.isCompleted=!0):a>o?(i=a-o,u.messageList=r.slice(i,a),u.nextReqMessageID=r[i].ID):(u.messageList=r.slice(0,a),u.isCompleted=!0),Ve.l("".concat(s," conversationID:").concat(t)+" ret.nextReqMessageID:".concat(u.nextReqMessageID," ret.isCompleted:").concat(u.isCompleted," ret.length:").concat(u.messageList.length)),u}},{key:"getMessageListHopping",value:function(e){var t=e.conversationID,n=e.sequence,o=e.time,s=e.count,r=e.direction,a=void 0===r?0:r;if((dt(s)||s>15)&&(s=15),t.startsWith(k.CONV_C2C)){var i=this.getModule(qn),u=t.replace(k.CONV_C2C,"");return i.getRoamingMessagesHopping({peerAccount:u,time:o,count:s,direction:a})}if(t.startsWith(k.CONV_GROUP)){var c=this.getModule(xn),l=t.replace(k.CONV_GROUP,"");return c.getRoamingMessagesHopping({groupID:l,sequence:n,count:s,direction:a})}}},{key:"_computeRemainingCount",value:function(e){var t=e.conversationID,n=e.nextReqMessageID,o=this._messageListHandler.getLocalMessageList(t),s=o.length;if(!n)return s;var r=0;return Rt(t)?r=o.findIndex((function(e){return e.ID===n})):Ot(t)&&(r=-1!==n.indexOf("-")?o.findIndex((function(e){return e.ID===n})):o.findIndex((function(e){return e.sequence===n}))),-1===r&&(r=0),r}},{key:"_getMessageListSize",value:function(e){return this._messageListHandler.getLocalMessageList(e).length}},{key:"_needGetHistory",value:function(e){var t=e.conversationID,n=e.remainingCount,o=e.count,s=this.getLocalConversation(t),r="";return s&&s.groupProfile&&(r=s.groupProfile.type),!Gt(t)&&!Lt(r)&&(!(Ot(t)&&this._isPagingGetGroupListCompleted()&&this._getLocalGroupCount()<=4e3&&!this._hasLocalGroup(t)&&!this._isTopicConversation(t))&&(n<=o&&!this._completedMap.has(t)))}},{key:"_isTopicConversation",value:function(e){var t=e.replace(k.CONV_GROUP,"");return Nt(t)}},{key:"getHistoryMessages",value:function(e){var t=e.conversationID,n=e.count;if(t===k.CONV_SYSTEM)return _a();var o=15;n>20&&(o=20);var s=null;if(Rt(t)){var r=this._roamingMessageKeyAndTimeMap.has(t);return(s=this.getModule(qn))?s.getRoamingMessage({conversationID:t,peerAccount:t.replace(k.CONV_C2C,""),count:o,lastMessageTime:r?this._roamingMessageKeyAndTimeMap.get(t).lastMessageTime:0,messageKey:r?this._roamingMessageKeyAndTimeMap.get(t).messageKey:""}):ha({code:Or.CANNOT_FIND_MODULE})}if(Ot(t)){if(!(s=this.getModule(xn)))return ha({code:Or.CANNOT_FIND_MODULE});var a=null;this._conversationMap.has(t)&&(a=this._conversationMap.get(t).lastMessage);var i=0;a&&(i=a.lastSequence);var u=this._roamingMessageSequenceMap.get(t);return s.getRoamingMessage({conversationID:t,groupID:t.replace(k.CONV_GROUP,""),count:o,sequence:u||i})}return _a()}},{key:"patchConversationLastMessage",value:function(e){var t=this.getLocalConversation(e);if(t){var n=t.lastMessage,o=n.messageForShow,s=n.payload;if($t(o)||$t(s)){var r=this._messageListHandler.getLocalMessageList(e);if(0===r.length)return;var a=r[r.length-1];Ve.l("".concat(this._n,".patchConversationLastMessage conversationID:").concat(e," payload:"),a.payload),t.updateLastMessage(a)}}}},{key:"onRoamingMessage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=n.startsWith(k.CONV_C2C)?k.CONV_C2C:k.CONV_GROUP,r=null,a=[],i=[],u=0,c=e.length,l=null,d=s===k.CONV_GROUP,p=this.getModule(zn),g=this.getFileDownloadProxy(),_=function(){u=d?e.length-1:0,c=d?0:e.length},h=function(){d?--u:++u},f=function(){return d?u>=c:u<c};for(_();f();h())if(d&&1===e[u].sequence&&o&&this.setCompleted(n),1!==e[u].isPlaceMessage)if((r=new ca(e[u])).to=e[u].to,s!==k.CONV_GROUP||dt(e[u].topicID)||(r.to=e[u].topicID),r.isSystemMessage=!!e[u].isSystemMessage,r.conversationType=s,4===e[u].event?l={type:k.MSG_GRP_TIP,content:t(t({},e[u].elements),{},{groupProfile:e[u].groupProfile})}:(e[u].elements=p.parseElements(e[u].elements,e[u].from),l=e[u].elements),d||r.setNickAndAvatar({nick:e[u].nick,avatar:e[u].avatar}),$t(l)){var m=new jr("emptyMessageBody");m.setMessage("from:".concat(r.from," to:").concat(r.to," sequence:").concat(r.sequence," event:").concat(e[u].event)),m.setNetworkType(this.getNetworkType()).setLevel("warning").end()}else r.setElement(l,g),r.reInitialize(this.getMyUserID()),a.push(r);return _=h=f=null,o?(this._messageListHandler.unshift(a,i),a=null,i):(i=null,a)}},{key:"findMessage",value:function(e){return this._messageListHandler.findMessage(e)}},{key:"_isNotInCommunity",value:function(e){var t=!1;if(e.startsWith(k.CONV_GROUP)&&this._isTopicConversation(e)){var n=Wt(e.replace(k.CONV_GROUP,""));this.getModule(xn).hasLocalGroup(n)||(t=!0)}return t}},{key:"deleteTopicRoamingMessageInfo",value:function(e){var t=this;At({groupID:e})&&this._messageListHandler.getTopicConversationIDList(e).forEach((function(e){t._messageListHandler.removeByConversationID(e),t._completedMap.delete(e),t._roamingMessageSequenceMap.delete(e)}))}},{key:"deleteGroupRomaingMessageInfo",value:function(e){var t="".concat(k.CONV_GROUP).concat(e);this._messageListHandler.removeByConversationID(t),this._completedMap.delete(t),this._roamingMessageSequenceMap.delete(t)}},{key:"setMessageRead",value:function(e){var t=e.conversationID,n=this.getLocalConversation(t);if(Ve.l("".concat(this._n,".setMessageRead conversationID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n)return _a();if(n.type!==k.CONV_GROUP&&n.type!==k.CONV_TOPIC||$t(n.groupAtInfoList)||this.deleteGroupAtTips(t),0===n.unreadCount)return _a();if(n.type===k.CONV_GROUP&&!this._hasLocalGroup(t))return 0!==n.unreadCount&&(n.unreadCount=0,this.emitConversationUpdate(!0,!1)),_a();var o=this._messageListHandler.getLocalLastMessage(t),s=n.lastMessage.lastTime;o&&s<o.time&&(s=o.time);var r=n.lastMessage.lastSequence;if(o&&r<o.sequence&&(r=o.sequence),n.type===k.CONV_TOPIC&&dt(o)){var a=this.getModule(Bn),i=t.replace(k.CONV_GROUP,""),u=Wt(i),c=a.getLocalTopic(u,i);c&&(r=c.nextMessageSeq-1)}var l=null;switch(n.type){case k.CONV_C2C:return(l=this.getModule(qn))?l.setMessageRead({conversationID:t,lastMessageTime:s}):ha({code:Or.CANNOT_FIND_MODULE});case k.CONV_GROUP:case k.CONV_TOPIC:return(l=this.getModule(xn))?l.setMessageRead({conversationID:t,lastMessageSeq:r}):ha({code:Or.CANNOT_FIND_MODULE});case k.CONV_SYSTEM:return n.unreadCount=0,this.emitConversationUpdate(!0,!1),_a();default:return _a()}}},{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=k.READ_ALL_MSG),Ve.l("".concat(o," options:"),t);var s=this._createSetAllMessageReadPack(t);if(0===s.readAllC2CMessage&&0===s.groupMessageReadInfoList.length)return _a();var r=new jr(n);return this.request({protocolName:ks,requestData:s}).then((function(n){var o=n.data,s=e._handleAllMessageRead(o);return r.setMessage("scope:".concat(t.scope," failureGroups:").concat(JSON.stringify(s))).setNetworkType(e.getNetworkType()).end(),_a()})).catch((function(t){return e.probeNetwork().then((function(e){var n=m(e,2),o=n[0],s=n[1];r.setError(t,o,s).end()})),Ve.w("".concat(o," failed. error:"),t),ha({code:t&&t.code?t.code:Or.MESSAGE_UNREAD_ALL_FAIL,message:t&&t.message?t.message:void 0})}))}},{key:"setConversationCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._convGroupHandler.markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConversationMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConversationGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConversationGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConversationGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConversationInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConversationAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConversationLastMessageSequence",value:function(e){var t=this._messageListHandler.getLocalLastMessage(e.conversationID),n=e.lastMessage.lastSequence;return t&&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,s=D(this._conversationMap);try{for(s.s();!(t=s.n()).done;){var r=m(t.value,2)[1];if(r.unreadCount>0)if(r.type===k.CONV_C2C&&0===n.readAllC2CMessage){if(o===k.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===k.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else if(r.type===k.CONV_GROUP&&(o===k.READ_ALL_GROUP_MSG||o===k.READ_ALL_MSG)){var a=this._getConversationLastMessageSequence(r);n.groupMessageReadInfoList.push({groupID:r.groupProfile.groupID,messageSequence:a})}}}catch(i){s.e(i)}finally{s.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMessageRead(e)}},{key:"_handleAllMessageRead",value:function(e){var t=e.groupMessageReadInfoList,n=e.readAllC2CMessage,o=this._parseGroupReadInfo(t);return this._updateAllConversationUnreadCount({readAllC2CMessage:n})>=1&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate()),o}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n<o;n++){var s=e[n],r=s.groupID,a=s.sequence,i=s.retCode,u=s.lastMessageSeq;dt(i)?this._remoteGroupReadSequenceMap.set(r,u):(this._remoteGroupReadSequenceMap.set(r,a),0!==i&&t.push("".concat(r,"-").concat(a,"-").concat(i)))}return t}},{key:"_updateAllConversationUnreadCount",value:function(e){var t,n=e.readAllC2CMessage,o=0,s=D(this._conversationMap);try{for(s.s();!(t=s.n()).done;){var r=m(t.value,2),a=r[0],i=r[1];if(i.unreadCount>=1){if(1===n&&i.type===k.CONV_C2C){var u=this._getConversationLastMessageTime(i);this.updateIsReadAfterReadReport({conversationID:a,lastMessageTime:u})}else if(i.type===k.CONV_GROUP){var c=a.replace(k.CONV_GROUP,"");if(this._remoteGroupReadSequenceMap.has(c)){var l=this._remoteGroupReadSequenceMap.get(c),d=this._getConversationLastMessageSequence(i);this.updateIsReadAfterReadReport({conversationID:a,remoteReadSequence:l}),d>=l&&this._remoteGroupReadSequenceMap.delete(c)}}this.updateUnreadCount(a,!1)&&(o+=1)}}}catch(p){s.e(p)}finally{s.f()}return o}},{key:"isRemoteRead",value:function(e){var t=e.conversationID,n=e.sequence,o=t.replace(k.CONV_GROUP,""),s=!1;if(this._remoteGroupReadSequenceMap.has(o)){var r=this._remoteGroupReadSequenceMap.get(o);n<=r&&(s=!0,Ve.l("".concat(this._n,".isRemoteRead conversationID:").concat(t," messageSequence:").concat(n," remoteReadSequence:").concat(r))),n>=r+10&&this._remoteGroupReadSequenceMap.delete(o)}return s}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,s=this._messageListHandler.getLocalMessageList(t);if(0!==s.length)for(var r,a=s.length-1;a>=0;a--)if(r=s[a],!(o&&r.time>o||n&&r.sequence>n)){if("in"===r.flow&&r.isRead)break;r.setIsRead(!0)}}},{key:"updateUnreadCount",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!1,o=this.getLocalConversation(e),s=this._messageListHandler.getLocalMessageList(e);if(o){var r=o.unreadCount,a=s.filter((function(e){return!e.isRead&&!e._onlineOnlyFlag&&!e.isDeleted})).length;if(r!==a&&(o.unreadCount=a,n=!0,Ve.l("".concat(this._n,".updateUnreadCount from ").concat(r," to ").concat(a,", conversationID:").concat(e)),!0===t&&(this.emitConversationUpdate(!0,!1),this.emitTotalUnreadMessageCountUpdate())),n&&o.type===k.CONV_TOPIC){var i=o.unreadCount,u=this.getModule(Bn),c=e.replace(k.CONV_GROUP,"");u.onConversationProxy({topicID:c,unreadCount:i})}return n}}},{key:"clearGroupAtInfoList",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalConversation(e);if(n&&n.groupAtInfoList.length>0){if(n.clearGroupAtInfoList(),Ve.l("".concat(this._n,".clearGroupAtInfoList conversationID:").concat(e)),n.type===k.CONV_TOPIC){var o=n.groupAtInfoList,s=this.getModule(Bn),r=e.replace(k.CONV_GROUP,"");s.onConversationProxy({topicID:r,groupAtInfoList:o})}!0===t&&this.emitConversationUpdate(!0,!1)}}},{key:"updateReadReceiptInfo",value:function(e){var t=this,n=e.userID,o=void 0===n?void 0:n,s=e.groupID,r=void 0===s?void 0:s,a=e.readReceiptList;if(!$t(a)){var i=[];if(dt(o)){if(!dt(r)){var u="".concat(k.CONV_GROUP).concat(r);a.forEach((function(e){var n=e.tinyID,o=e.clientTime,s=e.random,a=e.readCount,c=e.unreadCount,l="".concat(n,"-").concat(o,"-").concat(s),d=t._messageListHandler.getLocalMessage(u,l),p={groupID:r,messageID:l,readCount:0,unreadCount:0};d&&(at(a)&&(d.readReceiptInfo.readCount=a,p.readCount=a),at(c)&&(d.readReceiptInfo.unreadCount=c,p.unreadCount=c),i.push(p))}))}}else{var c="".concat(k.CONV_C2C).concat(o);a.forEach((function(e){var n=e.tinyID,s=e.clientTime,r=e.random,a="".concat(n,"-").concat(s,"-").concat(r),u=t._messageListHandler.getLocalMessage(c,a);if(u){u.readReceiptInfo.isPeerRead=!0;var l={userID:o,messageID:a,isPeerRead:!0};i.push(l)}}))}i.length>0&&this.emitOuterEvent(E.MESSAGE_READ_RECEIPT_RECEIVED,i)}}},{key:"recomputeGroupUnreadCount",value:function(e){var t=e.conversationID,n=e.count,o=this.getLocalConversation(t);if(o){var s=o.unreadCount,r=s-n;r<0&&(r=0),o.unreadCount=r,Ve.l("".concat(this._n,".recomputeGroupUnreadCount from ").concat(s," to ").concat(r,", conversationID:").concat(t))}}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&0!==n.length&&!Gt(t.type)){for(var o=[],s=0,r=n.length;s<r;s++)"in"!==n[s].flow?"out"!==n[s].flow||n[s].isRead||n[s].setIsRead(!0):o.push(n[s]);var a=0;if(t.type===k.CONV_C2C){var i=o.slice(-t.unreadCount).filter((function(e){return e.isRevoked})).length;a=o.length-t.unreadCount-i}else a=o.length-t.unreadCount;for(var u=0;u<a&&!o[u].isRead;u++)o[u].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t=this,n="".concat(this._n,".deleteGroupAtTips");Ve.l("".concat(n));var o=this._conversationMap.get(e);if(!o)return Promise.resolve();var s=o.groupAtInfoList;if(0===s.length)return Promise.resolve();var r=void 0;e.startsWith(k.CONV_GROUP)&&(r=e.replace(k.CONV_GROUP,""));var a=v(s);if((At({groupID:r})||Nt(r))&&0===(a=s.filter((function(e){return!e.atTypeArray.includes(k.CONV_AT_ALL)}))).length)return this.clearGroupAtInfoList(e,!1),Promise.resolve();var i=this.getMyUserID();return this.request({protocolName:ns,requestData:{messageListToDelete:a.map((function(e){return{from:e.from,to:i,messageSeq:e.__sequence,messageRandom:e.__random,groupID:dt(e.topicID)?e.groupID:e.topicID}}))}}).then((function(){return Ve.l("".concat(n," ok. count:").concat(s.length)),t.clearGroupAtInfoList(e,!1),Promise.resolve()})).catch((function(e){return Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"appendToMessageList",value:function(e){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(k.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;$t(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){Ve.l("".concat(this._n,".setCompleted. conversationID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMessageKeyAndTime",value:function(e,t,n){this._roamingMessageKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"updateRoamingMessageSequence",value:function(e,t){this._roamingMessageSequenceMap.set(e,t)}},{key:"getConversationList",value:function(e){var t=this,n="getConversationList",o="".concat(this._n,".").concat(n),s="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._conversationMap.size,", options:").concat(e);if(Ve.l("".concat(o,". ").concat(s)),this._pagingStatus===sn.REJECTED){var r=new jr(n);return r.setMessage(s),this.syncConversationList().then((function(){r.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return la({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}if(0===this._conversationMap.size){var a=new jr(n);return a.setMessage(s),this.syncConversationList().then((function(){a.setNetworkType(t.getNetworkType()).end();var n=t._getConversationList(e);return la({conversationList:n,isSyncCompleted:t._isSyncCompleted()})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}var i=this._getConversationList(e);return Ve.l("".concat(o,". returned conversation count:").concat(i.length)),_a({conversationList:i,isSyncCompleted:this._isSyncCompleted()})}},{key:"_getConversationList",value:function(e){if(dt(e))return this.getLocalConversationList();if(lt(e))return 0===e.length?[]:this.getLocalConversationList().filter((function(t){return e.includes(t.conversationID)}));if(ct(e)){var t=e.type,n=e.markType,o=e.groupName;return this.getLocalConversationList().filter((function(e){return(t!==k.CONV_C2C&&t!==k.CONV_GROUP||e.type===t)&&(!it(o)||e.conversationGroupList.includes(o))&&(!at(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=m(e.value,2),o=n[0],s=n[1];s.type===k.CONV_C2C&&(Ve.d("".concat(this._n,"._handleC2CPeerReadTime conversationID:").concat(o," peerReadTime:").concat(s.peerReadTime)),this.recordPeerReadTime(o,s.peerReadTime))}}catch(r){t.e(r)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){return this.getModule(xn).isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){return this.getModule(xn).getLocalGroupList().length}},{key:"_hasLocalGroup",value:function(e){return this.getModule(xn).hasLocalGroup(e.replace(k.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this;if((t=this._conversationMap.has(e)?this._conversationMap.get(e):new Ua({conversationID:e,type:e.slice(0,3)===k.CONV_C2C?k.CONV_C2C:k.CONV_GROUP},this.isIntl()))._isInfoCompleted||t.type===k.CONV_SYSTEM)return _a({conversation:t});if(Ot(e)&&!this._hasLocalGroup(e))return _a({conversation:t});var o="".concat(this._n,".").concat("getConversationProfile"),s=new jr("getConversationProfile");return Ve.l("".concat(o,". conversationID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._updateUserOrGroupProfileCompletely(t).then((function(r){s.setNetworkType(n.getNetworkType()).setMessage("conversationID:".concat(e," unreadCount:").concat(r.data.conversation.unreadCount)).end();var a=n.getModule(Vn);if(a&&t.type===k.CONV_C2C){var i=e.replace(k.CONV_C2C,"");if(a.isMyFriend(i)){var u=a.getFriendRemark(i);t.remark!==u&&(t.remark=u,Ve.l("".concat(o,". conversationID:").concat(e," patch remark:").concat(t.remark)))}}return Ve.l("".concat(o," ok. conversationID:").concat(e)),r})).catch((function(t){return n.probeNetwork().then((function(n){var o=m(n,2),r=o[0],a=o[1];s.setError(t,r,a).setMessage("conversationID:".concat(e)).end()})),Ve.e("".concat(o," failed. error:"),t),ha(t)}))}},{key:"_updateUserOrGroupProfileCompletely",value:function(e){var t=this;return e.type===k.CONV_C2C?this.getModule(Fn).getUserProfile({userIDList:[e.toAccount]}).then((function(n){var o=n.data;return 0===o.length?ha(new da({code:Or.USER_OR_GROUP_NOT_FOUND})):(e.userProfile=o[0],e._isInfoCompleted=!0,t._unshiftConversation(e),_a({conversation:e}))})):this.getModule(xn).getGroupProfile({groupID:e.toAccount}).then((function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._unshiftConversation(e),_a({conversation:e})}))}},{key:"_unshiftConversation",value:function(e){e instanceof Ua&&!this._conversationMap.has(e.conversationID)&&(this._conversationMap=new Map([[e.conversationID,e]].concat(v(this._conversationMap))),this._setStorageConversationList(),this.emitConversationUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach((function(e){var n=e.userID;if(n===t.getMyUserID())t._onMyProfileModified({latestNick:e.nick,latestAvatar:e.avatar});else{var o=t._conversationMap.get("".concat(k.CONV_C2C).concat(n));o&&(o.userProfile=e)}}))}},{key:"_isSyncCompleted",value:function(){return this._pagingStatus===sn.RESOLVED}},{key:"_errorLog",value:function(e,t,n,o){var s=new Error("Params validate failed."),r="".concat(this.getErrorMessage("API_REFER")).concat(e);throw Ve.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrorMessage(n,o),", ").concat(r)),Ve.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),s}},{key:"_isValidConversationID",value:function(e){return Rt(e)||Ot(e)||Gt(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return it(e)||ut(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),it(e)?(this._isValidConversationID(e)||this._errorLog(n,"options","InvalidConversationID",e),Ve.l("".concat(this._n,".").concat(n," conversationID:").concat(e)),this.deleteConversationList({conversationIDList:[e],flag:1})):(lt(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),0===e.conversationIDList.length&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach((function(e){t._isValidConversationID(e)||t._errorLog(n,"conversationIDList","InvalidConversationID",e)})),"clearHistoryMessage"in e&&"boolean"!=typeof e.clearHistoryMessage&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),e.conversationIDList.length>100&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConversationList(e))}},{key:"deleteConversationList",value:function(e){var t=this,n=e.conversationIDList,o=void 0===n?[]:n,s=e.clearHistoryMessage,r=void 0===s||s,a=e.flag,i=void 0===a?0:a,u="".concat(this._n,".").concat("deleteConversationList");Ve.l("".concat(u," conversationIDList.length:").concat(o.length," clearHistoryMessage:").concat(r));var c=new jr("deleteConversationList");return c.setMessage("conversationIDList:".concat(o)),Promise.all([this.rmLocalOnlyConversationList(o),this.rmLocalAndRemoteConversationList(o,r)]).then((function(e){c.setNetworkType(t.getNetworkType()).end();var n=[].concat(v(e[0]),v(e[1]));return 0===n.length?ha(new da({code:Or.CONVERSATION_NOT_FOUND})):(Ve.l("".concat(u," ok")),_a(1===i?{conversationID:n[0]}:{conversationIDList:n}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ve.e("".concat(u," failed. error:"),e),ha(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!==k.CONV_GROUP||t._hasLocalGroup(e)?n===k.CONV_SYSTEM&&(t.getModule(xn).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===k.CONV_C2C?o.conversationList.push({toAccount:e.replace(t,""),type:1}):t===k.CONV_GROUP&&n._hasLocalGroup(e)&&o.conversationList.push({toGroupID:e.replace(t,""),type:2})}})),0===o.conversationList.length?[]:this.request({protocolName:$o,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(k.CONV_C2C).concat(e.to):"".concat(k.CONV_GROUP).concat(e.groupID);t.push(n)}})),n.deleteLocalConversationList(t),t}))}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._conversationMap.has(e))return ha({code:Or.CONVERSATION_NOT_FOUND});var o=this._conversationMap.get(e).type;if(o===k.CONV_C2C)n.type=1,n.toAccount=e.replace(k.CONV_C2C,"");else{if(o!==k.CONV_GROUP)return o===k.CONV_SYSTEM?(this.getModule(xn).deleteGroupSystemNotice({messageList:this._messageListHandler.getLocalMessageList(e)}),_a({conversationID:e})):ha({code:Or.CONVERSATION_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(k.CONV_GROUP,"")}var s="".concat(this._n,".").concat("clearHistoryMessage"),r=new jr("clearHistoryMessage");return r.setMessage("conversationID:".concat(e)),Ve.l("".concat(s,". conversationID:").concat(e)),this.setMessageRead({conversationID:e}).then((function(){return t.request({protocolName:es,requestData:n})})).then((function(){r.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(s," ok")),t._messageListHandler.removeByConversationID(e),t.setCompleted(e);var n=t.getLocalConversation(e);return n&&(n.updateLastMessage(),t._sortConversationListAndEmitEvent()),_a({conversationID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(s," failed. error:"),e),ha(e)}))}},{key:"pinConversation",value:function(e){var t=this,n=e.conversationID,o=e.isPinned;if(!this._conversationMap.has(n))return ha({code:Or.CONVERSATION_NOT_FOUND});var s=this.getLocalConversation(n);if(s.isPinned===o)return _a({conversationID:n});var r="".concat(this._n,".").concat("pinConversation"),a=new jr("pinConversation");a.setMessage("conversationID:".concat(n," isPinned:").concat(o)),Ve.l("".concat(r,". conversationID:").concat(n," isPinned:").concat(o));var i=null;return Rt(n)?i={type:1,toAccount:n.replace(k.CONV_C2C,"")}:Ot(n)&&(i={type:2,groupID:n.replace(k.CONV_GROUP,"")}),this.request({protocolName:ts,requestData:{fromAccount:this.getMyUserID(),operationType:!0===o?1:2,itemList:[i]}}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(r," ok")),s.isPinned!==o&&(s.isPinned=o,t._sortConversationListAndEmitEvent()),la({conversationID:n})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(r," failed. error:"),e),ha(e)}))}},{key:"setMessageRemindType",value:function(e){return this._messageRemindHandler.set(e)}},{key:"patchMessageRemindType",value:function(e){var t=e.ID,n=e.isC2CConversation,o=e.messageRemindType,s=!1,r=this.getLocalConversation(n?"".concat(k.CONV_C2C).concat(t):"".concat(k.CONV_GROUP).concat(t));return r&&r.messageRemindType!==o&&(r.messageRemindType=o,s=!0),Ve.d("".concat(this._n,".patchMessageRemindType options:"),e,"ret:".concat(s)),s}},{key:"onC2CMessageRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMessageRemindTypeSynced");Ve.d(n,e),e.dataList.forEach((function(e){if(!$t(e.muteNotificationsSync)){var o,s=e.muteNotificationsSync,r=s.to,a=s.updateSequence,i=s.muteFlag;t._messageRemindHandler.setUpdateSequence(a),0===i?o=k.MSG_REMIND_ACPT_AND_NOTE:1===i?o=k.MSG_REMIND_DISCARD:2===i&&(o=k.MSG_REMIND_ACPT_NOT_NOTE);var u=0;t.patchMessageRemindType({ID:r,isC2CConversation:!0,messageRemindType:o})&&(u+=1),Ve.l("".concat(n," updateCount:").concat(u)),u>=1&&t.emitConversationUpdate(!0,!1)}}))}},{key:"onGroupMessageRemindTypeSynced",value:function(e){Ve.d("".concat(this._n,".onGroupMessageRemindTypeSynced options:"),e),this._messageRemindHandler.onGroupMessageRemindTypeUpdated(e)}},{key:"deleteLocalConversation",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._conversationMap.has(e);if(Ve.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)})),Ve.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(k.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(Fn).getNickAndAvatarByUserID(this.getMyUserID());this._messageListHandler.modifyMessageSentByMe({conversationID:e,latestNick:o.nick,latestAvatar:o.avatar}),Ve.l("".concat(this._n,".modifyMessageList conversationID:").concat(e," cost ").concat(Date.now()-n," ms"))}}},{key:"updateUserProfileSpecifiedKey",value:function(e){Ve.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),e);var t=e.conversationID,n=e.nick,o=e.avatar;if(this._conversationMap.has(t)){var s=this._conversationMap.get(t).userProfile;it(n)&&s.nick!==n&&(s.nick=n),it(o)&&s.avatar!==o&&(s.avatar=o),this.emitConversationUpdate(!0,!1)}}},{key:"_onMyProfileModified",value:function(e){var n=this,o=this.getLocalConversationList(),s=Date.now();o.forEach((function(o){n.modifyMessageSentByMe(t({conversationID:o.conversationID},e))})),Ve.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost ").concat(Date.now()-s," ms"))}},{key:"modifyMessageSentByMe",value:function(e){this._messageListHandler.modifyMessageSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._messageListHandler.getLatestMessageSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._messageListHandler.modifyMessageSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._messageListHandler.getLatestMessageSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._messageListHandler.pushIn(t)||this.singlyLinkedList.has(t.random))&&(e.push(t),!0)}},{key:"getLocalLastMessage",value:function(e){return this._messageListHandler.getLocalLastMessage(e)}},{key:"checkAndPatchRemark",value:function(){var e=Promise.resolve();if(0===this._conversationMap.size)return e;var t=this.getModule(Vn);if(!t)return e;var n=v(this._conversationMap.values()).filter((function(e){return e.type===k.CONV_C2C}));if(0===n.length)return e;var o=0;return n.forEach((function(e){var n=e.conversationID.replace(k.CONV_C2C,"");if(t.isMyFriend(n)){var s=t.getFriendRemark(n);e.remark!==s&&(e.remark=s,o+=1)}})),Ve.l("".concat(this._n,".checkAndPatchRemark. c2c conversation count:").concat(n.length,", patched count:").concat(o)),e}},{key:"updateTopicConversation",value:function(e){this._updateLocalConversationList({conversationOptionsList:e,isFromGetConversations:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===k.CONV_C2C?n=this._m.getModule(qn):t.conversationType===k.CONV_GROUP&&(n=this._m.getModule(xn)),n?n.sendReadReceipt(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===k.CONV_C2C?n=this._m.getModule(qn):t.conversationType===k.CONV_GROUP&&(n=this._m.getModule(xn)),n?n.getReadReceiptList(e):ha({code:Or.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!==k.CONV_SYSTEM&&(""!==e.messageRemindType&&e.messageRemindType!==k.MSG_REMIND_ACPT_AND_NOTE||(t+=e.unreadCount))})),t}},{key:"emitTotalUnreadMessageCountUpdate",value:function(){var e=this.getTotalUnreadMessageCount();this._convTotalUnreadCount!==e&&(Ve.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(){Ve.l("".concat(this._n,".reset")),this._pagingStatus=sn.NOT_START,this._messageListHandler.reset(),this._messageRemindHandler.reset(),this._roamingMessageKeyAndTimeMap.clear(),this._roamingMessageSequenceMap.clear(),this.singlyLinkedList.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._conversationMap.clear(),this._pagingTimeStamp=0,this._pagingStartIndex=0,this._pagingPinnedTimeStamp=0,this._pagingPinnedStartIndex=0,this._remoteGroupReadSequenceMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this.resetReady()}}]),s}(go),Fa=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 r(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupTipsMap.size>0&&this._checkCachedGroupTips()}},{key:"_checkCachedGroupTips",value:function(){var e=this;this._cachedGroupTipsMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);Ve.l("".concat(e._n,"._checkCachedGroupTips groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"onNewGroupTips",value:function(e){Ve.d("".concat(this._n,".onReceiveGroupTips count:").concat(e.dataList.length));var t=this.newGroupTipsStoredAndSummary(e),n=t.eventDataList,o=t.result,s=t.AVChatRoomMessageList;(s.length>0&&this._groupModule.onAVChatRoomMessage(s),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Kn).onNewMessage({conversationOptionsList:n,isInstantMessage:!0}));o.length>0&&(this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,o),this.handleMessageList(o))}},{key:"newGroupTipsStoredAndSummary",value:function(e){for(var n=this,o=e.event,s=e.dataList,r=null,a=[],i=[],u={},c=[],l=function(e,l){var d=kt(s[e]);if(6===o){if(n._groupModule.isGroupAttributesUpdatedNotice(d))return"continue";if(n._groupModule.isGroupCountersNotice(d))return"continue"}var p=d.groupProfile,g=p.groupID,_=p.communityType,h=void 0===_?0:_,f=p.topicID,m=void 0===f?void 0:f,v=p.invisible,M=void 0,y=n._groupModule.isMessageFromTopic(h,m);if(y){M=k.CONV_TOPIC,d.to=m;var I=n._groupModule.getModule(Bn);I.hasLocalTopic(g,m)||n._getTopicPendingMap.has(m)||(n._getTopicPendingMap.set(m,1),I.getTopicList({groupID:g,topicIDList:[m]}).finally((function(){n._getTopicPendingMap.delete(m)})))}var C=n._groupModule.hasLocalGroup(g);if(!C&&n._groupModule.isUnjoinedAVChatRoom(g))return"continue";if(!C&&!y)return n._cacheGroupTipsAndProbe({groupID:g,event:o,item:d}),"continue";if(n._groupModule.isMessageFromOrToAVChatroom(g))return d.event=o,c.push(d),"continue";if(d.currentUser=n._groupModule.getMyUserID(),d.conversationType=k.CONV_GROUP,(r=new ca(d)).setElement({type:k.MSG_GRP_TIP,content:t(t({},d.elements),{},{groupProfile:d.groupProfile})}),r.isSystemMessage=!1,1===v)return n._qualityStat(r),"continue";var T=n._groupModule.getModule(Kn),D=r,E=D.conversationID,S=D.sequence;if(6===o)r._onlineOnlyFlag=!0,i.push(r);else if(!T.pushIntoNoticeResult(i,r))return"continue";if(n._groupModule.isMessageFromCommunityOfTopic(h,m))return"continue";if(6===o&&T.getLocalConversation(E))return"continue";6!==o&&n._qualityStat(r);var L=T.isRemoteRead({conversationID:E,sequence:S});if(dt(u[E])){var A=0;"in"===r.flow&&(r._isExcludedFromUnreadCount||r._onlineOnlyFlag||L||(A=1)),u[E]=a.push({conversationID:E,unreadCount:A,type:dt(M)?r.conversationType:M,subType:r.conversationSubType,lastMessage:r._isExcludedFromLastMessage?"":r})-1}else{var N=u[E];a[N].type=r.conversationType,a[N].subType=r.conversationSubType,a[N].lastMessage=r._isExcludedFromLastMessage?"":r,"in"===r.flow&&(r._isExcludedFromUnreadCount||r._onlineOnlyFlag||L||a[N].unreadCount++)}},d=0,p=s.length;d<p;d++)l(d);return{eventDataList:a,result:i,AVChatRoomMessageList:c}}},{key:"_qualityStat",value:function(e){this._groupModule.getModule(ro).addMessageSequence({key:xr,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:Ve.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,s=this._groupModule.getLocalGroupProfile(o);s&&at(n)&&s.memberCount!==n&&(s.memberCount=n,this._updateConversationGroupProfile(s))}},{key:"_onMemberQuit",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,s=this._groupModule.getLocalGroupProfile(o);s&&at(n)&&s.memberCount!==n&&(s.memberCount=n,this._updateConversationGroupProfile(s)),this._groupModule.getModule(Hn).deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var t=e.payload,n=t.memberNum,o=t.groupProfile.groupID,s=this._groupModule.getLocalGroupProfile(o);s&&at(n)&&s.memberCount!==n&&(s.memberCount=n,this._updateConversationGroupProfile(s)),this._groupModule.getModule(Hn).deleteLocalGroupMembers(o,e.payload.userIDList)}},{key:"_updateConversationGroupProfile",value:function(e){this._groupModule.getModule(Kn).updateConversationGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getModule(Hn);n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(k.GRP_MBR_ROLE_ADMIN)}))}},{key:"_onMemberCancelledAdmin",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.userIDList,o=this._groupModule.getModule(Hn);n.forEach((function(e){var n=o.getLocalGroupMemberInfo(t,e);n&&n.updateRole(k.GRP_MBR_ROLE_MEMBER)}))}},{key:"_onGroupProfileModified",value:function(e){var t=this,n=e.payload,o=n.newGroupProfile,s=n.groupProfile.groupID,r=this._groupModule.getLocalGroupProfile(s);Object.keys(o).forEach((function(e){switch(e){case"ownerID":t._ownerChanged(r,o);break;case"groupName":r.name=o[e];break;default:r[e]=o[e]}}));var a=!r.isSupportTopic;this._groupModule.emitGroupListUpdate(!0,a)}},{key:"_ownerChanged",value:function(e,t){var n=e.groupID,o=this._groupModule.getLocalGroupProfile(n),s=this._groupModule.getMyUserID();if(s===t.ownerID){o.updateGroup({selfInfo:{role:k.GRP_MBR_ROLE_OWNER}});var r=this._groupModule.getModule(Hn),a=r.getLocalGroupMemberInfo(n,s),i=this._groupModule.getLocalGroupProfile(n).ownerID,u=r.getLocalGroupMemberInfo(n,i);a&&a.updateRole(k.GRP_MBR_ROLE_OWNER),u&&u.updateRole(k.GRP_MBR_ROLE_MEMBER)}}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,s=n.memberList,r=o.groupID;Nt(t)&&this._updateTopicMuteTime(e);var a=this._groupModule.getModule(Hn);s.forEach((function(e){var t=a.getLocalGroupMemberInfo(r,e.userID);t&&at(e.muteTime)&&t.updateMuteUntil(e.muteTime)}))}},{key:"_updateTopicMuteTime",value:function(e){var t=e.to,n=e.payload,o=n.groupProfile,s=n.memberList,r=void 0===s?[]:s,a=this._groupModule.getModule(Bn),i=o.groupID,u=a.getLocalTopic(i,t);if(u){for(var c=!1,l=0;l<r.length;l++){var d=r[l];if(d.userID===this._groupModule.getMyUserID()&&d.muteTime>=0){u.updateSelfInfo({muteTime:d.muteTime}),c=!0;break}}c&&this._groupModule.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,o=n.groupProfile.groupID,s=n.newTopicInfo;this._groupModule.getModule(Bn).onTopicProfileUpdated(t({groupID:o,topicID:e.to},s))}},{key:"_cacheGroupTips",value:function(e,t){this._cachedGroupTipsMap.has(e)||this._cachedGroupTipsMap.set(e,[]),this._cachedGroupTipsMap.get(e).push(t)}},{key:"_deleteCachedGroupTips",value:function(e){this._cachedGroupTipsMap.has(e)&&this._cachedGroupTipsMap.delete(e)}},{key:"_notifyCachedGroupTips",value:function(e){var t=this,n=this._cachedGroupTipsMap.get(e)||[];n.forEach((function(e){t.onNewGroupTips(e)})),this._deleteCachedGroupTips(e),Ve.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupTipsAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupTips(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===k.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),Ve.l("".concat(this._n,"._cacheGroupTipsAndProbe groupID:").concat(n))}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear()}}]),e}(),qa=function(){function e(t){o(this,e),this._groupModule=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this._getTopicPendingMap=new Map,this._isPagingGetCompleted=!1,t.getInnerEmitterInstance().once(va,this._initGroupList,this)}return r(e,[{key:"onCheckTimer",value:function(e){e%1==0&&this._cachedGroupMessageMap.size>0&&this._checkCachedGroupMessage()}},{key:"_checkCachedGroupMessage",value:function(){var e=this;this._cachedGroupMessageMap.forEach((function(t,n){var o=e._checkCountMap.get(n),s=e._groupModule.hasLocalGroup(n);Ve.l("".concat(e._n,"._checkCachedGroupMessage groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._groupModule.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):(o++,e._checkCountMap.set(n,o))}))}},{key:"_initGroupList",value:function(){var e=this;Ve.l("".concat(this._n,"._initGroupList"));var t=new jr("getGroupListInStorage"),n=this._groupModule.getStorageGroupList();if(lt(n)&&n.length>0){n.forEach((function(t){e._groupModule.initGroupMap(t)})),this._groupModule.emitGroupListUpdate(!0,!1);var o=this._groupModule.getLocalGroupList().length;t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:".concat(o)).end()}else t.setNetworkType(this._groupModule.getNetworkType()).setMessage("group count:0").end();Ve.l("".concat(this._n,"._initGroupList ok"))}},{key:"handleUpdateGroupLastMessage",value:function(e){var n="".concat(this._n,".handleUpdateGroupLastMessage");if(Ve.l("".concat(n," conversation count:").concat(e.length,", local group count:").concat(this._groupModule.getLocalGroupList().length)),0!==this._groupModule.getGroupMap().size){for(var o,s,r,a=!1,i=0,u=e.length;i<u;i++)(o=e[i]).type===k.CONV_GROUP&&(s=o.conversationID.split(/^GROUP/)[1],(r=this._groupModule.getLocalGroupProfile(s))&&(r.lastMessage=t({},o.lastMessage),a=!0));a&&(this._groupModule.sortLocalGroupList(),this._groupModule.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewGroupMessage",value:function(e){Ve.d("".concat(this._n,".onNewGroupMessage count:").concat(e.dataList.length));var t=this._newGroupMessageStoredAndSummary(e),n=t.conversationOptionsList,o=t.messageList,s=t.AVChatRoomMessageList;(s.length>0&&this._groupModule.onAVChatRoomMessage(s),this._groupModule.filterModifiedMessage(o),n.length>0)&&(this._groupModule.updateNextMessageSeq(n),this._groupModule.getModule(Kn).onNewMessage({conversationOptionsList:n,isInstantMessage:e.isInstantMessage||!0,updateUnreadCount:e.updateUnreadCount||!0}));var r=this._groupModule.filterUnmodifiedMessage(o);r.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,r),o.length=0}},{key:"_newGroupMessageStoredAndSummary",value:function(e){var t=this,n=e.dataList,o=e.event,s=e.isInstantMessage,r=null,a=[],i=[],u=[],c={},l=this._groupModule.getModule(zn),d=this._groupModule.getFileDownloadProxy(),p=n.length;p>1&&n.sort((function(e,t){return e.sequence-t.sequence}));for(var g=function(e){var p=kt(n[e]),g=p.groupProfile,_=g.groupID,h=g.communityType,f=void 0===h?0:h,m=g.topicID,v=void 0===m?void 0:m,M=g.invisible,y=void 0,I=t._groupModule.isMessageFromTopic(f,v);if(I){y=k.CONV_TOPIC,p.to=v;var C=t._groupModule.getModule(Bn);C.hasLocalTopic(_,v)||t._getTopicPendingMap.has(v)||(t._getTopicPendingMap.set(v,1),C.getTopicList({groupID:_,topicIDList:[v]}).finally((function(){t._getTopicPendingMap.delete(v)})))}var T=t._groupModule.hasLocalGroup(_);if(!T&&t._groupModule.isUnjoinedAVChatRoom(_))return"continue";if(!T&&!I)return t._cacheGroupMessageAndProbe({groupID:_,event:o,item:p}),"continue";if(t._groupModule.isMessageFromOrToAVChatroom(_))return p.event=o,u.push(p),"continue";if(p.currentUser=t._groupModule.getMyUserID(),p.conversationType=k.CONV_GROUP,p.isSystemMessage=!!p.isSystemMessage,r=new ca(p),p.elements=l.parseElements(p.elements,p.from),r.setElement(p.elements,d),1===M)return t._qualityStat(s,r),"continue";var D=1===n[e].isModified,E=t._groupModule.getModule(Kn);if(E.isMessageSentByCurrentInstance(r)?r.isModified=D:D=!1,1===p.onlineOnlyFlag)r._onlineOnlyFlag=!0,E.isMessageSentByCurrentInstance(r)||i.push(r);else{if(t._groupModule.isMessageFromCommunityOfTopic(f,v))return i.push(r),"continue";if(!E.pushIntoMessageList(i,r,D))return"continue";t._qualityStat(s,r);var S=r,L=S.conversationID,A=S.sequence,N=E.isRemoteRead({conversationID:L,sequence:A});if(dt(c[L])){var R=0;"in"===r.flow&&(r._isExcludedFromUnreadCount||N||(R=1)),c[L]=a.push({conversationID:L,unreadCount:R,type:dt(y)?r.conversationType:y,subType:r.conversationSubType,lastMessage:r._isExcludedFromLastMessage?"":r})-1}else{var O=c[L];a[O].type=dt(y)?r.conversationType:y,a[O].subType=r.conversationSubType,a[O].lastMessage=r._isExcludedFromLastMessage?"":r,"in"===r.flow&&(r._isExcludedFromUnreadCount||N||a[O].unreadCount++)}}},_=0;_<p;_++)g(_);return{conversationOptionsList:a,messageList:i,AVChatRoomMessageList:u}}},{key:"_qualityStat",value:function(e,t){var n=this._groupModule.getModule(ro);n.addMessageSequence({key:xr,message:t}),e&&t.clientTime>0&&n.addMessageDelay(t.clientTime)}},{key:"onGroupMessageRevoked",value:function(e){var t=this._groupModule.getModule(Kn),n=[],o=null,s=!0;e.dataList.forEach((function(e){var r=e.elements.revokedInfos;dt(r)||r.forEach((function(e){var r=$t(e.topicID)?"GROUP".concat(e.groupID):"GROUP".concat(e.topicID);o=t.revoke(r,e.sequence,e.random);var a=e.revokerInfo&&e.revokerInfo.revoker;if(o)o.revoker=a,n.push(o);else{var i={conversationID:r,to:e.topicID||"",sequence:e.sequence,time:e.time,revoker:a};t.isLastMessageRevoked(i)&&(n.push(i),s=!1)}}))})),0!==n.length&&(t.onMessageRevoked(n),!0===s&&(Ve.l("".concat(this._n,".onGroupMessageRevoked count:").concat(n.length)),this._groupModule.emitOuterEvent(E.MESSAGE_REVOKED,n)))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(v(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 s=v(t.keys()),r=0,a=s.length;r<a;r++)this._groupModule.deleteGroup(s[r])}},{key:"getGroupList",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupList"),o=new jr("getGroupList");Ve.l("".concat(n));var s={introduction:"Introduction",notification:"Notification",createTime:"CreateTime",ownerID:"Owner_Account",lastInfoTime:"LastInfoTime",memberNum:"MemberNum",maxMemberNum:"MaxMemberNum",joinOption:"ApplyJoinOption",inviteOption:"InviteJoinOption",muteAllMembers:"ShutUpAllMember"},r=["Type","Name","FaceUrl","NextMsgSeq","LastMsgTime","AtInfoList","LastRecallTime"],a=[];e&&e.groupProfileFilter&&e.groupProfileFilter.forEach((function(e){s[e]&&r.push(s[e])}));var i=(e||{}).isGroupWithTopicOnly,u=void 0!==i&&i;return this._pagingGetGroupList({limit:50,offset:0,groupBaseInfoFilter:r,groupList:a,isGroupWithTopicOnly:u}).then((function(){Ve.l("".concat(n," ok. count:").concat(a.length," isGroupWithTopicOnly:").concat(u)),u||t._groupListTreeShaking(a),t._groupModule.updateGroupMap(a);var e=t._groupModule.getLocalGroupList().length;o.setNetworkType(t._groupModule.getNetworkType()).setMessage("remote count:".concat(a.length,", after tree shaking, local count:").concat(e,", isGroupWithTopicOnly:").concat(u)).end(),t.tempConversationList&&(t.handleUpdateGroupLastMessage(t.tempConversationList),t.tempConversationList=null),t._groupModule.patchGroupMessageRemindType(),t._groupModule.recomputeUnreadCount(),t._groupModule.emitGroupListUpdate(!0,!u);var s=t._groupModule.getLocalGroupList();if(u){var r=s.filter((function(e){return!0===e.isSupportTopic}));return la({groupList:r})}return t._isPagingGetCompleted=!0,la({groupList:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"isPagingGetCompleted",value:function(){return this._isPagingGetCompleted}},{key:"_pagingGetGroupList",value:function(e){var t=this,n="".concat(this._n,".").concat("_pagingGetGroupList"),o=e.isCommunityRelay,s=void 0!==o&&o,r=e.isGroupWithTopicOnly,a=void 0!==r&&r,i=e.limit,u=e.offset,c=e.groupBaseInfoFilter,l=e.groupList;if(a)return this._pagingGetGroupListWithTopic({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l});var d=new jr("_pagingGetGroupList");return this._groupModule.request({protocolName:ds,requestData:{type:s?k.GRP_COMMUNITY:void 0,memberAccount:this._groupModule.getMyUserID(),limit:i,offset:u,responseFilter:{groupBaseInfoFilter:c,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then((function(e){var o=e.data,r=o.groups,a=void 0===r?[]:r,p=o.totalCount;l.push.apply(l,v(a)),t._handleGroupAtInfoWithoutTopic(s,a);var g=u+i,_=!(p>g),h="offset:".concat(u," totalCount:").concat(p," isCompleted:").concat(_," ")+"currentCount:".concat(l.length," isCommunityRelay:").concat(s);return d.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(h)).end(),s||_?!s&&_?(Ve.l("".concat(n," start to get community list")),u=0,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):s&&!_?(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l,isCommunityRelay:!0})):(Ve.l("".concat(n," ok. totalCount:").concat(l.length)),la({groupList:l})):(u=g,t._pagingGetGroupList({limit:i,offset:u,groupBaseInfoFilter:c,groupList:l}))})).catch((function(e){return 11e3!==e.code&&t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];d.setMessage("isCommunityRelay:".concat(s)).setError(e,o,r).end()})),s?(11e3===e.code&&(d=null,Ve.l("".concat(n," ok. community unavailable"))),_a({groupList:l})):ha(e)}))}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),o=e.limit,s=e.offset,r=e.groupBaseInfoFilter,a=e.groupList,i=new jr("pagingGetGroupListWithTopic");return this._groupModule.request({protocolName:ds,requestData:{type:k.GRP_COMMUNITY,memberAccount:this._groupModule.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:r,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]},isSupportTopic:1}}).then((function(e){var u=e.data,c=u.groups,l=void 0===c?[]:c,d=u.totalCount;a.push.apply(a,v(l));var p=s+o,g=!(d>p),_="offset:".concat(s," totalCount:").concat(d," isCompleted:").concat(g," ")+"currentCount:".concat(a.length);return i.setNetworkType(t._groupModule.getNetworkType()).setMessage("".concat(_)).end(),g?(Ve.l("".concat(n," ok. totalCount:").concat(a.length)),la({groupList:a})):(s=p,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:r,groupList:a}))})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),ha(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),Ve.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," count:").concat(n.length))}},{key:"_cacheGroupMessageAndProbe",value:function(e){var t=this,n=e.groupID,o=e.event,s=e.item;this._cacheGroupMessage(n,{event:o,dataList:[s]}),this._groupModule.getGroupSimplifiedInfo(n).then((function(e){e.type===k.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),Ve.l("".concat(this._n,"._cacheGroupMessageAndProbe groupID:").concat(n))}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,n){var o=this;e&&0!==n.length&&n.forEach((function(e){var n=e.groupID,s=e.groupAtInfoList,r=[];dt(s)||(s.forEach((function(e){r.push(t(t({},e),{},{groupID:n}))})),o._groupModule.getModule(Kn).onNewGroupAtTips({dataList:r}))}))}},{key:"reset",value:function(){this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._getTopicPendingMap.clear(),this._isPagingGetCompleted=!1,this._groupModule.getInnerEmitterInstance().once(va,this._initGroupList,this)}}]),e}(),xa=1,Va=2,Ha=3,Ba=4,Ka=5,Wa=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(Ma,this._onCloudConfigUpdated,this)}return r(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_attr_cache_time");dt(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach((function(e){e.localMainSequence=0}))}},{key:"isGroupAttributesUpdatedNotice",value:function(e){var t=e.to,n=e.elements.newGroupProfile,o=!dt(n)&&!$t(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:"_onGroupAttributesUpdated",value:function(e){var t=this,n=e.groupID,o=e.groupAttributeOption,s=o.mainSequence,r=o.isWithChangedAttributeInfo,a=o.groupAttributeList,i=void 0===a?[]:a,u=o.operationType;if(Ve.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(n," isWithChangedAttributeInfo:").concat(r," operationType:").concat(u)),!dt(u)){this._groupAttributesCopy=this._getCachedAttributes({groupID:n});var c=this._getLocalGroupAttributes(n).localMainSequence;if(1===r&&s-c==1)return this._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:s,groupAttributeList:i,operationType:u}),void this._emitGroupAttributesUpdated(n);if(this._hasLocalGroupAttributes(n)){var l=this._getLocalGroupAttributes(n).avChatRoomKey;this._getGroupAttributes({groupID:n,avChatRoomKey:l}).then((function(){t._emitGroupAttributesUpdated(n)}))}}}},{key:"initGroupAttributesCache",value:function(e){var t=e.groupID,n=e.avChatRoomKey,o=void 0===n?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:o}),Ve.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(o))}},{key:"initGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.groupAttributes,s=this._getLocalGroupAttributes(n),r=s.remoteMainSequence,a=s.avChatRoomKey,i=new jr("initGroupAttributes");return i.setMessage("groupID:".concat(n," avChatRoomKey:").concat(a," mainSequence:").concat(r)),this._groupModule.request({protocolName:qs,requestData:{groupID:n,avChatRoomKey:a,mainSequence:r,groupAttributeList:this._transformGroupAttributes(o)}}).then((function(e){var s=e.data,r=s.mainSequence,a=v(s.groupAttributeList);return a.forEach((function(e){e.value=o[e.key]})),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:r,groupAttributeList:a,operationType:xa}),i.setNetworkType(t._groupModule.getNetworkType()).end(),Ve.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n)),la({groupAttributes:o})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),ha(e)}))}},{key:"setGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),o=e.groupID,s=e.groupAttributes,r=this._getLocalGroupAttributes(o),a=r.remoteMainSequence,i=r.avChatRoomKey,u=r.attributes,c=this._transformGroupAttributes(s);c.forEach((function(e){var t=e.key;e.sequence=0,u.has(t)&&(e.sequence=u.get(t).sequence)}));var l=new jr("setGroupAttributes");return l.setMessage("groupID:".concat(o," groupAttributes:").concat(JSON.stringify(s))),Ve.l("".concat(n,". groupID:").concat(o," mainSequence:").concat(a)),this._groupModule.request({protocolName:xs,requestData:{groupID:o,avChatRoomKey:i,mainSequence:a,groupAttributeList:c}}).then((function(e){var r=e.data,a=r.mainSequence,i=v(r.groupAttributeList);return i.forEach((function(e){e.value=s[e.key]})),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:a,groupAttributeList:i,operationType:Va}),l.setNetworkType(t._groupModule.getNetworkType()).end(),Ve.l("".concat(n," ok.")),la({groupAttributes:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),ha(e)}))}},{key:"deleteGroupAttributes",value:function(e){var t=this,n=e.groupID,o=e.keyList,s=void 0===o?[]:o,r=this._getLocalGroupAttributes(n),a=r.remoteMainSequence,i=r.avChatRoomKey,u=r.attributes,c=v(u.keys()),l=Hs,d=Ha,p={groupID:n,avChatRoomKey:i,mainSequence:a},g=[];s.length>0&&(c=[],l=Vs,d=Ba,s.forEach((function(e){var t=0;u.has(e)&&(t=u.get(e).sequence,c.push(e)),g.push({key:e,sequence:t})})),p.groupAttributeList=g);var _=new jr("deleteGroupAttributes");return _.setMessage("groupID:".concat(n," mainSequence:").concat(a," keyList:").concat(s," protocolName:").concat(l)),this._groupModule.request({protocolName:l,requestData:p}).then((function(e){var o=e.data.mainSequence;return t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:o,groupAttributeList:g,operationType:d}),_.setNetworkType(t._groupModule.getNetworkType()).end(),Ve.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n)),la({keyList:c})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];_.setError(e,o,s).end()})),ha(e)}))}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),o=e.groupID,s=this._getLocalGroupAttributes(o),r=s.avChatRoomKey,a=s.lastUpdateTime,i=s.localMainSequence,u=s.remoteMainSequence,c=new jr("getGroupAttributes");if(c.setMessage("groupID:".concat(o," localMainSequence:").concat(i," remoteMainSequence:").concat(u," keyList:").concat(e.keyList)),Date.now()-a>=this.CACHE_EXPIRE_TIME||i<u)return this._getGroupAttributes({groupID:o,avChatRoomKey:r}).then((function(s){c.setMoreMessage("get attributes from remote. count:".concat(s.length)).setNetworkType(t._groupModule.getNetworkType()).end(),Ve.l("".concat(n," from remote. groupID:").concat(o));var r=t._getCachedAttributes(e);return la({groupAttributes:r})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),ha(e)}));c.setMoreMessage("get attributes from cache").setNetworkType(this._groupModule.getNetworkType()).end(),Ve.l("".concat(n," from cache. groupID:").concat(o));var l=this._getCachedAttributes(e);return _a({groupAttributes:l})}},{key:"_getGroupAttributes",value:function(e){var n=this,o=0;return dt(e.avChatRoomKey)||(o=1),this._groupModule.request({protocolName:Bs,requestData:t(t({},e),{},{groupType:o})}).then((function(t){var o=t.data,s=o.mainSequence,r=o.groupAttributeList,a=v(r);return dt(s)||n._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:s,groupAttributeList:a,operationType:Ka}),Ve.l("".concat(n._n,"._getGroupAttributes ok. groupID:").concat(e.groupID)),r})).catch((function(e){return ha(e)}))}},{key:"_refreshCachedGroupAttributes",value:function(e){var t=e.groupID,n=e.remoteMainSequence,o=e.groupAttributeList,s=e.operationType;if(this._hasLocalGroupAttributes(t)){var r=this._getLocalGroupAttributes(t),a=r.localMainSequence;if(s===Ka||n-a==1)r.remoteMainSequence=n,r.localMainSequence=n,r.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:r,groupAttributeList:o,operationType:s});else{if(a===n)return;r.remoteMainSequence=n}this._groupAttributesMap.set(t,r);var i="operationType:".concat(s," localMainSequence:").concat(a," remoteMainSequence:").concat(n);Ve.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(i))}}},{key:"_getCachedAttributes",value:function(e){var t=e.groupID,n=e.keyList,o=void 0===n?[]:n,s={};if(this._hasLocalGroupAttributes(t)){var r=this._getLocalGroupAttributes(t).attributes;if(o.length>0)o.forEach((function(e){r.has(e)&&(s[e]=r.get(e).value)}));else{var a,i=D(r.keys());try{for(i.s();!(a=i.n()).done;){var u=a.value;s[u]=r.get(u).value}}catch(c){i.e(c)}finally{i.f()}}}return s}},{key:"_updateCachedAttributes",value:function(e){var t=e.groupAttributes,n=e.groupAttributeList,o=e.operationType;o!==Ha?o!==Ba?(o===xa&&t.attributes.clear(),n.forEach((function(e){var n=e.key,o=e.value,s=e.sequence;t.attributes.set(n,{value:o,sequence:s})}))):n.forEach((function(e){t.attributes.delete(e.key)})):t.attributes.clear()}},{key:"_hasLocalGroupAttributes",value:function(e){return this._groupAttributesMap.has(e)}},{key:"_getLocalGroupAttributes",value:function(e){return this._hasLocalGroupAttributes(e)||this.initGroupAttributesCache({groupID:e}),this._groupAttributesMap.get(e)}},{key:"_transformGroupAttributes",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_emitGroupAttributesUpdated",value:function(e){var t=this._getCachedAttributes({groupID:e}),n=this._computeAttrChangedInfo(t),o=n.updatedKeyList,s=n.deletedKeyList;this._groupModule.emitOuterEvent(E.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:o,deletedKeyList:s})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach((function(o){e[o]!==t._groupAttributesCopy[o]&&n.push(o)})),Object.keys(this._groupAttributesCopy).forEach((function(t){dt(e[t])&&o.push(t)})),this._groupAttributesCopy={},Ve.l("".concat(this._n,"._computeAttrChangedInfo update count:").concat(n.length,", delete count:").concat(o.length)),{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}(),Ya="Set",ja="Increase",Ja="Decrease",za=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(Ma,this._onCloudConfigUpdated,this)}return r(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this._groupModule.getCloudConfig("grp_counter_expire_time");dt(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(e){var t=e.to,n=e.elements.groupCounterInfo,o=!1;return $t(n)||(this._onGroupCountersUpdated({groupID:t,groupCounterInfo:n}),o=!0),o}},{key:"_onGroupCountersUpdated",value:function(e){var t=this,n=e.groupID;e.groupCounterInfo.forEach((function(e){var o=e.type,s=e.groupCounterSeq,r=e.counterList,a=void 0===r?[]:r;0!==o&&2!==o||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:a}),a.forEach((function(e){t._groupModule.emitOuterEvent(E.GROUP_COUNTER_UPDATED,{groupID:n,key:e.key,value:e.value})}))),1===o&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:s,counterList:a})})),Ve.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}),Ve.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"setGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(H.GRP_COUNTER))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".setGroupCounters"),o=e.groupID,s=e.counters,r=this._convertObjectToList(s),a=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," count:").concat(r.length),u=new jr("setGroupCounters");return u.setMessage("".concat(i)),Ve.l("".concat(n,". ").concat(i)),this._updateGroupCounters({groupID:o,counterList:r,avChatRoomKey:a,mode:Ya}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),la({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"increaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(H.GRP_COUNTER))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".increaseGroupCounters"),o=e.groupID,s=e.key,r=e.value,a=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," key:").concat(s," value:").concat(r),u=new jr("increaseGroupCounter");u.setMessage("".concat(i)),Ve.l("".concat(n,". ").concat(i));var c=[{key:s,value:r}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:a,mode:ja}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),la({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"decreaseGroupCounter",value:function(e){var t=this;if(!this._groupModule.canIUse(H.GRP_COUNTER))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".decreaseGroupCounter"),o=e.groupID,s=e.key,r=e.value,a=this._getLocalGroupCounters(o).avChatRoomKey,i="groupID:".concat(o," key:").concat(s," value:").concat(r),u=new jr("decreaseGroupCounter");u.setMessage("".concat(i)),Ve.l("".concat(n,". ").concat(i));var c=[{key:s,value:r}];return this._updateGroupCounters({groupID:o,counterList:c,avChatRoomKey:a,mode:Ja}).then((function(e){return u.end(),Ve.l("".concat(n," ok.")),la({counters:e})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getGroupCounters",value:function(e){var t=this;if(!this._groupModule.canIUse(H.GRP_COUNTER))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".getGroupCounters"),o=e.groupID,s=e.keyList,r=void 0===s?[]:s,a=this._getLocalGroupCounters(o),i=a.avChatRoomKey,u=a.lastUpdateTime,c=new jr("getGroupCounters");if(c.setMessage("groupID:".concat(o)),Date.now()-u>=this.EXPIRE_TIME)return this._getRemoteGroupCounters({groupID:o,avChatRoomKey:i}).then((function(e){c.setMoreMessage("from remote. count:".concat(e.length)).end(),Ve.l("".concat(n," from remote. groupID:").concat(o));var s=t._getLocalCounters(o,r);return la({counters:s})})).catch((function(e){return t._groupModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),ha(e)}));c.setMoreMessage("from cache").end(),Ve.l("".concat(n," from cache. groupID:").concat(o));var l=this._getLocalCounters(o,r);return _a({counters:l})}},{key:"_getRemoteGroupCounters",value:function(e){var n=this;return this._groupModule.request({protocolName:Js,requestData:t({},e)}).then((function(t){var o=t.data,s=o.counterList,r=void 0===s?[]:s,a=o.groupCounterSeq;return n._updateLocalGroupCounters({groupID:e.groupID,counterList:r,groupCounterSeq:a}),Ve.l("".concat(n._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),r})).catch((function(e){return ha(e)}))}},{key:"_convertObjectToList",value:function(e){var t=[];return Object.keys(e).forEach((function(n){t.push({key:n,value:e[n]})})),t}},{key:"_updateGroupCounters",value:function(e){var n="".concat(this._n,"._updateGroupCounters"),o=e.groupID,s=e.avChatRoomKey,r=e.mode;return Ve.l("".concat(n,". groupID:").concat(o," avChatRoomKey:").concat(s," mode:").concat(r)),this._groupModule.request({protocolName:js,requestData:t({},e)}).then((function(e){Ve.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 ha(e)}))}},{key:"_hasLocalGroupCounters",value:function(e){return this._groupCountersMap.has(e)}},{key:"_getLocalGroupCounters",value:function(e){return this._hasLocalGroupCounters(e)||this.initGroupCountersCache({groupID:e}),this._groupCountersMap.get(e)}},{key:"_updateLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,s=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var r=this._getLocalGroupCounters(t),a=r.counters,i=r.avChatRoomKey,u=r.groupCounterSeq;if(s>0&&s<u)return;o.forEach((function(e){var t=e.key,n=e.value;a.set(t,n)})),this._groupCountersMap.set(t,{lastUpdateTime:Date.now(),groupCounterSeq:s,counters:a,avChatRoomKey:i})}}},{key:"_deleteLocalGroupCounters",value:function(e){var t=e.groupID,n=e.counterList,o=void 0===n?[]:n,s=e.groupCounterSeq;if(this._hasLocalGroupCounters(t)){var r=this._getLocalGroupCounters(t),a=r.counters,i=r.avChatRoomKey;o.forEach((function(e){a.delete(e.key)})),this._groupCountersMap.set(t,{lastUpdateTime:Date.now(),groupCounterSeq:s,counters:a,avChatRoomKey:i})}}},{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 s,r=D(o.keys());try{for(r.s();!(s=r.n()).done;){var a=s.value;n[a]=o.get(a)}}catch(i){r.e(i)}finally{r.f()}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),e}(),Xa=function(){function e(t){o(this,e);var n=t.manager,s=t.groupID,r=t.onInit,a=t.onSuccess,i=t.onFail;this._n="Polling",this._manager=n,this._groupModule=n._groupModule,this._onInit=r,this._onSuccess=a,this._onFail=i,this._groupID=s,this._timeoutID=-1,this._isRunning=!1,this._protocolName=Us}return r(e,[{key:"start",value:function(){var e=this._groupModule.isLoggedIn();e||(this._protocolName=Ps),Ve.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(){Ve.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}(),Qa={3:!0,4:!0,5:!0,6:!0,17:!0},Za=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 Na(200),this.messageIDLinkedList=new Na(100),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0}return r(e,[{key:"hasJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return this._joinedGroupMap.size>0?v(this._joinedGroupMap.keys()):null}},{key:"_updateRequestData",value:function(e){var n=this._pollingRequestInfoMap.get(e);return e===v(this._pollingInstanceMap.keys())[0]?t(t({},n),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):t(t({},n),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n=t.data,o=n.key,s=n.nextSeq,r=n.rspMsgList,a=n.errorCode,i=n.nextBroadcastSeq,u=n.broadcastMessageList;if(0!==a){var c=this._pollingRequestInfoMap.get(e),l=new jr("longPollingAVError"),d=c?"".concat(c.key,"-").concat(c.startSeq):"requestInfo is undefined";l.setMessage("".concat(e,"-").concat(d,"-").concat(t.errorInfo)).setCode(t.errorCode).setNetworkType(this._groupModule.getNetworkType()).end(!0)}else{if(!this.checkJoinedAVChatRoomByID(e))return;it(o)&&at(s)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:s}),at(i)&&i>this._startBroadcastSeq&&(this._startBroadcastSeq=i),lt(r)&&r.length>0?(r.forEach((function(e){e.to=e.groupID})),this.onMessage(r)):(this._pollingNoMessageCount+=1,this._pollingNoMessageCount===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(this._pollingInterval=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS)),this._onBroadcastMessage(u)}}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e){if(lt(e)&&0!==e.length){0!==this._pollingNoMessageCount&&(this._pollingNoMessageCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL);var t=null,n=[],o=this._getModule(Kn),s=this._getModule(ro),r=e.length;r>1&&e.sort((function(e,t){return e.sequence-t.sequence}));for(var a=this._getModule(Wn),i=0;i<r;i++){var u=this.restoreMessageFromSimplified(e[i]);if(Qa[u.event]){if(6===u.event){if(this._groupModule.isGroupAttributesUpdatedNotice(u))continue;if(this._groupModule.isGroupCountersNotice(u))continue}this.receivedMessageCount+=1,t=this.packMessage(u,u.event);var c=1===u.isModified,l=1===u.isHistoryMessage;if((a.isUnlimitedAVChatRoom()||!this.sequencesLinkedList.has(t.sequence))&&!this.messageIDLinkedList.has(t.ID)){var d=t.conversationID;if(this.receivedMessageCount%50==0?this._getModule(to).detectFirstRound(d,this.sequencesLinkedList.data()):this.receivedMessageCount%80==0&&this._getModule(to).detectSecondRound(d,this.sequencesLinkedList.data()),null!==this.sequencesLinkedList.tail()){var p=this.sequencesLinkedList.tail().value,g=t.sequence-p;g>1&&g<=20?this._getModule(to).onMessageMaybeLost(d,p+1,g-1):g<-1&&g>=-20&&this._getModule(to).onMessageMaybeLost(d,t.sequence+1,Math.abs(g)-1)}this.sequencesLinkedList.set(t.sequence),this.messageIDLinkedList.set(t.ID);var _=!1;if(this._isMessageSentByCurrentInstance(t)?c&&(_=!0,t.isModified=c,o.updateMessageIsModifiedProperty(t)):_=!0,_){if(t.conversationType===k.CONV_SYSTEM&&5===t.payload.operationType&&this._onGroupDismissed(t.payload.groupProfile.groupID),!l&&t.conversationType!==k.CONV_SYSTEM){var h=t.conversationID.replace(k.CONV_GROUP,"");this._pollingInstanceMap.has(h)?this._groupModule.isLoggedIn()&&s.addMessageSequence({key:Hr,message:t}):(t.type!==k.MSG_GRP_TIP&&t.clientTime>0&&s.addMessageDelay(t.clientTime),s.addMessageSequence({key:Vr,message:t}))}n.push(t)}}}else Ve.w("".concat(this._n,".onMessage unknown event:").concat(u.event))}if(0!==n.length){this._groupModule.filterModifiedMessage(n);var f=this.packConversationOption(n);if(f.length>0)this._getModule(Kn).onNewMessage({conversationOptionsList:f,isInstantMessage:!0});Ve.d("".concat(this._n,".onMessage count:").concat(n.length)),this._checkMessageStacked(n);var m=this._groupModule.filterUnmodifiedMessage(n);m.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,m),n.length=0}}}},{key:"isBroadcastOrNormal",value:function(e){return 3===e||17===e}},{key:"isGroupTip",value:function(e){return 4===e||6===e}},{key:"isGroupSystemNotice",value:function(e){return 5===e}},{key:"restoreGroupTipElements",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.groupJoinType||(e.groupJoinType=1);var t=e.operatorInfo,n=void 0===t?{}:t,o=e.operatorID,s=e.userIDList,r=void 0===s?[]:s,a=n.userID,i=void 0===a?o:a,u=n.avatar,c=void 0===u?"":u,l=n.nick,d=void 0===l?"":l;e.operatorInfo={userID:i,avatar:c,nick:d};var p=r.map((function(e){return{userID:e}}));return e.memberInfoList=e.memberInfoList||p,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===k.MSG_CUSTOM){var n=e.content,o=void 0===n?{}:n;e.content=t({data:"",description:"",extension:""},o)}return e}))),(this.isGroupTip(n)||this.isGroupSystemNotice(n))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(n)){e.elements=this.restoreGroupTipElements(e.elements);var o=e.elements,s=void 0===o?{}:o,r=s.operationType,i=s.operatorInfo;if(1===r){var u=[{userID:(void 0===i?{}:i).userID}];s.memberInfoList=s.memberInfoList||u}}if(this.isGroupSystemNotice(n)){var c=e.elements,l=c.memberInfoList,d=c.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),{},a({},o,e.elements[o]))}),{});e.elements=p}return e}},{key:"_onGroupDismissed",value:function(e){Ve.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),this._reportMessageStackedCount<5&&(new jr(t).setNetworkType(this._groupModule.getNetworkType()).setMessage("count:".concat(n," groupID:").concat(v(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1))}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._getModule(Kn).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(e,t){e.currentUser=this._groupModule.getMyUserID(),e.conversationType=5===t?k.CONV_SYSTEM:k.CONV_GROUP,e.isSystemMessage=!!e.isSystemMessage;var n=new ca(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:k.MSG_GRP_TIP,content:t(t({},e.elements),{},{groupProfile:e.groupProfile})}):5===n?{type:k.MSG_GRP_SYS_NOTICE,content:t(t({},e.elements),{},{groupProfile:t(t({},e.groupProfile),{},{groupID:e.groupID})})}:this._getModule(zn).parseElements(e.elements,e.from)}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var o=e[n],s=o.conversationID;if(t.has(s)){var r=t.get(s);r.lastMessage=o,"in"===o.flow&&r.unreadCount++}else t.set(s,{conversationID:o.conversationID,unreadCount:"out"===o.flow?0:1,type:o.conversationType,subType:o.conversationSubType,lastMessage:o})}return v(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(e){var t=e.groupProfile.groupID,n=e.elements.onlineMemberInfo,o=void 0===n?void 0:n;if(!$t(o)){var s=o.onlineMemberNum,r=void 0===s?0:s,a=o.expireTime,i=void 0===a?this.DEFAULT_EXPIRE_TIME:a,u=this._onlineMemberCountMap.get(t)||{},c=Date.now();$t(u)?Object.assign(u,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:c,memberCount:r,expireTime:i}):(u.latestUpdateTime=c,u.memberCount=r),Ve.d("".concat(this._n,"._updateMemberCountByGroupTips info:"),u),this._onlineMemberCountMap.set(t,u)}}},{key:"_onBroadcastMessage",value:function(e){if(!$t(e)){for(var t=[],n=e.length,o=null,s=0;s<n;s++){var r=this.restoreMessageFromSimplified(e[s]);Qa[r.event]?((o=this.packMessage(r,r.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(o.ID)||(t.push(o),this._broadcastMessageIDMap.set(o.ID,1))):Ve.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(r.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 Xa({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),Ve.l("".concat(this._n,".start groupID:").concat(e))}}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck().then((function(){var n=e.longPollingKey,o=e.group,s=o.groupID;return t._joinedGroupMap.set(s,o),t._groupModule.updateGroupMap([o]),t._groupModule.deleteUnjoinedAVChatRoom(s),t._groupModule.emitGroupListUpdate(!0,!1),dt(n)?_a({status:Ze,group:o}):Promise.resolve()}))}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then((function(){var n=e.longPollingKey,o=e.group,s=e.startSeq,r=void 0===s?0:s,a=o.groupID;return t._pollingRequestInfoMap.set(a,{key:n,startSeq:r}),t.start(a),t._groupModule.isLoggedIn()?_a({status:Ze,group:o}):_a({status:Ze})}))}},{key:"_preCheck",value:function(){if(this._getModule(Wn).isUnlimitedAVChatRoom())return Promise.resolve();if(!this.hasJoinedAVChatRoom())return Promise.resolve();var e=m(this._joinedGroupMap.entries().next().value,2),t=e[0],n=e[1];if(this._groupModule.isLoggedIn()){if(!(n.selfInfo.role===k.GRP_MBR_ROLE_OWNER||n.ownerID===this._groupModule.getMyUserID()))return this._groupModule.quitGroup(t);this._groupModule.deleteLocalGroupAndConversation(t)}else this._groupModule.deleteLocalGroupAndConversation(t);return this.reset(t),Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._n,".").concat("joinWithoutAuth"),s=new jr("joinWithoutAuth");return this._groupModule.request({protocolName:ms,requestData:e}).then((function(e){var r=e.data.longPollingKey;if(t._groupModule.probeNetwork().then((function(e){var t=m(e,2);t[0];var o=t[1];s.setNetworkType(o).setMessage("groupID:".concat(n," longPollingKey:").concat(r)).end(!0)})),dt(r))return ha({code:Or.CANNOT_JOIN_NON_AVCHATROOM_WITHOUT_LOGIN});Ve.l("".concat(o," ok. groupID:").concat(n)),t._getModule(Kn).setCompleted("".concat(k.CONV_GROUP).concat(n));var a=new Oa({groupID:n});return t.startRunLoop({group:a,longPollingKey:r}),la({status:Ze})})).catch((function(e){return Ve.e("".concat(o," failed. groupID:").concat(n," error:"),e),t._groupModule.probeNetwork().then((function(t){var o=m(t,2),r=o[0],a=o[1];s.setError(e,r,a).setMessage("groupID:".concat(n)).end(!0)})),ha(e)})).finally((function(){t._groupModule.getModule(jn).reportAtOnce()}))}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return $t(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 la({memberCount:e.memberCount})})).catch((function(e){return ha(e)}))):_a({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount");return this._groupModule.request({protocolName:bs,requestData:{groupID:e}}).then((function(o){var s=t._onlineMemberCountMap.get(e)||{},r=o.data,a=r.onlineMemberNum,i=void 0===a?0:a,u=r.expireTime,c=void 0===u?t.DEFAULT_EXPIRE_TIME:u;Ve.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(c));var l=Date.now();return $t(s)&&(s.lastReqTime=l),t._onlineMemberCountMap.set(e,Object.assign(s,{lastSyncTime:l,latestUpdateTime:l,memberCount:i,expireTime:c})),{memberCount:i}})).catch((function(o){return Ve.w("".concat(n," failed. error:"),o),new jr("_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){dt(e)||(at(e)?this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=e:this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){dt(e)||(at(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){dt(e)||(at(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){dt(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;Ve.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(t)),this._groupModule.deleteLocalGroupAndConversation(t),this.reset(t)}},{key:"restartPolling",value:function(){Ve.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 Ve.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t}},{key:"reset",value:function(e){if(e){Ve.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{Ve.l("".concat(this._n,".reset all"));var n,o=D(this._pollingInstanceMap.values());try{for(o.s();!(n=o.n()).done;){n.value.stop()}}catch(s){o.e(s)}finally{o.f()}this._pollingInstanceMap.clear(),this._joinedGroupMap.clear(),this._pollingRequestInfoMap.clear(),this._onlineMemberCountMap.clear(),this._broadcastMessageIDMap.clear()}this.sequencesLinkedList.reset(),this.messageIDLinkedList.reset(),this.receivedMessageCount=0,this._reportMessageStackedCount=0,this._pollingInterval=this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._pollingNoMessageCount=0}}]),e}(),$a=1,ei=15,ti=function(){function e(t){o(this,e),this._groupModule=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map}return r(e,[{key:"onNewGroupSystemNotice",value:function(e){var t=e.dataList,n=e.isSyncingEnded,o=e.isInstantMessage;Ve.d("".concat(this._n,".onReceiveSystemNotice count:").concat(t.length));var s=this.newSystemNoticeStoredAndSummary({notifiesList:t,isInstantMessage:o}),r=s.eventDataList,a=s.result;r.length>0&&(this._groupModule.getModule(Kn).onNewMessage({conversationOptionsList:r,isInstantMessage:o}),this._onReceivedGroupSystemNotice({result:a,isInstantMessage:o}));o?a.length>0&&this._groupModule.emitOuterEvent(E.MESSAGE_RECEIVED,a):!0===n&&this._clearGroupSystemNotice()}},{key:"newSystemNoticeStoredAndSummary",value:function(e){var n=e.notifiesList,o=e.isInstantMessage,s=null,r=n.length,a=0,i=[],u={conversationID:k.CONV_SYSTEM,unreadCount:0,type:k.CONV_SYSTEM,subType:null,lastMessage:null};for(a=0;a<r;a++){var c=n[a],l=c.groupProfile,d=l.communityType,p=void 0===d?0:d,g=l.topicID,_=void 0===g?void 0:g,h=c.elements,f=h.topicIDList,m=void 0===f?void 0:f,v=h.operationType;if(!(2!==p||$t(_)&&$t(m))){if([17,18,20].includes(v)){this._handleTopicSystemNotice(c);continue}$t(_)||(c.to=_)}if(c.elements.operationType!==ei)c.currentUser=this._groupModule.getMyUserID(),c.conversationType=k.CONV_SYSTEM,c.conversationID=k.CONV_SYSTEM,(s=new ca(c)).setElement({type:k.MSG_GRP_SYS_NOTICE,content:t(t({},c.elements),{},{groupProfile:t({},c.groupProfile)})}),s.isSystemMessage=!0,(1===s.sequence&&1===s.random||2===s.sequence&&2===s.random)&&(s.sequence=yt(),s.random=yt(),s.generateMessageID(),Ve.l("".concat(this._n,".newSystemNoticeStoredAndSummary sequence and random maybe duplicated, regenerate. ID:").concat(s.ID))),this._groupModule.getModule(Kn).pushIntoNoticeResult(i,s)&&(o?u.unreadCount++:s.setIsRead(!0),u.subType=s.conversationSubType)}return u.lastMessage=i[i.length-1],{eventDataList:i.length>0?[u]:[],result:i}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then((function(t){t.forEach((function(t){e.pendencyMap.set("".concat(t.from,"_").concat(t.groupID,"_").concat(t.to),t)}));var n=e._groupModule.getModule(Kn).getLocalMessageList(k.CONV_SYSTEM),o=[];n.forEach((function(t){var n=t.payload,s=n.operatorID,r=n.operationType,a=n.groupProfile;if(r===$a){var i="".concat(s,"_").concat(a.groupID,"_").concat(a.to),u=e.pendencyMap.get(i);u&&at(u.handled)&&0!==u.handled&&o.push(t)}})),e.deleteGroupSystemNotice({messageList:o})}))}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return lt(e.messageList)&&0!==e.messageList.length?(Ve.l("".concat(n," ")+e.messageList.map((function(e){return e.ID}))),this._groupModule.request({protocolName:Gs,requestData:{messageListToDelete:e.messageList.map((function(e){return{from:k.CONV_SYSTEM,messageSeq:e.clientSequence,messageRandom:e.random}}))}}).then((function(){Ve.l("".concat(n," ok"));var o=t._groupModule.getModule(Kn);return e.messageList.forEach((function(e){o.deleteLocalMessage(e)})),la()})).catch((function(e){return Ve.e("".concat(n," error:"),e),ha(e)}))):_a()}},{key:"_getPendencyList",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.type,o=void 0===n?void 0:n,s=t.startTime,r=void 0===s?0:s,a=t.limit,i=void 0===a?20:a;return this._groupModule.request({protocolName:Os,requestData:{type:o,startTime:r,limit:i,handleAccount:this._groupModule.getMyUserID()}}).then((function(t){var n=t.data.pendencyList;return 0!==t.data.nextStartTime?e._getPendencyList({startTime:t.data.nextStartTime}).then((function(e){return[].concat(v(n),v(e))})):n}))}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then((function(t){return e._getPendencyList({type:k.GRP_COMMUNITY}).then((function(n){return t.push.apply(t,v(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})})),_a({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach((function(e){switch(e.payload.operationType){case 1:break;case 2:t._onApplyGroupRequestAgreed(e);break;case 3:break;case 4:t._onMemberKicked(e);break;case 5:t._onGroupDismissed(e);break;case 6:break;case 7:t._onInviteGroup(e);break;case 8:t._onQuitGroup(e);break;case 9:t._onSetManager(e);break;case 10:t._onDeleteManager(e);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(e);break;case 21:t._groupModule.onAVChatRoomMemberBanned(e)}}))}},{key:"_onApplyGroupRequestAgreed",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;if(n){t._groupModule.updateGroupMap([n]);var o=!n.isSupportTopic;t._groupModule.emitGroupListUpdate(!0,o)}}))}},{key:"_onMemberKicked",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onGroupDismissed",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t);var n=this._groupModule._AVChatRoomHandler;n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(e){var t=this,n=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(n)||this._groupModule.getGroupProfile({groupID:n}).then((function(e){var n=e.data.group;n&&(t._groupModule.updateGroupMap([n]),t._groupModule.emitGroupListUpdate())}))}},{key:"_onQuitGroup",value:function(e){var t=e.payload.groupProfile.groupID;this._groupModule.hasLocalGroup(t)&&this._groupModule.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(Hn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(k.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(e){var t=e.payload.groupProfile,n=t.to,o=t.groupID,s=this._groupModule.getModule(Hn).getLocalGroupMemberInfo(o,n);s&&s.updateRole(k.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(e){var t=e.payload.groupProfile.groupID,n=e.payload.messageRemindType;this._groupModule.getModule(Kn).onGroupMessageRemindTypeSynced({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(e){var t=e.groupProfile,n=t.groupID,o=t.topicID,s=e.elements,r=s.operationType,a=s.topicIDList,i=s.messageRemindType,u=this._groupModule.getModule(Bn);17===r?u.onTopicCreated({groupID:n,topicID:o}):18===r?u.onTopicDeleted({groupID:n,topicIDList:a}):20===r&&u.onTopicMessageRemindTypeUpdated({groupID:n,topicID:o,messageRemindType:i})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),e}(),ni=["relayFlag"],oi=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupModule",t._commonGroupHandler=null,t._AVChatRoomHandler=null,t._groupSystemNoticeHandler=null,t._commonGroupHandler=new qa(_(t)),t._groupAttributesHandler=new Wa(_(t)),t._groupCountersHandler=new za(_(t)),t._AVChatRoomHandler=new Za(_(t)),t._groupTipsHandler=new Fa(_(t)),t._groupSystemNoticeHandler=new ti(_(t)),t.groupMap=new Map,t._unjoinedAVChatRoomList=new Map,t._receiptDetailCompleteMap=new Map,t.getInnerEmitterInstance().on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("polling_interval"),t=this.getCloudConfig("polling_interval_plus"),n=this.getCloudConfig("polling_no_msg_count"),o=this.getCloudConfig("polling_simplified_msg");this._AVChatRoomHandler&&(Ve.l("".concat(this._n,"._onCloudConfigUpdated pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o))}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t=this;if(e.conversationType===k.CONV_GROUP){var n=Nt(e.to)?Wt(e.to):e.to;return this.hasLocalGroup(n)?_a():this.getGroupProfile({groupID:n}).then((function(o){var s=o.data.group.type;if(Ve.l("".concat(t._n,".guardForAVChatRoom. groupID:").concat(n," type:").concat(s)),s===k.GRP_AVCHATROOM){var r=Or.MESSAGE_SEND_FAIL_NOT_IN_AVCHATROOM;return ha(new da({code:r,message:t.getErrorMessage(r,e.from,n),data:{message:e}}))}return _a()}))}return _a()}},{key:"checkJoinedAVChatRoomByID",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewGroupMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onNewGroupMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t=this;if(lt(e)){var n=this.getModule(Bn);e.forEach((function(e){var o=e.conversationID.replace(k.CONV_GROUP,"");Nt(o)&&n.updateLastMessage(o,e.lastMessage),t.groupMap.has(o)&&(t.groupMap.get(o).nextMessageSeq=e.lastMessage.sequence+1)}))}}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler&&this._groupTipsHandler.onNewGroupTips(e)}},{key:"onGroupMessageRevoked",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.onGroupMessageRevoked(e)}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onGroupMessageReadNotice",value:function(e){var t=this;e.dataList.forEach((function(e){var n=e.elements.groupMessageReadNotice;if(!dt(n)){var o=t.getModule(Kn);n.forEach((function(e){var n=e.groupID,s=e.topicID,r=void 0===s?void 0:s,a=e.lastMessageSeq;Ve.d("".concat(t._n,".onGroupMessageReadNotice groupID:").concat(n," lastMessageSeq:").concat(a));var i="".concat(k.CONV_GROUP).concat(n),u=!0;$t(r)||(i="".concat(k.CONV_GROUP).concat(r),u=!1),o.updateIsReadAfterReadReport({conversationID:i,lastMessageSeq:a}),o.updateUnreadCount(i,u),o.clearGroupAtInfoList(i,u)}))}}))}},{key:"onReadReceiptList",value:function(e){var t=this;Ve.d("".concat(this._n,".onReadReceiptList options:"),JSON.stringify(e)),e.dataList.forEach((function(e){var n=e.groupProfile,o=e.elements,s=n.groupID,r=t.getModule(Kn),a=o.readReceiptList;r.updateReadReceiptInfo({groupID:s,readReceiptList:a})}))}},{key:"onGroupMessageModified",value:function(e){Ve.d("".concat(this._n,".onGroupMessageModified options:"),JSON.stringify(e));var n=this.getModule(Kn);e.dataList.forEach((function(e){n.onMessageModified(t(t({},e),{},{conversationType:k.CONV_GROUP,to:e.topicID?e.topicID:e.groupID}))}))}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler&&this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new Oa(e))}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.getModule(Kn);e.forEach((function(e){t=e.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(e):(n.groupMap.set(t,new Oa(e)),o.deleteGroupRomaingMessageInfo(t))}));var s,r=this.getMyUserID(),a=D(this.groupMap);try{for(a.s();!(s=a.n()).done;){var i=m(s.value,2)[1];i.selfInfo.userID=r,"Owner"===i.selfInfo.role&&(i.ownerID=r)}}catch(u){a.e(u)}finally{a.f()}this._setStorageGroupList()}},{key:"getStorageGroupList",value:function(){return this.getModule(Yn).getItem("groupMap")}},{key:"_setStorageGroupList",value:function(){var e=this.getLocalGroupList().filter((function(e){var t=e.type;return!Lt(t)})).filter((function(e){return!e.isSupportTopic})).slice(0,20).map((function(e){return{groupID:e.groupID,name:e.name,avatar:e.avatar,type:e.type}}));this.getModule(Yn).setItem("groupMap",e)}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return v(this.groupMap.values())}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=v(this.groupMap).filter((function(e){var t=m(e,2);return t[0],!$t(t[1].lastMessage)}));e.sort((function(e,t){return t[1].lastMessage.lastTime-e[1].lastMessage.lastTime})),this.groupMap=new Map(v(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler&&this._commonGroupHandler.handleUpdateGroupLastMessage(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.getLocalGroupList();if(e&&this.emitOuterEvent(E.GROUP_LIST_UPDATED),t){var o=JSON.parse(JSON.stringify(n)),s=this.getModule(Kn);s.updateConversationGroupProfile(o)}}},{key:"patchGroupMessageRemindType",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Kn),n=0;e.forEach((function(e){!0===t.patchMessageRemindType({ID:e.groupID,isC2CConversation:!1,messageRemindType:e.selfInfo.messageRemindType})&&(n+=1)})),Ve.l("".concat(this._n,".patchGroupMessageRemindType count:").concat(n))}},{key:"recomputeUnreadCount",value:function(){var e=this.getLocalGroupList(),t=this.getModule(Kn);e.forEach((function(e){var n=e.groupID,o=e.selfInfo,s=o.excludedUnreadSequenceList,r=o.readedSequence;if(lt(s)){var a=0;s.forEach((function(t){t>=r&&t<=e.nextMessageSeq-1&&(a+=1)})),a>=1&&t.recomputeGroupUnreadCount({conversationID:"".concat(k.CONV_GROUP).concat(n),count:a})}}))}},{key:"getMyNameCardByGroupID",value:function(e){var t=this.getLocalGroupProfile(e);return t?t.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return!!this._commonGroupHandler&&this._commonGroupHandler.isPagingGetCompleted()}},{key:"getGroupList",value:function(e){return this._commonGroupHandler?this._commonGroupHandler.getGroupList(e):_a()}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),o=new jr("getGroupProfile"),s=e.groupID,r=e.groupCustomFieldFilter;Ve.l("".concat(n," groupID:").concat(s));var a={groupIDList:[s],responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],groupCustomFieldFilter:r,memberInfoFilter:["Role","JoinTime","MsgSeq","MsgFlag","NameCard"]}};return this.getGroupProfileAdvance(a).then((function(e){var r,a=e.data,i=a.successGroupList,u=a.failureGroupList;if(Ve.l("".concat(n," ok")),u.length>0)return ha(u[0]);(Lt(i[0].type)&&!t.hasLocalGroup(s)?r=new Oa(i[0]):(t.updateGroupMap(i),r=t.getLocalGroupProfile(s)),r.isSupportTopic)||t.getModule(Kn).updateConversationGroupProfile([r]);return o.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," type:").concat(r.type," muteAllMembers:").concat(r.muteAllMembers," ownerID:").concat(r.ownerID)).end(),la({group:r})})).catch((function(s){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(s,r,a).setMessage("groupID:".concat(e.groupID)).end()})),Ve.e("".concat(n," failed. error:"),s),ha(s)}))}},{key:"getGroupProfileAdvance",value:function(e){var n="".concat(this._n,".getGroupProfileAdvance"),o=e.groupIDList;lt(o)&&o.length>50&&(this.outputWarning("GetGroupProfileLimit"),o.length=50);var s=[],r=[];o.forEach((function(e){At({groupID:e})?r.push(e):s.push(e)}));var a=[];if(s.length>0){var i=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:s}));a.push(i)}if(r.length>0){var u=this._getGroupProfileAdvance(t(t({},e),{},{groupIDList:r,relayFlag:s.length>0}));a.push(u)}return Promise.all(a).then((function(e){var t=[],n=[];return e.forEach((function(e){t.push.apply(t,v(e.successGroupList)),n.push.apply(n,v(e.failureGroupList))})),la({successGroupList:t,failureGroupList:n})})).catch((function(e){return Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=void 0!==n&&n,s=g(e,ni);return this.request({protocolName:ps,requestData:s}).then((function(e){Ve.l("".concat(t._n,"._getGroupProfileAdvance ok."));var n=e.data.groups;return{successGroupList:n.filter((function(e){return dt(e.errorCode)||0===e.errorCode})),failureGroupList:n.filter((function(e){return e.errorCode&&0!==e.errorCode})).map((function(e){return new da({code:e.errorCode,message:e.errorInfo,data:{groupID:e.groupID}})}))}})).catch((function(t){return o&&At({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:ha(t)}))}},{key:"createGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("createGroup"),s=e.type,r=e.groupID;if(e.name&&!1===this._filterProfanity("name",e))return ha({code:Or.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return ha({code:Or.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return ha({code:Or.PROFANITY_FOUND});if(!["Public","Private","ChatRoom","AVChatRoom","Community"].includes(s))return ha({code:Or.ILLEGAL_GROUP_TYPE});if(!At({type:s})){if(!$t(r)&&At({groupID:r}))return ha({code:Or.ILLEGAL_GROUP_ID});e.isSupportTopic=void 0}if(Lt(s)&&!dt(e.memberList)&&e.memberList.length>0&&(e.memberList=void 0),this._canIUseJoinOption(s)||dt(e.joinOption)||(e.joinOption=void 0),At({type:s})){if(!$t(r)&&!At({groupID:r}))return ha({code:Or.ILLEGAL_GROUP_ID});e.isSupportTopic=!0===e.isSupportTopic?1:0}var a=new jr("createGroup");Ve.l("".concat(o," options:"),e);var i=null,u=[];return this.request({protocolName:gs,requestData:t(t({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then((function(s){var r=s.data,c=r.groupID,l=r.overLimitUserIDList,d=void 0===l?[]:l;if(i=c,u=d,a.setNetworkType(n.getNetworkType()).setMessage("groupType:".concat(e.type," groupID:").concat(c," overLimitUserIDList=").concat(d)).end(),Ve.l("".concat(o," ok groupID:").concat(c," overLimitUserIDList:"),d),e.type===k.GRP_AVCHATROOM)return n.getGroupProfile({groupID:c});if(e.type===k.GRP_COMMUNITY&&1===e.isSupportTopic)return n.getGroupProfile({groupID:c});$t(e.memberList)||$t(d)||(e.memberList=e.memberList.filter((function(e){return-1===d.indexOf(e.userID)}))),n.updateGroupMap([t(t({},e),{},{groupID:c})]);var p=n.getModule(bn),g=p.createCustomMessage({to:c,conversationType:k.CONV_GROUP,payload:{data:"group_create",extension:n.isIntl()?"".concat(n.getMyUserID()," created a group"):"".concat(n.getMyUserID(),"创建群组")}});return p.sendMessageInstance(g),n.emitGroupListUpdate(),n.getGroupProfile({groupID:c})})).then((function(e){var t=e.data.group,n=t.selfInfo,o=n.nameCard,s=n.joinTime;return t.updateSelfInfo({nameCard:o,joinTime:s,messageRemindType:k.MSG_REMIND_ACPT_AND_NOTE,role:k.GRP_MBR_ROLE_OWNER}),la({group:t,overLimitUserIDList:u})})).catch((function(s){if(a.setMessage("groupType:".concat(e.type)),n.probeNetwork().then((function(e){var t=m(e,2),n=t[0],o=t[1];a.setError(s,n,o).end()})),10010===s.code||10007===s.code){n.updateGroupMap([t(t({},e),{},{groupID:i})]);var r=n.getLocalGroupProfile(i);return Ve.l("".concat(o," success, but failed to get group profile.")),la({group:r,overLimitUserIDList:u})}return Ve.e("".concat(o," failed. error:"),s),ha(s)}))}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup");if(this.hasLocalGroup(e)&&this.getLocalGroupProfile(e).type===k.GRP_WORK)return ha(new da({code:Or.CANNOT_DISMISS_WORK}));var o=new jr("dismissGroup");return o.setMessage("groupID:".concat(e)),Ve.l("".concat(n," groupID:").concat(e)),this.request({protocolName:_s,requestData:{groupID:e}}).then((function(){return o.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),la({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(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)||dt(e.joinOption)||(Ve.w("".concat(n," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)}if(dt(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&!1===this._filterProfanity("name",e))return ha({code:Or.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return ha({code:Or.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return ha({code:Or.PROFANITY_FOUND});var s=new jr("updateGroupProfile");return s.setMessage(JSON.stringify(e)),Ve.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:hs,requestData:e}).then((function(){(s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.hasLocalGroup(e.groupID))&&(t.groupMap.get(e.groupID).updateGroup(e),t._setStorageGroupList());return la({group:t.groupMap.get(e.groupID)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.l("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(uo);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,r=o.modifiedText;return!0===s&&(t[e]=r,!0)}},{key:"joinGroup",value:function(e){var t=this,n=e.groupID,o=e.type,s="".concat(this._n,".joinGroup");if(o===k.GRP_WORK)return ha({code:Or.CANNOT_JOIN_WORK});if(this.deleteUnjoinedAVChatRoom(n),this.hasLocalGroup(n)){if(!this.isLoggedIn())return _a({status:k.JOIN_STATUS_ALREADY_IN_GROUP});var r=new jr("applyJoinGroup");return this.getGroupProfile({groupID:n}).then((function(){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," joinedStatus:").concat(k.JOIN_STATUS_ALREADY_IN_GROUP)).end(),_a({status:k.JOIN_STATUS_ALREADY_IN_GROUP})})).catch((function(o){return r.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," unjoined")).end(),Ve.w("".concat(s," ").concat(n," was unjoined, now join!")),t.groupMap.delete(n),t.applyJoinGroup(e)}))}return Ve.l("".concat(s," groupID:").concat(n)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e)}},{key:"applyJoinGroup",value:function(e){var n=this,o="".concat(this._n,".").concat("applyJoinGroup"),s=e.groupID;if(!$t(e.applyMessage)&&!1===this._filterProfanity("applyMessage",e))return ha({code:Or.PROFANITY_FOUND});var r=new jr("applyJoinGroup"),a=t({},e),i=this.canIUse(H.AVCHATROOM_HISTORY_MSG);return i&&(a.historyMessageFlag=1),this.getModule(Kn).deleteTopicRoamingMessageInfo(s),this.request({protocolName:fs,requestData:a}).then((function(e){var t=e.data,a=t.joinedStatus,u=t.longPollingKey,c=t.startSeq,l=t.avChatRoomFlag,d=t.avChatRoomKey,p=t.messageList,g="groupID:".concat(s," joinedStatus:").concat(a," longPollingKey:").concat(u," startSeq:").concat(c)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMessage:").concat(i,",")+" history message count:".concat($t(p)?0:p.length);switch(r.setNetworkType(n.getNetworkType()).setMessage("".concat(g)).end(),Ve.l("".concat(o," ok. ").concat(g)),a){case $e:return la({status:$e});case Ze:return n.getGroupProfile({groupID:s}).then((function(e){var t=e.data.group;return n._handleJoinResult({group:t,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:d,messageList:p})})).catch((function(){var e=new Oa({groupID:s});return n._handleJoinResult({group:e,avChatRoomFlag:l,longPollingKey:u,startSeq:c,avChatRoomKey:d,messageList:p})}));default:var _=new da({code:Or.JOIN_GROUP_FAIL});return Ve.e("".concat(o," failed. error:"),_),ha(_)}})).catch((function(e){return r.setMessage("groupID:".concat(s)),n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"_handleJoinResult",value:function(e){var t,n=this,o=e.group,s=e.avChatRoomFlag,r=e.longPollingKey,a=e.startSeq,i=e.avChatRoomKey,u=e.messageList,c=o.groupID;return 1===s?(this.getModule(Kn).setCompleted("".concat(k.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:i}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:i}),(t=dt(r)?this._AVChatRoomHandler.handleJoinResult({group:o}):this._AVChatRoomHandler.startRunLoop({group:o,longPollingKey:r,startSeq:a})).then((function(){n._onAVChatRoomHistoryMessage(u)})),t):(this.emitGroupListUpdate(!0,!1),la({status:Ze,group:o}))}},{key:"quitGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("quitGroup");Ve.l("".concat(n," groupID:").concat(e));var o=this.checkJoinedAVChatRoomByID(e);if(!o&&!this.hasLocalGroup(e))return ha({code:Or.MEMBER_NOT_IN_GROUP});if(o&&!this.isLoggedIn())return Ve.l("".concat(n," anonymously ok. groupID:").concat(e)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),_a({groupID:e});var s=new jr("quitGroup");return s.setMessage("groupID:".concat(e)),this.request({protocolName:vs,requestData:{groupID:e}}).then((function(){return s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),o&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),la({groupID:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"searchGroupByID",value:function(e){var t=this,n="".concat(this._n,".").concat("searchGroupByID"),o={groupIDList:[e]},s=new jr("searchGroupByID");return s.setMessage("groupID:".concat(e)),Ve.l("".concat(n," groupID:").concat(e)),this.request({protocolName:Ms,requestData:o}).then((function(e){var o=e.data.groupProfile;if(0!==o[0].errorCode)throw new da({code:o[0].errorCode,message:o[0].errorInfo});return s.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),la({group:new Oa(o[0])})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.w("".concat(n," failed. error:"),e),ha(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===k.GRP_AVCHATROOM)return ha({code:Or.CANNOT_CHANGE_OWNER_IN_AVCHATROOM});if(e.newOwnerID===this.getMyUserID())return ha({code:Or.CANNOT_CHANGE_OWNER_TO_SELF});var o=new jr("changeGroupOwner");return o.setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),Ve.l("".concat(n," groupID:").concat(e.groupID)),this.request({protocolName:ys,requestData:e}).then((function(){o.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=e.groupID,r=e.newOwnerID;t.groupMap.get(s).ownerID=r;var a=t.getModule(Hn).getLocalGroupMemberList(s);if(a instanceof Map){var i=a.get(t.getMyUserID());dt(i)||(i.updateRole("Member"),t.groupMap.get(s).selfInfo.role="Member");var u=a.get(r);dt(u)||u.updateRole("Owner")}return t.emitGroupListUpdate(!0,!1),la({group:t.groupMap.get(s)})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,s,r,a=this,i="".concat(this._n,".").concat("handleGroupApplication"),u=e.handleAction,c=e.handleMessage,l=e.message,d=e.application;l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,s=l.payload.messageKey):d&&(t=d.applicant,n=d.groupID,o=d.authentication,s=d.messageKey);var p=Is;d&&2===d.applicationType&&(p=Cs,r=d.userID);var g=new jr("handleGroupApplication");return g.setMessage("groupID:".concat(n)),Ve.l("".concat(i," groupID:").concat(n)),this.request({protocolName:p,requestData:{handleAction:u,handleMessage:c,applicant:t,invitee:r,groupID:n,authentication:o,messageKey:s}}).then((function(){return g.setNetworkType(a.getNetworkType()).end(),Ve.l("".concat(i," ok")),l&&a._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),la({group:a.getLocalGroupProfile(n)})})).catch((function(e){return a.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];g.setError(e,o,s).end()})),Ve.e("".concat(i," failed. error"),e),ha(e)}))}},{key:"handleGroupInvitation",value:function(e){var n=this,o="".concat(this._n,".").concat("handleGroupInvitation"),s=e.message.payload,r=s.groupProfile.groupID,a=s.authentication,i=s.messageKey,u=s.operatorID,c=e.handleAction,l=new jr("handleGroupInvitation");return l.setMessage("groupID:".concat(r," inviter:").concat(u," handleAction:").concat(c)),Ve.l("".concat(o," groupID:").concat(r," inviter:").concat(u," handleAction:").concat(c)),this.request({protocolName:Ts,requestData:t(t({},e),{},{inviter:u,groupID:r,authentication:a,messageKey:i})}).then((function(){return l.setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),la({group:n.getLocalGroupProfile(r)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error"),e),ha(e)}))}},{key:"getGroupOnlineMemberCount",value:function(e){return this._AVChatRoomHandler?this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)?this._AVChatRoomHandler.getGroupOnlineMemberCount(e):_a({memberCount:0}):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e);(Ve.l("".concat(this._n,".deleteLocalGroupAndConversation isJoinedAVChatRoom:").concat(t)),t)&&this.getModule(Kn).deleteLocalConversation("".concat(k.CONV_GROUP).concat(e));if(At({groupID:e})){var n=this.getLocalGroupProfile(e);if(n&&!0===n.isSupportTopic)this.getModule(Bn).deleteTopicListInCommunity(e)}this._deleteLocalGroup(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this.getModule(Hn).deleteGroupMemberList(e),this._setStorageGroupList()}},{key:"sendMessage",value:function(e,t){if(lt(e._receiverList)&&e._receiverList.length>0&&!this.canIUse(H.MSG_TO_SPECIFIED_GRP_MBR))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n=this.createGroupMessagePack(e,t);return this.request(n)}},{key:"createGroupMessagePack",value:function(e,t){var n=null;t&&t.offlinePushInfo&&(n=t.offlinePushInfo);var o="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(o=e.cloudCustomData);var s=[];if(ct(t)&&ct(t.messageControlInfo)){var r=t.messageControlInfo,a=r.excludedFromUnreadCount,i=r.excludedFromLastMessage,u=r.excludedFromContentModeration;!0===a&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c=void 0;lt(e._receiverList)&&e._receiverList.length>0&&(c=e._receiverList,e._receiverList.length>50&&(c=e._receiverList.slice(0,50),this.outputWarning("ReceiverListLimit")));var l=this.isOnlineMessage(e,t)?1:0,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!==k.MSG_TEXT||$t(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?s:void 0,needReadReceipt:!0!==e.needReadReceipt||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:c,isSupportExtension:!0===e.isSupportExtension?1:0};return Nt(e.to)&&(p.groupID=Wt(e.to),p.topicID=e.to),{protocolName:Io,tjgID:this.generateTjgID(e),requestData:p}}},{key:"_isVoipPush",value:function(e){var t=void 0;return dt(e.disableVoipPush)||(t=!1===e.disableVoipPush?1:0),t}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return Nt(e.to)&&(t.groupID=Wt(e.to),t.topicID=e.to),this.request({protocolName:Ds,requestData:t})}},{key:"deleteMessage",value:function(e){var t=e.to,n=e.keyList;Ve.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(n.length));var o={groupID:t,deleter:this.getMyUserID(),keyList:n};return Nt(t)&&(o.groupID=Wt(t),o.topicID=t),this.request({protocolName:ws,requestData:o})}},{key:"modifyRemoteMessage",value:function(e){var t=e.to,n=e.sequence,o=e.payload,s=e.type,r=e.version,a=void 0===r?0:r,i=e.cloudCustomData,u=t,c=void 0;Nt(t)&&(u=Wt(t),c=t);var l=void 0;return jt(s)&&(l=[]).push({type:s,content:o}),this.request({protocolName:Fs,requestData:{groupID:u,topicID:c,sequence:n,version:a,elements:l,cloudCustomData:i}})}},{key:"getRoamingMessage",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessage"),o=e.conversationID,s=e.groupID,r=e.sequence,a=new jr("getGroupRoamingMessages"),i=0,u=void 0;return Nt(s)&&(s=Wt(u=s)),this._computeLastSequence({groupID:s,topicID:u,sequence:r}).then((function(e){return i=e,Ve.l("".concat(n," groupID:").concat(s," startSequence:").concat(i)),t.request({protocolName:Ss,requestData:{groupID:s,count:21,sequence:i,topicID:u}})})).then((function(e){var r=e.data,c=r.messageList,l=r.complete,d=r.invisibleSequenceList,p=void 0===d?[]:d;dt(c)?Ve.l("".concat(n," ok. complete:").concat(l," but messageList is undefined!")):Ve.l("".concat(n," ok. complete:").concat(l," count:").concat(c.length));var g=t._getMinSequence(p,c)-1;a.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(i," complete:").concat(l," nextSequence:").concat(g)).end();var _=t.getModule(Kn),h=[];return $t(c)||(_.updateRoamingMessageSequence(o,g),h=_.onRoamingMessage(c,o),_.updateIsRead(o),_.patchConversationLastMessage(o)),(2===l||g<=1)&&(_.setCompleted(o),g=""),Ve.l("".concat(n," nextReqID:").concat(g,", stored message count:").concat(h.length,", invisible sequence count:").concat(p.length)),{nextReqID:g+"",storedMessageList:h}})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];a.setError(e,o,r).setMessage("groupID:".concat(s," topicID:").concat(u," startSequence:").concat(i)).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(k.CONV_GROUP,"")}},{key:"_getMinSequence",value:function(e,t){var n=0;$t(t)||(n=t[t.length-1].sequence);var o=0;$t(e)||(o=e[e.length-1]);return Ve.l("".concat(this._n,"._getMinSequence minVisibleSequence:").concat(n," minInvisibleSequence:").concat(o)),o>0&&o<n?o:n}},{key:"getReadReceiptList",value:function(e){var t=this,n="".concat(this._n,".").concat("getReadReceiptList"),o=this._getGroupIDOfMessage(e[0]),s=this.getMyUserID(),r=e.filter((function(e){return e.from===s&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));if(Ve.l("".concat(n," groupID:").concat(o," sequenceList:").concat(JSON.stringify(r))),0===r.length)return _a({messageList:e});var a=new jr("getReadReceiptList");return a.setMessage("groupID:".concat(o)),this.request({protocolName:Ls,requestData:{groupID:o,sequenceList:r}}).then((function(t){a.end(),Ve.l("".concat(n," ok"));var o=t.data.readReceiptList;return lt(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)}))})),la({messageList:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"sendReadReceipt",value:function(e){var t=this,n="".concat(this._n,".").concat("sendReadReceipt"),o=this._getGroupIDOfMessage(e[0]),s=new jr("sendReadReceipt");s.setMessage("groupID:".concat(o));var r=this.getMyUserID(),a=e.filter((function(e){return e.from!==r&&!0===e.needReadReceipt})).map((function(e){return{sequence:e.sequence}}));return 0===a.length?ha({code:Or.READ_RECEIPT_MESSAGE_LIST_EMPTY}):(Ve.l("".concat(n,". sequenceList:").concat(JSON.stringify(a))),this.request({protocolName:As,requestData:{groupID:o,sequenceList:a}}).then((function(e){return s.end(),Ve.l("".concat(n," ok")),la()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)})))}},{key:"getReadReceiptDetail",value:function(e){var t=this,n=e.message,o=e.filter,s=e.cursor,r=e.count,a=this._getGroupIDOfMessage(n),i=n.ID,u=n.sequence,c="".concat(this._n,".").concat("getReadReceiptDetail"),l=this._receiptDetailCompleteMap.get(i)||!1,d=0!==o&&1!==o?0:o,p=it(s)?s:"",g=!at(r)||r<=0||r>=100?100:r,_="groupID:".concat(a," sequence:").concat(u," cursor:").concat(p," filter:").concat(d," completeFlag:").concat(l);Ve.l("".concat(c," ").concat(_));var h={cursor:"",isCompleted:!1,messageID:i,unreadUserIDList:[],readUserIDList:[]},f=new jr("getReadReceiptDetail");return f.setMessage(_),this.request({protocolName:Rs,requestData:{groupID:a,sequence:u,flag:d,cursor:p,count:g}}).then((function(e){f.end();var n=e.data,o=n.cursor,s=n.isCompleted,r=n.unreadUserIDList,a=n.readUserIDList;return h.cursor=o,1===s&&(h.isCompleted=!0,t._receiptDetailCompleteMap.set(i,!0)),0===d?h.readUserIDList=a.map((function(e){return e.userID})):1===d&&(h.unreadUserIDList=r.map((function(e){return e.userID}))),Ve.l("".concat(c," ok")),la(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];f.setError(e,o,s).end()})),Ve.w("".concat(c," failed. error:"),e),ha(e)}))}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".getRoamingMessagesHopping"),o=new jr("getGroupRoamingMessagesHopping"),s=e.groupID,r=e.count,a=e.sequence,i=e.direction,u=a;1===i&&(u=a+r-1);var c=void 0;Nt(s)&&(s=Wt(c=s));var l="".concat(c?"topicID:".concat(c):"groupID:".concat(s)," sequence:").concat(a," direction:").concat(i);return Ve.l("".concat(n," ").concat(l)),this.request({protocolName:Ss,requestData:{groupID:s,topicID:c,count:r,sequence:u}}).then((function(s){var r=s.data,u=r.messageList,c=r.complete,d="complete:".concat(c," count:").concat(u?u.length:0);if(Ve.l("".concat(n," ok. ").concat(d)),o.setNetworkType(t.getNetworkType()).setMessage("".concat(l," ").concat(d)).end(),2===c||$t(u)){var p=t._computeResult();return la(p)}var g="".concat(k.CONV_GROUP).concat(e.groupID),_=t.getModule(Kn).onRoamingMessage(u,g,!1),h=t._computeResult({direction:i,sequence:a,remoteMessageList:u,processedMessageList:_});return la(h)})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),i=n[0],u=n[1];o.setError(e,i,u).setMessage("groupID:".concat(s," sequence:").concat(a," count:").concat(r)).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_computeResult",value:function(e){var t={messageList:[],isCompleted:!1,nextMessageSeq:""};if(dt(e))return t.isCompleted=!0,t;var n=e.direction,o=e.sequence,s=e.remoteMessageList,r=void 0===s?[]:s,a=e.processedMessageList,i=void 0===a?[]:a,u=r.length;return 1===n?(t.nextMessageSeq=r[0].sequence+1,i.forEach((function(e){e.sequence>=o&&t.messageList.push(e)})),0===t.messageList.length&&r[0].sequence<o&&(t.isCompleted=!0,t.nextMessageSeq=""),t):(t.nextMessageSeq=r[u-1].sequence-1,t.messageList=v(i),0===t.nextMessageSeq&&(t.isCompleted=!0,t.nextMessageSeq=""),t)}},{key:"setMessageRead",value:function(e){var t=this,n=e.conversationID,o=e.lastMessageSeq,s="".concat(this._n,".setMessageRead");Ve.l("".concat(s," conversationID:").concat(n," lastMessageSeq:").concat(o)),at(o)||this.outputWarning("DoNotModifyLastSeq");var r=new jr("setGroupMessageRead");r.setMessage("".concat(n,"-").concat(o));var a=n.replace(k.CONV_GROUP,""),i=void 0;return Nt(a)&&(a=Wt(i=a)),this.request({protocolName:Es,requestData:{groupID:a,topicID:i,messageReadSeq:o}}).then((function(){r.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(s," ok."));var e=t.getModule(Kn);e.updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:o});var u=!0;if(!dt(i)){u=!1;var c=t.getModule(Bn).getLocalTopic(a,i);c&&c.updateSelfInfo({readedSequence:o})}return e.updateUnreadCount(n,u),la()})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.l("".concat(s," failed. error:"),e),ha(e)}))}},{key:"_computeLastSequence",value:function(e){var t=e.groupID,n=e.topicID,o=void 0===n?void 0:n,s=e.sequence;return s>0?Promise.resolve(s):dt(o)||this.hasLocalGroup(t)?dt(o)?this.getGroupLastSequence(t):this.getTopicLastSequence({groupID:t,topicID:o}):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupLastSequence"),o=new jr("getGroupLastSequence"),s=0,r="";if(this.hasLocalGroup(e)){var a=this.getLocalGroupProfile(e),i=a.lastMessage;if(i.lastSequence>0&&!1===i.onlineOnlyFlag)return s=i.lastSequence,r="got lastSequence:".concat(s," from local group profile[lastMessage.lastSequence]. groupID:").concat(e),Ve.l("".concat(n," ").concat(r)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(r)).end(),Promise.resolve(s);if(a.nextMessageSeq>1)return s=a.nextMessageSeq-1,r="got lastSequence:".concat(s," from local group profile[nextMessageSeq]. groupID:").concat(e),Ve.l("".concat(n," ").concat(r)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(r)).end(),Promise.resolve(s)}var u="GROUP".concat(e),c=this.getModule(Kn).getLocalConversation(u);if(c&&c.lastMessage.lastSequence&&!1===c.lastMessage.onlineOnlyFlag)return s=c.lastMessage.lastSequence,r="got lastSequence:".concat(s," from local conversation profile[lastMessage.lastSequence]. groupID:").concat(e),Ve.l("".concat(n," ").concat(r)),o.setNetworkType(this.getNetworkType()).setMessage("".concat(r)).end(),Promise.resolve(s);var l={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}};return this.getGroupProfileAdvance(l).then((function(a){var i=a.data.successGroupList;return $t(i)?Ve.l("".concat(n," successGroupList is empty. groupID:").concat(e)):(s=i[0].nextMessageSeq-1,r="got lastSequence:".concat(s," from getGroupProfileAdvance. groupID:").concat(e),Ve.l("".concat(n," ").concat(r))),o.setNetworkType(t.getNetworkType()).setMessage("".concat(r)).end(),s})).catch((function(s){return t.probeNetwork().then((function(t){var n=m(t,2),r=n[0],a=n[1];o.setError(s,r,a).setMessage("get lastSequence failed from getGroupProfileAdvance. groupID:".concat(e)).end()})),Ve.w("".concat(n," failed. error:"),s),ha(s)}))}},{key:"getTopicLastSequence",value:function(e){var t=this,n=e.groupID,o=e.topicID,s="".concat(this._n,".").concat("getTopicLastSequence"),r=new jr("getTopicLastSequence"),a=0,i="",u=this.getModule(Bn);return u.hasLocalTopic(n,o)?(a=u.getLocalTopic(n,o).nextMessageSeq-1,i="get lastSequence:".concat(a," from local topic info[nextMessageSeq]. topicID:").concat(o),Ve.l("".concat(s," ").concat(i)),r.setNetworkType(this.getNetworkType()).setMessage("".concat(i)).end(),Promise.resolve(a)):u.getTopicList({groupID:n,topicIDList:[o]}).then((function(e){var n=e.data.successTopicList;return $t(n)?Ve.l("".concat(s," successTopicList is empty. topicID:").concat(o)):(a=n[0].nextMessageSeq-1,i="get lastSequence:".concat(a," from getTopicList. topicID:").concat(o),Ve.l("".concat(s," ").concat(i))),r.setNetworkType(t.getNetworkType()).setMessage("".concat(i)).end(),a})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),s=n[0],a=n[1];r.setError(e,s,a).setMessage("get lastSequence failed from getTopicList. topicID:".concat(o)).end()})),Ve.w("".concat(s," failed. error:"),e),ha(e)}))}},{key:"isMessageFromOrToAVChatroom",value:function(e){return!!this._AVChatRoomHandler&&this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.hasJoinedAVChatRoom():0}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler?this._AVChatRoomHandler.getJoinedAVChatRoom():[]}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||!0!==t.onlineUserOnly)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==k.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e){if(!$t(e)){Ve.l("".concat(this._n,"._onAVChatRoomHistoryMessage count:").concat(e.length));var n=[];e.forEach((function(e){n.push(t(t({},e),{},{isHistoryMessage:1}))})),this.onAVChatRoomMessage(n)}}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onMessage(e)}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler&&this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{key:"getGroupSimplifiedInfo",value:function(e){var t=this,n=new jr("getGroupSimplifiedInfo"),o={groupIDList:[e],responseFilter:{groupBaseInfoFilter:["Type","Name"]}};return this.getGroupProfileAdvance(o).then((function(o){var s=o.data.successGroupList;return n.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(e," type:").concat(s[0].type)).end(),s[0]})).catch((function(o){t.probeNetwork().then((function(t){var s=m(t,2),r=s[0],a=s[1];n.setError(o,r,a).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&&!$t(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return 2===e&&$t(t)}},{key:"getMessageExtensions",value:function(e,t){return Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.request({protocolName:Ws,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 Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n)),this.request({protocolName:Ks,requestData:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"getGroupNotify",value:function(e){var n=this;if(this.hasLocalGroup(e)){var o=this.getLocalGroupProfile(e),s=o.type,r=o.isSupportTopic;if(!Lt(s)&&!r){var a="".concat(this._n,".getGroupNotify"),i=this._getGroupLastRevokedTime(e),u=1e3*Pe();Ve.l("".concat(a," groupID:").concat(e," type:").concat(s," beginTime:").concat(i," endTime:").concat(u)),this.request({protocolName:Ys,requestData:{type:At({type:s,groupID:e})?k.GRP_COMMUNITY:void 0,groupID:e,beginTime:i,endTime:u}}).then((function(o){var s=o.data,r=s.nextRevokedTime,i=s.notifyList;Ve.l("".concat(a," ok. groupID:").concat(e," nextRevokedTime:").concat(r));var u={dataList:[{elements:{revokedInfos:[]}}]};lt(i)&&i.forEach((function(n){u.dataList[0].elements.revokedInfos.push({groupID:e,sequence:n.sequence,random:n.random,revokerInfo:t({},n.revokerInfo)})})),n.onGroupMessageRevoked(u),0!==r?(n._setGroupLastRevokedTime(e,r),n.getGroupNotify(e)):n._setGroupLastRevokedTime(e,1e3*Pe())})).catch((function(e){Ve.e("".concat(a," failed. error:"),e)}))}}}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler&&this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){if(!e)return-1;var t=this.getLocalGroupProfile(e);return t&&Lt(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return function(e){return e===k.GRP_PUBLIC}(e)||At({type:e})}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler&&this._AVChatRoomHandler.reset()}}]),s}(go),si=function(){function e(t){o(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this._initMember(t)}return r(e,[{key:"_initMember",value:function(e){this.updateMember(e)}},{key:"updateMember",value:function(e){var t=[null,void 0,"",0,NaN];e.memberCustomField&&St(this.memberCustomField,e.memberCustomField),mt(this,e,["memberCustomField","marks"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){dt(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){dt(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&St(this.memberCustomField,e)}}]),e}(),ri=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="GroupMemberModule",t.groupMemberListMap=new Map,t.getInnerEmitterInstance().on(ya,t._onProfileUpdated,_(t)),t}return r(s,[{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=function(e){var o=n[e];t.groupMemberListMap.forEach((function(e){e.has(o.userID)&&e.get(o.userID).updateMember({nick:o.nick,avatar:o.avatar})}))},s=0;s<n.length;s++)o(s)}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(e){var t=this,n=e.groupID,o=e.offset,s=void 0===o?0:o,r=e.count,a=void 0===r?15:r,i=e.filter,u=void 0===i?void 0:i,c="".concat(this._n,".").concat("getGroupMemberList"),l=this.getModule(xn),d=l.hasLocalGroup(n);if(Ve.l("".concat(c," groupID:").concat(n," offset:").concat(s," count:").concat(a," hasLocalGroup:").concat(d)),!d)return _a({memberList:[],offset:0});if(l.getLocalGroupProfile(n).type===k.GRP_AVCHATROOM){if(this.canIUse(H.AVCHATROOM_MBR_LIST))return this._getAVChatRoomMemberList({groupID:n,offset:s,filter:u});this.outputWarning("LiveOnlineMember")}var p=new jr("getGroupMemberList"),g=0,_={groupID:n,limit:a>100?100:a};At({groupID:n})?_.next="".concat(s):(_.offset=s,g=s+a);var h=[];return this.request({protocolName:zs,requestData:_}).then((function(e){var o=e.data,s=o.members,r=o.memberNum,a=o.next,i=void 0===a?void 0:a;if(dt(i)||(g=$t(i)?0:i),!lt(s)||0===s.length)return g=0,Promise.resolve([]);var u=t.getModule(xn);return u.hasLocalGroup(n)&&(u.getLocalGroupProfile(n).memberNum=r),h=t._updateLocalGroupMemberMap(n,s),t.getModule(Fn).getUserProfile({userIDList:s.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})})).then((function(e){var o=e.data;if(!lt(o)||0===o.length)return _a({memberList:[],offset:g});var r=o.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));return t._updateLocalGroupMemberMap(n,r),h.length<a&&(g=0),p.setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(n," offset:").concat(s," count:").concat(a)).end(),Ve.l("".concat(c," ok.")),la({memberList:h,offset:g})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),Ve.e("".concat(c," failed. error:"),e),ha(e)}))}},{key:"_getAVChatRoomMemberList",value:function(e){var t=this,n=e.groupID,o=e.offset,s=e.filter,r="".concat(this._n,".").concat("_getAVChatRoomMemberList"),a=new jr("_getAVChatRoomMemberList");return a.setMessage("groupID:".concat(n," offset:").concat(o," filter:").concat(s)),this.request({protocolName:Xs,requestData:{groupID:n,offset:o,filter:s}}).then((function(e){var o=e.data,s=o.memberList,i=void 0===s?[]:s,u=o.offset,c=void 0===u?0:u;a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(r," ok. member count:").concat(i.length,", next request timestamp:").concat(c));var l=t._updateLocalGroupMemberMap(n,i);return la({memberList:l,offset:c})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(r," failed. error:"),e),ha(e)}))}},{key:"getGroupMemberProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("getGroupMemberProfile"),s=new jr("getGroupMemberProfile");s.setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)),Ve.l("".concat(o," groupID:").concat(e.groupID," userIDList:").concat(e.userIDList.join(","))),e.userIDList.length>50&&(e.userIDList=e.userIDList.slice(0,50));var r=e.groupID,a=e.userIDList;return this._getGroupMemberProfileAdvance(t(t({},e),{},{userIDList:a})).then((function(e){var t=e.data.members;return lt(t)&&0!==t.length?(n._updateLocalGroupMemberMap(r,t),n.getModule(Fn).getUserProfile({userIDList:t.map((function(e){return e.userID})),tagList:[Be.NICK,Be.AVATAR]})):_a([])})).then((function(e){var t=e.data.map((function(e){return{userID:e.userID,nick:e.nick,avatar:e.avatar}}));n._updateLocalGroupMemberMap(r,t);var o=a.filter((function(e){return n.hasLocalGroupMember(r,e)})).map((function(e){return n.getLocalGroupMemberInfo(r,e)}));return s.setNetworkType(n.getNetworkType()).end(),la({memberList:o})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),o=e.groupID,s=this.getModule(xn).getLocalGroupProfile(o),r=s.type,a=new jr("addGroupMember");if(a.setMessage("groupID:".concat(o," groupType:").concat(r)),Lt(r)){var i=new da({code:Or.CANNOT_ADD_MEMBER_IN_AVCHATROOM});return a.setError(i,!0,this.getNetworkType()).end(),ha(i)}return e.userIDList=e.userIDList.map((function(e){return{userID:e}})),Ve.l("".concat(n," groupID:").concat(o)),this.request({protocolName:Zs,requestData:e}).then((function(o){var r=o.data.members;Ve.l("".concat(n," ok"));var i=r.filter((function(e){return 1===e.result})).map((function(e){return e.userID})),u=r.filter((function(e){return 0===e.result})).map((function(e){return e.userID})),c=r.filter((function(e){return 2===e.result})).map((function(e){return e.userID})),l=r.filter((function(e){return 4===e.result})).map((function(e){return e.userID})),d="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(i,", ")+"failureUserIDList:".concat(u,", ")+"existedUserIDList:".concat(c,", ")+"overLimitUserIDList:".concat(l);return a.setNetworkType(t.getNetworkType()).setMoreMessage(d).end(),0===i.length?la({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l}):(s.memberCount+=i.length,t._updateConversationGroupProfile(s),la({successUserIDList:i,failureUserIDList:u,existedUserIDList:c,overLimitUserIDList:l,group:s}))})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,r=this.getModule(xn).getLocalGroupProfile(o);if(dt(r))return ha({code:Or.CANNOT_FIND_GROUP});if(Lt(r.type))return this.canIUse(H.AVCHATROOM_BAN_MBR)?this._banAVChatRoomMember(e):ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var a=new jr("deleteGroupMember"),i="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s));return a.setMessage(i),Ve.l("".concat(n," groupID:").concat(o," userIDList:"),s),this.request({protocolName:$s,requestData:e}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),r.memberCount-=1,t._updateConversationGroupProfile(r),t.deleteLocalGroupMembers(o,s),la({group:r,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_updateConversationGroupProfile",value:function(e){this.getModule(Kn).updateConversationGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteGroupMember"),o=e.groupID,s=e.userIDList,r="groupID:".concat(o," ").concat(s.length>5?"userIDList.length:".concat(s.length):"userIDList:".concat(s)),a=new jr("deleteGroupMember");a.setMessage(r),Ve.l("".concat(n," groupID:").concat(o," userIDList:"),s);var i=this.getModule(xn).getLocalGroupProfile(o);return dt(e.duration)||0===e.duration?ha({code:Or.BAN_DURATION_INVALID}):this.request({protocolName:er,requestData:e}).then((function(){return a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,s),la({group:i,userIDList:s})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"setGroupMemberMuteTime",value:function(e){var t=this,n=e.groupID,o=e.userID,s=e.muteTime,r="".concat(this._n,".").concat("setGroupMemberMuteTime");if(o===this.getMyUserID())return ha(new da({code:Or.CANNOT_MUTE_SELF}));Ve.l("".concat(r," groupID:").concat(n," userID:").concat(o));var a=new jr("setGroupMemberMuteTime");return a.setMessage("groupID:".concat(n," userID:").concat(o," muteTime:").concat(s)),this.modifyGroupMemberInfo({groupID:n,userID:o,muteTime:s}).then((function(e){a.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(r," ok"));var o=t.getModule(xn);return la({group:o.getLocalGroupProfile(n),member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(r," failed. error:"),e),ha(e)}))}},{key:"setGroupMemberRole",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberRole"),o=e.groupID,s=e.userID,r=e.role,a=this.getModule(xn).getLocalGroupProfile(o);if(a.selfInfo.role!==k.GRP_MBR_ROLE_OWNER)return ha({code:Or.NOT_OWNER});if([k.GRP_WORK,k.GRP_AVCHATROOM].includes(a.type))return ha({code:Or.CANNOT_SET_MEMBER_ROLE_IN_WORK_AND_AVCHATROOM});var i=[k.GRP_MBR_ROLE_ADMIN,k.GRP_MBR_ROLE_MEMBER];if(At({groupID:o})&&i.push(k.GRP_MBR_ROLE_CUSTOM),i.indexOf(r)<0)return ha({code:Or.INVALID_MEMBER_ROLE});if(s===this.getMyUserID())return ha({code:Or.CANNOT_SET_SELF_MEMBER_ROLE});var u=new jr("setGroupMemberRole");return u.setMessage("groupID:".concat(o," userID:").concat(s," role:").concat(r)),Ve.l("".concat(n," groupID:").concat(o," userID:").concat(s)),this.modifyGroupMemberInfo({groupID:o,userID:s,role:r}).then((function(e){return u.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok")),la({group:a,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(uo);if(!n)return!0;var o=n.filterText(t[e],X),s=o.isAllowedToSend,r=o.modifiedText;return!0===s&&(t[e]=r,!0)}},{key:"setGroupMemberNameCard",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberNameCard");if(e.nameCard&&!1===this._filterProfanity("nameCard",e))return ha({code:Or.PROFANITY_FOUND});var o=e.groupID,s=e.userID,r=void 0===s?this.getMyUserID():s,a=e.nameCard;Ve.l("".concat(n," groupID:").concat(o," userID:").concat(r));var i=new jr("setGroupMemberNameCard");return i.setMessage("groupID:".concat(o," userID:").concat(r," nameCard:").concat(a)),this.modifyGroupMemberInfo({groupID:o,userID:r,nameCard:a}).then((function(e){Ve.l("".concat(n," ok")),i.setNetworkType(t.getNetworkType()).end();var s=t.getModule(xn).getLocalGroupProfile(o);return r===t.getMyUserID()&&s&&s.setSelfNameCard(a),la({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"setGroupMemberCustomField",value:function(e){var t=this,n="".concat(this._n,".").concat("setGroupMemberCustomField"),o=e.groupID,s=e.userID,r=void 0===s?this.getMyUserID():s,a=e.memberCustomField;Ve.l("".concat(n," groupID:").concat(o," userID:").concat(r));var i=new jr("setGroupMemberCustomField");return i.setMessage("groupID:".concat(o," userID:").concat(r," memberCustomField:").concat(JSON.stringify(a))),this.modifyGroupMemberInfo({groupID:o,userID:r,memberCustomField:a}).then((function(e){i.setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(n," ok"));var s=t.getModule(xn).getLocalGroupProfile(o);return la({group:s,member:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"modifyGroupMemberInfo",value:function(e){var n=this,o=e.groupID,s=e.userID,r=void 0;return Nt(o)&&(o=Wt(r=o)),this.request({protocolName:tr,requestData:t(t({},e),{},{groupID:o,topicID:r})}).then((function(){if(n.hasLocalGroupMember(o,s)){var t=n.getLocalGroupMemberInfo(o,s);return dt(e.muteTime)||t.updateMuteUntil(e.muteTime),dt(e.role)||t.updateRole(e.role),dt(e.nameCard)||t.updateNameCard(e.nameCard),dt(e.memberCustomField)||t.updateMemberCustomField(e.memberCustomField),t}return n.getGroupMemberProfile({groupID:o,userIDList:[s]}).then((function(e){return m(e.data.memberList,1)[0]}))}))}},{key:"markGroupMemberList",value:function(e){var t=this,n="".concat(this._n,".").concat("markGroupMemberList"),o=e.groupID,s=e.markType,r=e.enableMark,a=e.userIDList,i=void 0===a?[]:a,u="groupID:".concat(o," markType:").concat(s," enableMark:").concat(r," userIDList count: ").concat(i.length);Ve.l("".concat(n," ").concat(u));var c=2,l=[];!0===r&&(c=1);var d=v(i);i.length>500&&(d=i.slice(0,500),Ve.w("".concat(n," ").concat(Xt(500)))),d.forEach((function(e){l.push({userID:e,markType:[s]})})),d=null;var p=new jr("markGroupMemberList");return p.setMessage("".concat(u)),this.request({protocolName:nr,requestData:{groupID:o,operationType:c,memberList:l}}).then((function(e){var o=e.data.memberList,s=void 0===o?[]:o,r=[],a=[];s.length===i.length?r.push.apply(r,v(i)):(s.forEach((function(e){r.push(e.userID)})),i.forEach((function(e){r.includes(e)||a.push(e)})));var u="success count:".concat(r.length," fail count:").concat(a.length);return p.setNetworkType(t.getNetworkType()).setMessage(u).end(),Ve.l("".concat(n," ok. ").concat(u)),la({successUserIDList:r,failureUserIDList:a})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];p.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this.request({protocolName:Qs,requestData:t(t({},e),{},{memberInfoFilter:e.memberInfoFilter?e.memberInfoFilter:["Role","JoinTime","NameCard","ShutUpUntil"]})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return lt(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 si(t)),n.getLocalGroupMemberInfo(e,t.userID)})):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach((function(e){n.delete(e)}))}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){if(this.groupMemberListMap.has(e))this.groupMemberListMap.get(e).set(t.userID,t);else{var n=(new Map).set(t.userID,t);this.groupMemberListMap.set(e,n)}}},{key:"getLocalGroupMemberList",value:function(e){return this.groupMemberListMap.get(e)}},{key:"hasLocalGroupMember",value:function(e,t){return this.groupMemberListMap.has(e)&&this.groupMemberListMap.get(e).has(t)}},{key:"hasLocalGroupMemberMap",value:function(e){return this.groupMemberListMap.has(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear()}}]),s}(go),ai=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],ii=function(e,t){return $t(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:Yt(e.type,e.payload,t),nick:e.nick||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}},ui=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=ii(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)}return r(e,[{key:"_initTopic",value:function(e){for(var t in e)ai.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=ii(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){dt(e.selfInfo)||this.updateSelfInfo(e.selfInfo),dt(e.muteAllMembers)||(this.muteAllMembers=1===e.muteAllMembers),mt(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return 0!==mt(this.selfInfo,e,[],[""])}},{key:"reduceUnreadCount",value:function(){return this.unreadCount>=1&&(this.unreadCount-=1,!0)}},{key:"isLastMessageRevoked",value:function(e){return e.sequence===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}}]),e}(),ci=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="TopicModule",t._topicMap=new Map,t._getTopicTimeMap=new Map,t.TOPIC_CACHE_TIME=300,t.TOPIC_LAST_ACTIVE_TIME=3600,t.getInnerEmitterInstance().on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");dt(e)||(this.TOPIC_CACHE_TIME=Number(e)),dt(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOuterEvent(E.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(void 0===o?[]:o).forEach((function(e){t._deleteLocalTopic(n,e)})),this.emitOuterEvent(E.TOPIC_DELETED,e)}},{key:"onTopicMessageRemindTypeUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=e.messageRemindType,s=this.getLocalTopic(t,n);if(s){var r=s.updateSelfInfo({messageRemindType:o});r&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}),Ve.d("".concat(this._n,".onTopicMessageRemindTypeUpdated topicID:").concat(n)+" messageRemindType:".concat(o," isTopicUpdated:").concat(r))}}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,o=this.getLocalTopic(t,n);o&&(o.updateTopic(e),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:o}))}},{key:"onConversationProxy",value:function(e){var t=e.topicID,n=e.unreadCount,o=e.groupAtInfoList,s=Wt(t),r=this.getLocalTopic(s,t),a=!1;r&&(dt(n)||r.unreadCount===n||(r.updateUnreadCount(n),a=!0),dt(o)||(r.updateGroupAtInfoList(o),a=!0)),a&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:s,topic:r})}},{key:"onMessageSent",value:function(e){var t=e.groupID,n=e.topicID,o=e.lastMessage,s=this.getLocalTopic(t,n);s&&(s.nextMessageSeq+=1,s.updateLastMessage(o),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:t,topic:s}))}},{key:"onMessageModified",value:function(e){var t=e.to,n=e.time,o=e.sequence,s=e.elements,r=e.cloudCustomData,a=e.messageVersion,i=Wt(t),u=this.getLocalTopic(i,t);if(u){var c=u.lastMessage;Ve.d("".concat(this._n,".onMessageModified topicID:").concat(t," lastMessage:"),JSON.stringify(c),"options:",JSON.stringify(e)),c&&(null===c.payload||c.lastTime===n&&c.lastSequence===o&&c.version!==a)&&(c.type=s[0].type,c.payload=s[0].content,c.messageForShow=Yt(c.type,c.payload,this.isIntl()),c.cloudCustomData=r,c.version=a,c.lastSequence=o,c.lastTime=n,this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:i,topic:u}))}}},{key:"onMessageRevoked",value:function(e){var t=this;if(0!==e.length){var n=null,o=null,s=!1;e.forEach((function(e){var r=e.to;o=Wt(r),(n=t.getLocalTopic(o,r))&&(n.reduceUnreadCount()&&(s=!0),n.isLastMessageRevoked(e)&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(e.revoker),s=!0))})),s&&this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:o,topic:n})}}},{key:"isLastMessageRevoked",value:function(e){var t=e.topicID,n=e.sequence,o=Wt(t),s=this.getLocalTopic(o,t),r=!1;return s&&(r=s.isLastMessageRevoked({sequence:n})),r}},{key:"getJoinedCommunityList",value:function(){return this.getModule(xn).getGroupList({isGroupWithTopicOnly:!0}).then((function(e){var t=e.data.groupList;return la({groupList:void 0===t?[]:t})})).catch((function(e){return ha(e)}))}},{key:"createTopicInCommunity",value:function(e){var n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),s=e.topicID;if(!dt(s)&&!Nt(s))return ha({code:Or.ILLEGAL_TOPIC_ID});if(e.topicName&&!1===this._filterProfanity("topicName",e))return ha({code:Or.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return ha({code:Or.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return ha({code:Or.PROFANITY_FOUND});var r=new jr("createTopicInCommunity");return this.request({protocolName:Mr,requestData:t({},e)}).then((function(s){var a=s.data.topicID;return r.setMessage("topicID:".concat(a)).setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._updateTopicMap([t(t({},e),{},{topicID:a})]),la({topicID:a})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"deleteTopicFromCommunity",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),o=e.groupID,s=e.topicIDList,r=void 0===s?[]:s,a=new jr("deleteTopicFromCommunity");return a.setMessage("groupID:".concat(o," topicIDList:").concat(r)),this.request({protocolName:yr,requestData:{groupID:o,topicIDList:r}}).then((function(e){var n=e.data.resultList,s=[],r=[];(void 0===n?[]:n).forEach((function(e){var t=e.topicID,n=e.errorCode,o=e.errorInfo;0===n?s.push({topicID:t}):r.push({topicID:t,code:n,message:o})}));var i="success count:".concat(s.length,", fail count:").concat(r.length);return a.setMoreMessage("".concat(i)).setNetworkType(t.getNetworkType()).end(),Ve.l("".concat(i)),s.forEach((function(e){t._deleteLocalTopic(o,e.topicID)})),la({successTopicList:s,failureTopicList:r})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"updateTopicProfile",value:function(e){var n=this,o="".concat(this._n,".").concat("updateTopicProfile");if(Ve.l("".concat(o," options:"),e),e.topicName&&!1===this._filterProfanity("topicName",e))return ha({code:Or.PROFANITY_FOUND});if(e.introduction&&!1===this._filterProfanity("introduction",e))return ha({code:Or.PROFANITY_FOUND});if(e.notification&&!1===this._filterProfanity("notification",e))return ha({code:Or.PROFANITY_FOUND});var s=new jr("updateTopicProfile");return s.setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),dt(e.muteAllMembers)||(e.muteAllMembers=!0===e.muteAllMembers?"On":"Off"),this.request({protocolName:Ir,requestData:t({},e)}).then((function(){return s.setNetworkType(n.getNetworkType()).end(),Ve.l("".concat(o," ok")),n._updateTopicMap([e]),la({topic:n.getLocalTopic(e.groupID,e.topicID)})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"getTopicList",value:function(e){var n=this,o="".concat(this._n,".").concat("getTopicList"),s=e.groupID,r=e.topicIDList,a=void 0===r?[]:r,i=0===a.length,u=new jr("getTopicList");if(u.setMessage("groupID:".concat(s)),this._getTopicTimeMap.has(s)){var c=this._getTopicTimeMap.get(s),l=c.isGetAll,d=c.time;if((l||!l&&!i)&&Date.now()-d<1e3*this.TOPIC_CACHE_TIME){var p=this._getLocalTopicList(s,a);if(i||p.length===a.length)return u.setNetworkType(this.getNetworkType()).setMoreMessage("from cache, topic count:".concat(p.length)).end(),Ve.l("".concat(o," groupID:").concat(s," from cache, topic count:").concat(p.length)),_a({successTopicList:p,failureTopicList:[]})}}return this.request({protocolName:Cr,requestData:{groupID:s,topicIDList:a}}).then((function(e){var r=e.data.topicInfoList,a=[],c=[],l=[];(void 0===r?[]:r).forEach((function(e){var n=e.topic,o=e.selfInfo,s=e.errorCode,r=e.errorInfo,i=n.topicID;0===s?(a.push(t(t({},n),{},{selfInfo:o})),c.push(i)):l.push({topicID:i,code:s,message:r})})),n._updateTopicMap(a),n._handleTopicAtInfo(a);var d="success count:".concat(c.length,", fail count:").concat(l.length);u.setNetworkType(n.getNetworkType()).setMoreMessage("".concat(d)).end(),Ve.l("".concat(o," groupID:").concat(s," from remote, ").concat(d));var p=[];return $t(c)||(n._getTopicTimeMap.set(s,{time:Date.now(),isGetAll:i}),p=n._getLocalTopicList(s,c)),la({successTopicList:p,failureTopicList:l})})).catch((function(e){return n.probeNetwork(e).then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(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=v(n.values())),0===t.length?o:o.filter((function(e){return t.includes(e.topicID)}))}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&(this._topicMap.get(e).delete(t),Ve.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];(e.forEach((function(e){var o=e.groupID,s=e.topicID,r=null;t._topicMap.has(o)||t._topicMap.set(o,new Map),t._topicMap.get(o).has(s)?(r=t._topicMap.get(o).get(s)).updateTopic(e):(t._getTopicLastMessage(e),r=new ui(e,t.isIntl()),t._topicMap.get(o).set(s,r));var a=t._computeUnreadCount(r);r.updateUnreadCount(a),n.push({conversationID:"".concat(k.CONV_GROUP).concat(s),type:k.CONV_TOPIC,unreadCount:a})})),n.length>0)&&this.getModule(Kn).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;dt(e)?v(this._getTopicTimeMap.keys()).forEach((function(e){t._getTopicTimeMap.set(e,0)})):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=v(this._topicMap.keys()),n=[];t.forEach((function(t){var o=[];e._getLocalTopicList(t).forEach((function(t){var n=t.lastMessage.lastTime,s=void 0===n?0:n;Date.now()-1e3*s<1e3*e.TOPIC_LAST_ACTIVE_TIME&&o.push(t.topicID)})),o.length>0&&n.push({groupID:t,topicIDList:o})})),Ve.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t=this;if(0!==e.length){var n=e.shift(),o=n.topicIDList.length>5?"topicIDList.length:".concat(n.topicIDList.length):"topicIDList:".concat(n.topicIDList),s=new jr("relayGetTopicList");s.setMessage(o),Ve.l("".concat(this._n,"._relayGetTopicList. ").concat(o)),this.getTopicList(n).then((function(){s.setNetworkType(t.getNetworkType()).end(),t._relayGetTopicList(e)})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),o=t[0],r=t[1];s.setError(n,o,r).end()})),t._relayGetTopicList(e)}))}}},{key:"_handleTopicAtInfo",value:function(e){var n=this;0!==e.length&&e.forEach((function(e){var o=e.groupID,s=e.topicID,r=e.groupAtInfoList,a=[];dt(r)||(r.forEach((function(e){a.push(t(t({},e),{},{groupID:o,topicID:s}))})),n.getModule(Kn).onNewGroupAtTips({dataList:a}))}))}},{key:"_getTopicLastMessage",value:function(e){if(!dt(e.lastMsg)){var t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:2===e.lastMsg.isPlaceMessage,revoker:$t(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(Kn);n.forEach((function(n){var s=n.topicID;t._deleteLocalTopic(e,s),t._getTopicTimeMap.delete(e),o.deleteLocalConversation("".concat(k.CONV_GROUP).concat(s))}))}},{key:"_computeUnreadCount",value:function(e){var t=e.selfInfo,n=t.excludedUnreadSequenceList,o=t.readedSequence,s=e.nextMessageSeq-e.selfInfo.readedSequence-1;if(lt(n)){var r=0;n.forEach((function(t){t>=o&&t<=e.nextMessageSeq-1&&(r+=1)})),r>=1&&(s-=r)}return s<0?0:s}},{key:"_filterProfanity",value:function(e,t){var n=this.getModule(uo);if(!n)return!0;var o=n.filterText(t[e],z),s=o.isAllowedToSend,r=o.modifiedText;return!0===s&&(t[e]=r,!0)}},{key:"updateLastMessage",value:function(e,t){var n=Wt(e),o=this.getLocalTopic(n,e);if(o){var s=t.sequence+1;o.updateNextMessageSeq(s),o.updateLastMessage(t),this.emitOuterEvent(E.TOPIC_UPDATED,{groupID:n,topic:o})}}},{key:"getMessageExtensions",value:function(e,t){Ve.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=Wt(e.to);return this.request({protocolName:Ws,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;Ve.l("".concat(this._n,".modifyMessageExtensions operateType:").concat(n));var o=Wt(e.to);return this.request({protocolName:Ks,requestData:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}]),s}(go),li=function(){function e(t){o(this,e),this._userModule=t,this._n="ProfileHandler",this.TAG="profile",this.accountProfileMap=new Map,this.expirationTime=864e5}return r(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&&(Ve.w("".concat(n," ").concat(Xt(100))),o.length=100);for(var s,r=[],a=[],i=0,u=o.length;i<u;i++)s=o[i],this._userModule.isMyFriend(s)&&this._contains(s)?a.push(this._getProfileFromMap(s)):r.push(s);if(0===r.length)return _a(a);e.toAccount=r;var c=e.bFromGetMyProfile||!1,l=[];e.toAccount.forEach((function(e){l.push({toAccount:e,standardSequence:0,customSequence:0})})),e.userItem=l;var d=new jr("getUserProfile");return d.setMessage(o.length>5?"userIDList.length:".concat(o.length):"userIDList:".concat(o)),this._userModule.request({protocolName:Co,requestData:e}).then((function(e){d.setNetworkType(t._userModule.getNetworkType()).end(),Ve.i("".concat(n," ok"));var o=t._handleResponse(e).concat(a);return la(c?o[0]:o)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getMyProfile",value:function(){var e=this._userModule.getMyAccount(),t="".concat(this._n,".getMyProfile");if(Ve.l("".concat(t," myAccount:").concat(e)),this._fill(),this._contains(e)){var n=this._getProfileFromMap(e);return Ve.d("".concat(t," from cache, myProfile:").concat(JSON.stringify(n))),_a(n)}return this.getUserProfile({fromAccount:e,userIDList:[e],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!lt(t))return[];for(var n=[],o=Date.now(),s=0,r=t.length;s<r;s++){var a=t[s],i=a.to,u=a.profileItem;if("@TLS#NOT_FOUND"!==i&&""!==i){var c=this._update(i,this._getLatestProfileFromResponse(i,u)).latestProfile;n.push(c)}}return Ve.l("".concat(this._n,"._handleResponse cost ").concat(Date.now()-o," ms")),n}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={userID:e,profileCustomField:[]};if(!$t(t))for(var o=0,s=t.length;o<s;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 Be.NICK:n.nick=t[o].value;break;case Be.GENDER:n.gender=t[o].value;break;case Be.BIRTHDAY:n.birthday=t[o].value;break;case Be.LOCATION:n.location=t[o].value;break;case Be.SELFSIGNATURE:n.selfSignature=t[o].value;break;case Be.ALLOWTYPE:n.allowType=t[o].value;break;case Be.LANGUAGE:n.language=t[o].value;break;case Be.AVATAR:n.avatar=t[o].value;break;case Be.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case Be.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case Be.LEVEL:n.level=t[o].value;break;case Be.ROLE:n.role=t[o].value;break;default:Ve.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 ha({code:Or.PROFANITY_FOUND});if(e.selfSignature&&!1===this._userModule.filterProfanity("selfSignature",e))return ha({code:Or.PROFANITY_FOUND});var o=new jr("updateMyProfile");o.setMessage(JSON.stringify(e));var s=(new La).validate(e);if(!s.valid)return o.setCode(Or.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(s.tips)).setNetworkType(this._userModule.getNetworkType()).end(),Ve.e("".concat(n," info:").concat(s.tips)),ha({code:Or.UPDATE_PROFILE_INVALID_PARAM});var r=[];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&("profileCustomField"===a?e.profileCustomField.forEach((function(e){r.push({tag:e.key,value:e.value})})):r.push({tag:Be[a.toUpperCase()],value:e[a]}));if(0===r.length){var i=new da({code:Or.UPDATE_PROFILE_NO_KEY});return o.setError(i,!0,this._userModule.getNetworkType()).end(),Ve.e("".concat(n," failed. error:"),i),ha(i)}var u=this._userModule.getMyAccount();return this._userModule.request({protocolName:To,requestData:{fromAccount:u,profileItem:r}}).then((function(s){o.setNetworkType(t._userModule.getNetworkType()).end(),Ve.i("".concat(n," ok"));var r=t._update(u,e),a=r.isProfileUpdated,i=r.latestProfile;return!0===a&&t._userModule.emitOuterEvent(E.PROFILE_UPDATED,[i]),_a(i)})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!$t(t)){var n,o=t.length;Ve.d("".concat(this._n,".onProfileModified count:").concat(o," dataList:"),e.dataList);for(var s=[],r=0;r<o;r++){n=t[r].userID;var a=this._update(n,this._getLatestProfileFromResponse(n,t[r].profileList)),i=a.isProfileUpdated,u=a.latestProfile;!0===i&&s.push(u)}s.length>0&&(this._userModule.emitInnerEvent(ya,s),this._userModule.emitOuterEvent(E.PROFILE_UPDATED,s))}}},{key:"_fill",value:function(){if(0===this.accountProfileMap.size){for(var e=this._getCachedProfiles(),t=Date.now(),n=0,o=e.length;n<o;n++)t-e[n].lastUpdatedTime<this.expirationTime&&this.accountProfileMap.set(e[n].userID,e[n]);Ve.l("".concat(this._n,"._fill from cache, size:").concat(this.accountProfileMap.size))}}},{key:"_update",value:function(e,t){var n,o=!1,s=Date.now();this._contains(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&!0===St(n.profileCustomField,t.profileCustomField)&&(n.lastUpdatedTime=s,o=!0),mt(n,t,["profileCustomField"])>0&&(n.lastUpdatedTime=s,o=!0)):(n=new La(t),(this._userModule.isMyFriend(e)||e===this._userModule.getMyAccount())&&(n.lastUpdatedTime=s,o=!0,this.accountProfileMap.set(e,n)));return this._flush(e===this._userModule.getMyAccount()),Ve.l("".concat(this._n,"._update account:").concat(e," isProfileUpdated:").concat(o)),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=v(this.accountProfileMap.values()),n=this._userModule.getStorageModule();Ve.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 $t(e)?[]:e}},{key:"onConversationsProfileUpdated",value:function(e){for(var t,n,o,s=[],r=0,a=e.length;r<a;r++)n=(t=e[r]).userID,this._userModule.isMyFriend(n)&&(this._contains(n)?(o=this._getProfileFromMap(n),mt(o,t)>0&&s.push(n)):s.push(t.userID));0!==s.length&&(Ve.i("".concat(this._n,".onConversationsProfileUpdated toAccountList:").concat(s)),this.getUserProfile({userIDList:s}))}},{key:"getNickAndAvatarByUserID",value:function(e){if(this._contains(e)){var t=this._getProfileFromMap(e);return{nick:t.nick,avatar:t.avatar}}return{nick:"",avatar:""}}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear()}}]),e}(),di=r((function e(t){o(this,e),$t||(this.userID=t.userID||"",this.timeStamp=t.timeStamp||0)})),pi=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 r(e,[{key:"getLocalBlacklist",value:function(){return v(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 jr("getBlacklist");return this._userModule.request({protocolName:Do,requestData:n}).then((function(n){var s=n.data,r=s.blackListItem,a=s.currentSequence,i=$t(r)?0:r.length;o.setNetworkType(e._userModule.getNetworkType()).setMessage("count:".concat(i)).end(),Ve.i("".concat(t," ok")),e.currentSequence=a,e._handleResponse(r,!0),e._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,v(e._blacklistMap.keys()))})).catch((function(n){return e._userModule.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];o.setError(n,s,r).end()})),Ve.e("".concat(t," failed. error:"),n),ha(n)}))}},{key:"addBlacklist",value:function(e){var t=this,n=new jr("addToBlacklist"),o="".concat(this._n,".addBlacklist"),s=this._userModule.getMyAccount();if(1===e.userIDList.length&&e.userIDList[0]===s){var r=Or.CANNOT_ADD_SELF_TO_BLACKLIST,a=this._userModule.getErrorMessage(r);n.setCode(r).setMessage(a).setNetworkType(this._userModule.getNetworkType()).end();var i=new da({code:r});return Ve.e("".concat(o," failed. error:"),i),ha(i)}return e.userIDList.includes(s)&&(e.userIDList=e.userIDList.filter((function(e){return e!==s}))),e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:Eo,requestData:e}).then((function(s){return n.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ve.i("".concat(o," ok")),t._handleResponse(s.resultItem,!0),la(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var o=m(t,2),s=o[0],r=o[1];n.setError(e,s,r).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"_handleResponse",value:function(e,t){if(!$t(e))for(var n,o,s,r=0,a=e.length;r<a;r++)o=e[r].to,s=e[r].resultCode,(dt(s)||0===s)&&(t?((n=this._blacklistMap.has(o)?this._blacklistMap.get(o):new di).userID=o,!$t(e[r].addBlackTimeStamp)&&(n.timeStamp=e[r].addBlackTimeStamp),this._blacklistMap.set(o,n)):this._blacklistMap.has(o)&&(n=this._blacklistMap.get(o),this._blacklistMap.delete(o)));Ve.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 jr("removeFromBlacklist");return e.fromAccount=this._userModule.getMyAccount(),e.toAccount=e.userIDList,this._userModule.request({protocolName:ko,requestData:e}).then((function(s){return o.setNetworkType(t._userModule.getNetworkType()).setMessage(e.userIDList.length>5?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),Ve.i("".concat(n," ok")),t._handleResponse(s.data.resultItem,!1),la(v(t._blacklistMap.keys()))})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"onAccountDeleted",value:function(e){for(var t,n=[],o=0,s=e.length;o<s;o++)t=e[o],this._blacklistMap.has(t)&&(this._blacklistMap.delete(t),n.push(t));n.length>0&&(Ve.l("".concat(this._n,".onAccountDeleted count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"onAccountAdded",value:function(e){for(var t,n=[],o=0,s=e.length;o<s;o++)t=e[o],this._blacklistMap.has(t)||(this._blacklistMap.set(t,new di({userID:t})),n.push(t));n.length>0&&(Ve.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userModule.emitOuterEvent(E.BLACKLIST_UPDATED,v(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this.startIndex=0,this.maxLimited=100,this.currentSequence=0}}]),e}(),gi=function(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,s,r=0,a=0;s=t.charAt(a++);~s&&(o=r%4?64*o+s:s,r++%4)?n+=String.fromCharCode(255&o>>(-2*r&6)):0)s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);try{return decodeURIComponent(escape(n))}catch(i){return""}},_i=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(Ma,this._onCloudConfigUpdated,this)}return r(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");Ve.l("".concat(this._n,"._onCloudConfigUpdated statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),dt(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),dt(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),dt(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(e){var t=e.dataList,n=this._userModule.getMyUserID(),o=this._userModule.getModule(Wn),s=t.map((function(e){var t=e.to,s=e.statusType,r=e.customStatus,a=gi(r);return t===n&&o.setCustomStatus(a),{userID:t,statusType:s,customStatus:a}}));this._userModule.emitOuterEvent(E.USER_STATUS_UPDATED,s)}},{key:"setSelfStatus",value:function(e){var t=this,n="".concat(this._n,".setSelfStatus");if(!1===this._userModule.filterProfanity("customStatus",e))return ha({code:Or.PROFANITY_FOUND});var o=new jr("setSelfStatus"),s=e.customStatus;return this._userModule.request({protocolName:Tr,requestData:{customStatus:s}}).then((function(e){return o.setNetworkType(t._userModule.getNetworkType()).setMessage("customStatus:".concat(s)).end(),Ve.l("".concat(n," ok. customStatus:").concat(s)),t._userModule.getModule(Wn).setCustomStatus(s),la({userID:t._userModule.getMyUserID(),statusType:1,customStatus:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),s=n[0],r=n[1];o.setError(e,s,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"getUserStatus",value:function(e){var t=this,n="".concat(this._n,".getUserStatus"),o=e.userIDList,s=void 0===o?[]:o,r=this._userModule.getMyUserID(),a=v(s),i=void 0,u=a.indexOf(r);if(u>-1){a.splice(u,1);var c=this._userModule.getModule(Wn).getCustomStatus();i={userID:r,statusType:1,customStatus:c}}if(0===a.length)return _a({successUserList:[i],failureUserList:[]});if(!this._userModule.canIUse(H.USER_STATUS))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});a.length>this.MAX_QUERY_USER_COUNT&&(Ve.w("".concat(n," ").concat(Xt(this.MAX_QUERY_USER_COUNT))),a=s.slice(0,this.MAX_QUERY_USER_COUNT));var l=new jr("getUserStatus");return this._userModule.request({protocolName:Dr,requestData:{userIDList:a}}).then((function(e){var o=e.data,r=o.successUserList,a=void 0===r?[]:r,u=o.failureUserList,c=void 0===u?[]:u,d=a.map((function(e){var t=e.userID,n=e.statusType,o=e.customStatus;return{userID:t,statusType:n,customStatus:gi(o)}})),p=c.map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:$t(n)?t:n,code:o,message:s}}));dt(i)||d.unshift(i);var g="userID count:".concat(s.length,", success count:").concat(d.length,", fail count:").concat(p.length);return l.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(g)).end(),Ve.l("".concat(n," ok. ").concat(g,".")),la({successUserList:d,failureUserList:p})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];l.setMessage("userID count:".concat(s.length)).setError(e,o,r).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"subscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(H.USER_STATUS))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".subscribeUserStatus"),o=e.userIDList,s=void 0===o?[]:o,r=v(s);r.length>this.MAX_SUBSCRIBE_USER_COUNT&&(Ve.w("".concat(n," ").concat(Xt(this.MAX_SUBSCRIBE_USER_COUNT))),r=s.slice(0,this.MAX_SUBSCRIBE_USER_COUNT));var a=new jr("subscribeUserStatus"),i="userID count:".concat(s.length);return Ve.l("".concat(n," ").concat(i)),this._userModule.request({protocolName:Er,requestData:{userIDList:r}}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:$t(n)?t:n,code:o,message:s}}));return a.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(s.length)).end(),Ve.l("".concat(n," ok. fail count:").concat(s.length,".")),la({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setMessage("".concat(i)).setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"unsubscribeUserStatus",value:function(e){var t=this;if(!this._userModule.canIUse(H.USER_STATUS))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".unsubscribeUserStatus"),o=(e||{}).userIDList,s=void 0===o?[]:o,r=v(s);s.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(Ve.w("".concat(n," ").concat(Xt(this.MAX_UNSUBSCRIBE_USER_COUNT))),r=s.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT));var a=new jr("unsubscribeUserStatus"),i="userID count:".concat(s.length);Ve.l("".concat(n," ").concat(i));var u={userIDList:r};return 0===r.length&&(u.userIDList=void 0,u.unsubscribeAll=1),this._userModule.request({protocolName:kr,requestData:u}).then((function(e){var o=e.data.failureUserList,s=(void 0===o?[]:o).map((function(e){var t=e.userID,n=e.invalidUserID,o=e.errorCode,s=e.errorInfo;return{userID:$t(n)?t:n,code:o,message:s}}));return a.setNetworkType(t._userModule.getNetworkType()).setMessage("".concat(i," fail count:").concat(s.length)).end(),Ve.l("".concat(n," ok. fail count:").concat(s.length,".")),la({failureUserList:s})})).catch((function(e){return t._userModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setMessage("".concat(i)).setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),e}(),hi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="UserModule",s._profileHandler=new li(_(s)),s._blacklistHandler=new pi(_(s)),s._userStatusHandler=new _i(_(s)),s.getInnerEmitterInstance().on(va,s.onContextUpdated,_(s)),s}return r(n,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(e){var t=e.dataList;if(!$t(t)){var n=[];t.forEach((function(e){e.blackListDelAccount&&n.push.apply(n,v(e.blackListDelAccount))})),n.length>0&&this._blacklistHandler.onAccountDeleted(n);var o=[];t.forEach((function(e){e.blackListAddAccount&&o.push.apply(o,v(e.blackListAddAccount))})),o.length>0&&this._blacklistHandler.onAccountAdded(o)}}},{key:"onConversationsProfileUpdated",value:function(e){this._profileHandler.onConversationsProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.getModule(Yn)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(uo);if(!n)return!0;var o=n.filterText(t[e],j),s=o.isAllowedToSend,r=o.modifiedText;return!0===s&&(t[e]=r,!0)}},{key:"isMyFriend",value:function(e){var t=this.getModule(Vn);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return _a(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(){Ve.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}]),n}(go),fi=function(){function e(t,n){o(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="2.27.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}return r(e,[{key:"isLoggedIn",value:function(){return this._isLoggedIn}},{key:"isOversea",value:function(){return this._oversea}},{key:"isPrivateNetWork",value:function(){return this._proxyServer}},{key:"isDevMode",value:function(){return this._isDevMode}},{key:"isSingaporeSite",value:function(){return this._SDKAppID>=2e7&&this._SDKAppID<3e7||this._SDKAppID>=172e7&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return this._SDKAppID>=3e7&&this._SDKAppID<4e7||this._SDKAppID>=173e7&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return this._SDKAppID>=4e7&&this._SDKAppID<5e7||this._SDKAppID>=174e7&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return this._SDKAppID>=5e7&&this._SDKAppID<6e7||this._SDKAppID>=175e7&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return this._SDKAppID>=6e7&&this._SDKAppID<7e7||this._SDKAppID>=176e7&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return this._SDKAppID>=7e7&&this._SDKAppID<8e7||this._SDKAppID>=177e7&&this._SDKAppID<178e7}},{key:"isIntl",value:function(){return 0===(e=this._SDKAppID)||e>=2e7&&e<8e7||e>=172e7&&e<178e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Ae?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,s=[];re&&(s=Object.keys(ie)),ae&&(s=se?Object.keys(uni):Object.keys(window));for(var r=0,a=s.length;r<a;r++)if(s[r].toLowerCase().includes("uikit")){e=!0;break}if(s=null,re&&!gt(ie.createGamePortal)&>(getApp)&&!dt(getApp())){var i=getApp().globalData;ct(i)&&!0===i.isTUIKit&&(t=!0)}!0===this._m.getModule(Yn).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))&&(n=!0);var u=null;if(Q&&!$&&"undefined"==typeof uni&&__wxConfig&&(u=__wxConfig.pages),Z&&"undefined"==typeof uni&&__qqConfig&&(u=__qqConfig.pages),lt(u)&&u.length>0){for(var c=0,l=u.length;c<l;c++)if(u[c].toLowerCase().includes("tui")){o=!0;break}u=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}(),mi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="SignModule",s._helloInterval=120,s._lastLoginTs=0,s._lastWsHelloTs=0,s._isWebUniapp=0,Ia.mixin(_(s)),s}return r(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))&&Ve.w(t),_a({actionStatus:"OK",errorCode:0,errorInfo:t,repeatLogin:!0})}if(Date.now()-this._lastLoginTs<=15e3)return this.outputWarning("LoggingIn",e.userID),ha({code:Or.REPEAT_LOGIN});Ve.l("".concat(this._n,".login userID:").concat(e.userID));var o=this._checkLoginInfo(e);if(0!==o.code)return ha(o);var s=this.getModule(Wn),r=e.userID,a=e.userSig;return s.setUserID(r),s.setUserSig(a),this.getModule($n).updateProtocolConfig(),this._login()}},{key:"_login",value:function(){var e=this,t=this.getModule(Wn),n=t.getScene(),o=0,s=new jr("login");s.setMessage("".concat(n)).setMoreMessage("identifier:".concat(this.getMyUserID())),se?"tuikit"===n?s.setUIPlatform(4):s.setUIPlatform(3):re?"tuikit"===n?s.setUIPlatform(12):s.setUIPlatform(11):ae&&(Ae?"flutter_web_uikit"===n?s.setUIPlatform(21):s.setUIPlatform(20):this._isReactUIKit()?Le?s.setUIPlatform(25):s.setUIPlatform(24):Le?"tuikit"===n?s.setUIPlatform(17):s.setUIPlatform(16):"tuikit"===n?s.setUIPlatform(14):s.setUIPlatform(13));var r=this.getModule(io);if(r.canIUseOfflinePush()){this._isWebUniapp=r.getUniAppPlatform();var a=this._getStatusInstanceID();t.setStatusInstanceID(a),this.getModule($n).updateProtocolConfig(),o=r.getDeviceBrand()}var i="".concat(this._n,"._login");return this._lastLoginTs=Date.now(),this.request({protocolName:_o,requestData:{deviceBrand:o,isWebUniapp:this._isWebUniapp}}).then((function(o){e._lastLoginTs=0;var r=Date.now(),a=null,u=o.data,c=u.a2Key,l=u.tinyID,d=u.helloInterval,p=u.instanceID,g=u.timeStamp,_=u.customStatus,h=void 0===_?"":_;Ve.l("".concat(i," ok. scene:").concat(n," helloInterval:").concat(d," instanceID:").concat(p," timeStamp:").concat(g));var f=1e3*g,m=r-s.getStartTs(),v=f+parseInt(m/2)-r,M=s.getStartTs()+v;if(s.start(M),function(e,t){Ue=t;var n=new Date;n.setTime(e),Ve.i("baseTime from server:".concat(n," offset:").concat(Ue))}(f,v),!l)throw a=new da({code:Or.NO_TINYID}),s.setError(a,!0,e.getNetworkType()).end(),a;if(!c)throw a=new da({code:Or.NO_A2KEY}),s.setError(a,!0,e.getNetworkType()).end(),a;var y=gi(h);s.setNetworkType(e.getNetworkType()).setMoreMessage("helloInterval:".concat(d," instanceID:").concat(p," offset:").concat(v," customStatus:").concat(y)).end(),t.setA2Key(c),t.setTinyID(l),t.setStatusInstanceID(p),t.setCustomStatus(y),e.getModule($n).updateProtocolConfig(),e.emitInnerEvent(va),e._helloInterval=d,e.triggerReady();var I=e.getModule(io);return I.canIUseOfflinePush()&&(uni.setStorageSync("timUniAppInstanceID",p),I.init()),e._fetchCloudControlConfig(),e.getModule(uo).init(),o})).catch((function(t){return e.probeNetwork().then((function(e){var n=m(e,2),o=n[0],r=n[1];s.setError(t,o,r).end(!0)})),e._m.setNotReadyReason(Or.LOGIN_FAILED),Ve.e("".concat(i," failed. error:"),t),e._lastLoginTs=0,e._m.onLoginFailed(),ha(t)}))}},{key:"logout",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.isLoggedIn())return ha({code:Or.USER_NOT_LOGGED_IN});var n=new jr("logout");n.setNetworkType(this.getNetworkType()).setMessage("identifier:".concat(this.getMyUserID())).end(!0);var o="".concat(this._n,".logout");return Ve.i("".concat(o," type:").concat(t)),0===t&&this._m.setNotReadyReason(Or.LOGGED_OUT),this.request({protocolName:ho,requestData:{type:t}}).then((function(){return e.resetReady(),_a({})})).catch((function(t){return Ve.e("".concat(o," error:"),t),e.resetReady(),_a({})}))}},{key:"_fetchCloudControlConfig",value:function(){this.getModule(no).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.request({protocolName:fo,requestData:{isWebUniapp:this._isWebUniapp}}).catch((function(t){Ve.w("".concat(e._n,"._hello error:"),t)}))}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return $t(this.getModule(Wn).getSDKAppID())?t=Or.NO_SDKAPPID:$t(e.userID)?t=Or.NO_IDENTIFIER:$t(e.userSig)&&(t=Or.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return ae&&void 0!==window.tencent_cloud_im_csig_react_uikit_23F_xa}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new jr("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(k.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:k.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(Or.KICKED_OUT_MULT_ACCOUNT),t._m.reset()}))}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new jr("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(k.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then((function(){t.emitOuterEvent(E.KICKED_OUT,{type:k.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(Or.KICKED_OUT_MULT_DEVICE),t._m.reset()}))}},{key:"onUserSigExpired",value:function(){new jr("kickedOut").setNetworkType(this.getNetworkType()).setMessage(k.KICKED_OUT_USERSIG_EXPIRED).end(!0),Ve.w("".concat(this._n,".onUserSigExpired: userSig expired")),0!==this.getModule(Wn).getStatusInstanceID()&&(this.emitOuterEvent(E.KICKED_OUT,{type:k.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(Or.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){(new jr("kickedOut").setNetworkType(this.getNetworkType()).setMessage("type:".concat(k.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),Ve.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),0!==this.getModule(Wn).getStatusInstanceID())&&(this.emitOuterEvent(E.KICKED_OUT,{type:k.KICKED_OUT_REST_API}),this._m.setNotReadyReason(Or.KICKED_OUT_REST_API),this._m.reset(),this.getModule(eo).onRestApiKickedOut())}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]),n}(go);function vi(){return null}var Mi=function(){function e(t){o(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()}return r(e,[{key:"_errorTolerantHandle",value:function(){re||!dt(window)&&this._canIUseCookies()||(this.getItem=vi,this.setItem=vi,this.removeItem=vi,this.clear=vi)}},{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=m(e.value,2),o=n[0],s=n[1];this._setStorageSync(this._getKey(o),s)}}catch(r){t.e(r)}finally{t.f()}this._storageQueue.clear()}catch(a){Ve.w("".concat(this._n,"._doFlush error:"),a)}}},{key:"_getPrefix",value:function(){var e=this._m.getModule(Wn);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 Ve.w("".concat(this._n,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(n){var s=o?this._getKey(e):e;this._setStorageSync(s,t)}else this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{re?ie.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){Ve.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){Ve.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}}),re&&(o.limitSize=1024*ie.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(re){var s=ie.getStorageInfoSync(),r=s.keys;r.forEach((function(e){o.size+=JSON.stringify(t.getStorageSync(e)).length+t._getKey(e).length}))}else if(this._canIUseCookies())for(var a in localStorage)localStorage.hasOwnProperty(a)&&(o.size+=localStorage.getItem(a).length+a.length);return this._convertUnit(o)}catch(i){Ve.w("".concat(this._n," error:"),i)}}},{key:"_convertUnit",value:function(e){var t={},n=e.unit;for(var o in t.unit=n,e)"number"==typeof e[o]&&("kb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024):"mb"===n.toLowerCase()?t[o]=Math.round(e[o]/1024/1024):t[o]=e[o]);return t}},{key:"_setStorageSync",value:function(e,t){re?te?my.setStorageSync({key:e,data:t}):ie.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return re?te?my.getStorageSync({key:e}).data:ie.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){re?te?my.removeStorageSync({key:e}):ie.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._doFlush()}}]),e}(),yi=function(){function e(t){o(this,e),this._n="SSOLogBody",this._report=[]}return r(e,[{key:"pushIn",value:function(e){Ve.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;lt(e)&&0!==e.length&&(Ve.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,v(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),e}(),Ii=function(e){var t=e.getModule(Wn);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Pe()}},Ci=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="EventStatModule",t.TAG="im-ssolog-event",t._reportBody=new yi,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 r=t.getInnerEmitterInstance();return r.on(va,t._onLoginSuccess,_(t)),r.on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"reportAtOnce",value:function(){Ve.d("".concat(this._n,".reportAtOnce")),this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.getModule(Yn),n=t.getItem(this.TAG,!1);!$t(n)&>(n.forEach)&&(Ve.l("".concat(this._n,"._onLoginSuccess get ssolog in storage, count:").concat(n.length)),n.forEach((function(t){e._reportBody.pushIn(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("evt_rpt_threshold"),t=this.getCloudConfig("evt_rpt_waiting"),n=this.getCloudConfig("evt_rpt_level"),o=this.getCloudConfig("evt_rpt_sdkappid_bl"),s=this.getCloudConfig("evt_rpt_tinyid_wl");dt(e)||(this.MIN_THRESHOLD=Number(e)),dt(t)||(this.WAITING_TIME=Number(t)),dt(n)||(this.REPORT_LEVEL=n.split(",").map((function(e){return Number(e)}))),dt(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map((function(e){return Number(e)}))),dt(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}},{key:"pushIn",value:function(e){e instanceof jr&&(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(Wn),o=n.getSDKAppID(),s=n.getTinyID();return Bt(this.REPORT_SDKAPPID_BLACKLIST,o)&&!Kt(this.REPORT_TINYID_WHITELIST,s)?[]: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 s={header:Ii(this),event:o};this.request({protocolName:ar,requestData:t({},s)}).then((function(){e._lastReportTime=Date.now()})).catch((function(t){Ve.w("".concat(e._n,".report failed. networkType:").concat(e.getNetworkType()," error:"),t),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(Yn),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");if($t(t))Ve.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>this.MAX_THRESHOLD&&(s=s.slice(0,this.MAX_THRESHOLD)),Ve.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}]),s}(go),Ti="none",Di="online",Ei=[Or.OVER_FREQUENCY_LIMIT,Or.OPEN_SERVICE_OVERLOAD_ERROR],ki=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 r(e,[{key:"start",value:function(){var e=this;re?(ie.getNetworkType({success:function(t){e._networkType=t.networkType||t.subtype||"",t.networkType===Ti?Ve.w("".concat(e._n,".start no network, please check!")):Ve.i("".concat(e._n,".start networkType:").concat(t.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),ie.onNetworkStatusChange(this._mpNetworkStatusCallback)):(this._networkType=Di,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:Di})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Ti})}},{key:"_onNetworkStatusChange",value:function(e){var t=e.isConnected,n=e.networkType,o="".concat(this._n,"._onNetworkStatusChange"),s=!1;t?(Ve.i("".concat(o," previous:").concat(this._networkType," current:").concat(n)),this._networkType!==n&&(s=!0,this._m.getModule(eo).reConnect(!0))):this._networkType!==n&&(s=!0,Ve.w("".concat(o," no network, please check!")),this._m.getModule(eo).offline());s&&(new jr("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(!dt(e)&&Ei.includes(e.code))return Promise.resolve([!0,this._networkType]);var n="".concat(this._n,".probe");return new Promise((function(e,o){re?ie.getNetworkType({success:function(o){t._networkType=o.networkType,o.networkType===Ti?(Ve.w("".concat(n," no network, please check!")),e([!1,o.networkType])):(Ve.i("".concat(n," networkType:").concat(o.networkType)),e([!0,o.networkType]))}}):t._networkType===Ti?e([!1,Ti]):e([!0,Di])}))}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),re?null!==this._mpNetworkStatusCallback&&(ie.offNetworkStatusChange&&(oe||$?ie.offNetworkStatusChange(this._mpNetworkStatusCallback):ie.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 Si=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function r(e,t,o,r,a){if("function"!=typeof o)throw new TypeError("The listener must be a function");var i=new s(o,r||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],i]:e._events[u].push(i):(e._events[u]=i,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,o,s=[];if(0===this._eventsCount)return s;for(o in e=this._events)t.call(e,o)&&s.push(n?o.slice(1):o);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},i.prototype.listeners=function(e){var t=n?n+e:e,o=this._events[t];if(!o)return[];if(o.fn)return[o.fn];for(var s=0,r=o.length,a=new Array(r);s<r;s++)a[s]=o[s].fn;return a},i.prototype.listenerCount=function(e){var t=n?n+e:e,o=this._events[t];return o?o.fn?1:o.length:0},i.prototype.emit=function(e,t,o,s,r,a){var i=n?n+e:e;if(!this._events[i])return!1;var u,c,l=this._events[i],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,s),!0;case 5:return l.fn.call(l.context,t,o,s,r),!0;case 6:return l.fn.call(l.context,t,o,s,r,a),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var p,g=l.length;for(c=0;c<g;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,o);break;case 4:l[c].fn.call(l[c].context,t,o,s);break;default:if(!u)for(p=1,u=new Array(d-1);p<d;p++)u[p-1]=arguments[p];l[c].fn.apply(l[c].context,u)}}return!0},i.prototype.on=function(e,t,n){return r(this,e,t,n,!1)},i.prototype.once=function(e,t,n){return r(this,e,t,n,!0)},i.prototype.removeListener=function(e,t,o,s){var r=n?n+e:e;if(!this._events[r])return this;if(!t)return a(this,r),this;var i=this._events[r];if(i.fn)i.fn!==t||s&&!i.once||o&&i.context!==o||a(this,r);else{for(var u=0,c=[],l=i.length;u<l;u++)(i[u].fn!==t||s&&!i[u].once||o&&i[u].context!==o)&&c.push(i[u]);c.length?this._events[r]=1===c.length?c[0]:c:a(this,r)}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new o,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=n,i.EventEmitter=i,e.exports=i})),Li=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="BigDataChannelModule",s.FILETYPE={SOUND:2106,FILE:2107,VIDEO:2113},s._bdh_download_server="grouptalk.c2c.qq.com",s._BDHBizID=10001,s._authKey="",s._expireTime=0,s.getInnerEmitterInstance().on(va,s._getAuthKey,_(s)),s}return r(n,[{key:"_getAuthKey",value:function(){var e=this;this.isIntl()||this.request({protocolName:Mo}).then((function(t){t.data.authKey&&(e._authKey=t.data.authKey,e._expireTime=parseInt(t.data.expireTime))}))}},{key:"_isFromOlderVersion",value:function(e){return!(!e.content||2===e.content.downloadFlag)}},{key:"parseElements",value:function(e,t){if(!lt(e)||!t)return[];for(var n=[],o=null,s=0;s<e.length;s++)o=e[s],this._needParse(o)?n.push(this._parseElement(o,t)):n.push(e[s]);return n}},{key:"_needParse",value:function(e){return!e.cloudCustomData&&!(!this._isFromOlderVersion(e)||e.type!==k.MSG_AUDIO&&e.type!==k.MSG_FILE&&e.type!==k.MSG_VIDEO)}},{key:"_parseElement",value:function(e,t){switch(e.type){case k.MSG_AUDIO:return this._parseAudioElement(e,t);case k.MSG_FILE:return this._parseFileElement(e,t);case k.MSG_VIDEO:return this._parseVideoElement(e,t)}}},{key:"_parseAudioElement",value:function(e,t){return e.content.url=this._genAudioUrl(e.content.uuid,t),e}},{key:"_parseFileElement",value:function(e,t){return e.content.url=this._genFileUrl(e.content.uuid,t,e.content.fileName),e}},{key:"_parseVideoElement",value:function(e,t){return e.content.url=this._genVideoUrl(e.content.uuid,t),e}},{key:"_genAudioUrl",value:function(e,t){if(""===this._authKey)return"";var n=this.getModule(Wn).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(n,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.SOUND,"&openid=").concat(t,"&ver=0")}},{key:"_genFileUrl",value:function(e,t,n){if(""===this._authKey)return"";n||(n="".concat(Math.floor(1e5*Math.random()),"-").concat(Date.now()));var o=this.getModule(Wn).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(o,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.FILE,"&openid=").concat(t,"&ver=0&filename=").concat(encodeURIComponent(n))}},{key:"_genVideoUrl",value:function(e,t){if(""===this._authKey)return"";var n=this.getModule(Wn).getSDKAppID();return"https://".concat(this._bdh_download_server,"/asn.com/stddownload_common_file?authkey=").concat(this._authKey,"&bid=").concat(this._BDHBizID,"&subbid=").concat(n,"&fileid=").concat(e,"&filetype=").concat(this.FILETYPE.VIDEO,"&openid=").concat(t,"&ver=0")}},{key:"reset",value:function(){this._authKey="",this.expireTime=0}}]),n}(go),Ai=["requestSnapshotUrl"],Ni=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(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={AUDIO:20971520,FILE:104857600,IMAGE:20971520,VIDEO:104857600};var r=t.getInnerEmitterInstance();return r.on(va,t._init,_(t)),r.on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"_init",value:function(){var e=this.getModule(Qn);if(this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin)this._initUploaderMethod();else{var t=re?"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");if(Ve.l("".concat(e," uploadSizeLimit:").concat(t)),!dt(t))try{var n=JSON.parse(t);this.UPLOAD_SIZE_LIMIT={AUDIO:n.a?1048576*parseInt(n.a):this.UPLOAD_SIZE_LIMIT.AUDIO,FILE:n.f?1048576*parseInt(n.f):this.UPLOAD_SIZE_LIMIT.FILE,IMAGE:n.i?1048576*parseInt(n.i):this.UPLOAD_SIZE_LIMIT.IMAGE,VIDEO:n.v?1048576*parseInt(n.v):this.UPLOAD_SIZE_LIMIT.VIDEO}}catch(o){Ve.e("".concat(e," JSON parse error. uploadSizeLimit:"),t)}}},{key:"_getAuthorizationKey",value:function(){var e=this,t="".concat(this._n,".").concat("_getAuthorizationKey"),n=new jr("_getAuthorizationKey"),o=Math.ceil(Date.now()/1e3);this.request({protocolName:or,requestData:{duration:this.expiredTimeLimit}}).then((function(s){var r=s.data;Ve.l("".concat(t," ok. data:"),r);var a=r.expiredTime-o;n.setMessage("requestId:".concat(r.requestId," requestTime:").concat(o," expiredTime:").concat(r.expiredTime," diff:").concat(a,"s")).setNetworkType(e.getNetworkType()).end(),!re&&r.region&&(e.region=r.region),e.appid=r.appid,e.bucketName=r.bucketName,e.ciUrl=r.ciUrl,e.directory=r.directory,e.downloadUrl=r.downloadUrl,e.uploadUrl=r.uploadUrl,e.cosOptions={secretId:r.secretId,secretKey:r.secretKey,sessionToken:r.sessionToken,expiredTime:r.expiredTime},Ve.l("".concat(t," ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()})).catch((function(o){e.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.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),s=new jr("_getCosPreSigUrl");return this.request({protocolName:sr,requestData:{fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration}}).then((function(e){t.tryCount=0;var r=e.data||{},a=r.expiredTime-o;return Ve.l("".concat(n," ok. data:"),r),s.setMessage("requestId:".concat(r.requestId," expiredTime:").concat(r.expiredTime," diff:").concat(a,"s")).setNetworkType(t.getNetworkType()).end(),r})).catch((function(o){return-1===o.code&&(o.code=Or.COS_GET_SIG_FAIL),t.probeNetwork().then((function(e){var t=m(e,2),n=t[0],r=t[1];s.setError(o,n,r).end()})),Ve.w("".concat(n," failed. error:"),o),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,ha({code:Or.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=re?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=re?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.getRelayFlag())return Promise.resolve();var t=this.getModule(ro);switch(e.type){case k.MSG_IMAGE:return t.addTotalCount(qr),this._uploadImage(e);case k.MSG_FILE:return t.addTotalCount(qr),this._uploadFile(e);case k.MSG_AUDIO:return t.addTotalCount(qr),this._uploadAudio(e);case k.MSG_VIDEO:return t.addTotalCount(qr),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var n=this,o=this.getModule(bn),s=e.getElements()[0],r=o.getMessageOption(e.clientSequence);return this.doUploadImage({file:r.payload.file,to:r.to,onProgress:function(e){if(s.updatePercent(e),gt(r.onProgress))try{r.onProgress(e)}catch(t){return ha({code:Or.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(o){var r,a,i=o.location,u=o.fileType,c=o.fileSize,l=o.width,d=o.height,p=o.smallImageUrl,g=o.smallImageWidth,_=o.smallImageHeight,h=o.largeImageUrl,f=o.largeImageWidth,m=o.largeImageHeight,v=n.isPrivateNetWork()?i:Et(i);return s.updateImageFormat(u),p&&h?(r={url:p,width:g,height:_},a={url:h,width:f,height:m}):(r=qt({originUrl:v,originWidth:l,originHeight:d,min:198}),a=qt({originUrl:v,originWidth:l,originHeight:d,min:720})),s.updateImageInfoArray([{size:c,url:v,width:l,height:d},t({},a),t({},r)]),e}))}},{key:"_uploadFile",value:function(e){var t=this,n=this.getModule(bn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),gt(s.onProgress))try{s.onProgress(e)}catch(t){return ha({code:Or.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=t.isPrivateNetWork()?s:Et(s);return o.updateFileUrl(r),e}))}},{key:"_uploadAudio",value:function(e){var t=this,n=this.getModule(bn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),gt(s.onProgress))try{s.onProgress(e)}catch(t){return ha({code:Or.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=t.isPrivateNetWork()?s:Et(s);return o.updateAudioUrl(r),e}))}},{key:"_uploadVideo",value:function(e){var t=this,n=this.getModule(bn),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:s.payload.file,to:s.to,onProgress:function(e){if(o.updatePercent(e),gt(s.onProgress))try{s.onProgress(e)}catch(t){return ha({code:Or.MESSAGE_ONPROGRESS_FUNCTION_ERROR})}}}).then((function(n){var s=n.location,r=n.snapshotInfo,a=t.isPrivateNetWork()?s:Et(s);return o.updateVideoUrl(a),$t(r)||o.updateSnapshotInfo(r),e}))}},{key:"_checkSizeError",value:function(e){return ha({code:Or["MESSAGE_".concat(e,"_SIZE_LIMIT")],message:this.getErrorMessage("UploadSizeLimit",e.toLowerCase(),"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576," MB"))})}},{key:"doUploadImage",value:function(e){var t=this;if(!e.file)return ha({code:Or.MESSAGE_IMAGE_SELECT_FILE_FIRST});var n=this._checkImageType(e.file);if(!0!==n)return n;var o=this._checkImageSize(e.file);if(!0!==o)return o;var s=null;return this._setUploadFileType(Da),this.uploadByCOS(e).then((function(e){return s=e,t.isPrivateNetWork()?Pt(e.location):Pt("https://".concat(e.location))})).then((function(e){return s.width=e.width,s.height=e.height,Promise.resolve(s)}))}},{key:"_checkImageType",value:function(e){var t="";return t=re?e.url.slice(e.url.lastIndexOf(".")+1):e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1),Ca.indexOf(t.toLowerCase())>=0||ha({code:Or.MESSAGE_IMAGE_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){var t=0;return 0===(t=re?e.size:e.files[0].size)?ha({code:Or.MESSAGE_FILE_IS_EMPTY}):t<this.UPLOAD_SIZE_LIMIT.IMAGE||this._checkSizeError("IMAGE")}},{key:"doUploadFile",value:function(e){return e.file?e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.FILE?this._checkSizeError("FILE"):0===e.file.files[0].size?ha({code:Or.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(Sa),this.uploadByCOS(e)):ha({code:Or.MESSAGE_FILE_SELECT_FILE_FIRST})}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.VIDEO?this._checkSizeError("VIDEO"):0===e.file.videoFile.size?ha({code:Or.MESSAGE_FILE_IS_EMPTY}):-1===Ta.indexOf(e.file.videoFile.type)?ha({code:Or.MESSAGE_VIDEO_TYPES_LIMIT}):(this._setUploadFileType(Ea),re?this.handleVideoUpload({file:e.file.videoFile,onProgress:e.onProgress}):ae?this.handleVideoUpload(e):void 0)}},{key:"handleVideoUpload",value:function(e){var t=this;return new Promise((function(n,o){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){t.uploadByCOS(e).then((function(e){n(e)})).catch((function(){o(new da({code:Or.MESSAGE_VIDEO_UPLOAD_FAIL}))}))}))}))}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.AUDIO?this._checkSizeError("AUDIO"):0===e.file.size?ha({code:Or.MESSAGE_FILE_IS_EMPTY}):(this._setUploadFileType(ka),this.uploadByCOS(e)):ha({code:Or.MESSAGE_AUDIO_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t=this;if(!gt(this._cosUploadMethod))return this.outputWarning("PluginUndetected"),ha({code:Or.COS_UNDETECTED});if(this.timUploadPlugin)return this._uploadWithPreSigUrl(e);var n=new jr("upload"),o="".concat(this._n,".uploadByCOS"),s=Date.now(),r=this._getFile(e);return new Promise((function(a,i){var u=re?t._createCosOptionsWXMiniApp(e):t._createCosOptionsWeb(e),c=t;t._cosUploadMethod(u,(function(e,u){var l=Object.create(null);if(u){if(e||lt(u.files)&&u.files[0].error){var d=new da({code:Or.MESSAGE_FILE_UPLOAD_FAIL});return n.setError(d,!0,t.getNetworkType()).end(),Ve.l("".concat(o," failed. error:"),u.files[0].error),403===u.files[0].error.statusCode&&(Ve.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),void i(d)}l.fileName=r.name,l.fileSize=r.size,l.fileType=r.type.slice(r.type.indexOf("/")+1).toLowerCase(),l.location=re?u.Location:u.files[0].data.Location;var p=Date.now()-s,g=c._formatFileSize(r.size),_=c._formatSpeed(1e3*r.size/p),h="size:".concat(g," time:").concat(p,"ms speed:").concat(_);Ve.l("".concat(o," success. name:").concat(r.name," ").concat(h)),a(l);var f=t.getModule(ro);return f.addCost(qr,p),f.addFileSize(qr,r.size),void n.setNetworkType(t.getNetworkType()).setMessage(h).end()}var m=new da({code:Or.MESSAGE_FILE_UPLOAD_FAIL});n.setError(m,!0,c.getNetworkType()).end(),Ve.w("".concat(o," failed. error:"),e),403===e.statusCode&&(Ve.w("".concat(o," failed. cos AccessKeyId was invalid, regain auth key!")),t._getAuthorizationKey()),i(m)}))}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then((function(e){return new Promise((function(s,r){var a=new jr("upload"),i=e.requestSnapshotUrl,u=void 0===i?void 0:i,c=g(e,Ai),l=Date.now();t._cosUploadMethod(c,(function(e,i){if(e||403===i.statusCode)return a.setError(new da(e),!0,t.getNetworkType()).end(),Ve.l("".concat(n," failed, error:"),e),void r(new da({code:Or.MESSAGE_FILE_UPLOAD_FAIL}));var d=Object.create(null),p=i.data.location||"";t.isPrivateNetWork()||0!==p.indexOf("https://")&&0!==p.indexOf("http://")||(p=p.split("//")[1]),d.fileName=o.name,d.fileSize=o.size,d.fileType=o.type.slice(o.type.indexOf("/")+1).toLowerCase(),d.location=p;var g=Date.now()-l,_=t._formatFileSize(o.size),h=t._formatSpeed(1e3*o.size/g),f="size:".concat(_,",time:").concat(g,"ms,speed:").concat(h," res:").concat(JSON.stringify(i.data));Ve.l("".concat(n," success name:").concat(o.name,",").concat(f)),a.setNetworkType(t.getNetworkType()).setMessage(f).end();var m=t.getModule(ro);m.addCost(qr,g),m.addFileSize(qr,o.size);var v=[];if(c.thumbUrl&&c.largeUrl&&(v=[t._getSmallImageInfoByUrl(c.thumbUrl,d),t._getLargeImageInfoByUrl(c.largeUrl,d)]),u&&v.push(t._getSnapshotInfoByUrl(u,d)),v.length>0)return Promise.all(v).then((function(){s(d)}));s(d)}))}))}))}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.getModule(Wn).getFileUploadProxy(),n=e;return t&&(n=e.replace(/^https:\/\/[^/]+/,t)),n}},{key:"_getFile",value:function(e){var t;return lt(e.file.files)||(t=e.file.files,"filelist"===ht(t))?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?Ht(e/1024,1)+"KB/s":Ht(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,o=n.slice(n.lastIndexOf(".")),s=this._genFileName("".concat(yt(999999)).concat(o));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(s),Body:t}],SliceSize:1048576,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.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(Ve.l(JSON.stringify(t)),"function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.w("onProgress callback error:",n)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t=this,n="",o="",s=0,r=this._getFile(e);if(re)n=this._genFileName(r.name),o=r.url,s=1;else{var a=r.name,i=a.slice(a.lastIndexOf("."));n=this._genFileName("".concat(yt(999999)).concat(i)),o=r,s=0}return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:n,uploadMethod:s,duration:this.duration}).then((function(s){var r=s.uploadUrl,a=s.downloadUrl,i=s.requestSnapshotUrl,u=void 0===i?void 0:i,c=s.thumbUrl,l=s.largeUrl;return{url:t._getRawOrUploadProxyUrl(r),fileType:t.uploadFileType,fileName:n,resources:o,downloadUrl:a,requestSnapshotUrl:u,thumbUrl:c,largeUrl:l,onProgress:function(t){if("function"==typeof e.onProgress)try{e.onProgress(t.percent)}catch(n){Ve.w("onProgress callback error:",n),Ve.e(n)}}}}))}},{key:"_genFileName",value:function(e){return"".concat(bt(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,o=new jr("getSnapshotInfo");return this.request({protocolName:rr,requestData:{platform:this.getPlatform(),coverName:this._genFileName(yt(99999)),requestSnapshotUrl:e}}).then((function(e){var n=(e.data||{}).snapshotUrl;return o.setMessage("snapshotUrl:".concat(n)).end(),$t(n)?{}:Pt(n).then((function(e){t.snapshotInfo={snapshotUrl:n,snapshotWidth:e.width,snapshotHeight:e.height}}))})).catch((function(e){return Ve.w("".concat(n._n,"._getSnapshotInfoByUrl failed. error:"),e),o.setCode(e.errorCode).setMessage(e.errorInfo).end(),{}}))}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return Pt(e).then((function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height}))}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return Pt(e).then((function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height}))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset"))}}]),s}(go),Ri=["downloadKey","pbDownloadKey","messageList"],Oi=function(){function e(t){o(this,e),this._n="MergerMessageHandler",this._messageModule=t}return r(e,[{key:"uploadMergerMessage",value:function(e,t){var n=this,o="".concat(this._n,".").concat("uploadMergerMessage");Ve.d("".concat(o," message:"),e,"messageBytes:".concat(t));var s=e.payload.messageList,r=s.length,a=new jr("uploadMergerMessage");return this._messageModule.request({protocolName:pr,requestData:{messageList:s}}).then((function(e){Ve.d("".concat(o," ok. response:"),e.data);var s=e.data,i=s.pbDownloadKey,u=s.downloadKey,c={pbDownloadKey:i,downloadKey:u,messageNumber:r};return a.setNetworkType(n._messageModule.getNetworkType()).setMessage("".concat(r,"-").concat(t,"-").concat(u)).end(),c})).catch((function(e){throw Ve.w("".concat(o," failed. error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),e}))}},{key:"downloadMergerMessage",value:function(e){var n=this,o="".concat(this._n,".").concat("downloadMergerMessage");Ve.d("".concat(o," message:"),e);var s=e.payload.downloadKey,r=this._messageModule.getFileDownloadProxy(),a=new jr("downloadMergerMessage");return a.setMessage("downloadKey:".concat(s)),this._messageModule.request({protocolName:gr,requestData:{downloadKey:s}}).then((function(s){if(Ve.d("".concat(o," ok. response:"),s.data),gt(e.clearElement)){var i=e.payload;i.downloadKey,i.pbDownloadKey,i.messageList;var u=g(i,Ri);e.clearElement(),e.setElement({type:e.type,content:t({messageList:s.data.messageList},u)},r)}else{var c=[];s.data.messageList.forEach((function(e){if(!$t(e)){var t=new aa(e,r);c.push(t)}})),e.payload.messageList=c,e.payload.downloadKey="",e.payload.pbDownloadKey=""}return a.setNetworkType(n._messageModule.getNetworkType()).end(),e})).catch((function(e){throw Ve.w("".concat(o," failed. key:").concat(s," error:"),e),n._messageModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),e}))}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===k.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,n){var o=null;t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),!0===t.onlineUserOnly&&(o?o.disablePush=!0:o={disablePush:!0}));var s=[];if(ct(t)&&ct(t.messageControlInfo)){var r=t.messageControlInfo,a=r.excludedFromUnreadCount,i=r.excludedFromLastMessage,u=r.excludedFromContentModeration;!0===a&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,m=this._messageModule.getModule(qn),v=m&&m.isOnlineMessage(e,t)?0:void 0;return{protocolName:yo,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:_,abstractList:h,compatibleText:f,messageNumber:p}}],cloudCustomData:c,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:v,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!==v?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,t,n){var o=null;t&&t.offlinePushInfo&&(o=t.offlinePushInfo);var s=[];if(ct(t)&&ct(t.messageControlInfo)){var r=t.messageControlInfo,a=r.excludedFromUnreadCount,i=r.excludedFromLastMessage,u=r.excludedFromContentModeration;!0===a&&s.push("NoUnread"),!0===i&&s.push("NoLastMsg"),!0===u&&s.push("NoMsgCheck")}var c="";it(e.cloudCustomData)&&e.cloudCustomData.length>0&&(c=e.cloudCustomData);var l=n.pbDownloadKey,d=n.downloadKey,p=n.messageNumber,g=e.payload,_=g.title,h=g.abstractList,f=g.compatibleText,m=this._messageModule.getModule(xn),v=m&&m.isOnlineMessage(e,t)?1:0;return{protocolName:Io,tjgID:this._messageModule.generateTjgID(e),requestData:{fromAccount:this._messageModule.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:l,downloadKey:d,title:_,abstractList:h,compatibleText:f,messageNumber:p}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:c,onlineOnlyFlag:v,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||m.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:0===v?s:void 0,isSupportExtension:!0===e.isSupportExtension?1:0}}}}]),e}(),Gi={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MESSAGE_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},Ui=[Or.MESSAGE_ONPROGRESS_FUNCTION_ERROR,Or.MESSAGE_IMAGE_SELECT_FILE_FIRST,Or.MESSAGE_IMAGE_TYPES_LIMIT,Or.MESSAGE_FILE_IS_EMPTY,Or.MESSAGE_IMAGE_SIZE_LIMIT,Or.MESSAGE_FILE_SELECT_FILE_FIRST,Or.MESSAGE_FILE_SIZE_LIMIT,Or.MESSAGE_VIDEO_SIZE_LIMIT,Or.MESSAGE_VIDEO_TYPES_LIMIT,Or.MESSAGE_AUDIO_UPLOAD_FAIL,Or.MESSAGE_AUDIO_SIZE_LIMIT,Or.COS_UNDETECTED];function Pi(e){var t=!1;return Object.values(Gi).includes(e)&&(t=!0),(e>=120001&&e<=13e4||e>=10100&&e<=10200)&&(t=!0),t}var bi=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="MessageModule",t._messageOptionsMap=new Map,t._mergerMessageHandler=new Oi(_(t)),t}return r(s,[{key:"createTextMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new ca(e),o="string"==typeof e.payload?e.payload:e.payload.text,s=new Jr({text:o}),r=this._getNickAndAvatarByUserID(t);return n.setElement(s),n.setNickAndAvatar(r),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 ca(e);if(re){var o=e.payload.file;if(rt(o))return void this.outputWarning("FileUnsupportedInMP","createImageMessage");var s=o.tempFiles[0].path||o.tempFiles[0].tempFilePath,r={url:s,name:s.slice(s.lastIndexOf("/")+1),size:o.tempFiles&&o.tempFiles[0].size||1,type:s.slice(s.lastIndexOf(".")+1).toLowerCase()};e.payload.file=r}else if(ae)if(rt(e.payload.file)){var a=e.payload.file;e.payload.file={files:[a]}}else if(ct(e.payload.file)&&"undefined"!=typeof uni){var i=e.payload.file.tempFiles[0];e.payload.file={files:[i]}}var u=new zr({imageFormat:He.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file}),c=this._getNickAndAvatarByUserID(t);return n.setElement(u),n.setNickAndAvatar(c),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var t=e.payload.file;if(re){var n={url:t.tempFilePath,name:t.tempFilePath.slice(t.tempFilePath.lastIndexOf("/")+1),size:t.fileSize,second:parseInt(t.duration)/1e3,type:t.tempFilePath.slice(t.tempFilePath.lastIndexOf(".")+1).toLowerCase()};e.payload.file=n}var o=this.getMyUserID();e.currentUser=o,e.senderTinyID=this.getMyTinyID();var s=new ca(e),r=new Qr({second:Math.floor(t.duration/1e3),size:t.fileSize||t.size,url:t.tempFilePath,uuid:this._generateUUID(e.payload.file)}),a=this._getNickAndAvatarByUserID(o);return s.setElement(r),s.setNickAndAvatar(a),s.setNameCard(this._getNameCardByGroupID(s)),this._messageOptionsMap.set(s.clientSequence,e),s}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0;var n={};if(re){if(te)return void this.outputWarning("VideoUnsupportedInAlipay");if(rt(e.payload.file))return void this.outputWarning("FileUnsupportedInMP","createVideoMessage");var o=e.payload.file;lt(o.tempFiles)&&(o=o.tempFiles[0]),n.url=o.tempFilePath,n.name=o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),n.size=o.size||1,n.second=o.duration||0,n.type=o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()}else if(ae){if(rt(e.payload.file)){var s=e.payload.file;e.payload.file.files=[s]}else if(ct(e.payload.file)&&"undefined"!=typeof uni){var r=e.payload.file.tempFile;e.payload.file.files=[r]}var a=e.payload.file;n.url=window.URL.createObjectURL(a.files[0]),n.name=a.files[0].name,n.size=a.files[0].size||1,n.second=a.files[0].duration||0,n.type=a.files[0].type.split("/")[1]}e.payload.file.videoFile=n;var i=new ca(e),u=new sa({videoFormat:n.type,videoSecond:Ht(n.second,0),videoSize:n.size,remoteVideoUrl:"",videoUrl:n.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:e.payload.file.thumbUrl.slice(e.payload.file.thumbUrl.lastIndexOf(".")+1).toLowerCase()}),c=this._getNickAndAvatarByUserID(t);return i.setElement(u),i.setNickAndAvatar(c),i.setNameCard(this._getNameCardByGroupID(i)),this._messageOptionsMap.set(i.clientSequence,e),i}},{key:"createCustomMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new ca(e),o=new oa({data:e.payload.data,description:e.payload.description,extension:e.payload.extension}),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createFaceMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=new ca(e),o=new Xr(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"createMergerMessage",value:function(e){var t=this.getMyUserID();e.currentUser=t,e.senderTinyID=this.getMyTinyID();var n=this._getNickAndAvatarByUserID(t),o=new ca(e),s=new ia(e.payload);return o.setElement(s),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(o)),o.setRelayFlag(!0),o}},{key:"createForwardMessage",value:function(e){var t=e.to,n=e.conversationType,o=e.priority,s=e.payload,r=e.needReadReceipt,a=e.receiverList,i=this.getMyUserID(),u=this._getNickAndAvatarByUserID(i);if(s.type===k.MSG_GRP_TIP)return ha({code:Or.MESSAGE_FORWARD_TYPE_INVALID});var c={to:t,conversationType:n,conversationID:"".concat(n).concat(t),priority:o,isPlaceMessage:0,status:on.UNSEND,currentUser:i,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||s.cloudCustomData||"",needReadReceipt:r,receiverList:a,isSupportExtension:e.isSupportExtension||!1},l=new ca(c);return l.setElement(s.getElements()[0]),l.setNickAndAvatar(u),l.setNameCard(this._getNameCardByGroupID(s)),l.setRelayFlag(!0),l}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(re){if(!Q&&!Z&&!oe)return;var n=ie.getSystemInfoSync().SDKVersion;if(Q&&Ft(n,"2.5.0")<0)return void this.outputWarning("WXChooseMessageFile");if(Z&&Ft(n,"1.18.0")<0)return void this.outputWarning("QQChooseMessageFile")}if(ae||oe){if(rt(e.payload.file)){var o=e.payload.file;e.payload.file={files:[o]}}else if(ct(e.payload.file)&&"undefined"!=typeof uni){var s=e.payload.file,r=s.tempFiles,a=s.files,i=null;lt(r)?i=r[0]:lt(a)&&(i=a[0]),e.payload.file={files:[i]}}}else if(Q||Z){var u=e.payload.file.tempFiles,c=t(t({},u[0]),{},{url:u[0].path});e.payload.file={files:[c]}}var l=this.getMyUserID();e.currentUser=l,e.senderTinyID=this.getMyTinyID();var d=new ca(e),p=new na({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),g=this._getNickAndAvatarByUserID(l);return d.setElement(p),d.setNickAndAvatar(g),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 ca(e),o=new ra(e.payload),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),n}},{key:"_onCannotFindModule",value:function(){return ha({code:Or.CANNOT_FIND_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(!1===this.getModule(uo).filterMessage(e,t))return this._onSendMessageFailed(e,new da({code:Or.PROFANITY_FOUND}));var o,s=null;switch(e.conversationType){case k.CONV_C2C:if(!(s=this.getModule(qn)))return this._onCannotFindModule();break;case k.CONV_GROUP:if(!(s=this.getModule(xn)))return this._onCannotFindModule();if(At({groupID:e.to})){var r=s.getLocalGroupProfile(e.to);if(r&&r.isSupportTopic)return ha({code:Or.MESSAGE_SEND_GROUP_WITH_TOPIC_FAIL})}break;default:return ha({code:Or.MESSAGE_SEND_INVALID_CONVERSATION_TYPE})}var a=this.getModule(Xn),i=this.getModule(xn);return a.upload(e).then((function(){n._getSendMessageSpecifiedKey(e)===Fr&&n.getModule(ro).addSuccessCount(qr);return i.guardForAVChatRoom(e).then((function(){if(!e.isSendable())return ha({code:Or.MESSAGE_FILE_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var r=function(e){var t="utf-8";ae&&document&&(t=document.charset.toLowerCase());var n,o,s=0;if(o=e.length,"utf-8"===t||"utf8"===t)for(var r=0;r<o;r++)(n=e.codePointAt(r))<=127?s+=1:n<=2047?s+=2:n<=65535?s+=3:(s+=4,r++);else if("utf-16"===t||"utf16"===t)for(var a=0;a<o;a++)(n=e.codePointAt(a))<=65535?s+=2:(s+=4,a++);else s=e.replace(/[^\x00-\xff]/g,"aa").length;return s}(JSON.stringify(e));return e.type===k.MSG_MERGER&&r>11264?n._mergerMessageHandler.uploadMergerMessage(e,r).then((function(o){var s=n._mergerMessageHandler.createMergerMessagePack(e,t,o);return n.request(s)})):(n.getModule(Kn).setMessageRandom(e),e.conversationType===k.CONV_C2C||e.conversationType===k.CONV_GROUP?s.sendMessage(e,t):void 0)})).then((function(r){var a=r.data,i=a.time,u=a.sequence,c=a.readReceiptCode;at(c)&&0!==c&&(new jr("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(u," readReceiptCode:").concat(c)).end(),Ve.w("".concat(n._n,".sendMessageInstance readReceiptCode:").concat(c," message:").concat(n.getErrorMessage(c))));n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence);var l=n.getModule(Kn);e.status=on.SUCCESS,e.time=i;var d=!1;if(e.conversationType===k.CONV_GROUP)e.sequence=u;else if(e.conversationType===k.CONV_C2C){var p=l.getLatestMessageSentByMe(e.conversationID);if(p){var g=p.nick,_=p.avatar;g===e.nick&&_===e.avatar||(d=!0)}}if(d&&l.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),s.isOnlineMessage(e,t))e._onlineOnlyFlag=!0;else{l.appendToMessageList(e);var h=e;ct(t)&&ct(t.messageControlInfo)&&(!0===t.messageControlInfo.excludedFromLastMessage&&(e._isExcludedFromLastMessage=!0,h=""),!0===t.messageControlInfo.excludedFromUnreadCount&&(e._isExcludedFromUnreadCount=!0));var f=e.conversationType;if(Nt(e.to))f=k.CONV_TOPIC,n.getModule(Bn).onMessageSent({groupID:Wt(e.to),topicID:e.to,lastMessage:h});l.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:f,subType:e.conversationSubType,lastMessage:h}]})}return e.getRelayFlag()||"TIMImageElem"!==e.type||xt(e.payload.imageInfoArray),la({message:e})}))})).catch((function(t){return n._onSendMessageFailed(e,t)}))}},{key:"_onSendMessageFailed",value:function(e,t){e.status=on.FAIL,this.getModule(Kn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new jr("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=m(e,2),s=o[0],r=o[1];n.setError(t,s,r).end()})),Ve.e("".concat(this._n,"._onSendMessageFailed error:"),t),ha(new da({code:t&&t.code?t.code:Or.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([k.MSG_IMAGE,k.MSG_AUDIO,k.MSG_VIDEO,k.MSG_FILE].includes(e.type))return Fr;if(e.conversationType===k.CONV_C2C)return Pr;if(e.conversationType===k.CONV_GROUP){var t=this.getModule(xn).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Lt(n)?wr:br}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(ro).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var s=this.getModule(ro);s.addSuccessCount(o),s.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n,o,s=t.code,r=void 0===s?-1:s,a=this.getModule(ro),i=this._getSendMessageSpecifiedKey(e);i===Fr&&(n=r,o=!1,Ui.includes(n)&&(o=!0),o)?a.addFailedCountOfUserSide(qr):Pi(r)&&i&&a.addFailedCountOfUserSide(i)}},{key:"resendMessage",value:function(e){return e.isResend=!0,e.status=on.UNSEND,this.sendMessageInstance(e)}},{key:"revokeMessage",value:function(e){var t=this,n=null;if(e.conversationType===k.CONV_C2C?n=this.getModule(qn):e.conversationType===k.CONV_GROUP&&(n=this.getModule(xn)),!n)return this._onCannotFindModule();var o=new jr("revokeMessage");o.setMessage("tjg_id:".concat(this.generateTjgID(e)," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to));var s="".concat(this._n,".").concat("revokeMessage");return n.revokeMessage(e).then((function(n){var r=n.data.recallRetList;if(!$t(r)&&0!==r[0].retCode){var a=new da({code:r[0].retCode,data:{message:e}});return o.setCode(a.code).setMoreMessage(a.message).end(),ha(a)}return Ve.i("".concat(s," ok. ID:").concat(e.ID)),e.isRevoked=!0,o.end(),t.getModule(Kn).onMessageRevoked([e]),la({message:e})})).catch((function(n){t.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];o.setError(n,s,r).end()}));var r=new da({code:n&&n.code?n.code:Or.MESSAGE_REVOKE_FAIL,message:n&&n.message?n.message:void 0,data:{message:e}});return Ve.w("".concat(s," failed. error:"),n),ha(r)}))}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],s=o.conversationID,r="",a=[],i=[];if(o.conversationType===k.CONV_C2C)n=this.getModule(qn),r=s.replace(k.CONV_C2C,""),e.forEach((function(e){e&&e.status===on.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||a.push("".concat(e.sequence,"_").concat(e.random,"_").concat(e.time)),i.push(e))}));else if(o.conversationType===k.CONV_GROUP)n=this.getModule(xn),r=s.replace(k.CONV_GROUP,""),e.forEach((function(e){e&&e.status===on.SUCCESS&&e.conversationID===s&&(e._onlineOnlyFlag||a.push("".concat(e.sequence)),i.push(e))}));else if(o.conversationType===k.CONV_SYSTEM)return ha({code:Or.CANNOT_DELETE_GROUP_SYSTEM_NOTICE});if(!n)return this._onCannotFindModule();if(0===a.length)return this._onMessageDeleted(i);a.length>30&&(a=a.slice(0,30),i=i.slice(0,30));var u=new jr("deleteMessage");u.setMessage("to:".concat(r," count:").concat(a.length));var c="".concat(this._n,".").concat("deleteMessage");return n.deleteMessage({to:r,keyList:a}).then((function(e){return u.end(),Ve.i("".concat(c," ok")),t._onMessageDeleted(i)})).catch((function(e){t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.w("".concat(c," failed. error:"),e);var n=new da({code:e&&e.code?e.code:Or.MESSAGE_DELETE_FAIL,message:e&&e.message?e.message:void 0});return ha(n)}))}},{key:"_onMessageDeleted",value:function(e){return this.getModule(Kn).onMessageDeleted(e),_a({messageList:e})}},{key:"translateText",value:function(e){var n="".concat(this._n,".").concat("translateText"),o=e.sourceTextList,s=e.sourceLanguage,r=e.targetLanguage,a=new jr("translateText");return a.setMessage("sourceLanguage:".concat(s," targetLanguage:").concat(r)),this.request({protocolName:Rr,requestData:{sourceTextList:o,source:s||"auto",target:r,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then((function(e){var o=e.data,s=o.error,r=o.requestID,i=o.translatedTextList;if(0===s.code)return a.end(),Ve.i("".concat(n," ok. requestID:").concat(r)),la({translatedTextList:i});throw t(t({},s),{},{requestID:r})})).catch((function(e){return a.setCode(e.code).setMoreMessage(e.requestID).end(),Ve.w("".concat(n," failed. error:"),e),ha({code:Or.TRANSLATE_TEXT_FAIL})}))}},{key:"modifyRemoteMessage",value:function(e){var t=this,n=null,o=e.conversationType,s=e.to;if(this.getModule(xn).isMessageFromOrToAVChatroom(s))return ha({code:Or.MESSAGE_MODIFY_DISABLED_IN_AVCHATROOM,data:{message:e}});if(!1===this.getModule(uo).filterMessage(e))return ha({code:Or.PROFANITY_FOUND,data:{message:e}});o===k.CONV_C2C?n=this.getModule(qn):o===k.CONV_GROUP&&(n=this.getModule(xn));var r=new jr("modifyMessage");r.setMessage("to:".concat(s));var a="".concat(this._n,".modifyRemoteMessage");return n.modifyRemoteMessage(e).then((function(n){r.end(),Ve.i("".concat(a," ok"));var o=t._onModifyRemoteMessageResp(e,n.data);return la({message:o})})).catch((function(n){if(r.setCode(n.code).setMoreMessage(n.message).end(),Ve.w("".concat(a," failed. error:"),n),20027===n.code){var o=t._onModifyRemoteMessageResp(e,n.data);return ha({code:Or.MESSAGE_MODIFY_CONFLICT,data:{message:o}})}return ha({code:n.code,message:n.message,data:{message:e}})}))}},{key:"_onModifyRemoteMessageResp",value:function(e,t){Ve.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),t);var n=e.conversationType,o=e.from,s=e.to,r=e.random,a=e.sequence,i=e.time,u=t.elements,c=t.messageVersion,l=t.cloudCustomData,d=void 0===l?"":l;return this.getModule(Kn).onMessageModified({conversationType:n,from:o,to:s,time:i,random:r,sequence:a,elements:u,cloudCustomData:d,messageVersion:c})}},{key:"_generateUUID",value:function(e){var t=this.getModule(Wn),n="".concat(t.getSDKAppID(),"-").concat(t.getUserID(),"-").concat(function(){for(var e="",t=32;t>0;--t)e+=It[Math.floor(Math.random()*Ct)];return e}()),o=e.name||e.value||e.url||e.tempFilePath,s=o&&o.slice(o.lastIndexOf(".")+1);return s&&(n="".concat(n,".").concat(s)),n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.getModule(Fn).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===k.CONV_GROUP){var t=this.getModule(xn);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),s}(go),wi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageExtensionModule",s.messageExtensionMap=new Map,s.globalSeqMap=new Map,s.getMessageExtensionsMap=new Map,s}return r(n,[{key:"onMessageExtensionNotify",value:function(e){var t=this,n=e.dataList,o=n.messageInfo,s=n.operateType,r=n.operateResultList,a=n.tinyID,i=n.globalSequence,u=o.clientTime,c=o.random,l="".concat(a,"-").concat(u,"-").concat(c),d=[],p=[];Ve.l("".concat(this._n,".onMessageExtensionNotify messageID:").concat(l," operateType:").concat(s," globalSequence:").concat(i)),this._updateGlobalSequence(l,i);var g=!1,_=!1;r.forEach((function(e){var n=e.extensions,o=void 0===n?[]:n,r=e.clearSequence;if(1===s)g=!0,o.forEach((function(e){d.push({key:e.key,value:e.value})})),t._updateLocalExtension(l,o);else if(2===s)_=!0,o.forEach((function(e){p.push(e.key)})),t._updateLocalExtension(l,o);else if(3===s){if(_=!0,t._hasLocalExtension(l))t._getLocalExtension(l).forEach((function(e,t){e.seq<=r&&!$t(e.value)&&p.push(t)}));t._clearLocalExtension(l,r)}})),g&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_UPDATED,{messageID:l,extensions:d}),_&&this.emitOuterEvent(E.MESSAGE_EXTENSIONS_DELETED,{messageID:l,keyList:p})}},{key:"setMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(H.MSG_EXT))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("setMessageExtensions"),s=e.ID,r=e.conversationID,a=e.sequence,i=e.time,u=v(t);t.length>20&&(u=t.slice(0,20),Ve.w("".concat(o,". the length of extensions cannot exceed 20.")));var c="conversationID:".concat(r," messageID:").concat(s," sequence:").concat(a," time:").concat(i," count:").concat(u.length),l=new jr("setMessageExtensions");return l.setMessage(c),Ve.l("".concat(o," ").concat(c)),this._modifyMessageExtensions(e,u).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,r="success count:".concat(n," fail count:").concat(s);return l.setMoreMessage(r).end(),Ve.l("".concat(o," ok. ").concat(r)),la({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"getMessageExtensions",value:function(e){var t=this;if(!this.canIUse(H.MSG_EXT))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var n="".concat(this._n,".").concat("getMessageExtensions"),o=e.ID,s=e.conversationID,r=e.sequence,a=e.time,i="conversationID:".concat(s," messageID:").concat(o," sequence:").concat(r," time:").concat(a),u=new jr("getMessageExtensions");u.setMessage(i),Ve.l("".concat(n," ").concat(i));var c=void 0;return this.getMessageExtensionsMap.has(o)&&(c=this._getGlobalSequence(o)),this._getMessageExtensions(e,c).then((function(e){return u.end(),Ve.l("".concat(n," ok. total count:").concat(e.length)),dt(c)&&e.length>0&&t.getMessageExtensionsMap.set(o,1),la({extensions:e})})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];u.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteMessageExtensions",value:function(e,t){var n=this;if(!this.canIUse(H.MSG_EXT))return ha({code:Or.CANNOT_USE_COMMERCIAL_ABILITY});var o="".concat(this._n,".").concat("deleteMessageExtensions"),s=[],r=3;$t(t)||(r=2,t.forEach((function(e){s.push({key:e,value:"",seq:0})})));var a=e.ID,i=e.conversationID,u=e.sequence,c=e.time,l="conversationID:".concat(i," messageID:").concat(a," sequence:").concat(u," time:").concat(c," operateType:").concat(r),d=new jr("deleteMessageExtensions");return d.setMessage(l),Ve.l("".concat(o," ").concat(l)),this._modifyMessageExtensions(e,s,r).then((function(e){var t=e.resultList,n=e.successCount,s=e.failureCount,a="";return 2===r&&(a="success count:".concat(n," fail count:").concat(s)),d.setMoreMessage("".concat(a)).end(),Ve.l("".concat(o," ok. ").concat(a)),la({extensions:t})})).catch((function(e){return n.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];d.setError(e,o,s).end()})),Ve.e("".concat(o," failed. error:"),e),ha(e)}))}},{key:"_modifyMessageExtensions",value:function(e,t){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=Nt(e.to)?k.CONV_TOPIC:e.conversationType,r=void 0;3!==o&&(r=this._getRequestExtensions(e,t));var a=null;switch(s){case k.CONV_C2C:a=this.getModule(qn);break;case k.CONV_GROUP:a=this.getModule(xn);break;case k.CONV_TOPIC:a=this.getModule(Bn);break;default:return ha({code:Or.CANNOT_FIND_MODULE})}return a.modifyMessageExtensions(e,r,o).then((function(t){var o=t.data,s=o.extensions,r=o.seq,a=[],i=0,u=0,c=[];return(s=$t(s)?[]:s).forEach((function(e){var t=e.errorCode,n=e.extension,o=n.key,s=n.value,r=n.seq;a.push({code:t,key:o,value:s}),0===t?i++:u++,c.push({key:o,value:s,seq:r})})),n._updateGlobalSequence(e.ID,r),c.length>0&&(n._updateLocalExtension(e.ID,c),c=null),{resultList:a,successCount:i,failureCount:u}})).catch((function(e){return ha(e)}))}},{key:"_getRequestExtensions",value:function(e,t){var n=[];if(this._hasLocalExtension(e.ID)){var o=this._getLocalExtension(e.ID);return t.forEach((function(e){var t=e.key,s=e.value,r=0;o.has(t)&&(r=o.get(t).seq),n.push({key:t,value:s,seq:r})})),n}return t.forEach((function(e){var t=e.key,o=e.value;n.push({key:t,value:o,seq:0})})),n}},{key:"_getMessageExtensions",value:function(e,t){var n=this,o="".concat(this._n,"._getMessageExtensions"),s=e.ID,r=e.to,a=null;switch(Nt(r)?k.CONV_TOPIC:e.conversationType){case k.CONV_C2C:a=this.getModule(qn);break;case k.CONV_GROUP:a=this.getModule(xn);break;case k.CONV_TOPIC:a=this.getModule(Bn);break;default:return ha({code:Or.CANNOT_FIND_MODULE})}return a.getMessageExtensions(e,t).then((function(t){var r=t.data,a=r.extensions,i=r.completeFlag,u=r.globalSequence,c=r.clearSequence;if(a=$t(a)?[]:a,Ve.l("".concat(o," ok. completeFlag:").concat(i," globalSequence:").concat(u," clearSequence:").concat(c," count:").concat(a.length)),n._updateLocalExtension(s,a),n._clearLocalExtension(s,c),n._updateGlobalSequence(s,u),1!==i){var l=a.slice(-1)[0].seq+1;return n._getMessageExtensions(e,l)}return n._getLocalExtensions(s)})).catch((function(e){return ha(e)}))}},{key:"_hasLocalExtension",value:function(e){return this.messageExtensionMap.has(e)}},{key:"_getLocalExtension",value:function(e){return this.messageExtensionMap.get(e)}},{key:"_updateLocalExtension",value:function(e,t){this._hasLocalExtension(e)||this.messageExtensionMap.set(e,new Map);var n=this._getLocalExtension(e);t.forEach((function(e){var t=e.key,o=e.value,s=void 0===o?"":o,r=e.seq;n.set(t,{value:s,seq:r})}))}},{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;$t(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(){Ve.l("".concat(this._n,".reset")),this.messageExtensionMap.clear(),this.globalSeqMap.clear(),this.getMessageExtensionsMap.clear()}}]),n}(go),Fi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ComboMessageModule",s}return r(n,[{key:"sendMessage",value:function(e){var t=this,n=this._constructMessageInstance(e);if(null===n)return ha({code:Or.MESSAGE_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.getModule(Kn).setMessageRandom(n),this._sendComboMessage(n,e).then((function(e){var s=e.data,r=s.time,a=s.sequence,i=s.readReceiptCode;at(i)&&0!==i&&(new jr("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(a," readReceiptCode:").concat(i)).end(),Ve.w("".concat(t._n,".sendMessage readReceiptCode:").concat(i," message:").concat(t.getErrorMessage(i))));t._addSendMessageSuccessCount(n,o);var u=t.getModule(Kn);n.status=on.SUCCESS,n.time=r,n.conversationType===k.CONV_GROUP&&(n.sequence=a),u.appendToMessageList(n);var c=n;return!0===n._isExcludedFromLastMessage&&(c=""),u.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:c}]}),la({message:n})})).catch((function(e){return t._onSendMessageFailed(n,e)}))}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.getModule($n),o="";return e.conversationType===k.CONV_C2C&&(o="".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)),e.conversationType===k.CONV_GROUP&&(o="".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_constructMessageInstance",value:function(e){var t="".concat(this._n,"._constructMessageInstance"),n=null;try{var o=this.getMyUserID(),s={};if(s.senderTinyID=this.getMyTinyID(),s.currentUser=o,s.from=e.From_Account||o,e.GroupId?(s.conversationID="".concat(k.CONV_GROUP).concat(e.GroupId),s.conversationType=k.CONV_GROUP,s.to=e.GroupId):e.To_Account&&(s.conversationID="".concat(k.CONV_C2C).concat(e.To_Account),s.conversationType=k.CONV_C2C,s.to=e.To_Account),s.time=e.MsgTimeStamp||0,s.random=e.Random||e.MsgRandom||0,s.priority=e.MsgPriority,it(e.CloudCustomData)&&e.CloudCustomData.length>0&&(s.cloudCustomData=e.CloudCustomData),lt(e.SendMsgControl)&&(s.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(s.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg")&&(s.messageControlInfo.excludedFromLastMessage=1)),s.conversationType===k.CONV_GROUP&<(e.To_Account)&&e.To_Account.length>0){var r=e.To_Account;e.To_Account.length>50&&(r=e.To_Account.slice(0,50),Ve.w("".concat(t," To_Account must be less than or equal to 50."))),s.receiverList=v(r),e.To_Account=v(r)}1!==e.IsNeedReadReceipt&&1!==e.NeedReadReceipt||(s.needReadReceipt=!0),1===e.SupportMessageExtension&&(s.isSupportExtension=!0),(n=new ca(s)).status=on.UNSEND,e.MsgClientTime=n.clientTime,n.conversationType===k.CONV_C2C&&(e.MsgSeq=n.sequence);for(var a,i=e.MsgBody.length,u=0;u<i;u++)"TIMTextElem"===(a=e.MsgBody[u]).MsgType?n.setTextElement(a.MsgContent.Text):"TIMCustomElem"===a.MsgType?n.setCustomElement({data:a.MsgContent.Data||"",description:a.MsgContent.Desc||"",extension:a.MsgContent.Ext||""}):"TIMFaceElem"===a.MsgType&&n.setFaceElement({index:a.MsgContent.Index,data:a.MsgContent.Data});var c=n.getElements();n.payload=c[0].content,n.type=c[0].type}catch(l){n=null,Ve.e("".concat(t," failed. error:"),l)}return n}},{key:"_onSendMessageFailed",value:function(e,t){e.status=on.FAIL,this.getModule(Kn).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new jr("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=m(e,2),s=o[0],r=o[1];n.setError(t,s,r).end()})),Ve.e("".concat(this._n,"._onSendMessageFailed error:"),t),ha(new da({code:t&&t.code?t.code:Or.MESSAGE_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===k.CONV_C2C)return Pr;if(e.conversationType===k.CONV_GROUP){var t=this.getModule(xn).getLocalGroupProfile(e.to);if(!t)return;var n=t.type;return Lt(n)?wr:br}}},{key:"_addSendMessageTotalCount",value:function(e){var t=this._getSendMessageSpecifiedKey(e);t&&this.getModule(ro).addTotalCount(t)}},{key:"_addSendMessageSuccessCount",value:function(e,t){var n=Math.abs(Date.now()-t),o=this._getSendMessageSpecifiedKey(e);if(o){var s=this.getModule(ro);s.addSuccessCount(o),s.addCost(o,n)}}},{key:"_addSendMessageFailCountOnUser",value:function(e,t){var n=t.code,o=void 0===n?-1:n,s=this.getModule(ro),r=this._getSendMessageSpecifiedKey(e);Pi(o)&&r&&s.addFailedCountOfUserSide(r)}}]),n}(go),qi=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="PluginModule",s.plugins={},s}return r(n,[{key:"registerPlugin",value:function(e){var t=this;Object.keys(e).forEach((function(n){t.plugins[n]=e[n]})),new jr("registerPlugin").setMessage("".concat(Object.keys(e))).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}]),n}(go),xi=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="SyncUnreadMessageModule",t._cookie="",t._onlineSyncFlag=!1,t.getInnerEmitterInstance().on(va,t._onLoginSuccess,_(t)),t}return r(s,[{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,s=e.syncFlag,r=e.isOnlineSync,a="".concat(this._n,"._startSync");Ve.l("".concat(a," cookie:").concat(o," syncFlag:").concat(s," isOnlineSync:").concat(r)),this.request({protocolName:vo,requestData:{cookie:o,syncFlag:s,isOnlineSync:r}}).then((function(e){var o=e.data,s=o.cookie,r=o.syncFlag;n._cookie=s,$t(s)||(0===r||1===r?(n._dispatchUnreadMessage(t(t({},e.data),{},{isSyncingEnded:!1})),n._startSync({cookie:s,syncFlag:r,isOnlineSync:0})):2===r&&n._dispatchUnreadMessage(t(t({},e.data),{},{isSyncingEnded:!0})))})).catch((function(e){Ve.e("".concat(a," failed. error:"),e)}))}},{key:"_dispatchUnreadMessage",value:function(e){e.eventArray&&this.getModule($n).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}});this.getModule(qn).onNewC2CMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList})}},{key:"startOnlineSync",value:function(){Ve.l("".concat(this._n,".startOnlineSync")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"startSyncOnReconnected",value:function(){Ve.l("".concat(this._n,".startSyncOnReconnected.")),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}]),s}(go),Vi={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"},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"},ignoreKeyWord:["C2C","ID","USP"]};function Hi(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=Bi(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 Bi=function(e){for(var t=!1,n=!1,o=!1,s=0;s<e.length;s++){var r=e[s];t&&/[a-zA-Z]/.test(r)&&r.toUpperCase()===r?(e=e.slice(0,s)+"-"+e.slice(s),t=!1,o=n,n=!0,s++):n&&o&&/[a-zA-Z]/.test(r)&&r.toLowerCase()===r?(e=e.slice(0,s-1)+"-"+e.slice(s-1),o=n,n=!1,t=!0):(t=r.toLowerCase()===r&&r.toUpperCase()!==r,o=n,n=r.toUpperCase()===r&&r.toLowerCase()!==r)}return e};function Ki(e,t){var n=0;return function e(t,o){if(++n>100)return n--,t;if(lt(t)){var s=t.map((function(t){return ut(t)?e(t,o):t}));return n--,s}if(ut(t)){var r=(a=t,i=function(e,t){if(!ft(t))return!1;if((s=t)!==Hi(s))for(var n=0;n<Vi.ignoreKeyWord.length&&!t.includes(Vi.ignoreKeyWord[n]);n++);var s;return dt(o[t])?function(e){return"OPPOChannelID"===e?e:e[0].toUpperCase()+Hi(e).slice(1)}(t):o[t]},u=Object.create(null),Object.keys(a).forEach((function(e){var t=i(a[e],e);t&&(u[t]=a[e])})),u);return r=Ut(r,(function(t,n){return lt(t)||ut(t)?e(t,o):t})),n--,r}var a,i,u}(e,t)}function Wi(e,t){if(lt(e))return e.map((function(e){return ut(e)?Wi(e,t):e}));if(ut(e)){var n=(o=e,s=function(e,n){return dt(t[n])?Hi(n):t[n]},r={},Object.keys(o).forEach((function(e){r[s(o[e],e)]=o[e]})),r);return n=Ut(n,(function(e){return lt(e)||ut(e)?Wi(e,t):e}))}var o,s,r}var Yi=String.fromCharCode,ji=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,ji),n=0|t.length,o=new Uint8Array(n),s=0;s<n;s=s+1|0)o[s]=0|t.charCodeAt(s);return o},zi=function(e){for(var t=new Uint8Array(e),n="",o=0,s=t.length;o<s;){var r=t[o],a=0,i=0;if(r<=127?(a=0,i=255&r):r<=223?(a=1,i=31&r):r<=239?(a=2,i=15&r):r<=244&&(a=3,i=7&r),s-o-a>0)for(var u=0;u<a;)i=i<<6|63&(r=t[o+u+1]),u+=1;else i=65533,a=s-o;n+=String.fromCodePoint(i),o+=a+1}return n},Xi=function(){function e(t){o(this,e),this._handler=t;var n=t.getURL();if(this._socket=null,this._workerSocket=null,this._id=yt(),this._handler.getIsWorkerEnabled()){var s=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(s);var r=this;this._workerSocket.onmessage=function(e){var t=e.data,n=t.callback,o=t.e;"onOpen"===n?r._onOpen():"onClose"===n?r._onClose(o):"onError"===n?r._onError(o):"onMessage"===n&&r._onMessage(e.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:n})}else re?te?(ie.connectSocket({url:n,header:{"content-type":"application/json"}}),ie.onSocketClose(this._onClose.bind(this)),ie.onSocketOpen(this._onOpen.bind(this)),ie.onSocketMessage(this._onMessage.bind(this)),ie.onSocketError(this._onError.bind(this))):(this._socket=ie.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))):ae&&(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 r(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?zi(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),te)return ie.offSocketClose(),ie.offSocketMessage(),ie.offSocketOpen(),ie.offSocketError(),void ie.closeSocket();this._socket&&(re?(this._socket.onClose((function(){})),this._socket.onOpen((function(){})),this._socket.onMessage((function(){})),this._socket.onError((function(){}))):ae&&(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),ee?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(te)return void ie.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}});this._socket&&(re?this._socket.send({data:this._canIUseBinaryFrame?Ji(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):ae&&this._socket.send(this._canIUseBinaryFrame?Ji(e.data).buffer:e.data))}}}]),e}(),Qi=4e3,Zi=4001,$i=["keyMap"],eu=["keyMap"],tu="connected",nu="connecting",ou="disconnected",su=function(){function e(t){o(this,e),this._channelModule=t,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=ou,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=yt(),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 r(e,[{key:"_setWebsocketHost",value:function(){var e=this._channelModule.getModule(Wn),t=G;this._channelModule.isOversea()&&(t=U),e.isSingaporeSite()?t=P:e.isKoreaSite()?t=b:e.isGermanySite()?t=w:e.isIndiaSite()?t=F:e.isJapanSite()?t=q:e.isUSASite()&&(t=x),V.HOST.setCurrent(t)}},{key:"_initConnection",value:function(){dt(V.HOST.CURRENT.BACKUP)||""===this._url?this._url=V.HOST.CURRENT.DEFAULT:this._url===V.HOST.CURRENT.DEFAULT?this._url=V.HOST.CURRENT.BACKUP:this._url===V.HOST.CURRENT.BACKUP?this._url=this._canIUseAnyCast()?V.HOST.CURRENT.ANYCAST:V.HOST.CURRENT.DEFAULT:this._url===V.HOST.CURRENT.ANYCAST&&(V.HOST.CURRENT.ANYCAST="",this._url=V.HOST.CURRENT.DEFAULT);var e=this._channelModule.getModule(Wn).getProxyServer();$t(e)||(this._url=e),this._connect(),this._nextPingTs=0}},{key:"_canIUseAnyCast",value:function(){return ae&&V.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,s=t.timestamp,r=15e3;-1!==n.indexOf(_o)&&(r=9e4),Date.now()-s>=r&&(Ve.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new da({code:Or.NETWORK_TIMEOUT})),e._channelModule.onRequestTimeout(n))}))}},{key:"onOpen",value:function(e){if(""!==this._readyState){this._onOpenTs=Date.now();var t=e.id;this._socketID=t;var n=Date.now()-this._startTs;Ve.l("".concat(this._n,"._onOpen cost ").concat(n," ms. socketID:").concat(t)),new jr("wsOnOpen").setMessage(n).setCostTime(n).setMoreMessage("socketID:".concat(t)).end(),e.id===this._socketID&&(this._readyState=tu,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 jr("wsOnClose"),n=e.id,o=e.e,s="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),r=0;0!==this._onOpenTs&&(r=Date.now()-this._onOpenTs),t.setMessage(r).setCostTime(r).setMoreMessage(s).setCode(o.code).end(),Ve.l("".concat(this._n,"._onClose ").concat(s," onlineTime:").concat(r)),n===this._socketID&&(this._readyState=ou,r<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 jr("wsOnError").setMessage(n.errMsg||vt(n)).setMoreMessage(o).setLevel("error").end(),Ve.w("".concat(this._n,"._onError"),n,o),t===this._socketID&&(this._readyState="",this._channelModule.onError())}},{key:"onMessage",value:function(e){var t;try{t=JSON.parse(e.data)}catch(c){new jr("jsonParseError").setMessage(e.data).end()}if(t&&t.head){var n=this._getRequestIDFromHead(t.head),o=t.body;if(!this._isTRTCCommand(n)){var s=Vt(t.head);o=Wi(t.body,this._getResponseKeyMap(s))}if(Ve.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 r=this._promiseMap.get(n),a=r.resolve,i=r.reject,u=r.timestamp;return this._promiseMap.delete(n),this._calcRTT(u),void(o.errorCode&&0!==o.errorCode?(this._channelModule.onErrorCodeNotZero(o),i(new da({code:o.errorCode,message:o.errorInfo||"",data:n.includes(Jo)||n.includes(Fs)?{elements:o.elements,messageVersion:o.messageVersion,cloudCustomData:o.cloudCustomData}:void 0}))):a(la(o)))}this._channelModule.onMessage({head:t.head,body:o})}}},{key:"_isTRTCCommand",value:function(e){for(var t=this._channelModule.getModule(co).getCommandList(),n=!1,o=0;o<t.length;o++)if(e.startsWith(t[o])){n=!0;break}return n}},{key:"_calcRTT",value:function(e){var t=Date.now()-e;this._channelModule.getModule(ro).addRTT(t)}},{key:"_connect",value:function(){this._startTs=Date.now(),this._onOpenTs=0,this._socket=new Xi(this),this._socketID=this._socket.getID(),this._readyState=nu,Ve.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL())),new jr("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end()}},{key:"getURL",value:function(){this._channelModule.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=wt();(te||Q&&"windows"===e||oe)&&(this._canIUseBinaryFrame=!1);var t=-1;"ios"===e?t=ve||-1:"android"===e&&(t=ye||-1);var n=this._channelModule.getModule(Wn),o=this._channelModule.getPlatform(),s=n.getSDKAppID(),r=n.getInstanceID(),a="sdkappid=".concat(s,"&instanceid=").concat(r,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(e,"&version=").concat(t);return this._canIUseBinaryFrame?"".concat(this._url,"/binfo?").concat(a):"".concat(this._url,"/info?").concat(a)}},{key:"_closeConnection",value:function(e){Ve.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=ou)}},{key:"_resend",value:function(){var e=this;if(Ve.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,s=t.resolve,r=t.reject;e._promiseMap.set(n,{resolve:s,reject:r,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=m(t.value,2),s=o[0],r=o[1];this._execute(s,r)}}catch(a){n.e(a)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this;e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var n=g(e,$i),o=this._getRequestIDFromHead(e.head),s=JSON.stringify(n);return new Promise((function(e,r){(t._promiseMap.set(o,{resolve:e,reject:r,timestamp:Date.now(),uplinkData:s}),Ve.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==tu)?t._reConnect():(t._execute(o,s),t._channelModule.getModule(ro).addRequestCount())}))}},{key:"simplySend",value:function(e){e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.keyMap;var t=g(e,eu),n=this._getRequestIDFromHead(e.head),o=JSON.stringify(t);this._readyState!==tu?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(n,o):Ve.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:re?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){Ve.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=yt()),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({},Vi.response),n.response)}},{key:"_reConnect",value:function(){this._readyState!==tu&&this._readyState!==nu&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e=this,t="".concat(this._n,".forcedReconnect");Ve.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(Zi),this._initConnection()):(this._reConnectCount=0,this._channelModule.probeNetwork().then((function(n){var o=m(n,2),s=o[0];o[1],s?(Ve.w("".concat(t," disconnected from wsserver but network is ok, continue...")),e._closeConnection(Zi),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===tu}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"setIsWorkerEnabled",value:function(e){Ve.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&Se}},{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(){Ve.l("".concat(this._n,".close")),this._closeConnection(Qi),this._promiseMap.clear(),this._startSequence=yt(),this._readyState=ou,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),e}(),ru=function(e){i(n,e);var t=f(n);function n(e){var s;if(o(this,n),(s=t.call(this,e))._n="ChannelModule",s._socketHandler=new su(_(s)),s._probing=!1,s._isAppShowing=!0,s._previousState=k.NET_STATE_CONNECTED,re&&"function"==typeof ie.onAppShow&&"function"==typeof ie.onAppHide){var r=s._onAppHide.bind(_(s)),a=s._onAppShow.bind(_(s));"function"==typeof ie.offAppHide&&ie.offAppHide(r),"function"==typeof ie.offAppShow&&ie.offAppShow(a),ie.onAppHide(r),ie.onAppShow(a)}return s._timerForNotLoggedIn=-1,s._timerForNotLoggedIn=setInterval(s.onCheckTimer.bind(_(s)),1e3),s._fatalErrorFlag=!1,s}return r(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($n).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.getModule($n).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==k.NET_STATE_CONNECTED&&e.head.servcmd.includes(ar)?(this.reConnect(),this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(e){var t=V.HOST.CURRENT.STAT;return new Promise((function(n,o){var s="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(e.head.sdkappid,"&reqtime=").concat(Date.now()),r=JSON.stringify(e.body),a="application/x-www-form-urlencoded;charset=UTF-8";if(re)ie.request({url:s,data:r,method:"POST",timeout:3e3,header:{"content-type":a},success:function(){n()},fail:function(){o(new da({code:Or.NETWORK_ERROR}))}});else{var i=new XMLHttpRequest,u=setTimeout((function(){i.abort(),o(new da({code:Or.NETWORK_TIMEOUT}))}),3e3);i.onreadystatechange=function(){4===i.readyState&&(clearTimeout(u),200===i.status||304===i.status?n():o(new da({code:Or.NETWORK_ERROR})))},i.open("POST",s,!0),i.setRequestHeader("Content-type",a),i.send(r)}}))}},{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(k.NET_STATE_DISCONNECTED));this.reConnect()}},{key:"onError",value:function(){re&&!oe&&this.outputWarning("DomainNameInMP"),this._emitNetStateChangeEvent(k.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.getModule($n).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(){Ve.l("".concat(this._n,".onReconnected")),this._m.restartTimer(),this.getModule($n).onReconnected(),this._emitNetStateChangeEvent(k.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){Ve.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(k.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(k.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(Ve.l("".concat(this._n,".reConnect ").concat(n)),!this._fatalErrorFlag&&this._socketHandler){if(!0===e)this._socketHandler.forcedReconnect();else{if(this._previousState===k.NET_STATE_CONNECTING&&t)return;this._socketHandler.forcedReconnect()}this._emitNetStateChangeEvent(k.NET_STATE_CONNECTING)}}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(Ve.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),this._previousState=e,this.emitOuterEvent(E.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e=this;if(!0!==this._probing){this._probing=!0;var t=this.getModule($n).getProtocolData({protocolName:ir});this.send(t).then((function(){e._probing=!1})).catch((function(t){if(Ve.w("".concat(e._n,"._ping failed. error:"),t),e._probing=!1,t&&60002===t.code)return new jr("error").setMessage("code:".concat(t.code," message:").concat(t.message)).setNetworkType(e.getModule(Jn).getNetworkType()).end(),e._fatalErrorFlag=!0,void e._emitNetStateChangeEvent(k.NET_STATE_DISCONNECTED);e.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];Ve.l("".concat(e._n,"._ping failed. probe network, isAppShowing:").concat(e._isAppShowing," online:").concat(o," networkType:").concat(s)),o?e.reConnect():e._emitNetStateChangeEvent(k.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(){Ve.l("".concat(this._n,".reset")),this._previousState=k.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3)}}]),n}(go),au=["a2","tinyid"],iu=["a2","tinyid"],uu=function(){function e(t){o(this,e),this._n="ProtocolHandler",this._sessionModule=t,this._configMap=new Map,this._fillConfigMap()}return r(e,[{key:"_fillConfigMap",value:function(){this._configMap.clear();var e=this._sessionModule.genCommonHead(),n=this._sessionModule.genCosSpecifiedHead(),o=this._sessionModule.genSSOReportHead(),s=this._sessionModule.isIntl();this._configMap.set(_o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0},keyMap:{request:{deviceBrand:"InstType"},response:{InstId:"instanceID",HelloInterval:"helloInterval"}}}}(e)),this._configMap.set(ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.LOGOUT)}),body:{type:0},keyMap:{request:{type:"wslogout_type"}}}}(e)),this._configMap.set(fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.HELLO)}),body:{isWebUniapp:0},keyMap:{response:{NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.STAT_SERVICE,".").concat(V.CMD.KICK_OTHER)}),body:{}}}(e)),this._configMap.set(or,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_COS_SIGN,".").concat(V.CMD.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{request:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},response:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}}(n)),this._configMap.set(sr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{request:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},response:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}}(n)),this._configMap.set(rr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.CUSTOM_UPLOAD,".").concat(V.CMD.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{request:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},response:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}}(n)),this._configMap.set(fr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{request:{SDKAppID:"uint32_sdkappid"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(mr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}}(e)),this._configMap.set(_r,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.FETCH_CLOUD_CONTROL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{request:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(hr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_CONFIG_MANAGER,".").concat(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG)}),body:{},keyMap:{response:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}}(e)),this._configMap.set(vr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OVERLOAD_PUSH,".").concat(V.CMD.OVERLOAD_NOTIFY)}),body:{},keyMap:{response:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}}(e)),this._configMap.set(vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_MESSAGES)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},response:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}}(e)),s||(this._configMap.set(Mo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.BIG_DATA_HALLWAY_AUTH_KEY)}),body:{}}}(e)),this._configMap.set(Nr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_MSG_AUDIT_MGR,".").concat(V.CMD.GET_RPOFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{request:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},response:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}}(e))),this._configMap.set(yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_MESSAGE)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt"}}}}(e)),this._configMap.set(Io,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_GROUP_MESSAGE)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{badgeMode:0,isVoipPush:void 0},androidInfo:{OPPOChannelID:""}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0},keyMap:{request:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account"},response:{MsgTime:"time",MsgSeq:"sequence"}}}}(e)),this._configMap.set(Vo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.REVOKE_C2C_MESSAGE)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{request:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}}(e)),this._configMap.set(Ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.REVOKE_GROUP_MESSAGE)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{request:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}}(e)),this._configMap.set(Wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_ROAM_MESSAGES)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{request:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},response:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}}(e)),this._configMap.set(Jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_C2C_MESSAGE)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(Ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_ROAM_MESSAGES)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:"",topicID:void 0},keyMap:{request:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},response:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsPlaceMsg:"isPlaceMessage",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList"}}}}(e)),this._configMap.set(Ho,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_MESSAGE_READ)}),body:{C2CMsgReaded:void 0},keyMap:{request:{lastMessageTime:"LastedMsgTime"}}}}(e)),this._configMap.set(Bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{request:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}}(e)),this._configMap.set(Ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{updateSequence:0},keyMap:{response:{MuteNotificationsList:"muteFlagList"}}}}(e)),this._configMap.set(Es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_MESSAGE_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{request:{messageReadSeq:"MsgReadedSeq"}}}}(e)),this._configMap.set(ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SET_ALL_MESSAGE_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{request:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},response:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}}(e)),this._configMap.set(jo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_C2C_MESSAGE)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{request:{keyList:"MsgKeyList"}}}}(e)),this._configMap.set(ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MESSAGE)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{request:{deleter:"Deleter_Account",keyList:"Seqs"}}}}(e)),this._configMap.set(Rr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_TRANSLATE,".").concat(V.CMD.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{request:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},response:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}}(e)),this._configMap.set(Fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MODIFY_GROUP_MESSAGE)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{request:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}}(e)),this._configMap.set(Ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequence:"MsgSeq"}}}}(e)),this._configMap.set(Ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{request:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}}(e)),this._configMap.set(As,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{request:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}}(e)),this._configMap.set(Rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{request:{sequence:"MsgSeq",count:"Num"},response:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}}(e)),this._configMap.set(zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_C2C_MESSAGE_EXTENSIONS)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}}(e)),this._configMap.set(Ks,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.MODIFY_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}}(e)),this._configMap.set(Ws,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM_MSG_EXT,".").concat(V.CMD.GET_GROUP_MESSAGE_EXTENSIONS)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}}(e)),this._configMap.set(Yo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.GET_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{request:{userIDList:"To_Account"},response:{ReadTime:"peerReadTimeList"}}}}(e)),this._configMap.set(Zo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,count:0},keyMap:{request:{},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime"}}}}(e)),this._configMap.set(Qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PAGING_GET_CONVERSATION_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:4,assistFlag:15},keyMap:{request:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},response:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID"}}}}(e)),this._configMap.set($o,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{request:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},response:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}}(e)),this._configMap.set(es,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CLEAR_HISTORY_MESSAGE)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{request:{toGroupID:"ToGroupid"}}}}(e)),this._configMap.set(ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.PIN_CONVERSATION)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{request:{itemList:"RecentContactItem"}}}}(e)),this._configMap.set(ns,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(ss,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.MARK_CONVERSATION)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},response:{ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(rs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.CREATE_CONVERSATION_GROUP)}),body:{fromAccount:"",itemList:void 0},keyMap:{request:{itemList:"GroupContactItem",groupID:"ToGroupId"},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}}(e)),this._configMap.set(as,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.DELETE_CONVERSATION_GROUP)}),body:{fromAccount:"",groupName:void 0},keyMap:{request:{},response:{GroupId:"convGroupID"}}}}(e)),this._configMap.set(is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},response:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}}(e)),this._configMap.set(us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.UPDATE_CONVERSATION_GROUP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{request:{},response:{}}}}(e)),this._configMap.set(ls,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.RECENT_CONTACT,".").concat(V.CMD.GET_CONVERSATION_GROUP_LIST)}),body:{fromAccount:"",startTime:void 0,startIndex:void 0},keyMap:{request:{},response:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}}(e)),this._configMap.set(Co,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_GET)}),body:{fromAccount:"",userItem:[]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(To,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.PROFILE,".").concat(V.CMD.PORTRAIT_SET)}),body:{fromAccount:"",profileItem:[{tag:Be.NICK,value:""},{tag:Be.GENDER,value:""},{tag:Be.ALLOWTYPE,value:""},{tag:Be.AVATAR,value:""}]},keyMap:{request:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}}(e)),this._configMap.set(Do,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.GET_BLACKLIST)}),body:{fromAccount:"",startIndex:0,maxLimited:30,lastSequence:0},keyMap:{response:{CurruentSequence:"currentSequence"}}}}(e)),this._configMap.set(Eo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.ADD_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(ko,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_BLACKLIST)}),body:{fromAccount:"",toAccount:[]}}}(e)),this._configMap.set(Tr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_SELF_STATUS)}),body:{customStatus:""},keyMap:{}}}(e)),this._configMap.set(Dr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}}(e)),this._configMap.set(Er,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(kr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.UNSUBSCRIBE_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{response:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}}(e)),this._configMap.set(So,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.GET_FRIEND_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{response:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}}(e)),this._configMap.set(Ro,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.ADD_FRIEND)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{request:{source:"AddSource",wording:"AddWording",type:"AddType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Oo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.UPDATE_FRIEND)}),body:{fromAccount:"",updateItem:void 0},keyMap:{request:{snsItem:"SnsItem"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(No,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"DeleteType"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Lo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.GET_FRIEND_PROFILE)}),body:{fromAccount:"",userIDList:void 0},keyMap:{response:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}}(e)),this._configMap.set(Ao,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.CHECK_FRIEND)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{request:{type:"CheckType"},response:{InfoItem:"resultList"}}}}(e)),this._configMap.set(Uo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.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(Go,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.RESPOND_FRIEND_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{request:{tag:"TagName",action:"ResponseAction"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(Po,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_FRIEND_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{request:{type:"PendencyType",userIDList:"To_Account"},response:{ResultItem:"resultList"}}}}(e)),this._configMap.set(bo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.REPORT_FRIEND_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{request:{latestTimeStamp:"LatestPendencyTimeStamp"}}}}(e)),this._configMap.set(Fo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.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(qo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.DELETE_FRIEND_GROUP)}),body:{fromAccount:"",nameList:void 0},keyMap:{request:{nameList:"GroupName"}}}}(e)),this._configMap.set(wo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.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(xo,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.FRIEND,".").concat(V.CMD.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(ds,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_JOINED_GROUPS)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0},keyMap:{request:{memberAccount:"Member_Account"},response:{GroupIdList:"groups",NoUnreadSeqList:"excludedUnreadSequenceList",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime"}}}}(e)),this._configMap.set(ps,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_INFO)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember"],groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{request:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CREATE_GROUP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{request:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},response:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}}(e)),this._configMap.set(_s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DESTROY_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_INFO)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{request:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},response:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}}(e)),this._configMap.set(fs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{request:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},response:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}}(e)),this._configMap.set(ms,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,au)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_NO_AUTH,".").concat(V.CMD.APPLY_JOIN_GROUP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{request:{applyMessage:"ApplyMsg"},response:{HugeGroupFlag:"avChatRoomFlag"}}}}(e)),this._configMap.set(vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.QUIT_GROUP)}),body:{groupID:void 0}}}(e)),this._configMap.set(Ms,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SEARCH_GROUP_BY_ID)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}},keyMap:{response:{}}}}(e)),this._configMap.set(ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CHANGE_GROUP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{request:{newOwnerID:"NewOwner_Account"}}}}(e)),this._configMap.set(Is,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_APPLY_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Cs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_INVITE_JOIN_GROUP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{request:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}}(e)),this._configMap.set(Ts,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.HANDLE_GROUP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{request:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}}(e)),this._configMap.set(Os,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_APPLICATION)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{request:{handleAccount:"Handle_Account"},response:{To_Account:"userID"}}}}(e)),this._configMap.set(Gs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.DELETE_GROUP_SYSTEM_MESSAGE)}),body:{messageListToDelete:void 0},keyMap:{request:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}}(e)),this._configMap.set(Us,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(Ps,function(e){return e.a2,e.tinyid,{head:t(t({},g(e,iu)),{},{servcmd:"".concat(V.NAME.BIG_GROUP_LONG_POLLING_NO_AUTH,".").concat(V.CMD.AVCHATROOM_LONG_POLL)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{request:{USP:"USP"},response:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}}(e)),this._configMap.set(bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_ONLINE_MEMBER_NUM)}),body:{groupID:void 0}}}(e)),this._configMap.set(qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.SET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key",value:"value"}}}}(e)),this._configMap.set(Vs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_ATTRIBUTES)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{request:{key:"key"}}}}(e)),this._configMap.set(Hs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.CLEAR_GROUP_ATTRIBUTES)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}}(e)),this._configMap.set(Bs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_ATTR,".").concat(V.CMD.GET_GROUP_ATTRIBUTES)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{request:{avChatRoomKey:"Key",groupType:"GroupType"}}}}(e)),this._configMap.set(Ys,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_NOTIFY)}),body:{notifyType:1,groupID:"",beginTime:0,endTime:0,limit:20},keyMap:{request:{},response:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList"}}}}(e)),this._configMap.set(js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.UPDATE_GROUP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{request:{counterList:"GroupCounter"}}}}(e)),this._configMap.set(Js,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{request:{keyList:"GroupCounterKeys"}}}}(e)),this._configMap.set(Mr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{request:{avatar:"FaceUrl"}}}}(e)),this._configMap.set(yr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.DELETE_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{request:{topicIDList:"TopicIdList"},response:{DestroyResultItem:"resultList"}}}}(e)),this._configMap.set(Ir,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{request:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}}(e)),this._configMap.set(Cr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_COMMUNITY,".").concat(V.CMD.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{request:{topicIDList:"TopicIdList"},response:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence",NoUnreadSeqList:"excludedUnreadSequenceList"}}}}(e)),this._configMap.set(zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:["Role","NameCard","ShutUpUntil","JoinTime"],memberCustomFieldFilter:void 0},keyMap:{request:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}}(e)),this._configMap.set(Xs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.GET_AVCHATROOM_MEMBER_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{request:{offset:"Timestamp",filter:"Mark"},response:{NextTimestamp:"offset"}}}}(e)),this._configMap.set(Qs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.GET_GROUP_MEMBER_INFO)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{request:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},response:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}}(e)),this._configMap.set(Zs,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.ADD_GROUP_MEMBER)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{request:{userID:"Member_Account",userIDList:"MemberList"},response:{MemberList:"members"}}}}(e)),this._configMap.set($s,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.DELETE_GROUP_MEMBER)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{request:{userIDList:"MemberToDel_Account"}}}}(e)),this._configMap.set(er,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.BAN_AVCHATROOM_MEMBER)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{request:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}}(e)),this._configMap.set(tr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP,".").concat(V.CMD.MODIFY_GROUP_MEMBER_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{request:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}}(e)),this._configMap.set(nr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.GROUP_AVCHATROOM,".").concat(V.CMD.MARK_AVCHATROOM_MEMBER_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{request:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},response:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}}(e)),this._configMap.set(ar,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STAT,".").concat(V.CMD.TIM_WEB_REPORT_V2)}),body:{header:{},event:[],quality:[]},keyMap:{request:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}}(o)),this._configMap.set(ir,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.HEARTBEAT,".").concat(V.CMD.ALIVE)}),body:{}}}(e)),this._configMap.set(ur,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MESSAGE_PUSH)}),body:{},keyMap:{response:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}}(e)),this._configMap.set(cr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_PUSH,".").concat(V.CMD.MULTI_MESSAGE_PUSH)}),body:{},keyMap:{response:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}}(e)),this._configMap.set(lr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.OPEN_IM,".").concat(V.CMD.MESSAGE_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{request:{sessionData:"SessionData"}}}}(e)),this._configMap.set(dr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{response:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}}(e)),this._configMap.set(gr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.DOWNLOAD_MERGER_MESSAGE)}),body:{downloadKey:""},keyMap:{response:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}}(e)),this._configMap.set(pr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_LONG_MESSAGE,".").concat(V.CMD.UPLOAD_MERGER_MESSAGE)}),body:{messageList:[]},keyMap:{request:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}}(e)),this._configMap.set(Ar,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0},keyMap:{request:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns"}}}}(e)),this._configMap.set(Lr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_FOREGROUND)}),body:{isWebUniapp:0}}}(e)),this._configMap.set(Sr,function(e){return{head:t(t({},e),{},{servcmd:"".concat(V.NAME.IM_OPEN_STATUS,".").concat(V.CMD.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{request:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}}(e))}},{key:"has",value:function(e){return this._configMap.has(e)}},{key:"get",value:function(e){return this._configMap.get(e)}},{key:"update",value:function(){this._fillConfigMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(Ve.w("".concat(this._n,".getKeyMap unknown protocolName:").concat(e)),{})}},{key:"getProtocolData",value:function(e){var t=e.protocolName,n=e.requestData,o=this.get(t),s=null;if(n){var r=this._simpleDeepCopy(o),a=this._updateService(n,r),i=a.body,u=Object.create(null);for(var c in i)if(Object.prototype.hasOwnProperty.call(i,c)){if(u[c]=i[c],void 0===n[c])continue;u[c]=n[c]}a.body=u,s=this._getUplinkData(a)}else s=this._getUplinkData(o);return s}},{key:"_getUplinkData",value:function(e){var t=this._requestDataCleaner(e),n=Vt(t.head),o=Ki(t.body,this._getRequestKeyMap(n));return t.body=o,t}},{key:"_updateService",value:function(e,t){var n=Vt(t.head);if(this._isFromGroupRequest(t)){var o=e.type,s=e.groupID,r=void 0===s?void 0:s,a=e.groupIDList,i=void 0===a?[]:a;dt(r)&&(r=i[0]||""),At({type:o,groupID:r})&&(t.head.servcmd="".concat(V.NAME.GROUP_COMMUNITY,".").concat(n))}return t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(V.NAME.GROUP)||e.head.servcmd.includes(V.NAME.GROUP_ATTR)}},{key:"_getRequestKeyMap",value:function(e){var n=this.getKeyMap(e);return t(t({},Vi.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)&&ft(o)&&null!==e[o]&&void 0!==e[o]&&("object"!==n(e[o])?t[o]=e[o]:t[o]=this._requestDataCleaner.bind(this)(e[o]));return t}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},s=0,r=n.length;s<r;s++)t=n[s],lt(e[t])?o[t]=Array.from(e[t]):ut(e[t])?o[t]=this._simpleDeepCopy(e[t]):o[t]=e[t];return o}}]),e}(),cu=[lr],lu=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._keys=v(this._eventHandlerMap.keys())}return r(e,[{key:"_c2cMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(qn);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(Zn).startOnlineSync();t.onNewC2CMessage({dataList:e.dataList,isInstantMessage:!0})}}},{key:"_c2cMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(qn);t&&t.onC2CMessageModified(e)}},{key:"_groupMessageArrayHandler",value:function(e){var t=this._sessionModule.getModule(xn);t&&t.onNewGroupMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_groupMessageModifiedHandler",value:function(e){var t=this._sessionModule.getModule(xn);t&&t.onGroupMessageModified(e)}},{key:"_groupTipsHandler",value:function(e){var t=this._sessionModule.getModule(xn);if(t){var n=e.event,o=e.dataList,s=e.isInstantMessage,r=void 0===s||s,a=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:o});break;case 5:for(var i=0;i<o.length;i++)if(lt(o[i].elements.revokedInfos))t.onGroupMessageRevoked({dataList:o});else if(lt(o[i].elements.groupMessageReadNotice))t.onGroupMessageReadNotice({dataList:o});else{if(!lt(o[i].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:o,isInstantMessage:r,isSyncingEnded:a});break}t.onReadReceiptList({dataList:o})}break;case 12:this._sessionModule.getModule(Kn).onNewGroupAtTips({dataList:o});break;default:Ve.l("".concat(this._n,"._groupTipsHandler unknown event:").concat(n," dataList:"),o)}}}},{key:"_C2CNotifyMessageArrayHandler",value:function(e){var t=this,n=e.dataList;if(lt(n)){var o=this._sessionModule.getModule(qn);n.forEach((function(e){if(ct(e))if(e.hasOwnProperty("kickoutMsgNotify")){var s=e.kickoutMsgNotify,r=s.kickType,a=s.newInstanceInfo,i=void 0===a?{}:a;1===r?t._sessionModule.onMultipleAccountKickedOut(i):2===r?t._sessionModule.onMultipleDeviceKickedOut(i):3===r&&t._sessionModule.onRestApiKickedOut(i)}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(Kn).onC2CMessageRemindTypeSynced({dataList:n})}}))}}},{key:"_C2CReadReceiptArrayHandler",value:function(e){this._sessionModule.getModule(qn).onReadReceiptList(e)}},{key:"_profileHandler",value:function(e){this._sessionModule.getModule(Fn).onProfileModified({dataList:e.dataList});var t=this._sessionModule.getModule(Vn);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_relationChainHandler",value:function(e){this._sessionModule.getModule(Fn).onRelationChainModified({dataList:e.dataList});var t=this._sessionModule.getModule(Vn);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_recentContactHandler",value:function(e){var t=e.dataList;if(lt(t)){var n=this._sessionModule.getModule(Kn);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 s=e.recentContactTopItem;n.onConversationPinned(s.recentContactList)}else if(3===t){var r=e.recentContactTopItem;n.onConversationUnpinned(r.recentContactList)}else if(4===t){var a=e.recentContactMarkContact;n.onConversationMarkUpdated(a.recentContactMarkContactItem)}else if(5===t){var i=e.recentContactCreateContactGroup;n.onConversationGroupCreated(i.msgContactGroupContactItem)}else if(6===t){var u=e.recentContactDelContactGroup;n.onConversationGroupDeleted(u.msgGroupItem)}else if(7===t){var c=e.recentContactUpdateContactGroup,l=c.updateType,d=c.msgUpdateGroup,p=c.msgUpdateContact;if(1===l){var g=d.updateGroupType;1===g?n.onConversationGroupNameUpdated(d):2===g&&n.onConversationInGroupUpdated(d)}else 2===l&&n.onConversationAddedToOrDeletedFromGroup(p)}}))}}},{key:"_allMessageReadHandler",value:function(e){var t=e.dataList,n=this._sessionModule.getModule(Kn);n&&n.onPushedAllMessageRead(t)}},{key:"_userStatusListHandler",value:function(e){this._sessionModule.getModule(Fn).onUserStatusUpdated(e)}},{key:"_messageExtensionNotifyHandler",value:function(e){this._sessionModule.getModule(wn).onMessageExtensionNotify(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMessageFromIMOpenPush(e)){var o=n.eventArray,s=n.isInstantMessage,r=n.isSyncingEnded,a=n.needSync;if(lt(o))for(var i=null,u=null,c=0,l=0,d=o.length;l<d;l++){c=(i=o[l]).event;var p=Object.keys(i).find((function(e){return-1!==t._keys.indexOf(e)}));p?(u=14===c?{readAllC2CMessage:i[p],groupMessageReadInfoList:i.groupMessageReadNotice||[]}:16===c?{userID:i.userID,readReceiptList:i[p]}:i[p],this._eventHandlerMap.get(p)({event:c,dataList:u,isInstantMessage:s,isSyncingEnded:r,needSync:a})):Ve.l("".concat(this._n,".onMessage unknown eventItem:").concat(i))}}}},{key:"_filterMessageFromIMOpenPush",value:function(e){var t=e.head,n=e.body,o=t.servcmd,s=!1;if(dt(o)||(s=o.includes(V.NAME.IM_CONFIG_MANAGER)||o.includes(V.NAME.OVERLOAD_PUSH)||o.includes(V.NAME.STAT_SERVICE)),!s)return!0;if(o.includes(V.CMD.PUSHED_CLOUD_CONTROL_CONFIG))this._sessionModule.getModule(no).onPushedCloudControlConfig(n);else if(o.includes(V.CMD.PUSHED_COMMERCIAL_CONFIG)){this._sessionModule.getModule(ao).onPushedConfig(n)}else if(o.includes(V.CMD.OVERLOAD_NOTIFY))this._sessionModule.onPushedServerOverload(n);else if(o.includes(V.CMD.KICK_OTHER)){var r=Date.now();this._sessionModule.reLoginOnKickOther();var a=new jr("kickOther"),i=this._sessionModule.getModule(Pn).getLastWsHelloTs(),u=r-i;a.setMessage("last wshello time:".concat(i," diff:").concat(u,"ms")).setNetworkType(this._sessionModule.getNetworkType()).end()}return!1}}]),e}(),du=[{cmd:V.CMD.GET_GROUP_INFO,interval:1,count:20},{cmd:V.CMD.GET_AVCHATROOM_MEMBER_LIST,interval:3,count:1},{cmd:V.CMD.GET_GROUP_APPLICATION,interval:1,count:15},{cmd:V.CMD.GET_TOPIC_LIST,interval:1,count:10},{cmd:V.CMD.SET_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:V.CMD.MODIFY_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:V.CMD.DELETE_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:V.CMD.CLEAR_GROUP_ATTRIBUTES,interval:5,count:10},{cmd:V.CMD.GET_GROUP_ATTRIBUTES,interval:5,count:20},{cmd:V.CMD.UPDATE_GROUP_COUNTER,interval:5,count:20},{cmd:V.CMD.GET_GROUP_COUNTER,interval:5,count:20},{cmd:V.CMD.SET_ALL_MESSAGE_READ,interval:1,count:1},{cmd:V.CMD.GET_USER_STATUS,interval:5,count:20},{cmd:V.CMD.SUBSCRIBE_USER_STATUS,interval:5,count:20},{cmd:V.CMD.UNSUBSCRIBE_USER_STATUS,interval:5,count:20}],pu=function(e){i(s,e);var n=f(s);function s(e){var t;return o(this,s),(t=n.call(this,e))._n="SessionModule",t._platform=t.getPlatform(),t._protocolHandler=new uu(_(t)),t._messageDispatcher=new lu(_(t)),t._commandFrequencyLimitMap=new Map,t._commandRequestInfoMap=new Map,t._serverOverloadInfoMap=new Map,t._init(),t.getInnerEmitterInstance().on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"_init",value:function(){this._updateCommandFrequencyLimitMap(du)}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");dt(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){Ve.d("".concat(this._n,".request options:"),e);var t=e.protocolName,n=e.tjgID;if(!this._protocolHandler.has(t))return Ve.w("".concat(this._n,".request unknown protocol:").concat(t)),ha({code:Or.CANNOT_FIND_PROTOCOL});var o=this.getProtocolData(e),s=o.head.servcmd;if(this._isFrequencyOverLimit(s))return ha({code:Or.OVER_FREQUENCY_LIMIT});if(this._isServerOverload(s))return ha({code:Or.OPEN_SERVICE_OVERLOAD_ERROR});$t(n)||(o.head.tjgID=n);var r=this.getModule(eo);return cu.includes(t)?r.simplySend(o):r.send(o)}},{key:"getKeyMap",value:function(e){return this._protocolHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.getModule(Wn);return{ver:"v4",platform:this._platform,websdkappid:O,websdkversion:R,a2:e.getA2Key()||void 0,tinyid:e.getTinyID()||void 0,status_instid:e.getStatusInstanceID(),sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getA2Key()?void 0:e.getUserID(),usersig:e.getA2Key()?void 0:e.getUserSig(),sdkability:192371,tjgID:""}}},{key:"genCosSpecifiedHead",value:function(){var e=this.getModule(Wn);return{ver:"v4",platform:this._platform,websdkappid:O,websdkversion:R,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:192371}}},{key:"genSSOReportHead",value:function(){var e=this.getModule(Wn);return{ver:"v4",platform:this._platform,websdkappid:O,websdkversion:R,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:192371}}},{key:"getProtocolData",value:function(e){return this._protocolHandler.getProtocolData(e)}},{key:"trans",value:function(e){var n=e.servcmd,o=e.data,s={head:t(t({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(eo).send(s)}},{key:"sendComboMessage",value:function(e){var n=e.servcmd,o=e.data,s={head:t(t({},this.genCommonHead()),{},{servcmd:n}),body:o};return this.getModule(eo).send(s)}},{key:"onErrorCodeNotZero",value:function(e){var t=e.errorCode;if(t===Or.HELLO_ANSWER_KICKED_OUT){var n=e.kickType,o=e.newInstanceInfo,s=void 0===o?{}:o;1===n?this.onMultipleAccountKickedOut(s):2===n?this.onMultipleDeviceKickedOut(s):3===n&&this.onRestApiKickedOut(s)}t!==Or.MESSAGE_A2KEY_EXPIRED&&t!==Or.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.getModule(eo).reConnect())}},{key:"onMessage",value:function(e){var t=e.body,n=t.needAck,o=void 0===n?0:n,s=t.sessionData;1===o&&this._sendACK(s),this._messageDispatcher.onMessage(e)}},{key:"onReconnected",value:function(){this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){Ve.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){Ve.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e=this;if(this.isLoggedIn()){var t=0,n=this.getModule(io);n.canIUseOfflinePush()&&(t=n.getUniAppPlatform()),this.request({protocolName:_o,requestData:{isWebUniapp:t}}).then((function(t){var n=t.data.instanceID;e.getModule(Wn).setStatusInstanceID(n),Ve.l("".concat(e._n,"._reLogin ok.")),e.getModule(Kn).syncConversationList().then((function(){Ve.l("".concat(e._n,"._reLogin, sync conversation list ok.")),e.getModule(so).start()})),e.getModule(xn).updateLocalMainSequenceOnReconnected();var o=e.getModule(Bn);o.resetGetTopicTime(),o.getTopicListOnReconnected()}))}}},{key:"onMultipleAccountKickedOut",value:function(e){this.getModule(Pn).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.getModule(Pn).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.getModule(Pn).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.getModule(Pn).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.request({protocolName:lr,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,s=n.interval,r=this._commandRequestInfoMap.get(t),a=r.startTime,i=r.requestCount;if(Date.now()-a>1e3*s)return this._commandRequestInfoMap.set(t,{startTime:Date.now(),requestCount:1}),!1;i+=1,this._commandRequestInfoMap.set(t,{startTime:a,requestCount:i});var u=!1;return i>o&&(u=!0),u}},{key:"_isServerOverload",value:function(e){if(!this._serverOverloadInfoMap.has(e))return!1;var t=this._serverOverloadInfoMap.get(e),n=t.overloadTime,o=t.waitingTime,s=!1;return Date.now()-n<=1e3*o?s=!0:(this._serverOverloadInfoMap.delete(e),s=!1),s}},{key:"onPushedServerOverload",value:function(e){var t=e.overloadCommand,n=e.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),Ve.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(n,"s"))}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._updateCommandFrequencyLimitMap(du),this._commandRequestInfoMap.clear(),this._serverOverloadInfoMap.clear()}}]),s}(go),gu=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="MessageLossDetectionModule",s._maybeLostSequencesMap=new Map,s._firstRoundRet=[],s}return r(n,[{key:"onMessageMaybeLost",value:function(e,t,n){this._maybeLostSequencesMap.has(e)||this._maybeLostSequencesMap.set(e,[]);for(var o=this._maybeLostSequencesMap.get(e),s=0;s<n;s++)-1===o.indexOf(t+s)&&o.push(t+s)}},{key:"detectFirstRound",value:function(e,t){var n=this._maybeLostSequencesMap.get(e);if(!$t(n)&&!$t(t)){var o=n.filter((function(e){return-1===t.indexOf(e)}));0===o.length?Ve.i("".concat(this._n,".detectFirstRound no message loss. conversationID:").concat(e)):this._firstRoundRet=this._firstRoundRet.concat(o),n.length=0}}},{key:"detectSecondRound",value:function(e,t){if(!$t(this._firstRoundRet)&&!$t(t)){var n=this._firstRoundRet.filter((function(e){return-1===t.indexOf(e)}));this._firstRoundRet.length=0;var o,s=n.length;if(0!==s)s<=5?o=e+"-"+n.join("-"):(n.sort((function(e,t){return e-t})),o=e+" start:"+n[0]+" end:"+n[s-1]+" count:"+s),new jr("messageLoss").setMessage(o).setNetworkType(this.getNetworkType()).setLevel("warning").end(),Ve.i("".concat(this._n,".detectSecondRound message loss detected. conversationID:").concat(e," lostSequences:").concat(n))}}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._maybeLostSequencesMap.clear(),this._firstRoundRet.length=0}}]),n}(go),_u=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="CloudControlModule",s._cloudConfig=new Map,s._expiredTime=0,s._version=0,s._isFetching=!1,s}return r(n,[{key:"getCloudConfig",value:function(e){return dt(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"_canFetchConfig",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e=this,t=this._canFetchConfig();if(Ve.l("".concat(this._n,".fetchConfig canFetchConfig:").concat(t)),t){var n=new jr("fetchCloudControlConfig"),o=this.getModule(Wn).getSDKAppID();this._isFetching=!0,this.request({protocolName:_r,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(),Ve.l("".concat(e._n,".fetchConfig ok")),e._parseCloudControlConfig(t.data)})).catch((function(t){e._isFetching=!1,e.probeNetwork().then((function(e){var o=m(e,2),s=o[0],r=o[1];n.setError(t,s,r).end()})),Ve.l("".concat(e._n,".fetchConfig failed. error:"),t),e._setExpiredTimeOnResponseError(12e4)}))}}},{key:"onPushedCloudControlConfig",value:function(e){Ve.l("".concat(this._n,".onPushedCloudControlConfig")),new jr("pushedCloudControlConfig").setNetworkType(this.getNetworkType()).setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parseCloudControlConfig(e)}},{key:"onCheckTimer",value:function(e){this._canFetchConfig()&&this.fetchConfig()}},{key:"_parseCloudControlConfig",value:function(e){var t=this,n="".concat(this._n,"._parseCloudControlConfig"),o=e.errorCode,s=e.errorMessage,r=e.cloudControlConfig,a=e.version,i=e.expiredTime;if(0===o){if(this._version!==a){var u=null;try{u=JSON.parse(r)}catch(c){this.isPrivateNetWork()||Ve.e("".concat(n," JSON parse error. cloudControlConfig:"),r)}u&&(this._cloudConfig.clear(),Object.keys(u).forEach((function(e){t._cloudConfig.set(e,u[e])})),this._version=a,this.emitInnerEvent(Ma))}this._expiredTime=Date.now()+1e3*i}else dt(o)?(Ve.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ve.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(s)),this._setExpiredTimeOnResponseError(12e4))}},{key:"_setExpiredTimeOnResponseError",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}]),n}(go),hu=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="RecoverMessageModule",s.PULL_LIMIT_COUNT=15,s}return r(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===k.CONV_GROUP&&e.groupProfile.type!==k.GRP_AVCHATROOM})),s=this.getModule(Kn),r=0,a=0,i=0;o.forEach((function(o){var u=o.conversationID,c=o.lastMessage;t=u.replace(k.CONV_GROUP,""),e=s.getLocalLastMessage(u),c&&0!==c.lastSequence&&e?(a=c.lastSequence,r=e.sequence,i=a-r,r>0&&i>=1&&i<300?n._recoverGroupMessage({groupID:t,localLastMessageSequence:r,remoteLastMessageSequence:a}):n._getGroupNotify(t)):n._getGroupNotify(t)}))}},{key:"_recoverC2CChat",value:function(){var e,t=this,n=this._getLocalConversationList().filter((function(e){return e.type===k.CONV_C2C})),o=this.getModule(Kn),s=0,r=0,a=0,i=[Promise.resolve()];n.forEach((function(n){var u=n.conversationID,c=n.lastMessage;e=o.getLocalLastMessage(u),c&&0!==c.lastTime&&e&&(r=c.lastTime,s=e.time,a=r-s,s>0&&a>=1&&a<=600&&i.push(t._recoverC2CMessage({conversationID:u,localLastMessageTime:s,remoteLastMessageTime:r})))})),Promise.all(i).then((function(){Ve.l("".concat(t._n,"._recoverC2CChat all promise fulfilled, start to sync unread messages")),t.getModule(Zn).startSyncOnReconnected()}))}},{key:"_getLocalConversationList",value:function(){return this.getModule(Kn).getLocalConversationList()}},{key:"_recoverGroupMessage",value:function(e){var t=this,n="".concat(this._n,"._recoverGroupMessage");Ve.l("".concat(n," options:"),e);var o=e.groupID,s=e.localLastMessageSequence,r=e.remoteLastMessageSequence;this._getGroupRomaingMessage({groupID:o,sequence:s}).then((function(e){var s=e.data,a=s.complete,i=s.messageList;if(!dt(i)){var u=i[0].sequence;Ve.l("".concat(n," pkgLastMessageSequence:").concat(u," complete:").concat(a)),u<r&&2!==a&&t._recoverGroupMessage({groupID:o,localLastMessageSequence:u,remoteLastMessageSequence:r}),new jr("recoverMessage").setNetworkType(t.getNetworkType()).setMessage("groupID:".concat(o," complete:").concat(a," messageList length:").concat(i.length)).end();var c=t.getModule(xn);i.length>1&&i.sort((function(e,t){return e.sequence-t.sequence}));for(var l=0;l<i.length;l++){var d=i[l];d.from!==k.CONV_SYSTEM?c.onNewGroupMessage({dataList:[d],isInstantMessage:!1,updateUnreadCount:!1}):c.onNewGroupTips({event:d.event,dataList:[d]})}t._getGroupNotify(o)}}))}},{key:"_getGroupNotify",value:function(e){this.getModule(xn).getGroupNotify(e)}},{key:"_getGroupRomaingMessage",value:function(e){var t=e.groupID,n=e.sequence;return this.request({protocolName:Ss,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");Ve.l("".concat(this._n,"._recoverC2CMessage options:"),e);var o=e.conversationID,s=e.localLastMessageTime,r=e.remoteLastMessageTime;return this._getC2CRoamingMessage({conversationID:o,time:s}).then((function(e){var s=e.data,a=s.complete,i=s.messageList;if(!dt(i)){var u=i.length;new jr("recoverMessage").setNetworkType(t.getNetworkType()).setMessage("".concat(o," complete:").concat(a," messageList length:").concat(u)).end(),t.getModule(qn).onNewC2CMessage({dataList:i,isInstantMessage:!0});var c=i[u-1].time;if(Ve.l("".concat(n," pkgLastMessageTime:").concat(c," complete:").concat(a)),c<r&&1!==a)return t._recoverC2CMessage({conversationID:o,localLastMessageTime:c,remoteLastMessageTime:r})}}))}},{key:"_getC2CRoamingMessage",value:function(e){var t=e.conversationID,n=e.time;return this.request({protocolName:Wo,requestData:{peerAccount:t.replace(k.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:n,direction:1}})}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset"))}}]),n}(go),fu=function(){function e(){o(this,e),this._n="AvgE2EDelay",this._e2eDelayArray=[]}return r(e,[{key:"addMessageDelay",value:function(e){var t=we()-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})),Ht(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=Ht(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,s=Math.min.apply(Math,v(n)),r=Math.max.apply(Math,v(n)),a=this._calcAvg(n,o),i=Ht(o/e.length*100,2);if(i>50)new jr("messageE2EDelayException").setMessage("count:".concat(o," min:").concat(s," max:").concat(r," avg:").concat(a," percent:").concat(i)).setLevel("warning").end()}}},{key:"getStatResult",value:function(){var e=this._e2eDelayArray.length;if(0===e)return null;var t=v(this._e2eDelayArray),n=this._calcCountWithLimit({e2eDelayArray:t,min:0,max:1}),o=this._calcCountWithLimit({e2eDelayArray:t,min:1,max:3}),s=this._calcPercent(n,e),r=this._calcPercent(o,e),a=this._calcAvg(t,e);return this._checkE2EDelayException(t,3),t.length=0,this.reset(),{totalCount:e,countLessThan1Second:n,percentOfCountLessThan1Second:s,countLessThan3Second:o,percentOfCountLessThan3Second:r,avgDelay:a}}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),e}(),mu=function(){function e(){o(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]}return r(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=Ht(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,v(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,v(this._rttArray))}},{key:"getStatResult",value:function(){var e=this._calcTotalCount(),t=v(this._rttArray);if(0===e)return null;var n=this._calcRTTCount(t),o=this._calcSuccessRateOfRequest(n,e),s=this._calcAvg(t,n);return Ve.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(s)),this.reset(),{totalCount:e,rttCount:n,successRateOfRequest:o,avgRTT:s}}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),e}(),vu=function(){function e(){o(this,e),this._map=new Map}return r(e,[{key:"initMap",value:function(e){var t=this;e.forEach((function(e){t._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}))}},{key:"addTotalCount",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).totalCount+=1,!0)}},{key:"addSuccessCount",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).successCount+=1,!0)}},{key:"addFailedCountOfUserSide",value:function(e){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).failedCountOfUserSide+=1,!0)}},{key:"addCost",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).costArray.push(t),!0)}},{key:"addFileSize",value:function(e,t){return!(dt(e)||!this._map.has(e))&&(this._map.get(e).fileSizeArray.push(t),!0)}},{key:"_calcSuccessRateOfBusiness",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=Ht(t.successCount/t.totalCount*100,2);return n>100&&(n=100),n}},{key:"_calcSuccessRateOfPlatform",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e),n=this._calcSuccessCountOfPlatform(e)/t.totalCount*100;return(n=Ht(n,2))>100&&(n=100),n}},{key:"_calcTotalCount",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return dt(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){if(dt(e)||!this._map.has(e))return-1;var t=this._map.get(e);return t.successCount+t.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return dt(e)||!this._map.has(e)?-1:e===qr?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t=this._map.get(e).costArray.length;if(0===t)return 0;var n=0;return this._map.get(e).costArray.forEach((function(e){n+=e})),parseInt(n/t)}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach((function(e){t+=e})),this._map.get(e).fileSizeArray.forEach((function(e){n+=e})),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t=this._calcTotalCount(e);if(0===t)return null;var n=this._calcSuccessCountOfBusiness(e),o=this._calcSuccessRateOfBusiness(e),s=this._calcSuccessCountOfPlatform(e),r=this._calcSuccessRateOfPlatform(e),a=this._calcAvg(e);return this.reset(e),{totalCount:t,successCountOfBusiness:n,successRateOfBusiness:o,successCountOfPlatform:s,successRateOfPlatform:r,avgValue:a}}},{key:"reset",value:function(e){dt(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),e}(),Mu=function(){function e(){o(this,e),this._lastMap=new Map,this._currentMap=new Map}return r(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(dt(t)||!this._lastMap.has(t)||!this._currentMap.has(t))return!1;var o=n.conversationID,s=n.sequence,r=o.replace(k.CONV_GROUP,"");if(0===this._lastMap.get(t).size)this._addCurrentMap(e);else if(this._lastMap.get(t).has(r)){var a=this._lastMap.get(t).get(r),i=a.length-1;s>a[0]&&s<a[i]?(a.push(s),a.sort(),this._lastMap.get(t).set(r,a)):this._addCurrentMap(e)}else this._addCurrentMap(e);return!0}},{key:"_addCurrentMap",value:function(e){var t=e.key,n=e.message,o=n.conversationID,s=n.sequence,r=o.replace(k.CONV_GROUP,"");this._currentMap.get(t).has(r)||this._currentMap.get(t).set(r,[]),this._currentMap.get(t).get(r).push(s)}},{key:"_copyData",value:function(e){if(!dt(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 s=m(t.value,2),r=s[0],a=s[1];n.set(r,a)}}catch(i){o.e(i)}finally{o.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){if(dt(this._currentMap.get(e))||dt(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 s=v(e.values()),r=s.length,a=s[r-1]-s[0]+1;t+=a,n+=r})),0===t)return null;var o=Ht(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}(),yu=function(e){i(s,e);var n=f(s);function s(e){var t;o(this,s),(t=n.call(this,e))._n="QualityStatModule",t.TAG="im-ssolog-quality-stat",t.reportIndex=0,t.wholePeriod=!1,t._qualityItems=[Gr,Ur,Pr,br,wr,Fr,qr,xr,Vr,Hr],t._messageSentItems=[Pr,br,wr,Fr,qr],t._messageReceivedItems=[xr,Vr,Hr],t.REPORT_INTERVAL=120,t.REPORT_SDKAPPID_BLACKLIST=[],t.REPORT_TINYID_WHITELIST=[],t._statInfoArr=[],t._avgRTT=new mu,t._avgE2EDelay=new fu,t._rateMessageSent=new vu,t._rateMessageReceived=new Mu;var r=t.getInnerEmitterInstance();return r.on(va,t._onLoginSuccess,_(t)),r.on(Ma,t._onCloudConfigUpdated,_(t)),t}return r(s,[{key:"_onLoginSuccess",value:function(){var e=this;this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems);var t=this.getModule(Yn),n=t.getItem(this.TAG,!1);!$t(n)&>(n.forEach)&&(Ve.l("".concat(this._n,"._onLoginSuccess get quality stat logs from local storage, count:").concat(n.length)),n.forEach((function(t){e._statInfoArr.push(t)})),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");dt(e)||(this.REPORT_INTERVAL=Number(e)),dt(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map((function(e){return Number(e)}))),dt(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)||Ve.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||Ve.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||Ve.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||Ve.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||Ve.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||Ve.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var n={},o=Wr[this.getNetworkType()];dt(o)&&(o=8);var s={qualityType:Br[e],timestamp:Pe(),networkType:o,extension:""};switch(e){case Gr:n=this._avgRTT.getStatResult();break;case Ur:n=this._avgE2EDelay.getStatResult();break;case Pr:case br:case wr:case Fr:case qr:n=this._rateMessageSent.getStatResult(e);break;case xr:case Vr:case Hr:n=this._rateMessageReceived.getStatResult(e)}return null===n?null:t(t({},s),n)}},{key:"_report",value:function(e){var t=this,n=[],o=null;dt(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)),Ve.d("".concat(this._n,"._report"),n),this._statInfoArr.length>0&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]);var s=this.getModule(Wn),r=s.getSDKAppID(),a=s.getTinyID();Bt(this.REPORT_SDKAPPID_BLACKLIST,r)&&!Kt(this.REPORT_TINYID_WHITELIST,a)&&(n=[]),n.length>0&&this._doReport(n)}},{key:"_doReport",value:function(e){var n=this,o={header:Ii(this),quality:e};this.request({protocolName:ar,requestData:t({},o)}).then((function(){n.reportIndex++,n.wholePeriod=!1})).catch((function(t){Ve.w("".concat(n._n,"._doReport, online:").concat(n.getNetworkType()," error:"),t),n._statInfoArr=n._statInfoArr.concat(e),n._flushAtOnce()}))}},{key:"_flushAtOnce",value:function(){var e=this.getModule(Yn),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");if($t(t))Ve.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1);else{var s=n.concat(t);s.length>10&&(s=s.slice(0,10)),Ve.l("".concat(o," count:").concat(s.length)),e.setItem(this.TAG,s,!0,!1)}this._statInfoArr=[]}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),this._report(),this.reportIndex=0,this.wholePeriod=!1,this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[],this._avgRTT.reset(),this._avgE2EDelay.reset(),this._rateMessageSent.reset(),this._rateMessageReceived.reset()}}]),s}(go),Iu=r((function e(t){o(this,e),$t(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||"")})),Cu=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 r(e,[{key:"getLocalFriendApplicationList",value:function(){return{friendApplicationList:v(this._friendApplicationMap.values()),unreadCount:this._unreadCount}}},{key:"_onFriendApplicationListUpdated",value:function(){this._snsModule.emitOuterEvent(E.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:v(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(!$t(e)){var s="";s=n===this._snsModule.getMyUserID()?k.SNS_APPLICATION_SENT_BY_ME:k.SNS_APPLICATION_SENT_TO_ME;var r=!1;e.forEach((function(e){var n="".concat(e.userID,"_").concat(s);s!==k.SNS_APPLICATION_SENT_TO_ME||o._friendApplicationMap.has(n)||(o._unreadCount+=1),o._friendApplicationMap.set(n,new Iu(t(t({},e),{},{type:s}))),r=!0})),r&&this._onFriendApplicationListUpdated()}}},{key:"onFriendApplicationDeleted",value:function(e){$t(e)||this.getFriendApplicationList()}},{key:"getFriendApplicationList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendApplicationList"),n=new jr("getFriendApplicationList");return this._snsModule.request({protocolName:Uo,requestData:{applicationType:k.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsModule.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSequence}}).then((function(o){var s=o.data,r=s.resultList,a=s.unreadCount,i=s.startTime,u=s.currentSequence;e._startTime=i,e._currentSequence=u,e._unreadCount=a;var c=lt(r)?r.length:0;n.setNetworkType(e._snsModule.getNetworkType()).setMessage("applicationCount:".concat(c," unreadCount:").concat(a)).end(),Ve.i("".concat(t," ok. applicationCount:").concat(c," unreadCount:").concat(a)),e._friendApplicationMap.clear(),lt(r)&&r.forEach((function(t){var n=t.userID,o=t.type,s=new Iu(t);e._friendApplicationMap.set("".concat(n,"_").concat(o),s)})),e._onFriendApplicationListUpdated()})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.w("".concat(t," failed. error:"),o),ha(o)}))}},{key:"deleteFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriendApplication"),o=e.userID,s=e.type;if((!s||s!==k.SNS_APPLICATION_SENT_BY_ME&&s!==k.SNS_APPLICATION_SENT_TO_ME)&&(s=k.SNS_APPLICATION_SENT_TO_ME),!this._friendApplicationMap.has("".concat(o,"_").concat(s)))return ha({code:Or.FRIEND_APPLICATION_NOT_EXIST});var r=new jr("deleteFriendApplication");return r.setMessage("userID:".concat(o," type:").concat(s)),this._snsModule.request({protocolName:Po,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:[o],type:s}}).then((function(e){var a=e.data.resultList,i=a[0],u=i.to,c=i.resultCode,l=i.resultInfo;return r.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(a))).end(),Ve.i("".concat(n," ok. userID:").concat(o," type:").concat(s)),0===c?la():ha({userID:u,code:c,message:l})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"acceptFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("acceptFriendApplication"),o=e.userID,s=e.remark,r=e.tag,a=e.type;(!a||a!==k.SNS_APPLICATION_AGREE&&a!==k.SNS_APPLICATION_AGREE_AND_ADD)&&(a=k.SNS_APPLICATION_AGREE_AND_ADD);var i=new jr("acceptFriendApplication");return i.setMessage("userID:".concat(o," type:").concat(a)),this._snsModule.request({protocolName:Go,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,remark:s,tag:r,action:a}]}}).then((function(e){i.setNetworkType(t._snsModule.getNetworkType()).end();var s=e.data.resultList[0],r=s.resultCode,u=s.resultInfo;if(0!==r)return ha({code:r,message:u});Ve.i("".concat(n," ok. userID:").concat(o," type:").concat(a))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"refuseFriendApplication",value:function(e){var t=this,n="".concat(this._n,".").concat("refuseFriendApplication"),o=e.userID,s=new jr("refuseFriendApplication");return s.setMessage("userID:".concat(o)),this._snsModule.request({protocolName:Go,requestData:{fromAccount:this._snsModule.getMyUserID(),responseFriendItem:[{userID:o,action:"Response_Action_Reject"}]}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end();var r=e.data.resultList[0],a=r.resultCode,i=r.resultInfo;if(0!==a)return ha({code:a,message:i});Ve.i("".concat(n," ok. userID:").concat(o))})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.w("".concat(n," failed. error:"),e),ha(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(k.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 jr("setFriendApplicationRead");return this._snsModule.request({protocolName:bo,requestData:{fromAccount:this._snsModule.getMyUserID(),latestTimeStamp:Ht(Pe()/1e3,0)}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end(),Ve.i("".concat(t," ok")),e._unreadCount=0})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.w("".concat(t," failed. error:"),o),ha(o)}))}},{key:"reset",value:function(){this._startIndex=0,this._maxLimited=100,this._currentSequence=0,this._unreadCount=0,this._friendApplicationMap.clear()}}]),e}(),Tu=function(){function e(n,s){o(this,e),this.userID=n,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var r={},a=[];if(r.userID=n,!$t(s))for(var i="",u="",c=0,l=s.length;c<l;c++)if(i=s[c].tag,u=s[c].value,i.indexOf("Tag_SNS_Custom")>-1)this.friendCustomField.push({key:i,value:u});else if(i.indexOf("Tag_Profile_Custom")>-1)a.push({key:i,value:u});else switch(i){case Be.NICK:r.nick=u;break;case Be.GENDER:r.gender=u;break;case Be.BIRTHDAY:r.birthday=u;break;case Be.LOCATION:r.location=u;break;case Be.SELFSIGNATURE:r.selfSignature=u;break;case Be.ALLOWTYPE:r.allowType=u;break;case Be.LANGUAGE:r.language=u;break;case Be.AVATAR:r.avatar=u;break;case Be.MESSAGESETTINGS:r.messageSettings=u;break;case Be.ADMINFORBIDTYPE:r.adminForbidType=u;break;case Be.LEVEL:r.level=u;break;case Be.ROLE:r.role=u;break;case We:this.remark=u;break;case Je:this.addTime=u;break;case Ke:this.groupList=JSON.parse(JSON.stringify(u));break;case Ye:this.source=u;break;case je:break;default:Ve.l("snsProfileItem unknown tag->",s[c].tag)}this.profile=new La(t(t({},r),{},{profileCustomField:a}))}return r(e,[{key:"validate",value:function(e){var t=!0,n="";if($t(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var o=e.profileCustomField.length,s=null,r=0;r<o;r++){if(s=e.profileCustomField[r],!it(s.key)||-1===s.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(!it(s.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if("profileCustomField"===a)continue;if($t(e[a])&&!it(e[a])&&!at(e[a])){n="key:"+a+", invalid value:"+e[a],t=!1;continue}switch(a){case"nick":it(e[a])||(n="nick must be a string",t=!1),Mt(e[a])>500&&(n="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Mt(e[a])," bytes"),t=!1);break;case"gender":Tt(ze,e.gender)||(n="key:gender, invalid value:"+e.gender,t=!1);break;case"birthday":at(e.birthday)||(n="birthday must be a number",t=!1);break;case"location":it(e.location)||(n="location must be a string",t=!1);break;case"selfSignature":it(e.selfSignature)||(n="selfSignature must be a string",t=!1);break;case"allowType":Tt(Qe,e.allowType)||(n="key:allowType, invalid value:"+e.allowType,t=!1);break;case"language":at(e.language)||(n="language must be a number",t=!1);break;case"avatar":it(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":Tt(Xe,e.adminForbidType)||(n="key:adminForbidType, invalid value:"+e.adminForbidType,t=!1);break;case"level":at(e.level)||(n="level must be a number",t=!1);break;case"role":at(e.role)||(n="role must be a number",t=!1);break;default:n="unknown key:"+a+" "+e[a],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 s=0,r=e.length;s<r;s++)if(t=e[s].tag,n=e[s].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 a=!1;this.profile.profileCustomField.forEach((function(e){e.key===t&&(e.value=n,a=!0)})),a||this.profile.profileCustomField.push({key:t,value:n})}else switch(t){case Be.NICK:this.profile.nick=n;break;case Be.GENDER:this.profile.gender=n;break;case Be.BIRTHDAY:this.profile.birthday=n;break;case Be.LOCATION:this.profile.location=n;break;case Be.SELFSIGNATURE:this.profile.selfSignature=n;break;case Be.ALLOWTYPE:this.profile.allowType=n;break;case Be.LANGUAGE:this.profile.language=n;break;case Be.AVATAR:this.profile.avatar=n;break;case Be.MESSAGESETTINGS:this.profile.messageSettings=n;break;case Be.ADMINFORBIDTYPE:this.profile.adminForbidType=n;break;case Be.LEVEL:this.profile.level=n;break;case Be.ROLE:this.profile.role=n;break;case We:this.remark=n;break;case Je:this.addTime=n;break;case Ke:this.groupList=JSON.parse(JSON.stringify(n));break;case Ye:this.source=n;break;case je:break;default:Ve.d("snsProfileItem unkown tag->",e[s].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}(),Du=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 r(e,[{key:"getLocalFriendList",value:function(){return v(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(!$t(n)){var o=this._snsModule.getModule(Kn);n.forEach((function(e){var n=e.userID,s=e.profileList;if(t.isMyFriend(n)){Ve.l("".concat(t._n,".onFriendProfileModified. friend account:").concat(n,", profileList:").concat(JSON.stringify(s)));var r=t._friendMap.get(n);r.update(s),o.modifyMessageSentByPeer({conversationID:"".concat(k.CONV_C2C).concat(n),latestNick:r.profile.nick,latestAvatar:r.profile.avatar})}})),this._onFriendListUpdated()}}},{key:"onFriendAdded",value:function(e){var t=this;0!==e.length&&(Ve.l("".concat(this._n,".onFriendAdded userIDList:").concat(e)),e.forEach((function(e){t._friendMap.set(e,new Tu(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&&(Ve.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(Kn).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getFriendProfile"),o=e.userIDList,s=[],r=[],a=[];if(o.forEach((function(e){if(t._friendMap.has(e)){var n=t._friendMap.get(e);Date.now()-n.timestamp<t._expirationTime?r.push(n):a.push(e)}else s.push({userID:e,code:Or.NOT_MY_FRIEND,message:t._snsModule.getErrorMessage(Or.NOT_MY_FRIEND)})})),0===a.length)return Ve.i("".concat(n," newUserIDList is empty")),_a({friendList:r,failureUserIDList:s});var i=new jr("getFriendProfile");return i.setMessage("userIDList:".concat(a)),Ve.i("".concat(n," userIDList:").concat(a)),this._snsModule.request({protocolName:Lo,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:a}}).then((function(e){return i.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.i("".concat(n," ok")),e.data.resultList.forEach((function(e){var n,o=e.to,a=e.resultCode,i=e.resultInfo,u=e.tagValueList;dt(a)||0===a?(t._friendMap.has(o)?(n=t._friendMap.get(o)).update(u):(n=new Tu(o,u),t._friendMap.set(o,n)),r.push(n)):s.push({userID:o,code:a,message:i})})),la({friendList:r,failureUserIDList:s})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];i.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(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 jr("getFriendList"),o=Date.now();this._snsModule.request({protocolName:So,requestData:{fromAccount:this._snsModule.getMyUserID(),startIndex:this._startIndex,standardSequence:this._standardSequence,customSequence:this._customSequence}}).then((function(s){var r=s.data,a=r.friendCount,i=r.resultList,u=r.nextStartIndex,c=r.standardSequence,l=r.customSequence,d=r.completeFlag;e._startIndex=u,e._standardSequence=c,e._customSequence=l;var p=Date.now()-o,g="friendCount:".concat(a," nextStartIndex:").concat(u," standardSequence:").concat(c," ")+"customSequence:".concat(l," completeFlag:").concat(d," cost ").concat(p," ms");n.setNetworkType(e._snsModule.getNetworkType()).setMessage(g).end(),Ve.i("".concat(t," ok."),g),$t(i)||i.forEach((function(t){var n=t.to,o=t.tagValueList;e._friendMap.set(n,new Tu(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=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.w("".concat(t," failed. error:"),o),ha(o)}))}},{key:"_pagingGetFriendProfile",value:function(){var e=this,t=v(this._friendMap.keys()),n=this._snsModule.getModule(Fn),o=t.length,s=o<=100?1:Math.ceil(o/100);Ve.l("".concat(this._n,"._pagingGetFriendProfile friendCount:").concat(o," pageCount:").concat(s));for(var r=0;r<s;r++)n.getUserProfile({userIDList:t.slice(100*r,100*(r+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 ha({code:Or.ALREADY_MY_FRIEND});if(e.wording&&!1===this._snsModule.filterProfanity("wording",e))return ha({code:Or.PROFANITY_FOUND});var o=e.to,s=e.source,r=e.type,a=e.wording,i=e.remark,u=e.groupName,c=r;(!c||c!==k.SNS_ADD_TYPE_SINGLE&&c!==k.SNS_ADD_TYPE_BOTH)&&(c=k.SNS_ADD_TYPE_BOTH);var l=new jr("addFriend");return l.setMessage("to:".concat(o," source:").concat(s," type:").concat(c)),this._snsModule.request({protocolName:Ro,requestData:{fromAccount:this._snsModule.getMyUserID(),addFriendItem:[{to:o,source:s,wording:a,remark:i,groupName:u}],type:c}}).then((function(e){var o=e.data.resultList;l.setNetworkType(t._snsModule.getNetworkType()).setMoreMessage("resultList:".concat(JSON.stringify(o))).end();var s=o[0],r=s.to,a=s.resultCode,i=s.resultInfo;return Ve.i("".concat(n," ok. to:").concat(r," type:").concat(c," code:").concat(a)),dt(a)||0===a?la({userID:r,code:0}):30539===a?la({userID:r,code:a,message:t._snsModule.getErrorMessage(a)}):ha({userID:r,code:a,message:t._snsModule.getErrorMessage(a)||i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];l.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriend"),o=e.userIDList,s=e.type;o.length>1e3&&(Ve.w("".concat(n," ").concat(Xt(1e3))),o.length=1e3);var r=[],a=[],i=[];if(o.forEach((function(e){t._friendMap.has(e)?i.push(e):r.push({userID:e,code:Or.NOT_MY_FRIEND,message:t._snsModule.getErrorMessage(Or.NOT_MY_FRIEND)})})),0===i.length)return _a({successUserIDList:a,failureUserIDList:r});var u=s;(!u||u!==k.SNS_DELETE_TYPE_SINGLE&&u!==k.SNS_DELETE_TYPE_BOTH)&&(u=k.SNS_DELETE_TYPE_BOTH);var c=new jr("deleteFriend");return c.setMessage("userIDList:".concat(i," type:").concat(u)),this._snsModule.request({protocolName:No,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:i,type:u}}).then((function(e){c.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.i("".concat(n," ok"));var o=e.data.resultList;return $t(o)||o.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;dt(n)||0===n?a.push({userID:t}):r.push({userID:t,code:n,message:o})})),la({successUserIDList:a,failureUserIDList:r})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ve.w("".concat(n," error:"),e),ha(e)}))}},{key:"updateFriend",value:function(e){var t=this,n=e.userID,o=e.remark,s=e.friendCustomField;if(!this._friendMap.has(n))return ha({code:Or.NOT_MY_FRIEND});var r="".concat(this._n,".").concat("updateFriend"),a=new jr("updateFriend");a.setMessage("userID:".concat(n," remark:").concat(o," friendCustomField:").concat(s));var i=[];return dt(o)||i.push({tag:We,value:o}),lt(s)&&s.length>0&&s.forEach((function(e){i.push({tag:e.key,value:e.value})})),this._snsModule.request({protocolName:Oo,requestData:{fromAccount:this._snsModule.getMyUserID(),updateItem:[{to:n,snsItem:i}]}}).then((function(e){a.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.i("".concat(r," ok"));var n=e.data.resultList[0],i=n.to,u=n.resultCode,c=n.resultInfo;if(dt(u)||0===u){var l=t._friendMap.get(i);return l&&(dt(o)||(l.remark=o),lt(s)&&s.length>0&&St(l.friendCustomField,s),t._onFriendListUpdated()),la(l)}return ha({code:u,message:c})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];a.setError(e,o,s).end()})),Ve.w("".concat(r," failed. error:"),e),ha(e)}))}},{key:"checkFriend",value:function(e){var t=this,n="".concat(this._n,".").concat("checkFriend"),o=e.userIDList,s=e.type;(!s||s!==k.SNS_CHECK_TYPE_SINGLE&&s!==k.SNS_CHECK_TYPE_BOTH)&&(s=k.SNS_CHECK_TYPE_BOTH);var r=new jr("checkFriend");return r.setMessage("userIDList:".concat(o," type:").concat(s)),this._snsModule.request({protocolName:Ao,requestData:{fromAccount:this._snsModule.getMyUserID(),userIDList:o,type:s}}).then((function(e){r.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.i("".concat(n," ok. userIDList:").concat(o," type:").concat(s));var a=[],i=[],u=e.data.resultList;return lt(u)&&u.forEach((function(e){var t=e.to,n=e.relation,o=e.resultCode,s=e.resultInfo;dt(o)||0===o?a.push({userID:t,code:0,relation:n}):i.push({userID:t,code:o,message:s})})),la({successUserIDList:a,failureUserIDList:i})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"updateWhenAddedToFriendGroup",value:function(e){var t=this,n=e.name,o=e.userIDList;Ve.l("".concat(this._n,".updateWhenAddedToFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!$t(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;Ve.l("".concat(this._n,".updateWhenRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!$t(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}(),Eu=function(){function e(t){o(this,e),$t(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)}return r(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}(),ku=function(){function e(t){o(this,e),this._snsModule=t,this._n="FriendGroupHandler",this._friendGroupMap=new Map}return r(e,[{key:"getLocalFriendGroupList",value:function(){return v(this._friendGroupMap.values())}},{key:"_emitFriendGroupListUpdated",value:function(){var e=v(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 jr("getFriendGroupList");return this._snsModule.request({protocolName:wo,requestData:{fromAccount:this._snsModule.getMyUserID()}}).then((function(o){n.setNetworkType(e._snsModule.getNetworkType()).end();var s=o.data.resultList;$t(s)?Ve.i("".concat(t," ok. friend group count:0")):(Ve.i("".concat(t," ok. friend group count:").concat(s.length)),e._friendGroupMap.clear(),s.forEach((function(t){var n=new Eu(t);e._friendGroupMap.set(t.name,n)})),e._emitFriendGroupListUpdated())})).catch((function(o){return e._snsModule.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.w("".concat(t," error:"),o),ha(o)}))}},{key:"createFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("createFriendGroup"),o=e.name,s=e.userIDList;if(this._friendGroupMap.has(o))return ha({code:Or.FRIEND_GROUP_EXISTED});var r=new jr("createFriendGroup");return r.setMessage("name:".concat(o," userIDList:").concat(s)),this._snsModule.request({protocolName:Fo,requestData:{fromAccount:this._snsModule.getMyUserID(),groupName:[o],userIDList:lt(s)?s:void 0}}).then((function(e){r.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.l("".concat(n," ok. name:").concat(o," userIDList:").concat(s));var a=e.data.resultList,i=[],u=[];a&&a.forEach((function(e){var t=e.to,n=e.resultCode,o=e.resultInfo;if(dt(n)||0===n)i.push(t);else{var s={userID:e.to,code:n,message:o};u.push(s)}}));var c=new Eu({name:o,userIDList:i});return t._friendGroupMap.set(o,c),t._snsModule.updateWhenAddedToFriendGroup({name:o,userIDList:i}),t._emitFriendGroupListUpdated(),la({friendGroup:c,failureUserIDList:u})})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"deleteFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("deleteFriendGroup"),o=e.name;if(!this._friendGroupMap.has(o))return ha({code:Or.FRIEND_GROUP_NOT_EXIST});var s=new jr("deleteFriendGroup");return s.setMessage("name:".concat(o)),this._snsModule.request({protocolName:qo,requestData:{fromAccount:this._snsModule.getMyUserID(),nameList:[o]}}).then((function(e){s.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.l("".concat(n," ok. name:").concat(o));var r=t._friendGroupMap.get(o);return r&&(t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:r.userIDList}),t._friendGroupMap.delete(o),r.userIDList.length=0),t._emitFriendGroupListUpdated(),la(r)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],r=n[1];s.setError(e,o,r).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"renameFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("renameFriendGroup"),o=e.oldName,s=e.newName;if(!this._friendGroupMap.has(o))return ha({code:Or.FRIEND_GROUP_NOT_EXIST});var r=new jr("renameFriendGroup");return r.setMessage("oldName:".concat(o," newName:").concat(s)),this._snsModule.request({protocolName:xo,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,newName:s}}).then((function(){if(r.setNetworkType(t._snsModule.getNetworkType()).end(),Ve.l("".concat(n," ok. oldName:").concat(o," newName:").concat(s)),t._friendGroupMap.has(o)){var e=t._friendGroupMap.get(o);return e.name=s,t._friendGroupMap.delete(o),t._friendGroupMap.set(s,e),t._snsModule.updateWhenRemovedFromFriendGroup({name:o,userIDList:e.userIDList}),t._snsModule.updateWhenAddedToFriendGroup({name:s,userIDList:e.userIDList}),t._emitFriendGroupListUpdated(),la(e)}return la()})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"addToFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("addToFriendGroup"),o=e.name,s=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var r=new jr("addToFriendGroup");return r.setMessage("name:".concat(o," userIDList:").concat(s)),Ve.l("".concat(n," name:").concat(o," userIDList:").concat(s)),this._snsModule.request({protocolName:xo,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:s.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Add"}}))}}).then((function(e){return r.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"removeFromFriendGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("removeFromFriendGroup"),o=e.name,s=e.userIDList;if(!this._friendGroupMap.has(o))return this._onFriendGroupNotExist(o);var r=new jr("removeFromFriendGroup");return r.setMessage("name:".concat(o," userIDList:").concat(s)),Ve.l("".concat(n," name:").concat(o," userIDList:").concat(s)),this._snsModule.request({protocolName:xo,requestData:{fromAccount:this._snsModule.getMyUserID(),oldName:o,updateGroupItem:s.filter((function(e){return t._snsModule.isMyFriend(e)})).map((function(e){return{to:e,updateType:"Update_Type_Delete"}}))}}).then((function(e){return r.setNetworkType(t._snsModule.getNetworkType()).end(),t._onFriendGroupUpdated(o,e)})).catch((function(e){return t._snsModule.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];r.setError(e,o,s).end()})),Ve.w("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_onFriendGroupUpdated",value:function(e,t){var n=t.data.resultList,o=this._friendGroupMap.get(e),s=[],r=[],a=[];return lt(n)&&n.forEach((function(e){var t=e.to,n=e.resultCode,i=e.resultInfo,u=e.type;0===n?"Update_Type_Add"===u?o&&(o.addToUserIDList(t),r.push(t)):"Update_Type_Delete"===u&&o&&(o.removeFromUserIDList(t),a.push(t)):s.push({to:e.to,code:n,message:i})})),Ve.l("".concat(this._n,"._onFriendGroupUpdated name:").concat(e," userIDList:").concat(o.userIDList)),r.length>0&&this._snsModule.updateWhenAddedToFriendGroup({name:e,userIDList:r}),a.length>0&&this._snsModule.updateWhenRemovedFromFriendGroup({name:e,userIDList:a}),la({friendGroup:o,failureUserIDList:s})}},{key:"updateWhenFriendAdded",value:function(e){var t=this,n=e.nameList,o=e.userID;Ve.l("".concat(this._n,".updateWhenFriendAdded userID:").concat(o," nameList:").concat(n)),$t(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;Ve.l("".concat(this._n,".updateWhenFriendDeleted userID:").concat(o," nameList:").concat(n)),$t(n)||n.forEach((function(e){t._friendGroupMap.has(e)&&t._friendGroupMap.get(e).removeFromUserIDList(o)}))}},{key:"reset",value:function(){this._friendGroupMap.clear()}}]),e}(),Su=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="SnsModule",s._friendHandler=new Du(_(s)),s._friendApplicationHandler=new Cu(_(s)),s._friendGroupHandler=new ku(_(s)),s.getInnerEmitterInstance().on(va,s.onContextUpdated,_(s)),s}return r(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(!$t(n)){var o=[],s=[],r=[],a=[],i=!1,u="";n.forEach((function(e){if(3!==e.pushType&&4!==e.pushType||!e.from||(u=e.from),e.friendAddAccount&&(o.push.apply(o,v(e.friendAddAccount)),a.push.apply(a,v(e.friendAddAccount))),e.friendDelAccount&&s.push.apply(s,v(e.friendDelAccount)),e.friendApplicationAdded&&r.push.apply(r,v(e.friendApplicationAdded)),e.friendApplicationDeletedUserIDList&&a.push.apply(a,v(e.friendApplicationDeletedUserIDList)),e.reportTime&&7===e.pushType&&(i=!0),e.friendUpInfo){var n={dataList:[]};e.friendUpInfo.forEach((function(e){n.dataList.push({userID:e.friendAccount,profileList:v(e.sns)})})),t.onFriendProfileModified(n)}})),i&&this._friendApplicationHandler.onFriendApplicationRead(),this._friendApplicationHandler.onFriendApplicationAdded(r,u),this._friendApplicationHandler.onFriendApplicationDeleted(a),this._friendHandler.onFriendAdded(o),this._friendHandler.onFriendDeleted(s)}}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"filterProfanity",value:function(e,t){var n=this.getModule(uo);if(!n)return!0;var o=n.filterText(t[e],J),s=o.isAllowedToSend,r=o.modifiedText;return!0===s&&(t[e]=r,!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?_a(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 _a(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 _a(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(){Ve.l("".concat(this._n,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}]),n}(go),Lu=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="WorkerTimerModule",s._isWorkerEnabled=!0,s._workerTimer=null,s._timerID=-1,s._init(),s.getInnerEmitterInstance().on(Ma,s._onCloudConfigUpdated,_(s)),s}return r(n,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Se}},{key:"startWorkerTimer",value:function(){Ve.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){Ve.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){if(Se){var e=URL.createObjectURL(new Blob(['let interval = -1;onmessage = function(event) { if (event.data === "start") { if (interval > 0) { clearInterval(interval); } interval = setInterval(() => { postMessage(""); }, 1000); postMessage(interval); } else if (event.data === "stop") { clearInterval(interval); interval = -1; }};'],{type:"application/javascript; charset=utf-8"}));this._workerTimer=new Worker(e);var t=this;this._workerTimer.onmessage=function(e){e.data?(t._timerID=e.data,Ve.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()}}}},{key:"_onCloudConfigUpdated",value:function(){var e=this.getCloudConfig("enable_worker");Ve.l("".concat(this._n,"._onCloudConfigUpdated enableWorker:").concat(e)),dt(e)||"1"===e?!this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Se&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){Ve.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(){Ve.l("".concat(this._n,".reset"))}}]),n}(go),Au=function(){function e(){o(this,e),this._n="PurchasedFeatureHandler",this._purchasedFeatureMap=new Map}return r(e,[{key:"isValidPurchaseBits",value:function(e){return e&&"string"==typeof e&&e.length>=1&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){var t="".concat(this._n,".parsePurchaseBits");if(this.isValidPurchaseBits(e)){this._purchasedFeatureMap.clear();for(var n=null,o=e.length-1,s=0;o>=0;o--,s++)n=s<32?new L(0,Math.pow(2,s)).toString():new L(Math.pow(2,s-32),0).toString(),"1"===e[o]?this._purchasedFeatureMap.set(n,!0):this._purchasedFeatureMap.set(n,!1)}else Ve.w("".concat(t," invalid purchase bits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._purchasedFeatureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,s=t.length-1,r=0;s>=0;s--,r++)if("1"===t.charAt(s)&&(n=r<32?new L(0,Math.pow(2,r)).toString():new L(Math.pow(2,r-32),0).toString(),!this._purchasedFeatureMap.get(n))){o=!1;break}return Ve.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," binaryString:").concat(t," ret:").concat(o)),_a({enabled:o})}},{key:"clear",value:function(){this._purchasedFeatureMap.clear()}}]),e}(),Nu=function(){function e(t){o(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Au}return r(e,[{key:"_canFetch",value:function(){return this._getModule(Wn).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(Ve.l("".concat(n," canFetch:").concat(t)),t){var o=this._getModule(Jn),s=new jr("fetchCommercialConfig");s.setNetworkType(o.getNetworkType());var r=this._getModule(Wn).getSDKAppID(),a=this._getModule($n);this._isFetching=!0,a.request({protocolName:fr,requestData:{SDKAppID:r}}).then((function(t){s.setMessage("purchaseBits:".concat(t.data.purchaseBits)).end(),Ve.l("".concat(n," ok.")),e._parseConfig(t.data),e._isFetching=!1})).catch((function(t){o.probe().then((function(e){var n=m(e,2),o=n[0],r=n[1];s.setError(t,o,r).end()})),e._isFetching=!1}))}}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig");Ve.l("".concat(t)),new jr("pushedCommercialConfig").setNetworkType(this._getModule(Jn).getNetworkType()).setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,s=e.purchaseBits,r=e.expiredTime;0===n?(this._purchasedFeatureHandler.parsePurchaseBits(s),this._expiredTime=Date.now()+1e3*r):dt(n)?(Ve.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(Ve.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(){Ve.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),e}(),Ru=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._m=e,s._n="OfflinePushModule",s._offlinePushPlugin=void 0,s._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},s._deviceToken="",s._businessID=0,s._iosBusinessID=0,s._c2cUnreadCount=0,s._groupUnreadCount=0,s._isWebUniapp=0,s}return r(n,[{key:"registerPlugin",value:function(e){if(oe){this._offlinePushPlugin=e["tim-offline-push-plugin"];var t=e.offlinePushConfig||{},n=t.huaweiBusinessID,o=t.xiaomiBusinessID,s=t.xiaomiAppID,r=t.xiaomiAppKey,a=t.meizuBusinessID,i=t.meizuAppID,u=t.meizuAppKey,c=t.vivoBusinessID,l=t.oppoBusinessID,d=t.oppoAppKey,p=t.oppoAppSecret,g=t.honorBusinessID,_=t.iosBusinessID;this._androidPushConfig.huaweiPushBussinessId=n,this._androidPushConfig.xiaomiPushBussinessId=o,this._androidPushConfig.xiaomiPushAppId=s,this._androidPushConfig.xiaomiPushAppKey=r,this._androidPushConfig.meizuPushBussinessId=a,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=u,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=l,this._androidPushConfig.oppoPushAppKey=d,this._androidPushConfig.oppoPushAppSecret=p,this._androidPushConfig.honorPushBussinessId=g,new jr("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!dt(this._offlinePushPlugin))).end(!0),Ve.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=_,this._setAppShowListener()}else this.outputWarning("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e=this,t="".concat(this._n,".").concat("_getDeviceToken");if(gt(this._offlinePushPlugin.getDeviceToken)){var n="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID);Ve.l("".concat(t," start. ").concat(n)),new jr("_getDeviceToken").setMessage("".concat(n)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,(function(o){var s=new jr("getDeviceTokenRes"),r=o.code,a=o.msg;if(0===r){var i=o.data,u=i.deviceToken,c=i.deviceBrand,l=i.deviceType,d=i.bussinessId;e._deviceToken=u,e._businessID=d||e._iosBusinessID,n="deviceToken:".concat(u,", deviceBrand:").concat(c||l,", businessID:").concat(e._businessID),Ve.l("".concat(t," ok. ").concat(n)),s.setMessage(n).end(!0),e._setToken()}else s.setMessage("code:".concat(r,", msg:").concat(a)).end(!0),Ve.e("".concat(t," failed. error:"),o)}))}else Ve.e("".concat(t," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return oe&&!dt(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");dt(this._offlinePushPlugin)?Ve.e("".concat(t," offlinePushPlugin is undefined")):gt(this._offlinePushPlugin.setAppShowListener)?(new jr("_setAppShowListener").end(!0),Ve.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener((function(n){var o=(n||{}).appShow;new jr("setAppShowListenerRes").setMessage("appShow:".concat(o)).end(!0),Ve.l("".concat(t," ok. appShow:").concat(o)),e._m.isReady()&&(0===o?(e._getConvUnreadCount(),e._onBackground()):1===o&&e._onForeground())}))):Ve.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){if(!dt(this._offlinePushPlugin)&>(this._offlinePushPlugin.getDeviceType)){var e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType;return Ve.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(Wn),s=1,r="",a="";$t(this._deviceToken)&&(s=0);var i=this.getUniAppPlatform(),u=this.getDeviceBrand();i===N.IOS||i===N.IPAD||i===N.MAC?a=this._deviceToken:i===N.ANDROID&&(r=this._deviceToken);var c=new jr("offlinePushSetToken");return e="deviceToken:".concat(a||r,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(u,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(s,", platform:").concat(i),c.setMessage("".concat(e)),Ve.l("".concat(n," ").concat(e)),this.request({protocolName:Ar,requestData:{tokenID:r,pushMsg:s,sdkAppID:o.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:u,deviceToken:a,isWebUniapp:this._isWebUniapp}}).then((function(e){return c.end(),Ve.l("".concat(n," ok")),e})).catch((function(e){return t.probeNetwork().then((function(t){var n=m(t,2),o=n[0],s=n[1];c.setError(e,o,s).end()})),Ve.e("".concat(n," failed. error:"),e),ha(e)}))}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.getModule(Kn).getLocalConversationList().forEach((function(t){t.type===k.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===k.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)}))}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new jr("_onBackground");this.request({protocolName:Sr,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(),Ve.l("".concat(t," ok")),o})).catch((function(o){e.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.e("".concat(t," failed. error:"),o)}))}},{key:"_onForeground",value:function(){var e=this,t="".concat(this._n,".").concat("_onForeground"),n=new jr("_onForeground");this.request({protocolName:Lr,requestData:{isWebUniapp:this._isWebUniapp}}).then((function(e){return n.end(),Ve.l("".concat(t," ok")),e})).catch((function(o){e.probeNetwork().then((function(e){var t=m(e,2),s=t[0],r=t[1];n.setError(o,s,r).end()})),Ve.e("".concat(t," failed. error:"),o)}))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return"ios"===e?N.IOS:"android"===e?N.ANDROID:1002===t?N.IPAD:1001===t?N.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,Ve.l("".concat(this._n,".reset"))}}]),n}(go),Ou=function(e){i(n,e);var t=f(n);function n(e){var s;return o(this,n),(s=t.call(this,e))._n="ProfanityFilterModule",s._plugin=null,s._filterConfigMap=new Map,s._startIndex=0,s._version=0,s._canIUseLexicon=!1,s._isFetching=!1,s._expiredTime=0,s}return r(n,[{key:"init",value:function(){var e=this.getModule(Qn).getPlugin("tim-profanity-filter-plugin");e?(this._plugin=new e({logger:Ve,isArray:lt,isMap:st,isDevMode:this.isDevMode()}),this._getLexicon()):this.outputWarning("ProfanityPluginNotFound")}},{key:"onCheckTimer",value:function(){this._plugin&&this._canIUseLexicon&&this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime&&this._getLexicon()}},{key:"filterMessage",value:function(e,t){var n=!0;if(!this._plugin||!this._canIUseLexicon)return n;if(t&&t.messageControlInfo&&!0===t.messageControlInfo.excludedFromContentModeration)return n;var o=e.type,s=e.conversationType;if(o!==k.MSG_TEXT&&o!==k.MSG_CUSTOM)return n;var r,a="".concat(this._n,".filterMessage");if(Ve.l("".concat(a)),o===k.MSG_TEXT){if(s===k.CONV_C2C?r=B:s===k.CONV_GROUP&&(r=W),!this._isConfigOn(r))return n;var i=this._plugin.filter(e.payload.text),u=i.type,c=i.modifiedText;1===u?n=!1:2===u&&(e.payload.text=c)}else if(o===k.MSG_CUSTOM){if(s===k.CONV_C2C?r=K:s===k.CONV_GROUP&&(r=Y),!this._isConfigOn(r))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 Ve.l("".concat(a," done. isAllowedToSend:").concat(n)),n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};if(!this._plugin||!this._canIUseLexicon)return o;if(!this._isConfigOn(t))return o;Ve.l("".concat(n));var s=this._plugin.filter(e),r=s.type,a=s.modifiedText;return 1===r?o.isAllowedToSend=!1:2===r&&(o.modifiedText=a),Ve.l("".concat(n," done. ret:"),o),o}},{key:"_getLexicon",value:function(){var e=this,t=new jr("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.request({protocolName:Nr,requestData:{startIndex:this._startIndex,version:this._version}}).then((function(o){var s=o.data,r=s.errorInfo,a=s.filterConfig,i=s.lexicon,u=s.strToken,c=s.completeFlag,l=s.nextStartIndex,d=s.version,p=s.expiredTime,g=r.errorCode,_=r.errorMessage;return 0!==g?(e._isFetching=!1,Ve.w("".concat(n," failed. error:"),r),void t.setCode(g).setMessage(_).end()):(e._onFilterConfig(a),e._getToken(u),1===c?(Ve.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(i)):(e._startIndex=l,e._plugin.onLexiconSliced(i),void e._getLexicon()))})).catch((function(o){e.probeNetwork().then((function(e){var n=m(e,2),s=n[0],r=n[1];t.setError(o,s,r).end()})),e._isFetching=!1,Ve.l("".concat(n," failed. error:"),o)}))}},{key:"_onFilterConfig",value:function(e){var t=this;$t(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach((function(n){t._filterConfigMap.set(n,e[n])})),Ve.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(it(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n+=e[o+1],n+=e[o];else{for(var s=0;s<t-1;s+=2)n+=e[s+1],n+=e[s];n+=e[t-1]}this._plugin.onToken(n)}}},{key:"reset",value:function(){Ve.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}(go),Gu=function(){function e(t){o(this,e),this._m=t,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*"],this._m.getInnerEmitterInstance().on(Ma,this._onCloudConfigUpdated,this)}return r(e,[{key:"_onCloudConfigUpdated",value:function(){var e=this,t=this._m.getModule(no).getCloudConfig("rtc_cmd");dt(t)||(t=JSON.parse(t)).forEach((function(t){e._TRTCCommandList.includes(t)||e._TRTCCommandList.push(t)}))}},{key:"sendTRTCCustomData",value:function(e){var t=e.serviceCommand,n=e.data,o="".concat(V.NAME.TUIROOM_SVR,".*");return dt(t)||(o=t),this._TRTCCommandList.includes(o)?this._trans({servcmd:o,data:n}):ha({code:Or.INVALID_TRTC_CMD})}},{key:"_trans",value:function(e){Ve.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(e)));var t=e.servcmd,n=e.data;return this._m.getModule($n).trans({servcmd:t,data:it(n)?JSON.parse(n):n})}},{key:"getCommandList",value:function(){return this._TRTCCommandList}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset"))}}]),e}(),Uu=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 r(e,[{key:"_init",value:function(){var e=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(e){var t=JSON.parse(e);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,s=!n||"2.27.3"!==n;return Ve.l("".concat(this._n,"._needToUpdate isTimeout:").concat(o," isDifferentVersion:").concat(s)),o||s}},{key:"_fetch",value:function(){if(!this._m.getModule(Wn).isPrivateNetWork()){var e="https://web.sdk.qcloud.com/im/download/error-message/0.0.1/tim-error-message.txt",t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetch ok in"),o=this;if(re)ie.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(e){o._fillAndSave(e.data),Ve.l("".concat(n," mini program"))},fail:function(){}});else{var s=new XMLHttpRequest,r=setTimeout((function(){s.abort()}),3e3);s.onreadystatechange=function(){4===s.readyState&&(clearTimeout(r),200!==s.status&&304!==s.status||(Ve.l("".concat(n," browser")),o._fillAndSave(s.responseText)))},s.open("GET",e,!0),s.setRequestHeader("Content-type",t),s.send()}}}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:(new Date).getTime(),localSavedVersion:"2.27.3"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.getModule(Yn)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o,s=e.split(";\n"),r=s.length,a=new RegExp(/'/g),i=0;i<r;i++)if(t=s[i].indexOf(":"),n=s[i].slice(0,t),o=s[i].slice(t+1,s[i].length),!n.startsWith("//")){if(dt(o))continue;this._map.set(n,o.replace(a,""))}}},{key:"get",value:function(e){var t=e.isIntl,n=e.key,o=e.replacement1,s=e.replacement2,r="".concat(n,t?"_en":"_cn");!this._map.has(r)&&this._map.has(n)&&(r=n);var a="";return this._map.has(r)?(a=this._map.get(r),dt(o)||(a=a.replace("$replacement1",o)),dt(s)||(a=a.replace("$replacement2",s)),a):a}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset"))}}]),e}(),Pu=function(){function e(t){o(this,e);var n=new jr("sdkConstruct");this._n="ModuleManager",this._isReady=!1,this._reason=Or.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(Wn,new fi(this,t)),this._moduleMap.set(ao,new Nu(this)),this._moduleMap.set(no,new _u(this)),this._moduleMap.set(oo,new Lu(this)),this._moduleMap.set(ro,new yu(this)),this._moduleMap.set(eo,new ru(this)),this._moduleMap.set($n,new pu(this)),this._moduleMap.set(Pn,new mi(this)),this._moduleMap.set(bn,new bi(this)),this._moduleMap.set(wn,new wi(this)),this._moduleMap.set(lo,new Fi(this)),this._moduleMap.set(Fn,new hi(this)),this._moduleMap.set(qn,new fa(this)),this._moduleMap.set(Kn,new wa(this)),this._moduleMap.set(xn,new oi(this)),this._moduleMap.set(Hn,new ri(this)),this._moduleMap.set(Bn,new ci(this)),this._moduleMap.set(Yn,new Mi(this)),this._moduleMap.set(po,new Uu(this)),this._moduleMap.set(jn,new Ci(this)),this._moduleMap.set(Jn,new ki(this)),this._moduleMap.set(zn,new Li(this)),this._moduleMap.set(Xn,new Ni(this)),this._moduleMap.set(Qn,new qi(this)),this._moduleMap.set(Zn,new xi(this)),this._moduleMap.set(to,new gu(this)),this._moduleMap.set(so,new hu(this)),this._moduleMap.set(Vn,new Su(this)),this._moduleMap.set(io,new Ru(this)),this._moduleMap.set(uo,new Ou(this)),this._moduleMap.set(co,new Gu(this)),this._eventThrottleMap=new Map;var s=t.instanceID,r=t.oversea,a=t.SDKAppID,i="instanceID:".concat(s," SDKAppID:").concat(a," host:").concat(wt()," oversea:").concat(r," inBrowser:").concat(ae," inMiniApp:").concat(re)+" workerAvailable:".concat(Se," UserAgent:").concat(ue);jr.bindEventStatModule(this._moduleMap.get(jn)),n.setMessage("".concat(i," ").concat(function(){var e="";if(re)try{var t=ie.getSystemInfoSync(),n=t.model,o=t.version,s=t.system,r=t.platform,a=t.SDKVersion;e="model:".concat(n," version:").concat(o," system:").concat(s," platform:").concat(r," SDKVersion:").concat(a)}catch(i){e=""}return e}())).end(),Ve.i("SDK ".concat(i)),da.prototype._getErrorMessage=this.getErrorMessage.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()}return r(e,[{key:"_startTimer",value:function(){var e=this._moduleMap.get(oo),t=e.isWorkerEnabled();Ve.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)),Ve.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._moduleMap.get(oo),t=e.isWorkerEnabled();Ve.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){Ve.l("".concat(this._n,"._stopMainThreadTimer")),this._checkTimer>0&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){Ve.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._moduleMap.get(eo);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){Ve.l("".concat(this._n,"._startMainThreadSocket"));var e=this._moduleMap.get(eo);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){Ve.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){Ve.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=m(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(Pn),this._moduleMap.get(Kn)],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;Ve.w("SDK is ready. cost ".concat(t," ms")),this._startLoginTs=Date.now();var n=this._moduleMap.get(Jn).getNetworkType(),o=this._ssoLogForReady.getStartTs()+Ue;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(Jn).start(),this._ssoLogForReady=new jr("sdkReady"),this._reason=Or.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOuterEmitterInstance",value:function(){return null===this._outerEmitter&&(this._outerEmitter=new Si,ga(this._outerEmitter),this._outerEmitter._emit=this._outerEmitter.emit,this._outerEmitter.emit=function(e,t){var n=this;if(e===E.CONVERSATION_LIST_UPDATED||e===E.FRIEND_LIST_UPDATED||e===E.GROUP_LIST_UPDATED||e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED)if(this._eventThrottleMap.has(e)){var o=Date.now(),s=this._eventThrottleMap.get(e);o-s.last<=1e3?(s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout((function(){s.last=Date.now(),n._outerEmitter._emit.apply(n._outerEmitter,[e,{name:e,data:n._getEventData(e)}])}),1e3)):(s.last=o,this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]))}else this._eventThrottleMap.set(e,{last:Date.now(),timeoutID:-1}),this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:this._getEventData(e)}]);else this._outerEmitter._emit.apply(this._outerEmitter,[e,{name:e,data:arguments[1]}])}.bind(this)),this._outerEmitter}},{key:"_getEventData",value:function(e){return e===E.CONVERSATION_LIST_UPDATED?this._moduleMap.get(Kn).getLocalConversationList():e===E.FRIEND_LIST_UPDATED?this._moduleMap.get(Vn).getLocalFriendList(!1):e===E.GROUP_LIST_UPDATED?this._moduleMap.get(xn).getLocalGroupList():e===E.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._moduleMap.get(Kn).getTotalUnreadMessageCount():void 0}},{key:"getInnerEmitterInstance",value:function(){return null===this._innerEmitter&&(this._innerEmitter=new Si,this._innerEmitter._emit=this._innerEmitter.emit,this._innerEmitter.emit=function(e,t){var n;n=ct(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(Wn).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(po).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&&Ve.w(o)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);Ve.w("Oops! ".concat(t)),new jr("error").setMessage(t).setNetworkType(this.getModule(Jn).getNetworkType()).setLevel("error").end(),this.getOuterEmitterInstance().emit(E.ERROR,e)}},{key:"restartTimer",value:function(){Ve.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer(),this.getModule(xn).restartPolling()}},{key:"getTimerID",value:function(){var e=this._moduleMap.get(oo);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._moduleMap.get(xn).getPollingTimerID(e)}},{key:"reset",value:function(){Ve.l("".concat(this._n,".reset")),be();var e,t=D(this._moduleMap);try{for(t.s();!(e=t.n()).done;){var n=m(e.value,2)[1];n.reset&&n.reset()}}catch(a){t.e(a)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._outerEmitter.emit(E.SDK_NOT_READY);var o,s=D(this._eventThrottleMap);try{for(s.s();!(o=s.n()).done;){var r=m(o.value,2)[1];r.timeoutID&&clearTimeout(r.timeoutID)}}catch(a){s.e(a)}finally{s.f()}this._eventThrottleMap.clear()}}]),e}(),bu=function(){function e(t){o(this,e),this._funcMap=new Map,this._m=t}return r(e,[{key:"defense",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if("string"!=typeof e)return null;if(0===e.length)return null;if("function"!=typeof t)return null;if(this._funcMap.has(e)&&this._funcMap.get(e).has(t))return this._funcMap.get(e).get(t);this._funcMap.has(e)||this._funcMap.set(e,new Map);var o=null;return this._funcMap.get(e).has(t)?o=this._funcMap.get(e).get(t):(o=this._pack(e,t,n),this._funcMap.get(e).set(t,o)),o}},{key:"defenseOnce",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return"function"!=typeof t?null:this._pack(e,t,n)}},{key:"find",value:function(e,t){return"string"!=typeof e||0===e.length||"function"!=typeof t?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.outputWarning("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return"function"==typeof t&&(!!this._funcMap.has(e)&&(!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),0===this._funcMap.get(e).size&&this._funcMap.delete(e),!0)))}},{key:"_pack",value:function(e,t,n){var o=this;return function(){try{t.apply(n,Array.from(arguments))}catch(u){var s=Object.values(E).indexOf(e),r="CallbackError";if(-1!==s){var a=Object.keys(E)[s];o._m.outputWarning(r,a,u)}var i=new jr(r);i.setMessage("eventName:".concat(e)).setMoreMessage(u.message).end()}}}}]),e}(),wu=function(){function e(t){o(this,e);var n={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:bt(),devMode:t.devMode||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0};this._m=new Pu(n),this._safetyCallbackFactory=new bu(this._m)}return r(e,[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._getModule(Pn).login(e)}},{key:"logout",value:function(){var e=this;return this._getModule(Pn).logout().then((function(t){return e._m.reset(),t}))}},{key:"isReady",value:function(){return this._m.isReady()}},{key:"isIntl",value:function(){return this._m.isIntl()}},{key:"getNotReadyReason",value:function(){return this._m.getNotReadyReason()}},{key:"getErrorMessage",value:function(e,t,n){return this._m.getErrorMessage(e,t,n)}},{key:"_getModule",value:function(e){return this._m.getModule(e)}},{key:"destroy",value:function(){var e=this;return this.logout().finally((function(){e._m.stopTimer(),e._getModule(oo).terminate(),e._getModule(eo).dealloc();var t=e._m.getOuterEmitterInstance(),n=e._getModule(Wn);t.emit(E.SDK_DESTROY,{SDKAppID:n.getSDKAppID()})}))}},{key:"on",value:function(e,t,n){Ve.d("on","eventName:".concat(e)),this._m.getOuterEmitterInstance().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){Ve.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){Ve.d("off","eventName:".concat(e));var s=this._safetyCallbackFactory.find(e,t);null!==s&&(this._m.getOuterEmitterInstance().off(e,s,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){dt(e["tim-offline-push-plugin"])?this._getModule(Qn).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){zt()?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)}Ve.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._getModule(bn).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._getModule(bn).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._getModule(bn).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._getModule(bn).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._getModule(bn).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._getModule(bn).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._getModule(bn).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._getModule(bn).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._getModule(bn).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._getModule(bn).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==k.MSG_MERGER?ha({code:Or.MESSAGE_MERGER_TYPE_INVALID}):$t(e.payload.downloadKey)?ha({code:Or.MESSAGE_MERGER_KEY_INVALID}):this._getModule(bn).downloadMergerMessage(e).catch((function(e){return ha({code:Or.MESSAGE_MERGER_DOWNLOAD_FAIL})}))}},{key:"createForwardMessage",value:function(e){return this._getModule(bn).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof ca?this._getModule(bn).sendMessageInstance(e,t):ha({code:Or.MESSAGE_SEND_NEED_MESSAGE_INSTANCE})}},{key:"callExperimentalAPI",value:function(e,t){return"sendComboMessage"===e?this._getModule(lo).sendMessage(t):"handleGroupInvitation"===e?this._getModule(xn).handleGroupInvitation(t):"isCommercialAbilityEnabled"===e?this._getModule(ao).isFeatureEnabled(t):"isIntl"===e?this.isIntl():"sendTRTCCustomData"===e?this._getModule(co).sendTRTCCustomData(t):"getTimerID"===e?this._m.getTimerID():"getPollingTimerID"===e?this._m.getPollingTimerID(t):ha({code:Or.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._getModule(bn).revokeMessage(e)}},{key:"resendMessage",value:function(e){return this._getModule(bn).resendMessage(e)}},{key:"deleteMessage",value:function(e){return this._getModule(bn).deleteMessage(e)}},{key:"translateText",value:function(e){return this._getModule(bn).translateText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._getModule(wn).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._getModule(wn).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._getModule(wn).deleteMessageExtensions(e,t)}},{key:"modifyMessage",value:function(e){return this._getModule(bn).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._getModule(Kn).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._getModule(Kn).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._getModule(Kn).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._getModule(Kn).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){return this._getModule(xn).getReadReceiptDetail(e)}},{key:"findMessage",value:function(e){return this._getModule(Kn).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._getModule(Kn).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._getModule(Kn).getConversationList(e)}},{key:"getConversationProfile",value:function(e){return this._getModule(Kn).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._getModule(Kn).deleteConversation(e)}},{key:"clearHistoryMessage",value:function(e){return this._getModule(Kn).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._getModule(Kn).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._getModule(Kn).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._getModule(Kn).setMessageRemindType(e)}},{key:"getTotalUnreadMessageCount",value:function(){return this._getModule(Kn).getTotalUnreadMessageCount()}},{key:"setConversationCustomData",value:function(e){return this._getModule(Kn).setConversationCustomData(e)}},{key:"markConversation",value:function(e){return this._getModule(Kn).markConversation(e)}},{key:"getConversationGroupList",value:function(){return this._getModule(Kn).getConversationGroupList()}},{key:"createConversationGroup",value:function(e){return this._getModule(Kn).createConversationGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._getModule(Kn).deleteConversationGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._getModule(Kn).renameConversationGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._getModule(Kn).addConversationsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._getModule(Kn).deleteConversationsFromGroup(e)}},{key:"getMyProfile",value:function(){return this._getModule(Fn).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._getModule(Fn).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._getModule(Fn).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._getModule(Fn).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._getModule(Fn).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._getModule(Fn).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._getModule(Fn).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._getModule(Fn).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._getModule(Fn).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._getModule(Fn).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._getModule(Vn);return e?e.getLocalFriendList():ha({code:Or.CANNOT_FIND_MODULE})}},{key:"addFriend",value:function(e){var t=this._getModule(Vn);return t?t.addFriend(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._getModule(Vn);return t?t.deleteFriend(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"checkFriend",value:function(e){var t=this._getModule(Vn);return t?t.checkFriend(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._getModule(Vn);return t?t.getFriendProfile(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"updateFriend",value:function(e){var t=this._getModule(Vn);return t?t.updateFriend(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._getModule(Vn);return e?e.getLocalFriendApplicationList():ha({code:Or.CANNOT_FIND_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._getModule(Vn);return t?t.acceptFriendApplication(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._getModule(Vn);return t?t.refuseFriendApplication(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._getModule(Vn);return t?t.deleteFriendApplication(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._getModule(Vn);return e?e.setFriendApplicationRead():ha({code:Or.CANNOT_FIND_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._getModule(Vn);return e?e.getLocalFriendGroupList():ha({code:Or.CANNOT_FIND_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._getModule(Vn);return t?t.createFriendGroup(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._getModule(Vn);return t?t.deleteFriendGroup(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._getModule(Vn);return t?t.addToFriendGroup(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._getModule(Vn);return t?t.removeFromFriendGroup(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._getModule(Vn);return t?t.renameFriendGroup(e):ha({code:Or.CANNOT_FIND_MODULE})}},{key:"getGroupList",value:function(e){return this._getModule(xn).getGroupList(e)}},{key:"getGroupProfile",value:function(e){return this._getModule(xn).getGroupProfile(e)}},{key:"createGroup",value:function(e){return this._getModule(xn).createGroup(e)}},{key:"dismissGroup",value:function(e){return this._getModule(xn).dismissGroup(e)}},{key:"updateGroupProfile",value:function(e){return this._getModule(xn).updateGroupProfile(e)}},{key:"joinGroup",value:function(e){return this._getModule(xn).joinGroup(e)}},{key:"quitGroup",value:function(e){return this._getModule(xn).quitGroup(e)}},{key:"searchGroupByID",value:function(e){return this._getModule(xn).searchGroupByID(e)}},{key:"getGroupOnlineMemberCount",value:function(e){return this._getModule(xn).getGroupOnlineMemberCount(e)}},{key:"changeGroupOwner",value:function(e){return this._getModule(xn).changeGroupOwner(e)}},{key:"getGroupApplicationList",value:function(){return this._getModule(xn).getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){return this._getModule(xn).handleGroupApplication(e)}},{key:"initGroupAttributes",value:function(e){return this._getModule(xn).initGroupAttributes(e)}},{key:"setGroupAttributes",value:function(e){return this._getModule(xn).setGroupAttributes(e)}},{key:"deleteGroupAttributes",value:function(e){return this._getModule(xn).deleteGroupAttributes(e)}},{key:"getGroupAttributes",value:function(e){return this._getModule(xn).getGroupAttributes(e)}},{key:"setGroupCounters",value:function(e){return this._getModule(xn).setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._getModule(xn).increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._getModule(xn).decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._getModule(xn).getGroupCounters(e)}},{key:"getGroupMemberList",value:function(e){return this._getModule(Hn).getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._getModule(Hn).getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._getModule(Hn).addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._getModule(Hn).deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._getModule(Hn).setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._getModule(Hn).setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._getModule(Hn).setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._getModule(Hn).setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._getModule(Hn).markGroupMemberList(e)}},{key:"getJoinedCommunityList",value:function(){return this._getModule(Bn).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._getModule(Bn).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._getModule(Bn).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._getModule(Bn).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._getModule(Bn).getTopicList(e)}}]),e}(),Fu={login:1,logout:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1};function qu(e,t){if(e.isReady()||1===Fu[t])return!0;var n=e.getNotReadyReason(),o={code:n,message:"".concat(e.getErrorMessage(n)," | ").concat(t," | ").concat(e.getErrorMessage(Or.SDK_IS_NOT_READY))};return e.onError(o),o}var xu={},Vu={};return Vu.create=function(e){var n=0,o=e.SDKAppID;if(at(o))n=o;else if(n=parseInt(o),isNaN(o))return Ve.e("".concat("TIM.create"," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&xu[n])return xu[n];Ve.l("".concat("TIM.create"));var s=new wu(t(t({},e),{},{SDKAppID:n}));s.on(E.SDK_DESTROY,(function(e){xu[e.data.SDKAppID]=null,delete xu[e.data.SDKAppID]}));var r=function(e){var t=Object.create(null);return Object.keys(Un).forEach((function(n){if(e[n]){var o=new S;t[n]=function(){var t=Array.from(arguments);return o.use((function(t,o){var s=qu(e,n);return!0===s?o():ha(s)})).use((function(e,t){if(!0===en(e,Gn[n],n))return t()})).use((function(t,o){return e[n].apply(e,t)})),o.run(t)}}})),t}(s);return xu[n]=r,Gn.hookGetAPITips(s.getErrorMessage.bind(s)),Ve.l("".concat("TIM.create"," ok")),r},Vu.TYPES=k,Vu.EVENT=E,Vu.VERSION="2.27.3",Ve.l("TIM.VERSION:".concat(Vu.VERSION)),Vu}));
|