Files
zyt/server/public/admin/assets/@tencentcloud/chat-AC2Y2r2A.js
T
2026-07-06 15:00:10 +08:00

7 lines
709 KiB
JavaScript

import{c as Dt,a as kc}from"../lodash-D3kF6u-c.js";var Co={exports:{}},Rc=Co.exports,Xa;function Ac(){return Xa||(Xa=1,(function(Za,Nc){(function(mn,vn){Za.exports=vn()})(Rc,function(){function mn(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function vn(e){if(Array.isArray(e))return e}function le(e,s,n){s=In(s);var o=e,s=To()?Reflect.construct(s,n||[],In(e).constructor):s.apply(e,n);if(!s||typeof s!="object"&&typeof s!="function"){if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");if((s=o)===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return s}function U(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ms(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,ys(o.key),o)}}function b(e,t,n){return t&&ms(e.prototype,t),n&&ms(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Se(e,t){var n,o,s,a,i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i)return s=!(o=!0),{s:function(){i=i.call(e)},n:function(){var r=i.next();return o=r.done,r},e:function(r){s=!0,n=r},f:function(){try{o||i.return==null||i.return()}finally{if(s)throw n}}};if(Array.isArray(e)||(i=yn(e))||t&&e&&typeof e.length=="number")return i&&(e=i),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(r){throw r},f:t};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ge(e,t,n){return(t=ys(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function In(e){return(In=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}function de(e,t){if(typeof t!="function"&&t!==null)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&&Mn(e,t)}function To(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(To=function(){return!!e})()}function vs(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Is(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ms(e,t){var n,o=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),o.push.apply(o,n)),o}function p(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ms(Object(n),!0).forEach(function(o){Ge(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ms(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function Fe(e,t){if(e==null)return{};var n,o=(function(i,r){if(i==null)return{};var c,u={};for(c in i)if({}.hasOwnProperty.call(i,c)){if(0<=r.indexOf(c))continue;u[c]=i[c]}return u})(e,t);if(Object.getOwnPropertySymbols)for(var s=Object.getOwnPropertySymbols(e),a=0;a<s.length;a++)n=s[a],0<=t.indexOf(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function Mn(e,t){return(Mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n})(e,t)}function ke(e,t){return vn(e)||(function(n,o){var s=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(s!=null){var a,i,r,c,u=[],l=!0,_=!1;try{if(r=(s=s.call(n)).next,o===0){if(Object(s)!==s)return;l=!1}else for(;!(l=(a=r.call(s)).done)&&(u.push(a.value),u.length!==o);l=!0);}catch(m){_=!0,i=m}finally{try{if(!l&&s.return!=null&&(c=s.return(),Object(c)!==c))return}finally{if(_)throw i}}return u}})(e,t)||yn(e,t)||Is()}function G(e){return(function(t){if(Array.isArray(t))return mn(t)})(e)||vs(e)||yn(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function ys(e){return e=(function(t){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n===void 0)return String(t);if(n=n.call(t,"string"),typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(e),typeof e=="symbol"?e:e+""}function ut(e){return(ut=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function yn(e,t){var n;if(e)return typeof e=="string"?mn(e,t):(n=(n={}.toString.call(e).slice(8,-1))==="Object"&&e.constructor?e.constructor.name:n)==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mn(e,t):void 0}function Qa(e){var t=typeof Map=="function"?new Map:void 0;return(function(n){if(n===null||!(function(s){try{return Function.toString.call(s).indexOf("[native code]")!==-1}catch{return typeof s=="function"}})(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,o)}function o(){return(function(s,a,i){var r;return To()?Reflect.construct.apply(null,arguments):((r=[null]).push.apply(r,a),a=new(s.bind.apply(s,r)),i&&Mn(a,i.prototype),a)})(n,arguments,In(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Mn(o,n)})(e)}var F={SDK_READY:"sdkStateReady",SDK_NOT_READY:"sdkStateNotReady",SDK_DESTROY:"sdkDestroy",MESSAGE_RECEIVED:"onMessageReceived",ROOM_CUSTOM_DATA_RECEIVED:"onRoomCustomDataReceived",MESSAGE_MODIFIED:"onMessageModified",MESSAGE_REVOKED:"onMessageRevoked",MESSAGE_READ_BY_PEER:"onMessageReadByPeer",MESSAGE_READ_RECEIPT_RECEIVED:"onMessageReadReceiptReceived",MESSAGE_EXTENSIONS_UPDATED:"onMessageExtensionsUpdated",MESSAGE_EXTENSIONS_DELETED:"onMessageExtensionsDeleted",MESSAGE_REACTIONS_UPDATED:"onMessageReactionsUpdated",CONVERSATION_LIST_UPDATED:"onConversationListUpdated",TOTAL_UNREAD_MESSAGE_COUNT_UPDATED:"onTotalUnreadMessageCountUpdated",CONVERSATION_GROUP_LIST_UPDATED:"onConversationGroupListUpdated",CONVERSATION_IN_GROUP_UPDATED:"onConversationInGroupUpdated",GROUP_LIST_UPDATED:"onGroupListUpdated",GROUP_ATTRIBUTES_UPDATED:"groupAttributesUpdated",GROUP_COUNTER_UPDATED:"onGroupCounterUpdated",TOPIC_CREATED:"onTopicCreated",TOPIC_DELETED:"onTopicDeleted",TOPIC_UPDATED:"onTopicUpdated",PROFILE_UPDATED:"onProfileUpdated",USER_STATUS_UPDATED:"onUserStatusUpdated",BLACKLIST_UPDATED:"blacklistUpdated",FRIEND_LIST_UPDATED:"onFriendListUpdated",FRIEND_GROUP_LIST_UPDATED:"onFriendGroupListUpdated",FRIEND_APPLICATION_LIST_UPDATED:"onFriendApplicationListUpdated",MY_FOLLOWERS_LIST_UPDATED:"onMyFollowersListUpdated",MY_FOLLOWING_LIST_UPDATED:"onMyFollowingListUpdated",MUTUAL_FOLLOWERS_LIST_UPDATED:"onMutualFollowersListUpdated",KICKED_OUT:"kickedOut",ERROR:"error",NET_STATE_CHANGE:"netStateChange",ALL_RECEIVE_MESSAGE_OPT_UPDATED:"onAllReceiveMessageOptUpdated",SERVER_CONFIG_UPDATED:"onServerConfigUpdated",PINNED_GROUP_MESSAGE_UPDATED:"onPinnedGroupMessageUpdated"},g={MSG_TEXT:"TIMTextElem",MSG_IMAGE:"TIMImageElem",MSG_SOUND:"TIMSoundElem",MSG_AUDIO:"TIMSoundElem",MSG_FILE:"TIMFileElem",MSG_FACE:"TIMFaceElem",MSG_VIDEO:"TIMVideoFileElem",MSG_GEO:"TIMLocationElem",MSG_LOCATION:"TIMLocationElem",MSG_GRP_TIP:"TIMGroupTipElem",MSG_GRP_SYS_NOTICE:"TIMGroupSystemNoticeElem",MSG_CUSTOM:"TIMCustomElem",MSG_MERGER:"TIMRelayElem",MSG_PRIORITY_HIGH:"High",MSG_PRIORITY_NORMAL:"Normal",MSG_PRIORITY_LOW:"Low",MSG_PRIORITY_LOWEST:"Lowest",CONV_C2C:"C2C",CONV_GROUP:"GROUP",CONV_TOPIC:"TOPIC",CONV_SYSTEM:"@TIM#SYSTEM",CONV_AT_ME:1,CONV_AT_ALL:2,CONV_AT_ALL_AT_ME:3,CONV_MARK_TYPE_STAR:1,CONV_MARK_TYPE_UNREAD:2,CONV_MARK_TYPE_FOLD:4,CONV_MARK_TYPE_HIDE:8,GRP_PRIVATE:"Private",GRP_WORK:"Private",GRP_PUBLIC:"Public",GRP_CHATROOM:"ChatRoom",GRP_MEETING:"ChatRoom",GRP_AVCHATROOM:"AVChatRoom",GRP_COMMUNITY:"Community",GRP_ROOM:"Room",GRP_LIVE:"Live",GRP_MBR_ROLE_OWNER:"Owner",GRP_MBR_ROLE_ADMIN:"Admin",GRP_MBR_ROLE_MEMBER:"Member",GRP_MBR_ROLE_CUSTOM:"Custom",GRP_TIP_MBR_JOIN:1,GRP_TIP_MBR_QUIT:2,GRP_TIP_MBR_KICKED_OUT:3,GRP_TIP_MBR_SET_ADMIN:4,GRP_TIP_MBR_CANCELED_ADMIN:5,GRP_TIP_GRP_PROFILE_UPDATED:6,GRP_TIP_MBR_PROFILE_UPDATED:7,GRP_TIP_BAN_AVCHATROOM_MEMBER:10,GRP_TIP_UNBAN_AVCHATROOM_MEMBER:11,MSG_REMIND_ACPT_AND_NOTE:"AcceptAndNotify",MSG_REMIND_ACPT_NOT_NOTE:"AcceptNotNotify",MSG_REMIND_DISCARD:"Discard",RECEIVE_WITH_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT:"AcceptNotNotifyExceptAt",NOT_RECEIVE_MSG_EXCEPT_AT:"NotReceiveMsgExceptAt",GENDER_UNKNOWN:"Gender_Type_Unknown",GENDER_FEMALE:"Gender_Type_Female",GENDER_MALE:"Gender_Type_Male",KICKED_OUT_MULT_ACCOUNT:"multipleAccount",KICKED_OUT_MULT_DEVICE:"multipleDevice",KICKED_OUT_USERSIG_EXPIRED:"userSigExpired",KICKED_OUT_REST_API:"REST_API_Kick",ALLOW_TYPE_ALLOW_ANY:"AllowType_Type_AllowAny",ALLOW_TYPE_NEED_CONFIRM:"AllowType_Type_NeedConfirm",ALLOW_TYPE_DENY_ANY:"AllowType_Type_DenyAny",FORBID_TYPE_NONE:"AdminForbid_Type_None",FORBID_TYPE_SEND_OUT:"AdminForbid_Type_SendOut",JOIN_OPTIONS_FREE_ACCESS:"FreeAccess",JOIN_OPTIONS_NEED_PERMISSION:"NeedPermission",JOIN_OPTIONS_DISABLE_APPLY:"DisableApply",JOIN_STATUS_SUCCESS:"JoinedSuccess",JOIN_STATUS_ALREADY_IN_GROUP:"AlreadyInGroup",JOIN_STATUS_WAIT_APPROVAL:"WaitAdminApproval",INVITE_OPTIONS_DISABLE_INVITE:"DisableInvite",INVITE_OPTIONS_NEED_PERMISSION:"NeedPermission",INVITE_OPTIONS_FREE_ACCESS:"FreeAccess",GRP_PROFILE_OWNER_ID:"ownerID",GRP_PROFILE_CREATE_TIME:"createTime",GRP_PROFILE_LAST_INFO_TIME:"lastInfoTime",GRP_PROFILE_MEMBER_NUM:"memberNum",GRP_PROFILE_MAX_MEMBER_NUM:"maxMemberNum",GRP_PROFILE_JOIN_OPTION:"joinOption",GRP_PROFILE_INVITE_OPTION:"inviteOption",GRP_PROFILE_INTRODUCTION:"introduction",GRP_PROFILE_NOTIFICATION:"notification",GRP_PROFILE_MUTE_ALL_MBRS:"muteAllMembers",SNS_ADD_TYPE_SINGLE:"Add_Type_Single",SNS_ADD_TYPE_BOTH:"Add_Type_Both",SNS_DELETE_TYPE_SINGLE:"Delete_Type_Single",SNS_DELETE_TYPE_BOTH:"Delete_Type_Both",SNS_APPLICATION_TYPE_BOTH:"Pendency_Type_Both",SNS_APPLICATION_SENT_TO_ME:"Pendency_Type_ComeIn",SNS_APPLICATION_SENT_BY_ME:"Pendency_Type_SendOut",SNS_APPLICATION_AGREE:"Response_Action_Agree",SNS_APPLICATION_AGREE_AND_ADD:"Response_Action_AgreeAndAdd",SNS_CHECK_TYPE_BOTH:"CheckResult_Type_Both",SNS_CHECK_TYPE_SINGLE:"CheckResult_Type_Single",SNS_TYPE_NO_RELATION:"CheckResult_Type_NoRelation",SNS_TYPE_A_WITH_B:"CheckResult_Type_AWithB",SNS_TYPE_B_WITH_A:"CheckResult_Type_BWithA",SNS_TYPE_BOTH_WAY:"CheckResult_Type_BothWay",NET_STATE_CONNECTED:"connected",NET_STATE_CONNECTING:"connecting",NET_STATE_DISCONNECTED:"disconnected",MSG_AT_ALL:"__kImSDK_MesssageAtALL__",READ_ALL_C2C_MSG:"readAllC2CMessage",READ_ALL_GROUP_MSG:"readAllGroupMessage",READ_ALL_MSG:"readAllMessage",USER_STATUS_UNKNOWN:0,USER_STATUS_ONLINE:1,USER_STATUS_OFFLINE:2,USER_STATUS_UNLOGINED:3,IOS_OFFLINE_PUSH_NO_SOUND:"push.no_sound",IOS_OFFLINE_PUSH_DEFAULT_SOUND:"default"},ge={NEW_INVITATION_RECEIVED:"newInvitationReceived",INVITEE_ACCEPTED:"ts_invitee_accepted",INVITEE_REJECTED:"ts_invitee_rejected",INVITATION_CANCELLED:"ts_invitation_cancelled",INVITATION_TIMEOUT:"ts_invitation_timeout",INVITATION_MODIFIED:"ts_invitation_modified",ACTION_TYPE_UNKNOWN:0,ACTION_TYPE_INVITE:1,ACTION_TYPE_CANCEL_INVITE:2,ACTION_TYPE_ACCEPT_INVITE:3,ACTION_TYPE_REJECT_INVITE:4,ACTION_TYPE_INVITE_TIMEOUT:5},$a=b(function e(){U(this,e),this.cache=[],this.options=null},[{key:"use",value:function(e){if(typeof e!="function")throw"middleware must be a function";return this.cache.push(e),this}},{key:"next",value:function(e){if(this.middlewares&&0<this.middlewares.length)return this.middlewares.shift().call(this,this.options,this.next.bind(this))}},{key:"run",value:function(e){return this.middlewares=this.cache.map(function(t){return t}),this.options=e,this.next()}}]),Me=b(function e(){var t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:0,n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0;U(this,e),this.high=t,this.low=n},[{key:"equal",value:function(e){return e!==null&&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}}]),Cs={TEST:{CHINA:{DEFAULT:"wss://wss-dev.tim.qq.com"},OVERSEA:{DEFAULT:"wss://wss-dev.tim.qq.com"},SINGAPORE:{DEFAULT:"wss://wsssgp-dev.im.qcloud.com"},KOREA:{DEFAULT:"wss://wsskr-dev.im.qcloud.com"},GERMANY:{DEFAULT:"wss://wssger-dev.im.qcloud.com"},IND:{DEFAULT:"wss://wssind-dev.im.qcloud.com"},JPN:{DEFAULT:"wss://wssjpn-dev.im.qcloud.com"},USA:{DEFAULT:"wss://wssusa-dev.im.qcloud.com"},INDONESIA:{DEFAULT:"wss://wssidn-dev.im.qcloud.com"}},PRODUCTION:{CHINA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.tim.qq.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://events.im.qcloud.com",ANYCAST:"wss://162.14.13.203"},OVERSEA:{DEFAULT0:"wss://*w4c.my-imcloud.com",DEFAULT:"wss://wss.im.qcloud.com",IPV6:"wss://wssv6.im.qcloud.com",BACKUP:"wss://wss.my-imcloud.com",BACKUP_WEB:"wss://*w4c.my-cpaas.com",BACKUP_CN:"wss://wss.im.tencent.cn",STAT:"https://api.my-imcloud.com"},SINGAPORE:{DEFAULT0:"wss://*w4s.my-imcloud.com",DEFAULT:"wss://wsssgp.im.qcloud.com",IPV6:"wss://wsssgpv6.im.qcloud.com",BACKUP:"wss://wsssgp.my-imcloud.com",BACKUP_WEB:"wss://*w4s.my-cpaas.com",STAT:"https://apisgp.my-imcloud.com",ANYCAST:"wss://162.14.19.159"},KOREA:{DEFAULT0:"wss://*w4k.my-imcloud.com",DEFAULT:"wss://wsskr.im.qcloud.com",IPV6:"wss://wsskrv6.im.qcloud.com",BACKUP:"wss://wsskr.my-imcloud.com",BACKUP_WEB:"wss://*w4k.my-cpaas.com",STAT:"https://apikr.my-imcloud.com",ANYCAST:"wss://162.14.13.104"},GERMANY:{DEFAULT0:"wss://*w4g.my-imcloud.com",DEFAULT:"wss://wssger.im.qcloud.com",IPV6:"wss://wssgerv6.im.qcloud.com",BACKUP:"wss://wssger.my-imcloud.com",BACKUP_WEB:"wss://*w4g.my-cpaas.com",STAT:"https://apiger.my-imcloud.com",ANYCAST:"wss://162.14.3.17"},IND:{DEFAULT0:"wss://*w4i.my-imcloud.com",DEFAULT:"wss://wssind.my-imcloud.com",IPV6:"wss://wssindv6.im.qcloud.com",BACKUP:"wss://wssind.im.qcloud.com",BACKUP_WEB:"wss://*w4i.my-cpaas.com",STAT:"https://apiind.my-imcloud.com",ANYCAST:"wss://162.14.19.46"},JPN:{DEFAULT0:"wss://*w4j.my-imcloud.com",DEFAULT:"wss://wssjpn.im.qcloud.com",IPV6:"wss://wssjpnv6.im.qcloud.com",BACKUP:"wss://wssjpn.my-imcloud.com",BACKUP_WEB:"wss://*w4j.my-cpaas.com",STAT:"https://apijpn.my-imcloud.com",ANYCAST:"wss://162.14.13.254"},USA:{DEFAULT0:"wss://*w4u.my-imcloud.com",DEFAULT:"wss://wssusa.im.qcloud.com",IPV6:"wss://wssusav6.im.qcloud.com",BACKUP:"wss://wssusa.my-imcloud.com",BACKUP_WEB:"wss://*w4u.my-cpaas.com",STAT:"https://apiusa.my-imcloud.com",ANYCAST:"wss://162.14.10.42"},INDONESIA:{DEFAULT0:"wss://*w4y.my-imcloud.com",DEFAULT:"wss://wssidn.im.qcloud.com",IPV6:"wss://wssidnv6.im.qcloud.com",BACKUP:"wss://wssidn.my-imcloud.com",BACKUP_WEB:"wss://*w4y.my-cpaas.com",STAT:"https://apiidn.my-imcloud.com",ANYCAST:"wss://43.129.34.169"}}},qe={ANDROID:2,IOS:3,MAC:4,WEB:7,WX_MP:8,QQ_MP:9,TT_MP:10,BAIDU_MP:11,ALI_MP:12,IPAD:13,UNI_NATIVE_APP:15,DONUT_NATIVE_APP:19,NS_NATIVE_APP:20,RN_NATIVE_APP:21},Do="1.7.3",Eo=537048168,Cn="CHINA",E={HOST:{CURRENT:{DEFAULT:"wss://wss.im.qcloud.com",STAT:"https://events.im.qcloud.com"},setCurrent:function(){this.CURRENT=Cs.PRODUCTION[0<arguments.length&&arguments[0]!==void 0?arguments[0]:Cn]}},NAME:{OPEN_IM:"openim",OPEN_IM_MSG_EXT:"openim_msg_ext_http_svc",GRP:"group_open_http_svc",GRP_AV:"group_open_avchatroom_http_svc",GRP_COMMUNITY:"million_group_open_http_svc",GRP_ATTR:"group_open_attr_http_svc",FD:"sns",PROFILE:"profile",RECENT_CONTACT:"recentcontact",BIG_GRP_NO_AUTH:"group_open_http_noauth_svc",BIG_GRP_POLLING:"group_open_long_polling_http_svc",BIG_GRP_POLLING_NO_AUTH:"group_open_long_polling_http_noauth_svc",IM_OPEN_STAT:"imopenstat",IM_COS_SIGN:"im_cos_sign_svr",CUSTOM_UPLOAD:"im_cos_msg",HEARTBEAT:"heartbeat",IM_OPEN_PUSH:"im_open_push",IM_OPEN_STATUS:"im_open_status",IM_LONG_MSG:"im_long_msg",IM_CONFIG_MANAGER:"im_sdk_config_mgr",STAT_SERVICE:"StatSvc",OVERLOAD_PUSH:"OverLoadPush",IM_MSG_AUDIT_MGR:"im_msg_audit_mgr",TUIROOM_SVR:"tui_room_svr",IM_OPEN_TRANSLATE:"im_open_translate",IM_OPEN_SPEECH:"im_open_speech",MSG_SEARCH:"message_search",GRP_SEARCH:"group_search",GRP_MEMBER_SEARCH:"group_member_search",USER_SEARCH:"user_search",FOLLOW:"follow",OFFLINE_PUSH_REPORT:"offline_push_report",IM_MSG_LOGIC:"im_msg_db_logic"}},ee={SEARCH_GRP_SNS:new Me(0,Math.pow(2,1)).toString(),AV_HISTORY_MSG:new Me(0,Math.pow(2,2)).toString(),GRP_COMMUNITY:new Me(0,Math.pow(2,3)).toString(),MSG_TO_SPECIFIED_GRP_MBR:new Me(0,Math.pow(2,4)).toString(),AV_MBR_LIST:new Me(0,Math.pow(2,6)).toString(),USER_STATUS:new Me(0,Math.pow(2,7)).toString(),CONV_MARK:new Me(0,Math.pow(2,9)).toString(),CONV_GROUP:new Me(0,Math.pow(2,10)).toString(),AV_BAN_MBR:new Me(0,Math.pow(2,11)).toString(),MSG_EXT:new Me(0,Math.pow(2,13)).toString(),GRP_COUNTER:new Me(0,Math.pow(2,15)).toString(),PLUGIN_TRANSLATE:new Me(Math.pow(2,6)).toString(),PLUGIN_VOICE_TO_TEXT:new Me(Math.pow(2,7)).toString(),PLUGIN_CS:new Me(Math.pow(2,8)).toString(),PLUGIN_PUSH:new Me(Math.pow(2,9)).toString(),PLUGIN_BOT:new Me(Math.pow(2,10)).toString(),MSG_REACTION:new Me(Math.pow(2,16)).toString(),FOLLOW:new Me(Math.pow(2,20)).toString()},Ts="group_profile",Ds=["Type","Name","Introduction","Notification","FaceUrl","Owner_Account","CreateTime","InfoSeq","LastInfoTime","LastMsgTime","MemberNum","MaxMemberNum","ApplyJoinOption","NextMsgSeq","ShutUpAllMember","InviteJoinOption"],Es=["Role","JoinTime","MsgSeq","MsgFlag"],Ls="web.sdk.qcloud.com",Ss="web.sdk.cloud.tencent.cn",ks="web.sdk.tencent.cn";E.HOST.setCurrent(Cn);for(var Lo,A=typeof wx<"u"&&typeof wx.getSystemInfoSync=="function"&&(wx.getSystemInfoSync().platform==="mac"||wx.getSystemInfoSync().platform==="windows")&&wx.getSystemInfoSync().uniPlatform===void 0,Xe=typeof wx<"u"&&typeof wx.getSystemInfoSync=="function"&&!!wx.getSystemInfoSync().fontSizeSetting||A,Rs=Xe&&typeof wx.createGamePortal=="function",Et=typeof qq<"u"&&typeof qq.getSystemInfoSync=="function"&&!!qq.getSystemInfoSync().fontSizeSetting,ft=typeof tt<"u"&&typeof tt.getSystemInfoSync=="function"&&!!tt.getSystemInfoSync().fontSizeSetting,Tn=typeof swan<"u"&&typeof swan.getSystemInfoSync=="function"&&!!swan.getSystemInfoSync().fontSizeSetting,Ze=typeof my<"u"&&typeof my.getSystemInfoSync=="function"&&!!my.getSystemInfoSync().fontSizeSetting,A=typeof jd<"u"&&typeof jd.getSystemInfoSync=="function",Be=typeof uni<"u"&&typeof window>"u"&&typeof uni.requireNativePlugin=="function",W=Xe&&ut(wx.miniapp)==="object",As=typeof uni<"u",Os=ft&&typeof tt.enterChat=="function",X=Xe||Et||ft||Tn||Ze||Be||A,K=typeof window>"u"&&!X&&typeof Dt<"u"&&Dt.NativeScriptGlobals!==void 0,He=typeof Dt<"u"&&(Dt.nativeModuleProxy!==void 0||Dt.ReactNative!==void 0),Ae=typeof uni<"u"?!X:typeof window<"u"&&!X&&!He,te=Et?qq:ft?tt:Tn?swan:Ze?my:Xe?wx:Be?uni:A?jd:{},Ue=Ae&&window&&window.navigator&&window.navigator.userAgent||"",Ns=(A="WEB",/(micromessenger|webbrowser)/i.test(Ue)?A="WEB":Et?A="QQ_MP":ft?A="TT_MP":Tn?A="BAIDU_MP":Ze?A="ALI_MP":Xe?A=W?"DONUT_NATIVE_APP":"WX_MP":Be?A="UNI_NATIVE_APP":K?A="NS_NATIVE_APP":He&&(A="RN_NATIVE_APP"),qe[A]),W=/iPad/i.test(Ue),K=/iPhone/i.test(Ue)&&!W,A=/iPod/i.test(Ue),So=K||W||A,ei=(K=Ue.match(/OS (\d+)_/i))&&K[1]?K[1]:null,ko=/Android/i.test(Ue),ti=(W=Ue.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i))?(A=W[1]&&parseFloat(W[1]),K=W[2]&&parseFloat(W[2]),A&&K?parseFloat(W[1]+"."+W[2]):A||null):null,K=/Edge/i.test(Ue),W=!K&&/Chrome/i.test(Ue),Ro=/MSIE/.test(Ue)||-1<Ue.indexOf("Trident")&&-1<Ue.indexOf("rv:11.0"),ni=A=!(A=(A=/MSIE\s(\d+)\.\d/.exec(Ue))&&parseFloat(A[1]))&&/Trident\/7.0/i.test(Ue)&&/rv:11.0/.test(Ue)?11:A,A=/Safari/i.test(Ue)&&!W&&!ko&&!K,oi=/Windows/i.test(Ue),si=/MAC OS X/i.test(Ue),Pt=Ae&&typeof Worker<"u"&&!Ro,Ao=ko||So,Ps=Ae&&window.tencent_cloud_im_csig_flutter_for_web_25F_cy!==void 0,Gs=typeof window<"u"&&window.navigator!==void 0&&(W=window.navigator.standalone,!(!So||W||A)),Us=typeof console<"u"?console:typeof Dt<"u"&&Dt.console?Dt.console:typeof window<"u"&&window.console?window.console:{},ai=function(){},bs=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],ws=bs.length;ws--;)Lo=bs[ws],console[Lo]||(Us[Lo]=ai);function Fs(){var e=new Date;return e.setTime(Qe()),e}function qs(){Qt=0}function Zt(){return Math.floor(Qe()/1e3)}var xs=Us,Qt=0,Qe=function(){return new Date().getTime()+Qt},lt=0;function Vs(){return Fo()?"%c Chat %c":"Chat"}function Bs(){var e=Fs();return e.toLocaleTimeString("en-US",{hour12:!1})+"."+(function(t){var n;switch(t.toString().length){case 1:n="00"+t;break;case 2:n="0"+t;break;default:n=t}return n})(e.getMilliseconds())}var d={arguments2String:function(e){var t="";if(e.length===1)t=e[0];else for(var n=0,o=e.length;n<o;n++){if(en(e[n]))try{t+=ui(e[n])?JSON.stringify(e[n],["message","code"]):JSON.stringify(e[n])}catch(s){t+=s?s.message:"";break}else t+=e[n];t+=" "}return t},_exec:function(e,t){Fo()?xs[e](Vs(),"background:#0abf5b; padding:1px; border-radius:3px; color: #fff","background:transparent",Bs(),t):xs[e]("".concat(Vs()," ").concat(Bs()," ").concat(t))},d:function(){var e;lt<=-1&&(e=this.arguments2String(arguments),this._exec("debug",e))},l:function(){var e;lt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},log:function(){var e;lt<=0&&(e=this.arguments2String(arguments),this._exec("log",e))},i:function(){var e;lt<=1&&(e=this.arguments2String(arguments),this._exec("info",e))},w:function(){var e;lt<=2&&(e=this.arguments2String(arguments),this._exec("warn",e))},e:function(){var e;lt<=3&&(e=this.arguments2String(arguments),this._exec("error",e))},setLevel:function(e){e<4&&this._exec("log","set level from "+lt+" to "+e),lt=e},getLevel:function(){return lt}},Dn={JPG:1,JPEG:1,GIF:2,PNG:3,BMP:4,UNKNOWN:255},K="Tag_Profile_IM_",H={NICK:"".concat(K,"Nick"),GENDER:"".concat(K,"Gender"),BIRTHDAY:"".concat(K,"BirthDay"),LOCATION:"".concat(K,"Location"),SELFSIGNATURE:"".concat(K,"SelfSignature"),ALLOWTYPE:"".concat(K,"AllowType"),LANGUAGE:"".concat(K,"Language"),AVATAR:"".concat(K,"Image"),MESSAGESETTINGS:"".concat(K,"MsgSettings"),ADMINFORBIDTYPE:"".concat(K,"AdminForbidType"),LEVEL:"".concat(K,"Level"),ROLE:"".concat(K,"Role")},$e={GROUP:"".concat("Tag_SNS_IM_","Group"),REMARK:"".concat("Tag_SNS_IM_","Remark"),ADDSOURCE:"".concat("Tag_SNS_IM_","AddSource"),ADDWORDING:"".concat("Tag_SNS_IM_","Wording"),ADDTIME:"".concat("Tag_SNS_IM_","AddTime")},W="Gender_Type_",Hs={UNKNOWN:"".concat(W,"Unknown"),FEMALE:"".concat(W,"Female"),MALE:"".concat(W,"Male")},Ks={NONE:"".concat("AdminForbid_Type_","None"),SEND_OUT:"".concat("AdminForbid_Type_","SendOut")},Ys={NEED_CONFIRM:"".concat("AllowType_Type_","NeedConfirm"),ALLOW_ANY:"".concat("AllowType_Type_","AllowAny"),DENY_ANY:"".concat("AllowType_Type_","DenyAny")},Lt="JoinedSuccess",Ws="WaitAdminApproval",En="@TOPIC#_",ii=Object.prototype.hasOwnProperty;function k(e){if(e==null)return!0;if(typeof e=="boolean")return!1;if(typeof e=="number")return e===0;if(typeof e=="string"||typeof e=="function"||Array.isArray(e))return e.length===0;if(e instanceof Error)return e.message==="";if(Q(e)){for(var t in e)if(ii.call(e,t))return!1;return!0}return!!(js(e)||ri(e)||st(e))&&e.size===0}function js(e){return Ut(e)==="map"}function ri(e){return Ut(e)==="set"}function st(e){return Ut(e)==="file"}function Y(e){return e!==null&&(typeof e=="number"&&!isNaN(+e)||ut(e)==="object"&&e.constructor===Number)}function at(e){return e!==null&&ut(e)==="object"}function Q(e){if(ut(e)==="object"&&e!==null){if((e=Object.getPrototypeOf(e))===null)return 1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return e===t}}function O(e){return typeof Array.isArray=="function"?Array.isArray(e):Ut(e)==="array"}function Oo(e){return O(e)&&0<e.length}function Re(e){return typeof e=="function"}function Js(e){return Ut(e)==="filelist"}function zs(e){return typeof e=="string"&&(e=e[0],!/[^a-zA-Z0-9]/.test(e))}function et(e,t,n,o){if(!en(e)||!en(t))return 0;for(var s,a=0,i=Object.keys(t),r=0,c=i.length;r<c;r++)if(s=i[r],!(T(t[s])||n&&n.includes(s)))if(en(e[s])&&en(t[s]))a+=et(e[s],t[s],n,o);else{if(o&&o.includes(t[s]))continue;e[s]!==t[s]&&(e[s]=t[s],a+=1)}return a}function No(e,t){var n,o=new Map,s=Se(e.entries());try{for(s.s();!(n=s.n()).done;){var a=ke(n.value,2),i=a[0],r=a[1];r&&o.set(i,t?JSON.stringify(r):JSON.parse(JSON.stringify(r)))}}catch(c){s.e(c)}finally{s.f()}return o}function Ln(e){if(e.length===0)return 0;for(var t=0,n=0,o=typeof document<"u"&&document.characterSet!==void 0?document.characterSet:"UTF-8";e[t]!==void 0;)n+=e[t++].charCodeAt[t]<=255?1:o===!1?3:2;return n}function Je(e){return e=e||99999999,Math.round(Math.random()*e)}function Gt(e,t){for(var n in e)if(e[n]===t)return 1}function $t(e){return e.indexOf("http://")===-1||e.indexOf("https://")===-1?"https://"+e:e.replace(/https|http/,"https")}function Po(e){if(Object.getOwnPropertyNames(e).length===0)return Object.create(null);var t,n,o=Array.isArray(e)?[]:Object.create(null);for(n in e)e[n]!==null?e[n]!==void 0?(t=ut(e[n]),0<=["string","number","function","boolean"].indexOf(t)?o[n]=e[n]:o[n]=Po(e[n])):o[n]=void 0:o[n]=null;return o}var ci=["url"],V=function(e){return typeof e=="string"},T=function(e){return e===void 0},en=function(e){return O(e)||at(e)},ui=function(e){return e instanceof Error},Ut=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()},Xs=(Date.now||(Date.now=function(){return new Date().getTime()}),"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),li=Xs.length,Sn={};function tn(e,t){var n;return!(!O(e)||!O(t))&&(n=!1,t.forEach(function(a){var s=a.key,a=a.value,i=e.find(function(r){return r.key===s});i?i.value!==a&&(i.value=a,n=!0):(e.push({key:s,value:a}),n=!0)}),n)}function Go(e){return k(e)?[]:e.filter(function(t){return t.isModified===!0})}function Zs(e){if(Q(e)&&Q(e.webhookInfo)){var t=[];if(e.webhookInfo.disableCloudMessagePreHook&&t.push("ForbidBeforeSendMsgCallback"),e.webhookInfo.disableCloudMessagePostHook&&t.push("ForbidAfterSendMsgCallback"),t.length!==0)return t}}function Uo(e){return k(e)?[]:e.filter(function(t){return t.isModified===!1})}function be(e){return e===g.GRP_AVCHATROOM}function we(n){var t=n.type,n=n.groupID;return t===g.GRP_COMMUNITY||"".concat(n).startsWith("@TGS#_")&&!"".concat(n).includes(En)}function he(e){return"".concat(e).startsWith("@TGS#_")&&"".concat(e).includes(En)}function Oe(e){return V(e)&&e.slice(0,3)===g.CONV_C2C}function xe(e){return V(e)&&e.slice(0,5)===g.CONV_GROUP}function nn(e){return V(e)&&e===g.CONV_SYSTEM}function Qs(e,t){var n={};return Object.keys(e).forEach(function(o){n[o]=t(e[o],o)}),n}function bt(e){return He?Promise.resolve({width:0,height:0}):X?new Promise(function(t,n){te.getImageInfo({src:e,success:function(o){t({width:o.width,height:o.height})},fail:function(){t({width:0,height:0})}})}):Ro&&ni===9?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 $s(){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 ea(){var e=ko?"android":So?"ios":oi?"windows":si?"mac":"unknown";if(X)try{var t=te.getSystemInfoSync().platform;t!==void 0&&(e=t)}catch{}return e}function ta(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]),a=parseInt(t[o]);if(a<s)return 1;if(s<a)return-1}return 0}function bo(n){var t=n.originUrl,t=t===void 0?void 0:t,o=n.originWidth,s=n.originHeight,n=n.min,n=n===void 0?198:n,o=parseInt(o),s=parseInt(s),a={url:void 0,width:0,height:0};return(o<=s?o:s)<=n?(a.url=t,a.width=o,a.height=s):(s<=o?(a.width=Math.ceil(o*n/s),a.height=n):(a.width=n,a.height=Math.ceil(s*n/o)),s=t&&-1<t.indexOf("?")?"".concat(t,"&"):"".concat(t,"?"),a.url="".concat(s,n===198?"imageView2/3/w/198/h/198":"imageView2/3/w/720/h/720")),T(t)?Fe(a,ci):a}function na(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 wo(e){return e=e.servcmd,e.slice(e.indexOf(".")+1)}function nt(e,t){return Math.round(Number(e)*Math.pow(10,t))/Math.pow(10,t)}function oa(e,t){return e.includes(t)}function sa(e,t){return e.includes(t)}function _e(e){return e.split(En)[0]}function on(e,t,n){if(T(t))return"";switch(e){case g.MSG_TEXT:return t.text;case g.MSG_IMAGE:return n?"[Image]":"[图片]";case g.MSG_LOCATION:return n?"[Location]":"[位置]";case g.MSG_AUDIO:return n?"[Voice]":"[语音]";case g.MSG_VIDEO:return n?"[Video]":"[视频]";case g.MSG_FILE:return n?"[File]":"[文件]";case g.MSG_CUSTOM:return n?"[Custom Messages]":"[自定义消息]";case g.MSG_GRP_TIP:return n?"[Group Notification]":"[群提示消息]";case g.MSG_GRP_SYS_NOTICE:return n?"[Group System Message]":"[群系统通知]";case g.MSG_FACE:return n?"[Animated Sticker]":"[动画表情]";case g.MSG_MERGER:return n?"[Chat Record]":"[聊天记录]";default:return""}}function aa(e){return e===g.MSG_TEXT||e===g.MSG_CUSTOM||e===g.MSG_LOCATION||e===g.MSG_FACE}function kn(e){var t=[];if(V(e)){var n=e.length;if(n!==0)for(var o=n-1;0<=o;o--)e[o]==="1"&&t.push(Math.pow(2,n-o-1))}return t}function Fo(){return!Ro&&!X}function St(e){return"the length of userIDList cannot exceed ".concat(e)}function ia(e){var t;if(O(e)&&e.length!==0)return t=0,e.forEach(function(n){t+=n}),t.toFixed(0)}function ra(e){var t;if(O(e)&&e.length!==0)return t=0,e.forEach(function(n){t+=n}),(t/e.length).toFixed(0)}function ye(e,o,s){var o=!(1<arguments.length&&o!==void 0)||o,s=!(2<arguments.length&&s!==void 0)||s,a=Date.now();return o?s?"".concat(a-e," ms"):"".concat(Math.round((a-e)/1e3)," s"):s?a-e:Math.round((a-e)/1e3)}function ca(e){return!!(e&&1<e)}function ua(e,t,n,o){var s,a,i;return t===void 0||(s=!0,t.required&&k(e)&&(d.e("[".concat(n,'] Missing required params: "').concat(o,'".')),s=!1),k(e)||(a=Ut(e))===(i=t.type.toLowerCase())||a==="asyncfunction"&&i==="function"||(d.e("[".concat(n,'] Invalid params: type check failed for "').concat(o,'". Expected ').concat(t.type,".")),s=!1),t.validator&&!t.validator(e,n,o)&&(d.e("[".concat(n,'] Invalid params: custom validator check failed for "').concat(o,'".')),s=!1),s)}function mt(e){return!(!e||!(Oe(e)||xe(e)||nn(e))&&((e=Z("InvalidConversationID",e))&&d.w(e),1))}function R(e){e.desc!==""&&Z("API_REFER")!==""&&d.w("[".concat(e.api,"] | ").concat(e.paramName," | ").concat(e.desc,", ").concat(Z("API_REFER")).concat(e.api))}function ze(){return Z("StringRequiredLog")}function wt(e){return Z("NonEmptyStringRequiredLog",e)}function Ft(){return Z("NumberRequiredLog")}function sn(){return Z("UndefinedNotAllowedLog")}function qo(){return Z("FileRequiredLog")}function dt(){return Z("FunctionRequiredLog")}function Ke(){return Z("ArrayRequiredLog")}function vt(){return Z("NonEmptyArrayLog")}function Rn(){return Z("CallbackMissingLog")}function la(){return Z("PositiveIntegerRequiredLog")}function kt(e,t){return Z("StringNotLongerThanLog",e,t)}function da(e,t){return Z("NumberGreaterThanLog",e,t)}function pa(e,t){return Z("NumberGreaterOrEqualLog",e,t)}function An(e){return Z("KeyValueStringRequiredLog",e)}function ot(){return Z("PlainObjectRequiredLog")}function _a(){return Z("NonEmptyContentRequiredLog")}function qt(){return Z("FileNotSelectedLog")}function On(){return Z("MessageInstanceRequiredLog")}function an(){return Z("NonAnonymousFunctionLog")}function xo(){return Z("MessageExtensionNotAvailableLog")}function Vo(){return Z("MessageReactionRequiredLog")}function ga(e,t){return Z("ContainsUnsupportedTypeLog",e,t)}function xt(e,t,n,i){var s=i.allowUndefined,a=i.allowEmpty,i=i.maxLength;return T(e)?!!s||(R({api:t,paramName:n,desc:sn()}),!1):O(e)?!(e.length===0&&(R({api:t,paramName:n,desc:vt()}),!a)||i&&e.length>i&&(R({api:t,paramName:n,desc:Z("MaximumArrayLengthLog",n,i)}),1)):(R({api:t,paramName:n,desc:Ke()}),!1)}function rn(e,t,n,i){var s=i.allowUndefined,a=i.min,i=i.max;return T(e)?!!s||(R({api:t,paramName:n,desc:sn()}),!1):Y(e)?Y(a)&&e<a?(R({api:t,paramName:n,desc:a===0?pa(n,a):da(n,a-1)}),!1):!(Y(i)&&i<e&&(R({api:t,paramName:n,desc:Z("MaximumNumberLog",n,i)}),1)):(R({api:t,paramName:n,desc:Ft()}),!1)}function N(e){return{code:0,data:e||{}}}function q(e){return Promise.resolve(N(e))}function v(e){var t,n=1<arguments.length&&arguments[1]!==void 0&&arguments[1];return e instanceof ie?(n&&Rt!==null&&Rt.emit(F.ERROR,e),Promise.reject(e)):e instanceof Error?(t=new ie({code:y.UNCAUGHT_ERROR}),n&&Rt!==null&&Rt.emit(F.ERROR,t),Promise.reject(t)):T(e)||T(e.code)?Promise.reject(new ie({code:y.UNCAUGHT_ERROR})):(t=new ie(e),n&&Rt!==null&&Rt.emit(F.ERROR,t),Promise.reject(t))}var Nn="unSend",je="success",Bo="fail",pt="notStart",ha="pending",cn="resolved",Vt="rejected",A={type:"String",required:!0},K={type:"Array",required:!0},W={type:"Object",required:!0},Nt={type:"Boolean",required:!0},ce={type:"number",required:!0},ve={keywordListForMsg:{type:"Array",required:!1,validator:function(e,t,n){return xt(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},keywordListExceptMsg:{type:"Array",required:!0,validator:function(e,t,n){return xt(e,t,n,{allowUndefined:!1,allowEmpty:!1,maxLength:5})}},keywordListMatchType:{type:"String",required:!1,validator:function(e,t,n){return!e||e==="or"||e==="and"||R({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}},cursor:{type:"String",required:!1},count:{type:"Number",required:!1,validator:function(e,t,n){return rn(e,t,n,{allowUndefined:!0,min:1,max:100})}},groupTypeList:{type:"Array",required:!1,validator:function(e,t,n){var o;return!e||!(!xt(e,t,n,{allowUndefined:!0,allowEmpty:!0})||(o=[g.GRP_PUBLIC,g.GRP_COMMUNITY,g.GRP_WORK,g.GRP_MEETING],0<e.filter(function(s){return o.indexOf(s)===-1}).length&&(R({api:t,paramName:n,desc:ga(n,"group")}),1)))}}},Z=null,fa={hookGetAPITips:function(e){Z=e},login:{userID:A,userSig:A},addToBlacklist:{userIDList:K},removeFromBlacklist:{userIDList:K},on:[{name:"eventName",type:"String",validator:function(e,t,n){return typeof e=="string"&&e.length!==0||(R({api:t,paramName:n,desc:wt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return typeof e!="function"?(R({api:t,paramName:n,desc:dt()}),!1):(e.name===""&&R({api:t,paramName:n,desc:an()}),!0)}}],once:[{name:"eventName",type:"String",validator:function(e,t,n){return typeof e=="string"&&e.length!==0||(R({api:t,paramName:n,desc:wt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return typeof e!="function"?(R({api:t,paramName:n,desc:dt()}),!1):(e.name===""&&R({api:t,paramName:n,desc:an()}),!0)}}],off:[{name:"eventName",type:"String",validator:function(e,t,n){return typeof e=="string"&&e.length!==0||(R({api:t,paramName:n,desc:wt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return typeof e!="function"?(R({api:t,paramName:n,desc:dt()}),!1):(e.name===""&&R({api:t,paramName:n,desc:an()}),!0)}}],sendMessage:[p({name:"message"},W)],setMessageExtensions:[p(p({name:"message"},W),{},{validator:function(e,t,n){return e.status===je&&e.isSupportExtension===!0||(R({api:t,paramName:n,desc:xo()}),!1)}}),p({name:"extensions"},K)],getMessageExtensions:[p(p({name:"message"},W),{},{validator:function(e,t,n){return e.status===je&&e.isSupportExtension===!0||(R({api:t,paramName:n,desc:xo()}),!1)}})],deleteMessageExtensions:[p(p({name:"message"},W),{},{validator:function(e,t,n){return e.status===je&&e.isSupportExtension===!0||(R({api:t,paramName:n,desc:xo()}),!1)}})],addMessageReaction:[p(p({name:"message"},W),{},{validator:function(e,t,n){return e.status===je||(R({api:t,paramName:n,desc:Vo()}),!1)}}),p({name:"reactionID"},A)],removeMessageReaction:[p(p({name:"message"},W),{},{validator:function(e,t,n){return e.status===je||(R({api:t,paramName:n,desc:Vo()}),!1)}}),p({name:"reactionID"},A)],getMessageReactions:{messageList:p({},K)},getAllUserListOfMessageReaction:{message:p(p({},W),{},{validator:function(e,t,n){return e.status===je||(R({api:t,paramName:n,desc:Vo()}),!1)}}),reactionID:p({},A),nextSeq:{type:"Number"},count:{type:"Number"}},getMessageList:{conversationID:p(p({},A),{},{validator:mt}),nextReqMessageID:{type:"String"},count:{type:"Number",validator:function(e,t,n){return!(!T(e)&&!/^[1-9][0-9]*$/.test(e)&&(R({api:t,paramName:n,desc:la()}),1))}}},getMessageListHopping:{conversationID:p(p({},A),{},{validator:mt}),sequence:{type:"Number"},time:{type:"Number"},direction:{type:"Number",validator:function(e,t,n){return!(!T(e)&&e!==0&&e!==1&&(R({api:t,paramName:n,desc:Z("0Or1RequiredLog")}),1))}},count:{type:"Number",validator:function(e,t,n){return!(!T(e)&&!/^[1-9][0-9]*$/.test(e)&&(R({api:t,paramName:n,desc:la}),1))}}},setMessageRead:{conversationID:p(p({},A),{},{validator:mt})},setAllMessageRead:{scope:{type:"String",required:!1,validator:function(e,t,n){return!e||[g.READ_ALL_C2C_MSG,g.READ_ALL_GROUP_MSG,g.READ_ALL_MSG].indexOf(e)!==-1||(R({api:t,paramName:n,desc:Z("ValidScopeRequired")}),!1)}}},getConversationProfile:[p(p({name:"conversationID"},A),{},{validator:mt})],clearHistoryMessage:[p(p({name:"conversationID"},A),{},{validator:mt})],pinConversation:{conversationID:p(p({},A),{},{validator:mt}),isPinned:p({},Nt)},setConversationDraft:{conversationID:p(p({},A),{},{validator:mt}),draftText:{type:"String",validator:function(e,t,n){return!!V(e)||(R({api:t,paramName:n,desc:ze()}),!1)}}},setConversationCustomData:{conversationIDList:p({},K),customData:{type:"String",validator:function(e,t,n){return V(e)?!(256<e.length&&(R({api:t,paramName:n,desc:kt(n,256)}),1)):(R({api:t,paramName:n,desc:ze()}),!1)}}},markConversation:{conversationIDList:p({},K),markType:{type:"number",validator:function(e,t,n){return Y(e)?e<=0?(R({api:t,paramName:n,desc:da(n,0)}),!1):!(e>=Math.pow(2,64)&&(R({api:t,paramName:n,desc:Z("NumberLessThanLog",n,"Math.pow(2,64)")}),1)):(R({api:t,paramName:n,desc:Ft()}),!1)}},enableMark:p({},Nt)},createConversationGroup:{conversationIDList:p({},K),groupName:p(p({},A),{},{validator:function(e,t,n){return!(!e||32<e.length&&(R({api:t,paramName:n,desc:kt(n,32)}),1))}})},deleteConversationGroup:[p({name:"groupName"},A)],renameConversationGroup:{oldName:p({},A),newName:p(p({},A),{},{validator:function(e,t,n){return!(!e||32<e.length&&(R({api:t,paramName:n,desc:kt(n,32)}),1))}})},addConversationsToGroup:{conversationIDList:p({},K),groupName:p({},A)},deleteConversationsFromGroup:{conversationIDList:p({},K),groupName:p({},A)},getGroupList:{groupProfileFilter:{type:"Array"}},getGroupProfile:{groupID:A,groupCustomFieldFilter:{type:"Array"},memberCustomFieldFilter:{type:"Array"}},getGroupProfileAdvance:{groupIDList:K},createGroup:{name:A},joinGroup:{groupID:A,type:{type:"String"},applyMessage:{type:"String"}},quitGroup:[p({name:"groupID"},A)],pinGroupMessage:{groupID:A,message:W,isPinned:Nt},getPinnedGroupMessageList:[p({name:"groupID"},A)],handleApplication:{message:W,handleAction:A,handleMessage:{type:"String"}},changeGroupOwner:{groupID:A,newOwnerID:A},updateGroupProfile:{groupID:A,muteAllMembers:{type:"Boolean"}},dismissGroup:[p({name:"groupID"},A)],searchGroupByID:[p({name:"groupID"},A)],getGroupOnlineMemberCount:[p({name:"groupID"},A)],initGroupAttributes:{groupID:A,groupAttributes:p(p({},W),{},{validator:function(e,t,n){var o=!0;return Object.keys(e).forEach(function(s){if(!V(e[s]))return R({api:t,paramName:n,desc:An("value")}),o=!1}),o}})},setGroupAttributes:{groupID:A,groupAttributes:p(p({},W),{},{validator:function(e,t,n){var o=!0;return Object.keys(e).forEach(function(s){if(!V(e[s]))return R({api:t,paramName:n,desc:An("value")}),o=!1}),o}})},deleteGroupAttributes:{groupID:A,keyList:{type:"Array",validator:function(e,t,n){var o;return T(e)||!O(e)?(R({api:t,paramName:n,desc:Ke()}),!1):!!k(e)||(o=!0,e.forEach(function(s){if(!V(s))return R({api:t,paramName:n,desc:Z("StringArrayRequiredLog")}),o=!1}),o)}}},getGroupAttributes:{groupID:A,keyList:{type:"Array",validator:function(e,t,n){var o;return T(e)||!O(e)?(R({api:t,paramName:n,desc:Ke()}),!1):!!k(e)||(o=!0,e.forEach(function(s){if(!V(s))return R({api:t,paramName:n,desc:An("key")}),o=!1}),o)}}},setGroupCounters:{groupID:A,counters:W},increaseGroupCounter:{groupID:A,key:A,value:ce},decreaseGroupCounter:{groupID:A,key:A,value:ce},getGroupCounters:{groupID:A},getGroupMemberList:{groupID:A,count:{type:"Number"}},getGroupMemberProfile:{groupID:A,userIDList:K,memberCustomFieldFilter:{type:"Array"}},addGroupMember:{groupID:A,userIDList:K},setGroupMemberRole:{groupID:A,userID:A,role:A},setGroupMemberMuteTime:{groupID:A,userID:A,muteTime:{type:"Number",validator:function(e){return 0<=e}}},setGroupMemberNameCard:{groupID:A,userID:{type:"String"},nameCard:{type:"String",validator:function(e,t,n){return V(e)?(e.length,!0):(R({api:t,paramName:n,desc:ze()}),!1)}}},setGroupMemberCustomField:{groupID:A,userID:{type:"String"},memberCustomField:K},deleteGroupMember:{groupID:A},markGroupMemberList:{groupID:A,markType:{type:"number",validator:function(e,t,n){return Y(e)?!(e<1e3&&(R({api:t,paramName:n,desc:pa(n,1e3)}),1)):(R({api:t,paramName:n,desc:Ft()}),!1)}},userIDList:p({},K),enableMark:p({},Nt)},createTextMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return Q(e)?V(e.text)?e.text.length!==0||(R({api:t,paramName:"payload.text",desc:_a()}),!1):(R({api:t,paramName:"payload.text",desc:ze()}),!1):(R({api:t,paramName:n,desc:ot()}),!1)}})},createTextAtMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return Q(e)?V(e.text)?e.text.length===0?(R({api:t,paramName:"payload.text",desc:_a()}),!1):!(e.atUserList&&!O(e.atUserList)&&(R({api:t,paramName:"payload.atUserList",desc:Ke()}),1)):(R({api:t,paramName:"payload.text",desc:ze()}),!1):(R({api:t,paramName:n,desc:ot()}),!1)}})},createCustomMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return Q(e)?e.data&&!V(e.data)?(R({api:t,paramName:"payload.data",desc:ze()}),!1):e.description&&!V(e.description)?(R({api:t,paramName:"payload.description",desc:ze()}),!1):!(e.extension&&!V(e.extension)&&(R({api:t,paramName:"payload.extension",desc:ze()}),1)):(R({api:t,paramName:"payload",desc:ot()}),!1)}})},createImageMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){if(!Q(e))return R({api:t,paramName:n,desc:ot()}),!1;if(T(e.file))return R({api:t,paramName:"payload.file",desc:sn()}),!1;if(Ae){if(!(e.file instanceof HTMLInputElement||st(e.file)))return Q(e.file)&&typeof uni<"u"?e.file.tempFilePaths.length!==0&&e.file.tempFiles.length!==0||(R({api:t,paramName:"payload.file",desc:qt()}),!1):(R({api:t,paramName:"payload.file",desc:qo()}),!1);if(e.file instanceof HTMLInputElement&&e.file.files.length===0)return R({api:t,paramName:"payload.file",desc:qt()}),!1}return!0},onProgress:{type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:Rn()}),!0}}})},createAudioMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return!!Q(e)||(R({api:t,paramName:n,desc:ot()}),!1)}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:Rn()}),!0}}},createVideoMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){if(!Q(e))return R({api:t,paramName:n,desc:ot()}),!1;if(T(e.file))return R({api:t,paramName:"payload.file",desc:sn()}),!1;if(Ae){if(!(e.file instanceof HTMLInputElement||st(e.file)))return Q(e.file)&&typeof uni<"u"?!!st(e.file.tempFile)||(R({api:t,paramName:"payload.file",desc:qt()}),!1):(R({api:t,paramName:"payload.file",desc:qo()}),!1);if(e.file instanceof HTMLInputElement&&e.file.files.length===0)return R({api:t,paramName:"payload.file",desc:qt()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:Rn()}),!0}}},createFaceMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return Q(e)?Y(e.index)?!!V(e.data)||(R({api:t,paramName:"payload.data",desc:ze()}),!1):(R({api:t,paramName:"payload.index",desc:Ft()}),!1):(R({api:t,paramName:n,desc:ot()}),!1)}})},createFileMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){if(!Q(e))return R({api:t,paramName:n,desc:ot()}),!1;if(T(e.file))return R({api:t,paramName:"payload.file",desc:sn()}),!1;if(Ae){if(!(e.file instanceof HTMLInputElement||st(e.file)))return Q(e.file)&&typeof uni<"u"?e.file.tempFilePaths.length!==0&&e.file.tempFiles.length!==0||(R({api:t,paramName:"payload.file",desc:qt()}),!1):(R({api:t,paramName:"payload.file",desc:qo()}),!1);if(e.file instanceof HTMLInputElement&&e.file.files.length===0)return R({api:t,paramName:"payload.file",desc:qt()}),!1}return!0}}),onProgress:{type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:Rn()}),!0}}},createLocationMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){return Q(e)?V(e.description)?Y(e.longitude)?!!Y(e.latitude)||(R({api:t,paramName:"payload.latitude",desc:Ft()}),!1):(R({api:t,paramName:"payload.longitude",desc:Ft()}),!1):(R({api:t,paramName:"payload.description",desc:ze()}),!1):(R({api:t,paramName:n,desc:ot()}),!1)}})},createMergerMessage:{to:A,conversationType:A,payload:p(p({},W),{},{validator:function(e,t,n){var o;return k(e.messageList)?(R({api:t,paramName:"payload.messageList",desc:vt()}),!1):k(e.compatibleText)?(R({api:t,paramName:"payload.compatibleText",desc:wt("compatibleText")}),!1):(o=!1,e.messageList.forEach(function(s){s.status===Bo&&(o=!0)}),!o||(R({api:t,paramName:"payload.messageList",desc:Z("MergeFailedMessageLog")}),!1))}})},revokeMessage:[p(p({name:"message"},W),{},{validator:function(e,t,n){return k(e)?(R({api:t,paramName:n,desc:On()}),!1):e.conversationType===g.CONV_SYSTEM?(R({api:t,paramName:n,desc:Z("MessageCanBeRevokedDesc")}),!1):e.isRevoked!==!0||(R({api:t,paramName:n,desc:Z("MessageRevokedLog")}),!1)}})],deleteMessage:[p(p({name:"messageList"},K),{},{validator:function(e,t,n){return!k(e)||(R({api:t,paramName:n,desc:vt()}),!1)}})],translateText:{sourceTextList:K,sourceLanguage:A,targetLanguage:A},convertVoiceToText:{message:p(p({},W),{},{validator:function(e,t,n){return k(e)?(R({api:t,paramName:n,desc:On()}),!1):e.type===g.MSG_AUDIO&&e.status===je||(R({api:t,paramName:n,desc:Z("AudioMessageRequiredLog")}),!1)}})},modifyMessage:[p(p({name:"message"},W),{},{validator:function(e,t,n){return k(e)?(R({api:t,paramName:n,desc:On()}),!1):e.conversationType===g.CONV_SYSTEM?(R({api:t,paramName:n,desc:Z("MessageCanBeModifiedLog")}),!1):e._onlineOnlyFlag!==!0||(R({api:t,paramName:n,desc:Z("OnlineMessageNotSupportLog")}),!1)}})],searchCloudMessages:{keywordList:ve.keywordListForMsg,keywordListMatchType:ve.keywordListMatchType,cursor:ve.cursor,senderUserIDList:{type:"Array",required:!1,validator:function(e,t,n){return xt(e,t,n,{allowUndefined:!0,allowEmpty:!0,maxLength:5})}},messageTypeList:{type:"Array",required:!1,validator:function(e,t,n){var o;return!e||!(!xt(e,t,n,{allowUndefined:!0,allowEmpty:!0})||(o=[g.MSG_TEXT,g.MSG_IMAGE,g.MSG_AUDIO,g.MSG_FILE,g.MSG_VIDEO,g.MSG_LOCATION,g.MSG_CUSTOM,g.MSG_MERGER],0<e.filter(function(s){return o.indexOf(s)===-1}).length&&(R({api:t,paramName:n,desc:ga(n,"message")}),1)))}},conversationID:{type:"String",required:!1,validator:function(e){return!e||mt(e)}},timePosition:{type:"number",required:!1,validator:function(e,t,n){return rn(e,t,n,{allowUndefined:!0,min:0})}},timePeriod:{type:"number",required:!1,validator:function(e,t,n){return rn(e,t,n,{allowUndefined:!0,min:0})}}},searchCloudUsers:{keywordList:ve.keywordListExceptMsg,keywordListMatchType:ve.keywordListMatchType,cursor:ve.cursor,count:ve.count,miniBirthday:{type:"Number",required:!1,validator:function(e,t,n){return rn(e,t,n,{allowUndefined:!0,min:0})}},maxBirthday:{type:"Number",required:!1,validator:function(e,t,n){return rn(e,t,n,{allowUndefined:!0,min:0})}},gender:{type:"String",required:!1,validator:function(e,t,n){return!e||e===g.GENDER_FEMALE||e===g.GENDER_MALE||R({api:t,paramName:n,desc:"".concat(e," is invalid match type")})}}},searchCloudGroups:{keywordList:ve.keywordListExceptMsg,keywordListMatchType:ve.keywordListMatchType,cursor:ve.cursor,count:ve.count,groupTypeList:ve.groupTypeList},searchCloudGroupMembers:{keywordList:ve.keywordListExceptMsg,keywordListMatchType:ve.keywordListMatchType,cursor:ve.cursor,count:ve.count,groupTypeList:ve.groupTypeList,groupIDList:{type:"Array",required:!1,validator:function(e,t,n){return xt(e,t,n,{allowUndefined:!0,allowEmpty:!0})}}},getUserProfile:{userIDList:{type:"Array",validator:function(e,t,n){return O(e)?(e.length===0&&R({api:t,paramName:n,desc:vt()}),!0):(R({api:t,paramName:n,desc:Ke()}),!1)}}},updateMyProfile:{profileCustomField:{type:"Array",validator:function(e,t,n){return!!T(e)||!!O(e)||(R({api:t,paramName:n,desc:Ke()}),!1)}}},setSelfStatus:{customStatus:{type:"String",validator:function(e,t,n){return!!V(e)||(R({api:t,paramName:n,desc:ze()}),!1)}}},getUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return O(e)?e.length!==0||(R({api:t,paramName:n,desc:vt()}),!1):(R({api:t,paramName:n,desc:Ke()}),!1)}}},subscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return O(e)?e.length!==0||(R({api:t,paramName:n,desc:vt()}),!1):(R({api:t,paramName:n,desc:Ke()}),!1)}}},unsubscribeUserStatus:{userIDList:{type:"Array",validator:function(e,t,n){return!e||!!O(e)||(R({api:t,paramName:n,desc:Ke()}),!1)}}},addFriend:{to:A,source:{type:"String",required:!0,validator:function(e,t,n){return!(!e||(e.startsWith("AddSource_Type_")?8<e.replace("AddSource_Type_","").length&&(R({api:t,paramName:n,desc:kt("keyword",8)}),1):(R({api:t,paramName:n,desc:Z("SourcePrefixLog")}),1)))}},remark:{type:"String",required:!1,validator:function(e,t,n){return!(V(e)&&96<e.length&&(R({api:t,paramName:n,desc:kt(n,96)}),1))}}},deleteFriend:{userIDList:K},checkFriend:{userIDList:K},getFriendProfile:{userIDList:K},updateFriend:{userID:A,remark:{type:"String",required:!1,validator:function(e,t,n){return!(V(e)&&96<e.length&&(R({api:t,paramName:n,desc:kt(n,96)}),1))}},friendCustomField:{type:"Array",required:!1,validator:function(e,t,n){var o;return!e||(O(e)?(o=!0,e.forEach(function(s){return V(s.key)&&s.key.indexOf("Tag_SNS_Custom")!==-1?V(s.value)?8<s.key.replace("Tag_SNS_Custom_","").length?(R({api:t,paramName:n,desc:kt("keyword",8)}),o=!1):void 0:(R({api:t,paramName:n,desc:An("value")}),o=!1):(R({api:t,paramName:n,desc:Z("FriendCustomFieldPrefixLog")}),o=!1)}),o):(R({api:t,paramName:n,desc:Ke()}),!1))}}},acceptFriendApplication:{userID:A},refuseFriendApplication:{userID:A},deleteFriendApplication:{userID:A},createFriendGroup:{name:A},deleteFriendGroup:{name:A},addToFriendGroup:{name:A,userIDList:K},removeFromFriendGroup:{name:A,userIDList:K},renameFriendGroup:{oldName:A,newName:A},sendMessageReadReceipt:[{name:"messageList",type:"Array",validator:function(e,t,n){return O(e)?e.length!==0||(R({api:t,paramName:n,desc:vt()}),!1):(R({api:t,paramName:n,desc:Ke()}),!1)}}],getMessageReadReceiptList:[{name:"messageList",type:"Array",validator:function(e,t,n){return O(e)?e.length!==0||(R({api:t,paramName:n,desc:vt()}),!1):(R({api:t,paramName:n,desc:Ke()}),!1)}}],createTopicInCommunity:{groupID:A,topicName:A},deleteTopicFromCommunity:{groupID:A,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!O(e)||(R({api:t,paramName:n,desc:Ke()}),!1)}}},updateTopicProfile:{groupID:A,topicID:A},getTopicList:{groupID:A,topicIDList:{type:"Array",validator:function(e,t,n){return!e||!!O(e)||(R({api:t,paramName:n,desc:Ke()}),!1)}}},followUser:[p({name:"userIDList"},K)],unfollowUser:[p({name:"userIDList"},K)],getMyFollowingList:[p(p({name:"startIndex"},A),{},{required:!1})],getMyFollowersList:[p(p({name:"startIndex"},A),{},{required:!1})],getMutualFollowersList:[p(p({name:"startIndex"},A),{},{required:!1})],getUserFollowInfo:[p(p({name:"userIDList"},K),{},{required:!1})],checkFollowType:[p({name:"userIDList"},K)],addSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return typeof e=="string"&&e.length!==0||(R({api:t,paramName:n,desc:wt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return typeof e!="function"?(R({api:t,paramName:n,desc:dt()}),!1):(e.name===""&&R({api:t,paramName:n,desc:an()}),!0)}}],removeSignalingListener:[{name:"eventName",type:"String",validator:function(e,t,n){return typeof e=="string"&&e.length!==0||(R({api:t,paramName:n,desc:wt(n)}),!1)}},{name:"handler",type:"Function",validator:function(e,t,n){return typeof e!="function"?(R({api:t,paramName:n,desc:dt()}),!1):(e.name===""&&R({api:t,paramName:n,desc:an()}),!0)}}],invite:{userID:A},inviteSync:[p(p({},W),{},{validator:function(e,t,n){return Q(e)?!!V(e.userID)||(R({api:t,paramName:"options.userID",desc:ze()}),!1):(R({api:t,paramName:"options",desc:ot()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:dt()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:dt()}),!0}}],inviteInGroup:{groupID:A,inviteeList:K},inviteInGroupSync:[p(p({},W),{},{validator:function(e,t,n){return Q(e)?V(e.groupID)?!!O(e.inviteeList)||(R({api:t,paramName:"options.inviteeList",desc:Ke()}),!1):(R({api:t,paramName:"options.groupID",desc:ze()}),!1):(R({api:t,paramName:"options",desc:ot()}),!1)}}),{name:"successCb",type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:dt()}),!0}},{name:"errorCb",type:"Function",required:!1,validator:function(e,t,n){return T(e)&&R({api:t,paramName:n,desc:dt()}),!0}}],accept:{inviteID:A},reject:{inviteID:A},getSignalingInfo:[p(p({name:"message"},W),{},{validator:function(e,t,n){return!k(e)||(R({api:t,paramName:n,desc:On()}),!1)}})],modifyInvitation:{inviteID:A,data:A}},di={login:1,logout:1,getLoginUser:1,getServerTime:1,on:1,once:1,off:1,setLogLevel:1,registerPlugin:1,destroy:1,isReady:1,createTextMessage:1,createTextAtMessage:1,createImageMessage:1,createAudioMessage:1,createVideoMessage:1,createCustomMessage:1,createFaceMessage:1,createFileMessage:1,createLocationMessage:1,createMergerMessage:1,downloadMergerMessage:1,createForwardMessage:1,sendMessage:1,resendMessage:1,revokeMessage:1,deleteMessage:1,translateText:1,convertVoiceToText:1,modifyMessage:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageReadReceiptList:1,setMessageExtensions:1,getMessageExtensions:1,deleteMessageExtensions:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1,getMessageList:1,findMessage:1,getMessageListHopping:1,setMessageRead:1,setAllMessageRead:1,getConversationList:1,getConversationProfile:1,deleteConversation:1,setConversationDraft:1,pinConversation:1,getTotalUnreadMessageCount:1,setConversationCustomData:1,markConversation:1,createConversationGroup:1,getConversationGroupList:1,deleteConversationGroup:1,renameConversationGroup:1,addConversationsToGroup:1,deleteConversationsFromGroup:1,clearHistoryMessage:1,setMessageRemindType:1,setAllReceiveMessageOpt:1,getAllReceiveMessageOpt:1,getGroupList:1,getGroupProfile:1,createGroup:1,joinGroup:1,updateGroupProfile:1,quitGroup:1,dismissGroup:1,changeGroupOwner:1,searchGroupByID:1,getGroupApplicationList:1,handleGroupApplication:1,pinGroupMessage:1,getPinnedGroupMessageList:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getJoinedCommunityList:1,createTopicInCommunity:1,deleteTopicFromCommunity:1,updateTopicProfile:1,getTopicList:1,getGroupMemberProfile:1,getGroupMemberList:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberNameCard:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberCustomField:1,getGroupOnlineMemberCount:1,markGroupMemberList:1,getMyProfile:1,getUserProfile:1,updateMyProfile:1,setSelfStatus:1,getUserStatus:1,subscribeUserStatus:1,unsubscribeUserStatus:1,getBlacklist:1,addToBlacklist:1,removeFromBlacklist:1,searchCloudMessages:1,searchCloudUsers:1,searchCloudGroups:1,searchCloudGroupMembers:1,getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,updateFriend:1,getFriendProfile:1,getFriendApplicationList:1,refuseFriendApplication:1,deleteFriendApplication:1,acceptFriendApplication:1,setFriendApplicationRead:1,getFriendGroupList:1,createFriendGroup:1,renameFriendGroup:1,deleteFriendGroup:1,addToFriendGroup:1,removeFromFriendGroup:1,followUser:1,unfollowUser:1,getMyFollowingList:1,getMyFollowersList:1,getMutualFollowersList:1,getUserFollowInfo:1,checkFollowType:1,callExperimentalAPI:1,addSignalingListener:1,removeSignalingListener:1,invite:1,inviteSync:1,inviteInGroup:1,inviteInGroupSync:1,cancel:1,accept:1,reject:1,getSignalingInfo:1,modifyInvitation:1},ie=(de(Gn,Qa(Error)),b(Gn)),y={NO_SDKAPPID:2e3,NO_ACCOUNT_TYPE:2001,NO_IDENTIFIER:2002,NO_USERSIG:2003,NO_TINYID:2022,NO_A2KEY:2023,USER_NOT_LOGGED_IN:2024,REPEAT_LOGIN:2025,COS_UNDETECTED:2040,COS_GET_SIG_FAIL:2041,MSG_SEND_FAIL:2100,MSG_SEND_FAIL_NOT_IN_AV:2101,MSG_INSTANCE_REQUIRED:2105,MSG_INVALID_CONV_TYPE:2106,MSG_F_IS_EMPTY:2108,MSG_ONPROGRESS_ERR:2109,MSG_REVOKE_FAIL:2110,MSG_DELETE_FAIL:2111,MSG_UNREAD_ALL_FAIL:2112,READ_RECEIPT_MSG_LIST_EMPTY:2114,MSG_SEND_GRP_WITH_TOPIC_FAIL:2115,CANNOT_DELETE_GRP_SYSTEM_NOTICE:2116,TRANSLATE_TEXT_FAIL:2117,VOICE_TO_TEXT_FAIL:2118,UNSUPPORTED_VOICE_FORMAT:2119,MSG_I_SELECT_F_FIRST:2251,MSG_I_TYPES_LIMIT:2252,MSG_I_SIZE_LIMIT:2253,MSG_A_UPLOAD_FAIL:2300,MSG_A_SIZE_LIMIT:2301,MSG_V_UPLOAD_FAIL:2350,MSG_V_SIZE_LIMIT:2351,MSG_V_TYPES_LIMIT:2352,MSG_F_UPLOAD_FAIL:2400,MSG_F_SELECT_F_FIRST:2401,MSG_F_SIZE_LIMIT:2402,MSG_F_URL_IS_EMPTY:2403,MSG_MERGER_TYPE_INVALID:2450,MSG_MERGER_KEY_INVALID:2451,MSG_MERGER_DOWNLOAD_FAIL:2452,MSG_FORWARD_TYPE_INVALID:2453,MSG_FORWARD_INVALID_ELEMENTS:2454,MSG_MODIFY_CONFLICT:2480,MSG_MODIFY_DISABLED_IN_AV:2481,CONV_NOT_FOUND:2500,USER_OR_GRP_NOT_FOUND:2501,CONV_UN_RECORDED_TYPE:2502,INVALID_CONV_ID:2503,ILLEGAL_GRP_TYPE:2600,ILLEGAL_GRP_ID:2602,CANNOT_FIND_GRP:2603,CANNOT_CHANGE_OWNER_IN_AV:2620,CANNOT_CHANGE_OWNER_TO_SELF:2621,MEMBER_NOT_IN_GRP:2623,JOIN_GRP_FAIL:2660,CANNOT_ADD_MEMBER_IN_AV:2661,CANNOT_JOIN_NON_AV_WITHOUT_LOGIN:2662,NOT_OWNER:2681,INVALID_MEMBER_ROLE:2683,CANNOT_SET_SELF_MEMBER_ROLE:2684,CANNOT_MUTE_SELF:2685,BAN_DURATION_INVALID:2686,OPERATION_NOT_SUPPORTED_IN_AV:2687,NOT_MY_FRIEND:2700,ALREADY_MY_FRIEND:2701,FRIEND_GRP_EXISTED:2710,FRIEND_GRP_NOT_EXIST:2711,FRIEND_APPLICATION_NOT_EXIST:2716,UPDATE_PROFILE_INVALID_PARAM:2721,UPDATE_PROFILE_NO_KEY:2722,CANNOT_ADD_SELF_TO_BLACKLIST:2742,NETWORK_ERROR:2800,NETWORK_TIMEOUT:2801,NO_NETWORK:2805,UNCAUGHT_ERROR:2903,INVALID_OPERATION:2905,INVALID_TRTC_CMD:2995,OVER_FREQUENCY_LIMIT:2996,NO_PROTOCOL:2997,NO_MODULE:2998,SDK_IS_NOT_READY:2999,LOGGING_IN:3e3,LOGIN_FAILED:3001,KICKED_OUT_MULT_DEVICE:3002,KICKED_OUT_MULT_ACCOUNT:3003,KICKED_OUT_USERSIG_EXPIRED:3004,LOGGED_OUT:3005,KICKED_OUT_REST_API:3006,ILLEGAL_TOPIC_ID:3021,NO_USE:3122,PROFANITY_FOUND:3123,OPTIONS_IS_EMPTY:3153,MSG_A2KEY_EXPIRED:20002,ACCOUNT_A2KEY_EXPIRED:70001,HELLO_ANSWER_KICKED_OUT:1002,OPEN_SERVICE_OVERLOAD_ERROR:60022,SIGNALING_INVALID_INVITE_ID:8010,SIGNALING_NO_PERMISSION:8011,SIGNALING_ALREADY_EXISTS:8012,INVALID_CANCEL_MESSAGE:8020},Rt=null,ce=b(function e(t){U(this,e),this._m=t,this._n=""},[{key:"isLoggedIn",value:function(){return this._m.get(12).isLoggedIn()}},{key:"isOversea",value:function(){return this._m.get(12).isOversea()}},{key:"isPrivateNetWork",value:function(){var e=this._m.get(12);return e.isPrivateNetWork()&&!e.getFileDownloadProxy()}},{key:"getFileDownloadProxy",value:function(){return this._m.get(12).getFileDownloadProxy()}},{key:"getDownloadFileAuthKey",value:function(){return this._m.get(12).getDownloadFileAuthKey()}},{key:"getMyUserID",value:function(){return this._m.get(12).getUserID()}},{key:"getMyTinyID",value:function(){return this._m.get(12).getTinyID()}},{key:"getSDKAppID",value:function(){return this._m.get(12).getSDKAppID()}},{key:"isIntl",value:function(){return this._m.get(12).isIntl()}},{key:"isUsingChatCore",value:function(){return this._m.get(12).isUsingChatCore()}},{key:"isDevMode",value:function(){return this._m.get(12).isDevMode()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"getPlatform",value:function(){return Ns}},{key:"getCloudConfig",value:function(e){return this._m.get(23).getCloudConfig(e)}},{key:"emitOEvt",value:function(e,t){this._m.getOEmitInst().emit(e,t)}},{key:"emitIEvt",value:function(e,t){this._m.getIEmitInst().emit(e,t)}},{key:"getIEmitInst",value:function(){return this._m.getIEmitInst()}},{key:"req",value:function(e){return this._m.get(20).req(e)}},{key:"canIUse",value:function(e){return this._m.get(27).canIUse(e)}},{key:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"warn",value:function(e,t,n){e=this.getErrMsg(e,t,n),e&&d.w(e)}},{key:"noUse",value:function(e){var t=y.NO_USE;return v({code:t,message:this.getErrMsg(t,e)})}}]),h={LOGIN:"wslogin",LOGOUT:"wslogout",HELLO:"wshello",KICK_OTHER:"KickOther",SYNC_UNREAD_MSG:"getmsg",SEND_C2C_MSG:"sendmsg",SEND_GRP_MSG:"send_group_msg",GET_USER_PROFILE:"portrait_get_all",UPDATE_MY_PROFILE:"portrait_set",GET_BL:"black_list_get",ADD_TO_BL:"black_list_add",RM_FROM_BL:"black_list_delete",GET_FD_LIST:"friend_get",GET_FD_PROFILE:"friend_get_specified",CHECK_FD:"friend_check",DEL_FD:"friend_delete",ADD_FD:"friend_add",UPDATE_FD:"friend_update",RESPOND_FD_APPLICATION:"friend_response",GET_FD_APPLICATION_LIST:"pendency_get",DEL_FD_APPLICATION:"pendency_delete",REFUSE_FD_APPLICATION:"pendency_refuse",REPORT_FD_APPLICATION:"pendency_report",GET_FD_GRP_LIST:"group_get",CREATE_FD_GRP:"group_add",DEL_FD_GRP:"group_delete",UPDATE_FD_GRP:"group_update",REVOKE_C2C_MSG:"msgwithdraw",SET_C2C_MSG_READ:"msgreaded",SET_C2C_PEER_MUTE_NOTIFICATIONS:"set_c2c_peer_mute_notifications",GET_C2C_PEER_MUTE_NOTIFICATIONS:"get_c2c_peer_mute_notifications",GET_C2C_ROAMING_MSG:"getroammsg",GET_C2C_PEER_READ_TIME:"get_peer_read_time",DEL_C2C_MSG:"delete_c2c_msg_ramble",MODIFY_C2C_MSG:"modify_c2c_msg",MODIFY_C2C_MSG_EXT:"set_key_values",GET_C2C_MSG_EXT:"get_key_values",ADD_C2C_MSG_REACTION:"reaction_add",RM_C2C_MSG_REACTION:"reaction_del",GET_C2C_MSG_REACTIONS:"reaction_multi_stat",GET_C2C_MSG_REACTION_USER_LIST:"reaction_iterate",PAGING_GET_CONV_LIST:"page_get",DEL_CONV:"batch_delete",CLEAR_HISTORY_MSG:"clear_msg",PIN_CONV:"top",DEL_GROUP_AT_TIPS:"deletemsg",SET_CONV_CUSTOM_DATA:"set_conv_custom_data",MARK_CONV:"mark_contact",CREATE_CONV_GRP:"create_contact_group",DEL_CONV_GRP:"del_contact_group",RENAME_CONV_GRP:"update_contact_group",ADD_CONV_TO_GRP:"add_conv_to_group",DEL_CONV_FROM_GRP:"del_conv_from_group",GET_CONV_GRP_LIST:"get_contact_group",SEARCH_CONV_GRP_MARK:"search_contact_group",GET_GRP_LIST:"get_joined_group_list",GET_GRP_PROFILE:"get_group_self_member_info",CREATE_GRP:"create_group",DISMISS_GRP:"destroy_group",UPDATE_GRP_PROFILE:"modify_group_base_info",APPLY_JOIN_GRP:"apply_join_group",APPLY_JOIN_GRP_NOAUTH:"apply_join_group_noauth",QUIT_GRP:"quit_group",SEARCH_GRP:"get_group_public_info",CHANGE_GRP_OWNER:"change_group_owner",HANDLE_GRP_APPLICATION:"handle_apply_join_group",HANDLE_INVITE_JOIN_GRP:"handle_invite_join_permission_group",HANDLE_GRP_INVITATION:"handle_invite_join_group",REVOKE_GRP_MSG:"group_msg_recall",SET_GRP_MSG_READ:"msg_read_report",SET_ALL_MSG_READ:"read_all_unread_msg",GET_GRP_ROAMING_MSG:"group_msg_get",GET_READ_RECEIPT:"get_group_msg_receipt",SEND_READ_RECEIPT:"group_msg_receipt",SEND_C2C_READ_RECEIPT:"c2c_msg_read_receipt",GET_READ_RECEIPT_DETAIL:"get_group_msg_receipt_detail",GET_GRP_RECEIPTS_BY_USERS:"get_group_msg_receipts_by_users",GET_GRP_PENDENCY:"get_pendency",DEL_GRP_SYSTEM_NOTICE:"deletemsg",AV_POLLING:"get_msg",AV_NOAUTH_POLLING:"get_msg_noauth",GET_ONLINE_MBR_NUM:"get_online_member_num",DEL_GRP_MSG:"delete_group_ramble_msg_by_seq",MODIFY_GRP_MSG:"modify_group_msg",SET_GRP_ATTR:"set_group_attr",MODIFY_GRP_ATTR:"modify_group_attr",DEL_GRP_ATTR:"delete_group_attr",CLEAR_GRP_ATTR:"clear_group_attr",GET_GRP_ATTR:"get_group_attr",MODIFY_GRP_MSG_EXT:"group_set_key_values",GET_GRP_MSG_EXT:"group_get_key_values",GET_GRP_NOTIFY:"batch_get_group_notify",UPDATE_GRP_COUNTER:"update_group_counter",GET_GRP_COUNTER:"get_group_counter",ADD_GRP_MSG_REACTION:"group_reaction_add",RM_GRP_MSG_REACTION:"group_reaction_del",GET_GRP_MSG_REACTIONS:"group_reaction_multi_stat",GET_GRP_MSG_REACTION_USER_LIST:"group_reaction_iterate",PIN_GRP_MSG:"pin_message",UNPIN_GRP_MSG:"unpin_message",GET_PINNED_GRP_MSG_LIST:"get_pinned_messages",GET_LIVE_HISTORY_MSG:"get_huge_group_msg",GET_GRP_MBR_LIST:"get_group_member_info",GET_AV_MBR_LIST:"get_members",GET_GRP_MBR_PROFILE:"get_specified_group_member_info",ADD_GRP_MBR:"add_group_member",DEL_GRP_MBR:"delete_group_member",BAN_AV_MBR:"ban_group_member",MODIFY_GRP_MBR_INFO:"modify_group_member_info",MARK_AV_MBR_INFO:"modify_user_info",COS_SIGN:"cos",COS_PRE_SIG:"pre_sig",SIMPLE_COS_PRE_SIG:"simple_sig",GET_IMAGE_INFO:"get_imageinfo",GET_IP:"get_final_ip",VIDEO_COVER:"video_cover",SSO_STAT:"tim_web_report_v2",PING:"alive",MSG_PUSH:"msg_push",CS:"query",GRP_CS:"query_grp",MBR_CS:"query_grp_member",USER_CS:"query_user",MULTI_MSG_PUSH:"multi_msg_push_ws",MSG_PUSH_ACK:"ws_msg_push_ack",STATUS_FORCE_OFFLINE:"stat_forceoffline",UPLOAD_MERGER_MSG:"save_relay_json_msg",DOWNLOAD_MERGER_MSG:"get_relay_json_msg",FETCH_CLOUD_CTRL_CONFIG:"fetch_config",PUSHED_CLOUD_CTRL_CONFIG:"push_configv2",FETCH_COMMERCIAL_CONFIG:"fetch_imsdk_purchase_bitsv2",PUSHED_COMMERCIAL_CONFIG:"push_imsdk_purchase_bitsv2",OVERLOAD_NOTIFY:"notify2",CREATE_TOPIC:"create_topic",DEL_TOPIC:"destroy_topic",UPDATE_TOPIC_PROFILE:"modify_topic",GET_TOPIC_LIST:"get_topic",SET_SELF_STATUS:"ws_set_custom_status",GET_USER_STATUS:"ws_get_user_status",SUB_USER_STATUS:"ws_status_subscribe",UNSUB_USER_STATUS:"ws_status_unsubscribe",STAT_BACKGROUND:"ws_stat_background",STAT_FOREGROUND:"ws_stat_foreground",SET_TOKEN:"ws_stat_settoken",PUSH_REPORT:"uniapp_sdk_report",GET_PROFANITY_LIST:"get_local_words",TRANSLATE_TEXT:"ws_batch_trans_text",VOICE_TO_TEXT:"ws_sentence_recognition",FOLLOW:"follow_add",UNFOLLOW:"follow_delete",GET_FOLLOW:"follow_get",GET_FOLLOW_INFO:"follow_get_info",CHECK_FOLLOW_TYPE:"follow_check",SET_ALL_RECEIVE_MSG_OPT:"ws_set_do_not_disturb",GET_ALL_RECEIVE_MSG_OPT:"ws_get_do_not_disturb"},Ho="networkRTT",Ko="messageE2EDelay",Bt="sendMessageC2C",Ht="sendMessageGroup",Kt="sendMessageGroupAV",At="sendMessageRichMedia",Ye="cosUpload",Yt="messageReceivedGroup",un="messageReceivedGroupAVPush",ln="messageReceivedGroupAVPull",pi=Ge(Ge(Ge(Ge(Ge(Ge(Ge(Ge(Ge(Ge({},Ho,2),Ko,3),Bt,4),Ht,5),Kt,6),At,7),Yt,8),un,9),ln,10),Ye,11),_i={info:4,warning:5,error:6},ma={wifi:1,"2g":2,"3g":3,"4g":4,"5g":5,unknown:6,none:7,online:8},gi={login:4,plugin_search:16,plugin_translate:16,plugin_voice_to_text:16,plugin_cs:16,plugin_push:16,plugin_bot:16,plugin_emoji_reaction:16,tui_key_features:16},D=b(Pn,[{key:"updateTimeStamp",value:function(){this.timestamp=Qe()}},{key:"start",value:function(e){return this._startts=e,this}},{key:"end",value:function(){var e,t=this,n=0<arguments.length&&arguments[0]!==void 0&&arguments[0];this._sentFlag||(this._netMonitorModule&&(e=this._netMonitorModule.getNetworkType(),this.setNetworkType(e)),e=Qe(),this.costTime===0&&(this.costTime=e-this._startts),this.setMoreMessage("startts:".concat(this._startts," endts:").concat(e)),n?(this._sentFlag=!0,this._eventStatModule&&this._eventStatModule.pushIn(this)):setTimeout(function(){t._sentFlag=!0,t._eventStatModule&&t._eventStatModule.pushIn(t)},0))}},{key:"setError",value:function(e){var t;return e instanceof Error?this._sentFlag||(t=!0,(t=this._netMonitorModule?this._netMonitorModule.isOnline():t)?(e.code&&this.setCode(e.code),e.message&&this.setMoreMessage(e.message)):this.setCode(y.NO_NETWORK),this.setLevel("error")):d.w("".concat(this._n,".setError value not instanceof Error, please check!")),this}},{key:"setCode",value:function(e){return T(e)||this._sentFlag||(e==="ECONNABORTED"&&(this.code=103),Y(e)?this.code=e:d.w("".concat(this._n,".setCode value not a number, please check!"),e,ut(e))),this}},{key:"setMessage",value:function(e){return T(e)||this._sentFlag||(Y(e)&&(this.message=e.toString()),V(e)&&(this.message=e)),this}},{key:"setCostTime",value:function(e){return this.costTime=e,this}},{key:"setLevel",value:function(e){return T(e)||this._sentFlag||(this.level=_i[e]),this}},{key:"setMoreMessage",value:function(e){return k(this.moreMessage)?this.moreMessage="".concat(e):this.moreMessage+=" ".concat(e),this}},{key:"setNetworkType",value:function(e){return T(e)?d.w("".concat(this._n,".setNetworkType value is undefined, please check!")):(e=ma[e.toLowerCase()],T(e)||(this.networkType=e)),this}},{key:"getStartTs",value:function(){return this._startts}},{key:"setUIPlatform",value:function(e){return this.uiPlatform=e,this}},{key:"setExtension",value:function(e){return this.extension=e,this}},{key:"setEventType",value:function(e){return this.eventType=e,this}}],[{key:"bindEventStatModule",value:function(e){Pn.prototype._eventStatModule=e}},{key:"bindNetMonitorModule",value:function(e){Pn.prototype._netMonitorModule=e}}]),Yo=b(function e(t){U(this,e),this.type=g.MSG_TEXT,this.content={text:t.text||""}},[{key:"setText",value:function(e){this.content.text=e}},{key:"sendable",value:function(){return this.content.text.length!==0}}]);function Pn(e){U(this,Pn),this._n="SSOLogData",this.eventType=gi[e]||0,this.timestamp=0,this.networkType=8,this.code=0,this.message="",this.moreMessage="",this.extension=e,this.costTime=0,this.duplicate=!1,this.level=4,this.uiPlatform=void 0,this._sentFlag=!1,this._startts=Qe()}function Gn(s){U(this,Gn),t=le(this,Gn);var t,n=s.code,o=s.message,s=s.data;return t.code=n,o?t.message=o:t._getErrMsg&&(t.message=t._getErrMsg(t.code)),t.data=s||{},t}function oe(e,t,n,r){var s,a,i,r=3<arguments.length&&r!==void 0?r:[];return e&&(s=e,a=!1,k(t)||(i=/^(https?:\/\/[^/]+)/).test(e)&&(s=e.replace(i,t),a=!0),i=(function(c,u){var l=!1;if(c){var c=c.match(/:\/\/([0-9]?\.)?(.[^/:]+)/),_=c&&c[2]||"";if(_.includes("rich-dev"))return!0;for(var m=0;m<u.length;m++)if(_.endsWith(u[m])){l=!0;break}}return l})(s,r)||a,n&&s.indexOf("authKey=")===-1&&i?(-1<s.indexOf("?")?"".concat(s,"&authKey="):"".concat(s,"?authKey=")).concat(n):s)}function Un(e,t){var n=t[0].content||t[0].payload;return e===g.MSG_IMAGE?n.imageInfoArray.forEach(function(o){o.imageUrl=Wt(o.imageUrl)}):e===g.MSG_VIDEO?(n.remoteSnapshotUrl=Wt(n.remoteSnapshotUrl),n.remoteThumbUrl=Wt(n.remoteThumbUrl),n.remoteVideoUrl=Wt(n.remoteVideoUrl)):e===g.MSG_AUDIO?n.remoteAudioUrl=Wt(n.remoteAudioUrl):e===g.MSG_FILE?n.remoteFileUrl=Wt(n.remoteFileUrl):e===g.MSG_MERGER&&(e=(n=t[0].content||t[0].payload).downloadKey,n=(n=n.messageList)===void 0?[]:n,k(e===void 0?"":e))&&n.forEach(function(o){Un(o.messageBody[0].type,o.messageBody)}),t}function Wt(e){if(!e||e.indexOf("authKey=")===-1)return e;for(var e=e.split("?"),t=e[1].split("&"),n=0,o=0;o<t.length;o++)if(-1<t[o].indexOf("authKey=")){n=o;break}return t.splice(n,1),0<t.length?"".concat(e[0],"?").concat(t.join("&")):e[0]}var bn=b(function e(t,n,o,s){U(this,e),this._imageMemoryURL="",this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,X||He?this.createImageDataASURL(t.file):this.createImageDataASURLInWeb(t.file),this._initImageInfoModel(),this.type=g.MSG_IMAGE,this._percent=0,this.content={imageFormat:t.imageFormat||Dn.UNKNOWN,uuid:t.uuid,imageInfoArray:[]},this.initImageInfoArray(t.imageInfoArray),this._autoFixUrl()},[{key:"_initImageInfoModel",value:function(){var e=this;this._ImageInfoModel=function(t){this.instanceID=Je(9999999),this.sizeType=t.type||0,this.type=0,this.size=t.size||0,this.width=t.width||0,this.height=t.height||0,this.imageUrl=t.imageUrl||t.url||"",this.url=oe(t.url||e._imageMemoryURL,e._fileDownloadProxy,e._authKey,e._fileDNList)},this._ImageInfoModel.prototype={setSizeType:function(t){this.sizeType=t},setType:function(t){this.type=t},setImageUrl:function(t){t&&(this.imageUrl=oe(t,void 0,e._authKey,e._fileDNList))},getImageUrl:function(){return this.imageUrl}}}},{key:"initImageInfoArray",value:function(e){for(var t,n=0,o=null;n<=2;)t=T(e)||T(e[n])?{type:0,size:0,width:0,height:0,url:""}:e[n],(o=new this._ImageInfoModel(t)).setSizeType(n+1),o.setType(n),this.addImageInfo(o),n++;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,a=0;a<e;a++)this.content.imageInfoArray[a].url&&(s=this.content.imageInfoArray[a]).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[a].setImageUrl([n,t].join("")))}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateImageFormat",value:function(e){this.content.imageFormat=Dn[e.toUpperCase()]||Dn.UNKNOWN}},{key:"createImageDataASURLInWeb",value:function(e){e!==void 0&&0<e.files.length&&(this._imageMemoryURL=window.URL.createObjectURL(e.files[0]))}},{key:"createImageDataASURL",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){3<=this.content.imageInfoArray.length||this.content.imageInfoArray.push(e)}},{key:"updateAccessSideImageInfoArray",value:function(){var e=this.content.imageInfoArray,n=e[0],t=n.width,t=t===void 0?0:t,n=n.height,n=n===void 0?0:n;t!==0&&n!==0&&(na(e),Object.assign(e[2],bo({originWidth:t,originHeight:n,min:720})))}},{key:"sendable",value:function(){return this.content.imageInfoArray.length!==0&&this.content.imageInfoArray[0].imageUrl!==""&&this.content.imageInfoArray[0].size!==0}}]),Wo=b(function e(t){U(this,e),this.type=g.MSG_FACE,this.content=t||null},[{key:"sendable",value:function(){return this.content!==null}}]),wn=b(function e(t,n,o,s){U(this,e),this.type=g.MSG_AUDIO,this._percent=0,this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,this.content={downloadFlag:2,second:t.second,size:t.size,url:oe(t.url,this._fileDownloadProxy,this._authKey,this._fileDNList),remoteAudioUrl:oe(t.url||"",void 0,this._authKey,this._fileDNList),uuid:t.uuid}},[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateAudioUrl",value:function(e){this.content.remoteAudioUrl=oe(e,void 0,this._authKey,this._fileDNList)}},{key:"sendable",value:function(){return this.content.remoteAudioUrl!==""}}]),hi={from:!0,groupID:!0,groupName:!0,to:!0},va=b(function e(t){U(this,e),this.type=g.MSG_GRP_TIP,this.content={},this._initContent(t)},[{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":t.content.operatorInfo={},t._initOperatorInfo(e[n]);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];hi[o]&&(this.content.groupProfile[o]=e[o])}}},{key:"_initOperatorInfo",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];this.content.operatorInfo[o]=e[o]}}},{key:"_updateMemberList",value:function(e){k(this.content.memberList)?this.content.memberList=e:this.content.memberList.forEach(function(t){e.forEach(function(n){t.userID===n.userID&&Object.assign(t,n)})})}},{key:"_initNewGroupProfile",value:function(e){for(var t=Object.keys(e),n=0;n<t.length;n++){var o=t[n];this.content.newGroupProfile[o]=o!=="muteAllMembers"?e[o]:e[o]===1}}}]),fi={from:!0,groupID:!0,groupName:!0,to:!0,groupType:!0},Ia=b(function e(t){U(this,e),this.type=g.MSG_GRP_SYS_NOTICE,this.content={},this._initContent(t)},[{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];fi[o]&&(o==="groupName"?this.content.groupProfile.name=e[o]:this.content.groupProfile[o]=e[o])}}}]),Fn=b(function e(t,n,o,s){U(this,e),this.type=g.MSG_FILE,this._percent=0;var a=this._getFileInfo(t);this.content={downloadFlag:2,fileUrl:oe(t.url||t.fileUrl,n,o,s)||"",remoteFileUrl:oe(t.url||t.fileUrl,void 0,o,s)||"",uuid:t.uuid,fileName:a.name||"",fileSize:a.size||0}},[{key:"_getFileInfo",value:function(e){var t,n;return T(e.fileName)||T(e.fileSize)?(t=e.file.files[0],Be&&(t.path&&t.path.indexOf(".")!==-1&&(n=t.path.slice(t.path.lastIndexOf(".")+1).toLowerCase(),t.type=n,t.name||(t.name="".concat(Je(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)),{size:t.size,name:t.name}):{size:e.fileSize,name:e.fileName}}},{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateFileUrl",value:function(e,t){this.content.fileUrl=e,this.content.remoteFileUrl=t}},{key:"sendable",value:function(){return this.content.fileUrl!==""&&this.content.fileName!==""&&this.content.fileSize!==0}}]),jo=b(function e(t){U(this,e),this.type=g.MSG_CUSTOM,this.content={data:t.data||"",description:t.description||"",extension:t.extension||""}},[{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 this.content.data.length!==0||this.content.description.length!==0||this.content.extension.length!==0}}]),qn=b(function e(t,n,o,s){U(this,e),this.type=g.MSG_VIDEO,this._percent=0,this._fileDownloadProxy=n,this._authKey=o,this._fileDNList=s,this.content={remoteVideoUrl:oe(t.remoteVideoUrl||t.videoUrl||"",void 0,this._authKey,this._fileDNList),videoFormat:t.videoFormat,videoSecond:parseInt(t.videoSecond,10),videoSize:t.videoSize,videoUrl:oe(t.videoUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),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:oe(t.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),snapshotUrl:oe(t.thumbUrl,this._fileDownloadProxy,this._authKey,this._fileDNList),remoteSnapshotUrl:oe(t.thumbUrl,void 0,this._authKey,this._fileDNList),remoteThumbUrl:oe(t.thumbUrl,void 0,this._authKey,this._fileDNList)}},[{key:"updatePercent",value:function(e){this._percent=e,1<this._percent&&(this._percent=1)}},{key:"updateVideoUrl",value:function(e){e&&(this.content.remoteVideoUrl=oe(e,void 0,this._authKey,this._fileDNList))}},{key:"updateSnapshotInfo",value:function(s){var t=s.snapshotUrl,n=s.snapshotWidth,o=s.snapshotHeight,s=s.remoteSnapshotUrl;k(t)||(this.content.thumbUrl=this.content.snapshotUrl=t),k(n)||(this.content.thumbWidth=this.content.snapshotWidth=Number(n)),k(o)||(this.content.thumbHeight=this.content.snapshotHeight=Number(o)),k(s)||(this.content.remoteSnapshotUrl=s,this.content.remoteThumbUrl=s)}},{key:"sendable",value:function(){return this.content.remoteVideoUrl!==""}}]),Jo=b(function e(s){U(this,e),this.type=g.MSG_LOCATION;var n=s.description,o=s.longitude,s=s.latitude;this.content={description:n,longitude:o,latitude:s}},[{key:"sendable",value:function(){return!0}}]),Ma=b(function e(t,n,o,s){var a,i;U(this,e),this.from=t.from,this.messageSender=t.from,this.time=t.time,this.messageSequence=t.sequence,this.clientSequence=t.clientSequence||t.sequence,this.messageRandom=t.random,this.cloudCustomData=t.cloudCustomData||"",this.clientTime=t.clientTime||void 0,t.ID?(this.ID=t.ID||"",this.nick=t.nick||"",this.avatar=t.avatar||"",t.messageBody?this.messageBody=JSON.parse(JSON.stringify(t.messageBody)):this.messageBody=[{type:t.type,payload:t.payload}],t.conversationType?t.conversationType.startsWith(g.CONV_C2C)?this.receiverUserID=t.to:t.conversationType.startsWith(g.CONV_GROUP)&&(this.receiverGroupID=t.to):t.receiverGroupID?this.receiverGroupID=t.receiverGroupID:t.receiverUserID&&(this.receiverUserID=t.receiverUserID),this.messageReceiver=t.to||t.messageReceiver):(this.nick=t.nick||"",this.avatar=t.avatar||"",this.messageBody=[],a=t.elements[0].type,i=t.elements[0].content,this._patchRichMediaPayload(a,i),this._updateRichMediaDownloadUrl(a,i,n,o,s),a===g.MSG_MERGER?this.messageBody.push({type:a,payload:new xn(i,n,o,s).content}):this.messageBody.push({type:a,payload:i}),t.groupID&&(this.receiverGroupID=t.groupID,this.messageReceiver=t.groupID),t.to&&(this.receiverUserID=t.to,this.messageReceiver=t.to),this.ID="".concat(t.tinyID,"-").concat(t.clientTime,"-").concat(t.random))},[{key:"_patchRichMediaPayload",value:function(e,t){e===g.MSG_IMAGE?t.imageInfoArray.forEach(function(n){!n.imageUrl&&n.url&&(n.imageUrl=n.url,n.sizeType=n.type,n.type===1?n.type=0:n.type===3&&(n.type=1))}):e===g.MSG_VIDEO?!t.remoteVideoUrl&&t.videoUrl&&(t.remoteVideoUrl=t.videoUrl):e===g.MSG_AUDIO?!t.remoteAudioUrl&&t.url&&(t.remoteAudioUrl=t.url):e===g.MSG_FILE&&!t.fileUrl&&t.url&&(t.remoteFileUrl=t.url,t.fileUrl=t.url,t.url=void 0)}},{key:"_updateRichMediaDownloadUrl",value:function(e,t,n,o,s){(n||o)&&(e===g.MSG_IMAGE?t.imageInfoArray.forEach(function(a){a.imageUrl=oe(a.imageUrl,void 0,o,s),a.url=oe(a.url,n,o,s)}):e===g.MSG_VIDEO?(t.remoteVideoUrl=oe(t.remoteVideoUrl,void 0,o,s),t.videoUrl=oe(t.videoUrl,n,o,s),t.remoteThumbUrl=oe(t.thumbUrl,void 0,o,s),t.remoteSnapshotUrl=oe(t.thumbUrl,void 0,o,s),t.thumbUrl=oe(t.thumbUrl,n,o,s),t.snapshotUrl=oe(t.thumbUrl,n,o,s),t.snapshotHeight=t.thumbHeight,t.snapshotWidth=t.thumbWidth):e===g.MSG_AUDIO?(t.remoteAudioUrl=oe(t.remoteAudioUrl,void 0,o,s),t.url=oe(t.url,n,o,s)):e===g.MSG_FILE&&(t.remoteFileUrl=oe(t.fileUrl,void 0,o,s),t.fileUrl=oe(t.fileUrl,n,o,s)))}}]),xn=b(function e(t,n,o,s){var a,i,r,c,u,l,_;U(this,e),this.type=g.MSG_MERGER,this.content={downloadKey:"",pbDownloadKey:"",messageList:[],title:"",abstractList:[],compatibleText:"",version:0,layersOverLimit:!1},t.downloadKey?(i=t.downloadKey,r=t.pbDownloadKey,c=t.title,u=t.abstractList,l=t.compatibleText,a=t.version,this.content.downloadKey=i,this.content.pbDownloadKey=r,this.content.title=c,this.content.abstractList=u,this.content.compatibleText=l,this.content.version=a||0):k(t.messageList)?t.layersOverLimit===1&&(this.content.layersOverLimit=!0):(i=t.messageList,r=t.title,c=t.abstractList,u=t.compatibleText,l=t.version,_=[],i.forEach(function(m){k(m)||(m=new Ma(m,n,o,s),_.push(m))}),this.content.messageList=_,this.content.title=r,this.content.abstractList=c,this.content.compatibleText=u,this.content.version=l||0)},[{key:"sendable",value:function(){return!k(this.content.messageList)||!k(this.content.downloadKey)}}]),zo={1:g.MSG_PRIORITY_HIGH,2:g.MSG_PRIORITY_NORMAL,3:g.MSG_PRIORITY_LOW,4:g.MSG_PRIORITY_LOWEST},Ce=b(function e(t){U(this,e),this.ID="",this.conversationID=t.conversationID||null,this.conversationType=t.conversationType||g.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||t.random===0?t.random:Je(),this.priority=this._computePriority(t.priority),this.nick=t.nick||"",this.avatar=t.avatar||"",this.isPeerRead=!1,this.nameCard="",this.hasRiskContent=ca(t.checkResult),this._elements=[],this.isPlaceMessage=t.isPlaceMessage||0,this.isRevoked=t.isPlaceMessage===2||t.msgFlagBits===8,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||je,this._onlineOnlyFlag=!1,this._groupAtInfoList=[],this._relayFlag=!1,this.atUserList=[],this.cloudCustomData=t.cloudCustomData||"",this.isDeleted=!1,this.isModified=!!t.messageVersion,this._isExcludedFromUnreadCount=!(!t.messageControlInfo||t.messageControlInfo.excludedFromUnreadCount!==1),this._isExcludedFromLastMessage=!(!t.messageControlInfo||t.messageControlInfo.excludedFromLastMessage!==1),this.clientTime=t.clientTime||Zt()||0,this.senderTinyID=t.senderTinyID||t.tinyID||"",this.readReceiptInfo=t.readReceiptInfo||{readCount:void 0,unreadCount:void 0,isPeerRead:void 0,timestamp:0},this.needReadReceipt=t.needReadReceipt===!0||t.needReadReceipt===1,this.version=t.messageVersion||0,this.isBroadcastMessage=t.isBroadcastMessage||!1,this._receiverList=t.receiverList||void 0,this.isSupportExtension=t.isSupportExtension===!0||t.isSupportExtension===1,this._cmConfigID=t.customModerationConfigurationID,this.revoker=t.revokerInfo&&t.revokerInfo.revoker||"",this.revokerInfo=t.revokerInfo||{userID:"",nick:"",avatar:""},this.revokeReason=t.revokeReason||"",this.pinnerInfo=t.pinnerInfo||null,this.level=t.level||0,this.reInitialize(t.currentUser),this.extractGroupInfo(t.groupProfile||null),this.handleGroupAtInfo(t),this.initC2CReadReceiptInfo(t)},[{key:"elements",get:function(){return this._elements}},{key:"getElements",value:function(){return this._elements}},{key:"extractGroupInfo",value:function(e){e!==null&&(V(e.nick)&&(this.nick=e.nick),V(e.avatar)&&(this.avatar=e.avatar),Y(e.level)&&(this.level=e.level),e=e.messageFromAccountExtraInformation,Q(e))&&V(e.nameCard)&&(this.nameCard=e.nameCard)}},{key:"handleGroupAtInfo",value:function(e){var t=this;e.payload&&e.payload.atUserList&&e.payload.atUserList.forEach(function(n){n!==g.MSG_AT_ALL?(t._groupAtInfoList.push({groupAtAllFlag:0,groupAtUserID:n}),t.atUserList.push(n)):(t._groupAtInfoList.push({groupAtAllFlag:1}),t.atUserList.push(g.MSG_AT_ALL))}),O(e.groupAtInfo)&&e.groupAtInfo.forEach(function(n){n.groupAtAllFlag===0?t.atUserList.push(n.groupAtUserID):n.groupAtAllFlag===1&&t.atUserList.push(g.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?je:Nn,!this.from)&&(this.from=e),this._initFlow(e),this._initSequence(e),this._concatConversationID(e),this.generateMessageID()}},{key:"isSendable",value:function(){return this._elements.length!==0&&(this._relayFlag===!0||typeof this._elements[0].sendable=="function"&&this._elements[0].sendable())}},{key:"_initTo",value:function(e){this.conversationType===g.CONV_GROUP&&(this.to=e.groupID)}},{key:"_initSequence",value:function(e){var t,n,o;this.clientSequence===0&&e&&(this.clientSequence=!!(e=e)&&(Sn[e]===void 0&&(o=new Date,t="3".concat(o.getHours()).slice(-2),n="0".concat(o.getMinutes()).slice(-2),o="0".concat(o.getSeconds()).slice(-2),Sn[e]=parseInt([t,n,o,"0001"].join("")),o=n=t=null,d.l("autoIncrementIndex start index:".concat(Sn[e]))),Sn[e]++)),this.sequence===0&&this.conversationType===g.CONV_C2C&&(this.sequence=this.clientSequence)}},{key:"generateMessageID",value:function(){this.from===g.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=this.conversationType;n!==g.CONV_SYSTEM?(e=n===g.CONV_C2C?e===this.from?t:this.from:this.to,this.conversationID=e?"".concat(n).concat(e):null):this.conversationID=g.CONV_SYSTEM}},{key:"isElement",value:function(e){return e instanceof Yo||e instanceof bn||e instanceof Wo||e instanceof wn||e instanceof Fn||e instanceof qn||e instanceof va||e instanceof Ia||e instanceof jo||e instanceof Jo||e instanceof xn}},{key:"setElement",value:function(e,t,n,o){var s=this;if(this.isElement(e))this._elements=[e];else{var a=function(r){if(r.type&&r.content)switch(r.type){case g.MSG_TEXT:s.setTextElement(r.content);break;case g.MSG_IMAGE:s.setImageElement(r.content,t,n,o);break;case g.MSG_AUDIO:s.setAudioElement(r.content,t,n,o);break;case g.MSG_FILE:s.setFileElement(r.content,t,n,o);break;case g.MSG_VIDEO:s.setVideoElement(r.content,t,n,o);break;case g.MSG_CUSTOM:s.setCustomElement(r.content);break;case g.MSG_LOCATION:s.setLocationElement(r.content);break;case g.MSG_GRP_TIP:s.setGroupTipElement(r.content);break;case g.MSG_GRP_SYS_NOTICE:s.setGroupSystemNoticeElement(r.content);break;case g.MSG_FACE:s.setFaceElement(r.content);break;case g.MSG_MERGER:s.setMergerElement(r.content,t,n,o)}};if(O(e))for(var i=0;i<e.length;i++)a(e[i]);else a(e)}this._initProxy()}},{key:"clearElement",value:function(){this._elements.length=0}},{key:"setTextElement",value:function(e){e=typeof e=="string"?e:e.text,e=new Yo({text:e}),this._elements.push(e)}},{key:"setImageElement",value:function(e,t,n,o){e=new bn(e,t,n,o),this._elements.push(e)}},{key:"setAudioElement",value:function(e,t,n,o){e=new wn(e,t,n,o),this._elements.push(e)}},{key:"setFileElement",value:function(e,t,n,o){e=new Fn(e,t,n,o),this._elements.push(e)}},{key:"setVideoElement",value:function(e,t,n,o){e=new qn(e,t,n,o),this._elements.push(e)}},{key:"setLocationElement",value:function(e){e=new Jo(e),this._elements.push(e)}},{key:"setCustomElement",value:function(e){e=new jo(e),this._elements.push(e)}},{key:"setGroupTipElement",value:function(e){var t,n={},o=e.operationType;k(e.memberInfoList)?e.operatorInfo&&(n=e.operatorInfo):o!==g.GRP_TIP_MBR_JOIN&&o!==g.GRP_TIP_MBR_KICKED_OUT&&o!==g.GRP_TIP_MBR_SET_ADMIN&&o!==g.GRP_TIP_MBR_CANCELED_ADMIN||(n=e.memberInfoList[0]),k(e.memberExtraInfo)||(t=e.memberExtraInfo.reason,e.msgMemberInfo.forEach(function(s){s.reason=t})),o=n.nick,n=n.avatar,V(o)&&(this.nick=o),V(n)&&(this.avatar=n),o=new va(e),this._elements.push(o)}},{key:"setGroupSystemNoticeElement",value:function(e){e=new Ia(e),this._elements.push(e)}},{key:"setFaceElement",value:function(e){e=new Wo(e),this._elements.push(e)}},{key:"setMergerElement",value:function(e,t,n,o){e=new xn(e,t,n,o),this._elements.push(e)}},{key:"setIsRead",value:function(e){this.isRead=e}},{key:"setRelayFlag",value:function(e){this._relayFlag=e}},{key:"_computePriority",value:function(e){if(!T(e)){if(V(e)&&Object.values(zo).indexOf(e)!==-1)return e;if(Y(e)&&(e=""+e,Object.keys(zo).indexOf(e)!==-1))return zo[e]}return g.MSG_PRIORITY_NORMAL}},{key:"setNickAndAvatar",value:function(n){var t=n.nick,n=n.avatar;V(t)&&(this.nick=t),V(n)&&(this.avatar=n)}},{key:"setNameCard",value:function(e){V(e)&&(this.nameCard=e)}},{key:"initC2CReadReceiptInfo",value:function(n){var t=n.readReceiptSentByPeer,n=n.timestamp,n=n===void 0?0:n;this.conversationType===g.CONV_C2C&&this.needReadReceipt===!0&&(this.readReceiptInfo.isPeerRead=(t===void 0?void 0:t)===1,this.readReceiptInfo.timestamp=n)}}]),mi=["sound","FCMChannelID"],vi=["ignoreIOSBadge","disableVoipPush","enableIOSBackgroundNotification"],Ii={HonorImportance:{range:["LOW","NORMAL"],defaultValue:void 0},MeizuNotifyType:{range:[0,1],defaultValue:void 0}},Mi={enableIOSBackgroundNotification:{range:[!0,!1],defaultValue:!1},interruptionLevel:{range:["passive","active","time-sensitive","critical"],defaultValue:"active"}};function ya(e,t){for(var n in t){var o,s;Object.prototype.hasOwnProperty.call(t,n)&&(o=(s=t[n]).range,s=s.defaultValue,e[n]=o.includes(e[n])?e[n]:s)}return e}function Vn(e){if(Q(e))return{pushFlag:e.disablePush===!0?1:0,title:e.title||"",desc:e.description||"",ext:e.extension||"",apnsInfo:(n=(t=e).apnsInfo,o=(o=t.ignoreIOSBadge)!==void 0&&o,t=t.disableVoipPush,s=(n=ya(n===void 0?{}:n,Mi)).ignoreIOSBadge,a=n.disableVoipPush,i=n.enableIOSBackgroundNotification,n=Fe(n,vi),s=s===!0||o===!0?1:0,o=void 0,T(t)||(o=t===!1?1:0),T(a)||(o=a===!1?1:0),p(p({},n),{},{badgeMode:s,isVoipPush:o,contentAvailable:i?1:0})),androidInfo:(a=(a=(t=e).androidInfo)===void 0?{}:a,t=t.androidOPPOChannelID,t=a.OPPOChannelID||(t===void 0?"":t),a=ya(a,Ii),n=(n=a.sound)===void 0?"":n,s=(s=a.FCMChannelID)===void 0?"":s,p(p({},Fe(a,mi)),{},{Sound:(n=(a=n).lastIndexOf("."))===-1?a:a.slice(0,n),OPPOChannelID:t,GoogleChannelID:s}))};var t,n,o,s,a,i}de(Bn,ce);var yi=b(Bn,[{key:"onNewMessage",value:function(a){var i=a.dataList,t=a.isInstantMessage,o=a.C2CRemainingUnreadList,s=a.C2CPairUnreadList,n=a.isSyncingEnded,a=a.isOnlineSync,i=(t||d.l("".concat(this._n,".onNewMessage C2CPairUnreadList:"),s,"C2CRemainingUnreadList:",o),this._assembly({dataList:i,C2CRemainingUnreadList:o,C2CPairUnreadList:s,isInstantMessage:t,isOnlineSync:a})),o=i.conversationOptionsList,s=i.messageList,a=i.isUnreadC2CMessage,i=Go(s),i=(0<i.length&&this.emitOEvt(F.MESSAGE_MODIFIED,i),this.get(11).onNewMessage({conversationOptionsList:o,isInstantMessage:t,isUnreadC2CMessage:a,isSyncingEnded:n}),Uo(s));t&&0<i.length&&this.emitOEvt(F.MESSAGE_RECEIVED,i),s.length=0}},{key:"_assembly",value:function(e){for(var t=e.dataList,n=e.C2CRemainingUnreadList,o=e.C2CPairUnreadList,s=e.isInstantMessage,a=e.isOnlineSync,i=null,r=[],c=[],u={},l=this.get(26),_=!1,m=this.get(11),f=this.get(4),e=this.get(17),I=this.getFileDownloadProxy(),C=this.getDownloadFileAuthKey(),M=e.getFileDNList(),S=0,L=t.length;S<L;S++)if(this._isC2CNotice(t[S]))this._noticeFromUnreadDBList.push(t[S].eventArray[0].c2CNotifyMsgArray[0]);else{var P=t[S],w=(P.currentUser=this.getMyUserID(),P.conversationType=g.CONV_C2C,P.isSystemMessage=!!P.isSystemMessage,(T(P.nick)||T(P.avatar))&&(_=!0),(i=new Ce(P)).setElement(P.elements,I,C,M),i.setNickAndAvatar({nick:P.nick,avatar:P.avatar}),i.conversationID);if(s){if(this._msgFromUnreadDBMap.get(i.ID))continue;var B,x,j=!1,se=(i.from!==this.getMyUserID()?(x=m.getLatestMessageSentByPeer(w))&&(B=x.nick,x=x.avatar,_?i.setNickAndAvatar({nick:B,avatar:x}):B===i.nick&&x===i.avatar||(j=!0)):(B=m.getLatestMessageSentByMe(w))&&(x=B.nick,se=B.avatar,x===i.nick&&se===i.avatar||(m.modifyMessageSentByMe({conversationID:w,latestNick:i.nick,latestAvatar:i.avatar}),f.mockOnNickAvatarModified(i.nick,i.avatar))),t[S].isModified===1);if(m.isMessageSentByCurrentInstance(i)?i.isModified=se:se=!1,P.msgLifeTime===0)i._onlineOnlyFlag=!0,m.isMessageSentByCurrentInstance(i)||c.push(i);else{if(!m.pushIntoMessageList(c,i,se))continue;j&&(m.modifyMessageSentByPeer({conversationID:w,latestNick:i.nick,latestAvatar:i.avatar}),m.updateUserProfileSpecifiedKey({conversationID:w,nick:i.nick,avatar:i.avatar}))}s&&0<i.clientTime&&l.addMessageDelay(i.clientTime)}else this._msgFromUnreadDBMap.set(i.ID,i);if(P.msgLifeTime!==0){if(i._onlineOnlyFlag===!1){if(j=m.getLastMessageTime(w),Y(j)&&i.time<j)continue;s&&(T(u[w])?(P=0,i.flow!=="in"||i._isExcludedFromUnreadCount||(P=1),u[w]=r.push({conversationID:w,unreadCount:P,type:i.conversationType,subType:i.conversationSubType,lastMessage:i._isExcludedFromLastMessage?"":i})-1):(P=u[w],r[P].type=i.conversationType,r[P].subType=i.conversationSubType,r[P].lastMessage=i._isExcludedFromLastMessage?"":i,i.flow!=="in"||i._isExcludedFromUnreadCount||r[P].unreadCount++))}}else i._onlineOnlyFlag=!0}this._handleNoticeFromUnreadDB();var ae=!1;if(O(o)&&0<o.length)for(var $=0,fe=o.length;$<fe;$++)(function(ue){if(o[ue].from!==g.CONV_SYSTEM){ae=!0;var Ie=r.find(function(J){return J.conversationID==="".concat(g.CONV_C2C).concat(o[ue].from)});a&&!Ie||(Ie?Ie.unreadCount=o[ue].unreadCount:r.push({conversationID:"".concat(g.CONV_C2C).concat(o[ue].from),unreadCount:o[ue].unreadCount,type:g.CONV_C2C}))}})($);if(O(n))for(var gt=0,Te=n.length;gt<Te;gt++)(function(ue){r.find(function(Ie){return Ie.conversationID==="".concat(g.CONV_C2C).concat(n[ue].from)})||r.push({conversationID:"".concat(g.CONV_C2C).concat(n[ue].from),type:g.CONV_C2C,lastMsgTime:n[ue].lastMsgTime})})(gt);return{conversationOptionsList:r,messageList:c,isUnreadC2CMessage:ae}}},{key:"getMessageListFromUnreadDB",value:function(){return G(this._msgFromUnreadDBMap.values())}},{key:"_isC2CNotice",value:function(e){return e=e.eventArray,!(!O(e)||e[0].event!==10)}},{key:"_handleNoticeFromUnreadDB",value:function(){var e,t=this._noticeFromUnreadDBList.length;t!==0&&(d.l("".concat(this._n,"._handleNoticeFromUnreadDB count:").concat(t)),e=[],this._noticeFromUnreadDBList.forEach(function(n){n.hasOwnProperty("c2cMessageRevokedNotify")&&e.push(n)}),this.onMsgRevoked({dataList:e}),this._noticeFromUnreadDBList.length=0,e.length=0)}},{key:"onMsgRevoked",value:function(e,t){var n,o=this,s=this.get(11),a=[];e.dataList.forEach(function(i){i.c2cMessageRevokedNotify&&(i=i.c2cMessageRevokedNotify.revokedInfos,T(i)||i.forEach(function(r){var c=o.getMyUserID()===r.from?"".concat(g.CONV_C2C).concat(r.to):"".concat(g.CONV_C2C).concat(r.from);n=s.revoke(c,r.sequence,r.random);var u,l=r.revokerInfo&&r.revokerInfo.revoker,_=r.revokerInfo&&r.revokerInfo.reason||"";n?u=n:(u={conversationID:c,sequence:r.sequence},r.tinyID&&r.clientTime&&r.random&&(u.ID="".concat(r.tinyID,"-").concat(r.clientTime,"-").concat(r.random)),r.time&&(u.time=r.time)),u&&(u.revoker=l,u.revokeReason=_,u.revokerInfo={userID:l,nick:"",avatar:""},a.push(u))}))}),a.length!==0&&(d.l("".concat(this._n,".onMsgRevoked count:").concat(a.length," updateUnreadCount:").concat(t)),s.onMessageRevoked(a,t),s.updateRevokerInfo(a).then(function(i){o.emitOEvt(F.MESSAGE_REVOKED,i)}))}},{key:"onMsgReadReceipt",value:function(e){var t=this;e.dataList.forEach(function(n){var o;k(n.c2cMessageReadReceipt)||(o=n.c2cMessageReadReceipt.to,n.c2cMessageReadReceipt.uinPairReadArray.forEach(function(a){var a=a.peerReadTime,i=(d.l("".concat(t._n,".onMsgReadReceipt to:").concat(o," peerReadTime:").concat(a)),"".concat(g.CONV_C2C).concat(o)),r=t.get(11);r.recordPeerReadTime(i,a),r.updateMsgIsPeerReadProp(i,a)}))})}},{key:"onMsgReadNotice",value:function(e){var t=this;e.dataList.forEach(function(n){var o;k(n.c2cMessageReadNotice)||(o=t.get(11),n.c2cMessageReadNotice.uinPairReadArray.forEach(function(a){var i=a.from,a=a.peerReadTime,i=(d.l("".concat(t._n,".onMsgReadNotice from:").concat(i," lastReadTime:").concat(a)),"".concat(g.CONV_C2C).concat(i));o.updateIsReadAfterReadReport({conversationID:i,lastMessageTime:a}),o.updateUnreadCount(i)}))})}},{key:"onMsgModified",value:function(e){d.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach(function(n){t.onMessageModified(p(p({},n),{},{conversationType:g.CONV_C2C}))})}},{key:"onReadReceiptList",value:function(e){d.l("".concat(this._n,".onReadReceiptList options:"),e),this.get(11).updateReadReceiptInfo(e.dataList)}},{key:"sendMessage",value:function(e,t){return e=this._createC2CMessagePack(e,t),this.req(e)}},{key:"_createC2CMessagePack",value:function(e,t){var n,o=null,s=(t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),t.onlineUserOnly===!0)&&(o?o.disablePush=!0:o={disablePush:!0}),""),a=(V(e.cloudCustomData)&&0<e.cloudCustomData.length&&(s=e.cloudCustomData),[]),i=(Q(t)&&Q(t.messageControlInfo)&&(i=(n=t.messageControlInfo).excludedFromUnreadCount,r=n.excludedFromLastMessage,n=n.excludedFromContentModeration,i===!0&&a.push("NoUnread"),r===!0&&a.push("NoLastMsg"),n===!0)&&a.push("NoMsgCheck"),this.isOnlineMessage(e,t)?0:void 0),r=JSON.parse(JSON.stringify(e.getElements()));return this.get(17).getFileDNList(),{P:h.SEND_C2C_MSG,data:{fromAccount:this.getMyUserID(),toAccount:e.to,msgBody:Un(e.type,r),cloudCustomData:s,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:i,nick:e.nick,avatar:e.avatar,offlinePushInfo:Vn(o),messageControlInfo:i!==0?a:void 0,clientTime:e.clientTime,needReadReceipt:e.needReadReceipt===!0?1:0,isSupportExtension:e.isSupportExtension===!0?1:0,isRelayMessage:e._relayFlag===!0?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:Zs(t)}}}},{key:"isOnlineMessage",value:function(e,t){return!(!t||t.onlineUserOnly!==!0)}},{key:"revokeMessage",value:function(e){return this.req({P:h.REVOKE_C2C_MSG,data:{msgInfo:{fromAccount:e.from,toAccount:e.to,msgSeq:e.sequence,msgRandom:e.random,msgTimeStamp:e.time}}})}},{key:"deleteMessage",value:function(n){var t=n.to,n=n.keyList;return d.l("".concat(this._n,".deleteMessage toAccount:").concat(t," count:").concat(n.length)),this.req({P:h.DEL_C2C_MSG,data:{fromAccount:this.getMyUserID(),to:t,keyList:n}})}},{key:"modifyRemoteMessage",value:function(l){var t=l.from,n=l.to,o=l.version,o=o===void 0?0:o,s=l.sequence,a=l.random,i=l.time,r=l.payload,c=l.type,u=l.cloudCustomData,l=l._elements,_=void 0;return aa(c)&&(1<l.length&&l.splice(0,1,{type:c,content:r}),_=l),this.req({P:h.MODIFY_C2C_MSG,data:{from:t,to:n,version:o,sequence:s,random:a,time:i,elements:_,cloudCustomData:u}})}},{key:"setMessageRead",value:function(a){var t=this,n=a.conversationID,o=a.lastMessageTime,s="".concat(this._n,".").concat("setMessageRead"),a="convID:".concat(n," lastMessageTime:").concat(o),i=(d.l("".concat(s," ").concat(a)),Y(o)||this.warn("DoNotModifyLastTime"),new D("setMessageRead"));return i.setMessage(a),this.req({P:h.SET_C2C_MSG_READ,data:{C2CMsgReaded:{cookie:"",C2CMsgReadedItem:[{toAccount:n.replace("C2C",""),lastMessageTime:o,receipt:1}]}}}).then(function(){i.end(),d.l("".concat(s," ok"));var r=t.get(11);return r.updateIsReadAfterReadReport({conversationID:n,lastMessageTime:o}),r.updateUnreadCount(n),N()}).catch(function(r){return i.setError(r).end(),d.l("".concat(s," failed. error:"),r),v(r)})}},{key:"getRoamingMessage",value:function(r){var t=this,n="".concat(this._n,".").concat("getRoamingMessage"),o=r.peerAccount,s=r.conversationID,a=r.count,i=r.lastMessageTime,r=r.messageKey,c="peerAccount:".concat(o," count:").concat(a||15," lastMessageTime:").concat(i||0," messageKey:").concat(r),u=(d.l("".concat(n," ").concat(c)),new D("getRoamingMessage"));return this.req({P:h.GET_C2C_ROAMING_MSG,data:{peerAccount:o,count:a||15,lastMessageTime:i||0,messageKey:r}}).then(function(f){var f=f.data,_=f.complete,P=f.messageList,m=f.messageKey,f=f.lastMessageTime,I=(T(P)?d.l("".concat(n," ok. complete:").concat(_," but messageList is undefined!")):d.l("".concat(n," ok. complete:").concat(_," count:").concat(P.length)),u.setMessage("".concat(c," complete:").concat(_," length:").concat(P.length)).end(),t.get(11)),C=_===1,M=(C&&I.setCompleted(s),[]),S=I.onRoamingMessage(P,s,!0,M),L=(I.modifyMessageList(s),I.updateIsRead(s),I.updateRoamingMsgKeyAndTime(s,m,f),""),P=(0<S.length?L=S[0].ID:(_=I.getLocalOldestMessage(s))&&(L=_.ID),I.getPeerReadTime(s));return d.l("".concat(n," update isPeerRead property. convID:").concat(s," peerReadTime:").concat(P)),P?(I.updateMsgIsPeerReadProp(s,P),d.l("".concat(n," nextReqID:").concat(L," storedMsgCount:").concat(S.length)),{nextReqID:L,storedMessageList:S,assembledMessageList:M,isPullingCompleted:C}):(m=s.replace(g.CONV_C2C,""),t.getRemotePeerReadTime([m]).then(function(){return I.updateMsgIsPeerReadProp(s,I.getPeerReadTime(s)),d.l("".concat(n," nextReqID:").concat(L," storedMsgCount:").concat(S.length)),{nextReqID:L,storedMessageList:S,assembledMessageList:M,isPullingCompleted:C}}))}).catch(function(l){return u.setMessage(c).setError(l).end(),d.w("".concat(n," failed. error:"),l),v(l)})}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessagesHopping"),o=e.peerAccount,s=e.time,s=s===void 0?0:s,a=e.count,i=e.direction,r="".concat(g.CONV_C2C).concat(o),c="peerAccount:".concat(o," count:").concat(a," time:").concat(s," direction:").concat(i),u=(d.l("".concat(n," ").concat(c)),new D("getRoamingMessagesHopping"));return this.req({P:h.GET_C2C_ROAMING_MSG,data:{peerAccount:o,lastMessageTime:s,messageKey:this._gethHoppingMsgKey({conversationID:r,time:s,direction:i}),count:a,direction:i}}).then(function(M){var M=M.data,_=M.complete,m=M.messageList,m=m===void 0?[]:m,f=M.lastMessageTime,M=M.messageKey,I="complete:".concat(_," count:").concat(m.length),I=(d.l("".concat(n," ok. ").concat(I)),u.setMessage("".concat(c," ").concat(I)).end(),"".concat(r,"-").concat(i)),C=(t._hoppingMsgKeyMap.set(I,{lastMessageTime:f,messageKey:M}),_===1&&t._hoppingMsgKeyMap.delete(I),t.get(11)),M=C.onRoamingMessage(m,r,!1),S=(t._modifyMessageList(r,M),t._computeResult({complete:_,lastMessageTime:f,resultList:M})),L=(C.storeHoppingMessageList(S.messageList),C.getPeerReadTime(r));return d.l("".concat(n," update isPeerRead property. convID:").concat(r," peerReadTime:").concat(L)),L?(C.updateMsgIsPeerReadProp(r,L),t._updateIsPeerReadByHopping(S,L),N(S)):(I=r.replace(g.CONV_C2C,""),t.getRemotePeerReadTime([I]).then(function(){return C.updateMsgIsPeerReadProp(r,C.getPeerReadTime(r)),t._updateIsPeerReadByHopping(S,L),N(S)}))}).catch(function(l){return u.setMessage(c).setError(l).end(),d.w("".concat(n," failed. error:"),l),v(l)})}},{key:"_gethHoppingMsgKey",value:function(o){var n=o.conversationID,t=o.time,o=o.direction,n="".concat(n,"-").concat(o),o=this._hoppingMsgKeyMap.get(n)||{},n=o.lastMessageTime,o=o.messageKey;return t!==n||o===void 0?"":o}},{key:"_computeResult",value:function(o){var t=o.complete,t=t===void 0?0:t,n=o.lastMessageTime,o=o.resultList,o={messageList:G(o===void 0?[]:o),isCompleted:!1,nextMessageTime:""};return t===1?o.isCompleted=!0:o.nextMessageTime=n,o}},{key:"_updateIsPeerReadByHopping",value:function(e,t){for(var e=e.messageList,n=e===void 0?[]:e,o=0;o<n.length;o++){var s=n[o];s.time<=t&&!s.isPeerRead&&s.flow==="out"&&(s.isPeerRead=!0)}}},{key:"_modifyMessageList",value:function(e,t){if(e=this.get(11).getLocalConversation(e),e)for(var n=e.userProfile.nick,o=e.userProfile.avatar,e=this.get(4).getNickAndAvatarByUserID(this.getMyUserID()),s=e.nick,a=e.avatar,i=t.length-1;0<=i;i--){var r=t[i];r.flow==="in"&&(r.nick!==n&&r.setNickAndAvatar({nick:n}),r.avatar!==o)&&r.setNickAndAvatar({avatar:o}),r.flow==="out"&&(r.nick!==s&&r.setNickAndAvatar({nick:s}),r.avatar!==a)&&r.setNickAndAvatar({avatar:a})}}},{key:"getRemotePeerReadTime",value:function(e){var t,n=this,o="".concat(this._n,".").concat("getRemotePeerReadTime");return k(e)?Promise.resolve():(t=new D("getRemotePeerReadTime"),d.l("".concat(o," userIDList:").concat(e)),this.req({P:h.GET_C2C_PEER_READ_TIME,data:{userIDList:e}}).then(function(s){var a=s.data.peerReadTimeList;d.l("".concat(o," ok. peerReadTimeList:").concat(a));for(var i="",r=n.get(11),c=0;c<e.length;c++)i+="".concat(e[c],"-").concat(a[c]," "),0<a[c]&&r.recordPeerReadTime("".concat(g.CONV_C2C).concat(e[c]),a[c]);t.setMessage(i).end()}).catch(function(s){t.setError(s).end(),d.w("".concat(o," failed. error:"),s)}))}},{key:"sendReadReceipt",value:function(a){var t,n=a[0].conversationID.replace(g.CONV_C2C,""),o=new D("sendReadReceipt"),s=(o.setMessage("peerAccount:".concat(n)),this.getMyUserID()),a=a.filter(function(i){return i.from!==s&&i.needReadReceipt===!0}).map(function(i){return{fromAccount:i.from,toAccount:i.to,sequence:i.sequence,random:i.random,time:i.time,clientTime:i.clientTime}});return a.length===0?v({code:y.READ_RECEIPT_MSG_LIST_EMPTY}):(t="".concat(this._n,".").concat("sendReadReceipt"),d.l("".concat(t,". peerAccount:").concat(n," length:").concat(a.length)),this.req({P:h.SEND_C2C_READ_RECEIPT,data:{peerAccount:n,messageInfoList:a}}).then(function(i){return o.end(),d.l("".concat(t," ok")),N()}).catch(function(i){return o.setError(i).end(),d.w("".concat(t," failed. error:"),i),v(i)}))}},{key:"getReadReceiptList",value:function(e){var t=e[0].conversationID.replace(g.CONV_C2C,"");return d.l("".concat(this._n,".getReadReceiptList peerAccount:").concat(t," msgCount:").concat(e.length)),q({messageList:e})}},{key:"getMessageExtensions",value:function(e,t){return d.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:h.GET_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1;return d.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:h.MODIFY_C2C_MSG_EXT,data:{from:e.from,to:e.to,messageKey:this.getMessageKey(e),extensionList:t,operateType:n}})}},{key:"getMessageKey",value:function(o){var t=o.clientSequence,n=o.random,o=o.time;return"".concat(t,"_").concat(n,"_").concat(o)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._msgFromUnreadDBMap.clear(),this._noticeFromUnreadDBList.length=0,this._hoppingMsgKeyMap.clear()}}]),ne={A2KEY_AND_TINYID_UPDATED:"_inner".concat(1),CLOUD_CONFIG:"_inner".concat(2),PROFILE_UPDATED:"_inner".concat(3),CONV_SYNC_COMPLETED:"_inner".concat(4),C2C_UNREAD_HANDLE_COMPLETED:"_inner".concat(5)},Ci=b(function e(t){U(this,e),this._convM=t,this._map=new Map,this._n="MsgListHandler",this._latestMsgSentByPeerMap=new Map,this._latestMsgSentByMeMap=new Map,this._hoppingMsgMap=new Map,this.TOPIC_MSG_LIMIT=1e3,this._convM.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this._convM.getCloudConfig("topic_msg_limit");T(e)||(this.TOPIC_MSG_LIMIT=Number(e)),d.l("".concat(this._n,"._onCloudConfig topicMsgLimit:").concat(this.TOPIC_MSG_LIMIT))}},{key:"onCheckTimer",value:function(e){if(e%20==0&&0<this._map.size){var t,n=Se(this._map);try{for(n.s();!(t=n.n()).done;){var o=ke(t.value,2),s=o[0],a=o[1];s.includes(En)&&a.size>=this.TOPIC_MSG_LIMIT&&this._convM.clearMemMsg(s,!0)}}catch(i){n.e(i)}finally{n.f()}}}},{key:"pushIn",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0&&arguments[1],n=e.conversationID,o=!0,s=(this._map.has(n)||this._map.set(n,new Map),this._getUniqueIDOfMsg(e));if(this._map.get(n).has(s)){var a=this._map.get(n).get(s);if(!t||a.isModified===!0)return!1}return this._map.get(n).set(s,e),this._setLatestMsgSentByPeer(n,e),this._setLatestMsgSentByMe(n,e),o}},{key:"unshift",value:function(e,t){var n;if(O(e)?0<e.length&&(n=e[0].conversationID,this._unshiftMultipleMsgs(e,t)):(n=e.conversationID,this._unshiftSingleMsg(e,t)),n){var o=Array.from(this._map.get(n).values()),e=o.length;if(e!==0){for(var s=e-1;0<=s;s--)if(o[s].flow==="out"){this._setLatestMsgSentByMe(n,o[s]);break}if(n.startsWith(g.CONV_C2C)){for(var a=e-1;0<=a;a--)if(o[a].flow==="in"){this._setLatestMsgSentByPeer(n,o[a]);break}}}}}},{key:"_unshiftSingleMsg",value:function(e,t){var n,o,s=e.conversationID,a=this._getUniqueIDOfMsg(e);this._map.has(s)?(n=this._map.get(s),o=Array.from(n),n.has(a)||(o.unshift([a,e]),this._map.set(s,new Map(o)),t.push(e))):(this._map.set(s,new Map),this._map.get(s).set(a,e),t.push(e))}},{key:"_unshiftMultipleMsgs",value:function(e,t){for(var n=e.length,o=[],s=e[0].conversationID,a=this._map.get(s),i=this._map.has(s)?Array.from(a):[],r=0;r<n;r++){var c=this._getUniqueIDOfMsg(e[r]);a&&a.has(c)||(o.push([c,e[r]]),t.push(e[r]))}this._map.set(s,new Map(o.concat(i)))}},{key:"remove",value:function(n){var t=n.conversationID,n=this._getUniqueIDOfMsg(n);this._map.has(t)&&this._map.get(t).delete(n)}},{key:"revoke",value:function(e,t,n){var o;return this._map.has(e)?(o=this._map.get(e),this._updateMsgIsRevoked(o,t,n)):this._hoppingMsgMap.has(e)?(o=this._hoppingMsgMap.get(e),this._updateMsgIsRevoked(o,t,n)):null}},{key:"_updateMsgIsRevoked",value:function(e,t,n){var o,s=Se(e);try{for(s.s();!(o=s.n()).done;){var a=ke(o.value,2)[1];if(a.sequence===t&&(T(n)||a.random===n))return a.isRevoked||(a.isRevoked=!0),a}}catch(i){s.e(i)}finally{s.f()}}},{key:"removeByConvID",value:function(e){var t=this._map.has(e);d.l("".concat(this._n,".removeByConvID convID:").concat(e," has:").concat(t)),t&&(this._map.delete(e),this._latestMsgSentByPeerMap.delete(e),this._latestMsgSentByMeMap.delete(e))}},{key:"findMessage",value:function(e){return this._findMsg(e,this._map)||this._findMsg(e,this._hoppingMsgMap)}},{key:"_findMsg",value:function(e,t){var n,o=null,s=Se(t);try{for(s.s();!(n=s.n()).done;)for(var a=G(ke(n.value,2)[1].values()),i=a.length,r=0;r<i;r++)if(a[r].ID===e){o=a[r];break}}catch(c){s.e(c)}finally{s.f()}return o}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n,o=[];return this._map.has(e)?(n=this._map.get(e),o=this._updateMsgIsPeerReadProp(n,t)):this._hoppingMsgMap.has(e)&&(n=this._hoppingMsgMap.get(e),o=this._updateMsgIsPeerReadProp(n,t)),d.l("".concat(this._n,".updateMsgIsPeerReadProp convID:").concat(e," peerReadTime:").concat(t," count:").concat(o.length)),o}},{key:"_updateMsgIsPeerReadProp",value:function(e,t){var n,o=[],s=Se(e);try{for(s.s();!(n=s.n()).done;){var a=ke(n.value,2)[1];a.time<=t&&!a.isPeerRead&&a.flow==="out"&&(a.isPeerRead=!0,o.push(a))}}catch(i){s.e(i)}finally{s.f()}return o}},{key:"updateMsgIsModifiedProp",value:function(e){var t=e.conversationID;this._map.has(t)&&(e=this._getUniqueIDOfMsg(e),t=this._map.get(t).get(e))&&(t.isModified=!0)}},{key:"hasLocalMsgList",value:function(e){return this._map.has(e)}},{key:"getLocalMsgList",value:function(e){return this.hasLocalMsgList(e)?G(this._map.get(e).values()):[]}},{key:"getLocalMaxSeq",value:function(e){return this.hasLocalMsgList(e)?(e=G(this._map.get(e).values()).map(function(t){return t.sequence}),Math.max.apply(Math,G(e))):0}},{key:"getLocalMaxTime",value:function(e){return this.hasLocalMsgList(e)?(e=G(this._map.get(e).values()).map(function(t){return t.time}),Math.max.apply(Math,G(e))):0}},{key:"hasLocalMsg",value:function(e,t){for(var n=!1,o=this.getLocalMsgList(e),s=o.length,a=0;a<s;a++)o[a].ID===t&&(n=!0);return n}},{key:"getLocalMsg",value:function(e,t){for(var n=null,o=this.getLocalMsgList(e),s=o.length,a=0;a<s;a++)if(o[a].ID===t){n=o[a];break}return n}},{key:"getLocalLastMsg",value:function(e){for(var t=this.getLocalMsgList(e),n=void 0,o=t.length-1;0<=o;o--)if(t[o].status===je){n=t[o];break}return n}},{key:"getLocalSecondLastMsg",value:function(e){return e=this.getLocalMsgList(e),e[e.length-2]}},{key:"getLocalOldestMsg",value:function(e){return this.getLocalMsgList(e)[0]}},{key:"_setLatestMsgSentByPeer",value:function(e,t){e.startsWith(g.CONV_C2C)&&t.flow==="in"&&this._latestMsgSentByPeerMap.set(e,t)}},{key:"_setLatestMsgSentByMe",value:function(e,t){t.flow==="out"&&this._latestMsgSentByMeMap.set(e,t)}},{key:"getLatestMsgSentByPeer",value:function(e){return this._latestMsgSentByPeerMap.get(e)}},{key:"getLatestMsgSentByMe",value:function(e){return this._latestMsgSentByMeMap.get(e)}},{key:"modifyMsgSentByPeer",value:function(s){var t=s.conversationID,n=s.latestNick,o=s.latestAvatar,s=this._map.get(t);if(!k(s)){var a=Array.from(s.values()),s=a.length;if(s!==0){for(var i=null,r=0,c=!1,u=s-1;0<=u;u--)a[u].flow==="in"&&((i=a[u]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c)&&(r+=1);d.l("".concat(this._n,".modifyMsgSentByPeer convID:").concat(t," count:").concat(r))}}}},{key:"modifyMsgSentByMe",value:function(s){var t=s.conversationID,n=s.latestNick,o=s.latestAvatar,s=this._map.get(t);if(!k(s)){var a=Array.from(s.values()),s=a.length;if(s!==0){for(var i=null,r=0,c=!1,u=s-1;0<=u;u--)a[u].flow==="out"&&((i=a[u]).nick!==n&&(i.setNickAndAvatar({nick:n}),c=!0),i.avatar!==o&&(i.setNickAndAvatar({avatar:o}),c=!0),c)&&(r+=1);d.l("".concat(this._n,".modifyMsgSentByMe convID:").concat(t," count:").concat(r))}}}},{key:"getTopicConvIDList",value:function(e){return G(this._map.keys()).filter(function(t){return t.startsWith("".concat(g.CONV_GROUP).concat(e))})}},{key:"onMsgModified",value:function(e,t){var n,o,s,a;return(this._map.has(e)||this._hoppingMsgMap.has(e))&&(n="".concat(this._n,".onMsgModified"),s=this._getUniqueIDOfMsg(t),a=!!(o=this._getTargetMsg(e,s)),d.l("".concat(n," convID:").concat(e," uniqueID:").concat(s," has:").concat(a)),a)?(e=t.messageVersion,s=t.elements,a=t.cloudCustomData,t=t.checkResult,d.l("".concat(n," localVersion:").concat(o.version," remoteVersion:").concat(e)),o.version<e?(o.version=e,o._elements=JSON.parse(JSON.stringify(s)),o.payload=o._elements[0].content,o.type=o._elements[0].type,o.cloudCustomData=a,o.isModified=!0,o.hasRiskContent=ca(t),{isUpdated:!0,message:o}):{isUpdated:!1,message:o}):{isUpdated:!1,message:null}}},{key:"_getUniqueIDOfMsg",value:function(a){var t=a.from,n=a.to,o=a.random,s=a.sequence,a=a.time;return"".concat(t,"-").concat(n,"-").concat(o,"-").concat(s,"-").concat(a)}},{key:"_getTargetMsg",value:function(e,t){if(this._map.has(e))return this._map.get(e).get(t);var n=void 0;if(this._hoppingMsgMap.has(e)){for(var o=G(this._hoppingMsgMap.get(e).values()),s=0;s<o.length;s++)if(this._getUniqueIDOfMsg(o[s])===t){n=o[s];break}}return n}},{key:"storeHoppingMsgList",value:function(e){if(e.length!==0){var t=e[0].conversationID,n=e.length;this._hoppingMsgMap.has(t)||this._hoppingMsgMap.set(t,new Map);for(var o=this._hoppingMsgMap.get(t),s=0;s<n;s++){var a=e[s];o.has(a.ID)||o.set(a.ID,a)}}}},{key:"getHoppingMsg",value:function(e,t){if(this._hoppingMsgMap.has(e))return this._hoppingMsgMap.get(e).get(t)}},{key:"findMsgBySeq",value:function(e,t){var n=[];return this._map.has(e)&&n.push.apply(n,G(this._map.get(e).values())),this._hoppingMsgMap.has(e)&&n.push.apply(n,G(this._hoppingMsgMap.get(e).values())),n.find(function(o){return o.sequence===t})}},{key:"reset",value:function(){this._map.clear(),this._latestMsgSentByPeerMap.clear(),this._latestMsgSentByMeMap.clear(),this._hoppingMsgMap.clear()}}]);function Bn(e){return U(this,Bn),(e=le(this,Bn,[e]))._n="C2CModule",e._msgFromUnreadDBMap=new Map,e._noticeFromUnreadDBList=[],e._hoppingMsgKeyMap=new Map,e}function Xo(e){this.mixin(e)}Xo.mixin=function(e){e=e.prototype||e,e._isReady=!1,e.ready=function(t){if(t)return this._isReady?void(1<arguments.length&&arguments[1]!==void 0&&arguments[1]?t.call(this):setTimeout(t,1)):(this._readyQueue=this._readyQueue||[],void this._readyQueue.push(t))},e.triggerReady=function(){var t=this;this._isReady=!0,setTimeout(function(){var n=t._readyQueue;t._readyQueue=[],n&&0<n.length&&n.forEach(function(o){o.call(this)},t)},1)},e.resetReady=function(){this._isReady=!1,this._readyQueue=[]},e.isReady=function(){return this._isReady}};function Ca(e,t,n){return T(e)?{lastTime:0,lastSequence:0,fromAccount:"",messageForShow:"",payload:null,type:"",isRevoked:!1,cloudCustomData:"",onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:!1,revoker:null}:n&&e.ID||e instanceof Ce?{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",messageForShow:on(e.type,e.payload,t),payload:e.payload||null,type:e.type||null,isRevoked:e.isRevoked||!1,cloudCustomData:e.cloudCustomData||"",onlineOnlyFlag:e._onlineOnlyFlag||!1,nick:e.nick||"",nameCard:e.nameCard||"",version:e.version||0,isPeerRead:e.isPeerRead||!1,revoker:e.revoker||null}:p(p({},e),{},{messageForShow:on(e.type,e.payload,t)})}function Ta(e,t){return k(e)?{lastTime:0,lastSequence:0,fromAccount:"",payload:null,type:"",messageForShow:"",nick:"",avatar:"",version:0,cloudCustomData:"",isRevoked:!1,revoker:null}:{lastTime:e.time||0,lastSequence:e.sequence||0,fromAccount:e.from||"",payload:e.payload||null,type:e.type||"",messageForShow:on(e.type,e.payload,t),nick:e.nick||"",avatar:e.avatar||"",version:e.version||0,cloudCustomData:e.cloudCustomData||"",isRevoked:e.isRevoked||!1,revoker:e.revoker||null}}function Hn(e){var t=String(e).replace(/[=]+$/,""),n="";if(t.length%4==1)return"";for(var o,s,a=0,i=0;s=t.charAt(i++);~s&&(o=a%4?64*o+s:s,a++%4)&&(n+=String.fromCharCode(255&o>>(-2*a&6))))s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(s);try{return decodeURIComponent(escape(n))}catch{return""}}var Ti=["jpg","jpeg","gif","png","bmp","image","webp"],Di=["mp4","quicktime","mov","video"],jt=b(function e(t){var n=this;U(this,e),k(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||g.ALLOW_TYPE_ALLOW_ANY,this.language=t.language||0,this.avatar=t.avatar||"",this.messageSettings=t.messageSettings||0,this.adminForbidType=t.adminForbidType||g.FORBID_TYPE_NONE,this.level=t.level||0,this.role=t.role||0,this.lastUpdatedTime=t.lastUpdatedTime||0,this.profileCustomField=[],k(t.profileCustomField))||t.profileCustomField.forEach(function(o){n.profileCustomField.push({key:o.key,value:o.value})})},[{key:"validate",value:function(e){var t,n=!0,o="";if(k(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var s=e.profileCustomField.length,a=null,i=0;i<s;i++){if(a=e.profileCustomField[i],!V(a.key)||a.key.indexOf("Tag_Profile_Custom")===-1)return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!V(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(t==="profileCustomField")continue;if(k(e[t])&&!V(e[t])&&!Y(e[t])){o="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":V(e[t])||(n=!(o="nick must be a string")),500<Ln(e[t])&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Ln(e[t])," bytes"),n=!1);break;case"gender":Gt(Hs,e.gender)||(o="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Y(e.birthday)||(n=!(o="birthday must be a number"));break;case"location":V(e.location)||(n=!(o="location must be a string"));break;case"selfSignature":V(e.selfSignature)||(n=!(o="selfSignature must be a string"));break;case"allowType":Gt(Ys,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Y(e.language)||(n=!(o="language must be a number"));break;case"avatar":V(e.avatar)||(n=!(o="avatar must be a string"));break;case"messageSettings":e.messageSettings!==0&&e.messageSettings!==1&&(n=!(o="messageSettings must be 0 or 1"));break;case"adminForbidType":Gt(Ks,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Y(e.level)||(n=!(o="level must be a number"));break;case"role":Y(e.role)||(n=!(o="role must be a number"));break;default:o="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:o}}}]),Zo=b(function e(t){U(this,e),this.MAX_LENGTH=t,this.map=new Map},[{key:"set",value:function(e){var t;this.map.size>=this.MAX_LENGTH&&(t=this.map.entries().next().value[0],this.map.delete(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:"reset",value:function(){this.map.clear()}}]),Ei=["groupID","name","avatar","type","introduction","notification","ownerID","selfInfo","createTime","infoSequence","lastInfoTime","lastMessage","nextMessageSeq","memberNum","maxMemberNum","memberList","joinOption","groupCustomField","muteAllMembers","isSupportTopic","inviteOption","_lastRevokedTime"],it=b(function e(t){U(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)},[{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)Ei.indexOf(t)<0||(t!=="selfInfo"?(t==="memberNum"&&(this.memberCount=e[t]),t==="maxMemberNum"&&(this.maxMemberCount=e[t]),t!=="isSupportTopic"?t==="muteAllMembers"&&V(e[t])?this.muteAllMembers=e[t]==="On":this[t]=e[t]:this.isSupportTopic=e[t]===1):this.updateSelfInfo(e[t]))}},{key:"updateGroup",value:function(n){var t=this,n=(n.appid=void 0,n.grossTopicNextMsgSeq=void 0,n.selfInfo&&(n.selfInfo.grossTopicReadSeq=void 0),JSON.parse(JSON.stringify(n)));n.lastMsgTime&&(this.lastMessage.lastTime=n.lastMsgTime),T(n.muteAllMembers)||(n.muteAllMembers==="On"?n.muteAllMembers=!0:n.muteAllMembers=!1),n.groupCustomField&&tn(this.groupCustomField,n.groupCustomField),T(n.memberNum)||(this.memberCount=n.memberNum),T(n.maxMemberNum)||(this.maxMemberCount=n.maxMemberNum),T(n.isSupportTopic)||(this.isSupportTopic=Y(n.isSupportTopic)?n.isSupportTopic===1:n.isSupportTopic),et(this,n,["members","errorCode","lastMsgTime","groupCustomField","memberNum","maxMemberNum","isSupportTopic"]),O(n.members)&&0<n.members.length&&n.members.forEach(function(o){o.userID===t.selfInfo.userID&&et(t.selfInfo,o,["sequence"])})}},{key:"updateSelfInfo",value:function(e){e={nameCard:e.nameCard,joinTime:e.joinTime,role:e.role,messageRemindType:e.messageRemindType,readedSequence:e.readedSequence,excludedUnreadSequenceList:e.excludedUnreadSequenceList},et(this.selfInfo,p({},e),[],["",null,void 0,0,NaN])}},{key:"setSelfNameCard",value:function(e){this.selfInfo.nameCard=e}}]),dn=b(function e(t,n){var o=2<arguments.length&&arguments[2]!==void 0&&arguments[2];U(this,e),this.conversationID=t.conversationID||"",this.unreadCount=t.unreadCount||0,this.type=t.type||"",this.lastMessage=Ca(t.lastMessage,n,o),t.lastMsgTime&&(this.lastMessage.lastTime=t.lastMsgTime),this._isInfoCompleted=!1,this.peerReadTime=t.peerReadTime||0,this.groupAtInfoList=[],this.remark=t.remark||"",this.isPinned=t.isPinned||!1,this.messageRemindType=t.messageRemindType,this.markList=t.markList||[],this.customData=t.customData||"",this.conversationGroupList=t.conversationGroupList||[],this.draftText=t.draftText||"",this._initProfile(t),this.subType=this.groupProfile?this.groupProfile.type:""},[{key:"toAccount",get:function(){return this.conversationID.startsWith(g.CONV_C2C)?this.conversationID.replace(g.CONV_C2C,""):this.conversationID.startsWith(g.CONV_GROUP)?this.conversationID.replace(g.CONV_GROUP,""):""}},{key:"_initProfile",value:function(e){var t=this;Object.keys(e).forEach(function(n){switch(n){case"userProfile":t.userProfile=e.userProfile;break;case"groupProfile":t.groupProfile=e.groupProfile}}),T(this.userProfile)&&this.type===g.CONV_C2C?this.userProfile=new jt({userID:e.conversationID.replace("C2C","")}):T(this.groupProfile)&&this.type===g.CONV_GROUP&&(this.groupProfile=new it({groupID:e.conversationID.replace("GROUP","")}))}},{key:"updateUnreadCount",value:function(o){var t=o.nextUnreadCount,n=o.isFromGetConversations,o=o.isUnreadC2CMessage;T(t)||(be(this.subType)?this.unreadCount=0:n&&this.type===g.CONV_GROUP||n&&this.type===g.CONV_TOPIC||o&&this.type===g.CONV_C2C?this.unreadCount=t:this.unreadCount=this.unreadCount+t)}},{key:"updateLastMessage",value:function(e){this.lastMessage=Ca(e)}},{key:"updateGroupAtInfoList",value:function(e){var t;this._isNeedMergeGroupAtInfo(e)||((t=(vn(t=e.groupAtType)||vs(t)||yn(t)||Is()).slice(0)).indexOf(g.CONV_AT_ME)!==-1&&t.indexOf(g.CONV_AT_ALL)!==-1&&(t=[g.CONV_AT_ALL_AT_ME]),t={from:e.from,groupID:e.groupID,topicID:e.topicID,messageSequence:e.sequence,atTypeArray:t,__random:e.__random,__sequence:e.__sequence},this.groupAtInfoList.push(t))}},{key:"_isNeedMergeGroupAtInfo",value:function(e){var t,n=e.groupID,o=e.sequence;return!!we({groupID:n})&&(t=!1,this.groupAtInfoList.forEach(function(s){s.messageSequence===o&&(-1<s.atTypeArray.indexOf(g.CONV_AT_ME)&&-1<e.groupAtType.indexOf(g.CONV_AT_ALL)&&(s.atTypeArray=[g.CONV_AT_ALL_AT_ME]),-1<s.atTypeArray.indexOf(g.CONV_AT_ALL)&&-1<e.groupAtType.indexOf(g.CONV_AT_ME)&&(s.atTypeArray=[g.CONV_AT_ALL_AT_ME],s.__random=e.__random,s.__sequence=e.__sequence),t=!0)}),t)}},{key:"clearGroupAtInfoList",value:function(){this.groupAtInfoList.length=0}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!0)}},{key:"isLastMessageRevoked",value:function(n){var t=n.sequence,n=n.time;return this.type===g.CONV_C2C&&t===this.lastMessage.lastSequence&&n===this.lastMessage.lastTime||this.type===g.CONV_GROUP&&t===this.lastMessage.lastSequence}},{key:"setLastMessageRevoked",value:function(e){this.lastMessage.isRevoked=e}},{key:"setLastMessageRevoker",value:function(e){this.lastMessage.revoker=e}},{key:"setDraftText",value:function(e){this.draftText=e}}]),Da=Ge(Ge(Ge({},g.MSG_REMIND_ACPT_AND_NOTE,0),g.MSG_REMIND_DISCARD,1),g.MSG_REMIND_ACPT_NOT_NOTE,2),Li=b(function e(t){U(this,e),this._convM=t,this._n="MsgRemindHandler"},[{key:"onAllRcvMsgOptNotify",value:function(e){e=this._handleResult(e),this._convM.emitOEvt(F.ALL_RECEIVE_MESSAGE_OPT_UPDATED,e)}},{key:"getC2CMsgRemindType",value:function(e){var t=this,n="".concat(this._n,".getC2CMsgRemindType");return this._convM.req({P:h.GET_C2C_PEER_MUTE_NOTIFICATIONS,data:{toAccount:this._convM.getMyUserID(),userIDList:e}}).then(function(o){d.l("".concat(n," ok. userIDList:").concat(e)),o=o.data.muteFlagList,t._convM.onC2CMsgRemindTypeFetched(o)}).catch(function(o){d.e("".concat(n," failed. error:"),o)})}},{key:"set",value:function(e){return e.groupID?this._setGroupMsgRemindType(e):O(e.userIDList)?this._setC2CMsgRemindType(e):void 0}},{key:"_setGroupMsgRemindType",value:function(e){var t=this,n="".concat(this._n,".").concat("_setGroupMsgRemindType"),o=e.groupID,s=e.messageRemindType,a="groupID:".concat(o," messageRemindType:").concat(s),i=new D("_setGroupMsgRemindType"),r=(i.setMessage(a),this._get(7));return r?r.modifyGroupMemberInfo({groupID:o,messageRemindType:s,userID:this._convM.getMyUserID()}).then(function(){i.end(),d.l("".concat(n," ok. ").concat(a));var c=t.onGroupMsgRemindTypeUpdated(e);return t._convM.onTotalUnreadCountUpdate(),N(c)}).catch(function(c){return i.setError(c).end(),d.e("".concat(n," failed. error:"),c),v(c)}):v({code:y.NO_MODULE})}},{key:"onGroupMsgRemindTypeUpdated",value:function(s){var t,n,o=s.groupID,s=s.messageRemindType,a=(d.l("".concat(this._n,".onGroupMsgRemindTypeUpdated groupID:").concat(o," messageRemindType:").concat(s)),this._get(7).getLocalGroupProfile(o));return a&&(a.selfInfo.messageRemindType=s),he(o)?(t=_e(n=o),(n=this._get(10).getLocalTopic(t,n))&&n.updateSelfInfo({messageRemindType:s})&&this._convM.emitOEvt(F.TOPIC_UPDATED,{groupID:t,topic:n}),{topic:n}):(this._convM.patchMsgRemindType({ID:o,isC2CConversation:!1,messageRemindType:s})&&this._emitConvUpdate(),{group:a})}},{key:"_setC2CMsgRemindType",value:function(i){var t=this,n="".concat(this._n,".").concat("_setC2CMsgRemindType"),o=i.userIDList,s=i.messageRemindType,a=o.slice(0,30),i=Da[s]||0,r="userIDList:".concat(a," messageRemindType:").concat(s),c=new D("_setC2CMsgRemindType");return c.setMessage(r),this._convM.req({P:h.SET_C2C_PEER_MUTE_NOTIFICATIONS,data:{userIDList:a,muteFlag:i}}).then(function(m){c.end();var m=m.data.errorList,l=[],_=[],m=(O(m)&&m.forEach(function(I){l.push(I.userID),_.push({userID:I.userID,code:I.errorCode})}),a.filter(function(I){return l.indexOf(I)===-1})),f=(d.l("".concat(n," ok. ").concat(r," successUserIDList:").concat(m," failureUserIDList:").concat(JSON.stringify(_))),0);return m.forEach(function(I){t._convM.patchMsgRemindType({ID:I,isC2CConversation:!0,messageRemindType:s})&&(f+=1)}),1<=f&&t._emitConvUpdate(),a.length=l.length=0,t._convM.onTotalUnreadCountUpdate(),q({successUserIDList:m.map(function(I){return{userID:I}}),failureUserIDList:_})}).catch(function(u){return c.setError(u).end(),d.e("".concat(n," failed. error:"),u),v(u)})}},{key:"_get",value:function(e){return this._convM.get(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"setAllRcvMsgOpt",value:function(i){var t="".concat(this._n,".").concat("setAllRcvMsgOpt"),n=i.messageRemindType,n=n===void 0?g.MSG_REMIND_ACPT_NOT_NOTE:n,o=i.isRepeated,o=o===void 0||o,a=this._calcStartAndEndTime(i),s=a.startTime,s=s===void 0?0:s,a=a.endTime,a=a===void 0?0:a,i=JSON.stringify(i),r=new D("setAllRcvMsgOpt");return r.setMessage(i),d.l("".concat(t," options:").concat(i)),this._convM.req({P:h.SET_ALL_RECEIVE_MSG_OPT,data:{messageRemindType:Da[n],startTime:s,endTime:a,isRepeated:o?1:0}}).then(function(c){return r.end(),d.l("".concat(t," ok.")),N(c)}).catch(function(c){return r.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})}},{key:"_calcStartAndEndTime",value:function(a){var t=a.startHour,t=t===void 0?0:t,n=a.startMinute,n=n===void 0?0:n,o=a.startSecond,o=o===void 0?0:o,s=a.duration,s=s===void 0?0:s,a=a.isRepeated,a=a===void 0||a,r=new Date,c=r.getFullYear(),i=r.getMonth(),r=r.getDate(),c=Math.round(new Date(c,i,r,t,n,o).getTime()/1e3);return{startTime:c,endTime:a&&86400<=s?c+86400:c+s}}},{key:"getAllRcvMsgOpt",value:function(){var e=this,t="".concat(this._n,".").concat("getAllRcvMsgOpt"),n=new D("getAllRcvMsgOpt");return this._convM.req({P:h.GET_ALL_RECEIVE_MSG_OPT,data:{toAccount:this._convM.getMyUserID()}}).then(function(o){return o=o.data,n.setMessage(JSON.stringify(o)).end(),d.l("".concat(t," ok. data:").concat(JSON.stringify(o))),o=e._handleResult(o),N(o)}).catch(function(o){return n.setError(o).end(),d.e("".concat(t," failed. error:"),o),v(o)})}},{key:"_handleResult",value:function(s){var t=s.messageRemindType,n=s.startTime,o=s.endTime,s=s.isRepeated,a=g.MSG_REMIND_ACPT_AND_NOTE;return t===1&&(a=g.MSG_REMIND_DISCARD),{messageRemindType:a=t===2?g.MSG_REMIND_ACPT_NOT_NOTE:a,startTime:n,endTime:o,isRepeated:s===1}}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}]),Si=b(function e(t){U(this,e),this._convM=t,this._n="ConvGroupHandler",this._convGroupMap=new Map,this._startIndex=0,this._pagingStatus=pt},[{key:"setConvCustomData",value:function(e){var t=this,n="".concat(this._n,".").concat("setConvCustomData"),o=e.conversationIDList,s=e.customData,a=(d.l("".concat(n," options:"),e),new D("setConvCustomData")),i=(a.setMessage(JSON.stringify(e)),{fromAccount:this._getMyUserID(),itemList:[]}),r=[],c=[];return o.forEach(function(u){var l;return t._hasLocalConv(u)?Oe(u)||xe(u)?(l={operationType:2,contactItem:void 0,customMark:s},Oe(u)?l.contactItem={type:1,toAccount:u.replace(g.CONV_C2C,"")}:xe(u)&&(l.contactItem={type:2,groupID:u.replace(g.CONV_GROUP,"")}),void i.itemList.push(l)):(t._onConvIDInvalid(c,u),!0):(t._onConvNotFound(c,u),!0)}),c.length===o.length?q({successConversationIDList:r,failureConversationIDList:c}):this._convM.req({P:h.SET_CONV_CUSTOM_DATA,data:i}).then(function(f){a.end(),d.l("".concat(n," ok"));var l,_,m,f=f.data.resultItem;return O(f)&&(m=!1,f.forEach(function(I){l=t._concatConvID(I.contactItem),I.resultCode===0?(r.push(l),(_=t._getLocalConv(l))&&_.customData!==s&&(_.customData=s,m=!0)):c.push({conversationID:l,code:I.resultCode,message:I.resultInfo})}),m===!0)&&t._emitConvUpdate(),N({successConversationIDList:r,failureConversationIDList:c})}).catch(function(u){return a.setError(u).end(),d.e("".concat(n," failed. error:"),u),v(u)})}},{key:"markConv",value:function(e){var t,n,o,s,a,i,r,c,u,l,_=this;return this._convM.canIUse(ee.CONV_MARK)?(t="".concat(this._n,".").concat("markConv"),n=e.conversationIDList,o=e.markType,s=e.enableMark,d.l("".concat(t," options:"),e),a=new D("markConv"),i=void a.setMessage(JSON.stringify(e)),r=void 0,e=this._getFlagBit(o),s===!0?r=[e]:i=[e],c={fromAccount:this._getMyUserID(),itemList:[]},u=[],l=[],n.forEach(function(m){var f;return _._hasLocalConv(m)?Oe(m)||xe(m)?(f={operationType:1,contactItem:void 0,clearMark:i,setMark:r},Oe(m)?f.contactItem={type:1,toAccount:m.replace(g.CONV_C2C,"")}:xe(m)&&(f.contactItem={type:2,groupID:m.replace(g.CONV_GROUP,"")}),void c.itemList.push(f)):(_._onConvIDInvalid(l,m),!0):(_._onConvNotFound(l,m),!0)}),l.length===n.length?q({successConversationIDList:u,failureConversationIDList:l}):this._convM.req({P:h.MARK_CONV,data:c}).then(function(M){a.end(),d.l("".concat(t," ok"));var f,I,C,M=M.data.resultItem;return O(M)&&(C=!1,M.forEach(function(S){var L;f=_._concatConvID(S.contactItem),S.resultCode===0?(u.push(f),(I=_._getLocalConv(f))&&(L=I.markList.indexOf(o),s===!0?L===-1&&(I.markList.push(o),C=!0):L!==-1&&(I.markList.splice(L,1),C=!0))):l.push({conversationID:f,code:S.resultCode,message:S.resultInfo})}),C===!0)&&_._emitConvUpdate(),N({successConversationIDList:u,failureConversationIDList:l})}).catch(function(m){return a.setError(m).end(),d.e("".concat(t," failed. error:"),m),v(m)})):this._convM.noUse("markConv")}},{key:"getLocalConvGroupList",value:function(){var e=this;return d.l("".concat(this._n,".getLocalConvGroupList pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===Vt?this.getRemoteConvGroupList().then(function(){return N(G(e._convGroupMap.values()))}):q(G(this._convGroupMap.values()))}},{key:"searchConvGroupAndMark",value:function(e,t){var n=this,o="".concat(this._n,".searchConvGroupAndMark"),s=[];return e.forEach(function(a){t===1?s.push({type:1,toAccount:a}):t===2&&s.push({type:2,groupID:a})}),d.l("".concat(o," type:").concat(t," list:"),e),this._convM.req({P:h.SEARCH_CONV_GRP_MARK,data:{fromAccount:this._getMyUserID(),contactItem:s}}).then(function(r){var r=r.data,i=r.contactItem,r=r.groupItem;d.l("".concat(o," ok. contactItem:"),i,"groupItem:",r),n._fillConvGroupMap(r),n._handleContactItem(i),n._emitConvUpdate()}).catch(function(a){d.w("".concat(o," failed. error:"),a)})}},{key:"_fillConvGroupMap",value:function(e){var t=this;O(e)&&e.forEach(function(s){var o=s.convGroupID,s=s.groupName;t._convGroupMap.set(o,s)})}},{key:"_handleContactItem",value:function(e){var t,n=this;O(e)&&e.forEach(function(o){var s=[],a=o.standardMark,i=o.customData,r=o.convGroupIDList;O(r)&&r.forEach(function(c){n._convGroupMap.has(c)&&s.push(n._convGroupMap.get(c))}),t=n._concatConvID(o),(t=n._getLocalConv(t))&&(t.markList=kn(a),t.customData=i||"",t.conversationGroupList=[].concat(s))})}},{key:"getRemoteConvGroupList",value:function(){var e=this,t="".concat(this._n,".getRemoteConvGroupList");return this._pagingStatus=ha,this._convM.req({P:h.GET_CONV_GRP_LIST,data:{fromAccount:this._getMyUserID(),startIndex:this._startIndex}}).then(function(i){var i=i.data,o=i.completeFlag,s=i.contactItem,a=i.nextStartIndex,a=a===void 0?0:a,i=i.groupItem;if(e._startIndex=a,d.l("".concat(t," completeFlag:").concat(o," nextStartIndex:").concat(a,", groupItem:"),i,"contactItem:",s),e._fillConvGroupMap(i),e._handleContactItem(s),o===0)return e.getRemoteConvGroupList();o===1&&(e._pagingStatus=cn,e._emitConvUpdate(),e._emitConvGroupListUpdate())}).catch(function(n){e._pagingStatus=Vt,d.w("".concat(t," failed. error:"),n)})}},{key:"createConvGroup",value:function(e){var t,n,o,s,a,i,r=this;return this._convM.canIUse(ee.CONV_GROUP)?(t="".concat(this._n,".").concat("createConvGroup"),d.l("".concat(t," options:"),e),(n=new D("createConvGroup")).setMessage(JSON.stringify(e)),o=e.groupName,e=e.conversationIDList,s={fromAccount:this._getMyUserID(),itemList:[{groupName:o,contactItem:[]}]},a=[],i=[],e.forEach(function(c){return r._hasLocalConv(c)?Oe(c)||xe(c)?void(Oe(c)?s.itemList[0].contactItem.push({type:1,toAccount:c.replace(g.CONV_C2C,"")}):xe(c)&&s.itemList[0].contactItem.push({type:2,groupID:c.replace(g.CONV_GROUP,"")})):(r._onConvIDInvalid(i,c),!0):(r._onConvNotFound(i,c),!0)}),i.length===e.length?q({successConversationIDList:a,failureConversationIDList:i}):this._convM.req({P:h.CREATE_CONV_GRP,data:s}).then(function(f){n.end(),d.l("".concat(t," ok"));var u,l,_,f=f.data.groupResultItem[0],m=f.groupItem,f=f.resultItem;return Q(m)&&(r._convGroupMap.set(m.convGroupID,m.groupName),r._emitConvGroupListUpdate()),O(f)&&(_=!1,f.forEach(function(I){u=r._concatConvID(I.contactItem),I.resultCode===0?(a.push(u),(l=r._getLocalConv(u))&&l.conversationGroupList.indexOf(o)===-1&&(l.conversationGroupList.push(o),_=!0)):i.push({conversationID:u,code:I.resultCode,message:I.resultInfo})}),_===!0)&&(r._emitConvUpdate(),r._emitConvGroupListUpdate()),N({successConversationIDList:a,failureConversationIDList:i})}).catch(function(c){return n.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})):this._convM.noUse("createConvGroup")}},{key:"deleteConvGroup",value:function(e){var t,n,o=this;return this._convM.canIUse(ee.CONV_GROUP)?(t="".concat(this._n,".").concat("deleteConvGroup"),d.l("".concat(t," groupName:").concat(e)),(n=new D("deleteConvGroup")).setMessage(e),this._convM.req({P:h.DEL_CONV_GRP,data:{fromAccount:this._getMyUserID(),groupName:[e]}}).then(function(i){n.end(),d.l("".concat(t," ok"));var a,i=i.data.groupItem;O(i)&&(a=!1,i.forEach(function(r){o._convGroupMap.has(r.convGroupID)&&(o._convGroupMap.delete(r.convGroupID),a=!0)}),a===!0)&&o._emitConvGroupListUpdate(),o._eraseFromConversationGroupList([e])}).catch(function(s){return n.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})):this._convM.noUse("deleteConvGroup")}},{key:"renameConvGroup",value:function(e){var t,n,o,s,a=this;return this._convM.canIUse(ee.CONV_GROUP)?(t="".concat(this._n,".").concat("renameConvGroup"),d.l("".concat(t," options:"),e),(n=new D("renameConvGroup")).setMessage(JSON.stringify(e)),o=e.oldName,s=e.newName,this._convM.req({P:h.RENAME_CONV_GRP,data:{fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:1,oldName:o,newName:s}}}).then(function(u){n.end(),d.l("".concat(t," ok")),u=u.data.updateGroupResult.convGroupID,a._convGroupMap.set(u,s),a._emitConvGroupListUpdate();var r,c,u=a._convM.getLocalConvList(),l=!1;u.forEach(function(_){r=_.conversationGroupList,(c=r.indexOf(o))!==-1&&(r.splice(c,1,s),l=!0)}),l===!0&&a._emitConvUpdate()}).catch(function(i){return n.setError(i).end(),d.e("".concat(t," failed. error:"),i),v(i)})):this._convM.noUse("renameConvGroup")}},{key:"addConvsToGroup",value:function(e){var t,n,o,s,a,i,r,c=this;return this._convM.canIUse(ee.CONV_GROUP)?(t="".concat(this._n,".").concat("addConvsToGroup"),d.l("".concat(t," options:"),e),(n=new D("addConvsToGroup")).setMessage(JSON.stringify(e)),o=e.conversationIDList,s=e.groupName,a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],r=[],o.forEach(function(u){return c._hasLocalConv(u)?Oe(u)||xe(u)?void(Oe(u)?a.updateGroup.updateItem.push({operationType:1,contactItem:{type:1,toAccount:u.replace(g.CONV_C2C,"")}}):xe(u)&&a.updateGroup.updateItem.push({operationType:1,contactItem:{type:2,groupID:u.replace(g.CONV_GROUP,"")}})):(c._onConvIDInvalid(r,u),!0):(c._onConvNotFound(r,u),!0)}),r.length===o.length?q({successConversationIDList:i,failureConversationIDList:r}):this._convM.req({P:h.ADD_CONV_TO_GRP,data:a}).then(function(f){n.end(),d.l("".concat(t," ok"));var l,_,m,f=f.data.updateGroupResult.contactResultItem;return O(f)&&(m=!1,f.forEach(function(I){l=c._concatConvID(I.contactItem),I.resultCode===0?(_=c._getLocalConv(l))&&_.conversationGroupList.indexOf(s)===-1&&(_.conversationGroupList.push(s),i.push(l),m=!0):r.push({conversationID:l,code:I.resultCode,message:I.resultInfo})}),m===!0)&&(c._emitConvUpdate(),c._emitConvInGroupUpdate(s)),N({successConversationIDList:i,failureConversationIDList:r})}).catch(function(u){return n.setError(u).end(),d.e("".concat(t," failed. error:"),u),v(u)})):this._convM.noUse("addConvsToGroup")}},{key:"deleteConvsFromGroup",value:function(e){var t,n,o,s,a,i,r,c=this,u="deleteConvsFromGroup";return this._convM.canIUse(ee.CONV_GROUP)?(t="".concat(this._n,".").concat(u),d.l("".concat(t," options:"),e),(n=new D(u)).setMessage(JSON.stringify(e)),o=e.conversationIDList,s=e.groupName,a={fromAccount:this._getMyUserID(),updateType:1,updateGroup:{updateGroupType:2,groupName:s,updateItem:[]}},i=[],r=[],o.forEach(function(l){return c._hasLocalConv(l)?Oe(l)||xe(l)?void(Oe(l)?a.updateGroup.updateItem.push({operationType:2,contactItem:{type:1,toAccount:l.replace(g.CONV_C2C,"")}}):xe(l)&&a.updateGroup.updateItem.push({operationType:2,contactItem:{type:2,groupID:l.replace(g.CONV_GROUP,"")}})):(c._onConvIDInvalid(r,l),!0):(c._onConvNotFound(r,l),!0)}),r.length===o.length?q({successConversationIDList:i,failureConversationIDList:r}):this._convM.req({P:h.DEL_CONV_FROM_GRP,data:a}).then(function(I){n.end(),d.l("".concat(t," ok"));var _,m,f,I=I.data.updateGroupResult.contactResultItem;return O(I)&&(f=!1,I.forEach(function(C){var M;_=c._concatConvID(C.contactItem),C.resultCode===0?(m=c._getLocalConv(_))&&(M=m.conversationGroupList.indexOf(s))!==-1&&(m.conversationGroupList.splice(M,1),i.push(_),f=!0):r.push({conversationID:_,code:C.resultCode,message:C.resultInfo})}),f===!0)&&(c._emitConvUpdate(),c._emitConvInGroupUpdate(s)),N({successConversationIDList:i,failureConversationIDList:r})}).catch(function(l){return n.setError(l).end(),d.e("".concat(t," failed. error:"),l),v(l)})):this._convM.noUse(u)}},{key:"onConvMarkUpdated",value:function(e){var t,n,o=this;k(e)||(d.l("".concat(this._n,".onConvMarkUpdated markItemList:"),e),n=!1,e.forEach(function(c){var a=c.recentContactItem,i=c.optType,r=c.standardMark,c=c.customMark;t=o._concatConvID(a),(t=o._getLocalConv(t))&&(i===1?n=o._diffStandardMark(t,r):i===2?n=o._diffCustomMark(t,c):i===3&&(a=o._diffStandardMark(t,r),i=o._diffCustomMark(t,c),n=a||i))}),n===!0&&this._emitConvUpdate())}},{key:"_diffStandardMark",value:function(e,n){var n=kn(n),o=!1;return(function(s,a){if(s!==a){if(!s||!a||s.length!==a.length)return!1;for(var i=0,r=s.length;i<r;i++)if(s[i]!==a[i])return!1}return!0})(e.markList,n)!==!0&&(e.markList=n,o=!0),o}},{key:"_diffCustomMark",value:function(e,t){var n=!1;return e.customData!==t&&t!==void 0&&(e.customData=t,n=!0),n}},{key:"onConvGroupCreated",value:function(e){var t=this,n=(d.l("".concat(this._n,".onConvGroupCreated resultList:"),e),!1),o=!1;O(e)&&(e.forEach(function(s){var c=s.msgGroupItem,a=c.groupID,i=c.groupName;t._convGroupMap.get(a)!==i&&(t._convGroupMap.set(a,i),o=!0);var r,c=s.msgRecentContactItem;O(c)&&c.forEach(function(u){r=t._concatConvID(u),(r=t._getLocalConv(r))&&r.conversationGroupList.indexOf(i)===-1&&(r.conversationGroupList.push(i),n=!0)})}),n===!0&&this._emitConvUpdate(),o===!0)&&this._emitConvGroupListUpdate()}},{key:"onConvGroupDeleted",value:function(e){var t,n=this,o=(d.l("".concat(this._n,".onConvGroupDeleted groupItemList:"),e),[]);O(e)&&(t=!1,e.forEach(function(i){var a=i.groupID,i=i.groupName;n._convGroupMap.has(a)&&(n._convGroupMap.delete(a),t=!0,o.push(i))}),t===!0)&&this._emitConvGroupListUpdate(),this._eraseFromConversationGroupList(o)}},{key:"_eraseFromConversationGroupList",value:function(e){k(e)||(this._convM.getLocalConvList().forEach(function(t){t.conversationGroupList=t.conversationGroupList.filter(function(n){return!e.includes(n)})}),this._emitConvUpdate())}},{key:"onConvGroupNameUpdated",value:function(e){d.l("".concat(this._n,".onConvGroupNameUpdated options:"),e);var t,n,o,s=e.groupID,a=e.groupName,i=e.oldGroupName;this._convGroupMap.get(s)!==a&&(this._convGroupMap.set(s,a),this._emitConvGroupListUpdate(),e=this._convM.getLocalConvList(),o=!1,e.forEach(function(r){t=r.conversationGroupList,(n=t.indexOf(i))!==-1&&(t.splice(n,1,a),o=!0)}),o===!0)&&this._emitConvUpdate()}},{key:"onConvInGroupUpdated",value:function(i){var t,n,o,s=this,a=(d.l("".concat(this._n,".onConvInGroupUpdated options:"),i),i.oldGroupName),i=i.recentContactUpdateGroupItem;O(i)&&(o=!1,i.forEach(function(u){var c=u.contactOptType,u=u.recentContactItem;t=s._concatConvID(u),(t=s._getLocalConv(t))&&(n=t.conversationGroupList.indexOf(a),c===1?n===-1&&(t.conversationGroupList.push(a),o=!0):c===2&&n!==-1&&(t.conversationGroupList.splice(n,1),o=!0))}),o===!0)&&(this._emitConvUpdate(),this._emitConvInGroupUpdate(a))}},{key:"onConvAddedToOrDeletedFromGroup",value:function(s){var t,n,o=this,a=(d.l("".concat(this._n,".onConvAddedToOrDeletedFromGroup options:"),s),s.msgRecentContactItem),s=s.msgRecentContactUpdateContactItem,a=this._concatConvID(a),i=this._getLocalConv(a);i&&O(s)&&(n=!1,s.forEach(function(u){var c=u.groupOptType,u=u.recentContactGroupItem.groupName;t=i.conversationGroupList.indexOf(u),c===1?t===-1&&(i.conversationGroupList.push(u),n=!0):c===2&&t!==-1&&(i.conversationGroupList.splice(t,1),n=!0),n===!0&&o._emitConvInGroupUpdate(u)}),n===!0)&&this._emitConvUpdate()}},{key:"onConvGroupListSynced",value:function(e){O(e)&&e.length!==0&&(d.l("".concat(this._n,".onConvGroupListSynced groupItem:"),e),this._fillConvGroupMap(e))}},{key:"getConvGroupListByID",value:function(e){var t,n=this;if(!k(e))return t=[],e.forEach(function(o){n._convGroupMap.has(o)&&t.push(n._convGroupMap.get(o))}),t}},{key:"_onConvNotFound",value:function(e,t){e.push({conversationID:t,code:y.CONV_NOT_FOUND,message:this._convM.getErrMsg(y.CONV_NOT_FOUND)})}},{key:"_onConvIDInvalid",value:function(e,t){e.push({conversationID:t,code:y.INVALID_CONV_ID,message:this._convM.getErrMsg(y.INVALID_CONV_ID)})}},{key:"_getFlagBit",value:function(e){for(var t=e.toString(2),n=t.length,o=n-1;0<=o;o--)if(t[o]==="1")return n-o-1}},{key:"_concatConvID",value:function(a){var t,n=a.type,o=a.to,s=a.groupID,a=a.userID;return n===1?T(a)?T(o)||(t="".concat(g.CONV_C2C).concat(o)):t="".concat(g.CONV_C2C).concat(a):n===2&&(t="".concat(g.CONV_GROUP).concat(s)),t}},{key:"_getMyUserID",value:function(){return this._convM.getMyUserID()}},{key:"_getLocalConv",value:function(e){return this._convM.getLocalConversation(e)}},{key:"_hasLocalConv",value:function(e){return this._convM.hasLocalConversation(e)}},{key:"_emitConvUpdate",value:function(){this._convM.emitConvUpdate(!0,!1)}},{key:"_emitConvGroupListUpdate",value:function(){this._convM.emitOEvt(F.CONVERSATION_GROUP_LIST_UPDATED,G(this._convGroupMap.values()))}},{key:"_emitConvInGroupUpdate",value:function(e){var t={groupName:e,conversationList:[]},n=this._convM.getLocalConvList();t.conversationList=n.filter(function(o){return o.conversationGroupList.includes(e)}),this._convM.emitOEvt(F.CONVERSATION_IN_GROUP_UPDATED,t)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._convGroupMap.clear(),this._startIndex=0,this._pagingStatus=pt}}]),ki=(de(Jn,ce),b(Jn,[{key:"_initListeners",value:function(){var e=this.getIEmitInst();e.on(ne.A2KEY_AND_TINYID_UPDATED,this._init,this),e.on(ne.PROFILE_UPDATED,this._onProfileUpdated,this),e.on(ne.CLOUD_CONFIG,this._onCloudConfig,this)}},{key:"_init",value:function(){var e=this,t=(d.l("".concat(this._n,"._init")),this.get(13).getItem("conversationMap")),n=this.isIntl(),o=this.isUsingChatCore();if(t){for(var s=t.length,a=0;a<s;a++){var i=t[a];i&&(this._isNonExistentAccount(i.conversationID)||i.groupProfile&&be(i.groupProfile.type))||this._convMap.set(i.conversationID,new dn(t[a],n,o))}this.emitConvUpdate(!0,!1)}this.ready(function(){0<e._tmpGroupList.length&&(e.updateConvGroupProfile(e._tmpGroupList),e._tmpGroupList.length=0)}),this.syncConvList()}},{key:"_isNonExistentAccount",value:function(e){var t;return(t=e.startsWith(g.CONV_C2C)?e.replace(g.CONV_C2C,""):t)==="@TLS#ERROR"||t==="@TLS#NOT_FOUND"}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&this._msgListHandler.onCheckTimer(e)}},{key:"onMessageSent",value:function(e){this._onSendOrRcvMsg({conversationOptionsList:e.conversationOptionsList,isInstantMessage:!0})}},{key:"onNewMessage",value:function(e){this._onSendOrRcvMsg(e)}},{key:"_onSendOrRcvMsg",value:function(e){var t=this,n=e.conversationOptionsList,o=e.isInstantMessage,o=o===void 0||o,s=e.isUnreadC2CMessage,s=s!==void 0&&s,a=e.updateUnreadCount,a=a===void 0||a,i=e.isSyncingEnded,i=i!==void 0&&i;this._isReady?n.length!==0?(o===!0&&this._checkNewConv(n),this._updateLocalConvList({conversationOptionsList:n,isInstantMessage:o,isUnreadC2CMessage:s,isFromGetConversations:!1,updateUnreadCount:a}),o||(this._convIDFromUnreadDBMap=new Map([].concat(G(this._convIDFromUnreadDBMap),G(n.map(function(r){return[r.conversationID,1]})))),this._diffAndDeleteConv(),i&&this.emitIEvt(ne.C2C_UNREAD_HANDLE_COMPLETED)),0<n.filter(function(r){return!t._isConvNeedShow(r.conversationID)}).length||this.emitConvUpdate()):i&&this.emitIEvt(ne.C2C_UNREAD_HANDLE_COMPLETED):this.ready(function(){t._onSendOrRcvMsg(e)})}},{key:"updateConvGroupProfile",value:function(e){var t,n=this;O(e)&&e.length===0||(this._convMap.size!==0?(t=!1,e.forEach(function(o){var s="".concat(g.CONV_GROUP).concat(o.groupID);n._convMap.has(s)&&(t=!0,(s=n._convMap.get(s)).groupProfile=JSON.parse(JSON.stringify(o)),s.lastMessage.lastSequence<o.nextMessageSeq&&(s.lastMessage.lastSequence=o.nextMessageSeq-1),s.subType||(s.subType=o.type))}),t&&this.emitConvUpdate(!0,!1)):this._tmpGroupList=e)}},{key:"onMessageRevoked",value:function(e,t){var n,o,s,a=this;e.length!==0&&(n=null,o=!1,s=[],e.forEach(function(i){(n=a._convMap.get(i.conversationID))&&(t&&n.reduceUnreadCount()&&(o=n.type!==g.CONV_TOPIC),n.type===g.CONV_TOPIC?s.push(i):n.isLastMessageRevoked({sequence:i.sequence,time:i.time})&&(n.setLastMessageRevoked(!0),n.setLastMessageRevoker(i.revoker),o=!0))}),this.get(10).onMessageRevoked(s),o)&&(this.emitConvUpdate(!0,!1),this._updateGroupLastMessage(e[0]))}},{key:"_updateGroupLastMessage",value:function(n){var t,n=n.conversationID;n.startsWith(g.CONV_GROUP)&&(n=this._convMap.get(n),t=this.get(7))&&t.updateGroupLastMessage([n])}},{key:"updateRevokerInfo",value:function(e){for(var t=new Set,n=0;n<e.length;n++){var o=e[n].revoker;t.add(o)}var s=G(t),a=this.get(4);return new Promise(function(i){a.getUserProfile({userIDList:s}).then(function(r){if(r=r.data,!O(r)||r.length===0)return i(e);var c,u={},l=Se(r);try{for(l.s();!(c=l.n()).done;){var _=c.value,m=_.userID,f=_.nick,I=_.avatar;u[m]={nick:f,avatar:I}}}catch(C){l.e(C)}finally{l.f()}e.forEach(function(C){var M=C.revoker;u[M]&&(C.revokerInfo.nick=u[M].nick||"",C.revokerInfo.avatar=u[M].avatar||"")}),i(e)}).catch(function(){i(e)})})}},{key:"isLastMessageRevoked",value:function(e){var t=!1,n=e.conversationID,o=e.sequence,s=e.time,a=this._convMap.get(n);return a&&(t=a.type===g.CONV_TOPIC?this.get(10).isLastMessageRevoked({topicID:n.replace(g.CONV_GROUP,""),sequence:o}):a.isLastMessageRevoked({sequence:o,time:s})),d.l("".concat(this._n,".isLastMessageRevoked options:"),e,"ret:".concat(t)),t}},{key:"onMessageDeleted",value:function(e){var t=this;if(e.length!==0){var n=null;e.forEach(function(c){(n=t._msgListHandler.getLocalMsg(c.conversationID,c.ID))&&(n.isDeleted=!0),c!==n&&(c.isDeleted=!0)});for(var e=e[0].conversationID,o=this._msgListHandler.getLocalMsgList(e),s={},a=o.length-1;0<=a;a--)if(!o[a].isDeleted){s=o[a];break}var i,r=this._convMap.get(e);r&&(i=!1,r.lastMessage.lastSequence===s.sequence&&r.lastMessage.lastTime===s.time||(k(s)&&(s=void 0),r.updateLastMessage(s),r.type!==g.CONV_TOPIC&&(i=!0),d.l("".concat(this._n,".onMessageDeleted. update convID:").concat(e," with lastMessage:"),r.lastMessage)),e.startsWith(g.CONV_C2C)&&this.updateUnreadCount(e),i)&&this.emitConvUpdate(!0,!1)}}},{key:"onMessageModified",value:function(e){var t="".concat(this._n,".onMessageModified"),l=e.conversationType,n=e.from,o=e.to,s=e.time,a=e.sequence,i=e.elements,r=e.cloudCustomData,c=e.messageVersion,_=this.getMyUserID(),u="".concat(l).concat(o),_=(o===_&&l===g.CONV_C2C&&(u="".concat(l).concat(n)),this._msgListHandler.onMsgModified(u,e)),l=_.isUpdated,_=_.message,m=(l===!0&&this.emitOEvt(F.MESSAGE_MODIFIED,[_]),this._isTopicConv(u));return _===null?d.l("".concat(t," message is null! options:"),e):d.l("".concat(t," isUpdated:").concat(l," isTopicMessage:").concat(m," from:").concat(n," to:").concat(o," sequence:").concat(_.sequence," time:").concat(_.time)),m?this.get(10).onMessageModified(e):(l=this._convMap.get(u))&&(n=l.lastMessage)&&n.lastTime===s&&n.lastSequence===a&&n.version!==c&&(d.l("".concat(t," convID:").concat(u," lastMessage updated")),n.type=i[0].type,n.payload=i[0].content,n.messageForShow=on(n.type,n.payload,this.isIntl()),n.cloudCustomData=r,n.version=c,this.emitConvUpdate(!0,!1)),_}},{key:"onNewGroupAtTips",value:function(n){var t=this,n=n.dataList,o=null;n.forEach(function(s){s.groupAtTips?o=s.groupAtTips:s.elements?o=p(p({},s.elements),{},{sync:!0}):s.groupAtType&&(o=p(p({},s),{},{sync:!0})),o.__random=s.random,o.__sequence=s.clientSequence,t._tmpGroupAtTipsList.push(o)}),d.l("".concat(this._n,".onNewGroupAtTips isReady:").concat(this._isReady),this._tmpGroupAtTipsList),this._isReady&&this._handleGroupAtTipsList()}},{key:"_handleGroupAtTipsList",value:function(){var e,t=this;this._tmpGroupAtTipsList.length!==0&&(e=!1,this._tmpGroupAtTipsList.forEach(function(n){var o=n.groupID,s=n.from,a=n.topicID,a=a===void 0?void 0:a,i=n.sync,i=i!==void 0&&i;s!==t.getMyUserID()&&(T(a)?(s=t._convMap.get("".concat(g.CONV_GROUP).concat(o)))&&(s.updateGroupAtInfoList(n),e=!0):((o=t._convMap.get("".concat(g.CONV_GROUP).concat(a)))&&(o.updateGroupAtInfoList(n),t.get(10).onAtInfoUpdated({topicID:a,groupAtInfoList:o.groupAtInfoList})),k(o)&&i&&(t.updateTopicConversation([{conversationID:"".concat(g.CONV_GROUP).concat(a),type:g.CONV_TOPIC}]),t._convMap.get("".concat(g.CONV_GROUP).concat(a)).updateGroupAtInfoList(n))))}),e&&this.emitConvUpdate(!0,!1),this._tmpGroupAtTipsList.length=0)}},{key:"_checkNewConv",value:function(e){var t=this,n=[],o=[];e.forEach(function(s){t._convMap.has(s.conversationID)||(s.type===g.CONV_C2C?n.push(s.conversationID.replace(g.CONV_C2C,"")):s.type===g.CONV_GROUP&&o.push(s.conversationID.replace(g.CONV_GROUP,"")))}),0<n.length&&(this._onNewC2CConv(n),n=null),0<o.length&&(this._onNewGroupConv(o),o=null)}},{key:"_onNewC2CConv",value:function(e){var t=this.get(6);return Promise.all([t.getRemotePeerReadTime(e),this._msgRemindHandler.getC2CMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,1)])}},{key:"_onNewGroupConv",value:function(e){var t=this.get(7);return t?Promise.all([t.getMsgRemindType(e),this._convGroupHandler.searchConvGroupAndMark(e,2)]):Promise.resolve()}},{key:"_setStorageConvList",value:function(){var e=0<arguments.length&&arguments[0]!==void 0&&arguments[0],t=this.getLocalConvList().filter(function(n){return n.type===g.CONV_C2C||n.type===g.CONV_GROUP&&n.lastMessage.type!==g.MSG_GRP_TIP}).slice(0,20).map(function(n){return{conversationID:n.conversationID,type:n.type,subType:n.subType,lastMessage:n.lastMessage,groupProfile:n.groupProfile,userProfile:n.userProfile}});this.get(13).setItem("conversationMap",t,e)}},{key:"emitConvUpdate",value:function(){var e=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1],n=this.getLocalConvList();t&&(t=this.get(7))&&t.updateGroupLastMessage(n),e&&(this.get(12).isPartialUpdatedConvs()?(this._diffConvMap(this._convMapForDiff,this._convMap),0<this._partialUpdatedConvMap.size&&(this.emitOEvt(F.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate(),this._convMapForDiff.clear(),this._convMapForDiff=No(this._convMap,!0)),this._convMapForDiff.size===0&&(this._convMapForDiff=No(this._convMap,!0))):(this.emitOEvt(F.CONVERSATION_LIST_UPDATED),this.onTotalUnreadCountUpdate()))}},{key:"_diffConvMap",value:function(e,t){var n,o=Se(t);try{for(o.s();!(n=o.n()).done;){var s=ke(n.value,2),a=s[0],i=s[1];e.has(a)&&JSON.stringify(i)===e.get(a)||this._partialUpdatedConvMap.set(a,i)}}catch(r){o.e(r)}finally{o.f()}}},{key:"getPartialUpdatedConvs",value:function(){var e=G(No(this._partialUpdatedConvMap,!1).values());return this._partialUpdatedConvMap.clear(),e}},{key:"getLocalConvList",value:function(){var e=this;return G(this._convMap.values()).filter(function(t){return e._isConvNeedShow(t.conversationID)})}},{key:"getLocalConversation",value:function(e){return this._convMap.get(e)}},{key:"hasLocalConversation",value:function(e){return this._convMap.has(e)}},{key:"getLocalOldestMessage",value:function(e){return this._msgListHandler.getLocalOldestMsg(e)}},{key:"syncConvList",value:function(){var e=this,t=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],n="syncConvList",o=new D(n);return this._pagingStatus===pt&&this._convMap.clear(),this._pagingGetConvList(t).then(function(s){var a=ra(e._pagingGetCostList),i=ia(e._pagingGetCostList),i=(e._pagingGetCostList.length=0,e._pagingStatus=cn,e._diffAndDeleteConv(),e.emitConvUpdate(!0,!1),e._setStorageConvList(),e._handleC2CPeerReadTime(),e.emitIEvt(ne.CONV_SYNC_COMPLETED),"count:".concat(e._convMap.size," sum:").concat(i," avg:").concat(a));return d.l("".concat(e._n,".").concat(n,". ").concat(i)),o.setMessage(i).end(),s}).catch(function(s){return e._pagingStatus=Vt,o.setMessage(e._pagingTs).setError(s).end(),v(s)})}},{key:"_diffAndDeleteConv",value:function(){var e,t=this;this.isSyncCompleted()&&(e=[],this._convMap.forEach(function(n,o){!t._pagingConvIDMap.has(o)&&t._convIDFromUnreadDBMap.has(o)&&(t._convMap.delete(o),e.push(o))}),d.l("".concat(this._n,"._diffAndDeleteConv list:").concat(e)),e=null)}},{key:"_pagingGetConvList",value:function(){var e=this,t=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],n="".concat(this._n,"._pagingGetConvList"),o=(d.l("".concat(n," incrementalPullFlag:").concat(t," ts:").concat(this._pagingTs," startIdx:").concat(this._pagingStartIdx)+" pinnedTs:".concat(this._pagingPinnedTs," pinnedStartIdx:").concat(this._pagingPinnedStartIdx)),Date.now());return this._pagingStatus=ha,this.req({P:h.PAGING_GET_CONV_LIST,data:{fromAccount:this.getMyUserID(),timeStamp:t?this._pagingTs:0,startIndex:t?this._pagingStartIdx:0,pinnedTimeStamp:t?this._pagingPinnedTs:0,pinnedStartIndex:t?this._pagingPinnedStartIdx:0,orderType:1}}).then(function(_){var _=_.data,a=_.completeFlag,i=_.conversations,i=i===void 0?[]:i,r=_.timeStamp,c=_.startIndex,u=_.pinnedTimeStamp,l=_.pinnedStartIndex,_=_.groupItem;if(e._pagingGetCostList.push(ye(o,!1)),d.l("".concat(n," ok. completeFlag:").concat(a," count:").concat(i.length," cost:").concat(ye(o))),e._convGroupHandler.onConvGroupListSynced(_),0<i.length&&(_=e._getConvOptions(i),e._pagingConvIDMap=new Map([].concat(G(e._pagingConvIDMap),G(_.map(function(m){return[m.conversationID,1]})))),e._updateLocalConvList({conversationOptionsList:_,isFromGetConversations:!0,updateUnreadCount:!0}),e.isLoggedIn())&&e.emitConvUpdate(),!e._isReady){if(!e.isLoggedIn())return q();e.triggerReady()}return e._pagingTs=r,e._pagingStartIdx=c,e._pagingPinnedTs=u,e._pagingPinnedStartIdx=l,a!==1?e._pagingGetConvList():(e._handleGroupAtTipsList(),e._convGroupHandler.getRemoteConvGroupList(),q())}).catch(function(s){throw!e.isLoggedIn()||e._isReady||(d.w("".concat(n," failed. error:"),s),e.triggerReady()),s})}},{key:"_updateLocalConvList",value:function(o){var t=o.isFromGetConversations,n=Date.now(),o=this._getTmpConvListMapping(o).newConvList;this._convMap=new Map(this._sortConvList(G(this._convMap))),t||this._updateUserOrGroupProfile(o),d.l("".concat(this._n,"._updateLocalConvList cost:").concat(ye(n)))}},{key:"_getTmpConvListMapping",value:function(e){for(var t=e.conversationOptionsList,n=e.isFromGetConversations,o=e.isInstantMessage,s=e.isUnreadC2CMessage,a=s!==void 0&&s,i=e.updateUnreadCount,r=[],c=[],u=this.get(7),l=this.get(8),_=this.isIntl(),m=this.isUsingChatCore(),f=0,I=t.length;f<I;f++){var C=new dn(t[f],_,m),M=C.conversationID,S=C.type;if(!this._isNonExistentAccount(M)){if(this._convMap.has(M)){var L=this._convMap.get(M);if(n&&S!==g.CONV_TOPIC){this._convMap.set(M,C),S===g.CONV_C2C?C.unreadCount=L.unreadCount:S===g.CONV_GROUP&&(C.groupProfile=JSON.parse(JSON.stringify(L.groupProfile)));continue}var P=["unreadCount","allowType","adminForbidType","payload","groupProfile"],w=(o===!1&&P.push("lastMessage"),typeof o=="boolean"&&P.push("isPinned"),t[f].lastMessage),B=!T(w);B||t[f].type===g.CONV_TOPIC||this._onLastMsgNotExist(t[f]),T(o)&&B&&L.lastMessage.payload===null&&(L.lastMessage.payload=w.payload),k(L.lastMessage.revoker)||(L.lastMessage.revoker=null),et(L,C,P,[null,void 0,"",0,NaN]),i===!0&&L.updateUnreadCount({nextUnreadCount:C.unreadCount,isFromGetConversations:n,isUnreadC2CMessage:a}),o&&B&&(w.payload&&(L.lastMessage.payload=w.payload),L.type===g.CONV_GROUP)&&(L.lastMessage.nameCard=w.nameCard,L.lastMessage.nick=w.nick),B&&L.lastMessage.cloudCustomData!==w.cloudCustomData&&(L.lastMessage.cloudCustomData=w.cloudCustomData||"")}else S===g.CONV_GROUP&&u?(P=C.groupProfile.groupID,(B=u.getLocalGroupProfile(P))&&(C.groupProfile=B,i===!0)&&C.updateUnreadCount({nextUnreadCount:0})):S===g.CONV_C2C&&(L=M.replace(g.CONV_C2C,""),l)&&l.isMyFriend(L)&&(C.remark=l.getFriendRemark(L)),r.push(C),this._convMap.set(M,C);this._convMap.get(M).type===g.CONV_TOPIC&&c.push(this._convMap.get(M))}}for(var x=this.get(10),j=0,se=c.length;j<se;j++){var $=c[j],ae=$.conversationID,$=$.groupAtInfoList;k($)||x.onAtInfoUpdated({topicID:ae.replace(g.CONV_GROUP,""),groupAtInfoList:$})}return{newConvList:r}}},{key:"_onLastMsgNotExist",value:function(e){new D("lastMsgNotExist").setMessage(JSON.stringify(e)).end()}},{key:"_sortConvList",value:function(e){var t=[],n=[],o=[],s=[];return e.forEach(function(a){(a[1].isPinned===!0?k(a[1].lastMessage.lastTime)?n:t:k(a[1].lastMessage.lastTime)?s:o).push(a)}),t.sort(function(a,i){return i[1].lastMessage.lastTime-a[1].lastMessage.lastTime}).concat(n).concat(o.sort(function(a,i){return i[1].lastMessage.lastTime-a[1].lastMessage.lastTime})).concat(s)}},{key:"_sortConvListAndEmitEvent",value:function(){this._convMap=new Map(this._sortConvList(G(this._convMap))),this.emitConvUpdate(!0,!1)}},{key:"_updateUserOrGroupProfile",value:function(e){var t,n,o,s,a=this;e.length!==0&&(t=[],n=[],o=this.get(4),s=this.get(7),e.forEach(function(i){i.type===g.CONV_C2C?t.push(i.toAccount):i.type===g.CONV_GROUP&&(i=i.toAccount,n.push(i))}),d.l("".concat(this._n,"._updateUserOrGroupProfile userIDList:").concat(t," groupIDList:").concat(n)),0<t.length&&o.getUserProfile({userIDList:t}).then(function(i){i=i.data,O(i)?i.forEach(function(r){a._doUpdateUserProfile("".concat(g.CONV_C2C).concat(r.userID),r)}):a._doUpdateUserProfile("".concat(g.CONV_C2C).concat(i.userID),i)}),0<n.length)&&s.getGroupProfileAdvance({groupIDList:n,responseFilter:{groupBaseInfoFilter:["Type","Name","FaceUrl"]}}).then(function(r){var r=r.data.successGroupList,c=!1;r.forEach(function(u){var l="".concat(g.CONV_GROUP).concat(u.groupID);a._convMap.has(l)&&(l=a._convMap.get(l),et(l.groupProfile,u,[],[null,void 0,"",0,NaN]),!l.subType&&u.type&&(l.subType=u.type),c=!0)}),c&&a.emitConvUpdate()})}},{key:"_doUpdateUserProfile",value:function(e,t){this.hasLocalConversation(e)&&(this.getLocalConversation(e).userProfile=t,this.emitConvUpdate())}},{key:"_getConvOptions",value:function(s){var t=this,n=[],s=s.filter(function(r){var i=r.type,r=r.userID;return i===1&&!t._isNonExistentAccount(r)||i===2}),o=this.getMyUserID(),s=s.map(function(a){var i;return T(a.lastMsg)&&(a.lastMsg={elements:[]}),a.type===1?(i={userID:a.userID,nick:a.peerNick,avatar:a.peerAvatar},n.push(i),{conversationID:"".concat(g.CONV_C2C).concat(a.userID),type:g.CONV_C2C,lastMessage:{lastTime:a.time,lastSequence:a.sequence,fromAccount:a.lastC2CMsgFromAccount,type:a.lastMsg.elements[0]?a.lastMsg.elements[0].type:null,payload:a.lastMsg.elements[0]?t._amendLayersOverLimitProp(a.lastMsg.elements[0].content,a.lastMsg.elements[0].type):null,cloudCustomData:a.lastMsg.cloudCustomData||"",isRevoked:a.lastMessageFlag===8,onlineOnlyFlag:!1,nick:"",nameCard:"",version:0,isPeerRead:a.lastC2CMsgFromAccount===o&&a.time<=a.c2cPeerReadTime,revoker:a.lastMsg.revokerInfo?a.lastMsg.revokerInfo.revoker:null},unreadCount:0,userProfile:new jt(i),peerReadTime:a.c2cPeerReadTime,isPinned:a.isPinned===1,customData:a.customMark||"",markList:kn(a.standardMark),conversationGroupList:t._convGroupHandler.getConvGroupListByID(a.contactGroupId),remark:a.friendRemark||"",messageRemindType:t._transMsgRemindType(a.messageRemindType)}):{conversationID:"".concat(g.CONV_GROUP).concat(a.groupID),type:g.CONV_GROUP,lastMessage:p(p({lastTime:a.time,lastSequence:a.sequence,fromAccount:a.msgGroupFromAccount},t._patchTypeAndPayload(a)),{},{cloudCustomData:a.lastMsg.cloudCustomData||"",isRevoked:a.lastMessageFlag===2,onlineOnlyFlag:!1,nick:a.senderNick||"",nameCard:a.senderNameCard||"",revoker:a.lastMsg.revokerInfo?a.lastMsg.revokerInfo.revoker:null}),groupProfile:new it({groupID:a.groupID,name:a.groupNick,avatar:a.groupImage,type:a.groupType,nextMessageSeq:a.nextMessageSeq}),unreadCount:t._computeGroupUnreadCount(a),peerReadTime:0,isPinned:a.isPinned===1,version:0,customData:a.customMark||"",markList:kn(a.standardMark),conversationGroupList:t._convGroupHandler.getConvGroupListByID(a.contactGroupId),messageRemindType:t._transMsgRemindType(a.messageRemindType)}});return 0<n.length&&this.get(4).onConvProfileUpdated(n),s}},{key:"_transMsgRemindType",value:function(e){var t="";return e===0?t=g.MSG_REMIND_ACPT_AND_NOTE:e===1?t=g.MSG_REMIND_DISCARD:e===2?t=g.MSG_REMIND_ACPT_NOT_NOTE:e===3&&(t=g.NOT_RECEIVE_OFFLINE_PUSH_EXCEPT_AT),t}},{key:"_computeGroupUnreadCount",value:function(t){var n=t.unreadCount,t=t.noUnreadCount,n=(n===void 0?0:n)-(t===void 0?0:t);return 0<n?n:0}},{key:"_patchTypeAndPayload",value:function(o){var o=o.lastMsg,t=o.event,n=o.elements,n=n===void 0?[]:n,o=o.groupTips,o=o===void 0?{}:o;return T(t===void 0?void 0:t)||k(o)?{type:n[0]?n[0].type:null,payload:n[0]?this._amendLayersOverLimitProp(n[0].content,n[0].type):null}:((t=new Ce(o)).setElement({type:g.MSG_GRP_TIP,content:p(p({},o.elements),{},{groupProfile:o.groupProfile})}),n=JSON.parse(JSON.stringify(t.payload)),t=null,{type:g.MSG_GRP_TIP,payload:n})}},{key:"_amendLayersOverLimitProp",value:function(e,t){var n=this.getFileDownloadProxy(),o=this.getDownloadFileAuthKey(),s=this.get(17).getFileDNList(),a=e.layersOverLimit,i=null;return t===g.MSG_IMAGE&&(i=new bn(e,n,o,s)),t===g.MSG_VIDEO&&(i=new qn(e,n,o,s)),t===g.MSG_SOUND&&(i=new wn(e,n,o,s)),t===g.MSG_FILE&&((i=new Fn(e,n,o,s)).content.url=void 0),a===0?e.layersOverLimit=!1:a===1&&(e.layersOverLimit=!0),i&&Object.assign(e,i.content),e}},{key:"getLocalMessageList",value:function(e){return this._msgListHandler.getLocalMsgList(e)}},{key:"deleteLocalMessage",value:function(e){e instanceof Ce&&this._msgListHandler.remove(e)}},{key:"onConvDeleted",value:function(e){O(e)&&(e=e.map(function(s){var n=s.type,o=s.userID,s=s.groupID;return n===1?"".concat(g.CONV_C2C).concat(o):n===2?"".concat(g.CONV_GROUP).concat(s):void 0}),d.l("".concat(this._n,".onConvDeleted convIDList:").concat(e)),this.deleteLocalConvList(e))}},{key:"onConvPinnedStatus",value:function(e,t){var n,o=this;O(e)&&(n=!1,e.forEach(function(c){var a,i=c.type,r=c.userID,c=c.groupID;i===1?a=o.getLocalConversation("".concat(g.CONV_C2C).concat(r)):i===2&&(a=o.getLocalConversation("".concat(g.CONV_GROUP).concat(c))),a&&(d.l("".concat(o._n,".onConvPinnedStatus convID:").concat(a.conversationID," localPinned:").concat(a.isPinned," remotePinned:").concat(t)),t?a.isPinned||(a.isPinned=!0,n=!0):a.isPinned&&(a.isPinned=!1,n=!0))}),n)&&this._sortConvListAndEmitEvent()}},{key:"getMessageList",value:function(s){var t=this,n=s.conversationID,o=s.nextReqMessageID,s=s.count,a="".concat(this._n,".getMessageList"),c=this.getLocalConversation(n),i="";if(c&&c.groupProfile&&(i=c.groupProfile.type),be(i))return d.l("".concat(a," not available in ").concat(i,". convID:").concat(n)),q({messageList:[],nextReqMessageID:"",isCompleted:!0});(T(s)||15<s)&&(s=15),o||this._isMeInCommunity(n)||this.clearMemMsg(n);var r=this._computeRemainingCount({conversationID:n,nextReqMessageID:o}),c=this._completedMap.has(n);return d.l("".concat(a," convID:").concat(n," isEverCleared:").concat(this._isEverCleared(n)," nextReqMessageID:").concat(o)+" remainingCount:".concat(r," count:").concat(s," isCompleted:").concat(c)),this._needGetHistory({conversationID:n,remainingCount:r,count:s})?this.getHistoryMessages({conversationID:n,nextReqMessageID:o,count:20}).then(function(_){var l=_.nextReqID,C=_.storedMessageList,M=_.assembledMessageList,_=_.isPullingCompleted,m=t._completedMap.has(n),f=C,I=(0<r&&(f=t._msgListHandler.getLocalMsgList(n).slice(0,C.length+r)),{nextReqMessageID:void 0,messageList:void 0,isCompleted:void 0}),C=(t._isEverCleared(n)?(I.nextReqMessageID=l,I.messageList=M,I.isCompleted=_):(I.nextReqMessageID=m?"":l,I.messageList=f,I.isCompleted=m),I.messageList.filter(function(S){return S.isRevoked})||[]),M=I.messageList.map(function(S){return S.sequence});return d.l("".concat(a," ret.nextReqMessageID:").concat(I.nextReqMessageID," ret.isCompleted:").concat(I.isCompleted," sequenceList:"),M),O(C)&&C.length!==0?t.updateRevokerInfo(C).then(function(S){return S.forEach(function(L){var P=L.revokerInfo;I.messageList=I.messageList.map(function(w){return w.ID===L.ID&&P&&(w.revokeReason=P.reason||"",w.revokerInfo={userID:P.revoker||w.revoker,nick:P.nick,avatar:P.avatar}),w})}),N(I)}):N(I)}):(this.modifyMessageList(n),i=this._getMsgListFromMem({conversationID:n,nextReqMessageID:o,count:s}),q(i))}},{key:"_isEverCleared",value:function(e){return this._everClearedMap.has(e)}},{key:"_getMsgListFromMem",value:function(u){var t=u.conversationID,n=u.nextReqMessageID,u=u.count,o="".concat(this._n,"._getMsgListFromMem"),s=this._msgListHandler.getLocalMsgList(t),a=s.length,i=Oe(t),r=0,c={isCompleted:!1,nextReqMessageID:"",messageList:[]},u=(n?(r=i?s.findIndex(function(l){return l.ID===n}):s.findIndex(function(l){return l.sequence+""===n}))>u?(c.messageList=s.slice(r-u,r),c.nextReqMessageID=i?s[r-u].ID:s[r-u].sequence+""):(c.messageList=s.slice(0,r),c.isCompleted=!0):u<a?(c.messageList=s.slice(r=a-u,a),c.nextReqMessageID=i?s[r].ID:s[r].sequence+""):(c.messageList=s.slice(0,a),c.isCompleted=!0),c.messageList.map(function(l){return l.sequence}));return d.l("".concat(o," convID:").concat(t)+" ret.nextReqMessageID:".concat(c.nextReqMessageID," ret.isCompleted:").concat(c.isCompleted," sequenceList:").concat(u)),c}},{key:"getMessageListHopping",value:function(r){var t,n,o=r.conversationID,s=r.sequence,a=r.time,i=r.count,r=r.direction,r=r===void 0?0:r;return(T(i)||15<i)&&(i=15),o.startsWith(g.CONV_C2C)?(t=this.get(6),n=o.replace(g.CONV_C2C,""),t.getRoamingMessagesHopping({peerAccount:n,time:a,count:i,direction:r})):o.startsWith(g.CONV_GROUP)?(t=this.get(7),n=o.replace(g.CONV_GROUP,""),t.getRoamingMessagesHopping({groupID:n,sequence:s,count:i,direction:r})):void 0}},{key:"_computeRemainingCount",value:function(s){var t,n=s.conversationID,o=s.nextReqMessageID,s=this._msgListHandler.getLocalMsgList(n),a=s.length;return d.l("".concat(this._n,"._computeRemainingCount convID:").concat(n," nextReqMessageID:").concat(o," length:").concat(a)),o?(t=0,Oe(n)?t=s.findIndex(function(i){return i.ID===o}):xe(n)&&(t=o.indexOf("-")!==-1?s.findIndex(function(i){return i.ID===o}):s.findIndex(function(i){return i.sequence+""===o})),t===-1?0:t):a}},{key:"_needGetHistory",value:function(o){var t=o.conversationID,n=o.remainingCount,o=o.count,s=this.getLocalConversation(t),a="";return s&&s.groupProfile&&(a=s.groupProfile.type),!(nn(t)||be(a)||!this._isEverCleared(t)&&(s=n<=o&&!this._completedMap.has(t),d.l("".concat(this._n,"._needGetHistory convID:").concat(t," ret:").concat(s)),!s))}},{key:"_isTopicConv",value:function(e){return e=e.replace(g.CONV_GROUP,""),he(e)}},{key:"getHistoryMessages",value:function(u){var t,n,o,s,a,i,r=u.conversationID,c=u.count,u=u.nextReqMessageID;return r===g.CONV_SYSTEM?q():(c=20<c?20:15,t=null,Oe(r)?(i=0,n="",o=!1,a=this._roamingMsgKeyAndTimeMap.has(r),u&&(o=!0,a?(i=this._roamingMsgKeyAndTimeMap.get(r).lastMessageTime,n=this._roamingMsgKeyAndTimeMap.get(r).messageKey):(s=this._msgListHandler.findMessage(u))&&(i=s.time,d.l("".concat(this._n,".getHistoryMessages convID:").concat(r," isRelayInfoExisted:").concat(a," lastMessageTime:").concat(i)))),(t=this.get(6)).getRoamingMessage({conversationID:r,peerAccount:r.replace(g.CONV_C2C,""),count:c,lastMessageTime:o?i:0,messageKey:o?n:""})):xe(r)?(t=this.get(7))?(s=r.replace(g.CONV_GROUP,""),a=null,this._convMap.has(r)&&!he(s)&&(a=this._convMap.get(r).lastMessage),i=0,u?i=Number(u):a&&(i=a.lastSequence),t.getRoamingMessage({conversationID:r,groupID:s,count:c,sequence:i})):v({code:y.NO_MODULE}):q())}},{key:"patchConvLastMessage",value:function(e){var t,n,o=1<arguments.length&&arguments[1]!==void 0&&arguments[1],s=this.getLocalConversation(e);s&&(t=(n=s.lastMessage).messageForShow,n=n.payload,k(t)||k(n)||o)&&(t=this._msgListHandler.getLocalMsgList(e)).length!==0&&(n=t[t.length-1],d.l("".concat(this._n,".patchConvLastMessage bForceUpdate:").concat(o," convID:").concat(e," payload:"),n.payload),s.updateLastMessage(n))}},{key:"onRoamingMessage",value:function(){for(var e,t,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:[],c=1<arguments.length?arguments[1]:void 0,o=!(2<arguments.length&&arguments[2]!==void 0)||arguments[2],s=3<arguments.length?arguments[3]:void 0,a=c.startsWith(g.CONV_C2C)?g.CONV_C2C:g.CONV_GROUP,i=null,r=[],c=[],M=0,S=n.length,u=a===g.CONV_GROUP,l=this.getFileDownloadProxy(),_=this.getDownloadFileAuthKey(),m=O(s),f=this.get(17).getFileDNList(),I=function(){u?--M:++M},C=function(){return u?S<=M:M<S},M=u?n.length-1:0,S=u?0:n.length;C();I())n[M].isPlaceMessage!==1&&((i=new Ce(n[M])).to=n[M].to,a!==g.CONV_GROUP||T(n[M].topicID)||(i.to=n[M].topicID),i.isSystemMessage=!!n[M].isSystemMessage,i.conversationType=a,e=n[M].event===4?{type:g.MSG_GRP_TIP,content:p(p({},n[M].elements),{},{groupProfile:n[M].groupProfile})}:n[M].elements,u||i.setNickAndAvatar({nick:n[M].nick,avatar:n[M].avatar}),k(e)?((t=new D("emptyMessageBody")).setMessage("from:".concat(i.from," to:").concat(i.to," sequence:").concat(i.sequence," event:").concat(n[M].event)),t.setLevel("warning").end()):(i.setElement(e,l,_,f),i.reInitialize(this.getMyUserID()),r.push(i),m&&s.push(i)));return I=C=null,o?(this._msgListHandler.unshift(r,c),r=null,c):r}},{key:"findMessage",value:function(e){return this._msgListHandler.findMessage(e)}},{key:"_isMeInCommunity",value:function(e){var t=!0;return this._isTopicConv(e)&&(e=_e(e.replace(g.CONV_GROUP,"")),this.get(7).hasLocalGroup(e)||(t=!1,d.l("".concat(this._n,"._isMeInCommunity groupID:").concat(e," ret:").concat(t)))),t}},{key:"deleteTopicRoamingInfo",value:function(e){var t=this;we({groupID:e})&&this._msgListHandler.getTopicConvIDList(e).forEach(function(n){t.clearMemMsg(n)})}},{key:"deleteGroupRoamingInfo",value:function(e){e="".concat(g.CONV_GROUP).concat(e),0<this._msgListHandler.getLocalMsgList(e).length&&this.clearMemMsg(e)}},{key:"setMessageRead",value:function(o){var t=o.conversationID,n=this.getLocalConversation(t),o="".concat(this._n,".setMessageRead");if(d.l("".concat(o," convID:").concat(t," unreadCount:").concat(n?n.unreadCount:0)),!n||(n.type!==g.CONV_GROUP&&n.type!==g.CONV_TOPIC||k(n.groupAtInfoList)||this.deleteGroupAtTips(t),n.unreadCount===0))return q();var s=this._msgListHandler.getLocalLastMsg(t),a=n.lastMessage.lastTime,i=this._msgListHandler.getLocalMaxTime(t),i=(a<i&&(d.l("".concat(o," update lastMessageTime from ").concat(a," to ").concat(i)),a=i),this._msgListHandler.getLocalMaxSeq(t)),r=n.lastMessage.lastSequence,c=(r<i&&(d.l("".concat(o," update lastMessageSeq from ").concat(r," to ").concat(i)),r=i),n.type===g.CONV_TOPIC&&T(s)&&(o=this.get(10),s=_e(i=t.replace(g.CONV_GROUP,"")),o=o.getLocalTopic(s,i))&&(r=o.nextMessageSeq-1),null);switch(n.type){case g.CONV_C2C:return(c=this.get(6))?c.setMessageRead({conversationID:t,lastMessageTime:a}):v({code:y.NO_MODULE});case g.CONV_GROUP:case g.CONV_TOPIC:return(c=this.get(7))?c.setMessageRead({conversationID:t,lastMessageSeq:r}):v({code:y.NO_MODULE});case g.CONV_SYSTEM:return n.unreadCount=0,this.emitConvUpdate(!0,!1),q();default:return q()}}},{key:"setAllMessageRead",value:function(){var e,t=this,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},o="setAllMessageRead",s="".concat(this._n,".").concat(o),a=(n.scope||(n.scope=g.READ_ALL_MSG),d.l("".concat(s," options:"),n),this._createSetAllMessageReadPack(n));return a.readAllC2CMessage===0&&a.groupMessageReadInfoList.length===0?q():(e=new D(o),this.req({P:h.SET_ALL_MSG_READ,data:a}).then(function(i){return i=i.data,i=t._handleAllMsgRead(i),e.setMessage("scope:".concat(n.scope," failureGroups:").concat(JSON.stringify(i))).end(),q()}).catch(function(i){return e.setError(i).end(),d.w("".concat(s," failed. error:"),i),v({code:i&&i.code?i.code:y.MSG_UNREAD_ALL_FAIL,message:i&&i.message?i.message:void 0})}))}},{key:"setConvCustomData",value:function(e){return this._convGroupHandler.setConvCustomData(e)}},{key:"markConv",value:function(e){return this._convGroupHandler.markConv(e)}},{key:"getConvGroupList",value:function(){return this._convGroupHandler.getLocalConvGroupList()}},{key:"createConvGroup",value:function(e){return this._convGroupHandler.createConvGroup(e)}},{key:"deleteConvGroup",value:function(e){return this._convGroupHandler.deleteConvGroup(e)}},{key:"renameConvGroup",value:function(e){return this._convGroupHandler.renameConvGroup(e)}},{key:"addConvsToGroup",value:function(e){return this._convGroupHandler.addConvsToGroup(e)}},{key:"deleteConvsFromGroup",value:function(e){return this._convGroupHandler.deleteConvsFromGroup(e)}},{key:"onConvMarkUpdated",value:function(e){this._convGroupHandler.onConvMarkUpdated(e)}},{key:"onConvGroupCreated",value:function(e){this._convGroupHandler.onConvGroupCreated(e)}},{key:"onConvGroupDeleted",value:function(e){this._convGroupHandler.onConvGroupDeleted(e)}},{key:"onConvGroupNameUpdated",value:function(e){this._convGroupHandler.onConvGroupNameUpdated(e)}},{key:"onConvInGroupUpdated",value:function(e){this._convGroupHandler.onConvInGroupUpdated(e)}},{key:"onConvAddedToOrDeletedFromGroup",value:function(e){this._convGroupHandler.onConvAddedToOrDeletedFromGroup(e)}},{key:"_getConvLastMessageSeq",value:function(n){var t=this._msgListHandler.getLocalLastMsg(n.conversationID),n=n.lastMessage.lastSequence;return n=t&&n<t.sequence?t.sequence:n}},{key:"_getConvLastMessageTime",value:function(n){var t=this._msgListHandler.getLocalLastMsg(n.conversationID),n=n.lastMessage.lastTime;return n=t&&n<t.time?t.time:n}},{key:"_createSetAllMessageReadPack",value:function(e){var t,n={readAllC2CMessage:0,groupMessageReadInfoList:[]},o=e.scope,s=Se(this._convMap);try{for(s.s();!(t=s.n()).done;){var a,i=ke(t.value,2)[1];if(0<i.unreadCount)if(i.type===g.CONV_C2C&&n.readAllC2CMessage===0){if(o===g.READ_ALL_MSG)n.readAllC2CMessage=1;else if(o===g.READ_ALL_C2C_MSG){n.readAllC2CMessage=1;break}}else i.type!==g.CONV_GROUP||o!==g.READ_ALL_GROUP_MSG&&o!==g.READ_ALL_MSG||(a=this._getConvLastMessageSeq(i),n.groupMessageReadInfoList.push({groupID:i.groupProfile.groupID,messageSequence:a}))}}catch(r){s.e(r)}finally{s.f()}return n}},{key:"onPushedAllMessageRead",value:function(e){this._handleAllMsgRead(e)}},{key:"_handleAllMsgRead",value:function(t){var n=t.groupMessageReadInfoList,t=t.readAllC2CMessage,n=this._parseGroupReadInfo(n);return 1<=this._updateAllConvUnreadCount({readAllC2CMessage:t})&&this.emitConvUpdate(!0,!1),n}},{key:"_parseGroupReadInfo",value:function(e){var t=[];if(e&&e.length)for(var n=0,o=e.length;n<o;n++){var r=e[n],s=r.groupID,a=r.sequence,i=r.retCode,r=r.lastMessageSeq;T(i)?this._remoteGroupReadSeqMap.set(s,r):(this._remoteGroupReadSeqMap.set(s,a),i!==0&&t.push("".concat(s,"-").concat(a,"-").concat(i)))}return t}},{key:"_updateAllConvUnreadCount",value:function(e){var t,n=e.readAllC2CMessage,o=0,s=Se(this._convMap);try{for(s.s();!(t=s.n()).done;){var a,i,r,c,u=ke(t.value,2),l=u[0],_=u[1];1<=_.unreadCount&&(n===1&&_.type===g.CONV_C2C?(a=this._getConvLastMessageTime(_),this.updateIsReadAfterReadReport({conversationID:l,lastMessageTime:a})):_.type===g.CONV_GROUP&&(i=l.replace(g.CONV_GROUP,""),this._remoteGroupReadSeqMap.has(i))&&(r=this._remoteGroupReadSeqMap.get(i),c=this._getConvLastMessageSeq(_),this.updateIsReadAfterReadReport({conversationID:l,remoteReadSequence:r}),r<=c)&&this._remoteGroupReadSeqMap.delete(i),this.updateUnreadCount(l,!1))&&(o+=1)}}catch(m){s.e(m)}finally{s.f()}return o}},{key:"isRemoteRead",value:function(o){var t,n=o.conversationID,o=o.sequence,s=n.replace(g.CONV_GROUP,""),a=!1;return this._remoteGroupReadSeqMap.has(s)&&(o<=(t=this._remoteGroupReadSeqMap.get(s))&&(a=!0,d.l("".concat(this._n,".isRemoteRead convID:").concat(n," msgSeq:").concat(o," remoteReadSeq:").concat(t))),t+10<=o)&&this._remoteGroupReadSeqMap.delete(s),a}},{key:"updateIsReadAfterReadReport",value:function(e){var t=e.conversationID,n=e.lastMessageSeq,o=e.lastMessageTime,s=this._msgListHandler.getLocalMsgList(t);if(s.length!==0){for(var a,i=s.length-1;0<=i;i--)if(a=s[i],!(o&&a.time>o||n&&a.sequence>n)){if(a.flow==="in"&&a.isRead)break;a.setIsRead(!0)}}}},{key:"updateUnreadCount",value:function(e){var t,n=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1],o=!1,s=this.getLocalConversation(e),a=this._msgListHandler.getLocalMsgList(e);if(s)return(t=s.unreadCount)!==(a=a.filter(function(i){return!i.isRead&&!i._onlineOnlyFlag&&!i.isDeleted}).length)&&(s.unreadCount=a,o=!0,d.l("".concat(this._n,".updateUnreadCount from ").concat(t," to ").concat(a,", convID:").concat(e)),n===!0)&&this.emitConvUpdate(!0,!1),o&&s.type===g.CONV_TOPIC&&(t=s.unreadCount,a=this.get(10),n=e.replace(g.CONV_GROUP,""),a.onUnreadCountUpdatedFromConv(n,t)),o}},{key:"clearGroupAtInfoList",value:function(e){var t,n=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1],o=this.getLocalConversation(e);o&&0<o.groupAtInfoList.length&&(o.clearGroupAtInfoList(),d.l("".concat(this._n,".clearGroupAtInfoList convID:").concat(e)),o.type===g.CONV_TOPIC&&(o=o.groupAtInfoList,t=this.get(10),e=e.replace(g.CONV_GROUP,""),t.onAtInfoUpdated({topicID:e,groupAtInfoList:o})),n===!0)&&this.emitConvUpdate(!0,!1)}},{key:"updateReadReceiptInfo",value:function(c){var t,n,o,s=this,r=c.userID,a=r===void 0?void 0:r,r=c.groupID,i=r===void 0?void 0:r,r=c.readReceiptList,c=c.timestamp,u=c===void 0?0:c;k(r)||(t=[],T(a)?T(i)||(n="".concat(g.CONV_GROUP).concat(i),r.forEach(function(m){var f=m.tinyID,I=m.clientTime,C=m.random,_=m.readCount,m=m.unreadCount,f="".concat(f,"-").concat(I,"-").concat(C),I=s._msgListHandler.getLocalMsg(n,f)||s._msgListHandler.getHoppingMsg(n,f),C={groupID:i,messageID:f,readCount:0,unreadCount:0};I&&(Y(_)&&(I.readReceiptInfo.readCount=_,C.readCount=_),Y(m)&&(I.readReceiptInfo.unreadCount=m,C.unreadCount=m),t.push(C))})):(o="".concat(g.CONV_C2C).concat(a),r.forEach(function(_){var m=_.tinyID,f=_.clientTime,_=_.random,m="".concat(m,"-").concat(f,"-").concat(_),f=s._msgListHandler.getLocalMsg(o,m)||s._msgListHandler.getHoppingMsg(o,m);f&&!f.readReceiptInfo.isPeerRead&&(f.readReceiptInfo.isPeerRead=!0,f.readReceiptInfo.timestamp=u,t.push({userID:a,messageID:m,isPeerRead:!0,timestamp:u}))})),0<t.length&&this.emitOEvt(F.MESSAGE_READ_RECEIPT_RECEIVED,t))}},{key:"updateIsRead",value:function(e){var t=this.getLocalConversation(e),n=this.getLocalMessageList(e);if(t&&n.length!==0&&!nn(t.type)){for(var o=[],s=0,a=n.length;s<a;s++)n[s].flow!=="in"?n[s].flow!=="out"||n[s].isRead||n[s].setIsRead(!0):o.push(n[s]);var i=0;i=t.type===g.CONV_C2C?(e=o.slice(-t.unreadCount).filter(function(c){return c.isRevoked}).length,o.length-t.unreadCount-e):o.length-t.unreadCount;for(var r=0;r<i&&!o[r].isRead;r++)o[r].setIsRead(!0)}}},{key:"deleteGroupAtTips",value:function(e){var t,n,o,s=this,a="".concat(this._n,".deleteGroupAtTips"),i=(d.l("".concat(a)),this._convMap.get(e));return!i||(t=i.groupAtInfoList).length===0?Promise.resolve():(i=void 0,e.startsWith(g.CONV_GROUP)&&(i=e.replace(g.CONV_GROUP,"")),n=G(t),(we({groupID:i})||he(i))&&(n=t.filter(function(r){return!r.atTypeArray.includes(g.CONV_AT_ALL)})).length===0?(this.clearGroupAtInfoList(e,!1),Promise.resolve()):(o=this.getMyUserID(),this.req({P:h.DEL_GROUP_AT_TIPS,data:{messageListToDelete:n.map(function(r){return{from:r.from,to:o,messageSeq:r.__sequence,messageRandom:r.__random,groupID:T(r.topicID)?r.groupID:r.topicID}})}}).then(function(){return d.l("".concat(a," ok. count:").concat(t.length)),s.clearGroupAtInfoList(e,!1),Promise.resolve()}).catch(function(r){return d.e("".concat(a," failed. error:"),r),v(r)})))}},{key:"appendToMessageList",value:function(e){return this._msgListHandler.pushIn(e)}},{key:"setMessageRandom",value:function(e){this._sll.set(e.random)}},{key:"deleteMessageRandom",value:function(e){this._sll.delete(e.random)}},{key:"pushIntoMessageList",value:function(e,t,n){return!(!this._msgListHandler.pushIn(t,n)||this._sll.has(t.random)&&!n||(e.push(t),0))}},{key:"revoke",value:function(e,t,n){return this._msgListHandler.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)}},{key:"updateMsgIsPeerReadProp",value:function(e,t){var n;e.startsWith(g.CONV_C2C)&&0<t&&(0<(n=this._msgListHandler.updateMsgIsPeerReadProp(e,t)).length&&this.emitOEvt(F.MESSAGE_READ_BY_PEER,n),this._convMap.has(e))&&!k(n=this._convMap.get(e).lastMessage)&&n.fromAccount===this.getMyUserID()&&n.lastTime<=t&&!n.isPeerRead&&(n.isPeerRead=!0,this.emitConvUpdate(!0,!1))}},{key:"updateMsgIsModifiedProp",value:function(e){this._msgListHandler.updateMsgIsModifiedProp(e)}},{key:"setCompleted",value:function(e){d.l("".concat(this._n,".setCompleted convID:").concat(e)),this._completedMap.set(e,!0)}},{key:"updateRoamingMsgKeyAndTime",value:function(e,t,n){this._roamingMsgKeyAndTimeMap.set(e,{messageKey:t,lastMessageTime:n})}},{key:"getConvList",value:function(e){var t,n=this,o="".concat(this._n,".").concat("getConvList"),s="pagingStatus:".concat(this._pagingStatus,", local conversation count:").concat(this._convMap.size,", options:").concat(JSON.stringify(e));return d.l("".concat(o,". ").concat(s)),this._pagingStatus===Vt?((t=new D("getConvList")).setMessage(s),this.syncConvList().then(function(){t.end();var a=n._getConvList(e);return N({conversationList:a,isSyncCompleted:n.isSyncCompleted()})}).catch(function(a){return t.setError(a).end(),d.e("".concat(o," failed. error:"),a),v(a)})):(s=this._getConvList(e),d.l("".concat(o,". returned conversation count:").concat(s.length)),q({conversationList:s,isSyncCompleted:this.isSyncCompleted()}))}},{key:"_getConvList",value:function(e){var t,n,o,s,a,i=this;return T(e)?this.getLocalConvList():O(e)?e.length===0?[]:this.getLocalConvList().filter(function(r){return e.includes(r.conversationID)}):Q(e)?(t=e.type,n=e.markType,o=e.groupName,s=e.hasUnreadCount,a=e.hasGroupAtInfo,this.getLocalConvList().filter(function(r){return i._filterType(r,t)&&i._filterMarkType(r,n)&&i._filterGroupName(r,o)&&i._filterUnreadCount(r,s)&&i._filterGroupAtInfo(r,a)})):[]}},{key:"_filterType",value:function(e,t){return t!==g.CONV_C2C&&t!==g.CONV_GROUP||e.type===t}},{key:"_filterGroupName",value:function(e,t){return!V(t)||(t===""?e.conversationGroupList.length===0:e.conversationGroupList.includes(t))}},{key:"_filterMarkType",value:function(e,t){return!Y(t)||(t===0?e.markList.length===0:e.markList.includes(t))}},{key:"_filterUnreadCount",value:function(e,t){var n=!0;return t===!0?n=1<=e.unreadCount:t===!1&&(n=e.unreadCount===0),n}},{key:"_filterGroupAtInfo",value:function(e,t){var n=!0;return t===!0?n=1<=e.groupAtInfoList.length:t===!1&&(n=e.groupAtInfoList.length===0),n}},{key:"_handleC2CPeerReadTime",value:function(){var e,t=Se(this._convMap);try{for(t.s();!(e=t.n()).done;){var n=ke(e.value,2),o=n[0],s=n[1];s.type===g.CONV_C2C&&this.recordPeerReadTime(o,s.peerReadTime)}}catch(a){t.e(a)}finally{t.f()}}},{key:"_isPagingGetGroupListCompleted",value:function(){var e=this.get(7);return!e||e.isPagingGetCompleted()}},{key:"_getLocalGroupCount",value:function(){var e=this.get(7);return e?e.getLocalGroupList().length:0}},{key:"_hasLocalGroup",value:function(e){var t=this.get(7);return!!t&&t.hasLocalGroup(e.replace(g.CONV_GROUP,""))}},{key:"getConversationProfile",value:function(e){var t,n=this,o=!1;if(this._convMap.has(e)?t=this._convMap.get(e):(t=new dn({conversationID:e,type:Oe(e)?g.CONV_C2C:g.CONV_GROUP},this.isIntl(),this.isUsingChatCore()),o=!0),t._isInfoCompleted||t.type===g.CONV_SYSTEM)return q({conversation:t});if(xe(e)){if(!this.get(7))return v({code:y.NO_MODULE});if(!this._hasLocalGroup(e))return q({conversation:t})}var s="".concat(this._n,".").concat("getConversationProfile"),a=new D("getConversationProfile");return d.l("".concat(s,". convID:").concat(e," remark:").concat(t.remark," lastMessage:"),t.lastMessage),this._getUserOrGroupProfile(t).then(function(i){a.setMessage("convID:".concat(e," unreadCount:").concat(i.data.conversation.unreadCount)).end();var r,c=n.get(8);if(c&&t.type===g.CONV_C2C&&(r=e.replace(g.CONV_C2C,""),c.isMyFriend(r))&&(c=c.getFriendRemark(r),t.remark!==c)&&(t.remark=c,d.l("".concat(s,". convID:").concat(e," patch remark:").concat(t.remark))),d.l("".concat(s," ok. isNewConv:").concat(o," convID:").concat(e)),o){if(t.type===g.CONV_C2C)return n._onNewC2CConv([e.replace(g.CONV_C2C,"")]).then(function(){return q({conversation:t})});if(t.type===g.CONV_GROUP)return n._onNewGroupConv([e.replace(g.CONV_GROUP,"")]).then(function(){return q({conversation:t})})}return i}).catch(function(i){return a.setError(i).setMessage("convID:".concat(e)).end(),d.e("".concat(s," failed. error:"),i),v(i)})}},{key:"_getUserOrGroupProfile",value:function(e){var t=this;return e.type===g.CONV_C2C?this.get(4).getUserProfile({userIDList:[e.toAccount]}).then(function(n){return n=n.data,n.length===0?v({code:y.USER_OR_GRP_NOT_FOUND}):(e.userProfile=n[0],e._isInfoCompleted=!0,t._insertConvAfterTopmost(e),q({conversation:e}))}):this.get(7).getGroupProfile({groupID:e.toAccount}).then(function(n){return e.groupProfile=n.data.group,e._isInfoCompleted=!0,t._insertConvAfterTopmost(e),q({conversation:e})})}},{key:"_insertConvAfterTopmost",value:function(e){var t,n;e instanceof dn&&!this._convMap.has(e.conversationID)&&(n=(t=G(this._convMap)).findIndex(function(o){return o[1].isPinned===!1}),t.splice(n,0,[e.conversationID,e]),this._convMap=new Map(t),this._setStorageConvList(),this.emitConvUpdate(!0,!1))}},{key:"_onProfileUpdated",value:function(e){var t=this;e.data.forEach(function(n){var o=n.userID;o===t.getMyUserID()?t._onMyProfileModified({latestNick:n.nick,latestAvatar:n.avatar}):(o=t._convMap.get("".concat(g.CONV_C2C).concat(o)))&&(o.userProfile=n)})}},{key:"_onCloudConfig",value:function(e){this.getCloudConfig("pull_on_invite")==="0"&&(this._bPullOnInvite=!1),d.l("".concat(this._n,"._onCloudConfig bPullOnInvite:").concat(this._bPullOnInvite))}},{key:"disableMsgPullOnInvite",value:function(){this._bPullOnInvite=!1}},{key:"isSyncCompleted",value:function(){return this._pagingStatus===cn}},{key:"_errorLog",value:function(e,t,n,o){var s=new Error("Params validate failed."),a="".concat(this.getErrMsg("API_REFER")).concat(e);throw d.w("[".concat(e,"] | ").concat(t," | ").concat(this.getErrMsg(n,o),", ").concat(a)),d.e("[".concat(e,"] Invalid ").concat(t,": type check failed for ").concat(t,".")),s}},{key:"_isValidConvID",value:function(e){return Oe(e)||xe(e)||nn(e)}},{key:"deleteConversation",value:function(e){var t=this,n="deleteConversation";return V(e)||at(e)||this._errorLog(n,"options","StringOrObjectRequiredLog"),V(e)?(this._isValidConvID(e)||this._errorLog(n,"options","InvalidConversationID",e),d.l("".concat(this._n,".").concat(n," convID:").concat(e)),this.deleteConvList({conversationIDList:[e],flag:1})):(O(e.conversationIDList)||this._errorLog(n,"conversationIDList","ArrayRequiredLog"),e.conversationIDList.length===0&&this._errorLog(n,"conversationIDList","NonEmptyArrayLog"),e.conversationIDList.forEach(function(o){t._isValidConvID(o)||t._errorLog(n,"conversationIDList","InvalidConversationID",o)}),"clearHistoryMessage"in e&&typeof e.clearHistoryMessage!="boolean"&&this._errorLog(n,"clearHistoryMessage","BooleanRequiredLog"),100<e.conversationIDList.length&&(e.conversationIDList=e.conversationIDList.slice(0,100)),this.deleteConvList(e))}},{key:"deleteConvList",value:function(a){var t=a.conversationIDList,t=t===void 0?[]:t,n=a.clearHistoryMessage,n=n===void 0||n,a=a.flag,o=a===void 0?0:a,s="".concat(this._n,".").concat("deleteConvList"),a="convIDList:".concat(t," clearHistoryMessage:").concat(n),i=(d.l("".concat(s," ").concat(a)),new D("deleteConvList"));return i.setMessage(a),Promise.all([this.rmLocalOnlyConvList(t),this.rmLocalAndRemoteConvList(t,n)]).then(function(r){return i.end(),r=[].concat(G(r[0]),G(r[1])),r.length===0?v(new ie({code:y.CONV_NOT_FOUND})):(d.l("".concat(s," ok")),q(o===1?{conversationID:r[0]}:{conversationIDList:r}))}).catch(function(r){return i.setError(r).end(),d.e("".concat(s," failed. error:"),r),v(r)})}},{key:"rmLocalOnlyConvList",value:function(e){var t=this;return e.filter(function(n){var o;return!!t._convMap.has(n)&&((o=t.getLocalConversation(n).type)!==g.CONV_GROUP||t._hasLocalGroup(n)?o===g.CONV_SYSTEM&&(t.get(7).deleteGroupSystemNotice({messageList:t._msgListHandler.getLocalMsgList(n)}),t.deleteLocalConv(n),!0):(t.deleteLocalConv(n),!0))})}},{key:"rmLocalAndRemoteConvList",value:function(e,t){var n=this,o={fromAccount:this.getMyUserID(),conversationList:[],clearHistoryMessage:t?1:0};return e.forEach(function(s){var a;n._convMap.has(s)&&((a=n.getLocalConversation(s).type)===g.CONV_C2C?o.conversationList.push({toAccount:s.replace(a,""),type:1}):a===g.CONV_GROUP&&n._hasLocalGroup(s)&&o.conversationList.push({toGroupID:s.replace(a,""),type:2}))}),o.conversationList.length===0?[]:this.req({P:h.DEL_CONV,data:o}).then(function(s){var a=[];return 0<s.data.resultList.length&&s.data.resultList.map(function(i){i.code===0&&(i=i.type===1?"".concat(g.CONV_C2C).concat(i.to):"".concat(g.CONV_GROUP).concat(i.groupID),a.push(i))}),n.deleteLocalConvList(a),a})}},{key:"setConvDraft",value:function(n){var t=n.conversationID,n=n.draftText,o="".concat(this._n,".").concat("setConvDraft");return d.l("".concat(o," convID:").concat(t," draftText:").concat(n)),this._convMap.has(t)?((o=this._convMap.get(t)).setDraftText(n),this.emitConvUpdate(),q({code:0,conversation:o})):v({code:y.CONV_NOT_FOUND})}},{key:"clearHistoryMessage",value:function(e){var t=this,n={fromAccount:this.getMyUserID(),toAccount:void 0,type:void 0,toGroupID:void 0};if(!this._convMap.has(e))return v({code:y.CONV_NOT_FOUND});var o=this._convMap.get(e).type;if(o===g.CONV_C2C)n.type=1,n.toAccount=e.replace(g.CONV_C2C,"");else{if(o!==g.CONV_GROUP)return o===g.CONV_SYSTEM?(this.get(7).deleteGroupSystemNotice({messageList:this._msgListHandler.getLocalMsgList(e)}),q({conversationID:e})):v({code:y.CONV_UN_RECORDED_TYPE});n.type=2,n.toGroupID=e.replace(g.CONV_GROUP,"")}var s="".concat(this._n,".").concat("clearHistoryMessage"),a=new D("clearHistoryMessage");return a.setMessage("convID:".concat(e)),d.l("".concat(s,". convID:").concat(e)),this.setMessageRead({conversationID:e}).then(function(){return t.req({P:h.CLEAR_HISTORY_MSG,data:n})}).then(function(){a.end(),d.l("".concat(s," ok")),t.clearMemMsg(e);var i=t.getLocalConversation(e);return i&&(i.updateLastMessage(),t._sortConvListAndEmitEvent()),q({conversationID:e})}).catch(function(i){return a.setError(i).end(),d.e("".concat(s," failed. error:"),i),v(i)})}},{key:"pinConversation",value:function(e){var t,n,o,s=this,a=e.conversationID,i=e.isPinned,r=this.getLocalConversation(a);return r&&r.isPinned===i?q({conversationID:a}):nn(a)?(r&&(r.isPinned=i),this._sortConvListAndEmitEvent(),q({conversationID:a})):(e=null,Oe(a)?e={type:1,toAccount:a.replace(g.CONV_C2C,"")}:xe(a)&&(e={type:2,groupID:a.replace(g.CONV_GROUP,"")}),e===null?v({code:y.INVALID_CONV_ID}):(t="".concat(this._n,".").concat("pinConversation"),n="convID:".concat(a," isPinned:").concat(i),(o=new D("pinConversation")).setMessage(n),d.l("".concat(t,". ").concat(n)),this.req({P:h.PIN_CONV,data:{fromAccount:this.getMyUserID(),operationType:i===!0?1:2,itemList:[e]}}).then(function(){return o.end(),d.l("".concat(t," ok")),r?r.isPinned!==i&&(r.isPinned=i):s._convMap.set(a,new dn({conversationID:a,type:Oe(a)?g.CONV_C2C:g.CONV_GROUP,isPinned:i},s.isIntl(),s.isUsingChatCore())),s._sortConvListAndEmitEvent(),N({conversationID:a})}).catch(function(c){return o.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})))}},{key:"setMessageRemindType",value:function(e){return this._msgRemindHandler.set(e)}},{key:"patchMsgRemindType",value:function(e){var t=e.ID,s=e.isC2CConversation,n=e.messageRemindType,o=!1,s=this.getLocalConversation("".concat(s?g.CONV_C2C:g.CONV_GROUP).concat(t));return s&&s.messageRemindType!==n&&(s.messageRemindType=n,o=!0),d.l("".concat(this._n,".patchMsgRemindType options:"),e,"ret:".concat(o)),o}},{key:"onC2CMsgRemindTypeFetched",value:function(e){var t,n=this;O(e)&&0<e.length&&(t=0,e.forEach(function(a){var s=a.userID,a=a.muteFlag,a=n._transMsgRemindType(a);n.patchMsgRemindType({ID:s,isC2CConversation:!0,messageRemindType:a})===!0&&(t+=1)}),d.l("".concat(this._n,".onC2CMsgRemindTypeFetched updateCount:").concat(t)),1<=t)&&this.emitConvUpdate(!0,!1)}},{key:"onC2CMsgRemindTypeSynced",value:function(e){var t=this,n="".concat(this._n,".onC2CMsgRemindTypeSynced");e.dataList.forEach(function(o){var s;k(o.muteNotificationsSync)||(s=(o=o.muteNotificationsSync).to,o=o.muteFlag,o=t._transMsgRemindType(o),t.patchMsgRemindType({ID:s,isC2CConversation:!(s=0),messageRemindType:o})&&(s+=1),d.l("".concat(n," updateCount:").concat(s)),1<=s&&t.emitConvUpdate(!0,!1))})}},{key:"onGroupMsgRemindTypeUpdated",value:function(e){this._msgRemindHandler.onGroupMsgRemindTypeUpdated(e)}},{key:"deleteLocalConv",value:function(e){var t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1],n=this._convMap.has(e);d.l("".concat(this._n,".deleteLocalConv convID:").concat(e," has:").concat(n)),n&&(this._convMap.delete(e),this._convMapForDiff.delete(e),this.clearMemMsg(e),this._setStorageConvList(!0),t)&&(n=!this._isTopicConv(e),this.emitConvUpdate(n,!1))}},{key:"pullMsgOnInvite",value:function(e){var t,n,o,s,a,i=this.get(7);i&&(t="".concat(this._n,".pullMsgOnInvite"),d.l("".concat(t," flag:").concat(this._bPullOnInvite)),this._bPullOnInvite)&&(a=this.getLocalLastMessage(e),n=this.getLocalSecondLastMessage(e),s=o=1,a&&(o=a.sequence),n&&(s=n.sequence),a=i.getGroupRemoteLastSeq(e.replace(g.CONV_GROUP,"")),d.l("".concat(t," convID:").concat(e," localLastSeq:").concat(o," localSecondLastSeq:").concat(s," remoteLastSeq:").concat(a)),this.clearMemMsg(e),1<o-s?this._recursiveGetMsgList([],e,!1,o,s):1<a-o&&this._recursiveGetMsgList([],e,!0,a,o))}},{key:"_recursiveGetMsgList",value:function(e,t,n,o,s,a){var i=this;this.getMessageList({conversationID:t,nextReqMessageID:a}).then(function(l){var l=l.data,c=l.messageList,u=l.isCompleted,l=l.nextReqMessageID,_=c.filter(function(m){return n?m.sequence>s&&m.sequence<=o:m.sequence>s&&m.sequence<o});e.unshift.apply(e,G(_)),!u&&0<c.length&&c[0].sequence>s&&e.length<60?i._recursiveGetMsgList(e,t,n,o,s,l):i._emitMsgReceived(t,e)})}},{key:"_emitMsgReceived",value:function(e,t){var n,o,s=this;0<t.length&&(t=t.filter(function(a,i,r){return i===r.findIndex(function(c){return c.sequence===a.sequence})}),n=this.hasLocalConversation(e),o=t.map(function(a){return a.sequence}),d.l("".concat(this._n,"._emitMsgReceived convID:").concat(e," has:").concat(n," count:").concat(o.length," sequenceList:"),o),this.emitOEvt(F.MESSAGE_RECEIVED,t),n?this.patchConvLastMessage(e,!0):this.getConversationProfile(e).then(function(){s.patchConvLastMessage(e,!0)}))}},{key:"deleteLocalConvList",value:function(e){var t=this,n=!1;e.forEach(function(o){t._convMap.has(o)&&(t.deleteLocalConv(o,!1),n=!0)}),d.l("".concat(this._n,".deleteLocalConvList convID:").concat(e," isConvIDExisted:").concat(n)),n&&this.emitConvUpdate(!0,!1)}},{key:"isMessageSentByCurrentInstance",value:function(e){return!(!this._msgListHandler.hasLocalMsg(e.conversationID,e.ID)&&!this._sll.has(e.random))}},{key:"modifyMessageList",value:function(e){var t,n;e.startsWith(g.CONV_C2C)&&this._convMap.has(e)&&(n=this._convMap.get(e),t=Date.now(),this._msgListHandler.modifyMsgSentByPeer({conversationID:e,latestNick:n.userProfile.nick,latestAvatar:n.userProfile.avatar}),n=this.get(4).getNickAndAvatarByUserID(this.getMyUserID()),this._msgListHandler.modifyMsgSentByMe({conversationID:e,latestNick:n.nick,latestAvatar:n.avatar}),d.l("".concat(this._n,".modifyMessageList convID:").concat(e," cost:").concat(ye(t))))}},{key:"updateUserProfileSpecifiedKey",value:function(o){d.l("".concat(this._n,".updateUserProfileSpecifiedKey options:"),o);var t=o.conversationID,n=o.nick,o=o.avatar;this._convMap.has(t)&&(t=this._convMap.get(t).userProfile,V(n)&&t.nick!==n&&(t.nick=n),V(o)&&t.avatar!==o&&(t.avatar=o),this.emitConvUpdate(!0,!1))}},{key:"_onMyProfileModified",value:function(e){var t=this,n=this.getLocalConvList(),o=Date.now();n.forEach(function(s){t.modifyMessageSentByMe(p({conversationID:s.conversationID},e))}),d.l("".concat(this._n,"._onMyProfileModified. modify all messages sent by me, cost:").concat(ye(o)))}},{key:"modifyMessageSentByMe",value:function(e){this._msgListHandler.modifyMsgSentByMe(e)}},{key:"getLatestMessageSentByMe",value:function(e){return this._msgListHandler.getLatestMsgSentByMe(e)}},{key:"modifyMessageSentByPeer",value:function(e){this._msgListHandler.modifyMsgSentByPeer(e)}},{key:"getLatestMessageSentByPeer",value:function(e){return this._msgListHandler.getLatestMsgSentByPeer(e)}},{key:"pushIntoNoticeResult",value:function(e,t){return!(!this._msgListHandler.pushIn(t)||this._sll.has(t.random)||(e.push(t),0))}},{key:"getLocalLastMessage",value:function(e){return this._msgListHandler.getLocalLastMsg(e)}},{key:"getLocalSecondLastMessage",value:function(e){return this._msgListHandler.getLocalSecondLastMsg(e)}},{key:"checkAndPatchRemark",value:function(){var e,t,n=this.get(8);this._convMap.size!==0&&n&&(e=G(this._convMap.values()).filter(function(o){return o.type===g.CONV_C2C})).length!==0&&(t=0,e.forEach(function(o){var s=o.conversationID.replace(g.CONV_C2C,"");n.isMyFriend(s)&&(s=n.getFriendRemark(s),o.remark!==s)&&(o.remark=s,t+=1)}),d.l("".concat(this._n,".checkAndPatchRemark. c2cConvCount:").concat(e.length," patchedCount:").concat(t)),0<t)&&this.emitConvUpdate(!0,!1)}},{key:"updateTopicConversation",value:function(e){this._updateLocalConvList({conversationOptionsList:e,isFromGetConversations:!0,updateUnreadCount:!0})}},{key:"sendReadReceipt",value:function(e){var t=e[0],n=null;return t.conversationType===g.CONV_C2C?n=this._m.get(6):t.conversationType===g.CONV_GROUP&&(n=this._m.get(7)),n?n.sendReadReceipt(e):v({code:y.NO_MODULE})}},{key:"getReadReceiptList",value:function(e){var t=e[0],n=null;return t.conversationType===g.CONV_C2C?n=this._m.get(6):t.conversationType===g.CONV_GROUP&&(n=this._m.get(7)),n?n.getReadReceiptList(e):v({code:y.NO_MODULE})}},{key:"getLastMessageTime",value:function(e){return e=this.getLocalConversation(e),e?e.lastMessage.lastTime:0}},{key:"getTotalUnreadCount",value:function(){var e=this.getLocalConvList(),t=0;return e.forEach(function(n){n.type===g.CONV_SYSTEM||n.messageRemindType!==""&&n.messageRemindType!==g.MSG_REMIND_ACPT_AND_NOTE||(t+=n.unreadCount)}),t}},{key:"onTotalUnreadCountUpdate",value:function(){var e=this.getTotalUnreadCount();this._convTotalUnreadCount!==e&&(d.l("".concat(this._n,".onTotalUnreadCountUpdate from ").concat(this._convTotalUnreadCount," to ").concat(e)),this._convTotalUnreadCount=e,this.emitOEvt(F.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED))}},{key:"_isConvNeedShow",value:function(o){var t,n,o=this.getLocalConversation(o);return!(!T(o)&&(t=o.type===g.CONV_TOPIC,n=o.type===g.CONV_GROUP&&o.groupProfile.type===g.GRP_ROOM,o=o.type===g.CONV_GROUP&&o.groupProfile.type===g.GRP_LIVE,t||n||o))}},{key:"setAllRcvMsgOpt",value:function(e){return this._msgRemindHandler.setAllRcvMsgOpt(e)}},{key:"getAllRcvMsgOpt",value:function(){return this._msgRemindHandler.getAllRcvMsgOpt()}},{key:"onAllRcvMsgOptNotify",value:function(e){this._msgRemindHandler.onAllRcvMsgOptNotify(e)}},{key:"clearUnreadCount",value:function(e){e=this.getLocalConversation(e),e&&0<e.unreadCount&&(e.unreadCount=0,this.emitConvUpdate(!0,!1))}},{key:"storeHoppingMessageList",value:function(e){this._msgListHandler.storeHoppingMsgList(e)}},{key:"clearMemMsg",value:function(e){var t=1<arguments.length&&arguments[1]!==void 0&&arguments[1];d.l("".concat(this._n,".clearMemMsg convID:").concat(e," isOverLimit:").concat(t)),this._msgListHandler.removeByConvID(e),this._completedMap.delete(e),this._roamingMsgKeyAndTimeMap.delete(e),t&&this._everClearedMap.set(e,1)}},{key:"findMsgBySeq",value:function(e,t){return this._msgListHandler.findMsgBySeq(e,t)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._setStorageConvList(!0),this._pagingStatus=pt,this._msgListHandler.reset(),this._msgRemindHandler.reset(),this._roamingMsgKeyAndTimeMap.clear(),this._sll.reset(),this._peerReadTimeMap.clear(),this._completedMap.clear(),this._convMap.clear(),this._pagingTs=0,this._pagingStartIdx=0,this._pagingPinnedTs=0,this._pagingPinnedStartIdx=0,this._remoteGroupReadSeqMap.clear(),this._convTotalUnreadCount=0,this._pagingGetCostList.length=0,this._pagingConvIDMap.clear(),this._convIDFromUnreadDBMap.clear(),this._pagingGetCostList.length=0,this._convMapForDiff.clear(),this._partialUpdatedConvMap.clear(),this._everClearedMap.clear(),this._bPullOnInvite=!0,this._convGroupHandler.reset(),this.resetReady()}}])),Ri=b(function e(t){U(this,e),this._grpM=t,this._n="GroupTipsHandler",this._cachedGroupTipsMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4},[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupTipsMap.size&&this._check()}},{key:"_check",value:function(){var e=this;this._cachedGroupTipsMap.forEach(function(t,n){var o=e._checkCountMap.get(n),s=e._grpM.hasLocalGroup(n);d.l("".concat(e._n,"._check groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupTips(n),e._checkCountMap.delete(n),e._grpM.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupTips(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++o)})}},{key:"onNewGroupTips",value:function(o){d.l("".concat(this._n,".onNewGroupTips options:").concat(JSON.stringify(o.dataList)));var o=this._assembly(o),t=o.eventDataList,n=o.result,o=o.AVChatRoomMessageList;0<o.length&&this._grpM.onAVChatRoomMessage(o),0<n.length&&(this._grpM.emitOEvt(F.MESSAGE_RECEIVED,n),this._handleTips(n)),0<t.length&&(this._grpM.updateNextMessageSeq(t),this._grpM.get(11).onNewMessage({conversationOptionsList:t,isInstantMessage:!0}))}},{key:"_assembly",value:function(e){for(var t=e.event,n=e.dataList,o=null,s=[],a=[],i={},r=[],c=0,u=n.length;c<u;c++){var l=Po(n[c]);if(!(t===6&&(this._grpM.isGroupAttributesUpdatedNotice(l)||this._grpM.isGroupCountersNotice(l)))){var C=l.groupProfile,_=C.groupID,m=C.communityType,m=m===void 0?0:m,f=C.topicID,f=f===void 0?void 0:f,I=C.invisible,C=C.groupType,C=C===void 0?void 0:C,M=l.elements.operationType;if(M!==16&&M!==17){var M=void 0,S=this._grpM.isMessageFromTopic(m,f),L=(S&&(M=g.CONV_TOPIC,l.to=f),this._grpM.hasLocalGroup(_));if(L||!this._grpM.isUnjoinedAVChatRoom(_))if(L||S)if(this._grpM.isMessageFromOrToAVChatroom(_))l.event=t,r.push(l);else if(l.currentUser=this._grpM.getMyUserID(),l.conversationType=g.CONV_GROUP,(o=new Ce(l)).setElement({type:g.MSG_GRP_TIP,content:p(p({},l.elements),{},{groupProfile:l.groupProfile})}),o.isSystemMessage=!1,I!==1){var L=this._grpM.get(11),S=o,I=S.conversationID,S=S.sequence;if(t===6)o._onlineOnlyFlag=!0,a.push(o);else if(!L.pushIntoNoticeResult(a,o))continue;this._grpM.isMessageFromCommunityOfTopic(m,f)||t===6&&L.getLocalConversation(I)||(t!==6&&this._qualityStat(o),m=L.isRemoteRead({conversationID:I,sequence:S}),T(i[I])?(f=0,o.flow!=="in"||o._isExcludedFromUnreadCount||o._onlineOnlyFlag||m||(f=1),i[I]=s.push({conversationID:I,unreadCount:f,type:T(M)?o.conversationType:M,subType:o.conversationSubType,lastMessage:o._isExcludedFromLastMessage?"":o})-1):(s[L=i[I]].type=o.conversationType,s[L].subType=o.conversationSubType,s[L].lastMessage=o._isExcludedFromLastMessage?"":o,o.flow!=="in"||o._isExcludedFromUnreadCount||o._onlineOnlyFlag||m||s[L].unreadCount++))}else this._qualityStat(o);else this._cacheAndCompare({groupID:_,event:t,item:l,groupType:C})}else this._grpM.onPinnedMessageNotify(l)}}return{eventDataList:s,result:a,AVChatRoomMessageList:r}}},{key:"_qualityStat",value:function(e){this._grpM.get(26).addMessageSequence({key:Yt,message:e})}},{key:"_handleTips",value:function(e){var t=this;e.forEach(function(n){switch(n.payload.operationType){case 1:t._onNewMemberComeIn(n);break;case 2:t._onMemberQuit(n);break;case 3:t._onMemberKickedOut(n);break;case 4:t._onMemberSetAdmin(n);break;case 5:t._onMemberCancelledAdmin(n);break;case 6:t._onGroupProfileModified(n);break;case 7:t._onMemberInfoModified(n);break;case 8:t._onTopicProfileUpdated(n);break;default:d.w("".concat(t._n,"._handleTips unknown operationType:").concat(n.payload.operationType))}})}},{key:"_onNewMemberComeIn",value:function(n){var n=n.payload,t=n.memberNum,n=n.groupProfile.groupID,n=this._grpM.getLocalGroupProfile(n);n&&Y(t)&&n.memberCount!==t&&(n.memberCount=t,this._updateConvGroupProfile(n))}},{key:"_onMemberQuit",value:function(e){var n=e.payload,t=n.memberNum,n=n.groupProfile.groupID,o=this._grpM.getLocalGroupProfile(n);o&&Y(t)&&o.memberCount!==t&&(o.memberCount=t,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_onMemberKickedOut",value:function(e){var n=e.payload,t=n.memberNum,n=n.groupProfile.groupID,o=this._grpM.getLocalGroupProfile(n);o&&Y(t)&&o.memberCount!==t&&(o.memberCount=t,this._updateConvGroupProfile(o)),this._grpM.getGroupMemberHandler().deleteLocalGroupMembers(n,e.payload.userIDList)}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_onMemberSetAdmin",value:function(n){var t=n.payload.groupProfile.groupID,n=n.payload.userIDList,o=this._grpM.getGroupMemberHandler();n.forEach(function(s){s=o.getLocalGroupMemberInfo(t,s),s&&s.updateRole(g.GRP_MBR_ROLE_ADMIN)})}},{key:"_onMemberCancelledAdmin",value:function(n){var t=n.payload.groupProfile.groupID,n=n.payload.userIDList,o=this._grpM.getGroupMemberHandler();n.forEach(function(s){s=o.getLocalGroupMemberInfo(t,s),s&&s.updateRole(g.GRP_MBR_ROLE_MEMBER)})}},{key:"_onGroupProfileModified",value:function(s){var t=this,s=s.payload,n=s.newGroupProfile,i=s.groupProfile,o=s.operatorInfo,s=i.groupID,a=this._grpM.getLocalGroupProfile(s),i=(Object.keys(n).forEach(function(r){switch(r){case"ownerID":t._ownerChanged(a,n);break;case"groupName":a.name=n[r];break;default:a[r]=n[r]}}),T(o)||a.selfInfo.userID!==o.userID||Object.keys(o).forEach(function(r){var c;r==="nameCard"?a.updateSelfInfo({nameCard:o[r]}):r==="role"&&(c="",o[r]===400?c=g.GRP_MBR_ROLE_OWNER:o[r]===300?c=g.GRP_MBR_ROLE_ADMIN:o[r]===200&&(c=g.GRP_MBR_ROLE_MEMBER),a.updateSelfInfo({role:c}))}),!a.isSupportTopic);this._grpM.emitGroupListUpdate(!0,i)}},{key:"_ownerChanged",value:function(s,r){var n,o,s=s.groupID,a=this._grpM.getLocalGroupProfile(s),i=this._grpM.getMyUserID(),r=r.ownerID;i===r&&(i=(o=this._grpM.getGroupMemberHandler()).getLocalGroupMemberInfo(s,i),n=this._grpM.getLocalGroupProfile(s).ownerID,o=o.getLocalGroupMemberInfo(s,n),a.updateGroup({ownerID:r,selfInfo:{role:g.GRP_MBR_ROLE_OWNER}}),i&&i.updateRole(g.GRP_MBR_ROLE_OWNER),o)&&o.updateRole(g.GRP_MBR_ROLE_MEMBER)}},{key:"_onMemberInfoModified",value:function(e){var t=e.to,o=e.payload,n=o.groupProfile,o=o.memberList,s=n.groupID,a=(he(t)&&this._updateTopicMuteTime(e),this._grpM.getGroupMemberHandler());o.forEach(function(i){var r=a.getLocalGroupMemberInfo(s,i.userID);r&&Y(i.muteTime)&&r.updateMuteUntil(i.muteTime)})}},{key:"_updateTopicMuteTime",value:function(o){var t=o.to,o=o.payload,s=o.groupProfile,o=o.memberList,n=o===void 0?[]:o,o=this._grpM.get(10),s=s.groupID,a=o.getLocalTopic(s,t);if(a){for(var i=!1,r=0;r<n.length;r++){var c=n[r];if(c.userID===this._grpM.getMyUserID()&&0<=c.muteTime){a.updateSelfInfo({muteTime:c.muteTime}),i=!0;break}}i&&this._grpM.emitOEvt(F.TOPIC_UPDATED,{groupID:s,topic:a})}}},{key:"_onTopicProfileUpdated",value:function(e){var n=e.payload,t=n.groupProfile.groupID,n=n.newTopicInfo;this._grpM.get(10).onTopicProfileUpdated(p({groupID:t,topicID:e.to},n))}},{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,t){var n=this,o=this._cachedGroupTipsMap.get(e)||[];d.l("".concat(this._n,"._notifyCachedGroupTips groupID:").concat(e," groupType:").concat(t," count:").concat(o.length)),o.forEach(function(s){n.onNewGroupTips(s)}),this._deleteCachedGroupTips(e)}},{key:"_cacheAndCompare",value:function(o){var t=o.groupID,s=o.event,n=o.item,o=o.groupType,s=(d.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(o)),this._cacheGroupTips(t,{event:s,dataList:[n]}),{groupID:t,type:o});o===g.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupTips(t,o):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([s]),this._notifyCachedGroupTips(t,o)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"reset",value:function(){this._cachedGroupTipsMap.clear(),this._checkCountMap.clear()}}]),Ai=b(function e(t){U(this,e),this._grpM=t,this._n="CommonGroupHandler",this.tempConversationList=null,this._cachedGroupMessageMap=new Map,this._checkCountMap=new Map,this.MAX_CHECK_COUNT=4,this.PAGING_GRP_COUNT_LIMIT=200,this._pagingStatus=pt,this._pagingGetCostList=[],t.getIEmitInst().on(ne.A2KEY_AND_TINYID_UPDATED,this.syncGroupList,this)},[{key:"onCheckTimer",value:function(e){e%1==0&&0<this._cachedGroupMessageMap.size&&this._check()}},{key:"_check",value:function(){var e=this;this._cachedGroupMessageMap.forEach(function(t,n){var o=e._checkCountMap.get(n),s=e._grpM.hasLocalGroup(n);d.l("".concat(e._n,"._check groupID:").concat(n," hasLocalGroup:").concat(s," checkCount:").concat(o)),s?(e._notifyCachedGroupMessage(n),e._checkCountMap.delete(n),e._grpM.deleteUnjoinedAVChatRoom(n)):o>=e.MAX_CHECK_COUNT?(e._deleteCachedGroupMessage(n),e._checkCountMap.delete(n)):e._checkCountMap.set(n,++o)})}},{key:"updateLastMsg",value:function(e){var t="".concat(this._n,".updateLastMsg");if(this._grpM.getGroupMap().size!==0){for(var n,o,s,a,i=!1,r=e.length,c=0;c<r;c++)(n=e[c]).type===g.CONV_GROUP&&n.lastMessage.lastSequence!==0&&n.lastMessage.payload!==null&&(o=n.conversationID.split(/^GROUP/)[1],o=this._grpM.getLocalGroupProfile(o))&&(s=o.lastMessage,a=n.lastMessage,JSON.stringify(s)!==JSON.stringify(a))&&(o.lastMessage=p({},n.lastMessage),i=!0);d.l("".concat(t," convCount:").concat(r," groupCount:").concat(this._grpM.getLocalGroupList().length," isUpdated:").concat(i)),i&&(this._grpM.sortLocalGroupList(),this._grpM.emitGroupListUpdate(!0,!1))}else this.tempConversationList=e}},{key:"onNewMessage",value:function(e){var o=this._assembly(e),t=o.conversationOptionsList,n=o.messageList,o=o.AVChatRoomMessageList,o=(0<o.length&&this._grpM.onAVChatRoomMessage(o),Go(n)),o=(0<o.length&&this._grpM.emitOEvt(F.MESSAGE_MODIFIED,o),0<t.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:t,isInstantMessage:e.isInstantMessage!==!1,updateUnreadCount:e.updateUnreadCount!==!1}),this._grpM.updateNextMessageSeq(t)),Uo(n));0<o.length&&this._grpM.emitOEvt(F.MESSAGE_RECEIVED,o),n.length=0}},{key:"_assembly",value:function(e){var t=e.dataList,n=e.event,o=e.isInstantMessage,s=null,a=[],i=[],r=[],c={},u=this._grpM.getFileDownloadProxy(),l=this._grpM.getDownloadFileAuthKey(),_=this._grpM.get(17).getFileDNList(),m=t.length;1<m&&t.sort(function($,fe){return $.sequence-fe.sequence});for(var f=this._grpM.get(11),I=this._grpM.get(4),C=0;C<m;C++){var M,S=Po(t[C]),x=S.groupProfile,L=x.groupID,P=x.communityType,P=P===void 0?0:P,w=x.topicID,w=w===void 0?void 0:w,B=x.invisible,x=x.groupType,x=x===void 0?void 0:x,j=void 0,se=this._grpM.isMessageFromTopic(P,w),ae=(se&&(j=g.CONV_TOPIC,S.to=w),this._grpM.hasLocalGroup(L));!ae&&this._grpM.isUnjoinedAVChatRoom(L)||(ae||se?this._grpM.isMessageFromOrToAVChatroom(L)?(S.event=n,r.push(S)):(S.currentUser=this._grpM.getMyUserID(),S.conversationType=g.CONV_GROUP,S.isSystemMessage=!!S.isSystemMessage,(s=new Ce(S)).setElement(S.elements,u,l,_),B!==1?(ae=t[C].isModified===1,f.isMessageSentByCurrentInstance(s)?s.isModified=ae:ae=!1,S.onlineOnlyFlag===1?(s._onlineOnlyFlag=!0,f.isMessageSentByCurrentInstance(s)||i.push(s)):this._grpM.isMessageFromCommunityOfTopic(P,w)?i.push(s):(s.from===this._grpM.getMyUserID()&&(se=f.getLatestMessageSentByMe(s.conversationID))&&(B=se.nick,P=se.avatar,B===s.nick&&P===s.avatar||(f.modifyMessageSentByMe({conversationID:M,latestNick:s.nick,latestAvatar:s.avatar}),I.mockOnNickAvatarModified(s.nick,s.avatar))),f.pushIntoMessageList(i,s,ae)&&(this._qualityStat(o,s),M=(w=s).conversationID,se=w.sequence,B=f.isRemoteRead({conversationID:M,sequence:se}),T(c[M])?(P=0,s.flow!=="in"||s._isExcludedFromUnreadCount||B||(P=1),c[M]=a.push({conversationID:M,unreadCount:P,type:T(j)?s.conversationType:j,subType:s.conversationSubType,lastMessage:s._isExcludedFromLastMessage?"":s})-1):(a[ae=c[M]].type=T(j)?s.conversationType:j,a[ae].subType=s.conversationSubType,a[ae].lastMessage=s._isExcludedFromLastMessage?"":s,s.flow!=="in"||s._isExcludedFromUnreadCount||B||a[ae].unreadCount++)))):this._qualityStat(o,s)):this._cacheAndCompare({groupID:L,event:n,item:S,groupType:x}))}return{conversationOptionsList:a,messageList:i,AVChatRoomMessageList:r}}},{key:"_qualityStat",value:function(e,t){var n=this._grpM.get(26);n.addMessageSequence({key:Yt,message:t}),e&&0<t.clientTime&&n.addMessageDelay(t.clientTime)}},{key:"onMsgRevoked",value:function(e,t){var n=this,o=this._grpM.get(11),s=[],a=[];e.dataList.forEach(function(i){var r=i.elements.revokedInfos,c=i.revokerInfo,u=i.groupProfile,l=!1;u&&(l=we({groupID:u.groupID})||!k(u.topicID)),T(r)||r.forEach(function(_){var m,f=k(_.topicID)?"GROUP".concat(_.groupID):"GROUP".concat(_.topicID),I=o.getLocalConversation(f),C=_.revokerInfo&&_.revokerInfo.revoker||c&&c.revoker,M=c&&c.reason||"";I&&be(I.type)?m={conversationID:f,sequence:_.sequence,ID:"".concat(_.tinyID,"-").concat(_.clientTime,"-").concat(_.random)}:(I=o.revoke(f,_.sequence,_.random))?m=I:(m={conversationID:f,sequence:_.sequence},_.tinyID&&_.clientTime&&_.random&&(m.ID="".concat(_.tinyID,"-").concat(_.clientTime,"-").concat(_.random)),_.time&&(m.time=_.time)),m&&(m.revoker=C,m.revokeReason=M,m.revokerInfo={userID:C,nick:"",avatar:""},(l?(m.revokerInfo.nick=u.nick,m.revokerInfo.avatar=u.avatar,s):a).push(m))})}),a.length===0&&s.length===0||(o.onMessageRevoked([].concat(s,a),t),0<s.length&&this._grpM.emitOEvt(F.MESSAGE_REVOKED,s),0<a.length&&o.updateRevokerInfo(a).then(function(i){n._grpM.emitOEvt(F.MESSAGE_REVOKED,i)}))}},{key:"_groupListTreeShaking",value:function(e){for(var t=new Map(G(this._grpM.getGroupMap())),n=0,o=e.length;n<o;n++)t.delete(e[n].groupID);this._grpM.hasJoinedAVChatRoom()&&this._grpM.getJoinedAVChatRoom().forEach(function(r){t.delete(r)}),this._grpM.getGroupMap().forEach(function(r,c){r.isSupportTopic&&t.delete(c)});for(var s=G(t.keys()),a=0,i=s.length;a<i;a++)this._grpM.deleteGroup(s[a])}},{key:"syncGroupList",value:function(){var e,t,n=this,o=0<arguments.length&&arguments[0]!==void 0&&arguments[0],s=(this._pagingStatus===pt&&this._grpM.clearGroupMap(),G(Ds)),a=this.PAGING_GRP_COUNT_LIMIT,i=[];return o===!0?this._pagingGetGroupListWithTopic({limit:a,offset:0,groupBaseInfoFilter:s,groupList:i}):(o="syncGroupList",e="".concat(this._n,".").concat(o),t=new D(o),this._pagingGetGroupList({limit:a,offset:0,groupBaseInfoFilter:s,groupList:i}).then(function(){var r=ra(n._pagingGetCostList),c=ia(n._pagingGetCostList),u=(n._pagingGetCostList.length=0,n._pagingStatus=cn,n._groupListTreeShaking(i),n._grpM.updateGroupMap(i),n._grpM.getLocalGroupList().length),u="count:".concat(u," sum:").concat(c," avg:").concat(r);return d.l("".concat(e," ok. ").concat(u)),t.setMessage(u).end(),n.tempConversationList&&(n.updateLastMsg(n.tempConversationList),n.tempConversationList=null),n._grpM.emitGroupListUpdate(!0,!0),N({groupList:n._grpM.getLocalGroupList()})}).catch(function(r){return n._pagingStatus=Vt,t.setError(r).end(),d.e("".concat(e," failed. error:"),r),v(r)}))}},{key:"getGroupList",value:function(){var e,t=this,n="".concat(this._n,".").concat("getGroupList");return d.l("".concat(n," pagingStatus:").concat(this._pagingStatus)),this._pagingStatus===Vt||this._pagingStatus===pt?this.syncGroupList().then(function(){var o=t._grpM.getLocalGroupList();return N({groupList:o,isSyncCompleted:t.isPagingGetCompleted()})}).catch(function(o){return d.e("".concat(n," failed. error:"),o),v(o)}):(e=this._grpM.getLocalGroupList(),d.l("".concat(n,". returned group count:").concat(e.length)),q({groupList:e,isSyncCompleted:this.isPagingGetCompleted()}))}},{key:"isPagingGetCompleted",value:function(){return this._pagingStatus===cn}},{key:"_pagingGetGroupList",value:function(e){var t=this,n="".concat(this._n,".").concat("_pagingGetGroupList"),c=e.isCommunityRelay,o=c!==void 0&&c,s=e.limit,a=e.offset,i=e.groupBaseInfoFilter,r=e.groupList,c=void 0,u=(o&&(c=g.GRP_COMMUNITY,i.push("AtInfoList")),Date.now());return this._grpM.req({P:h.GET_GRP_LIST,data:{type:c,memberAccount:this._grpM.getMyUserID(),limit:s,offset:a,responseFilter:{groupBaseInfoFilter:i,selfInfoFilter:["Role","JoinTime","MsgFlag","MsgSeq"]}}}).then(function(f){var f=f.data,_=f.groups,_=_===void 0?[]:_,f=f.totalCount,_=(r.push.apply(r,G(_)),t._handleGroupAtInfoWithoutTopic(o,_),a+s),m=!(_<f),f="offset:".concat(a," limit:").concat(s," total:").concat(f," isCompleted:").concat(m," ")+"current:".concat(r.length," isCommunityRelay:").concat(o);return t._pagingGetCostList.push(ye(u,!1)),d.l("".concat(n," ok. ").concat(f," cost:").concat(ye(u))),o||m?!o&&m?(d.l("".concat(n," start to get community list")),a=0,t._pagingGetGroupList({limit:s,offset:a,groupBaseInfoFilter:i,groupList:r,isCommunityRelay:!0})):o&&!m?(a=_,t._pagingGetGroupList({limit:s,offset:a,groupBaseInfoFilter:i,groupList:r,isCommunityRelay:!0})):N({groupList:r}):(a=_,t._pagingGetGroupList({limit:s,offset:a,groupBaseInfoFilter:i,groupList:r}))}).catch(function(l){return l.code===10018?(d.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(s)),s=50,t._pagingGetGroupList({limit:s,offset:a,groupBaseInfoFilter:i,groupList:r,isCommunityRelay:o})):o?(l.code===11e3&&d.l("".concat(n," ok. community unavailable")),q({groupList:r})):v(l)})}},{key:"_pagingGetGroupListWithTopic",value:function(e){var t=this,n="".concat(this._n,"._pagingGetGroupListWithTopic"),o=e.limit,s=e.offset,a=e.groupBaseInfoFilter,i=e.groupList,r=Date.now();return this._grpM.req({P:h.GET_GRP_LIST,data:{type:g.GRP_COMMUNITY,memberAccount:this._grpM.getMyUserID(),limit:o,offset:s,responseFilter:{groupBaseInfoFilter:a,selfInfoFilter:G(Es)},isSupportTopic:1,needAppDefineData:1}}).then(function(u){var u=u.data,l=u.groups,u=u.totalCount,l=(i.push.apply(i,G(l===void 0?[]:l)),s+o),_=!(l<u);return d.l("".concat(n," ok. offset:").concat(s," limit:").concat(o," totalCount:").concat(u," isCompleted:").concat(_," currentCount:").concat(i.length," cost:").concat(ye(r))),_?(t._grpM.updateGroupMap(i),t._grpM.emitGroupListUpdate(!0,!1),u=t._grpM.getLocalGroupList().filter(function(m){return m.isSupportTopic===!0}),N({groupList:u})):(s=l,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:a,groupList:i}))}).catch(function(c){return c.code===10018?(d.w("".concat(t.logPrefix," response size exceeds the limit, request count:").concat(o)),o=50,t._pagingGetGroupListWithTopic({limit:o,offset:s,groupBaseInfoFilter:a,groupList:i})):v(c)})}},{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,t){var n=this,o=this._cachedGroupMessageMap.get(e)||[];d.l("".concat(this._n,"._notifyCachedGroupMessage groupID:").concat(e," groupType:").concat(t," count:").concat(o.length)),o.forEach(function(s){n.onNewMessage(s)}),this._deleteCachedGroupMessage(e)}},{key:"_cacheAndCompare",value:function(o){var t=o.groupID,s=o.event,n=o.item,o=o.groupType,s=(d.l("".concat(this._n,"._cacheAndCompare groupID:").concat(t," groupType:").concat(o)),this._cacheGroupMessage(t,{event:s,dataList:[n]}),{groupID:t,type:o});o===g.GRP_AVCHATROOM?this._grpM.hasLocalGroup(t)?this._notifyCachedGroupMessage(t,o):this._grpM.setUnjoinedAVChatRoom(t):(this._grpM.updateGroupMap([s]),this._notifyCachedGroupMessage(t,o)),this._checkCountMap.has(t)||this._checkCountMap.set(t,0)}},{key:"_handleGroupAtInfoWithoutTopic",value:function(e,t){var n=this;e&&t.length!==0&&t.forEach(function(a){var s=a.groupID,a=a.groupAtInfoList,i=[];T(a)||(a.forEach(function(r){i.push(p(p({},r),{},{groupID:s}))}),n._grpM.get(11).onNewGroupAtTips({dataList:i}))})}},{key:"setPagingGroupCount",value:function(e){T(e)||(this.PAGING_GRP_COUNT_LIMIT=parseInt(e,10))}},{key:"reset",value:function(){this.PAGING_GRP_COUNT_LIMIT=200,this._cachedGroupMessageMap.clear(),this._checkCountMap.clear(),this._pagingStatus=pt,this._pagingGetCostList=[]}}]),Oi=b(function e(t){U(this,e),this._grpM=t,this._n="GroupAttributesHandler",this._groupAttributesMap=new Map,this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_attr_cache_time");T(e)||(this.CACHE_EXPIRE_TIME=Number(e))}},{key:"updateLocalMainSequenceOnReconnected",value:function(){this._groupAttributesMap.forEach(function(e){e.localMainSequence=0})}},{key:"isGroupAttributesUpdatedNotice",value:function(n){var t=n.to,n=n.elements.newGroupProfile,o=!T(n)&&!k(n.groupAttributeOption);return o&&this._onGroupAttributesUpdated({groupID:t,groupAttributeOption:n.groupAttributeOption}),o}},{key:"_onGroupAttributesUpdated",value:function(r){var t,n=this,o=r.groupID,r=r.groupAttributeOption,s=r.mainSequence,a=r.isWithChangedAttributeInfo,i=r.groupAttributeList,i=i===void 0?[]:i,r=r.operationType;d.l("".concat(this._n,".onGroupAttributesUpdated. ")+"groupID:".concat(o," isWithChangedAttributeInfo:").concat(a," operationType:").concat(r)),T(r)||(this._groupAttributesCopy=this._getCachedAttributes({groupID:o}),(t=s-this._getLocalGroupAttributes(o).localMainSequence)!=0&&(a===1&&t==1?(this._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:s,groupAttributeList:i,operationType:r}),this._emitGroupAttributesUpdated(o)):this._hasLocalGroupAttributes(o)&&(a=this._getLocalGroupAttributes(o).avChatRoomKey,this._getGroupAttributes({groupID:o,avChatRoomKey:a}).then(function(){n._emitGroupAttributesUpdated(o)}))))}},{key:"initGroupAttributesCache",value:function(n){var t=n.groupID,n=n.avChatRoomKey,n=n===void 0?void 0:n;this._groupAttributesMap.set(t,{lastUpdateTime:0,localMainSequence:0,remoteMainSequence:0,attributes:new Map,avChatRoomKey:n}),d.l("".concat(this._n,".initGroupAttributesCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"initGroupAttributes",value:function(a){var t=this,n=a.groupID,o=a.groupAttributes,a=this._getLocalGroupAttributes(n),s=a.remoteMainSequence,a=a.avChatRoomKey,i=new D("initGroupAttributes");return i.setMessage("groupID:".concat(n," avChatRoomKey:").concat(a," mainSequence:").concat(s)),this._grpM.req({P:h.SET_GRP_ATTR,data:{groupID:n,avChatRoomKey:a,mainSequence:s,groupAttributeList:this._transformGroupAttributes(o)}}).then(function(u){d.l("".concat(t._n,".").concat("initGroupAttributes"," ok. groupID:").concat(n));var u=u.data,c=u.mainSequence,u=G(u.groupAttributeList);return u.forEach(function(l){l.value=o[l.key]}),t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:c,groupAttributeList:u,operationType:1}),t._emitGroupAttributesUpdated(n),i.end(),N({groupAttributes:o})}).catch(function(r){return i.setError(r).end(),v(r)})}},{key:"setGroupAttributes",value:function(c){var t=this,n="".concat(this._n,".").concat("setGroupAttributes"),o=c.groupID,s=c.groupAttributes,c=this._getLocalGroupAttributes(o),a=c.remoteMainSequence,i=c.avChatRoomKey,r=c.attributes,c=this._transformGroupAttributes(s),u=(c.forEach(function(l){var _=l.key;l.sequence=0,r.has(_)&&(l.sequence=r.get(_).sequence)}),new D("setGroupAttributes"));return u.setMessage("groupID:".concat(o," groupAttributes:").concat(JSON.stringify(s))),d.l("".concat(n,". groupID:").concat(o," mainSequence:").concat(a)),this._grpM.req({P:h.MODIFY_GRP_ATTR,data:{groupID:o,avChatRoomKey:i,mainSequence:a,groupAttributeList:c}}).then(function(m){d.l("".concat(n," ok."));var m=m.data,_=m.mainSequence,m=G(m.groupAttributeList);return m.forEach(function(f){f.value=s[f.key]}),t._groupAttributesCopy=t._getCachedAttributes({groupID:o}),t._refreshCachedGroupAttributes({groupID:o,remoteMainSequence:_,groupAttributeList:m,operationType:2}),t._emitGroupAttributesUpdated(o),u.end(),N({groupAttributes:s})}).catch(function(l){return u.setError(l).end(),v(l)})}},{key:"deleteGroupAttributes",value:function(o){var t=this,n=o.groupID,o=o.keyList,o=o===void 0?[]:o,r=this._getLocalGroupAttributes(n),s=r.remoteMainSequence,u=r.avChatRoomKey,a=r.attributes,i=G(a.keys()),r=h.CLEAR_GRP_ATTR,c=3,u={groupID:n,avChatRoomKey:u,mainSequence:s},l=[],_=(0<o.length&&(i=[],r=h.DEL_GRP_ATTR,c=4,o.forEach(function(m){var f=0;a.has(m)&&(f=a.get(m).sequence,i.push(m)),l.push({key:m,sequence:f})}),u.groupAttributeList=l),new D("deleteGroupAttributes"));return _.setMessage("groupID:".concat(n," mainSequence:").concat(s," keyList:").concat(o," proto:").concat(r)),this._grpM.req({P:r,data:u}).then(function(m){return d.l("".concat(t._n,".").concat("deleteGroupAttributes"," ok. groupID:").concat(n)),m=m.data.mainSequence,t._groupAttributesCopy=t._getCachedAttributes({groupID:n}),t._refreshCachedGroupAttributes({groupID:n,remoteMainSequence:m,groupAttributeList:l,operationType:c}),t._emitGroupAttributesUpdated(n),_.end(),N({keyList:i})}).catch(function(m){return _.setError(m).end(),v(m)})}},{key:"getGroupAttributes",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupAttributes"),o=e.groupID,r=this._getLocalGroupAttributes(o),s=r.avChatRoomKey,a=r.lastUpdateTime,i=r.localMainSequence,r=r.remoteMainSequence,c=new D("getGroupAttributes");return c.setMessage("groupID:".concat(o," localMainSequence:").concat(i," remoteMainSequence:").concat(r," keyList:").concat(e.keyList)),Date.now()-a>=this.CACHE_EXPIRE_TIME||i<r?this._getGroupAttributes({groupID:o,avChatRoomKey:s}).then(function(u){return c.setMoreMessage("from remote. count:".concat(u.length)).end(),d.l("".concat(n," from remote. groupID:").concat(o)),u=t._getCachedAttributes(e),N({groupAttributes:u})}).catch(function(u){return c.setError(u).end(),v(u)}):(c.setMoreMessage("from cache localMainSequence:".concat(i," remoteMainSequence:").concat(r)).end(),d.l("".concat(n," from cache. groupID:").concat(o)),a=this._getCachedAttributes(e),q({groupAttributes:a}))}},{key:"_getGroupAttributes",value:function(e){var t=this,n=0;return T(e.avChatRoomKey)||(n=1),this._grpM.req({P:h.GET_GRP_ATTR,data:p(p({},e),{},{groupType:n})}).then(function(a){d.l("".concat(t._n,"._getGroupAttributes ok. groupID:").concat(e.groupID));var a=a.data,s=a.mainSequence,s=s===void 0?0:s,a=a.groupAttributeList,i=G(a);return t._refreshCachedGroupAttributes({groupID:e.groupID,remoteMainSequence:s,groupAttributeList:i,operationType:5}),a}).catch(function(o){return v(o)})}},{key:"_refreshCachedGroupAttributes",value:function(s){var t=s.groupID,n=s.remoteMainSequence,o=s.groupAttributeList,s=s.operationType;if(this._hasLocalGroupAttributes(t)){var a=this._getLocalGroupAttributes(t),i=a.localMainSequence;if(s===5||n-i==1)a.remoteMainSequence=n,a.localMainSequence=n,a.lastUpdateTime=Date.now(),this._updateCachedAttributes({groupAttributes:a,groupAttributeList:o,operationType:s});else{if(i===n)return;a.remoteMainSequence=n}this._groupAttributesMap.set(t,a),o="operationType:".concat(s," localMainSequence:").concat(i," remoteMainSequence:").concat(n),d.l("".concat(this._n,"._refreshCachedGroupAttributes. ").concat(o))}}},{key:"_getCachedAttributes",value:function(n){var t=n.groupID,n=n.keyList,n=n===void 0?[]:n,o={};if(this._hasLocalGroupAttributes(t)){var s=this._getLocalGroupAttributes(t).attributes;if(0<n.length)n.forEach(function(c){s.has(c)&&(o[c]=s.get(c).value)});else{var a,i=Se(s.keys());try{for(i.s();!(a=i.n()).done;){var r=a.value;o[r]=s.get(r).value}}catch(c){i.e(c)}finally{i.f()}}}return o}},{key:"_updateCachedAttributes",value:function(o){var t=o.groupAttributes,n=o.groupAttributeList,o=o.operationType;o!==3?o!==4?(o===1&&t.attributes.clear(),n.forEach(function(r){var a=r.key,i=r.value,r=r.sequence;t.attributes.set(a,{value:i,sequence:r})})):n.forEach(function(s){t.attributes.delete(s.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}),o=this._computeAttrChangedInfo(t),n=o.updatedKeyList,o=o.deletedKeyList;d.l("".concat(this._n,"._emitGroupAttributesUpdated update:").concat(n.length,", delete:").concat(o.length)),n.length===0&&o.length===0||this._grpM.emitOEvt(F.GROUP_ATTRIBUTES_UPDATED,{groupID:e,groupAttributes:t,updatedKeyList:n,deletedKeyList:o})}},{key:"_computeAttrChangedInfo",value:function(e){var t=this,n=[],o=[];return Object.keys(e).forEach(function(s){e[s]!==t._groupAttributesCopy[s]&&n.push(s)}),Object.keys(this._groupAttributesCopy).forEach(function(s){T(e[s])&&o.push(s)}),this._groupAttributesCopy={},{updatedKeyList:n,deletedKeyList:o}}},{key:"deleteLocalGroupAttributes",value:function(e){this._hasLocalGroupAttributes(e)&&this._groupAttributesMap.delete(e)}},{key:"reset",value:function(){this._groupAttributesMap.clear(),this._groupAttributesCopy={},this.CACHE_EXPIRE_TIME=3e4}}]),Ni=b(function e(t){U(this,e),this._grpM=t,this._n="GroupCountersHandler",this._groupCountersMap=new Map,this.EXPIRE_TIME=3e4,this._grpM.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this._grpM.getCloudConfig("grp_counter_expire_time");T(e)||(this.EXPIRE_TIME=Number(e))}},{key:"isGroupCountersNotice",value:function(n){var t=n.to,n=n.elements.groupCounterInfo,o=!1;return k(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(i){var s=i.type,a=i.groupCounterSeq,i=i.counterList,i=i===void 0?[]:i;s!==0&&s!==2||(t._updateLocalGroupCounters({groupID:n,groupCounterSeq:a,counterList:i}),i.forEach(function(r){t._grpM.emitOEvt(F.GROUP_COUNTER_UPDATED,{groupID:n,key:r.key,value:r.value})})),s===1&&t._deleteLocalGroupCounters({groupID:n,groupCounterSeq:a,counterList:i})}),d.l("".concat(this._n,"._onGroupCountersUpdated groupID:").concat(n))}},{key:"initGroupCountersCache",value:function(n){var t=n.groupID,n=n.avChatRoomKey;this._groupCountersMap.set(t,{lastUpdateTime:0,groupCounterSeq:0,counters:new Map,avChatRoomKey:n}),d.l("".concat(this._n,".initGroupCountersCache groupID:").concat(t," avChatRoomKey:").concat(n))}},{key:"setGroupCounters",value:function(e){var t,n,o,s,a;return this._grpM.canIUse(ee.GRP_COUNTER)?(t="".concat(this._n,".").concat("setGroupCounters"),n=e.groupID,e=e.counters,e=this._convertObjectToList(e),o=this._getLocalGroupCounters(n).avChatRoomKey,s="groupID:".concat(n," count:").concat(e.length),(a=new D("setGroupCounters")).setMessage("".concat(s)),d.l("".concat(t,". ").concat(s)),this._updateGroupCounters({groupID:n,counterList:e,avChatRoomKey:o,mode:"Set"}).then(function(i){return a.end(),d.l("".concat(t," ok.")),N({counters:i})}).catch(function(i){return a.setError(i).end(),d.e("".concat(t," failed. error:"),i),v(i)})):this._grpM.noUse("setGroupCounters")}},{key:"increaseGroupCounter",value:function(e){var t,n,o,s,a,i,r="increaseGroupCounter";return this._grpM.canIUse(ee.GRP_COUNTER)?(t="".concat(this._n,".").concat(r),n=e.groupID,o=e.key,e=e.value,s=this._getLocalGroupCounters(n).avChatRoomKey,a="groupID:".concat(n," key:").concat(o," value:").concat(e),(i=new D(r)).setMessage("".concat(a)),d.l("".concat(t,". ").concat(a)),this._updateGroupCounters({groupID:n,counterList:[{key:o,value:e}],avChatRoomKey:s,mode:"Increase"}).then(function(c){return i.end(),d.l("".concat(t," ok.")),N({counters:c})}).catch(function(c){return i.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})):this._grpM.noUse(r)}},{key:"decreaseGroupCounter",value:function(e){var t,n,o,s,a,i,r="decreaseGroupCounter";return this._grpM.canIUse(ee.GRP_COUNTER)?(t="".concat(this._n,".").concat(r),n=e.groupID,o=e.key,e=e.value,s=this._getLocalGroupCounters(n).avChatRoomKey,a="groupID:".concat(n," key:").concat(o," value:").concat(e),(i=new D(r)).setMessage("".concat(a)),d.l("".concat(t,". ").concat(a)),this._updateGroupCounters({groupID:n,counterList:[{key:o,value:e}],avChatRoomKey:s,mode:"Decrease"}).then(function(c){return i.end(),d.l("".concat(t," ok.")),N({counters:c})}).catch(function(c){return i.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})):this._grpM.noUse(r)}},{key:"getGroupCounters",value:function(i){var t=this;if(!this._grpM.canIUse(ee.GRP_COUNTER))return this._grpM.noUse("getGroupCounters");var n="".concat(this._n,".").concat("getGroupCounters"),o=i.groupID,i=i.keyList,s=i===void 0?[]:i,i=this._getLocalGroupCounters(o),a=i.avChatRoomKey,i=i.lastUpdateTime,r=new D("getGroupCounters");return r.setMessage("groupID:".concat(o)),Date.now()-i>=this.EXPIRE_TIME?this._getRemoteGroupCounters({groupID:o,avChatRoomKey:a}).then(function(c){return r.setMoreMessage("from remote. count:".concat(c.length)).end(),d.l("".concat(n," from remote. groupID:").concat(o)),c=t._getLocalCounters(o,s),N({counters:c})}).catch(function(c){return r.setError(c).end(),v(c)}):(r.setMoreMessage("from cache").end(),d.l("".concat(n," from cache. groupID:").concat(o)),i=this._getLocalCounters(o,s),q({counters:i}))}},{key:"_getRemoteGroupCounters",value:function(e){var t=this;return this._grpM.req({P:h.GET_GRP_COUNTER,data:p({},e)}).then(function(s){var s=s.data,o=s.counterList,o=o===void 0?[]:o,s=s.groupCounterSeq;return t._updateLocalGroupCounters({groupID:e.groupID,counterList:o,groupCounterSeq:s}),d.l("".concat(t._n,"._getRemoteGroupCounters ok. groupID:").concat(e.groupID)),o}).catch(function(n){return v(n)})}},{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 t="".concat(this._n,"._updateGroupCounters"),n=e.groupID,o=e.avChatRoomKey,s=e.mode;return d.l("".concat(t,". groupID:").concat(n," avChatRoomKey:").concat(o," mode:").concat(s)),this._grpM.req({P:h.UPDATE_GRP_COUNTER,data:p({},e)}).then(function(i){d.l("".concat(t," ok."));var i=i.data.counterList,r={};return(i===void 0?[]:i).forEach(function(l){var u=l.key,l=l.value;r[u]=l}),r}).catch(function(a){return v(a)})}},{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(i){var t,n,o,s=i.groupID,a=i.counterList,a=a===void 0?[]:a,i=i.groupCounterSeq;this._hasLocalGroupCounters(s)&&(o=this._getLocalGroupCounters(s),t=o.counters,n=o.avChatRoomKey,o=o.groupCounterSeq,0<i&&i<o||(a.forEach(function(u){var c=u.key,u=u.value;t.set(c,u)}),this._groupCountersMap.set(s,{lastUpdateTime:Date.now(),groupCounterSeq:i,counters:t,avChatRoomKey:n})))}},{key:"_deleteLocalGroupCounters",value:function(a){var t,n,o=a.groupID,s=a.counterList,s=s===void 0?[]:s,a=a.groupCounterSeq;this._hasLocalGroupCounters(o)&&(n=this._getLocalGroupCounters(o),t=n.counters,n=n.avChatRoomKey,s.forEach(function(i){t.delete(i.key)}),this._groupCountersMap.set(o,{lastUpdateTime:Date.now(),groupCounterSeq:a,counters:t,avChatRoomKey:n}))}},{key:"_getLocalCounters",value:function(e,t){var n={};if(this._hasLocalGroupCounters(e)){var o=this._getLocalGroupCounters(e).counters;if(0<t.length)t.forEach(function(r){o.has(r)&&(n[r]=o.get(r))});else{var s,a=Se(o.keys());try{for(a.s();!(s=a.n()).done;){var i=s.value;n[i]=o.get(i)}}catch(r){a.e(r)}finally{a.f()}}}return n}},{key:"reset",value:function(){this._groupCountersMap.clear(),this.EXPIRE_TIME=3e4}}]),Pi=b(function e(i){U(this,e);var n=i.manager,o=i.groupID,s=i.onInit,a=i.onSuccess,i=i.onFail;this._n="Polling",this._manager=n,this._grpM=n._grpM,this._onInit=s,this._onSuccess=a,this._onFail=i,this._groupID=o,this._timeoutID=-1,this._isRunning=!1,this._proto=h.AV_POLLING},[{key:"start",value:function(){var e=this._grpM.isLoggedIn();e||(this._proto=h.AV_NOAUTH_POLLING),d.l("".concat(this._n,".start pollingInterval:").concat(this._manager.getPollingInterval(this._groupID)," 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._grpM.req({P:this._proto,data:t}).then(function(n){e._onSuccess(e._groupID,n),e.isRunning()&&(-1<e._timeoutID&&clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.getPollingInterval(e._groupID)))}).catch(function(n){e._onFail(e._groupID,n),e.isRunning()&&(-1<e._timeoutID&&clearTimeout(e._timeoutID),e._timeoutID=setTimeout(e._request.bind(e),e._manager.MAX_POLLING_INTERVAL))})}},{key:"stop",value:function(){d.l("".concat(this._n,".stop timerID:").concat(this._timeoutID)),-1<this._timeoutID&&(clearTimeout(this._timeoutID),this._timeoutID=-1),this._isRunning=!1}},{key:"getPollingTimerID",value:function(){return this._timeoutID}}]),Ea={3:!0,4:!0,5:!0,6:!0,17:!0,20:!0,21:!0,100:!0},Gi=b(function e(t){U(this,e),this._grpM=t,this._n="AVChatRoomHandler",this._joinedGroupMap=new Map,this._pollingRequestInfoMap=new Map,this._pollingInstanceMap=new Map,this._seqSll=new Zo(200),this._IDSll=new Zo(100),this._reportMessageStackedCount=0,this._onlineMemberCountMap=new Map,this.DEFAULT_EXPIRE_TIME=60,this.DEFAULT_POLLING_INTERVAL=300,this.MAX_POLLING_INTERVAL=2e3,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3,this._startBroadcastSeq=1,this._broadcastMessageIDMap=new Map,this.DEFAULT_POLLING_SIMPLIFIED_MSG=0,this._pollingIntervalMap=new Map,this._pollingNoMessageCountMap=new Map},[{key:"hasJoinedAVChatRoom",value:function(){var e=[];return 0<(e=0<this._joinedGroupMap.size?G(this._joinedGroupMap.values()).filter(function(t){return t.type===g.GRP_AVCHATROOM}):e).length}},{key:"getJoinedLiveList",value:function(){var e=[];return e=0<this._joinedGroupMap.size?G(this._joinedGroupMap.values()).filter(function(t){return t.type===g.GRP_LIVE}):e}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._joinedGroupMap.has(e)}},{key:"getJoinedAVChatRoom",value:function(){return 0<this._joinedGroupMap.size?G(this._joinedGroupMap.keys()):[]}},{key:"_updatedata",value:function(e){var t=this._pollingRequestInfoMap.get(e);return e===G(this._pollingInstanceMap.keys())[0]?p(p({},t),{},{startBroadcastSeq:this._startBroadcastSeq,simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG}):p(p({},t),{},{simplifiedMessage:this.DEFAULT_POLLING_SIMPLIFIED_MSG})}},{key:"_handleSuccess",value:function(e,t){var n,c=t.data,o=c.key,s=c.nextSeq,a=c.rspMsgList,i=c.errorCode,r=c.nextBroadcastSeq,c=c.broadcastMessageList;i!==0?(i=this._pollingRequestInfoMap.get(e),n=new D("longPollingAVError"),i=i?"".concat(i.key,"-").concat(i.startSeq):"requestInfo is undefined",n.setMessage("".concat(e,"-").concat(i,"-").concat(t.errorInfo)).setCode(t.errorCode).end(!0)):this.checkJoinedAVChatRoomByID(e)&&(V(o)&&Y(s)&&this._pollingRequestInfoMap.set(e,{key:o,startSeq:s}),Y(r)&&r>this._startBroadcastSeq&&(this._startBroadcastSeq=r),O(a)&&0<a.length?(a.forEach(function(u){u.to=u.groupID}),this.onMessage(a,e)):(n=this._getPollingNoMessageCount(e),this._updatePollingNoMessageCount(e,n+=1),n===this.DEFAULT_POLLING_NO_MESSAGE_COUNT&&(i=this.DEFAULT_POLLING_INTERVAL+this.DEFAULT_POLLING_INTERVAL_PLUS,this._pollingIntervalMap.set(e,i))),this._onBroadcastMessage(c))}},{key:"_handleFailure",value:function(e,t){}},{key:"onMessage",value:function(e,t){if(O(e)&&e.length!==0){var n="".concat(this._n,".onMessage"),o=(t&&(n+=" groupID:".concat(t)),this._getPollingNoMessageCount(t)!==0&&(this._updatePollingNoMessageCount(t,0),this._pollingIntervalMap.set(t,this.DEFAULT_POLLING_INTERVAL)),null),s=[],a=this._get(11),i=this._get(26),r=e.length,c=(1<r&&e.sort(function(I,C){return I.sequence-C.sequence}),this._get(12).isUnlimitedAVChatRoom()),u=!1;d.getLevel()<=0&&(t=e.map(function(I){return I.sequence}),d.l("".concat(n," count:").concat(t.length," sequenceList:").concat(t)),t.length=0);for(var l=0;l<r;l++){var _=this.restoreMessageFromSimplified(e[l]);if(Ea[_.event]){if(_.event===6&&(this._grpM.isGroupAttributesUpdatedNotice(_)||this._grpM.isGroupCountersNotice(_)))continue;if(_.event!==20)if(_.event!==21)if(_.event!==100){var o=this.packMessage(_,_.event),m=_.isModified===1,u=_.isHistoryMessage===1;if(!c){if(this._seqSll.has(o.sequence))continue;this._seqSll.set(o.sequence)}var f=this._IDSll.has(o.ID);f?d.w("".concat(n," ID:").concat(o.ID," has:").concat(f)):(this._IDSll.set(o.ID),f=!1,!u&&this._isMessageSentByCurrentInstance(o)?m&&(f=!0,o.isModified=m,a.updateMsgIsModifiedProp(o)):f=!0,f&&(o.conversationType===g.CONV_SYSTEM&&o.payload.operationType===5&&this._onGroupDismissed(o.payload.groupProfile.groupID),u||o.conversationType===g.CONV_SYSTEM||(m=o.conversationID.replace(g.CONV_GROUP,""),this._pollingInstanceMap.has(m)?this._grpM.isLoggedIn()&&i.addMessageSequence({key:ln,message:o}):(o.type!==g.MSG_GRP_TIP&&0<o.clientTime&&i.addMessageDelay(o.clientTime),i.addMessageSequence({key:un,message:o}))),s.push(o)))}else this.onRoomCustomData(_);else this._get(34).onMessageReactionNotify({event:21,dataList:_.elements.messageReactionNotifyList});else this.handleMessageRevokedNotice(_)}else d.w("".concat(n,". unknown event:").concat(_.event))}s.length!==0&&(0<(t=Go(s)).length&&this._grpM.emitOEvt(F.MESSAGE_MODIFIED,t),u||0<(t=this.packConversationOption(s)).length&&a.onNewMessage({conversationOptionsList:t,isInstantMessage:!0}),this._checkMessageStacked(s),t=Uo(s),d.getLevel()<=0&&d.l("".concat(n," message received count:").concat(t.length)),0<t.length&&this._grpM.emitOEvt(F.MESSAGE_RECEIVED,t),s.length=0)}}},{key:"handleMessageRevokedNotice",value:function(e){var t=this,n=e.groupID,o=e.elements.revokeMsgList,s=e.revokerInfo,a=[];o.forEach(function(u){var l=u.tinyID,r=u.clientTime,c=u.random,u=u.sequence,l={conversationID:"".concat(g.CONV_GROUP).concat(n),ID:"".concat(l,"-").concat(r,"-").concat(c),revoker:s.revoker,revokeReason:s.reason||"",revokerInfo:{userID:s.revoker,nick:"",avatar:""},sequence:u};a.push(l)}),a.length!==0&&this._get(11).updateRevokerInfo(a).then(function(i){t._grpM.emitOEvt(F.MESSAGE_REVOKED,i)})}},{key:"isBroadcastOrNormal",value:function(e){return e===3||e===17}},{key:"isGroupTip",value:function(e){return e===4||e===6}},{key:"isGroupSystemNotice",value:function(e){return e===5}},{key:"restoreGroupTipElements",value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},s=e.operatorInfo,s=s===void 0?{}:s,a=e.operatorID,t=e.userIDList,t=t===void 0?[]:t,n=e.operationType,n=(Y(e.groupJoinType)||n!==1&&n!==2||(e.groupJoinType=n===2?0:1),s.userID),o=s.avatar,s=s.nick,a=(e.operatorInfo={userID:n===void 0?a:n,avatar:o===void 0?"":o,nick:s===void 0?"":s},t.map(function(i){return{userID:i}}));return e.memberInfoList=e.memberInfoList||a,e}},{key:"restoreMessageFromSimplified",value:function(e){var t,n,o,s=e.event;return this.isBroadcastOrNormal(s)&&(e.cloudCustomData=e.cloudCustomData||"",e.elements=e.elements.map(function(a){var i;return a.type===g.MSG_CUSTOM&&(i=a.content,a.content=p({data:"",description:"",extension:""},i===void 0?{}:i)),a})),(this.isGroupTip(s)||this.isGroupSystemNotice(s))&&(e.from=e.from||"@TIM#SYSTEM"),this.isGroupTip(s)&&(e.elements=this.restoreGroupTipElements(e.elements),n=(o=(o=e.elements)===void 0?{}:o).operationType,t=o.operatorInfo,n===1)&&(n=[{userID:(t===void 0?{}:t).userID}],o.memberInfoList=o.memberInfoList||n),this.isGroupSystemNotice(s)&&(o=(t=e.elements).memberInfoList,n=t.operatorInfo,e.elements.memberInfoList=p({userID:e.elements.operatorID,avatar:"",nick:""},o=o||(n===void 0?{}:n)),e.elements=p({authentication:"",remarkInfo:"",messageKey:1e3*e.time},e.elements),s=Object.keys(e.elements).filter(function(a){return a!=="operatorInfo"}).reduce(function(a,i){return p(p({},a),{},Ge({},i,e.elements[i]))},{}),e.elements=s),e}},{key:"_onGroupDismissed",value:function(e){d.l("".concat(this._n,"._onGroupDismissed groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"_checkMessageStacked",value:function(n){var t="MessageStacked",n=n.length;100<=n&&(this._grpM.warn(t,n),this._reportMessageStackedCount<5)&&(new D(t).setMessage("count:".concat(n," groupID:").concat(G(this._joinedGroupMap.keys()))).setLevel("warning").end(),this._reportMessageStackedCount+=1)}},{key:"_isMessageSentByCurrentInstance",value:function(e){return!!this._get(11).isMessageSentByCurrentInstance(e)}},{key:"packMessage",value:function(o,s){o.currentUser=this._grpM.getMyUserID(),o.conversationType=s===5?g.CONV_SYSTEM:g.CONV_GROUP,o.isSystemMessage=!!o.isSystemMessage;var n=new Ce(o),o=this.packElements(o,s),s=this._grpM.getFileDownloadProxy(),a=this._grpM.getDownloadFileAuthKey(),i=this._get(17).getFileDNList();return n.setElement(o,s,a,i),n}},{key:"packElements",value:function(e,t){return t===4||t===6?(this._updateMemberCountByGroupTips(e),{type:g.MSG_GRP_TIP,content:p(p({},e.elements),{},{groupProfile:e.groupProfile})}):t===5?{type:g.MSG_GRP_SYS_NOTICE,content:p(p({},e.elements),{},{groupProfile:p(p({},e.groupProfile),{},{groupID:e.groupID})})}:e.elements}},{key:"packConversationOption",value:function(e){for(var t=new Map,n=0;n<e.length;n++){var o,s=e[n],a=s.conversationID;t.has(a)?((o=t.get(a)).lastMessage=s).flow==="in"&&o.unreadCount++:t.set(a,{conversationID:s.conversationID,unreadCount:s.flow==="out"?0:1,type:s.conversationType,subType:s.conversationSubType,lastMessage:s})}return G(t.values())}},{key:"_updateMemberCountByGroupTips",value:function(a){var t,n,o,s=a.groupProfile.groupID,a=a.elements.onlineMemberInfo,a=a===void 0?void 0:a;k(a)||(t=(t=a.onlineMemberNum)===void 0?0:t,a=(a=a.expireTime)===void 0?this.DEFAULT_EXPIRE_TIME:a,n=this._onlineMemberCountMap.get(s)||{},o=Date.now(),k(n)?Object.assign(n,{lastReqTime:0,lastSyncTime:0,latestUpdateTime:o,memberCount:t,expireTime:a}):(n.latestUpdateTime=o,n.memberCount=t),this._onlineMemberCountMap.set(s,n))}},{key:"_onBroadcastMessage",value:function(e){if(!k(e)){for(var t=[],n=e.length,o=null,s=0;s<n;s++){var a=this.restoreMessageFromSimplified(e[s]);Ea[a.event]?((o=this.packMessage(a,a.event)).isBroadcastMessage=!0,this._broadcastMessageIDMap.has(o.ID)||(t.push(o),this._broadcastMessageIDMap.set(o.ID,1))):d.w("".concat(this._n,"._onBroadcastMessage unknown event:").concat(a.event))}0<t.length&&this._grpM.emitOEvt(F.MESSAGE_RECEIVED,t)}}},{key:"start",value:function(e){var t;this._pollingInstanceMap.has(e)?(t=this._pollingInstanceMap.get(e)).isRunning()||t.start():((t=new Pi({manager:this,groupID:e,onInit:this._updatedata.bind(this),onSuccess:this._handleSuccess.bind(this),onFail:this._handleFailure.bind(this)})).start(),this._pollingInstanceMap.set(e,t),d.l("".concat(this._n,".start groupID:").concat(e)))}},{key:"handleJoinResult",value:function(e){var t=this;return this._preCheck(e.group).then(function(){var n=e.longPollingKey,o=e.group,s=o.groupID;return t._joinedGroupMap.set(s,o),t._grpM.updateGroupMap([o]),t._grpM.deleteUnjoinedAVChatRoom(s),t._grpM.emitGroupListUpdate(!0,!1),T(n)?q({status:Lt,group:o}):Promise.resolve()})}},{key:"startRunLoop",value:function(e){var t=this;return this.handleJoinResult(e).then(function(){var n=e.longPollingKey,o=e.group,s=e.startSeq,a=o.groupID;return t._pollingRequestInfoMap.set(a,{key:n,startSeq:s===void 0?0:s}),t.start(a),t._reportLongPollingCount(),t._grpM.isLoggedIn()?q({status:Lt,group:o}):q({status:Lt})})}},{key:"_preCheck",value:function(e){var t=this;if(!this._get(12).isUnlimitedAVChatRoom()&&this.hasJoinedAVChatRoom()){var o=ke(this._joinedGroupMap.entries().next().value,2),n=o[0],o=o[1];if(this._grpM.isLoggedIn()&&o.selfInfo.role!==g.GRP_MBR_ROLE_OWNER&&o.ownerID!==this._grpM.getMyUserID())return this._grpM.quitGroup(n,"av").catch(function(s){return t.reset(n),Promise.resolve()});this._grpM.deleteLocalGroupAndConversation(n),this.reset(n)}return Promise.resolve()}},{key:"joinWithoutAuth",value:function(e){var t=this,n=e.groupID,o="".concat(this._n,".").concat("joinWithoutAuth"),s=new D("joinWithoutAuth");return this._grpM.req({P:h.APPLY_JOIN_GRP_NOAUTH,data:e}).then(function(a){if(a=a.data.longPollingKey,s.setMessage("groupID:".concat(n," longPollingKey:").concat(a)).end(!0),T(a))return v({code:y.CANNOT_JOIN_NON_AV_WITHOUT_LOGIN});d.l("".concat(o," ok. groupID:").concat(n)),t._get(11).setCompleted("".concat(g.CONV_GROUP).concat(n));var i=new it({groupID:n});return t.startRunLoop({group:i,longPollingKey:a}),N({status:Lt})}).catch(function(a){return d.e("".concat(o," failed. groupID:").concat(n," error:"),a),s.setError(a).setMessage("groupID:".concat(n)).end(!0),v(a)}).finally(function(){t._grpM.get(14).reportAtOnce()})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._onlineMemberCountMap.get(e)||{},n=Date.now();return k(t)||n-t.lastSyncTime>1e3*t.expireTime&&1e4<n-t.latestUpdateTime&&3e3<n-t.lastReqTime?(t.lastReqTime=n,this._onlineMemberCountMap.set(e,t),this._getGroupOnlineMemberCount(e).then(function(o){return N({memberCount:o.memberCount})}).catch(function(o){return v(o)})):q({memberCount:t.memberCount})}},{key:"_getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".").concat("_getGroupOnlineMemberCount"),o=new D("_getGroupOnlineMemberCount");return this._grpM.requestOnlineCount(e).then(function(r){var a=t._onlineMemberCountMap.get(e)||{},r=r.data,i=r.memberCount,i=i===void 0?0:i,r=r.expireTime,r=r===void 0?t.DEFAULT_EXPIRE_TIME:r,c=(d.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(i," expireTime:").concat(r)),Date.now());return k(a)&&(a.lastReqTime=c),t._onlineMemberCountMap.set(e,Object.assign(a,{lastSyncTime:c,latestUpdateTime:c,memberCount:i,expireTime:r})),{memberCount:i}}).catch(function(s){return d.w("".concat(n," failed. error:"),s),o.setCode(s.code).setMessage("groupID:".concat(e," error:").concat(JSON.stringify(s))).end(),Promise.reject(s)})}},{key:"_get",value:function(e){return this._grpM.get(e)}},{key:"setPollingInterval",value:function(e){T(e)||(Y(e)?this.DEFAULT_POLLING_INTERVAL=e:this.DEFAULT_POLLING_INTERVAL=parseInt(e,10))}},{key:"setPollingIntervalPlus",value:function(e){T(e)||(Y(e)?this.DEFAULT_POLLING_INTERVAL_PLUS=e:this.DEFAULT_POLLING_INTERVAL_PLUS=parseInt(e,10))}},{key:"setPollingNoMessageCount",value:function(e){T(e)||(Y(e)?this.DEFAULT_POLLING_NO_MESSAGE_COUNT=e:this.DEFAULT_POLLING_NO_MESSAGE_COUNT=parseInt(e,10))}},{key:"setPollingSimplifiedMessage",value:function(e){T(e)||e!=="0"&&e!=="1"||(this.DEFAULT_POLLING_SIMPLIFIED_MSG=parseInt(e,10))}},{key:"getPollingInterval",value:function(e){return this._pollingIntervalMap.get(e)||this.DEFAULT_POLLING_INTERVAL}},{key:"onAVChatRoomMemberBanned",value:function(e){e=e.payload.groupProfile.groupID,d.l("".concat(this._n,".onAVChatRoomMemberBanned groupID:").concat(e)),this._grpM.deleteLocalGroupAndConversation(e),this.reset(e)}},{key:"restartPolling",value:function(){d.l("".concat(this._n,".restartPolling count:").concat(this._pollingInstanceMap.size));var e,t=Se(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){var t;return this._pollingInstanceMap.has(e)?(t=this._pollingInstanceMap.get(e).getPollingTimerID(),d.l("".concat(this._n,".getPollingTimerID groupID:").concat(e," timerID:").concat(t)),t):-1}},{key:"hasPollingInstance",value:function(e){return this._pollingInstanceMap.has(e)}},{key:"onRoomCustomData",value:function(s){var t=s.groupID,n=s.sequence,o=s.time,s=s.elements,s=s&&s.content;this._get(30).onRoomCustomDataReceived(s),d.l("".concat(this._n,".onRoomCustomData groupID:").concat(t," sequence:").concat(n," time:").concat(o," data:").concat(s))}},{key:"startLiveLongPolling",value:function(o){var t=o.group,n=o.longPollingKey,o=o.startSeq,s=t.groupID;return this._joinedGroupMap.set(s,t),this._grpM.updateGroupMap([t]),this._pollingRequestInfoMap.set(s,{key:n,startSeq:o}),this.start(s),this._reportLongPollingCount(),q({status:Lt,group:t})}},{key:"stopLiveLongPolling",value:function(e){var t=this._pollingInstanceMap.get(e);t&&t.stop(),this._seqSll.reset(),this._IDSll.reset(),this._pollingInstanceMap.delete(e),this._joinedGroupMap.delete(e),this._pollingRequestInfoMap.delete(e),this._pollingIntervalMap.delete(e),this._pollingNoMessageCountMap.delete(e),this._reportMessageStackedCount=0}},{key:"_updatePollingNoMessageCount",value:function(e,t){this._pollingNoMessageCountMap.set(e,t)}},{key:"_getPollingNoMessageCount",value:function(e){return this._pollingNoMessageCountMap.get(e)||0}},{key:"_reportLongPollingCount",value:function(){var e,t,n,o=this._joinedGroupMap.size;1<o&&(e=this._get(12).isUnlimitedAVChatRoom()?1:0,t=[],n=[],Array.from(this._joinedGroupMap.values()).forEach(function(s){var a=s.groupID;(s.type===g.GRP_LIVE?n:t).push(a)}),new D("longPollingCount").setMessage("".concat(o)).setMoreMessage("av:".concat(t.join(",")," live:").concat(n.join(","))).setEventType(29).setCode(e).end())}},{key:"reset",value:function(e){if(e){d.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),this._pollingIntervalMap.delete(e),this._pollingNoMessageCountMap.delete(e)}else{d.l("".concat(this._n,".reset all"));var n,o=Se(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._pollingIntervalMap.clear(),this._pollingNoMessageCountMap.clear(),this.DEFAULT_POLLING_INTERVAL=300,this.DEFAULT_POLLING_NO_MESSAGE_COUNT=20,this.DEFAULT_POLLING_INTERVAL_PLUS=2e3}this._seqSll.reset(),this._IDSll.reset(),this._reportMessageStackedCount=0}}]),Ui=b(function e(t){U(this,e),this.userID="",this.avatar="",this.nick="",this.role="",this.joinTime="",this.lastSendMsgTime="",this.nameCard="",this.muteUntil=0,this.memberCustomField=[],this.isOnline=!1,this.updateMember(t)},[{key:"updateMember",value:function(e){T(e.onlineStatus)||(this.isOnline=e.onlineStatus==="Online");var t=[null,void 0,"",0,NaN];e.memberCustomField&&tn(this.memberCustomField,e.memberCustomField),et(this,e,["memberCustomField","marks","onlineStatus"],t)}},{key:"updateRole",value:function(e){["Owner","Admin","Member"].indexOf(e)<0||(this.role=e)}},{key:"updateMuteUntil",value:function(e){T(e)||(this.muteUntil=Math.floor((Date.now()+1e3*e)/1e3))}},{key:"updateNameCard",value:function(e){T(e)||(this.nameCard=e)}},{key:"updateMemberCustomField",value:function(e){e&&tn(this.memberCustomField,e)}}]),bi=b(function e(t){U(this,e),this._grpM=t,this._n="GroupMemberHandler",this.groupMemberListMap=new Map,this.avChatRoomMembersReqInfoMap=new Map,this.avChatRoomMembersFreqCount=4,this.avChatRoomMembersFreqInterval=30,this.DEFAULT_MEMBER_INFO_FILTER=["Role","JoinTime","NameCard","ShutUpUntil","OnlineStatus"],this._grpM.getIEmitInst().on(ne.PROFILE_UPDATED,this._onProfileUpdated,this)},[{key:"setAVChatRoomMembersFrequencyLimit",value:function(e){var t;T(e)||(t=(e=JSON.parse(e)).interval,e=e.count,t&&e&&(this.avChatRoomMembersFreqCount=e,this.avChatRoomMembersFreqInterval=t))}},{key:"_onProfileUpdated",value:function(e){for(var t=this,n=e.data,o=0;o<n.length;o++)(function(){var s=n[o];t.groupMemberListMap.forEach(function(a){a.has(s.userID)&&a.get(s.userID).updateMember({nick:s.nick,avatar:s.avatar})})})()}},{key:"deleteGroupMemberList",value:function(e){this.groupMemberListMap.delete(e)}},{key:"getGroupMemberList",value:function(r){var t,n=this,o=r.groupID,s=r.role,s=s===void 0?void 0:s,_=r.offset,a=_===void 0?0:_,_=r.count,i=_===void 0?15:_,_=r.filter,r=_===void 0?void 0:_,c="".concat(this._n,".").concat("getGroupMemberList"),_=this._grpM.hasLocalGroup(o);if(d.l("".concat(c," groupID:").concat(o," role:").concat(s," offset:").concat(a," count:").concat(i," hasLocalGroup:").concat(_)),!_)return q({memberList:[],offset:0});if(this._grpM.getLocalGroupProfile(o).type===g.GRP_AVCHATROOM){if(this._grpM.canIUse(ee.AV_MBR_LIST))return this._isFrequencyOverLimit(o)?v({code:y.OVER_FREQUENCY_LIMIT,message:this._grpM.getErrMsg(y.OVER_FREQUENCY_LIMIT,"".concat(h.GET_AV_MBR_LIST,"-").concat(o))}):this._getAVChatRoomMemberList({groupID:o,offset:a,filter:r});this._grpM.warn("LiveOnlineMember")}s!==g.GRP_MBR_ROLE_ADMIN&&s!==g.GRP_MBR_ROLE_OWNER&&s!==g.GRP_MBR_ROLE_MEMBER||(t=s);var u=new D("getGroupMemberList"),l=0,_={groupID:o,limit:100<i?100:i,memberRoleFilter:t?[t]:void 0,memberInfoFilter:this.DEFAULT_MEMBER_INFO_FILTER},m=(we({groupID:o})?_.next="".concat(a):l=(_.offset=a)+i,[]);return this._grpM.req({P:h.GET_GRP_MBR_LIST,data:_}).then(function(M){var M=M.data,I=M.members,C=M.memberNum,M=M.next,M=M===void 0?void 0:M;return T(M)||(l=k(M)?0:M),O(I)&&I.length!==0?(n._grpM.hasLocalGroup(o)&&(n._grpM.getLocalGroupProfile(o).memberNum=C),m=n._updateLocalGroupMemberMap(o,I),n._grpM.get(4).getUserProfile({userIDList:I.map(function(S){return S.userID}),tagList:[H.NICK,H.AVATAR]})):(l=0,Promise.resolve([]))}).then(function(I){var I=I.data;return O(I)&&I.length!==0?(I=I.map(function(C){return{userID:C.userID,nick:C.nick,avatar:C.avatar}}),n._updateLocalGroupMemberMap(o,I),m.length<i&&(l=0),u.setMessage("groupID:".concat(o," offset:").concat(a," count:").concat(i)).end(),d.l("".concat(c," ok.")),N({memberList:m,offset:l})):q({memberList:[],offset:l})}).catch(function(f){return u.setError(f).end(),d.e("".concat(c," failed. error:"),f),v(f)})}},{key:"_getAVChatRoomMemberList",value:function(s){var t=this,n=s.groupID,o=s.offset,s=s.filter,a="".concat(this._n,".").concat("_getAVChatRoomMemberList"),i=new D("_getAVChatRoomMemberList");return i.setMessage("groupID:".concat(n," offset:").concat(o," filter:").concat(s)),this._grpM.req({P:h.GET_AV_MBR_LIST,data:{groupID:n,offset:o,filter:s}}).then(function(c){var c=c.data,u=c.memberList,u=u===void 0?[]:u,c=c.offset,c=c===void 0?0:c,u=(i.end(),d.l("".concat(a," ok. member count:").concat(u.length,", next request timestamp:").concat(c)),u.map(function(l){return p(p({},l),{},{onlineStatus:"Online"})})),u=t._updateLocalGroupMemberMap(n,u);return N({memberList:u,offset:c})}).catch(function(r){return i.setError(r).end(),d.e("".concat(a," failed. error:"),r),v(r)})}},{key:"_isFrequencyOverLimit",value:function(e){var t,n;return!this.avChatRoomMembersReqInfoMap.has(e)||(t=(n=this.avChatRoomMembersReqInfoMap.get(e)).startTime,n=n.requestCount,Date.now()-t>1e3*this.avChatRoomMembersFreqInterval)?(this.avChatRoomMembersReqInfoMap.set(e,{startTime:Date.now(),requestCount:1}),!1):(this.avChatRoomMembersReqInfoMap.set(e,{startTime:t,requestCount:n+=1}),n>this.avChatRoomMembersFreqCount)}},{key:"getGroupMemberProfile",value:function(e){var t,n=this,o="getGroupMemberProfile",r="".concat(this._n,".").concat(o),s="groupID:".concat(e.groupID),a=(5<e.userIDList.length?s+=" userIDList.length:".concat(e.userIDList.length):s+=" userIDList:".concat(e.userIDList),d.l("".concat(r," ").concat(s)),50<e.userIDList.length&&(e.userIDList=e.userIDList.slice(0,50)),e.groupID),i=e.userIDList,r=this._grpM.getLocalGroupProfile(a);return r&&be(r.type)?v({code:r=y.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(r,o)}):((t=new D(o)).setMessage(s),this._getGroupMemberProfileAdvance(p(p({},e),{},{userIDList:i})).then(function(c){return c=c.data.members,O(c)&&c.length!==0?(n._updateLocalGroupMemberMap(a,c),n._grpM.get(4).getUserProfile({userIDList:c.map(function(u){return u.userID}),tagList:[H.NICK,H.AVATAR]})):q([])}).then(function(c){return c=c.data.map(function(u){return{userID:u.userID,nick:u.nick,avatar:u.avatar}}),n._updateLocalGroupMemberMap(a,c),c=i.filter(function(u){return n.hasLocalGroupMember(a,u)}).map(function(u){return n.getLocalGroupMemberInfo(a,u)}),t.end(),N({memberList:c})}))}},{key:"addGroupMember",value:function(e){var t=this,n="".concat(this._n,".").concat("addGroupMember"),o=e.groupID,s=this._grpM.getLocalGroupProfile(o),a=s.type,i=new D("addGroupMember");return i.setMessage("groupID:".concat(o," groupType:").concat(a)),be(a)?(a=new ie({code:y.CANNOT_ADD_MEMBER_IN_AV}),i.setError(a).end(),v(a)):(e.userIDList=e.userIDList.map(function(r){return{userID:r}}),d.l("".concat(n," groupID:").concat(o)),this._grpM.req({P:h.ADD_GRP_MBR,data:e}).then(function(_){var _=_.data.members,c=(d.l("".concat(n," ok")),_.filter(function(f){return f.result===1}).map(function(f){return f.userID})),u=_.filter(function(f){return f.result===0}).map(function(f){return f.userID}),l=_.filter(function(f){return f.result===2}).map(function(f){return f.userID}),_=_.filter(function(f){return f.result===4}).map(function(f){return f.userID}),m="groupID:".concat(e.groupID,", ")+"successUserIDList:".concat(c,", ")+"failureUserIDList:".concat(u,", ")+"existedUserIDList:".concat(l,", ")+"overLimitUserIDList:".concat(_);return i.setMoreMessage(m).end(),c.length===0?N({successUserIDList:c,failureUserIDList:u,existedUserIDList:l,overLimitUserIDList:_}):(t._updateConvGroupProfile(s),N({successUserIDList:c,failureUserIDList:u,existedUserIDList:l,overLimitUserIDList:_,group:s}))}).catch(function(r){return i.setError(r).end(),d.e("".concat(n," failed. error:"),r),v(r)}))}},{key:"deleteGroupMember",value:function(e){var t,n,o=this,s="".concat(this._n,".").concat("deleteGroupMember"),a=e.groupID,i=e.userIDList,r=this._grpM.getLocalGroupProfile(a);return T(r)?v({code:y.CANNOT_FIND_GRP}):be(r.type)?this._grpM.canIUse(ee.AV_BAN_MBR)?this._banAVChatRoomMember(e):this._grpM.noUse("deleteGroupMember"):(t="groupID:".concat(a," ").concat(5<i.length?"userIDList.length:".concat(i.length):"userIDList:".concat(i)),d.l("".concat(s," groupID:").concat(a," userIDList:"),i),(n=new D("deleteGroupMember")).setMessage(t),this._grpM.req({P:h.DEL_GRP_MBR,data:e}).then(function(){return n.end(),d.l("".concat(s," ok")),o._updateConvGroupProfile(r),o.deleteLocalGroupMembers(a,i),N({group:r,userIDList:i})}).catch(function(c){return n.setError(c).end(),d.e("".concat(s," failed. error:"),c),v(c)}))}},{key:"_updateConvGroupProfile",value:function(e){this._grpM.get(11).updateConvGroupProfile([e])}},{key:"_banAVChatRoomMember",value:function(e){var t=this,n="".concat(this._n,".").concat("_banAVChatRoomMember"),o=e.groupID,s=e.userIDList,a="groupID:".concat(o," ").concat(5<s.length?"userIDList.length:".concat(s.length):"userIDList:".concat(s)),i=new D("_banAVChatRoomMember"),r=(i.setMessage(a),d.l("".concat(n," groupID:").concat(o," userIDList:"),s),this._grpM.getLocalGroupProfile(o));return T(e.duration)||e.duration===0?v({code:y.BAN_DURATION_INVALID}):this._grpM.req({P:h.BAN_AV_MBR,data:e}).then(function(){return i.end(),d.l("".concat(n," ok")),t.deleteLocalGroupMembers(o,s),N({group:r,userIDList:s})}).catch(function(c){return i.setError(c).end(),d.e("".concat(n," failed. error:"),c),v(c)})}},{key:"setGroupMemberMuteTime",value:function(i){var t,n,o=this,s=i.groupID,a=i.userID,i=i.muteTime,r="".concat(this._n,".").concat("setGroupMemberMuteTime");return a===this._grpM.getMyUserID()?v({code:y.CANNOT_MUTE_SELF}):(t="groupID:".concat(s," userID:").concat(a," muteTime:").concat(i),d.l("".concat(r," ").concat(t)),(n=new D("setGroupMemberMuteTime")).setMessage(t),this.modifyGroupMemberInfo({groupID:s,userID:a,muteTime:i}).then(function(c){n.end(),d.l("".concat(r," ok"));var u=o._grpM.getLocalGroupProfile(s);return N({group:u,member:c})}).catch(function(c){return n.setError(c).end(),d.e("".concat(r," failed. error:"),c),v(c)}))}},{key:"setGroupMemberRole",value:function(i){var t,n,o="".concat(this._n,".").concat("setGroupMemberRole"),s=i.groupID,a=i.userID,i=i.role,r="groupID:".concat(s," userID:").concat(a," role:").concat(i),c=this._grpM.getLocalGroupProfile(s);return c&&c.selfInfo.role!==g.GRP_MBR_ROLE_OWNER?v({code:y.NOT_OWNER}):(t=[g.GRP_MBR_ROLE_ADMIN,g.GRP_MBR_ROLE_MEMBER],we({groupID:s})&&t.push(g.GRP_MBR_ROLE_CUSTOM),t.indexOf(i)<0?v({code:y.INVALID_MEMBER_ROLE}):a===this._grpM.getMyUserID()?v({code:y.CANNOT_SET_SELF_MEMBER_ROLE}):((n=new D("setGroupMemberRole")).setMessage(r),d.l("".concat(o," ").concat(r)),this.modifyGroupMemberInfo({groupID:s,userID:a,role:i}).then(function(u){return n.end(),d.l("".concat(o," ok")),N({group:c,member:u})}).catch(function(u){return n.setError(u).end(),d.e("".concat(o," failed. error:"),u),v(u)})))}},{key:"_filterProfanity",value:function(e,t){var n,o=this._grpM.get(29);return!o||(n=(o=o.filterText(t[e],"group_member_profile")).isAllowedToSend,o=o.modifiedText,n===!0&&(t[e]=o,!0))}},{key:"setGroupMemberNameCard",value:function(e){var t,n,o,s,a,i=this,r="setGroupMemberNameCard",c="".concat(this._n,".").concat(r);return e.nameCard&&this._filterProfanity("nameCard",e)===!1?v({code:y.PROFANITY_FOUND}):(t=e.groupID,s=e.userID,n=s===void 0?this._grpM.getMyUserID():s,o=e.nameCard,s="groupID:".concat(t," userID:").concat(n," nameCard:").concat(o),d.l("".concat(c," ").concat(s)),(e=this._grpM.getLocalGroupProfile(t))&&be(e.type)?v({code:e=y.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(e,r)}):((a=new D(r)).setMessage(s),this.modifyGroupMemberInfo({groupID:t,userID:n,nameCard:o}).then(function(u){d.l("".concat(c," ok")),a.end();var l=i._grpM.getLocalGroupProfile(t);return n===i._grpM.getMyUserID()&&l&&l.setSelfNameCard(o),N({group:l,member:u})}).catch(function(u){return a.setError(u).end(),d.e("".concat(c," failed. error:"),u),v(u)})))}},{key:"setGroupMemberCustomField",value:function(r){var t,n=this,o="setGroupMemberCustomField",s="".concat(this._n,".").concat(o),a=r.groupID,i=r.userID,i=i===void 0?this._grpM.getMyUserID():i,r=r.memberCustomField,c="groupID:".concat(a," userID:").concat(i," memberCustomField:").concat(JSON.stringify(r)),u=(d.l("".concat(s," ").concat(c)),this._grpM.getLocalGroupProfile(a));return u&&be(u.type)?v({code:u=y.OPERATION_NOT_SUPPORTED_IN_AV,message:this._grpM.getErrMsg(u,o)}):((t=new D(o)).setMessage(c),this.modifyGroupMemberInfo({groupID:a,userID:i,memberCustomField:r}).then(function(l){t.end(),d.l("".concat(s," ok"));var _=n._grpM.getLocalGroupProfile(a);return N({group:_,member:l})}).catch(function(l){return t.setError(l).end(),d.e("".concat(s," failed. error:"),l),v(l)}))}},{key:"modifyGroupMemberInfo",value:function(e){var t=this,n=e.groupID,o=e.userID,s=void 0;return he(n)&&(n=_e(s=n)),this._grpM.req({P:h.MODIFY_GRP_MBR_INFO,data:p(p({},e),{},{groupID:n,topicID:s})}).then(function(){var a;return t.hasLocalGroupMember(n,o)?(a=t.getLocalGroupMemberInfo(n,o),T(e.muteTime)||a.updateMuteUntil(e.muteTime),T(e.role)||a.updateRole(e.role),T(e.nameCard)||a.updateNameCard(e.nameCard),T(e.memberCustomField)||a.updateMemberCustomField(e.memberCustomField),a):(a=t._grpM.getLocalGroupProfile(n))&&!be(a.type)?t.getGroupMemberProfile({groupID:n,userIDList:[o]}).then(function(i){return ke(i.data.memberList,1)[0]}):void 0})}},{key:"markGroupMemberList",value:function(a){var t="".concat(this._n,".").concat("markGroupMemberList"),n=a.groupID,o=a.markType,c=a.enableMark,a=a.userIDList,s=a===void 0?[]:a,a="groupID:".concat(n," markType:").concat(o," enableMark:").concat(c," userIDList count:").concat(s.length),i=(d.l("".concat(t," ").concat(a)),2),r=[],c=(c===!0&&(i=1),G(s)),u=(500<s.length&&(c=s.slice(0,500),d.w("".concat(t," ").concat(St(500)))),c.forEach(function(l){r.push({userID:l,markType:[o]})}),c=null,new D("markGroupMemberList"));return u.setMessage(a),this._grpM.req({P:h.MARK_AV_MBR_INFO,data:{groupID:n,operationType:i,memberList:r}}).then(function(f){var f=f.data.memberList,f=f===void 0?[]:f,_=[],m=[],f=(f.length===s.length?_.push.apply(_,G(s)):(f.forEach(function(I){_.push(I.userID)}),s.forEach(function(I){_.includes(I)||m.push(I)})),"success count:".concat(_.length," fail count:").concat(m.length));return u.setMessage(f).end(),d.l("".concat(t," ok. ").concat(f)),N({successUserIDList:_,failureUserIDList:m})}).catch(function(l){return u.setError(l).end(),d.e("".concat(t," failed. error:"),l),v(l)})}},{key:"_getGroupMemberProfileAdvance",value:function(e){return this._grpM.req({P:h.GET_GRP_MBR_PROFILE,data:p(p({},e),{},{memberInfoFilter:e.memberInfoFilter||this.DEFAULT_MEMBER_INFO_FILTER})})}},{key:"_updateLocalGroupMemberMap",value:function(e,t){var n=this;return O(t)&&t.length!==0?t.map(function(o){return n.hasLocalGroupMember(e,o.userID)?n.getLocalGroupMemberInfo(e,o.userID).updateMember(o):n.setLocalGroupMember(e,new Ui(o)),n.getLocalGroupMemberInfo(e,o.userID)}):[]}},{key:"deleteLocalGroupMembers",value:function(e,t){var n=this.groupMemberListMap.get(e);n&&t.forEach(function(o){n.delete(o)})}},{key:"getLocalGroupMemberInfo",value:function(e,t){return this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).get(t):null}},{key:"setLocalGroupMember",value:function(e,t){this.groupMemberListMap.has(e)?this.groupMemberListMap.get(e).set(t.userID,t):(t=new Map().set(t.userID,t),this.groupMemberListMap.set(e,t))}},{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:"deleteAVChatRoomMembersReqInfo",value:function(e){this.avChatRoomMembersReqInfoMap.delete(e)}},{key:"reset",value:function(){this.groupMemberListMap.clear(),this.avChatRoomMembersReqInfoMap.clear(),this.avChatRoomMembersFreqCount=4,this.avChatRoomMembersFreqInterval=30}}]),wi=b(function e(t){U(this,e),this._grpM=t,this._n="GroupPinMessageHandler"},[{key:"onPinnedMessageNotify",value:function(u){var t,n,o=u.to,u=u.elements,s=u.pinnedMessage,a=u.unPinnedMessageInfo,i=u.operationType,u=u.operatorInfo,r=u.userID,c=u.nick,c=c===void 0?"":c,u=u.avatar,u=u===void 0?"":u,l=null,_=!1;i===16?(_=!0,s.conversationType=g.CONV_GROUP,(l=new Ce(s)).setElement(s.elements[0]),l.pinnerInfo={userID:r,nick:c,avatar:u}):(i=a.clientTime,s=a.random,t=a.senderTinyId,n=a.serverTime,a=a.sequence,l={ID:"".concat(t,"-").concat(i,"-").concat(s),sequence:a,random:s,time:n,clientTime:i}),this._grpM.emitOEvt(F.PINNED_GROUP_MESSAGE_UPDATED,{groupID:o,message:l,isPinned:_,operatorInfo:{userID:r,nick:c,avatar:u}})}},{key:"pinGroupMessage",value:function(o){var t="".concat(this._n,".").concat("pinGroupMessage"),n=o.groupID,s=o.message,o=o.isPinned,s=s.sequence,i="groupID:".concat(n," sequence:").concat(s),a=new D("pinGroupMessage"),i=(a.setMessage(i),d.l("".concat(t," ").concat(i)),n),r=void 0;return he(n)&&(i=_e(r=n)),this._grpM.req({P:o?h.PIN_GRP_MSG:h.UNPIN_GRP_MSG,data:{groupID:i,topicID:r,sequence:s,operator:this._grpM.getMyUserID()}}).then(function(c){return a.end(),d.l("".concat(t," ok.")),N()}).catch(function(c){return a.setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})}},{key:"getPinnedGroupMessageList",value:function(e){var t=this,n="".concat(this._n,".").concat("getPinnedGroupMessageList"),o=new D("getPinnedGroupMessageList"),s=(o.setMessage(e),e),a=void 0;return he(e)&&(s=_e(a=e)),this._grpM.req({P:h.GET_PINNED_GRP_MSG_LIST,data:{groupID:s,topicID:a}}).then(function(i){return i=i.data.pinnedMessageList,i=i===void 0?[]:i,o.setMoreMessage("count:".concat(i.length)).end(),d.l("".concat(n," ok, groupID:").concat(e," count:").concat(i.length)),t._updatePinnerInfo(e,i).then(function(r){return N({messageList:r})})}).catch(function(i){return o.setError(i).end(),d.e("".concat(n," failed. error:"),i),v(i)})}},{key:"_updatePinnerInfo",value:function(e,t){if(k(t))return Promise.resolve([]);for(var n=new Set,o={},s={},a=[],i=[],r=this._grpM.get(11),c=this._grpM.get(4),u="".concat(g.CONV_GROUP).concat(e),l=0;l<t.length;l++){var m=t[l],_=m.userID,m=m.sequence,f=r.findMsgBySeq(u,m);n.add(_),o[m]=_,f?a.push(f):i.push(m)}return Promise.all([this._getMessagesBySequences(e,i),c.getUserProfile({userIDList:G(n)})]).then(function(M){var M=ke(M,2),C=M[0],M=M[1].data;return(M===void 0?[]:M).forEach(function(w){var L=w.userID,P=w.nick,w=w.avatar;s[L]={userID:L,nick:P===void 0?"":P,avatar:w===void 0?"":w}}),a.push.apply(a,G(C)),a.forEach(function(S){var L=S.sequence,L=o[L];S.pinnerInfo=s[L]||{userID:L,nick:"",avatar:""}}),a.sort(function(S,L){return S.sequence-L.sequence}),n.clear(),a})}},{key:"_getMessagesBySequences",value:function(e,t){var n,o,s=this;return k(t)?Promise.resolve([]):(o=void 0,he(n=e)&&(n=_e(o=e)),this._grpM.req({P:h.GET_GRP_ROAMING_MSG,data:{groupID:n,topicID:o,reqMsgSeqList:t,getType:3}}).then(function(i){var i=i.data.messageList,i=i===void 0?[]:i,r=(d.l("".concat(s._n,".getMessagesBySequences ok, groupID:").concat(e," sequenceList:").concat(t," result:").concat(i.length)),"".concat(g.CONV_GROUP).concat(e));return s._grpM.get(11).onRoamingMessage(i,r,!1)}))}}]),Fi=[17,18,20],qi=b(function e(t){U(this,e),this._grpM=t,this._n="GroupSystemNoticeHandler",this.pendencyMap=new Map},[{key:"onNewGroupSystemNotice",value:function(n){var s=n.dataList,t=n.isSyncingEnded,n=n.isInstantMessage,s=(d.d("".concat(this._n,".onReceiveSystemNotice count:").concat(s.length)),this._assembly({notifiesList:s,isInstantMessage:n})),o=s.eventDataList,s=s.result;0<o.length&&(this._grpM.get(11).onNewMessage({conversationOptionsList:o,isInstantMessage:n}),this._onReceivedGroupSystemNotice({result:s,isInstantMessage:n})),n?0<s.length&&this._grpM.emitOEvt(F.MESSAGE_RECEIVED,s):t===!0&&this._clearGroupSystemNotice()}},{key:"_assembly",value:function(e){for(var t=e.notifiesList,n=e.isInstantMessage,o=null,s=t.length,r=0,a=[],i={conversationID:g.CONV_SYSTEM,unreadCount:0,type:g.CONV_SYSTEM,subType:null,lastMessage:null},r=0;r<s;r++){var c=t[r],l=c.groupProfile,u=l.communityType,l=l.topicID,l=l===void 0?void 0:l,m=c.elements,_=m.topicIDList,_=_===void 0?void 0:_,m=m.operationType;if(!((u===void 0?0:u)!==2||k(l)&&k(_))){if(Fi.includes(m)){this._handleTopicSystemNotice(c);continue}k(l)||(c.to=l)}c.elements.operationType!==15&&(c.currentUser=this._grpM.getMyUserID(),c.conversationType=g.CONV_SYSTEM,c.conversationID=g.CONV_SYSTEM,(o=new Ce(c)).setElement({type:g.MSG_GRP_SYS_NOTICE,content:p(p({},c.elements),{},{groupProfile:p({},c.groupProfile)})}),o.isSystemMessage=!0,(o.sequence===1&&o.random===1||o.sequence===2&&o.random===2)&&(o.sequence=Je(),o.random=Je(),o.generateMessageID(),d.l("".concat(this._n,"._assembly regenerate ID:").concat(o.ID))),this._grpM.get(11).pushIntoNoticeResult(a,o))&&(n?i.unreadCount++:o.setIsRead(!0),i.subType=o.conversationSubType)}return i.lastMessage=a[a.length-1],{eventDataList:0<a.length?[i]:[],result:a}}},{key:"_clearGroupSystemNotice",value:function(){var e=this;this._getPendencyList().then(function(n){n.forEach(function(s){e.pendencyMap.set("".concat(s.from,"_").concat(s.groupID,"_").concat(s.to),s)});var n=e._grpM.get(11).getLocalMessageList(g.CONV_SYSTEM),o=[];n.forEach(function(s){var r=s.payload,a=r.operatorID,i=r.operationType,r=r.groupProfile;i===1&&(i="".concat(a,"_").concat(r.groupID,"_").concat(r.to),a=e.pendencyMap.get(i))&&Y(a.handled)&&a.handled!==0&&o.push(s)}),e.deleteGroupSystemNotice({messageList:o})})}},{key:"deleteGroupSystemNotice",value:function(e){var t=this,n="".concat(this._n,".deleteGroupSystemNotice");return O(e.messageList)&&e.messageList.length!==0?(d.l("".concat(n," ")+e.messageList.map(function(o){return o.ID})),this._grpM.req({P:h.DEL_GRP_SYSTEM_NOTICE,data:{messageListToDelete:e.messageList.map(function(o){return{from:g.CONV_SYSTEM,messageSeq:o.clientSequence,messageRandom:o.random}})}}).then(function(){d.l("".concat(n," ok"));var o=t._grpM.get(11);return e.messageList.forEach(function(s){o.deleteLocalMessage(s)}),N()}).catch(function(o){return d.e("".concat(n," error:"),o),v(o)})):q()}},{key:"_getPendencyList",value:function(){var e=this,o=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},t=o.type,n=o.startTime,o=o.limit;return this._grpM.req({P:h.GET_GRP_PENDENCY,data:{type:t===void 0?void 0:t,startTime:n===void 0?0:n,limit:o===void 0?20:o,handleAccount:this._grpM.getMyUserID()}}).then(function(s){var a=s.data.pendencyList;return s.data.nextStartTime!==0?e._getPendencyList({startTime:s.data.nextStartTime}).then(function(i){return[].concat(G(a),G(i))}):a})}},{key:"getGroupApplicationList",value:function(){var e=this;return this._getPendencyList().then(function(t){return e._getPendencyList({type:g.GRP_COMMUNITY}).then(function(n){return t.push.apply(t,G(n)),e._handlePendencyResult(t)}).catch(function(n){return e._handlePendencyResult(t)})})}},{key:"_handlePendencyResult",value:function(e){var t=this,n=[];return e.forEach(function(o){t.pendencyMap.set("".concat(o.from,"_").concat(o.groupID,"_").concat(o.to),o),o.handled===0&&n.push({applicant:o.from,applicantNick:o.fromUserNickName,groupName:o.groupName,groupID:o.groupID,authentication:o.authentication,messageKey:o.time,applicationType:o.applicationType,userID:o.userID,note:o.note})}),q({applicationList:n})}},{key:"_onReceivedGroupSystemNotice",value:function(e){var t=this,n=e.result;e.isInstantMessage&&n.forEach(function(o){switch(o.payload.operationType){case 1:break;case 2:t._onApplyJoinGroup(o);break;case 3:break;case 4:t._onMemberKicked(o);break;case 5:t._onGroupDismissed(o);break;case 6:break;case 7:t._onInviteGroup(o);break;case 8:t._onQuitGroup(o);break;case 9:t._onSetManager(o);break;case 10:t._onDeleteManager(o);break;case 11:case 12:case 15:break;case 20:t._onMessageRemindTypeSynced(o);break;case 21:t._grpM.onAVChatRoomMemberBanned(o)}})}},{key:"_onApplyJoinGroup",value:function(o){var t=this,o=o.payload.groupProfile,n=o.groupID,o=o.groupType,s=this._grpM.hasLocalGroup(n);d.l("".concat(this._n,"._onApplyJoinGroup groupID:").concat(n," groupType:").concat(o," hasGroup:").concat(s)),s||be(o)||this._grpM.getGroupProfile({groupID:n}).then(function(i){var i=i.data.group;i&&(t._grpM.updateGroupMap([i]),i=!i.isSupportTopic,t._grpM.emitGroupListUpdate(!0,i))})}},{key:"_onMemberKicked",value:function(e){e=e.payload.groupProfile.groupID,this._grpM.hasLocalGroup(e)&&this._grpM.deleteLocalGroupAndConversation(e)}},{key:"_onGroupDismissed",value:function(t){var t=t.payload.groupProfile.groupID,n=(this._grpM.hasLocalGroup(t)&&this._grpM.deleteLocalGroupAndConversation(t),this._grpM._AVChatRoomHandler);n&&n.checkJoinedAVChatRoomByID(t)&&n.reset(t)}},{key:"_onInviteGroup",value:function(o){var t=this,n=o.payload.groupProfile.groupID,o=this._grpM.hasLocalGroup(n);d.l("".concat(this._n,"._onInviteGroup groupID:").concat(n," hasGroup:").concat(o)),this._grpM.getGroupProfile({groupID:n}).then(function(){t._grpM.emitGroupListUpdate(),t._grpM.get(11).pullMsgOnInvite("".concat(g.CONV_GROUP).concat(n))})}},{key:"_onQuitGroup",value:function(n){var n=n.payload.groupProfile,t=n.groupID,n=n.groupType,o=this._grpM.hasLocalGroup(t);d.l("".concat(this._n,"._onQuitGroup groupID:").concat(t," groupType:").concat(n," hasGroup:").concat(o)),o&&this._grpM.deleteLocalGroupAndConversation(t)}},{key:"_onSetManager",value:function(n){var n=n.payload.groupProfile,t=n.to,n=n.groupID,n=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(n,t);n&&n.updateRole(g.GRP_MBR_ROLE_ADMIN)}},{key:"_onDeleteManager",value:function(n){var n=n.payload.groupProfile,t=n.to,n=n.groupID,n=this._grpM.getGroupMemberHandler().getLocalGroupMemberInfo(n,t);n&&n.updateRole(g.GRP_MBR_ROLE_MEMBER)}},{key:"_onMessageRemindTypeSynced",value:function(n){var t=n.payload.groupProfile.groupID,n=n.payload.messageRemindType;this._grpM.get(11).onGroupMsgRemindTypeUpdated({groupID:t,messageRemindType:n})}},{key:"_handleTopicSystemNotice",value:function(a){var n=a.groupProfile,t=n.groupID,n=n.topicID,a=a.elements,o=a.operationType,s=a.topicIDList,a=a.messageRemindType,i=this._grpM.get(10);o===17?i.onTopicCreated({groupID:t,topicID:n}):o===18?i.onTopicDeleted({groupID:t,topicIDList:s}):o===20&&i.onMessageRemindTypeUpdated({groupID:t,topicID:n,messageRemindType:a})}},{key:"reset",value:function(){this.pendencyMap.clear()}}]),xi=["relayFlag"],Vi=(de(jn,ce),b(jn,[{key:"_onCloudConfig",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"),s=this.getCloudConfig("paging_grp_count"),a=this.getCloudConfig("av_members_freq_limit");d.l("".concat(this._n,"._onCloudConfig pollingInterval:").concat(e)+" pollingIntervalPlus:".concat(t," pollingNoMessageCount:").concat(n)+" pollingSimplifiedMessage:".concat(o," pagingGroupCount:").concat(s)+" avChatRoomMembersFrequencyLimit:".concat(a)),this._AVChatRoomHandler.setPollingInterval(e),this._AVChatRoomHandler.setPollingIntervalPlus(t),this._AVChatRoomHandler.setPollingNoMessageCount(n),this._AVChatRoomHandler.setPollingSimplifiedMessage(o),this._commonGroupHandler.setPagingGroupCount(s),this._groupMemberHandler.setAVChatRoomMembersFrequencyLimit(a)}},{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&(this._commonGroupHandler.onCheckTimer(e),this._groupTipsHandler.onCheckTimer(e))}},{key:"guardForAVChatRoom",value:function(e){var t,n=this;return e.conversationType!==g.CONV_GROUP||(t=he(e.to)?_e(e.to):e.to,this.hasLocalGroup(t))?q():this.getGroupProfile({groupID:t}).then(function(s){var s=s.data.group.type;return d.l("".concat(n._n,".guardForAVChatRoom. groupID:").concat(t," type:").concat(s)),s===g.GRP_AVCHATROOM?v(new ie({code:s=y.MSG_SEND_FAIL_NOT_IN_AV,message:n.getErrMsg(s,e.from,t),data:{message:e}})):q()})}},{key:"checkJoinedAVChatRoomByID",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"onNewMessage",value:function(e){this._commonGroupHandler.onNewMessage(e)}},{key:"updateNextMessageSeq",value:function(e){var t,n=this;O(e)&&(t=this.get(10),e.forEach(function(o){var s=o.conversationID.replace(g.CONV_GROUP,"");he(s)&&t.updateUnreadCountAndLastMsg(s,o.lastMessage),n.groupMap.has(s)&&(n.groupMap.get(s).nextMessageSeq=o.lastMessage.sequence+1)}))}},{key:"onNewGroupTips",value:function(e){this._groupTipsHandler.onNewGroupTips(e)}},{key:"onMsgRevoked",value:function(e){this._commonGroupHandler.onMsgRevoked(e,!(1<arguments.length&&arguments[1]!==void 0)||arguments[1])}},{key:"onNewGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.onNewGroupSystemNotice(e)}},{key:"onMsgReadNotice",value:function(e){var t=this;e.dataList.forEach(function(s){var o,s=s.elements.groupMessageReadNotice;T(s)||(o=t.get(11),s.forEach(function(r){var c=r.groupID,i=r.topicID,i=i===void 0?void 0:i,r=r.lastMessageSeq,c=(d.l("".concat(t._n,".onMsgReadNotice groupID:").concat(c," lastMessageSeq:").concat(r)),"".concat(g.CONV_GROUP).concat(c)),u=!0;k(i)||(c="".concat(g.CONV_GROUP).concat(i),u=!1),o.updateIsReadAfterReadReport({conversationID:c,lastMessageSeq:r}),o.updateUnreadCount(c,u),o.clearGroupAtInfoList(c,u)}))})}},{key:"onReadReceiptList",value:function(e){var t=this;d.l("".concat(this._n,".onReadReceiptList options:"),e),e.dataList.forEach(function(a){var o=a.groupProfile,a=a.elements,o=o.groupID,s=t.get(11),a=a.readReceiptList;s.updateReadReceiptInfo({groupID:o,readReceiptList:a})})}},{key:"onMsgModified",value:function(e){d.l("".concat(this._n,".onMsgModified options:"),e);var t=this.get(11);e.dataList.forEach(function(n){t.onMessageModified(p(p({},n),{},{conversationType:g.CONV_GROUP,to:n.topicID||n.groupID}))})}},{key:"deleteGroupSystemNotice",value:function(e){this._groupSystemNoticeHandler.deleteGroupSystemNotice(e)}},{key:"initGroupMap",value:function(e){this.groupMap.set(e.groupID,new it(e))}},{key:"clearGroupMap",value:function(){this.groupMap.clear()}},{key:"deleteGroup",value:function(e){this.groupMap.delete(e)}},{key:"updateGroupMap",value:function(e){var t,n=this,o=this.get(11);e.forEach(function(c){t=c.groupID,n.groupMap.has(t)?n.groupMap.get(t).updateGroup(c):(n.groupMap.set(t,new it(c)),o.deleteGroupRoamingInfo(t))});var s,a=this.getMyUserID(),i=Se(this.groupMap);try{for(i.s();!(s=i.n()).done;){var r=ke(s.value,2)[1];r.selfInfo.userID=a,r.selfInfo.role==="Owner"&&(r.ownerID=a)}}catch(c){i.e(c)}finally{i.f()}}},{key:"getGroupMap",value:function(){return this.groupMap}},{key:"getLocalGroupList",value:function(){return G(this.groupMap.values()).filter(function(e){return e.type!==g.GRP_ROOM&&e.type!==g.GRP_LIVE})}},{key:"getLocalGroupProfile",value:function(e){return this.groupMap.get(e)}},{key:"sortLocalGroupList",value:function(){var e=G(this.groupMap).filter(function(t){return t=ke(t,2),t[0],!k(t[1].lastMessage)});e.sort(function(t,n){return n[1].lastMessage.lastTime-t[1].lastMessage.lastTime}),this.groupMap=new Map(G(e))}},{key:"updateGroupLastMessage",value:function(e){this._commonGroupHandler.updateLastMsg(e)}},{key:"emitGroupListUpdate",value:function(){var e=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1],n=this.getLocalGroupList();e&&this.emitOEvt(F.GROUP_LIST_UPDATED),t&&(e=JSON.parse(JSON.stringify(n)),this.get(11).updateConvGroupProfile(e))}},{key:"getMyNameCardByGroupID",value:function(e){return e=this.getLocalGroupProfile(e),e?e.selfInfo.nameCard:""}},{key:"isPagingGetCompleted",value:function(){return this._commonGroupHandler.isPagingGetCompleted()}},{key:"getMsgRemindType",value:function(e){var t=this;return!O(e)||e.length===0||(e=e.filter(function(n){return n=(t.getLocalGroupProfile(n)||{}).type,!be(n===void 0?"":n)})).length===0?Promise.resolve():(d.l("".concat(this._n,".getMsgRemindType groupIDList:").concat(e)),this.getGroupProfileAdvance({groupIDList:e,responseFilter:{memberInfoFilter:["MsgFlag"]}}).then(function(o){var o=o.data.successGroupList,s=t.get(11);o.forEach(function(a){s.onGroupMsgRemindTypeUpdated({groupID:a.groupID,messageRemindType:O(a.members)?a.members[0].messageRemindType:""})})}))}},{key:"getGroupList",value:function(){return this._commonGroupHandler.getGroupList()}},{key:"syncCommunityWithTopic",value:function(){return this._commonGroupHandler.syncGroupList(!0)}},{key:"getGroupProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("getGroupProfile"),o=new D("getGroupProfile"),s=e.groupID,a=e.groupCustomFieldFilter,a=(d.l("".concat(n," groupID:").concat(s)),{groupIDList:[s],responseFilter:{groupBaseInfoFilter:G(Ds),groupCustomFieldFilter:a,memberInfoFilter:[].concat(G(Es),["NameCard"])}});return this.getGroupProfileAdvance(a).then(function(c){var c=c.data,r=c.successGroupList,c=c.failureGroupList;return d.l("".concat(n," ok")),0<c.length?v(c[0]):((c=be(r[0].type)&&!t.hasLocalGroup(s)?new it(r[0]):(t.updateGroupMap(r),t.getLocalGroupProfile(s))).isSupportTopic||t.get(11).updateConvGroupProfile([c]),o.setMessage("groupID:".concat(s," type:").concat(c.type," muteAllMembers:").concat(c.muteAllMembers," ownerID:").concat(c.ownerID)).end(),N({group:c}))}).catch(function(i){return o.setError(i).setMessage("groupID:".concat(e.groupID)).end(),d.e("".concat(n," failed. error:"),i),v(i)})}},{key:"getGroupProfileAdvance",value:function(e){var t,n="".concat(this._n,".getGroupProfileAdvance"),a=e.groupIDList,o=(O(a)&&50<a.length&&(this.warn("GetGroupProfileLimit"),a.length=50),[]),s=[],a=(a.forEach(function(i){(we({groupID:i})?s:o).push(i)}),[]);return 0<o.length&&(t=this._getGroupProfileAdvance(p(p({},e),{},{groupIDList:o})),a.push(t)),0<s.length&&(t=this._getGroupProfileAdvance(p(p({},e),{},{groupIDList:s,relayFlag:0<o.length})),a.push(t)),Promise.all(a).then(function(i){var r=[],c=[];return i.forEach(function(u){r.push.apply(r,G(u.successGroupList)),c.push.apply(c,G(u.failureGroupList))}),N({successGroupList:r,failureGroupList:c})}).catch(function(i){return d.e("".concat(n," failed. error:"),i),v(i)})}},{key:"_getGroupProfileAdvance",value:function(e){var t=this,n=e.relayFlag,o=n!==void 0&&n,s=Fe(e,xi);return this.req({P:h.GET_GRP_PROFILE,data:s}).then(function(a){return d.l("".concat(t._n,"._getGroupProfileAdvance ok. options:"),s),a=a.data.groups,{successGroupList:a.filter(function(i){return T(i.errorCode)||i.errorCode===0}),failureGroupList:a.filter(function(i){return i.errorCode&&i.errorCode!==0}).map(function(i){return new ie({code:i.errorCode,message:i.errorInfo,data:{groupID:i.groupID}})})}}).catch(function(a){return o&&we({groupID:e.groupIDList[0]})?{successGroupList:[],failureGroupList:[]}:v(a)})}},{key:"createGroup",value:function(e){var t=this,n=[g.GRP_PUBLIC,g.GRP_WORK,g.GRP_MEETING,g.GRP_AVCHATROOM,g.GRP_COMMUNITY],o="".concat(this._n,".").concat("createGroup"),s=e.type,a=e.groupID;if(e.name&&this._filterProfanity("name",e)===!1)return v({code:y.PROFANITY_FOUND});if(e.introduction&&this._filterProfanity("introduction",e)===!1)return v({code:y.PROFANITY_FOUND});if(e.notification&&this._filterProfanity("notification",e)===!1)return v({code:y.PROFANITY_FOUND});if(!n.includes(s))return v({code:y.ILLEGAL_GRP_TYPE});if(!we({type:s})){if(!k(a)&&we({groupID:a}))return v({code:y.ILLEGAL_GRP_ID});e.isSupportTopic=void 0}if(be(s)&&!T(e.memberList)&&0<e.memberList.length&&(e.memberList=void 0),this._canIUseJoinOption(s)||T(e.joinOption)||(e.joinOption=void 0),we({type:s})){if(!k(a)&&!we({groupID:a}))return v({code:y.ILLEGAL_GRP_ID});e.isSupportTopic=e.isSupportTopic===!0?1:0}var i=new D("createGroup"),r=(d.l("".concat(o," options:"),e),null),c=[];return this.req({P:h.CREATE_GRP,data:p(p({},e),{},{ownerID:this.getMyUserID(),webPushFlag:1})}).then(function(C){var l,_,m,C=C.data,f=C.groupID,C=C.overLimitUserIDList,I=C===void 0?[]:C,C=(r=f,c=I,"groupType:".concat(e.type," groupID:").concat(f," overLimitUserIDList:").concat(I));return i.setMessage(C).end(),d.l("".concat(o," ok. ").concat(C)),e.type===g.GRP_AVCHATROOM||e.type===g.GRP_COMMUNITY&&e.isSupportTopic===1||(k(e.memberList)||k(I)||(e.memberList=e.memberList.filter(function(M){return I.indexOf(M.userID)===-1})),t.updateGroupMap([p(p({},e),{},{groupID:f})]),C=t.get(2),m="",l=0,e.type===g.GRP_COMMUNITY?(m=t.isIntl()?"Create Community":"创建社群",l=1):m=t.isIntl()?"Create Group":"创建群组",_=t.get(4).getMyNick(),m=C.createCustomMessage({to:f,conversationType:g.CONV_GROUP,payload:{data:JSON.stringify({businessID:"group_create",content:m,cmd:l,opUser:_||t.getMyUserID(),version:4})}}),C.sendMessageInstance(m),t.emitGroupListUpdate()),t.getGroupProfile({groupID:f})}).then(function(l){var l=l.data.group,m=l.selfInfo,_=m.nameCard,m=m.joinTime;return l.updateSelfInfo({nameCard:_,joinTime:m,messageRemindType:g.MSG_REMIND_ACPT_AND_NOTE,role:g.GRP_MBR_ROLE_OWNER}),N({group:l,overLimitUserIDList:c})}).catch(function(u){var l;return i.setMessage("groupType:".concat(e.type)).setError(u).end(),u.code===10010||u.code===10007?(t._silentlyGetGroupProfile(u.code,r),t.updateGroupMap([p(p({},e),{},{groupID:r})]),(l=t.getLocalGroupProfile(r)).selfInfo.role=g.GRP_MBR_ROLE_OWNER,N({group:l,overLimitUserIDList:c})):(d.e("".concat(o," failed. error:"),u),v(u))})}},{key:"dismissGroup",value:function(e){var t=this,n="".concat(this._n,".").concat("dismissGroup"),o="groupID:".concat(e),s=new D("dismissGroup");return s.setMessage(o),d.l("".concat(n," ").concat(o)),this.req({P:h.DISMISS_GRP,data:{groupID:e}}).then(function(){return s.end(),d.l("".concat(n," ok")),t.deleteLocalGroupAndConversation(e),t.checkJoinedAVChatRoomByID(e)&&t._AVChatRoomHandler.reset(e),t._groupAttributesHandler.deleteLocalGroupAttributes(e),N({groupID:e})}).catch(function(a){return s.setError(a).end(),d.e("".concat(n," failed. error:"),a),v(a)})}},{key:"updateGroupProfile",value:function(e){var t,n,o=this,s="".concat(this._n,".").concat("updateGroupProfile");return this.hasLocalGroup(e.groupID)&&(t=this.getLocalGroupProfile(e.groupID).type,this._canIUseJoinOption(t)||T(e.joinOption)||(d.w("".concat(s," joinOption is unavailable for Work/Meeting/AVChatRoom")),e.joinOption=void 0)),T(e.muteAllMembers)||(e.muteAllMembers?e.muteAllMembers="On":e.muteAllMembers="Off"),e.name&&this._filterProfanity("name",e)===!1||e.introduction&&this._filterProfanity("introduction",e)===!1||e.notification&&this._filterProfanity("notification",e)===!1?v({code:y.PROFANITY_FOUND}):((n=new D("updateGroupProfile")).setMessage(JSON.stringify(e)),d.l("".concat(s," groupID:").concat(e.groupID)),this.req({P:h.UPDATE_GRP_PROFILE,data:e}).then(function(){return n.end(),d.l("".concat(s," ok")),o.hasLocalGroup(e.groupID)&&o.groupMap.get(e.groupID).updateGroup(e),N({group:o.groupMap.get(e.groupID)})}).catch(function(a){return n.setError(a).end(),d.l("".concat(s," failed. error:"),a),v(a)}))}},{key:"_filterProfanity",value:function(e,t){var n,o=this.get(29);return!o||(n=(o=o.filterText(t[e],Ts)).isAllowedToSend,o=o.modifiedText,n===!0&&(t[e]=o,!0))}},{key:"joinGroup",value:function(e){var t,n=this,o=e.groupID,s="".concat(this._n,".joinGroup");return this.deleteUnjoinedAVChatRoom(o),this.hasLocalGroup(o)?this.isLoggedIn()?(t=new D("applyJoinGroup"),this.getGroupProfile({groupID:o}).then(function(){return t.setMessage("groupID:".concat(o," joinedStatus:").concat(g.JOIN_STATUS_ALREADY_IN_GROUP)).end(),q({status:g.JOIN_STATUS_ALREADY_IN_GROUP})}).catch(function(a){return t.setMessage("groupID:".concat(o," unjoined")).end(),d.w("".concat(s," ").concat(o," was unjoined, now join!")),n.groupMap.delete(o),n.applyJoinGroup(e)})):q({status:g.JOIN_STATUS_ALREADY_IN_GROUP}):(d.l("".concat(s," groupID:").concat(o)),this.isLoggedIn()?this.applyJoinGroup(e):this._AVChatRoomHandler.joinWithoutAuth(e))}},{key:"applyJoinGroup",value:function(e){var t,n,o=this,s="".concat(this._n,".").concat("applyJoinGroup"),a=e.groupID;return k(e.applyMessage)||this._filterProfanity("applyMessage",e)!==!1?(t=new D("applyJoinGroup"),e=p({},e),(n=this.canIUse(ee.AV_HISTORY_MSG))&&(e.historyMessageFlag=1),this.get(11).deleteTopicRoamingInfo(a),this.req({P:h.APPLY_JOIN_GRP,data:e}).then(function(f){var f=f.data,r=f.joinedStatus,c=f.longPollingKey,u=f.startSeq,l=f.avChatRoomFlag,_=f.avChatRoomKey,m=f.messageList,f="groupID:".concat(a," joinedStatus:").concat(r," longPollingKey:").concat(c," startSeq:").concat(u)+" avChatRoomFlag:".concat(l," canGetAVChatRoomHistoryMsg:").concat(n,",")+" historyMsgCount:".concat(k(m)?0:m.length);switch(t.setMessage(f).end(),d.l("".concat(s," ok. ").concat(f)),r){case Ws:return N({status:Ws});case Lt:return o.getGroupProfile({groupID:a}).then(function(C){return C=C.data.group,o._handleJoinResult({group:C,avChatRoomFlag:l,longPollingKey:c,startSeq:u,avChatRoomKey:_,messageList:m})}).catch(function(C){var M;return C.code===10010||C.code===10007?(o._silentlyGetGroupProfile(C.code,a),M=new it({groupID:a}),o.updateGroupMap([M]),o._handleJoinResult({group:M,avChatRoomFlag:l,longPollingKey:c,startSeq:u,avChatRoomKey:_,messageList:m})):(d.e("".concat(s," failed. error:"),C),v(C))});default:var I=new ie({code:y.JOIN_GRP_FAIL});return d.e("".concat(s," failed. error:"),I),v(I)}}).catch(function(i){return t.setMessage("groupID:".concat(a)).setError(i).end(),d.e("".concat(s," failed. error:"),i),v(i)})):v({code:y.PROFANITY_FOUND})}},{key:"_handleJoinResult",value:function(e){var t=this,n=e.group,o=e.avChatRoomFlag,s=e.longPollingKey,a=e.startSeq,i=e.avChatRoomKey,r=e.messageList,c=n.groupID;return o===1?(this.get(11).setCompleted("".concat(g.CONV_GROUP).concat(c)),this._groupAttributesHandler.initGroupAttributesCache({groupID:c,avChatRoomKey:i}),this._groupCountersHandler.initGroupCountersCache({groupID:c,avChatRoomKey:i}),(e=T(s)?this._AVChatRoomHandler.handleJoinResult({group:n}):this._AVChatRoomHandler.startRunLoop({group:n,longPollingKey:s,startSeq:a})).then(function(){t._onAVChatRoomHistoryMessage(r,c)}),e):(this.emitGroupListUpdate(!0,!1),N({status:Lt,group:n}))}},{key:"quitGroup",value:function(e){var t,n=this,s=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"outer",o="".concat(this._n,".").concat("quitGroup"),s="groupID:".concat(e," from:").concat(s),a=(d.l("".concat(o," ").concat(s)),this.checkJoinedAVChatRoomByID(e));return a||this.hasLocalGroup(e)?a&&!this.isLoggedIn()?(d.l("".concat(o," anonymously ok. ").concat(s)),this.deleteLocalGroupAndConversation(e),this._AVChatRoomHandler.reset(e),q({groupID:e})):((t=new D("quitGroup")).setMessage(s),this.req({P:h.QUIT_GRP,data:{groupID:e}}).then(function(){return t.end(),d.l("".concat(o," ok")),n.deleteLocalGroupAndConversation(e),a&&n._AVChatRoomHandler.reset(e),n._groupAttributesHandler.deleteLocalGroupAttributes(e),N({groupID:e})}).catch(function(i){return t.setError(i).end(),d.e("".concat(o," failed. error:"),i),v(i)})):v({code:y.MEMBER_NOT_IN_GRP})}},{key:"searchGroupByID",value:function(e){var t="".concat(this._n,".").concat("searchGroupByID"),n={groupIDList:[e]},o=new D("searchGroupByID");return o.setMessage("groupID:".concat(e)),d.l("".concat(t," groupID:").concat(e)),this.req({P:h.SEARCH_GRP,data:n}).then(function(s){if(s=s.data.groupProfile,s[0].errorCode!==0)throw new ie({code:s[0].errorCode,message:s[0].errorInfo});return o.end(),d.l("".concat(t," ok")),N({group:new it(s[0])})}).catch(function(s){return o.setError(s).end(),d.w("".concat(t," failed. error:"),s),v(s)})}},{key:"changeGroupOwner",value:function(e){var t,n=this,o="".concat(this._n,".").concat("changeGroupOwner");return this.hasLocalGroup(e.groupID)&&this.getLocalGroupProfile(e.groupID).type===g.GRP_AVCHATROOM?v({code:y.CANNOT_CHANGE_OWNER_IN_AV}):e.newOwnerID===this.getMyUserID()?v({code:y.CANNOT_CHANGE_OWNER_TO_SELF}):((t=new D("changeGroupOwner")).setMessage("groupID:".concat(e.groupID," newOwnerID:").concat(e.newOwnerID)),d.l("".concat(o," groupID:").concat(e.groupID)),this.req({P:h.CHANGE_GRP_OWNER,data:e}).then(function(){t.end(),d.l("".concat(o," ok"));var s,a=e.groupID,i=e.newOwnerID,r=(n.groupMap.get(a).ownerID=i,n._groupMemberHandler.getLocalGroupMemberList(a));return r instanceof Map&&(s=r.get(n.getMyUserID()),T(s)||(s.updateRole("Member"),n.groupMap.get(a).selfInfo.role="Member"),s=r.get(i),T(s)||s.updateRole("Owner")),n.emitGroupListUpdate(!0,!1),N({group:n.groupMap.get(a)})}).catch(function(s){return t.setError(s).end(),d.e("".concat(o," failed. error:"),s),v(s)}))}},{key:"getGroupApplicationList",value:function(){return this._groupSystemNoticeHandler.getGroupApplicationList()}},{key:"handleGroupApplication",value:function(e){var t,n,o,s,a,i=this,r="".concat(this._n,".").concat("handleGroupApplication"),c=e.handleAction,u=e.handleMessage,l=e.message,_=e.application,m=(l?(t=l.payload.operatorID,n=l.payload.groupProfile.groupID,o=l.payload.authentication,s=l.payload.messageKey):_&&(t=_.applicant,n=_.groupID,o=_.authentication,s=_.messageKey),h.HANDLE_GRP_APPLICATION),f=(_&&_.applicationType===2&&(m=h.HANDLE_INVITE_JOIN_GRP,a=_.userID),new D("handleGroupApplication"));return f.setMessage("groupID:".concat(n)),d.l("".concat(r," groupID:").concat(n)),this.req({P:m,data:{handleAction:c,handleMessage:u,applicant:t,invitee:a,groupID:n,authentication:o,messageKey:s}}).then(function(){return f.end(),d.l("".concat(r," ok")),l&&i._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),N({group:i.getLocalGroupProfile(n)})}).catch(function(I){return f.setError(I).end(),d.e("".concat(r," failed. error"),I),v(I)})}},{key:"handleGroupInvitation",value:function(e){var t=this,n="".concat(this._n,".").concat("handleGroupInvitation"),i=e.message.payload,o=i.groupProfile.groupID,s=i.authentication,a=i.messageKey,i=i.operatorID,r=e.handleAction,c=new D("handleGroupInvitation");return c.setMessage("groupID:".concat(o," inviter:").concat(i," handleAction:").concat(r)),d.l("".concat(n," groupID:").concat(o," inviter:").concat(i," handleAction:").concat(r)),this.req({P:h.HANDLE_GRP_INVITATION,data:p(p({},e),{},{inviter:i,groupID:o,authentication:s,messageKey:a})}).then(function(){return c.end(),d.l("".concat(n," ok")),t._groupSystemNoticeHandler.deleteGroupSystemNotice({messageList:[e.message]}),N({group:t.getLocalGroupProfile(o)})}).catch(function(u){return c.setError(u).end(),d.e("".concat(n," failed. error"),u),v(u)})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this,n="".concat(this._n,".getGroupOnlineMemberCount"),o=this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e),s=this.hasLocalGroup(e);if(d.l("".concat(n," groupID:").concat(e," isAVChatRoom:").concat(o," has:").concat(s)),o)return this._AVChatRoomHandler.getGroupOnlineMemberCount(e);if(!s)return q({memberCount:0});if(o=Date.now(),this._onlineMemberCountMap.has(e)){if(s=this._onlineMemberCountMap.get(e),o-s.lastReqTime<=6e4)return q({memberCount:s.memberCount});s.lastReqTime=o}return this.requestOnlineCount(e).then(function(a){return a=a.data.memberCount,a=a===void 0?0:a,t._onlineMemberCountMap.set(e,{lastReqTime:Date.now(),memberCount:a}),d.l("".concat(n," ok. groupID:").concat(e," memberCount:").concat(a)),q({memberCount:a})}).catch(function(a){return d.w("".concat(n," failed. error:"),a),Promise.reject(a)})}},{key:"requestOnlineCount",value:function(e){return this.req({P:h.GET_ONLINE_MBR_NUM,data:{groupID:e}})}},{key:"hasLocalGroup",value:function(e){return this.groupMap.has(e)}},{key:"deleteLocalGroupAndConversation",value:function(e){var t=this.checkJoinedAVChatRoomByID(e),n=(d.l("".concat(this._n,".deleteLocalGroupAndConversation groupID:").concat(e," isJoinedAVChatRoom:").concat(t)),this.get(11)),o="".concat(g.CONV_GROUP).concat(e);t&&(this._AVChatRoomHandler.reset(e),this._deleteLocalGroup(e),n.deleteLocalConv(o),this._groupMemberHandler.deleteAVChatRoomMembersReqInfo(e)),we({groupID:e})&&(t=this.getLocalGroupProfile(e))&&t.isSupportTopic===!0&&this.get(10).deleteTopicListInCommunity(e),n.clearUnreadCount(o),n.setCompleted(o),this._deleteLocalGroup(e),this._onlineMemberCountMap.delete(e),this.emitGroupListUpdate(!0,!1)}},{key:"_deleteLocalGroup",value:function(e){this.groupMap.delete(e),this._groupMemberHandler.deleteGroupMemberList(e)}},{key:"sendMessage",value:function(e,t){return O(e._receiverList)&&0<e._receiverList.length&&!this.canIUse(ee.MSG_TO_SPECIFIED_GRP_MBR)?this.noUse("Targeted Group Message"):(e=this.createGroupMessagePack(e,t),this.req(e))}},{key:"createGroupMessagePack",value:function(e,t){var n=null,o=(t&&t.offlinePushInfo&&(n=t.offlinePushInfo),""),s=(V(e.cloudCustomData)&&0<e.cloudCustomData.length&&(o=e.cloudCustomData),[]),a=(Q(t)&&Q(t.messageControlInfo)&&(a=(c=t.messageControlInfo).excludedFromUnreadCount,i=c.excludedFromLastMessage,c=c.excludedFromContentModeration,a===!0&&s.push("NoUnread"),i===!0&&s.push("NoLastMsg"),c===!0)&&s.push("NoMsgCheck"),void 0),i=(O(e._receiverList)&&0<e._receiverList.length&&(a=e._receiverList,50<e._receiverList.length)&&(a=e._receiverList.slice(0,50),this.warn("ReceiverListLimit")),this.isOnlineMessage(e,t)?1:0),c=JSON.parse(JSON.stringify(e.getElements())),r=(this.get(17).getFileDNList(),e.getGroupAtInfoList()),c={fromAccount:this.getMyUserID(),groupID:e.to,msgBody:Un(e.type,c),cloudCustomData:o,random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:e.type!==g.MSG_TEXT||k(r)?void 0:r,onlineOnlyFlag:i,clientTime:e.clientTime,offlinePushInfo:Vn(n),messageControlInfo:i==0?s:void 0,needReadReceipt:e.needReadReceipt!==!0||this.isMessageFromOrToAVChatroom(e.to)?0:1,receiverList:a,isSupportExtension:e.isSupportExtension===!0?1:0,isRelayMessage:e._relayFlag===!0?1:0,cmConfigID:e._cmConfigID,forbidCallbackControl:Zs(t)};return he(e.to)&&(c.groupID=_e(e.to),c.topicID=e.to),{P:h.SEND_GRP_MSG,data:c}}},{key:"revokeMessage",value:function(e){var t={groupID:e.to,msgSeqList:[{msgSeq:e.sequence}]};return he(e.to)&&(t.groupID=_e(e.to),t.topicID=e.to),this.req({P:h.REVOKE_GRP_MSG,data:t})}},{key:"deleteMessage",value:function(n){var t=n.to,n=n.keyList,n=(d.l("".concat(this._n,".deleteMessage groupID:").concat(t," count:").concat(n.length)),{groupID:t,deleter:this.getMyUserID(),keyList:n});return he(t)&&(n.groupID=_e(t),n.topicID=t),this.req({P:h.DEL_GRP_MSG,data:n})}},{key:"modifyRemoteMessage",value:function(i){var u=i.to,t=i.sequence,n=i.payload,o=i.type,s=i.version,s=s===void 0?0:s,a=i.cloudCustomData,i=i._elements,r=u,c=void 0,u=(he(u)&&(r=_e(u),c=u),void 0);return aa(o)&&(1<i.length&&i.splice(0,1,{type:o,content:n}),u=i),this.req({P:h.MODIFY_GRP_MSG,data:{groupID:r,topicID:c,sequence:t,version:s,elements:u,cloudCustomData:a}})}},{key:"getRoamingMessage",value:function(a){var t=this,n="".concat(this._n,".").concat("getRoamingMessage"),o=a.conversationID,s=a.groupID,a=a.sequence,i=new D("getRoamingMessage"),r=0,c=void 0;return he(s)&&(s=_e(c=s)),this._computeLastSequence({groupID:s,topicID:c,sequence:a}).then(function(u){return r=u,d.l("".concat(n," groupID:").concat(s," startSequence:").concat(r)),t.req({P:h.GET_GRP_ROAMING_MSG,data:{groupID:s,count:21,sequence:r,topicID:c}})}).then(function(m){var _=m.data,M=_.messageList,l=_.complete,_=_.invisibleSequenceList,_=_===void 0?[]:_,m=m.data.nextSequence,m=m===void 0?0:m,f=(T(M)?d.l("".concat(n," ok. complete:").concat(l," nextSequence:").concat(m," but messageList is undefined!")):d.l("".concat(n," ok. complete:").concat(l," nextSequence:").concat(m," count:").concat(M.length)),i.setMessage("groupID:".concat(s," topicID:").concat(c," startSequence:").concat(r," complete:").concat(l," nextSequence:").concat(m)).end(),t.get(11)),I=[],C=[],M=(k(M)||(I=f.onRoamingMessage(M,o,!0,C),f.updateIsRead(o),f.patchConvLastMessage(o)),l===2||m<1);return M&&(f.setCompleted(o),m=""),d.l("".concat(n," isPullingCompleted:").concat(M," nextReqID:").concat(m," storedMsgCount:").concat(I.length)+" invisibleSeqCount:".concat(_.length)),{nextReqID:m+"",storedMessageList:I,assembledMessageList:C,isPullingCompleted:M}}).catch(function(u){return i.setError(u).setMessage("groupID:".concat(s," topicID:").concat(c," startSequence:").concat(r)).end(),d.w("".concat(n," failed. error:"),u),v(u)})}},{key:"_getGroupIDOfMessage",value:function(e){return e.conversationID.replace(g.CONV_GROUP,"")}},{key:"getReadReceiptList",value:function(e){var t,n="".concat(this._n,".").concat("getReadReceiptList"),o=this._getGroupIDOfMessage(e[0]),s=this.getMyUserID(),a=e.filter(function(i){return i.from===s&&i.needReadReceipt===!0}).map(function(i){return{sequence:i.sequence}});return d.l("".concat(n," groupID:").concat(o," sequenceList:").concat(JSON.stringify(a))),a.length===0?q({messageList:e}):((t=new D("getReadReceiptList")).setMessage("groupID:".concat(o)),this.req({P:h.GET_READ_RECEIPT,data:{groupID:o,sequenceList:a}}).then(function(i){return t.end(),d.l("".concat(n," ok")),i=i.data.readReceiptList,O(i)&&i.forEach(function(r){e.forEach(function(c){r.code===0&&r.sequence===c.sequence&&(c.readReceiptInfo.readCount=r.readCount,c.readReceiptInfo.unreadCount=r.unreadCount)})}),N({messageList:e})}).catch(function(i){return t.setError(i).end(),d.w("".concat(n," failed. error:"),i),v(i)}))}},{key:"sendReadReceipt",value:function(a){var t="".concat(this._n,".").concat("sendReadReceipt"),n=this._getGroupIDOfMessage(a[0]),o=new D("sendReadReceipt"),s=(o.setMessage("groupID:".concat(n)),this.getMyUserID()),a=a.filter(function(i){return i.from!==s&&i.needReadReceipt===!0}).map(function(i){return{sequence:i.sequence}});return a.length===0?v({code:y.READ_RECEIPT_MSG_LIST_EMPTY}):(d.l("".concat(t,". sequenceList:").concat(JSON.stringify(a))),this.req({P:h.SEND_READ_RECEIPT,data:{groupID:n,sequenceList:a}}).then(function(i){return o.end(),d.l("".concat(t," ok")),N()}).catch(function(i){return o.setError(i).end(),d.w("".concat(t," failed. error:"),i),v(i)}))}},{key:"getReadReceiptDetail",value:function(l){var t=this,s=l.message,c=l.filter,u=l.cursor,l=l.count,n=this._getGroupIDOfMessage(s),o=s.ID,s=s.sequence,a="".concat(this._n,".").concat("getReadReceiptDetail"),i=this._receiptDetailCompleteMap.get(o)||!1,r=c!==0&&c!==1?0:c,c=V(u)?u:"",u=!Y(l)||l<=0||100<=l?100:l,l="groupID:".concat(n," sequence:").concat(s," cursor:").concat(c," filter:").concat(r," completeFlag:").concat(i),_=(d.l("".concat(a," ").concat(l)),{cursor:"",isCompleted:!1,messageID:o,unreadUserIDList:[],readUserIDList:[]}),m=new D("getReadReceiptDetail");return m.setMessage(l),this.req({P:h.GET_READ_RECEIPT_DETAIL,data:{groupID:n,sequence:s,flag:r,cursor:c,count:u}}).then(function(S){m.end();var S=S.data,I=S.cursor,C=S.isCompleted,M=S.unreadUserIDList,S=S.readUserIDList;return _.cursor=I,C===1&&(_.isCompleted=!0,t._receiptDetailCompleteMap.set(o,!0)),r===0?_.readUserIDList=S.map(function(L){return L.userID}):r===1&&(_.unreadUserIDList=M.map(function(L){return L.userID})),d.l("".concat(a," ok")),N(_)}).catch(function(f){return m.setError(f).end(),d.w("".concat(a," failed. error:"),f),v(f)})}},{key:"getGroupReceiptsByUsers",value:function(o){var t="".concat(this._n,".").concat("getGroupReceiptsByUsers"),n=o.groupID,o=o.dataList,o=o===void 0?[]:o,s="groupID:".concat(n," dataList length:").concat(o.length);return d.l("".concat(t," ").concat(s)),o.length===0&&d.w("".concat(t," dataList is empty.")),this.req({P:h.GET_GRP_RECEIPTS_BY_USERS,data:{groupID:n,dataList:o}}).then(function(a){return a=a.data.dataList,a=a===void 0?[]:a,d.l("".concat(t," ok.")),N({dataList:a})}).catch(function(a){return d.w("".concat(t," failed. error:"),a),v(a)})}},{key:"getRoamingMessagesHopping",value:function(e){var t=this,n="".concat(this._n,".").concat("getRoamingMessagesHopping"),o=e.groupID,s=e.count,a=e.sequence,i=e.direction,r=void 0;return T(a)&&i===1?q({messageList:[],isCompleted:!0,nextMessageSeq:""}):(he(o)&&(o=_e(r=o)),this._computeReqSeqHopping({groupID:o,topicID:r,sequence:a}).then(function(c){T(a)||i!==1||(c=a+s-1);var u="".concat(r?"topicID:".concat(r):"groupID:".concat(o)," sequence:").concat(a," reqSeq:").concat(c," direction:").concat(i),l=(d.l("".concat(n," ").concat(u)),new D("getRoamingMessagesHopping"));return t.req({P:h.GET_GRP_ROAMING_MSG,data:{groupID:o,topicID:r,count:s,sequence:c}}).then(function(I){var I=I.data,S=I.messageList,S=S===void 0?[]:S,m=I.complete,f=I.nextSequence,f=f===void 0?0:f,I=I.invisibleSequenceList,I=I===void 0?[]:I,M="complete:".concat(m," nextSequence:").concat(f," remoteMsgCount:").concat(S.length," invisibleSequenceList:").concat(I),M=(l.setMessage("".concat(u," ").concat(M)).end(),d.l("".concat(n," ok. ").concat(M)),"".concat(g.CONV_GROUP).concat(e.groupID)),C=t.get(11),M=C.onRoamingMessage(S,M,!1),S=t._computeResult({groupID:e.groupID,direction:i,sequence:a,remoteMessageList:S,processedMessageList:M,complete:m,nextSequence:f,invisibleSequenceList:I});return C.storeHoppingMessageList(S.messageList),N(S)}).catch(function(_){return l.setError(_).setMessage("groupID:".concat(o," sequence:").concat(a," count:").concat(s)).end(),d.w("".concat(n," failed. error:"),_),v(_)})}))}},{key:"_computeReqSeqHopping",value:function(s){var t=this,n=s.groupID,o=s.topicID,o=o===void 0?void 0:o,s=s.sequence,s=s===void 0?void 0:s;return 0<s?Promise.resolve(s):T(o)?this.getGroupProfileAdvance({groupIDList:[n],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then(function(i){var i=i.data.successGroupList,r=0;return k(i)||(r=i[0].nextMessageSeq-1),d.l("".concat(t._n,"._computeReqSeqHopping groupID:").concat(n," lastSequence:").concat(r," from remote")),r}).catch(function(a){return v(a)}):Promise.resolve(0)}},{key:"_computeResult",value:function(u){var t={messageList:[],isCompleted:!1,nextMessageSeq:""},n=u.groupID,o=u.direction,s=u.sequence,a=u.remoteMessageList,a=a===void 0?[]:a,i=u.processedMessageList,i=i===void 0?[]:i,r=u.complete,c=u.nextSequence,u=u.invisibleSequenceList;if(o===0)return t.nextMessageSeq=c,(r===2||c<1)&&(t.isCompleted=!0,t.nextMessageSeq=""),t.messageList=i,t;if(o===1){if(k(a)){if(k(u))return t.isCompleted=!0,t.nextMessageSeq="",t;t.nextMessageSeq=u[0]+1}else r=a[0].sequence,c=u[0]||0,t.nextMessageSeq=c<r?r+1:c+1;return i.forEach(function(l){l.sequence>=s&&t.messageList.push(l)}),(we({groupID:n})||he(n))&&t.messageList.length===0&&a[0].sequence<s&&(t.isCompleted=!0,t.nextMessageSeq=""),t}}},{key:"setMessageRead",value:function(a){var t=this,n=a.conversationID,o=a.lastMessageSeq,s="".concat(this._n,".").concat("setMessageRead"),a="convID:".concat(n," lastMessageSeq:").concat(o),i=(d.l("".concat(s," ").concat(a)),Y(o)||this.warn("DoNotModifyLastSeq"),new D("setMessageRead")),r=(i.setMessage(a),n.replace(g.CONV_GROUP,"")),c=void 0;return he(r)&&(r=_e(c=r)),this.req({P:h.SET_GRP_MSG_READ,data:{groupID:r,topicID:c,messageReadSeq:o}}).then(function(){i.end(),d.l("".concat(s," ok"));var u,l=t.get(11),_=(l.updateIsReadAfterReadReport({conversationID:n,lastMessageSeq:o}),!0);return!T(c)&&(_=!1,u=t.get(10).getLocalTopic(r,c))&&u.updateSelfInfo({readedSequence:o}),l.updateUnreadCount(n,_),N()}).catch(function(u){return i.setError(u).end(),d.l("".concat(s," failed. error:"),u),v(u)})}},{key:"_computeLastSequence",value:function(o){var t=o.groupID,n=o.topicID,n=n===void 0?void 0:n,o=o.sequence;return 0<o?Promise.resolve(o):T(n)?this.getGroupLastSequence(t):Promise.resolve(0)}},{key:"getGroupLastSequence",value:function(e){var t="".concat(this._n,".").concat("getGroupLastSequence"),n=new D("getGroupLastSequence"),o=0,s="",a="groupID:".concat(e);if(this.hasLocalGroup(e)){var i=this.getLocalGroupProfile(e),r=i.lastMessage;if(0<r.lastSequence&&r.onlineOnlyFlag===!1)return o=r.lastSequence,s="".concat(a,", ").concat(o," from group.lastMessage.lastSequence"),d.l("".concat(t," ").concat(s)),n.setMessage(s).end(),Promise.resolve(o);if(1<i.nextMessageSeq)return o=i.nextMessageSeq-1,s="".concat(a,", ").concat(o," from group.nextMessageSeq"),d.l("".concat(t," ").concat(s)),n.setMessage(s).end(),Promise.resolve(o)}return r=this.get(11).getLocalConversation("GROUP".concat(e)),r&&r.lastMessage.lastSequence&&r.lastMessage.onlineOnlyFlag===!1?(o=r.lastMessage.lastSequence,s="".concat(a,", ").concat(o," from conversation.lastMessage.lastSequence"),d.l("".concat(t," ").concat(s)),n.setMessage(s).end(),Promise.resolve(o)):this.getGroupProfileAdvance({groupIDList:[e],responseFilter:{groupBaseInfoFilter:["NextMsgSeq"]}}).then(function(c){return c=c.data.successGroupList,k(c)?d.w("".concat(t," ").concat(a,", empty successGroupList")):(o=c[0].nextMessageSeq-1,s="".concat(a,", ").concat(o," from remote"),d.l("".concat(t," ").concat(s))),n.setMessage(s).end(),o}).catch(function(c){return n.setError(c).setMessage(a).end(),d.w("".concat(t," failed. error:"),c),v(c)})}},{key:"isMessageFromOrToAVChatroom",value:function(e){return this._AVChatRoomHandler.checkJoinedAVChatRoomByID(e)}},{key:"hasJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.hasJoinedAVChatRoom()}},{key:"getJoinedAVChatRoom",value:function(){return this._AVChatRoomHandler.getJoinedAVChatRoom()}},{key:"getGroupRemoteLastSeq",value:function(e){return e=this.getLocalGroupProfile(e),e?e.nextMessageSeq-1:1}},{key:"isOnlineMessage",value:function(e,t){return!(!this._canIUseOnlineOnlyFlag(e)||!t||t.onlineUserOnly!==!0)}},{key:"_canIUseOnlineOnlyFlag",value:function(e){var t=this.getJoinedAVChatRoom();return!t||!t.includes(e.to)||e.conversationType!==g.CONV_GROUP}},{key:"_onAVChatRoomHistoryMessage",value:function(e,t){var n;k(e)||(d.l("".concat(this._n,"._onAVChatRoomHistoryMessage groupID:").concat(t," count:").concat(e.length)),n=[],e.forEach(function(o){n.push(p(p({},o),{},{isHistoryMessage:1}))}),this.onAVChatRoomMessage(n,t))}},{key:"onAVChatRoomMessage",value:function(e){this._AVChatRoomHandler.onMessage(e,1<arguments.length&&arguments[1]!==void 0?arguments[1]:"")}},{key:"onAVChatRoomMemberBanned",value:function(e){this._AVChatRoomHandler.onAVChatRoomMemberBanned(e)}},{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 e===2&&!k(t)}},{key:"isMessageFromCommunityOfTopic",value:function(e,t){return e===2&&k(t)}},{key:"getMessageExtensions",value:function(e,t){return d.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t)),this.req({P:h.GET_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1;return d.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),this.req({P:h.MODIFY_GRP_MSG_EXT,data:{groupID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"_genNotifyReqList",value:function(e){for(var t,n,o,s,a=[],i=0,r=e.length;i<r;i++)t=e[i],s=this.getLocalGroupProfile(t).type,n=this._getGroupLastRevokedTime(t),o=1e3*Qe(),s={notifyType:1,limit:20,type:we({type:s,groupID:t})?g.GRP_COMMUNITY:void 0,groupID:t,beginTime:n,endTime:o},a.push(s);return a}},{key:"getNotice",value:function(o){var t=this,n="".concat(this._n,".getNotice"),o=o.filter(function(s){var a;return!!t.hasLocalGroup(s)&&(a=(s=t.getLocalGroupProfile(s)).type,s=s.isSupportTopic,!be(a))&&!s});o.length!==0&&(d.l("".concat(n," list:").concat(o)),this.req({P:h.GET_GRP_NOTIFY,data:{notifyReqList:this._genNotifyReqList(o)}}).then(function(r){var a,i,r=r.data.notifyRspList,c=[];O(r)&&(a={dataList:[]},i="".concat(n," ok."),r.forEach(function(u){var l=u.nextRevokedTime,_=u.groupID,m=u.notifyList;i+=" groupID:".concat(_," nextRevokedTime:").concat(l," count:").concat(m.length,`
`),a.dataList.push({elements:{revokedInfos:t._genRevokedInfos(u)}}),l!==0?(t._setGroupLastRevokedTime(_,l),c.push(_)):t._setGroupLastRevokedTime(_,1e3*Qe())}),d.l(i),t.onMsgRevoked(a,!1)),0<c.length&&t.getNotice(c)}).catch(function(s){d.e("".concat(n," failed. error:"),s)}))}},{key:"_genRevokedInfos",value:function(e){var t=e.notifyList,n=e.groupID,o=[];return O(t)&&t.forEach(function(s){o.push({groupID:n,sequence:s.sequence,random:s.random,revokerInfo:p({},s.revokerInfo)})}),o}},{key:"_getGroupLastRevokedTime",value:function(e){return this.hasLocalGroup(e)?this.getLocalGroupProfile(e)._lastRevokedTime:0}},{key:"_setGroupLastRevokedTime",value:function(e,t){this.hasLocalGroup(e)&&(this.getLocalGroupProfile(e)._lastRevokedTime=t)}},{key:"isGroupCountersNotice",value:function(e){return this._groupCountersHandler.isGroupCountersNotice(e)}},{key:"setGroupCounters",value:function(e){return this._groupCountersHandler.setGroupCounters(e)}},{key:"increaseGroupCounter",value:function(e){return this._groupCountersHandler.increaseGroupCounter(e)}},{key:"decreaseGroupCounter",value:function(e){return this._groupCountersHandler.decreaseGroupCounter(e)}},{key:"getGroupCounters",value:function(e){return this._groupCountersHandler.getGroupCounters(e)}},{key:"getGroupMemberHandler",value:function(){return this._groupMemberHandler}},{key:"getGroupMemberList",value:function(e){return this._groupMemberHandler.getGroupMemberList(e)}},{key:"getGroupMemberProfile",value:function(e){return this._groupMemberHandler.getGroupMemberProfile(e)}},{key:"addGroupMember",value:function(e){return this._groupMemberHandler.addGroupMember(e)}},{key:"deleteGroupMember",value:function(e){return this._groupMemberHandler.deleteGroupMember(e)}},{key:"setGroupMemberMuteTime",value:function(e){return this._groupMemberHandler.setGroupMemberMuteTime(e)}},{key:"setGroupMemberRole",value:function(e){return this._groupMemberHandler.setGroupMemberRole(e)}},{key:"setGroupMemberNameCard",value:function(e){return this._groupMemberHandler.setGroupMemberNameCard(e)}},{key:"setGroupMemberCustomField",value:function(e){return this._groupMemberHandler.setGroupMemberCustomField(e)}},{key:"markGroupMemberList",value:function(e){return this._groupMemberHandler.markGroupMemberList(e)}},{key:"modifyGroupMemberInfo",value:function(e){return this._groupMemberHandler.modifyGroupMemberInfo(e)}},{key:"restartPolling",value:function(){this._AVChatRoomHandler.restartPolling()}},{key:"getPollingTimerID",value:function(e){var t;return e&&(t=this.getLocalGroupProfile(e))&&be(t.type)?this._AVChatRoomHandler.getPollingTimerID(e):-1}},{key:"_canIUseJoinOption",value:function(e){return e===g.GRP_PUBLIC||we({type:e})}},{key:"_silentlyGetGroupProfile",value:function(e,t){var n=setTimeout(this.getGroupProfile.bind(this,{groupID:t}),3e3);this._timeoutIDs.push(n),d.l("".concat(this._n,"._silentlyGetGroupProfile errorCode:").concat(e," groupID:").concat(t," timeoutIDs:").concat(this._timeoutIDs))}},{key:"_clearTimeoutIDs",value:function(){this._timeoutIDs.forEach(function(e){e&&clearTimeout(e)}),this._timeoutIDs=[]}},{key:"startMessageLongPolling",value:function(s){var t,n=s.groupID,o=s.longPollingKey,s=s.longPollingSequence,s=s===void 0?1:s,a=this.get(12).isUnlimitedAVChatRoom();if(!k(o))return this._AVChatRoomHandler.hasPollingInstance(n)&&this.stopMessageLongPolling({groupID:n}),t=this._AVChatRoomHandler.getJoinedLiveList(),!a&&0<t.length&&this.stopMessageLongPolling({groupID:t[0].groupID}),t=new it({groupID:n,type:g.GRP_LIVE}),d.l("".concat(this._n,".startMessageLongPolling isUnlimited:").concat(a," groupID:").concat(n," longPollingKey:").concat(o," longPollingSequence:").concat(s)),this._getLiveHistoryMessages({groupID:n,longPollingKey:o,startSeq:s}),this._AVChatRoomHandler.startLiveLongPolling({group:t,longPollingKey:o,startSeq:s});console.warn("".concat(this._n,".startMessageLongPolling longPollingKey is empty."))}},{key:"stopMessageLongPolling",value:function(t){var t=t.groupID,n=this.get(11);return this._AVChatRoomHandler.stopLiveLongPolling(t),this._deleteLocalGroup(t),n.deleteLocalConv("".concat(g.CONV_GROUP).concat(t)),d.l("".concat(this._n,".stopMessageLongPolling ok, groupID:").concat(t)),q({groupID:t})}},{key:"_getLiveHistoryMessages",value:function(e){var t=this,n=e.groupID;this.req({P:h.GET_LIVE_HISTORY_MSG,data:e}).then(function(o){o=o.data.messageList,o=o===void 0?[]:o,d.log("".concat(t._n,"._getLiveHistoryMessages ok, groupID:").concat(n," count:").concat(o.length)),0<o.length&&t._onAVChatRoomHistoryMessage(o,n)}).catch(function(o){d.log("".concat(t._n,"._getLiveHistoryMessages failed, groupID:").concat(n," info:"),o)})}},{key:"onPinnedMessageNotify",value:function(e){this._groupPinMessageHandler.onPinnedMessageNotify(e)}},{key:"pinGroupMessage",value:function(e){return this._groupPinMessageHandler.pinGroupMessage(e)}},{key:"getPinnedGroupMessageList",value:function(e){return this._groupPinMessageHandler.getPinnedGroupMessageList(e)}},{key:"reset",value:function(){this.groupMap.clear(),this._unjoinedAVChatRoomList.clear(),this._receiptDetailCompleteMap.clear(),this._onlineMemberCountMap.clear(),this._commonGroupHandler.reset(),this._groupSystemNoticeHandler.reset(),this._groupTipsHandler.reset(),this._groupAttributesHandler.reset(),this._groupCountersHandler.reset(),this._AVChatRoomHandler.reset(),this._groupMemberHandler.reset(),this._clearTimeoutIDs()}}])),Bi=["topicID","topicName","avatar","introduction","notification","unreadCount","muteAllMembers","customData","groupAtInfoList","nextMessageSeq","selfInfo"],Hi=b(function e(t,n){U(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=Ta(t.lastMessage,n),this.selfInfo={muteTime:0,readedSequence:0,messageRemindType:"",excludedUnreadSequenceList:void 0},this._initTopic(t)},[{key:"_initTopic",value:function(e){for(var t in e)Bi.indexOf(t)<0||(t==="selfInfo"?this.updateSelfInfo(e[t]):this[t]=t==="muteAllMembers"?e[t]===1:e[t])}},{key:"updateUnreadCount",value:function(){this.unreadCount=0<arguments.length&&arguments[0]!==void 0?arguments[0]:0}},{key:"updateNextMessageSeq",value:function(e){this.nextMessageSeq=e}},{key:"updateLastMessage",value:function(e){this.lastMessage=Ta(e)}},{key:"updateGroupAtInfoList",value:function(e){this.groupAtInfoList=JSON.parse(JSON.stringify(e))}},{key:"updateTopic",value:function(e){T(e.selfInfo)||this.updateSelfInfo(e.selfInfo),T(e.muteAllMembers)||(this.muteAllMembers=e.muteAllMembers===1),et(this,e,["groupID","lastMessageTime","selfInfo","muteAllMembers","lastMsg"])}},{key:"updateSelfInfo",value:function(e){return et(this.selfInfo,e,[],[""])===0}},{key:"reduceUnreadCount",value:function(){return 1<=this.unreadCount&&(--this.unreadCount,!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}}]),Ki=(de(Wn,ce),b(Wn,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("topic_cache_time"),t=this.getCloudConfig("topic_last_active_time");T(e)||(this.TOPIC_CACHE_TIME=Number(e)),T(t)||(this.TOPIC_LAST_ACTIVE_TIME=Number(t))}},{key:"onTopicCreated",value:function(e){var t=e.groupID;this.resetGetTopicTime(t),this.emitOEvt(F.TOPIC_CREATED,e)}},{key:"onTopicDeleted",value:function(e){var t=this,n=e.groupID,o=e.topicIDList;(o===void 0?[]:o).forEach(function(s){t._deleteLocalTopic(n,s)}),this.emitOEvt(F.TOPIC_DELETED,e)}},{key:"onTopicProfileUpdated",value:function(e){var t=e.groupID,n=e.topicID,n=this.getLocalTopic(t,n);n&&(n.updateTopic(e),this.emitOEvt(F.TOPIC_UPDATED,{groupID:t,topic:n}))}},{key:"onTopicLatestMsg",value:function(s){var t,n,s=s||{},o=s.topicLatestMessage,s=s.excludedUnreadSequenceList;k(o)||(t=o.groupProfile.topicID,o.conversationType=g.CONV_GROUP,o.to=t,(n=new Ce(o)).setElement(o.elements),this.updateUnreadCountAndLastMsg(t,n,s))}},{key:"onMessageRemindTypeUpdated",value:function(s){var t,n=s.groupID,o=s.topicID,s=s.messageRemindType,a=this.getLocalTopic(n,o);a&&((t=a.updateSelfInfo({messageRemindType:s}))&&this.emitOEvt(F.TOPIC_UPDATED,{groupID:n,topic:a}),d.l("".concat(this._n,".onMessageRemindTypeUpdated topicID:").concat(o," messageRemindType:").concat(s," isUpdated:").concat(t)))}},{key:"onAtInfoUpdated",value:function(t){var o=t.topicID,t=t.groupAtInfoList,n=_e(o),o=this.getLocalTopic(n,o);o&&!T(t)&&(o.updateGroupAtInfoList(t),this.emitOEvt(F.TOPIC_UPDATED,{groupID:n,topic:o}))}},{key:"onUnreadCountUpdatedFromConv",value:function(o){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:0,n=_e(o),o=this.getLocalTopic(n,o);o&&o.unreadCount!==t&&(o.updateUnreadCount(t),t===0&&o.updateSelfInfo({readedSequence:o.lastMessage.lastSequence}),this.emitOEvt(F.TOPIC_UPDATED,{groupID:n,topic:o}))}},{key:"onMessageSent",value:function(s){var t,n,o=s.groupID,a=s.topicID,s=s.lastMessage,a=this.getLocalTopic(o,a);a&&(n=(t=(t=s.sequence)===void 0?0:t)+1)>a.nextMessageSeq&&(a.updateNextMessageSeq(n),a.updateLastMessage(s),a.updateSelfInfo({readedSequence:t}),a.updateUnreadCount(0),this.emitOEvt(F.TOPIC_UPDATED,{groupID:o,topic:a}))}},{key:"onMessageModified",value:function(e){var t,n=e.to,o=e.time,s=e.sequence,a=e.elements,i=e.cloudCustomData,r=e.messageVersion,c=_e(n),u=this.getLocalTopic(c,n);u&&(t=u.lastMessage,d.d("".concat(this._n,".onMessageModified topicID:").concat(n," lastMessage:"),JSON.stringify(t),"options:",JSON.stringify(e)),t)&&(t.payload===null||t.lastTime===o&&t.lastSequence===s&&t.version!==r)&&(t.type=a[0].type,t.payload=a[0].content,t.messageForShow=on(t.type,t.payload,this.isIntl()),t.cloudCustomData=i,t.version=r,t.lastSequence=s,t.lastTime=o,this.emitOEvt(F.TOPIC_UPDATED,{groupID:c,topic:u}))}},{key:"onMessageRevoked",value:function(e){var t,n,o,s=this;e.length!==0&&(n=t=null,o=!1,e.forEach(function(a){var i=a.to;n=_e(i),(t=s.getLocalTopic(n,i))&&(t.reduceUnreadCount()&&(o=!0),t.isLastMessageRevoked(a)&&(t.setLastMessageRevoked(!0),t.setLastMessageRevoker(a.revoker),o=!0),(i=t.selfInfo.excludedUnreadSequenceList||[]).push(a.sequence),t.updateSelfInfo({excludedUnreadSequenceList:i}))}),o)&&this.emitOEvt(F.TOPIC_UPDATED,{groupID:n,topic:t})}},{key:"isLastMessageRevoked",value:function(t){var o=t.topicID,t=t.sequence,n=_e(o),n=this.getLocalTopic(n,o),o=!1;return o=n?n.isLastMessageRevoked({sequence:t}):o}},{key:"updateUnreadCountAndLastMsg",value:function(e,t,n){var o,s=_e(e),a=this.getLocalTopic(s,e);a&&(o=a.selfInfo.excludedUnreadSequenceList||[],T(n)||(o=n),t._isExcludedFromUnreadCount&&o.push(t.sequence),a.updateSelfInfo({excludedUnreadSequenceList:o}),d.l("".concat(this._n,".updateUnreadCountAndLastMsg seq:").concat(t.sequence," lastSeq:").concat(a.lastMessage.lastSequence)),t.sequence>a.lastMessage.lastSequence)&&(a.updateLastMessage(t),n=t.sequence+1,a.updateNextMessageSeq(n),o=this._computeUnreadCount(a),a.updateUnreadCount(o),(t=this.get(11).getLocalConversation("".concat(g.CONV_GROUP).concat(e)))&&t.updateUnreadCount({nextUnreadCount:o,isFromGetConversations:!0}),this.emitOEvt(F.TOPIC_UPDATED,{groupID:s,topic:a}))}},{key:"getJoinedCommunityList",value:function(){return this.get(7).syncCommunityWithTopic()}},{key:"createTopicInCommunity",value:function(e){var t,n=this,o="".concat(this._n,".").concat("createTopicInCommunity"),s=e.topicID;return T(s)||he(s)?e.topicName&&this._filterProfanity("topicName",e)===!1||e.introduction&&this._filterProfanity("introduction",e)===!1||e.notification&&this._filterProfanity("notification",e)===!1?v({code:y.PROFANITY_FOUND}):(t=new D("createTopicInCommunity"),this.req({P:h.CREATE_TOPIC,data:p({},e)}).then(function(a){return a=a.data.topicID,t.setMessage("topicID:".concat(a)).end(),d.l("".concat(o," ok. topicID:").concat(a)),n._updateTopicMap([p(p({},e),{},{topicID:a})]),N({topicID:a})}).catch(function(a){return t.setError(a).end(),d.e("".concat(o," failed. error:"),a),v(a)})):v({code:y.ILLEGAL_TOPIC_ID})}},{key:"deleteTopicFromCommunity",value:function(s){var t=this,n="".concat(this._n,".").concat("deleteTopicFromCommunity"),o=s.groupID,s=s.topicIDList,s=s===void 0?[]:s,a=new D("deleteTopicFromCommunity");return a.setMessage("groupID:".concat(o," topicIDList:").concat(s)),this.req({P:h.DEL_TOPIC,data:{groupID:o,topicIDList:s}}).then(function(u){var u=u.data.resultList,r=[],c=[],u=((u===void 0?[]:u).forEach(function(f){var _=f.topicID,m=f.errorCode,f=f.errorInfo;m===0?r.push({topicID:_}):c.push({topicID:_,code:m,message:f})}),"success count:".concat(r.length,", fail count:").concat(c.length));return a.setMoreMessage(u).end(),d.l("".concat(n," ok. ").concat(u)),r.forEach(function(l){t._deleteLocalTopic(o,l.topicID)}),N({successTopicList:r,failureTopicList:c})}).catch(function(i){return a.setError(i).end(),d.e("".concat(n," failed. error:"),i),v(i)})}},{key:"updateTopicProfile",value:function(e){var t,n=this,o="".concat(this._n,".").concat("updateTopicProfile");return d.l("".concat(o," options:"),e),e.topicName&&this._filterProfanity("topicName",e)===!1||e.introduction&&this._filterProfanity("introduction",e)===!1||e.notification&&this._filterProfanity("notification",e)===!1?v({code:y.PROFANITY_FOUND}):((t=new D("updateTopicProfile")).setMessage("groupID:".concat(e.groupID," topicID:").concat(e.topicID)),T(e.muteAllMembers)||(e.muteAllMembers=e.muteAllMembers===!0?"On":"Off"),this.req({P:h.UPDATE_TOPIC_PROFILE,data:p({},e)}).then(function(){return t.end(),d.l("".concat(o," ok")),n._updateTopicMap([e]),N({topic:n.getLocalTopic(e.groupID,e.topicID)})}).catch(function(s){return t.setError(s).end(),d.e("".concat(o," failed. error:"),s),v(s)}))}},{key:"getTopicList",value:function(s){var t=this,n="".concat(this._n,".").concat("getTopicList"),o=s.groupID,s=s.topicIDList,s=s===void 0?[]:s,a=s.length===0,i=new D("getTopicList");if(i.setMessage("groupID:".concat(o)),this._getTopicTimeMap.has(o)){var c=this._getTopicTimeMap.get(o),r=c.isGetAll,c=c.time;if((r||!r&&!a)&&Date.now()-c<1e3*this.TOPIC_CACHE_TIME&&(r=this._getLocalTopicList(o,s),a||r.length===s.length))return i.setMoreMessage("from cache, topic count:".concat(r.length)).end(),d.l("".concat(n," groupID:").concat(o," from cache, topic count:").concat(r.length)),q({successTopicList:r,failureTopicList:[]})}return this.req({P:h.GET_TOPIC_LIST,data:{groupID:o,topicIDList:s}}).then(function(f){var f=f.data.topicInfoList,l=[],_=[],m=[],f=((f===void 0?[]:f).forEach(function(L){var C=L.topic,M=L.selfInfo,S=L.errorCode,L=L.errorInfo,P=C.topicID;S===0?(l.push(p(p({},C),{},{selfInfo:M})),_.push(P)):m.push({topicID:P,code:S,message:L})}),t._updateTopicMap(l),t._handleTopicAtInfo(l),"success count:".concat(_.length,", fail count:").concat(m.length)),f=(i.setMoreMessage(f).end(),d.l("".concat(n," groupID:").concat(o," from remote, ").concat(f)),[]);return k(_)||(t._getTopicTimeMap.set(o,{time:Date.now(),isGetAll:a}),f=t._getLocalTopicList(o,_)),N({successTopicList:f,failureTopicList:m})}).catch(function(u){return i.setError(u).end(),d.e("".concat(n," failed. error:"),u),v(u)})}},{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 n=this._topicMap.has(e)?this._topicMap.get(e).get(t):n}},{key:"_getLocalTopicList",value:function(n){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:[],n=this._topicMap.get(n),o=[];return n&&(o=G(n.values())),t.length===0?o:o.filter(function(s){return t.includes(s.topicID)})}},{key:"_deleteLocalTopic",value:function(e,t){this._topicMap.has(e)&&this._topicMap.get(e).has(t)&&(this._topicMap.get(e).delete(t),d.l("".concat(this._n,"._deleteLocalTopic groupID:").concat(e," topicID:").concat(t)))}},{key:"_updateTopicMap",value:function(e){var t=this,n=[];e.forEach(function(r){var s=r.groupID,a=r.topicID,i=null,r=(t._topicMap.has(s)||t._topicMap.set(s,new Map),t._topicMap.get(s).has(a)?(i=t._topicMap.get(s).get(a)).updateTopic(r):(t._getTopicLastMessage(r),i=new Hi(r,t.isIntl()),t._topicMap.get(s).set(a,i)),t._computeUnreadCount(i));i.updateUnreadCount(r),n.push({conversationID:"".concat(g.CONV_GROUP).concat(a),type:g.CONV_TOPIC,unreadCount:r})}),0<n.length&&this.get(11).updateTopicConversation(n)}},{key:"resetGetTopicTime",value:function(e){var t=this;T(e)?G(this._getTopicTimeMap.keys()).forEach(function(n){t._getTopicTimeMap.set(n,0)}):this._getTopicTimeMap.set(e,0)}},{key:"getTopicListOnReconnected",value:function(){var e=this,t=G(this._topicMap.keys()),n=[],o=this.get(11);t.forEach(function(s){var a=[],i=e._getLocalTopicList(s);o.deleteTopicRoamingInfo(s),i.forEach(function(r){var c=r.lastMessage.lastTime,c=c===void 0?0:c;Date.now()-1e3*c<1e3*e.TOPIC_LAST_ACTIVE_TIME&&a.push(r.topicID)}),0<a.length&&n.push({groupID:s,topicIDList:a})}),d.l("".concat(this._n,".getTopicListOnReconnected. active community count:").concat(n.length)),this._relayGetTopicList(n)}},{key:"_relayGetTopicList",value:function(e){var t,n,o,s=this;e.length!==0&&(n=5<(t=e.shift()).topicIDList.length?"topicIDList.length:".concat(t.topicIDList.length):"topicIDList:".concat(t.topicIDList),(o=new D("relayGetTopicList")).setMessage(n),d.l("".concat(this._n,"._relayGetTopicList. ").concat(n)),this.getTopicList(t).then(function(){o.end(),s._relayGetTopicList(e)}).catch(function(a){o.setError(a).end(),s._relayGetTopicList(e)}))}},{key:"_handleTopicAtInfo",value:function(e){var t=this;e.length!==0&&e.forEach(function(a){var o=a.groupID,s=a.topicID,a=a.groupAtInfoList,i=[];T(a)||(a.forEach(function(r){i.push(p(p({},r),{},{groupID:o,topicID:s}))}),t.get(11).onNewGroupAtTips({dataList:i}))})}},{key:"_getTopicLastMessage",value:function(e){var t;T(e.lastMsg)||(t={time:e.lastMsg.time,sequence:e.lastMsg.sequence,from:e.lastMsg.from,payload:e.lastMsg.elements[0]?e.lastMsg.elements[0].content:null,type:e.lastMsg.elements[0]?e.lastMsg.elements[0].type:"",nick:e.lastMsg.nick,avatar:e.lastMsg.avatar,version:e.lastMsg.messageVersion,cloudCustomData:e.lastMsg.cloudCustomData,isRevoked:e.lastMsg.isPlaceMessage===2,revoker:k(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.get(11);n.forEach(function(s){s=s.topicID,t._deleteLocalTopic(e,s),t._getTopicTimeMap.delete(e),o.deleteLocalConv("".concat(g.CONV_GROUP).concat(s))})}},{key:"_computeUnreadCount",value:function(e){var t,s=e.selfInfo,n=s.excludedUnreadSequenceList,o=s.readedSequence,s=e.nextMessageSeq-e.selfInfo.readedSequence-1;return O(n)&&(t=0,n.forEach(function(a){o<a&&a<=e.nextMessageSeq-1&&(t+=1)}),1<=t)&&(s-=t),s<0?0:s}},{key:"_filterProfanity",value:function(e,t){var n,o=this.get(29);return!o||(n=(o=o.filterText(t[e],Ts)).isAllowedToSend,o=o.modifiedText,n===!0&&(t[e]=o,!0))}},{key:"getMessageExtensions",value:function(e,t){d.l("".concat(this._n,".getMessageExtensions startSequence:").concat(t));var n=_e(e.to);return this.req({P:h.GET_GRP_MSG_EXT,data:{groupID:n,topicID:e.to,messageSequence:e.sequence,startSequence:t}})}},{key:"modifyMsgExts",value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1,o=(d.l("".concat(this._n,".modifyMsgExts operateType:").concat(n)),_e(e.to));return this.req({P:h.MODIFY_GRP_MSG_EXT,data:{groupID:o,topicID:e.to,messageSequence:e.sequence,extensionList:t,operateType:n}})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._topicMap.clear(),this._getTopicTimeMap.clear(),this.TOPIC_CACHE_TIME=300,this.TOPIC_LAST_ACTIVE_TIME=3600}}])),Yi=b(function e(t){U(this,e),this._userM=t,this._n="ProfileHandler",this.TAG="profile",this.MAX_USER_COUNT=1e3,this.CHUNK_SIZE=100,this.accountProfileMap=new Map,this.expirationTime=864e5,this.strangerProfileMap=new Map,this.strangerProfileExpirationTime=600,this._userM.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this._userM.getCloudConfig("stranger_profile_expiration_time");d.l("".concat(this._n,"._onCloudConfig profileExpirationTime:").concat(e)),T(e)||(this.strangerProfileExpirationTime=parseInt(e,10))}},{key:"getUserProfile",value:function(e){for(var t=this,n="".concat(this._n,".").concat("getUserProfile"),s=e.userIDList,o=s===void 0?[]:s,s=e.bFromGetMyProfile,a=s!==void 0&&s,i=[],r=[],c=0,u=o.length;c<u;c++){var l,_=o[c];this._contains(_)?(l=this._getProfileFromMap(_),r.push(l)):this._isStrangerProfileExpired(_)?i.push(_):(l=this.strangerProfileMap.get(_),r.push(l))}if(i.length===0)return d.l("".concat(n," from cache, total:").concat(r.length)),q(r);i.length>this.MAX_USER_COUNT&&(d.w("".concat(n," ").concat(St(this.MAX_USER_COUNT))),i.length=this.MAX_USER_COUNT);var m=[],f=this._userM.getMyAccount(),I=(this._chunkUserIDList(i,this.CHUNK_SIZE).forEach(function(S){m.push(t._getUserProfile(p(p({},e),{},{userIDList:S,fromAccount:f})))}),i.length),C=new D("getUserProfile"),M=(C.setMessage(5<I?"count:".concat(I):"userIDList:".concat(i)),Date.now());return Promise.allSettled(m).then(function(){var S=[],L=0,P={},w=((0<arguments.length&&arguments[0]!==void 0?arguments[0]:[]).forEach(function(x){var j;x.status==="fulfilled"&&O(x.value)&&(L+=x.value.length,S.push.apply(S,G(x.value))),x.status==="rejected"&&(j=(x=x.reason||{}).code,x=x.message,P.code=j,P.message=x)}),I-L),B="query:".concat(I," success:").concat(L," fail:").concat(w," from cache:").concat(r.length);return r.length!==0||I!==w||k(P)?(S.push.apply(S,r),C.setMoreMessage("".concat(B," total:").concat(S.length)).end(),d.l("".concat(n," ").concat(B," total:").concat(S.length," cost:").concat(ye(M))),N(a?S[0]:S)):(C.setMoreMessage("".concat(B," error:").concat(JSON.stringify(P))).end(),d.e("".concat(n," ").concat(B," error:").concat(JSON.stringify(P)," cost:").concat(ye(M))),v(P))})}},{key:"_isStrangerProfileExpired",value:function(e){return!!this._userM.isMyFriend(e)||(e=(e=(this.strangerProfileMap.get(e)||{}).lastUpdatedTime)===void 0?0:e,Date.now()-e>1e3*this.strangerProfileExpirationTime)}},{key:"_getUserProfile",value:function(e){var t=this,n="".concat(this._n,".").concat("_getUserProfile"),o=e.userIDList,s=[];return o.forEach(function(a){s.push({toAccount:a,standardSequence:0,customSequence:0})}),e.userItem=s,this._userM.req({P:h.GET_USER_PROFILE,data:e}).then(function(a){return t._handleResponse(a)}).catch(function(a){return d.e("".concat(n," failed. error:"),a),v(a)})}},{key:"getMyProfile",value:function(){var e,t=this._userM.getMyAccount(),n="".concat(this._n,".getMyProfile");return d.l("".concat(n," myAccount:").concat(t)),this._fill(),this._contains(t)?(e=this._getProfileFromMap(t),d.d("".concat(n," from cache, myProfile:").concat(JSON.stringify(e))),q(e)):this.getUserProfile({fromAccount:t,userIDList:[t],bFromGetMyProfile:!0})}},{key:"_handleResponse",value:function(e){var t=e.data.userProfileItem;if(!O(t))return[];for(var n=[],e=Date.now(),o=0,s=t.length;o<s;o++){var i=t[o],a=i.to,i=i.profileItem;a!=="@TLS#NOT_FOUND"&&a!==""&&(a=this._update(a,this._getLatestProfileFromResponse(a,i)).latestProfile,n.push(a))}return d.l("".concat(this._n,"._handleResponse cost:").concat(ye(e))),n}},{key:"_getLatestProfileFromResponse",value:function(e,t){var n={userID:e,profileCustomField:[]};if(!k(t))for(var o=0,s=t.length;o<s;o++)if(-1<t[o].tag.indexOf("Tag_Profile_Custom"))n.profileCustomField.push({key:t[o].tag,value:t[o].value});else switch(t[o].tag){case H.NICK:n.nick=t[o].value;break;case H.GENDER:n.gender=t[o].value;break;case H.BIRTHDAY:n.birthday=t[o].value;break;case H.LOCATION:n.location=t[o].value;break;case H.SELFSIGNATURE:n.selfSignature=t[o].value;break;case H.ALLOWTYPE:n.allowType=t[o].value;break;case H.LANGUAGE:n.language=t[o].value;break;case H.AVATAR:n.avatar=t[o].value;break;case H.MESSAGESETTINGS:n.messageSettings=t[o].value;break;case H.ADMINFORBIDTYPE:n.adminForbidType=t[o].value;break;case H.LEVEL:n.level=t[o].value;break;case H.ROLE:n.role=t[o].value;break;default:d.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&&this._userM.filterProfanity("nick",e)===!1)return v({code:y.PROFANITY_FOUND});if(e.selfSignature&&this._userM.filterProfanity("selfSignature",e)===!1)return v({code:y.PROFANITY_FOUND});var o=new D("updateMyProfile"),s=(o.setMessage(JSON.stringify(e)),new jt().validate(e));if(!s.valid)return o.setCode(y.UPDATE_PROFILE_INVALID_PARAM).setMoreMessage("info:".concat(s.tips)).end(),d.e("".concat(n," info:").concat(s.tips)),v({code:y.UPDATE_PROFILE_INVALID_PARAM});var a,i,r=[];for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(a==="profileCustomField"?e.profileCustomField.forEach(function(c){r.push({tag:c.key,value:c.value})}):r.push({tag:H[a.toUpperCase()],value:e[a]}));return r.length===0?(s=new ie({code:y.UPDATE_PROFILE_NO_KEY}),o.setError(s).end(),d.e("".concat(n," failed. error:"),s),v(s)):(i=this._userM.getMyAccount(),this._userM.req({P:h.UPDATE_MY_PROFILE,data:{fromAccount:i,profileItem:r}}).then(function(c){o.end(),d.i("".concat(n," ok"));var l=t._update(i,e),u=l.isProfileUpdated,l=l.latestProfile;return u===!0&&t._userM.emitOEvt(F.PROFILE_UPDATED,[l]),q(l)}).catch(function(c){return o.setError(c).end(),d.e("".concat(n," failed. error:"),c),v(c)}))}},{key:"onProfileModified",value:function(e){var t=e.dataList;if(!k(t)){var n=t.length;d.d("".concat(this._n,".onProfileModified count:").concat(n," dataList:"),e.dataList);for(var o=[],s=0;s<n;s++){var i=t[s].userID,i=this._update(i,this._getLatestProfileFromResponse(i,t[s].profileList)),a=i.isProfileUpdated,i=i.latestProfile;a===!0&&o.push(i)}0<o.length&&(this._userM.emitIEvt(ne.PROFILE_UPDATED,o),this._userM.emitOEvt(F.PROFILE_UPDATED,o))}}},{key:"_fill",value:function(){if(this.accountProfileMap.size===0){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,new jt(e[n]));d.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();return this._contains(e)?(n=this._getProfileFromMap(e),t.profileCustomField&&tn(n.profileCustomField,t.profileCustomField)===!0&&(n.lastUpdatedTime=s,o=!0),0<et(n,t,["profileCustomField"])&&(n.lastUpdatedTime=s,o=!0)):((n=new jt(t)).lastUpdatedTime=s,(this._userM.isMyFriend(e)||e===this._userM.getMyAccount()?(o=!0,this.accountProfileMap):this.strangerProfileMap).set(e,n)),this._flush(e===this._userM.getMyAccount()),{isProfileUpdated:o,latestProfile:n}}},{key:"_flush",value:function(e){var t=G(this.accountProfileMap.values()),n=this._userM.getStorageModule();d.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._userM.getStorageModule().getItem(this.TAG);return k(e)?[]:e}},{key:"onConvProfileUpdated",value:function(e){for(var t,n,o,s=[],a=0,i=e.length;a<i;a++)n=(t=e[a]).userID,this._userM.isMyFriend(n)&&(this._contains(n)?(o=this._getProfileFromMap(n),0<et(o,t)&&s.push(n)):s.push(t.userID));s.length!==0&&(d.l("".concat(this._n,".onConvProfileUpdated toAccountList:").concat(s)),this.getUserProfile({userIDList:s}))}},{key:"getNickAndAvatarByUserID",value:function(e){return this._contains(e)?{nick:(e=this._getProfileFromMap(e)).nick,avatar:e.avatar}:{nick:"",avatar:""}}},{key:"getUserNickAndAvatar",value:function(e){var t,n=this,o=G(new Set(e)),s=(d.l("".concat(this._n,".getUserNickAndAvatar userIDList.length:").concat(e.length," uniqueUserIDList.length:").concat(o.length)),[]);return e.length===0?Promise.resolve(s):(e=this._chunkUserIDList(o,this.CHUNK_SIZE),t=[],e.forEach(function(a){t.push(n.getUserProfile({userIDList:a}))}),Promise.all(t).then(function(a){return a.forEach(function(i){i=i.data.map(function(r){return{userID:r.userID,nick:r.nick,avatar:r.avatar}}),s.push.apply(s,G(i))}),s}))}},{key:"_chunkUserIDList",value:function(e,t){return Array.from({length:Math.ceil(e.length/t)},function(n,o){return e.slice(o*t,(o+1)*t)})}},{key:"getMyLocalProfile",value:function(){var e=this._userM.getMyAccount();return this._contains(e)?this._getProfileFromMap(e):{}}},{key:"reset",value:function(){this._flush(!0),this.accountProfileMap.clear(),this.strangerProfileMap.clear(),this.strangerProfileExpirationTime=600}}]),La=b(function e(t){U(this,e)}),Wi=b(function e(t){U(this,e),this._userM=t,this._n="BlacklistHandler",this._blacklistMap=new Map,this._startIndex=0},[{key:"getLocalBlacklist",value:function(){return G(this._blacklistMap.keys())}},{key:"getBlacklist",value:function(){var e=this,t="".concat(this._n,".getBlacklist"),n={fromAccount:this._userM.getMyAccount(),maxLimited:1e3,startIndex:this._startIndex},o=new D("getBlacklist");return this._userM.req({P:h.GET_BL,data:n}).then(function(i){var i=i.data,a=i.blackListItem,i=i.startIndex,r=k(a)?0:a.length;o.setMessage("count:".concat(r)).end(),d.i("".concat(t," ok")),e._startIndex=i,e._handleResponse(a,!0),e._userM.emitOEvt(F.BLACKLIST_UPDATED,G(e._blacklistMap.keys())),e._startIndex!==0&&e.getBlacklist()}).catch(function(s){return o.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})}},{key:"addBlacklist",value:function(e){var t,n,o=this,s=new D("addToBlacklist"),a="".concat(this._n,".addBlacklist"),i=this._userM.getMyAccount();return e.userIDList.length===1&&e.userIDList[0]===i?(n=this._userM.getErrMsg(t=y.CANNOT_ADD_SELF_TO_BLACKLIST),s.setCode(t).setMessage(n).end(),n=new ie({code:t}),d.e("".concat(a," failed. error:"),n),v(n)):(e.userIDList.includes(i)&&(e.userIDList=e.userIDList.filter(function(r){return r!==i})),e.fromAccount=this._userM.getMyAccount(),e.toAccount=e.userIDList,this._userM.req({P:h.ADD_TO_BL,data:e}).then(function(r){return s.setMessage(5<e.userIDList.length?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),d.i("".concat(a," ok")),o._handleResponse(r.resultItem,!0),N(G(o._blacklistMap.keys()))}).catch(function(r){return s.setError(r).end(),d.e("".concat(a," failed. error:"),r),v(r)}))}},{key:"_handleResponse",value:function(e,t){if(!k(e))for(var n,o,s,a=0,i=e.length;a<i;a++)o=e[a].to,s=e[a].resultCode,!T(s)&&s!==0||(t?((n=this._blacklistMap.has(o)?this._blacklistMap.get(o):new La).userID=o,k(e[a].addBlackTimeStamp)||(n.timeStamp=e[a].addBlackTimeStamp),this._blacklistMap.set(o,n)):this._blacklistMap.has(o)&&(n=this._blacklistMap.get(o),this._blacklistMap.delete(o)));d.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 D("removeFromBlacklist");return e.fromAccount=this._userM.getMyAccount(),e.toAccount=e.userIDList,this._userM.req({P:h.RM_FROM_BL,data:e}).then(function(s){return o.setMessage(5<e.userIDList.length?"userIDList.length:".concat(e.userIDList.length):"userIDList:".concat(e.userIDList)).end(),d.i("".concat(n," ok")),t._handleResponse(s.data.resultItem,!1),N(G(t._blacklistMap.keys()))}).catch(function(s){return o.setError(s).end(),d.e("".concat(n," failed. error:"),s),v(s)})}},{key:"onAccountDeleted",value:function(e){for(var t=0,n=e.length;t<n;t++){var o=e[t];this._blacklistMap.has(o)&&this._blacklistMap.delete(o)}var s=e.length;0<s&&(d.l("".concat(this._n,".onAccountDeleted count:").concat(s," ").concat(s<30?"userIDList:".concat(e):"")),this._userM.emitOEvt(F.BLACKLIST_UPDATED,G(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 La({userID:t})),n.push(t));0<n.length&&(d.l("".concat(this._n,".onAccountAdded count:").concat(n.length," userIDList:"),n),this._userM.emitOEvt(F.BLACKLIST_UPDATED,G(this._blacklistMap.keys())))}},{key:"reset",value:function(){this._blacklistMap.clear(),this._startIndex=0}}]),ji=b(function e(t){U(this,e),this._userM=t,this._n="UserStatusHandler",this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100,this._userM.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this._userM.getCloudConfig("status_query_count"),t=this._userM.getCloudConfig("status_sub_count"),n=this._userM.getCloudConfig("status_unsub_count");d.l("".concat(this._n,"._onCloudConfig statusQueryCount:").concat(e," statusSubscribeCount:").concat(t)+" statusUnsubscribeCount:".concat(n)),T(e)||(this.MAX_QUERY_USER_COUNT=parseInt(e,10)),T(e)||(this.MAX_SUBSCRIBE_USER_COUNT=parseInt(t,10)),T(e)||(this.MAX_UNSUBSCRIBE_USER_COUNT=parseInt(n,10))}},{key:"onUserStatusUpdated",value:function(o){var o=o.dataList,t=this._userM.getMyUserID(),n=this._userM.get(12),o=o.map(function(r){var a=r.to,i=r.statusType,r=r.customStatus,r=Hn(r);return a===t&&n.setCustomStatus(r),{userID:a,statusType:i,customStatus:r}});d.l("".concat(this._n,".onUserStatusUpdated list:").concat(JSON.stringify(o))),this._userM.emitOEvt(F.USER_STATUS_UPDATED,o)}},{key:"setSelfStatus",value:function(e){var t,n,o=this,s="".concat(this._n,".setSelfStatus");return this._userM.filterProfanity("customStatus",e)===!1?v({code:y.PROFANITY_FOUND}):(t=new D("setSelfStatus"),n=e.customStatus,this._userM.req({P:h.SET_SELF_STATUS,data:{customStatus:n}}).then(function(a){return t.setMessage("customStatus:".concat(n)).end(),d.l("".concat(s," ok. customStatus:").concat(n)),o._userM.get(12).setCustomStatus(n),N({userID:o._userM.getMyUserID(),statusType:1,customStatus:n})}).catch(function(a){return t.setError(a).end(),d.e("".concat(s," failed. error:"),a),v(a)}))}},{key:"getUserStatus",value:function(o){var t="".concat(this._n,".").concat("getUserStatus"),o=o.userIDList,n=o===void 0?[]:o,o=this._userM.getMyUserID(),s=G(n),a=void 0,i=s.indexOf(o);if(-1<i&&(s.splice(i,1),a={userID:o,statusType:1,customStatus:this._userM.get(12).getCustomStatus()}),s.length===0)return q({successUserList:[a],failureUserList:[]});if(!this._userM.canIUse(ee.USER_STATUS))return this._userM.noUse("getUserStatus");s.length>this.MAX_QUERY_USER_COUNT&&(d.w("".concat(t," ").concat(St(this.MAX_QUERY_USER_COUNT))),s=n.slice(0,this.MAX_QUERY_USER_COUNT));var r=new D("getUserStatus");return this._userM.req({P:h.GET_USER_STATUS,data:{userIDList:s}}).then(function(l){var l=l.data,u=l.successUserList,u=u===void 0?[]:u,l=l.failureUserList,l=l===void 0?[]:l,u=u.map(function(C){var f=C.userID,I=C.statusType,C=C.customStatus;return{userID:f,statusType:I,customStatus:Hn(C)}}),l=l.map(function(M){var f=M.userID,I=M.invalidUserID,C=M.errorCode,M=M.errorInfo;return{userID:k(I)?f:I,code:C,message:M}}),_=(T(a)||u.unshift(a),"userID count:".concat(n.length,", success count:").concat(u.length,", fail count:").concat(l.length));return r.setMessage("".concat(_)).end(),d.l("".concat(t," ok. ").concat(_,".")),N({successUserList:u,failureUserList:l})}).catch(function(c){return r.setMessage("userID count:".concat(n.length)).setError(c).end(),d.e("".concat(t," failed. error:"),c),v(c)})}},{key:"subscribeUserStatus",value:function(e){var t,n,o,s,a="subscribeUserStatus";return this._userM.canIUse(ee.USER_STATUS)?(t="".concat(this._n,".").concat(a),(n=G(e=(e=e.userIDList)===void 0?[]:e)).length>this.MAX_SUBSCRIBE_USER_COUNT&&(d.w("".concat(t," ").concat(St(this.MAX_SUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_SUBSCRIBE_USER_COUNT)),o=new D(a),s="userID count:".concat(e.length),d.l("".concat(t," ").concat(s)),this._userM.req({P:h.SUB_USER_STATUS,data:{userIDList:n}}).then(function(i){return i=i.data.failureUserList,i=(i===void 0?[]:i).map(function(_){var c=_.userID,u=_.invalidUserID,l=_.errorCode,_=_.errorInfo;return{userID:k(u)?c:u,code:l,message:_}}),o.setMessage("".concat(s," fail count:").concat(i.length)).end(),d.l("".concat(t," ok. fail count:").concat(i.length,".")),N({failureUserList:i})}).catch(function(i){return o.setMessage(s).setError(i).end(),d.e("".concat(t," failed. error:"),i),v(i)})):this._userM.noUse(a)}},{key:"unsubscribeUserStatus",value:function(e){var t,n,o,s,a="unsubscribeUserStatus";return this._userM.canIUse(ee.USER_STATUS)?(t="".concat(this._n,".").concat(a),n=G(e=(e=(e||{}).userIDList)===void 0?[]:e),e.length>this.MAX_UNSUBSCRIBE_USER_COUNT&&(d.w("".concat(t," ").concat(St(this.MAX_UNSUBSCRIBE_USER_COUNT))),n=e.slice(0,this.MAX_UNSUBSCRIBE_USER_COUNT)),o=new D(a),s="userID count:".concat(e.length),d.l("".concat(t," ").concat(s)),e={userIDList:n},n.length===0&&(e.userIDList=void 0,e.unsubscribeAll=1),this._userM.req({P:h.UNSUB_USER_STATUS,data:e}).then(function(i){return i=i.data.failureUserList,i=(i===void 0?[]:i).map(function(_){var c=_.userID,u=_.invalidUserID,l=_.errorCode,_=_.errorInfo;return{userID:k(u)?c:u,code:l,message:_}}),o.setMessage("".concat(s," fail count:").concat(i.length)).end(),d.l("".concat(t," ok. fail count:").concat(i.length,".")),N({failureUserList:i})}).catch(function(i){return o.setMessage("".concat(s)).setError(i).end(),d.e("".concat(t," failed. error:"),i),v(i)})):this._userM.noUse(a)}},{key:"reset",value:function(){this.MAX_QUERY_USER_COUNT=500,this.MAX_SUBSCRIBE_USER_COUNT=100,this.MAX_UNSUBSCRIBE_USER_COUNT=100}}]),Ji=(de(Yn,ce),b(Yn,[{key:"onContextUpdated",value:function(e){this._profileHandler.getMyProfile(),this._blacklistHandler.getBlacklist()}},{key:"mockOnNickAvatarModified",value:function(e,t){d.l("".concat(this._n,"._mockOnNickAvatarModified nick:").concat(e," avatar:").concat(t)),this.onProfileModified({dataList:[{pushType:1,userID:this.getMyUserID(),profileList:[{tag:H.NICK,value:e},{tag:H.AVATAR,value:t}]}]})}},{key:"onProfileModified",value:function(e){this._profileHandler.onProfileModified(e)}},{key:"onRelationChainModified",value:function(o){var t,n,o=o.dataList;k(o)||(t=[],o.forEach(function(s){s.blackListDelAccount&&t.push.apply(t,G(s.blackListDelAccount))}),0<t.length&&this._blacklistHandler.onAccountDeleted(t),n=[],o.forEach(function(s){s.blackListAddAccount&&n.push.apply(n,G(s.blackListAddAccount))}),0<n.length&&this._blacklistHandler.onAccountAdded(n))}},{key:"onConvProfileUpdated",value:function(e){this._profileHandler.onConvProfileUpdated(e)}},{key:"getMyAccount",value:function(){return this.getMyUserID()}},{key:"getMyNick",value:function(){return this._profileHandler.getNickAndAvatarByUserID(this.getMyUserID()).nick}},{key:"getMyLevel",value:function(){return this._profileHandler.getMyLocalProfile().level||0}},{key:"getMyProfile",value:function(){return this._profileHandler.getMyProfile()}},{key:"getStorageModule",value:function(){return this.get(13)}},{key:"filterProfanity",value:function(e,t){var n,o=this.get(29);return!o||(n=(o=o.filterText(t[e],"user_profile")).isAllowedToSend,o=o.modifiedText,n===!0&&(t[e]=o,!0))}},{key:"isMyFriend",value:function(e){var t=this.get(8);return!!t&&t.isMyFriend(e)}},{key:"getUserProfile",value:function(e){return this._profileHandler.getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._profileHandler.updateMyProfile(e)}},{key:"getNickAndAvatarByUserID",value:function(e){return this._profileHandler.getNickAndAvatarByUserID(e)}},{key:"getUserNickAndAvatar",value:function(e){return this._profileHandler.getUserNickAndAvatar(e)}},{key:"getLocalBlacklist",value:function(){var e=this._blacklistHandler.getLocalBlacklist();return q(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(){d.l("".concat(this._n,".reset")),this._profileHandler.reset(),this._blacklistHandler.reset(),this._userStatusHandler.reset()}}])),zi=b(function e(t,n){U(this,e),this._m=t,this._isLoggedIn=!1,this._SDKAppID=n.SDKAppID,this._userID=n.userID||"",this._userSig=n.userSig||"",this._version="3.6.6",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._isTestEnv=n.testEnv,this._proxyServer=n.proxyServer,this._fileUploadProxy=n.fileUploadProxy,this._fileDownloadProxy=n.fileDownloadProxy,this._applicationID=0,this._isPartialUpdatedConvs=n.partialUpdatedConversations,this._isIndependentDomainDisabled=n.disableIndependentDomain,this._isUsingChatCore=!1,this._uiPlatform=0,this._authKey="",this._customLoginInfo=""},[{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:"isTestEnv",value:function(){return this._isTestEnv}},{key:"isPartialUpdatedConvs",value:function(){return this._isPartialUpdatedConvs}},{key:"isIndependentDomainDisabled",value:function(){return this._isIndependentDomainDisabled}},{key:"isSingaporeSite",value:function(){return 2e7<=this._SDKAppID&&this._SDKAppID<3e7||172e7<=this._SDKAppID&&this._SDKAppID<173e7}},{key:"isKoreaSite",value:function(){return 3e7<=this._SDKAppID&&this._SDKAppID<4e7||173e7<=this._SDKAppID&&this._SDKAppID<174e7}},{key:"isGermanySite",value:function(){return 4e7<=this._SDKAppID&&this._SDKAppID<5e7||174e7<=this._SDKAppID&&this._SDKAppID<175e7}},{key:"isIndiaSite",value:function(){return 5e7<=this._SDKAppID&&this._SDKAppID<6e7||175e7<=this._SDKAppID&&this._SDKAppID<176e7}},{key:"isJapanSite",value:function(){return 6e7<=this._SDKAppID&&this._SDKAppID<7e7||176e7<=this._SDKAppID&&this._SDKAppID<177e7}},{key:"isUSASite",value:function(){return 7e7<=this._SDKAppID&&this._SDKAppID<8e7||177e7<=this._SDKAppID&&this._SDKAppID<178e7}},{key:"isIndonesiaSite",value:function(){return 8e7<=this._SDKAppID&&this._SDKAppID<9e7||178e7<=this._SDKAppID&&this._SDKAppID<179e7}},{key:"isIntl",value:function(){return(e=this._SDKAppID)===0||2e7<=e&&e<9e7||172e7<=e&&e<179e7;var e}},{key:"isUnlimitedAVChatRoom",value:function(){return this._unlimitedAVChatRoom}},{key:"isUsingChatCore",value:function(){return this._isUsingChatCore}},{key:"setUsingChatCore",value:function(e){this._isUsingChatCore=e}},{key:"getUIPlatform",value:function(){return this._uiPlatform}},{key:"setUIPlatform",value:function(e){this._uiPlatform=e}},{key:"setUserID",value:function(e){this._userID=e}},{key:"getUserID",value:function(){return this._userID}},{key:"setUserSig",value:function(e){this._userSig=e}},{key:"getUserSig",value:function(){return this._userSig}},{key:"getSDKAppID",value:function(){return this._SDKAppID}},{key:"setTinyID",value:function(e){this._tinyID=e,this._isLoggedIn=!0}},{key:"getTinyID",value:function(){return this._tinyID}},{key:"setCustomStatus",value:function(e){this._customStatus=e}},{key:"getCustomStatus",value:function(){return this._customStatus}},{key:"getScene",value:function(){return Ps?window.tencent_cloud_im_csig_flutter_for_web_25F_cy:this._isTUIKit()?"tuikit":this._scene}},{key:"getInstanceID",value:function(){return this._instanceID}},{key:"getStatusInstanceID",value:function(){return this._statusInstanceID}},{key:"setStatusInstanceID",value:function(e){this._statusInstanceID=e}},{key:"getVersion",value:function(){return this._version}},{key:"getA2Key",value:function(){return this._a2Key}},{key:"setA2Key",value:function(e){this._a2Key=e}},{key:"getContentType",value:function(){return this._contentType}},{key:"getProxyServer",value:function(){return this._proxyServer}},{key:"getFileUploadProxy",value:function(){return this._fileUploadProxy}},{key:"getFileDownloadProxy",value:function(){return this._fileDownloadProxy}},{key:"setApplicationID",value:function(e){this._applicationID=e}},{key:"getApplicationID",value:function(){return this._applicationID}},{key:"setDowloadFileAuthKey",value:function(e){this._authKey=e}},{key:"getDownloadFileAuthKey",value:function(){return this._authKey}},{key:"setCustomLoginInfo",value:function(e){this._customLoginInfo=e}},{key:"getCustomLoginInfo",value:function(){return this._customLoginInfo}},{key:"_isTUIKit",value:function(){var e=!1,t=!1,n=!1,o=!1,r=[];X&&(r=Object.keys(te));for(var s=0,a=(r=Ae?Object.keys(As?uni:window):r).length;s<a;s++)if(r[s].toLowerCase().includes("uikit")){e=!0;break}var i,r=null,c=(X&&!Re(te.createGamePortal)&&Re(getApp)&&!T(getApp())&&(i=getApp().globalData,Q(i))&&i.isTUIKit===!0&&(t=!0),this._m.get(13).getStorageSync("TIM_".concat(this._SDKAppID,"_isTUIKit"))===!0&&(n=!0),null);if(Xe&&!ft&&typeof uni>"u"&&__wxConfig&&(c=__wxConfig.pages),Et&&typeof uni>"u"&&__qqConfig&&(c=__qqConfig.pages),O(c)&&0<c.length){for(var u=0,l=c.length;u<l;u++)if(c[u].toLowerCase().includes("tui")){o=!0;break}c=null}return e||t||n||o}},{key:"reset",value:function(){this._isLoggedIn=!1,this._userSig="",this._a2Key="",this._tinyID="",this._customStatus="",this._statusInstanceID=0}}]),Xi={"k-vue2-pc":1,"k-vue2-h5":2,"k-vue2-h5-uni":3,"k-vue2-app-uni":4,"k-vue2-mp-uni":5,"k-vue2-pc-uni":6,"k-vue3-pc":7,"k-vue3-h5":8,"k-vue3-h5-uni":9,"k-vue3-app-uni":10,"k-vue3-mp-uni":11,"k-vue3-pc-uni":12,"k-rn":13},Zi=(de(Kn,ce),b(Kn,[{key:"onCheckTimer",value:function(e){this.isLoggedIn()&&e%this._helloInterval==0&&this._hello()}},{key:"getPushModule",value:function(){var e=void 0,t=this.get(36),n=this.get(28);return t.canIUseTIMPush()?e=t:n.canIUseOfflinePush()&&(e=n),e}},{key:"login",value:function(e){if(this.isLoggedIn())return n=this.getMyUserID(),(n=this.getErrMsg("RepeatLogin",n))&&d.w(n),q({actionStatus:"OK",errorCode:0,errorInfo:n,repeatLogin:!0});if(Date.now()-this._lastLoginTs<=15e3)return this.warn("LoggingIn",e.userID),v({code:y.REPEAT_LOGIN});d.l("".concat(this._n,".login userID:").concat(e.userID));var t,n=this._checkLoginInfo(e);return n.code!==0?v(n):(n=this.get(12),t=e.userID,e=e.userSig,n.setUserID(t),n.setUserSig(e),this.get(20).updateProtocolConfig(),this._login())}},{key:"_login",value:function(){var e=this,t=this.get(12),n=t.getScene(),o=0,s=n,a=(n&&n.startsWith("k-")&&(s=Xi[n],n="tuikit"),new D("login")),r=(a.setMessage("".concat(s)).setMoreMessage("identifier:".concat(this.getMyUserID())),n==="tuikit"),i=0,r=(As?i=r?s===3||s===4||s===5||s===6?31:s===9||s===10||s===11||s===12?32:4:3:X?i=Rs?36:n==="tuikit"?12:11:Ae?i=Ps?n==="flutter_web_uikit"?21:20:this._isReactUIKit()?Ao?25:24:r?s===1||s===2?29:s===7||s===8?30:Ao?17:14:Ao?16:13:s===13&&(i=38),a.setUIPlatform(i),t.setUIPlatform(i),this.getPushModule()),c=(r&&(this._isWebUniapp=r.getUniAppPlatform(),s=this._getStatusInstanceID(),t.setStatusInstanceID(s),this.get(20).updateProtocolConfig(),o=r.getDeviceBrand()),"".concat(this._n,"._login"));return this._lastLoginTs=Date.now(),this.req({P:h.LOGIN,data:{deviceBrand:o,isWebUniapp:this._isWebUniapp,customInfo:t.getCustomLoginInfo()}}).then(function(u){e._lastLoginTs=0;var B=Date.now(),l=null,L=u.data,_=L.a2Key,m=L.tinyID,f=L.helloInterval,I=L.instanceID,C=L.timeStamp,M=L.customStatus,M=M===void 0?"":M,S=L.purchaseBits,L=L.authKey,L=L===void 0?"":L,P=1e3*C,w=B-a.getStartTs(),w=P+parseInt(w/2)-B,B=a.getStartTs()+w;if(a.start(B),B=P,Qt=w,(P=new Date).setTime(B),d.i("baseTime from server:".concat(P," offset:").concat(Qt)),m){if(_)return B=e.get(21).getSocketID(),P=Hn(M),M="socketID:".concat(B," scene:").concat(n," helloInterval:").concat(f," instanceID:").concat(I," timeStamp:").concat(C)+" offset:".concat(w," customStatus:").concat(P," isWebUniapp:").concat(e._isWebUniapp),d.l("".concat(c," ok. ").concat(M)),C=B="",Xe&&Re(te.getAccountInfoSync)&&(w=te.getAccountInfoSync().miniProgram)&&(B=w.appId,C=w.envVersion),a.setMoreMessage("".concat(M," href:").concat(Ae?window.location.href:""," mpAppId:").concat(B," envVersion:").concat(C," authKey:").concat(L)).end(),t.setA2Key(_),t.setTinyID(m),t.setStatusInstanceID(I),t.setCustomStatus(P),t.setDowloadFileAuthKey(L),S&&e.get(27).onPushedConfig({errorCode:0,expiredTime:0,purchaseBits:S}),e.get(20).updateProtocolConfig(),e.emitIEvt(ne.A2KEY_AND_TINYID_UPDATED),e._helloInterval=f,e.triggerReady(),(w=e.getPushModule())&&(uni.setStorageSync("timUniAppInstanceID",I),w.init()),e._fetchCloudControlConfig(),e.get(29).init(),u;l=new ie({code:y.NO_A2KEY})}else l=new ie({code:y.NO_TINYID});throw a.setError(l).end(),l}).catch(function(u){return a.setError(u).end(!0),e._m.setNotReadyReason(y.LOGIN_FAILED),d.e("".concat(c," failed. error:"),u),e._lastLoginTs=0,e._m.onLoginFailed(),v(u)})}},{key:"logout",value:function(){var e=this,t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:0,n="".concat(this._n,".logout"),o=this.isLoggedIn();return d.i("".concat(n," type:").concat(t," isLoggedIn:").concat(o," isWebUniapp:").concat(this._isWebUniapp)),o?(new D("logout").setMessage("identifier:".concat(this.getMyUserID())).end(!0),t===0&&this._m.setNotReadyReason(y.LOGGED_OUT),this.req({P:h.LOGOUT,data:{type:t,isWebUniapp:this._isWebUniapp}}).then(function(){return e.resetReady(),q({})}).catch(function(s){return d.e("".concat(n," error:"),s),e.resetReady(),q({})})):v({code:y.USER_NOT_LOGGED_IN})}},{key:"getLoginUser",value:function(){return this.isLoggedIn()?this.getMyUserID():""}},{key:"_fetchCloudControlConfig",value:function(){this.get(23).fetchConfig()}},{key:"_getStatusInstanceID",value:function(){return uni.getStorageSync("timUniAppInstanceID")||0}},{key:"_hello",value:function(){var e=this;this._lastWsHelloTs=Date.now(),this.req({P:h.HELLO,data:{isWebUniapp:this._isWebUniapp}}).catch(function(t){d.w("".concat(e._n,"._hello error:"),t)})}},{key:"getLastWsHelloTs",value:function(){return this._lastWsHelloTs}},{key:"_checkLoginInfo",value:function(e){var t=0;return k(this.get(12).getSDKAppID())?t=y.NO_SDKAPPID:k(e.userID)?t=y.NO_IDENTIFIER:k(e.userSig)&&(t=y.NO_USERSIG),{code:t}}},{key:"_isReactUIKit",value:function(){return Ae&&window.tencent_cloud_im_csig_react_uikit_23F_xa!==void 0}},{key:"onMultipleAccountKickedOut",value:function(e){var t=this;new D("kickedOut").setMessage("type:".concat(g.KICKED_OUT_MULT_ACCOUNT," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),d.w("".concat(this._n,".onMultipleAccountKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){t.emitOEvt(F.KICKED_OUT,{type:g.KICKED_OUT_MULT_ACCOUNT}),t._m.setNotReadyReason(y.KICKED_OUT_MULT_ACCOUNT),t._m.reset()})}},{key:"onMultipleDeviceKickedOut",value:function(e){var t=this;new D("kickedOut").setMessage("type:".concat(g.KICKED_OUT_MULT_DEVICE," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),d.w("".concat(this._n,".onMultipleDeviceKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.logout(1).then(function(){t.emitOEvt(F.KICKED_OUT,{type:g.KICKED_OUT_MULT_DEVICE}),t._m.setNotReadyReason(y.KICKED_OUT_MULT_DEVICE),t._m.reset()})}},{key:"onUserSigExpired",value:function(){new D("kickedOut").setMessage(g.KICKED_OUT_USERSIG_EXPIRED).end(!0),d.w("".concat(this._n,".onUserSigExpired userID:").concat(this.getMyUserID())),this.get(12).getStatusInstanceID()!==0&&(this.emitOEvt(F.KICKED_OUT,{type:g.KICKED_OUT_USERSIG_EXPIRED}),this._m.setNotReadyReason(y.KICKED_OUT_USERSIG_EXPIRED),this._m.reset())}},{key:"onRestApiKickedOut",value:function(e){new D("kickedOut").setMessage("type:".concat(g.KICKED_OUT_REST_API," newInstanceInfo:").concat(JSON.stringify(e))).end(!0),d.w("".concat(this._n,".onRestApiKickedOut userID:").concat(this.getMyUserID()," newInstanceInfo:"),e),this.get(12).getStatusInstanceID()!==0&&(this.emitOEvt(F.KICKED_OUT,{type:g.KICKED_OUT_REST_API}),this._m.setNotReadyReason(y.KICKED_OUT_REST_API),this._m.reset(),this.get(21).onRestApiKickedOut())}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this.resetReady(),this._helloInterval=120,this._lastLoginTs=0,this._lastWsHelloTs=0,this._isWebUniapp=0}}]));function Kn(e){return U(this,Kn),(e=le(this,Kn,[e]))._n="SignModule",e._helloInterval=120,e._lastLoginTs=0,e._lastWsHelloTs=0,e._isWebUniapp=0,Xo.mixin(e),e}function Yn(e){return U(this,Yn),(e=le(this,Yn,[e]))._n="UserModule",e._profileHandler=new Yi(e),e._blacklistHandler=new Wi(e),e._userStatusHandler=new ji(e),e.getIEmitInst().on(ne.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,e),e}function Wn(e){return U(this,Wn),(e=le(this,Wn,[e]))._n="TopicModule",e._topicMap=new Map,e._getTopicTimeMap=new Map,e.TOPIC_CACHE_TIME=300,e.TOPIC_LAST_ACTIVE_TIME=3600,e.getIEmitInst().on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function jn(e){return U(this,jn),(e=le(this,jn,[e]))._n="GroupModule",e._commonGroupHandler=new Ai(e),e._groupAttributesHandler=new Oi(e),e._groupCountersHandler=new Ni(e),e._AVChatRoomHandler=new Gi(e),e._groupTipsHandler=new Ri(e),e._groupSystemNoticeHandler=new qi(e),e._groupMemberHandler=new bi(e),e._groupPinMessageHandler=new wi(e),e.groupMap=new Map,e._unjoinedAVChatRoomList=new Map,e._receiptDetailCompleteMap=new Map,e._onlineMemberCountMap=new Map,e._timeoutIDs=[],e.getIEmitInst().on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function Jn(e){return U(this,Jn),(e=le(this,Jn,[e]))._n="ConvModule",Xo.mixin(e),e._msgListHandler=new Ci(e),e._msgRemindHandler=new Li(e),e._convGroupHandler=new Si(e),e._sll=new Zo(100),e._pagingStatus=pt,e._pagingTs=0,e._pagingStartIdx=0,e._pagingPinnedTs=0,e._pagingPinnedStartIdx=0,e._pagingConvIDMap=new Map,e._convIDFromUnreadDBMap=new Map,e._convMap=new Map,e._tmpGroupList=[],e._tmpGroupAtTipsList=[],e._peerReadTimeMap=new Map,e._completedMap=new Map,e._roamingMsgKeyAndTimeMap=new Map,e._remoteGroupReadSeqMap=new Map,e._convTotalUnreadCount=0,e._pagingGetCostList=[],e._convMapForDiff=new Map,e._partialUpdatedConvMap=new Map,e._everClearedMap=new Map,e._bPullOnInvite=!0,e._initListeners(),e}function zn(){return null}function Sa(e){var t=e.get(12);return{SDKType:10,SDKAppID:t.getSDKAppID(),SDKVersion:t.getVersion(),tinyID:Number(t.getTinyID()),userID:t.getUserID(),platform:e.getPlatform(),instanceID:t.getInstanceID(),traceID:Qe()}}var Qi=b(function e(t){U(this,e),this._m=t,this._n="StorageModule",this._storageQueue=new Map,this._errorTolerantHandle()},[{key:"_errorTolerantHandle",value:function(){X||typeof window<"u"&&this._canIUseCookies()||(this.getItem=zn,this.setItem=zn,this.removeItem=zn,this.clear=zn)}},{key:"onCheckTimer",value:function(e){e%20==0&&this._storageQueue.size!==0&&this._doFlush()}},{key:"_doFlush",value:function(){try{var e,t=Se(this._storageQueue);try{for(t.s();!(e=t.n()).done;){var n=ke(e.value,2),o=n[0],s=n[1];this._setStorageSync(this._getKey(o),s)}}catch(a){t.e(a)}finally{t.f()}this._storageQueue.clear()}catch(a){d.w("".concat(this._n,"._doFlush error:"),a)}}},{key:"_getPrefix",value:function(){var e=this._m.get(12);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=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1];try{var n=t?this._getKey(e):e;return this.getStorageSync(n)}catch(o){return d.w("".concat(this._n,".getItem error:"),o),{}}}},{key:"setItem",value:function(e,t){var n;2<arguments.length&&arguments[2]!==void 0&&arguments[2]?(n=!(3<arguments.length&&arguments[3]!==void 0)||arguments[3]?this._getKey(e):e,this._setStorageSync(n,t)):this._storageQueue.set(e,t)}},{key:"clear",value:function(){try{X?te.clearStorageSync():this._canIUseCookies()&&localStorage.clear()}catch(e){d.w("".concat(this._n,".clear error:"),e)}}},{key:"removeItem",value:function(e){var t=!(1<arguments.length&&arguments[1]!==void 0)||arguments[1];try{var n=t?this._getKey(e):e;this._removeStorageSync(n)}catch(o){d.w("".concat(this._n,".removeItem error:"),o)}}},{key:"getSize",value:function(e){var t=this,n=1<arguments.length&&arguments[1]!==void 0?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}}),X&&(o.limitSize=1024*te.getStorageInfoSync().limitSize),e)o.size=JSON.stringify(this.getItem(e)).length+this._getKey(e).length;else if(X)te.getStorageInfoSync().keys.forEach(function(a){o.size+=JSON.stringify(t.getStorageSync(a)).length+t._getKey(a).length});else if(this._canIUseCookies())for(var s in localStorage)localStorage.hasOwnProperty(s)&&(o.size+=localStorage.getItem(s).length+s.length);return this._convertUnit(o)}catch(a){d.w("".concat(this._n," error:"),a)}}},{key:"_convertUnit",value:function(e){var t,n={},o=e.unit;for(t in n.unit=o,e)typeof e[t]=="number"&&(o.toLowerCase()==="kb"?n[t]=Math.round(e[t]/1024):o.toLowerCase()==="mb"?n[t]=Math.round(e[t]/1024/1024):n[t]=e[t]);return n}},{key:"_setStorageSync",value:function(e,t){X?Ze?my.setStorageSync({key:e,data:t}):te.setStorageSync(e,t):this._canIUseCookies()&&localStorage.setItem(e,JSON.stringify(t))}},{key:"getStorageSync",value:function(e){return X?Ze?my.getStorageSync({key:e}).data:te.getStorageSync(e):this._canIUseCookies()?JSON.parse(localStorage.getItem(e)):{}}},{key:"_removeStorageSync",value:function(e){X?Ze?my.removeStorageSync({key:e}):te.removeStorageSync(e):this._canIUseCookies()&&localStorage.removeItem(e)}},{key:"_canIUseCookies",value:function(){return typeof window<"u"&&navigator&&navigator.cookieEnabled&&localStorage}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._doFlush()}}]),$i=b(function e(t){U(this,e),this._n="SSOLogBody",this._report=[]},[{key:"pushIn",value:function(e){d.d("".concat(this._n,".pushIn"),this._report.length,e),this._report.push(e)}},{key:"backfill",value:function(e){var t;O(e)&&e.length!==0&&(d.d("".concat(this._n,".backfill"),this._report.length,e.length),(t=this._report).unshift.apply(t,G(e)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return this._report.length===0}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getLogsInMemory",value:function(){var e=this._report.slice();return this._reset(),e}}]),er=(de(Xn,ce),b(Xn,[{key:"reportAtOnce",value:function(){this._report()}},{key:"_onLoginSuccess",value:function(){var e=this,t=this.get(13),n=t.getItem(this.TAG,!1);!k(n)&&Re(n.forEach)&&(d.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach(function(o){e._reportBody.pushIn(o)}),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",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");T(e)||(this.MIN_THRESHOLD=Number(e)),T(t)||(this.WAITING_TIME=Number(t)),T(n)||(this.REPORT_LEVEL=n.split(",").map(function(a){return Number(a)})),T(o)||(this.REPORT_SDKAPPID_BLACKLIST=o.split(",").map(function(a){return Number(a)})),T(s)||(this.REPORT_TINYID_WHITELIST=s.split(","))}},{key:"pushIn",value:function(e){e instanceof D&&(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,o=this.get(12),n=o.getSDKAppID(),o=o.getTinyID();return oa(this.REPORT_SDKAPPID_BLACKLIST,n)&&!sa(this.REPORT_TINYID_WHITELIST,o)?[]:e.filter(function(s){return t.REPORT_LEVEL.includes(s.level)})}},{key:"_report",value:function(){var e,t,n=this;this._reportBody.isEmpty()||(e=this._reportBody.getLogsInMemory(),(t=this._filterLogs(e)).length!==0?(t={header:Sa(this),event:t},this.req({P:h.SSO_STAT,data:p({},t)}).then(function(){n._lastReportTime=Date.now()}).catch(function(o){d.w("".concat(n._n,"._report failed. error:"),o),n._lastReportTime=Date.now(),n._reportBody.backfill(e),n._reportBody.getLogsNumInMemory()>n.MAX_THRESHOLD&&n._flushAtOnce()})):this._lastReportTime=Date.now())}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._reportBody.getLogsInMemory(),o="".concat(this._n,"._flushAtOnce");k(t)?(d.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):((n=n.concat(t)).length>this.MAX_THRESHOLD&&(n=n.slice(0,this.MAX_THRESHOLD)),d.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1))}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._lastReportTime=0,this._report(),this.REPORT_SDKAPPID_BLACKLIST=[],this.REPORT_TINYID_WHITELIST=[]}}])),Qo="none",$o="online",tr=b(function e(t){U(this,e),this._m=t,this._networkType=$o,this._n="NetMonitorModule",this._mpNetworkStatusCallback=null,this._webOnlineCallback=null,this._webOfflineCallback=null,this._removeListener=null,this._m.getIEmitInst().on(ne.A2KEY_AND_TINYID_UPDATED,this._startRN,this)},[{key:"_startRN",value:function(){var e,t=this;He&&(e=this._m.get(18).getPlugin("chat-network-monitor"))&&(this._removeListener=e.addEventListener(function(s){var o=s.isConnected,s=s.type;t._networkType!==s&&t._onNetworkStatusChange({isConnected:o!==void 0&&o,networkType:s})}))}},{key:"start",value:function(){var e=this,t="".concat(this._n,".start");X?(te.getNetworkType({success:function(n){e._networkType=n.networkType||n.subtype||"",n.networkType===Qo?d.w("".concat(t," no network, please check!")):d.i("".concat(t," networkType:").concat(n.networkType))}}),this._mpNetworkStatusCallback=this._onNetworkStatusChange.bind(this),te.onNetworkStatusChange(this._mpNetworkStatusCallback)):Ae&&(this._networkType=$o,this._webOnlineCallback=this._onWebOnline.bind(this),this._webOfflineCallback=this._onWebOffline.bind(this),window.addEventListener("online",this._webOnlineCallback),window.addEventListener("offline",this._webOfflineCallback))}},{key:"_onWebOnline",value:function(){this._onNetworkStatusChange({isConnected:!0,networkType:$o})}},{key:"_onWebOffline",value:function(){this._onNetworkStatusChange({isConnected:!1,networkType:Qo})}},{key:"_onNetworkStatusChange",value:function(n){var t=n.isConnected,n=n.networkType,o="".concat(this._n,"._onNetworkStatusChange"),s=!1,a="previous:".concat(this._networkType," current:").concat(n);t?(d.i("".concat(o," ").concat(a)),this._networkType!==n&&(s=!0,this._networkType=n,this._m.get(21).reConnect(!0))):this._networkType!==n&&(s=!0,this._networkType=n,d.w("".concat(o," no network, please check!")),this._m.get(21).offline()),s&&new D("networkChange").setMessage("isConnected:".concat(t," ").concat(a)).end()}},{key:"isOnline",value:function(){return this._networkType!==Qo}},{key:"getNetworkType",value:function(){return this._networkType}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),X?this._mpNetworkStatusCallback!==null&&(te.offNetworkStatusChange&&te.offNetworkStatusChange(this._mpNetworkStatusCallback),this._mpNetworkStatusCallback=null):Ae?(this._webOnlineCallback!==null&&(window.removeEventListener("online",this._webOnlineCallback),this._webOnlineCallback=null),this._onWebOffline!==null&&(window.removeEventListener("offline",this._webOfflineCallback),this._webOfflineCallback=null)):He&&this._removeListener&&(this._removeListener(),this._removeListener=null)}}]);function Xn(e){U(this,Xn),(e=le(this,Xn,[e]))._n="EventStatModule",e.TAG="im-ssolog-event",e._reportBody=new $i,e.MIN_THRESHOLD=20,e.MAX_THRESHOLD=100,e.WAITING_TIME=6e4,e.REPORT_LEVEL=[4,5,6],e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._lastReportTime=Date.now();var t=e.getIEmitInst();return t.on(ne.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function ka(e,t){return e(t={exports:{}},t.exports),t.exports}var Ra=ka(function(e){var t=Object.prototype.hasOwnProperty,n="~";function o(){}function s(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function a(c,u,l,_,m){if(typeof l!="function")throw new TypeError("The listener must be a function");return l=new s(l,_||c,m),_=n?n+u:u,c._events[_]?c._events[_].fn?c._events[_]=[c._events[_],l]:c._events[_].push(l):(c._events[_]=l,c._eventsCount++),c}function i(c,u){--c._eventsCount==0?c._events=new o:delete c._events[u]}function r(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1)),r.prototype.eventNames=function(){var c,u,l=[];if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(n?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},r.prototype.listeners=function(u){var u=n?n+u:u,l=this._events[u];if(!l)return[];if(l.fn)return[l.fn];for(var _=0,m=l.length,f=new Array(m);_<m;_++)f[_]=l[_].fn;return f},r.prototype.listenerCount=function(c){return c=n?n+c:c,c=this._events[c],c?c.fn?1:c.length:0},r.prototype.emit=function(c,u,l,_,m,f){var I=n?n+c:c;if(!this._events[I])return!1;var C,M=this._events[I],S=arguments.length;if(M.fn){switch(M.once&&this.removeListener(c,M.fn,void 0,!0),S){case 1:return M.fn.call(M.context),!0;case 2:return M.fn.call(M.context,u),!0;case 3:return M.fn.call(M.context,u,l),!0;case 4:return M.fn.call(M.context,u,l,_),!0;case 5:return M.fn.call(M.context,u,l,_,m),!0;case 6:return M.fn.call(M.context,u,l,_,m,f),!0}for(w=1,C=new Array(S-1);w<S;w++)C[w-1]=arguments[w];M.fn.apply(M.context,C)}else for(var L,P=M.length,w=0;w<P;w++)switch(M[w].once&&this.removeListener(c,M[w].fn,void 0,!0),S){case 1:M[w].fn.call(M[w].context);break;case 2:M[w].fn.call(M[w].context,u);break;case 3:M[w].fn.call(M[w].context,u,l);break;case 4:M[w].fn.call(M[w].context,u,l,_);break;default:if(!C)for(L=1,C=new Array(S-1);L<S;L++)C[L-1]=arguments[L];M[w].fn.apply(M[w].context,C)}return!0},r.prototype.on=function(c,u,l){return a(this,c,u,l,!1)},r.prototype.once=function(c,u,l){return a(this,c,u,l,!0)},r.prototype.removeListener=function(c,u,l,_){if(c=n?n+c:c,this._events[c])if(u){var m=this._events[c];if(m.fn)m.fn!==u||_&&!m.once||l&&m.context!==l||i(this,c);else{for(var f=0,I=[],C=m.length;f<C;f++)(m[f].fn!==u||_&&!m[f].once||l&&m[f].context!==l)&&I.push(m[f]);I.length?this._events[c]=I.length===1?I[0]:I:i(this,c)}}else i(this,c);return this},r.prototype.removeAllListeners=function(c){return c?(c=n?n+c:c,this._events[c]&&i(this,c)):(this._events=new o,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prefixed=n,e.exports=r.EventEmitter=r}),nr=["rich.my-imcloud.com","imrich.qcloud.com"],or=["existFlag"],sr=(de(Zn,ce),b(Zn,[{key:"_init",value:function(){this._fileDownloadProxy=this.getFileDownloadProxy(),this._authKey=this.getDownloadFileAuthKey();var e=this.get(18);this.TIMUploadPlugin=e.getPlugin("tim-upload-plugin"),this.TIMUploadPlugin?this._initUploaderMethod():(this.COSSDK=e.getPlugin(e=X?"cos-wx-sdk":"cos-js-sdk"),this.COSSDK?(this._getAuthorizationKey(),this.warn("CosReplacement",e)):this.warn("PluginUndetected"))}},{key:"_onCloudConfig",value:function(){var e=this,t="".concat(this._n,"._onCloudConfig"),n=this.getCloudConfig("upload_size_limit"),o=this.getCloudConfig("simple_cos"),s=this.getCloudConfig("file_dn_list");if(d.l("".concat(t," uploadSizeLimit:").concat(n," simpleCos:").concat(o)),!T(n))try{var a=JSON.parse(n);this.UPLOAD_SIZE_LIMIT={A:a.a?1048576*parseInt(a.a):this.UPLOAD_SIZE_LIMIT.A,F:a.f?1048576*parseInt(a.f):this.UPLOAD_SIZE_LIMIT.F,I:a.i?1048576*parseInt(a.i):this.UPLOAD_SIZE_LIMIT.I,V:a.v?1048576*parseInt(a.v):this.UPLOAD_SIZE_LIMIT.V}}catch{}if(T(o)||(this.isSimpleCos=o==="1"),!T(s))try{JSON.parse(s).forEach(function(i){e._fileDNList.includes(i)||e._fileDNList.push(i)})}catch{}}},{key:"_getAuthorizationKey",value:function(){var e=this,t="".concat(this._n,".").concat("_getAuthorizationKey"),n=new D("_getAuthorizationKey"),o=Math.ceil(Date.now()/1e3);this.req({P:h.COS_SIGN,data:{duration:this.expiredTimeLimit}}).then(function(a){var a=a.data,i=(d.l("".concat(t," ok. data:"),a),a.expiredTime-o);n.setMessage("requestId:".concat(a.requestId," requestTime:").concat(o," expiredTime:").concat(a.expiredTime," diff:").concat(i,"s")).end(),!X&&a.region&&(e.region=a.region),e.appid=a.appid,e.bucketName=a.bucketName,e.ciUrl=a.ciUrl,e.directory=a.directory,e.downloadUrl=a.downloadUrl,e.uploadUrl=a.uploadUrl,e.cosOptions={secretId:a.secretId,secretKey:a.secretKey,sessionToken:a.sessionToken,expiredTime:a.expiredTime},d.l("".concat(t," ok. region:").concat(e.region," bucketName:").concat(e.bucketName)),e._initUploaderMethod()}).catch(function(s){n.setError(s).end(),d.w("".concat(t," failed. error:"),s)})}},{key:"_getCosPreSigUrl",value:function(e){var t=this,n="".concat(this._n,".").concat("_getCosPreSigUrl"),o=Math.ceil(Date.now()/1e3),s=new D("_getCosPreSigUrl"),a={uploadMethod:e.uploadMethod,platform:this.getPlatform(),SDKAppID:this.getSDKAppID(),userID:e.userID,conversationType:e.conversationType,uploadConfig:[{fileID:1,fileType:e.fileType,fileName:e.fileName}]},i=h.SIMPLE_COS_PRE_SIG;return this.isSimpleCos||(a={fileType:e.fileType,fileName:e.fileName,uploadMethod:e.uploadMethod,duration:e.duration},i=h.COS_PRE_SIG),this.req({P:i,data:a}).then(function(l){t.tryCount=0;var c,u,l=l.data||{},_=(d.l("".concat(n," ok. isSimpleCos:").concat(t.isSimpleCos," data:"),l),"");return _=t.isSimpleCos?(c=(u=l.preSig[0]).uploadUrl,u=u.fileKey,"uploadIP:".concat(l.uploadIP," uploadUrl:").concat(c," fileKey:").concat(u," cost:").concat(ye(o))):"requestId:".concat(l.requestId," expiredTime:").concat(l.expiredTime," diff:").concat(l.expiredTime-o,"s"),s.setMessage(_).end(),l}).catch(function(r){return r.code===-1&&(r.code=y.COS_GET_SIG_FAIL),s.setError(r).end(),d.w("".concat(n," failed. error:"),r),t.tryCount<1?(t.tryCount++,t._getCosPreSigUrl(e)):(t.tryCount=0,v({code:y.COS_GET_SIG_FAIL}))})}},{key:"_initUploaderMethod",value:function(){var e=this;this.TIMUploadPlugin?(this.timUploadPlugin=new this.TIMUploadPlugin,this._cosUploadMethod=function(t,n){e.timUploadPlugin.uploadFile(t,n)}):this.appid&&(this.cos=X?new this.COSSDK({ForcePathStyle:!0,getAuthorization:this._getAuthorization.bind(this)}):new this.COSSDK({getAuthorization:this._getAuthorization.bind(this)}),this._cosUploadMethod=X?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:"getFileDNList",value:function(){return this._fileDNList}},{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(e._relayFlag===!0)return Promise.resolve();var t=this.get(26);switch(e.type){case g.MSG_IMAGE:return t.addTotalCount(Ye),this._uploadImage(e);case g.MSG_FILE:return t.addTotalCount(Ye),this._uploadFile(e);case g.MSG_AUDIO:return t.addTotalCount(Ye),this._uploadAudio(e);case g.MSG_VIDEO:return t.addTotalCount(Ye),this._uploadVideo(e);default:return Promise.resolve()}}},{key:"_uploadImage",value:function(e){var t=this,n=this.get(2),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadImage({file:s.payload.file,customFileName:s.payload.customFileName,to:s.to,message:e,onProgress:function(a){if(o.updatePercent(a),Re(s.onProgress))try{s.onProgress(a)}catch{return v({code:y.MSG_ONPROGRESS_ERR})}}}).then(function(L){var i=L.location,r=L.fileType,c=L.fileSize,u=L.width,l=L.height,_=L.smallImageUrl,m=L.smallImageWidth,f=L.smallImageHeight,I=L.largeImageUrl,C=L.largeImageWidth,M=L.largeImageHeight,S=L.imageInfoArray,L=t.isPrivateNetWork()?i:$t(i);o.updateImageFormat(r);var P,w,B={size:c,url:L,width:u,height:l};if(S&&0<S.length)for(var x=0;x<S.length;x++){var j=S[x];j.type===1?P=j:j.type===2?w=j:B=p(p({},B),j)}else w=_&&I?(P={url:_,width:m,height:f},{url:I,width:C,height:M}):(P=bo({originUrl:L,originWidth:u,originHeight:l,min:198}),bo({originUrl:L,originWidth:u,originHeight:l,min:720}));return o.updateImageInfoArray([p({},B),p({},w),p({},P)]),e})}},{key:"_uploadFile",value:function(e){var t=this,n=this.get(2),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadFile({file:s.payload.file,customFileName:s.payload.customFileName,to:s.to,message:e,onProgress:function(a){if(o.updatePercent(a),Re(s.onProgress))try{s.onProgress(a)}catch{return v({code:y.MSG_ONPROGRESS_ERR})}}}).then(function(i){var i=i.location,r=i,c=i;return t.isPrivateNetWork()||(r=oe(i=$t(i),t._fileDownloadProxy,t._authKey,t._fileDNList),c=oe(i,void 0,t._authKey,t._fileDNList)),o.updateFileUrl(r,c),e})}},{key:"_uploadAudio",value:function(e){var t=this,n=this.get(2),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadAudio({file:s.payload.file,customFileName:s.payload.customFileName,to:s.to,message:e,onProgress:function(a){if(o.updatePercent(a),Re(s.onProgress))try{s.onProgress(a)}catch{return v({code:y.MSG_ONPROGRESS_ERR})}}}).then(function(a){return a=a.location,a=t.isPrivateNetWork()?a:$t(a),o.updateAudioUrl(a),e})}},{key:"_uploadVideo",value:function(e){var t=this,n=this.get(2),o=e.getElements()[0],s=n.getMessageOption(e.clientSequence);return this.doUploadVideo({file:s.payload.file,customFileName:s.payload.customFileName,to:s.to,message:e,onProgress:function(a){if(o.updatePercent(a),Re(s.onProgress))try{s.onProgress(a)}catch{return v({code:y.MSG_ONPROGRESS_ERR})}}}).then(function(i){var r=i.location,i=i.snapshotInfo,r=t.isPrivateNetWork()?r:$t(r);return o.updateVideoUrl(r),k(i)||o.updateSnapshotInfo(i),e})}},{key:"_checkSizeError",value:function(e){var t="";return e==="A"?t="audio":e==="I"?t="image":e==="V"?t="video":e==="F"&&(t="file"),v({code:y["MSG_".concat(e,"_SIZE_LIMIT")],message:this.getErrMsg("UploadSizeLimit",t,"".concat(this.UPLOAD_SIZE_LIMIT[e]/1048576,"MB"))})}},{key:"doUploadImage",value:function(e){var t,n,o=this;return!e.file||this._isEmptyFileList(e.file.files)?v({code:y.MSG_I_SELECT_F_FIRST}):(t=this._checkImageType(e.file))!==!0||(t=this._checkImageSize(e.file))!==!0?t:(n=null,this._setUploadFileType(1),this.uploadByCOS(e).then(function(s){if(n=s,o.isPrivateNetWork())return bt(s.location);if(O(n.imageInfoArray)){var a=n.imageInfoArray.find(function(i){return i.type===3});if(a)return a}return He?{width:e.file.width,height:e.file.height}:(a=$t(s.location),o.COSSDK?bt(a):bt(a=oe(a,o._fileDownloadProxy,o._authKey,o._fileDNList)))}).then(function(s){return n.width=s.width,n.height=s.height,Promise.resolve(n)}))}},{key:"_checkImageType",value:function(e){var t="",t=X?e.url.slice(e.url.lastIndexOf(".")+1):He?e.type.split("/")[1]:e.files[0].name.slice(e.files[0].name.lastIndexOf(".")+1);return 0<=Ti.indexOf(t.toLowerCase())||v({code:y.MSG_I_TYPES_LIMIT})}},{key:"_checkImageSize",value:function(e){return(e=(X||He?e:e.files[0]).size)===0?v({code:y.MSG_F_IS_EMPTY}):e<this.UPLOAD_SIZE_LIMIT.I||this._checkSizeError("I")}},{key:"doUploadFile",value:function(e){return!e.file||this._isEmptyFileList(e.file.files)?v({code:y.MSG_F_SELECT_F_FIRST}):e.file.files[0].size>this.UPLOAD_SIZE_LIMIT.F?this._checkSizeError("F"):e.file.files[0].size===0?v({code:y.MSG_F_IS_EMPTY}):(this._setUploadFileType(255),this.uploadByCOS(e))}},{key:"doUploadVideo",value:function(e){return e.file.videoFile.size>this.UPLOAD_SIZE_LIMIT.V?this._checkSizeError("V"):e.file.videoFile.size===0?v({code:y.MSG_F_IS_EMPTY}):Di.indexOf(e.file.videoFile.type)===-1?v({code:y.MSG_V_TYPES_LIMIT}):(this._setUploadFileType(2),X||He?this.handleVideoUpload(p(p({},e),{},{file:e.file.videoFile})):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(s){n(s)}).catch(function(){t.uploadByCOS(e).then(function(s){n(s)}).catch(function(){o(new ie({code:y.MSG_V_UPLOAD_FAIL}))})})})}},{key:"doUploadAudio",value:function(e){return e.file?e.file.size>this.UPLOAD_SIZE_LIMIT.A?this._checkSizeError("A"):e.file.size===0?v({code:y.MSG_F_IS_EMPTY}):(this._setUploadFileType(3),this.uploadByCOS(e)):v({code:y.MSG_A_UPLOAD_FAIL})}},{key:"uploadByCOS",value:function(e){var t,n,o,s,a=this;return Re(this._cosUploadMethod)?this.timUploadPlugin?this._uploadWithPreSigUrl(e):(t=new D("upload"),n="".concat(this._n,".uploadByCOS"),o=Date.now(),s=this._getFile(e),new Promise(function(i,r){var c=X?a._createCosOptionsWXMiniApp(e):a._createCosOptionsWeb(e),u=a;a._cosUploadMethod(c,function(l,_){var m,f,I=Object.create(null);_?l||O(_.files)&&_.files[0].error?(m=new ie({code:y.MSG_F_UPLOAD_FAIL}),t.setError(m).end(),d.l("".concat(n," failed. error:"),_.files[0].error),_.files[0].error.statusCode===403&&a._getAuthorizationKey(),r(m)):(I.fileName=s.name,I.fileSize=s.size,I.fileType=s.type.slice(s.type.indexOf("/")+1).toLowerCase(),I.location=(X?_:_.files[0].data).Location,m=Date.now()-o,_=u._formatFileSize(s.size),f=u._formatSpeed(1e3*s.size/m),_="size:".concat(_," time:").concat(m,"ms speed:").concat(f),d.l("".concat(n," success. name:").concat(s.name," ").concat(_)),i(I),(f=a.get(26)).addCost(Ye,m),f.addFileSize(Ye,s.size),t.setMessage(_).end()):(I=new ie({code:y.MSG_F_UPLOAD_FAIL}),t.setError(I).end(),d.w("".concat(n," failed. error:"),l),l.statusCode===403&&a._getAuthorizationKey(),r(I))})})):(this.warn("PluginUndetected"),v({code:y.COS_UNDETECTED}))}},{key:"_uploadWithPreSigUrl",value:function(e){var t=this,n="".concat(this._n,"._uploadWithPreSigUrl"),o=this._getFile(e);return this._createCosOptionsPreSigUrl(e).then(function(s){return new Promise(function(a,i){var r=new D("upload"),c=s.existFlag,u=Fe(s,or),l=Date.now();c!==1?t._cosUploadMethod(u,function(_,m){var f;_||m.statusCode===403?(f="".concat(T(_)?"":JSON.stringify(_)," ").concat(T(m)?"":JSON.stringify(m)),r.setMessage(f).end(),_={HttpStatusCode:9999,CostTime:ye(l,!1),error:_,url:s.url},m.data&&m.data.uploadIP&&(_.uploadIP=m.data.uploadIP),t._uploadSSOLog(_),d.l("".concat(n," failed, error:").concat(f)),i(new ie({code:y.MSG_F_UPLOAD_FAIL}))):t._handleUploadSuccessResult({ssoLog:r,startTs:l,file:o,uploadOptions:s,uploadResult:m},a)}):t._handleUploadSuccessResult({ssoLog:r,startTs:l,file:o,uploadOptions:s,uploadResult:{data:{location:u.downloadUrl,statusCode:200}}},a)})})}},{key:"_handleUploadSuccessResult",value:function(_,t){var M=_.ssoLog,I=_.startTs,n=_.file,l=_.uploadOptions,o=l.existFlag,s=l.fileType,a=l.url,i=l.downloadUrl,r=l.requestSnapshotUrl,c=l.thumbUrl,u=l.largeUrl,l=l.imageInfoArray,l=l===void 0?[]:l,_=_.uploadResult,m=Object.create(null),f=_.data.location||"",f=(this.isPrivateNetWork()||f.indexOf("https://")!==0&&f.indexOf("http://")!==0||(f=f.split("//")[1]),m.fileName=n.name,m.fileSize=n.size,m.fileType=n.type.slice(n.type.indexOf("/")+1).toLowerCase(),m.location=f,ye(I,!1)),I=this._formatFileSize(n.size),C=this._formatSpeed(1e3*n.size/(f||1)),I="exist:".concat(o," fileType:").concat(s," bytes:").concat(n.size," size:").concat(I," time:").concat(f,"ms speed:").concat(C," res:").concat(JSON.stringify(_)),C=(d.l("".concat(this._n,"._uploadWithPreSigUrl ok. name:").concat(n.name," ").concat(I)),M.setMessage(I).end(),{HttpStatusCode:_.statusCode,FileSize:n.size,CostTime:f,url:a}),M=(_.data&&_.data.uploadIP&&(C.uploadIP=_.data.uploadIP),this._uploadSSOLog(C),this.get(26));if(M.addCost(Ye,f),M.addFileSize(Ye,n.size),o===1){if(0<l.length)return m.imageInfoArray=l,void t(m);if(r)return this._getSnapshotInfoByUrl(r,m).then(function(){t(m)})}if(I=[],c&&u&&I.push.apply(I,[this._getSmallImageInfoByUrl(c,m),this._getLargeImageInfoByUrl(u,m)]),this.isSimpleCos&&s===1&&!this.isPrivateNetWork()&&(I.push(this._getImageInfoArray(i,m)),_.data.uploadIP)&&I.push(this._getDownloadIP(i.split("//")[1].split("/")[0],m)),r&&I.push(this._getSnapshotInfoByUrl(r,m)),0<I.length)return Promise.all(I).then(function(){t(m)});t(m)}},{key:"_getDownloadIP",value:function(e,t){var n="".concat(this._n,"._getDownloadIP"),o=Date.now();return this.req({P:h.GET_IP,data:{domainName:e}}).then(function(s){var a;s.data&&s.data.ip&&(d.l("".concat(n," ok. downloadIP:").concat(s.data.ip," cost:").concat(ye(o))),(a=t.location.split("/"))[0]=s.data.ip,t.location=a.join("/"))}).catch(function(s){})}},{key:"_getImageInfoArray",value:function(e,t){var n=this,o="".concat(this._n,"._getImageInfoArray"),s=Date.now();return this.req({P:h.GET_IMAGE_INFO,data:{imageUrl:e}}).then(function(a){return a=a.data||{},d.l("".concat(o," ok. data: ").concat(JSON.stringify(a)," cost:").concat(ye(s))),t.imageInfoArray=a.imageInfoArray,a}).catch(function(a){t.imageInfoArray=void 0,n._uploadSSOLog({HttpStatusCode:1e4,CostTime:ye(s,!1),url:e})})}},{key:"_uploadSSOLog",value:function(e){var t,n;this.isSimpleCos&&((t=new D).setEventType(18),e.error&&t.setError(new ie(e.error)),n="HttpStatusCode:".concat(e.HttpStatusCode,"|CosRequestId:").concat(e.CosRequestId||"","|")+"FileAlreadyExist:".concat(e.FileAlreadyExist||0,"|FileSize:").concat(e.FileSize||0,"|CostTime:").concat(e.CostTime),e.uploadIP&&(n+="|FinalIP:".concat(e.uploadIP)),t.setMessage("OK").setMoreMessage(e.url).setExtension(n).end())}},{key:"_getRawOrUploadProxyUrl",value:function(e){var t=this.get(12).getFileUploadProxy(),n=e;return n=t?e.replace(/^https:\/\/[^/]+/,t):n}},{key:"_getFile",value:function(e){return O(e.file.files)||Js(e.file.files)?e.file.files[0]:e.file}},{key:"_formatFileSize",value:function(e){return e<1024?e+"B":e<1048576?Math.floor(e/1024)+"KB":Math.floor(e/1048576)+"MB"}},{key:"_formatSpeed",value:function(e){return e<=1048576?nt(e/1024,1)+"KB/s":nt(e/1048576,1)+"MB/s"}},{key:"_createCosOptionsWeb",value:function(e){var t=this._getFile(e),n=t.name,n=n.slice(n.lastIndexOf(".")),n=this._genFileName("".concat(Je(999999)).concat(n));return{files:[{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(n),Body:t}],SliceSize:1048576,onProgress:function(o){if(typeof e.onProgress=="function")try{e.onProgress(o.percent)}catch(s){d.w("onProgress callback error:",s)}},onFileFinish:function(o,s,a){}}}},{key:"_createCosOptionsWXMiniApp",value:function(e){var n=this._getFile(e),t=this._genFileName(n.name),n=n.url;return{Bucket:"".concat(this.bucketName,"-").concat(this.appid),Region:this.region,Key:"".concat(this.directory,"/").concat(t),FilePath:n,onProgress:function(o){if(d.l(JSON.stringify(o)),typeof e.onProgress=="function")try{e.onProgress(o.percent)}catch(s){d.w("onProgress callback error:",s)}}}}},{key:"_createCosOptionsPreSigUrl",value:function(e){var t,n=this,o=e.customFileName,s="",i=0,a=this._getFile(e),i=X||He?(T(o)&&(o=e.message.type===g.MSG_FILE||e.message.type===g.MSG_VIDEO?(t=(t=a.name).slice(t.lastIndexOf(".")),this._genFileName("".concat(Je(999999)).concat(t))):this._genFileName(a.name)),s=a.url,1):(T(o)&&(t=(t=a.name).slice(t.lastIndexOf(".")),o=this._genFileName("".concat(Je(999999)).concat(t))),s=a,0);return this._getCosPreSigUrl({fileType:this.uploadFileType,fileName:o,uploadMethod:i,duration:this.duration,userID:e.message.from,conversationType:Oe(e.message.conversationID)?1:2}).then(function(M){var C=n.isSimpleCos?M.preSig[0]:M,c=C.uploadUrl,u=C.downloadUrl,l=C.requestSnapshotUrl,l=l===void 0?void 0:l,_=C.thumbUrl,m=C.largeUrl,f=C.fileKey,I=C.existFlag,I=I===void 0?0:I,C=C.imageInfoArray,C=C===void 0?void 0:C,M=M.uploadIP,M=M===void 0?"":M;return{url:n._getRawOrUploadProxyUrl(c),fileType:n.uploadFileType,fileName:o,resources:s,downloadUrl:u,requestSnapshotUrl:l,thumbUrl:_,largeUrl:m,fileKey:f,existFlag:I,imageInfoArray:C,uploadIP:!n.isPrivateNetWork()&&M,onProgress:function(S){if(typeof e.onProgress=="function")try{e.onProgress(S.percent)}catch(L){d.w("onProgress callback error:",L),d.e(L)}}}})}},{key:"_genFileName",value:function(e){return"".concat($s(),"-").concat(e)}},{key:"_setUploadFileType",value:function(e){this.uploadFileType=e}},{key:"_getSnapshotInfoByUrl",value:function(e,t){var n=this,o="_getSnapshotInfoByUrl",s=new D(o);return this.req({P:h.VIDEO_COVER,data:{platform:this.getPlatform(),coverName:this._genFileName(Je(99999)),requestSnapshotUrl:e}}).then(function(c){var i,r,c=(c.data||{}).snapshotUrl;return d.l("".concat(n._n,".").concat(o," ok. snapshotUrl:").concat(c)),s.setMessage("snapshotUrl:".concat(c)).end(),k(c)?{}:(i=oe(c,n._fileDownloadProxy,n._authKey,n._fileDNList),r=oe(c,void 0,n._authKey,n._fileDNList),bt(i).then(function(u){t.snapshotInfo={snapshotUrl:i,snapshotWidth:u.width,snapshotHeight:u.height,remoteSnapshotUrl:r}}))}).catch(function(a){return d.w("".concat(n._n,".").concat(o," failed. error:"),a),s.setCode(a.errorCode).setMessage(a.errorInfo).end(),{}})}},{key:"_getSmallImageInfoByUrl",value:function(e,t){return bt(oe(e,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(function(n){t.smallImageUrl=e,t.smallImageWidth=n.width,t.smallImageHeight=n.height})}},{key:"_getLargeImageInfoByUrl",value:function(e,t){return bt(oe(e,this._fileDownloadProxy,this._authKey,this._fileDNList)).then(function(n){t.largeImageUrl=e,t.largeImageWidth=n.width,t.largeImageHeight=n.height})}},{key:"_isEmptyFileList",value:function(e){return!(!Js(e)||e.length!==0)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}])),ar=["downloadKey","pbDownloadKey","messageList"],ir=b(function e(t){U(this,e),this._n="MergerMessageHandler",this._msgM=t},[{key:"uploadMergerMessage",value:function(o,t){var n="".concat(this._n,".").concat("uploadMergerMessage"),o=(d.d("".concat(n," message:"),o,"messageBytes:".concat(t)),JSON.parse(JSON.stringify(o.payload)).messageList),s=o.length,a=(this._msgM.get(17).getFileDNList(),new D("uploadMergerMessage"));return o.forEach(function(i){Un(i.messageBody[0].type,i.messageBody)}),this._msgM.req({P:h.UPLOAD_MERGER_MSG,data:{messageList:o}}).then(function(r){d.d("".concat(n," ok. response:"),r.data);var r=r.data,c=r.pbDownloadKey,r=r.downloadKey,c={pbDownloadKey:c,downloadKey:r,messageNumber:s};return a.setMessage("".concat(s,"-").concat(t,"-").concat(r)).end(),c}).catch(function(i){throw d.w("".concat(n," failed. error:"),i),a.setError(i).end(),i})}},{key:"downloadMergerMessage",value:function(e){var t=this,n="".concat(this._n,".").concat("downloadMergerMessage"),o=(d.d("".concat(n," message:"),e),e.payload.downloadKey),s=this._msgM.getFileDownloadProxy(),a=this._msgM.getDownloadFileAuthKey(),i=new D("downloadMergerMessage");return i.setMessage("downloadKey:".concat(o)),this._msgM.req({P:h.DOWNLOAD_MERGER_MSG,data:{downloadKey:o}}).then(function(r){d.d("".concat(n," ok. response:"),r.data);var c,u,l=t._msgM.get(17).getFileDNList();return Re(e.clearElement)?((c=e.payload).downloadKey,c.pbDownloadKey,c.messageList,c=Fe(c,ar),e.clearElement(),e.setElement({type:e.type,content:p({messageList:r.data.messageList},c)},s,a,l)):(u=[],r.data.messageList.forEach(function(_){k(_)||(_=new Ma(_,s,a,l),u.push(_))}),e.payload.messageList=u,e.payload.downloadKey="",e.payload.pbDownloadKey=""),i.end(),e}).catch(function(r){throw d.w("".concat(n," failed. key:").concat(o," error:"),r),i.setError(r).end(),r})}},{key:"createMergerMessagePack",value:function(e,t,n){return e.conversationType===g.CONV_C2C?this._createC2CMergerMessagePack(e,t,n):this._createGroupMergerMessagePack(e,t,n)}},{key:"_createC2CMergerMessagePack",value:function(e,t,c){var o=null,s=(t&&(t.offlinePushInfo&&(o=t.offlinePushInfo),t.onlineUserOnly===!0)&&(o?o.disablePush=!0:o={disablePush:!0}),[]),a=(Q(t)&&Q(t.messageControlInfo)&&(a=(r=t.messageControlInfo).excludedFromUnreadCount,i=r.excludedFromLastMessage,r=r.excludedFromContentModeration,a===!0&&s.push("NoUnread"),i===!0&&s.push("NoLastMsg"),r===!0)&&s.push("NoMsgCheck"),""),i=(V(e.cloudCustomData)&&0<e.cloudCustomData.length&&(a=e.cloudCustomData),c.pbDownloadKey),r=c.downloadKey,c=c.messageNumber,_=e.payload,u=_.title,l=_.abstractList,_=_.compatibleText,m=this._msgM.get(6),m=m&&m.isOnlineMessage(e,t)?0:void 0;return{P:h.SEND_C2C_MSG,data:{fromAccount:this._msgM.getMyUserID(),toAccount:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:i,downloadKey:r,title:u,abstractList:l,compatibleText:_,messageNumber:c}}],cloudCustomData:a,clientTime:e.clientTime,msgSeq:e.sequence,msgRandom:e.random,msgLifeTime:m,offlinePushInfo:Vn(o),messageControlInfo:m!==0?s:void 0,isSupportExtension:e.isSupportExtension===!0?1:0,isRelayMessage:e._relayFlag===!0?1:0}}}},{key:"_createGroupMergerMessagePack",value:function(e,f,c){var o=null,s=(f&&f.offlinePushInfo&&(o=f.offlinePushInfo),[]),a=(Q(f)&&Q(f.messageControlInfo)&&(a=(r=f.messageControlInfo).excludedFromUnreadCount,i=r.excludedFromLastMessage,r=r.excludedFromContentModeration,a===!0&&s.push("NoUnread"),i===!0&&s.push("NoLastMsg"),r===!0)&&s.push("NoMsgCheck"),""),i=(V(e.cloudCustomData)&&0<e.cloudCustomData.length&&(a=e.cloudCustomData),c.pbDownloadKey),r=c.downloadKey,c=c.messageNumber,_=e.payload,u=_.title,l=_.abstractList,_=_.compatibleText,m=this._msgM.get(7),f=m&&m.isOnlineMessage(e,f)?1:0;return{P:h.SEND_GRP_MSG,data:{fromAccount:this._msgM.getMyUserID(),groupID:e.to,msgBody:[{msgType:e.type,msgContent:{pbDownloadKey:i,downloadKey:r,title:u,abstractList:l,compatibleText:_,messageNumber:c}}],random:e.random,priority:e.priority,clientSequence:e.clientSequence,groupAtInfo:void 0,cloudCustomData:a,onlineOnlyFlag:f,offlinePushInfo:Vn(o),clientTime:e.clientTime,needReadReceipt:e.needReadReceipt!==!0||m.isMessageFromOrToAVChatroom(e.to)?0:1,messageControlInfo:f==0?s:void 0,isSupportExtension:e.isSupportExtension===!0?1:0,isRelayMessage:e._relayFlag===!0?1:0}}}}]),rr={ERR_SVR_COMM_SENSITIVE_TEXT:80001,ERR_SVR_COMM_BODY_SIZE_LIMIT:80002,OPEN_SERVICE_OVERLOAD_ERROR:60022,ERR_SVR_MSG_PKG_PARSE_FAILED:20001,ERR_SVR_MSG_INTERNAL_AUTH_FAILED:20002,ERR_SVR_MSG_INVALID_ID:20003,ERR_SVR_MSG_PUSH_DENY:20006,ERR_SVR_MSG_IN_PEER_BLACKLIST:20007,ERR_SVR_MSG_BOTH_NOT_FRIEND:20009,ERR_SVR_MSG_NOT_PEER_FRIEND:20010,ERR_SVR_MSG_NOT_SELF_FRIEND:20011,ERR_SVR_MSG_SHUTUP_DENY:20012,ERR_SVR_GROUP_INVALID_PARAMETERS:10004,ERR_SVR_GROUP_PERMISSION_DENY:10007,ERR_SVR_GROUP_NOT_FOUND:10010,ERR_SVR_GROUP_INVALID_GROUPID:10015,ERR_SVR_GROUP_REJECT_FROM_THIRDPARTY:10016,ERR_SVR_GROUP_SHUTUP_DENY:10017,MSG_SEND_FAIL:2100,OVER_FREQUENCY_LIMIT:2996},cr=[y.MSG_ONPROGRESS_ERR,y.MSG_I_SELECT_F_FIRST,y.MSG_I_TYPES_LIMIT,y.MSG_F_IS_EMPTY,y.MSG_I_SIZE_LIMIT,y.MSG_F_SELECT_F_FIRST,y.MSG_F_SIZE_LIMIT,y.MSG_V_SIZE_LIMIT,y.MSG_V_TYPES_LIMIT,y.MSG_A_UPLOAD_FAIL,y.MSG_A_SIZE_LIMIT,y.COS_UNDETECTED];function Zn(e){U(this,Zn),(e=le(this,Zn,[e]))._n="UploadModule",e.TIMUploadPlugin=null,e.timUploadPlugin=null,e.COSSDK=null,e._cosUploadMethod=null,e.expiredTimeLimit=600,e.appid=0,e.bucketName="",e.ciUrl="",e.directory="",e.downloadUrl="",e.uploadUrl="",e.region="ap-shanghai",e.cos=null,e.cosOptions={secretId:"",secretKey:"",sessionToken:"",expiredTime:0},e.uploadFileType="",e.duration=900,e.tryCount=0,e.UPLOAD_SIZE_LIMIT={A:20971520,F:104857600,I:20971520,V:104857600},e.isSimpleCos=!e.isPrivateNetWork(),e._fileDownloadProxy="",e._authKey="",e._fileDNList=nr;var t=e.getIEmitInst();return t.on(ne.A2KEY_AND_TINYID_UPDATED,e._init,e),t.on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function Aa(e){var t=!1;return Object.values(rr).includes(e)&&(t=!0),t=120001<=e&&e<=13e4||10100<=e&&e<=10200?!0:t}de(so,ce);var ur=b(so,[{key:"createTextMessage",value:function(n){var o=this.getMyUserID(),t=(n.currentUser=o,n.senderTinyID=this.getMyTinyID(),new Ce(n)),n=V(n.payload)?n.payload:n.payload.text,n=new Yo({text:n}),o=this._getNickAndAvatarByUserID(o);return t.setElement(n),t.setNickAndAvatar(o),t.setNameCard(this._getNameCardByGroupID(t)),t}},{key:"createImageMessage",value:function(e){var t=this.getMyUserID(),n=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),new Ce(e));if(X){var s=e.payload.file;if(st(s))return void this.warn("FileUnsupportedInMP","createImageMessage");var o=s.tempFiles[0].path||s.tempFiles[0].tempFilePath,s={url:o,name:o.slice(o.lastIndexOf("/")+1),size:s.tempFiles&&s.tempFiles[0].size||1,type:o.slice(o.lastIndexOf(".")+1).toLowerCase()};e.payload.file=s}else He?(s={url:(o=e.payload.file).uri,name:o.fileName,size:o.fileSize||1,type:o.type,width:o.width,height:o.height},e.payload.file=s):Ae&&(st(e.payload.file)?(o=e.payload.file,e.payload.file={files:[o]}):Q(e.payload.file)&&typeof uni<"u"&&(s=e.payload.file.tempFiles[0],e.payload.file={files:[s]}));return o=this.get(17).getFileDNList(),s=new bn({imageFormat:Dn.UNKNOWN,uuid:this._generateUUID(e.payload.file),file:e.payload.file},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),o),o=this._getNickAndAvatarByUserID(t),n.setElement(s),n.setNickAndAvatar(o),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createAudioMessage",value:function(e){var o=e.payload.file,t=(X&&(t={url:o.tempFilePath,name:o.tempFilePath.slice(o.tempFilePath.lastIndexOf("/")+1),size:o.fileSize,second:parseInt(o.duration)/1e3,type:o.tempFilePath.slice(o.tempFilePath.lastIndexOf(".")+1).toLowerCase()},e.payload.file=t),He&&(t={url:o.uri,name:o.uri.slice(o.uri.lastIndexOf("/")+1),size:o.fileSize||1,second:Math.floor(o.duration/1e3),type:o.uri.slice(o.uri.lastIndexOf(".")+1).toLowerCase()},e.payload.file=t,k(o.uri))&&this.warn("VoiceFileInRN"),this.getMyUserID()),s=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),this.get(17).getFileDNList()),n=new Ce(e),o=new wn({second:Math.floor(o.duration/1e3),size:o.fileSize||o.size||1,url:o.tempFilePath||o.uri,uuid:this._generateUUID(e.payload.file)},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),s),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"createVideoMessage",value:function(e){var t=this.getMyUserID(),o=(e.currentUser=t,e.senderTinyID=this.getMyTinyID(),e.payload.file.thumbUrl="",e.payload.file.thumbSize=0,{});if(X){if(st(e.payload.file))return void this.warn("FileUnsupportedInMP","createVideoMessage");var s=e.payload.file;O(s.tempFiles)&&(s=s.tempFiles[0]),o.url=s.tempFilePath,o.name=s.tempFilePath.slice(s.tempFilePath.lastIndexOf("/")+1),o.size=s.size||1,o.second=s.duration||0,o.type=this._getVideoFileType(s)}else He?(s=e.payload.file,o.url=s.uri,o.name=s.fileName,o.size=s.fileSize||1,o.second=s.duration||0,o.type=s.type.split("/")[1]):Ae&&(st(e.payload.file)?(s=e.payload.file,e.payload.file.files=[s]):Q(e.payload.file)&&typeof uni<"u"&&(s=e.payload.file.tempFile,e.payload.file.files=[s]),s=e.payload.file,o.url=window.URL.createObjectURL(s.files[0]),o.name=s.files[0].name,o.size=s.files[0].size||1,o.second=s.files[0].duration||0,o.type=s.files[0].type.split("/")[1]);e.payload.file.videoFile=o;var s=this.get(17).getFileDNList(),n=new Ce(e),o=new qn({videoFormat:o.type,videoSecond:nt(o.second,0),videoSize:o.size,remoteVideoUrl:"",videoUrl:o.url,videoUUID:this._generateUUID(e.payload.file.videoFile),thumbUUID:this._generateUUID(e.payload.file.videoFile,"jpg"),thumbWidth:e.payload.file.width||200,thumbHeight:e.payload.file.height||200,thumbUrl:e.payload.file.thumbUrl,thumbSize:e.payload.file.thumbSize,thumbFormat:"jpg"},this.getFileDownloadProxy(),this.getDownloadFileAuthKey(),s),s=this._getNickAndAvatarByUserID(t);return n.setElement(o),n.setNickAndAvatar(s),n.setNameCard(this._getNameCardByGroupID(n)),this._messageOptionsMap.set(n.clientSequence,e),n}},{key:"_getVideoFileType",value:function(e){var t=e.tempFilePath.slice(e.tempFilePath.lastIndexOf(".")+1).toLowerCase();return Be&&e.fileType||t}},{key:"createCustomMessage",value:function(n){var o=this.getMyUserID(),t=(n.currentUser=o,n.senderTinyID=this.getMyTinyID(),new Ce(n)),n=new jo({data:n.payload.data,description:n.payload.description,extension:n.payload.extension}),o=this._getNickAndAvatarByUserID(o);return t.setElement(n),t.setNickAndAvatar(o),t.setNameCard(this._getNameCardByGroupID(t)),t}},{key:"createFaceMessage",value:function(n){var o=this.getMyUserID(),t=(n.currentUser=o,n.senderTinyID=this.getMyTinyID(),new Ce(n)),n=new Wo(n.payload),o=this._getNickAndAvatarByUserID(o);return t.setElement(n),t.setNickAndAvatar(o),t.setNameCard(this._getNameCardByGroupID(t)),t}},{key:"createMergerMessage",value:function(o){var t=this.getMyUserID(),t=(o.currentUser=t,o.senderTinyID=this.getMyTinyID(),this._getNickAndAvatarByUserID(t)),n=new Ce(o),o=new xn(o.payload);return n.setElement(o),n.setNickAndAvatar(t),n.setNameCard(this._getNameCardByGroupID(n)),n.setRelayFlag(!0),n}},{key:"createForwardMessage",value:function(e){var t,n,o=e.to,s=e.conversationType,a=e.priority,i=e.payload,r=e.needReadReceipt,c=e.receiverList;return O(i._elements)?(t=this.getMyUserID(),n=this._getNickAndAvatarByUserID(t),i.type===g.MSG_GRP_TIP?v({code:y.MSG_FORWARD_TYPE_INVALID}):(s={to:o,conversationType:s,conversationID:"".concat(s).concat(o),priority:a,isPlaceMessage:0,status:Nn,currentUser:t,senderTinyID:this.getMyTinyID(),cloudCustomData:e.cloudCustomData||i.cloudCustomData||"",needReadReceipt:r,receiverList:c,isSupportExtension:e.isSupportExtension||!1},(o=new Ce(s)).setElement(i._elements[0]),o.setNickAndAvatar(n),o.setNameCard(this._getNameCardByGroupID(i)),o.setRelayFlag(!0),o)):v({code:y.MSG_FORWARD_INVALID_ELEMENTS})}},{key:"downloadMergerMessage",value:function(e){return this._mergerMessageHandler.downloadMergerMessage(e)}},{key:"createFileMessage",value:function(e){if(X){if(!Xe&&!Et&&!Be)return;var o=te.getSystemInfoSync().SDKVersion;if(Xe&&ta(o,"2.5.0")<0)return void this.warn("WXChooseMessageFile");if(Et&&ta(o,"1.18.0")<0)return void this.warn("QQChooseMessageFile")}Ae||Be?st(e.payload.file)?(o=e.payload.file,e.payload.file={files:[o]}):Q(e.payload.file)&&typeof uni<"u"&&(n=(o=e.payload.file).tempFiles,o=o.files,t=null,O(n)?t=n[0]:O(o)&&(t=o[0]),e.payload.file={files:[t]}):Xe||Et?(o=p(p({},(n=e.payload.file.tempFiles)[0]),{},{url:n[0].path}),e.payload.file={files:[o]}):He&&(n=p(p({},t=e.payload.file),{},{url:t.uri}),e.payload.file={files:[n]});var o=this.getMyUserID(),t=(e.currentUser=o,e.senderTinyID=this.getMyTinyID(),new Ce(e)),n=new Fn({uuid:this._generateUUID(e.payload.file),file:e.payload.file}),o=this._getNickAndAvatarByUserID(o);return t.setElement(n),t.setNickAndAvatar(o),t.setNameCard(this._getNameCardByGroupID(t)),this._messageOptionsMap.set(t.clientSequence,e),t}},{key:"createLocationMessage",value:function(n){var o=this.getMyUserID(),t=(n.currentUser=o,n.senderTinyID=this.getMyTinyID(),new Ce(n)),n=new Jo(n.payload),o=this._getNickAndAvatarByUserID(o);return t.setElement(n),t.setNickAndAvatar(o),t.setNameCard(this._getNameCardByGroupID(t)),t}},{key:"_onNoModule",value:function(){return v({code:y.NO_MODULE})}},{key:"sendMessageInstance",value:function(e,t){var n=this;if(this.get(29).filterMessage(e,t)===!1)return e.hasRiskContent=!0,this._onSendMessageFailed(e,new ie({code:y.PROFANITY_FOUND}));var o,s,a,i,r=null;if(e.conversationType===g.CONV_C2C)r=this.get(6);else{if(e.conversationType!==g.CONV_GROUP)return v({code:y.MSG_INVALID_CONV_TYPE});r=this.get(7)}return r?(s="".concat(this._n,".sendMessageInstance"),a=this.get(11),i=r.isOnlineMessage(e,t),this.get(17).upload(e).then(function(){return n._getSendMessageSpecifiedKey(e)===At&&n.get(26).addSuccessCount(Ye),n._guardForGroup(e).then(function(){if(!e.isSendable())return v({code:y.MSG_F_URL_IS_EMPTY});n._addSendMessageTotalCount(e),o=Date.now();var c=(function(u){var l="utf-8";Ae&&document&&(l=document.charset.toLowerCase());var _,m=0,f=u.length;if(l==="utf-8"||l==="utf8")for(var I=0;I<f;I++)(_=u.codePointAt(I))<=127?m+=1:_<=2047?m+=2:_<=65535?m+=3:(m+=4,I++);else if(l==="utf-16"||l==="utf16")for(var C=0;C<f;C++)(_=u.codePointAt(C))<=65535?m+=2:(m+=4,C++);else m=u.replace(/[^\x00-\xff]/g,"aa").length;return m})(JSON.stringify(e));return e.type===g.MSG_MERGER&&11264<c?n._mergerMessageHandler.uploadMergerMessage(e,c).then(function(u){return u=n._mergerMessageHandler.createMergerMessagePack(e,t,u),n.req(u)}):(a.setMessageRandom(e),r.sendMessage(e,t))}).then(function(m){var m=m.data,u=m.time,l=m.sequence,_=m.readReceiptCode,m=m.messageDropReason,m=(Y(_)&&_!==0&&(new D("sendMessageWithReceipt").setMessage("from:".concat(e.from," to:").concat(e.to," sequence:").concat(l," readReceiptCode:").concat(_)).end(),d.w("".concat(s," readReceiptCode:").concat(_," message:").concat(n.getErrMsg(_)))),m&&(_=new D("messageDropReason"),m="from:".concat(e.from," to:").concat(e.to," sequence:").concat(l," messageDropReason:").concat(m),_.setMessage(m).end(),d.w("".concat(s," ").concat(m))),n._addSendMessageSuccessCount(e,o),n._messageOptionsMap.delete(e.clientSequence),e.isResend===!0&&(_=a.findMessage(e.ID))&&(d.l("".concat(s," resend ok. ID:").concat(_.ID)),a.deleteLocalMessage(_)),e.status=je,e.time=u,!1);return e.conversationType===g.CONV_GROUP?e.sequence=l:e.conversationType===g.CONV_C2C&&(_=a.getLatestMessageSentByMe(e.conversationID))&&(u=_.nick,l=_.avatar,u===e.nick&&l===e.avatar||(m=!0)),m&&a.modifyMessageSentByMe({conversationID:e.conversationID,latestNick:e.nick,latestAvatar:e.avatar}),i===!0?e._onlineOnlyFlag=!0:(a.appendToMessageList(e),_=e,Q(t)&&Q(t.messageControlInfo)&&(t.messageControlInfo.excludedFromLastMessage===!0&&(e._isExcludedFromLastMessage=!0,_=""),t.messageControlInfo.excludedFromUnreadCount===!0)&&(e._isExcludedFromUnreadCount=!0),u=e.conversationType,he(e.to)&&(u=g.CONV_TOPIC,n.get(10).onMessageSent({groupID:_e(e.to),topicID:e.to,lastMessage:_})),a.onMessageSent({conversationOptionsList:[{conversationID:e.conversationID,unreadCount:0,type:u,subType:e.conversationSubType,lastMessage:_}]})),e._relayFlag||e.type!=="TIMImageElem"||na(e.payload.imageInfoArray),N({message:e})})}).catch(function(c){return n._onSendMessageFailed(e,c,i)})):this._onNoModule()}},{key:"_guardForGroup",value:function(e){if(e.conversationType!==g.CONV_GROUP)return Promise.resolve();var t=this.get(7);if(!t)return this._onNoModule();if(we({groupID:e.to})){var n=t.getLocalGroupProfile(e.to);if(n&&n.isSupportTopic)return v({code:y.MSG_SEND_GRP_WITH_TOPIC_FAIL})}return t.guardForAVChatRoom(e)}},{key:"_onSendMessageFailed",value:function(e,t){var s=2<arguments.length&&arguments[2]!==void 0&&arguments[2],n="".concat(this._n,"._onSendMessageFailed"),o=(e.status=Bo,t.code!==80001&&t.code!==80004||(e.hasRiskContent=!0),this.get(11)),a=(o.deleteMessageRandom(e),10100<=t.code&&t.code<=10200||120001<=t.code&&t.code<=13e4),s=(s||a||o.appendToMessageList(e)===!0&&d.l("".concat(n," message stored, ID:").concat(e.ID)),this._addSendMessageFailCountOnUser(e,t),new D("sendMessage")),a="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to);return Ae&&("connection"in navigator&&(o=navigator.connection,a+=" downlink:".concat(o.downlink," effectiveType:").concat(o.effectiveType," rtt:").concat(o.rtt)),"memory"in window.performance)&&(o=window.performance.memory,a+=" usedJSHeapSize:".concat(o.usedJSHeapSize," totalJSHeapSize:").concat(o.totalJSHeapSize," jsHeapSizeLimit:").concat(o.jsHeapSizeLimit)),s.setMessage(a).setError(t).end(),d.e("".concat(n," ").concat(a," error:"),t),v(new ie({code:t&&t.code?t.code:y.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if([g.MSG_IMAGE,g.MSG_AUDIO,g.MSG_VIDEO,g.MSG_FILE].includes(e.type))return At;if(e.conversationType===g.CONV_C2C)return Bt;if(e.conversationType===g.CONV_GROUP){var t=this.get(7);if(t&&(t=t.getLocalGroupProfile(e.to),t))return e=t.type,be(e)?Kt:Ht}}},{key:"_addSendMessageTotalCount",value:function(e){e=this._getSendMessageSpecifiedKey(e),e&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(o,t){var n,o=this._getSendMessageSpecifiedKey(o);o&&((n=this.get(26)).addSuccessCount(o),n.addCost(o,ye(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(a,o){var n,o=o.code,o=o===void 0?-1:o,s=this.get(26),a=this._getSendMessageSpecifiedKey(a);a===At&&(n=!1,n=cr.includes(o)?!0:n)?s.addFailedCountOfUserSide(Ye):Aa(o)&&a&&s.addFailedCountOfUserSide(a)}},{key:"resendMessage",value:function(e,t){return e.isResend=!0,e.status=Nn,this.sendMessageInstance(e,t)}},{key:"revokeMessage",value:function(e){var t,n,o=this,s=null;return e.conversationType===g.CONV_C2C?s=this.get(6):e.conversationType===g.CONV_GROUP&&(s=this.get(7)),s?((t=new D("revokeMessage")).setMessage("type:".concat(e.type," from:").concat(e.from," to:").concat(e.to)),n="".concat(this._n,".").concat("revokeMessage"),s.revokeMessage(e).then(function(i){var i=i.data.recallRetList;return k(i)||i[0].retCode===0?(d.i("".concat(n," ok. ID:").concat(e.ID)),e.isRevoked=!0,t.end(),o.get(11).onMessageRevoked([e]),N({message:e})):(i=new ie({code:i[0].retCode,data:{message:e}}),t.setCode(i.code).setMoreMessage(i.message).end(),v(i))}).catch(function(a){t.setError(a).end();var i=new ie({code:a&&a.code?a.code:y.MSG_REVOKE_FAIL,message:a&&a.message?a.message:void 0,data:{message:e}});return d.w("".concat(n," failed. error:"),a),v(i)})):this._onNoModule()}},{key:"deleteMessage",value:function(e){var t=this,n=null,o=e[0],s=o.conversationID,a="",i=[],r=[];if(o.conversationType===g.CONV_C2C)n=this.get(6),a=s.replace(g.CONV_C2C,""),e.forEach(function(l){l&&l.status===je&&l.conversationID===s&&(l._onlineOnlyFlag||i.push("".concat(l.sequence,"_").concat(l.random,"_").concat(l.time)),r.push(l))});else if(o.conversationType===g.CONV_GROUP)n=this.get(7),a=s.replace(g.CONV_GROUP,""),e.forEach(function(l){l&&l.status===je&&l.conversationID===s&&(l._onlineOnlyFlag||i.push("".concat(l.sequence)),r.push(l))});else if(o.conversationType===g.CONV_SYSTEM)return v({code:y.CANNOT_DELETE_GRP_SYSTEM_NOTICE});if(!n)return this._onNoModule();if(i.length===0)return this._onMessageDeleted(r);30<i.length&&(i=i.slice(0,30),r=r.slice(0,30));var c=new D("deleteMessage"),u=(c.setMessage("to:".concat(a," count:").concat(i.length)),"".concat(this._n,".").concat("deleteMessage"));return n.deleteMessage({to:a,keyList:i}).then(function(l){return c.end(),d.i("".concat(u," ok")),t._onMessageDeleted(r)}).catch(function(l){return c.setError(l).end(),d.w("".concat(u," failed. error:"),l),l=new ie({code:l&&l.code?l.code:y.MSG_DELETE_FAIL,message:l&&l.message?l.message:void 0}),v(l)})}},{key:"_onMessageDeleted",value:function(e){return this.get(11).onMessageDeleted(e),q({messageList:e})}},{key:"translateText",value:function(s){var t="".concat(this._n,".").concat("translateText"),n=s.sourceTextList,o=s.sourceLanguage,s=s.targetLanguage,a=new D("translateText");return a.setMessage("sourceLanguage:".concat(o," targetLanguage:").concat(s)),this.req({P:h.TRANSLATE_TEXT,data:{sourceTextList:n,source:o||"auto",target:s,from:this.getMyTinyID(),SDKAppID:this.getSDKAppID()}}).then(function(u){var u=u.data,r=u.error,c=u.requestID,u=u.translatedTextList;if(r.code===0)return a.end(),d.i("".concat(t," ok. requestID:").concat(c)),N({translatedTextList:u});throw p(p({},r),{},{requestID:c})}).catch(function(i){return a.setCode(i.code).setMoreMessage(i.requestID).end(),d.w("".concat(t," failed. error:"),i),v({code:i.code||y.TRANSLATE_TEXT_FAIL,message:i.message})})}},{key:"convertVoiceToText",value:function(s){var t,n,o,i=s.message,s=s.language,a=i.payload.url,i=(i.from===this.getMyUserID()&&i.flow==="out"&&(a=i.payload.remoteAudioUrl),/\.(wav|pcm|ogg-opus|speex|silk|mp3|m4a|aac|amr)/);return i.test(a)?(i=i.exec(a)[1]||"mp3",t="16k_zh-PY",s?s==="zh (cmn-Hans-CN)"?t="16k_zh":s==="en-US"?t="16k_en":s==="yue-Hant-HK"?t="16k_yue":s==="ja-JP"&&(t="16k_ja"):t="16k_zh-PY",s="serviceType:".concat(t," url:").concat(a),n="".concat(this._n,".").concat("convertVoiceToText"),d.i("".concat(n," ").concat(s)),(o=new D("convertVoiceToText")).setMessage(s),this.req({P:h.VOICE_TO_TEXT,data:{url:a,language:t,SDKAppID:this.getSDKAppID(),format:i}}).then(function(l){var l=l.data,c=l.error,u=l.requestID,l=l.result;if(c.code===0)return o.end(),d.i("".concat(n," ok. requestID:").concat(u)),N({result:l});throw p(p({},c),{},{requestID:u})}).catch(function(r){return o.setCode(r.code).setMoreMessage(r.requestID||"").end(),d.w("".concat(n," failed. error:"),r),v({code:y.VOICE_TO_TEXT_FAIL})})):v({code:y.UNSUPPORTED_VOICE_FORMAT})}},{key:"modifyRemoteMessage",value:function(e){var t=this;if(this.get(29).filterMessage(e)===!1)return e.hasRiskContent=!0,v({code:y.PROFANITY_FOUND,data:{message:e}});var n=null,o=e.conversationType,s=e.to;if(o===g.CONV_C2C)n=this.get(6);else if(o===g.CONV_GROUP){if(!(n=this.get(7)))return this._onNoModule();if(n.isMessageFromOrToAVChatroom(s))return v({code:y.MSG_MODIFY_DISABLED_IN_AV,data:{message:e}})}var a=new D("modifyMessage"),i=(a.setMessage("to:".concat(s)),"".concat(this._n,".modifyRemoteMessage"));return n.modifyRemoteMessage(e).then(function(r){return a.end(),d.i("".concat(i," ok")),r=t._onModifyRemoteMessageResp(e,r.data),N({message:r})}).catch(function(r){var c;return a.setCode(r.code).setMoreMessage(r.message).end(),d.w("".concat(i," failed. error:"),r),r.code===20027?(c=t._onModifyRemoteMessageResp(e,r.data),v({code:y.MSG_MODIFY_CONFLICT,data:{message:c}})):v({code:r.code,message:r.message,data:{message:e}})})}},{key:"_onModifyRemoteMessageResp",value:function(r,l){d.d("".concat(this._n,"._onModifyRemoteMessageResp options:"),l);var n=r.conversationType,o=r.from,s=r.to,a=r.random,i=r.sequence,r=r.time,c=l.elements,u=l.messageVersion,l=l.cloudCustomData,l=l===void 0?"":l;return this.get(11).onMessageModified({conversationType:n,from:o,to:s,time:r,random:a,sequence:i,elements:c,cloudCustomData:l,messageVersion:u})}},{key:"_generateUUID",value:function(e,t){var n=this.get(12),n="".concat(n.getSDKAppID(),"-").concat(n.getUserID(),"-").concat((function(){for(var o="",s=32;0<s;--s)o+=Xs[Math.floor(Math.random()*li)];return o})());return(t=t||(e=(t=O((t=e).files)?e.files[0]:t).name||t.value||t.url||t.tempFilePath)&&e.slice(e.lastIndexOf(".")+1))?"".concat(n,".").concat(t):n}},{key:"getMessageOption",value:function(e){return this._messageOptionsMap.get(e)}},{key:"_getNickAndAvatarByUserID",value:function(e){return this.get(4).getNickAndAvatarByUserID(e)}},{key:"_getNameCardByGroupID",value:function(e){if(e.conversationType===g.CONV_GROUP){var t=this.get(7);if(t)return t.getMyNameCardByGroupID(e.to)}return""}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._messageOptionsMap.clear()}}]),lr=(de(oo,ce),b(oo,[{key:"onMsgExtNotify",value:function(a){var t=this,a=a.dataList,r=a.messageInfo,n=a.operateType,o=a.operateResultList,s=a.tinyID,a=a.globalSequence,i=r.clientTime,r=r.random,c="".concat(s,"-").concat(i,"-").concat(r),u=[],l=[],_=(d.l("".concat(this._n,".onMsgExtNotify messageID:").concat(c," operateType:").concat(n," globalSequence:").concat(a)),this._updateGlobalSeq(c,a),!1),m=!1;o.forEach(function(f){var I=f.extensions,I=I===void 0?[]:I,C=f.clearSequence;n===1?(_=!0,I.forEach(function(M){u.push({key:M.key,value:M.value})}),t._updateLocalExt(c,I)):n===2?(m=!0,I.forEach(function(M){l.push(M.key)}),t._updateLocalExt(c,I)):n===3&&(m=!0,t._hasLocalExt(c)&&t._getLocalExt(c).forEach(function(M,S){M.seq<=C&&!k(M.value)&&l.push(S)}),t._clearLocalExt(c,C))}),_&&this.emitOEvt(F.MESSAGE_EXTENSIONS_UPDATED,{messageID:c,extensions:u}),m&&this.emitOEvt(F.MESSAGE_EXTENSIONS_DELETED,{messageID:c,keyList:l})}},{key:"setMessageExtensions",value:function(e,t){var n,o,s,a,i,r,c,u="setMessageExtensions";return this.canIUse(ee.MSG_EXT)?(n="".concat(this._n,".").concat(u),o=e.ID,s=e.conversationID,a=e.sequence,i=e.time,r=G(t),20<t.length&&(r=t.slice(0,20),d.w("".concat(n,". the length of extensions cannot exceed 20."))),t="convID:".concat(s," messageID:").concat(o," sequence:").concat(a," time:").concat(i," count:").concat(r.length),(c=new D(u)).setMessage(t),d.l("".concat(n," ").concat(t)),this._modifyMsgExts(e,r).then(function(m){var _=m.resultList,f=m.successCount,m=m.failureCount,f="successCount:".concat(f," failCount:").concat(m);return c.setMoreMessage(f).end(),d.l("".concat(n," ok. ").concat(f)),N({extensions:_})}).catch(function(l){return c.setError(l).end(),d.e("".concat(n," failed. error:"),l),v(l)})):this.noUse(u)}},{key:"getMessageExtensions",value:function(e){var t,n,o,s,a,i,r,c=this,u="getMessageExtensions";return this.canIUse(ee.MSG_EXT)?(t="".concat(this._n,".").concat(u),n=e.ID,a=e.conversationID,o=e.sequence,s=e.time,a="convID:".concat(a," messageID:").concat(n," sequence:").concat(o," time:").concat(s),(i=new D(u)).setMessage(a),r=void d.l("".concat(t," ").concat(a)),this.getMsgExtsMap.has(n)&&(r=this._getGlobalSeq(n)),this._getMsgExts(e,r).then(function(l){return i.end(),d.l("".concat(t," ok. extCount:").concat(l.length)),T(r)&&0<l.length&&c.getMsgExtsMap.set(n,1),N({extensions:l})}).catch(function(l){return i.setError(l).end(),d.e("".concat(t," failed. error:"),l),v(l)})):this.noUse(u)}},{key:"deleteMessageExtensions",value:function(e,t){var n,o,s,a,i,r,c,u="deleteMessageExtensions";return this.canIUse(ee.MSG_EXT)?(n="".concat(this._n,".").concat(u),o=[],s=3,k(t)||(s=2,t.forEach(function(l){o.push({key:l,value:"",seq:0})})),t=e.ID,r=e.conversationID,a=e.sequence,i=e.time,r="convID:".concat(r," messageID:").concat(t," sequence:").concat(a," time:").concat(i," operateType:").concat(s),(c=new D(u)).setMessage(r),d.l("".concat(n," ").concat(r)),this._modifyMsgExts(e,o,s).then(function(f){var _=f.resultList,m=f.successCount,f=f.failureCount,I="";return s===2&&(I="success count:".concat(m," fail count:").concat(f)),c.setMoreMessage("".concat(I)).end(),d.l("".concat(n," ok. ").concat(I)),N({extensions:_})}).catch(function(l){return c.setError(l).end(),d.e("".concat(n," failed. error:"),l),v(l)})):this.noUse(u)}},{key:"_modifyMsgExts",value:function(e,t){var n=this,o=2<arguments.length&&arguments[2]!==void 0?arguments[2]:1,s=he(e.to)?g.CONV_TOPIC:e.conversationType,a=void 0,i=(o!==3&&(a=this._getReqExts(e,t)),null);switch(s){case g.CONV_C2C:i=this.get(6);break;case g.CONV_GROUP:i=this.get(7);break;case g.CONV_TOPIC:i=this.get(10);break;default:return v({code:y.NO_MODULE})}return i.modifyMsgExts(e,a,o).then(function(u){var u=u.data,c=u.extensions,u=u.seq,l=[],_=0,m=0,f=[];return(c=k(c)?[]:c).forEach(function(L){var C=L.errorCode,L=L.extension,M=L.key,S=L.value,L=L.seq;l.push({code:C,key:M,value:S}),C===0?_++:m++,f.push({key:M,value:S,seq:L})}),n._updateGlobalSeq(e.ID,u),0<f.length&&(n._updateLocalExt(e.ID,f),f=null),{resultList:l,successCount:_,failureCount:m}}).catch(function(r){return v(r)})}},{key:"_getReqExts",value:function(e,t){var n,o=[];return this._hasLocalExt(e.ID)?(n=this._getLocalExt(e.ID),t.forEach(function(i){var a=i.key,i=i.value,r=0;n.has(a)&&(r=n.get(a).seq),o.push({key:a,value:i,seq:r})})):t.forEach(function(i){var a=i.key,i=i.value;o.push({key:a,value:i,seq:0})}),o}},{key:"_getMsgExts",value:function(e,t){var n=this,o="".concat(this._n,"._getMsgExts"),s=e.ID,a=e.to,i=null;switch(he(a)?g.CONV_TOPIC:e.conversationType){case g.CONV_C2C:i=this.get(6);break;case g.CONV_GROUP:i=this.get(7);break;case g.CONV_TOPIC:i=this.get(10);break;default:return v({code:y.NO_MODULE})}return i.getMessageExtensions(e,t).then(function(l){var l=l.data,_=l.extensions,c=l.completeFlag,u=l.globalSequence,l=l.clearSequence,_=k(_)?[]:_;return d.l("".concat(o," ok. completeFlag:").concat(c," globalSequence:").concat(u," clearSequence:").concat(l," count:").concat(_.length)),n._updateLocalExt(s,_),n._clearLocalExt(s,l),n._updateGlobalSeq(s,u),c!==1?(l=_.slice(-1)[0].seq+1,n._getMsgExts(e,l)):n._getLocalExtList(s)}).catch(function(r){return v(r)})}},{key:"_hasLocalExt",value:function(e){return this.msgExtMap.has(e)}},{key:"_getLocalExt",value:function(e){return this.msgExtMap.get(e)}},{key:"_updateLocalExt",value:function(e,t){this._hasLocalExt(e)||this.msgExtMap.set(e,new Map);var n=this._getLocalExt(e);t.forEach(function(i){var s=i.key,a=i.value,i=i.seq;n.set(s,{value:a===void 0?"":a,seq:i})})}},{key:"_clearLocalExt",value:function(e,t){var n;t<=0||!this._hasLocalExt(e)||(n=this._getLocalExt(e)).forEach(function(o,s){o.seq<=t&&n.delete(s)})}},{key:"_getLocalExtList",value:function(e){var t=[];return this._hasLocalExt(e)&&this._getLocalExt(e).forEach(function(n,o){n=n.value,k(n)||t.push({key:o,value:n})}),t}},{key:"_getGlobalSeq",value:function(e){return this.globalSeqMap.get(e)}},{key:"_updateGlobalSeq",value:function(e,t){this.globalSeqMap.set(e,t)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this.msgExtMap.clear(),this.globalSeqMap.clear(),this.getMsgExtsMap.clear()}}])),dr=(de(no,ce),b(no,[{key:"onReactionNotifyList",value:function(n){var t=this,n=(n||{}).dataList;(n===void 0?[]:n).forEach(function(s){var i=s.C2CMessageInfo,r=s.groupMessageInfo,r=r===void 0?{}:r,s=s.reactionList,s=s===void 0?[]:s,i=p(p({},i===void 0?{}:i),r),r=i.tinyID,a=i.clientTime,i=i.random,r="".concat(r,"-").concat(a,"-").concat(i),c=[];s.forEach(function(u){T(u.userIDList)&&(u.userIDList=[],u.count=0),c.push.apply(c,G(u.userIDList))}),d.l("".concat(t._n,".onReactionNotifyList messageID:").concat(r," reactionList:").concat(s.length)),t._handleReactionSummary([{messageID:r,reactionList:s}],c).then(function(u){t.emitOEvt(F.MESSAGE_REACTIONS_UPDATED,p({},u[0]))})})}},{key:"onReactionNotify",value:function(n){var n=n.dataList||{},o=n.C2CMessageInfo,s=n.groupMessageInfo,s=s===void 0?{}:s,t=n.reactionID,n=n.operateType,o=p(p({},o===void 0?{}:o),s),s=o.tinyID,a=o.clientTime,o=o.random,s="".concat(s,"-").concat(a,"-").concat(o),a=(d.l("".concat(this._n,".onReactionNotify messageID:").concat(s," reactionID:").concat(t," operateType:").concat(n)),n===1?this._addReactedByMyselfMap(s,t):this._removeReactedByMyselfMap(s,t),"".concat(s,"-").concat(t));this._reactionInfoMap.has(a)&&((o=this._reactionInfoMap.get(a)).reactedByMyself=n===1,this.emitOEvt(F.MESSAGE_REACTIONS_UPDATED,{messageID:s,reactionList:[o]}))}},{key:"addMessageReaction",value:function(e,t){var n,o,s,a,i=this,r="addMessageReaction";return this.canIUse(ee.MSG_REACTION)?(n="".concat(this._n,".").concat(r),a=e.ID,o=e.conversationID,o="convID:".concat(o," messageID:").concat(a," reactionID:").concat(t),(s=new D(r)).setMessage(o),d.l("".concat(n," ").concat(o)),a=this._createReactionOperationPack(e,t,1),this._addReactedByMyselfMap(e.ID,t),this.req(a).then(function(){return s.end(),d.l("".concat(n," ok.")),N()}).catch(function(c){return i._removeReactedByMyselfMap(e.ID,t),s.setError(c).end(),d.e("".concat(n," failed. error:"),c),v(c)})):this.noUse(r)}},{key:"removeMessageReaction",value:function(e,t){var n,o,s,a,i="removeMessageReaction";return this.canIUse(ee.MSG_REACTION)?(n="".concat(this._n,".").concat(i),a=e.ID,o=e.conversationID,o="convID:".concat(o," messageID:").concat(a," reactionID:").concat(t),(s=new D(i)).setMessage(o),d.l("".concat(n," ").concat(o)),a=this._createReactionOperationPack(e,t,2),this._removeReactedByMyselfMap(e.ID,t),this.req(a).then(function(){return s.end(),d.l("".concat(n," ok.")),N()}).catch(function(r){return s.setError(r).end(),d.e("".concat(n," failed. error:"),r),v(r)})):this.noUse(i)}},{key:"getMessageReactions",value:function(e){var t,n,o,s,a,i,r=this,c="getMessageReactions";return this.canIUse(ee.MSG_REACTION)?(t="".concat(this._n,".").concat(c),n=e.messageList,i=e.maxUserCountPerReaction,o=n[0].conversationID,o="convID:".concat(o," maxUserCountPerReaction:").concat(i," msgCount:").concat(n.length),(s=new D(c)).setMessage(o),d.l("".concat(t," ").concat(o)),a=new Map,i=this._createReactionSummaryPack(p(p({},e),{},{messageIDMap:a})),this.req(i).then(function(l){var l=l.data.resultList,_=[],m=[];return(l===void 0?[]:l).forEach(function(C){var I=C.messageKey,I=I===void 0?void 0:I,M=C.messageSequence,M=M===void 0?void 0:M,C=C.reactionList,C=C===void 0?[]:C,M=T(I)?a.get(M):a.get(I);_.push({messageID:M,reactionList:C}),C.forEach(function(S){m.push.apply(m,G(S.userIDList))})}),r._handleReactionSummary(_,m)}).then(function(u){return s.end(),d.l("".concat(t," ok.")),a.clear(),N({resultList:u})}).catch(function(u){return s.setError(u).end(),d.e("".concat(t," failed. error:"),u),v(u)})):this.noUse(c)}},{key:"getAllUserListOfMessageReaction",value:function(e){var t,n,o,s,a,i,r,c,u=this,l="getAllUserListOfMessageReaction";return this.canIUse(ee.MSG_REACTION)?(t="".concat(this._n,".").concat(l),a=e.message,n=e.reactionID,o=e.nextSeq,s=e.count,c=a.ID,a=a.conversationID,a="convID:".concat(a," messageID:").concat(c," reactionID:").concat(n," nextSeq:").concat(o," count:").concat(s),(i=new D(l)).setMessage(a),d.l("".concat(t," ").concat(a)),r={userList:[],nextSeq:0,isCompleted:!1},c=this._createReactionUserListPack(e),this.req(c).then(function(f){var f=f.data,m=f.userIDList,m=m===void 0?[]:m,f=f.nextSeq,f=f===void 0?0:f;return r.nextSeq=f,r.isCompleted=f===0,u.get(4).getUserNickAndAvatar(m)}).then(function(_){return r.userList=_,i.end(),d.l("".concat(t," ok.")),N(r)}).catch(function(_){return i.setError(_).end(),d.e("".concat(t," failed. error:"),_),v(_)})):this.noUse(l)}},{key:"_createReactionOperationPack",value:function(e,i,n){var o,s,a=void 0,i={reactionID:i,userIDList:[this.getMyUserID()]};return e.conversationType===g.CONV_C2C&&(o=this.get(6),a=n===1?h.ADD_C2C_MSG_REACTION:h.RM_C2C_MSG_REACTION,i.from=e.from,i.to=e.to,i.messageKey=o.getMessageKey(e)),e.conversationType===g.CONV_GROUP&&(o=void 0,s=e.to,he(e.to)&&(s=_e(o=e.to)),a=n===1?h.ADD_GRP_MSG_REACTION:h.RM_GRP_MSG_REACTION,i.groupID=s,i.topicID=o,i.messageSequence=e.sequence),{P:a,data:i}}},{key:"_createReactionSummaryPack",value:function(r){var t,n,o,s=r.messageList,a=r.maxUserCountPerReaction,a=a===void 0?10:a,i=r.messageIDMap,r=s[0],c=void 0,u=void 0;return r.conversationType===g.CONV_C2C&&(t=this.get(6),n=s.map(function(l){var _=t.getMessageKey(l);return i.set(_,l.ID),_}),c=h.GET_C2C_MSG_REACTIONS,u={from:r.from,to:r.to,messageKeyList:n,count:a}),r.conversationType===g.CONV_GROUP&&(n=void 0,o=r.to,he(r.to)&&(o=_e(n=r.to)),r=s.map(function(l){return i.set(l.sequence,l.ID),l.sequence}),c=h.GET_GRP_MSG_REACTIONS,u={groupID:o,topicID:n,messageSequenceList:r,count:a}),{P:c,data:u}}},{key:"_createReactionUserListPack",value:function(o){var t=o.message,a=o.reactionID,n=o.nextSeq,o=o.count,o=o===void 0?100:o,s=void 0,a={reactionID:a,nextSeq:n===void 0?0:n,count:100<o?100:o};return t.conversationType===g.CONV_C2C&&(n=this.get(6),s=h.GET_C2C_MSG_REACTION_USER_LIST,a.from=t.from,a.to=t.to,a.messageKey=n.getMessageKey(t)),t.conversationType===g.CONV_GROUP&&(o=void 0,n=t.to,he(t.to)&&(n=_e(o=t.to)),s=h.GET_GRP_MSG_REACTION_USER_LIST,a.groupID=n,a.topicID=o,a.messageSequence=t.sequence),{P:s,data:a}}},{key:"_handleReactionSummary",value:function(e,t){var n=this;return this.get(4).getUserNickAndAvatar(t).then(function(o){var s=[];return e.forEach(function(a){var i=[];a.reactionList.forEach(function(l){var c=l.reactionID,u=l.count,m=l.userIDList,l=l.reactedByMyself,l=l===void 0?void 0:l,_=[],m=(m.forEach(function(f){o.forEach(function(I){f===I.userID&&_.push(I)})}),{reactionID:c,totalUserCount:u,partialUserList:_,reactedByMyself:n._computeReactedByMyself({reactedByMyself:l,messageID:a.messageID,reactionID:c})});i.push(m),T(l)&&!n._reactedByMyselfMap.has(a.messageID)&&(u="".concat(a.messageID,"-").concat(c),n._reactionInfoMap.set(u,m))}),s.push({messageID:a.messageID,reactionList:i})}),s})}},{key:"_addReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)||this._reactedByMyselfMap.set(e,[]),e=this._reactedByMyselfMap.get(e),e.indexOf(t)===-1&&e.push(t)}},{key:"_removeReactedByMyselfMap",value:function(e,t){this._reactedByMyselfMap.has(e)&&-1<(t=(e=this._reactedByMyselfMap.get(e)).indexOf(t))&&e.splice(t,1)}},{key:"_computeReactedByMyself",value:function(o){var t=o.reactedByMyself,n=o.messageID,o=o.reactionID;return T(t)?!!this._reactedByMyselfMap.has(n)&&this._reactedByMyselfMap.get(n).includes(o):t===1}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._reactedByMyselfMap.clear(),this._reactionInfoMap.clear()}}])),pr=(de(to,ce),b(to,[{key:"sendMessage",value:function(e){var t=this,n=this._createMsg(e);if(n===null)return v({code:y.MSG_SEND_FAIL});this._addSendMessageTotalCount(n);var o=Date.now();return this.get(11).setMessageRandom(n),this._sendComboMessage(n,e).then(function(i){var i=i.data,r=i.time,a=i.sequence,i=i.readReceiptCode,i=(Y(i)&&i!==0&&(new D("sendMessageWithReceipt").setMessage("from:".concat(n.from," to:").concat(n.to," sequence:").concat(a," readReceiptCode:").concat(i)).end(),d.w("".concat(t._n,".sendMessage readReceiptCode:").concat(i," message:").concat(t.getErrMsg(i)))),t._addSendMessageSuccessCount(n,o),t.get(11)),r=(n.status=je,n.time=r,n.conversationType===g.CONV_GROUP&&(n.sequence=a),i.appendToMessageList(n),n);return n._isExcludedFromLastMessage===!0&&(r=""),i.onMessageSent({conversationOptionsList:[{conversationID:n.conversationID,unreadCount:0,type:n.conversationType,subType:n.conversationSubType,lastMessage:r}]}),N({message:n})}).catch(function(s){return t._onSendMessageFailed(n,s)})}},{key:"_sendComboMessage",value:function(e,t){var n=this._m.get(20),o="";return e.conversationType===g.CONV_C2C&&(o="".concat(E.NAME.OPEN_IM,".").concat(h.SEND_C2C_MSG)),e.conversationType===g.CONV_GROUP&&(o="".concat(E.NAME.GRP,".").concat(h.SEND_GRP_MSG)),n.sendComboMessage({servcmd:o,data:t})}},{key:"_createMsg",value:function(e){var t="".concat(this._n,"._createMsg"),n=null;try{var o,s=this.getMyUserID(),a=this.get(4),i={};i.senderTinyID=this.getMyTinyID(),i.currentUser=s,i.from=e.From_Account||s,i.level=a.getMyLevel(),e.GroupId?(i.conversationID="".concat(g.CONV_GROUP).concat(e.GroupId),i.conversationType=g.CONV_GROUP,i.to=e.GroupId):e.To_Account&&(i.conversationID="".concat(g.CONV_C2C).concat(e.To_Account),i.conversationType=g.CONV_C2C,i.to=e.To_Account),i.time=e.MsgTimeStamp||0,i.random=e.Random||e.MsgRandom||0,i.priority=e.MsgPriority,V(e.CloudCustomData)&&0<e.CloudCustomData.length&&(i.cloudCustomData=e.CloudCustomData),O(e.SendMsgControl)&&(i.messageControlInfo={},e.SendMsgControl.includes("NoUnread")&&(i.messageControlInfo.excludedFromUnreadCount=1),e.SendMsgControl.includes("NoLastMsg"))&&(i.messageControlInfo.excludedFromLastMessage=1),i.conversationType===g.CONV_GROUP&&O(e.To_Account)&&0<e.To_Account.length&&(o=e.To_Account,50<e.To_Account.length&&(o=e.To_Account.slice(0,50),d.w("".concat(t," To_Account must be less than or equal to 50."))),i.receiverList=G(o),e.To_Account=G(o)),e.IsNeedReadReceipt!==1&&e.NeedReadReceipt!==1||(i.needReadReceipt=!0),e.SupportMessageExtension===1&&(i.isSupportExtension=!0),(n=new Ce(i)).status=Nn,e.MsgClientTime=n.clientTime,n.conversationType===g.CONV_C2C&&(e.MsgSeq=n.sequence);for(var r,c=e.MsgBody.length,u=0;u<c;u++)(r=e.MsgBody[u]).MsgType==="TIMTextElem"?n.setTextElement(r.MsgContent.Text):r.MsgType==="TIMCustomElem"?n.setCustomElement({data:r.MsgContent.Data||"",description:r.MsgContent.Desc||"",extension:r.MsgContent.Ext||""}):r.MsgType==="TIMFaceElem"&&n.setFaceElement({index:r.MsgContent.Index,data:r.MsgContent.Data});var l=n.getElements();n.payload=l[0].content,n.type=l[0].type}catch(_){n=null,d.e("".concat(t," failed. error:"),_)}return n}},{key:"_onSendMessageFailed",value:function(e,t){e.status=Bo,this.get(11).deleteMessageRandom(e),this._addSendMessageFailCountOnUser(e,t);var n=new D("sendMessage"),o="head.seq:".concat(t.data.headSeq," type:").concat(e.type," from:").concat(e.from," to:").concat(e.to);return n.setMessage(o).setError(t).end(),d.e("".concat(this._n,"._onSendMessageFailed ").concat(o," error:"),t),v(new ie({code:t&&t.code?t.code:y.MSG_SEND_FAIL,message:t&&t.message?t.message:void 0,data:{message:e}}))}},{key:"_getSendMessageSpecifiedKey",value:function(e){if(e.conversationType===g.CONV_C2C)return Bt;if(e.conversationType===g.CONV_GROUP){var e=this.get(7).getLocalGroupProfile(e.to);if(e)return e=e.type,be(e)?Kt:Ht}}},{key:"_addSendMessageTotalCount",value:function(e){e=this._getSendMessageSpecifiedKey(e),e&&this.get(26).addTotalCount(e)}},{key:"_addSendMessageSuccessCount",value:function(o,t){var n,o=this._getSendMessageSpecifiedKey(o);o&&((n=this.get(26)).addSuccessCount(o),n.addCost(o,ye(t,!1)))}},{key:"_addSendMessageFailCountOnUser",value:function(s,n){var n=n.code,n=n===void 0?-1:n,o=this.get(26),s=this._getSendMessageSpecifiedKey(s);Aa(n)&&s&&o.addFailedCountOfUserSide(s)}}])),_r=(de(eo,ce),b(eo,[{key:"registerPlugin",value:function(e){var t=this,n="0";Object.keys(e).forEach(function(o){t.plugins[o]=e[o],o==="tim-upload-plugin"&&typeof e[o].getVersion=="function"&&(n=e[o].getVersion())}),new D("registerPlugin").setMessage("".concat(Object.keys(e))).setMoreMessage("version:".concat(n)).end()}},{key:"getPlugin",value:function(e){return this.plugins[e]}},{key:"reset",value:function(){}}])),gr=(de($n,ce),b($n,[{key:"_init",value:function(){this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"_startSync",value:function(e){var t=this,n=e.cookie,o=e.syncFlag,s=e.isOnlineSync,a="".concat(this._n,"._startSync"),i=(d.l("".concat(a," options:"),e),new D("syncUnread"));i.setMessage(JSON.stringify(e)),this.req({P:h.SYNC_UNREAD_MSG,data:{cookie:n,syncFlag:o,isOnlineSync:s}}).then(function(r){var u=r.data,c=u.cookie,u=u.syncFlag,l="$cookie:".concat(c," syncFlag:").concat(u);d.l("".concat(a," ok. ").concat(l)),t._cookie=c,i.setMoreMessage(l).end(),k(c)||(u===0||u===1?(t._dispatch(p(p({},r.data),{},{isSyncingEnded:!1})),t._startSync({cookie:c,syncFlag:u,isOnlineSync:0})):u===2&&t._dispatch(p(p({},r.data),{},{isSyncingEnded:!0})))}).catch(function(r){i.setError(r).end(),d.e("".concat(a," failed. error:"),r)})}},{key:"_dispatch",value:function(e){e.eventArray&&this.get(20).onMessage({head:{},body:{eventArray:e.eventArray,isInstantMessage:this._onlineSyncFlag,isSyncingEnded:e.isSyncingEnded}}),this.get(6).onNewMessage({dataList:e.messageList,isInstantMessage:!!e.isSyncingEnded&&this._onlineSyncFlag,C2CRemainingUnreadList:e.C2CRemainingUnreadList,C2CPairUnreadList:e.C2CPairUnreadList,isSyncingEnded:e.isSyncingEnded,isOnlineSync:this._onlineSyncFlag})}},{key:"syncOnNeed",value:function(){d.l("".concat(this._n,".syncOnNeed cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:1})}},{key:"syncOnReconnected",value:function(){d.l("".concat(this._n,".syncOnReconnected cookie:").concat(this._cookie)),this._onlineSyncFlag=!0,this._startSync({cookie:this._cookie,syncFlag:0,isOnlineSync:0})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._onlineSyncFlag=!1,this._cookie=""}}])),Qn={req:{toAccount:"To_Account",fromAccount:"From_Account",to:"To_Account",from:"From_Account",groupID:"GroupId",groupAtUserID:"GroupAt_Account",extension:"Ext",data:"Data",description:"Desc",elements:"MsgBody",sizeType:"Type",downloadFlag:"Download_Flag",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",videoUrl:"",imageUrl:"URL",uuid:"UUID",priority:"MsgPriority",receiverUserID:"To_Account",receiverGroupID:"GroupId",messageSender:"SenderId",messageReceiver:"ReceiverId",nick:"From_AccountNick",avatar:"From_AccountHeadurl",messageNumber:"MsgNum",pbDownloadKey:"PbMsgKey",downloadKey:"JsonMsgKey",applicationType:"PendencyType",userIDList:"To_Account",groupNameList:"GroupName",userID:"To_Account",groupAttributeList:"GroupAttr",mainSequence:"AttrMainSeq",avChatRoomKey:"BytesKey",attributeControl:"AttrControl",sequence:"seq",messageControlInfo:"SendMsgControl",updateSequence:"UpdateSeq",clientTime:"MsgClientTime",sequenceList:"MsgSeqList",topicID:"TopicId",customData:"CustomString",isSupportTopic:"SupportTopic",isWebUniapp:"is_web_uniapp",isSupportExtension:"SupportMessageExtension",messageSequence:"MsgSeq",messageKey:"MsgKey",startSequence:"startSeq",simplifiedMessage:"DownsizeFlag",isRelayMessage:"IsRelayMsg",reactionID:"Reaction",messageSequenceList:"MsgSeqList",messageKeyList:"MsgKeyList",cmConfigID:"CustomModerationConfigID",remoteSnapshotUrl:"SnapshotUrl",remoteThumbUrl:"ThumbUrl",remoteFileUrl:"Url",snapshotUrl:"",thumbUrl:""},res:{MsgPriority:"priority",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",Download_Flag:"downloadFlag",GroupId:"groupID",Member_Account:"userID",MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",MsgSeq:"sequence",MsgRandom:"random",MsgTime:"time",MsgTimeStamp:"time",MsgContent:"content",MsgBody:"elements",From_AccountNick:"nick",From_AccountHeadurl:"avatar",GroupWithdrawInfoArray:"revokedInfos",GroupReadInfoArray:"groupMessageReadNotice",LastReadMsgSeq:"lastMessageSeq",WithdrawC2cMsgNotify:"c2cMessageRevokedNotify",C2cWithdrawInfoArray:"revokedInfos",C2cReadedReceipt:"c2cMessageReadReceipt",ReadC2cMsgNotify:"c2cMessageReadNotice",LastReadTime:"peerReadTime",MsgRand:"random",MsgType:"type",MsgShow:"messageShow",NextMsgSeq:"nextMessageSeq",FaceUrl:"avatar",ProfileDataMod:"profileModify",Profile_Account:"userID",ValueBytes:"value",ValueNum:"value",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgFrom_AccountExtraInfo:"messageFromAccountExtraInformation",Operator_Account:"operatorID",OpType:"operationType",ReportType:"operationType",UserId:"userID",User_Account:"userID",List_Account:"userIDList",MsgOperatorMemberExtraInfo:"operatorInfo",MsgMemberExtraInfo:"memberInfoList",ImageUrl:"avatar",NickName:"nick",MsgGroupNewInfo:"newGroupProfile",MsgAppDefinedData:"groupCustomField",Owner_Account:"ownerID",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupNotification:"notification",GroupApplyJoinOption:"joinOption",MsgKey:"messageKey",GroupInfo:"groupProfile",ShutupTime:"muteTime",Desc:"description",Ext:"extension",GroupAt_Account:"groupAtUserID",MsgNum:"messageNumber",PbMsgKey:"pbDownloadKey",JsonMsgKey:"downloadKey",MsgModifiedFlag:"isModified",PendencyItem:"applicationItem",PendencyType:"applicationType",AddTime:"time",AddSource:"source",AddWording:"wording",ProfileImImage:"avatar",PendencyAdd:"friendApplicationAdded",FrienPencydDel_Account:"friendApplicationDeletedUserIDList",Peer_Account:"userID",GroupAttr:"groupAttributeList",GroupAttrAry:"groupAttributeList",AttrMainSeq:"mainSequence",seq:"sequence",GroupAttrOption:"groupAttributeOption",BytesChangedKeys:"changedKeyList",GroupAttrInfo:"groupAttributeList",GroupAttrSeq:"mainSequence",PushChangedAttrValFlag:"isWithChangedAttributeInfo",SubKeySeq:"sequence",Val:"value",MsgGroupFromCardName:"senderNameCard",MsgGroupFromNickName:"senderNick",C2cNick:"peerNick",C2cImage:"peerAvatar",SendMsgControl:"messageControlInfo",NoLastMsg:"excludedFromLastMessage",NoUnread:"excludedFromUnreadCount",UpdateSeq:"updateSequence",MuteNotifications:"muteFlag",MsgClientTime:"clientTime",TinyId:"tinyID",GroupMsgReceiptList:"readReceiptList",ReadNum:"readCount",UnreadNum:"unreadCount",TopicId:"topicID",MillionGroupFlag:"communityType",SupportTopic:"isSupportTopic",MsgTopicNewInfo:"newTopicInfo",ShutupAll:"muteAllMembers",CustomString:"customData",TopicFaceUrl:"avatar",TopicIntroduction:"introduction",TopicNotification:"notification",TopicIdArray:"topicIDList",MsgVersion:"messageVersion",C2cMsgModNotifys:"c2cMessageModified",GroupMsgModNotifys:"groupMessageModified",ApplyJoinOption:"joinOption",MsgFlag:"messageRemindType",AtInfoList:"groupAtInfoList",AtFlagList:"groupAtType",AtMsgSeq:"sequence",BanDuration:"duration",BanDescription:"reason",NotVisible:"invisible",BytesTag:"tag",BytesValue:"value",RptBytesValue:"value",LatestSeq:"globalSequence",ClearSeq:"clearSequence",SupportMessageExtension:"isSupportExtension",ExtensionList:"extensions",GroupCounter:"counterList",Revoker_Account:"revoker",MsgExtensionNotify:"messageExtensionNotify",ExtensionC2cMsgInfo:"messageInfo",ExtensionGroupMsgInfo:"messageInfo",MsgOptType:"operateType",SetKVInfo:"operateResultList",DeleteKVInfo:"operateResultList",ClearKVInfo:"operateResultList",MsgKeyValue:"extensions",ClearMsgSeq:"clearSequence",MsgLastSeq:"globalSequence",InviteJoinOption:"inviteOption",MemberList_Account:"inviteeList",MsgMemberExtraInfoList:"inviteeInfoList",E:"event",GInf:"groupProfile",MCT:"clientTime",MR:"random",MP:"priority",MTS:"time",GId:"groupID",MS:"sequence",CCD:"cloudCustomData",F_Account:"from",F_Hd:"avatar",F_NN:"nick",GN:"groupName",GT:"groupType",IsSys:"isSystemMessage",OpInf:"operatorInfo",Img:"avatar",NN:"nick",OnlineInf:"onlineMemberInfo",ET:"expireTime",Num:"onlineMemberNum",Opt:"operationType",O_Account:"operatorID",RT:"operationType",UDF:"userDefinedField",L_Account:"userIDList",IsPlaceMsg:"isPlaceMessage",MsgCheckResult:"checkResult",Results:"resultList",Reaction:"reactionID",Reaction_Account:"userIDList",MsgReactionNotifyList:"messageReactionNotifyList",MsgReactionNotify:"messageReactionNotify",MsgReactionSummary:"reactionList",C2CMsgInfo:"C2CMessageInfo",GroupMsgInfo:"groupMessageInfo",int32_err_code:"errorCode",str_err_msg:"errorMsg",MsgDropReason:"messageDropReason",ReactedByMe:"reactedByMyself",Level:"messageRemindType",PeerReadTime:"timestamp",NoUnreadSeqList:"excludedUnreadSequenceList",NewMsg:"topicLatestMessage",PinnedMsg:"pinnedMessage",SdkGroupMessageId:"unPinnedMessageInfo",From_AccountLevel:"level",F_Ll:"level"},ignoreKeyWord:["C2C","ID","USP"]};function $n(e){return U(this,$n),(e=le(this,$n,[e]))._n="SyncUnreadMsgModule",e._cookie="",e._onlineSyncFlag=!1,e.getIEmitInst().on(ne.A2KEY_AND_TINYID_UPDATED,e._init,e),e}function eo(e){return U(this,eo),(e=le(this,eo,[e]))._n="PluginModule",e.plugins={},e}function to(e){return U(this,to),(e=le(this,to,[e]))._n="ComboMsgModule",e}function no(e){return U(this,no),(e=le(this,no,[e]))._n="MsgReactionModule",e._reactedByMyselfMap=new Map,e._reactionInfoMap=new Map,e}function oo(e){return U(this,oo),(e=le(this,oo,[e]))._n="MsgExtModule",e.msgExtMap=new Map,e.globalSeqMap=new Map,e.getMsgExtsMap=new Map,e}function so(e){return U(this,so),(e=le(this,so,[e]))._n="MessageModule",e._messageOptionsMap=new Map,e._mergerMessageHandler=new ir(e),e}function es(e,t){if(typeof e=="string"||Array.isArray(e))return t=Object.assign({pascalCase:!1},t),(e=Array.isArray(e)?e.map(function(n){return n.trim()}).filter(function(n){return n.length}).join("-"):e.trim()).length===0?"":e.length===1?t.pascalCase?e.toUpperCase():e.toLowerCase():(e=e=(e=e!==e.toLowerCase()?hr(e):e).replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(n,o){return o.toUpperCase()}).replace(/\d+(\w|$)/g,function(n){return n.toUpperCase()}),t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e);throw new TypeError("Expected the input to be `string | string[]`")}var hr=function(e){for(var t=!1,n=!1,o=!1,s=0;s<e.length;s++){var a=e[s];t&&/[a-zA-Z]/.test(a)&&a.toUpperCase()===a?(e=e.slice(0,s)+"-"+e.slice(s),o=n,n=!(t=!1),s++):n&&o&&/[a-zA-Z]/.test(a)&&a.toLowerCase()===a?(e=e.slice(0,s-1)+"-"+e.slice(s-1),o=n,t=!(n=!1)):(t=a.toLowerCase()===a&&a.toUpperCase()!==a,o=n,n=a.toUpperCase()===a&&a.toLowerCase()!==a)}return e};function fr(e,t){var n=0;return(function o(s,a){var i,r,c,u;return 100<++n?(n--,s):O(s)?(i=s.map(function(l){return at(l)?o(l,a):l}),n--,i):at(s)?(r=s,c=function(l,_){if(!zs(_))return!1;if(_!==es(_))for(var m=0;m<Qn.ignoreKeyWord.length&&!_.includes(Qn.ignoreKeyWord[m]);m++);var f;return T(a[_])?(f=_)[0].toUpperCase()+es(f).slice(1):a[_]},u=Object.create(null),Object.keys(r).forEach(function(l){var _=c(r[l],l);_&&(u[_]=r[l])}),i=Qs(i=u,function(l,_){return O(l)||at(l)?o(l,a):l}),n--,i):void 0})(e,t)}for(var ts=String.fromCharCode,mr=function(e){var t=0|e.charCodeAt(0);if(55296<=t)if(t<56320)if(e=0|e.charCodeAt(1),56320<=e&&e<=57343){if(65535<(t=(t<<10)+e-56613888|0))return ts(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?ts(192|t>>>6,128|63&t):ts(224|t>>>12,128|t>>>6&63,128|63&t)},ao=function(e){for(var t=e===void 0?"":(""+e).replace(/[\x80-\uD7ff\uDC00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g,mr),n=0|t.length,o=new Uint8Array(n),s=0;s<n;s=s+1|0)o[s]=0|t.charCodeAt(s);return o},vr=b(function e(t){var n,o,s=this,a=(U(this,e),(this._handler=t).getURL());this._socket=null,this._workerSocket=null,this._id=Je(),this._handler.getIsWorkerEnabled()?(o=URL.createObjectURL(new Blob([';let _socket = null;onmessage = function(event) { if (event.data.cmd === "start") { const url = event.data.url; _socket = new WebSocket(url); _socket.binaryType = "arraybuffer"; _socket.onopen = function() { postMessage({ callback: "onOpen", extensions: _socket.extensions }); }; _socket.onclose = function(e) { postMessage({ callback: "onClose", 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(o),(n=this)._workerSocket.onmessage=function(i){var u=i.data,r=u.callback,c=u.e,u=u.extensions;r==="onOpen"?n._onOpen(u):r==="onClose"?n._onClose(c):r==="onError"?n._onError(c):r==="onMessage"&&n._onMessage(i.data)},this._workerSocket.postMessage({cmd:"start",id:this._id,url:a})):X?(o={"content-type":"application/json"},Ze?(te.connectSocket({url:a,header:o}),te.onSocketClose(this._onClose.bind(this)),te.onSocketOpen(this._onOpen.bind(this)),te.onSocketMessage(this._onMessage.bind(this)),te.onSocketError(this._onError.bind(this))):ft&&!Os?this._socket=te.connectSocket({url:a,header:o,success:function(){s._bindEventsInMini()},fail:function(i){s._onFail({code:i.errNo,reason:i.errMsg})}}):(this._socket=te.connectSocket({url:a,header:o,complete:function(){}}),this._bindEventsInMini())):(this._socket=new WebSocket(a),this._socket.binaryType="arraybuffer",this._socket.onopen=this._onOpen.bind(this,this._socket.extensions),this._socket.onmessage=this._onMessage.bind(this),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this)),this._canIUseBinaryFrame=t.canIUseBinaryFrame()},[{key:"getID",value:function(){return this._id}},{key:"getClient",value:function(){return this._socket}},{key:"_bindEventsInMini",value:function(){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))}},{key:"_onOpen",value:function(e){this._handler.onOpen({id:this._id,res:JSON.stringify(e)})}},{key:"_onClose",value:function(e){this._handler.onClose({id:this._id,e})}},{key:"_onFail",value:function(e){this._handler.onFail({id:this._id,e})}},{key:"_onMessage",value:function(e){e=this._canIUseBinaryFrame?this._isAppCompressedData(e.data)?this._handler.inflate(e.data):(function(t){for(var n=new Uint8Array(t),o="",s=0,a=n.length;s<a;){var i=n[s],r=0,c=0;if(i<=127?(r=0,c=255&i):i<=223?(r=1,c=31&i):i<=239?(r=2,c=15&i):i<=244&&(r=3,c=7&i),0<a-s-r)for(var u=0;u<r;)c=c<<6|63&(i=n[s+u+1]),u+=1;else c=65533,r=a-s;o+=String.fromCodePoint(c),s+=r+1}return o})(e.data):e.data,this._handler.onMessage({data:e})}},{key:"_isAppCompressedData",value:function(e){return e=new Uint8Array(e),e[0]===67&&e[1]===79&&e[2]===77&&e[3]===80}},{key:"_onError",value:function(e){this._handler.onError({id:this._id,e})}},{key:"setIsWorkerEnabled",value:function(e){this._isWorkerEnabled=!0}},{key:"close",value:function(e){this._workerSocket&&(this._workerSocket.postMessage({cmd:"stop",code:e}),this._workerSocket.terminate(),this._workerSocket=null),Ze?(te.offSocketClose(),te.offSocketMessage(),te.offSocketOpen(),te.offSocketError(),te.closeSocket()):this._socket&&(X?(this._socket.onClose(function(){}),this._socket.onOpen(function(){}),this._socket.onMessage(function(){}),this._socket.onError(function(){})):(this._socket.onopen=null,this._socket.onmessage=null,this._socket.onclose=null,this._socket.onerror=null),Tn?this._socket.close({code:e}):this._socket.close(e),this._socket=null)}},{key:"send",value:function(e){this._workerSocket?this._workerSocket.postMessage({cmd:"sendMessage",data:this._canIUseBinaryFrame?ao(e.data).buffer:e.data}):Ze?te.sendSocketMessage({data:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket&&(X?this._socket.send({data:this._canIUseBinaryFrame?ao(e.data).buffer:e.data,fail:function(){e.fail&&e.requestID&&e.fail(e.requestID)}}):this._socket.send(this._canIUseBinaryFrame?ao(e.data):e.data))}}]),Ir=["keyMap"],Mr=["keyMap"],Jt="connected",ns="connecting",_t="disconnected",yr=b(function e(t){U(this,e),this._chM=t,this._n="SocketHandler",this._promiseMap=new Map,this._readyState=_t,this._simpleRequestMap=new Map,this.MAX_SIZE=100,this._startSequence=Je(),this._startTs=0,this._reConnectFlag=!1,this._nextPingTs=0,this._reConnectCount=0,this.MAX_RECONNECT_COUNT=3,this._socketID=-1,this._random=0,this._socket=null,this._url="",this._onOpenTs=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0,this._currentSite=Cn,this._setWebsocketHost(),this._initConnection(),this._addAppVisibilityListener()},[{key:"_addAppVisibilityListener",value:function(){var e=this;ft&&te.onAppShow(function(){d.l("".concat(e._n,"._addAppVisibilityListener onAppShow readyState:").concat(e._readyState)),e._readyState===_t&&e._initConnection()})}},{key:"_setWebsocketHost",value:function(){var e=this._chM.get(12);this._currentSite=Cn,this._chM.isOversea()&&(this._currentSite="OVERSEA"),e.isSingaporeSite()?this._currentSite="SINGAPORE":e.isKoreaSite()?this._currentSite="KOREA":e.isGermanySite()?this._currentSite="GERMANY":e.isIndiaSite()?this._currentSite="IND":e.isJapanSite()?this._currentSite="JPN":e.isUSASite()?this._currentSite="USA":e.isIndonesiaSite()&&(this._currentSite="INDONESIA"),E.HOST.setCurrent(this._currentSite)}},{key:"_initConnection",value:function(){var t=this._chM.get(12).getSDKAppID()+"",e=this._chM.get(12).isIndependentDomainDisabled(),e=(T(E.HOST.CURRENT.BACKUP)?this._url=E.HOST.CURRENT.DEFAULT:this._url===""?this._url=e?E.HOST.CURRENT.DEFAULT:E.HOST.CURRENT.DEFAULT0.replace("*",t):-1<this._url.indexOf(t)?this._url=E.HOST.CURRENT.DEFAULT:this._url===E.HOST.CURRENT.DEFAULT?this._url=E.HOST.CURRENT.IPV6:this._url===E.HOST.CURRENT.IPV6?this._url=Ae?this._genRandomDomain():E.HOST.CURRENT.BACKUP:this._isWebBackupUrl(this._url)||this._url===E.HOST.CURRENT.BACKUP?this._canIUseBackupCN()?this._url=E.HOST.CURRENT.BACKUP_CN:this._canIUseAnyCast()?this._url=E.HOST.CURRENT.ANYCAST:this._url=E.HOST.CURRENT.DEFAULT:this._url===E.HOST.CURRENT.BACKUP_CN?this._url=this._canIUseAnyCast()?E.HOST.CURRENT.ANYCAST:E.HOST.CURRENT.DEFAULT:this._url===E.HOST.CURRENT.ANYCAST&&(E.HOST.CURRENT.ANYCAST="",this._url=E.HOST.CURRENT.DEFAULT),this._chM.get(12)),t=e.getProxyServer();k(t)||(this._url=t),e.isTestEnv()&&(this._url=Cs.TEST[this._currentSite].DEFAULT),this._connect(),this._nextPingTs=0}},{key:"_genRandomDomain",value:function(){var e=Math.floor(10001*Math.random())+1e4;return E.HOST.CURRENT.BACKUP_WEB.replace("*",e)}},{key:"_isWebBackupUrl",value:function(e){return e.includes("my-cpaas.com")}},{key:"_canIUseAnyCast",value:function(){return Ae&&E.HOST.CURRENT.ANYCAST}},{key:"_canIUseBackupCN",value:function(){return E.HOST.CURRENT.BACKUP_CN}},{key:"onCheckTimer",value:function(e){e%1==0&&(this._checkPromiseMap(),this._checkNativeAppWS())}},{key:"_checkPromiseMap",value:function(){var e=this;this._promiseMap.size!==0&&this._promiseMap.forEach(function(a,n){var o=a.reject,s=a.timestamp,a=a.headSeq,i=15e3;n.indexOf(h.LOGIN)!==-1?i=9e4:n.indexOf(h.PING)!==-1&&(i=3e3),Date.now()-s>=i&&(d.l("".concat(e._n,"._checkPromiseMap request timeout, delete requestID:").concat(n)),e._promiseMap.delete(n),o(new ie({code:y.NETWORK_TIMEOUT,data:{headSeq:a}})),e._chM.onRequestTimeout())})}},{key:"_checkNativeAppWS",value:function(){Be&&!this.isConnected()&&this._reConnect()}},{key:"onOpen",value:function(e){var t,n;this._readyState!==_t&&(this._onOpenTs=Date.now(),n=e.id,e=e.res,this._socketID=n,t=ye(this._startTs,!1),n="socketID:".concat(n," res:").concat(e),d.l("".concat(this._n,"._onOpen cost:").concat(t," ms. ").concat(n)),new D("wsOnOpen").setMessage(t).setCostTime(t).setMoreMessage(n).end(),this._readyState=Jt,this._reConnectCount=0,this._resend(),this._reConnectFlag===!0&&(this._chM.onReconnected(),this._reConnectFlag=!1),this._chM.onOpen())}},{key:"onClose",value:function(o){var t=new D("wsOnClose"),n=o.id,o=o.e,s="sourceSocketID:".concat(n," currentSocketID:").concat(this._socketID," code:").concat(o.code," reason:").concat(o.reason),a=0;this._onOpenTs!==0&&(a=Date.now()-this._onOpenTs),t.setMessage(a).setCostTime(a).setMoreMessage(s).setCode(o.code).end(!0),d.l("".concat(this._n,"._onClose ").concat(s," onlineTime:").concat(a)),n!==this._socketID||Ze&&this._reConnectFlag===!0&&n===this._socketID&&a===0||(this._readyState=_t,a<1e3?this._chM.onReconnectFailed():this._chM.onClose())}},{key:"onError",value:function(n){var t=n.id,n=n.e,o="sourceSocketID:".concat(t," currentSocketID:").concat(this._socketID);new D("wsOnError").setMessage(n.errMsg||JSON.stringify(n,["message","code"])).setMoreMessage(o).setLevel("error").end(!0),d.w("".concat(this._n,"._onError"),n,o),t===this._socketID&&(this._readyState=_t,this._chM.onError())}},{key:"onFail",value:function(t){this._readyState=_t;var n=t.id,t=t.e,n="currentSocketID:".concat(n," code:").concat(t.code," reason:").concat(t.reason);new D("wsOnFail").setMessage(n).setCode(t.code).end(!0),d.l("".concat(this._n,"._onFail ").concat(n))}},{key:"onMessage",value:function(e){var t,n,o,s,a,i;try{t=JSON.parse(e.data)}catch{new D("jsonParseError").setMessage(e.data).end()}t&&t.head&&(e=this._getRequestIDFromHead(t.head),n=t.body,this._chM.get(30).isTRTCCommand(e)||(i=wo(t.head),n=(function r(c,u){var l,_,m;return O(c)?c.map(function(f){return at(f)?r(f,u):f}):at(c)?(l=c,_=function(f,I){return T(u[I])?es(I):u[I]},m={},Object.keys(l).forEach(function(f){m[_(l[f],f)]=l[f]}),Qs(m,function(f){return O(f)||at(f)?r(f,u):f})):void 0})(t.body,this._getResKeyMap(i))),d.d("".concat(this._n,".onMessage ret:").concat(JSON.stringify(n)," requestID:").concat(e," has:").concat(this._promiseMap.has(e))),this._setNextPingTs(),this._promiseMap.has(e)?(o=(i=this._promiseMap.get(e)).resolve,s=i.reject,a=i.timestamp,i=i.headSeq,this._promiseMap.delete(e),this._calcRTT(a),n.errorCode&&n.errorCode!==0?(this._chM.onErrorCodeNotZero(n),s(new ie({code:n.errorCode,message:n.errorInfo||"",data:e.includes(h.MODIFY_C2C_MSG)||e.includes(h.MODIFY_GRP_MSG)?{elements:n.elements,messageVersion:n.messageVersion,cloudCustomData:n.cloudCustomData,headSeq:i}:{headSeq:i}}))):o(N(n))):this._chM.onMessage({head:t.head,body:n}))}},{key:"_calcRTT",value:function(e){e=Date.now()-e,this._chM.get(26).addRTT(e)}},{key:"_connect",value:function(){if(this._readyState!==ns&&this._readyState!==Jt){if(this._startTs=Date.now(),this._onOpenTs=0,this._readyState=ns,this._socket=new vr(this),this._socketID=this._socket.getID(),ft){var e=this._socket.getClient().readyState;if(T(e))return void(this._readyState=_t)}new D("wsConnect").setMessage("socketID:".concat(this._socketID," url:").concat(this.getURL())).end(),d.l("".concat(this._n,"._connect isWorkerEnabled:").concat(this.getIsWorkerEnabled()," socketID:").concat(this._socketID," url:").concat(this.getURL()))}}},{key:"getURL",value:function(){this._chM.isDevMode()&&(this._canIUseBinaryFrame=!1);var e=ea(),t=((Ze||Xe&&e==="windows"||Os)&&(this._canIUseBinaryFrame=!1),Be&&(o=te.getSystemInfoSync().uniRuntimeVersion,n=ke((o=o===void 0?"":o).split(".").map(Number),3),s=(s=n[0])===void 0?0:s,t=(t=n[1])===void 0?0:t,n=n[2],s=2<s||!(s<2)&&(2<t||!(t<2)&&6<=(n===void 0?0:n)),d.l("".concat(this._n,".getURL uniRuntimeVersion:").concat(o," isUniRuntimeVersionGte226:").concat(s)),s||(this._canIUseBinaryFrame=!1)),-1),n=(e==="ios"?t=ei||-1:e==="android"&&(t=ti||-1),this._chM.get(12)),o=this._chM.getPlatform(),s=n.getSDKAppID(),a=n.getInstanceID(),a="sdkappid=".concat(s,"&instanceid=").concat(a,"&random=").concat(this._getRandom(),"&platform=").concat(o,"&host=").concat(e)+"&version=".concat(t,"&sdkversion=").concat("3.6.6");return Rs&&(a+="&isminigame=1"),this._chM.canIUseInflate()&&(a+="&compress=gzip"),(this._canIUseBinaryFrame?"".concat(this._url,"/binfo?"):"".concat(this._url,"/info?")).concat(a)}},{key:"_closeConnection",value:function(e){d.l("".concat(this._n,"._closeConnection socketID:").concat(this._socketID)),this._socket&&(this._socket.close(e),this._socketID=-1,this._socket=null,this._readyState=_t)}},{key:"_resend",value:function(){var e=this;if(d.l("".concat(this._n,"._resend reConnectFlag:").concat(this._reConnectFlag),"promiseMap.size:".concat(this._promiseMap.size," simpleRequestMap.size:").concat(this._simpleRequestMap.size)),0<this._promiseMap.size&&this._promiseMap.forEach(function(l,r){var c=l.uplinkData,u=l.resolve,l=l.reject;r.indexOf(h.AV_POLLING)!==-1?e._promiseMap.delete(r):(e._promiseMap.set(r,{resolve:u,reject:l,timestamp:Date.now(),uplinkData:c}),e._execute(r,c))}),0<this._simpleRequestMap.size){var t,n=Se(this._simpleRequestMap);try{for(n.s();!(t=n.n()).done;){var o=ke(t.value,2),s=o[0],a=o[1];this._execute(s,a)}}catch(i){n.e(i)}finally{n.f()}this._simpleRequestMap.clear()}}},{key:"send",value:function(e){var t=this,n=(e.head.seq=this._getSequence(),e.head.reqtime=Math.floor(Date.now()/1e3),e.head.cs=this._calcCheckSum(e.head.servcmd,e.body),e.keyMap,Fe(e,Ir)),o=this._getRequestIDFromHead(e.head),s=JSON.stringify(n);return new Promise(function(a,i){t._promiseMap.set(o,{resolve:a,reject:i,timestamp:Date.now(),uplinkData:s,headSeq:e.head.seq}),d.d("".concat(t._n,".send uplinkData:").concat(JSON.stringify(n)," requestID:").concat(o," readyState:").concat(t._readyState)),t._readyState!==Jt?t._reConnect():(t._execute(o,s),t._chM.get(26).addRequestCount())})}},{key:"simplySend",value:function(t){t.head.seq=this._getSequence(),t.head.reqtime=Math.floor(Date.now()/1e3),t.keyMap;var n=Fe(t,Mr),t=this._getRequestIDFromHead(t.head),n=JSON.stringify(n);this._readyState!==Jt?(this._simpleRequestMap.size<this.MAX_SIZE?this._simpleRequestMap.set(t,n):d.l("".concat(this._n,".simplySend. simpleRequestMap is full, drop request!")),this._reConnect()):this._execute(t,n)}},{key:"_execute",value:function(e,t){this._socket.send({data:t,fail:X?this._onSendFail.bind(this):void 0,requestID:e})}},{key:"_onSendFail",value:function(e){d.l("".concat(this._n,"._onSendFail requestID:").concat(e)),this._chM.onSendFail()}},{key:"_getSequence",value:function(){var e;if(this._startSequence<2415919103)return e=this._startSequence,this._startSequence+=1,this._startSequence===2415919103&&(this._startSequence=Je()),e}},{key:"_getRequestIDFromHead",value:function(e){return e.servcmd+e.seq}},{key:"_getResKeyMap",value:function(e){return e=this._chM.getKeyMap(e),p(p({},Qn.res),e.res)}},{key:"_reConnect",value:function(){this._readyState!==Jt&&this._readyState!==ns&&this.forcedReconnect()}},{key:"forcedReconnect",value:function(){var e="".concat(this._n,".forcedReconnect");d.l("".concat(e," count:").concat(this._reConnectCount," readyState:").concat(this._readyState)),this._reConnectFlag=!0,this._resetRandom(),this._reConnectCount<this.MAX_RECONNECT_COUNT?(this._reConnectCount+=1,this._closeConnection(4001),this._initConnection()):(this._reConnectCount=0,this._chM.get(15).isOnline()?(d.w("".concat(e," disconnected from wsserver but network is ok, continue...")),this._closeConnection(4001),this._initConnection()):this._chM.onReconnectFailed())}},{key:"getReconnectFlag",value:function(){return this._reConnectFlag}},{key:"_setNextPingTs",value:function(){this._nextPingTs=Be?Date.now()+5e3:Date.now()+1e4}},{key:"getNextPingTs",value:function(){return this._nextPingTs}},{key:"isConnected",value:function(){return this._readyState===Jt}},{key:"canIUseBinaryFrame",value:function(){return this._canIUseBinaryFrame}},{key:"getSocketID",value:function(){return this._socketID}},{key:"inflate",value:function(e){if(this._chM.canIUseInflate())return this._chM.get(37).inflate(e)}},{key:"setIsWorkerEnabled",value:function(e){d.l("".concat(this._n,".setIsWorkerEnabled flag:").concat(e)),this._isWorkerEnabled=e}},{key:"getIsWorkerEnabled",value:function(){return this._isWorkerEnabled&&Pt}},{key:"_getRandom",value:function(){return this._random===0&&(this._random=Math.random()),this._random}},{key:"_resetRandom",value:function(){this._random=0}},{key:"_calcCheckSum",value:function(e,t){if(e.indexOf(h.PING)!==-1||e.indexOf(h.LOGIN)!==-1||e.indexOf(h.LOGOUT)!==-1||e.indexOf(h.AV_POLLING)!==-1||e.indexOf(h.AV_NOAUTH_POLLING)!==-1)return 0;for(var n=ao(JSON.stringify(t)),o=4294967295,s=0,a=n.length;s<a;s++){o^=n[s];for(var i=0;i<8;i++)(1&o)==1?o=o>>>1^3988292384:o>>>=1}return(4294967295^o)>>>0}},{key:"close",value:function(){d.l("".concat(this._n,".close")),this._closeConnection(4e3),this._promiseMap.clear(),this._startSequence=Je(),this._readyState=_t,this._simpleRequestMap.clear(),this._reConnectFlag=!1,this._reConnectCount=0,this._onOpenTs=0,this._url="",this._random=0,this._canIUseBinaryFrame=!0,this._isWorkerEnabled=!0}}]),os=function(e,t,n){return new Promise(function(o,s){var a,i,r="application/x-www-form-urlencoded;charset=UTF-8";X?te.request({url:t,data:n,method:e,timeout:3e3,header:{"content-type":r},success:function(c){c&&c.data&&c.data.NetCheckInfo&&d.l("".concat("getconninfo ok in"," miniapp. ret:"),c.data),o()},fail:function(){s(new ie({code:y.NETWORK_ERROR}))}}):(a=new XMLHttpRequest,i=setTimeout(function(){a.abort(),s(new ie({code:y.NETWORK_TIMEOUT}))},3e3),a.onreadystatechange=function(){a.readyState===4&&(i&&clearTimeout(i),a.status===200||a.status===304?(a.responseText&&-1<a.responseText.indexOf("NetCheckInfo")&&d.l("".concat("getconninfo ok in"," web. ret:"),JSON.parse(a.responseText)),o()):s(new ie({code:y.NETWORK_ERROR})))},a.open(e,t,!0),a.setRequestHeader("Content-type",r),n?a.send(n):a.send())})},Cr=(de(ro,ce),b(ro,[{key:"onCheckTimer",value:function(e){this._socketHandler&&(this.isLoggedIn()?(0<this._timerForNotLoggedIn&&(clearInterval(this._timerForNotLoggedIn),this._timerForNotLoggedIn=-1),this._socketHandler.onCheckTimer(e)):this._socketHandler.onCheckTimer(1),this._checkNextPing())}},{key:"onErrorCodeNotZero",value:function(e){this.get(20).onErrorCodeNotZero(e)}},{key:"onMessage",value:function(e){this.get(20).onMessage(e)}},{key:"send",value:function(e){return this._socketHandler?this._previousState!==g.NET_STATE_CONNECTED&&e.head.servcmd.includes(h.SSO_STAT)?(this.reConnect(),this.isPrivateNetWork()?Promise.resolve():this._sendLogViaHTTP(e)):this._socketHandler.send(e):Promise.reject()}},{key:"_sendLogViaHTTP",value:function(n){var t=E.HOST.CURRENT.STAT,t="".concat(t,"/v4/imopenstat/tim_web_report_v2?sdkappid=").concat(n.head.sdkappid,"&reqtime=").concat(Date.now()),n=JSON.stringify(n.body);return os("POST",t,n)}},{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(g.NET_STATE_DISCONNECTED),this.reConnect()}},{key:"onError",value:function(){X&&!Be&&this.warn("DomainNameInMP"),this._emitNetStateChangeEvent(g.NET_STATE_DISCONNECTED)}},{key:"getKeyMap",value:function(e){return this.get(20).getKeyMap(e)}},{key:"onRequestTimeout",value:function(){3e4<=Date.now()-this._lastDiagnoseTS&&this.diagnose()}},{key:"onSendFail",value:function(){this._emitNetStateChangeEvent(g.NET_STATE_DISCONNECTED)}},{key:"onReconnected",value:function(){d.l("".concat(this._n,".onReconnected cost:").concat(ye(this._disconnectedTS,!0,!0))),this._m.restartTimer(),this.get(20).onReconnected(ye(this._disconnectedTS,!1,!1)),this._disconnectedTS=0,this._emitNetStateChangeEvent(g.NET_STATE_CONNECTED)}},{key:"onReconnectFailed",value:function(){d.l("".concat(this._n,".onReconnectFailed")),this._emitNetStateChangeEvent(g.NET_STATE_DISCONNECTED)}},{key:"setIsWorkerEnabled",value:function(e){this._socketHandler&&this._socketHandler.setIsWorkerEnabled(!1)}},{key:"offline",value:function(){this._emitNetStateChangeEvent(g.NET_STATE_DISCONNECTED)}},{key:"reConnect",value:function(){var e=0<arguments.length&&arguments[0]!==void 0&&arguments[0],t=!1,n=(this._socketHandler&&(t=this._socketHandler.getReconnectFlag()),"forcedFlag:".concat(e," fatalErrorFlag:").concat(this._fatalErrorFlag," previousState:").concat(this._previousState," reconnectFlag:").concat(t));d.l("".concat(this._n,".reConnect ").concat(n)),this._fatalErrorFlag||!this._socketHandler||e!==!0&&this._previousState===g.NET_STATE_CONNECTING&&t||(this._socketHandler.forcedReconnect(),this._emitNetStateChangeEvent(g.NET_STATE_CONNECTING))}},{key:"_emitNetStateChangeEvent",value:function(e){this._previousState!==e&&(d.l("".concat(this._n,"._emitNetStateChangeEvent from ").concat(this._previousState," to ").concat(e)),e===g.NET_STATE_DISCONNECTED&&this._disconnectedTS===0&&(this._disconnectedTS=Date.now(),this.diagnose()),this._previousState=e,this.emitOEvt(F.NET_STATE_CHANGE,{state:e}))}},{key:"_ping",value:function(){var e,t=this;this._probing!==!0&&(this._probing=!0,e=this.get(20).getProtocolData({P:h.PING}),this.send(e).then(function(){t._probing=!1}).catch(function(n){t._probing=!1;var o=t.get(15).isOnline();d.w("".concat(t._n,"._ping failed. bOnline:").concat(o," error:"),n),n&&n.code===60002?(new D("error").setMessage("code:".concat(n.code," message:").concat(n.message)).end(),t._fatalErrorFlag=!0,t._emitNetStateChangeEvent(g.NET_STATE_DISCONNECTED)):o?t.reConnect():t._emitNetStateChangeEvent(g.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),-1<this._timerForNotLoggedIn&&clearInterval(this._timerForNotLoggedIn)}},{key:"onRestApiKickedOut",value:function(){this._socketHandler&&(this._socketHandler.close(),this.reConnect(!0))}},{key:"canIUseInflate",value:function(){return this._m.canIUseInflate()}},{key:"getSocketID",value:function(){if(this._socketHandler)return this._socketHandler.getSocketID()}},{key:"diagnose",value:function(){this.isPrivateNetWork()||(this._lastDiagnoseTS=Date.now(),this._diagnoseBySSO(),this._diagnoseByCDN())}},{key:"_diagnoseBySSO",value:function(){var e=this,t=this._socketHandler.getURL(),n=t.split("/")[2];n.startsWith("ws")&&(t=t.slice(t.indexOf("info?")+5),n="https://".concat(n,"/v3/netcheck/getconninfo?").concat(t,"&reqtime=").concat(Date.now()),os("GET",n).catch(function(o){d.w("".concat(e._n,"._diagnoseBySSO failed. error:"),o)}))}},{key:"_diagnoseByCDN",value:function(){var e=this,t=this._socketHandler.getURL(),t=t.slice(t.indexOf("info?")+5),t="https://boce-cdn.my-imcloud.com/v3/netcheck/getconninfo?".concat(t,"&reqtime=").concat(Date.now());os("GET",t).catch(function(n){d.w("".concat(e._n,"._diagnoseByCDN failed. error:"),n)})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._previousState=g.NET_STATE_CONNECTED,this._probing=!1,this._fatalErrorFlag=!1,this._timerForNotLoggedIn=setInterval(this.onCheckTimer.bind(this),1e3),this._disconnectedTS=0,this._lastDiagnoseTS=0}}])),Tr=["a2","tinyid"],Dr=["a2","tinyid"],Er=b(function e(t){U(this,e),this._n="PHandler",this._sessionM=t,this._map=new Map,this._fillMap()},[{key:"_fillMap",value:function(){this._map.clear();var e=this._sessionM.genCommonHead(),t=this._sessionM.genCosSpecifiedHead(),n=this._sessionM.genSSOReportHead();this._map.set(h.LOGIN,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.LOGIN)}),body:{state:"Online",isWebUniapp:0,deviceBrand:0,customInfo:""},keyMap:{req:{deviceBrand:"InstType"},res:{InstId:"instanceID",HelloInterval:"helloInterval",RichMsgAuthKey:"authKey"}}}),this._map.set(h.LOGOUT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.LOGOUT)}),body:{type:0,isWebUniapp:0},keyMap:{req:{type:"wslogout_type"}}}),this._map.set(h.HELLO,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.HELLO)}),body:{isWebUniapp:0},keyMap:{res:{NewInstInfo:"newInstanceInfo"}}}),this._map.set(h.KICK_OTHER,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.STAT_SERVICE,".").concat(h.KICK_OTHER)}),body:{}}),this._map.set(h.COS_SIGN,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.IM_COS_SIGN,".").concat(h.COS_SIGN)}),body:{cmd:"open_im_cos_svc",subCmd:"get_cos_token",duration:300,version:2},keyMap:{req:{userSig:"usersig",subCmd:"sub_cmd",cmd:"cmd",duration:"duration",version:"version"},res:{expired_time:"expiredTime",bucket_name:"bucketName",session_token:"sessionToken",tmp_secret_id:"secretId",tmp_secret_key:"secretKey"}}}),this._map.set(h.COS_PRE_SIG,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.CUSTOM_UPLOAD,".").concat(h.COS_PRE_SIG)}),body:{fileType:void 0,fileName:void 0,uploadMethod:0,duration:900},keyMap:{req:{userSig:"usersig",fileType:"file_type",fileName:"file_name",uploadMethod:"upload_method"},res:{expired_time:"expiredTime",request_id:"requestId",head_url:"headUrl",upload_url:"uploadUrl",download_url:"downloadUrl",ci_url:"ciUrl",snapshot_url:"requestSnapshotUrl"}}}),this._map.set(h.SIMPLE_COS_PRE_SIG,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.CUSTOM_UPLOAD,".").concat(h.SIMPLE_COS_PRE_SIG)}),body:{uploadMethod:0,platform:2,SDKAppID:0,userID:"",conversationType:1,uploadConfig:[{fileID:1,fileType:1,fileName:""}]},keyMap:{req:{platform:"uint32_platform",SDKAppID:"uint32_sdkappid",userID:"str_user_id",uploadMethod:"uint32_upload_method",conversationType:"uint32_scene",uploadConfig:"rpt_upload_object",fileID:"uint32_file_id",fileType:"uint32_file_type",fileName:"str_file_name"},res:{str_final_ip:"uploadIP",rpt_pre_sig:"preSig",uint32_file_id:"fileID",uint32_exist_flag:"existFlag",str_download_url:"downloadUrl",str_upload_url:"uploadUrl",str_snapshot_url:"requestSnapshotUrl",str_file_key:"fileKey",rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(h.GET_IMAGE_INFO,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.CUSTOM_UPLOAD,".").concat(h.GET_IMAGE_INFO)}),body:{imageUrl:""},keyMap:{req:{imageUrl:"str_image_url"},res:{rpt_msg_image_info:"imageInfoArray",uint32_image_type:"type",str_url:"url",uint32_width:"width",uint32_height:"height",str_image_format:"imageFormat"}}}),this._map.set(h.GET_IP,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.CUSTOM_UPLOAD,".").concat(h.GET_IP)}),body:{domainName:""},keyMap:{req:{domainName:"str_domain"},res:{str_final_ip:"ip"}}}),this._map.set(h.VIDEO_COVER,{head:p(p({},t),{},{servcmd:"".concat(E.NAME.CUSTOM_UPLOAD,".").concat(h.VIDEO_COVER)}),body:{version:1,platform:void 0,coverName:void 0,requestSnapshotUrl:void 0},keyMap:{req:{version:"version",platform:"platform",coverName:"cover_name",requestSnapshotUrl:"snapshot_url"},res:{error_code:"errorCode",error_msg:"errorInfo",download_url:"snapshotUrl"}}}),this._map.set(h.FETCH_COMMERCIAL_CONFIG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_CONFIG_MANAGER,".").concat(h.FETCH_COMMERCIAL_CONFIG)}),body:{SDKAppID:0},keyMap:{req:{SDKAppID:"uint32_sdkappid"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(h.PUSHED_COMMERCIAL_CONFIG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_CONFIG_MANAGER,".").concat(h.PUSHED_COMMERCIAL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_purchase_bits:"purchaseBits",uint32_expired_time:"expiredTime"}}}),this._map.set(h.FETCH_CLOUD_CTRL_CONFIG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_CONFIG_MANAGER,".").concat(h.FETCH_CLOUD_CTRL_CONFIG)}),body:{SDKAppID:0,version:0},keyMap:{req:{SDKAppID:"uint32_sdkappid",version:"uint64_version"},res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(h.PUSHED_CLOUD_CTRL_CONFIG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_CONFIG_MANAGER,".").concat(h.PUSHED_CLOUD_CTRL_CONFIG)}),body:{},keyMap:{res:{int32_error_code:"errorCode",str_error_message:"errorMessage",str_json_config:"cloudControlConfig",uint32_expired_time:"expiredTime",uint32_sdkappid:"SDKAppID",uint64_version:"version"}}}),this._map.set(h.OVERLOAD_NOTIFY,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OVERLOAD_PUSH,".").concat(h.OVERLOAD_NOTIFY)}),body:{},keyMap:{res:{OverLoadServCmd:"overloadCommand",DelaySecs:"waitingTime"}}}),this._map.set(h.SYNC_UNREAD_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SYNC_UNREAD_MSG)}),body:{cookie:"",syncFlag:0,needAbstract:1,isOnlineSync:0,needSignaling:1,needCachedMsg:1},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",from:"From_Account",to:"To_Account",time:"MsgTimeStamp",sequence:"MsgSeq",random:"MsgRandom",elements:"MsgBody"},res:{MsgList:"messageList",SyncFlag:"syncFlag",To_Account:"to",From_Account:"from",ClientSeq:"clientSequence",MsgSeq:"sequence",NoticeSeq:"noticeSequence",NotifySeq:"notifySequence",MsgRandom:"random",MsgTimeStamp:"time",MsgContent:"content",ToGroupId:"to",MsgKey:"messageKey",GroupTips:"groupTips",MsgBody:"elements",MsgType:"type",C2CRemainingUnreadCount:"C2CRemainingUnreadList",C2CPairUnreadCount:"C2CPairUnreadList"}}}),this._map.set(h.GET_PROFANITY_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_MSG_AUDIT_MGR,".").concat(h.GET_PROFANITY_LIST)}),body:{version:0,deviceID:"",startIndex:void 0},keyMap:{req:{version:"uint64_version",deviceID:"str_device_id",startIndex:"uint64_start_index"},res:{msg_cmd_error_code:"errorInfo",str_err_msg:"errorMessage",uint32_code:"errorCode",msg_scene_ctl_config:"filterConfig",uint64_c2c_custom_msg_flag:"c2c_custom_message",uint64_c2c_text_msg_flag:"c2c_text_message",uint64_group_custom_msg_flag:"group_custom_message",uint64_group_text_msg_flag:"group_text_message",uint64_group_info_flag:"group_profile",uint64_group_member_info_flag:"group_member_profile",uint64_relation_chain_flag:"sns",uint64_user_info_flag:"user_profile",rpt_msg_dirty_word:"lexicon",str_dirty_word:"profanity",str_replaced_content:"replacement",uint64_filter_type:"filterType",uint64_id:"id",uint64_word_type:"profanityType",uint64_complete_flag:"completeFlag",uint64_next_start_index:"nextStartIndex",uint64_version:"version",uint64_expired_time:"expiredTime"}}}),this._map.set(h.SEND_C2C_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SEND_C2C_MSG)}),body:{fromAccount:"",toAccount:"",msgSeq:0,msgRandom:0,msgBody:[],cloudCustomData:void 0,nick:"",avatar:"",msgLifeTime:void 0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:"",interruptionLevel:"active",contentAvailable:0},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",count:"MaxCnt",lastMessageTime:"LastMsgTime",messageKey:"MsgKey",peerAccount:"Peer_Account",data:"Data",description:"Desc",extension:"Ext",type:"MsgType",content:"MsgContent",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",nick:"From_AccountNick",avatar:"From_AccountHeadurl",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"IsNeedReadReceipt",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance",MeizuNotifyType:"MeiZuNoticeMsgType"}}}),this._map.set(h.SEND_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.SEND_GRP_MSG)}),body:{fromAccount:"",groupID:"",random:0,clientSequence:0,priority:"",msgBody:[],cloudCustomData:void 0,onlineOnlyFlag:0,offlinePushInfo:{pushFlag:0,title:"",desc:"",ext:"",apnsInfo:{sound:"",badgeMode:0,isVoipPush:void 0,image:"",interruptionLevel:"active",contentAvailable:0},androidInfo:{sound:"",XiaoMiChannelID:"",OPPOChannelID:"",GoogleChannelID:"",VIVOClassification:1,VIVOCategory:"",HuaWeiCategory:"",OPPOCategory:"",HuaWeiImage:"",HonorImage:"",GoogleImage:"",HonorImportance:"",MeizuNotifyType:void 0}},groupAtInfo:[],messageControlInfo:void 0,clientTime:void 0,needReadReceipt:0,topicID:void 0,receiverList:void 0,isSupportExtension:0,isRelayMessage:0,cmConfigID:void 0,forbidCallbackControl:void 0},keyMap:{req:{to:"GroupId",extension:"Ext",data:"Data",description:"Desc",random:"Random",sequence:"ReqMsgSeq",count:"ReqMsgNumber",type:"MsgType",priority:"MsgPriority",content:"MsgContent",elements:"MsgBody",sizeType:"Type",uuid:"UUID",url:"",imageUrl:"URL",fileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",clientSequence:"ClientSeq",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody",needReadReceipt:"NeedReadReceipt",receiverList:"To_Account",GoogleChannelID:"GoogleChannelID",XiaoMiChannelID:"XiaoMiChannelID",OPPOChannelID:"OPPOChannelID",OPPOCategory:"OPPOCategory",VIVOClassification:"VIVOClassification",VIVOCategory:"VIVOCategory",HonorImportance:"HonorImportance",MeizuNotifyType:"MeiZuNoticeMsgType"},res:{MsgTime:"time",MsgSeq:"sequence"}}}),this._map.set(h.REVOKE_C2C_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.REVOKE_C2C_MSG)}),body:{msgInfo:{fromAccount:"",toAccount:"",msgTimeStamp:0,msgSeq:0,msgRandom:0}},keyMap:{req:{msgInfo:"MsgInfo",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom"}}}),this._map.set(h.REVOKE_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.REVOKE_GRP_MSG)}),body:{groupID:"",msgSeqList:void 0,topicID:""},keyMap:{req:{msgSeqList:"MsgSeqList",msgSeq:"MsgSeq"}}}),this._map.set(h.GET_C2C_ROAMING_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.GET_C2C_ROAMING_MSG)}),body:{peerAccount:"",count:15,lastMessageTime:0,messageKey:"",withRecalledMessage:1,direction:0},keyMap:{req:{messageKey:"MsgKey",peerAccount:"Peer_Account",count:"MaxCnt",lastMessageTime:"LastMsgTime",withRecalledMessage:"WithRecalledMsg",direction:"GetDirection"},res:{LastMsgTime:"lastMessageTime",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer"}}}),this._map.set(h.MODIFY_C2C_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.MODIFY_C2C_MSG)}),body:{from:"",to:"",sequence:0,random:0,time:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(h.GET_GRP_ROAMING_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_ROAMING_MSG)}),body:{withRecalledMsg:1,groupID:"",count:15,sequence:void 0,topicID:void 0,getType:void 0,reqMsgSeqList:void 0},keyMap:{req:{sequence:"ReqMsgSeq",count:"ReqMsgNumber",withRecalledMessage:"WithRecalledMsg"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",NextReqMsgSeq:"nextSequence"}}}),this._map.set(h.SET_C2C_MSG_READ,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SET_C2C_MSG_READ)}),body:{C2CMsgReaded:void 0},keyMap:{req:{lastMessageTime:"LastedMsgTime"}}}),this._map.set(h.SET_C2C_PEER_MUTE_NOTIFICATIONS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{userIDList:void 0,muteFlag:0},keyMap:{req:{userIDList:"Peer_Account",muteFlag:"Mute_Notifications"}}}),this._map.set(h.GET_C2C_PEER_MUTE_NOTIFICATIONS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.GET_C2C_PEER_MUTE_NOTIFICATIONS)}),body:{toAccount:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Peer_Account"},res:{MuteNotificationsList:"muteFlagList"}}}),this._map.set(h.SET_GRP_MSG_READ,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.SET_GRP_MSG_READ)}),body:{groupID:void 0,messageReadSeq:void 0,topicID:void 0},keyMap:{req:{messageReadSeq:"MsgReadedSeq"}}}),this._map.set(h.SET_ALL_MSG_READ,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SET_ALL_MSG_READ)}),body:{readAllC2CMessage:0,groupMessageReadInfoList:[]},keyMap:{req:{readAllC2CMessage:"C2CReadAllMsg",groupMessageReadInfoList:"GroupReadInfo",messageSequence:"MsgSeq"},res:{C2CReadAllMsg:"readAllC2CMessage",GroupReadInfoArray:"groupMessageReadInfoList"}}}),this._map.set(h.DEL_C2C_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.DEL_C2C_MSG)}),body:{fromAccount:"",to:"",keyList:void 0},keyMap:{req:{keyList:"MsgKeyList"}}}),this._map.set(h.DEL_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.DEL_GRP_MSG)}),body:{groupID:"",deleter:"",keyList:void 0,topicID:void 0},keyMap:{req:{deleter:"Deleter_Account",keyList:"Seqs"}}}),this._map.set(h.TRANSLATE_TEXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_TRANSLATE,".").concat(h.TRANSLATE_TEXT)}),body:{sourceTextList:void 0,SDKAppID:0,from:0,source:"",target:""},keyMap:{req:{sourceTextList:"SourceText",SDKAppID:"SdkAppId",from:"FromAccount"},res:{TargetText:"translatedTextList",RequestId:"requestID",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(h.VOICE_TO_TEXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_SPEECH,".").concat(h.VOICE_TO_TEXT)}),body:{url:"",SDKAppID:0,format:"",sourceType:0,language:""},keyMap:{req:{url:"BytesUrl",SDKAppID:"Uint32Sdkappid",format:"BytesVoiceFormat",sourceType:"Uint64SourceType",language:"BytesEngServiceType"},res:{BytesRequestid:"requestID",BytesResult:"result",CmdErrorCode:"error",ErrorCode:"code",ErrorInfo:"message"}}}),this._map.set(h.MODIFY_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.MODIFY_GRP_MSG)}),body:{groupID:"",topicID:void 0,sequence:0,version:0,elements:void 0,cloudCustomData:void 0},keyMap:{req:{sequence:"MsgSeq",version:"MsgVersion",type:"MsgType",content:"MsgContent"}}}),this._map.set(h.GET_READ_RECEIPT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequence:"MsgSeq"}}}),this._map.set(h.SEND_C2C_READ_RECEIPT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.SEND_C2C_READ_RECEIPT)}),body:{peerAccount:"",messageInfoList:void 0},keyMap:{req:{peerAccount:"Peer_Account",messageInfoList:"C2CMsgInfo",fromAccount:"From_Account",toAccount:"To_Account",sequence:"MsgSeq",random:"MsgRandom",time:"MsgTime",clientTime:"MsgClientTime"}}}),this._map.set(h.SEND_READ_RECEIPT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.SEND_READ_RECEIPT)}),body:{groupID:"",sequenceList:void 0},keyMap:{req:{sequenceList:"MsgSeqList",sequence:"MsgSeq"}}}),this._map.set(h.GET_READ_RECEIPT_DETAIL,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_READ_RECEIPT_DETAIL)}),body:{groupID:"",sequence:void 0,flag:0,cursor:0,count:0},keyMap:{req:{sequence:"MsgSeq",count:"Num"},res:{ReadList:"readUserIDList",Read_Account:"userID",UnreadList:"unreadUserIDList",Unread_Account:"userID",IsFinish:"isCompleted"}}}),this._map.set(h.GET_GRP_RECEIPTS_BY_USERS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_RECEIPTS_BY_USERS)}),body:{groupID:"",dataList:void 0},keyMap:{req:{dataList:"MemberReadMsgList",sequence:"MsgSeq",userIDList:"MemberList_Account"},res:{MsgReadList:"dataList",Read_Account:"userID",Read_Time:"readTime"}}}),this._map.set(h.MODIFY_C2C_MSG_EXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.MODIFY_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(h.GET_C2C_MSG_EXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_C2C_MSG_EXT)}),body:{from:void 0,to:void 0,messageKey:void 0,startSequence:void 0}}),this._map.set(h.MODIFY_GRP_MSG_EXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.MODIFY_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,operateType:void 0,extensionList:void 0}}),this._map.set(h.GET_GRP_MSG_EXT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_GRP_MSG_EXT)}),body:{groupID:void 0,topicID:void 0,messageSequence:void 0,startSequence:void 0}}),this._map.set(h.ADD_C2C_MSG_REACTION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.ADD_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(h.RM_C2C_MSG_REACTION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.RM_C2C_MSG_REACTION)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(h.GET_C2C_MSG_REACTIONS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_C2C_MSG_REACTIONS)}),body:{from:void 0,to:void 0,messageKeyList:void 0,count:void 0}}),this._map.set(h.GET_C2C_MSG_REACTION_USER_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_C2C_MSG_REACTION_USER_LIST)}),body:{from:void 0,to:void 0,reactionID:void 0,messageKey:void 0,count:void 0}}),this._map.set(h.ADD_GRP_MSG_REACTION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.ADD_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Add_Account"}}}),this._map.set(h.RM_GRP_MSG_REACTION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.RM_GRP_MSG_REACTION)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,userIDList:void 0},keyMap:{req:{userIDList:"Del_Account"}}}),this._map.set(h.GET_GRP_MSG_REACTIONS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_GRP_MSG_REACTIONS)}),body:{groupID:void 0,topicID:void 0,messageSequenceList:void 0,count:void 0},keyMap:{res:{MsgSeq:"messageSequence"}}}),this._map.set(h.GET_GRP_MSG_REACTION_USER_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM_MSG_EXT,".").concat(h.GET_GRP_MSG_REACTION_USER_LIST)}),body:{groupID:void 0,topicID:void 0,reactionID:void 0,messageSequence:void 0,nextSeq:void 0,count:void 0}}),this._map.set(h.GET_C2C_PEER_READ_TIME,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.GET_C2C_PEER_READ_TIME)}),body:{userIDList:void 0},keyMap:{req:{userIDList:"To_Account"},res:{ReadTime:"peerReadTimeList"}}}),this._map.set(h.PAGING_GET_CONV_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.PAGING_GET_CONV_LIST)}),body:{fromAccount:void 0,timeStamp:void 0,startIndex:void 0,pinnedTimeStamp:void 0,pinnedStartIndex:void 0,orderType:void 0,messageAssistFlag:15,assistFlag:31},keyMap:{req:{messageAssistFlag:"MsgAssistFlags",assistFlag:"AssistFlags",pinnedTimeStamp:"TopTimeStamp",pinnedStartIndex:"TopStartIndex"},res:{SessionItem:"conversations",ToAccount:"groupID",To_Account:"userID",UnreadMsgCount:"unreadCount",MsgGroupReadedSeq:"messageReadSeq",C2cPeerReadTime:"c2cPeerReadTime",LastMsgFlags:"lastMessageFlag",TopFlags:"isPinned",TopTimeStamp:"pinnedTimeStamp",TopStartIndex:"pinnedStartIndex",GroupId:"convGroupID",C2cRemark:"friendRemark",MsgRecvOption:"messageRemindType",GroupIgnoredUnreadSeqCount:"noUnreadCount",GroupNextMsgSeq:"nextMessageSeq"}}}),this._map.set(h.DEL_CONV,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.DEL_CONV)}),body:{fromAccount:"",conversationList:void 0,clearHistoryMessage:void 0},keyMap:{req:{toGroupID:"ToGroupid",clearHistoryMessage:"ClearRamble",conversationList:"ContactItem"},res:{ResultItem:"resultList",ToGroupid:"groupID",ResultCode:"code",ResultInfo:"info"}}}),this._map.set(h.CLEAR_HISTORY_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.CLEAR_HISTORY_MSG)}),body:{fromAccount:"",toAccount:void 0,type:1,toGroupID:void 0},keyMap:{req:{toGroupID:"ToGroupid"}}}),this._map.set(h.PIN_CONV,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.PIN_CONV)}),body:{fromAccount:"",operationType:1,itemList:void 0},keyMap:{req:{itemList:"RecentContactItem"}}}),this._map.set(h.DEL_GROUP_AT_TIPS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.DEL_GROUP_AT_TIPS)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(h.SET_CONV_CUSTOM_DATA,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(h.MARK_CONV,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.MARK_CONV)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"MarkItem",operationType:"OptType",groupID:"ToGroupId"},res:{ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(h.CREATE_CONV_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.CREATE_CONV_GRP)}),body:{fromAccount:"",itemList:void 0},keyMap:{req:{itemList:"GroupContactItem",groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType"}}}),this._map.set(h.DEL_CONV_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.DEL_CONV_GRP)}),body:{fromAccount:"",groupName:void 0},keyMap:{res:{GroupId:"convGroupID"}}}),this._map.set(h.RENAME_CONV_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0},keyMap:{req:{oldName:"OldGroupName",newName:"NewGroupName",groupID:"ToGroupId",operationType:"ContactOptType",groupName:"OldGroupName",updateItem:"ContactUpdateItem"},res:{ContactOptType:"operationType",ToGroupId:"groupID",GroupId:"convGroupID"}}}),this._map.set(h.ADD_CONV_TO_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:{groupName:void 0,updateGroupType:void 0,updateItem:void 0}}}),this._map.set(h.DEL_CONV_FROM_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.RENAME_CONV_GRP)}),body:{fromAccount:"",updateType:void 0,updateGroup:void 0}}),this._map.set(h.GET_CONV_GRP_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.GET_CONV_GRP_LIST)}),body:{fromAccount:"",startIndex:void 0},keyMap:{res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList"}}}),this._map.set(h.SEARCH_CONV_GRP_MARK,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.RECENT_CONTACT,".").concat(h.SEARCH_CONV_GRP_MARK)}),body:{fromAccount:"",contactItem:void 0},keyMap:{req:{groupID:"ToGroupId"},res:{GroupId:"convGroupID",ToGroupId:"groupID",OptType:"operationType",CustomMark:"customData",ContactGroupId:"convGroupIDList",ContactResultItem:"contactItem"}}}),this._map.set(h.GET_USER_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.PROFILE,".").concat(h.GET_USER_PROFILE)}),body:{fromAccount:"",userItem:[]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(h.UPDATE_MY_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.PROFILE,".").concat(h.UPDATE_MY_PROFILE)}),body:{fromAccount:"",profileItem:[{tag:H.NICK,value:""},{tag:H.GENDER,value:""},{tag:H.ALLOWTYPE,value:""},{tag:H.AVATAR,value:""}]},keyMap:{req:{toAccount:"To_Account",standardSequence:"StandardSequence",customSequence:"CustomSequence"}}}),this._map.set(h.GET_BL,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.GET_BL)}),body:{fromAccount:"",startIndex:0,maxLimited:30}}),this._map.set(h.ADD_TO_BL,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.ADD_TO_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(h.RM_FROM_BL,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.RM_FROM_BL)}),body:{fromAccount:"",toAccount:[]}}),this._map.set(h.SET_SELF_STATUS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.SET_SELF_STATUS)}),body:{customStatus:""}}),this._map.set(h.GET_USER_STATUS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.GET_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{UserStatusList:"successUserList",ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID",Status:"statusType"}}}),this._map.set(h.SUB_USER_STATUS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.SUB_USER_STATUS)}),body:{userIDList:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(h.UNSUB_USER_STATUS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.UNSUB_USER_STATUS)}),body:{userIDList:void 0,unsubscribeAll:void 0},keyMap:{res:{ErrorList:"failureUserList",To_Account:"userID",Invalid_Account:"invalidUserID"}}}),this._map.set(h.GET_FD_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.GET_FD_LIST)}),body:{fromAccount:"",startIndex:0,standardSequence:0,customSequence:0},keyMap:{res:{FriendNum:"friendCount",UserDataItem:"resultList",ValueItem:"tagValueList"}}}),this._map.set(h.ADD_FD,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.ADD_FD)}),body:{fromAccount:"",addFriendItem:[],type:""},keyMap:{req:{source:"AddSource",wording:"AddWording",type:"AddType"},res:{ResultItem:"resultList"}}}),this._map.set(h.UPDATE_FD,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.UPDATE_FD)}),body:{fromAccount:"",updateItem:void 0},keyMap:{req:{snsItem:"SnsItem"},res:{ResultItem:"resultList"}}}),this._map.set(h.DEL_FD,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.DEL_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"DeleteType"},res:{ResultItem:"resultList"}}}),this._map.set(h.GET_FD_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.GET_FD_PROFILE)}),body:{fromAccount:"",userIDList:void 0},keyMap:{res:{InfoItem:"resultList",SnsProfileItem:"tagValueList"}}}),this._map.set(h.CHECK_FD,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.CHECK_FD)}),body:{fromAccount:"",userIDList:[],type:""},keyMap:{req:{type:"CheckType"},res:{InfoItem:"resultList"}}}),this._map.set(h.GET_FD_APPLICATION_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.GET_FD_APPLICATION_LIST)}),body:{fromAccount:"",applicationType:"",startTime:0,maxLimited:0,lastSequence:0},keyMap:{res:{PendencyItem:"resultList",AddSource:"source",AddTime:"time",AddWording:"wording",Image:"avatar",UnreadPendencyCount:"unreadCount",To_Account:"userID",PendencyType:"type"}}}),this._map.set(h.RESPOND_FD_APPLICATION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.RESPOND_FD_APPLICATION)}),body:{fromAccount:"",responseFriendItem:[]},keyMap:{req:{tag:"TagName",action:"ResponseAction"},res:{ResultItem:"resultList"}}}),this._map.set(h.DEL_FD_APPLICATION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.DEL_FD_APPLICATION)}),body:{fromAccount:"",type:"",userIDList:void 0},keyMap:{req:{type:"PendencyType",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(h.REPORT_FD_APPLICATION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.REPORT_FD_APPLICATION)}),body:{fromAccount:"",latestTimeStamp:""},keyMap:{req:{latestTimeStamp:"LatestPendencyTimeStamp"}}}),this._map.set(h.CREATE_FD_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.CREATE_FD_GRP)}),body:{fromAccount:"",groupName:void 0,userIDList:void 0},keyMap:{req:{groupName:"GroupName",userIDList:"To_Account"},res:{ResultItem:"resultList"}}}),this._map.set(h.DEL_FD_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.DEL_FD_GRP)}),body:{fromAccount:"",nameList:void 0},keyMap:{req:{nameList:"GroupName"}}}),this._map.set(h.GET_FD_GRP_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.GET_FD_GRP_LIST)}),body:{fromAccount:"",lastSequence:0,needFriend:"Need_Friend_Type_Yes"},keyMap:{res:{ResultItem:"resultList",GroupName:"name",FriendNumber:"friendCount",To_Account:"userIDList"}}}),this._map.set(h.UPDATE_FD_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FD,".").concat(h.UPDATE_FD_GRP)}),body:{fromAccount:"",oldName:"",newName:void 0,updateGroupItem:void 0},keyMap:{req:{oldName:"GroupOldName",newName:"GroupNewName"},res:{UpdateType:"type",ResultItem:"resultList"}}}),this._map.set(h.GET_GRP_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_LIST)}),body:{memberAccount:"",limit:void 0,offset:void 0,groupType:void 0,responseFilter:{groupBaseInfoFilter:void 0,selfInfoFilter:void 0},isSupportTopic:0,needAppDefineData:1},keyMap:{req:{memberAccount:"Member_Account"},res:{GroupIdList:"groups",MsgSeq:"readedSequence",LastRecallTime:"_lastRevokedTime",AppDefinedData:"groupCustomField",MuteAllMember:"muteAllMembers"}}}),this._map.set(h.GET_GRP_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_PROFILE)}),body:{groupIDList:void 0,responseFilter:{groupBaseInfoFilter:void 0,groupCustomFieldFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0}},keyMap:{req:{groupIDList:"GroupIdList",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",groupCustomFieldFilter:"AppDefinedDataFilter_Group",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{GroupIdList:"groups",AppDefinedData:"groupCustomField",AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_Group:"groupCustomFieldFilter",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",InfoSeq:"infoSequence",MemberList:"members",GroupInfo:"groups",ShutUpUntil:"muteUntil",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(h.CREATE_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.CREATE_GRP)}),body:{type:void 0,name:void 0,groupID:void 0,ownerID:void 0,introduction:void 0,notification:void 0,maxMemberNum:void 0,joinOption:void 0,memberList:void 0,groupCustomField:void 0,memberCustomField:void 0,webPushFlag:1,avatar:"",isSupportTopic:void 0,inviteOption:void 0},keyMap:{req:{ownerID:"Owner_Account",userID:"Member_Account",avatar:"FaceUrl",maxMemberNum:"MaxMemberCount",joinOption:"ApplyJoinOption",groupCustomField:"AppDefinedData",memberCustomField:"AppMemberDefinedData",inviteOption:"InviteJoinOption"},res:{HugeGroupFlag:"avChatRoomFlag",OverJoinedGroupLimit_Account:"overLimitUserIDList"}}}),this._map.set(h.DISMISS_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.DISMISS_GRP)}),body:{groupID:void 0}}),this._map.set(h.UPDATE_GRP_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.UPDATE_GRP_PROFILE)}),body:{groupID:void 0,name:void 0,introduction:void 0,notification:void 0,avatar:void 0,joinOption:void 0,groupCustomField:void 0,muteAllMembers:void 0,inviteOption:void 0},keyMap:{req:{groupCustomField:"AppDefinedData",muteAllMembers:"ShutUpAllMember",joinOption:"ApplyJoinOption",avatar:"FaceUrl",inviteOption:"InviteJoinOption"},res:{AppDefinedData:"groupCustomField",ShutUpAllMember:"muteAllMembers"}}}),this._map.set(h.APPLY_JOIN_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1,historyMessageFlag:void 0},keyMap:{req:{applyMessage:"ApplyMsg",historyMessageFlag:"HugeGroupHistoryMsgFlag"},res:{HugeGroupFlag:"avChatRoomFlag",AVChatRoomKey:"avChatRoomKey",RspMsgList:"messageList",ToGroupId:"to"}}}),this._map.set(h.APPLY_JOIN_GRP_NOAUTH,(e.a2,e.tinyid,{head:p(p({},Fe(e,Tr)),{},{servcmd:"".concat(E.NAME.BIG_GRP_NO_AUTH,".").concat(h.APPLY_JOIN_GRP)}),body:{groupID:void 0,applyMessage:void 0,userDefinedField:void 0,webPushFlag:1},keyMap:{req:{applyMessage:"ApplyMsg"},res:{HugeGroupFlag:"avChatRoomFlag"}}})),this._map.set(h.QUIT_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.QUIT_GRP)}),body:{groupID:void 0}}),this._map.set(h.SEARCH_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.SEARCH_GRP)}),body:{groupIDList:void 0,responseFilter:{groupBasePublicInfoFilter:["Type","Name","Introduction","Notification","FaceUrl","CreateTime","Owner_Account","LastInfoTime","LastMsgTime","NextMsgSeq","MemberNum","MaxMemberNum","ApplyJoinOption","InviteJoinOption"]}}}),this._map.set(h.CHANGE_GRP_OWNER,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.CHANGE_GRP_OWNER)}),body:{groupID:void 0,newOwnerID:void 0},keyMap:{req:{newOwnerID:"NewOwner_Account"}}}),this._map.set(h.HANDLE_GRP_APPLICATION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.HANDLE_GRP_APPLICATION)}),body:{groupID:void 0,applicant:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(h.HANDLE_INVITE_JOIN_GRP,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.HANDLE_INVITE_JOIN_GRP)}),body:{groupID:void 0,applicant:void 0,invitee:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,userDefinedField:void 0},keyMap:{req:{applicant:"Applicant_Account",invitee:"Invited_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg"}}}),this._map.set(h.HANDLE_GRP_INVITATION,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.HANDLE_GRP_INVITATION)}),body:{groupID:void 0,inviter:void 0,handleAction:void 0,handleMessage:void 0,authentication:void 0,messageKey:void 0,userDefinedField:void 0},keyMap:{req:{inviter:"Inviter_Account",handleAction:"HandleMsg",handleMessage:"ApprovalMsg",messageKey:"MsgKey"}}}),this._map.set(h.GET_GRP_PENDENCY,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_PENDENCY)}),body:{startTime:void 0,limit:void 0,handleAccount:void 0},keyMap:{req:{handleAccount:"Handle_Account"},res:{To_Account:"userID",ApplyInviteMsg:"note"}}}),this._map.set(h.DEL_GRP_SYSTEM_NOTICE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.DEL_GRP_SYSTEM_NOTICE)}),body:{messageListToDelete:void 0},keyMap:{req:{messageListToDelete:"DelMsgList",messageSeq:"MsgSeq",messageRandom:"MsgRandom"}}}),this._map.set(h.AV_POLLING,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.BIG_GRP_POLLING,".").concat(h.AV_POLLING)}),body:{USP:1,startSeq:1,startBroadcastSeq:void 0,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}}),this._map.set(h.AV_NOAUTH_POLLING,(e.a2,e.tinyid,{head:p(p({},Fe(e,Dr)),{},{servcmd:"".concat(E.NAME.BIG_GRP_POLLING_NO_AUTH,".").concat(h.AV_POLLING)}),body:{USP:1,startSeq:1,holdTime:90,key:void 0,simplifiedMessage:void 0},keyMap:{req:{USP:"USP"},res:{ToGroupId:"groupID",RspBroadcastMsgList:"broadcastMessageList",IsSystemMsg:"isSystemMessage"}}})),this._map.set(h.GET_ONLINE_MBR_NUM,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_ONLINE_MBR_NUM)}),body:{groupID:void 0},keyMap:{res:{OnlineMemberNum:"memberCount"}}}),this._map.set(h.SET_GRP_ATTR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.SET_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(h.MODIFY_GRP_ATTR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.MODIFY_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key",value:"value"}}}),this._map.set(h.DEL_GRP_ATTR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.DEL_GRP_ATTR)}),body:{groupID:void 0,groupAttributeList:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]},keyMap:{req:{key:"key"}}}),this._map.set(h.CLEAR_GRP_ATTR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.CLEAR_GRP_ATTR)}),body:{groupID:void 0,mainSequence:void 0,avChatRoomKey:void 0,attributeControl:["RaceConflict"]}}),this._map.set(h.GET_GRP_ATTR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_ATTR,".").concat(h.GET_GRP_ATTR)}),body:{groupID:void 0,avChatRoomKey:void 0,groupType:1},keyMap:{req:{avChatRoomKey:"Key",groupType:"GroupType"}}}),this._map.set(h.GET_GRP_NOTIFY,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_NOTIFY)}),body:{notifyReqList:[]},keyMap:{req:{notifyReqList:"NotifyReqList"},res:{NextMsgTime:"nextRevokedTime",NotifyMsgList:"notifyList",NotifyRspList:"notifyRspList"}}}),this._map.set(h.UPDATE_GRP_COUNTER,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.UPDATE_GRP_COUNTER)}),body:{groupID:void 0,counterList:void 0,avChatRoomKey:void 0,mode:void 0},keyMap:{req:{counterList:"GroupCounter"}}}),this._map.set(h.GET_GRP_COUNTER,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_COUNTER)}),body:{groupID:void 0,keyList:[],avChatRoomKey:void 0},keyMap:{req:{keyList:"GroupCounterKeys"}}}),this._map.set(h.PIN_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.PIN_GRP_MSG)}),body:{groupID:void 0,topicID:void 0,sequence:void 0,operator:void 0},keyMap:{req:{sequence:"MsgSeq",operator:"Pinner_Account"}}}),this._map.set(h.UNPIN_GRP_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.UNPIN_GRP_MSG)}),body:{groupID:void 0,topicID:void 0,sequence:void 0,operator:void 0},keyMap:{req:{sequence:"MsgSeq",operator:"UnPinner_Account"}}}),this._map.set(h.GET_PINNED_GRP_MSG_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_PINNED_GRP_MSG_LIST)}),body:{groupID:void 0,topicID:void 0},keyMap:{res:{PinnedMsgList:"pinnedMessageList",Pinner_Account:"userID"}}}),this._map.set(h.GET_LIVE_HISTORY_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_LIVE_HISTORY_MSG)}),body:{groupID:"",longPollingKey:void 0,startSeq:void 0},keyMap:{req:{startSeq:"PullPreSeq"},res:{Random:"random",MsgTime:"time",MsgSeq:"sequence",ReqMsgSeq:"sequence",RspMsgList:"messageList",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgPriority:"priority",MsgBody:"elements",MsgType:"type",MsgContent:"content",IsFinished:"complete",Download_Flag:"downloadFlag",ClientSeq:"clientSequence",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(h.CREATE_TOPIC,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_COMMUNITY,".").concat(h.CREATE_TOPIC)}),body:{groupID:void 0,topicName:void 0,avatar:void 0,customData:void 0,topicID:void 0,notification:void 0,introduction:void 0},keyMap:{req:{avatar:"FaceUrl"}}}),this._map.set(h.DEL_TOPIC,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_COMMUNITY,".").concat(h.DEL_TOPIC)}),body:{groupID:void 0,topicIDList:void 0},keyMap:{req:{topicIDList:"TopicIdList"},res:{DestroyResultItem:"resultList"}}}),this._map.set(h.UPDATE_TOPIC_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_COMMUNITY,".").concat(h.UPDATE_TOPIC_PROFILE)}),body:{groupID:void 0,topicID:void 0,avatar:void 0,customData:void 0,notification:void 0,introduction:void 0,muteAllMembers:void 0,topicName:void 0},keyMap:{req:{avatar:"FaceUrl",muteAllMembers:"ShutUpAllMember"}}}),this._map.set(h.GET_TOPIC_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_COMMUNITY,".").concat(h.GET_TOPIC_LIST)}),body:{groupID:void 0,topicIDList:void 0,MemberInfoFilter:["NoUnreadSeqList"]},keyMap:{req:{topicIDList:"TopicIdList"},res:{TopicAndSelfInfo:"topicInfoList",TopicInfo:"topic",GroupID:"groupID",ShutUpTime:"muteTime",ShutUpAllFlag:"muteAllMembers",LastMsgTime:"lastMessageTime",MsgSeq:"readedSequence",LastMsgSeq:"sequence"}}}),this._map.set(h.GET_GRP_MBR_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_MBR_LIST)}),body:{groupID:void 0,limit:0,offset:void 0,next:void 0,memberRoleFilter:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{AppMemberDefinedData:"memberCustomField",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",MemberList:"members",ShutUpUntil:"muteUntil"}}}),this._map.set(h.GET_AV_MBR_LIST,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_AV,".").concat(h.GET_AV_MBR_LIST)}),body:{groupID:void 0,offset:void 0,filter:void 0},keyMap:{req:{offset:"Timestamp",filter:"Mark"},res:{NextTimestamp:"offset"}}}),this._map.set(h.GET_GRP_MBR_PROFILE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.GET_GRP_MBR_PROFILE)}),body:{groupID:void 0,userIDList:void 0,memberInfoFilter:void 0,memberCustomFieldFilter:void 0},keyMap:{req:{userIDList:"Member_List_Account",memberCustomFieldFilter:"AppDefinedDataFilter_GroupMember"},res:{MemberList:"members",ShutUpUntil:"muteUntil",AppDefinedDataFilter_GroupMember:"memberCustomFieldFilter",AppMemberDefinedData:"memberCustomField"}}}),this._map.set(h.ADD_GRP_MBR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.ADD_GRP_MBR)}),body:{groupID:void 0,silence:void 0,userIDList:void 0},keyMap:{req:{userID:"Member_Account",userIDList:"MemberList"},res:{MemberList:"members"}}}),this._map.set(h.DEL_GRP_MBR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.DEL_GRP_MBR)}),body:{groupID:void 0,userIDList:void 0,reason:void 0},keyMap:{req:{userIDList:"MemberToDel_Account"}}}),this._map.set(h.BAN_AV_MBR,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.BAN_AV_MBR)}),body:{groupID:void 0,userIDList:void 0,duration:void 0,reason:""},keyMap:{req:{userIDList:"Members_Account",duration:"Duration",reason:"Description"}}}),this._map.set(h.MODIFY_GRP_MBR_INFO,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP,".").concat(h.MODIFY_GRP_MBR_INFO)}),body:{groupID:void 0,topicID:void 0,userID:void 0,messageRemindType:void 0,nameCard:void 0,role:void 0,memberCustomField:void 0,muteTime:void 0},keyMap:{req:{userID:"Member_Account",memberCustomField:"AppMemberDefinedData",muteTime:"ShutUpTime",messageRemindType:"MsgFlag"}}}),this._map.set(h.MARK_AV_MBR_INFO,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_AV,".").concat(h.MARK_AV_MBR_INFO)}),body:{groupID:void 0,operationType:1,memberList:[]},keyMap:{req:{operationType:"CommandType",memberList:"MemberList",markType:"Marks",userID:"Member_Account"},res:{CommandType:"operationType",Marks:"markType",Member_Account:"userID"}}}),this._map.set(h.CS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.MSG_SEARCH,".").concat(h.CS)}),body:{keywordList:void 0,keywordListMatchType:"or",account:void 0,groupID:void 0,count:100,cursor:void 0,messageTypeList:void 0,senderUserIDList:void 0,startTime:void 0,endTime:void 0},keyMap:{req:{keywordListMatchType:"MatchType",account:"PeerAccount",groupID:"GroupID",messageTypeList:"MsgTypeList",senderUserIDList:"SendUserIDList",keywords:"Keywords",keywordMatchType:"KeywordMatchType",count:"Count",miniBirthday:"UserBirthStart",maxBirthday:"UserBirthEnd",gender:"UserGenderType",groupTypeList:"GroupType",groupIDList:"GroupIdList"},res:{GroupID:"groupID",UserID:"userID",ErrorCode:"code",ErrorInfo:"message",TotalCount:"totalCount",Count:"messageCount",LastMsgTime:"lastMessageTime",ConversationMsgs:"searchResult",IsNeedReadReceipt:"needReadReceipt",IsPeerRead:"readReceiptSentByPeer",MsgSeq:"sequence",ReqMsgSeq:"sequence",IsSystemMsg:"isSystemMessage",ToGroupId:"to",EnumFrom_AccountType:"fromAccountType",EnumTo_AccountType:"toAccountType",GroupCode:"groupCode",MsgContent:"content",ClientSeq:"clientSequence",ToTopicId:"topicID",InvisibleMsgSeq:"invisibleSequenceList",Users:"userList",ProfileItems:"profileItems",StrValue:"value",IntValue:"value",Groups:"groupList",GroupFaceUrl:"avatar",GroupIntroduction:"introduction",GroupOwnerUserID:"ownerID",GroupOwnerUserName:"ownerNick",GroupOwnerTinyID:"ownerTinyID",GroupMemberNum:"memberNum",GroupAddOption:"joinOption",GroupInviteOption:"inviteOption",GroupName:"name",GroupType:"type",GroupMembers:"groupMemberList",GroupMemberUserID:"userID",GroupMemberTinyID:"userTinyID",GroupMemberUserName:"nick",GroupMemberNameCard:"nameCard",GroupMemberAvatar:"memberAvatar"}}}),this._map.set(h.USER_CS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.USER_SEARCH,".").concat(h.CS)}),body:{keywords:void 0,keywordMatchType:0,miniBirthday:void 0,maxBirthday:void 0,gender:void 0,count:20,cursor:void 0}}),this._map.set(h.GRP_CS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_SEARCH,".").concat(h.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,count:20,cursor:void 0}}),this._map.set(h.MBR_CS,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.GRP_MEMBER_SEARCH,".").concat(h.CS)}),body:{keywords:void 0,keywordMatchType:0,groupType:void 0,groupIDList:void 0,count:20,cursor:void 0}}),this._map.set(h.SSO_STAT,{head:p(p({},n),{},{servcmd:"".concat(E.NAME.IM_OPEN_STAT,".").concat(h.SSO_STAT)}),body:{header:{},event:[],quality:[]},keyMap:{req:{SDKType:"sdk_type",SDKVersion:"sdk_version",deviceType:"device_type",platform:"platform",instanceID:"instance_id",traceID:"trace_id",SDKAppID:"sdk_app_id",userID:"user_id",tinyID:"tiny_id",extension:"extension",timestamp:"timestamp",networkType:"network_type",eventType:"event_type",code:"error_code",message:"error_message",moreMessage:"more_message",duplicate:"duplicate",costTime:"cost_time",level:"level",qualityType:"quality_type",reportIndex:"report_index",wholePeriod:"whole_period",totalCount:"total_count",rttCount:"success_count_business",successRateOfRequest:"percent_business",countLessThan1Second:"success_count_business",percentOfCountLessThan1Second:"percent_business",countLessThan3Second:"success_count_platform",percentOfCountLessThan3Second:"percent_platform",successCountOfBusiness:"success_count_business",successRateOfBusiness:"percent_business",successCountOfPlatform:"success_count_platform",successRateOfPlatform:"percent_platform",successCountOfMessageReceived:"success_count_business",successRateOfMessageReceived:"percent_business",avgRTT:"average_value",avgDelay:"average_value",avgValue:"average_value",uiPlatform:"ui_platform"}}}),this._map.set(h.PING,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.HEARTBEAT,".").concat(h.PING)}),body:{}}),this._map.set(h.MSG_PUSH,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_PUSH,".").concat(h.MSG_PUSH)}),body:{},keyMap:{res:{C2cMsgArray:"C2CMessageArray",GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",C2cNotifyMsgArray:"C2CNotifyMessageArray",C2cMsgInfo:"C2CReadReceiptArray",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyAdd_Account:"userID",ProfileImNick:"nick",PendencyType:"applicationType",C2CReadAllMsg:"readAllC2CMessage",IsNeedReadReceipt:"needReadReceipt",Status:"statusType"}}}),this._map.set(h.MULTI_MSG_PUSH,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_PUSH,".").concat(h.MULTI_MSG_PUSH)}),body:{},keyMap:{res:{GroupMsgArray:"groupMessageArray",GroupTips:"groupTips",ClientSeq:"clientSequence",MsgPriority:"priority",NoticeSeq:"noticeSequence",MsgContent:"content",MsgType:"type",MsgBody:"elements",ToGroupId:"to",Desc:"description",Ext:"extension",IsSyncMsg:"isSyncMessage",Flag:"needSync",NeedAck:"needAck",PendencyType:"applicationType"}}}),this._map.set(h.MSG_PUSH_ACK,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OPEN_IM,".").concat(h.MSG_PUSH_ACK)}),body:{sessionData:void 0},keyMap:{req:{sessionData:"SessionData"}}}),this._map.set(h.STATUS_FORCE_OFFLINE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.STATUS_FORCE_OFFLINE)}),body:{},keyMap:{res:{C2cNotifyMsgArray:"C2CNotifyMessageArray",NoticeSeq:"noticeSequence",KickoutMsgNotify:"kickoutMsgNotify",NewInstInfo:"newInstanceInfo"}}}),this._map.set(h.DOWNLOAD_MERGER_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_LONG_MSG,".").concat(h.DOWNLOAD_MERGER_MSG)}),body:{downloadKey:""},keyMap:{res:{Data:"data",Desc:"description",Ext:"extension",Download_Flag:"downloadFlag",ThumbUUID:"thumbUUID",VideoUUID:"videoUUID"}}}),this._map.set(h.UPLOAD_MERGER_MSG,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_LONG_MSG,".").concat(h.UPLOAD_MERGER_MSG)}),body:{messageList:[]},keyMap:{req:{fromAccount:"From_Account",toAccount:"To_Account",msgTimeStamp:"MsgTimeStamp",msgSeq:"MsgSeq",msgRandom:"MsgRandom",msgBody:"MsgBody",type:"MsgType",content:"MsgContent",data:"Data",description:"Desc",extension:"Ext",sizeType:"Type",uuid:"UUID",url:"",fileUrl:"",imageUrl:"URL",remoteFileUrl:"Url",remoteAudioUrl:"Url",remoteVideoUrl:"VideoUrl",thumbUUID:"ThumbUUID",videoUUID:"VideoUUID",videoUrl:"",downloadFlag:"Download_Flag",from:"From_Account",time:"MsgTimeStamp",messageRandom:"MsgRandom",messageSequence:"MsgSeq",elements:"MsgBody",clientSequence:"ClientSeq",payload:"MsgContent",messageList:"MsgList",messageNumber:"MsgNum",abstractList:"AbstractList",messageBody:"MsgBody"}}}),this._map.set(h.FOLLOW,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FOLLOW,".").concat(h.FOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"FollowItem"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(h.UNFOLLOW,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FOLLOW,".").concat(h.UNFOLLOW)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(h.GET_FOLLOW_INFO,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FOLLOW,".").concat(h.GET_FOLLOW_INFO)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{FollowInfo:"followInfoList",To_Account:"userID",FollowerCount:"followersCount",FollowingCount:"followingCount",MutualFollowingCount:"mutualFollowersCount"}}}),this._map.set(h.GET_FOLLOW,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FOLLOW,".").concat(h.GET_FOLLOW)}),body:{fromAccount:"",type:1,nextCursor:"",count:500},keyMap:{req:{type:"FollowType",nextCursor:"StartCursor",count:"WantNum"},res:{FollowItem:"resultList",To_Account:"userID",ProfileItem:"profileList"}}}),this._map.set(h.CHECK_FOLLOW_TYPE,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.FOLLOW,".").concat(h.CHECK_FOLLOW_TYPE)}),body:{fromAccount:"",userIDList:[]},keyMap:{req:{userIDList:"To_Account"},res:{ResultItem:"resultList",To_Account:"userID"}}}),this._map.set(h.SET_TOKEN,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.SET_TOKEN)}),body:{tokenID:"",pushMsg:0,sdkAppID:0,businessID:"",deviceBrand:"",deviceToken:"",isTpns:0,isWebUniapp:0,notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:""},keyMap:{req:{tokenID:"TokenID",pushMsg:"PushMsg",sdkAppID:"EnterVersion",businessID:"BusiID",deviceBrand:"InstType",deviceToken:"VarToken",isTpns:"IsTpns",notificationStatus:"NotificationStatus",deviceModel:"DeviceModel",systemVersion:"SystemVersion",pushVersion:"PushPluginVersion"}}}),this._map.set(h.STAT_FOREGROUND,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.STAT_FOREGROUND)}),body:{isWebUniapp:0}}),this._map.set(h.STAT_BACKGROUND,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_OPEN_STATUS,".").concat(h.STAT_BACKGROUND)}),body:{C2CUnread:0,GroupUnread:0,isWebUniapp:0},keyMap:{req:{c2cUnreadCount:"C2cUnread",groupUnreadCount:"GrpUnread"}}}),this._map.set(h.PUSH_REPORT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.OFFLINE_PUSH_REPORT,".").concat(h.PUSH_REPORT)}),body:{eventList:[]},keyMap:{req:{eventList:"UinappPushEvents",type:"EventType",time:"EventTime",pushId:"ClickExt"}}}),this._map.set(h.SET_ALL_RECEIVE_MSG_OPT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_MSG_LOGIC,".").concat(h.SET_ALL_RECEIVE_MSG_OPT)}),body:{startTime:0,endTime:0,isRepeated:0,messageRemindType:0},keyMap:{req:{messageRemindType:"Level"}}}),this._map.set(h.GET_ALL_RECEIVE_MSG_OPT,{head:p(p({},e),{},{servcmd:"".concat(E.NAME.IM_MSG_LOGIC,".").concat(h.GET_ALL_RECEIVE_MSG_OPT)}),body:{toAccount:void 0}})}},{key:"has",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"update",value:function(){this._fillMap()}},{key:"getKeyMap",value:function(e){return this.has(e)?this.get(e).keyMap||{}:(d.w("".concat(this._n,".getKeyMap unknown P:").concat(e)),{})}},{key:"getProtocolData",value:function(n){var o=n.P,t=n.data,n=this.get(o),o=null;if(t){var s,a=this._simpleDeepCopy(n),a=this._updateService(t,a),i=a.body,r=Object.create(null);for(s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(r[s]=i[s],t[s]===void 0)continue;r[s]=t[s]}a.body=r,o=this._getUplinkData(a)}else o=this._getUplinkData(n);return o}},{key:"_getUplinkData",value:function(t){var t=this._dataCleaner(t),n=wo(t.head),n=fr(t.body,this._getReqKeyMap(n));return t.body=n,t}},{key:"_updateService",value:function(e,t){var n,o,s=wo(t.head);return this._isFromGroupRequest(t)&&(n=e.type,o=e.groupID,e=(e=e.groupIDList)===void 0?[]:e,T(o=o===void 0?void 0:o)&&(o=e[0]||""),we({type:n,groupID:o}))&&(t.head.servcmd="".concat(E.NAME.GRP_COMMUNITY,".").concat(s)),t}},{key:"_isFromGroupRequest",value:function(e){return e.head.servcmd.includes(E.NAME.GRP)||e.head.servcmd.includes(E.NAME.GRP_ATTR)}},{key:"_getReqKeyMap",value:function(e){return e=this.getKeyMap(e),p(p({},Qn.req),e.req)}},{key:"_dataCleaner",value:function(e){var t,n=Array.isArray(e)?[]:Object.create(null);for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&zs(t)&&e[t]!==null&&e[t]!==void 0&&(ut(e[t])!=="object"?n[t]=e[t]:n[t]=this._dataCleaner.bind(this)(e[t]));return n}},{key:"_simpleDeepCopy",value:function(e){for(var t,n=Object.keys(e),o={},s=0,a=n.length;s<a;s++)t=n[s],O(e[t])?o[t]=Array.from(e[t]):at(e[t])?o[t]=this._simpleDeepCopy(e[t]):o[t]=e[t];return o}}]),Lr=[h.MSG_PUSH_ACK],Sr=b(function e(t){U(this,e),this._sessionM=t,this._n="MsgDispatcher",this._eventHandlerMap=new Map,this._eventHandlerMap.set("C2CMessageArray",this._onC2CMsgArray.bind(this)),this._eventHandlerMap.set("groupMessageArray",this._onGroupMsgArray.bind(this)),this._eventHandlerMap.set("groupTips",this._onGroupTips.bind(this)),this._eventHandlerMap.set("C2CNotifyMessageArray",this._onC2CNotifyMsgArray.bind(this)),this._eventHandlerMap.set("C2CReadReceiptArray",this._onC2CReadReceiptArray.bind(this)),this._eventHandlerMap.set("profileModify",this._onProfileModified.bind(this)),this._eventHandlerMap.set("friendListMod",this._onRelationChainModified.bind(this)),this._eventHandlerMap.set("recentContactMod",this._onRecentContact.bind(this)),this._eventHandlerMap.set("readAllC2CMessage",this._onAllMsgRead.bind(this)),this._eventHandlerMap.set("c2cMessageModified",this._onC2CMsgModified.bind(this)),this._eventHandlerMap.set("groupMessageModified",this._onGroupMsgModified.bind(this)),this._eventHandlerMap.set("userStatusList",this._onUserStatusList.bind(this)),this._eventHandlerMap.set("messageExtensionNotify",this._onMsgExtNotify.bind(this)),this._eventHandlerMap.set("messageReactionNotifyList",this._onMsgReactionNotifyList.bind(this)),this._eventHandlerMap.set("messageReactionNotify",this._onMsgReactionNotify.bind(this)),this._eventHandlerMap.set("followChangeList",this._onFollowNotify.bind(this)),this._keys=G(this._eventHandlerMap.keys())},[{key:"_onC2CMsgArray",value:function(e){var t=this._sessionM.get(6);e.dataList.forEach(function(n){var o;n.isSyncMessage===1&&(o=n.from,n.from=n.to,n.to=o)}),e.needSync===1&&this._sessionM.get(19).syncOnNeed(),t.onNewMessage({dataList:e.dataList,isInstantMessage:!0})}},{key:"_onC2CMsgModified",value:function(e){this._sessionM.get(6).onMsgModified(e)}},{key:"_onGroupMsgArray",value:function(e){var t=this._sessionM.get(7);t&&t.onNewMessage({event:e.event,dataList:e.dataList,isInstantMessage:!0})}},{key:"_onGroupMsgModified",value:function(e){var t=this._sessionM.get(7);t&&t.onMsgModified(e)}},{key:"_onGroupTips",value:function(e){var t=this._sessionM.get(7);if(t){var n=e.event,o=e.dataList,s=e.isInstantMessage,a=s===void 0||s,i=e.isSyncingEnded;switch(n){case 4:case 6:t.onNewGroupTips({event:n,dataList:o});break;case 5:for(var r=0;r<o.length;r++)if(O(o[r].elements.revokedInfos))t.onMsgRevoked({dataList:o});else if(O(o[r].elements.groupMessageReadNotice))t.onMsgReadNotice({dataList:o});else{if(!O(o[r].elements.readReceiptList)){t.onNewGroupSystemNotice({dataList:o,isInstantMessage:a,isSyncingEnded:i});break}t.onReadReceiptList({dataList:o})}break;case 12:this._sessionM.get(11).onNewGroupAtTips({dataList:o});break;default:d.l("".concat(this._n,"._onGroupTips unknown event:").concat(n," dataList:"),o)}}}},{key:"_onC2CNotifyMsgArray",value:function(e){var t,n=this,o=e.dataList;O(o)&&(t=this._sessionM.get(6),o.forEach(function(s){var a,i;Q(s)&&(s.hasOwnProperty("kickoutMsgNotify")?(a=(i=s.kickoutMsgNotify).kickType,i=(i=i.newInstanceInfo)===void 0?{}:i,a===1?n._sessionM.onMultipleAccountKickedOut(i):a===2?n._sessionM.onMultipleDeviceKickedOut(i):a===3&&n._sessionM.onRestApiKickedOut(i)):s.hasOwnProperty("c2cMessageRevokedNotify")?t&&t.onMsgRevoked({dataList:o},!0):s.hasOwnProperty("c2cMessageReadReceipt")?t&&t.onMsgReadReceipt({dataList:o}):s.hasOwnProperty("c2cMessageReadNotice")?t&&t.onMsgReadNotice({dataList:o}):s.hasOwnProperty("muteNotificationsSync")&&n._sessionM.get(11).onC2CMsgRemindTypeSynced({dataList:o}))}))}},{key:"_onC2CReadReceiptArray",value:function(e){this._sessionM.get(6).onReadReceiptList(e)}},{key:"_onProfileModified",value:function(e){this._sessionM.get(4).onProfileModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onFriendProfileModified({dataList:e.dataList})}},{key:"_onRelationChainModified",value:function(e){this._sessionM.get(4).onRelationChainModified({dataList:e.dataList});var t=this._sessionM.get(8);t&&t.onRelationChainModified({dataList:e.dataList})}},{key:"_onRecentContact",value:function(n){var t,n=n.dataList;O(n)&&(t=this._sessionM.get(11))&&n.forEach(function(o){var s,a,i=o.pushType;i===1?(s=o.recentContactDeleteItem,t.onConvDeleted(s.recentContactList)):i===2?(s=o.recentContactTopItem,t.onConvPinnedStatus(s.recentContactList,!0)):i===3?(s=o.recentContactTopItem,t.onConvPinnedStatus(s.recentContactList,!1)):i===4?(s=o.recentContactMarkContact,t.onConvMarkUpdated(s.recentContactMarkContactItem)):i===5?(s=o.recentContactCreateContactGroup,t.onConvGroupCreated(s.msgContactGroupContactItem)):i===6?(s=o.recentContactDelContactGroup,t.onConvGroupDeleted(s.msgGroupItem)):i===7&&(i=(s=o.recentContactUpdateContactGroup).updateType,o=s.msgUpdateGroup,s=s.msgUpdateContact,i===1?(a=o.updateGroupType)===1?t.onConvGroupNameUpdated(o):a===2&&t.onConvInGroupUpdated(o):i===2&&t.onConvAddedToOrDeletedFromGroup(s))})}},{key:"_onAllMsgRead",value:function(t){var t=t.dataList,n=this._sessionM.get(11);n&&n.onPushedAllMessageRead(t)}},{key:"_onUserStatusList",value:function(e){this._sessionM.get(4).onUserStatusUpdated(e)}},{key:"_onMsgExtNotify",value:function(e){this._sessionM.get(3).onMsgExtNotify(e)}},{key:"_onMsgReactionNotifyList",value:function(e){this._sessionM.get(34).onReactionNotifyList(e)}},{key:"_onMsgReactionNotify",value:function(e){this._sessionM.get(34).onReactionNotify(e)}},{key:"_onFollowNotify",value:function(e){this._sessionM.get(35).onFollowNotify(e)}},{key:"_onTopicLatestMsg",value:function(e){this._sessionM.get(10).onTopicLatestMsg(e)}},{key:"onMessage",value:function(e){var t=this,n=e.body;if(this._filterMsgFromIMOpenPush(e)){var o,s=n.eventArray,a=n.isInstantMessage,i=n.isSyncingEnded,r=n.needSync;if(O(s))for(var c,u,l,_=0,m=s.length;_<m;_++)(l=(c=s[_]).event)!==100?l!==24?l!==26?(o=Object.keys(c).find(function(f){return t._keys.indexOf(f)!==-1}))?(u=l===14?{readAllC2CMessage:c[o],groupMessageReadInfoList:c.groupMessageReadNotice||[]}:l===16?{userID:c.userID,timestamp:c.timestamp,readReceiptList:c[o]}:c[o],this._eventHandlerMap.get(o)({event:l,dataList:u,isInstantMessage:a,isSyncingEnded:i,needSync:r})):d.l("".concat(this._n,".onMessage unknown eventItem:"),c):this._onTopicLatestMsg(c):this._onAllRcvMsgOptNotify(c):this._onRoomCustomData(c.content)}}},{key:"_onRoomCustomData",value:function(e){this._sessionM.get(30).onRoomCustomDataReceived(e),d.l("".concat(this._n,"._onRoomCustomData data:").concat(e))}},{key:"_onAllRcvMsgOptNotify",value:function(e){this._sessionM.get(11).onAllRcvMsgOptNotify(e)}},{key:"_filterMsgFromIMOpenPush",value:function(t){var n=t.head,t=t.body,n=n.servcmd,o=!1;return!(o=T(n)?o:n.includes(E.NAME.IM_CONFIG_MANAGER)||n.includes(E.NAME.OVERLOAD_PUSH)||n.includes(E.NAME.STAT_SERVICE))||(n.includes(h.PUSHED_CLOUD_CTRL_CONFIG)?this._sessionM.get(23).onPushedConfig(t):n.includes(h.PUSHED_COMMERCIAL_CONFIG)?this._sessionM.get(27).onPushedConfig(t):n.includes(h.OVERLOAD_NOTIFY)?this._sessionM.onPushedServerOverload(t):n.includes(h.KICK_OTHER)&&(o=Date.now(),this._sessionM.reLoginOnKickOther(),t=new D("kickOther"),o=o-(n=this._sessionM.get(1).getLastWsHelloTs()),t.setMessage("last wshello time:".concat(n," diff:").concat(o,"ms")).end()),!1)}}]),Oa=[{cmd:h.GET_GRP_PROFILE,interval:1,count:8},{cmd:h.UPDATE_GRP_PROFILE,interval:1,count:8},{cmd:h.GET_GRP_PENDENCY,interval:1,count:15},{cmd:h.GET_TOPIC_LIST,interval:1,count:10},{cmd:h.SET_GRP_ATTR,interval:5,count:10},{cmd:h.MODIFY_GRP_ATTR,interval:5,count:10},{cmd:h.DEL_GRP_ATTR,interval:5,count:10},{cmd:h.CLEAR_GRP_ATTR,interval:5,count:10},{cmd:h.GET_GRP_ATTR,interval:5,count:20},{cmd:h.UPDATE_GRP_COUNTER,interval:5,count:20},{cmd:h.GET_GRP_COUNTER,interval:5,count:20},{cmd:h.SET_ALL_MSG_READ,interval:1,count:1},{cmd:h.GET_USER_STATUS,interval:5,count:20},{cmd:h.SUB_USER_STATUS,interval:5,count:20},{cmd:h.UNSUB_USER_STATUS,interval:5,count:20},{cmd:h.CS,interval:5,count:20},{cmd:h.GRP_CS,interval:5,count:20},{cmd:h.MBR_CS,interval:5,count:20},{cmd:h.USER_CS,interval:5,count:20},{cmd:h.CHECK_FOLLOW_TYPE,interval:5,count:20},{cmd:h.GET_GRP_ROAMING_MSG,interval:1,count:20},{cmd:h.GET_C2C_ROAMING_MSG,interval:1,count:20}],ss=new Map,Na=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],io=0,kr=Na.length;io<kr;io++)ss.set(io,Na[io]);function ro(e){return U(this,ro),(e=le(this,ro,[e]))._n="ChannelModule",e._socketHandler=new yr(e),e._probing=!1,e._isAppShowing=!0,e._previousState=g.NET_STATE_CONNECTED,e._timerForNotLoggedIn=-1,e._timerForNotLoggedIn=setInterval(e.onCheckTimer.bind(e),1e3),e._fatalErrorFlag=!1,e._disconnectedTS=0,e._lastDiagnoseTS=0,e}function as(e){for(var t,n,o=e,s="",a=0,i=(o=e.length%8!=0?"0".repeat(8-e.length%8)+e:o).length;a<i;a+=8)t=parseInt(o.slice(a,a+4),2),n=parseInt(o.slice(a+4,a+8),2),s+=ss.get(t)+ss.get(n);return s}function Rr(e){var t;return e<0||53<e?NaN:(t=0|1073741824*Math.random(),30<e?t+1073741824*(0|Math.random()*(1<<e-30)):t>>>30-e)}function Ar(e,t){for(var n=e.toString(16),o=t-n.length,s="0";0<o;o>>>=1,s+=s)1&o&&(n=s+n);return n}de(Io,ce);var Or=b(Io,[{key:"_init",value:function(){this._updateCmdFreqLimitMap(Oa)}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("cmd_frequency_limit");T(e)||(e=JSON.parse(e),this._updateCmdFreqLimitMap(e))}},{key:"_updateCmdFreqLimitMap",value:function(e){var t=this;e.forEach(function(n){t._cmdFreqLimitMap.set(n.cmd,{interval:n.interval,count:n.count})})}},{key:"updateProtocolConfig",value:function(){this._pHandler.update()}},{key:"req",value:function(e){d.d("".concat(this._n,".req options:"),e);var t,n,o=e.P;return this._pHandler.has(o)?(t=(e=this.getProtocolData(e)).head.servcmd,this._isFreqOverLimit(t)?v({code:n=y.OVER_FREQUENCY_LIMIT,message:this.getErrMsg(n,this._getCmd(t))}):this._isServerOverload(t)?v({code:n=y.OPEN_SERVICE_OVERLOAD_ERROR,message:this.getErrMsg(n,this._getCmd(t))}):(n=this.get(21),Lr.includes(o)?n.simplySend(e):n.send(e))):(d.w("".concat(this._n,".req unknown P:").concat(o)),v({code:y.NO_PROTOCOL}))}},{key:"getKeyMap",value:function(e){return this._pHandler.getKeyMap(e)}},{key:"genCommonHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:Eo,websdkversion:Do,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:75689843,sdkability_ext:as(""),cappid:e.getApplicationID(),cs:0}}},{key:"genCosSpecifiedHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:Eo,websdkversion:Do,sdkappid:e.getSDKAppID(),contenttype:e.getContentType(),reqtime:0,identifier:e.getUserID(),usersig:e.getUserSig(),status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:as(""),cappid:e.getApplicationID(),cs:0}}},{key:"genSSOReportHead",value:function(){var e=this.get(12);return{ver:"v4",platform:this._platform,websdkappid:Eo,websdkversion:Do,sdkappid:e.getSDKAppID(),contenttype:"",reqtime:0,identifier:"",usersig:"",status_instid:e.getStatusInstanceID(),sdkability:75689843,sdkability_ext:as(""),cappid:e.getApplicationID(),cs:0}}},{key:"getProtocolData",value:function(e){return this._pHandler.getProtocolData(e)}},{key:"trans",value:function(t){var n=t.servcmd,t=t.data,n={head:p(p({},this.genCommonHead()),{},{servcmd:n}),body:t};return this.get(21).send(n)}},{key:"sendComboMessage",value:function(t){var n=t.servcmd,t=t.data,n={head:p(p({},this.genCommonHead()),{},{servcmd:n}),body:t};return this.get(21).send(n)}},{key:"onErrorCodeNotZero",value:function(e){var t,n=e.errorCode;n===y.HELLO_ANSWER_KICKED_OUT&&(t=e.kickType,e=(e=e.newInstanceInfo)===void 0?{}:e,t===1?this.onMultipleAccountKickedOut(e):t===2?this.onMultipleDeviceKickedOut(e):t===3&&this.onRestApiKickedOut(e)),n!==y.MSG_A2KEY_EXPIRED&&n!==y.ACCOUNT_A2KEY_EXPIRED||(this._onUserSigExpired(),this.get(21).reConnect())}},{key:"onMessage",value:function(e){var n=e.body,t=n.needAck,n=n.sessionData;(t===void 0?0:t)===1&&this._sendACK(n),this._msgDispatcher.onMessage(e)}},{key:"onReconnected",value:function(e){this._incrementalPullContactFlag=e<=300,this._reLoginOnReconnected()}},{key:"reLoginOnKickOther",value:function(){d.l("".concat(this._n,".reLoginOnKickOther")),this._reLogin()}},{key:"_reLoginOnReconnected",value:function(){d.l("".concat(this._n,"._reLoginOnReconnected")),this._reLogin()}},{key:"_reLogin",value:function(){var e,t,n,o=this,s="".concat(this._n,"._reLogin");this.isLoggedIn()&&(e=0,(t=this.get(1).getPushModule())&&(e=t.getUniAppPlatform()),n=new D("reLogin"),this.req({P:h.LOGIN,data:{isWebUniapp:e,customInfo:this.get(12).getCustomLoginInfo()}}).then(function(i){var i=i.data,u=i.instanceID,i=i.customStatus,_=o.get(12),r=Hn(i),c=(_.setStatusInstanceID(u),o.get(21)),l=c.getSocketID(),l="socketID:".concat(l," instanceID:").concat(u," customStatus:").concat(r),u=(n.setMessage(l).end(!0),d.l("".concat(s," ok. ").concat(l)),_.getCustomStatus()!==r&&o.get(4).onUserStatusUpdated({dataList:[{to:o.getMyUserID(),statusType:g.USER_STATUS_ONLINE,customStatus:i}]}),c.diagnose(),o.get(11).syncConvList(o._incrementalPullContactFlag).then(function(){d.l("".concat(s,", sync conv list ok.")),o.get(25).start()}),o.get(7)),l=(u&&u.updateLocalMainSequenceOnReconnected(),o.get(10)),_=(l.resetGetTopicTime(),l.getTopicListOnReconnected(),o.get(8));_&&_.updateCacheOnReconnected()}))}},{key:"onMultipleAccountKickedOut",value:function(e){this.get(1).onMultipleAccountKickedOut(e)}},{key:"onMultipleDeviceKickedOut",value:function(e){this.get(1).onMultipleDeviceKickedOut(e)}},{key:"_onUserSigExpired",value:function(){this.get(1).onUserSigExpired()}},{key:"onRestApiKickedOut",value:function(e){this.get(1).onRestApiKickedOut(e)}},{key:"_sendACK",value:function(e){this.req({P:h.MSG_PUSH_ACK,data:{sessionData:e}})}},{key:"_isFreqOverLimit",value:function(a){var t,n,o,s,a=a.split(".")[1];return!!this._cmdFreqLimitMap.has(a)&&(!this._cmdReqInfoMap.has(a)||(t=(n=this._cmdFreqLimitMap.get(a)).count,n=n.interval,o=(s=this._cmdReqInfoMap.get(a)).startTime,s=s.requestCount,Date.now()-o>1e3*n)?(this._cmdReqInfoMap.set(a,{startTime:Date.now(),requestCount:1}),!1):(this._cmdReqInfoMap.set(a,{startTime:o,requestCount:s+=1}),t<s))}},{key:"_isServerOverload",value:function(e){var t,n;return!!this._serverOverloadInfoMap.has(e)&&(t=(n=this._serverOverloadInfoMap.get(e)).overloadTime,n=n.waitingTime,Date.now()-t<=1e3*n||(this._serverOverloadInfoMap.delete(e),!1))}},{key:"_getCmd",value:function(e){var t="";if(e.includes(".")){var n,o=e.split(".")[1];for(n in h)if(h[n]===o){t=n;break}}return t}},{key:"onPushedServerOverload",value:function(n){var t=n.overloadCommand,n=n.waitingTime;this._serverOverloadInfoMap.set(t,{overloadTime:Date.now(),waitingTime:n}),d.w("".concat(this._n,".onPushedServerOverload waitingTime:").concat(n,"s cmd:").concat(this._getCmd(t)))}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._updateCmdFreqLimitMap(Oa),this._cmdReqInfoMap.clear(),this._serverOverloadInfoMap.clear(),this._incrementalPullContactFlag=!0}}]),Nr=(de(vo,ce),b(vo,[{key:"getCloudConfig",value:function(e){return T(e)?this._cloudConfig:this._cloudConfig.has(e)?this._cloudConfig.get(e):void 0}},{key:"getServerConfig",value:function(e){var t={code:0,data:""};return!T(e)&&this._cloudConfig.has(e)&&(t.data=this._cloudConfig.get(e)),Promise.resolve(t)}},{key:"_canFetch",value:function(){return this.isLoggedIn()&&!this._isFetching&&Date.now()>=this._expiredTime}},{key:"fetchConfig",value:function(){var e,t=this,n="".concat(this._n,".fetchConfig"),o=this._canFetch();d.l("".concat(n," canFetch:").concat(o)),o&&(e=new D("fetchCloudCtrlConfig"),o=this.get(12).getSDKAppID(),this._isFetching=!0,this.req({P:h.FETCH_CLOUD_CTRL_CONFIG,data:{SDKAppID:o,version:this._version}}).then(function(s){t._isFetching=!1;var i=s.data,a=i.version,i=i.cloudControlConfig;e.setMessage("version:".concat(t._version," newVersion:").concat(a," config:").concat(i)).end(),d.l("".concat(n," ok")),t._parse(s.data)}).catch(function(s){t._isFetching=!1,e.setError(s).end(),d.l("".concat(n," failed. error:"),s),t._setExpiredTime(12e4)}))}},{key:"onPushedConfig",value:function(e){d.l("".concat(this._n,".onPushedConfig config:"),e),new D("pushedCloudCtrlConfig").setMessage("newVersion:".concat(e.version," config:").concat(e.cloudControlConfig)).end(),this._parse(e)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"_parse",value:function(e){var t=this,n="".concat(this._n,"._parse"),o=e.errorCode,s=e.errorMessage,a=e.cloudControlConfig,i=e.version,r=e.expiredTime;if(o===0){if(this._version!==i){var c=null;try{c=JSON.parse(a)}catch{this.isPrivateNetWork()||d.e("".concat(n," failed. config:"),a)}c&&(this._cloudConfig.clear(),Object.keys(c).forEach(function(u){t._cloudConfig.set(u,c[u])}),this._version=i,this.emitIEvt(ne.CLOUD_CONFIG),this.emitOEvt(F.SERVER_CONFIG_UPDATED,{config:c}))}this._setExpiredTime(1e3*r)}else T(o)?(d.l("".concat(n," failed. Invalid message format:"),e),this._setExpiredTime(36e5)):(d.e("".concat(n," errorCode:").concat(o," errorMessage:").concat(s)),this._setExpiredTime(12e4))}},{key:"_setExpiredTime",value:function(e){this._expiredTime=Date.now()+e}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._cloudConfig.clear(),this._expiredTime=0,this._version=0,this._isFetching=!1}}])),Pr=(de(mo,ce),b(mo,[{key:"start",value:function(){this._recoverGroupChat(),this._recoverC2CChat()}},{key:"_recoverGroupChat",value:function(){var e,t,n,o,s=this,a=this._getLocalConvList().filter(function(c){return c.type===g.CONV_GROUP&&c.groupProfile.type!==g.GRP_AVCHATROOM}),i=this.get(11),r=[];a.forEach(function(l){var u=l.conversationID,l=l.lastMessage;e=u.replace(g.CONV_GROUP,""),t=i.getLocalLastMessage(u),l&&l.lastSequence!==0&&t&&(n=l.lastSequence,t=t.sequence,o=n-t,0<t)&&1<=o&&o<300?s._recoverGroupMsg({groupID:e,localLastMessageSequence:t,remoteLastMessageSequence:n}):r.push(e)}),this._getGroupNotice(r)}},{key:"_recoverC2CChat",value:function(){var e,t,n,o=this,s=this._getLocalConvList().filter(function(c){return c.type===g.CONV_C2C}),a=this.get(11),i=[Promise.resolve()],r=[];s.forEach(function(l){var u=l.conversationID,l=l.lastMessage;e=a.getLocalLastMessage(u),l&&l.lastTime!==0&&e&&(t=l.lastTime,e=e.time,n=t-e,0<e)&&1<=n&&n<=600&&(i.push(o._recoverC2CMsg({conversationID:u,localLastMessageTime:e,remoteLastMessageTime:t})),r.push(u))}),Promise.all(i).then(function(){d.l("".concat(o._n,"._recoverC2CChat all done, convIDList:"),r),o.get(19).syncOnReconnected()})}},{key:"_getLocalConvList",value:function(){return this.get(11).getLocalConvList()}},{key:"_recoverGroupMsg",value:function(e){var t=this,n="".concat(this._n,".").concat("_recoverGroupMsg"),o=(d.l("".concat(n," options:"),e),e.groupID),s=e.localLastMessageSequence,a=e.remoteLastMessageSequence,i=JSON.stringify(e),r=new D("_recoverGroupMsg");r.setMessage(i),this._getGroupRoamingMsg({groupID:o,sequence:s}).then(function(u){var u=u.data,l=u.complete,_=u.messageList;if(!T(_)){var u=_[0].sequence,m=_.map(function(B){return B.sequence}),m="".concat(i," complete:").concat(l," sequenceList:").concat(m),f=(d.l("".concat(n," ").concat(m)),u!==s&&u<a&&l!==2&&t._recoverGroupMsg({groupID:o,localLastMessageSequence:u,remoteLastMessageSequence:a}),r.setMessage(m).end(),t.get(7));1<_.length&&_.sort(function(B,x){return B.sequence-x.sequence});for(var I=!1,C=0,M=_.length;C<M;C++)if(_[C].from===g.CONV_SYSTEM){I=!0;break}if(I)for(var S=0,L=_.length;S<L;S++){var P=_[S];P.from!==g.CONV_SYSTEM?f.onNewMessage({dataList:[P],isInstantMessage:!1,updateUnreadCount:!1}):f.onNewGroupTips({event:P.event,dataList:[P]})}else f.onNewMessage({dataList:_,isInstantMessage:!1,updateUnreadCount:!1})}}).catch(function(c){r.setError(c).end(),d.w("".concat(n," failed. error:"),c)})}},{key:"_getGroupNotice",value:function(e){var t=e.length;if(d.l("".concat(this._n,"._getGroupNotice length:").concat(t)),t!==0){var n=this.get(7);if(t<=10)n.getNotice(e);else{var o=Math.floor(t/10);5<=o&&(o=5);for(var s=0;s<=o;s++)n.getNotice(e.slice(10*s,10*(s+1)))}}}},{key:"_getGroupRoamingMsg",value:function(n){var t=n.groupID,n=n.sequence;return this.req({P:h.GET_GRP_ROAMING_MSG,data:{groupID:t,count:this.PULL_LIMIT_COUNT,sequence:n+this.PULL_LIMIT_COUNT-1}})}},{key:"_recoverC2CMsg",value:function(e){var t=this,n="".concat(this._n,".").concat("_recoverC2CMsg"),o=(d.l("".concat(n," options:"),e),e.conversationID),s=e.localLastMessageTime,a=e.remoteLastMessageTime,i=JSON.stringify(e),r=new D("_recoverC2CMsg");return r.setMessage(i),this._getC2CRoamingMsg({conversationID:o,time:s}).then(function(l){var l=l.data,u=l.complete,l=l.messageList;if(!T(l)){var _=l.length,_=(t.get(6).onNewMessage({dataList:l,isInstantMessage:!0}),l[_-1].time),l=l.map(function(f){return f.random}),l="".concat(i," complete:").concat(u," randomList:").concat(l);if(d.l("".concat(n," ").concat(l)),r.setMessage(l).end(),_<a&&u!==1)return t._recoverC2CMsg({conversationID:o,localLastMessageTime:_,remoteLastMessageTime:a})}}).catch(function(c){r.setError(c).end(),d.w("".concat(n," failed. error:"),c)})}},{key:"_getC2CRoamingMsg",value:function(n){var t=n.conversationID,n=n.time;return this.req({P:h.GET_C2C_ROAMING_MSG,data:{peerAccount:t.replace(g.CONV_C2C,""),count:this.PULL_LIMIT_COUNT+1,lastMessageTime:n,direction:1}})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}])),Gr=b(function e(){U(this,e),this._n="AvgE2EDelay",this._e2eDelayArray=[]},[{key:"addMessageDelay",value:function(e){e=Zt()-e,0<=e&&this._e2eDelayArray.push(e)}},{key:"_calcAvg",value:function(e,t){var n;return t===0?0:(n=0,e.forEach(function(o){n+=o}),nt(n/t,1))}},{key:"_calcCountWithLimit",value:function(e){var t=e.e2eDelayArray,n=e.min,o=e.max;return t.filter(function(s){return n<=s&&s<o}).length}},{key:"_calcPercent",value:function(e,t){return e=nt(e/t*100,2),e=100<e?100:e}},{key:"_checkE2EDelayException",value:function(e,t){var n,o,s,a=e.filter(function(i){return t<i});0<a.length&&(n=a.length,o=Math.min.apply(Math,G(a)),s=Math.max.apply(Math,G(a)),a=this._calcAvg(a,n),50<(e=nt(n/e.length*100,2)))&&new D("messageE2EDelayException").setMessage("count:".concat(n," min:").concat(o," max:").concat(s," avg:").concat(a," percent:").concat(e)).setLevel("warning").end()}},{key:"getStatResult",value:function(){var e,t,n,o,s,a,i=this._e2eDelayArray.length;return i===0?null:(e=G(this._e2eDelayArray),t=this._calcCountWithLimit({e2eDelayArray:e,min:0,max:1}),n=this._calcCountWithLimit({e2eDelayArray:e,min:1,max:3}),o=this._calcPercent(t,i),s=this._calcPercent(n,i),a=this._calcAvg(e,i),this._checkE2EDelayException(e,3),e.length=0,this.reset(),{totalCount:i,countLessThan1Second:t,percentOfCountLessThan1Second:o,countLessThan3Second:n,percentOfCountLessThan3Second:s,avgDelay:a})}},{key:"reset",value:function(){this._e2eDelayArray.length=0}}]),Ur=b(function e(){U(this,e),this._n="AvgRTT",this._requestCount=0,this._rttArray=[]},[{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){return t===0?0:100<(e=nt(e/t*100,2))?100:e}},{key:"_calcAvg",value:function(e,t){var n;return t===0?0:(n=0,e.forEach(function(o){n+=o}),parseInt(n/t))}},{key:"_calcMax",value:function(){return Math.max.apply(Math,G(this._rttArray))}},{key:"_calcMin",value:function(){return Math.min.apply(Math,G(this._rttArray))}},{key:"getStatResult",value:function(){var e,t,n=this._calcTotalCount(),o=G(this._rttArray);return n===0?null:(e=this._calcRTTCount(o),t=this._calcSuccessRateOfRequest(e,n),o=this._calcAvg(o,e),d.l("".concat(this._n,".getStatResult max:").concat(this._calcMax()," min:").concat(this._calcMin()," avg:").concat(o)),this.reset(),{totalCount:n,rttCount:e,successRateOfRequest:t,avgRTT:o})}},{key:"reset",value:function(){this._requestCount=0,this._rttArray.length=0}}]),br=b(function e(){U(this,e),this._map=new Map},[{key:"initMap",value:function(e){var t=this;e.forEach(function(n){t._map.set(n,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})})}},{key:"addTotalCount",value:function(e){return!(T(e)||!this._map.has(e)||(this._map.get(e).totalCount+=1,0))}},{key:"addSuccessCount",value:function(e){return!(T(e)||!this._map.has(e)||(this._map.get(e).successCount+=1,0))}},{key:"addFailedCountOfUserSide",value:function(e){return!(T(e)||!this._map.has(e)||(this._map.get(e).failedCountOfUserSide+=1,0))}},{key:"addCost",value:function(e,t){return!(T(e)||!this._map.has(e)||(this._map.get(e).costArray.push(t),0))}},{key:"addFileSize",value:function(e,t){return!(T(e)||!this._map.has(e)||(this._map.get(e).fileSizeArray.push(t),0))}},{key:"_calcSuccessRateOfBusiness",value:function(e){return T(e)||!this._map.has(e)?-1:100<(e=nt((e=this._map.get(e)).successCount/e.totalCount*100,2))?100:e}},{key:"_calcSuccessRateOfPlatform",value:function(e){var t;return T(e)||!this._map.has(e)?-1:(t=this._map.get(e),100<(e=nt(e=this._calcSuccessCountOfPlatform(e)/t.totalCount*100,2))?100:e)}},{key:"_calcTotalCount",value:function(e){return T(e)||!this._map.has(e)?-1:this._map.get(e).totalCount}},{key:"_calcSuccessCountOfBusiness",value:function(e){return T(e)||!this._map.has(e)?-1:this._map.get(e).successCount}},{key:"_calcSuccessCountOfPlatform",value:function(e){return T(e)||!this._map.has(e)?-1:(e=this._map.get(e)).successCount+e.failedCountOfUserSide}},{key:"_calcAvg",value:function(e){return T(e)||!this._map.has(e)?-1:e===Ye?this._calcAvgSpeed(e):this._calcAvgCost(e)}},{key:"_calcAvgCost",value:function(e){var t,n=this._map.get(e).costArray.length;return n===0?0:(t=0,this._map.get(e).costArray.forEach(function(o){t+=o}),parseInt(t/n))}},{key:"_calcAvgSpeed",value:function(e){var t=0,n=0;return this._map.get(e).costArray.forEach(function(o){t+=o}),this._map.get(e).fileSizeArray.forEach(function(o){n+=o}),parseInt(1e3*n/t)}},{key:"getStatResult",value:function(e){var t,n,o,s,a,i=this._calcTotalCount(e);return i===0?null:(t=this._calcSuccessCountOfBusiness(e),n=this._calcSuccessRateOfBusiness(e),o=this._calcSuccessCountOfPlatform(e),s=this._calcSuccessRateOfPlatform(e),a=this._calcAvg(e),this.reset(e),{totalCount:i,successCountOfBusiness:t,successRateOfBusiness:n,successCountOfPlatform:o,successRateOfPlatform:s,avgValue:a})}},{key:"reset",value:function(e){T(e)?this._map.clear():this._map.set(e,{totalCount:0,successCount:0,failedCountOfUserSide:0,costArray:[],fileSizeArray:[]})}}]),wr=b(function e(){U(this,e),this._lastMap=new Map,this._currentMap=new Map},[{key:"initMap",value:function(e){var t=this;e.forEach(function(n){t._lastMap.set(n,new Map),t._currentMap.set(n,new Map)})}},{key:"addMessageSequence",value:function(e){var t,n,o,s=e.key,a=e.message;return!(T(s)||!this._lastMap.has(s)||!this._currentMap.has(s)||(t=a.conversationID,a=a.sequence,t=t.replace(g.CONV_GROUP,""),this._lastMap.get(s).size!==0&&this._lastMap.get(s).has(t)&&(o=(n=this._lastMap.get(s).get(t)).length-1,a>n[0])&&a<n[o]?(n.push(a),n.sort(),this._lastMap.get(s).set(t,n)):this._addCurrentMap(e),0))}},{key:"_addCurrentMap",value:function(n){var t=n.key,n=n.message,o=n.conversationID,n=n.sequence,o=o.replace(g.CONV_GROUP,"");this._currentMap.get(t).has(o)||this._currentMap.get(t).set(o,[]),this._currentMap.get(t).get(o).push(n)}},{key:"_copyData",value:function(e){if(!T(e)){this._lastMap.set(e,new Map);var t,n=this._lastMap.get(e),o=Se(this._currentMap.get(e));try{for(o.s();!(t=o.n()).done;){var s=ke(t.value,2),a=s[0],i=s[1];n.set(a,i)}}catch(r){o.e(r)}finally{o.f()}n=null,this._currentMap.set(e,new Map)}}},{key:"getStatResult",value:function(e){var t,n,o;return T(this._currentMap.get(e))||T(this._lastMap.get(e))?null:this._lastMap.get(e).size===0?(this._copyData(e),null):(n=t=0,this._lastMap.get(e).forEach(function(r,a){var r=G(r.values()),i=r.length,r=r[i-1]-r[0]+1;t+=r,n+=i}),t===0?null:(100<(o=nt(n/t*100,2))&&(o=100),this._copyData(e),{totalCount:t,successCountOfMessageReceived:n,successRateOfMessageReceived:o}))}},{key:"reset",value:function(){this._currentMap.clear(),this._lastMap.clear()}}]),Fr=(de(fo,ce),b(fo,[{key:"_onLoginSuccess",value:function(){var e=this,t=(this._rateMessageSent.initMap(this._messageSentItems),this._rateMessageReceived.initMap(this._messageReceivedItems),this.get(13)),n=t.getItem(this.TAG,!1);!k(n)&&Re(n.forEach)&&(d.l("".concat(this._n,"._onLoginSuccess. logs count:").concat(n.length)),n.forEach(function(o){e._statInfoArr.push(o)}),t.removeItem(this.TAG,!1))}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("q_rpt_interval"),t=this.getCloudConfig("q_rpt_sdkappid_bl"),n=this.getCloudConfig("q_rpt_tinyid_wl");T(e)||(this.REPORT_INTERVAL=Number(e)),T(t)||(this.REPORT_SDKAPPID_BLACKLIST=t.split(",").map(function(o){return Number(o)})),T(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)||d.w("".concat(this._n,".addTotalCount invalid key:"),e)}},{key:"addSuccessCount",value:function(e){this._rateMessageSent.addSuccessCount(e)||d.w("".concat(this._n,".addSuccessCount invalid key:"),e)}},{key:"addFailedCountOfUserSide",value:function(e){this._rateMessageSent.addFailedCountOfUserSide(e)||d.w("".concat(this._n,".addFailedCountOfUserSide invalid key:"),e)}},{key:"addCost",value:function(e,t){this._rateMessageSent.addCost(e,t)||d.w("".concat(this._n,".addCost invalid key or cost:"),e,t)}},{key:"addFileSize",value:function(e,t){this._rateMessageSent.addFileSize(e,t)||d.w("".concat(this._n,".addFileSize invalid key or size:"),e,t)}},{key:"addMessageSequence",value:function(e){this._rateMessageReceived.addMessageSequence(e)||d.w("".concat(this._n,".addMessageSequence invalid key:"),e.key)}},{key:"_getQualityItem",value:function(e){var t={},n=ma[this.get(15).getNetworkType()],n=(T(n)&&(n=8),{qualityType:pi[e],timestamp:Qe(),networkType:n,extension:""});switch(e){case Ho:t=this._avgRTT.getStatResult();break;case Ko:t=this._avgE2EDelay.getStatResult();break;case Bt:case Ht:case Kt:case At:case Ye:t=this._rateMessageSent.getStatResult(e);break;case Yt:case un:case ln:t=this._rateMessageReceived.getStatResult(e)}return t===null?null:p(p({},n),t)}},{key:"_report",value:function(a){var t=this,n=[],o=null,a=(T(a)?this._qualityItems.forEach(function(i){(o=t._getQualityItem(i))!==null&&(o.reportIndex=t.reportIndex,o.wholePeriod=t.wholePeriod,n.push(o))}):(o=this._getQualityItem(a))!==null&&(o.reportIndex=this.reportIndex,o.wholePeriod=this.wholePeriod,n.push(o)),d.d("".concat(this._n,"._report"),n),0<this._statInfoArr.length&&(n=n.concat(this._statInfoArr),this._statInfoArr=[]),this.get(12)),s=a.getSDKAppID(),a=a.getTinyID();0<(n=oa(this.REPORT_SDKAPPID_BLACKLIST,s)&&!sa(this.REPORT_TINYID_WHITELIST,a)?[]:n).length&&this._doReport(n)}},{key:"_doReport",value:function(e){var t=this,n={header:Sa(this),quality:e};this.req({P:h.SSO_STAT,data:p({},n)}).then(function(){t.reportIndex++,t.wholePeriod=!1}).catch(function(o){d.w("".concat(t._n,"._doReport failed. error:"),o),t._statInfoArr=t._statInfoArr.concat(e),t._flushAtOnce()})}},{key:"_flushAtOnce",value:function(){var e=this.get(13),t=e.getItem(this.TAG,!1),n=this._statInfoArr,o="".concat(this._n,"._flushAtOnce");k(t)?(d.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)):(10<(n=n.concat(t)).length&&(n=n.slice(0,10)),d.l("".concat(o," count:").concat(n.length)),e.setItem(this.TAG,n,!0,!1)),this._statInfoArr=[]}},{key:"reset",value:function(){d.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()}}])),Pa=b(function e(t){U(this,e),k(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||"")}),qr=b(function e(t){U(this,e),this._snsM=t,this._n="FriendApplicationHandler",this._startTime=0,this._maxLimited=100,this._currentSeq=0,this._map=new Map,this._unreadCount=0},[{key:"updateCacheOnReconnected",value:function(){this._startTime=0,this._currentSeq=0,this.getApplicationList()}},{key:"getLocalApplicationList",value:function(){return{friendApplicationList:G(this._map.values()),unreadCount:this._unreadCount}}},{key:"_onApplicationListUpdated",value:function(){this._snsM.emitOEvt(F.FRIEND_APPLICATION_LIST_UPDATED,{friendApplicationList:G(this._map.values()),unreadCount:this._unreadCount})}},{key:"onApplicationRead",value:function(){this._unreadCount=0,this._onApplicationListUpdated()}},{key:"onApplicationAdded",value:function(e,t){var n,o,s=this;k(e)||(n="",n=t===this._snsM.getMyUserID()?g.SNS_APPLICATION_SENT_BY_ME:g.SNS_APPLICATION_SENT_TO_ME,o=!1,e.forEach(function(a){var i="".concat(a.userID,"_").concat(n);n!==g.SNS_APPLICATION_SENT_TO_ME||s._map.has(i)||(s._unreadCount+=1),s._map.set(i,new Pa(p(p({},a),{},{type:n}))),o=!0}),o&&this._onApplicationListUpdated())}},{key:"onApplicationDeleted",value:function(e){k(e)||(this._startTime=0,this._currentSeq=0,this.getApplicationList())}},{key:"getApplicationList",value:function(){var e=this,t="".concat(this._n,".").concat("getApplicationList"),n=new D("getApplicationList");return this._snsM.req({P:h.GET_FD_APPLICATION_LIST,data:{applicationType:g.SNS_APPLICATION_TYPE_BOTH,fromAccount:this._snsM.getMyUserID(),maxLimited:this._maxLimited,startTime:this._startTime,lastSequence:this._currentSeq}}).then(function(r){var r=r.data,s=r.resultList,a=r.unreadCount,i=r.startTime,r=r.currentSequence,c=(e._startTime=i,e._currentSeq=r,e._unreadCount=a,O(s)?s.length:0),c="applicationCount:".concat(c," unreadCount:").concat(a," startTime:").concat(i," currentSequence:").concat(r);n.setMessage(c).end(),d.i("".concat(t," ok. ").concat(c)),e._map.clear(),O(s)&&s.forEach(function(m){var l=m.userID,_=m.type,m=new Pa(m);e._map.set("".concat(l,"_").concat(_),m)}),e._onApplicationListUpdated()}).catch(function(o){return n.setError(o).end(),d.w("".concat(t," failed. error:"),o),v(o)})}},{key:"deleteApplication",value:function(e){var t,n="".concat(this._n,".").concat("deleteApplication"),o=e.userID,s=e.type;return s&&(s===g.SNS_APPLICATION_SENT_BY_ME||s===g.SNS_APPLICATION_SENT_TO_ME)||(s=g.SNS_APPLICATION_SENT_TO_ME),this._map.has("".concat(o,"_").concat(s))?((t=new D("deleteApplication")).setMessage("userID:".concat(o," type:").concat(s)),this._snsM.req({P:h.DEL_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),userIDList:[o],type:s}}).then(function(i){var i=i.data.resultList,u=i[0],r=u.to,c=u.resultCode,u=u.resultInfo;return t.setMoreMessage("resultList:".concat(JSON.stringify(i))).end(),d.i("".concat(n," ok. userID:").concat(o," type:").concat(s)),c===0?N():v({userID:r,code:c,message:u})}).catch(function(a){return t.setError(a).end(),d.w("".concat(n," failed. error:"),a),v(a)})):v({code:y.FRIEND_APPLICATION_NOT_EXIST})}},{key:"acceptApplication",value:function(e){var t="".concat(this._n,".").concat("acceptApplication"),n=e.userID,o=e.remark,s=e.tag,a=e.type,i=(a&&(a===g.SNS_APPLICATION_AGREE||a===g.SNS_APPLICATION_AGREE_AND_ADD)||(a=g.SNS_APPLICATION_AGREE_AND_ADD),new D("acceptApplication"));return i.setMessage("userID:".concat(n," type:").concat(a)),this._snsM.req({P:h.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:n,remark:o,tag:s,action:a}]}}).then(function(u){i.end();var u=u.data.resultList[0],c=u.resultCode,u=u.resultInfo;if(c!==0)return v({code:c,message:u});d.i("".concat(t," ok. userID:").concat(n," type:").concat(a))}).catch(function(r){return i.setError(r).end(),d.w("".concat(t," failed. error:"),r),v(r)})}},{key:"refuseApplication",value:function(e){var t="".concat(this._n,".").concat("refuseApplication"),n=e.userID,o=new D("refuseApplication");return o.setMessage("userID:".concat(n)),this._snsM.req({P:h.RESPOND_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),responseFriendItem:[{userID:n,action:"Response_Action_Reject"}]}}).then(function(i){o.end();var i=i.data.resultList[0],a=i.resultCode,i=i.resultInfo;if(a!==0)return v({code:a,message:i});d.i("".concat(t," ok. userID:").concat(n))}).catch(function(s){return o.setError(s).end(),d.w("".concat(t," failed. error:"),s),v(s)})}},{key:"setApplicationRead",value:function(){var e=this,t="".concat(this._n,".").concat("setApplicationRead"),n=new D("setApplicationRead");return this._snsM.req({P:h.REPORT_FD_APPLICATION,data:{fromAccount:this._snsM.getMyUserID(),latestTimeStamp:nt(Qe()/1e3,0)}}).then(function(o){n.end(),d.i("".concat(t," ok")),e._unreadCount=0}).catch(function(o){return n.setError(o).end(),d.w("".concat(t," failed. error:"),o),v(o)})}},{key:"reset",value:function(){this._maxLimited=100,this._startTime=0,this._currentSeq=0,this._unreadCount=0,this._map.clear()}}]),is=b(function e(t,n){U(this,e),this.userID=t,this.remark="",this.groupList=[],this.source="",this.addTime=0,this.friendCustomField=[],this.timestamp=0;var o={},s=[];if(o.userID=t,!k(n))for(var a,i="",r=0,c=n.length;r<c;r++)if(i=n[r].tag,a=n[r].value,-1<i.indexOf("Tag_SNS_Custom"))this.friendCustomField.push({key:i,value:a});else if(-1<i.indexOf("Tag_Profile_Custom"))s.push({key:i,value:a});else switch(i){case H.NICK:o.nick=a;break;case H.GENDER:o.gender=a;break;case H.BIRTHDAY:o.birthday=a;break;case H.LOCATION:o.location=a;break;case H.SELFSIGNATURE:o.selfSignature=a;break;case H.ALLOWTYPE:o.allowType=a;break;case H.LANGUAGE:o.language=a;break;case H.AVATAR:o.avatar=a;break;case H.MESSAGESETTINGS:o.messageSettings=a;break;case H.ADMINFORBIDTYPE:o.adminForbidType=a;break;case H.LEVEL:o.level=a;break;case H.ROLE:o.role=a;break;case $e.REMARK:this.remark=a;break;case $e.ADDTIME:this.addTime=a;break;case $e.GROUP:this.groupList=JSON.parse(JSON.stringify(a));break;case $e.ADDSOURCE:this.source=a;break;case $e.ADDWORDING:break;default:d.l("snsProfileItem unknown tag->",n[r].tag)}this.profile=new jt(p(p({},o),{},{profileCustomField:s}))},[{key:"validate",value:function(e){var t,n=!0,o="";if(k(e))return{valid:!1,tips:"empty options"};if(e.profileCustomField)for(var s=e.profileCustomField.length,a=null,i=0;i<s;i++){if(a=e.profileCustomField[i],!V(a.key)||a.key.indexOf("Tag_Profile_Custom")===-1)return{valid:!1,tips:"The prefix of keys of the custom profile key-value pairs (which is profileCustomField) must be Tag_Profile_Custom"};if(!V(a.value))return{valid:!1,tips:"The type of values of the custom profile key-value pairs (which is profileCustomField) must be String"}}for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(t==="profileCustomField")continue;if(k(e[t])&&!V(e[t])&&!Y(e[t])){o="key:"+t+", invalid value:"+e[t],n=!1;continue}switch(t){case"nick":V(e[t])||(n=!(o="nick must be a string")),500<Ln(e[t])&&(o="nick name limited: must less than or equal to ".concat(500," bytes, current size: ").concat(Ln(e[t])," bytes"),n=!1);break;case"gender":Gt(Hs,e.gender)||(o="key:gender, invalid value:"+e.gender,n=!1);break;case"birthday":Y(e.birthday)||(n=!(o="birthday must be a number"));break;case"location":V(e.location)||(n=!(o="location must be a string"));break;case"selfSignature":V(e.selfSignature)||(n=!(o="selfSignature must be a string"));break;case"allowType":Gt(Ys,e.allowType)||(o="key:allowType, invalid value:"+e.allowType,n=!1);break;case"language":Y(e.language)||(n=!(o="language must be a number"));break;case"avatar":V(e.avatar)||(n=!(o="avatar must be a string"));break;case"messageSettings":e.messageSettings!==0&&e.messageSettings!==1&&(n=!(o="messageSettings must be 0 or 1"));break;case"adminForbidType":Gt(Ks,e.adminForbidType)||(o="key:adminForbidType, invalid value:"+e.adminForbidType,n=!1);break;case"level":Y(e.level)||(n=!(o="level must be a number"));break;case"role":Y(e.role)||(n=!(o="role must be a number"));break;default:o="unknown key:"+t+" "+e[t],n=!1}}return{valid:n,tips:o}}},{key:"update",value:function(e){var t=this,n="",o="",s=[];this.friendCustomField.forEach(function(r){s.push(r.key)});for(var a=0,i=e.length;a<i;a++)(function(){if(n=e[a].tag,o=e[a].value,-1<n.indexOf("Tag_SNS_Custom"))-1<s.indexOf(n)?t.friendCustomField.forEach(function(c){c.key===n&&(c.value=o)}):t.friendCustomField.push({key:n,value:o});else if(-1<n.indexOf("Tag_Profile_Custom")){var r=!1;t.profile.profileCustomField.forEach(function(c){c.key===n&&(c.value=o,r=!0)}),r||t.profile.profileCustomField.push({key:n,value:o})}else switch(n){case H.NICK:t.profile.nick=o;break;case H.GENDER:t.profile.gender=o;break;case H.BIRTHDAY:t.profile.birthday=o;break;case H.LOCATION:t.profile.location=o;break;case H.SELFSIGNATURE:t.profile.selfSignature=o;break;case H.ALLOWTYPE:t.profile.allowType=o;break;case H.LANGUAGE:t.profile.language=o;break;case H.AVATAR:t.profile.avatar=o;break;case H.MESSAGESETTINGS:t.profile.messageSettings=o;break;case H.ADMINFORBIDTYPE:t.profile.adminForbidType=o;break;case H.LEVEL:t.profile.level=o;break;case H.ROLE:t.profile.role=o;break;case $e.REMARK:t.remark=o;break;case $e.ADDTIME:t.addTime=o;break;case $e.GROUP:t.groupList=JSON.parse(JSON.stringify(o));break;case $e.ADDSOURCE:t.source=o;break;case $e.ADDWORDING:break;default:d.d("snsProfileItem unkown tag->",e[a].tag)}})();this.timestamp=Date.now(),s.length=0}},{key:"updateProfile",value:function(e){this.profile=JSON.parse(JSON.stringify(e)),this.timestamp=Date.now()}},{key:"addToGroupList",value:function(e){this.groupList.indexOf(e)===-1&&(this.groupList.push(e),this.count=this.groupList.length)}},{key:"removeFromGroupList",value:function(e){e=this.groupList.indexOf(e),-1<e&&(this.groupList.splice(e,1),this.count=this.groupList.length)}}]),xr=b(function e(t){U(this,e),this._snsM=t,this._n="FriendHandler",this._map=new Map,this._startIdx=0,this._standardSeq=0,this._customSeq=0,this._expirationTime=18e4},[{key:"updateCacheOnReconnected",value:function(){this._startIdx=0,this._standardSeq=0,this._customSeq=0,this.pagingGetFriendList()}},{key:"getLocalFriendList",value:function(){return G(this._map.values())}},{key:"getFriendRemark",value:function(e){return this._map.has(e)?this._map.get(e).remark:""}},{key:"onFriendProfileModified",value:function(o){var t,n=this,o=o.dataList;k(o)||(t=this._snsM.get(11),o.forEach(function(r){var a,i=r.userID,r=r.profileList;n.isMyFriend(i)&&(d.l("".concat(n._n,".onFriendProfileModified. friend account:").concat(i,", profileList:").concat(JSON.stringify(r))),(a=n._map.get(i)).update(r),t.modifyMessageSentByPeer({conversationID:"".concat(g.CONV_C2C).concat(i),latestNick:a.profile.nick,latestAvatar:a.profile.avatar}))}),this._onFriendListUpdated())}},{key:"onFriendAdded",value:function(e){var t=this;e.length!==0&&(d.l("".concat(this._n,".onFriendAdded userIDList:").concat(e)),e.forEach(function(n){t._map.set(n,new is(n))}),this.getFriendProfile({userIDList:e}).then(function(n){e.forEach(function(o){var s=t._map.get(o);0<s.groupList.length&&t._snsM.updateWhenFriendAdded({nameList:s.groupList,userID:o})}),t._onFriendListUpdated()}))}},{key:"onFriendDeleted",value:function(e){var t=this;e.length!==0&&(d.l("".concat(this._n,".onFriendDeleted userIDList:").concat(e)),e.forEach(function(n){var o=t._map.get(n);0<o.groupList.length&&t._snsM.updateWhenFriendDeleted({nameList:o.groupList,userID:n}),t._map.delete(n)}),this._onFriendListUpdated())}},{key:"_onFriendListUpdated",value:function(){this._snsM.emitOEvt(F.FRIEND_LIST_UPDATED),this._snsM.get(11).checkAndPatchRemark()}},{key:"getFriendProfile",value:function(s){var t,n=this,o="".concat(this._n,".").concat("getFriendProfile"),s=s.userIDList,a=[],i=[],r=[];return s.forEach(function(c){var u;n._map.has(c)?(u=n._map.get(c),Date.now()-u.timestamp<n._expirationTime?i.push(u):r.push(c)):a.push({userID:c,code:y.NOT_MY_FRIEND,message:n._snsM.getErrMsg(y.NOT_MY_FRIEND)})}),r.length===0?(d.i("".concat(o," newUserIDList is empty")),q({friendList:i,failureUserIDList:a})):((t=new D("getFriendProfile")).setMessage("userIDList:".concat(r)),d.i("".concat(o," userIDList:").concat(r)),this._snsM.req({P:h.GET_FD_PROFILE,data:{fromAccount:this._snsM.getMyUserID(),userIDList:r}}).then(function(c){return t.end(),d.i("".concat(o," ok")),c.data.resultList.forEach(function(I){var l,_=I.to,m=I.resultCode,f=I.resultInfo,I=I.tagValueList;T(m)||m===0?(n._map.has(_)?(l=n._map.get(_)).update(I):(l=new is(_,I),n._map.set(_,l)),i.push(l)):a.push({userID:_,code:m,message:f})}),N({friendList:i,failureUserIDList:a})}).catch(function(c){return t.setError(c).end(),d.w("".concat(o," failed. error:"),c),v(c)}))}},{key:"isMyFriend",value:function(e){return this._map.has(e)}},{key:"pagingGetFriendList",value:function(){var e=this,t="".concat(this._n,".").concat("getFriendList"),n=new D("getFriendList"),o=Date.now();this._snsM.req({P:h.GET_FD_LIST,data:{fromAccount:this._snsM.getMyUserID(),startIndex:this._startIdx,standardSequence:this._standardSeq,customSequence:this._customSeq}}).then(function(u){var u=u.data,l=u.friendCount,a=u.resultList,i=u.nextStartIndex,r=u.standardSequence,c=u.customSequence,u=u.completeFlag,l=(e._startIdx=i,e._standardSeq=r,e._customSeq=c,"friendCount:".concat(l," nextStartIndex:").concat(i," standardSequence:").concat(r," ")+"customSequence:".concat(c," completeFlag:").concat(u," cost:").concat(ye(o)));n.setMessage(l).end(),d.i("".concat(t," ok."),l),k(a)||a.forEach(function(f){var m=f.to,f=f.tagValueList;e._map.set(m,new is(m,f))}),u===0?e.pagingGetFriendList():(e._snsM.emitOEvt(F.FRIEND_LIST_UPDATED),e._pagingGetFriendProfile())}).catch(function(s){return n.setError(s).end(),d.w("".concat(t," failed. error:"),s),v(s)})}},{key:"_pagingGetFriendProfile",value:function(){var e=this,t=G(this._map.keys()),n=this._snsM.get(4),o=t.length,s=o<=100?1:Math.ceil(o/100);d.l("".concat(this._n,"._pagingGetFriendProfile friendCount:").concat(o," pageCount:").concat(s));for(var a=0;a<s;a++)n.getUserProfile({userIDList:t.slice(100*a,100*(a+1))}).then(function(i){i.data.forEach(function(r){var c=e._map.get(r.userID);c&&c.updateProfile(r)}),e._onFriendListUpdated()})}},{key:"addFriend",value:function(e){var t,n,o,s,a,i,r,c=this,u="".concat(this._n,".").concat("addFriend");return e.wording&&this._snsM.filterProfanity("wording",e)===!1?v({code:y.PROFANITY_FOUND}):(t=e.to,n=e.source,o=e.type,s=e.wording,a=e.remark,e=e.groupName,(i=o)&&(i===g.SNS_ADD_TYPE_SINGLE||i===g.SNS_ADD_TYPE_BOTH)||(i=g.SNS_ADD_TYPE_BOTH),(r=new D("addFriend")).setMessage("to:".concat(t," source:").concat(n," type:").concat(i)),this._snsM.req({P:h.ADD_FD,data:{fromAccount:this._snsM.getMyUserID(),addFriendItem:[{to:t,source:n,wording:s,remark:a,groupName:e}],type:i}}).then(function(f){var f=f.data.resultList,f=(r.setMoreMessage("resultList:".concat(JSON.stringify(f))).end(),f[0]),_=f.to,m=f.resultCode,f=f.resultInfo;return d.i("".concat(u," ok. to:").concat(_," type:").concat(i," code:").concat(m)),T(m)||m===0?N({userID:_,code:0}):m===30539?N({userID:_,code:m,message:c._snsM.getErrMsg(m)}):v({userID:_,code:m,message:c._snsM.getErrMsg(m)||f})}).catch(function(l){return r.setError(l).end(),d.w("".concat(u," failed. error:"),l),v(l)}))}},{key:"deleteFriend",value:function(a){var t,n=this,o="".concat(this._n,".").concat("deleteFriend"),s=a.userIDList,a=a.type,i=(1e3<s.length&&(d.w("".concat(o," ").concat(St(1e3))),s.length=1e3),[]),r=[],c=[];return s.forEach(function(u){n._map.has(u)?c.push(u):i.push({userID:u,code:y.NOT_MY_FRIEND,message:n._snsM.getErrMsg(y.NOT_MY_FRIEND)})}),c.length===0?q({successUserIDList:r,failureUserIDList:i}):((s=a)&&(s===g.SNS_DELETE_TYPE_SINGLE||s===g.SNS_DELETE_TYPE_BOTH)||(s=g.SNS_DELETE_TYPE_BOTH),(t=new D("deleteFriend")).setMessage("userIDList:".concat(c," type:").concat(s)),this._snsM.req({P:h.DEL_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:c,type:s}}).then(function(u){return t.end(),d.i("".concat(o," ok")),u=u.data.resultList,k(u)||u.forEach(function(f){var _=f.to,m=f.resultCode,f=f.resultInfo;T(m)||m===0?r.push({userID:_}):i.push({userID:_,code:m,message:f})}),N({successUserIDList:r,failureUserIDList:i})}).catch(function(u){return t.setError(u).end(),d.w("".concat(o," error:"),u),v(u)}))}},{key:"updateFriend",value:function(e){var t,n,o,s=this,a=e.userID,i=e.remark,r=e.friendCustomField;return this._map.has(a)?(t="".concat(this._n,".").concat("updateFriend"),(n=new D("updateFriend")).setMessage("userID:".concat(a," remark:").concat(i," friendCustomField:").concat(r)),o=[],T(i)||o.push({tag:$e.REMARK,value:i}),O(r)&&0<r.length&&r.forEach(function(c){o.push({tag:c.key,value:c.value})}),this._snsM.req({P:h.UPDATE_FD,data:{fromAccount:this._snsM.getMyUserID(),updateItem:[{to:a,snsItem:o}]}}).then(function(_){n.end(),d.i("".concat(t," ok"));var _=_.data.resultList[0],u=_.to,l=_.resultCode,_=_.resultInfo;return T(l)||l===0?((u=s._map.get(u))&&(T(i)||(u.remark=i),O(r)&&0<r.length&&tn(u.friendCustomField,r),s._onFriendListUpdated()),N(u)):v({code:l,message:_})}).catch(function(c){return n.setError(c).end(),d.w("".concat(t," failed. error:"),c),v(c)})):v({code:y.NOT_MY_FRIEND})}},{key:"checkFriend",value:function(e){var t="".concat(this._n,".").concat("checkFriend"),n=e.userIDList,o=e.type,s=(o&&(o===g.SNS_CHECK_TYPE_SINGLE||o===g.SNS_CHECK_TYPE_BOTH)||(o=g.SNS_CHECK_TYPE_BOTH),new D("checkFriend"));return s.setMessage("userIDList:".concat(n," type:").concat(o)),this._snsM.req({P:h.CHECK_FD,data:{fromAccount:this._snsM.getMyUserID(),userIDList:n,type:o}}).then(function(c){s.end(),d.i("".concat(t," ok. userIDList:").concat(n," type:").concat(o));var i=[],r=[],c=c.data.resultList;return O(c)&&c.forEach(function(f){var l=f.to,_=f.relation,m=f.resultCode,f=f.resultInfo;T(m)||m===0?i.push({userID:l,code:0,relation:_}):r.push({userID:l,code:m,message:f})}),N({successUserIDList:i,failureUserIDList:r})}).catch(function(a){return s.setError(a).end(),d.w("".concat(t," failed. error:"),a),v(a)})}},{key:"onAddedToFriendGroup",value:function(o){var t=this,n=o.name,o=o.userIDList;d.l("".concat(this._n,".onAddedToFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!k(o)&&o.forEach(function(s){t._map.has(s)&&t._map.get(s).addToGroupList(n)})}},{key:"onRemovedFromFriendGroup",value:function(o){var t=this,n=o.name,o=o.userIDList;d.l("".concat(this._n,".onRemovedFromFriendGroup groupName:").concat(n," userIDList:").concat(o)),n&&!k(o)&&o.forEach(function(s){t._map.has(s)&&t._map.get(s).removeFromGroupList(n)})}},{key:"reset",value:function(){this._map.clear(),this._startIdx=0,this._standardSeq=0,this._customSeq=0}}]),Ga=b(function e(t){U(this,e),k(t)||(this.name=t.name||"",this.userIDList=t.userIDList||[],this.count=this.userIDList.length||0)},[{key:"addToUserIDList",value:function(e){this.userIDList.indexOf(e)===-1&&(this.userIDList.push(e),this.count=this.userIDList.length)}},{key:"removeFromUserIDList",value:function(e){e=this.userIDList.indexOf(e),-1<e&&(this.userIDList.splice(e,1),this.count=this.userIDList.length)}}]),Vr=b(function e(t){U(this,e),this._snsM=t,this._n="FriendGroupHandler",this._map=new Map},[{key:"updateCacheOnReconnected",value:function(){this.getGroupList()}},{key:"getLocalGroupList",value:function(){return G(this._map.values())}},{key:"_onGroupListUpdated",value:function(){var e=G(this._map.values());this._snsM.emitOEvt(F.FRIEND_GROUP_LIST_UPDATED,e)}},{key:"getGroupList",value:function(){var e=this,t="".concat(this._n,".").concat("getGroupList"),n=new D("getGroupList");return this._snsM.req({P:h.GET_FD_GRP_LIST,data:{fromAccount:this._snsM.getMyUserID()}}).then(function(o){n.end(),o=o.data.resultList,k(o)?d.i("".concat(t," ok. count:0")):(d.i("".concat(t," ok. count:").concat(o.length)),e._map.clear(),o.forEach(function(s){var a=new Ga(s);e._map.set(s.name,a)}),e._onGroupListUpdated())}).catch(function(o){return n.setError(o).end(),d.w("".concat(t," error:"),o),v(o)})}},{key:"createGroup",value:function(i){var t,n,o=this,s="".concat(this._n,".").concat("createGroup"),a=i.name,i=i.userIDList;return this._map.has(a)?v({code:y.FRIEND_GRP_EXISTED}):(t="name:".concat(a," userIDList:").concat(i),(n=new D("createGroup")).setMessage(t),this._snsM.req({P:h.CREATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),groupName:[a],userIDList:O(i)?i:void 0}}).then(function(l){n.end(),d.l("".concat(s," ok. ").concat(t));var l=l.data.resultList,c=[],u=[],l=(l&&l.forEach(function(_){var m=_.to,f=_.resultCode,I=_.resultInfo;T(f)||f===0?c.push(m):(m={userID:_.to,code:f,message:I},u.push(m))}),new Ga({name:a,userIDList:c}));return o._map.set(a,l),o._snsM.onAddedToFriendGroup({name:a,userIDList:c}),o._onGroupListUpdated(),N({friendGroup:l,failureUserIDList:u})}).catch(function(r){return n.setError(r).end(),d.w("".concat(s," failed. error:"),r),v(r)}))}},{key:"deleteGroup",value:function(e){var t,n,o=this,s="".concat(this._n,".").concat("deleteGroup"),a=e.name;return this._map.has(a)?(t="name:".concat(a),(n=new D("deleteGroup")).setMessage(t),this._snsM.req({P:h.DEL_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),nameList:[a]}}).then(function(i){n.end(),d.l("".concat(s," ok. ").concat(t));var r=o._map.get(a);return r&&(o._snsM.onRemovedFromFriendGroup({name:a,userIDList:r.userIDList}),o._map.delete(a),r.userIDList.length=0),o._onGroupListUpdated(),N(r)}).catch(function(i){return n.setError(i).end(),d.w("".concat(s," failed. error:"),i),v(i)})):this._onGroupNotExist()}},{key:"renameGroup",value:function(e){var t,n,o=this,s="".concat(this._n,".").concat("renameGroup"),a=e.oldName,i=e.newName;return this._map.has(a)?(t="oldName:".concat(a," newName:").concat(i),(n=new D("renameGroup")).setMessage(t),this._snsM.req({P:h.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:a,newName:i}}).then(function(){var r;return n.end(),d.l("".concat(s," ok. ").concat(t)),o._map.has(a)?((r=o._map.get(a)).name=i,o._map.delete(a),o._map.set(i,r),o._snsM.onRemovedFromFriendGroup({name:a,userIDList:r.userIDList}),o._snsM.onAddedToFriendGroup({name:i,userIDList:r.userIDList}),o._onGroupListUpdated(),N(r)):N()}).catch(function(r){return n.setError(r).end(),d.w("".concat(s," failed. error:"),r),v(r)})):this._onGroupNotExist()}},{key:"addToGroup",value:function(i){var t,n,o=this,s="".concat(this._n,".").concat("addToGroup"),a=i.name,i=i.userIDList;return this._map.has(a)?(t="name:".concat(a," userIDList:").concat(i),(n=new D("addToGroup")).setMessage(t),this._snsM.req({P:h.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:a,updateGroupItem:i.filter(function(r){return o._snsM.isMyFriend(r)}).map(function(r){return{to:r,updateType:"Update_Type_Add"}})}}).then(function(r){return n.end(),d.l("".concat(s," ok. ").concat(t)),o._onGroupUpdated(a,r)}).catch(function(r){return n.setError(r).end(),d.w("".concat(s," failed. error:"),r),v(r)})):this._onGroupNotExist()}},{key:"removeFromGroup",value:function(i){var t,n,o=this,s="".concat(this._n,".").concat("removeFromGroup"),a=i.name,i=i.userIDList;return this._map.has(a)?(t="name:".concat(a," userIDList:").concat(i),(n=new D("removeFromGroup")).setMessage(t),this._snsM.req({P:h.UPDATE_FD_GRP,data:{fromAccount:this._snsM.getMyUserID(),oldName:a,updateGroupItem:i.filter(function(r){return o._snsM.isMyFriend(r)}).map(function(r){return{to:r,updateType:"Update_Type_Delete"}})}}).then(function(r){return n.end(),d.l("".concat(s," ok. ").concat(t)),o._onGroupUpdated(a,r)}).catch(function(r){return n.setError(r).end(),d.w("".concat(s," failed. error:"),r),v(r)})):this._onGroupNotExist()}},{key:"_onGroupUpdated",value:function(e,n){var n=n.data.resultList,o=this._map.get(e),s=[],a=[],i=[],r=!1;return O(n)&&n.forEach(function(c){var u=c.to,l=c.resultCode,_=c.resultInfo,m=c.type;l===0?m==="Update_Type_Add"?o&&(o.addToUserIDList(u),a.push(u),r=!0):m==="Update_Type_Delete"&&o&&(o.removeFromUserIDList(u),i.push(u),r=!0):s.push({to:c.to,code:l,message:_})}),d.l("".concat(this._n,"._onGroupUpdated name:").concat(e," userIDList:").concat(o.userIDList)),0<a.length&&this._snsM.onAddedToFriendGroup({name:e,userIDList:a}),0<i.length&&this._snsM.onRemovedFromFriendGroup({name:e,userIDList:i}),r&&this._onGroupListUpdated(),N({friendGroup:o,failureUserIDList:s})}},{key:"updateWhenFriendAdded",value:function(e){var t,n=this,o=e.nameList,s=e.userID;d.l("".concat(this._n,".updateWhenFriendAdded userID:").concat(s," nameList:").concat(o)),k(o)||(t=!1,o.forEach(function(a){n._map.has(a)&&(n._map.get(a).addToUserIDList(s),t=!0)}),t&&this._onGroupListUpdated())}},{key:"updateWhenFriendDeleted",value:function(e){var t,n=this,o=e.nameList,s=e.userID;d.l("".concat(this._n,".updateWhenFriendDeleted userID:").concat(s," nameList:").concat(o)),k(o)||(t=!1,o.forEach(function(a){n._map.has(a)&&(n._map.get(a).removeFromUserIDList(s),t=!0)}),t&&this._onGroupListUpdated())}},{key:"_onGroupNotExist",value:function(e){return v({code:y.FRIEND_GRP_NOT_EXIST})}},{key:"reset",value:function(){this._map.clear()}}]),Br=(de(ho,ce),b(ho,[{key:"onContextUpdated",value:function(e){this._friendHandler.pagingGetFriendList(),this._friendGroupHandler.getGroupList(),this._friendApplicationHandler.getApplicationList()}},{key:"onRelationChainModified",value:function(c){var t,n,o,s,a,i,r=this,c=c.dataList;k(c)||(t=[],n=[],o=[],a=!(s=[]),i="",c.forEach(function(u){var l;u.pushType!==3&&u.pushType!==4||!u.from||(i=u.from),u.friendAddAccount&&(t.push.apply(t,G(u.friendAddAccount)),s.push.apply(s,G(u.friendAddAccount))),u.friendDelAccount&&n.push.apply(n,G(u.friendDelAccount)),u.friendApplicationAdded&&o.push.apply(o,G(u.friendApplicationAdded)),u.friendApplicationDeletedUserIDList&&s.push.apply(s,G(u.friendApplicationDeletedUserIDList)),u.reportTime&&u.pushType===7&&(a=!0),u.friendUpInfo&&(l={dataList:[]},u.friendUpInfo.forEach(function(_){l.dataList.push({userID:_.friendAccount,profileList:G(_.sns)})}),r.onFriendProfileModified(l))}),a&&this._friendApplicationHandler.onApplicationRead(),this._friendApplicationHandler.onApplicationAdded(o,i),this._friendApplicationHandler.onApplicationDeleted(s),this._friendHandler.onFriendAdded(t),this._friendHandler.onFriendDeleted(n))}},{key:"isMyFriend",value:function(e){return this._friendHandler.isMyFriend(e)}},{key:"filterProfanity",value:function(e,t){var n,o=this.get(29);return!o||(n=(o=o.filterText(t[e],"sns")).isAllowedToSend,o=o.modifiedText,n===!0&&(t[e]=o,!0))}},{key:"onFriendProfileModified",value:function(e){this._friendHandler.onFriendProfileModified(e)}},{key:"getLocalFriendList",value:function(){var e=!(0<arguments.length&&arguments[0]!==void 0)||arguments[0],t=this._friendHandler.getLocalFriendList();return e?q(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:"onAddedToFriendGroup",value:function(e){this._friendHandler.onAddedToFriendGroup(e)}},{key:"onRemovedFromFriendGroup",value:function(e){this._friendHandler.onRemovedFromFriendGroup(e)}},{key:"getLocalFriendApplicationList",value:function(){var e=this._friendApplicationHandler.getLocalApplicationList();return q(e)}},{key:"deleteFriendApplication",value:function(e){return this._friendApplicationHandler.deleteApplication(e)}},{key:"refuseFriendApplication",value:function(e){return this._friendApplicationHandler.refuseApplication(e)}},{key:"acceptFriendApplication",value:function(e){return this._friendApplicationHandler.acceptApplication(e)}},{key:"setFriendApplicationRead",value:function(e){return this._friendApplicationHandler.setApplicationRead(e)}},{key:"getLocalFriendGroupList",value:function(){var e=this._friendGroupHandler.getLocalGroupList();return q(e)}},{key:"createFriendGroup",value:function(e){return this._friendGroupHandler.createGroup(e)}},{key:"deleteFriendGroup",value:function(e){return this._friendGroupHandler.deleteGroup(e)}},{key:"addToFriendGroup",value:function(e){return this._friendGroupHandler.addToGroup(e)}},{key:"removeFromFriendGroup",value:function(e){return this._friendGroupHandler.removeFromGroup(e)}},{key:"renameFriendGroup",value:function(e){return this._friendGroupHandler.renameGroup(e)}},{key:"updateWhenFriendAdded",value:function(e){this._friendGroupHandler.updateWhenFriendAdded(e)}},{key:"updateWhenFriendDeleted",value:function(e){this._friendGroupHandler.updateWhenFriendDeleted(e)}},{key:"updateCacheOnReconnected",value:function(){d.l("".concat(this._n,".updateCacheOnReconnected")),this._friendHandler.updateCacheOnReconnected(),this._friendGroupHandler.updateCacheOnReconnected(),this._friendApplicationHandler.updateCacheOnReconnected()}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._friendHandler.reset(),this._friendGroupHandler.reset(),this._friendApplicationHandler.reset()}}])),Hr=(de(go,ce),b(go,[{key:"isWorkerEnabled",value:function(){return this._isWorkerEnabled&&Pt}},{key:"startWorkerTimer",value:function(){d.l("".concat(this._n,".startWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("start")}},{key:"stopWorkerTimer",value:function(){d.l("".concat(this._n,".stopWorkerTimer")),this._workerTimer&&this._workerTimer.postMessage("stop")}},{key:"_init",value:function(){var e,t;Pt&&(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),(t=this)._workerTimer.onmessage=function(n){n.data?(t._timerID=n.data,d.l("".concat(t._n,"._init seed:").concat(t._timerID))):t._m.onCheckTimer()})}},{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("enable_worker");d.l("".concat(this._n,"._onCloudConfig enableWorker:").concat(e)),T(e)||e==="1"?!this._isWorkerEnabled&&Pt&&(this._isWorkerEnabled=!0,this.startWorkerTimer(),this._m.onWorkerTimerEnabled()):this._isWorkerEnabled&&Pt&&(this._isWorkerEnabled=!1,this.stopWorkerTimer(),this._m.onWorkerTimerDisabled())}},{key:"terminate",value:function(){d.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(){d.l("".concat(this._n,".reset"))}}])),Kr=b(function e(t){U(this,e),this._commercialConfigM=t,this._n="PurchasedFeatureHandler",this._isCSPluginReported=!1,this._featureMap=new Map,this._commercialAbility="0"},[{key:"isValidPurchaseBits",value:function(e){return e&&typeof e=="string"&&1<=e.length&&e.length<=64&&/[01]{1,64}/.test(e)}},{key:"parsePurchaseBits",value:function(e){if(this.isValidPurchaseBits(e)){this._commercialAbility=e,this._featureMap.clear();for(var t,n=e.length-1,o=0;0<=n;n--,o++)t=(o<32?new Me(0,Math.pow(2,o)):new Me(Math.pow(2,o-32),0)).toString(),e[n]==="1"?this._featureMap.set(t,!0):this._featureMap.set(t,!1)}else d.w("".concat(this._n,".parsePurchaseBits invalid purchasebits:").concat(e))}},{key:"hasPurchasedFeature",value:function(e){return!!this._featureMap.get(e)}},{key:"isFeatureEnabled",value:function(e){for(var t=parseInt(e).toString(2),n=void 0,o=!0,s=t.length-1,a=0;0<=s;s--,a++)if(t.charAt(s)==="1"&&(n=(a<32?new Me(0,Math.pow(2,a)):new Me(Math.pow(2,a-32),0)).toString(),!this._featureMap.get(n))){o=!1;break}return d.l("".concat(this._n,".isFeatureEnabled decimalNumber:").concat(e," key:").concat(n," ret:").concat(o)),q({enabled:o})}},{key:"isFeatureEnabledForStat",value:function(e){for(var t=parseInt(e).toString(2),n=t.length-1,o=0;0<=n;n--,o++)if(t.charAt(n)==="1"){if(s=(o<32?new Me(0,Math.pow(2,o)):new Me(Math.pow(2,o-32),0)).toString(),!this._featureMap.get(s))break;var s,a="",i=0;s===ee.PLUGIN_TRANSLATE?(a="plugin_translate",i=16):s===ee.PLUGIN_VOICE_TO_TEXT?(a="plugin_voice_to_text",i=17):s===ee.PLUGIN_CS?(a="plugin_cs",i=14):s===ee.PLUGIN_PUSH?(a="plugin_push",i=13):s===ee.PLUGIN_BOT?(a="plugin_bot",i=15):s===ee.MSG_REACTION&&(a="plugin_emoji_reaction",i=18),a!==""&&(s=this._commercialConfigM.get(12).getUIPlatform(),new D(a).setCode(i).setUIPlatform(s).end(),d.l("".concat(this._n,".isFeatureEnabledForStat ").concat(a," code:").concat(i," uiPlatform:").concat(s)))}}},{key:"isCSPluginEnabled",value:function(){var e;this._isCSPluginReported||(e=this._commercialConfigM.get(12).getUIPlatform(),new D("plugin_search").setCode(6).setUIPlatform(e).end(),this._isCSPluginReported=!0)}},{key:"queryCommercialAbility",value:function(){return this._commercialAbility}},{key:"clear",value:function(){this._featureMap.clear(),this._isCSPluginReported=!1,this._commercialAbility="0"}}]),Yr=b(function e(t){U(this,e),this._m=t,this._n="CommercialConfigModule",this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler=new Kr(this)},[{key:"_canFetch",value:function(){return this.get(12).isLoggedIn()?!this._isFetching&&Date.now()>=this._expiredTime:(this._expiredTime=Date.now()+2e3,!1)}},{key:"onCheckTimer",value:function(e){this._canFetch()&&this.fetchConfig()}},{key:"fetchConfig",value:function(){var e,t,n=this,o=this._canFetch(),s="".concat(this._n,".fetchConfig");d.l("".concat(s," canFetch:").concat(o)),o&&(e=new D("fetchCommercialConfig"),o=this.get(12).getSDKAppID(),t=this.get(20),this._isFetching=!0,t.req({P:h.FETCH_COMMERCIAL_CONFIG,data:{SDKAppID:o}}).then(function(a){e.setMessage("purchaseBits:".concat(a.data.purchaseBits)).end(),d.l("".concat(s," ok.")),n._parseConfig(a.data),n._isFetching=!1}).catch(function(a){e.setError(a).end(),n._isFetching=!1}))}},{key:"onPushedConfig",value:function(e){var t="".concat(this._n,".onPushedConfig data:").concat(JSON.stringify(e));d.l("".concat(t)),new D("pushedCommercialConfig").setMessage("purchaseBits:".concat(e.purchaseBits)).end(),this._parseConfig(e)}},{key:"_parseConfig",value:function(e){var t="".concat(this._n,"._parseConfig"),n=e.errorCode,o=e.errorMessage,s=e.purchaseBits,a=e.expiredTime;n===0?(this._purchasedFeatureHandler.parsePurchaseBits(s),this._expiredTime=Date.now()+1e3*a):T(n)?(d.l("".concat(t," failed. Invalid message format:"),e),this._setExpiredTimeOnResponseError(36e5)):(d.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:"isFeatureEnabledForStat",value:function(e){this._purchasedFeatureHandler.isFeatureEnabledForStat(e)}},{key:"isCSPluginEnabled",value:function(){this._purchasedFeatureHandler.isCSPluginEnabled()}},{key:"queryCommercialAbility",value:function(){return this._purchasedFeatureHandler.queryCommercialAbility()}},{key:"get",value:function(e){return this._m.get(e)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._expiredTime=0,this._isFetching=!1,this._purchasedFeatureHandler.clear()}}]),Wr=(de(_o,ce),b(_o,[{key:"registerPlugin",value:function(e){var t,n,o,s,a,i,r,c,u,l,_,m,f;Be?(this._offlinePushPlugin=e["tim-offline-push-plugin"],t=(f=e.offlinePushConfig||{}).huaweiBusinessID,n=f.xiaomiBusinessID,o=f.xiaomiAppID,s=f.xiaomiAppKey,a=f.meizuBusinessID,i=f.meizuAppID,r=f.meizuAppKey,c=f.vivoBusinessID,u=f.oppoBusinessID,l=f.oppoAppKey,_=f.oppoAppSecret,m=f.honorBusinessID,f=f.iosBusinessID,this._androidPushConfig.huaweiPushBussinessId=t,this._androidPushConfig.xiaomiPushBussinessId=n,this._androidPushConfig.xiaomiPushAppId=o,this._androidPushConfig.xiaomiPushAppKey=s,this._androidPushConfig.meizuPushBussinessId=a,this._androidPushConfig.meizuPushAppId=i,this._androidPushConfig.meizuPushAppKey=r,this._androidPushConfig.vivoPushBussinessId=c,this._androidPushConfig.oppoPushBussinessId=u,this._androidPushConfig.oppoPushAppKey=l,this._androidPushConfig.oppoPushAppSecret=_,this._androidPushConfig.honorPushBussinessId=m,new D("registerPlugin").setMessage("tim-offline-push-plugin").setMoreMessage("isExist:".concat(!T(this._offlinePushPlugin))).end(!0),d.l("".concat(this._n,".").concat("registerPlugin"," ok. offlinePushConfig:").concat(JSON.stringify(e.offlinePushConfig))),this._iosBusinessID=f,this._setAppShowListener()):this.warn("OfflinePushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._getDeviceToken()}},{key:"_getDeviceToken",value:function(){var e,t=this,n="".concat(this._n,".").concat("_getDeviceToken");Re(this._offlinePushPlugin.getDeviceToken)?(e="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig),", iosBusinessID:").concat(this._iosBusinessID),d.l("".concat(n," start. ").concat(e)),new D("_getDeviceToken").setMessage("".concat(e)).end(!0),this._offlinePushPlugin.getDeviceToken(this._androidPushConfig,function(o){var s,a,i,r,c=new D("getDeviceTokenRes"),u=o.code,l=o.msg;u===0?(s=(r=o.data).deviceToken,a=r.deviceBrand,i=r.deviceType,r=r.bussinessId,t._deviceToken=s,t._businessID=r||t._iosBusinessID,e="deviceToken:".concat(s,", deviceBrand:").concat(a||i,", businessID:").concat(t._businessID),d.l("".concat(n," ok. ").concat(e)),c.setMessage(e).end(!0),t._setToken()):(c.setMessage("code:".concat(u,", msg:").concat(l)).end(!0),d.e("".concat(n," failed. error:"),o))})):d.e("".concat(n," getDeviceToken is not a function"))}},{key:"canIUseOfflinePush",value:function(){return Be&&!T(this._offlinePushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");T(this._offlinePushPlugin)?d.e("".concat(t," offlinePushPlugin is undefined")):Re(this._offlinePushPlugin.setAppShowListener)?(new D("_setAppShowListener").end(!0),d.l("".concat(t," start")),this._offlinePushPlugin.setAppShowListener(function(n){n=(n||{}).appShow,new D("setAppShowListenerRes").setMessage("appShow:".concat(n)).end(!0),d.l("".concat(t," ok. appShow:").concat(n)),e._m.isReady()&&(n===0?(e._getConvUnreadCount(),e._onBackground()):n===1&&e._onForeground())})):d.e("".concat(t," setAppShowListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!T(this._offlinePushPlugin)&&Re(this._offlinePushPlugin.getDeviceType))return e=(this._offlinePushPlugin.getDeviceType()||{}).deviceType,d.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var e="".concat(this._n,"._setToken"),t=this.get(12),n=1,o="",s="",r=(k(this._deviceToken)&&(n=0),this.getUniAppPlatform()),a=this.getDeviceBrand(),i=(r===qe.IOS||r===qe.IPAD||r===qe.MAC?s=this._deviceToken:r===qe.ANDROID&&(o=this._deviceToken),new D("offlinePushSetToken")),r="deviceToken:".concat(s||o,", businessID:").concat(this._businessID,", ")+"deviceBrand:".concat(a,", isWebUniapp:").concat(this._isWebUniapp,", pushMsg:").concat(n,", platform:").concat(r);return i.setMessage("".concat(r)),d.l("".concat(e," ").concat(r)),this.req({P:h.SET_TOKEN,data:{tokenID:o,pushMsg:n,sdkAppID:t.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:a,deviceToken:s,isWebUniapp:this._isWebUniapp}}).then(function(c){return i.end(),d.l("".concat(e," ok")),c}).catch(function(c){return i.setError(c).end(),d.e("".concat(e," failed. error:"),c),v(c)})}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(t){t.type===g.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===g.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)})}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new D("_onBackground");this.req({P:h.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(o){return n.setMessage("c2cUnreadCount: ".concat(e._c2cUnreadCount,", groupUnreadCount: ").concat(e._groupUnreadCount)).end(),d.l("".concat(t," ok")),o}).catch(function(o){n.setError(o).end(),d.e("".concat(t," failed. error:"),o)})}},{key:"_onForeground",value:function(){var e="".concat(this._n,".").concat("_onForeground"),t=new D("_onForeground");this.req({P:h.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(n){return t.end(),d.l("".concat(e," ok")),n}).catch(function(n){t.setError(n).end(),d.e("".concat(e," failed. error:"),n)})}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return e==="ios"?qe.IOS:e==="android"?qe.ANDROID:t===1002?qe.IPAD:t===1001?qe.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,d.l("".concat(this._n,".reset"))}}])),jr=(de(po,ce),b(po,[{key:"registerPlugin",value:function(e){var t,n,o;Be?(t="".concat(this._n,".").concat("registerPlugin"),this._pushPlugin=e["tim-push"],this._getDeviceInfo(),n=(o=e.pushConfig||{}).androidConfig,o=o.iOSConfig,at(n)&&(this._androidPushConfig=n[this._deviceInfo.packageName]),n=(o||{}).iOSBusinessID,this._iOSBusinessID=n,o=!T(this._pushPlugin),new D("registerPlugin").setMessage(this._pluginName).setMoreMessage("isExisted:".concat(o)).end(!0),d.l("".concat(t," ok. pushConfig:").concat(JSON.stringify(e.pushConfig))),o?(this._setAppShowListener(),this._setPushEventReportListener()):d.e("".concat(t," ").concat(this._pluginName," is undefined"))):this.warn("TIMPushInUniapp")}},{key:"init",value:function(){this._isWebUniapp=this.getUniAppPlatform(),this._reportEventCacheList(),this._getDeviceToken(),this.get(27).isFeatureEnabledForStat(Math.pow(2,41))}},{key:"_reportEventCacheList",value:function(){var e=this,t="".concat(this._n,".").concat("_reportEventCacheList");Re(this._pushPlugin.getPushEventCacheList)?(new D("_reportEventCacheList").end(!0),this._pushPlugin.getPushEventCacheList(function(n){var o=n.code,s=n.data.eventList,a=new D("getPushEventCacheListRes");if(a.setCode(o),o!==0)a.setMessage("res:".concat(JSON.stringify(n))).end(!0),d.e("".concat(t," failed. error:").concat(JSON.stringify(n)));else{o=s.length<10?"eventList:".concat(JSON.stringify(s)):"eventList.length:".concat(s.length),d.l("".concat(t," ok. ").concat(o)),a.setMessage(o).end(!0);for(var i=p(p({},n.data),{},{eventList:[]});0<s.length;)i.eventList=s.splice(0,40),e._pushReport(i)}})):d.e("".concat(this._pluginName,".getPushEventCacheList is not a function"))}},{key:"_getDeviceToken",value:function(){var e,t=this,n="".concat(this._n,".").concat("_getDeviceToken");Re(this._pushPlugin.getDeviceToken)?(e="androidPushConfig:".concat(JSON.stringify(this._androidPushConfig)," iOSBusinessID:").concat(this._iOSBusinessID),d.l("".concat(n," start. ").concat(e)),new D("_getDeviceToken").setMessage("".concat(e)).end(!0),this._pushPlugin.getDeviceToken(this._androidPushConfig,function(o){var s,a,i,r=o.code,c=o.msg,u=new D("getDeviceTokenRes");u.setCode(r),r===0?(s=(r=o.data).deviceToken,a=r.deviceBrand,i=r.deviceType,r=r.bussinessId,t._deviceToken=s,t._businessID=r||t._iOSBusinessID,e="deviceToken:".concat(s," deviceBrand:").concat(a||i," businessID:").concat(t._businessID),d.l("".concat(n," ok. ").concat(e)),u.setMessage(e).end(!0),t._setToken()):(u.setMessage(c).end(!0),d.e("".concat(n," failed. error:").concat(JSON.stringify(o))))})):d.e("".concat(this._pluginName,".getDeviceToken is not a function"))}},{key:"_getDeviceInfo",value:function(){var e,t,n,o,s="".concat(this._n,".").concat("_getDeviceInfo");Re(this._pushPlugin.getDeviceInfo)?(o=(e=this._pushPlugin.getDeviceInfo()).code,t=e.data,(n=new D("_getDeviceInfo")).setCode(o),o===0?(this._deviceInfo=p(p({},this._deviceInfo),t),this._deviceInfo.pushVersion||(this._deviceInfo.pushVersion="1.0.1"),o="deviceInfo:".concat(JSON.stringify(this._deviceInfo)),d.l("".concat(s," ok. ").concat(o)),n.setMessage(o).end(!0)):(n.setMessage("deviceInfoRes:".concat(JSON.stringify(e))).end(!0),d.e("".concat(s," failed. error:").concat(JSON.stringify(e))))):d.e("".concat(this._pluginName,".getDeviceInfo is not a function"))}},{key:"canIUseTIMPush",value:function(){return Be&&!T(this._pushPlugin)}},{key:"_setAppShowListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setAppShowListener");Re(this._pushPlugin.setAppShowListener)?(new D("_setAppShowListener").end(!0),d.l("".concat(t," start")),this._pushPlugin.setAppShowListener(function(n){n=(n||{}).appShow,new D("setAppShowListenerRes").setMessage("appShow:".concat(n)).end(!0),d.l("".concat(t," ok. appShow:").concat(n)),e._m.isReady()&&(n===0?(e._getConvUnreadCount(),e._onBackground()):n===1&&e._onForeground())})):d.e("".concat(this._pluginName,".setAppShowListener is not a function"))}},{key:"_setPushEventReportListener",value:function(){var e=this,t="".concat(this._n,".").concat("_setPushEventReportListener");Re(this._pushPlugin.setPushEventReportListener)?(new D("_setPushEventReportListener").end(!0),this._pushPlugin.setPushEventReportListener(function(n){var o=n.code,s=n.data,a=s.eventList,i=new D("setPushEventReportListenerRes");i.setCode(o),o===0?(o="eventList:".concat(JSON.stringify(a)),d.l("".concat(t," ok. ").concat(o)),i.setMessage(o).end(!0),e._m.isReady()&&O(a)&&0<a.length&&e._pushReport(s)):(i.setMessage("res:".concat(JSON.stringify(n))).end(!0),d.e("".concat(t," failed. error:").concat(JSON.stringify(n))))})):d.e("".concat(this._pluginName,".setPushEventReportListener is not a function"))}},{key:"getDeviceBrand",value:function(){var e;if(!T(this._pushPlugin)&&Re(this._pushPlugin.getDeviceType))return e=(this._pushPlugin.getDeviceType()||{}).deviceType,d.l("".concat(this._n,".getDeviceBrand ok. deviceType:").concat(e)),e}},{key:"_setToken",value:function(){var e="".concat(this._n,".").concat("_setToken"),t=this.get(12),n=1,r="",o="",a=(k(this._deviceToken)&&(n=0),this.getUniAppPlatform()),s=this.getDeviceBrand(),a=(a===qe.IOS||a===qe.IPAD||a===qe.MAC?o=this._deviceToken:a===qe.ANDROID&&(r=this._deviceToken),p({tokenID:r,pushMsg:n,sdkAppID:t.getSDKAppID(),businessID:parseInt(this._businessID),deviceBrand:s,deviceToken:o,isWebUniapp:this._isWebUniapp},this._deviceInfo)),i=new D("_setToken"),r="data:".concat(JSON.stringify(a));i.setMessage("".concat(r)),d.l("".concat(e," ").concat(r)),this.req({P:h.SET_TOKEN,data:a}).then(function(){i.end(),d.w("".concat(e," ok"))}).catch(function(c){i.setError(c).end(),d.e("".concat(e," failed. error:"),c),v(c)})}},{key:"_getConvUnreadCount",value:function(){var e=this;this._c2cUnreadCount=0,this._groupUnreadCount=0,this.get(11).getLocalConvList().forEach(function(t){t.type===g.CONV_C2C&&(e._c2cUnreadCount+=t.unreadCount),t.type===g.CONV_GROUP&&(e._groupUnreadCount+=t.unreadCount)})}},{key:"_onBackground",value:function(){var e=this,t="".concat(this._n,".").concat("_onBackground"),n=new D("_onBackground");this.req({P:h.STAT_BACKGROUND,data:{c2cUnreadCount:this._c2cUnreadCount,groupUnreadCount:this._groupUnreadCount,isWebUniapp:this._isWebUniapp}}).then(function(){n.setMessage("c2cUnreadCount:".concat(e._c2cUnreadCount," groupUnreadCount:").concat(e._groupUnreadCount)).end(),d.l("".concat(t," ok"))}).catch(function(o){n.setError(o).end(),d.e("".concat(t," failed. error:"),o)})}},{key:"_onForeground",value:function(){var e="".concat(this._n,".").concat("_onForeground"),t=new D("_onForeground");this.req({P:h.STAT_FOREGROUND,data:{isWebUniapp:this._isWebUniapp}}).then(function(){t.end(),d.l("".concat(e," ok"))}).catch(function(n){t.setError(n).end(),d.e("".concat(e," failed. error:"),n)})}},{key:"_pushReport",value:function(e){var t=this,n="".concat(this._n,".").concat("_pushReport"),o=new D("_pushReport");this.req({P:h.PUSH_REPORT,data:{eventList:e.eventList}}).then(function(){o.end(),t._notifyReportSuccess(e)}).catch(function(s){o.setError(s).end(),d.e("".concat(n," failed. error:"),s)})}},{key:"_notifyReportSuccess",value:function(e){!T(this._pushPlugin)&&Re(this._pushPlugin.notifyReportSuccess)&&(this._pushPlugin.notifyReportSuccess(e),d.l("".concat(this._n,"._notifyReportSuccess ok")))}},{key:"getUniAppPlatform",value:function(){var e=uni.getSystemInfoSync().platform,t=this.getDeviceBrand();return e==="ios"?qe.IOS:e==="android"?qe.ANDROID:t===1002?qe.IPAD:t===1001?qe.MAC:void 0}},{key:"reset",value:function(){this._deviceToken="",this._businessID=0,this._c2cUnreadCount=0,this._groupUnreadCount=0,this._isWebUniapp=0,d.l("".concat(this._n,".reset"))}}])),Jr=(de(lo,ce),b(lo,[{key:"init",value:function(){var e=this.get(18).getPlugin("tim-profanity-filter-plugin");e&&(this._plugin=new e({logger:d,isArray:O,isMap:js,isDevMode:this.isDevMode()}),this._getLexicon())}},{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&&(!t||!t.messageControlInfo||t.messageControlInfo.excludedFromContentModeration!==!0)){var t=e.type,o=e.conversationType;if(t===g.MSG_TEXT||t===g.MSG_CUSTOM){var s,a="".concat(this._n,".filterMessage");if(d.l("".concat(a)),t===g.MSG_TEXT){if(o===g.CONV_C2C?s="c2c_text_message":o===g.CONV_GROUP&&(s="group_text_message"),!this._isConfigOn(s))return n;var r=this._plugin.filter(e.payload.text),i=r.type,r=r.modifiedText;i===1?n=!1:i===2&&(e.payload.text=r)}else if(t===g.MSG_CUSTOM){if(o===g.CONV_C2C?s="c2c_custom_message":o===g.CONV_GROUP&&(s="group_custom_message"),!this._isConfigOn(s))return n;i=this._plugin.filter(e.payload.data),r=this._plugin.filter(e.payload.description),t=this._plugin.filter(e.payload.extension),i.type===1||r.type===1||t.type===1?n=!1:(i.type===2&&(e.payload.data=i.modifiedText),r.type===2&&(e.payload.description=r.modifiedText),t.type===2&&(e.payload.extension=t.modifiedText))}d.l("".concat(a," done. isAllowedToSend:").concat(n))}}return n}},{key:"filterText",value:function(e,t){var n="".concat(this._n,".filterText"),o={isAllowedToSend:!0,modifiedText:e};return this._plugin&&this._canIUseLexicon&&this._isConfigOn(t)&&(d.l("".concat(n)),e=(t=this._plugin.filter(e)).type,t=t.modifiedText,e===1?o.isAllowedToSend=!1:e===2&&(o.modifiedText=t),d.l("".concat(n," done. ret:"),o)),o}},{key:"_getLexicon",value:function(){var e=this,t=new D("profanityFilter"),n="".concat(this._n,"._getLexicon");this._isFetching=!0,this.req({P:h.GET_PROFANITY_LIST,data:{startIndex:this._startIndex,version:this._version}}).then(function(_){var _=_.data,s=_.errorInfo,a=_.filterConfig,i=_.lexicon,r=_.strToken,c=_.completeFlag,u=_.nextStartIndex,l=_.version,_=_.expiredTime,m=s.errorCode,f=s.errorMessage;return m!==0?(e._isFetching=!1,d.w("".concat(n," failed. error:"),s),void t.setCode(m).setMessage(f).end()):(e._onFilterConfig(a),e._getToken(r),c===1?(d.l("".concat(n," done. version:").concat(l," expiredTime:").concat(_)),e._version=l,e._canIUseLexicon=!0,e._isFetching=!1,e._expiredTime=Date.now()+1e3*_,void e._plugin.onLexiconCompleted(i)):(e._startIndex=u,e._plugin.onLexiconSliced(i),void e._getLexicon()))}).catch(function(o){t.setError(o).end(),e._isFetching=!1,d.l("".concat(n," failed. error:"),o)})}},{key:"_onFilterConfig",value:function(e){var t=this;k(e)||(this._filterConfigMap.clear(),Object.keys(e).forEach(function(n){t._filterConfigMap.set(n,e[n])}),d.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 this._filterConfigMap.get(e)===1}},{key:"_getToken",value:function(e){if(V(e)){var t=e.length,n="";if(t%2==0)for(var o=0;o<=t-1;o+=2)n=(n+=e[o+1])+e[o];else{for(var s=0;s<t-1;s+=2)n=(n+=e[s+1])+e[s];n+=e[t-1]}this._plugin.onToken(n)}}},{key:"reset",value:function(){d.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}}])),zr=b(function e(t){U(this,e),this._m=t,this._n="TransCmdModule",this._TRTCCommandList=["tui_room_svr.*","callkit_records_svr.*","room_engine_srv.*","room_engine_http_srv.*","room_engine_mic.*","live_engine_srv.*","live_engine_http_srv.*","live_engine_pk.*","trtc_ai_service.*","call_engine_srv.*"],this._TRTCCommandMap=new Map,this._setTRTCCommandMap(),this._m.getIEmitInst().on(ne.CLOUD_CONFIG,this._onCloudConfig,this)},[{key:"_onCloudConfig",value:function(){var e=this,t=this._m.get(23).getCloudConfig("rtc_cmd");T(t)||((t=JSON.parse(t)).forEach(function(n){e._TRTCCommandList.includes(n)||e._TRTCCommandList.push(n)}),this._setTRTCCommandMap())}},{key:"_setTRTCCommandMap",value:function(){for(var e,t=0,n=this._TRTCCommandList.length;t<n;t++)e=this._TRTCCommandList[t].split(".")[0],this._TRTCCommandMap.set(e,1)}},{key:"onRoomCustomDataReceived",value:function(e){this._m.getOEmitInst().emit(F.ROOM_CUSTOM_DATA_RECEIVED,e)}},{key:"sendTRTCCustomData",value:function(n){var t=n.serviceCommand,n=n.data,o="".concat(E.NAME.TUIROOM_SVR,".*");return T(t)||(o=t),this._isValidServiceCommand(o)?this._trans({servcmd:o,data:n}):v({code:y.INVALID_TRTC_CMD})}},{key:"_trans",value:function(n){d.d("".concat(this._n,"._trans. options:").concat(JSON.stringify(n)));var t=n.servcmd,n=n.data;return this._m.get(20).trans({servcmd:t,data:V(n)?JSON.parse(n):n})}},{key:"_isValidServiceCommand",value:function(e){return e.endsWith(".*")?this._TRTCCommandList.includes(e):(e=e.split(".")[0],this._TRTCCommandMap.has(e))}},{key:"isTRTCCommand",value:function(e){return e=e.split(".")[0],this._TRTCCommandMap.has(e)}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}]),Xr=b(function e(t){U(this,e),this._m=t,this._n="ErrMsgModule",this.TIM_ERROR_ASSISTANCE="tim_error_assistance",this.STORAGE_EXPIRES_TIME=6048e5,this.CURRENT_DOMAIN=Ls,this._map=new Map,this._init()},[{key:"_init",value:function(){var e,t=this._getStorageModule().getItem(this.TIM_ERROR_ASSISTANCE,!1);if(t){try{e=JSON.parse(t)}catch(n){this._getStorageModule().removeItem(this.TIM_ERROR_ASSISTANCE,!1),d.w("".concat(this._n,"._init error:"),n)}e&&(this._needToUpdate(e)?this._fetch():this._fillMap(e.message))}else this._fetch()}},{key:"_needToUpdate",value:function(n){var t=n.localSavedTime,n=n.localSavedVersion,t=t&&new Date().getTime()-t>=this.STORAGE_EXPIRES_TIME,n=!n||n!=="3.6.6";return d.l("".concat(this._n,"._needToUpdate isTimeout:").concat(t," isDifferentVersion:").concat(n)),t||n}},{key:"_fetch",value:function(){this._m.get(12).isPrivateNetWork()||this._fetchWithRetry()}},{key:"_fetchWithRetry",value:function(){var e=this;this._fetchAdapter().catch(function(){e.CURRENT_DOMAIN!==ks&&(e._generateCurrentDomain(),e._fetchWithRetry())})}},{key:"_generateCurrentDomain",value:function(){this.CURRENT_DOMAIN===Ls?this.CURRENT_DOMAIN=Ss:this.CURRENT_DOMAIN===Ss&&(this.CURRENT_DOMAIN=ks)}},{key:"_fetchAdapter",value:function(){var e="https://".concat(this.CURRENT_DOMAIN,"/im/download/error-message/v3/0.0.7/tim-error-message.txt"),t="application/x-www-form-urlencoded;charset=UTF-8",n="".concat(this._n,"._fetchAdapter ok in"),o=this;return new Promise(function(s,a){var i,r;X?te.request({url:e,method:"GET",timeout:3e3,header:{"content-type":t},dataType:"text",success:function(c){o._fillAndSave(c.data),d.l("".concat(n," mini program.")),s()},fail:function(c){a(c)}}):(i=new XMLHttpRequest,r=setTimeout(function(){i.abort()},3e3),i.onreadystatechange=function(){i.readyState===4&&(r&&clearTimeout(r),i.status===200||i.status===304?(d.l("".concat(n," browser.")),o._fillAndSave(i.responseText),s()):a(i.status))},i.onerror=function(c){a(c)},i.open("GET",e,!0),i.setRequestHeader("Content-type",t),i.send())})}},{key:"_fillAndSave",value:function(e){this._fillMap(e),this._getStorageModule().setItem(this.TIM_ERROR_ASSISTANCE,JSON.stringify({message:e,localSavedTime:new Date().getTime(),localSavedVersion:"3.6.6"}),!0,!1)}},{key:"_getStorageModule",value:function(){return this._m.get(13)}},{key:"_fillMap",value:function(e){this._map.clear();for(var t,n,o=e.split(`;
`),s=o.length,a=new RegExp(/'/g),i=0;i<s;i++)if(n=o[i].indexOf(":"),t=o[i].slice(0,n),n=o[i].slice(n+1,o[i].length),!t.startsWith("//")){if(T(n))continue;this._map.set(t,n.replace(a,""))}}},{key:"get",value:function(n){var o=n.isIntl,s=n.key,t=n.replacement1,n=n.replacement2,o="".concat(s,o?"_en":"_cn"),s=(!this._map.has(o)&&this._map.has(s)&&(o=s),"");return this._map.has(o)&&(s=this._map.get(o),T(t)||(s=s.replace("$replacement1",t)),T(n)||(s=s.replace("$replacement2",n))),s}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}]),Zr=b(function e(t){U(this,e),this._n="RemoteSignalingHandler",this._sigM=t},[{key:"onNewMessageList",value:function(e){var t=this;e.forEach(function(n){var o=t.getPayloadData(n);o&&t._handleActionType(o,n)})}},{key:"onMessageModified",value:function(e){var t=this;e.forEach(function(n){var o=t.getPayloadData(n);o&&t._onInvitationModified(o,n)})}},{key:"getPayloadData",value:function(n){var t="".concat(this._n,".getPayloadData"),n=n.payload.data;try{return JSON.parse(n)}catch{return d.e("".concat(t," JSON parse error. signalingData:").concat(n)),null}}},{key:"_handleActionType",value:function(e,t){switch(e.actionType){case ge.ACTION_TYPE_INVITE:this._onNewInvitationReceived(e,t);break;case ge.ACTION_TYPE_REJECT_INVITE:this._onInviteeRejected(e);break;case ge.ACTION_TYPE_ACCEPT_INVITE:this._onInviteeAccepted(e);break;case ge.ACTION_TYPE_CANCEL_INVITE:this._onInvitationCancelled(e);break;case ge.ACTION_TYPE_INVITE_TIMEOUT:this._onInvitationTimeout(e)}}},{key:"_genBaseEmitData",value:function(e){return{inviteID:e.inviteID,inviter:e.inviter,groupID:e.groupID,data:e.data||""}}},{key:"_onNewInvitationReceived",value:function(e,t){var l="".concat(this._n,"._onNewInvitationReceived"),n=e.inviteID,o=e.inviteeList,s=e.groupID,a=e.inviter,i=this._sigM.getMyUserID(),r=o.includes(i),c=e.timeout,u=(Fs().getTime()-1e3*t.time)/1e3,l=(0<c&&0<u&&u<c&&(c-=u),"".concat(l," myselfIncluded:").concat(r," groupID:").concat(s," signalObj:").concat(JSON.stringify(e)));d.l("".concat(l," timeout:").concat(c,"s delta:").concat(u,"s")),!(s&&r||!s)||(l=this._sigM.getInviteInfo(n))&&l===e||(l||this._sigM.setInviteInfo(n,p(p({},e),{},{message:t})),this._sigM.emitEvent(ge.NEW_INVITATION_RECEIVED,p(p({},this._genBaseEmitData(e)),{},{inviteeList:o})),a!==i&&this._sigM.startTimer(p(p({},e),{},{timeout:c})))}},{key:"_onInviteeRejected",value:function(e){var t="".concat(this._n,"._onInviteeRejected"),n=e.inviteID,o=e.inviter,s=e.groupID,a=this._sigM.hasInviteInfo(n);d.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(s)),a&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(ge.INVITEE_REJECTED,p(p({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInviteeAccepted",value:function(e){var t="".concat(this._n,"._onInviteeAccepted"),n=e.inviteID,o=e.inviter,s=e.groupID,a=this._sigM.hasInviteInfo(n);d.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(s)),a&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(ge.INVITEE_ACCEPTED,p(p({},this._genBaseEmitData(e)),{},{invitee:e.inviteeList[0]})))}},{key:"_onInvitationCancelled",value:function(e){var t="".concat(this._n,"._onInvitationCancelled"),n=e.inviteID,o=e.inviter,s=e.groupID,a=this._sigM.hasInviteInfo(n);d.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(a," inviter:").concat(o," groupID:").concat(s)),a&&(this._sigM.deleteInviteInfo(n),this._sigM.emitEvent(ge.INVITATION_CANCELLED,this._genBaseEmitData(e)))}},{key:"_onInvitationTimeout",value:function(e){var t="".concat(this._n,"._onInvitationTimeout"),n=e.inviteID,o=e.inviter,s=e.groupID,a=e.inviteeList,i=this._sigM.hasInviteInfo(n);d.l("".concat(t," inviteID:").concat(n," hasInviteID:").concat(i," inviter:").concat(o," groupID:").concat(s," data:").concat(e.data)),i&&(this._sigM.updateInviteInfo(e),this._sigM.emitEvent(ge.INVITATION_TIMEOUT,p(p({},this._genBaseEmitData(e)),{},{inviteeList:a,isSelfTimeout:!1})))}},{key:"_onInvitationModified",value:function(e,t){var n="".concat(this._n,"._onInvitationModified"),o=e.inviteID,s=e.data,a=this._sigM.hasInviteInfo(o);d.l("".concat(n," inviteID:").concat(o," hasInviteID:").concat(a," data:").concat(s)),a&&(this._sigM.setInviteInfo(o,p(p({},e),{},{message:t})),this._sigM.emitEvent(ge.INVITATION_MODIFIED,{inviteID:o,data:s}))}}]),Qr=b(function e(t){U(this,e),this._n="LocalSignalingHandler",this._sigM=t},[{key:"generateInviteID",value:function(){var e,t=(t=Ar)((e=Rr)(32),8)+"-"+t(e(16),4)+"-"+t(16384|e(12),4)+"-"+t(32768|e(14),4)+"-"+t(e(48),12);return d.l("".concat(this._n,".generateInviteID inviteID:").concat(t)),t}},{key:"createInviteInfo",value:function(n){var t=this.generateInviteID(),n=this.createInviteCustomData(p(p({},n),{},{inviteID:t})),s=n.groupID,o=n.inviteeList,s=s||o[0];return{customData:n,message:this._sigM.createSignaling(n,s),inviteID:t}}},{key:"_genBaseCustomData",value:function(o){var t=o.data,n=o.inviteID,o=o.groupID;return{businessID:1,timeout:0,data:t===void 0?"":t,inviteID:n===void 0?"":n,groupID:o===void 0?"":o}}},{key:"createInviteCustomData",value:function(e){var t=e.userID,n=e.timeout,n=n===void 0?0:n,o=e.groupID,o=o===void 0?"":o,s=this._sigM.getMyUserID(),s=p(p({},this._genBaseCustomData(e)),{},{actionType:ge.ACTION_TYPE_INVITE,inviter:s,inviteeList:o?e.inviteeList:[t],timeout:n});return d.l("".concat(this._n,".createInviteCustomData customData:"),s),s}},{key:"createCancelCustomData",value:function(e){var t,n="".concat(this._n,".createCancelCustomData"),i=e.inviteID,o=this._sigM.getMyUserID(),i=this._sigM.getInviteInfo(i),s=i.inviteeList,a=i.groupID,i=i.inviter;return i===o?t=p(p({},this._genBaseCustomData(e)),{},{actionType:ge.ACTION_TYPE_CANCEL_INVITE,groupID:a,inviter:o,inviteeList:s}):d.e("".concat(n," unmatched inviter:").concat(i," and my userID:").concat(o)),d.l("".concat(n," customData:"),t),t}},{key:"createAcceptCustomData",value:function(e){var t,n="".concat(this._n,".createAcceptCustomData"),o=e.inviteID,s=this._sigM.getMyUserID(),a=this._sigM.getInviteInfo(o),i=a.inviter,r=a.groupID;return a.inviteeList.includes(s)?t=p(p({},this._genBaseCustomData(e)),{},{actionType:ge.ACTION_TYPE_ACCEPT_INVITE,groupID:r,inviter:i,inviteeList:[s]}):d.e("".concat(n," userID:").concat(s," not in inviteeList. inviteID:").concat(o," groupID:").concat(r)),d.l("".concat(n," customData:"),t),t}},{key:"createRejectCustomData",value:function(e){var t,n="".concat(this._n,".createRejectCustomData"),o=e.inviteID,s=this._sigM.getMyUserID(),a=this._sigM.getInviteInfo(o),i=a.inviter,r=a.groupID;return a.inviteeList.includes(s)?t=p(p({},this._genBaseCustomData(e)),{},{actionType:ge.ACTION_TYPE_REJECT_INVITE,groupID:r,inviter:i,inviteeList:[s]}):d.e("".concat(n," userID:").concat(s," not in inviteeList. inviteID:").concat(o," groupID:").concat(r)),d.l("".concat(n," customData:"),t),t}},{key:"createTimeoutCustomData",value:function(i){var t="".concat(this._n,".createTimeoutCustomData"),n=i.inviteeList,o=i.inviter,s=i.isInviter,s=s!==void 0&&s,a=this._sigM.getMyUserID(),i=p(p({},this._genBaseCustomData(i)),{},{actionType:ge.ACTION_TYPE_INVITE_TIMEOUT,inviter:o,inviteeList:s?n:[a]});return d.l("".concat(t," customData:"),i),i}}]),$r=b(function e(t){U(this,e),this._n="HistorySignalingHandler",this._sigM=t,this.COUNT=20,this.EXPIRED_TIME=300,this._map=new Map,this._relatedToMeMap=new Map},[{key:"setCloudConfig",value:function(){var e=0<arguments.length&&arguments[0]!==void 0?arguments[0]:20,t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:300;this.COUNT=e,this.EXPIRED_TIME=t,d.l("".concat(this._n,".setCloudConfig count:").concat(e,", time:").concat(t))}},{key:"getHistorySignaling",value:function(){var e=this,t=this._sigM.get(11).getLocalConvList();k(t)||(this._getC2CSignalingList(),t=this._getValidGroupConvList(t),this._getGroupSignalingList(t).then(function(n){e._handleSignalingList(n)}))}},{key:"_getC2CSignalingList",value:function(){var e=this._sigM.get(6).getMessageListFromUnreadDB(),e=this._sigM.filterMessageList(e);this._getRelatedToMeMap(e)}},{key:"_getGroupSignalingList",value:function(n){var t=this,n=this._createPromiseList(n);return n.length===0?Promise.resolve(this._sortSignaling(this._relatedToMeMap)):this._concurrentGetMessageList(n).then(function(o){var s=new Map;return o.forEach(function(a){a=a.list,a=t._getRelatedToMeMap(a),s=new Map([].concat(G(s),G(a)))}),t._sortSignaling(s)})}},{key:"_handleSignalingList",value:function(e){k(e)||this._sigM.onNewMessageList(e)}},{key:"_getValidGroupConvList",value:function(e){for(var t=[],n=0,o=e.length;n<o;n++){var i=e[n],a=i.type,s=i.unreadCount,i=i.lastMessage,a=a===g.CONV_GROUP,i=this._isNotExpired(i);a&&s&&i&&t.push(e[n])}return t}},{key:"_isNotExpired",value:function(e){return!(!e||!e.lastTime)&&e.lastTime>Zt()-this.EXPIRED_TIME}},{key:"_createPromiseList",value:function(e){for(var t=[],n=0;n<e.length;n++){var s=e[n],o=s.conversationID,s=s.unreadCount,s=s<this.COUNT?s:this.COUNT,s=(this._map.set(o,{msgCount:s,list:[]}),this._sigM.get(11).getMessageList({conversationID:o}));t.push(s)}return t}},{key:"_concurrentGetMessageList",value:function(e){var t=this,n=[];return Promise.all(e).then(function(o){for(var s=0;s<o.length;s++){var i=o[s],a=i.code,i=i.data;a===0&&i.messageList.length!==0&&(t._handleMessageList(i.messageList),a=t._relayGetMessageList(i))&&n.push(a)}return 0<n.length?t._concurrentGetMessageList(n):t._map})}},{key:"_relayGetMessageList",value:function(s){var t,n=s.messageList,o=s.nextReqMessageID,s=s.isCompleted;return n.length===0||(n=n[0].conversationID,(t=this._map.get(n).msgCount)===0)||s?null:this._sigM.get(11).getMessageList({conversationID:n,nextReqMessageID:o,count:t})}},{key:"_handleMessageList",value:function(e){var t=e.length,n=e[0].conversationID,s=this._map.get(n),o=s.msgCount,s=s.list;this._map.set(n,{msgCount:0<o-t?o-t:0,list:s.concat(this._sigM.filterMessageList(e))})}},{key:"_getRelatedToMeMap",value:function(e){for(var t=0;t<e.length;t++){var n=e[t];this._saveRelatedToMe(n)}return this._relatedToMeMap}},{key:"_saveRelatedToMe",value:function(e){var n=this._sigM.getPayloadData(e)||{},t=n.actionType,n=n.inviteID,o=n===void 0?"":n;switch(t===void 0?"":t){case ge.ACTION_TYPE_INVITE:this._setHistoryInvite(e);break;case ge.ACTION_TYPE_REJECT_INVITE:case ge.ACTION_TYPE_ACCEPT_INVITE:this._updateHistoryInvite(e);break;case ge.ACTION_TYPE_CANCEL_INVITE:this._delHistoryInvite(o);break;case ge.ACTION_TYPE_INVITE_TIMEOUT:this._updateHistoryInvite(e)}}},{key:"_setHistoryInvite",value:function(e){var t=this._sigM.getPayloadData(e)||{},n=t.inviteID,n=n===void 0?"":n,o=t.inviteeList,o=o===void 0?[]:o,s=t.timeout,s=s===void 0?0:s,a=this._sigM.getMyUserID();o.includes(a)&&(o=Zt()-e.time,0<s&&s<o&&s!==0||this._relatedToMeMap.set(n,p(p({},t),{},{messageList:[e]})))}},{key:"_delHistoryInvite",value:function(e){this._relatedToMeMap.has(e)&&this._relatedToMeMap.delete(e)}},{key:"_updateHistoryInvite",value:function(e){var n=this._sigM.getPayloadData(e)||{},t=n.inviteID,t=t===void 0?"":t,n=n.inviteeList,o=n===void 0?[]:n;if(this._relatedToMeMap.has(t)){for(var n=this._relatedToMeMap.get(t),s=n.inviteeList,n=n.messageList,a=0;a<o.length;a++){var i=o[a];s.includes(i)&&s.splice(s.indexOf(i),1)}s.length===0?this._delHistoryInvite(t):n.push(e)}else this._delHistoryInvite(t)}},{key:"_sortSignaling",value:function(e){var t=[];return e.forEach(function(n){t=[].concat(G(t),G(n.messageList))}),t.sort(function(n,o){return n.time-o.time})}},{key:"reset",value:function(){this._map.clear(),this._relatedToMeMap.clear()}}]),ec=b(function e(t,n){U(this,e),this.businessID=t.businessID||1,this.inviteID=t.inviteID,this.groupID=t.groupID||"",this.inviter=t.inviter||"",this.inviteeList=t.inviteeList||[],this.data=t.data||"",this.actionType=t.actionType||ge.ACTION_TYPE_INVITE,this.timeout=t.timeout||0}),tc=["message"],nc=["message"],oc=(de(uo,ce),b(uo,[{key:"onC2CUnreadHandleCompleted",value:function(){this._isC2CUnreadHandleCompleted=!0,this._isCloudConfigCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onConvSyncCompleted",value:function(){this._isConvSyncCompleted=!0,this._isC2CUnreadHandleCompleted&&this._isCloudConfigCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"onCloudConfig",value:function(){this._isCloudConfigCompleted=!0;var e=this.getCloudConfig("history_s_count"),t=this.getCloudConfig("history_s_time");T(e)||(e=Number(e)),T(t)||(t=Number(t)),this._historySignalingHandler.setCloudConfig(e,t),this._isC2CUnreadHandleCompleted&&this._isConvSyncCompleted&&!this._isSyncCompleted&&this.onReady()}},{key:"_isListenerExisted",value:function(){return-1<this._m.getOEmitInst().eventNames().indexOf(ge.NEW_INVITATION_RECEIVED)}},{key:"onReady",value:function(){this._isSyncCompleted=!0;var e=this._isListenerExisted();d.l("".concat(this._n,".onReady. isListenerExisted: ").concat(e)),e&&this._historySignalingHandler.getHistorySignaling()}},{key:"onNewMessageList",value:function(e){if(e=this.filterMessageList(e),0<e.length)return this._remoteSignalingHandler.onNewMessageList(e)}},{key:"onMessageModified",value:function(e){if(e=this.filterMessageList(e),0<e.length)return this._remoteSignalingHandler.onMessageModified(e)}},{key:"hasInviteInfo",value:function(e){return this._inviteInfoMap.has(e)}},{key:"getInviteInfo",value:function(e){return this._inviteInfoMap.get(e)}},{key:"setInviteInfo",value:function(e,o){var n=o.message,o=Fe(o,tc);d.l("".concat(this._n,".setInviteInfo inviteID:").concat(e," data:"),o),this._inviteInfoMap.set(e,p(p({},o),{},{message:n}))}},{key:"deleteInviteInfo",value:function(e){this.hasInviteInfo(e)&&(d.l("".concat(this._n,".deleteInviteInfo inviteID:").concat(e,".")),this._inviteInfoMap.delete(e))}},{key:"updateInviteInfo",value:function(a){var t="".concat(this._n,".updateInviteInfo"),n=a.inviteID,o=a.inviter,s=a.inviteeList,a=a.groupID;d.l("".concat(t," inviteID:").concat(n," inviter:").concat(o," groupID:").concat(a)),a&&this.hasInviteInfo(n)&&(o=s[0],(a=this.getInviteInfo(n).inviteeList).includes(o)&&(a.splice(a.indexOf(o),1),d.l("".concat(t," remove ").concat(o,". localInviteeList.length:").concat(a.length))),a.length!==0)||this.deleteInviteInfo(n)}},{key:"canIUseSignaling",value:function(){return this._canIUseSignaling}},{key:"emitEvent",value:function(e,t){this.emitOEvt(e,t)}},{key:"addSignalingListener",value:function(e,t,n){this._canIUseSignaling||(this._canIUseSignaling=!0),this._m.getOEmitInst().on(e,t,n)}},{key:"removeSignalingListener",value:function(e,t,n){this._m.getOEmitInst().off(e,t,n),this._isListenerExisted()||(this._canIUseSignaling=!1)}},{key:"invite",value:function(e){var t=this,n="".concat(this._n,".").concat("invite"),o=this._localSignalingHandler.createInviteInfo(e),s=o.message,a=o.customData,i=o.inviteID;return d.l("".concat(n," options:").concat(JSON.stringify(e)," inviteID:").concat(i)),this.sendSignaling(s,e).then(function(r){return r&&r.code===0?(t.setInviteInfo(i,p(p({},a),{},{message:s})),t.startTimer(p(p({},a),{},{inviteID:i})),p(p({},r),{},{inviteID:i})):r}).catch(function(r){return v(r)})}},{key:"inviteSync",value:function(e,t,n){var o=this,s="".concat(this._n,".").concat("inviteSync"),a=this._localSignalingHandler.createInviteInfo(e),i=a.message,r=a.customData,c=a.inviteID;return d.l("".concat(s," options:").concat(JSON.stringify(e)," inviteID:").concat(c)),this.sendSignaling(i,e).then(function(u){if(u&&u.code===0)return o.setInviteInfo(c,p(p({},r),{},{message:i})),o.startTimer(p(p({},r),{},{inviteID:c})),t&&t({inviteID:c}),{inviteID:c};n&&n(u.code===0,u.message||"")}).catch(function(u){return n&&n(u.code,u.message),v(u)}),c}},{key:"_handleImResponse",value:function(e,t,n){t&&t.code===0&&(this._isHandling=!1,n?this.deleteInviteInfo(e.inviteID):this.updateInviteInfo(e))}},{key:"cancel",value:function(e){var t=this,n="".concat(this._n,".").concat("cancel");if(d.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return v({code:y.INVALID_CANCEL_MESSAGE});this._isHandling=!0;var o,s=this._localSignalingHandler.createCancelCustomData(e);return s?(n=s.groupID,o=s.inviteeList,n=n||o[0],o=this.createSignaling(s,n),this.sendSignaling(o,e).then(function(a){return t._handleImResponse(s,a,!0),a.code===0?p(p({},a),{},{inviteID:e.inviteID}):a}).catch(function(a){return v(a)})):(this._isHandling=!1,v({code:y.SIGNALING_NO_PERMISSION}))}},{key:"accept",value:function(e){var t=this,n="".concat(this._n,".").concat("accept");if(d.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return v({code:y.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var o=this._localSignalingHandler.createAcceptCustomData(e);return o?(n=this.createSignaling(o),this.sendSignaling(n,e).then(function(s){return t._handleImResponse(o,s),s.code===0?p(p({},s),{},{inviteID:e.inviteID}):s}).catch(function(s){return v(s)})):(this._isHandling=!1,v({code:y.SIGNALING_NO_PERMISSION}))}},{key:"reject",value:function(e){var t=this,n="".concat(this._n,".").concat("reject");if(d.l("".concat(n," options:").concat(JSON.stringify(e))),!this.hasInviteInfo(e.inviteID)||this._isHandling)return v({code:y.SIGNALING_INVALID_INVITE_ID});this._isHandling=!0;var o=this._localSignalingHandler.createRejectCustomData(e);return o?(n=this.createSignaling(o),this.sendSignaling(n,e).then(function(s){return t._handleImResponse(o,s,!0),s.code===0?p(p({},s),{},{inviteID:e.inviteID}):s}).catch(function(s){return v(s)})):(this._isHandling=!1,v({code:y.SIGNALING_NO_PERMISSION}))}},{key:"getSignalingInfo",value:function(r){var t="".concat(this._n,".getSignalingInfo"),n=r.ID,o=r.from,s=r.to,a=this._filterSignaling(r),i=null,r=(a&&(r=this.getPayloadData(r),i=new ec(r)),a?"actionType:".concat(i.actionType):"");return d.l("".concat(t," messageID:").concat(n," from:").concat(o," to:").concat(s," ")+"".concat(r," isSignaling:").concat(a)),i}},{key:"modifyInvitation",value:function(r){var t,n,o,s,a=this,i=r.inviteID,r=r.data;return this.hasInviteInfo(i)?(t=this.getInviteInfo(i),n=t.message,o=Fe(t,nc),s=n.payload.data,o.data=r,n.payload.data=JSON.stringify(o),this.get(2).modifyRemoteMessage(n).then(function(c){return a.hasInviteInfo(i)&&a.setInviteInfo(i,p(p({},o),{},{message:n})),c}).catch(function(c){return n.payload.data=s,v(c)})):v({code:y.SIGNALING_INVALID_INVITE_ID})}},{key:"_genMsgCtrlInfo",value:function(){var o=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},e=o.data,e=e===void 0?"":e,t=o.onlineUserOnly,a=o.inviteID,a=a===void 0?"":a,n=o.offlinePushInfo,o=o.actionType,s={_onlineOnlyFlag:!1},a={onlineUserOnly:(s=a&&this.getInviteInfo(a)?this.getInviteInfo(a).message:s)._onlineOnlyFlag||t||!1,offlinePushInfo:n,messageControlInfo:{excludedFromContentModeration:!0,excludedFromUnreadCount:!1,excludedFromLastMessage:!1}};return o===ge.ACTION_TYPE_INVITE_TIMEOUT?(s=!!e.match(/excludeTimeoutSignalingFromHistoryMessage/),a.messageControlInfo.excludedFromUnreadCount=s,a.messageControlInfo.excludedFromLastMessage=s):(t=!!e.match(/excludeFromHistoryMessage/),n=!!e.match(/excludeOriginalSignalingFromHistoryMessage/),a.messageControlInfo.excludedFromUnreadCount=t||n,a.messageControlInfo.excludedFromLastMessage=t||n),a}},{key:"sendSignaling",value:function(e,t){var n=this;return this.get(2).sendMessageInstance(e,this._genMsgCtrlInfo(t)).catch(function(o){return n._isHandling=!1,v(o)})}},{key:"filterMessageList",value:function(e){var t=this;return e.filter(function(n){return t._filterSignaling(n)})}},{key:"getPayloadData",value:function(e){return this._remoteSignalingHandler.getPayloadData(e)}},{key:"createSignaling",value:function(e,o){var n=e.groupID,s=e.inviter,o={to:o||n||s,conversationType:n?g.CONV_GROUP:g.CONV_C2C,priority:g.MSG_PRIORITY_HIGH,payload:{data:JSON.stringify(e)}},s=this.get(2).createCustomMessage(o);return d.l("".concat(this._n,".createSignaling. message:"),s),s}},{key:"_filterSignaling",value:function(e){var t,n,o=!1;return e.type&&e.type===g.MSG_CUSTOM&&(t=e.cloudCustomData,e=(e=e.payload.data)===void 0?"":e,t=(t===void 0?"":t).match(/"type":"tsignaling"/),n=e.match(/inviteID/),e=e.match(/actionType/),o=t||n&&e),!!o}},{key:"startTimer",value:function(e){var t,n,o,s=this,a="".concat(this._n,".startTimer"),i=e.timeout,r=e.inviteID,c=e.inviter,u=e.groupID,l=c===this.getMyUserID();d.l("".concat(a," timeout:").concat(i," isInviter:").concat(l," groupID:").concat(u)),i<=0||(t=l?i+5:i,n=1,o=setInterval(function(){var _=s._hasLocalInviteInfo(e,l);n<t&&_?++n:(_&&s._sendTimeoutNotice(r,l),d.l("".concat(a," end.")),clearInterval(o))},1e3))}},{key:"_hasLocalInviteInfo",value:function(a,t){var n,o,s=a.inviteID,a=a.groupID;return!!this.hasInviteInfo(s)&&(n="".concat(this._n,"._hasLocalInviteInfo"),o=this.getInviteInfo(s).inviteeList,d.l("".concat(n," inviteID:").concat(s," inviteeList:").concat(o," groupID:").concat(a)),!a||(t?0<o.length:0<o.length&&o.includes(this.getMyUserID())))}},{key:"_getReceiver",value:function(e,s){var n=s.groupID,o=s.inviteeList,s=s.inviter;return e?n||o[0]:n||s}},{key:"_sendTimeoutNotice",value:function(e,t){var n=this,o=this.getInviteInfo(e),s=this._getReceiver(t,o),a=(d.l("".concat(this._n,"._sendTimeoutNotice inviteID:").concat(e," to:").concat(s," isInviter:").concat(t)),this._localSignalingHandler.createTimeoutCustomData(p(p({},o),{},{isInviter:t}))),i=this.createSignaling(a,s);return this.sendSignaling(i,a).then(function(r){var c,u,l;r&&r.code===0&&(r=a.data,c=a.groupID,u=a.inviteeList,l=a.inviter,n.emitEvent(ge.INVITATION_TIMEOUT,{data:r,groupID:c,inviteID:e,inviteeList:u,inviter:l,isSelfTimeout:!0,message:i}),t?n.deleteInviteInfo(e):n.updateInviteInfo(a))})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._inviteInfoMap.clear(),this._canIUseSignaling=!1,this._isHandling=!1,this._historySignalingHandler.reset(),this._isC2CUnreadHandleCompleted=!1,this._isConvSyncCompleted=!1,this._isSyncCompleted=!1,this._isCloudConfigCompleted=!1}}])),sc=["followDiffList"],ac=["from"],It={NONE:0,FOLLOWERS:1,FOLLOWING:2,MUTUAL:3},ic=(de(co,ce),b(co,[{key:"_onCloudConfig",value:function(){var e=this.getCloudConfig("follow_req_count");T(e)||(e=Number(e),this.DEFAULT_COUNT=e>this.MAX_COUNT?this.MAX_COUNT:e)}},{key:"onFollowNotify",value:function(n){var t=this,n=n.dataList||[];d.l("".concat(this._n,".onFollowNotify followChangeList:").concat(n.length)),n.forEach(function(a){var s=a.followDiffList,s=s===void 0?[]:s,a=Fe(a,sc),i=a.from,r=Fe(a,ac);s.forEach(function(l){var u=l.isAdd,l=l.followType,l=l===void 0?0:l,_=t._initFollowInfo();u===1?(r.userID=i,_[l].userInfoList.push(r),_[l].isAdd=!0):(_[l].userInfoList.push(i),_[l].isAdd=!1),t._emitEvent(_)})})}},{key:"_initFollowInfo",value:function(){var e={};return Object.values(It).forEach(function(t){t!==It.NONE&&(e[t]={userInfoList:[],isAdd:!1})}),e}},{key:"_emitEvent",value:function(e){var t=this;Object.keys(e).forEach(function(o){var o=Number(o),s=e[o];0<s.userInfoList.length&&(o===It.FOLLOWERS&&t.emitOEvt(F.MY_FOLLOWERS_LIST_UPDATED,s),o===It.FOLLOWING&&t.emitOEvt(F.MY_FOLLOWING_LIST_UPDATED,s),o===It.MUTUAL)&&t.emitOEvt(F.MUTUAL_FOLLOWERS_LIST_UPDATED,s)})}},{key:"followUser",value:function(e){var t,n,o;return this.canIUse(ee.FOLLOW)?(t="".concat(this._n,".").concat("followUser"),n="userIDList:".concat(e.length),(o=new D("followUser")).setMessage(n),d.l("".concat(t," ").concat(n)),this.req({P:h.FOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e.map(function(s){return{userID:s}})}}).then(function(s){return o.end(),d.l("".concat(t," ok.")),N(s.data.resultList)}).catch(function(s){return o.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})):this.noUse("followUser")}},{key:"unfollowUser",value:function(e){var t,n,o;return this.canIUse(ee.FOLLOW)?(t="".concat(this._n,".").concat("unfollowUser"),n="userIDList:".concat(e.length),(o=new D("unfollowUser")).setMessage(n),d.l("".concat(t," ").concat(n)),this.req({P:h.UNFOLLOW,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(function(s){return o.end(),d.l("".concat(t," ok.")),N(s.data.resultList)}).catch(function(s){return o.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})):this.noUse("unfollowUser")}},{key:"getMyFollowersList",value:function(){var e=this,t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",n="getMyFollowersList";return this.canIUse(ee.FOLLOW)?this._getFollowList(t,It.FOLLOWERS).then(function(o){var s=o.nextCursor,a=o.resultList,a=a===void 0?[]:a;return d.l("".concat(e._n,".").concat(n," ok, count:").concat(a.length," nextCursor:").concat(s)),N(o)}):this.noUse(n)}},{key:"getMyFollowingList",value:function(){var e=this,t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",n="getMyFollowingList";return this.canIUse(ee.FOLLOW)?this._getFollowList(t,It.FOLLOWING).then(function(o){var s=o.nextCursor,a=o.resultList,a=a===void 0?[]:a;return d.l("".concat(e._n,".").concat(n," ok, count:").concat(a.length," nextCursor:").concat(s)),N(o)}):this.noUse(n)}},{key:"getMutualFollowersList",value:function(){var e=this,t=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"",n="getMutualFollowersList";return this.canIUse(ee.FOLLOW)?this._getFollowList(t,It.MUTUAL).then(function(o){var s=o.nextCursor,a=o.resultList,a=a===void 0?[]:a;return d.l("".concat(e._n,".").concat(n," ok, count:").concat(a.length," nextCursor:").concat(s)),N(o)}):this.noUse(n)}},{key:"_getFollowList",value:function(e,t){var n=this,o=new D("_getFollowList");return o.setMessage("nextCursor:".concat(e," type:").concat(t)),this.req({P:h.GET_FOLLOW,data:{fromAccount:this.getMyUserID(),count:this.DEFAULT_COUNT,nextCursor:e,type:t}}).then(function(i){o.end();var i=i.data,a=i.resultList,a=a===void 0?[]:a,i=i.nextCursor,i=i===void 0?"":i,r=[];return a.forEach(function(_){var u=_.userID,l=_.followTime,_=_.profileList;r.push(p({userID:u,followTime:l},n._handleProfileItem(_===void 0?[]:_)))}),{resultList:r,nextCursor:i}}).catch(function(s){return o.setError(s).end(),d.e("".concat(n._n,"._getFollowList failed. error:"),s),v(s)})}},{key:"_handleProfileItem",value:function(e){var t={};return e.forEach(function(n){switch(n.tag){case H.NICK:t.nick=n.value;break;case H.GENDER:t.gender=n.value;break;case H.BIRTHDAY:t.birthday=n.value;break;case H.LOCATION:t.location=n.value;break;case H.SELFSIGNATURE:t.selfSignature=n.value;break;case H.ALLOWTYPE:t.allowType=n.value;break;case H.LANGUAGE:t.language=n.value;break;case H.AVATAR:t.avatar=n.value;break;case H.MESSAGESETTINGS:t.messageSettings=n.value;break;case H.ADMINFORBIDTYPE:t.adminForbidType=n.value;break;case H.LEVEL:t.level=n.value;break;case H.ROLE:t.role=n.value;break;default:t[n.tag]=n.value}}),t}},{key:"getUserFollowInfo",value:function(e){var t,n,o;return this.canIUse(ee.FOLLOW)?(n=!1,T(e=e)&&(e=[this.getMyUserID()],n=!0),t="".concat(this._n,".").concat("getUserFollowInfo"),n="userIDList:".concat(e.length," isGetMyFollowInfo:").concat(n),(o=new D("getUserFollowInfo")).setMessage(n),d.l("".concat(t," ").concat(n)),this.req({P:h.GET_FOLLOW_INFO,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(function(a){o.end(),d.l("".concat(t," ok."));var a=a.data.followInfoList,i=[];return(a===void 0?[]:a).forEach(function(l){var c=l.followersCount,u=l.followingCount,l=l.mutualFollowersCount;i.push({followersCount:c,followingCount:u,mutualFollowersCount:l})}),N(i)}).catch(function(s){return o.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})):this.noUse("getUserFollowInfo")}},{key:"checkFollowType",value:function(e){if(!this.canIUse(ee.FOLLOW))return this.noUse("checkFollowType");100<e.length&&(e=e.slice(0,100),d.w("".concat(t," ").concat(St(100))));var t="".concat(this._n,".").concat("checkFollowType"),n="userIDList length:".concat(e.length," "),o=new D("checkFollowType");return o.setMessage(n),d.l("".concat(t," ").concat(n)),this.req({P:h.CHECK_FOLLOW_TYPE,data:{fromAccount:this.getMyUserID(),userIDList:e}}).then(function(a){o.end(),d.l("".concat(t," ok."));var a=a.data.resultList,i=[];return(a===void 0?[]:a).forEach(function(u){var c=u.userID,u=u.followType;i.push({userID:c,followType:u})}),N(i)}).catch(function(s){return o.setError(s).end(),d.e("".concat(t," failed. error:"),s),v(s)})}},{key:"reset",value:function(){d.l("".concat(this._n,".reset"))}}])),re=ka(function(e,t){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";t.assign=function(a){for(var i,r,c=Array.prototype.slice.call(arguments,1);c.length;){var u=c.shift();if(u){if(ut(u)!=="object")throw new TypeError(u+"must be non-object");for(var l in u)i=u,r=l,Object.prototype.hasOwnProperty.call(i,r)&&(a[l]=u[l])}}return a},t.shrinkBuf=function(a,i){return a.length===i?a:a.subarray?a.subarray(0,i):(a.length=i,a)};var o={arraySet:function(a,i,r,c,u){if(i.subarray&&a.subarray)a.set(i.subarray(r,r+c),u);else for(var l=0;l<c;l++)a[u+l]=i[r+l]},flattenChunks:function(a){for(var i,r,c,u=0,l=0,_=a.length;l<_;l++)u+=a[l].length;for(c=new Uint8Array(u),l=i=0,_=a.length;l<_;l++)r=a[l],c.set(r,i),i+=r.length;return c}},s={arraySet:function(a,i,r,c,u){for(var l=0;l<c;l++)a[u+l]=i[r+l]},flattenChunks:function(a){return[].concat.apply([],a)}};t.setTyped=function(a){a?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,o)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,s))},t.setTyped(n)});function co(e){return U(this,co),(e=le(this,co,[e]))._n="FollowModule",e.DEFAULT_COUNT=500,e.MAX_COUNT=1e3,e.getIEmitInst().on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function uo(e){U(this,uo),(e=le(this,uo,[e]))._n="SignalingModule",e._inviteInfoMap=new Map,e._canIUseSignaling=!1,e._isHandling=!1,e._remoteSignalingHandler=new Zr(e),e._localSignalingHandler=new Qr(e),e._historySignalingHandler=new $r(e),e._isC2CUnreadHandleCompleted=!1,e._isConvSyncCompleted=!1,e._isSyncCompleted=!1,e._isCloudConfigCompleted=!1;var t=e.getIEmitInst();return t.on(ne.C2C_UNREAD_HANDLE_COMPLETED,e.onC2CUnreadHandleCompleted,e),t.on(ne.CONV_SYNC_COMPLETED,e.onConvSyncCompleted,e),t.on(ne.CLOUD_CONFIG,e.onCloudConfig,e),e}function lo(e){return U(this,lo),(e=le(this,lo,[e]))._n="ProfanityFilterModule",e._plugin=null,e._filterConfigMap=new Map,e._startIndex=0,e._version=0,e._canIUseLexicon=!1,e._isFetching=!1,e._expiredTime=0,e}function po(e){var t;return U(this,po),(t=le(this,po,[e]))._m=e,t._n="TIMPushModule",t._pluginName="TIMPush",t._pushPlugin=void 0,t._androidPushConfig={},t._deviceToken="",t._businessID=0,t._iOSBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t._deviceInfo={notificationStatus:0,deviceModel:"",systemVersion:"",pushVersion:"1.0.1",packageName:""},t}function _o(e){var t;return U(this,_o),(t=le(this,_o,[e]))._m=e,t._n="OfflinePushModule",t._offlinePushPlugin=void 0,t._androidPushConfig={huaweiPushBussinessId:"",xiaomiPushBussinessId:"",xiaomiPushAppId:"",xiaomiPushAppKey:"",meizuPushBussinessId:"",meizuPushAppId:"",meizuPushAppKey:"",vivoPushBussinessId:"",fcmPushBussinessId:"",oppoPushBussinessId:"",oppoPushAppKey:"",oppoPushAppSecret:"",honorPushBussinessId:""},t._deviceToken="",t._businessID=0,t._iosBusinessID=0,t._c2cUnreadCount=0,t._groupUnreadCount=0,t._isWebUniapp=0,t}function go(e){return U(this,go),(e=le(this,go,[e]))._n="WorkerTimerModule",e._isWorkerEnabled=!0,e._workerTimer=null,e._timerID=-1,e._init(),e.getIEmitInst().on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function ho(e){return U(this,ho),(e=le(this,ho,[e]))._n="SnsModule",e._friendHandler=new xr(e),e._friendApplicationHandler=new qr(e),e._friendGroupHandler=new Vr(e),e.getIEmitInst().on(ne.A2KEY_AND_TINYID_UPDATED,e.onContextUpdated,e),e}function fo(e){U(this,fo),(e=le(this,fo,[e]))._n="QualityStatModule",e.TAG="im-ssolog-quality-stat",e.reportIndex=0,e.wholePeriod=!1,e._qualityItems=[Ho,Ko,Bt,Ht,Kt,At,Ye,Yt,un,ln],e._messageSentItems=[Bt,Ht,Kt,At,Ye],e._messageReceivedItems=[Yt,un,ln],e.REPORT_INTERVAL=120,e.REPORT_SDKAPPID_BLACKLIST=[],e.REPORT_TINYID_WHITELIST=[],e._statInfoArr=[],e._avgRTT=new Ur,e._avgE2EDelay=new Gr,e._rateMessageSent=new br,e._rateMessageReceived=new wr;var t=e.getIEmitInst();return t.on(ne.A2KEY_AND_TINYID_UPDATED,e._onLoginSuccess,e),t.on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}function mo(e){return U(this,mo),(e=le(this,mo,[e]))._n="RecoverMsgModule",e.PULL_LIMIT_COUNT=15,e}function vo(e){return U(this,vo),(e=le(this,vo,[e]))._n="CloudControlModule",e._cloudConfig=new Map,e._expiredTime=0,e._version=0,e._isFetching=!1,e}function Io(e){return U(this,Io),(e=le(this,Io,[e]))._n="SessionModule",e._platform=e.getPlatform(),e._pHandler=new Er(e),e._msgDispatcher=new Sr(e),e._cmdFreqLimitMap=new Map,e._cmdReqInfoMap=new Map,e._serverOverloadInfoMap=new Map,e._incrementalPullContactFlag=!0,e._init(),e.getIEmitInst().on(ne.CLOUD_CONFIG,e._onCloudConfig,e),e}re.assign,re.shrinkBuf,re.setTyped,re.Buf8,re.Buf16,re.Buf32;function rs(e,t,n,o){for(var s=65535&e|0,a=e>>>16&65535|0,i=0;n!==0;){for(n-=i=2e3<n?2e3:n;a=a+(s=s+t[o++]|0)|0,--i;);s%=65521,a%=65521}return s|a<<16|0}function rt(e,t,n,o){var s=rc,a=o+n;e^=-1;for(var i=o;i<a;i++)e=e>>>8^s[255&(e^t[i])];return-1^e}function pn(e,t,n,o,s,a,i,r){for(var c,u,l,_,m,f,I,C,M,S=r.bits,z=0,L=0,P=0,w=0,B=0,x=0,j=0,se=0,ae=0,$=0,fe=null,gt=0,Te=new re.Buf16(16),ue=new re.Buf16(16),Ie=null,J=0,z=0;z<=15;z++)Te[z]=0;for(L=0;L<o;L++)Te[t[n+L]]++;for(B=S,w=15;1<=w&&Te[w]===0;w--);if(w<B&&(B=w),w===0)s[a++]=20971520,s[a++]=20971520,r.bits=1;else{for(P=1;P<w&&Te[P]===0;P++);for(B<P&&(B=P),z=se=1;z<=15;z++)if((se=(se<<1)-Te[z])<0)return-1;if(0<se&&(e===0||w!==1))return-1;for(ue[1]=0,z=1;z<15;z++)ue[z+1]=ue[z]+Te[z];for(L=0;L<o;L++)t[n+L]!==0&&(i[ue[t[n+L]]++]=L);if(f=e===0?(fe=Ie=i,19):e===1?(fe=cc,gt-=257,Ie=uc,J-=257,256):(fe=lc,Ie=dc,-1),z=P,m=a,j=L=$=0,l=-1,_=(ae=1<<(x=B))-1,e===1&&852<ae||e===2&&592<ae)return 1;for(;;){for(M=i[L]<f?(C=0,i[L]):i[L]>f?(C=Ie[J+i[L]],fe[gt+i[L]]):(C=96,0),c=1<<(I=z-j),P=u=1<<x;s[m+($>>j)+(u-=c)]=I<<24|C<<16|M|0,u!==0;);for(c=1<<z-1;$&c;)c>>=1;if(c!==0?$=($&c-1)+c:$=0,L++,--Te[z]==0){if(z===w)break;z=t[n+i[L]]}if(B<z&&($&_)!==l){for(m+=P,se=1<<(x=z-(j=j===0?B:j));x+j<w&&!((se-=Te[x+j])<=0);)x++,se<<=1;if(ae+=1<<x,e===1&&852<ae||e===2&&592<ae)return 1;s[l=$&_]=B<<24|x<<16|m-a|0}}$!==0&&(s[m+$]=z-j<<24|64<<16|0),r.bits=B}return 0}var rc=(function(){for(var e=[],t=0;t<256;t++){for(var n=t,o=0;o<8;o++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n}return e})(),cc=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],uc=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],lc=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],dc=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];function Ua(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function pc(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new re.Buf16(320),this.work=new re.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ba(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new re.Buf32(852),t.distcode=t.distdyn=new re.Buf32(592),t.sane=1,t.back=-1,0):-2}function wa(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ba(e)):-2}function Fa(e,t){var n,o;return!e||!e.state||(o=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t))?-2:(o.window!==null&&o.wbits!==t&&(o.window=null),o.wrap=n,o.wbits=t,wa(e))}function qa(e,t){var n;return e?(n=new pc,(e.state=n).window=null,(n=Fa(e,t))!==0&&(e.state=null),n):-2}var cs,us,xa=!0;function Va(a,t,n,o){var s,a=a.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new re.Buf8(a.wsize)),o>=a.wsize?(re.arraySet(a.window,t,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((s=a.wsize-a.wnext)>o&&(s=o),re.arraySet(a.window,t,n-o,s,a.wnext),(o-=s)?(re.arraySet(a.window,t,n-o,o,0),a.wnext=o,a.whave=a.wsize):(a.wnext+=s,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=s))),0}var zt={inflateReset:wa,inflateReset2:Fa,inflateResetKeep:ba,inflateInit:function(e){return qa(e,15)},inflateInit2:qa,inflate:function(e,t){var n,o,s,a,i,r,c,u,l,_,m,f,I,C,M,S,L,P,w,B,x,j,se,ae,$=0,fe=new re.Buf8(4),gt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return-2;(n=e.state).mode===12&&(n.mode=13),i=e.next_out,s=e.output,c=e.avail_out,a=e.next_in,o=e.input,r=e.avail_in,u=n.hold,l=n.bits,_=r,m=c,j=0;e:for(;;)switch(n.mode){case 1:if(n.wrap===0)n.mode=13;else{for(;l<16;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(2&n.wrap&&u===35615)fe[n.check=0]=255&u,fe[1]=u>>>8&255,n.check=rt(n.check,fe,2,0),l=u=0,n.mode=2;else if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&u)<<8)+(u>>8))%31)e.msg="incorrect header check",n.mode=30;else if((15&u)!=8)e.msg="unknown compression method",n.mode=30;else{if(l-=4,x=8+(15&(u>>>=4)),n.wbits===0)n.wbits=x;else if(x>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<x,e.adler=n.check=1,n.mode=512&u?10:12,l=u=0}}break;case 2:for(;l<16;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(n.flags=u,(255&n.flags)!=8){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=u>>8&1),512&n.flags&&(fe[0]=255&u,fe[1]=u>>>8&255,n.check=rt(n.check,fe,2,0)),l=u=0,n.mode=3;case 3:for(;l<32;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.head&&(n.head.time=u),512&n.flags&&(fe[0]=255&u,fe[1]=u>>>8&255,fe[2]=u>>>16&255,fe[3]=u>>>24&255,n.check=rt(n.check,fe,4,0)),l=u=0,n.mode=4;case 4:for(;l<16;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.head&&(n.head.xflags=255&u,n.head.os=u>>8),512&n.flags&&(fe[0]=255&u,fe[1]=u>>>8&255,n.check=rt(n.check,fe,2,0)),l=u=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.length=u,n.head&&(n.head.extra_len=u),512&n.flags&&(fe[0]=255&u,fe[1]=u>>>8&255,n.check=rt(n.check,fe,2,0)),l=u=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((f=(f=n.length)>r?r:f)&&(n.head&&(x=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),re.arraySet(n.head.extra,o,a,f,x)),512&n.flags&&(n.check=rt(n.check,o,f,a)),r-=f,a+=f,n.length-=f),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(r===0)break e;for(f=0;x=o[a+f++],n.head&&x&&n.length<65536&&(n.head.name+=String.fromCharCode(x)),x&&f<r;);if(512&n.flags&&(n.check=rt(n.check,o,f,a)),r-=f,a+=f,x)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(r===0)break e;for(f=0;x=o[a+f++],n.head&&x&&n.length<65536&&(n.head.comment+=String.fromCharCode(x)),x&&f<r;);if(512&n.flags&&(n.check=rt(n.check,o,f,a)),r-=f,a+=f,x)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;l<16;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(u!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}l=u=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;l<32;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}e.adler=n.check=Ua(u),l=u=0,n.mode=11;case 11:if(n.havedict===0)return e.next_out=i,e.avail_out=c,e.next_in=a,e.avail_in=r,n.hold=u,n.bits=l,2;e.adler=n.check=1,n.mode=12;case 12:if(t===5||t===6)break e;case 13:if(n.last)u>>>=7&l,l-=7&l,n.mode=27;else{for(;l<3;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}switch(n.last=1&u,--l,3&(u>>>=1)){case 0:n.mode=14;break;case 1:Te=ue=void 0;var Te,ue=n;if(xa){for(cs=new re.Buf32(512),us=new re.Buf32(32),Te=0;Te<144;)ue.lens[Te++]=8;for(;Te<256;)ue.lens[Te++]=9;for(;Te<280;)ue.lens[Te++]=7;for(;Te<288;)ue.lens[Te++]=8;for(pn(1,ue.lens,0,288,cs,0,ue.work,{bits:9}),Te=0;Te<32;)ue.lens[Te++]=5;pn(2,ue.lens,0,32,us,0,ue.work,{bits:5}),xa=!1}if(ue.lencode=cs,ue.lenbits=9,ue.distcode=us,ue.distbits=5,n.mode=20,t!==6)break;u>>>=2,l-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}u>>>=2,l-=2}break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&u,l=u=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(f=n.length){if((f=c<(f=r<f?r:f)?c:f)===0)break e;re.arraySet(s,o,a,f,i),r-=f,a+=f,c-=f,i+=f,n.length-=f}else n.mode=12;break;case 17:for(;l<14;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(n.nlen=257+(31&u),u>>>=5,l-=5,n.ndist=1+(31&u),u>>>=5,l-=5,n.ncode=4+(15&u),u>>>=4,l-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;l<3;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.lens[gt[n.have++]]=7&u,u>>>=3,l-=3}for(;n.have<19;)n.lens[gt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,se={bits:n.lenbits},j=pn(0,n.lens,0,19,n.lencode,0,n.work,se),n.lenbits=se.bits,j){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;S=($=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,L=65535&$,!((M=$>>>24)<=l);){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(L<16)u>>>=M,l-=M,n.lens[n.have++]=L;else{if(L===16){for(ae=M+2;l<ae;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(u>>>=M,l-=M,n.have===0){e.msg="invalid bit length repeat",n.mode=30;break}x=n.lens[n.have-1],f=3+(3&u),u>>>=2,l-=2}else if(L===17){for(ae=M+3;l<ae;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}x=0,f=3+(7&(u>>>=M)),u>>>=3,l=l-M-3}else{for(ae=M+7;l<ae;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}x=0,f=11+(127&(u>>>=M)),u>>>=7,l=l-M-7}if(n.have+f>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;f--;)n.lens[n.have++]=x}}if(n.mode===30)break;if(n.lens[256]===0){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,se={bits:n.lenbits},j=pn(1,n.lens,0,n.nlen,n.lencode,0,n.work,se),n.lenbits=se.bits,j){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,se={bits:n.distbits},j=pn(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,se),n.distbits=se.bits,j){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=r&&258<=c){e.next_out=i,e.avail_out=c,e.next_in=a,e.avail_in=r,n.hold=u,n.bits=l,Ee=Ct=ct=De=ht=z=J=Ie=za=Ja=fs=hs=me=Pe=Xt=Tt=ja=gs=Wa=fn=Ya=pe=hn=We=Ne=void 0;var Ie,J,z,ht,De,ct,Ve=e,Sc=m,Ne=Ve.state,We=Ve.next_in,Ct=Ve.input,hn=We+(Ve.avail_in-5),pe=Ve.next_out,Ee=Ve.output,Ya=pe-(Sc-Ve.avail_out),fn=pe+(Ve.avail_out-257),Wa=Ne.dmax,gs=Ne.wsize,ja=Ne.whave,Tt=Ne.wnext,Xt=Ne.window,Pe=Ne.hold,me=Ne.bits,hs=Ne.lencode,fs=Ne.distcode,Ja=(1<<Ne.lenbits)-1,za=(1<<Ne.distbits)-1;t:do for(me<15&&(Pe+=Ct[We++]<<me,me+=8,Pe+=Ct[We++]<<me,me+=8),Ie=hs[Pe&Ja];;){if(Pe>>>=J=Ie>>>24,me-=J,(J=Ie>>>16&255)==0)Ee[pe++]=65535&Ie;else{if(!(16&J)){if((64&J)==0){Ie=hs[(65535&Ie)+(Pe&(1<<J)-1)];continue}if(32&J){Ne.mode=12;break t}Ve.msg="invalid literal/length code",Ne.mode=30;break t}for(z=65535&Ie,(J&=15)&&(me<J&&(Pe+=Ct[We++]<<me,me+=8),z+=Pe&(1<<J)-1,Pe>>>=J,me-=J),me<15&&(Pe+=Ct[We++]<<me,me+=8,Pe+=Ct[We++]<<me,me+=8),Ie=fs[Pe&za];;){if(Pe>>>=J=Ie>>>24,me-=J,!(16&(J=Ie>>>16&255))){if((64&J)==0){Ie=fs[(65535&Ie)+(Pe&(1<<J)-1)];continue}Ve.msg="invalid distance code",Ne.mode=30;break t}if(ht=65535&Ie,me<(J&=15)&&(Pe+=Ct[We++]<<me,(me+=8)<J)&&(Pe+=Ct[We++]<<me,me+=8),(ht+=Pe&(1<<J)-1)>Wa){Ve.msg="invalid distance too far back",Ne.mode=30;break t}if(Pe>>>=J,me-=J,ht>(J=pe-Ya)){if((J=ht-J)>ja&&Ne.sane){Ve.msg="invalid distance too far back",Ne.mode=30;break t}if(ct=Xt,(De=0)===Tt){if(De+=gs-J,J<z){for(z-=J;Ee[pe++]=Xt[De++],--J;);De=pe-ht,ct=Ee}}else if(Tt<J){if(De+=gs+Tt-J,(J-=Tt)<z){for(z-=J;Ee[pe++]=Xt[De++],--J;);if(De=0,Tt<z){for(z-=J=Tt;Ee[pe++]=Xt[De++],--J;);De=pe-ht,ct=Ee}}}else if(De+=Tt-J,J<z){for(z-=J;Ee[pe++]=Xt[De++],--J;);De=pe-ht,ct=Ee}for(;2<z;)Ee[pe++]=ct[De++],Ee[pe++]=ct[De++],Ee[pe++]=ct[De++],z-=3;z&&(Ee[pe++]=ct[De++],1<z)&&(Ee[pe++]=ct[De++])}else{for(De=pe-ht;Ee[pe++]=Ee[De++],Ee[pe++]=Ee[De++],Ee[pe++]=Ee[De++],2<(z-=3););z&&(Ee[pe++]=Ee[De++],1<z)&&(Ee[pe++]=Ee[De++])}break}}break}while(We<hn&&pe<fn);We-=z=me>>3,Pe&=(1<<(me-=z<<3))-1,Ve.next_in=We,Ve.next_out=pe,Ve.avail_in=We<hn?hn-We+5:5-(We-hn),Ve.avail_out=pe<fn?fn-pe+257:257-(pe-fn),Ne.hold=Pe,Ne.bits=me,i=e.next_out,s=e.output,c=e.avail_out,a=e.next_in,o=e.input,r=e.avail_in,u=n.hold,l=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;S=($=n.lencode[u&(1<<n.lenbits)-1])>>>16&255,L=65535&$,!((M=$>>>24)<=l);){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(S&&(240&S)==0){for(P=M,w=S,B=L;S=($=n.lencode[B+((u&(1<<P+w)-1)>>P)])>>>16&255,L=65535&$,!(P+(M=$>>>24)<=l);){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}u>>>=P,l-=P,n.back+=P}if(u>>>=M,l-=M,n.back+=M,n.length=L,S===0){n.mode=26;break}if(32&S){n.back=-1,n.mode=12;break}if(64&S){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&S,n.mode=22;case 22:if(n.extra){for(ae=n.extra;l<ae;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;S=($=n.distcode[u&(1<<n.distbits)-1])>>>16&255,L=65535&$,!((M=$>>>24)<=l);){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if((240&S)==0){for(P=M,w=S,B=L;S=($=n.distcode[B+((u&(1<<P+w)-1)>>P)])>>>16&255,L=65535&$,!(P+(M=$>>>24)<=l);){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}u>>>=P,l-=P,n.back+=P}if(u>>>=M,l-=M,n.back+=M,64&S){e.msg="invalid distance code",n.mode=30;break}n.offset=L,n.extra=15&S,n.mode=24;case 24:if(n.extra){for(ae=n.extra;l<ae;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(c===0)break e;if(n.offset>(f=m-c)){if((f=n.offset-f)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}I=f>n.wnext?(f-=n.wnext,n.wsize-f):n.wnext-f,f>n.length&&(f=n.length),C=n.window}else C=s,I=i-n.offset,f=n.length;for(c-=f=c<f?c:f,n.length-=f;s[i++]=C[I++],--f;);n.length===0&&(n.mode=21);break;case 26:if(c===0)break e;s[i++]=n.length,c--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(r===0)break e;r--,u|=o[a++]<<l,l+=8}if(m-=c,e.total_out+=m,n.total+=m,m&&(e.adler=n.check=(n.flags?rt:rs)(n.check,s,m,i-m)),m=c,(n.flags?u:Ua(u))!==n.check){e.msg="incorrect data check",n.mode=30;break}l=u=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;l<32;){if(r===0)break e;r--,u+=o[a++]<<l,l+=8}if(u!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}l=u=0}n.mode=29;case 29:j=1;break e;case 30:j=-3;break e;case 31:return-4;default:return-2}return e.next_out=i,e.avail_out=c,e.next_in=a,e.avail_in=r,n.hold=u,n.bits=l,(n.wsize||m!==e.avail_out&&n.mode<30&&(n.mode<27||t!==4))&&Va(e,e.output,e.next_out,m-e.avail_out),_-=e.avail_in,m-=e.avail_out,e.total_in+=_,e.total_out+=m,n.total+=m,n.wrap&&m&&(e.adler=n.check=(n.flags?rt:rs)(n.check,s,m,e.next_out-m)),e.data_type=n.bits+(n.last?64:0)+(n.mode===12?128:0)+(n.mode===20||n.mode===15?256:0),j=(_==0&&m===0||t===4)&&j===0?-5:j},inflateEnd:function(e){var t;return e&&e.state?((t=e.state).window&&(t.window=null),e.state=null,0):-2},inflateGetHeader:function(e,t){return!e||!e.state||(2&(e=e.state).wrap)==0?-2:((e.head=t).done=!1,0)},inflateSetDictionary:function(e,t){var n,o=t.length;return!e||!e.state||(n=e.state).wrap!==0&&n.mode!==11?-2:n.mode===11&&rs(1,t,o,0)!==n.check?-3:Va(e,t,o,o)?(n.mode=31,-4):(n.havedict=1,0)},inflateInfo:"pako inflate (from Nodeca project)"},Ba=!0,Ha=!0;try{String.fromCharCode.apply(null,[0])}catch{Ba=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Ha=!1}for(var _n=new re.Buf8(256),Mt=0;Mt<256;Mt++)_n[Mt]=252<=Mt?6:248<=Mt?5:240<=Mt?4:224<=Mt?3:192<=Mt?2:1;_n[254]=_n[254]=1;function _c(e,t){for(var n,o,s=t||e.length,a=new Array(2*s),i=0,r=0;r<s;)if((n=e[r++])<128)a[i++]=n;else if(4<(o=_n[n]))a[i++]=65533,r+=o-1;else{for(n&=o===2?31:o===3?15:7;1<o&&r<s;)n=n<<6|63&e[r++],o--;1<o?a[i++]=65533:n<65536?a[i++]=n:(n-=65536,a[i++]=55296|n>>10&1023,a[i++]=56320|1023&n)}var c=a,u=i;if(u<65534&&(c.subarray&&Ha||!c.subarray&&Ba))return String.fromCharCode.apply(null,re.shrinkBuf(c,u));for(var l="",_=0;_<u;_++)l+=String.fromCharCode(c[_]);return l}function gc(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function hc(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Le={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},ls={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Ka=Object.prototype.toString;function Ot(n){if(!(this instanceof Ot))return new Ot(n);this.options=re.assign({chunkSize:16384,windowBits:0,to:""},n||{});var t=this.options,n=(t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0)&&(t.windowBits=-15),!(0<=t.windowBits&&t.windowBits<16)||n&&n.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&(15&t.windowBits)==0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gc,this.strm.avail_out=0,zt.inflateInit2(this.strm,t.windowBits));if(n!==Le.Z_OK)throw new Error(ls[n]);if(this.header=new hc,zt.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=(function(o){for(var s,a,i,r,c=o.length,u=0,l=0;l<c;l++)(64512&(a=o.charCodeAt(l)))==55296&&l+1<c&&(64512&(i=o.charCodeAt(l+1)))==56320&&(a=65536+(a-55296<<10)+(i-56320),l++),u+=a<128?1:a<2048?2:a<65536?3:4;for(s=new re.Buf8(u),l=r=0;r<u;l++)(64512&(a=o.charCodeAt(l)))==55296&&l+1<c&&(64512&(i=o.charCodeAt(l+1)))==56320&&(a=65536+(a-55296<<10)+(i-56320),l++),a<128?s[r++]=a:(a<2048?s[r++]=192|a>>>6:(a<65536?s[r++]=224|a>>>12:(s[r++]=240|a>>>18,s[r++]=128|a>>>12&63),s[r++]=128|a>>>6&63),s[r++]=128|63&a);return s})(t.dictionary):Ka.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw)&&(n=zt.inflateSetDictionary(this.strm,t.dictionary))!==Le.Z_OK)throw new Error(ls[n])}function ds(e,t){if(t=new Ot(t),t.push(e,!0),t.err)throw t.msg||ls[t.err];return t.result}Ot.prototype.push=function(e,t){var n,o,s,a,i,r=this.strm,c=this.options.chunkSize,u=this.options.dictionary,l=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?Le.Z_FINISH:Le.Z_NO_FLUSH,typeof e=="string"?r.input=(function(_){for(var m=new re.Buf8(_.length),f=0,I=m.length;f<I;f++)m[f]=_.charCodeAt(f);return m})(e):Ka.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new re.Buf8(c),r.next_out=0,r.avail_out=c),(n=(n=zt.inflate(r,Le.Z_NO_FLUSH))===Le.Z_NEED_DICT&&u?zt.inflateSetDictionary(this.strm,u):n)===Le.Z_BUF_ERROR&&l===!0&&(n=Le.Z_OK,l=!1),n!==Le.Z_STREAM_END&&n!==Le.Z_OK)return this.onEnd(n),!(this.ended=!0);!r.next_out||r.avail_out!==0&&n!==Le.Z_STREAM_END&&(r.avail_in!==0||o!==Le.Z_FINISH&&o!==Le.Z_SYNC_FLUSH)||(this.options.to==="string"?(s=(function(_,m){for(var f=(m=(m=m||_.length)>_.length?_.length:m)-1;0<=f&&(192&_[f])==128;)f--;return!(f<0||f===0)&&f+_n[_[f]]>m?f:m})(r.output,r.next_out),a=r.next_out-s,i=_c(r.output,s),r.next_out=a,r.avail_out=c-a,a&&re.arraySet(r.output,r.output,s,a,0),this.onData(i)):this.onData(re.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(l=!0)}while((0<r.avail_in||r.avail_out===0)&&n!==Le.Z_STREAM_END);return(o=n===Le.Z_STREAM_END?Le.Z_FINISH:o)===Le.Z_FINISH?(n=zt.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Le.Z_OK):o!==Le.Z_SYNC_FLUSH||(this.onEnd(Le.Z_OK),!(r.avail_out=0))},Ot.prototype.onData=function(e){this.chunks.push(e)},Ot.prototype.onEnd=function(e){e===Le.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=re.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Nt={},fc=((0,re.assign)(Nt,{Inflate:Ot,inflate:ds,inflateRaw:function(e,t){return(t=t||{}).raw=!0,ds(e,t)},ungzip:ds},Le),Nt),mc=b(function e(t){U(this,e),this._m=t,this._n="InflateModule",this._bLogForInflateOK=!1,this._bLogForInflateError=!1},[{key:"inflate",value:function(o){var t,o=new Uint8Array(o).slice(4),n=Date.now();try{t=fc.inflate(o,{to:"string"}),this._bLogForInflateOK||(this._bLogForInflateOK=!0,new D("inflateOK").end())}catch(a){return this._bLogForInflateError?void 0:(this._bLogForInflateError=!0,void new D("inflateError").setMessage(a).end())}var o=o.length+4,s=t.length;return d.d("inflate ok. zipped:".concat(o," unzipped:").concat(s)+" compression ratio:".concat(Math.round(100*(s-o)/s),"% cost:").concat(Date.now()-n)),t}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._bLogForInflateOK=!1,this._bLogForInflateError=!1}}]),yt="Message",Mo="User",ps="Group",_s="GroupMember",vc=["count"],Ic=["conversationID","timePosition","timePeriod"],Mc=["miniBirthday","maxBirthday"],yc=Ge(Ge(Ge(Ge({},yt,h.CS),Mo,h.USER_CS),ps,h.GRP_CS),_s,h.MBR_CS),Cc=(de(yo,ce),b(yo,[{key:"searchCloudMessages",value:function(e){return this.search(yt,e)}},{key:"searchCloudUsers",value:function(e){return this.search(Mo,e)}},{key:"searchCloudGroups",value:function(e){return this.search(ps,e)}},{key:"searchCloudGroupMembers",value:function(e){return this.search(_s,e)}},{key:"search",value:function(e,t){var n=this,o="searchCloud".concat(e,"s"),s="".concat(this._n,".").concat(o);if(!t)return v({code:y.OPTIONS_IS_EMPTY,message:this.getErrMsg(y.OPTIONS_IS_EMPTY,o)});var a=t.keywordList,i=Oo(a),r=t.count;if(t.count&&(r=parseInt(r)),e===yt&&!i&&!Oo(t.senderUserIDList)&&!Oo(t.messageTypeList)||e!==yt&&!i)throw d.e("[".concat(o,'] Missing required params: "keywordList".')),new Error("Params validate failed.");var c=Date.now(),u=new D(o),l="keywordList:".concat(a," keywordListMatchType:").concat(t.keywordListMatchType," cursor:").concat(t.cursor," count:").concat(r);return d.l("".concat(s," ").concat(l)),this.req({P:yc[e],data:this._genParams(e,t)}).then(function(_){var m=_.data,I=m.code,m=m.message;if(I!==0)return(f=I)===60020?f="SearchUnable":e!==yt&&I===27003?f="SearchParamsError":e!==yt&&I===60018&&(f="SearchOverLimit"),f=n.getErrMsg(f)||m,m=new ie({code:I,message:f}),u.setMessage(l).setError(m).end(),v(m);n.get(27).isCSPluginEnabled();var I=_.data,f=I.cursor,m=f===void 0?"":f,f=I.totalCount,I="totalCount:".concat(f," cost:").concat(ye(c)),I=(d.l("".concat(s," ok. cursor:").concat(m," ").concat(I)),u.setMessage("".concat(l," ").concat(I)).end(),n._genRes(e,t,_.data));return N({searchResultList:I,cursor:m,totalCount:f})}).catch(function(_){return u.setMessage(l).setError(_).end(),v(_)})}},{key:"_genParams",value:function(e,t){var n=t.count,o=Fe(t,vc);return n&&(o.count=parseInt(n)),e===yt?this._genMsgParams(o):(n=t.keywordList,t=t.keywordListMatchType,o.keywords=n,o.keywordMatchType=t==="and"?1:0,e===Mo?this._genUserParams(o):o)}},{key:"_genMsgParams",value:function(s){var t=s.conversationID,n=s.timePosition,o=s.timePeriod,s=Fe(s,Ic);return T(t)||(Oe(t)&&(s.account=t.replace(g.CONV_C2C,"")),xe(t)&&(s.groupID=t.replace(g.CONV_GROUP,""))),Y(o)&&0<o&&(Y(n)&&0<n?s.startTime=n-o:s.startTime=Zt()-o),s.startTime&&s.startTime<0&&(s.startTime=void 0),Y(n)&&0<n&&(s.endTime=n),s}},{key:"_genUserParams",value:function(o){var t=o.miniBirthday,n=o.maxBirthday,o=Fe(o,Mc);return Y(t)&&(o.miniBirthday=parseInt(t),Y(n)||(o.maxBirthday=4294967295)),Y(n)&&(o.maxBirthday=parseInt(n)),o}},{key:"_genRes",value:function(e,t,n){switch(e){case yt:return this._genMsgRes(n.searchResult,!t.conversationID);case Mo:return this._genUserRes(n.userList);case ps:return this._genGrpRes(n.groupList);case _s:return this._genMemberRes(n.groupMemberList);default:return[]}}},{key:"_genMsgRes",value:function(e,t){var n=this.get(11);return O(e)&&e.length!==0?e.map(function(i){var s=i.groupID,r=i.userID,a=i.messageCount,i=i.messageList,i=i===void 0?[]:i,r=s?"".concat(g.CONV_GROUP).concat(s):"".concat(g.CONV_C2C).concat(r),c={conversationID:r,messageCount:a,messageList:[]};return t&&1<a||0<(a=i.filter(function(u){return!!u})).length&&(i=n.onRoamingMessage(a,r,!1),s&&i.reverse(),c.messageList=i,c.messageCount=i.length),c}):[]}},{key:"_genUserRes",value:function(e){var t=this.get(4)._profileHandler;if(!O(e))return[];for(var n=[],o=0,s=e.length;o<s;o++){var i=e[o],a=i.userID,i=i.profileItems;a!=="@TLS#NOT_FOUND"&&a!==""&&(a=t._update(a,t._getLatestProfileFromResponse(a,i)).latestProfile,n.push(a))}return n}},{key:"_genGrpRes",value:function(e){if(!O(e))return[];for(var t=[],n=0,o=e.length;n<o;n++)e[n]&&e[n].groupID&&t.push(new it(e[n]));return t}},{key:"_genMemberRes",value:function(e){if(!O(e))return[];for(var t,n,o,s,a,i,r=new Map,c=0,u=e.length;c<u;c++)e[c]&&e[c].userID&&e[c].groupID&&(n=(t=e[c]).groupID,s=t.name,o=t.type,a=t.avatar,i=t.nick,s={groupID:n,name:s,type:o,avatar:a},a={userID:t.userID,nick:i,nameCard:t.nameCard,avatar:(o=t.memberAvatar)===void 0?"":o},r.has(n)?((i=r.get(n)).memberList.push(a),r.set(n,i)):r.set(n,{groupInfo:s,memberList:[a]}));return G(r.values())}}])),Tc=b(function e(t){var n=this;U(this,e);var o,s=new D("sdkConstruct"),c=(this._n="ModuleManager",this._isReady=!1,this._reason=y.USER_NOT_LOGGED_IN,this._startLoginTs=0,this._map=new Map,this._optionalModuleMap=new Map,this._codeMsgForTUIMap=new Map,this._iEmitter=null,this._oEmitter=null,this._checkCount=0,this._checkTimer=-1,this._map.set(12,new zi(this,t)),this._map.set(37,new mc(this)),this._map.set(15,new tr(this)),this._map.set(27,new Yr(this)),this._map.set(23,new Nr(this)),this._map.set(24,new Hr(this)),this._map.set(26,new Fr(this)),this._map.set(21,new Cr(this)),this._map.set(20,new Or(this)),this._map.set(1,new Zi(this)),this._map.set(2,new ur(this)),this._map.set(3,new lr(this)),this._map.set(34,new dr(this)),this._map.set(31,new pr(this)),this._map.set(4,new Ji(this)),this._map.set(6,new yi(this)),this._map.set(11,new ki(this)),this._map.set(7,new Vi(this)),this._map.set(10,new Ki(this)),this._map.set(13,new Qi(this)),this._map.set(32,new Xr(this)),this._map.set(14,new er(this)),this._map.set(17,new sr(this)),this._map.set(18,new _r(this)),this._map.set(19,new gr(this)),this._map.set(25,new Pr(this)),this._map.set(8,new Br(this)),this._map.set(28,new Wr(this)),this._map.set(36,new jr(this)),this._map.set(29,new Jr(this)),this._map.set(30,new zr(this)),this._map.set(33,new oc(this)),this._map.set(35,new ic(this)),this._map.set(38,new Cc(this)),this._eventThrottleMap=new Map,this._eventThrottling=t.eventThrottling,this._map.get(12).isPartialUpdatedConvs()&&(this._eventThrottling=!1),Q(t.modules)?(Object.keys(t.modules).forEach(function(u){o=t.modules[u],u==="group-module"?n._map.set(7,new o(n)):u==="relationship-module"?n._map.set(8,new o(n)):u==="signaling-module"?n._map.set(33,new o(n)):u==="follow-module"?n._map.set(35,new o(n)):u==="cloud-search-module"&&n._map.set(38,new o(n)),n._optionalModuleMap.set(u,1)}),this._map.get(12).setUsingChatCore(!0)):this._map.has(7)||this._map.get(12).setUsingChatCore(!0),t.instanceID),a=t.SDKAppID,i=this._map.get(12).isIntl(),r=this._map.get(12).isUsingChatCore(),c="instanceID:".concat(c," SDKAppID:").concat(a," isIntl:").concat(i," isUsingChatCore:").concat(r," host:").concat(ea())+" isIOSWebView:".concat(Gs," platform:").concat(Ns," canIUseInflate:").concat(this.canIUseInflate())+" workerAvailable:".concat(Pt," eventThrottling:").concat(this._eventThrottling," UserAgent:").concat(Ue);D.bindEventStatModule(this._map.get(14)),D.bindNetMonitorModule(this._map.get(15)),s.setMessage("".concat(c," ").concat((function(){var u="";if(X)try{var l=te.getSystemInfoSync(),_=l.model,m=l.version,f=l.system,I=l.platform,C=l.SDKVersion,u="model:".concat(_," version:").concat(m," system:").concat(f," platform:").concat(I," SDKVersion:").concat(C)}catch{u=""}return u})())).end(),d.i("SDK ".concat(c)),ie.prototype._getErrMsg=this.getErrMsg.bind(this),this._readyList=void 0,this._ssoLogForReady=null,this._initReadyList()},[{key:"_startTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();d.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)),d.l("".concat(this._n,"._startMainThreadTimer seed:").concat(this._checkTimer))}},{key:"stopTimer",value:function(){var e=this._map.get(24),t=e.isWorkerEnabled();d.l("".concat(this._n,".stopTimer isWorkerEnabled:").concat(t," seed:").concat(this._checkTimer)),t?e.stopWorkerTimer():this._stopMainThreadTimer()}},{key:"_stopMainThreadTimer",value:function(){d.l("".concat(this._n,"._stopMainThreadTimer")),0<this._checkTimer&&(clearInterval(this._checkTimer),this._checkTimer=-1,this._checkCount=0)}},{key:"_stopMainThreadSocket",value:function(){d.l("".concat(this._n,"._stopMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!0),e.reConnect()}},{key:"_startMainThreadSocket",value:function(){d.l("".concat(this._n,"._startMainThreadSocket"));var e=this._map.get(21);e.setIsWorkerEnabled(!1),e.reConnect()}},{key:"onWorkerTimerEnabled",value:function(){d.l("".concat(this._n,".onWorkerTimerEnabled, disable main thread timer and socket")),this._stopMainThreadTimer(),this._stopMainThreadSocket()}},{key:"onWorkerTimerDisabled",value:function(){d.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=Se(this._map);try{for(t.s();!(e=t.n()).done;){var n=ke(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._map.get(1)],this._readyList.forEach(function(t){t.ready(function(){return e._onModuleReady()})})}},{key:"_onModuleReady",value:function(){var e,t,n=!0;this._readyList.forEach(function(o){o.isReady()||(n=!1)}),n&&!this._isReady&&(this._isReady=!0,this._oEmitter.emit(F.SDK_READY),e=Date.now()-this._startLoginTs,d.w("SDK is ready. cost ".concat(e," ms")),this._startLoginTs=Date.now(),t=this._ssoLogForReady.getStartTs()+Qt,this._ssoLogForReady.setMessage(e).start(t).end())}},{key:"login",value:function(){this._startLoginTs===0&&(qs(),this._startLoginTs=Date.now(),this._startTimer(),this._map.get(15).start(),this._ssoLogForReady=new D("sdkReady"),this._reason=y.LOGGING_IN)}},{key:"onLoginFailed",value:function(){this._startLoginTs=0}},{key:"getOEmitInst",value:function(){return this._oEmitter===null&&(this._oEmitter=new Ra,e=this._oEmitter,Rt=e,this._oEmitter._emit=this._oEmitter.emit,this._oEmitter.emit=(function(t,n){var o,s,a=this;this._canIUseSignaling()&&(t===F.MESSAGE_RECEIVED&&this.get(33).onNewMessageList(n),t===F.MESSAGE_MODIFIED)&&this.get(33).onMessageModified(n),t===F.CONVERSATION_LIST_UPDATED||t===F.FRIEND_LIST_UPDATED||t===F.GROUP_LIST_UPDATED||t===F.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?this._eventThrottling!==!1?this._eventThrottleMap.has(t)?(o=Date.now())-(s=this._eventThrottleMap.get(t)).last<=1e3?(-1<s.timeoutID&&clearTimeout(s.timeoutID),s.timeoutID=setTimeout(function(){s.last=Date.now(),a._oEmitter._emit.apply(a._oEmitter,[t,p({name:t},a._getEventData(t))])},1e3)):(s.last=o,this._oEmitter._emit.apply(this._oEmitter,[t,p({name:t},this._getEventData(t))])):(this._eventThrottleMap.set(t,{last:Date.now(),timeoutID:-1}),this._oEmitter._emit.apply(this._oEmitter,[t,p({name:t},this._getEventData(t))])):this._oEmitter._emit.apply(this._oEmitter,[t,p({name:t},this._getEventData(t))]):this._oEmitter._emit.apply(this._oEmitter,[t,{name:t,data:n}])}).bind(this)),this._oEmitter;var e}},{key:"_canIUseSignaling",value:function(){var e=this.get(33);return!!e&&e.canIUseSignaling()}},{key:"_getEventData",value:function(e){var t,n;return e===F.CONVERSATION_LIST_UPDATED?(n={isSyncCompleted:(t=this._map.get(11)).isSyncCompleted()},this._map.get(12).isPartialUpdatedConvs()?n.data=t.getPartialUpdatedConvs():n.data=t.getLocalConvList(),n):e===F.FRIEND_LIST_UPDATED?{data:this._map.get(8).getLocalFriendList(!1)}:e===F.GROUP_LIST_UPDATED?{data:this._map.get(7).getLocalGroupList()}:e===F.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED?{data:this._map.get(11).getTotalUnreadCount()}:e===F.CONVERSATION_ID_LIST_UPDATED?{data:this._map.get(11).getUpdatedConvIDList()}:void 0}},{key:"getIEmitInst",value:function(){return this._iEmitter===null&&(this._iEmitter=new Ra,this._iEmitter._emit=this._iEmitter.emit,this._iEmitter.emit=(function(e,t){e=Q(t)&&t.data?[e,{name:e,data:t.data}]:[e,{name:e,data:t}],this._iEmitter._emit.apply(this._iEmitter,e)}).bind(this)),this._iEmitter}},{key:"hasModule",value:function(e){return this._map.has(e)}},{key:"get",value:function(e){return this._map.get(e)}},{key:"canIUseModule",value:function(e){return!this._map.get(12).isUsingChatCore()||this._optionalModuleMap.has(e)}},{key:"canIUseInflate",value:function(){return!!this._map.get(37)}},{key:"isReady",value:function(){return this._isReady}},{key:"isIntl",value:function(){return this.get(12).isIntl()}},{key:"getNotReadyReason",value:function(){return this._reason}},{key:"setNotReadyReason",value:function(e){this._reason=e}},{key:"getErrMsg",value:function(e,t,n){return this._map.get(32).get({key:e,replacement1:t,replacement2:n,isIntl:this.isIntl()})}},{key:"warn",value:function(e,t,n){e=this.getErrMsg(e,t,n),e&&d.w(e)}},{key:"onError",value:function(e){var t="code:".concat(e.code," message:").concat(e.message);d.w("Oops! ".concat(t)),new D("error").setMessage(t).setLevel("error").end(),this.getOEmitInst().emit(F.ERROR,e)}},{key:"restartTimer",value:function(){d.l("".concat(this._n,".restartTimer")),this.stopTimer(),this._startTimer();var e=this.get(7);e&&e.restartPolling()}},{key:"getTimerID",value:function(){var e=this._map.get(24);return e.isWorkerEnabled()?e.getTimerID():this._checkTimer}},{key:"getPollingTimerID",value:function(e){return this._map.get(7).getPollingTimerID(e)}},{key:"statTUIKeyFeatures",value:function(n){var t=n.code,n=n.msg,n=n===void 0?"":n,o=t+n;this._codeMsgForTUIMap.has(o)||(this._codeMsgForTUIMap.set(o,1),o=this.get(12).getUIPlatform(),new D("tui_key_features").setCode(t).setMessage(n).setUIPlatform(o).end())}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),qs();var e,t=Se(this._map);try{for(t.s();!(e=t.n()).done;){var n=ke(e.value,2)[1];n.reset&&n.reset()}}catch(i){t.e(i)}finally{t.f()}this._startLoginTs=0,this._initReadyList(),this._isReady=!1,this.stopTimer(),this._oEmitter.emit(F.SDK_NOT_READY);var o,s=Se(this._eventThrottleMap);try{for(s.s();!(o=s.n()).done;){var a=ke(o.value,2)[1];-1<a.timeoutID&&clearTimeout(a.timeoutID)}}catch(i){s.e(i)}finally{s.f()}this._eventThrottleMap.clear(),this._codeMsgForTUIMap.clear()}}]),Dc=b(function e(t){U(this,e),this._funcMap=new Map,this._m=t,this._n="SafetyCallback",this._reportCount=0},[{key:"defense",value:function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:void 0;if(typeof e!="string"||e.length===0||typeof t!="function")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){return typeof t!="function"?null:this._pack(e,t,2<arguments.length&&arguments[2]!==void 0?arguments[2]:void 0)}},{key:"find",value:function(e,t){return typeof e!="string"||e.length===0||typeof t!="function"?null:this._funcMap.has(e)&&this._funcMap.get(e).has(t)?this._funcMap.get(e).get(t):(this._m.warn("ListenerFnNotFound",e),null)}},{key:"delete",value:function(e,t){return typeof t=="function"&&!!this._funcMap.has(e)&&!!this._funcMap.get(e).has(t)&&(this._funcMap.get(e).delete(t),this._funcMap.get(e).size===0&&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(i){var s=Object.values(F).indexOf(e),a="CallbackError";s!==-1&&(s=Object.keys(F)[s],o._m.warn(a,s,i)),o._reportCount<5&&(new D(a).setMessage("eventName:".concat(e)).setMoreMessage(i.message).end(),o._reportCount+=1)}}}},{key:"destroy",value:function(){this._funcMap.clear()}},{key:"reset",value:function(){d.l("".concat(this._n,".reset")),this._reportCount=0}}]),Ec=b(function e(t){U(this,e),t={SDKAppID:t.SDKAppID,unlimitedAVChatRoom:t.unlimitedAVChatRoom||!1,scene:t.scene||"",oversea:t.oversea||!1,instanceID:$s(),devMode:t.devMode||!1,testEnv:t.testEnv||!1,proxyServer:t.proxyServer||void 0,fileUploadProxy:t.fileUploadProxy||void 0,fileDownloadProxy:t.fileDownloadProxy||t.fileUploadProxy||void 0,eventThrottling:t.eventThrottling!==!1,partialUpdatedConversations:t.partialUpdatedConversations===!0,disableIndependentDomain:t.disableIndependentDomain===!0,modules:t.modules||void 0},this._m=new Tc(t),this._safetyCallbackFactory=new Dc(this._m)},[{key:"onError",value:function(e){this._m.onError(e)}},{key:"login",value:function(e){return this._m.login(),this._get(1).login(e)}},{key:"logout",value:function(){var e=this;return this._get(1).logout().then(function(t){return e._safetyCallbackFactory.reset(),e._m.reset(),t})}},{key:"getLoginUser",value:function(){return this._get(1).getLoginUser()}},{key:"getServerTime",value:function(){return Qe()}},{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:"getErrMsg",value:function(e,t,n){return this._m.getErrMsg(e,t,n)}},{key:"_get",value:function(e){return this._m.get(e)}},{key:"destroy",value:function(){var e=this,t=this._get(12),n=t.getSDKAppID();return d.w("destroy ".concat(n," ").concat(t.getInstanceID())),this.logout().finally(function(){e._safetyCallbackFactory.destroy(),e._m.stopTimer(),e._get(24).terminate(),e._get(21).dealloc(),e._m.getOEmitInst().emit(F.SDK_DESTROY,{SDKAppID:n})})}},{key:"on",value:function(e,t,n){d.d("on","eventName:".concat(e)),this._m.getOEmitInst().on(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"once",value:function(e,t,n){d.d("once","eventName:".concat(e)),this._m.getOEmitInst().once(e,this._safetyCallbackFactory.defenseOnce(e,t,n),n||this)}},{key:"off",value:function(e,t,n,o){d.d("off","eventName:".concat(e));var s=this._safetyCallbackFactory.find(e,t);s!==null&&(this._m.getOEmitInst().off(e,s,n,o),this._safetyCallbackFactory.delete(e,t))}},{key:"registerPlugin",value:function(e){(T(e["tim-push"])?T(e["tim-offline-push-plugin"])?this._get(18):this._get(28):this._get(36)).registerPlugin(e)}},{key:"setLogLevel",value:function(e){var t;e<=0&&((t=this.getErrMsg("TIM_ASCII_ART"))&&console.log(t),(t=this.getErrMsg("API_REFER"))&&(Fo()?console.log("%c ".concat("IM SDK API ->"," %c"),"background:#ff9d00; padding:1px; border-radius:3px; color: #fff","background:transparent",t):console.log("IM SDK API ->",t)),(t=this.getErrMsg("DOCS_GUIDE"))&&console.log(t),t=this.getErrMsg("IOS_WEBVIEW_WARNING"),Gs)&&t&&console.warn(t),d.setLevel(e)}},{key:"createTextMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createTextAtMessage",value:function(e){return this._get(2).createTextMessage(e)}},{key:"createImageMessage",value:function(e){return this._get(2).createImageMessage(e)}},{key:"createAudioMessage",value:function(e){return this._get(2).createAudioMessage(e)}},{key:"createVideoMessage",value:function(e){return this._get(2).createVideoMessage(e)}},{key:"createCustomMessage",value:function(e){return this._get(2).createCustomMessage(e)}},{key:"createFaceMessage",value:function(e){return this._get(2).createFaceMessage(e)}},{key:"createFileMessage",value:function(e){return this._get(2).createFileMessage(e)}},{key:"createLocationMessage",value:function(e){return this._get(2).createLocationMessage(e)}},{key:"createMergerMessage",value:function(e){return this._get(2).createMergerMessage(e)}},{key:"downloadMergerMessage",value:function(e){return e.type!==g.MSG_MERGER?v({code:y.MSG_MERGER_TYPE_INVALID}):k(e.payload.downloadKey)?v({code:y.MSG_MERGER_KEY_INVALID}):this._get(2).downloadMergerMessage(e).catch(function(t){return v({code:y.MSG_MERGER_DOWNLOAD_FAIL})})}},{key:"createForwardMessage",value:function(e){return this._get(2).createForwardMessage(e)}},{key:"sendMessage",value:function(e,t){return e instanceof Ce?this._get(2).sendMessageInstance(e,t):v({code:y.MSG_INSTANCE_REQUIRED})}},{key:"callExperimentalAPI",value:function(e,t){return e==="sendComboMessage"?this._get(31).sendMessage(t):e==="handleGroupInvitation"?this._get(7).handleGroupInvitation(t):e==="isCommercialAbilityEnabled"?this._get(27).isFeatureEnabled(t):e==="isFeatureEnabledForStat"?this._get(27).isFeatureEnabledForStat(t):e==="isIntl"?this.isIntl():e==="sendTRTCCustomData"||e==="sendRoomCustomData"?this._get(30).sendTRTCCustomData(t):e==="getTimerID"?this._m.getTimerID():e==="getPollingTimerID"?this._m.getPollingTimerID(t):e==="setApplicationID"?(this._get(12).setApplicationID(t),void this._get(20).updateProtocolConfig()):e==="getServerConfig"?this._get(23).getServerConfig(t):e==="canIUseModule"?this._m.canIUseModule(t):e==="startMessageLongPolling"?this._get(7).startMessageLongPolling(t):e==="stopMessageLongPolling"?this._get(7).stopMessageLongPolling(t):e==="disableMessagePullOnInvite"?this._get(11).disableMsgPullOnInvite(t):e==="clearLocalMessage"?this._get(11).clearMemMsg(t,!1):e==="setCustomLoginInfo"?this._get(12).setCustomLoginInfo(t):e==="statTUIKeyFeatures"?this._m.statTUIKeyFeatures(t):e==="getGroupReceiptsByUsers"?this._get(7).getGroupReceiptsByUsers(t):e==="queryCommercialAbility"?this._get(27).queryCommercialAbility():v({code:y.INVALID_OPERATION})}},{key:"revokeMessage",value:function(e){return this._get(2).revokeMessage(e)}},{key:"resendMessage",value:function(e,t){return e instanceof Ce?this._get(2).resendMessage(e,t):v({code:y.MSG_INSTANCE_REQUIRED})}},{key:"deleteMessage",value:function(e){return this._get(2).deleteMessage(e)}},{key:"translateText",value:function(e){return this._get(2).translateText(e)}},{key:"convertVoiceToText",value:function(e){return this._get(2).convertVoiceToText(e)}},{key:"setMessageExtensions",value:function(e,t){return this._get(3).setMessageExtensions(e,t)}},{key:"getMessageExtensions",value:function(e){return this._get(3).getMessageExtensions(e)}},{key:"deleteMessageExtensions",value:function(e,t){return this._get(3).deleteMessageExtensions(e,t)}},{key:"addMessageReaction",value:function(e,t){return this._get(34).addMessageReaction(e,t)}},{key:"removeMessageReaction",value:function(e,t){return this._get(34).removeMessageReaction(e,t)}},{key:"getMessageReactions",value:function(e){return this._get(34).getMessageReactions(e)}},{key:"getAllUserListOfMessageReaction",value:function(e){return this._get(34).getAllUserListOfMessageReaction(e)}},{key:"modifyMessage",value:function(e){return this._get(2).modifyRemoteMessage(e)}},{key:"getMessageList",value:function(e){return this._get(11).getMessageList(e)}},{key:"getMessageListHopping",value:function(e){return this._get(11).getMessageListHopping(e)}},{key:"sendMessageReadReceipt",value:function(e){return this._get(11).sendReadReceipt(e)}},{key:"getMessageReadReceiptList",value:function(e){return this._get(11).getReadReceiptList(e)}},{key:"getGroupMessageReadMemberList",value:function(e){var t=this._get(7);return t?t.getReadReceiptDetail(e):v({code:y.NO_MODULE})}},{key:"findMessage",value:function(e){return this._get(11).findMessage(e)}},{key:"setMessageRead",value:function(e){return this._get(11).setMessageRead(e)}},{key:"getConversationList",value:function(e){return this._get(11).getConvList(e)}},{key:"getConversationProfile",value:function(e){return this._get(11).getConversationProfile(e)}},{key:"deleteConversation",value:function(e){return this._get(11).deleteConversation(e)}},{key:"setConversationDraft",value:function(e){return this._get(11).setConvDraft(e)}},{key:"clearHistoryMessage",value:function(e){return this._get(11).clearHistoryMessage(e)}},{key:"pinConversation",value:function(e){return this._get(11).pinConversation(e)}},{key:"setAllMessageRead",value:function(e){return this._get(11).setAllMessageRead(e)}},{key:"setMessageRemindType",value:function(e){return this._get(11).setMessageRemindType(e)}},{key:"setAllReceiveMessageOpt",value:function(e){return this._get(11).setAllRcvMsgOpt(e)}},{key:"getAllReceiveMessageOpt",value:function(){return this._get(11).getAllRcvMsgOpt()}},{key:"getTotalUnreadMessageCount",value:function(){return this._get(11).getTotalUnreadCount()}},{key:"setConversationCustomData",value:function(e){return this._get(11).setConvCustomData(e)}},{key:"markConversation",value:function(e){return this._get(11).markConv(e)}},{key:"getConversationGroupList",value:function(){return this._get(11).getConvGroupList()}},{key:"createConversationGroup",value:function(e){return this._get(11).createConvGroup(e)}},{key:"deleteConversationGroup",value:function(e){return this._get(11).deleteConvGroup(e)}},{key:"renameConversationGroup",value:function(e){return this._get(11).renameConvGroup(e)}},{key:"addConversationsToGroup",value:function(e){return this._get(11).addConvsToGroup(e)}},{key:"deleteConversationsFromGroup",value:function(e){return this._get(11).deleteConvsFromGroup(e)}},{key:"searchCloudMessages",value:function(e){var t=this._get(38);return t?t.searchCloudMessages(e):v({code:y.NO_MODULE})}},{key:"searchCloudUsers",value:function(e){var t=this._get(38);return t?t.searchCloudUsers(e):v({code:y.NO_MODULE})}},{key:"searchCloudGroups",value:function(e){var t=this._get(38);return t?t.searchCloudGroups(e):v({code:y.NO_MODULE})}},{key:"searchCloudGroupMembers",value:function(e){var t=this._get(38);return t?t.searchCloudGroupMembers(e):v({code:y.NO_MODULE})}},{key:"getMyProfile",value:function(){return this._get(4).getMyProfile()}},{key:"getUserProfile",value:function(e){return this._get(4).getUserProfile(e)}},{key:"updateMyProfile",value:function(e){return this._get(4).updateMyProfile(e)}},{key:"getBlacklist",value:function(){return this._get(4).getLocalBlacklist()}},{key:"addToBlacklist",value:function(e){return this._get(4).addBlacklist(e)}},{key:"removeFromBlacklist",value:function(e){return this._get(4).deleteBlacklist(e)}},{key:"setSelfStatus",value:function(e){return this._get(4).setSelfStatus(e)}},{key:"getUserStatus",value:function(e){return this._get(4).getUserStatus(e)}},{key:"subscribeUserStatus",value:function(e){return this._get(4).subscribeUserStatus(e)}},{key:"unsubscribeUserStatus",value:function(e){return this._get(4).unsubscribeUserStatus(e)}},{key:"getFriendList",value:function(){var e=this._get(8);return e?e.getLocalFriendList():v({code:y.NO_MODULE})}},{key:"addFriend",value:function(e){var t=this._get(8);return t?t.addFriend(e):v({code:y.NO_MODULE})}},{key:"deleteFriend",value:function(e){var t=this._get(8);return t?t.deleteFriend(e):v({code:y.NO_MODULE})}},{key:"checkFriend",value:function(e){var t=this._get(8);return t?t.checkFriend(e):v({code:y.NO_MODULE})}},{key:"getFriendProfile",value:function(e){var t=this._get(8);return t?t.getFriendProfile(e):v({code:y.NO_MODULE})}},{key:"updateFriend",value:function(e){var t=this._get(8);return t?t.updateFriend(e):v({code:y.NO_MODULE})}},{key:"getFriendApplicationList",value:function(){var e=this._get(8);return e?e.getLocalFriendApplicationList():v({code:y.NO_MODULE})}},{key:"acceptFriendApplication",value:function(e){var t=this._get(8);return t?t.acceptFriendApplication(e):v({code:y.NO_MODULE})}},{key:"refuseFriendApplication",value:function(e){var t=this._get(8);return t?t.refuseFriendApplication(e):v({code:y.NO_MODULE})}},{key:"deleteFriendApplication",value:function(e){var t=this._get(8);return t?t.deleteFriendApplication(e):v({code:y.NO_MODULE})}},{key:"setFriendApplicationRead",value:function(){var e=this._get(8);return e?e.setFriendApplicationRead():v({code:y.NO_MODULE})}},{key:"getFriendGroupList",value:function(){var e=this._get(8);return e?e.getLocalFriendGroupList():v({code:y.NO_MODULE})}},{key:"createFriendGroup",value:function(e){var t=this._get(8);return t?t.createFriendGroup(e):v({code:y.NO_MODULE})}},{key:"deleteFriendGroup",value:function(e){var t=this._get(8);return t?t.deleteFriendGroup(e):v({code:y.NO_MODULE})}},{key:"addToFriendGroup",value:function(e){var t=this._get(8);return t?t.addToFriendGroup(e):v({code:y.NO_MODULE})}},{key:"removeFromFriendGroup",value:function(e){var t=this._get(8);return t?t.removeFromFriendGroup(e):v({code:y.NO_MODULE})}},{key:"renameFriendGroup",value:function(e){var t=this._get(8);return t?t.renameFriendGroup(e):v({code:y.NO_MODULE})}},{key:"followUser",value:function(e){var t=this._get(35);return t?t.followUser(e):v({code:y.NO_MODULE})}},{key:"unfollowUser",value:function(e){var t=this._get(35);return t?t.unfollowUser(e):v({code:y.NO_MODULE})}},{key:"getMyFollowersList",value:function(e){var t=this._get(35);return t?t.getMyFollowersList(e):v({code:y.NO_MODULE})}},{key:"getMyFollowingList",value:function(e){var t=this._get(35);return t?t.getMyFollowingList(e):v({code:y.NO_MODULE})}},{key:"getMutualFollowersList",value:function(e){var t=this._get(35);return t?t.getMutualFollowersList(e):v({code:y.NO_MODULE})}},{key:"getUserFollowInfo",value:function(e){var t=this._get(35);return t?t.getUserFollowInfo(e):v({code:y.NO_MODULE})}},{key:"checkFollowType",value:function(e){var t=this._get(35);return t?t.checkFollowType(e):v({code:y.NO_MODULE})}},{key:"getGroupList",value:function(){var e=this._get(7);return e?e.getGroupList():v({code:y.NO_MODULE})}},{key:"getGroupProfile",value:function(e){var t=this._get(7);return t?t.getGroupProfile(e):v({code:y.NO_MODULE})}},{key:"createGroup",value:function(e){var t=this._get(7);return t?t.createGroup(e):v({code:y.NO_MODULE})}},{key:"dismissGroup",value:function(e){var t=this._get(7);return t?t.dismissGroup(e):v({code:y.NO_MODULE})}},{key:"updateGroupProfile",value:function(e){var t=this._get(7);return t?t.updateGroupProfile(e):v({code:y.NO_MODULE})}},{key:"joinGroup",value:function(e){var t=this._get(7);return t?t.joinGroup(e):v({code:y.NO_MODULE})}},{key:"quitGroup",value:function(e){var t=this._get(7);return t?t.quitGroup(e):v({code:y.NO_MODULE})}},{key:"pinGroupMessage",value:function(e){var t=this._get(7);return t?t.pinGroupMessage(e):v({code:y.NO_MODULE})}},{key:"getPinnedGroupMessageList",value:function(e){var t=this._get(7);return t?t.getPinnedGroupMessageList(e):v({code:y.NO_MODULE})}},{key:"searchGroupByID",value:function(e){var t=this._get(7);return t?t.searchGroupByID(e):v({code:y.NO_MODULE})}},{key:"getGroupOnlineMemberCount",value:function(e){var t=this._get(7);return t?t.getGroupOnlineMemberCount(e):v({code:y.NO_MODULE})}},{key:"changeGroupOwner",value:function(e){var t=this._get(7);return t?t.changeGroupOwner(e):v({code:y.NO_MODULE})}},{key:"getGroupApplicationList",value:function(){var e=this._get(7);return e?e.getGroupApplicationList():v({code:y.NO_MODULE})}},{key:"handleGroupApplication",value:function(e){var t=this._get(7);return t?t.handleGroupApplication(e):v({code:y.NO_MODULE})}},{key:"initGroupAttributes",value:function(e){var t=this._get(7);return t?t.initGroupAttributes(e):v({code:y.NO_MODULE})}},{key:"setGroupAttributes",value:function(e){var t=this._get(7);return t?t.setGroupAttributes(e):v({code:y.NO_MODULE})}},{key:"deleteGroupAttributes",value:function(e){var t=this._get(7);return t?t.deleteGroupAttributes(e):v({code:y.NO_MODULE})}},{key:"getGroupAttributes",value:function(e){var t=this._get(7);return t?t.getGroupAttributes(e):v({code:y.NO_MODULE})}},{key:"setGroupCounters",value:function(e){var t=this._get(7);return t?t.setGroupCounters(e):v({code:y.NO_MODULE})}},{key:"increaseGroupCounter",value:function(e){var t=this._get(7);return t?t.increaseGroupCounter(e):v({code:y.NO_MODULE})}},{key:"decreaseGroupCounter",value:function(e){var t=this._get(7);return t?t.decreaseGroupCounter(e):v({code:y.NO_MODULE})}},{key:"getGroupCounters",value:function(e){var t=this._get(7);return t?t.getGroupCounters(e):v({code:y.NO_MODULE})}},{key:"getGroupMemberList",value:function(e){var t=this._get(7);return t?t.getGroupMemberList(e):v({code:y.NO_MODULE})}},{key:"getGroupMemberProfile",value:function(e){var t=this._get(7);return t?t.getGroupMemberProfile(e):v({code:y.NO_MODULE})}},{key:"addGroupMember",value:function(e){var t=this._get(7);return t?t.addGroupMember(e):v({code:y.NO_MODULE})}},{key:"deleteGroupMember",value:function(e){var t=this._get(7);return t?t.deleteGroupMember(e):v({code:y.NO_MODULE})}},{key:"setGroupMemberMuteTime",value:function(e){var t=this._get(7);return t?t.setGroupMemberMuteTime(e):v({code:y.NO_MODULE})}},{key:"setGroupMemberRole",value:function(e){var t=this._get(7);return t?t.setGroupMemberRole(e):v({code:y.NO_MODULE})}},{key:"setGroupMemberNameCard",value:function(e){var t=this._get(7);return t?t.setGroupMemberNameCard(e):v({code:y.NO_MODULE})}},{key:"setGroupMemberCustomField",value:function(e){var t=this._get(7);return t?t.setGroupMemberCustomField(e):v({code:y.NO_MODULE})}},{key:"markGroupMemberList",value:function(e){var t=this._get(7);return t?t.markGroupMemberList(e):v({code:y.NO_MODULE})}},{key:"getJoinedCommunityList",value:function(){return this._get(10).getJoinedCommunityList()}},{key:"createTopicInCommunity",value:function(e){return this._get(10).createTopicInCommunity(e)}},{key:"deleteTopicFromCommunity",value:function(e){return this._get(10).deleteTopicFromCommunity(e)}},{key:"updateTopicProfile",value:function(e){return this._get(10).updateTopicProfile(e)}},{key:"getTopicList",value:function(e){return this._get(10).getTopicList(e)}},{key:"addSignalingListener",value:function(e,t,n){var o=this._get(33);o&&o.addSignalingListener(e,this._safetyCallbackFactory.defense(e,t,n),n)}},{key:"removeSignalingListener",value:function(e,t,n){var o,s=this._safetyCallbackFactory.find(e,t);s!==null&&(o=this._get(33))&&(o.removeSignalingListener(e,s,n),this._safetyCallbackFactory.delete(e,t))}},{key:"invite",value:function(e){var t=this._get(33);return t?t.invite(e):v({code:y.NO_MODULE})}},{key:"inviteSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"inviteInGroup",value:function(e){var t=this._get(33);return t?t.invite(e):v({code:y.NO_MODULE})}},{key:"inviteInGroupSync",value:function(e,t,n){var o=this._get(33);return o?o.inviteSync(e,t,n):""}},{key:"cancel",value:function(e){var t=this._get(33);return t?t.cancel(e):v({code:y.NO_MODULE})}},{key:"accept",value:function(e){var t=this._get(33);return t?t.accept(e):v({code:y.NO_MODULE})}},{key:"reject",value:function(e){var t=this._get(33);return t?t.reject(e):v({code:y.NO_MODULE})}},{key:"getSignalingInfo",value:function(e){var t=this._get(33);return t?t.getSignalingInfo(e):null}},{key:"modifyInvitation",value:function(e){var t=this._get(33);return t?t.modifyInvitation(e):v({code:y.NO_MODULE})}}]),Lc={login:1,logout:1,getLoginUser:1,destroy:1,on:1,off:1,ready:1,setLogLevel:1,joinGroup:1,quitGroup:1,registerPlugin:1,getGroupOnlineMemberCount:1,isReady:1,addSignalingListener:1,removeSignalingListener:1,callExperimentalAPI:1};function yo(e){return U(this,yo),(e=le(this,yo,[e]))._n="CSModule",e}var gn={},ve={};return ve.create=function(i){var t="TencentCloudChat.create",n=0,a=i.SDKAppID;if(Y(a))n=a;else if(n=parseInt(a),isNaN(a))return d.e("".concat(t," failed. Failed to parse the SDKAppID, please check the arguments")),null;if(n&&gn[n])return gn[n];d.l("".concat(t));var o,s,a=new Ec(p(p({},i),{},{SDKAppID:n})),i=(a.on(F.SDK_DESTROY,function(r){gn[r.data.SDKAppID]=null,delete gn[r.data.SDKAppID]}),o=a,s=Object.create(null),Object.keys(di).forEach(function(r){var c;o[r]&&(c=new $a,s[r]=function(){var u=Array.from(arguments);return c.use(function(l,_){I=r;var m,f,I=!(!(m=o).isReady()&&Lc[I]!==1)||(f={code:f=m.getNotReadyReason(),message:"".concat(m.getErrMsg(f)," | ").concat(I," | ").concat(m.getErrMsg(y.SDK_IS_NOT_READY))},m.onError(f),f);return I===!0?_():v(I)}).use(function(l,_){if((function(m,f,I){if(f===void 0)return!0;var C=!0;if(Q(f))Object.keys(f).forEach(function(S){var L=m.length===1?m[0][S]:void 0;C=!!ua(L,f[S],I,S)&&C});else if(O(f))for(var M=0;M<f.length;M++)C=!!ua(m[M],f[M],I,f[M].name)&&C;if(C)return C;throw new Error("Params validate failed.")})(l,fa[r],r)===!0)return _()}).use(function(l,_){return o[r].apply(o,l)}),c.run(u)})}),s);return gn[n]=i,fa.hookGetAPITips(a.getErrMsg.bind(a)),d.l("".concat(t," ok")),i},ve.TYPES=g,ve.EVENT=F,ve.TSignaling=ge,ve.VERSION="3.6.6",d.l("TencentCloudChat.VERSION:".concat(ve.VERSION)),ve})})(Co)),Co.exports}var Oc=Ac();const Gc=kc(Oc);export{Gc as T,Ac as r};