UNPKG

@openim/client-sdk

Version:

JavaScript/TypeScript Client SDK for OpenIM

1 lines 185 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("loglevel"),require("spark-md5"),require("base64-arraybuffer"),require("@openim/protocol")):"function"==typeof define&&define.amd?define(["exports","loglevel","spark-md5","base64-arraybuffer","@openim/protocol"],t):t((e||self).clientSdk={},e.loglevel,e.sparkMd5,e.base64Arraybuffer,e.protocol)}(this,function(e,t,n,r,o){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=/*#__PURE__*/i(t),a=/*#__PURE__*/i(n);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var d=0;function g(e){return"__private_"+d+++"_"+e}function p(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,I(e,t)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}function m(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function M(e){var t="function"==typeof Map?new Map:void 0;return M=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(h())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&I(o,n.prototype),o}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),I(n,e)},M(e)}var y,D,C,S=function(e){try{if(!e.ok)throw new Error(e.statusText);return Promise.resolve(e.json()).then(function(e){if(0!==e.errCode)throw new Error(e.errMsg);return e.data})}catch(e){return Promise.reject(e)}},T={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",csv:"text/csv",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",gif:"image/gif",bmp:"image/bmp",svg:"image/svg+xml",mp3:"audio/mpeg",mp4:"video/mp4",wav:"audio/wav",pdf:"application/pdf",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",xml:"application/xml",zip:"application/zip",tar:"application/x-tar","7z":"application/x-7z-compressed",rar:"application/vnd.rar",ogg:"audio/ogg",midi:"audio/midi",webm:"audio/webm",avi:"video/x-msvideo",mpeg:"video/mpeg",ts:"video/mp2t",mov:"video/quicktime",wmv:"video/x-ms-wmv",flv:"video/x-flv",mkv:"video/x-matroska",webp:"image/webp",heic:"image/heic",psd:"image/vnd.adobe.photoshop",ai:"application/postscript",eps:"application/postscript",ttf:"font/ttf",otf:"font/otf",woff:"font/woff",woff2:"font/woff2",jsonld:"application/ld+json",ics:"text/calendar",sh:"application/x-sh",php:"application/x-httpd-php",jar:"application/java-archive"};e.RequestApi=void 0,(D=e.RequestApi||(e.RequestApi={})).InitSDK="InitSDK",D.Login="Login",D.Logout="Logout",D.GetLoginStatus="GetLoginStatus",D.GetLoginUserID="GetLoginUserID",D.ForceReconnect="ForceReconnect",D.GetSelfUserInfo="GetSelfUserInfo",D.SetSelfInfo="SetSelfInfo",D.GetUsersInfo="GetUsersInfo",D.SubscribeUsersStatus="SubscribeUsersStatus",D.UnsubscribeUsersStatus="UnsubscribeUsersStatus",D.GetSubscribeUsersStatus="GetSubscribeUsersStatus",D.SetAppBackgroundStatus="SetAppBackgroundStatus",D.NetworkStatusChanged="NetworkStatusChanged",D.SetGlobalRecvMessageOpt="SetGlobalRecvMessageOpt",D.AcceptFriendApplication="AcceptFriendApplication",D.AddBlack="AddBlack",D.AddFriend="AddFriend",D.CheckFriend="CheckFriend",D.DeleteFriend="DeleteFriend",D.GetBlackList="GetBlackList",D.GetFriendApplicationListAsApplicant="GetFriendApplicationListAsApplicant",D.GetFriendApplicationListAsRecipient="GetFriendApplicationListAsRecipient",D.GetFriendList="GetFriendList",D.GetFriendListPage="GetFriendListPage",D.GetSpecifiedFriendsInfo="GetSpecifiedFriendsInfo",D.RefuseFriendApplication="RefuseFriendApplication",D.RemoveBlack="RemoveBlack",D.SearchFriends="SearchFriends",D.UpdateFriends="UpdateFriends",D.CreateGroup="CreateGroup",D.JoinGroup="JoinGroup",D.InviteUserToGroup="InviteUserToGroup",D.GetJoinedGroupList="GetJoinedGroupList",D.GetJoinedGroupListPage="GetJoinedGroupListPage",D.SearchGroups="SearchGroups",D.GetSpecifiedGroupsInfo="GetSpecifiedGroupsInfo",D.SetGroupInfo="SetGroupInfo",D.GetGroupApplicationListAsRecipient="GetGroupApplicationListAsRecipient",D.GetGroupApplicationListAsApplicant="GetGroupApplicationListAsApplicant",D.AcceptGroupApplication="AcceptGroupApplication",D.RefuseGroupApplication="RefuseGroupApplication",D.GetGroupMemberList="GetGroupMemberList",D.GetSpecifiedGroupMembersInfo="GetSpecifiedGroupMembersInfo",D.SearchGroupMembers="SearchGroupMembers",D.SetGroupMemberInfo="SetGroupMemberInfo",D.GetGroupMemberOwnerAndAdmin="GetGroupMemberOwnerAndAdmin",D.GetGroupMemberListByJoinTimeFilter="GetGroupMemberListByJoinTimeFilter",D.KickGroupMember="KickGroupMember",D.ChangeGroupMemberMute="ChangeGroupMemberMute",D.ChangeGroupMute="ChangeGroupMute",D.TransferGroupOwner="TransferGroupOwner",D.DismissGroup="DismissGroup",D.QuitGroup="QuitGroup",D.GetUsersInGroup="GetUsersInGroup",D.IsJoinGroup="IsJoinGroup",D.GetAllConversationList="GetAllConversationList",D.GetConversationListSplit="GetConversationListSplit",D.GetOneConversation="GetOneConversation",D.GetMultipleConversation="GetMultipleConversation",D.GetConversationIDBySessionType="GetConversationIDBySessionType",D.GetTotalUnreadMsgCount="GetTotalUnreadMsgCount",D.MarkConversationMessageAsRead="MarkConversationMessageAsRead",D.SetConversationDraft="SetConversationDraft",D.PinConversation="PinConversation",D.SetConversationRecvMessageOpt="SetConversationRecvMessageOpt",D.SetConversationPrivateChat="SetConversationPrivateChat",D.SetConversationBurnDuration="SetConversationBurnDuration",D.ResetConversationGroupAtType="ResetConversationGroupAtType",D.HideConversation="HideConversation",D.HideAllConversation="HideAllConversation",D.ClearConversationAndDeleteAllMsg="ClearConversationAndDeleteAllMsg",D.DeleteConversationAndDeleteAllMsg="DeleteConversationAndDeleteAllMsg",D.ChangeInputStates="ChangeInputStates",D.GetInputStates="GetInputStates",D.CreateTextMessage="CreateTextMessage",D.CreateTextAtMessage="CreateTextAtMessage",D.CreateImageMessageByFile="CreateImageMessageByFile",D.CreateImageMessageByURL="CreateImageMessageByURL",D.CreateSoundMessageByFile="CreateSoundMessageByFile",D.CreateSoundMessageByURL="CreateSoundMessageByURL",D.CreateVideoMessageByFile="CreateVideoMessageByFile",D.CreateVideoMessageByURL="CreateVideoMessageByURL",D.CreateFileMessageByFile="CreateFileMessageByFile",D.CreateFileMessageByURL="CreateFileMessageByURL",D.CreateMergerMessage="CreateMergerMessage",D.CreateForwardMessage="CreateForwardMessage",D.CreateLocationMessage="CreateLocationMessage",D.CreateQuoteMessage="CreateQuoteMessage",D.CreateCardMessage="CreateCardMessage",D.CreateCustomMessage="CreateCustomMessage",D.CreateFaceMessage="CreateFaceMessage",D.SendMessage="SendMessage",D.SendMessageNotOss="SendMessageNotOss",D.UploadFile="UploadFile",D.TypingStatusUpdate="TypingStatusUpdate",D.RevokeMessage="RevokeMessage",D.DeleteMessage="DeleteMessage",D.DeleteMessageFromLocalStorage="DeleteMessageFromLocalStorage",D.DeleteAllMsgFromLocal="DeleteAllMsgFromLocal",D.DeleteAllMsgFromLocalAndSvr="DeleteAllMsgFromLocalAndSvr",D.SearchLocalMessages="SearchLocalMessages",D.GetAdvancedHistoryMessageList="GetAdvancedHistoryMessageList",D.GetAdvancedHistoryMessageListReverse="GetAdvancedHistoryMessageListReverse",D.FindMessageList="FindMessageList",D.InsertGroupMessageToLocalStorage="InsertGroupMessageToLocalStorage",D.InsertSingleMessageToLocalStorage="InsertSingleMessageToLocalStorage",D.SetMessageLocalEx="SetMessageLocalEx",D.SetConversation="SetConversation",function(e){e.GetFriendVersion="GetFriendVersion",e.GetGroupVersion="GetGroupVersion",e.GetJoinedGroupIDList="GetJoinedGroupIDList",e.GetGroupMemberVersion="GetGroupMemberVersion",e.GetConversationVersion="GetConversationVersion",e.GetConversationsHasReadAndMaxSeq="GetConversationsHasReadAndMaxSeq",e.GetDesignatedFriendsApplication="GetDesignatedFriendsApplication",e.GetDesignatedGroupApplication="GetDesignatedGroupApplication",e.GetDesignatedBlackUser="GetDesignatedBlackUser",e.GetActiveConversations="GetActiveConversations",e.GetDesignatedConversation="GetDesignatedConversation",e.GetNotNotifyConversationIDs="GetNotNotifyConversationIDs",e.GetFullFriendUserIDs="GetFullFriendUserIDs",e.GetFullGroupMemberUserIDs="GetFullGroupMemberUserIDs"}(C||(C={}));var b,A,R,P,G,N,q,E,w,U,F,O,k=((y={})[e.RequestApi.AddFriend]="/friend/add_friend",y[e.RequestApi.CheckFriend]="/friend/is_friend",y[e.RequestApi.DeleteFriend]="/friend/delete_friend",y[e.RequestApi.AcceptFriendApplication]="/friend/add_friend_response",y[e.RequestApi.RefuseFriendApplication]="/friend/add_friend_response",y[e.RequestApi.GetFriendListPage]="/friend/get_friend_list",y[e.RequestApi.GetSpecifiedFriendsInfo]="/friend/get_designated_friends",y[e.RequestApi.GetFriendApplicationListAsApplicant]="/friend/get_self_friend_apply_list",y[e.RequestApi.GetFriendApplicationListAsRecipient]="/friend/get_friend_apply_list",y[e.RequestApi.UpdateFriends]="/friend/update_friends",y[e.RequestApi.AddBlack]="/friend/add_black",y[e.RequestApi.RemoveBlack]="/friend/remove_black",y[e.RequestApi.GetBlackList]="/friend/get_black_list",y[e.RequestApi.CreateGroup]="/group/create_group",y[e.RequestApi.JoinGroup]="/group/join_group",y[e.RequestApi.InviteUserToGroup]="/group/invite_user_to_group",y[e.RequestApi.GetJoinedGroupListPage]="/group/get_joined_group_list",y[e.RequestApi.GetSpecifiedGroupsInfo]="/group/get_groups_info",y[e.RequestApi.SetGroupInfo]="/group/set_group_info_ex",y[e.RequestApi.GetGroupApplicationListAsApplicant]="/group/get_user_req_group_applicationList",y[e.RequestApi.GetGroupApplicationListAsRecipient]="/group/get_recv_group_applicationList",y[e.RequestApi.AcceptGroupApplication]="/group/group_application_response",y[e.RequestApi.RefuseGroupApplication]="/group/group_application_response",y[e.RequestApi.GetGroupMemberList]="/group/get_group_member_list",y[e.RequestApi.GetSpecifiedGroupMembersInfo]="/group/get_group_members_info",y[e.RequestApi.SetGroupMemberInfo]="/group/set_group_member_info",y[e.RequestApi.KickGroupMember]="/group/kick_group",y[e.RequestApi.TransferGroupOwner]="/group/transfer_group",y[e.RequestApi.DismissGroup]="/group/dismiss_group",y[e.RequestApi.QuitGroup]="/group/quit_group",y[e.RequestApi.GetSelfUserInfo]="/user/get_users_info",y[e.RequestApi.SetSelfInfo]="/user/update_user_info_ex",y[e.RequestApi.GetUsersInfo]="/user/get_users_info",y[e.RequestApi.SubscribeUsersStatus]="/user/subscribe_users_status",y[e.RequestApi.UnsubscribeUsersStatus]="/user/subscribe_users_status",y[e.RequestApi.GetSubscribeUsersStatus]="/user/get_subscribe_users_status",y[e.RequestApi.SetGlobalRecvMessageOpt]="/user/set_global_msg_recv_opt",y[e.RequestApi.RevokeMessage]="/msg/revoke_msg",y[e.RequestApi.DeleteMessage]="/msg/delete_msgs",y[e.RequestApi.DeleteConversationAndDeleteAllMsg]="/msg/clear_conversation_msg",y[e.RequestApi.DeleteAllMsgFromLocalAndSvr]="/msg/user_clear_all_msg",y[e.RequestApi.MarkConversationMessageAsRead]="/msg/mark_conversation_as_read",y[e.RequestApi.SetConversation]="/conversation/set_conversations",y[C.GetFriendVersion]="/friend/get_incremental_friends",y[C.GetGroupVersion]="/group/get_incremental_join_groups",y[C.GetJoinedGroupIDList]="/group/get_full_join_group_ids",y[C.GetGroupMemberVersion]="/group/get_incremental_group_members_batch",y[C.GetConversationVersion]="/conversation/get_incremental_conversations",y[C.GetConversationsHasReadAndMaxSeq]="/conversation/get_conversations_has_read_and_max_seq",y[C.GetDesignatedFriendsApplication]="/friend/get_designated_friend_apply",y[C.GetDesignatedGroupApplication]="/group/get_specified_user_group_request_info",y[C.GetDesignatedBlackUser]="/friend/get_specified_blacks",y[C.GetActiveConversations]="/jssdk/get_active_conversations",y[C.GetDesignatedConversation]="/jssdk/get_conversations",y[C.GetNotNotifyConversationIDs]="/conversation/get_not_notify_conversation_ids",y[C.GetFullFriendUserIDs]="/friend/get_full_friend_user_ids",y[C.GetFullGroupMemberUserIDs]="/group/get_full_group_member_user_ids",y);e.CbEvents=void 0,(b=e.CbEvents||(e.CbEvents={})).OnConnectFailed="OnConnectFailed",b.OnConnectSuccess="OnConnectSuccess",b.OnConnecting="OnConnecting",b.OnKickedOffline="OnKickedOffline",b.OnSelfInfoUpdated="OnSelfInfoUpdated",b.OnUserTokenExpired="OnUserTokenExpired",b.OnUserTokenInvalid="OnUserTokenInvalid",b.OnProgress="OnProgress",b.OnRecvNewMessage="OnRecvNewMessage",b.OnRecvNewMessages="OnRecvNewMessages",b.OnRecvOfflineNewMessage="onRecvOfflineNewMessage",b.OnRecvOfflineNewMessages="onRecvOfflineNewMessages",b.OnNewRecvMessageRevoked="OnNewRecvMessageRevoked",b.OnRecvC2CReadReceipt="OnRecvC2CReadReceipt",b.OnRecvGroupReadReceipt="OnRecvGroupReadReceipt",b.OnConversationChanged="OnConversationChanged",b.OnNewConversation="OnNewConversation",b.OnConversationUserInputStatusChanged="OnConversationUserInputStatusChanged",b.OnSyncServerFailed="OnSyncServerFailed",b.OnSyncServerFinish="OnSyncServerFinish",b.OnSyncServerProgress="OnSyncServerProgress",b.OnSyncServerStart="OnSyncServerStart",b.OnTotalUnreadMessageCountChanged="OnTotalUnreadMessageCountChanged",b.OnBlackAdded="OnBlackAdded",b.OnBlackDeleted="OnBlackDeleted",b.OnFriendApplicationAccepted="OnFriendApplicationAccepted",b.OnFriendApplicationAdded="OnFriendApplicationAdded",b.OnFriendApplicationDeleted="OnFriendApplicationDeleted",b.OnFriendApplicationRejected="OnFriendApplicationRejected",b.OnFriendInfoChanged="OnFriendInfoChanged",b.OnFriendAdded="OnFriendAdded",b.OnFriendDeleted="OnFriendDeleted",b.OnJoinedGroupAdded="OnJoinedGroupAdded",b.OnJoinedGroupDeleted="OnJoinedGroupDeleted",b.OnGroupDismissed="OnGroupDismissed",b.OnGroupMemberAdded="OnGroupMemberAdded",b.OnGroupMemberDeleted="OnGroupMemberDeleted",b.OnGroupApplicationAdded="OnGroupApplicationAdded",b.OnGroupApplicationDeleted="OnGroupApplicationDeleted",b.OnGroupInfoChanged="OnGroupInfoChanged",b.OnGroupMemberInfoChanged="OnGroupMemberInfoChanged",b.OnGroupApplicationAccepted="OnGroupApplicationAccepted",b.OnGroupApplicationRejected="OnGroupApplicationRejected",b.UploadComplete="UploadComplete",b.OnRecvCustomBusinessMessage="OnRecvCustomBusinessMessage",b.OnUserStatusChanged="OnUserStatusChanged",b.OnUploadLogsProgress="OnUploadLogsProgress",b.OnReceiveNewInvitation="OnReceiveNewInvitation",b.OnInviteeAccepted="OnInviteeAccepted",b.OnInviteeRejected="OnInviteeRejected",b.OnInvitationCancelled="OnInvitationCancelled",b.OnHangUp="OnHangUp",b.OnInvitationTimeout="OnInvitationTimeout",b.OnInviteeAcceptedByOtherDevice="OnInviteeAcceptedByOtherDevice",b.OnInviteeRejectedByOtherDevice="OnInviteeRejectedByOtherDevice",b.OnStreamChange="OnStreamChange",b.OnRoomParticipantConnected="OnRoomParticipantConnected",b.OnRoomParticipantDisconnected="OnRoomParticipantDisconnected",b.OnReceiveCustomSignal="OnReceiveCustomSignal",b.UnUsedEvent="UnUsedEvent",e.ErrorCode=void 0,(R=e.ErrorCode||(e.ErrorCode={}))[R.NetworkError=1e4]="NetworkError",R[R.NetworkTimeoutError=10001]="NetworkTimeoutError",R[R.ArgsError=10002]="ArgsError",R[R.CtxDeadlineExceededError=10003]="CtxDeadlineExceededError",R[R.ResourceLoadNotCompleteError=10004]="ResourceLoadNotCompleteError",R[R.UnknownCode=10005]="UnknownCode",R[R.SdkInternalError=10006]="SdkInternalError",R[R.NoUpdateError=10007]="NoUpdateError",R[R.UserIDNotFoundError=10100]="UserIDNotFoundError",R[R.LoginOutError=10101]="LoginOutError",R[R.LoginRepeatError=10102]="LoginRepeatError",R[R.FileNotFoundError=10200]="FileNotFoundError",R[R.MsgDeCompressionError=10201]="MsgDeCompressionError",R[R.MsgDecodeBinaryWsError=10202]="MsgDecodeBinaryWsError",R[R.MsgBinaryTypeNotSupportError=10203]="MsgBinaryTypeNotSupportError",R[R.MsgRepeatError=10204]="MsgRepeatError",R[R.MsgContentTypeNotSupportError=10205]="MsgContentTypeNotSupportError",R[R.MsgHasNoSeqError=10206]="MsgHasNoSeqError",R[R.NotSupportOptError=10301]="NotSupportOptError",R[R.NotSupportTypeError=10302]="NotSupportTypeError",R[R.UnreadCountError=10303]="UnreadCountError",R[R.GroupIDNotFoundError=10400]="GroupIDNotFoundError",R[R.GroupTypeErr=10401]="GroupTypeErr",e.ReqIdentifier=void 0,(P=e.ReqIdentifier||(e.ReqIdentifier={}))[P.GetNewestSeq=1001]="GetNewestSeq",P[P.PullMsgByRange=1002]="PullMsgByRange",P[P.SendMsg=1003]="SendMsg",P[P.SendSignalMsg=1004]="SendSignalMsg",P[P.PullMsgBySeqList=1005]="PullMsgBySeqList",P[P.GetConvMaxReadSeq=1006]="GetConvMaxReadSeq",P[P.PushMsg=2001]="PushMsg",P[P.KickOnlineMsg=2002]="KickOnlineMsg",P[P.LogoutMsg=2003]="LogoutMsg",P[P.SetBackgroundStatus=2004]="SetBackgroundStatus",P[P.WsSubUserOnlineStatus=2005]="WsSubUserOnlineStatus",P[P.WSServerConfigMsg=2100]="WSServerConfigMsg",P[P.WSDataError=3001]="WSDataError",e.InternalContentType=void 0,(G=e.InternalContentType||(e.InternalContentType={}))[G.Text=101]="Text",G[G.Picture=102]="Picture",G[G.Sound=103]="Sound",G[G.Video=104]="Video",G[G.File=105]="File",G[G.AtText=106]="AtText",G[G.Merger=107]="Merger",G[G.Card=108]="Card",G[G.Location=109]="Location",G[G.Custom=110]="Custom",G[G.Typing=113]="Typing",G[G.Quote=114]="Quote",G[G.Face=115]="Face",G[G.AdvancedText=117]="AdvancedText",G[G.CustomMsgNotTriggerConversation=119]="CustomMsgNotTriggerConversation",G[G.CustomMsgOnlineOnly=120]="CustomMsgOnlineOnly",G[G.ReactionMessageModifier=121]="ReactionMessageModifier",G[G.ReactionMessageDeleter=122]="ReactionMessageDeleter",e.NotificationType=void 0,(N=e.NotificationType||(e.NotificationType={}))[N.NotificationBegin=1e3]="NotificationBegin",N[N.FriendNotificationBegin=1200]="FriendNotificationBegin",N[N.FriendApplicationApprovedNotification=1201]="FriendApplicationApprovedNotification",N[N.FriendApplicationRejectedNotification=1202]="FriendApplicationRejectedNotification",N[N.FriendApplicationNotification=1203]="FriendApplicationNotification",N[N.FriendAddedNotification=1204]="FriendAddedNotification",N[N.FriendDeletedNotification=1205]="FriendDeletedNotification",N[N.FriendRemarkSetNotification=1206]="FriendRemarkSetNotification",N[N.BlackAddedNotification=1207]="BlackAddedNotification",N[N.BlackDeletedNotification=1208]="BlackDeletedNotification",N[N.FriendInfoUpdatedNotification=1209]="FriendInfoUpdatedNotification",N[N.FriendsInfoUpdateNotification=1210]="FriendsInfoUpdateNotification",N[N.FriendNotificationEnd=1299]="FriendNotificationEnd",N[N.ConversationChangeNotification=1300]="ConversationChangeNotification",N[N.UserNotificationBegin=1301]="UserNotificationBegin",N[N.UserInfoUpdatedNotification=1303]="UserInfoUpdatedNotification",N[N.UserStatusChangeNotification=1304]="UserStatusChangeNotification",N[N.UserCommandAddNotification=1305]="UserCommandAddNotification",N[N.UserCommandDeleteNotification=1306]="UserCommandDeleteNotification",N[N.UserCommandUpdateNotification=1307]="UserCommandUpdateNotification",N[N.UserNotificationEnd=1399]="UserNotificationEnd",N[N.OANotification=1400]="OANotification",N[N.GroupNotificationBegin=1500]="GroupNotificationBegin",N[N.GroupCreatedNotification=1501]="GroupCreatedNotification",N[N.GroupInfoSetNotification=1502]="GroupInfoSetNotification",N[N.JoinGroupApplicationNotification=1503]="JoinGroupApplicationNotification",N[N.MemberQuitNotification=1504]="MemberQuitNotification",N[N.GroupApplicationAcceptedNotification=1505]="GroupApplicationAcceptedNotification",N[N.GroupApplicationRejectedNotification=1506]="GroupApplicationRejectedNotification",N[N.GroupOwnerTransferredNotification=1507]="GroupOwnerTransferredNotification",N[N.MemberKickedNotification=1508]="MemberKickedNotification",N[N.MemberInvitedNotification=1509]="MemberInvitedNotification",N[N.MemberEnterNotification=1510]="MemberEnterNotification",N[N.GroupDismissedNotification=1511]="GroupDismissedNotification",N[N.GroupMemberMutedNotification=1512]="GroupMemberMutedNotification",N[N.GroupMemberCancelMutedNotification=1513]="GroupMemberCancelMutedNotification",N[N.GroupMutedNotification=1514]="GroupMutedNotification",N[N.GroupCancelMutedNotification=1515]="GroupCancelMutedNotification",N[N.GroupMemberInfoSetNotification=1516]="GroupMemberInfoSetNotification",N[N.GroupMemberSetToAdminNotification=1517]="GroupMemberSetToAdminNotification",N[N.GroupMemberSetToOrdinaryUserNotification=1518]="GroupMemberSetToOrdinaryUserNotification",N[N.GroupInfoSetAnnouncementNotification=1519]="GroupInfoSetAnnouncementNotification",N[N.GroupInfoSetNameNotification=1520]="GroupInfoSetNameNotification",N[N.GroupNotificationEnd=1599]="GroupNotificationEnd",N[N.SignalingNotificationBegin=1600]="SignalingNotificationBegin",N[N.SignalingNotification=1601]="SignalingNotification",N[N.RoomParticipantsConnectedNotification=1602]="RoomParticipantsConnectedNotification",N[N.RoomParticipantsDisconnectedNotification=1603]="RoomParticipantsDisconnectedNotification",N[N.StreamChangedNotification=1604]="StreamChangedNotification",N[N.CustomSignalNotification=1605]="CustomSignalNotification",N[N.SignalingNotificationEnd=1649]="SignalingNotificationEnd",N[N.SuperGroupNotificationBegin=1650]="SuperGroupNotificationBegin",N[N.SuperGroupUpdateNotification=1651]="SuperGroupUpdateNotification",N[N.MsgDeleteNotification=1652]="MsgDeleteNotification",N[N.ReactionMessageModifierNotification=1653]="ReactionMessageModifierNotification",N[N.ReactionMessageDeleteNotification=1654]="ReactionMessageDeleteNotification",N[N.SuperGroupNotificationEnd=1699]="SuperGroupNotificationEnd",N[N.ConversationPrivateChatNotification=1701]="ConversationPrivateChatNotification",N[N.ConversationUnreadNotification=1702]="ConversationUnreadNotification",N[N.ClearConversationNotification=1703]="ClearConversationNotification",N[N.WorkMomentNotificationBegin=1900]="WorkMomentNotificationBegin",N[N.WorkMomentNotification=1901]="WorkMomentNotification",N[N.BusinessNotificationBegin=2e3]="BusinessNotificationBegin",N[N.BusinessNotification=2001]="BusinessNotification",N[N.BusinessNotificationEnd=2099]="BusinessNotificationEnd",N[N.RevokeNotification=2101]="RevokeNotification",N[N.HasReadReceiptNotification=2150]="HasReadReceiptNotification",N[N.GroupHasReadReceiptNotification=2155]="GroupHasReadReceiptNotification",N[N.DeleteMsgsNotification=2102]="DeleteMsgsNotification",N[N.HasReadReceipt=2200]="HasReadReceipt",N[N.HasGroupReadReceipt=2300]="HasGroupReadReceipt",N[N.NotificationEnd=5e3]="NotificationEnd",e.MsgFrom=void 0,(q=e.MsgFrom||(e.MsgFrom={}))[q.UserMsgType=100]="UserMsgType",q[q.SysMsgType=200]="SysMsgType",e.InternalMessageStatus=void 0,(E=e.InternalMessageStatus||(e.InternalMessageStatus={}))[E.MsgStatusDefault=0]="MsgStatusDefault",E[E.MsgStatusSending=1]="MsgStatusSending",E[E.MsgStatusSendSuccess=2]="MsgStatusSendSuccess",E[E.MsgStatusSendFailed=3]="MsgStatusSendFailed",E[E.MsgStatusHasDeleted=4]="MsgStatusHasDeleted",E[E.MsgStatusFiltered=5]="MsgStatusFiltered",e.MessageOptionsKey=void 0,(w=e.MessageOptionsKey||(e.MessageOptionsKey={})).IsHistory="history",w.IsPersistent="persistent",w.IsUnreadCount="unreadCount",w.IsConversationUpdate="conversationUpdate",w.IsOfflinePush="offlinePush",w.IsSenderSync="senderSync",w.IsNotPrivate="notPrivate",w.IsSenderConversationUpdate="senderConversationUpdate",e.GroupStatus=void 0,(U=e.GroupStatus||(e.GroupStatus={}))[U.GroupOk=0]="GroupOk",U[U.GroupBanChat=1]="GroupBanChat",U[U.GroupStatusDismissed=2]="GroupStatusDismissed",U[U.GroupStatusMuted=3]="GroupStatusMuted",e.WorkMomentSdkNotificationType=void 0,(F=e.WorkMomentSdkNotificationType||(e.WorkMomentSdkNotificationType={}))[F.WorkMomentCommentNotification=0]="WorkMomentCommentNotification",F[F.WorkMomentLikeNotification=1]="WorkMomentLikeNotification",F[F.WorkMomentAtUserNotification=2]="WorkMomentAtUserNotification",e.WsErrorCode=void 0,(O=e.WsErrorCode||(e.WsErrorCode={}))[O.TokenExpiredError=1501]="TokenExpiredError",O[O.TokenInvalidError=1502]="TokenInvalidError",O[O.TokenMalformedError=1503]="TokenMalformedError",O[O.TokenNotValidYetError=1504]="TokenNotValidYetError",O[O.TokenUnknownError=1505]="TokenUnknownError",O[O.TokenKickedError=1506]="TokenKickedError",O[O.TokenNotExistError=1507]="TokenNotExistError";var L,x,j,V,B,_,H,J,W,K,Q,z,Y,X,$,Z,ee,te,ne,re=((A={})[e.WsErrorCode.TokenExpiredError]=e.CbEvents.OnUserTokenExpired,A[e.WsErrorCode.TokenInvalidError]=e.CbEvents.OnUserTokenInvalid,A[e.WsErrorCode.TokenMalformedError]=e.CbEvents.OnUserTokenInvalid,A[e.WsErrorCode.TokenNotValidYetError]=e.CbEvents.OnUserTokenInvalid,A[e.WsErrorCode.TokenUnknownError]=e.CbEvents.OnUserTokenInvalid,A[e.WsErrorCode.TokenKickedError]=e.CbEvents.OnKickedOffline,A[e.WsErrorCode.TokenNotExistError]=e.CbEvents.OnUserTokenInvalid,A);e.MessageReceiveOptType=void 0,(L=e.MessageReceiveOptType||(e.MessageReceiveOptType={}))[L.Nomal=0]="Nomal",L[L.NotReceive=1]="NotReceive",L[L.NotNotify=2]="NotNotify",e.AllowType=void 0,(x=e.AllowType||(e.AllowType={}))[x.Allowed=0]="Allowed",x[x.NotAllowed=1]="NotAllowed",e.GroupType=void 0,(j=e.GroupType||(e.GroupType={}))[j.Group=2]="Group",j[j.WorkingGroup=2]="WorkingGroup",e.GroupJoinSource=void 0,(V=e.GroupJoinSource||(e.GroupJoinSource={}))[V.Invitation=2]="Invitation",V[V.Search=3]="Search",V[V.QrCode=4]="QrCode",e.GroupMemberRole=void 0,(B=e.GroupMemberRole||(e.GroupMemberRole={}))[B.Nomal=20]="Nomal",B[B.Admin=60]="Admin",B[B.Owner=100]="Owner",e.GroupVerificationType=void 0,(_=e.GroupVerificationType||(e.GroupVerificationType={}))[_.ApplyNeedInviteNot=0]="ApplyNeedInviteNot",_[_.AllNeed=1]="AllNeed",_[_.AllNot=2]="AllNot",e.MessageStatus=void 0,(H=e.MessageStatus||(e.MessageStatus={}))[H.Sending=1]="Sending",H[H.Succeed=2]="Succeed",H[H.Failed=3]="Failed",e.Platform=void 0,(J=e.Platform||(e.Platform={}))[J.iOS=1]="iOS",J[J.Android=2]="Android",J[J.Windows=3]="Windows",J[J.MacOSX=4]="MacOSX",J[J.Web=5]="Web",J[J.Linux=7]="Linux",J[J.AndroidPad=8]="AndroidPad",J[J.iPad=9]="iPad",e.LogLevel=void 0,(W=e.LogLevel||(e.LogLevel={}))[W.Silent=5]="Silent",W[W.Error=4]="Error",W[W.Warn=3]="Warn",W[W.Info=2]="Info",W[W.Debug=1]="Debug",W[W.Trace=0]="Trace",e.ApplicationHandleResult=void 0,(K=e.ApplicationHandleResult||(e.ApplicationHandleResult={}))[K.Unprocessed=0]="Unprocessed",K[K.Agree=1]="Agree",K[K.Reject=-1]="Reject",e.MessageType=void 0,(Q=e.MessageType||(e.MessageType={}))[Q.TextMessage=101]="TextMessage",Q[Q.PictureMessage=102]="PictureMessage",Q[Q.VoiceMessage=103]="VoiceMessage",Q[Q.VideoMessage=104]="VideoMessage",Q[Q.FileMessage=105]="FileMessage",Q[Q.AtTextMessage=106]="AtTextMessage",Q[Q.MergeMessage=107]="MergeMessage",Q[Q.CardMessage=108]="CardMessage",Q[Q.LocationMessage=109]="LocationMessage",Q[Q.CustomMessage=110]="CustomMessage",Q[Q.TypingMessage=113]="TypingMessage",Q[Q.QuoteMessage=114]="QuoteMessage",Q[Q.FaceMessage=115]="FaceMessage",Q[Q.FriendAdded=1201]="FriendAdded",Q[Q.OANotification=1400]="OANotification",Q[Q.GroupCreated=1501]="GroupCreated",Q[Q.MemberQuit=1504]="MemberQuit",Q[Q.GroupOwnerTransferred=1507]="GroupOwnerTransferred",Q[Q.MemberKicked=1508]="MemberKicked",Q[Q.MemberInvited=1509]="MemberInvited",Q[Q.MemberEnter=1510]="MemberEnter",Q[Q.GroupDismissed=1511]="GroupDismissed",Q[Q.GroupMemberMuted=1512]="GroupMemberMuted",Q[Q.GroupMemberCancelMuted=1513]="GroupMemberCancelMuted",Q[Q.GroupMuted=1514]="GroupMuted",Q[Q.GroupCancelMuted=1515]="GroupCancelMuted",Q[Q.GroupAnnouncementUpdated=1519]="GroupAnnouncementUpdated",Q[Q.GroupNameUpdated=1520]="GroupNameUpdated",Q[Q.BurnMessageChange=1701]="BurnMessageChange",Q[Q.RevokeMessage=2101]="RevokeMessage",e.SessionType=void 0,(z=e.SessionType||(e.SessionType={}))[z.Single=1]="Single",z[z.Group=3]="Group",z[z.Notification=4]="Notification",function(e){e[e.Nomal=0]="Nomal",e[e.Baned=1]="Baned",e[e.Dismissed=2]="Dismissed",e[e.Muted=3]="Muted"}(e.GroupStatus||(e.GroupStatus={})),e.GroupAtType=void 0,(Y=e.GroupAtType||(e.GroupAtType={}))[Y.AtNormal=0]="AtNormal",Y[Y.AtMe=1]="AtMe",Y[Y.AtAll=2]="AtAll",Y[Y.AtAllAtMe=3]="AtAllAtMe",Y[Y.AtGroupNotice=4]="AtGroupNotice",e.GroupMemberFilter=void 0,(X=e.GroupMemberFilter||(e.GroupMemberFilter={}))[X.All=0]="All",X[X.Owner=1]="Owner",X[X.Admin=2]="Admin",X[X.Nomal=3]="Nomal",X[X.AdminAndNomal=4]="AdminAndNomal",X[X.AdminAndOwner=5]="AdminAndOwner",e.Relationship=void 0,($=e.Relationship||(e.Relationship={}))[$.isBlack=0]="isBlack",$[$.isFriend=1]="isFriend",e.LoginStatus=void 0,(Z=e.LoginStatus||(e.LoginStatus={}))[Z.Logout=1]="Logout",Z[Z.Logging=2]="Logging",Z[Z.Logged=3]="Logged",e.OnlineState=void 0,(ee=e.OnlineState||(e.OnlineState={}))[ee.Online=1]="Online",ee[ee.Offline=0]="Offline",e.ViewType=void 0,(te=e.ViewType||(e.ViewType={}))[te.ViewHistory=0]="ViewHistory",te[te.ViewSearch=1]="ViewSearch";var oe=function(){return(36*Math.random()).toString(36).slice(2)+(new Date).getTime().toString()},ie=function(e){var t=(new Date).getTime().toString(),n=Math.floor(Math.random()*(new Date).getTime());return a.default.hash(t+e+n)},se=function(t){if(t.sessionType===e.SessionType.Single){var n=[t.sendID,t.recvID].sort();return"si_"+n[0]+"_"+n[1]}return t.sessionType===e.SessionType.Group?"sg_"+t.groupID:t.sessionType===e.SessionType.Notification?"sn_"+t.sendID+"_"+t.recvID:""},ae=function(t){if(t.sessionType===e.SessionType.Single){var n=[t.sourceID,t.userID].sort();return"si_"+n[0]+"_"+n[1]}return t.sessionType===e.SessionType.Group?"sg_"+t.sourceID:t.sessionType===e.SessionType.Notification?"sn_"+t.sourceID+"_"+t.userID:""},ue=function(e,t){return!(t in e&&!e[t])},ce=((ne={})[e.ReqIdentifier.GetNewestSeq]=o.PbCoder.GetMaxSeqResp.decode,ne[e.ReqIdentifier.PullMsgByRange]=o.PbCoder.PullMessageBySeqsResp.decode,ne[e.ReqIdentifier.SendMsg]=o.PbCoder.UserSendMsgResp.decode,ne[e.ReqIdentifier.PullMsgBySeqList]=o.PbCoder.GetSeqMessageResp.decode,ne[e.ReqIdentifier.PushMsg]=o.PbCoder.PushMessages.decode,ne[e.ReqIdentifier.SetBackgroundStatus]=o.PbCoder.SetAppBackgroundStatusResp.decode,ne[e.ReqIdentifier.WsSubUserOnlineStatus]=o.PbCoder.SubUserOnlineStatusTips.decode,ne[e.ReqIdentifier.GetConvMaxReadSeq]=o.PbCoder.GetConversationsHasReadAndMaxSeqResp.decode,ne[C.GetActiveConversations]=o.PbCoder.GetActiveConversationsResp.decode,ne[C.GetDesignatedConversation]=o.PbCoder.GetConversationsResp.decode,ne),de=function(e,t){if(!e)return null;var n=r.decode(e),o=ce[t];return o?o(new Uint8Array(n)):null},ge=function(t,n,r){var o=(new Date).getTime(),i=t.userTrigger.cache.getSelfUserInfo();return{clientMsgID:ie(t.userID),createTime:o,sendTime:o,sessionType:0,sendID:t.userID,msgFrom:n,contentType:r,senderPlatformID:t.platform,senderNickname:null==i?void 0:i.nickname,senderFaceUrl:null==i?void 0:i.faceURL,seq:0,isRead:!1,status:e.MessageStatus.Sending}},pe=function(e){return e.sort(function(e,t){return e.isPinned===t.isPinned?e.latestMsgSendTime>t.latestMsgSendTime?-1:e.latestMsgSendTime<t.latestMsgSendTime?1:0:e.isPinned&&!t.isPinned?-1:1})},le=/*#__PURE__*/function(e){function t(t,n){var r;return(r=e.call(this,n)||this).errCode=void 0,r.name=r.constructor.name,r.errCode=t,Error.captureStackTrace&&Error.captureStackTrace(r,r.constructor),r}return v(t,e),t}(/*#__PURE__*/M(Error)),fe=function(t,n,r,o){var i={event:n,operationID:r,data:null,errMsg:"",errCode:0};return t===e.LoginStatus.Logout?Promise.reject(l({},i,{errCode:e.ErrorCode.ResourceLoadNotCompleteError,errMsg:"Resource load not complete"})):o().then(function(e){return void 0===e&&(e=null),l({},i,{data:e})}).catch(function(t){return l({},i,{errCode:t.errCode||e.ErrorCode.SdkInternalError,errMsg:t.message||"Internal Error"})})},ve="UTF-8",he="ASCII",me=ve,Ie=65533,Me=function(e,t){if(e<128)t.push(e);else for(var n=[127,2047,65535,2097151],r=0;;){if(++r===n.length)return console.error("UTF-8 Write - attempted to encode illegally high code point - "+e),void Me(Ie,t);if(e<=n[r]){r+=1;var o=0,i=void 0;for(i=0;i<r;i++)o<<=1,o|=1;for(o<<=8-r,t.push(o|=e>>6*(r-1)),i=1;i<r;i++)o=128,t.push(o|=e>>6*(r-(i+1))&191);return}}},ye=function(e,t,n,r){var o=t.getUint8(n);if(e.bytesRead=1,e.charVal=0,128&o){for(var i=0,s=o;128&s;)i++,s<<=1;if(1===i)return console.error("UTF-8 read - found continuation byte at beginning of character"),void(e.charVal=Ie);if(i>r)return console.error("UTF-8 read - attempted to read "+i+" byte character, "+(r-i)+" bytes past end of buffer"),void(e.charVal=Ie);e.charVal=o&255>>i+1;for(var a=1;a<i;a++){if(128!=(192&(s=t.getUint8(n+a))))return console.error("UTF-8 read - attempted to read "+i+" byte character, found non-continuation at byte "+a),e.charVal=Ie,void(e.bytesRead=1);if(e.charVal<<=6,e.charVal|=63&s,!(1!==a||e.charVal>>8-(i+1)-1))return console.error("UTF-8 read - found overlong encoding"),e.charVal=Ie,void(e.bytesRead=1);e.bytesRead++}if(e.charVal>1114111)return console.error("UTF-8 read - found illegally high code point "+e.charVal),e.charVal=Ie,void(e.bytesRead=1)}else e.charVal=o},De=function(e){for(var t=[],n=0;n<e.length;n++)Me(e.charCodeAt(n),t);return t},Ce=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r>255&&(r="?".charCodeAt(0)),t.push(r)}return t},Se=function(e,t,n,r){var o=void 0===n,i=t||0;if(!o&&i+n>e.byteLength)throw new Error("Attempted to read "+(i+n-e.byteLength)+" bytes past end of buffer");for(var s=[],a={};i<e.byteLength&&(o||n>i-t)&&(ye(a,e,i,o?e.byteLength-(i+t):n-(i-t)),i+=a.bytesRead,!o||a.charVal!==r);)s.push(String.fromCharCode(a.charVal));return{str:s.join(""),byteLength:i-t}},Te=function(e,t,n,r){var o=[],i=0;t=t||0;var s=!1;void 0===n&&(s=!0,n=e.byteLength-e.byteOffset);for(var a=0;a<n;a++){var u=e.getUint8(a+t);if(i++,s&&u===r)break;o.push(String.fromCharCode(u))}return{str:o.join(""),byteLength:i}},be=/*#__PURE__*/g("readString"),Ae=/*#__PURE__*/g("writeString"),Re=/*#__PURE__*/g("checkEncoding");function Pe(e){if(void 0===e&&(e=me),!c(this,Ae)[Ae].has(e))throw new Error("Unknown string encoding '"+e+"'");return e}var Ge,Ne=new(/*#__PURE__*/function(){function e(){Object.defineProperty(this,Re,{value:Pe}),Object.defineProperty(this,be,{writable:!0,value:new Map([[he,Te],[ve,Se]])}),Object.defineProperty(this,Ae,{writable:!0,value:new Map([[he,Ce],[ve,De]])})}var t=e.prototype;return t.addStringCodec=function(e,t,n){c(this,be)[be].put(e,t),c(this,Ae)[Ae].put(e,n)},t.stringByteLength=function(e,t){return t=c(this,Re)[Re](t),c(this,Ae)[Ae].get(t)(e).length},t.getString=function(e,t,n,r){return this.getStringData(e,t,n,r).str},t.getStringData=function(e,t,n,r){return r=c(this,Re)[Re](r),n||(n=e.byteLength-t),c(this,be)[be].get(r)(e,t,n)},t.getStringNT=function(e,t,n,r){return void 0===r&&(r=0),this.getStringDataNT(e,t,n,r).str},t.getStringDataNT=function(e,t,n,r){return void 0===r&&(r=0),n=c(this,Re)[Re](n),c(this,be)[be].get(n)(e,t,void 0,r)},t.setString=function(e,t,n,r){r=c(this,Re)[Re](r);var o,i=c(this,Ae)[Ae].get(r)(n);for(o=0;o<i.length&&t+o<e.byteLength;o++)e.setUint8(t+o,i[o]);return o},t.setStringNT=function(e,t,n,r){var o=this.setString(e,t,n,r);return t+o>=e.byteLength&&(o-=1),e.setUint8(t+o,0),o+1},e}()),qe=function(e){return(new TextDecoder).decode(e)},Ee=function(e){return(new TextEncoder).encode(e)};!function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"}(Ge||(Ge={}));var we,Ue=/*#__PURE__*/function(){function e(e,t,n,r,o,i,s,a,u,c){var d=this,g=this;void 0===a&&(a=5e3),void 0===u&&(u=Infinity),this.url=void 0,this.onMessage=void 0,this.onClose=void 0,this.onReconnecting=void 0,this.onReconnectFailed=void 0,this.onReconnectSuccess=void 0,this.reconnectInterval=void 0,this.maxReconnectAttempts=void 0,this.ws=void 0,this.connectParams=void 0,this.reconnectAttempts=void 0,this.shouldReconnect=void 0,this.isProcessingMessage=!1,this.consecutiveHeartbeatFailures=0,this.connectTimeoutId=null,this.platformNamespace=void 0,this.envListenersInstalled=!1,this.heartbeatConfig={interval:1e4,timeout:5e3,maxFailures:3},this.heartbeatWorker=null,this.legacyTimer=null,this.heartbeatTimeoutId=null,this.workerUrl=null,this.lastPongAt=0,this.forceImmediateReconnect=!1,this.checkPlatform=function(){if("undefined"!=typeof WebSocket)try{if("undefined"!=typeof window&&window.WebSocket)return"web";if("undefined"!=typeof global&&global.WebSocket)return"web"}catch(e){}return"undefined"!=typeof my&&"function"==typeof my.connectSocket?"my":"undefined"!=typeof uni&&"function"==typeof uni.connectSocket?"uni":"undefined"!=typeof wx&&"function"==typeof wx.connectSocket?"wx":"unknow"},this.urlFormat=function(){for(var e="?",t=0,n=Object.entries(g.connectParams);t<n.length;t++){var r=n[t];e+=r[0]+"="+r[1]+"&"}return g.url+e.slice(0,-1)},this.startHeartbeat=function(){if(g.heartbeatWorker&&g.stopHeartbeat(),g.consecutiveHeartbeatFailures=0,"undefined"!=typeof Worker)try{var e=new Blob(["\n let timerId = null;\n let heartbeatInterval;\n\n self.onmessage = (e) => {\n if (e.data.type === 'start') {\n heartbeatInterval = e.data.interval;\n if (timerId) return;\n \n timerId = self.setInterval(() => {\n self.postMessage({ type: 'ping' });\n }, heartbeatInterval);\n } else if (e.data.type === 'stop') {\n if (timerId) {\n self.clearInterval(timerId);\n timerId = null;\n }\n }\n };\n "],{type:"application/javascript"});g.workerUrl=URL.createObjectURL(e),g.heartbeatWorker=new Worker(g.workerUrl),g.heartbeatWorker.onmessage=function(e){"ping"===e.data.type&&g.sendPing()},g.heartbeatWorker.postMessage({type:"start",interval:g.heartbeatConfig.interval})}catch(e){g.heartbeatWorker=null,g.workerUrl&&(URL.revokeObjectURL(g.workerUrl),g.workerUrl=null),g.legacyTimer=setInterval(function(){g.sendPing()},g.heartbeatConfig.interval)}else g.legacyTimer=setInterval(function(){g.sendPing()},g.heartbeatConfig.interval)},this.connect=function(e){return void 0===e&&(e=1e4),"unknow"===g.platformNamespace?Promise.reject(new Error("WebSocket is not supported")):new Promise(function(t,n){if(g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),g.connectTimeoutId=setTimeout(function(){g.ws&&(g.ws.close(),g.onClose()),n(new Error("Connection timeout after "+e+"ms"))},e),g.ws&&g.ws.readyState!==Ge.CLOSED)g.ws.readyState===g.ws.OPEN?(g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),t()):(g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),n(new Error("WebSocket is in an unknown state")));else{var r=function(){g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),g.reconnectAttempts&&g.onReconnectSuccess(),g.reconnectAttempts=0,g.consecutiveHeartbeatFailures=0,g.lastPongAt=Date.now(),g.startHeartbeat(),t()},o=function(e){g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),n(e)};if("web"===g.platformNamespace)g.ws=new WebSocket(g.urlFormat()),g.ws.onopen=r,g.ws.onerror=o;else{var i={url:g.urlFormat(),complete:function(){}};"my"===g.platformNamespace&&(i.multiple=!0),"uni"===g.platformNamespace&&(g.ws=uni.connectSocket(i)),"wx"===g.platformNamespace&&(g.ws=wx.connectSocket(i)),"my"===g.platformNamespace&&(g.ws=my.connectSocket(i)),g.ws.onOpen(r),g.ws.onError(o)}g.setupEventListeners(),g.installEnvListeners()}})},this.setupEventListeners=function(){if(g.ws){var e=function(e){return g.onBinaryMessage(e.data)},t=function(e){if(g.shouldReconnect&&g.reconnectAttempts<g.maxReconnectAttempts){if(g.isProcessingMessage)return void setTimeout(function(){return t()},100);var n=function(){g.onReconnecting(),g.connectParams.operationID=oe(),g.connect().catch(function(){g.onReconnectFailed()}),g.reconnectAttempts++};if(g.forceImmediateReconnect)g.forceImmediateReconnect=!1,n();else{var r=Math.min(g.reconnectInterval*Math.pow(1.5,g.reconnectAttempts),6e4),o=.25*r*(2*Math.random()-1),i=Math.max(r+o,1e3);setTimeout(function(){n()},i)}}g.stopHeartbeat(),g.heartbeatTimeoutId&&(clearTimeout(g.heartbeatTimeoutId),g.heartbeatTimeoutId=null),g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null)};"web"===g.platformNamespace?(g.ws.onmessage=e,g.ws.onclose=t):(g.ws.onMessage(e),g.ws.onClose(t))}},this.onBinaryMessage=function(e){try{return"string"!=typeof e&&"my"===d.platformNamespace&&(e=e.data),"string"==typeof e&&"pong"===JSON.parse(e).type?(d.heartbeatTimeoutId&&(clearTimeout(d.heartbeatTimeoutId),d.heartbeatTimeoutId=null),d.consecutiveHeartbeatFailures=0,d.lastPongAt=Date.now(),Promise.resolve()):(d.isProcessingMessage=!0,Promise.resolve(d.onMessage(e,d.connectParams.operationID)).then(function(){d.isProcessingMessage=!1}))}catch(e){return Promise.reject(e)}},this.sendPing=function(){var e;if((null==(e=g.ws)?void 0:e.readyState)===Ge.OPEN){if(g.consecutiveHeartbeatFailures>=g.heartbeatConfig.maxFailures)return console.warn("Heartbeat failed "+g.consecutiveHeartbeatFailures+" times, closing connection"),g.ws.close(),g.onClose(),void g.stopHeartbeat();g.heartbeatTimeoutId&&clearTimeout(g.heartbeatTimeoutId),g.heartbeatTimeoutId=setTimeout(function(){var e;g.consecutiveHeartbeatFailures++,console.warn("Heartbeat timeout, consecutive failures: "+g.consecutiveHeartbeatFailures),g.consecutiveHeartbeatFailures>=g.heartbeatConfig.maxFailures&&(null==(e=g.ws)||e.close(),g.onClose(),g.stopHeartbeat())},g.heartbeatConfig.timeout);var t=JSON.stringify({type:"ping"});g.ws.send("web"===g.platformNamespace?t:{data:t})}else g.heartbeatTimeoutId&&(clearTimeout(g.heartbeatTimeoutId),g.heartbeatTimeoutId=null)},this.forceHealthCheck=function(e){void 0===e&&(e=!1),g.ws&&g.ws.readyState===Ge.OPEN&&(e&&(g.consecutiveHeartbeatFailures=Math.max(g.heartbeatConfig.maxFailures-1,0)),g.sendPing())},this.handleVisibilityChange=function(){try{"visible"===("undefined"!=typeof document?document.visibilityState:"visible")&&g.forceHealthCheck(!0)}catch(e){}},this.handleOnline=function(){if(!g.ws||g.ws.readyState!==Ge.OPEN)return g.reconnectAttempts=0,g.onReconnecting(),g.connectParams.operationID=oe(),void g.connect().catch(function(){g.onReconnectFailed()});var e=Date.now();g.lastPongAt&&e-g.lastPongAt>g.heartbeatConfig.interval+g.heartbeatConfig.timeout*g.heartbeatConfig.maxFailures&&g.forceHealthCheck(!0)},this.handleOffline=function(){g.stopHeartbeat()},this.installEnvListeners=function(){if(!g.envListenersInstalled&&"web"===g.platformNamespace)try{"undefined"!=typeof document&&document.addEventListener&&document.addEventListener("visibilitychange",g.handleVisibilityChange),"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("online",g.handleOnline),window.addEventListener("offline",g.handleOffline),window.addEventListener("pageshow",g.handleVisibilityChange),window.addEventListener("focus",g.handleVisibilityChange)),g.envListenersInstalled=!0}catch(e){}},this.removeEnvListeners=function(){if(g.envListenersInstalled&&"web"===g.platformNamespace){try{"undefined"!=typeof document&&document.removeEventListener&&document.removeEventListener("visibilitychange",g.handleVisibilityChange),"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("online",g.handleOnline),window.removeEventListener("offline",g.handleOffline),window.removeEventListener("pageshow",g.handleVisibilityChange),window.removeEventListener("focus",g.handleVisibilityChange))}catch(e){}g.envListenersInstalled=!1}},this.sendMessage=function(e){var t,n=Ee(JSON.stringify(e));(null==(t=g.ws)?void 0:t.readyState)===Ge.OPEN?g.ws.send("web"===g.platformNamespace?n:{data:Uint8Array.from(n).buffer}):console.error("WebSocket is not open. Message not sent.")},this.close=function(){var e;g.shouldReconnect=!1,g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),g.heartbeatTimeoutId&&(clearTimeout(g.heartbeatTimeoutId),g.heartbeatTimeoutId=null),(null==(e=g.ws)?void 0:e.readyState)===Ge.OPEN&&(g.ws.close(),g.onClose()),g.stopHeartbeat(),g.removeEnvListeners()},this.forceReconnect=function(e){if(void 0===e&&(e=!0),g.shouldReconnect=!0,g.reconnectAttempts=0,g.consecutiveHeartbeatFailures=0,e&&(g.forceImmediateReconnect=!0),!g.ws||g.ws.readyState===Ge.CLOSED)return g.onReconnecting(),g.connectParams.operationID=oe(),void g.connect().catch(function(){g.onReconnectFailed()});g.stopHeartbeat();try{g.ws.close()}catch(e){g.onReconnecting(),g.connectParams.operationID=oe(),g.connect().catch(function(){g.onReconnectFailed()})}},this.reset=function(){g.shouldReconnect=!0,g.reconnectAttempts=0,g.consecutiveHeartbeatFailures=0,g.connectTimeoutId&&(clearTimeout(g.connectTimeoutId),g.connectTimeoutId=null),g.heartbeatTimeoutId&&(clearTimeout(g.heartbeatTimeoutId),g.heartbeatTimeoutId=null),g.stopHeartbeat(),g.removeEnvListeners()},this.url=e,this.onMessage=n,this.onClose=r,this.onReconnecting=o,this.onReconnectFailed=i,this.onReconnectSuccess=s,this.reconnectInterval=a,this.maxReconnectAttempts=u,this.connectParams=t,this.reconnectInterval=a,this.maxReconnectAttempts=u,this.reconnectAttempts=0,this.shouldReconnect=!0,this.platformNamespace=this.checkPlatform(),c&&(this.heartbeatConfig=l({},this.heartbeatConfig,c))}return e.prototype.stopHeartbeat=function(){this.heartbeatTimeoutId&&(clearTimeout(this.heartbeatTimeoutId),this.heartbeatTimeoutId=null),this.heartbeatWorker&&(this.heartbeatWorker.postMessage({type:"stop"}),this.heartbeatWorker.terminate(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.heartbeatWorker=null),this.legacyTimer&&(clearInterval(this.legacyTimer),this.legacyTimer=null)},e}(),Fe=/*#__PURE__*/function(){function e(){this.events=void 0,this.events={}}var t=e.prototype;return t.emit=function(e,t){return this.events[e]&&this.events[e].forEach(function(e){return e(t)}),this},t.on=function(e,t){return this.events[e]?this.events[e].push(t):this.events[e]=[t],this},t.off=function(e,t){if(e&&"function"==typeof t&&this.events[e]){var n=this.events[e];if(!n||0===n.length)return;var r=n.findIndex(function(e){return e===t});-1!==r&&n.splice(r,1)}return this},e}(),Oe=["friendUser"],ke=["blackUserInfo"],Le=function(e){var t,n,r,o,i,s,a,u,c,d,g,p,l,f;return{createTime:null==(t=e.groupInfo)?void 0:t.createTime,creatorUserID:null==(n=e.groupInfo)?void 0:n.creatorUserID,ex:e.ex,groupFaceURL:null==(r=e.groupInfo)?void 0:r.faceURL,groupID:null==(o=e.groupInfo)?void 0:o.groupID,groupName:null==(i=e.groupInfo)?void 0:i.groupName,groupType:null==(s=e.groupInfo)?void 0:s.groupType,handleResult:e.handleResult,handleUserID:e.handleUserID,handledMsg:e.handleMsg,handledTime:e.handleTime,introduction:null==(a=e.groupInfo)?void 0:a.introduction,memberCount:null==(u=e.groupInfo)?void 0:u.memberCount,nickname:null==(c=e.userInfo)?void 0:c.nickname,notification:null==(d=e.groupInfo)?void 0:d.notification,ownerUserID:null==(g=e.groupInfo)?void 0:g.ownerUserID,reqMsg:e.reqMsg,reqTime:e.reqTime,joinSource:e.joinSource,status:null==(p=e.groupInfo)?void 0:p.status,userFaceURL:null==(l=e.userInfo)?void 0:l.faceURL,userID:null==(f=e.userInfo)?void 0:f.userID}},xe=function(t){return{clientMsgID:t.clientMsgID,serverMsgID:t.serverMsgID,createTime:t.createTime,sendTime:t.sendTime,sessionType:t.sessionType,sendID:t.sendID,recvID:t.recvID,msgFrom:t.msgFrom,contentType:t.contentType,senderPlatformID:t.senderPlatformID,senderNickname:t.senderNickname,senderFaceUrl:t.senderFaceURL,groupID:t.groupID,content:t.content.length?qe(t.content):"",seq:t.seq,isRead:t.isRead,status:e.InternalMessageStatus.MsgStatusSendSuccess,isExternalExtensions:!1,offlinePush:t.offlinePushInfo,attachedInfo:t.attachedInfo,ex:t.ex,localEx:""}},je=function(t){var n=l({},t);try{switch(t.contentType){case e.InternalContentType.Text:n.textElem=JSON.parse(n.content);break;case e.InternalContentType.Picture:n.pictureElem=JSON.parse(n.content);break;case e.InternalContentType.Sound:n.soundElem=JSON.parse(n.content);break;case e.InternalContentType.Video:n.videoElem=JSON.parse(n.content);break;case e.InternalContentType.File:n.fileElem=JSON.parse(n.content);break;case e.InternalContentType.AtText:n.atTextElem=JSON.parse(n.content);break;case e.InternalContentType.Location:n.locationElem=JSON.parse(n.content);break;case e.InternalContentType.Custom:case e.InternalContentType.CustomMsgNotTriggerConversation:case e.InternalContentType.CustomMsgOnlineOnly:n.customElem=JSON.parse(n.content);break;case