@tencentcloud/chat-uikit-engine 2.0.8 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,10 +28,6 @@ TUIChatEngine.login({
28
28
  userSig: 'your userSig',
29
29
  // 如果您需要发送图片、语音、视频、文件等富媒体消息,请设置为 true
30
30
  useUploadPlugin: true,
31
- // 本地审核可识别、处理不安全、不适宜的内容,为您的产品体验和业务安全保驾护航
32
- // 此功能为增值服务,请参考:https://cloud.tencent.com/document/product/269/79139
33
- // 如果您已购买内容审核服务,开启此功能请设置为 true
34
- useProfanityFilterPlugin: false
35
31
  });
36
32
  ```
37
33
 
package/index.d.ts CHANGED
@@ -182,10 +182,10 @@ interface UpdateMyProfileParams {
182
182
  adminForbidType?: TencentCloudChat.TYPES;
183
183
  level?: number;
184
184
  role?: number;
185
- profileCustomField?: Array<object>;
185
+ profileCustomField?: object[];
186
186
  }
187
187
  interface UserIDListParams {
188
- userIDList: Array<string>;
188
+ userIDList: string[];
189
189
  }
190
190
  interface SwitchUserStatusParams {
191
191
  displayOnlineStatus: boolean;
@@ -196,7 +196,7 @@ interface PinConversationParams {
196
196
  }
197
197
  interface MuteConversationParams {
198
198
  groupID?: string;
199
- userIDList?: Array<string>;
199
+ userIDList?: string[];
200
200
  messageRemindType: TencentCloudChat.TYPES;
201
201
  }
202
202
  interface SendMessageBasicParams {
@@ -204,7 +204,7 @@ interface SendMessageBasicParams {
204
204
  payload: any;
205
205
  cloudCustomData?: string;
206
206
  needReadReceipt?: boolean;
207
- receiverList?: Array<string>;
207
+ receiverList?: string[];
208
208
  }
209
209
  interface SendMessageParams extends SendMessageBasicParams {
210
210
  to?: string;
@@ -216,7 +216,7 @@ interface SendForwardMessageOptions extends SendMessageOptions {
216
216
  priority?: TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST | TencentCloudChat.TYPES.MSG_PRIORITY_LOW | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | TencentCloudChat.TYPES.MSG_PRIORITY_HIGH;
217
217
  cloudCustomData?: string;
218
218
  needReadReceipt?: boolean;
219
- receiverList?: Array<string>;
219
+ receiverList?: string[];
220
220
  };
221
221
  }
222
222
  interface OfflinePushInfo {
@@ -239,15 +239,14 @@ interface SendMessageOptions {
239
239
  messageControlInfo?: MessageControlInfo;
240
240
  }
241
241
  interface TranslateTextParams {
242
- sourceTextList: Array<string>;
243
- sourceLanguage: string;
244
- targetLanguage: string;
242
+ sourceTextList: string[];
243
+ sourceLanguage?: string;
245
244
  }
246
245
  interface SearchCloudMessagesParams {
247
- keywordList?: Array<string>;
246
+ keywordList?: string[];
248
247
  keywordListMatchType?: 'or' | 'and';
249
- senderUserIDList?: Array<string>;
250
- messageTypeList?: Array<string>;
248
+ senderUserIDList?: string[];
249
+ messageTypeList?: string[];
251
250
  conversationID?: string;
252
251
  timePosition?: number;
253
252
  timePeriod?: number;
@@ -277,13 +276,13 @@ interface GetGroupMessageReadParams {
277
276
  count: number;
278
277
  }
279
278
  interface GetMessageReactionsParams {
280
- messageList: Array<Message>;
279
+ messageList: Message[];
281
280
  maxUserCountPerReaction?: number;
282
281
  }
283
282
  interface ReactionInfo {
284
283
  reactionID: string;
285
284
  totalUserCount: number;
286
- partialUserList: Array<ReactionUserInfo>;
285
+ partialUserList: ReactionUserInfo[];
287
286
  }
288
287
  interface ReactionUserInfo {
289
288
  userID: string;
@@ -328,7 +327,7 @@ interface MJoinGroupParams {
328
327
  applyMessage?: string;
329
328
  }
330
329
  interface MKeyListParams {
331
- keyList: Array<string>;
330
+ keyList: string[];
332
331
  }
333
332
  interface MGetMemberListParams {
334
333
  count?: number;
@@ -336,14 +335,14 @@ interface MGetMemberListParams {
336
335
  filter?: number;
337
336
  }
338
337
  interface MGetMemberProfileParams {
339
- userIDList: Array<string>;
340
- memberCustomFieldFilter?: Array<string>;
338
+ userIDList: string[];
339
+ memberCustomFieldFilter?: string[];
341
340
  }
342
341
  interface MAddMemberParams {
343
- userIDList: Array<string>;
342
+ userIDList: string[];
344
343
  }
345
344
  interface MDeleteMemberParams {
346
- userIDList: Array<string>;
345
+ userIDList: string[];
347
346
  reason?: string;
348
347
  duration?: number;
349
348
  }
@@ -361,10 +360,10 @@ interface MSetMemberNameCardParams {
361
360
  }
362
361
  interface MSetMemberCustomFiledParams {
363
362
  userID?: string;
364
- memberCustomField: Array<any>;
363
+ memberCustomField: any[];
365
364
  }
366
365
  interface MMarkMemberParams {
367
- userIDList: Array<string>;
366
+ userIDList: string[];
368
367
  markType: number;
369
368
  enableMark: boolean;
370
369
  }
@@ -372,7 +371,7 @@ interface GroupServiceBasicParams {
372
371
  groupID: string;
373
372
  }
374
373
  interface GetGroupProfileParams extends GroupServiceBasicParams {
375
- groupCustomFieldFilter?: Array<string>;
374
+ groupCustomFieldFilter?: string[];
376
375
  }
377
376
  interface UpdateGroupParams extends GroupServiceBasicParams, MUpdateGroupParams {
378
377
  }
@@ -397,14 +396,14 @@ interface CreateGroupParams {
397
396
  avatar?: string;
398
397
  maxMemberNum?: number;
399
398
  joinOption: Partial<TencentCloudChat.TYPES>;
400
- memberList?: Array<GroupMemberItem>;
401
- groupCustomField?: Array<any>;
399
+ memberList?: GroupMemberItem[];
400
+ groupCustomField?: any[];
402
401
  isSupportTopic?: boolean;
403
402
  }
404
403
  interface GroupMemberItem {
405
404
  userID: string;
406
405
  role?: string;
407
- memberCustomField?: Array<any>;
406
+ memberCustomField?: any[];
408
407
  }
409
408
  interface handleGroupApplicationParams {
410
409
  handleAction: 'Agree' | 'Reject';
@@ -432,11 +431,11 @@ interface MarkMemberParams extends GroupServiceBasicParams, MMarkMemberParams {
432
431
  interface Friend {
433
432
  userID: string;
434
433
  remark: string;
435
- groupList: Array<any>;
434
+ groupList: any[];
436
435
  source: string;
437
436
  wording: string;
438
437
  profile: any;
439
- friendCustomFriend: Array<any>;
438
+ friendCustomFriend: any[];
440
439
  }
441
440
  interface FriendApplication {
442
441
  userID: string;
@@ -456,20 +455,20 @@ interface AddFriendParams {
456
455
  type?: TencentCloudChat.TYPES;
457
456
  }
458
457
  interface DeleteFriendParams {
459
- userIDList: Array<string>;
458
+ userIDList: string[];
460
459
  type?: TencentCloudChat.TYPES;
461
460
  }
462
461
  interface CheckFriendParams {
463
- userIDList: Array<string>;
462
+ userIDList: string[];
464
463
  type: Partial<TencentCloudChat.TYPES>;
465
464
  }
466
465
  interface GetFriendProfileParams {
467
- userIDList: Array<string>;
466
+ userIDList: string[];
468
467
  }
469
468
  interface UpdateFriendParams {
470
469
  userID: string;
471
470
  remark?: string;
472
- friendCustomField?: Array<any>;
471
+ friendCustomField?: any[];
473
472
  }
474
473
  interface AcceptFriendApplicationParams {
475
474
  userID: string;
@@ -599,7 +598,7 @@ interface IMessageHandler {
599
598
  interface ITUIChatService extends TUIBase {
600
599
  messageHandler: IMessageHandler;
601
600
  init: () => void;
602
- updateMessageList(messageList: Array<Message>, type: string): void;
601
+ updateMessageList(messageList: Message[], type: string): void;
603
602
  sendTextMessage(options: SendMessageParams, sendMessageOptions?: SendMessageOptions): Promise<any>;
604
603
  sendTextAtMessage(options: SendMessageParams, sendMessageOptions?: SendMessageOptions): Promise<any>;
605
604
  sendImageMessage(options: SendMessageParams, sendMessageOptions?: SendMessageOptions): Promise<any>;
@@ -612,20 +611,21 @@ interface ITUIChatService extends TUIBase {
612
611
  sendForwardMessage(conversationList: Array<Conversation | IConversationModel>, messageList: Array<Message | IMessageModel>, sendForwardMessageOptions?: SendForwardMessageOptions): Promise<any>;
613
612
  revokeMessage(message: Message): Promise<any>;
614
613
  resendMessage(message: Message): Promise<any>;
615
- deleteMessage(messageList: Array<Message>): Promise<any>;
616
- setMessageExtensions(message: Message, extensions: Array<object>): Promise<any>;
614
+ deleteMessage(messageList: Message[]): Promise<any>;
615
+ setMessageExtensions(message: Message, extensions: object[]): Promise<any>;
617
616
  getMessageExtensions(message: Message): Promise<any>;
618
- deleteMessageExtensions(message: Message, keyList?: Array<string>): Promise<any>;
617
+ deleteMessageExtensions(message: Message, keyList?: string[]): Promise<any>;
619
618
  modifyMessage(message: Message): Promise<any>;
620
619
  quoteMessage(message: Message): Message;
621
620
  replyMessage(message: Message): Message;
622
621
  enterTypingState(): void;
623
622
  leaveTypingState(): void;
624
- sendMessageReadReceipt(messageList: Array<IMessageModel>): Promise<any>;
623
+ sendMessageReadReceipt(messageList: IMessageModel[]): Promise<any>;
625
624
  getGroupMessageReadMemberList(options: GetGroupMessageReadParams): Promise<any>;
626
625
  getMessageList(options?: GetMessageListParams): Promise<any>;
627
626
  getMessageListHopping(options?: GetMessageListHoppingParams): Promise<any>;
628
627
  downloadMergedMessages(message: IMessageModel): Promise<any>;
628
+ setTranslationLanguage(language: string): void;
629
629
  translateText(options: TranslateTextParams): Promise<any>;
630
630
  searchCloudMessages(options: SearchCloudMessagesParams): Promise<any>;
631
631
  addMessageReaction(message: IMessageModel, reactionID: string): Promise<any>;
@@ -734,4 +734,4 @@ declare const tuiChat: ITUIChatService;
734
734
  declare const tuiGroup: ITUIGroupService;
735
735
  declare const tuiFriend: ITUIFriendService;
736
736
 
737
- export { AcceptFriendApplicationParams, AddFriendParams, AddMemberParams, ChangGroupOwnerParams, CheckFriendParams, CountersParams, CreateGroupParams, DeleteFriendApplicationParams, DeleteFriendParams, DeleteMemberParams, ForwardMessageParams, Friend, FriendApplication, GetAllUserListOfMessageReactionParams, GetFriendProfileParams, GetGroupMessageReadParams, GetGroupProfileParams, GetMemberListParams, GetMemberProfileParams, GetMessageListHoppingParams, GetMessageListParams, GetMessageReactionsParams, GroupAttrParams, GroupServiceBasicParams, IConversationModel, IGroupModel, IMessageModel, JoinGroupParams, KeyListParams, LoginParams, MAddMemberParams, MChangGroupOwnerParams, MCountersParams, MDeleteMemberParams, MGetMemberListParams, MGetMemberProfileParams, MGroupAttrParams, MJoinGroupParams, MKeyListParams, MMarkMemberParams, MSetCountersParams, MSetMemberCustomFiledParams, MSetMemberMuteParams, MSetMemberNameCardParams, MSetMemberRoleParams, MUpdateGroupParams, MarkMemberParams, MessageControlInfo, ModifyMessageParams, MuteConversationParams, OfflinePushInfo, PinConversationParams, ReactionInfo, SEARCH_TYPE, SearchCloudMessagesParams, SendForwardMessageOptions, SendMessageOptions, SendMessageParams, SetCountersParams, SetMemberCustomFiledParams, SetMemberMuteParams, SetMemberNameCardParams, SetMemberRoleParams, StoreName, SwitchUserStatusParams, tuiChat as TUIChatService, tuiConversation as TUIConversationService, tuiFriend as TUIFriendService, tuiGlobal as TUIGlobal, tuiGroup as TUIGroupService, tuiStore as TUIStore, tuiTranslate as TUITranslateService, tuiUser as TUIUserService, TranslateTextParams, UpdateFriendParams, UpdateGroupParams, UpdateMyProfileParams, UserIDListParams, TUIChatEngine as default, func, handleGroupApplicationParams };
737
+ export { AcceptFriendApplicationParams, AddFriendParams, AddMemberParams, ChangGroupOwnerParams, CheckFriendParams, CountersParams, CreateGroupParams, DeleteFriendApplicationParams, DeleteFriendParams, DeleteMemberParams, ForwardMessageParams, Friend, FriendApplication, GetAllUserListOfMessageReactionParams, GetFriendProfileParams, GetGroupMessageReadParams, GetGroupProfileParams, GetMemberListParams, GetMemberProfileParams, GetMessageListHoppingParams, GetMessageListParams, GetMessageReactionsParams, GroupAttrParams, GroupServiceBasicParams, IConversationModel, IGroupModel, IMessageModel, JoinGroupParams, KeyListParams, LoginParams, MAddMemberParams, MChangGroupOwnerParams, MCountersParams, MDeleteMemberParams, MGetMemberListParams, MGetMemberProfileParams, MGroupAttrParams, MJoinGroupParams, MKeyListParams, MMarkMemberParams, MSetCountersParams, MSetMemberCustomFiledParams, MSetMemberMuteParams, MSetMemberNameCardParams, MSetMemberRoleParams, MUpdateGroupParams, MarkMemberParams, MessageControlInfo, ModifyMessageParams, MuteConversationParams, OfflinePushInfo, PinConversationParams, ReactionInfo, SEARCH_TYPE, SearchCloudMessagesParams, SendForwardMessageOptions, SendMessageOptions, SendMessageParams, SetCountersParams, SetMemberCustomFiledParams, SetMemberMuteParams, SetMemberNameCardParams, SetMemberRoleParams, StoreName, SwitchUserStatusParams, TUIChatEngine, tuiChat as TUIChatService, tuiConversation as TUIConversationService, tuiFriend as TUIFriendService, tuiGlobal as TUIGlobal, tuiGroup as TUIGroupService, tuiStore as TUIStore, tuiTranslate as TUITranslateService, tuiUser as TUIUserService, TranslateTextParams, UpdateFriendParams, UpdateGroupParams, UpdateMyProfileParams, UserIDListParams, TUIChatEngine as default, func, handleGroupApplicationParams };
package/index.js CHANGED
@@ -1 +1 @@
1
- import e from"@tencentcloud/chat";import t from"tim-upload-plugin";import s from"tim-profanity-filter-plugin";function n(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(s[n[i]]=e[n[i]])}return s}function i(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{u(n.next(e))}catch(e){r(e)}}function a(e){try{u(n.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class r{constructor(e){return r.instance||(r.instance=this,this.engine=e,this.events={},this.bindIMEvents()),r.instance}addEvent(e,t){this.events[e]||(this.events[e]=new Map),this.events[e].set(t,1)}removeEvents(){Object.keys(this.events).forEach((e=>{this.events[e].clear()})),this.events={}}dispatch(e,t){if(this.events[e])for(const s of this.events[e].keys())s.call(this,t)}bindIMEvents(){this.engine.chat.on(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.on(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.on(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.on(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.on(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.on(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.on(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.on(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.on(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}unbindIMEvents(){this.engine.chat.off(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.off(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.off(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.off(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.off(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.off(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.off(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.off(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.off(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}onSDKReady(e){this.dispatch(this.engine.EVENT.SDK_READY,e.data)}onSDKNotReady(e){this.dispatch(this.engine.EVENT.SDK_NOT_READY,e.data)}onKickedOut(e){this.dispatch(this.engine.EVENT.KICKED_OUT,e.data)}onNetStateChange(e){this.dispatch(this.engine.EVENT.NET_STATE_CHANGE,e.data)}onReceiveMessage(e){this.dispatch(this.engine.EVENT.MESSAGE_RECEIVED,e.data)}onMessageModified(e){this.dispatch(this.engine.EVENT.MESSAGE_MODIFIED,e.data)}onMessageRevoked(e){this.dispatch(this.engine.EVENT.MESSAGE_REVOKED,e.data)}onMessageReadByPeer(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_BY_PEER,e.data)}onMessageReadReceiptReceived(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,e.data)}onMessageReactionsUpdated(e){this.dispatch(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,e.data)}onConversationListUpdated(e){this.dispatch(this.engine.EVENT.CONVERSATION_LIST_UPDATED,e.data)}onTotalMessageCountUpdated(e){this.dispatch(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,e.data)}onProfileUpdated(e){this.dispatch(this.engine.EVENT.PROFILE_UPDATED,e.data)}onBlacklistUpdated(e){this.dispatch(this.engine.EVENT.BLACKLIST_UPDATED,e.data)}onUserStatusUpdated(e){this.dispatch(this.engine.EVENT.USER_STATUS_UPDATED,e.data)}onGroupListUpdated(e){this.dispatch(this.engine.EVENT.GROUP_LIST_UPDATED,e.data)}onGroupAttributesUpdated(e){this.dispatch(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,e.data)}onGroupCounterUpdated(e){this.dispatch(this.engine.EVENT.GROUP_COUNTER_UPDATED,e.data)}onFriendListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_LIST_UPDATED,e.data)}onFriendApplicationListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,e.data)}}var o,a,u,c,g,l,h,p,d;!function(e){e.TUIStore="TUIStore",e.TUITranslate="TUITranslate",e.TUIConversation="TUIConversation",e.TUIChat="TUIChat",e.TUIGroup="TUIGroup",e.TUIUser="TUIUser",e.TUIFriend="TUIFriend"}(o||(o={})),function(e){e.APP="application",e.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",e.FRIEND="friend",e.SEARCH="search",e.CUSTOM="custom"}(a||(a={})),function(e){e[e.UNSUB_USER=-1]="UNSUB_USER"}(u||(u={})),function(e){e.BUSINESS_ID="user_typing_status",e[e.STATUS_START=1]="STATUS_START",e[e.STATUS_END=0]="STATUS_END",e[e.VERSION=1]="VERSION",e[e.ACTION_START_ID=14]="ACTION_START_ID",e[e.ACTION_END_ID=0]="ACTION_END_ID",e.ACTION_START="EIMAMSG_InputStatus_Ing",e.ACTION_END="EIMAMSG_InputStatus_End",e[e.NEED_TYPING=1]="NEED_TYPING"}(c||(c={})),function(e){e.ADD="add",e.REMOVE="remove"}(g||(g={})),function(e){e[e.MSG_MODIFY_CONFLICT=2480]="MSG_MODIFY_CONFLICT",e[e.MSG_MODIFY_DISABLED_IN_AVCHATROOM=2481]="MSG_MODIFY_DISABLED_IN_AVCHATROOM",e[e.MODIFY_MESSAGE_NOT_EXIST=20026]="MODIFY_MESSAGE_NOT_EXIST"}(l||(l={})),function(e){e[e.NOT_INIT=-1e5]="NOT_INIT",e[e.INVALID_CONV_ID=-100001]="INVALID_CONV_ID",e[e.CONV_ID_SAME=-100002]="CONV_ID_SAME",e[e.CONV_NOT_EXIST=-100003]="CONV_NOT_EXIST",e[e.GET_MSG_LIST_ERROR=-100004]="GET_MSG_LIST_ERROR",e[e.MISMATCH_TYPE_AND_PAYLOAD=-100005]="MISMATCH_TYPE_AND_PAYLOAD"}(h||(h={})),function(e){e.MSG_MODIFY_CONFLICT="MODIFY_MESSAGE_ERROR,修改消息发生冲突, data.message 是最新的消息",e.MSG_MODIFY_DISABLED_IN_AVCHATROOM="MODIFY_MESSAGE_ERROR,不支持修改直播群消息.",e.MODIFY_MESSAGE_NOT_EXIST="MODIFY_MESSAGE_ERROR,消息不存在."}(p||(p={})),function(e){e.NOT_INIT="TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。",e.INVALID_CONV_ID="会话 ID 无效",e.CONV_ID_SAME="您切换的是同一个会话 ID",e.CONV_NOT_EXIST="会话不存在",e.GET_MSG_LIST_ERROR="Chat SDK is not ready.",e.MISMATCH_TYPE_AND_PAYLOAD="type 与 payload 不匹配."}(d||(d={}));const f={logout:1,destroy:1},m={deleteConversation:1,pinConversation:1,muteConversation:1,switchConversation:1,getConversationProfile:1,clearHistoryMessage:1},E={modifyMessage:1,revokeMessage:1,resendMessage:1,deleteMessage:1,quoteMessage:1,replyMessage:1,setMessageExtensions:1,deleteMessageExtensions:1,getMessageExtensions:1,sendTextMessage:1,sendTextAtMessage:1,sendImageMessage:1,sendAudioMessage:1,sendVideoMessage:1,sendFileMessage:1,sendCustomMessage:1,sendFaceMessage:1,sendLocationMessage:1,sendForwardMessage:1,enterTypingState:1,leaveTypingState:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageList:1,downloadMergedMessages:1,translateText:1,searchCloudMessages:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1},v={switchGroup:1,getGroupProfile:1,updateGroupProfile:1,createGroup:1,dismissGroup:1,searchGroupByID:1,joinGroup:1,quitGroup:1,getGroupApplicationList:1,handleGroupApplication:1,getGroupOnlineMemberCount:1,changeGroupOwner:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getGroupMemberList:1,getGroupMemberProfile:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberNameCard:1,setGroupMemberCustomField:1,markGroupMemberList:1},T={switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1,addToBlacklist:1,removeFromBlacklist:1},I={getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,getFriendProfile:1,updateFriend:1,acceptFriendApplication:1,refuseFriendApplication:1,deleteFriendApplication:1,setFriendApplicationRead:1},S=function(e){return void 0===e},y=function(e){return e.startsWith("_")},b=function(e){return/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(e)};const M=function(e){return e&&function(e){if("string"==typeof e)try{return!!JSON.parse(e)}catch(e){return!1}return!1}(e)?JSON.parse(e):e},U=function(e){let t="";return t=e>=1048576?`${(e/1048576).toFixed(2)} Mb`:e>=1024?`${(e/1024).toFixed(2)} Kb`:`${e.toFixed(2)}B`,t},O="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",C="https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.svg",D="https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png",_="https://web.sdk.qcloud.com/im/assets/emoji-plugin/",P="https://web.sdk.qcloud.com/im/assets/face-elem/",R="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&",j="https://apis.map.qq.com/ws/staticmap/v2/?",L={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"},A={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},G={enabledMessageReadReceipt:Math.pow(2,5),enabledEmojiPlugin:Math.pow(2,48),enabledOnlineStatus:Math.pow(2,7),enabledCustomerServicePlugin:Math.pow(2,40)},N=["messageList","conversationList","newMessageList"],k="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),x="undefined"!=typeof uni&&"undefined"==typeof window,w=k||x,V="undefined"!=typeof uni,F=("undefined"!=typeof uni||"undefined"!=typeof window)&&!w,$=k?wx:V?uni:window,H=F&&window&&window.navigator&&window.navigator.userAgent||"",Y=/Android/i.test(H),B=/(?:Windows Phone)/.test(H),K=/(?:SymbianOS)/.test(H),q=/iPad/i.test(H)||/iPhone/i.test(H)||/iPod/i.test(H),z=Y||B||K||q,J=F&&!z;class W{constructor(){this.global=$,this.isOfficial=!1}static getInstance(){return W.instance||(W.instance=new W),W.instance}initOfficial(e){this.isOfficial=e}getPlatform(){let e="";return J?e="pc":z?e="h5":k?e="wechat":x&&!k&&(e="app"),e}}const X="group-module",Z="relationship-module";class Q{constructor(){this.EVENT=e.EVENT,this.TYPES=e.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return Q.instance||(Q.instance=new Q),Q.instance}mount(e,t){this[e]=t}login(t){const{chat:s,SDKAppID:n,userID:i}=t,o=1400187352===n||1400188366===n;return this.createChat(t),this.userID=i,W.getInstance().initOfficial(o),this.TUIStore.update(a.APP,"isOfficial",o),this.TUIStore.update(a.APP,"SDKVersion",e.VERSION),this.eventCenter=new r(this),this.eventCenter.removeEvents(),this.initStore(),this.initService(),s&&s.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),this.checkCommercialAbility(),Promise.resolve({})):(this.registerPlugin(t),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(t))}logout(){return this.userID="",this.isInited=!1,this.chat.logout()}isReady(){var e;return(null===(e=this.chat)||void 0===e?void 0:e.isReady())||!1}setLogLevel(e){if(this.chat)return this.chat.setLogLevel(e);console.warn("TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。")}destroy(){return this.eventCenter.unbindIMEvents(),this.isInited=!1,this.chat.destroy()}getMyUserID(){return this.userID}initStore(){this.TUIStore.reset(a.CHAT),this.TUIStore.reset(a.CONV),this.TUIStore.reset(a.GRP),this.TUIStore.reset(a.USER),this.TUIStore.reset(a.SEARCH),console.log("TUIChatEngine.initStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIUser.init(),this.initOptionalServices(),this.isInited=!0,console.log("TUIChatEngine.initService ok.")}initOptionalServices(){const t=e.VERSION.split(".");t[0]>3||3===t[0]&&t[1]>=3&&t[2]>0?(!0===this.chat.callExperimentalAPI("canIUseModule",[X])&&this.TUIGroup.init(),!0===this.chat.callExperimentalAPI("canIUseModule",[Z])&&this.TUIFriend.init()):(this.TUIGroup.init(),this.TUIFriend.init())}createChat(t){const{chat:s}=t,i=n(t,["chat"]);S(s)?this.chat=e.create(Object.assign(Object.assign({},i),{scene:"chat-uikit-engine"})):this.chat=s}loginChat(e){const{userID:t,userSig:s}=e;return new Promise(((e,n)=>{this.chat.login({userID:t,userSig:s}).then((t=>{console.log("TUIChatEngine.loginChat ok."),this.checkCommercialAbility(),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:n,imResponse:t})})).catch((e=>{n(e)}))}))}registerPlugin(e){const{useUploadPlugin:n=!1,useProfanityFilterPlugin:i=!1,TIMPush:r,pushConfig:o,TUIOfflinePush:a,offlinePushConfig:u}=e;!0===n&&this.chat.registerPlugin({"tim-upload-plugin":t}),!0===i&&this.chat.registerPlugin({"tim-profanity-filter-plugin":s}),!x||k||S(r)||S(o)||this.chat.registerPlugin({"tim-push":r,pushConfig:o}),!x||k||S(a)||S(u)||this.chat.registerPlugin({"tim-offline-push-plugin":a,offlinePushConfig:u})}onSDKReady(){if(this.loginStatusPromise.has("login")){const e=this.loginStatusPromise.get("login");e.resolve(e.imResponse),this.TUIUser.getUserProfile()}this.loginStatusPromise.delete("login")}onSDKNotReady(){if(this.loginStatusPromise.has("login")){this.loginStatusPromise.get("login").reject(new Error("sdk not ready"))}this.loginStatusPromise.delete("login")}checkCommercialAbility(){Object.keys(G).forEach((e=>{const t=G[e];this.chat.callExperimentalAPI("isCommercialAbilityEnabled",t).then((t=>{const{enabled:s=!1}=t.data;this.TUIStore.update(a.APP,e,s)}))}))}}class ee{constructor(){this.defaultStore={enabledMessageReadReceipt:!1,enabledEmojiPlugin:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enableTyping:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1}},this.store={enabledEmojiPlugin:!1,enabledMessageReadReceipt:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enableTyping:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1}}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class te{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[]},this.store={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[]}}update(e,t){if("userStatusList"===e)this.updateUserStatusList(t);else this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateUserStatusList(e){0!==e.length?e.forEach((e=>{const{userID:t,statusType:s=0,customStatus:n=""}=e;s===u.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:s,customStatus:n})})):this.store.userStatusList.clear()}}class se{getEngine(){return Q.getInstance()}}const ne=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let s=t;for(;null!==Object.getPrototypeOf(s);)s=Object.getPrototypeOf(s);return t===s}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1};class ie extends se{constructor(e){super(),this.initProxy(e),this.isMuted=this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_ACPT_NOT_NOTE||this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_DISCARD,this.operationType=0,this._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}updateProperties(e){this._conversation=e,Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}getConversation(){return this._conversation}deleteConversation(){return this.getEngine().TUIConversation.deleteConversation(this.conversationID)}pinConversation(){return this.getEngine().TUIConversation.pinConversation({conversationID:this.conversationID,isPinned:!this.isPinned})}muteConversation(){const e=this.getEngine(),t={messageRemindType:!0===this.isMuted?e.TYPES.MSG_REMIND_ACPT_AND_NOTE:e.TYPES.MSG_REMIND_ACPT_NOT_NOTE};if(this.type===e.TYPES.CONV_C2C){const s=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[s]}else if(this.type===e.TYPES.CONV_GROUP){const s=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=s}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,s,n,i,r;const o=this.getEngine();let a="";switch(this.type){case o.TYPES.CONV_C2C:a=b(null===(e=this.userProfile)||void 0===e?void 0:e.avatar)?null===(t=this.userProfile)||void 0===t?void 0:t.avatar:O;break;case o.TYPES.CONV_GROUP:a=b(null===(s=this.groupProfile)||void 0===s?void 0:s.avatar)?null===(n=this.groupProfile)||void 0===n?void 0:n.avatar:C;break;case o.TYPES.CONV_SYSTEM:a=b(null===(i=this.groupProfile)||void 0===i?void 0:i.avatar)?null===(r=this.groupProfile)||void 0===r?void 0:r.avatar:D}return a}getShowName(){var e,t,s,n;const i=this.getEngine();let r="";switch(this.type){case i.TYPES.CONV_C2C:r=this.remark||(null===(e=this.userProfile)||void 0===e?void 0:e.nick)||(null===(t=this.userProfile)||void 0===t?void 0:t.userID)||"";break;case i.TYPES.CONV_GROUP:r=(null===(s=this.groupProfile)||void 0===s?void 0:s.name)||(null===(n=this.groupProfile)||void 0===n?void 0:n.groupID)||"";break;case i.TYPES.CONV_SYSTEM:r=i.TUITranslate.t("系统通知")}return r}getGroupAtInfo(){const e=this.getEngine(),t=e.TUITranslate.t.bind(e.TUITranslate),s=[`[${t("TUIConversation.有人@我")}]`,`[${t("TUIConversation.@所有人")}]`,`[${t("TUIConversation.@所有人")}][${t("TUIConversation.有人@我")}]`];let n="";for(let e=0;e<this.groupAtInfoList.length;e++)this.groupAtInfoList[e].atTypeArray[0]&&this.unreadCount>0&&(n=s[this.groupAtInfoList[e].atTypeArray[0]-1]);return n}getLastMessage(e){return"time"===e?this.getLastMessageTime():"text"===e?this.getLastMessageText():(console.warn(`ConversationModel.getLastMessage key:${e} is invalid.`),null)}getLastMessageTime(){var e;const t=this.getEngine();let s="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(s=function(e,t){const s=6e4,n=36e5,i=24*n,r=7*i,o=(new Date).getTime()-e;let a="";if(o<0)return a;const u=o/s,c=o/n,g=o/i,l=o/r;if(l>=1&&l<=4)a=` ${parseInt(`${l}`,10)} ${t("time.周")}${t("time.前")}`;else if(g>=1&&g<=6)a=` ${parseInt(`${g}`,10)} ${t("time.天")}${t("time.前")}`;else if(c>=1&&c<=23)a=` ${parseInt(`${c}`,10)} ${t("time.小时")}${t("time.前")}`;else if(u>=1&&u<=59)a=` ${parseInt(`${u}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(o>=0&&o<=s)a=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),a=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return a}(1e3*this.lastMessage.lastTime,t.TUITranslate.t.bind(t.TUITranslate))),s}getLastMessageText(){var e;const t=this.getEngine(),s=t.TUITranslate.t.bind(t.TUITranslate);if(4===this.operationType)return s("TUIConversation.您已被群管理员移出群聊");if(5===this.operationType)return s("TUIConversation.该群聊已被解散");if(8===this.operationType)return s("TUIConversation.您已退出该群聊");const n=this._conversation,i=this.lastMessage;let r="",o="";const a=n.unreadCount>0&&n.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?s(`[${n.unreadCount>99?"99+":n.unreadCount}条]`):"";if(n.type===t.TYPES.CONV_GROUP)if(i.fromAccount===t.getMyUserID())r=s("TUIConversation.我");else{const e=i.fromAccount;r=t.TUIFriend.getFriendRemark([e])[e]||i.nameCard||i.nick||e}if(i.type===t.TYPES.MSG_TEXT)o=this.decodeTextMessage(i.payload.text);else if(i.type===t.TYPES.MSG_CUSTOM){const s=M(null===(e=null==i?void 0:i.payload)||void 0===e?void 0:e.data);if(1===(null==s?void 0:s.businessID))return o=t.TUIChat.messageHandler.handleCallKitSignaling(i),o;o=i.messageForShow}else o=i.messageForShow;return i.isRevoked&&(o=s("TUIChat.撤回了一条消息")),n.type===t.TYPES.CONV_GROUP&&i.type===t.TYPES.MSG_GRP_TIP?o:`${a}${r?`${r}:`:""}${o}`}decodeTextMessage(e){if(ne(e))return e;const t=/(\[.+?\])/g;let s=e;return t.test(e)&&(s=e.replace(t,(e=>A[e]||e))),s}}class re{constructor(){this.defaultStore={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null},this.store={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null}}update(e,t){if("conversationList"===e)this.updateConversationList(t);else this.store[e]=t}getData(e){return this.store[e]}getModel(e){return this.store.conversationList.find((t=>t.conversationID===e))}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateConversationList(e){const t=[];e.forEach((e=>{let s=e;e instanceof ie?s.updateProperties(e):s=new ie(e),t.push(s)})),this.store.conversationList=t}}class oe extends se{constructor(e){super(),this.messageHandlers={[this.getEngine().TYPES.MSG_TEXT]:e=>this.getEngine().TUIChat.messageHandler.handleTextMessage(e),[this.getEngine().TYPES.MSG_FACE]:e=>this.getEngine().TUIChat.messageHandler.handleFaceMessage(e),[this.getEngine().TYPES.MSG_LOCATION]:e=>this.getEngine().TUIChat.messageHandler.handleLocationMessage(e),[this.getEngine().TYPES.MSG_IMAGE]:e=>this.getEngine().TUIChat.messageHandler.handleImageMessage(e),[this.getEngine().TYPES.MSG_AUDIO]:e=>this.getEngine().TUIChat.messageHandler.handleAudioMessage(e),[this.getEngine().TYPES.MSG_VIDEO]:e=>this.getEngine().TUIChat.messageHandler.handleVideoMessage(e),[this.getEngine().TYPES.MSG_FILE]:e=>this.getEngine().TUIChat.messageHandler.handleFileMessage(e),[this.getEngine().TYPES.MSG_CUSTOM]:e=>this.getEngine().TUIChat.messageHandler.handleCustomMessage(e),[this.getEngine().TYPES.MSG_MERGER]:e=>this.getEngine().TUIChat.messageHandler.handleMergeMessage(e),[this.getEngine().TYPES.MSG_GRP_TIP]:e=>this.getEngine().TUIChat.messageHandler.handleGroupTipsMessage(e)},this._message=e,this._signalingInfo=void 0,this.progress=0,this.reactionList=[],this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}getMessage(){return this._message}modifyMessage(e){return e.type&&this._message.type!==e.type&&!e.payload?Promise.reject({code:h.MISMATCH_TYPE_AND_PAYLOAD,message:d.MISMATCH_TYPE_AND_PAYLOAD}):(this._message.type=e.type||this._message.type,this._message.payload=e.payload||this._message.payload,this._message.cloudCustomData=e.cloudCustomData||this._message.cloudCustomData,this.getEngine().TUIChat.modifyMessage(this._message))}revokeMessage(){return this.getEngine().TUIChat.revokeMessage(this._message)}resendMessage(){return this.getEngine().TUIChat.resendMessage(this._message)}deleteMessage(){return this.getEngine().TUIChat.deleteMessage([this._message])}quoteMessage(){return this.getEngine().TUIChat.quoteMessage(this._message)}replyMessage(){return this.getEngine().TUIChat.replyMessage(this._message)}setMessageExtensions(e){return this.getEngine().TUIChat.setMessageExtensions(this._message,e)}getMessageExtensions(){return this.getEngine().TUIChat.getMessageExtensions(this._message)}deleteMessageExtensions(e){return this.getEngine().TUIChat.deleteMessageExtensions(this._message,e)}getSignalingInfo(){return this.type!==this.getEngine().TYPES.MSG_CUSTOM?null:S(this._signalingInfo)?(this._signalingInfo=this.getEngine().chat.getSignalingInfo(this._message),this._signalingInfo):this._signalingInfo}getMessageContent(){const e=this.messageHandlers[this.type];if(S(e))return{};if(this.type===this.getEngine().TYPES.MSG_GRP_TIP)return e(this._message);const t=this.getEngine().TUIFriend.getFriendRemark([this.from]);return Object.assign(Object.assign({},e(this._message)),{showName:t[this.from]||this.nameCard||this.nick||this.from})}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class ae{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0}}update(e,t){if("messageList"===e)this.updateMessageList(t);else this.store[e]=t}getData(e){return this.store[e]}getModel(e){return this.store.messageList.find((t=>t.ID===e))}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let s=e;e instanceof oe||(s=this.getModel(e.ID),s?s.updateProperties(e):s=new oe(e)),t.push(s)})),this.store.messageList=t}}class ue extends se{constructor(e){super(),this.groupAttributes={},this.groupCounters={},this.initProxy(e)}initProxy(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])})),this._group=e}getGroup(){return this._group}switchGroup(){return this.getEngine().TUIGroup.switchGroup(this.groupID)}getGroupProfile(e){return this.getEngine().TUIGroup.getGroupProfile({groupID:this.groupID,groupCustomFieldFilter:e})}updateGroupProfile(e){return this.getEngine().TUIGroup.updateGroupProfile(Object.assign({groupID:this.groupID},e))}joinGroup(e){return this.getEngine().TUIGroup.joinGroup({groupID:this.groupID,applyMessage:e})}quitGroup(){return this.getEngine().TUIGroup.quitGroup(this.groupID)}dismissGroup(){return this.getEngine().TUIGroup.dismissGroup(this.groupID)}getGroupOnlineMemberCount(){return this.getEngine().TUIGroup.getGroupOnlineMemberCount(this.groupID)}changeGroupOwner(e){return this.getEngine().TUIGroup.changeGroupOwner(Object.assign({groupID:this.groupID},e))}initGroupAttributes(e){return this.getEngine().TUIGroup.initGroupAttributes(Object.assign({groupID:this.groupID},e))}setGroupAttributes(e){return this.getEngine().TUIGroup.setGroupAttributes(Object.assign({groupID:this.groupID},e))}deleteGroupAttributes(e){return this.getEngine().TUIGroup.deleteGroupAttributes(Object.assign({groupID:this.groupID},e))}getGroupAttributes(e){return this.getEngine().TUIGroup.getGroupAttributes(Object.assign({groupID:this.groupID},e))}setGroupCounters(e){return this.getEngine().TUIGroup.setGroupCounters(Object.assign({groupID:this.groupID},e))}increaseGroupCounter(e){return this.getEngine().TUIGroup.increaseGroupCounter(Object.assign({groupID:this.groupID},e))}decreaseGroupCounter(e){return this.getEngine().TUIGroup.decreaseGroupCounter(Object.assign({groupID:this.groupID},e))}getGroupCounters(e){return this.getEngine().TUIGroup.getGroupCounters(Object.assign({groupID:this.groupID},e))}addGroupMember(e){return this.getEngine().TUIGroup.addGroupMember(Object.assign({groupID:this.groupID},e))}getGroupMemberList(e){return this.getEngine().TUIGroup.getGroupMemberList(Object.assign({groupID:this.groupID},e))}getGroupMemberProfile(e){return this.getEngine().TUIGroup.getGroupMemberProfile(Object.assign({groupID:this.groupID},e))}deleteGroupMember(e){return this.getEngine().TUIGroup.deleteGroupMember(Object.assign({groupID:this.groupID},e))}setGroupMemberMuteTime(e){return this.getEngine().TUIGroup.setGroupMemberMuteTime(Object.assign({groupID:this.groupID},e))}setGroupMemberRole(e){return this.getEngine().TUIGroup.setGroupMemberRole(Object.assign({groupID:this.groupID},e))}setGroupMemberNameCard(e){return this.getEngine().TUIGroup.setGroupMemberNameCard(Object.assign({groupID:this.groupID},e))}setGroupMemberCustomField(e){return this.getEngine().TUIGroup.setGroupMemberCustomField(Object.assign({groupID:this.groupID},e))}markGroupMemberList(e){return this.getEngine().TUIGroup.markGroupMemberList(Object.assign({groupID:this.groupID},e))}}class ce{constructor(){this.defaultStore={currentGroupID:"",currentGroup:{},currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[]},this.store={currentGroupID:"",currentGroup:void 0,currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[]}}update(e,t){switch(e){case"groupList":this.updateGroupList(t);break;case"currentGroup":this.store.currentGroup=t instanceof ue?t:new ue(t);break;default:this.store[e]=t}}getData(e){if("groupSystemNoticeList"===e){const e=[...this.store.groupSystemNoticeList];return this.store.groupSystemNoticeList.length=0,e}return this.store[e]}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateGroupList(e){this.store.groupList=e.map((e=>e instanceof ue?e:new ue(e)))}}class ge{constructor(){this.store={}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(this.store={}),this.store=Object.assign(Object.assign({},this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:void 0})),{}))}}class le{constructor(){this.defaultStore={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0},this.store={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class he{constructor(){this.defaultStore={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1},this.store={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(e=Object.keys(this.store)),this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class pe{constructor(){this.storeMap={[a.APP]:new ee,[a.USER]:new te,[a.CONV]:new re,[a.CHAT]:new ae,[a.GRP]:new ce,[a.FRIEND]:new le,[a.SEARCH]:new he},this.task={}}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}watch(e,t){this.task[e]||(this.task[e]={});const s=this.task[e];Object.keys(t).forEach((n=>{const i=t[n];s[n]||(s[n]=new Map),s[n].set(i,1),this.notifyOnWatch(e,n,i)}))}unwatch(e,t){if(!this.task[e])return;const s=this.task[e];Object.keys(t).forEach((e=>{s[e].delete(t[e])}))}update(e,t,s){var n;e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ge),null===(n=this.storeMap[e])||void 0===n||n.update(t,s),this.notify(e,t)}getData(e,t){var s;return e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ge),null===(s=this.storeMap[e])||void 0===s?void 0:s.getData(t)}getConversationModel(e){var t;return null===(t=this.storeMap[a.CONV])||void 0===t?void 0:t.getModel(e)}getMessageModel(e){var t;return null===(t=this.storeMap[a.CHAT])||void 0===t?void 0:t.getModel(e)}reset(e,t=[],s=!1){if(e in this.storeMap){const n=this.storeMap[e];0===t.length&&(t=Object.keys(null==n?void 0:n.store)),n.reset(t),s&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,s){const n=this.getData(e,t);N.indexOf(t)>-1&&0===n.length||s&&s.call(this,n)}notify(e,t){if(!this.task[e])return;const s=this.task[e];if(s[t]){const n=s[t],i=this.getData(e,t);for(const[e]of n.entries())e.call(this,i)}}}function de(e){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(e)}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e){var t=function(e,t){if("object"!=de(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==de(t)?t:String(t)}function Ee(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,me(n.key),n)}}function ve(e,t,s){return t&&Ee(e.prototype,t),s&&Ee(e,s),Object.defineProperty(e,"prototype",{writable:!1}),e}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ie(e,t){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ie(e,t)}function Se(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ie(e,t)}function ye(e,t){if(t&&("object"===de(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Te(e)}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},be(e)}function Me(e,t,s){return(t=me(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s<t;s++)n[s]=e[s];return n}function Oe(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Ue(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Ue(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ce(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function De(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ce(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var _e={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Pe=new(function(){function e(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fe(this,e),this.init(t,s)}return ve(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||_e,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,s,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(s).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,De(De({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),Re=function(){function e(){fe(this,e),this.observers={}}return ve(e,[{key:"on",value:function(e,t){var s=this;return e.split(" ").forEach((function(e){s.observers[e]=s.observers[e]||[],s.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,s)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(s))}))}}]),e}();function je(){var e,t,s=new Promise((function(s,n){e=s,t=n}));return s.resolve=e,s.reject=t,s}function Le(e){return null==e?"":""+e}function Ae(e,t,s){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var r="string"!=typeof t?[].concat(t):t.split(".");r.length>1;){if(i())return{};var o=n(r.shift());!e[o]&&s&&(e[o]=new s),e=Object.prototype.hasOwnProperty.call(e,o)?e[o]:{}}return i()?{}:{obj:e,k:n(r.shift())}}function Ge(e,t,s){var n=Ae(e,t,Object);n.obj[n.k]=s}function Ne(e,t){var s=Ae(e,t),n=s.obj,i=s.k;if(n)return n[i]}function ke(e,t,s){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?s&&(e[n]=t[n]):ke(e[n],t[n],s):e[n]=t[n]);return e}function xe(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var we={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Ve(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return we[e]})):e}var Fe="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,$e=[" ",",","?","!",";"];function He(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(s),i=e,r=0;r<n.length;++r){if(!i)return;if("string"==typeof i[n[r]]&&r+1<n.length)return;if(void 0===i[n[r]]){for(var o=2,a=n.slice(r,r+o).join(s),u=i[a];void 0===u&&n.length>r+o;)o++,u=i[a=n.slice(r,r+o).join(s)];if(void 0===u)return;if(null===u)return null;if(t.endsWith(a)){if("string"==typeof u)return u;if(a&&"string"==typeof u[a])return u[a]}var c=n.slice(r+o).join(s);return c?He(u,c,s):void 0}i=i[n[r]]}return i}}function Ye(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function Be(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ye(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Ke(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var qe=function(e){Se(s,Re);var t=Ke(s);function s(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return fe(this,s),n=t.call(this),Fe&&Re.call(Te(n)),n.data=e||{},n.options=i,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return ve(s,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,o=[e,t];s&&"string"!=typeof s&&(o=o.concat(s)),s&&"string"==typeof s&&(o=o.concat(i?s.split(i):s)),e.indexOf(".")>-1&&(o=e.split("."));var a=Ne(this.data,o);return a||!r||"string"!=typeof s?a:He(this.data&&this.data[e]&&this.data[e][t],s,i)}},{key:"addResource",value:function(e,t,s,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,o=[e,t];s&&(o=o.concat(r?s.split(r):s)),e.indexOf(".")>-1&&(n=t,t=(o=e.split("."))[1]),this.addNamespaces(t),Ge(this.data,o,n),i.silent||this.emit("added",e,t,s,n)}},{key:"addResources",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in s)"string"!=typeof s[i]&&"[object Array]"!==Object.prototype.toString.apply(s[i])||this.addResource(e,t,i,s[i],{silent:!0});n.silent||this.emit("added",e,t,s)}},{key:"addResourceBundle",value:function(e,t,s,n,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(n=s,s=t,t=(o=e.split("."))[1]),this.addNamespaces(t);var a=Ne(this.data,o)||{};n?ke(a,s,i):a=Be(Be({},a),s),Ge(this.data,o,a),r.silent||this.emit("added",e,t,s)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Be(Be({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),s}(),ze={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,s,n,i){var r=this;return e.forEach((function(e){r.processors[e]&&(t=r.processors[e].process(t,s,n,i))})),t}};function Je(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function We(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Je(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Je(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Xe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var Ze={},Qe=function(e){Se(s,Re);var t=Xe(s);function s(e){var n,i,r,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fe(this,s),n=t.call(this),Fe&&Re.call(Te(n)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,o=Te(n),i.forEach((function(e){r[e]&&(o[e]=r[e])})),n.options=a,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=Pe.create("translator"),n}return ve(s,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var s=this.resolve(e,t);return s&&void 0!==s.res}},{key:"extractFromKey",value:function(e,t){var s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],r=s&&e.indexOf(s)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,s){t=t||"",s=s||"";var n=$e.filter((function(e){return t.indexOf(e)<0&&s.indexOf(e)<0}));if(0===n.length)return!0;var i=new RegExp("(".concat(n.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),r=!i.test(e);if(!r){var o=e.indexOf(s);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r}(e,s,n));if(r&&!o){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var u=e.split(s);(s!==n||s===n&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(n)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,n){var i=this;if("object"!==de(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===de(t)&&(t=We({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),u=a.key,c=a.namespaces,g=c[c.length-1],l=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return r?{res:"".concat(g).concat(p).concat(u),usedKey:u,exactUsedKey:u,usedLng:l,usedNS:g}:"".concat(g).concat(p).concat(u)}return r?{res:u,usedKey:u,exactUsedKey:u,usedLng:l,usedNS:g}:u}var d=this.resolve(e,t),f=d&&d.res,m=d&&d.usedKey||u,E=d&&d.exactUsedKey||u,v=Object.prototype.toString.apply(f),T=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject;if(I&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(v)<0&&("string"!=typeof T||"[object Array]"!==v)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,We(We({},t),{},{ns:c})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return r?(d.res=S,d):S}if(o){var y="[object Array]"===v,b=y?[]:{},M=y?E:m;for(var U in f)if(Object.prototype.hasOwnProperty.call(f,U)){var O="".concat(M).concat(o).concat(U);b[U]=this.translate(O,We(We({},t),{joinArrays:!1,ns:c})),b[U]===O&&(b[U]=f[U])}f=b}}else if(I&&"string"==typeof T&&"[object Array]"===v)(f=f.join(T))&&(f=this.extendTranslation(f,e,t,n));else{var C=!1,D=!1,_=void 0!==t.count&&"string"!=typeof t.count,P=s.hasDefaultValue(t),R=_?this.pluralResolver.getSuffix(l,t.count,t):"",j=t["defaultValue".concat(R)]||t.defaultValue;!this.isValidLookup(f)&&P&&(C=!0,f=j),this.isValidLookup(f)||(D=!0,f=u);var L=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:f,A=P&&j!==f&&this.options.updateMissing;if(D||C||A){if(this.logger.log(A?"updateKey":"missingKey",l,g,u,A?j:f),o){var G=this.resolve(u,We(We({},t),{},{keySeparator:!1}));G&&G.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var N=[],k=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&k&&k[0])for(var x=0;x<k.length;x++)N.push(k[x]);else"all"===this.options.saveMissingTo?N=this.languageUtils.toResolveHierarchy(t.lng||this.language):N.push(t.lng||this.language);var w=function(e,s,n){var r=P&&n!==f?n:L;i.options.missingKeyHandler?i.options.missingKeyHandler(e,g,s,r,A,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,g,s,r,A,t),i.emit("missingKey",e,g,s,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?N.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(s){w([e],u+s,t["defaultValue".concat(s)]||j)}))})):w(N,u,j))}f=this.extendTranslation(f,e,t,d,n),D&&f===u&&this.options.appendNamespaceToMissingKey&&(f="".concat(g,":").concat(u)),(D||C)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(g,":").concat(u):u,C?f:void 0):this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d):f}},{key:"extendTranslation",value:function(e,t,s,n,i){var r=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,We(We({},this.options.interpolation.defaultVariables),s),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(We(We({},s),{interpolation:We(We({},this.options.interpolation),s.interpolation)}));var o,a="string"==typeof e&&(s&&s.interpolation&&void 0!==s.interpolation.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var u=e.match(this.interpolator.nestingRegexp);o=u&&u.length}var c=s.replace&&"string"!=typeof s.replace?s.replace:s;if(this.options.interpolation.defaultVariables&&(c=We(We({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,s.lng||this.language,s),a){var g=e.match(this.interpolator.nestingRegexp);o<(g&&g.length)&&(s.nest=!1)}!s.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(s.lng=n.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return i&&i[0]===n[0]&&!s.context?(r.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):r.translate.apply(r,n.concat([t]))}),s)),s.interpolation&&this.interpolator.reset()}var l=s.postProcess||this.options.postProcess,h="string"==typeof l?[l]:l;return null!=e&&h&&h.length&&!1!==s.applyPostProcessor&&(e=ze.handle(h,e,t,this.options&&this.options.postProcessPassResolved?We({i18nResolved:n},s):s,this)),e}},{key:"resolve",value:function(e){var t,s,n,i,r,o=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!o.isValidLookup(t)){var u=o.extractFromKey(e,a),c=u.key;s=c;var g=u.namespaces;o.options.fallbackNS&&(g=g.concat(o.options.fallbackNS));var l=void 0!==a.count&&"string"!=typeof a.count,h=l&&!a.ordinal&&0===a.count&&o.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,d=a.lngs?a.lngs:o.languageUtils.toResolveHierarchy(a.lng||o.language,a.fallbackLng);g.forEach((function(e){o.isValidLookup(t)||(r=e,!Ze["".concat(d[0],"-").concat(e)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(r)&&(Ze["".concat(d[0],"-").concat(e)]=!0,o.logger.warn('key "'.concat(s,'" for languages "').concat(d.join(", "),'" won\'t get resolved as namespace "').concat(r,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach((function(s){if(!o.isValidLookup(t)){i=s;var r,u=[c];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(u,c,s,e,a);else{var g;l&&(g=o.pluralResolver.getSuffix(s,a.count,a));var d="".concat(o.options.pluralSeparator,"zero");if(l&&(u.push(c+g),h&&u.push(c+d)),p){var f="".concat(c).concat(o.options.contextSeparator).concat(a.context);u.push(f),l&&(u.push(f+g),h&&u.push(f+d))}}for(;r=u.pop();)o.isValidLookup(t)||(n=r,t=o.getResource(s,e,r,a))}})))}))}})),{res:t,usedKey:s,exactUsedKey:n,usedLng:i,usedNS:r}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,s,n):this.resourceStore.getResource(e,t,s,n)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,12)&&void 0!==e[s])return!0;return!1}}]),s}();function et(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tt=function(){function e(t){fe(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Pe.create("languageUtils")}return ve(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],s=e.split("-");return this.options.lowerCaseLng?s=s.map((function(e){return e.toLowerCase()})):2===s.length?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=et(s[1].toLowerCase()))):3===s.length&&(s[0]=s[0].toLowerCase(),2===s[1].length&&(s[1]=s[1].toUpperCase()),"sgn"!==s[0]&&2===s[2].length&&(s[2]=s[2].toUpperCase()),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=et(s[1].toLowerCase())),t.indexOf(s[2].toLowerCase())>-1&&(s[2]=et(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,s=this;return e?(e.forEach((function(e){if(!t){var n=s.formatLanguageCode(e);s.options.supportedLngs&&!s.isSupportedCode(n)||(t=n)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var n=s.getLanguagePartFromCode(e);if(s.isSupportedCode(n))return t=n;t=s.options.supportedLngs.find((function(e){return e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}},{key:"toResolveHierarchy",value:function(e,t){var s=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=function(e){e&&(s.isSupportedCode(e)?i.push(e):s.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):"string"==typeof e&&r(this.formatLanguageCode(e)),n.forEach((function(e){i.indexOf(e)<0&&r(s.formatLanguageCode(e))})),i}}]),e}(),st=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],nt={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},it=["v1","v2","v3"],rt={zero:0,one:1,two:2,few:3,many:4,other:5};var ot=function(){function e(t){var s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fe(this,e),this.languageUtils=t,this.options=n,this.logger=Pe.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(s={},st.forEach((function(e){e.lngs.forEach((function(t){s[t]={numbers:e.nr,plurals:nt[e.fc]}}))})),s)}return ve(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,t);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,s).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,s);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((function(e,t){return rt[e]-rt[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):n.numbers.map((function(n){return t.getSuffix(e,n,s)})):[]}},{key:"getSuffix",value:function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,s);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var s=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var r=function(){return s.options.prepend&&i.toString()?s.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):r():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?r():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!it.includes(this.options.compatibilityJSON)}}]),e}();function at(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function ut(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?at(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):at(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function ct(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=function(e,t,s){var n=Ne(e,s);return void 0!==n?n:Ne(t,s)}(e,t,s);return!r&&i&&"string"==typeof s&&void 0===(r=He(e,s,n))&&(r=He(t,s,n)),r}var gt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe(this,e),this.logger=Pe.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return ve(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Ve,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?xe(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?xe(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?xe(t.nestingPrefix):t.nestingPrefixEscaped||xe("$t("),this.nestingSuffix=t.nestingSuffix?xe(t.nestingSuffix):t.nestingSuffixEscaped||xe(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var s="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(s,"g")}},{key:"interpolate",value:function(e,t,s,n){var i,r,o,a=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var g=function(e){if(e.indexOf(a.formatSeparator)<0){var i=ct(t,u,e,a.options.keySeparator,a.options.ignoreJSONStructure);return a.alwaysFormat?a.format(i,void 0,s,ut(ut(ut({},n),t),{},{interpolationkey:e})):i}var r=e.split(a.formatSeparator),o=r.shift().trim(),c=r.join(a.formatSeparator).trim();return a.format(ct(t,u,o,a.options.keySeparator,a.options.ignoreJSONStructure),c,s,ut(ut(ut({},n),t),{},{interpolationkey:o}))};this.resetRegExp();var l=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,h=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(o=0;i=t.regex.exec(e);){var s=i[1].trim();if(void 0===(r=g(s)))if("function"==typeof l){var u=l(e,i,n);r="string"==typeof u?u:""}else if(n&&Object.prototype.hasOwnProperty.call(n,s))r="";else{if(h){r=i[0];continue}a.logger.warn("missed to pass in variable ".concat(s," for interpolating ").concat(e)),r=""}else"string"==typeof r||a.useRawValueToEscape||(r=Le(r));var c=t.safeValue(r);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=r.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++o>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var s,n,i,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var s=this.nestingOptionsSeparator;if(e.indexOf(s)<0)return e;var n=e.split(new RegExp("".concat(s,"[ ]*{"))),r="{".concat(n[1]);e=n[0];var o=(r=this.interpolate(r,i)).match(/'/g),a=r.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(r=r.replace(/'/g,'"'));try{i=JSON.parse(r),t&&(i=ut(ut({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(s).concat(r)}return delete i.defaultValue,e}for(;s=this.nestingRegexp.exec(e);){var u=[];(i=(i=ut({},o)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var c=!1;if(-1!==s[0].indexOf(this.formatSeparator)&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map((function(e){return e.trim()}));s[1]=g.shift(),u=g,c=!0}if((n=t(a.call(this,s[1].trim(),i),i))&&s[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=Le(n)),n||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(e)),n=""),c&&(n=u.reduce((function(e,t){return r.format(e,t,o.lng,ut(ut({},o),{},{interpolationkey:s[1].trim()}))}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}]),e}();function lt(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function ht(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):lt(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function pt(e){var t={};return function(s,n,i){var r=n+JSON.stringify(i),o=t[r];return o||(o=e(n,i),t[r]=o),o(s)}}var dt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe(this,e),this.logger=Pe.create("formatter"),this.options=t,this.formats={number:pt((function(e,t){var s=new Intl.NumberFormat(e,ht({},t));return function(e){return s.format(e)}})),currency:pt((function(e,t){var s=new Intl.NumberFormat(e,ht(ht({},t),{},{style:"currency"}));return function(e){return s.format(e)}})),datetime:pt((function(e,t){var s=new Intl.DateTimeFormat(e,ht({},t));return function(e){return s.format(e)}})),relativetime:pt((function(e,t){var s=new Intl.RelativeTimeFormat(e,ht({},t));return function(e){return s.format(e,t.range||"day")}})),list:pt((function(e,t){var s=new Intl.ListFormat(e,ht({},t));return function(e){return s.format(e)}}))},this.init(t)}return ve(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=pt(t)}},{key:"format",value:function(e,t,s){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce((function(e,t){var r=function(e){var t=e.toLowerCase().trim(),s={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?s.currency||(s.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?s.range||(s.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=Oe(e.split(":")),n=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");s[n.trim()]||(s[n.trim()]=i),"false"===i&&(s[n.trim()]=!1),"true"===i&&(s[n.trim()]=!0),isNaN(i)||(s[n.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:s}}(t),o=r.formatName,a=r.formatOptions;if(n.formats[o]){var u=e;try{var c=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=c.locale||c.lng||i.locale||i.lng||s;u=n.formats[o](e,g,ht(ht(ht({},a),i),c))}catch(e){n.logger.warn(e)}return u}return n.logger.warn("there was no format function for ".concat(o)),e}),e)}}]),e}();function ft(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function mt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ft(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var vt=function(e){Se(s,Re);var t=Et(s);function s(e,n,i){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return fe(this,s),r=t.call(this),Fe&&Re.call(Te(r)),r.backend=e,r.store=n,r.services=i,r.languageUtils=i.languageUtils,r.options=o,r.logger=Pe.create("backendConnector"),r.waitingReads=[],r.maxParallelReads=o.maxParallelReads||10,r.readingCalls=0,r.maxRetries=o.maxRetries>=0?o.maxRetries:5,r.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(i,o.backend,o),r}return ve(s,[{key:"queueLoad",value:function(e,t,s,n){var i=this,r={},o={},a={},u={};return e.forEach((function(e){var n=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!s.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===o[a]&&(o[a]=!0):(i.state[a]=1,n=!1,void 0===o[a]&&(o[a]=!0),void 0===r[a]&&(r[a]=!0),void 0===u[t]&&(u[t]=!0)))})),n||(a[e]=!0)})),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,s){var n=e.split("|"),i=n[0],r=n[1];t&&this.emit("failedLoading",i,r,t),s&&this.store.addResourceBundle(i,r,s),this.state[e]=t?-1:2;var o={};this.queue.forEach((function(s){var n,a,u,c,g,l;n=s.loaded,a=r,c=Ae(n,[i],Object),g=c.obj,l=c.k,g[l]=g[l]||[],u&&(g[l]=g[l].concat(a)),u||g[l].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(s,e),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach((function(e){o[e]||(o[e]={});var t=s.loaded[e];t.length&&t.forEach((function(t){void 0===o[e][t]&&(o[e][t]=!0)}))})),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,s){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:r,callback:o});else{this.readingCalls++;var a=function(a,u){if(n.readingCalls--,n.waitingReads.length>0){var c=n.waitingReads.shift();n.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&u&&i<n.maxRetries?setTimeout((function(){n.read.call(n,e,t,s,i+1,2*r,o)}),r):o(a,u)},u=this.backend[s].bind(this.backend);if(2!==u.length)return u(e,t,a);try{var c=u(e,t);c&&"function"==typeof c.then?c.then((function(e){return a(null,e)})).catch(a):a(null,c)}catch(e){a(e)}}}},{key:"prepareLoading",value:function(e,t){var s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var r=this.queueLoad(e,t,n,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach((function(e){s.loadOne(e)}))}},{key:"load",value:function(e,t,s){this.prepareLoading(e,t,{},s)}},{key:"reload",value:function(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}},{key:"loadOne",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),i=n[0],r=n[1];this.read(i,r,"read",void 0,void 0,(function(n,o){n&&t.logger.warn("".concat(s,"loading namespace ").concat(r," for language ").concat(i," failed"),n),!n&&o&&t.logger.log("".concat(s,"loaded namespace ").concat(r," for language ").concat(i),o),t.loaded(e,n,o)}))}},{key:"saveMissing",value:function(e,t,s,n,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=s&&""!==s){if(this.backend&&this.backend.create){var a=mt(mt({},r),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var c;(c=5===u.length?u(e,t,s,n,a):u(e,t,s,n))&&"function"==typeof c.then?c.then((function(e){return o(null,e)})).catch(o):o(null,c)}catch(e){o(e)}else u(e,t,s,n,o,a)}e&&e[0]&&this.store.addResource(e[0],t,s,n)}}}]),s}();function Tt(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===de(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===de(e[2])||"object"===de(e[3])){var s=e[3]||e[2];Object.keys(s).forEach((function(e){t[e]=s[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,s,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function It(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function St(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function yt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?St(Object(s),!0).forEach((function(t){Me(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):St(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}function Mt(){}var Ut=function(e){Se(s,Re);var t=bt(s);function s(){var e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(fe(this,s),e=t.call(this),Fe&&Re.call(Te(e)),e.options=It(i),e.services={},e.logger=Pe,e.modules={external:[]},n=Te(e),Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((function(e){"function"==typeof n[e]&&(n[e]=n[e].bind(n))})),r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),ye(e,Te(e));setTimeout((function(){e.init(i,r)}),0)}return e}return ve(s,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(s=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var n=Tt();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=yt(yt(yt({},n),this.options),It(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=yt(yt({},n.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var r;this.modules.logger?Pe.init(i(this.modules.logger),this.options):Pe.init(null,this.options),this.modules.formatter?r=this.modules.formatter:"undefined"!=typeof Intl&&(r=dt);var o=new tt(this.options);this.store=new qe(this.options.resources,this.options);var a=this.services;a.logger=Pe,a.resourceStore=this.store,a.languageUtils=o,a.pluralResolver=new ot(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!r||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(a.formatter=i(r),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new gt(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new vt(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),i=1;i<s;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new Qe(this.services,this.options),this.translator.on("*",(function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),i=1;i<s;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,s||(s=Mt),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&"dev"!==u[0]&&(this.options.lng=u[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var s;return(s=e.store)[t].apply(s,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var s;return(s=e.store)[t].apply(s,arguments),e}}));var c=je(),g=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),c.resolve(n),s(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),c}},{key:"loadResources",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mt,n="string"==typeof e?e:this.language;if("function"==typeof e&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return s();var i=[],r=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(n)r(n);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return r(e)}));this.options.preload&&this.options.preload.forEach((function(e){return r(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),s(e)}))}else s(null)}},{key:"reloadResources",value:function(e,t,s){var n=je();return e||(e=this.languages),t||(t=this.options.ns),s||(s=Mt),this.services.backendConnector.reload(e,t,(function(e){n.resolve(),s(e)})),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&ze.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(e,t){var s=this;this.isLanguageChangingTo=e;var n=je();this.emit("languageChanging",e);var i=function(e){s.language=e,s.languages=s.services.languageUtils.toResolveHierarchy(e),s.resolvedLanguage=void 0,s.setResolvedLanguage(e)},r=function(r){e||r||!s.services.languageDetector||(r=[]);var o="string"==typeof r?r:s.services.languageUtils.getBestMatchFromCodes(r);o&&(s.language||i(o),s.translator.language||s.translator.changeLanguage(o),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(o)),s.loadResources(o,(function(e){!function(e,r){r?(i(r),s.translator.changeLanguage(r),s.isLanguageChangingTo=void 0,s.emit("languageChanged",r),s.logger.log("languageChanged",r)):s.isLanguageChangingTo=void 0,n.resolve((function(){return s.t.apply(s,arguments)})),t&&t(e,(function(){return s.t.apply(s,arguments)}))}(e,o)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,s){var n=this,i=function e(t,i){var r;if("object"!==de(i)){for(var o=arguments.length,a=new Array(o>2?o-2:0),u=2;u<o;u++)a[u-2]=arguments[u];r=n.options.overloadTranslationOptionHandler([t,i].concat(a))}else r=yt({},i);r.lng=r.lng||e.lng,r.lngs=r.lngs||e.lngs,r.ns=r.ns||e.ns,r.keyPrefix=r.keyPrefix||s||e.keyPrefix;var c,g=n.options.keySeparator||".";return c=r.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(r.keyPrefix).concat(g).concat(e)})):r.keyPrefix?"".concat(r.keyPrefix).concat(g).concat(t):t,n.t(c,r)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=s.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var o=function(e,s){var n=t.services.backendConnector.state["".concat(e,"|").concat(s)];return-1===n||2===n};if(s.precheck){var a=s.precheck(this,o);if(void 0!==a)return a}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(n,e)||i&&!o(r,e)))}},{key:"loadNamespaces",value:function(e,t){var s=this,n=je();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){s.options.ns.indexOf(e)<0&&s.options.ns.push(e)})),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var s=je();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],i=e.filter((function(e){return n.indexOf(e)<0}));return i.length?(this.options.preload=n.concat(i),this.loadResources((function(e){s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new tt(Tt());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mt,i=yt(yt(yt({},this.options),t),{isClone:!0}),r=new s(i);void 0===t.debug&&void 0===t.prefix||(r.logger=r.logger.clone(t));return["store","services","language"].forEach((function(t){r[t]=e[t]})),r.services=yt({},this.services),r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r.translator=new Qe(r.services,r.options),r.translator.on("*",(function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];r.emit.apply(r,[e].concat(s))})),r.init(i,n),r.translator.options=r.options,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),s}();Me(Ut,"createInstance",(function(){return new Ut(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Ot=Ut.createInstance();Ot.createInstance=Ut.createInstance,Ot.createInstance,Ot.dir,Ot.init,Ot.loadResources,Ot.reloadResources,Ot.use,Ot.changeLanguage,Ot.getFixedT,Ot.t,Ot.exists,Ot.setDefaultNamespace,Ot.hasLoadedNamespace,Ot.loadNamespaces,Ot.loadLanguages;class Ct extends se{constructor(){super(),this.languages=null}static getInstance(){return Ct.instance||(Ct.instance=new Ct),Ct.instance}provideLanguages(e){k||(this.languages=e,console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){k||(this.languages?Ot.init({compatibilityJSON:"v3",lng:e||"zh",fallbackLng:"zh",detection:{order:["querystring","navigator"],caches:["localStorage","cookie"]},resources:{en:{translation:this.languages.en},zh:{translation:this.languages.zh_cn}}}):console.warn("TUITranslateService.useI18next not have messages."))}changeLanguage(e){return Ot.changeLanguage(e)}t(e){if(!this.languages){let t=e;return!S(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}return Ot.t(e)}}class Dt extends se{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return Dt.instance||(Dt.instance=new Dt),Dt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalUnreadCountUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getConversationInitData()}onConversationListUpdated(e){const t=this.filterSystemConversation(e);this.getEngine().TUIStore.update(a.CONV,"conversationList",t),this.updateCurrentConversation()}onTotalUnreadCountUpdated(e){this.getEngine().TUIStore.update(a.CONV,"totalUnreadCount",e)}onMessageReceived(e){const t=this.getEngine(),s=this.getEngine().TUIStore.getData(a.CONV,"conversationList");let n=!1;for(let i=0;i<e.length;i++){if(e[i].type!==t.TYPES.MSG_GRP_SYS_NOTICE)continue;const{operationType:r}=e[i].payload,o=`GROUP${e[i].to}`,a=4===r||5===r||8===r,u=2===r||6===r||7===r;if(a||u)for(let e=0;e<s.length;e++)if(s[e].type!==t.TYPES.CONV_C2C&&s[e].conversationID===o){if(a){s[e].operationType=r,n=!0;break}if(u&&s[e].operationType>0){s[e].operationType=0,n=!0;break}}}n&&this.getEngine().TUIStore.update(a.CONV,"conversationList",s)}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:s,isSyncCompleted:n}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${s.length} isSyncCompleted:${n}`),s.length>0){this.onConversationListUpdated(s);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return i(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,s=this.getEngine();if(!e)return s.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),s.TUIStore.update(a.CONV,"currentConversationID",""),s.TUIStore.update(a.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(s.TYPES.CONV_C2C)&&!e.startsWith(s.TYPES.CONV_GROUP))return console.warn(`${t} conversationID is invalid, conversationID:${e}`),Promise.reject({code:h.INVALID_CONV_ID,message:d.INVALID_CONV_ID});const n=s.TUIStore.getData(a.CONV,"currentConversationID");if(n&&n===e)return this.setMessageRead(n),console.warn(`${t} please check conversationID, conversationID:${e}`),Promise.resolve({code:h.CONV_ID_SAME,message:d.CONV_ID_SAME});const i=yield this.getConversationModel(e);return S(i)?(console.warn(`${t} target conversation is not exist, conversationID:${e}`),Promise.reject({code:h.CONV_NOT_EXIST,message:d.CONV_NOT_EXIST})):(n&&this.setMessageRead(n),e&&this.setMessageRead(e),s.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),s.TUIStore.update(a.CONV,"currentConversationID",e),s.TUIStore.update(a.CONV,"currentConversation",i),Promise.resolve(i))}))}getConversationModel(e){return i(this,void 0,void 0,(function*(){let t=this.findConversation(e);if(S(t))try{const s=yield this.getConversationProfile(e);s.data&&s.data.conversation&&(t=new ie(s.data.conversation))}catch(e){t=void 0}return t}))}findConversation(e){let t;const s=this.getEngine().TUIStore.getData(a.CONV,"conversationList");for(let n=0;n<s.length;n++)if(s[n].conversationID===e){t=s[n];break}return t}updateCurrentConversation(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"currentConversationID"),s=this.findConversation(t);s&&e.TUIStore.update(a.CONV,"currentConversation",s)}getConversationList(){return this.getEngine().chat.getConversationList()}getConversationProfile(e){return this.getEngine().chat.getConversationProfile(e)}deleteConversation(e){return this.getEngine().chat.deleteConversation(e).then((t=>{const s=this.getEngine().TUIStore.getData(a.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${s}`),e===s&&(this.getEngine().TUIStore.update(a.CONV,"currentConversationID",""),this.getEngine().TUIStore.update(a.CONV,"currentConversation",null)),t}))}pinConversation(e){return this.getEngine().chat.pinConversation(e)}muteConversation(e){return this.getEngine().chat.setMessageRemindType(e)}clearHistoryMessage(e){return this.getEngine().chat.clearHistoryMessage(e).then((e=>(this.getEngine().TUIStore.update(a.CHAT,"messageList",[]),this.getEngine().TUIStore.update(a.CHAT,"nextReqMessageID",""),this.getEngine().TUIStore.update(a.CHAT,"isCompleted",!0),e)))}setMessageRead(e){return this.getEngine().chat.setMessageRead({conversationID:e})}filterSystemConversation(e){return e.filter((e=>e.type!==this.getEngine().TYPES.CONV_SYSTEM))}}class _t{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this)),this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated.bind(this))}onProfileUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.USER,"userProfile");e.forEach((e=>{e.userID===s.userID&&t.TUIStore.update(a.USER,"userProfile",e)}))}onBlacklistUpdated(e){const t=this.getEngine();this.getBlacklistProfile(e).then((e=>{t.TUIStore.update(a.USER,"userBlacklist",e)}))}getBlacklistProfile(e){const t=[];let s=0;for(;s<e.length;)t.push(e.slice(s,s+=100));const n=[];t.forEach((e=>{n.push(this.TUIUserService.getUserProfile({userIDList:e}))}));const i=[];return Promise.all(n).then((e=>(e.forEach((e=>{const t=e.data.map((e=>{const{userID:t,nick:s,avatar:n}=e;return{userID:t,nick:s,avatar:n}}));i.push(...t)})),i)))}getUserProfile(e){const t=this.getEngine();return S(e)?t.chat.getMyProfile().then((e=>(t.TUIStore.update(a.USER,"userProfile",e.data),e))).catch((e=>Promise.reject(e))):t.chat.getUserProfile(e)}updateMyProfile(e){return this.getEngine().chat.updateMyProfile(e)}addToBlacklist(e){return this.getEngine().chat.addToBlacklist(e)}removeFromBlacklist(e){return this.getEngine().chat.removeFromBlacklist(e)}}function Pt(e,t,s=!0){!function(e,t){w?$.setStorageSync(e,t):Lt()&&localStorage.setItem(e,JSON.stringify(t))}(s?jt(e):e,t)}function Rt(e,t=!0){try{return function(e){if(w)return $.getStorageSync(e);if(Lt()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}return}(t?jt(e):e)}catch(e){return void console.warn("Storage.getStorageItem error:",e)}}function jt(e){return`chat_engine_${e}`}function Lt(){return navigator&&navigator.cookieEnabled&&localStorage}class At{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=Rt("displayOnlineStatus")||!1;e.TUIStore.update(a.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{conversationList:()=>{const t=e.TUIStore.getData(a.APP,"enabledOnlineStatus"),s=e.TUIStore.getData(a.USER,"displayOnlineStatus");t&&s&&this.startToSubscribe()}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(a.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:s=!1}=e;t.TUIStore.update(a.USER,"displayOnlineStatus",s),Pt("displayOnlineStatus",s);const n=t.TUIStore.getData(a.APP,"enabledOnlineStatus");n?!0===s?this.startToSubscribe():this.unsubscribeUserStatus():console.warn(`UserStatusHandler.switchUserStatus enabledOnlineStatus:${n} displayOnlineStatus:${s}`)}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:s}=e.data;return s.length>0&&t.TUIStore.update(a.USER,"userStatusList",s),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;const s=(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length)||0;return 0===s?(console.warn(`UserStatusHandler.subscribeUserStatus userID count:${s}`),Promise.resolve()):this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const t=this.getEngine(),{userIDList:s=[]}=e||{};return t.chat.unsubscribeUserStatus({userIDList:s}).then((e=>{const{failureUserList:n}=e.data,i=[];return s.forEach((e=>{n.includes(e)||i.push({userID:e,statusType:u.UNSUB_USER})})),t.TUIStore.update(a.USER,"userStatusList",i),e})).catch((e=>Promise.reject(e)))}startToSubscribe(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"conversationList"),s=e.TUIStore.getData(a.USER,"userStatusList"),n=[];t.forEach((t=>{if(t.type===e.TYPES.CONV_C2C){const i=t.conversationID.replace(e.TYPES.CONV_C2C,"");s.has(i)||n.push(i)}})),0!==n.length&&e.chat.isReady()&&(this.subscribeUserStatus({userIDList:n}),this.getUserStatus({userIDList:n}))}}class Gt extends se{constructor(){super(),this.userProfileHandler=new _t(this),this.userStatusHandler=new At(this)}static getInstance(){return Gt.instance||(Gt.instance=new Gt),Gt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.KICKED_OUT,this.onKickedOut.bind(this)),e.eventCenter.addEvent(e.EVENT.NET_STATE_CHANGE,this.onNetStateChange.bind(this)),this.userProfileHandler.init(),this.userStatusHandler.init(),this.initMessageReadReceipt()}onKickedOut(e){this.getEngine().TUIStore.update(a.USER,"kickedOut",e.type)}onNetStateChange(e){this.getEngine().TUIStore.update(a.USER,"netStateChange",e.state)}initMessageReadReceipt(){const e=Rt("displayMessageReadReceipt")||!0;this.getEngine().TUIStore.update(a.USER,"displayMessageReadReceipt",e)}switchUserStatus(e){return this.userStatusHandler.switchUserStatus(e)}switchMessageReadStatus(e){this.getEngine().TUIStore.update(a.USER,"displayMessageReadReceipt",e),Pt("displayMessageReadReceipt",e)}getUserProfile(e){return this.userProfileHandler.getUserProfile(e)}updateMyProfile(e){return this.userProfileHandler.updateMyProfile(e)}addToBlacklist(e){return this.userProfileHandler.addToBlacklist(e)}removeFromBlacklist(e){return this.userProfileHandler.removeFromBlacklist(e)}getUserStatus(e){return this.userStatusHandler.getUserStatus(e)}subscribeUserStatus(e){return this.userStatusHandler.subscribeUserStatus(e)}unsubscribeUserStatus(e){return this.userStatusHandler.unsubscribeUserStatus(e)}}class Nt{constructor(e){this.TUIChatService=e,this.userShowNameMap=new Map,this.requestedUserMap=new Map}getEngine(){return this.TUIChatService.getEngine()}t(e){return this.getEngine().TUITranslate.t(e)}handleTextMessage(e){return{text:this.decodeText(e.payload)}}handleFaceMessage(e){const t={name:"",url:""};return t.name=e.payload.data.indexOf("@2x")<0?`${e.payload.data}@2x`:e.payload.data,t.url=`${P}${t.name}.png`,t}handleLocationMessage(e){const t={lon:"",lat:"",href:"",url:"",description:""};return t.lon=e.payload.longitude.toFixed(6),t.lat=e.payload.latitude.toFixed(6),t.href=`${R}pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`${j}center=${t.lat},${t.lon}&zoom=10&size=300*150&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|${t.lat},${t.lon}&key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD`,t.description=e.payload.description,t}handleImageMessage(e){return{url:e.payload.imageInfoArray[0].url,width:e.payload.imageInfoArray[0].width,height:e.payload.imageInfoArray[0].height}}handleAudioMessage(e){return{url:e.payload.url,second:e.payload.second}}handleVideoMessage(e){return{url:e.payload.videoUrl,snapshotUrl:e.payload.snapshotUrl,snapshotWidth:e.payload.snapshotWidth,snapshotHeight:e.payload.snapshotHeight}}handleFileMessage(e){return{url:e.payload.fileUrl,name:e.payload.fileName,size:U(e.payload.fileSize)}}handleCustomMessage(e){var t;const s=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||s||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`[${this.t("message.custom.自定义消息")}]`,businessID:s?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,s,n,i,r,o;const a=this.getEngine(),u={text:""};let c=(null==e?void 0:e.nick)||(null===(s=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===s?void 0:s.join(","));switch((null===(i=null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.memberList)||void 0===i?void 0:i.length)>0&&(c="",null===(o=null===(r=null==e?void 0:e.payload)||void 0===r?void 0:r.memberList)||void 0===o||o.map((e=>{const t=(null==e?void 0:e.nick)||(null==e?void 0:e.userID);c+=`${this.substringByLength(t)},`})),c=null==c?void 0:c.slice(0,-1)),e.payload.operationType){case a.TYPES.GRP_TIP_MBR_JOIN:u.text=`${c} ${this.t("message.tip.加入群组")}`;break;case a.TYPES.GRP_TIP_MBR_QUIT:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.退出群组")}`;break;case a.TYPES.GRP_TIP_MBR_KICKED_OUT:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case a.TYPES.GRP_TIP_MBR_SET_ADMIN:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.成为管理员")}`;break;case a.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被撤销管理员")}`;break;case a.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:u.text=this.handleGroupProfileUpdated(e);break;case a.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:for(const t of e.payload.memberList)t.muteTime>0?u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被禁言")}`:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被取消禁言")}`;break;default:u.text=`[${this.t("message.tip.群提示消息")}]`}return u}handleGroupSystemMessage(e){const t=e.payload.groupProfile.name||e.payload.groupProfile.groupID,s={text:""};switch(e.payload.operationType){case 1:s.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${t}`;break;case 2:s.text=`${this.t("message.tip.成功加入群组")}:${t}`;break;case 3:s.text=`${this.t("message.tip.申请加入群组")}:${t} ${this.t("message.tip.被拒绝")}`;break;case 4:s.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}:${t}`;break;case 5:s.text=`${this.t("message.tip.群")}:${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:s.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}:${t}`;break;case 7:case 12:s.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${t}`;break;case 8:s.text=`${this.t("message.tip.你退出群组")}:${t}`;break;case 9:s.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}:${t} ${this.t("message.tip.的管理员")}`;break;case 10:s.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}:${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:s.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}:${t}`;break;case 14:s.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}:${t}`;break;case 255:s.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:s.text="未解析的群系统通知"}return s}handleCallKitSignaling(e){var t,s,n,i,r,o,a,u,c,g;const l=M(e.payload.data);if(1!==(null==l?void 0:l.businessID))return"";const h=M(null==l?void 0:l.data),p=e.fromAccount||e.from;let d=this.getEngine().TUIFriend.getFriendRemark([p])[p]||e.nameCard||e.nick||p;switch(d=this.substringByLength(d),null==l?void 0:l.actionType){case 1:return"audioCall"!==(null===(t=null==h?void 0:h.data)||void 0===t?void 0:t.cmd)&&"videoCall"!==(null===(s=null==h?void 0:h.data)||void 0===s?void 0:s.cmd)||!(null==l?void 0:l.groupID)?"hangup"===(null===(n=null==h?void 0:h.data)||void 0===n?void 0:n.cmd)?(null==l?void 0:l.groupID)?`${this.t("message.custom.通话结束")}`:`${this.t("message.custom.通话时长")}:${function(e){const t=e;let s,n,i,r="";return t>=3600?(s=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),n=parseInt(""+t%60/60,10)<10?`0${parseInt(""+t%60/60,10)}`:parseInt(""+t%60/60,10),i=t%3600<10?"0"+t%3600:t%3600,i>60&&(n=parseInt(""+i/60,10)<10?`0${parseInt(""+i/60,10)}`:parseInt(""+i/60,10),i=i%60<10?"0"+i%60:i%60),r=`${s}:${n}:${i}`):t>=60&&t<3600?(n=parseInt(""+t/60,10)<10?`0${parseInt(""+t/60,10)}`:parseInt(""+t/60,10),i=t%60<10?"0"+t%60:t%60,r=`00:${n}:${i}`):t<60&&(i=t<10?`0${t}`:t,r=`00:00:${i}`),r}(null==h?void 0:h.call_end)}`:"switchToAudio"===(null===(i=null==h?void 0:h.data)||void 0===i?void 0:i.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(r=null==h?void 0:h.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${d} ${this.t("message.custom.发起通话")}`;case 2:return(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.取消通话")}`:this.t("message.custom.取消通话");case 3:return"switchToAudio"===(null===(o=null==h?void 0:h.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(a=null==h?void 0:h.data)||void 0===a?void 0:a.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.拒绝通话")}`:this.t("message.custom.拒绝通话");case 5:if("switchToAudio"===(null===(u=null==h?void 0:h.data)||void 0===u?void 0:u.cmd))return`${this.t("message.custom.切换语音通话")}`;if("switchToVideo"===(null===(c=null==h?void 0:h.data)||void 0===c?void 0:c.cmd))return`${this.t("message.custom.切换视频通话")}`;if(null==l?void 0:l.groupID){if(p===(null==l?void 0:l.inviter)){this.handleCallkitTimeoutSignaling(l.inviteeList);let e="";return null===(g=l.inviteeList)||void 0===g||g.forEach((t=>{const s=this.userShowNameMap.get(t)||t;e+=`${this.substringByLength(s)}、`})),e=e.substring(0,e.lastIndexOf("、")),`${e} ${this.t("message.custom.无应答")}`}return`${d} ${this.t("message.custom.无应答")}`}return this.t("message.custom.无应答");default:return""}}handleCreateGroupCustomMessage(e){let t;const s=M(e.payload.data);return"group_create"===(null==s?void 0:s.businessID)&&(t=`${s.opUser} ${s.content}`),t}decodeText(e){const t=[];let s=e.text,n=-1,i=-1;for(;""!==s;)switch(n=s.indexOf("["),i=s.indexOf("]"),n){case 0:if(-1===i)t.push({name:"text",text:s}),s="";else{const e=s.slice(0,i+1);L[e]?(t.push({name:"img",src:_+L[e]}),s=s.substring(i+1)):(t.push({name:"text",text:"["}),s=s.slice(1))}break;case-1:t.push({name:"text",text:s}),s="";break;default:t.push({name:"text",text:s.slice(0,n)}),s=s.substring(n)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:s}=e,{newGroupProfile:n,memberList:i,operatorID:r}=s;let o="";const a=t||r,u=Object.keys(n)[0];switch(u){case"muteAllMembers":o=n[u]?`${this.t("message.tip.管理员")} ${a} ${this.t("message.tip.开启全员禁言")}`:`${this.t("message.tip.管理员")} ${a} ${this.t("message.tip.取消全员禁言")}`;break;case"ownerID":o=`${i[0].nick||i[0].userID} ${this.t("message.tip.成为新的群主")}`;break;case"groupName":o=`${a} ${this.t("message.tip.修改群名为")} ${n[u]}`;break;case"notification":o=`${a} ${this.t("message.tip.发布新公告")}`}return o}handleCallkitTimeoutSignaling(e=[]){if(0===e.length)return;const t=this.getEngine().TUIFriend.getFriendRemark(e),s=[];e.forEach((e=>{const n=t[e];n?this.userShowNameMap.set(e,n):this.requestedUserMap.has(e)||(s.push(e),this.requestedUserMap.set(e,1))})),s.length>0&&this.getEngine().TUIUser.getUserProfile({userIDList:s}).then((e=>{(e.data||[]).forEach((e=>{const{userID:t,nick:s}=e,n=s||t;this.userShowNameMap.set(t,n)}))})).catch((e=>{}))}substringByLength(e,t=12){return e.length>t?`${e.slice(0,t)}...`:e}}class kt{constructor(e){this.TUIChatService=e,this.typingTo="",this.timer=null}getEngine(){return this.TUIChatService.getEngine()}clearTypingStatus(){this.getEngine().TUIStore.getData(a.CHAT,"typingStatus")&&this.getEngine().TUIStore.update(a.CHAT,"typingStatus",!1),this.timer&&clearTimeout(this.timer),this.timer=null}handleLastMessage(e){const t=this.getEngine(),s=t.TUIStore.getData(a.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const n=M(e.payload.data);if(n.businessID===c.BUSINESS_ID){const{typingStatus:e,userAction:i}=n;if(e===c.STATUS_START||i===c.ACTION_START_ID)return s?(this.timer&&clearTimeout(this.timer),this.timer=null):t.TUIStore.update(a.CHAT,"typingStatus",!0),this.timer=setTimeout((()=>{this.clearTypingStatus()}),3e4),t.TUIStore.getData(a.CHAT,"typingStatus");e!==c.STATUS_END&&i!==c.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(e=[]){if(0===e.length)return[];return this.getEngine().TUIStore.getData(a.APP,"enableTyping")&&this.handleLastMessage(e[e.length-1]),e.filter((e=>{if(e.type===this.getEngine().TYPES.MSG_CUSTOM){return M(e.payload.data).businessID!==c.BUSINESS_ID}return!0}))}createTypingMessage(e=c.STATUS_END,t=""){const{BUSINESS_ID:s,STATUS_START:n,VERSION:i,ACTION_START_ID:r,ACTION_END_ID:o,ACTION_START:a,ACTION_END:u,NEED_TYPING:g}=c;return{to:t,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:s,typingStatus:e,version:i,userAction:e===n?r:o,actionParam:e===n?a:u}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:g,version:i}})}}sendTyping(e=!1,t=""){if(e){this.typingTo=t;const e=this.createTypingMessage(c.STATUS_START,t);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const e=this.createTypingMessage(c.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}this.typingTo=""}}class xt{constructor(e){this.TUIChatService=e}getEngine(){return this.TUIChatService.getEngine()}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived.bind(this))}onMessageReadReceiptReceived(e){const t=this.getEngine(),s=t.TUIStore.getData(a.CONV,"currentConversationID"),n=[];e.forEach((e=>{const{messageID:i}=e,r=t.chat.findMessage(i);r&&s===r.conversationID&&n.push(r)})),n.length>0&&t.TUIChat.updateMessageList(n,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const s=e.getMessage();t.push(s)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),s=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(s)}getMessageReadReceiptList(e){const t=this.getEngine(),s=t.TUIStore.getData(a.APP,"enabledMessageReadReceipt"),n=t.TUIStore.getData(a.USER,"displayMessageReadReceipt");!s||!n||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP||t.chat.getMessageReadReceiptList(e).then((e=>{const{messageList:t}=e.data;this.TUIChatService.updateMessageList(t,"edit")})).catch((e=>{console.warn(`ReadReceiptHandler.getMessageReadReceiptList error:${e.message}`)}))}}class wt extends se{constructor(){super(),this.messageHandler=new Nt(this),this.typingHandler=new kt(this),this.readReceiptHandler=new xt(this),this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap=new Map}static getInstance(){return wt.instance||(wt.instance=new wt),wt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_MODIFIED,this.onMessageModified.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REVOKED,this.onMessageRevoked.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated.bind(this)),this.onCurrentConversationIDUpdated(),this.onMessageSource(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"push"),this.getEngine().TUIStore.update(a.CHAT,"newMessageList",e)}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}onMessageReactionsUpdated(e){this.updateMessageReactionList([e])}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{currentConversationID:t=>{this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.clear(),e.TUIStore.reset(a.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),ne(t)||this.getMessageList().finally((()=>{this.isSwitching=!1,this.delayGetHoppingFunction&&this.delayGetHoppingFunction()}))}})}onMessageSource(){const e=this.getEngine();e.TUIStore.watch(a.CHAT,{messageSource:t=>{const s=this.getStoreData(a.CONV,"currentConversationID");if(!s||t&&t.conversationID!==s)return;if(S(t))return this.hoppingConfigMap.clear(),e.TUIStore.update(a.CHAT,"messageList",[]),e.TUIStore.update(a.CHAT,"nextReqMessageID",""),e.TUIStore.update(a.CHAT,"isCompleted",!1),void this.getMessageList();const n=this.getStoreData(a.CHAT,"messageList");n&&n.find((e=>t&&e.ID===t.ID))||(this.isSwitching?this.delayGetHoppingFunction=this.getMessageListHoppingForDown:this.getMessageListHoppingForDown())}})}getMessageListHoppingForDown(){const e=this.getStoreData(a.CHAT,"messageList"),{conversationID:t,sequence:s,time:n,ID:i}=this.getStoreData(a.CHAT,"messageSource");if(e&&e.find((e=>i&&e.ID===i)))return;const r=this.getEngine();r.TUIStore.update(a.CHAT,"messageList",[]),r.TUIStore.update(a.CHAT,"nextReqMessageID",""),r.TUIStore.update(a.CHAT,"isCompleted",!1),this.getMessageListHopping({conversationID:t,sequence:s,time:n,direction:1})}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const s=this.getEngine().chat.sendMessage(e,t);return this.getResponse(s)}getResponse(e,t=!0,s=!0){return e.then((e=>{const s=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(s,"edit"),e})).catch((e=>{var t;return s&&(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.message)&&this.updateMessageList([e.data.message],"edit"),Promise.reject(e)}))}updateMessageList(e,t=""){if(this.getStoreData(a.CHAT,"messageSource")&&"unshift"!==t&&"edit"!==t)return;const s=this.getStoreData(a.CHAT,"messageList"),n=this.updateTargetMessageList(e,s,t);this.getEngine().TUIStore.update(a.CHAT,"messageList",n)}updateTargetMessageList(e,t,s=""){const n=this.getStoreData(a.CONV,"currentConversationID"),i=e.filter((e=>e.conversationID===n));if(!s||0===i.length)return t;const r=t||[];let o=[];switch(s){case"edit":for(const e of t){const t=i.find((t=>t.ID===e.ID));o.push(t||e)}break;case"resend":o=r.filter((e=>e.ID!==i[0].ID)).concat(i);break;case"send":o=r.concat(this.typingHandler.filterTypingMessage(i));break;case"push":o=r.concat(this.typingHandler.filterTypingMessage(i)),this.getEngine().chat.setMessageRead({conversationID:n});break;case"unshift":o=i.filter((e=>0===r.length||!r.find((t=>t.ID===e.ID)))),o.push(...r)}return o}enterTypingState(){this.getStoreData(a.APP,"enableTyping")&&this.sendTyping(!0)}leaveTypingState(){this.getStoreData(a.APP,"enableTyping")&&this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),s=this.getStoreData(a.CONV,"currentConversationID");if(!s.startsWith(t.TYPES.CONV_C2C))return;const n=s.replace(t.TYPES.CONV_C2C,"");if(e){const e=this.getStoreData(a.CHAT,"messageList").filter((e=>"in"===e.flow));if(0===e.length)return;const t=1e3*e[e.length-1].time;if((new Date).getTime()-t>3e4)return}this.typingHandler.sendTyping(e,n)}quoteMessage(e){return this.getEngine().TUIStore.update(a.CHAT,"quoteMessage",{message:e,type:"quote"}),e}replyMessage(e){return this.getEngine().TUIStore.update(a.CHAT,"quoteMessage",{message:e,type:"reply"}),e}getCurrentConvInfo(){const{conversationID:e="",type:t}=this.getStoreData(a.CONV,"currentConversation")||{};return{to:e.replace(t,""),conversationType:t}}t(e){return this.getEngine().TUITranslate.t(e)||e}getMessageAbstractAndType(e){var t;const s=this.getEngine(),n={abstract:"",type:0};switch(e.type){case s.TYPES.MSG_TEXT:n.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,n.type=1;break;case s.TYPES.MSG_CUSTOM:n.abstract=this.t("[自定义消息]"),n.type=2;break;case s.TYPES.MSG_IMAGE:n.abstract=this.t("[图片]"),n.type=3;break;case s.TYPES.MSG_AUDIO:n.abstract=this.t("[语音]"),n.type=4;break;case s.TYPES.MSG_VIDEO:n.abstract=this.t("[视频]"),n.type=5;break;case s.TYPES.MSG_FILE:n.abstract=this.t("[文件]"),n.type=6;break;case s.TYPES.MSG_FACE:n.abstract=this.t("[表情]"),n.type=7}return n}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:s,type:n}=this.getMessageAbstractAndType(e),i={messageAbstract:s,messageSender:e.nick||e.from,messageID:e.ID},r=Object.assign(Object.assign({},i),{messageType:n,messageTime:null==e?void 0:e.time,messageSequence:null==e?void 0:e.sequence,version:1});if("reply"===t&&(r.messageRootID=e.ID,e.cloudCustomData)){const t=M(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(r.messageRootID=t.messageReply.messageRootID)}return{messageReply:r,messageReplyRoot:i}}getMessageInfo(e,t,s){const{messageReply:n,messageReplyRoot:i}=this.genMessageReply(t,s),r=e.cloudCustomData?M(e.cloudCustomData):{};let o;if(r.messageReply?r.messageReply=Object.assign(Object.assign({},n),r.messageReply):r.messageReply=n,"reply"===s){const{messageRootID:e}=n;o=this.getEngine().chat.findMessage(e);const t=(null==o?void 0:o.cloudCustomData)?M(o.cloudCustomData):{};t.messageReplies||(t.messageReplies={}),a=t.messageReplies.replies,("function"==typeof Array.isArray?Array.isArray(a):"array"===Object.prototype.toString.call(a).match(/^\[object (.*)\]$/)[1].toLowerCase())||(t.messageReplies.replies=[]),t.messageReplies.replies.push(i),o.cloudCustomData=JSON.stringify(t)}var a;return{cloudCustomData:JSON.stringify(r),rootMessage:o}}sendTextMessage(e,t){const s=this.getEngine(),{message:n,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};n&&(r=this.getMessageInfo(e,n,i));const o=s.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:r.cloudCustomData}));return this.sendMessage(o,t).then((e=>(r.rootMessage&&this.modifyMessage(r.rootMessage),s.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const s=this.getEngine(),{message:n,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};n&&(r=this.getMessageInfo(e,n,i));const o=s.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:r.cloudCustomData}));return this.sendMessage(o,t).then((e=>(r.rootMessage&&this.modifyMessage(r.rootMessage),s.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const s=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendAudioMessage(e,t){const s=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendVideoMessage(e,t){const s=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendCustomMessage(e,t){const s=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}sendFaceMessage(e,t){const s=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}sendFileMessage(e,t){const s=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendLocationMessage(e,t){const s=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}onProgress(e,t){const s=this.getEngine().TUIStore.getMessageModel(e);if(s){(t-s.progress>=.1||1===t)&&(s.progress=t,this.updateMessageList([s],"edit"))}}setAbstractList(e){const t=this.getEngine(),s=e.nick||e.from;let n="";switch(e.type){case t.TYPES.MSG_TEXT:return n=e.payload.text||"",n.length>20&&(n=n.slice(0,20)),`${s}: ${n}`;case t.TYPES.MSG_MERGER:return`${s}: ${this.t("[聊天记录]")}`;case t.TYPES.MSG_IMAGE:return`${s}: ${this.t("[图片]")}`;case t.TYPES.MSG_AUDIO:return`${s}: ${this.t("[音频]")}`;case t.TYPES.MSG_VIDEO:return`${s}: ${this.t("[视频]")}`;case t.TYPES.MSG_CUSTOM:return`${s}: ${this.t("[自定义消息]")}`;case t.TYPES.MSG_FILE:return`${s}: ${this.t("[文件]")}`;case t.TYPES.MSG_FACE:return`${s}: ${this.t("[动画表情]")}`}}genMergerForwardPayload(e){const{conversationType:t,nick:s,from:n,to:i}=e[0],r=[];return e.forEach((e=>{r.push(this.setAbstractList(e))})),{messageList:e,title:"GROUP"===t?"群聊的聊天记录":`${s||n} 和 ${i} 的聊天记录`,abstractList:r,compatibleText:"请升级IMSDK到v2.10.1或更高版本查看此消息"}}sendMergerForwardMessage(e){const{conversationList:t,messageList:s,params:n,sendMessageOptions:i}=e,r=[];for(let e=0;e<t.length;e++){const{conversationID:o,type:a}=t[e],u=Object.assign({to:o.replace(`${a}`,""),conversationType:a,payload:this.genMergerForwardPayload(s)},n),c=this.getEngine().chat.createMergerMessage(u);r.push(this.sendMessage(c,i))}return Promise.all(r)}getOriginMessageList(e){return e.map((e=>e instanceof oe?e.getMessage():e))}sendForwardMessage(e,t,s){t=this.getOriginMessageList(t);const i=s||{},{needMerge:r=!1,params:o={}}=i,a=n(i,["needMerge","params"]);if(r)return this.sendMergerForwardMessage({conversationList:e,messageList:t,params:o,sendMessageOptions:a});const u=[];for(let s=0;s<e.length;s++){const{conversationID:n,type:i}=e[s],r=Object.assign({to:n.replace(`${i}`,""),conversationType:i},o);for(let e=0;e<t.length;e++){Reflect.set(r,"payload",t[e]);const s=this.getEngine().chat.createForwardMessage(r);u.push(this.sendMessage(s,a))}}return Promise.all(u)}revokeMessage(e){const t=this.getEngine().chat.revokeMessage(e);return this.getResponse(t,!0,!1)}resendMessage(e){e.status="unSend",this.updateMessageList([e],"resend");const t=this.getEngine().chat.resendMessage(e);return this.getResponse(t,!0,!0)}deleteMessage(e){const t=this.getEngine().chat.deleteMessage(e);return this.getResponse(t,!0,!1)}setMessageExtensions(e,t){return this.getEngine().chat.setMessageExtensions(e,t)}getMessageExtensions(e){return this.getEngine().chat.getMessageExtensions(e)}deleteMessageExtensions(e,t){return this.getEngine().chat.deleteMessageExtensions(e,t)}modifyMessage(e){const t=this.getEngine().chat.modifyMessage(e);return this.getResponse(t,!0,!1).catch((e=>{const{code:t=0,data:s={}}=e.code;throw t===l.MSG_MODIFY_CONFLICT?console.warn(`${p.MSG_MODIFY_CONFLICT} data.message: ${null==s?void 0:s.message}`):t===l.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn(p.MSG_MODIFY_DISABLED_IN_AVCHATROOM):t===l.MODIFY_MESSAGE_NOT_EXIST&&console.warn(p.MODIFY_MESSAGE_NOT_EXIST),e}))}getMessageList(e={conversationID:this.getStoreData(a.CONV,"currentConversationID"),nextReqMessageID:this.getStoreData(a.CHAT,"nextReqMessageID")}){const t=this.getEngine();if(!t.chat.isReady())return Promise.reject({code:h.GET_MSG_LIST_ERROR,message:d.GET_MSG_LIST_ERROR});if(this.getStoreData(a.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});const s=this.getStoreData(a.CHAT,"messageSource"),n=this.hoppingConfigMap.get("nextMessageSeq"),i=this.hoppingConfigMap.get("nextMessageTime"),r=n||i;return s&&s.conversationID===e.conversationID&&r?this.getMessageListHopping():t.chat.getMessageList(e).then((e=>{const{messageList:s,nextReqMessageID:n,isCompleted:i}=e.data;return this.updateMessageList(s,"unshift"),t.TUIStore.update(a.CHAT,"nextReqMessageID",n),t.TUIStore.update(a.CHAT,"isCompleted",i),this.getMessageReactions({messageList:s}),this.readReceiptHandler.getMessageReadReceiptList(s),e})).catch((e=>Promise.reject(e)))}getMessageListHopping(e){var t;void 0===e&&(e={conversationID:null===(t=this.getStoreData(a.CHAT,"messageSource"))||void 0===t?void 0:t.conversationID,sequence:this.hoppingConfigMap.get("nextMessageSeq"),time:this.hoppingConfigMap.get("nextMessageTime")});const s=this.getEngine();return s.chat.getMessageListHopping(e).then((t=>{const{messageList:n,nextMessageSeq:i,nextMessageTime:r,isCompleted:o}=t.data,u=1===e.direction?e.sequence:i,c=1===e.direction?e.time:r;return this.updateMessageList(n,"unshift"),this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.set("nextMessageSeq",u),this.hoppingConfigMap.set("nextMessageTime",c),s.TUIStore.update(a.CHAT,"isCompleted",o),t})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e).then((e=>{const{isCompleted:t,cursor:s,messageID:n,unreadUserIDList:i,readUserIDList:r}=e.data,o={code:0,data:{cursor:s,isCompleted:t,messageID:n,unreadUserInfoList:[],readUserInfoList:[]}},a=[...i,...r];return 0===a.length?o:this.getEngine().TUIUser.getUserProfile({userIDList:a}).then((e=>(i.length>0?e.data.forEach((e=>{const{userID:t,nick:s="",avatar:n=""}=e;o.data.unreadUserInfoList.push({userID:t,nick:s,avatar:n})})):e.data.forEach((e=>{const{userID:t,nick:s="",avatar:n=""}=e;o.data.readUserInfoList.push({userID:t,nick:s,avatar:n})})),o)))}))}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e.getMessage())}translateText(e){return this.getEngine().chat.translateText(e)}searchCloudMessages(e){const t=this.getStoreData(a.CONV,"conversationList");return this.getEngine().chat.searchCloudMessages(e).then((e=>{const{searchResultList:s}=e.data;return e.data.searchResultList=s.map((e=>{const{messageList:s,conversationID:i}=e,r=n(e,["messageList","conversationID"]),o=s.map((e=>new oe(e))),a=t.find((e=>e.conversationID===i));return Object.assign(Object.assign({},r),{messageList:o.sort(((e,t)=>t.time-e.time)),conversation:a})})),e}))}addMessageReaction(e,t){return this.getEngine().chat.addMessageReaction(e.getMessage(),t)}removeMessageReaction(e,t){return this.getEngine().chat.removeMessageReaction(e.getMessage(),t)}getMessageReactions(e){const{messageList:t=[]}=e,s=this.getStoreData(a.APP,"enabledEmojiPlugin");console.log(`TUIChatService.getMessageReactions enabledEmojiPlugin:${s} messageList length:${t.length}`),s&&t.length>0&&this.getEngine().chat.getMessageReactions(e).then((e=>{const t=e.data.resultList||e.data;this.updateMessageReactionList(t)})).catch((e=>{console.warn(`TUIChatService.getMessageReactions error:${e.message}`)}))}getAllUserListOfMessageReaction(e){var t;return this.getEngine().chat.getAllUserListOfMessageReaction(Object.assign(Object.assign({},e),{message:null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.getMessage()}))}updateMessageReactionList(e){const t=[];e.forEach((e=>{const{messageID:s,reactionList:n}=e,i=this.getEngine().TUIStore.getMessageModel(s);if(i){const e=[];for(let t=0;t<n.length;t++){let s=!0;for(let e=0;e<i.reactionList.length;e++)if(n[t].reactionID===i.reactionList[e].reactionID){i.reactionList[e]=n[t],s=!1;break}s&&e.push(n[t])}i.reactionList.push(...e),e.length=0,t.push(i)}})),t.length>0&&this.updateMessageList(t,"edit")}}class Vt extends se{constructor(){super(),this.groupMap=new Map}static getInstance(){return Vt.instance||(Vt.instance=new Vt),Vt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getGroupInitData()}onGroupListUpdated(e){const t=this.getEngine();t.TUIStore.update(a.GRP,"groupList",e);const s=t.TUIStore.getData(a.GRP,"currentGroupID");e.forEach((e=>{e.groupID===s&&t.TUIStore.update(a.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID");let n=t.TUIStore.getData(a.GRP,"groupList");const{groupID:i,groupAttributes:r}=e;s===i&&t.TUIStore.update(a.GRP,"currentGroupAttributes",r),n=n.map((e=>(e.groupID===i&&(e.groupAttributes=r),e))),t.TUIStore.update(a.GRP,"groupList",n)}onGroupCounterUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID"),n=t.TUIStore.getData(a.GRP,"currentGroupCounters")||{};let i=t.TUIStore.getData(a.GRP,"groupList");const{groupID:r,key:o,value:u}=e;s===r&&(n[o]=u,t.TUIStore.update(a.GRP,"currentGroupCounters",n)),i=i.map((e=>(e.groupID===r&&(e.groupCounters=Object.assign(Object.assign({},e.groupCounters),{[o]:u})),e))),t.TUIStore.update(a.GRP,"groupList",i)}onMessageReceived(e){const t=this.getEngine(),s=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:s}=e,{operationType:n,userIDList:i}=s,r=t.TUIStore.getData(a.GRP,"currentGroupID");switch(n){case t.TYPES.GRP_TIP_MBR_JOIN:this.addMemberList(i);break;case t.TYPES.GRP_TIP_MBR_QUIT:case t.TYPES.GRP_TIP_MBR_KICKED_OUT:this.removeMemberList(i);break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:this.updateGroupMember(i);break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:this.getGroupProfile({groupID:r});break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:case t.TYPES.GRP_TIP_BAN_AVCHATROOM_MEMBER:case t.TYPES.GRP_TIP_UNBAN_AVCHATROOM_MEMBER:this.updateGroupMember(i)}}e.type===t.TYPES.MSG_GRP_SYS_NOTICE&&s.push(e)})),s.length>0&&t.TUIStore.update(a.GRP,"groupSystemNoticeList",s)}getGroupInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getGroupList().then((e=>{const{groupList:t=[]}=e.data;console.log(`TUIGroupService.init, getGroupList count:${t.length}`),t.length>0&&this.onGroupListUpdated(t)}))}updateGroupMember(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t){const s=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:n}=s.data;this.updateMemberList(n)}}))}resetCurrentStore(){this.getEngine().TUIStore.reset(a.GRP,["currentGroupID","currentGroup","currentGroupAttributes","currentGroupCounters","currentGroupMemberList"],!0)}switchGroup(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(s===e){const e=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(e)}this.resetCurrentStore(),t.TUIStore.update(a.GRP,"currentGroupID",e);try{yield this.getGroupInfo(e)}catch(e){Promise.reject(e)}const n=setTimeout((()=>{this.groupMap.delete(e),clearTimeout(n)}),5e3),i=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(i)}))}getGroupInfo(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine(),s=this.groupMap.get(e);if(s)return this.updateMemberList((null==s?void 0:s.memberList)||[]),t.TUIStore.update(a.GRP,"currentGroup",s.group),t.TUIStore.update(a.GRP,"currentGroupAttributes",s.groupAttributes||{}),void t.TUIStore.update(a.GRP,"currentGroupCounters",s.counters||{});const n={group:{},memberList:[],groupAttributes:void 0,counters:void 0},{data:{group:i}}=yield this.getGroupProfile({groupID:e});n.group=i;const{data:{memberList:r}}=yield this.getGroupMemberList({groupID:e});n.memberList=r;const o=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:u}=o.data;n.groupAttributes=u,t.TUIStore.update(a.GRP,"currentGroupAttributes",u);try{const s=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:n}=s.data;t.TUIStore.update(a.GRP,"currentGroupCounters",n)}catch(e){console.warn(e)}this.groupMap.set(e,n)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((s=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{group:e}=s.data;t.TUIStore.update(a.GRP,"currentGroup",e)}return s}))))}updateGroupProfile(e){return this.getEngine().chat.updateGroupProfile(e)}createGroup(e){return this.getEngine().chat.createGroup(e)}dismissGroup(e){return this.getEngine().chat.dismissGroup(e)}searchGroupByID(e){const t=this.getEngine();return t.chat.searchGroupByID(e).then((e=>{const{group:s}=e.data,n=t.TUIStore.getData(a.GRP,"groupList");return e.data.group.isJoinedGroup=n.some((e=>e.groupID===s.groupID)),e}))}joinGroup(e){return this.getEngine().chat.joinGroup(e)}quitGroup(e){return this.getEngine().chat.quitGroup(e)}getGroupApplicationList(){return this.getEngine().chat.getGroupApplicationList()}handleGroupApplication(e){return this.getEngine().chat.handleGroupApplication(e)}getGroupOnlineMemberCount(e){return this.getEngine().chat.getGroupOnlineMemberCount(e)}changeGroupOwner(e){return this.getEngine().chat.changeGroupOwner(e)}initGroupAttributes(e){return this.getEngine().chat.initGroupAttributes(e)}setGroupAttributes(e){return this.getEngine().chat.setGroupAttributes(e)}deleteGroupAttributes(e){return this.getEngine().chat.deleteGroupAttributes(e)}getGroupAttributes(e){return this.getEngine().chat.getGroupAttributes(e)}setGroupCounters(e){return this.getEngine().chat.setGroupCounters(e)}increaseGroupCounter(e){return this.getEngine().chat.increaseGroupCounter(e)}decreaseGroupCounter(e){return this.getEngine().chat.decreaseGroupCounter(e)}getGroupCounters(e){return this.getEngine().chat.getGroupCounters(e)}updateMemberList(e){const t=this.getEngine(),s=[...(t.TUIStore.getData(a.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(a.GRP,"currentGroupMemberList",s)}addMemberList(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t)try{const s=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:n}=s.data;this.updateMemberList(n)}catch(t){const s=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(s)}}))}removeMemberList(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(a.GRP,"currentGroupMemberList",s)}getGroupMemberList(e){const t=this.getEngine();return t.chat.getGroupMemberList(e).then((s=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{memberList:e}=s.data;this.updateMemberList(e)}return s}))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((s=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:n}=s.data;t.TUIStore.update(a.GRP,"currentGroup",n),this.addMemberList(e)}return s}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((s=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:n}=s.data;this.removeMemberList(e),t.TUIStore.update(a.GRP,"currentGroup",n)}return s}))}setGroupMemberMuteTime(e){return this.getEngine().chat.setGroupMemberMuteTime(e)}setGroupMemberRole(e){return this.getEngine().chat.setGroupMemberRole(e)}setGroupMemberNameCard(e){return this.getEngine().chat.setGroupMemberNameCard(e)}setGroupMemberCustomField(e){return this.getEngine().chat.setGroupMemberCustomField(e)}markGroupMemberList(e){return this.getEngine().chat.markGroupMemberList(e)}}class Ft extends se{constructor(){super()}static getInstance(){return Ft.instance||(Ft.instance=new Ft),Ft.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated.bind(this))}onFriendListUpdated(e){this.getEngine().TUIStore.update(a.FRIEND,"friendList",e)}onFriendApplicationListUpdated(e){const{friendApplicationList:t,unreadCount:s=0}=e,n=this.getEngine();n.TUIStore.update(a.FRIEND,"friendApplicationList",t),n.TUIStore.update(a.FRIEND,"friendApplicationUnreadCount",s)}getFriendList(){return this.getEngine().chat.getFriendList()}getFriendRemark(e){const t=this.getEngine().TUIStore.getData(a.FRIEND,"friendList"),s={};return e.forEach((e=>{for(let n=0;n<t.length;n++)t[n].userID!==e||(s[e]=t[n].remark)})),s}addFriend(e){return this.getEngine().chat.addFriend(e)}deleteFriend(e){return this.getEngine().chat.deleteFriend(e)}checkFriend(e){return this.getEngine().chat.checkFriend(e)}getFriendProfile(e){return this.getEngine().chat.getFriendProfile(e)}updateFriend(e){return this.getEngine().chat.updateFriend(e)}acceptFriendApplication(e){return this.getEngine().chat.acceptFriendApplication(e)}refuseFriendApplication(e){return this.getEngine().chat.refuseFriendApplication({userID:e})}deleteFriendApplication(e){return this.getEngine().chat.deleteFriendApplication(e)}setFriendApplicationRead(){return this.getEngine().chat.setFriendApplicationRead()}}class $t{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(e){return"function"!=typeof e&&console.error("middleware must be a function"),this.cache.push(e),this}next(){if(this.middlewares&&this.middlewares.length>0){return this.middlewares.shift().call(this,this.options,this.next.bind(this))}}run(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}function Ht(e,t,s){const n=Object.create(null);Object.keys(s).forEach((s=>{if(!t[s])return;n[s]=t[s];const i=new $t;t[s]=function(){const r=Array.from(arguments);return i.use((function(t,n){return e.isInited?n():Promise.reject({code:h.NOT_INIT,message:`${s} | ${d.NOT_INIT}`})})).use((function(e,i){return n[s].apply(t,e)})),i.run(r)}}))}console.log("TUIChatEngine.VERSION:2.0.8");const Yt=Q.getInstance(),Bt=W.getInstance(),Kt=pe.getInstance(),qt=Ct.getInstance(),zt=Dt.getInstance(),Jt=Gt.getInstance(),Wt=wt.getInstance(),Xt=Vt.getInstance(),Zt=Ft.getInstance();Yt.mount(o.TUIStore,Kt),Yt.mount(o.TUITranslate,qt),Yt.mount(o.TUIConversation,zt),Yt.mount(o.TUIUser,Jt),Yt.mount(o.TUIChat,Wt),Yt.mount(o.TUIGroup,Xt),Yt.mount(o.TUIFriend,Zt),Ht(Yt,Yt,f),Ht(Yt,zt,m),Ht(Yt,Wt,E),Ht(Yt,Xt,v),Ht(Yt,Jt,T),Ht(Yt,Zt,I);export{a as StoreName,Wt as TUIChatService,zt as TUIConversationService,Zt as TUIFriendService,Bt as TUIGlobal,Xt as TUIGroupService,Kt as TUIStore,qt as TUITranslateService,Jt as TUIUserService,Yt as default};
1
+ import e from"@tencentcloud/chat";import t from"tim-upload-plugin";import s from"tim-profanity-filter-plugin";function n(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(s[n[i]]=e[n[i]])}return s}function i(e,t,s,n){return new(s||(s=Promise))((function(i,r){function o(e){try{u(n.next(e))}catch(e){r(e)}}function a(e){try{u(n.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class r{constructor(e){return r.instance||(r.instance=this,this.engine=e,this.events={},this.bindIMEvents()),r.instance}addEvent(e,t){this.events[e]||(this.events[e]=new Map),this.events[e].set(t,1)}removeEvents(){Object.keys(this.events).forEach((e=>{this.events[e].clear()})),this.events={}}dispatch(e,t){if(this.events[e])for(const s of this.events[e].keys())s.call(this,t)}bindIMEvents(){this.engine.chat.on(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.on(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.on(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.on(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.on(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.on(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.on(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.on(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.on(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.on(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.on(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.on(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}unbindIMEvents(){this.engine.chat.off(this.engine.EVENT.SDK_READY,this.onSDKReady,this),this.engine.chat.off(this.engine.EVENT.SDK_NOT_READY,this.onSDKNotReady,this),this.engine.chat.off(this.engine.EVENT.KICKED_OUT,this.onKickedOut,this),this.engine.chat.off(this.engine.EVENT.NET_STATE_CHANGE,this.onNetStateChange,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_RECEIVED,this.onReceiveMessage,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_MODIFIED,this.onMessageModified,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REVOKED,this.onMessageRevoked,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived,this),this.engine.chat.off(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated,this),this.engine.chat.off(this.engine.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated,this),this.engine.chat.off(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalMessageCountUpdated,this),this.engine.chat.off(this.engine.EVENT.PROFILE_UPDATED,this.onProfileUpdated,this),this.engine.chat.off(this.engine.EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated,this),this.engine.chat.off(this.engine.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated,this),this.engine.chat.off(this.engine.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated,this),this.engine.chat.off(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated,this)}onSDKReady(e){this.dispatch(this.engine.EVENT.SDK_READY,e.data)}onSDKNotReady(e){this.dispatch(this.engine.EVENT.SDK_NOT_READY,e.data)}onKickedOut(e){this.dispatch(this.engine.EVENT.KICKED_OUT,e.data)}onNetStateChange(e){this.dispatch(this.engine.EVENT.NET_STATE_CHANGE,e.data)}onReceiveMessage(e){this.dispatch(this.engine.EVENT.MESSAGE_RECEIVED,e.data)}onMessageModified(e){this.dispatch(this.engine.EVENT.MESSAGE_MODIFIED,e.data)}onMessageRevoked(e){this.dispatch(this.engine.EVENT.MESSAGE_REVOKED,e.data)}onMessageReadByPeer(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_BY_PEER,e.data)}onMessageReadReceiptReceived(e){this.dispatch(this.engine.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,e.data)}onMessageReactionsUpdated(e){this.dispatch(this.engine.EVENT.MESSAGE_REACTIONS_UPDATED,e.data)}onConversationListUpdated(e){this.dispatch(this.engine.EVENT.CONVERSATION_LIST_UPDATED,e.data)}onTotalMessageCountUpdated(e){this.dispatch(this.engine.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,e.data)}onProfileUpdated(e){this.dispatch(this.engine.EVENT.PROFILE_UPDATED,e.data)}onBlacklistUpdated(e){this.dispatch(this.engine.EVENT.BLACKLIST_UPDATED,e.data)}onUserStatusUpdated(e){this.dispatch(this.engine.EVENT.USER_STATUS_UPDATED,e.data)}onGroupListUpdated(e){this.dispatch(this.engine.EVENT.GROUP_LIST_UPDATED,e.data)}onGroupAttributesUpdated(e){this.dispatch(this.engine.EVENT.GROUP_ATTRIBUTES_UPDATED,e.data)}onGroupCounterUpdated(e){this.dispatch(this.engine.EVENT.GROUP_COUNTER_UPDATED,e.data)}onFriendListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_LIST_UPDATED,e.data)}onFriendApplicationListUpdated(e){this.dispatch(this.engine.EVENT.FRIEND_APPLICATION_LIST_UPDATED,e.data)}}var o,a,u,c,g,l,h,p,d;!function(e){e.TUIStore="TUIStore",e.TUITranslate="TUITranslate",e.TUIConversation="TUIConversation",e.TUIChat="TUIChat",e.TUIGroup="TUIGroup",e.TUIUser="TUIUser",e.TUIFriend="TUIFriend"}(o||(o={})),function(e){e.APP="application",e.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",e.FRIEND="friend",e.SEARCH="search",e.CUSTOM="custom"}(a||(a={})),function(e){e[e.UNSUB_USER=-1]="UNSUB_USER"}(u||(u={})),function(e){e.BUSINESS_ID="user_typing_status",e[e.STATUS_START=1]="STATUS_START",e[e.STATUS_END=0]="STATUS_END",e[e.VERSION=1]="VERSION",e[e.ACTION_START_ID=14]="ACTION_START_ID",e[e.ACTION_END_ID=0]="ACTION_END_ID",e.ACTION_START="EIMAMSG_InputStatus_Ing",e.ACTION_END="EIMAMSG_InputStatus_End",e[e.NEED_TYPING=1]="NEED_TYPING"}(c||(c={})),function(e){e.ADD="add",e.REMOVE="remove"}(g||(g={})),function(e){e[e.MSG_MODIFY_CONFLICT=2480]="MSG_MODIFY_CONFLICT",e[e.MSG_MODIFY_DISABLED_IN_AVCHATROOM=2481]="MSG_MODIFY_DISABLED_IN_AVCHATROOM",e[e.MODIFY_MESSAGE_NOT_EXIST=20026]="MODIFY_MESSAGE_NOT_EXIST"}(l||(l={})),function(e){e[e.NOT_INIT=-1e5]="NOT_INIT",e[e.INVALID_CONV_ID=-100001]="INVALID_CONV_ID",e[e.CONV_ID_SAME=-100002]="CONV_ID_SAME",e[e.CONV_NOT_EXIST=-100003]="CONV_NOT_EXIST",e[e.GET_MSG_LIST_ERROR=-100004]="GET_MSG_LIST_ERROR",e[e.MISMATCH_TYPE_AND_PAYLOAD=-100005]="MISMATCH_TYPE_AND_PAYLOAD"}(h||(h={})),function(e){e.MSG_MODIFY_CONFLICT="MODIFY_MESSAGE_ERROR,修改消息发生冲突, data.message 是最新的消息",e.MSG_MODIFY_DISABLED_IN_AVCHATROOM="MODIFY_MESSAGE_ERROR,不支持修改直播群消息.",e.MODIFY_MESSAGE_NOT_EXIST="MODIFY_MESSAGE_ERROR,消息不存在."}(p||(p={})),function(e){e.NOT_INIT="TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。",e.INVALID_CONV_ID="会话 ID 无效",e.CONV_ID_SAME="您切换的是同一个会话 ID",e.CONV_NOT_EXIST="会话不存在",e.GET_MSG_LIST_ERROR="Chat SDK is not ready.",e.MISMATCH_TYPE_AND_PAYLOAD="type 与 payload 不匹配."}(d||(d={}));const f={logout:1,destroy:1},m={deleteConversation:1,pinConversation:1,muteConversation:1,switchConversation:1,getConversationProfile:1,clearHistoryMessage:1},E={modifyMessage:1,revokeMessage:1,resendMessage:1,deleteMessage:1,quoteMessage:1,replyMessage:1,setMessageExtensions:1,deleteMessageExtensions:1,getMessageExtensions:1,sendTextMessage:1,sendTextAtMessage:1,sendImageMessage:1,sendAudioMessage:1,sendVideoMessage:1,sendFileMessage:1,sendCustomMessage:1,sendFaceMessage:1,sendLocationMessage:1,sendForwardMessage:1,enterTypingState:1,leaveTypingState:1,sendMessageReadReceipt:1,getGroupMessageReadMemberList:1,getMessageList:1,downloadMergedMessages:1,setTranslationLanguage:1,translateText:1,searchCloudMessages:1,addMessageReaction:1,removeMessageReaction:1,getMessageReactions:1,getAllUserListOfMessageReaction:1},v={switchGroup:1,getGroupProfile:1,updateGroupProfile:1,createGroup:1,dismissGroup:1,searchGroupByID:1,joinGroup:1,quitGroup:1,getGroupApplicationList:1,handleGroupApplication:1,getGroupOnlineMemberCount:1,changeGroupOwner:1,initGroupAttributes:1,setGroupAttributes:1,deleteGroupAttributes:1,getGroupAttributes:1,setGroupCounters:1,increaseGroupCounter:1,decreaseGroupCounter:1,getGroupCounters:1,getGroupMemberList:1,getGroupMemberProfile:1,addGroupMember:1,deleteGroupMember:1,setGroupMemberMuteTime:1,setGroupMemberRole:1,setGroupMemberNameCard:1,setGroupMemberCustomField:1,markGroupMemberList:1},T={switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1,addToBlacklist:1,removeFromBlacklist:1},I={getFriendList:1,addFriend:1,deleteFriend:1,checkFriend:1,getFriendProfile:1,updateFriend:1,acceptFriendApplication:1,refuseFriendApplication:1,deleteFriendApplication:1,setFriendApplicationRead:1},S=function(e){return void 0===e},y=function(e){return e.startsWith("_")},b=function(e){return/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(e)};const U=function(e){return e&&function(e){if("string"==typeof e)try{return!!JSON.parse(e)}catch(e){return!1}return!1}(e)?JSON.parse(e):e},M=function(e){let t="";return t=e>=1048576?`${(e/1048576).toFixed(2)} Mb`:e>=1024?`${(e/1024).toFixed(2)} Kb`:`${e.toFixed(2)}B`,t},O="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",D="https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.svg",C="https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png",_="https://web.sdk.qcloud.com/im/assets/emoji-plugin/",P="https://web.sdk.qcloud.com/im/assets/face-elem/",R="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&",L="https://apis.map.qq.com/ws/staticmap/v2/?",j={"[TUIEmoji_Expect]":"emoji_0@2x.png","[TUIEmoji_Blink]":"emoji_1@2x.png","[TUIEmoji_Guffaw]":"emoji_2@2x.png","[TUIEmoji_KindSmile]":"emoji_3@2x.png","[TUIEmoji_Haha]":"emoji_4@2x.png","[TUIEmoji_Cheerful]":"emoji_5@2x.png","[TUIEmoji_Smile]":"emoji_6@2x.png","[TUIEmoji_Sorrow]":"emoji_7@2x.png","[TUIEmoji_Speechless]":"emoji_8@2x.png","[TUIEmoji_Amazed]":"emoji_9@2x.png","[TUIEmoji_Complacent]":"emoji_10@2x.png","[TUIEmoji_Lustful]":"emoji_11@2x.png","[TUIEmoji_Stareyes]":"emoji_12@2x.png","[TUIEmoji_Giggle]":"emoji_13@2x.png","[TUIEmoji_Daemon]":"emoji_14@2x.png","[TUIEmoji_Rage]":"emoji_15@2x.png","[TUIEmoji_Yawn]":"emoji_16@2x.png","[TUIEmoji_TearsLaugh]":"emoji_17@2x.png","[TUIEmoji_Silly]":"emoji_18@2x.png","[TUIEmoji_Wail]":"emoji_19@2x.png","[TUIEmoji_Kiss]":"emoji_20@2x.png","[TUIEmoji_Trapped]":"emoji_21@2x.png","[TUIEmoji_Fear]":"emoji_22@2x.png","[TUIEmoji_BareTeeth]":"emoji_23@2x.png","[TUIEmoji_FlareUp]":"emoji_24@2x.png","[TUIEmoji_Tact]":"emoji_25@2x.png","[TUIEmoji_Shit]":"emoji_26@2x.png","[TUIEmoji_ShutUp]":"emoji_27@2x.png","[TUIEmoji_Sigh]":"emoji_28@2x.png","[TUIEmoji_Hehe]":"emoji_29@2x.png","[TUIEmoji_Silent]":"emoji_30@2x.png","[TUIEmoji_Skull]":"emoji_31@2x.png","[TUIEmoji_Mask]":"emoji_32@2x.png","[TUIEmoji_Beer]":"emoji_33@2x.png","[TUIEmoji_Cake]":"emoji_34@2x.png","[TUIEmoji_RedPacket]":"emoji_35@2x.png","[TUIEmoji_Bombs]":"emoji_36@2x.png","[TUIEmoji_Ai]":"emoji_37@2x.png","[TUIEmoji_Celebrate]":"emoji_38@2x.png","[TUIEmoji_Bless]":"emoji_39@2x.png","[TUIEmoji_Flower]":"emoji_40@2x.png","[TUIEmoji_Watermelon]":"emoji_41@2x.png","[TUIEmoji_Cow]":"emoji_42@2x.png","[TUIEmoji_Fool]":"emoji_43@2x.png","[TUIEmoji_Surprised]":"emoji_44@2x.png","[TUIEmoji_Askance]":"emoji_45@2x.png","[TUIEmoji_Monster]":"emoji_46@2x.png","[TUIEmoji_Pig]":"emoji_47@2x.png","[TUIEmoji_Coffee]":"emoji_48@2x.png","[TUIEmoji_Ok]":"emoji_49@2x.png","[TUIEmoji_Heart]":"emoji_50@2x.png","[TUIEmoji_Sun]":"emoji_51@2x.png","[TUIEmoji_Moon]":"emoji_52@2x.png","[TUIEmoji_Star]":"emoji_53@2x.png","[TUIEmoji_Rich]":"emoji_54@2x.png","[TUIEmoji_Fortune]":"emoji_55@2x.png","[TUIEmoji_857]":"emoji_56@2x.png","[TUIEmoji_666]":"emoji_57@2x.png","[TUIEmoji_Prohibit]":"emoji_58@2x.png","[TUIEmoji_Convinced]":"emoji_59@2x.png","[TUIEmoji_Knife]":"emoji_60@2x.png","[TUIEmoji_Like]":"emoji_61@2x.png"},A={"[TUIEmoji_Smile]":"[微笑]","[TUIEmoji_Expect]":"[期待]","[TUIEmoji_Blink]":"[眨眼]","[TUIEmoji_Guffaw]":"[大笑]","[TUIEmoji_KindSmile]":"[姨母笑]","[TUIEmoji_Haha]":"[哈哈哈]","[TUIEmoji_Cheerful]":"[愉快]","[TUIEmoji_Speechless]":"[无语]","[TUIEmoji_Amazed]":"[惊讶]","[TUIEmoji_Sorrow]":"[悲伤]","[TUIEmoji_Complacent]":"[得意]","[TUIEmoji_Silly]":"[傻了]","[TUIEmoji_Lustful]":"[色]","[TUIEmoji_Giggle]":"[憨笑]","[TUIEmoji_Kiss]":"[亲亲]","[TUIEmoji_Wail]":"[大哭]","[TUIEmoji_TearsLaugh]":"[哭笑]","[TUIEmoji_Trapped]":"[困]","[TUIEmoji_Mask]":"[口罩]","[TUIEmoji_Fear]":"[恐惧]","[TUIEmoji_BareTeeth]":"[龇牙]","[TUIEmoji_FlareUp]":"[发怒]","[TUIEmoji_Yawn]":"[打哈欠]","[TUIEmoji_Tact]":"[机智]","[TUIEmoji_Stareyes]":"[星星眼]","[TUIEmoji_ShutUp]":"[闭嘴]","[TUIEmoji_Sigh]":"[叹气]","[TUIEmoji_Hehe]":"[呵呵]","[TUIEmoji_Silent]":"[收声]","[TUIEmoji_Surprised]":"[惊喜]","[TUIEmoji_Askance]":"[白眼]","[TUIEmoji_Ok]":"[OK]","[TUIEmoji_Shit]":"[便便]","[TUIEmoji_Monster]":"[怪兽]","[TUIEmoji_Daemon]":"[恶魔]","[TUIEmoji_Rage]":"[恶魔怒]","[TUIEmoji_Fool]":"[衰]","[TUIEmoji_Pig]":"[猪]","[TUIEmoji_Cow]":"[牛]","[TUIEmoji_Ai]":"[AI]","[TUIEmoji_Skull]":"[骷髅]","[TUIEmoji_Bombs]":"[炸弹]","[TUIEmoji_Coffee]":"[咖啡]","[TUIEmoji_Cake]":"[蛋糕]","[TUIEmoji_Beer]":"[啤酒]","[TUIEmoji_Flower]":"[花]","[TUIEmoji_Watermelon]":"[瓜]","[TUIEmoji_Rich]":"[壕]","[TUIEmoji_Heart]":"[爱心]","[TUIEmoji_Moon]":"[月亮]","[TUIEmoji_Sun]":"[太阳]","[TUIEmoji_Star]":"[星星]","[TUIEmoji_RedPacket]":"[红包]","[TUIEmoji_Celebrate]":"[庆祝]","[TUIEmoji_Bless]":"[福]","[TUIEmoji_Fortune]":"[发]","[TUIEmoji_Convinced]":"[服]","[TUIEmoji_Prohibit]":"[禁]","[TUIEmoji_666]":"[666]","[TUIEmoji_857]":"[857]","[TUIEmoji_Knife]":"[刀]","[TUIEmoji_Like]":"[赞]"},G={enabledMessageReadReceipt:Math.pow(2,5),enabledEmojiPlugin:Math.pow(2,48),enabledOnlineStatus:Math.pow(2,7),enabledCustomerServicePlugin:Math.pow(2,40),enabledTranslationPlugin:Math.pow(2,38)},N=["messageList","conversationList","newMessageList"],k="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),x="undefined"!=typeof uni&&"undefined"==typeof window,w=k||x,V="undefined"!=typeof uni,F=("undefined"!=typeof uni||"undefined"!=typeof window)&&!w,$=k?wx:V?uni:window,H=F&&window&&window.navigator&&window.navigator.userAgent||"",Y=/Android/i.test(H),B=/(?:Windows Phone)/.test(H),K=/(?:SymbianOS)/.test(H),q=/iPad/i.test(H)||/iPhone/i.test(H)||/iPod/i.test(H),z=Y||B||K||q,J=F&&!z;class W{constructor(){this.global=$,this.isOfficial=!1}static getInstance(){return W.instance||(W.instance=new W),W.instance}initOfficial(e){this.isOfficial=e}getPlatform(){let e="";return J?e="pc":z?e="h5":k?e="wechat":x&&!k&&(e="app"),e}}const X="group-module",Z="relationship-module";class Q{constructor(){this.EVENT=e.EVENT,this.TYPES=e.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return Q.instance||(Q.instance=new Q),Q.instance}mount(e,t){this[e]=t}login(t){const{chat:s,SDKAppID:n,userID:i}=t,o=1400187352===n||1400188366===n;return this.createChat(t),this.userID=i,W.getInstance().initOfficial(o),this.TUIStore.update(a.APP,"isOfficial",o),this.TUIStore.update(a.APP,"SDKVersion",e.VERSION),this.eventCenter=new r(this),this.eventCenter.removeEvents(),this.initStore(),this.initService(),s&&s.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),this.checkCommercialAbility(),Promise.resolve({})):(this.registerPlugin(t),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(t))}logout(){return this.userID="",this.isInited=!1,this.chat.logout()}isReady(){var e;return(null===(e=this.chat)||void 0===e?void 0:e.isReady())||!1}setLogLevel(e){if(this.chat)return this.chat.setLogLevel(e);console.warn("TUIChatEngine 初始化未完成,请确认 TUIChatEngine.login 接口调用是否正常。")}destroy(){return this.eventCenter.unbindIMEvents(),this.isInited=!1,this.chat.destroy()}getMyUserID(){return this.userID}initStore(){this.TUIStore.reset(a.CHAT),this.TUIStore.reset(a.CONV),this.TUIStore.reset(a.GRP),this.TUIStore.reset(a.USER),this.TUIStore.reset(a.SEARCH),console.log("TUIChatEngine.initStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIUser.init(),this.initOptionalServices(),this.isInited=!0,console.log("TUIChatEngine.initService ok.")}initOptionalServices(){const t=e.VERSION.split(".");t[0]>3||3===t[0]&&t[1]>=3&&t[2]>0?(!0===this.chat.callExperimentalAPI("canIUseModule",[X])&&this.TUIGroup.init(),!0===this.chat.callExperimentalAPI("canIUseModule",[Z])&&this.TUIFriend.init()):(this.TUIGroup.init(),this.TUIFriend.init())}createChat(t){const{chat:s}=t,i=n(t,["chat"]);S(s)?this.chat=e.create(Object.assign(Object.assign({},i),{scene:"chat-uikit-engine"})):this.chat=s}loginChat(e){const{userID:t,userSig:s}=e;return new Promise(((e,n)=>{this.chat.login({userID:t,userSig:s}).then((t=>{console.log("TUIChatEngine.loginChat ok."),this.checkCommercialAbility(),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:n,imResponse:t})})).catch((e=>{n(e)}))}))}registerPlugin(e){const{useUploadPlugin:n=!1,useProfanityFilterPlugin:i=!1,TIMPush:r,pushConfig:o,TUIOfflinePush:a,offlinePushConfig:u}=e;!0===n&&this.chat.registerPlugin({"tim-upload-plugin":t}),!0===i&&this.chat.registerPlugin({"tim-profanity-filter-plugin":s}),!x||k||S(r)||S(o)||this.chat.registerPlugin({"tim-push":r,pushConfig:o}),!x||k||S(a)||S(u)||this.chat.registerPlugin({"tim-offline-push-plugin":a,offlinePushConfig:u})}onSDKReady(){if(this.loginStatusPromise.has("login")){const e=this.loginStatusPromise.get("login");e.resolve(e.imResponse),this.TUIUser.getUserProfile()}this.loginStatusPromise.delete("login")}onSDKNotReady(){if(this.loginStatusPromise.has("login")){this.loginStatusPromise.get("login").reject(new Error("sdk not ready"))}this.loginStatusPromise.delete("login")}checkCommercialAbility(){Object.keys(G).forEach((e=>{const t=G[e];this.chat.callExperimentalAPI("isCommercialAbilityEnabled",t).then((t=>{const{enabled:s=!1}=t.data;this.TUIStore.update(a.APP,e,s)}))}))}}class ee{constructor(){this.defaultStore={enabledMessageReadReceipt:!1,enabledEmojiPlugin:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enableTyping:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1}},this.store={enabledEmojiPlugin:!1,enabledMessageReadReceipt:!1,enabledOnlineStatus:!1,enabledCustomerServicePlugin:!1,enabledTranslationPlugin:!1,enableTyping:!0,isOfficial:!1,SDKVersion:"3.0.0",tasks:{sendMessage:!1,revokeMessage:!1,modifyNickName:!1,groupChat:!1,muteGroup:!1,dismissGroup:!1,call:!1,searchCloudMessage:!1,customerService:!1}}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class te{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"},this.store={userProfile:{},displayOnlineStatus:!1,displayMessageReadReceipt:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",userBlacklist:[],targetLanguage:"zh"}}update(e,t){if("userStatusList"===e)this.updateUserStatusList(t);else this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateUserStatusList(e){0!==e.length?e.forEach((e=>{const{userID:t,statusType:s=0,customStatus:n=""}=e;s===u.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:s,customStatus:n})})):this.store.userStatusList.clear()}}class se{getEngine(){return Q.getInstance()}}const ne=function(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let s=t;for(;null!==Object.getPrototypeOf(s);)s=Object.getPrototypeOf(s);return t===s}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1};class ie extends se{constructor(e){super(),this.initProxy(e),this.isMuted=this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_ACPT_NOT_NOTE||this.messageRemindType===this.getEngine().TYPES.MSG_REMIND_DISCARD,this.operationType=0,this._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}updateProperties(e){this._conversation=e,Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}getConversation(){return this._conversation}deleteConversation(){return this.getEngine().TUIConversation.deleteConversation(this.conversationID)}pinConversation(){return this.getEngine().TUIConversation.pinConversation({conversationID:this.conversationID,isPinned:!this.isPinned})}muteConversation(){const e=this.getEngine(),t={messageRemindType:!0===this.isMuted?e.TYPES.MSG_REMIND_ACPT_AND_NOTE:e.TYPES.MSG_REMIND_ACPT_NOT_NOTE};if(this.type===e.TYPES.CONV_C2C){const s=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[s]}else if(this.type===e.TYPES.CONV_GROUP){const s=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=s}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,s,n,i,r;const o=this.getEngine();let a="";switch(this.type){case o.TYPES.CONV_C2C:a=b(null===(e=this.userProfile)||void 0===e?void 0:e.avatar)?null===(t=this.userProfile)||void 0===t?void 0:t.avatar:O;break;case o.TYPES.CONV_GROUP:a=b(null===(s=this.groupProfile)||void 0===s?void 0:s.avatar)?null===(n=this.groupProfile)||void 0===n?void 0:n.avatar:D;break;case o.TYPES.CONV_SYSTEM:a=b(null===(i=this.groupProfile)||void 0===i?void 0:i.avatar)?null===(r=this.groupProfile)||void 0===r?void 0:r.avatar:C}return a}getShowName(){var e,t,s,n;const i=this.getEngine();let r="";switch(this.type){case i.TYPES.CONV_C2C:r=this.remark||(null===(e=this.userProfile)||void 0===e?void 0:e.nick)||(null===(t=this.userProfile)||void 0===t?void 0:t.userID)||"";break;case i.TYPES.CONV_GROUP:r=(null===(s=this.groupProfile)||void 0===s?void 0:s.name)||(null===(n=this.groupProfile)||void 0===n?void 0:n.groupID)||"";break;case i.TYPES.CONV_SYSTEM:r=i.TUITranslate.t("系统通知")}return r}getGroupAtInfo(){const e=this.getEngine(),t=e.TUITranslate.t.bind(e.TUITranslate),s=[`[${t("TUIConversation.有人@我")}]`,`[${t("TUIConversation.@所有人")}]`,`[${t("TUIConversation.@所有人")}][${t("TUIConversation.有人@我")}]`];let n="";for(let e=0;e<this.groupAtInfoList.length;e++)this.groupAtInfoList[e].atTypeArray[0]&&this.unreadCount>0&&(n=s[this.groupAtInfoList[e].atTypeArray[0]-1]);return n}getLastMessage(e){return"time"===e?this.getLastMessageTime():"text"===e?this.getLastMessageText():(console.warn(`ConversationModel.getLastMessage key:${e} is invalid.`),null)}getLastMessageTime(){var e;const t=this.getEngine();let s="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(s=function(e,t){const s=6e4,n=36e5,i=24*n,r=7*i,o=(new Date).getTime()-e;let a="";if(o<0)return a;const u=o/s,c=o/n,g=o/i,l=o/r;if(l>=1&&l<=4)a=` ${parseInt(`${l}`,10)} ${t("time.周")}${t("time.前")}`;else if(g>=1&&g<=6)a=` ${parseInt(`${g}`,10)} ${t("time.天")}${t("time.前")}`;else if(c>=1&&c<=23)a=` ${parseInt(`${c}`,10)} ${t("time.小时")}${t("time.前")}`;else if(u>=1&&u<=59)a=` ${parseInt(`${u}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(o>=0&&o<=s)a=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),a=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return a}(1e3*this.lastMessage.lastTime,t.TUITranslate.t.bind(t.TUITranslate))),s}getLastMessageText(){var e;const t=this.getEngine(),s=t.TUITranslate.t.bind(t.TUITranslate);if(4===this.operationType)return s("TUIConversation.您已被群管理员移出群聊");if(5===this.operationType)return s("TUIConversation.该群聊已被解散");if(8===this.operationType)return s("TUIConversation.您已退出该群聊");const n=this._conversation,i=this.lastMessage;let r="",o="";const a=n.unreadCount>0&&n.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?s(`[${n.unreadCount>99?"99+":n.unreadCount}条]`):"";if(n.type===t.TYPES.CONV_GROUP)if(i.fromAccount===t.getMyUserID())r=s("TUIConversation.我");else{const e=i.fromAccount;r=t.TUIFriend.getFriendRemark([e])[e]||i.nameCard||i.nick||e}if(i.type===t.TYPES.MSG_TEXT)o=this.decodeTextMessage(i.payload.text);else if(i.type===t.TYPES.MSG_CUSTOM){const s=U(null===(e=null==i?void 0:i.payload)||void 0===e?void 0:e.data);if(1===(null==s?void 0:s.businessID))return o=t.TUIChat.messageHandler.handleCallKitSignaling(i),o;o=i.messageForShow}else o=i.messageForShow;return i.isRevoked&&(o=s("TUIChat.撤回了一条消息")),n.type===t.TYPES.CONV_GROUP&&i.type===t.TYPES.MSG_GRP_TIP?o:`${a}${r?`${r}:`:""}${o}`}decodeTextMessage(e){if(ne(e))return e;const t=/(\[.+?\])/g;let s=e;return t.test(e)&&(s=e.replace(t,(e=>A[e]||e))),s}}class re{constructor(){this.defaultStore={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null},this.store={currentConversationID:"",totalUnreadCount:0,conversationList:[],currentConversation:null}}update(e,t){if("conversationList"===e)this.updateConversationList(t);else this.store[e]=t}getData(e){return this.store[e]}getModel(e){return this.store.conversationList.find((t=>t.conversationID===e))}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateConversationList(e){const t=[];e.forEach((e=>{let s=e;e instanceof ie?s.updateProperties(e):s=new ie(e),t.push(s)})),this.store.conversationList=t}}class oe extends se{constructor(e){super(),this.messageHandlers={[this.getEngine().TYPES.MSG_TEXT]:e=>this.getEngine().TUIChat.messageHandler.handleTextMessage(e),[this.getEngine().TYPES.MSG_FACE]:e=>this.getEngine().TUIChat.messageHandler.handleFaceMessage(e),[this.getEngine().TYPES.MSG_LOCATION]:e=>this.getEngine().TUIChat.messageHandler.handleLocationMessage(e),[this.getEngine().TYPES.MSG_IMAGE]:e=>this.getEngine().TUIChat.messageHandler.handleImageMessage(e),[this.getEngine().TYPES.MSG_AUDIO]:e=>this.getEngine().TUIChat.messageHandler.handleAudioMessage(e),[this.getEngine().TYPES.MSG_VIDEO]:e=>this.getEngine().TUIChat.messageHandler.handleVideoMessage(e),[this.getEngine().TYPES.MSG_FILE]:e=>this.getEngine().TUIChat.messageHandler.handleFileMessage(e),[this.getEngine().TYPES.MSG_CUSTOM]:e=>this.getEngine().TUIChat.messageHandler.handleCustomMessage(e),[this.getEngine().TYPES.MSG_MERGER]:e=>this.getEngine().TUIChat.messageHandler.handleMergeMessage(e),[this.getEngine().TYPES.MSG_GRP_TIP]:e=>this.getEngine().TUIChat.messageHandler.handleGroupTipsMessage(e)},this._message=e,this._signalingInfo=void 0,this.progress=0,this.reactionList=[],this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])}))}getMessage(){return this._message}modifyMessage(e){return e.type&&this._message.type!==e.type&&!e.payload?Promise.reject({code:h.MISMATCH_TYPE_AND_PAYLOAD,message:d.MISMATCH_TYPE_AND_PAYLOAD}):(this._message.type=e.type||this._message.type,this._message.payload=e.payload||this._message.payload,this._message.cloudCustomData=e.cloudCustomData||this._message.cloudCustomData,this.getEngine().TUIChat.modifyMessage(this._message))}revokeMessage(){return this.getEngine().TUIChat.revokeMessage(this._message)}resendMessage(){return this.getEngine().TUIChat.resendMessage(this._message)}deleteMessage(){return this.getEngine().TUIChat.deleteMessage([this._message])}quoteMessage(){return this.getEngine().TUIChat.quoteMessage(this._message)}replyMessage(){return this.getEngine().TUIChat.replyMessage(this._message)}setMessageExtensions(e){return this.getEngine().TUIChat.setMessageExtensions(this._message,e)}getMessageExtensions(){return this.getEngine().TUIChat.getMessageExtensions(this._message)}deleteMessageExtensions(e){return this.getEngine().TUIChat.deleteMessageExtensions(this._message,e)}getSignalingInfo(){return this.type!==this.getEngine().TYPES.MSG_CUSTOM?null:S(this._signalingInfo)?(this._signalingInfo=this.getEngine().chat.getSignalingInfo(this._message),this._signalingInfo):this._signalingInfo}getMessageContent(){const e=this.messageHandlers[this.type];if(S(e))return{};if(this.type===this.getEngine().TYPES.MSG_GRP_TIP)return e(this._message);const t=this.getEngine().TUIFriend.getFriendRemark([this.from]);return Object.assign(Object.assign({},e(this._message)),{showName:t[this.from]||this.nameCard||this.nick||this.from})}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class ae{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},newMessageList:[],typingStatus:!1,messageSource:void 0,translateTextInfo:void 0}}update(e,t){switch(e){case"messageList":this.updateMessageList(t);break;case"translateTextInfo":this.updateTranslateTextInfo(t);break;default:this.store[e]=t}}getData(e){return this.store[e]}getModel(e){return this.store.messageList.find((t=>t.ID===e))}reset(e=[]){const t=e.filter((e=>"translateTextInfo"!==e));this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==t?void 0:t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let s=e;e instanceof oe||(s=this.getModel(e.ID),s?s.updateProperties(e):s=new oe(e)),t.push(s)})),this.store.messageList=t}updateTranslateTextInfo(e){const{conversationID:t,messageID:s,visible:n=!1}=e;this.store.translateTextInfo||(this.store.translateTextInfo=new Map),this.store.translateTextInfo.has(t)||this.store.translateTextInfo.set(t,[]);const i=this.store.translateTextInfo.get(t)||[];let r=!0;for(let e=0;e<i.length;e++)if(i[e].messageID===s){i[e].visible=n,r=!1;break}r&&i.push({messageID:s,visible:n}),this.store.translateTextInfo.set(t,i)}}class ue extends se{constructor(e){super(),this.groupAttributes={},this.groupCounters={},this.initProxy(e)}initProxy(e){Object.keys(e).forEach((t=>{y(t)||(this[t]=e[t])})),this._group=e}getGroup(){return this._group}switchGroup(){return this.getEngine().TUIGroup.switchGroup(this.groupID)}getGroupProfile(e){return this.getEngine().TUIGroup.getGroupProfile({groupID:this.groupID,groupCustomFieldFilter:e})}updateGroupProfile(e){return this.getEngine().TUIGroup.updateGroupProfile(Object.assign({groupID:this.groupID},e))}joinGroup(e){return this.getEngine().TUIGroup.joinGroup({groupID:this.groupID,applyMessage:e})}quitGroup(){return this.getEngine().TUIGroup.quitGroup(this.groupID)}dismissGroup(){return this.getEngine().TUIGroup.dismissGroup(this.groupID)}getGroupOnlineMemberCount(){return this.getEngine().TUIGroup.getGroupOnlineMemberCount(this.groupID)}changeGroupOwner(e){return this.getEngine().TUIGroup.changeGroupOwner(Object.assign({groupID:this.groupID},e))}initGroupAttributes(e){return this.getEngine().TUIGroup.initGroupAttributes(Object.assign({groupID:this.groupID},e))}setGroupAttributes(e){return this.getEngine().TUIGroup.setGroupAttributes(Object.assign({groupID:this.groupID},e))}deleteGroupAttributes(e){return this.getEngine().TUIGroup.deleteGroupAttributes(Object.assign({groupID:this.groupID},e))}getGroupAttributes(e){return this.getEngine().TUIGroup.getGroupAttributes(Object.assign({groupID:this.groupID},e))}setGroupCounters(e){return this.getEngine().TUIGroup.setGroupCounters(Object.assign({groupID:this.groupID},e))}increaseGroupCounter(e){return this.getEngine().TUIGroup.increaseGroupCounter(Object.assign({groupID:this.groupID},e))}decreaseGroupCounter(e){return this.getEngine().TUIGroup.decreaseGroupCounter(Object.assign({groupID:this.groupID},e))}getGroupCounters(e){return this.getEngine().TUIGroup.getGroupCounters(Object.assign({groupID:this.groupID},e))}addGroupMember(e){return this.getEngine().TUIGroup.addGroupMember(Object.assign({groupID:this.groupID},e))}getGroupMemberList(e){return this.getEngine().TUIGroup.getGroupMemberList(Object.assign({groupID:this.groupID},e))}getGroupMemberProfile(e){return this.getEngine().TUIGroup.getGroupMemberProfile(Object.assign({groupID:this.groupID},e))}deleteGroupMember(e){return this.getEngine().TUIGroup.deleteGroupMember(Object.assign({groupID:this.groupID},e))}setGroupMemberMuteTime(e){return this.getEngine().TUIGroup.setGroupMemberMuteTime(Object.assign({groupID:this.groupID},e))}setGroupMemberRole(e){return this.getEngine().TUIGroup.setGroupMemberRole(Object.assign({groupID:this.groupID},e))}setGroupMemberNameCard(e){return this.getEngine().TUIGroup.setGroupMemberNameCard(Object.assign({groupID:this.groupID},e))}setGroupMemberCustomField(e){return this.getEngine().TUIGroup.setGroupMemberCustomField(Object.assign({groupID:this.groupID},e))}markGroupMemberList(e){return this.getEngine().TUIGroup.markGroupMemberList(Object.assign({groupID:this.groupID},e))}}class ce{constructor(){this.defaultStore={currentGroupID:"",currentGroup:{},currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[]},this.store={currentGroupID:"",currentGroup:void 0,currentGroupAttributes:{},currentGroupCounters:{},currentGroupMemberList:[],groupList:[],groupSystemNoticeList:[]}}update(e,t){switch(e){case"groupList":this.updateGroupList(t);break;case"currentGroup":this.store.currentGroup=t instanceof ue?t:new ue(t);break;default:this.store[e]=t}}getData(e){if("groupSystemNoticeList"===e){const e=[...this.store.groupSystemNoticeList];return this.store.groupSystemNoticeList.length=0,e}return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateGroupList(e){this.store.groupList=e.map((e=>e instanceof ue?e:new ue(e)))}}class ge{constructor(){this.store={}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){0===e.length&&(this.store={}),this.store=Object.assign(Object.assign({},this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:void 0})),{}))}}class le{constructor(){this.defaultStore={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0},this.store={friendList:[],friendApplicationList:[],friendApplicationUnreadCount:0}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class he{constructor(){this.defaultStore={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1},this.store={currentSearchInputValue:{value:"",searchType:"global"},currentSearchMessageType:{value:{key:"",label:"",value:""},searchType:"global"},currentSearchMessageTime:{value:{key:"",label:"",value:{timePosition:0,timePeriod:0}},searchType:"global"},currentSearchingStatus:{isSearching:!1,searchType:"global"},isShowInConversationSearch:!1}}update(e,t){this.store[e]=t}getData(e){return this.store[e]}reset(e=[]){this.store=Object.assign(Object.assign(Object.assign({},this.defaultStore),this.store),null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}}class pe{constructor(){this.storeMap={[a.APP]:new ee,[a.USER]:new te,[a.CONV]:new re,[a.CHAT]:new ae,[a.GRP]:new ce,[a.FRIEND]:new le,[a.SEARCH]:new he},this.task={}}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}watch(e,t){this.task[e]||(this.task[e]={});const s=this.task[e];Object.keys(t).forEach((n=>{const i=t[n];s[n]||(s[n]=new Map),s[n].set(i,1),this.notifyOnWatch(e,n,i)}))}unwatch(e,t){if(!this.task[e])return;const s=this.task[e];Object.keys(t).forEach((e=>{s[e].delete(t[e])}))}update(e,t,s){var n;e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ge),null===(n=this.storeMap[e])||void 0===n||n.update(t,s),this.notify(e,t)}getData(e,t){var s;return e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ge),null===(s=this.storeMap[e])||void 0===s?void 0:s.getData(t)}getConversationModel(e){var t;return null===(t=this.storeMap[a.CONV])||void 0===t?void 0:t.getModel(e)}getMessageModel(e){var t;return null===(t=this.storeMap[a.CHAT])||void 0===t?void 0:t.getModel(e)}reset(e,t=[],s=!1){if(e in this.storeMap){const n=this.storeMap[e];0===t.length&&(t=Object.keys(null==n?void 0:n.store)),n.reset(t),s&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,s){const n=this.getData(e,t);N.indexOf(t)>-1&&0===n.length||s&&s.call(this,n)}notify(e,t){if(!this.task[e])return;const s=this.task[e];if(s[t]){const n=s[t],i=this.getData(e,t);for(const[e]of n.entries())e.call(this,i)}}}function de(e){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(e)}function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function me(e){var t=function(e,t){if("object"!=de(e)||!e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,t||"default");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==de(t)?t:t+""}function Ee(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,me(n.key),n)}}function ve(e,t,s){return t&&Ee(e.prototype,t),s&&Ee(e,s),Object.defineProperty(e,"prototype",{writable:!1}),e}function Te(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ie(e,t){return Ie=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ie(e,t)}function Se(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ie(e,t)}function ye(e,t){if(t&&("object"===de(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return Te(e)}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},be(e)}function Ue(e,t,s){return(t=me(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var s=0,n=new Array(t);s<t;s++)n[s]=e[s];return n}function Oe(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Me(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);return"Object"===s&&e.constructor&&(s=e.constructor.name),"Map"===s||"Set"===s?Array.from(e):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?Me(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function De(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function Ce(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?De(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):De(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var _e={type:"logger",log:function(e){this.output("log",e)},warn:function(e){this.output("warn",e)},error:function(e){this.output("error",e)},output:function(e,t){console&&console[e]&&console[e].apply(console,t)}},Pe=new(function(){function e(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fe(this,e),this.init(t,s)}return ve(e,[{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||_e,this.options=t,this.debug=t.debug}},{key:"setDebug",value:function(e){this.debug=e}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,s,n){return n&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(s).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Ce(Ce({},{prefix:"".concat(this.prefix,":").concat(t,":")}),this.options))}},{key:"clone",value:function(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new e(this.logger,t)}}]),e}()),Re=function(){function e(){fe(this,e),this.observers={}}return ve(e,[{key:"on",value:function(e,t){var s=this;return e.split(" ").forEach((function(e){s.observers[e]=s.observers[e]||[],s.observers[e].push(t)})),this}},{key:"off",value:function(e,t){this.observers[e]&&(t?this.observers[e]=this.observers[e].filter((function(e){return e!==t})):delete this.observers[e])}},{key:"emit",value:function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,s)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(s))}))}}]),e}();function Le(){var e,t,s=new Promise((function(s,n){e=s,t=n}));return s.resolve=e,s.reject=t,s}function je(e){return null==e?"":""+e}function Ae(e,t,s){function n(e){return e&&e.indexOf("###")>-1?e.replace(/###/g,"."):e}function i(){return!e||"string"==typeof e}for(var r="string"!=typeof t?[].concat(t):t.split(".");r.length>1;){if(i())return{};var o=n(r.shift());!e[o]&&s&&(e[o]=new s),e=Object.prototype.hasOwnProperty.call(e,o)?e[o]:{}}return i()?{}:{obj:e,k:n(r.shift())}}function Ge(e,t,s){var n=Ae(e,t,Object);n.obj[n.k]=s}function Ne(e,t){var s=Ae(e,t),n=s.obj,i=s.k;if(n)return n[i]}function ke(e,t,s){for(var n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?"string"==typeof e[n]||e[n]instanceof String||"string"==typeof t[n]||t[n]instanceof String?s&&(e[n]=t[n]):ke(e[n],t[n],s):e[n]=t[n]);return e}function xe(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var we={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function Ve(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return we[e]})):e}var Fe="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,$e=[" ",",","?","!",";"];function He(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var n=t.split(s),i=e,r=0;r<n.length;++r){if(!i)return;if("string"==typeof i[n[r]]&&r+1<n.length)return;if(void 0===i[n[r]]){for(var o=2,a=n.slice(r,r+o).join(s),u=i[a];void 0===u&&n.length>r+o;)o++,u=i[a=n.slice(r,r+o).join(s)];if(void 0===u)return;if(null===u)return null;if(t.endsWith(a)){if("string"==typeof u)return u;if(a&&"string"==typeof u[a])return u[a]}var c=n.slice(r+o).join(s);return c?He(u,c,s):void 0}i=i[n[r]]}return i}}function Ye(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function Be(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Ye(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Ke(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var qe=function(e){Se(s,Re);var t=Ke(s);function s(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return fe(this,s),n=t.call(this),Fe&&Re.call(Te(n)),n.data=e||{},n.options=i,void 0===n.options.keySeparator&&(n.options.keySeparator="."),void 0===n.options.ignoreJSONStructure&&(n.options.ignoreJSONStructure=!0),n}return ve(s,[{key:"addNamespaces",value:function(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}},{key:"removeNamespaces",value:function(e){var t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}},{key:"getResource",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure,o=[e,t];s&&"string"!=typeof s&&(o=o.concat(s)),s&&"string"==typeof s&&(o=o.concat(i?s.split(i):s)),e.indexOf(".")>-1&&(o=e.split("."));var a=Ne(this.data,o);return a||!r||"string"!=typeof s?a:He(this.data&&this.data[e]&&this.data[e][t],s,i)}},{key:"addResource",value:function(e,t,s,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},r=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,o=[e,t];s&&(o=o.concat(r?s.split(r):s)),e.indexOf(".")>-1&&(n=t,t=(o=e.split("."))[1]),this.addNamespaces(t),Ge(this.data,o,n),i.silent||this.emit("added",e,t,s,n)}},{key:"addResources",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in s)"string"!=typeof s[i]&&"[object Array]"!==Object.prototype.toString.apply(s[i])||this.addResource(e,t,i,s[i],{silent:!0});n.silent||this.emit("added",e,t,s)}},{key:"addResourceBundle",value:function(e,t,s,n,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(n=s,s=t,t=(o=e.split("."))[1]),this.addNamespaces(t);var a=Ne(this.data,o)||{};n?ke(a,s,i):a=Be(Be({},a),s),Ge(this.data,o,a),r.silent||this.emit("added",e,t,s)}},{key:"removeResourceBundle",value:function(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}},{key:"hasResourceBundle",value:function(e,t){return void 0!==this.getResource(e,t)}},{key:"getResourceBundle",value:function(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?Be(Be({},{}),this.getResource(e,t)):this.getResource(e,t)}},{key:"getDataByLanguage",value:function(e){return this.data[e]}},{key:"hasLanguageSomeTranslations",value:function(e){var t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((function(e){return t[e]&&Object.keys(t[e]).length>0}))}},{key:"toJSON",value:function(){return this.data}}]),s}(),ze={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,s,n,i){var r=this;return e.forEach((function(e){r.processors[e]&&(t=r.processors[e].process(t,s,n,i))})),t}};function Je(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function We(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?Je(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):Je(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Xe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var Ze={},Qe=function(e){Se(s,Re);var t=Xe(s);function s(e){var n,i,r,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fe(this,s),n=t.call(this),Fe&&Re.call(Te(n)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,o=Te(n),i.forEach((function(e){r[e]&&(o[e]=r[e])})),n.options=a,void 0===n.options.keySeparator&&(n.options.keySeparator="."),n.logger=Pe.create("translator"),n}return ve(s,[{key:"changeLanguage",value:function(e){e&&(this.language=e)}},{key:"exists",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;var s=this.resolve(e,t);return s&&void 0!==s.res}},{key:"extractFromKey",value:function(e,t){var s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");var n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],r=s&&e.indexOf(s)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,s){t=t||"",s=s||"";var n=$e.filter((function(e){return t.indexOf(e)<0&&s.indexOf(e)<0}));if(0===n.length)return!0;var i=new RegExp("(".concat(n.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),r=!i.test(e);if(!r){var o=e.indexOf(s);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r}(e,s,n));if(r&&!o){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var u=e.split(s);(s!==n||s===n&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(n)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,n){var i=this;if("object"!==de(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===de(t)&&(t=We({},t)),t||(t={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);var r=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,o=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=this.extractFromKey(e[e.length-1],t),u=a.key,c=a.namespaces,g=c[c.length-1],l=t.lng||this.language,h=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(h){var p=t.nsSeparator||this.options.nsSeparator;return r?{res:"".concat(g).concat(p).concat(u),usedKey:u,exactUsedKey:u,usedLng:l,usedNS:g}:"".concat(g).concat(p).concat(u)}return r?{res:u,usedKey:u,exactUsedKey:u,usedLng:l,usedNS:g}:u}var d=this.resolve(e,t),f=d&&d.res,m=d&&d.usedKey||u,E=d&&d.exactUsedKey||u,v=Object.prototype.toString.apply(f),T=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,I=!this.i18nFormat||this.i18nFormat.handleAsObject;if(I&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(v)<0&&("string"!=typeof T||"[object Array]"!==v)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,We(We({},t),{},{ns:c})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return r?(d.res=S,d):S}if(o){var y="[object Array]"===v,b=y?[]:{},U=y?E:m;for(var M in f)if(Object.prototype.hasOwnProperty.call(f,M)){var O="".concat(U).concat(o).concat(M);b[M]=this.translate(O,We(We({},t),{joinArrays:!1,ns:c})),b[M]===O&&(b[M]=f[M])}f=b}}else if(I&&"string"==typeof T&&"[object Array]"===v)(f=f.join(T))&&(f=this.extendTranslation(f,e,t,n));else{var D=!1,C=!1,_=void 0!==t.count&&"string"!=typeof t.count,P=s.hasDefaultValue(t),R=_?this.pluralResolver.getSuffix(l,t.count,t):"",L=t["defaultValue".concat(R)]||t.defaultValue;!this.isValidLookup(f)&&P&&(D=!0,f=L),this.isValidLookup(f)||(C=!0,f=u);var j=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,A=P&&L!==f&&this.options.updateMissing;if(C||D||A){if(this.logger.log(A?"updateKey":"missingKey",l,g,u,A?L:f),o){var G=this.resolve(u,We(We({},t),{},{keySeparator:!1}));G&&G.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var N=[],k=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&k&&k[0])for(var x=0;x<k.length;x++)N.push(k[x]);else"all"===this.options.saveMissingTo?N=this.languageUtils.toResolveHierarchy(t.lng||this.language):N.push(t.lng||this.language);var w=function(e,s,n){var r=P&&n!==f?n:j;i.options.missingKeyHandler?i.options.missingKeyHandler(e,g,s,r,A,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,g,s,r,A,t),i.emit("missingKey",e,g,s,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&_?N.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(s){w([e],u+s,t["defaultValue".concat(s)]||L)}))})):w(N,u,L))}f=this.extendTranslation(f,e,t,d,n),C&&f===u&&this.options.appendNamespaceToMissingKey&&(f="".concat(g,":").concat(u)),(C||D)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(g,":").concat(u):u,D?f:void 0):this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d):f}},{key:"extendTranslation",value:function(e,t,s,n,i){var r=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,We(We({},this.options.interpolation.defaultVariables),s),n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init(We(We({},s),{interpolation:We(We({},this.options.interpolation),s.interpolation)}));var o,a="string"==typeof e&&(s&&s.interpolation&&void 0!==s.interpolation.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var u=e.match(this.interpolator.nestingRegexp);o=u&&u.length}var c=s.replace&&"string"!=typeof s.replace?s.replace:s;if(this.options.interpolation.defaultVariables&&(c=We(We({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,s.lng||this.language,s),a){var g=e.match(this.interpolator.nestingRegexp);o<(g&&g.length)&&(s.nest=!1)}!s.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(s.lng=n.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return i&&i[0]===n[0]&&!s.context?(r.logger.warn("It seems you are nesting recursively key: ".concat(n[0]," in key: ").concat(t[0])),null):r.translate.apply(r,n.concat([t]))}),s)),s.interpolation&&this.interpolator.reset()}var l=s.postProcess||this.options.postProcess,h="string"==typeof l?[l]:l;return null!=e&&h&&h.length&&!1!==s.applyPostProcessor&&(e=ze.handle(h,e,t,this.options&&this.options.postProcessPassResolved?We({i18nResolved:n},s):s,this)),e}},{key:"resolve",value:function(e){var t,s,n,i,r,o=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof e&&(e=[e]),e.forEach((function(e){if(!o.isValidLookup(t)){var u=o.extractFromKey(e,a),c=u.key;s=c;var g=u.namespaces;o.options.fallbackNS&&(g=g.concat(o.options.fallbackNS));var l=void 0!==a.count&&"string"!=typeof a.count,h=l&&!a.ordinal&&0===a.count&&o.pluralResolver.shouldUseIntlApi(),p=void 0!==a.context&&("string"==typeof a.context||"number"==typeof a.context)&&""!==a.context,d=a.lngs?a.lngs:o.languageUtils.toResolveHierarchy(a.lng||o.language,a.fallbackLng);g.forEach((function(e){o.isValidLookup(t)||(r=e,!Ze["".concat(d[0],"-").concat(e)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(r)&&(Ze["".concat(d[0],"-").concat(e)]=!0,o.logger.warn('key "'.concat(s,'" for languages "').concat(d.join(", "),'" won\'t get resolved as namespace "').concat(r,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach((function(s){if(!o.isValidLookup(t)){i=s;var r,u=[c];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(u,c,s,e,a);else{var g;l&&(g=o.pluralResolver.getSuffix(s,a.count,a));var d="".concat(o.options.pluralSeparator,"zero");if(l&&(u.push(c+g),h&&u.push(c+d)),p){var f="".concat(c).concat(o.options.contextSeparator).concat(a.context);u.push(f),l&&(u.push(f+g),h&&u.push(f+d))}}for(;r=u.pop();)o.isValidLookup(t)||(n=r,t=o.getResource(s,e,r,a))}})))}))}})),{res:t,usedKey:s,exactUsedKey:n,usedLng:i,usedNS:r}}},{key:"isValidLookup",value:function(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}},{key:"getResource",value:function(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,s,n):this.resourceStore.getResource(e,t,s,n)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,12)&&void 0!==e[s])return!0;return!1}}]),s}();function et(e){return e.charAt(0).toUpperCase()+e.slice(1)}var tt=function(){function e(t){fe(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Pe.create("languageUtils")}return ve(e,[{key:"getScriptPartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return null;var t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}},{key:"getLanguagePartFromCode",value:function(e){if(!e||e.indexOf("-")<0)return e;var t=e.split("-");return this.formatLanguageCode(t[0])}},{key:"formatLanguageCode",value:function(e){if("string"==typeof e&&e.indexOf("-")>-1){var t=["hans","hant","latn","cyrl","cans","mong","arab"],s=e.split("-");return this.options.lowerCaseLng?s=s.map((function(e){return e.toLowerCase()})):2===s.length?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=et(s[1].toLowerCase()))):3===s.length&&(s[0]=s[0].toLowerCase(),2===s[1].length&&(s[1]=s[1].toUpperCase()),"sgn"!==s[0]&&2===s[2].length&&(s[2]=s[2].toUpperCase()),t.indexOf(s[1].toLowerCase())>-1&&(s[1]=et(s[1].toLowerCase())),t.indexOf(s[2].toLowerCase())>-1&&(s[2]=et(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}},{key:"isSupportedCode",value:function(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}},{key:"getBestMatchFromCodes",value:function(e){var t,s=this;return e?(e.forEach((function(e){if(!t){var n=s.formatLanguageCode(e);s.options.supportedLngs&&!s.isSupportedCode(n)||(t=n)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var n=s.getLanguagePartFromCode(e);if(s.isSupportedCode(n))return t=n;t=s.options.supportedLngs.find((function(e){return e===n?e:e.indexOf("-")<0&&n.indexOf("-")<0?void 0:0===e.indexOf(n)?e:void 0}))}})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}},{key:"getFallbackCodes",value:function(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),"string"==typeof e&&(e=[e]),"[object Array]"===Object.prototype.toString.apply(e))return e;if(!t)return e.default||[];var s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}},{key:"toResolveHierarchy",value:function(e,t){var s=this,n=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=function(e){e&&(s.isSupportedCode(e)?i.push(e):s.logger.warn("rejecting language code not found in supportedLngs: ".concat(e)))};return"string"==typeof e&&e.indexOf("-")>-1?("languageOnly"!==this.options.load&&r(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&r(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&r(this.getLanguagePartFromCode(e))):"string"==typeof e&&r(this.formatLanguageCode(e)),n.forEach((function(e){i.indexOf(e)<0&&r(s.formatLanguageCode(e))})),i}}]),e}(),st=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],nt={1:function(e){return Number(e>1)},2:function(e){return Number(1!=e)},3:function(e){return 0},4:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},5:function(e){return Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5)},6:function(e){return Number(1==e?0:e>=2&&e<=4?1:2)},7:function(e){return Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(1==e?0:2==e?1:8!=e&&11!=e?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(1==e?0:2==e?1:e<7?2:e<11?3:4)},11:function(e){return Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(0!==e)},14:function(e){return Number(1==e?0:2==e?1:3==e?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:0!==e?1:2)},17:function(e){return Number(1==e||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(0==e?0:1==e?1:2)},19:function(e){return Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(1==e?0:0==e||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)}},it=["v1","v2","v3"],rt={zero:0,one:1,two:2,few:3,many:4,other:5};var ot=function(){function e(t){var s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};fe(this,e),this.languageUtils=t,this.options=n,this.logger=Pe.create("pluralResolver"),this.options.compatibilityJSON&&"v4"!==this.options.compatibilityJSON||"undefined"!=typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(s={},st.forEach((function(e){e.lngs.forEach((function(t){s[t]={numbers:e.nr,plurals:nt[e.fc]}}))})),s)}return ve(e,[{key:"addRule",value:function(e,t){this.rules[e]=t}},{key:"getRule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(e,{type:t.ordinal?"ordinal":"cardinal"})}catch(e){return}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}},{key:"needsPlural",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,t);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,s).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.getRule(e,s);return n?this.shouldUseIntlApi()?n.resolvedOptions().pluralCategories.sort((function(e,t){return rt[e]-rt[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):n.numbers.map((function(n){return t.getSuffix(e,n,s)})):[]}},{key:"getSuffix",value:function(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getRule(e,s);return n?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(n.select(t)):this.getSuffixRetroCompatible(n,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var s=this,n=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[n];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var r=function(){return s.options.prepend&&i.toString()?s.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_".concat(i.toString()):r():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?r():this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString()}},{key:"shouldUseIntlApi",value:function(){return!it.includes(this.options.compatibilityJSON)}}]),e}();function at(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function ut(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?at(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):at(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function ct(e,t,s){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=function(e,t,s){var n=Ne(e,s);return void 0!==n?n:Ne(t,s)}(e,t,s);return!r&&i&&"string"==typeof s&&void 0===(r=He(e,s,n))&&(r=He(t,s,n)),r}var gt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe(this,e),this.logger=Pe.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return ve(e,[{key:"init",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});var t=e.interpolation;this.escape=void 0!==t.escape?t.escape:Ve,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?xe(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?xe(t.suffix):t.suffixEscaped||"}}",this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||",",this.unescapePrefix=t.unescapeSuffix?"":t.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":t.unescapeSuffix||"",this.nestingPrefix=t.nestingPrefix?xe(t.nestingPrefix):t.nestingPrefixEscaped||xe("$t("),this.nestingSuffix=t.nestingSuffix?xe(t.nestingSuffix):t.nestingSuffixEscaped||xe(")"),this.nestingOptionsSeparator=t.nestingOptionsSeparator?t.nestingOptionsSeparator:t.nestingOptionsSeparator||",",this.maxReplaces=t.maxReplaces?t.maxReplaces:1e3,this.alwaysFormat=void 0!==t.alwaysFormat&&t.alwaysFormat,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var e="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(e,"g");var t="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(t,"g");var s="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(s,"g")}},{key:"interpolate",value:function(e,t,s,n){var i,r,o,a=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function c(e){return e.replace(/\$/g,"$$$$")}var g=function(e){if(e.indexOf(a.formatSeparator)<0){var i=ct(t,u,e,a.options.keySeparator,a.options.ignoreJSONStructure);return a.alwaysFormat?a.format(i,void 0,s,ut(ut(ut({},n),t),{},{interpolationkey:e})):i}var r=e.split(a.formatSeparator),o=r.shift().trim(),c=r.join(a.formatSeparator).trim();return a.format(ct(t,u,o,a.options.keySeparator,a.options.ignoreJSONStructure),c,s,ut(ut(ut({},n),t),{},{interpolationkey:o}))};this.resetRegExp();var l=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,h=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return c(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?c(a.escape(e)):c(e)}}].forEach((function(t){for(o=0;i=t.regex.exec(e);){var s=i[1].trim();if(void 0===(r=g(s)))if("function"==typeof l){var u=l(e,i,n);r="string"==typeof u?u:""}else if(n&&Object.prototype.hasOwnProperty.call(n,s))r="";else{if(h){r=i[0];continue}a.logger.warn("missed to pass in variable ".concat(s," for interpolating ").concat(e)),r=""}else"string"==typeof r||a.useRawValueToEscape||(r=je(r));var c=t.safeValue(r);if(e=e.replace(i[0],c),h?(t.regex.lastIndex+=r.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,++o>=a.maxReplaces)break}})),e}},{key:"nest",value:function(e,t){var s,n,i,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var s=this.nestingOptionsSeparator;if(e.indexOf(s)<0)return e;var n=e.split(new RegExp("".concat(s,"[ ]*{"))),r="{".concat(n[1]);e=n[0];var o=(r=this.interpolate(r,i)).match(/'/g),a=r.match(/"/g);(o&&o.length%2==0&&!a||a.length%2!=0)&&(r=r.replace(/'/g,'"'));try{i=JSON.parse(r),t&&(i=ut(ut({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(s).concat(r)}return delete i.defaultValue,e}for(;s=this.nestingRegexp.exec(e);){var u=[];(i=(i=ut({},o)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var c=!1;if(-1!==s[0].indexOf(this.formatSeparator)&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map((function(e){return e.trim()}));s[1]=g.shift(),u=g,c=!0}if((n=t(a.call(this,s[1].trim(),i),i))&&s[0]===e&&"string"!=typeof n)return n;"string"!=typeof n&&(n=je(n)),n||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(e)),n=""),c&&(n=u.reduce((function(e,t){return r.format(e,t,o.lng,ut(ut({},o),{},{interpolationkey:s[1].trim()}))}),n.trim())),e=e.replace(s[0],n),this.regexp.lastIndex=0}return e}}]),e}();function lt(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function ht(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?lt(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):lt(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function pt(e){var t={};return function(s,n,i){var r=n+JSON.stringify(i),o=t[r];return o||(o=e(n,i),t[r]=o),o(s)}}var dt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fe(this,e),this.logger=Pe.create("formatter"),this.options=t,this.formats={number:pt((function(e,t){var s=new Intl.NumberFormat(e,ht({},t));return function(e){return s.format(e)}})),currency:pt((function(e,t){var s=new Intl.NumberFormat(e,ht(ht({},t),{},{style:"currency"}));return function(e){return s.format(e)}})),datetime:pt((function(e,t){var s=new Intl.DateTimeFormat(e,ht({},t));return function(e){return s.format(e)}})),relativetime:pt((function(e,t){var s=new Intl.RelativeTimeFormat(e,ht({},t));return function(e){return s.format(e,t.range||"day")}})),list:pt((function(e,t){var s=new Intl.ListFormat(e,ht({},t));return function(e){return s.format(e)}}))},this.init(t)}return ve(e,[{key:"init",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=t.formatSeparator?t.formatSeparator:t.formatSeparator||","}},{key:"add",value:function(e,t){this.formats[e.toLowerCase().trim()]=t}},{key:"addCached",value:function(e,t){this.formats[e.toLowerCase().trim()]=pt(t)}},{key:"format",value:function(e,t,s){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return t.split(this.formatSeparator).reduce((function(e,t){var r=function(e){var t=e.toLowerCase().trim(),s={};if(e.indexOf("(")>-1){var n=e.split("(");t=n[0].toLowerCase().trim();var i=n[1].substring(0,n[1].length-1);"currency"===t&&i.indexOf(":")<0?s.currency||(s.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?s.range||(s.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=Oe(e.split(":")),n=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");s[n.trim()]||(s[n.trim()]=i),"false"===i&&(s[n.trim()]=!1),"true"===i&&(s[n.trim()]=!0),isNaN(i)||(s[n.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:s}}(t),o=r.formatName,a=r.formatOptions;if(n.formats[o]){var u=e;try{var c=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=c.locale||c.lng||i.locale||i.lng||s;u=n.formats[o](e,g,ht(ht(ht({},a),i),c))}catch(e){n.logger.warn(e)}return u}return n.logger.warn("there was no format function for ".concat(o)),e}),e)}}]),e}();function ft(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function mt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?ft(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):ft(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function Et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}var vt=function(e){Se(s,Re);var t=Et(s);function s(e,n,i){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return fe(this,s),r=t.call(this),Fe&&Re.call(Te(r)),r.backend=e,r.store=n,r.services=i,r.languageUtils=i.languageUtils,r.options=o,r.logger=Pe.create("backendConnector"),r.waitingReads=[],r.maxParallelReads=o.maxParallelReads||10,r.readingCalls=0,r.maxRetries=o.maxRetries>=0?o.maxRetries:5,r.retryTimeout=o.retryTimeout>=1?o.retryTimeout:350,r.state={},r.queue=[],r.backend&&r.backend.init&&r.backend.init(i,o.backend,o),r}return ve(s,[{key:"queueLoad",value:function(e,t,s,n){var i=this,r={},o={},a={},u={};return e.forEach((function(e){var n=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!s.reload&&i.store.hasResourceBundle(e,t)?i.state[a]=2:i.state[a]<0||(1===i.state[a]?void 0===o[a]&&(o[a]=!0):(i.state[a]=1,n=!1,void 0===o[a]&&(o[a]=!0),void 0===r[a]&&(r[a]=!0),void 0===u[t]&&(u[t]=!0)))})),n||(a[e]=!0)})),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,s){var n=e.split("|"),i=n[0],r=n[1];t&&this.emit("failedLoading",i,r,t),s&&this.store.addResourceBundle(i,r,s),this.state[e]=t?-1:2;var o={};this.queue.forEach((function(s){var n,a,u,c,g,l;n=s.loaded,a=r,c=Ae(n,[i],Object),g=c.obj,l=c.k,g[l]=g[l]||[],u&&(g[l]=g[l].concat(a)),u||g[l].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(s,e),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach((function(e){o[e]||(o[e]={});var t=s.loaded[e];t.length&&t.forEach((function(t){void 0===o[e][t]&&(o[e][t]=!0)}))})),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,s){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:r,callback:o});else{this.readingCalls++;var a=function(a,u){if(n.readingCalls--,n.waitingReads.length>0){var c=n.waitingReads.shift();n.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&u&&i<n.maxRetries?setTimeout((function(){n.read.call(n,e,t,s,i+1,2*r,o)}),r):o(a,u)},u=this.backend[s].bind(this.backend);if(2!==u.length)return u(e,t,a);try{var c=u(e,t);c&&"function"==typeof c.then?c.then((function(e){return a(null,e)})).catch(a):a(null,c)}catch(e){a(e)}}}},{key:"prepareLoading",value:function(e,t){var s=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();"string"==typeof e&&(e=this.languageUtils.toResolveHierarchy(e)),"string"==typeof t&&(t=[t]);var r=this.queueLoad(e,t,n,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach((function(e){s.loadOne(e)}))}},{key:"load",value:function(e,t,s){this.prepareLoading(e,t,{},s)}},{key:"reload",value:function(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}},{key:"loadOne",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=e.split("|"),i=n[0],r=n[1];this.read(i,r,"read",void 0,void 0,(function(n,o){n&&t.logger.warn("".concat(s,"loading namespace ").concat(r," for language ").concat(i," failed"),n),!n&&o&&t.logger.log("".concat(s,"loaded namespace ").concat(r," for language ").concat(i),o),t.loaded(e,n,o)}))}},{key:"saveMissing",value:function(e,t,s,n,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(t,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(null!=s&&""!==s){if(this.backend&&this.backend.create){var a=mt(mt({},r),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var c;(c=5===u.length?u(e,t,s,n,a):u(e,t,s,n))&&"function"==typeof c.then?c.then((function(e){return o(null,e)})).catch(o):o(null,c)}catch(e){o(e)}else u(e,t,s,n,o,a)}e&&e[0]&&this.store.addResource(e[0],t,s,n)}}}]),s}();function Tt(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if("object"===de(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===de(e[2])||"object"===de(e[3])){var s=e[3]||e[2];Object.keys(s).forEach((function(e){t[e]=s[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,s,n){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function It(e){return"string"==typeof e.ns&&(e.ns=[e.ns]),"string"==typeof e.fallbackLng&&(e.fallbackLng=[e.fallbackLng]),"string"==typeof e.fallbackNS&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function St(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function yt(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?St(Object(s),!0).forEach((function(t){Ue(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):St(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=be(e);if(t){var i=be(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return ye(this,s)}}function Ut(){}var Mt=function(e){Se(s,Re);var t=bt(s);function s(){var e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(fe(this,s),e=t.call(this),Fe&&Re.call(Te(e)),e.options=It(i),e.services={},e.logger=Pe,e.modules={external:[]},n=Te(e),Object.getOwnPropertyNames(Object.getPrototypeOf(n)).forEach((function(e){"function"==typeof n[e]&&(n[e]=n[e].bind(n))})),r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),ye(e,Te(e));setTimeout((function(){e.init(i,r)}),0)}return e}return ve(s,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(s=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&("string"==typeof t.ns?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));var n=Tt();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=yt(yt(yt({},n),this.options),It(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=yt(yt({},n.interpolation),this.options.interpolation)),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),!this.options.isClone){var r;this.modules.logger?Pe.init(i(this.modules.logger),this.options):Pe.init(null,this.options),this.modules.formatter?r=this.modules.formatter:"undefined"!=typeof Intl&&(r=dt);var o=new tt(this.options);this.store=new qe(this.options.resources,this.options);var a=this.services;a.logger=Pe,a.resourceStore=this.store,a.languageUtils=o,a.pluralResolver=new ot(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!r||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(a.formatter=i(r),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new gt(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new vt(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),i=1;i<s;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))})),this.modules.languageDetector&&(a.languageDetector=i(this.modules.languageDetector),a.languageDetector.init&&a.languageDetector.init(a,this.options.detection,this.options)),this.modules.i18nFormat&&(a.i18nFormat=i(this.modules.i18nFormat),a.i18nFormat.init&&a.i18nFormat.init(this)),this.translator=new Qe(this.services,this.options),this.translator.on("*",(function(t){for(var s=arguments.length,n=new Array(s>1?s-1:0),i=1;i<s;i++)n[i-1]=arguments[i];e.emit.apply(e,[t].concat(n))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,s||(s=Ut),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&"dev"!==u[0]&&(this.options.lng=u[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((function(t){e[t]=function(){var s;return(s=e.store)[t].apply(s,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var s;return(s=e.store)[t].apply(s,arguments),e}}));var c=Le(),g=function(){var t=function(t,n){e.isInitialized&&!e.initializedStoreOnce&&e.logger.warn("init: i18next is already initialized. You should call init just once!"),e.isInitialized=!0,e.options.isClone||e.logger.log("initialized",e.options),e.emit("initialized",e.options),c.resolve(n),s(t,n)};if(e.languages&&"v1"!==e.options.compatibilityAPI&&!e.isInitialized)return t(null,e.t.bind(e));e.changeLanguage(e.options.lng,t)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),c}},{key:"loadResources",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ut,n="string"==typeof e?e:this.language;if("function"==typeof e&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(n&&"cimode"===n.toLowerCase())return s();var i=[],r=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(n)r(n);else this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((function(e){return r(e)}));this.options.preload&&this.options.preload.forEach((function(e){return r(e)})),this.services.backendConnector.load(i,this.options.ns,(function(e){e||t.resolvedLanguage||!t.language||t.setResolvedLanguage(t.language),s(e)}))}else s(null)}},{key:"reloadResources",value:function(e,t,s){var n=Le();return e||(e=this.languages),t||(t=this.options.ns),s||(s=Ut),this.services.backendConnector.reload(e,t,(function(e){n.resolve(),s(e)})),n}},{key:"use",value:function(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&ze.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}},{key:"setResolvedLanguage",value:function(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(var t=0;t<this.languages.length;t++){var s=this.languages[t];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(e,t){var s=this;this.isLanguageChangingTo=e;var n=Le();this.emit("languageChanging",e);var i=function(e){s.language=e,s.languages=s.services.languageUtils.toResolveHierarchy(e),s.resolvedLanguage=void 0,s.setResolvedLanguage(e)},r=function(r){e||r||!s.services.languageDetector||(r=[]);var o="string"==typeof r?r:s.services.languageUtils.getBestMatchFromCodes(r);o&&(s.language||i(o),s.translator.language||s.translator.changeLanguage(o),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(o)),s.loadResources(o,(function(e){!function(e,r){r?(i(r),s.translator.changeLanguage(r),s.isLanguageChangingTo=void 0,s.emit("languageChanged",r),s.logger.log("languageChanged",r)):s.isLanguageChangingTo=void 0,n.resolve((function(){return s.t.apply(s,arguments)})),t&&t(e,(function(){return s.t.apply(s,arguments)}))}(e,o)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),n}},{key:"getFixedT",value:function(e,t,s){var n=this,i=function e(t,i){var r;if("object"!==de(i)){for(var o=arguments.length,a=new Array(o>2?o-2:0),u=2;u<o;u++)a[u-2]=arguments[u];r=n.options.overloadTranslationOptionHandler([t,i].concat(a))}else r=yt({},i);r.lng=r.lng||e.lng,r.lngs=r.lngs||e.lngs,r.ns=r.ns||e.ns,r.keyPrefix=r.keyPrefix||s||e.keyPrefix;var c,g=n.options.keySeparator||".";return c=r.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(r.keyPrefix).concat(g).concat(e)})):r.keyPrefix?"".concat(r.keyPrefix).concat(g).concat(t):t,n.t(c,r)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}},{key:"t",value:function(){var e;return this.translator&&(e=this.translator).translate.apply(e,arguments)}},{key:"exists",value:function(){var e;return this.translator&&(e=this.translator).exists.apply(e,arguments)}},{key:"setDefaultNamespace",value:function(e){this.options.defaultNS=e}},{key:"hasLoadedNamespace",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var n=s.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===n.toLowerCase())return!0;var o=function(e,s){var n=t.services.backendConnector.state["".concat(e,"|").concat(s)];return-1===n||2===n};if(s.precheck){var a=s.precheck(this,o);if(void 0!==a)return a}return!!this.hasResourceBundle(n,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(n,e)||i&&!o(r,e)))}},{key:"loadNamespaces",value:function(e,t){var s=this,n=Le();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){s.options.ns.indexOf(e)<0&&s.options.ns.push(e)})),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var s=Le();"string"==typeof e&&(e=[e]);var n=this.options.preload||[],i=e.filter((function(e){return n.indexOf(e)<0}));return i.length?(this.options.preload=n.concat(i),this.loadResources((function(e){s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}},{key:"dir",value:function(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";var t=this.services&&this.services.languageUtils||new tt(Tt());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ut,i=yt(yt(yt({},this.options),t),{isClone:!0}),r=new s(i);void 0===t.debug&&void 0===t.prefix||(r.logger=r.logger.clone(t));return["store","services","language"].forEach((function(t){r[t]=e[t]})),r.services=yt({},this.services),r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r.translator=new Qe(r.services,r.options),r.translator.on("*",(function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),n=1;n<t;n++)s[n-1]=arguments[n];r.emit.apply(r,[e].concat(s))})),r.init(i,n),r.translator.options=r.options,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}},{key:"toJSON",value:function(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}]),s}();Ue(Mt,"createInstance",(function(){return new Mt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Ot=Mt.createInstance();Ot.createInstance=Mt.createInstance,Ot.createInstance,Ot.dir,Ot.init,Ot.loadResources,Ot.reloadResources,Ot.use,Ot.changeLanguage,Ot.getFixedT,Ot.t,Ot.exists,Ot.setDefaultNamespace,Ot.hasLoadedNamespace,Ot.loadNamespaces,Ot.loadLanguages;class Dt extends se{constructor(){super(),this.languages=null}static getInstance(){return Dt.instance||(Dt.instance=new Dt),Dt.instance}provideLanguages(e){k||(this.languages=e,console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){k||(this.languages?Ot.init({compatibilityJSON:"v3",lng:e||"zh",fallbackLng:"zh",detection:{order:["querystring","navigator"],caches:["localStorage","cookie"]},resources:{en:{translation:this.languages.en},zh:{translation:this.languages.zh_cn}}}):console.warn("TUITranslateService.useI18next not have messages."))}changeLanguage(e){return Ot.changeLanguage(e)}t(e){if(!this.languages){let t=e;return!S(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}return Ot.t(e)}}class Ct extends se{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return Ct.instance||(Ct.instance=new Ct),Ct.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.CONVERSATION_LIST_UPDATED,this.onConversationListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED,this.onTotalUnreadCountUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getConversationInitData()}onConversationListUpdated(e){const t=this.filterSystemConversation(e);this.getEngine().TUIStore.update(a.CONV,"conversationList",t),this.updateCurrentConversation()}onTotalUnreadCountUpdated(e){this.getEngine().TUIStore.update(a.CONV,"totalUnreadCount",e)}onMessageReceived(e){const t=this.getEngine(),s=this.getEngine().TUIStore.getData(a.CONV,"conversationList");let n=!1;for(let i=0;i<e.length;i++){if(e[i].type!==t.TYPES.MSG_GRP_SYS_NOTICE)continue;const{operationType:r}=e[i].payload,o=`GROUP${e[i].to}`,a=4===r||5===r||8===r,u=2===r||6===r||7===r;if(a||u)for(let e=0;e<s.length;e++)if(s[e].type!==t.TYPES.CONV_C2C&&s[e].conversationID===o){if(a){s[e].operationType=r,n=!0;break}if(u&&s[e].operationType>0){s[e].operationType=0,n=!0;break}}}n&&this.getEngine().TUIStore.update(a.CONV,"conversationList",s)}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:s,isSyncCompleted:n}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${s.length} isSyncCompleted:${n}`),s.length>0){this.onConversationListUpdated(s);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return i(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,s=this.getEngine();if(!e)return s.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),s.TUIStore.update(a.CONV,"currentConversationID",""),s.TUIStore.update(a.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(s.TYPES.CONV_C2C)&&!e.startsWith(s.TYPES.CONV_GROUP))return console.warn(`${t} conversationID is invalid, conversationID:${e}`),Promise.reject({code:h.INVALID_CONV_ID,message:d.INVALID_CONV_ID});const n=s.TUIStore.getData(a.CONV,"currentConversationID");if(n&&n===e)return this.setMessageRead(n),console.warn(`${t} please check conversationID, conversationID:${e}`),Promise.resolve({code:h.CONV_ID_SAME,message:d.CONV_ID_SAME});const i=yield this.getConversationModel(e);return S(i)?(console.warn(`${t} target conversation is not exist, conversationID:${e}`),Promise.reject({code:h.CONV_NOT_EXIST,message:d.CONV_NOT_EXIST})):(n&&this.setMessageRead(n),e&&this.setMessageRead(e),s.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),s.TUIStore.update(a.CONV,"currentConversationID",e),s.TUIStore.update(a.CONV,"currentConversation",i),Promise.resolve(i))}))}getConversationModel(e){return i(this,void 0,void 0,(function*(){let t=this.findConversation(e);if(S(t))try{const s=yield this.getConversationProfile(e);s.data&&s.data.conversation&&(t=new ie(s.data.conversation))}catch(e){t=void 0}return t}))}findConversation(e){let t;const s=this.getEngine().TUIStore.getData(a.CONV,"conversationList");for(let n=0;n<s.length;n++)if(s[n].conversationID===e){t=s[n];break}return t}updateCurrentConversation(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"currentConversationID"),s=this.findConversation(t);s&&e.TUIStore.update(a.CONV,"currentConversation",s)}getConversationList(){return this.getEngine().chat.getConversationList()}getConversationProfile(e){return this.getEngine().chat.getConversationProfile(e)}deleteConversation(e){return this.getEngine().chat.deleteConversation(e).then((t=>{const s=this.getEngine().TUIStore.getData(a.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${s}`),e===s&&(this.getEngine().TUIStore.update(a.CONV,"currentConversationID",""),this.getEngine().TUIStore.update(a.CONV,"currentConversation",null)),t}))}pinConversation(e){return this.getEngine().chat.pinConversation(e)}muteConversation(e){return this.getEngine().chat.setMessageRemindType(e)}clearHistoryMessage(e){return this.getEngine().chat.clearHistoryMessage(e).then((e=>(this.getEngine().TUIStore.update(a.CHAT,"messageList",[]),this.getEngine().TUIStore.update(a.CHAT,"nextReqMessageID",""),this.getEngine().TUIStore.update(a.CHAT,"isCompleted",!0),e)))}setMessageRead(e){return this.getEngine().chat.setMessageRead({conversationID:e})}filterSystemConversation(e){return e.filter((e=>e.type!==this.getEngine().TYPES.CONV_SYSTEM))}}class _t{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this)),this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.BLACKLIST_UPDATED,this.onBlacklistUpdated.bind(this))}onProfileUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.USER,"userProfile");e.forEach((e=>{e.userID===s.userID&&t.TUIStore.update(a.USER,"userProfile",e)}))}onBlacklistUpdated(e){const t=this.getEngine();this.getBlacklistProfile(e).then((e=>{t.TUIStore.update(a.USER,"userBlacklist",e)}))}getBlacklistProfile(e){const t=[];let s=0;for(;s<e.length;)t.push(e.slice(s,s+=100));const n=[];t.forEach((e=>{n.push(this.TUIUserService.getUserProfile({userIDList:e}))}));const i=[];return Promise.all(n).then((e=>(e.forEach((e=>{const t=e.data.map((e=>{const{userID:t,nick:s,avatar:n}=e;return{userID:t,nick:s,avatar:n}}));i.push(...t)})),i)))}getUserProfile(e){const t=this.getEngine();return S(e)?t.chat.getMyProfile().then((e=>(t.TUIStore.update(a.USER,"userProfile",e.data),e))).catch((e=>Promise.reject(e))):t.chat.getUserProfile(e)}updateMyProfile(e){return this.getEngine().chat.updateMyProfile(e)}addToBlacklist(e){return this.getEngine().chat.addToBlacklist(e)}removeFromBlacklist(e){return this.getEngine().chat.removeFromBlacklist(e)}}function Pt(e,t,s=!0){!function(e,t){w?$.setStorageSync(e,t):jt()&&localStorage.setItem(e,JSON.stringify(t))}(s?Lt(e):e,t)}function Rt(e,t=!0){try{return function(e){if(w)return $.getStorageSync(e);if(jt()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}return}(t?Lt(e):e)}catch(e){return void console.warn("Storage.getStorageItem error:",e)}}function Lt(e){return`chat_engine_${e}`}function jt(){return navigator&&navigator.cookieEnabled&&localStorage}class At{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=Rt("displayOnlineStatus")||!1;e.TUIStore.update(a.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{conversationList:()=>{const t=e.TUIStore.getData(a.APP,"enabledOnlineStatus"),s=e.TUIStore.getData(a.USER,"displayOnlineStatus");t&&s&&this.startToSubscribe()}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(a.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:s=!1}=e;t.TUIStore.update(a.USER,"displayOnlineStatus",s),Pt("displayOnlineStatus",s);const n=t.TUIStore.getData(a.APP,"enabledOnlineStatus");n?!0===s?this.startToSubscribe():this.unsubscribeUserStatus():console.warn(`UserStatusHandler.switchUserStatus enabledOnlineStatus:${n} displayOnlineStatus:${s}`)}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:s}=e.data;return s.length>0&&t.TUIStore.update(a.USER,"userStatusList",s),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;const s=(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length)||0;return 0===s?(console.warn(`UserStatusHandler.subscribeUserStatus userID count:${s}`),Promise.resolve()):this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const t=this.getEngine(),{userIDList:s=[]}=e||{};return t.chat.unsubscribeUserStatus({userIDList:s}).then((e=>{const{failureUserList:n}=e.data,i=[];return s.forEach((e=>{n.includes(e)||i.push({userID:e,statusType:u.UNSUB_USER})})),t.TUIStore.update(a.USER,"userStatusList",i),e})).catch((e=>Promise.reject(e)))}startToSubscribe(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"conversationList"),s=e.TUIStore.getData(a.USER,"userStatusList"),n=[];t.forEach((t=>{if(t.type===e.TYPES.CONV_C2C){const i=t.conversationID.replace(e.TYPES.CONV_C2C,"");s.has(i)||n.push(i)}})),0!==n.length&&e.chat.isReady()&&(this.subscribeUserStatus({userIDList:n}),this.getUserStatus({userIDList:n}))}}class Gt extends se{constructor(){super(),this.userProfileHandler=new _t(this),this.userStatusHandler=new At(this)}static getInstance(){return Gt.instance||(Gt.instance=new Gt),Gt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.KICKED_OUT,this.onKickedOut.bind(this)),e.eventCenter.addEvent(e.EVENT.NET_STATE_CHANGE,this.onNetStateChange.bind(this)),this.userProfileHandler.init(),this.userStatusHandler.init(),this.initMessageReadReceipt()}onKickedOut(e){this.getEngine().TUIStore.update(a.USER,"kickedOut",e.type)}onNetStateChange(e){this.getEngine().TUIStore.update(a.USER,"netStateChange",e.state)}initMessageReadReceipt(){const e=Rt("displayMessageReadReceipt")||!0;this.getEngine().TUIStore.update(a.USER,"displayMessageReadReceipt",e)}switchUserStatus(e){return this.userStatusHandler.switchUserStatus(e)}switchMessageReadStatus(e){this.getEngine().TUIStore.update(a.USER,"displayMessageReadReceipt",e),Pt("displayMessageReadReceipt",e)}getUserProfile(e){return this.userProfileHandler.getUserProfile(e)}updateMyProfile(e){return this.userProfileHandler.updateMyProfile(e)}addToBlacklist(e){return this.userProfileHandler.addToBlacklist(e)}removeFromBlacklist(e){return this.userProfileHandler.removeFromBlacklist(e)}getUserStatus(e){return this.userStatusHandler.getUserStatus(e)}subscribeUserStatus(e){return this.userStatusHandler.subscribeUserStatus(e)}unsubscribeUserStatus(e){return this.userStatusHandler.unsubscribeUserStatus(e)}}class Nt{constructor(e){this.TUIChatService=e,this.userShowNameMap=new Map,this.requestedUserMap=new Map}getEngine(){return this.TUIChatService.getEngine()}t(e){return this.getEngine().TUITranslate.t(e)}handleTextMessage(e){return{text:this.decodeText(e.payload)}}handleFaceMessage(e){const t={name:"",url:""};return t.name=e.payload.data.indexOf("@2x")<0?`${e.payload.data}@2x`:e.payload.data,t.url=`${P}${t.name}.png`,t}handleLocationMessage(e){const t={lon:"",lat:"",href:"",url:"",description:""};return t.lon=e.payload.longitude.toFixed(6),t.lat=e.payload.latitude.toFixed(6),t.href=`${R}pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`${L}center=${t.lat},${t.lon}&zoom=10&size=300*150&maptype=roadmap&markers=size:large|color:0xFFCCFF|label:k|${t.lat},${t.lon}&key=UBNBZ-PTP3P-TE7DB-LHRTI-Y4YLE-VWBBD`,t.description=e.payload.description,t}handleImageMessage(e){return{url:e.payload.imageInfoArray[0].url,width:e.payload.imageInfoArray[0].width,height:e.payload.imageInfoArray[0].height}}handleAudioMessage(e){return{url:e.payload.url,second:e.payload.second}}handleVideoMessage(e){return{url:e.payload.videoUrl,snapshotUrl:e.payload.snapshotUrl,snapshotWidth:e.payload.snapshotWidth,snapshotHeight:e.payload.snapshotHeight}}handleFileMessage(e){return{url:e.payload.fileUrl,name:e.payload.fileName,size:M(e.payload.fileSize)}}handleCustomMessage(e){var t;const s=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||s||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`[${this.t("message.custom.自定义消息")}]`,businessID:s?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,s,n,i,r,o;const a=this.getEngine(),u={text:""};let c=(null==e?void 0:e.nick)||(null===(s=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===s?void 0:s.join(","));switch((null===(i=null===(n=null==e?void 0:e.payload)||void 0===n?void 0:n.memberList)||void 0===i?void 0:i.length)>0&&(c="",null===(o=null===(r=null==e?void 0:e.payload)||void 0===r?void 0:r.memberList)||void 0===o||o.map((e=>{const t=(null==e?void 0:e.nick)||(null==e?void 0:e.userID);c+=`${this.substringByLength(t)},`})),c=null==c?void 0:c.slice(0,-1)),e.payload.operationType){case a.TYPES.GRP_TIP_MBR_JOIN:u.text=`${c} ${this.t("message.tip.加入群组")}`;break;case a.TYPES.GRP_TIP_MBR_QUIT:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.退出群组")}`;break;case a.TYPES.GRP_TIP_MBR_KICKED_OUT:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case a.TYPES.GRP_TIP_MBR_SET_ADMIN:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.成为管理员")}`;break;case a.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被撤销管理员")}`;break;case a.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:u.text=this.handleGroupProfileUpdated(e);break;case a.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:for(const t of e.payload.memberList)t.muteTime>0?u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被禁言")}`:u.text=`${this.t("message.tip.群成员")}:${c} ${this.t("message.tip.被取消禁言")}`;break;default:u.text=`[${this.t("message.tip.群提示消息")}]`}return u}handleGroupSystemMessage(e){const t=e.payload.groupProfile.name||e.payload.groupProfile.groupID,s={text:""};switch(e.payload.operationType){case 1:s.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${t}`;break;case 2:s.text=`${this.t("message.tip.成功加入群组")}:${t}`;break;case 3:s.text=`${this.t("message.tip.申请加入群组")}:${t} ${this.t("message.tip.被拒绝")}`;break;case 4:s.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}:${t}`;break;case 5:s.text=`${this.t("message.tip.群")}:${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:s.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}:${t}`;break;case 7:case 12:s.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${t}`;break;case 8:s.text=`${this.t("message.tip.你退出群组")}:${t}`;break;case 9:s.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}:${t} ${this.t("message.tip.的管理员")}`;break;case 10:s.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}:${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:s.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}:${t}`;break;case 14:s.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}:${t}`;break;case 255:s.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:s.text="未解析的群系统通知"}return s}handleCallKitSignaling(e){var t,s,n,i,r,o,a,u,c,g;const l=U(e.payload.data);if(1!==(null==l?void 0:l.businessID))return"";const h=U(null==l?void 0:l.data),p=e.fromAccount||e.from;let d=this.getEngine().TUIFriend.getFriendRemark([p])[p]||e.nameCard||e.nick||p;switch(d=this.substringByLength(d),null==l?void 0:l.actionType){case 1:return"audioCall"!==(null===(t=null==h?void 0:h.data)||void 0===t?void 0:t.cmd)&&"videoCall"!==(null===(s=null==h?void 0:h.data)||void 0===s?void 0:s.cmd)||!(null==l?void 0:l.groupID)?"hangup"===(null===(n=null==h?void 0:h.data)||void 0===n?void 0:n.cmd)?(null==l?void 0:l.groupID)?`${this.t("message.custom.通话结束")}`:`${this.t("message.custom.通话时长")}:${function(e){const t=e;let s,n,i,r="";return t>=3600?(s=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),n=parseInt(""+t%60/60,10)<10?`0${parseInt(""+t%60/60,10)}`:parseInt(""+t%60/60,10),i=t%3600<10?"0"+t%3600:t%3600,i>60&&(n=parseInt(""+i/60,10)<10?`0${parseInt(""+i/60,10)}`:parseInt(""+i/60,10),i=i%60<10?"0"+i%60:i%60),r=`${s}:${n}:${i}`):t>=60&&t<3600?(n=parseInt(""+t/60,10)<10?`0${parseInt(""+t/60,10)}`:parseInt(""+t/60,10),i=t%60<10?"0"+t%60:t%60,r=`00:${n}:${i}`):t<60&&(i=t<10?`0${t}`:t,r=`00:00:${i}`),r}(null==h?void 0:h.call_end)}`:"switchToAudio"===(null===(i=null==h?void 0:h.data)||void 0===i?void 0:i.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(r=null==h?void 0:h.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${d} ${this.t("message.custom.发起通话")}`;case 2:return(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.取消通话")}`:this.t("message.custom.取消通话");case 3:return"switchToAudio"===(null===(o=null==h?void 0:h.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(a=null==h?void 0:h.data)||void 0===a?void 0:a.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==l?void 0:l.groupID)?`${d} ${this.t("message.custom.拒绝通话")}`:this.t("message.custom.拒绝通话");case 5:if("switchToAudio"===(null===(u=null==h?void 0:h.data)||void 0===u?void 0:u.cmd))return`${this.t("message.custom.切换语音通话")}`;if("switchToVideo"===(null===(c=null==h?void 0:h.data)||void 0===c?void 0:c.cmd))return`${this.t("message.custom.切换视频通话")}`;if(null==l?void 0:l.groupID){if(p===(null==l?void 0:l.inviter)){this.handleCallkitTimeoutSignaling(l.inviteeList);let e="";return null===(g=l.inviteeList)||void 0===g||g.forEach((t=>{const s=this.userShowNameMap.get(t)||t;e+=`${this.substringByLength(s)}、`})),e=e.substring(0,e.lastIndexOf("、")),`${e} ${this.t("message.custom.无应答")}`}return`${d} ${this.t("message.custom.无应答")}`}return this.t("message.custom.无应答");default:return""}}handleCreateGroupCustomMessage(e){let t;const s=U(e.payload.data);return"group_create"===(null==s?void 0:s.businessID)&&(t=`${s.opUser} ${s.content}`),t}decodeText(e){const t=[];let s=e.text,n=-1,i=-1;for(;""!==s;)switch(n=s.indexOf("["),i=s.indexOf("]"),n){case 0:if(-1===i)t.push({name:"text",text:s}),s="";else{const e=s.slice(0,i+1);j[e]?(t.push({name:"img",src:_+j[e]}),s=s.substring(i+1)):(t.push({name:"text",text:"["}),s=s.slice(1))}break;case-1:t.push({name:"text",text:s}),s="";break;default:t.push({name:"text",text:s.slice(0,n)}),s=s.substring(n)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:s}=e,{newGroupProfile:n,memberList:i,operatorID:r}=s;let o="";const a=t||r,u=Object.keys(n)[0];switch(u){case"muteAllMembers":o=n[u]?`${this.t("message.tip.管理员")} ${a} ${this.t("message.tip.开启全员禁言")}`:`${this.t("message.tip.管理员")} ${a} ${this.t("message.tip.取消全员禁言")}`;break;case"ownerID":o=`${i[0].nick||i[0].userID} ${this.t("message.tip.成为新的群主")}`;break;case"groupName":o=`${a} ${this.t("message.tip.修改群名为")} ${n[u]}`;break;case"notification":o=`${a} ${this.t("message.tip.发布新公告")}`}return o}handleCallkitTimeoutSignaling(e=[]){if(0===e.length)return;const t=this.getEngine().TUIFriend.getFriendRemark(e),s=[];e.forEach((e=>{const n=t[e];n?this.userShowNameMap.set(e,n):this.requestedUserMap.has(e)||(s.push(e),this.requestedUserMap.set(e,1))})),s.length>0&&this.getEngine().TUIUser.getUserProfile({userIDList:s}).then((e=>{(e.data||[]).forEach((e=>{const{userID:t,nick:s}=e,n=s||t;this.userShowNameMap.set(t,n)}))})).catch((e=>{}))}substringByLength(e,t=12){return e.length>t?`${e.slice(0,t)}...`:e}}class kt{constructor(e){this.TUIChatService=e,this.typingTo="",this.timer=null}getEngine(){return this.TUIChatService.getEngine()}clearTypingStatus(){this.getEngine().TUIStore.getData(a.CHAT,"typingStatus")&&this.getEngine().TUIStore.update(a.CHAT,"typingStatus",!1),this.timer&&clearTimeout(this.timer),this.timer=null}handleLastMessage(e){const t=this.getEngine(),s=t.TUIStore.getData(a.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const n=U(e.payload.data);if(n.businessID===c.BUSINESS_ID){const{typingStatus:e,userAction:i}=n;if(e===c.STATUS_START||i===c.ACTION_START_ID)return s?(this.timer&&clearTimeout(this.timer),this.timer=null):t.TUIStore.update(a.CHAT,"typingStatus",!0),this.timer=setTimeout((()=>{this.clearTypingStatus()}),3e4),t.TUIStore.getData(a.CHAT,"typingStatus");e!==c.STATUS_END&&i!==c.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(e=[]){if(0===e.length)return[];return this.getEngine().TUIStore.getData(a.APP,"enableTyping")&&this.handleLastMessage(e[e.length-1]),e.filter((e=>{if(e.type===this.getEngine().TYPES.MSG_CUSTOM){return U(e.payload.data).businessID!==c.BUSINESS_ID}return!0}))}createTypingMessage(e=c.STATUS_END,t=""){const{BUSINESS_ID:s,STATUS_START:n,VERSION:i,ACTION_START_ID:r,ACTION_END_ID:o,ACTION_START:a,ACTION_END:u,NEED_TYPING:g}=c;return{to:t,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:s,typingStatus:e,version:i,userAction:e===n?r:o,actionParam:e===n?a:u}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:g,version:i}})}}sendTyping(e=!1,t=""){if(e){this.typingTo=t;const e=this.createTypingMessage(c.STATUS_START,t);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const e=this.createTypingMessage(c.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}this.typingTo=""}}class xt{constructor(e){this.TUIChatService=e}getEngine(){return this.TUIChatService.getEngine()}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_RECEIPT_RECEIVED,this.onMessageReadReceiptReceived.bind(this))}onMessageReadReceiptReceived(e){const t=this.getEngine(),s=t.TUIStore.getData(a.CONV,"currentConversationID"),n=[];e.forEach((e=>{const{messageID:i}=e,r=t.chat.findMessage(i);r&&s===r.conversationID&&n.push(r)})),n.length>0&&t.TUIChat.updateMessageList(n,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const s=e.getMessage();t.push(s)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),s=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(s)}getMessageReadReceiptList(e){const t=this.getEngine(),s=t.TUIStore.getData(a.APP,"enabledMessageReadReceipt"),n=t.TUIStore.getData(a.USER,"displayMessageReadReceipt");!s||!n||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP||t.chat.getMessageReadReceiptList(e).then((e=>{const{messageList:t}=e.data;this.TUIChatService.updateMessageList(t,"edit")})).catch((e=>{console.warn(`ReadReceiptHandler.getMessageReadReceiptList error:${e.message}`)}))}}class wt extends se{constructor(){super(),this.messageHandler=new Nt(this),this.typingHandler=new kt(this),this.readReceiptHandler=new xt(this),this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap=new Map}static getInstance(){return wt.instance||(wt.instance=new wt),wt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_MODIFIED,this.onMessageModified.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REVOKED,this.onMessageRevoked.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_READ_BY_PEER,this.onMessageReadByPeer.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_REACTIONS_UPDATED,this.onMessageReactionsUpdated.bind(this)),this.onCurrentConversationIDUpdated(),this.onMessageSource(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"push"),this.getEngine().TUIStore.update(a.CHAT,"newMessageList",e)}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}onMessageReactionsUpdated(e){this.updateMessageReactionList([e])}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{currentConversationID:t=>{this.isSwitching=!0,this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.clear(),e.TUIStore.reset(a.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),ne(t)||this.getMessageList().finally((()=>{this.isSwitching=!1,this.delayGetHoppingFunction&&this.delayGetHoppingFunction()}))}})}onMessageSource(){const e=this.getEngine();e.TUIStore.watch(a.CHAT,{messageSource:t=>{const s=this.getStoreData(a.CONV,"currentConversationID");if(!s||t&&t.conversationID!==s)return;if(S(t))return this.hoppingConfigMap.clear(),e.TUIStore.update(a.CHAT,"messageList",[]),e.TUIStore.update(a.CHAT,"nextReqMessageID",""),e.TUIStore.update(a.CHAT,"isCompleted",!1),void this.getMessageList();const n=this.getStoreData(a.CHAT,"messageList");n&&n.find((e=>t&&e.ID===t.ID))||(this.isSwitching?this.delayGetHoppingFunction=this.getMessageListHoppingForDown:this.getMessageListHoppingForDown())}})}getMessageListHoppingForDown(){const e=this.getStoreData(a.CHAT,"messageList"),{conversationID:t,sequence:s,time:n,ID:i}=this.getStoreData(a.CHAT,"messageSource");if(e&&e.find((e=>i&&e.ID===i)))return;const r=this.getEngine();r.TUIStore.update(a.CHAT,"messageList",[]),r.TUIStore.update(a.CHAT,"nextReqMessageID",""),r.TUIStore.update(a.CHAT,"isCompleted",!1),this.getMessageListHopping({conversationID:t,sequence:s,time:n,direction:1})}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const s=this.getEngine().chat.sendMessage(e,t);return this.getResponse(s)}getResponse(e,t=!0,s=!0){return e.then((e=>{const s=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(s,"edit"),e})).catch((e=>{var t;return s&&(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.message)&&this.updateMessageList([e.data.message],"edit"),Promise.reject(e)}))}updateMessageList(e,t=""){if(this.getStoreData(a.CHAT,"messageSource")&&"unshift"!==t&&"edit"!==t)return;const s=this.getStoreData(a.CHAT,"messageList"),n=this.updateTargetMessageList(e,s,t);this.getEngine().TUIStore.update(a.CHAT,"messageList",n)}updateTargetMessageList(e,t,s=""){const n=this.getStoreData(a.CONV,"currentConversationID"),i=e.filter((e=>e.conversationID===n));if(!s||0===i.length)return t;const r=t||[];let o=[];switch(s){case"edit":for(const e of t){const t=i.find((t=>t.ID===e.ID));o.push(t||e)}break;case"resend":o=r.filter((e=>e.ID!==i[0].ID)).concat(i);break;case"send":o=r.concat(this.typingHandler.filterTypingMessage(i));break;case"push":o=r.concat(this.typingHandler.filterTypingMessage(i)),this.getEngine().chat.setMessageRead({conversationID:n});break;case"unshift":o=i.filter((e=>0===r.length||!r.find((t=>t.ID===e.ID)))),o.push(...r)}return o}enterTypingState(){this.getStoreData(a.APP,"enableTyping")&&this.sendTyping(!0)}leaveTypingState(){this.getStoreData(a.APP,"enableTyping")&&this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),s=this.getStoreData(a.CONV,"currentConversationID");if(!s.startsWith(t.TYPES.CONV_C2C))return;const n=s.replace(t.TYPES.CONV_C2C,"");if(e){const e=this.getStoreData(a.CHAT,"messageList").filter((e=>"in"===e.flow));if(0===e.length)return;const t=1e3*e[e.length-1].time;if((new Date).getTime()-t>3e4)return}this.typingHandler.sendTyping(e,n)}quoteMessage(e){return this.getEngine().TUIStore.update(a.CHAT,"quoteMessage",{message:e,type:"quote"}),e}replyMessage(e){return this.getEngine().TUIStore.update(a.CHAT,"quoteMessage",{message:e,type:"reply"}),e}getCurrentConvInfo(){const{conversationID:e="",type:t}=this.getStoreData(a.CONV,"currentConversation")||{};return{to:e.replace(t,""),conversationType:t}}t(e){return this.getEngine().TUITranslate.t(e)||e}getMessageAbstractAndType(e){var t;const s=this.getEngine(),n={abstract:"",type:0};switch(e.type){case s.TYPES.MSG_TEXT:n.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,n.type=1;break;case s.TYPES.MSG_CUSTOM:n.abstract=this.t("[自定义消息]"),n.type=2;break;case s.TYPES.MSG_IMAGE:n.abstract=this.t("[图片]"),n.type=3;break;case s.TYPES.MSG_AUDIO:n.abstract=this.t("[语音]"),n.type=4;break;case s.TYPES.MSG_VIDEO:n.abstract=this.t("[视频]"),n.type=5;break;case s.TYPES.MSG_FILE:n.abstract=this.t("[文件]"),n.type=6;break;case s.TYPES.MSG_FACE:n.abstract=this.t("[表情]"),n.type=7}return n}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:s,type:n}=this.getMessageAbstractAndType(e),i={messageAbstract:s,messageSender:e.nick||e.from,messageID:e.ID},r=Object.assign(Object.assign({},i),{messageType:n,messageTime:null==e?void 0:e.time,messageSequence:null==e?void 0:e.sequence,version:1});if("reply"===t&&(r.messageRootID=e.ID,e.cloudCustomData)){const t=U(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(r.messageRootID=t.messageReply.messageRootID)}return{messageReply:r,messageReplyRoot:i}}getMessageInfo(e,t,s){const{messageReply:n,messageReplyRoot:i}=this.genMessageReply(t,s),r=e.cloudCustomData?U(e.cloudCustomData):{};let o;if(r.messageReply?r.messageReply=Object.assign(Object.assign({},n),r.messageReply):r.messageReply=n,"reply"===s){const{messageRootID:e}=n;o=this.getEngine().chat.findMessage(e);const t=(null==o?void 0:o.cloudCustomData)?U(o.cloudCustomData):{};t.messageReplies||(t.messageReplies={}),a=t.messageReplies.replies,("function"==typeof Array.isArray?Array.isArray(a):"array"===Object.prototype.toString.call(a).match(/^\[object (.*)\]$/)[1].toLowerCase())||(t.messageReplies.replies=[]),t.messageReplies.replies.push(i),o.cloudCustomData=JSON.stringify(t)}var a;return{cloudCustomData:JSON.stringify(r),rootMessage:o}}sendTextMessage(e,t){const s=this.getEngine(),{message:n,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};n&&(r=this.getMessageInfo(e,n,i));const o=s.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:r.cloudCustomData}));return this.sendMessage(o,t).then((e=>(r.rootMessage&&this.modifyMessage(r.rootMessage),s.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const s=this.getEngine(),{message:n,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};n&&(r=this.getMessageInfo(e,n,i));const o=s.chat.createTextMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{cloudCustomData:r.cloudCustomData}));return this.sendMessage(o,t).then((e=>(r.rootMessage&&this.modifyMessage(r.rootMessage),s.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const s=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendAudioMessage(e,t){const s=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendVideoMessage(e,t){const s=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendCustomMessage(e,t){const s=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}sendFaceMessage(e,t){const s=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}sendFileMessage(e,t){const s=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(s.ID,e)}}));return this.sendMessage(s,t)}sendLocationMessage(e,t){const s=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(s,t)}onProgress(e,t){const s=this.getEngine().TUIStore.getMessageModel(e);if(s){(t-s.progress>=.1||1===t)&&(s.progress=t,this.updateMessageList([s],"edit"))}}setAbstractList(e){const t=this.getEngine(),s=e.nick||e.from;let n="";switch(e.type){case t.TYPES.MSG_TEXT:return n=e.payload.text||"",n.length>20&&(n=n.slice(0,20)),`${s}: ${n}`;case t.TYPES.MSG_MERGER:return`${s}: ${this.t("[聊天记录]")}`;case t.TYPES.MSG_IMAGE:return`${s}: ${this.t("[图片]")}`;case t.TYPES.MSG_AUDIO:return`${s}: ${this.t("[音频]")}`;case t.TYPES.MSG_VIDEO:return`${s}: ${this.t("[视频]")}`;case t.TYPES.MSG_CUSTOM:return`${s}: ${this.t("[自定义消息]")}`;case t.TYPES.MSG_FILE:return`${s}: ${this.t("[文件]")}`;case t.TYPES.MSG_FACE:return`${s}: ${this.t("[动画表情]")}`}}genMergerForwardPayload(e){const{conversationType:t,nick:s,from:n,to:i}=e[0],r=[];return e.forEach((e=>{r.push(this.setAbstractList(e))})),{messageList:e,title:"GROUP"===t?"群聊的聊天记录":`${s||n} 和 ${i} 的聊天记录`,abstractList:r,compatibleText:"请升级IMSDK到v2.10.1或更高版本查看此消息"}}sendMergerForwardMessage(e){const{conversationList:t,messageList:s,params:n,sendMessageOptions:i}=e,r=[];for(let e=0;e<t.length;e++){const{conversationID:o,type:a}=t[e],u=Object.assign({to:o.replace(`${a}`,""),conversationType:a,payload:this.genMergerForwardPayload(s)},n),c=this.getEngine().chat.createMergerMessage(u);r.push(this.sendMessage(c,i))}return Promise.all(r)}getOriginMessageList(e){return e.map((e=>e instanceof oe?e.getMessage():e))}sendForwardMessage(e,t,s){t=this.getOriginMessageList(t);const i=s||{},{needMerge:r=!1,params:o={}}=i,a=n(i,["needMerge","params"]);if(r)return this.sendMergerForwardMessage({conversationList:e,messageList:t,params:o,sendMessageOptions:a});const u=[];for(let s=0;s<e.length;s++){const{conversationID:n,type:i}=e[s],r=Object.assign({to:n.replace(`${i}`,""),conversationType:i},o);for(let e=0;e<t.length;e++){Reflect.set(r,"payload",t[e]);const s=this.getEngine().chat.createForwardMessage(r);u.push(this.sendMessage(s,a))}}return Promise.all(u)}revokeMessage(e){const t=this.getEngine().chat.revokeMessage(e);return this.getResponse(t,!0,!1)}resendMessage(e){e.status="unSend",this.updateMessageList([e],"resend");const t=this.getEngine().chat.resendMessage(e);return this.getResponse(t,!0,!0)}deleteMessage(e){const t=this.getEngine().chat.deleteMessage(e);return this.getResponse(t,!0,!1)}setMessageExtensions(e,t){return this.getEngine().chat.setMessageExtensions(e,t)}getMessageExtensions(e){return this.getEngine().chat.getMessageExtensions(e)}deleteMessageExtensions(e,t){return this.getEngine().chat.deleteMessageExtensions(e,t)}modifyMessage(e){const t=this.getEngine().chat.modifyMessage(e);return this.getResponse(t,!0,!1).catch((e=>{const{code:t=0,data:s={}}=e.code;throw t===l.MSG_MODIFY_CONFLICT?console.warn(`${p.MSG_MODIFY_CONFLICT} data.message: ${null==s?void 0:s.message}`):t===l.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn(p.MSG_MODIFY_DISABLED_IN_AVCHATROOM):t===l.MODIFY_MESSAGE_NOT_EXIST&&console.warn(p.MODIFY_MESSAGE_NOT_EXIST),e}))}getMessageList(e={conversationID:this.getStoreData(a.CONV,"currentConversationID"),nextReqMessageID:this.getStoreData(a.CHAT,"nextReqMessageID")}){const t=this.getEngine();if(!t.chat.isReady())return Promise.reject({code:h.GET_MSG_LIST_ERROR,message:d.GET_MSG_LIST_ERROR});if(this.getStoreData(a.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});const s=this.getStoreData(a.CHAT,"messageSource"),n=this.hoppingConfigMap.get("nextMessageSeq"),i=this.hoppingConfigMap.get("nextMessageTime"),r=n||i;return s&&s.conversationID===e.conversationID&&r?this.getMessageListHopping():t.chat.getMessageList(e).then((e=>{const{messageList:s,nextReqMessageID:n,isCompleted:i}=e.data;return this.updateMessageList(s,"unshift"),t.TUIStore.update(a.CHAT,"nextReqMessageID",n),t.TUIStore.update(a.CHAT,"isCompleted",i),this.getMessageReactions({messageList:s}),this.readReceiptHandler.getMessageReadReceiptList(s),e})).catch((e=>Promise.reject(e)))}getMessageListHopping(e){var t;void 0===e&&(e={conversationID:null===(t=this.getStoreData(a.CHAT,"messageSource"))||void 0===t?void 0:t.conversationID,sequence:this.hoppingConfigMap.get("nextMessageSeq"),time:this.hoppingConfigMap.get("nextMessageTime")});const s=this.getEngine();return s.chat.getMessageListHopping(e).then((t=>{const{messageList:n,nextMessageSeq:i,nextMessageTime:r,isCompleted:o}=t.data,u=1===e.direction?e.sequence:i,c=1===e.direction?e.time:r;return this.updateMessageList(n,"unshift"),this.delayGetHoppingFunction=void 0,this.hoppingConfigMap.set("nextMessageSeq",u),this.hoppingConfigMap.set("nextMessageTime",c),s.TUIStore.update(a.CHAT,"isCompleted",o),t})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e).then((e=>{const{isCompleted:t,cursor:s,messageID:n,unreadUserIDList:i,readUserIDList:r}=e.data,o={code:0,data:{cursor:s,isCompleted:t,messageID:n,unreadUserInfoList:[],readUserInfoList:[]}},a=[...i,...r];return 0===a.length?o:this.getEngine().TUIUser.getUserProfile({userIDList:a}).then((e=>(i.length>0?e.data.forEach((e=>{const{userID:t,nick:s="",avatar:n=""}=e;o.data.unreadUserInfoList.push({userID:t,nick:s,avatar:n})})):e.data.forEach((e=>{const{userID:t,nick:s="",avatar:n=""}=e;o.data.readUserInfoList.push({userID:t,nick:s,avatar:n})})),o)))}))}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e.getMessage())}setTranslationLanguage(e){this.getEngine().TUIStore.update(a.USER,"targetLanguage",e)}translateText(e){const t=this.getStoreData(a.USER,"targetLanguage"),s=Object.assign({targetLanguage:t,sourceLanguage:"auto"},e);return this.getEngine().chat.translateText(s)}searchCloudMessages(e){const t=this.getStoreData(a.CONV,"conversationList");return this.getEngine().chat.searchCloudMessages(e).then((e=>{const{searchResultList:s}=e.data;return e.data.searchResultList=s.map((e=>{const{messageList:s,conversationID:i}=e,r=n(e,["messageList","conversationID"]),o=s.map((e=>new oe(e))),a=t.find((e=>e.conversationID===i));return Object.assign(Object.assign({},r),{messageList:o.sort(((e,t)=>t.time-e.time)),conversation:a})})),e}))}addMessageReaction(e,t){return this.getEngine().chat.addMessageReaction(e.getMessage(),t)}removeMessageReaction(e,t){return this.getEngine().chat.removeMessageReaction(e.getMessage(),t)}getMessageReactions(e){const{messageList:t=[]}=e,s=this.getStoreData(a.APP,"enabledEmojiPlugin");console.log(`TUIChatService.getMessageReactions enabledEmojiPlugin:${s} messageList length:${t.length}`),s&&t.length>0&&this.getEngine().chat.getMessageReactions(e).then((e=>{const t=e.data.resultList||e.data;this.updateMessageReactionList(t)})).catch((e=>{console.warn(`TUIChatService.getMessageReactions error:${e.message}`)}))}getAllUserListOfMessageReaction(e){var t;return this.getEngine().chat.getAllUserListOfMessageReaction(Object.assign(Object.assign({},e),{message:null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.getMessage()}))}updateMessageReactionList(e){const t=[];e.forEach((e=>{const{messageID:s,reactionList:n}=e,i=this.getEngine().TUIStore.getMessageModel(s);if(i){const e=[];for(let t=0;t<n.length;t++){let s=!0;for(let e=0;e<i.reactionList.length;e++)if(n[t].reactionID===i.reactionList[e].reactionID){i.reactionList[e]=n[t],s=!1;break}s&&e.push(n[t])}i.reactionList.push(...e),e.length=0,t.push(i)}})),t.length>0&&this.updateMessageList(t,"edit")}}class Vt extends se{constructor(){super(),this.groupMap=new Map}static getInstance(){return Vt.instance||(Vt.instance=new Vt),Vt.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.GROUP_LIST_UPDATED,this.onGroupListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_ATTRIBUTES_UPDATED,this.onGroupAttributesUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.GROUP_COUNTER_UPDATED,this.onGroupCounterUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.MESSAGE_RECEIVED,this.onMessageReceived.bind(this)),this.getGroupInitData()}onGroupListUpdated(e){const t=this.getEngine();t.TUIStore.update(a.GRP,"groupList",e);const s=t.TUIStore.getData(a.GRP,"currentGroupID");e.forEach((e=>{e.groupID===s&&t.TUIStore.update(a.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID");let n=t.TUIStore.getData(a.GRP,"groupList");const{groupID:i,groupAttributes:r}=e;s===i&&t.TUIStore.update(a.GRP,"currentGroupAttributes",r),n=n.map((e=>(e.groupID===i&&(e.groupAttributes=r),e))),t.TUIStore.update(a.GRP,"groupList",n)}onGroupCounterUpdated(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID"),n=t.TUIStore.getData(a.GRP,"currentGroupCounters")||{};let i=t.TUIStore.getData(a.GRP,"groupList");const{groupID:r,key:o,value:u}=e;s===r&&(n[o]=u,t.TUIStore.update(a.GRP,"currentGroupCounters",n)),i=i.map((e=>(e.groupID===r&&(e.groupCounters=Object.assign(Object.assign({},e.groupCounters),{[o]:u})),e))),t.TUIStore.update(a.GRP,"groupList",i)}onMessageReceived(e){const t=this.getEngine(),s=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:s}=e,{operationType:n,userIDList:i}=s,r=t.TUIStore.getData(a.GRP,"currentGroupID");switch(n){case t.TYPES.GRP_TIP_MBR_JOIN:this.addMemberList(i);break;case t.TYPES.GRP_TIP_MBR_QUIT:case t.TYPES.GRP_TIP_MBR_KICKED_OUT:this.removeMemberList(i);break;case t.TYPES.GRP_TIP_MBR_SET_ADMIN:case t.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:this.updateGroupMember(i);break;case t.TYPES.GRP_TIP_GRP_PROFILE_UPDATED:this.getGroupProfile({groupID:r});break;case t.TYPES.GRP_TIP_MBR_PROFILE_UPDATED:case t.TYPES.GRP_TIP_BAN_AVCHATROOM_MEMBER:case t.TYPES.GRP_TIP_UNBAN_AVCHATROOM_MEMBER:this.updateGroupMember(i)}}e.type===t.TYPES.MSG_GRP_SYS_NOTICE&&s.push(e)})),s.length>0&&t.TUIStore.update(a.GRP,"groupSystemNoticeList",s)}getGroupInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getGroupList().then((e=>{const{groupList:t=[]}=e.data;console.log(`TUIGroupService.init, getGroupList count:${t.length}`),t.length>0&&this.onGroupListUpdated(t)}))}updateGroupMember(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t){const s=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:n}=s.data;this.updateMemberList(n)}}))}resetCurrentStore(){this.getEngine().TUIStore.reset(a.GRP,["currentGroupID","currentGroup","currentGroupAttributes","currentGroupCounters","currentGroupMemberList"],!0)}switchGroup(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(s===e){const e=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(e)}this.resetCurrentStore(),t.TUIStore.update(a.GRP,"currentGroupID",e);try{yield this.getGroupInfo(e)}catch(e){Promise.reject(e)}const n=setTimeout((()=>{this.groupMap.delete(e),clearTimeout(n)}),5e3),i=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(i)}))}getGroupInfo(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine(),s=this.groupMap.get(e);if(s)return this.updateMemberList((null==s?void 0:s.memberList)||[]),t.TUIStore.update(a.GRP,"currentGroup",s.group),t.TUIStore.update(a.GRP,"currentGroupAttributes",s.groupAttributes||{}),void t.TUIStore.update(a.GRP,"currentGroupCounters",s.counters||{});const n={group:{},memberList:[],groupAttributes:void 0,counters:void 0},{data:{group:i}}=yield this.getGroupProfile({groupID:e});n.group=i;const{data:{memberList:r}}=yield this.getGroupMemberList({groupID:e});n.memberList=r;const o=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:u}=o.data;n.groupAttributes=u,t.TUIStore.update(a.GRP,"currentGroupAttributes",u);try{const s=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:n}=s.data;t.TUIStore.update(a.GRP,"currentGroupCounters",n)}catch(e){console.warn(e)}this.groupMap.set(e,n)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((s=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{group:e}=s.data;t.TUIStore.update(a.GRP,"currentGroup",e)}return s}))))}updateGroupProfile(e){return this.getEngine().chat.updateGroupProfile(e)}createGroup(e){return this.getEngine().chat.createGroup(e)}dismissGroup(e){return this.getEngine().chat.dismissGroup(e)}searchGroupByID(e){const t=this.getEngine();return t.chat.searchGroupByID(e).then((e=>{const{group:s}=e.data,n=t.TUIStore.getData(a.GRP,"groupList");return e.data.group.isJoinedGroup=n.some((e=>e.groupID===s.groupID)),e}))}joinGroup(e){return this.getEngine().chat.joinGroup(e)}quitGroup(e){return this.getEngine().chat.quitGroup(e)}getGroupApplicationList(){return this.getEngine().chat.getGroupApplicationList()}handleGroupApplication(e){return this.getEngine().chat.handleGroupApplication(e)}getGroupOnlineMemberCount(e){return this.getEngine().chat.getGroupOnlineMemberCount(e)}changeGroupOwner(e){return this.getEngine().chat.changeGroupOwner(e)}initGroupAttributes(e){return this.getEngine().chat.initGroupAttributes(e)}setGroupAttributes(e){return this.getEngine().chat.setGroupAttributes(e)}deleteGroupAttributes(e){return this.getEngine().chat.deleteGroupAttributes(e)}getGroupAttributes(e){return this.getEngine().chat.getGroupAttributes(e)}setGroupCounters(e){return this.getEngine().chat.setGroupCounters(e)}increaseGroupCounter(e){return this.getEngine().chat.increaseGroupCounter(e)}decreaseGroupCounter(e){return this.getEngine().chat.decreaseGroupCounter(e)}getGroupCounters(e){return this.getEngine().chat.getGroupCounters(e)}updateMemberList(e){const t=this.getEngine(),s=[...(t.TUIStore.getData(a.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(a.GRP,"currentGroupMemberList",s)}addMemberList(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t)try{const s=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:n}=s.data;this.updateMemberList(n)}catch(t){const s=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(s)}}))}removeMemberList(e){const t=this.getEngine(),s=t.TUIStore.getData(a.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(a.GRP,"currentGroupMemberList",s)}getGroupMemberList(e){const t=this.getEngine();return t.chat.getGroupMemberList(e).then((s=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{memberList:e}=s.data;this.updateMemberList(e)}return s}))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((s=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:n}=s.data;t.TUIStore.update(a.GRP,"currentGroup",n),this.addMemberList(e)}return s}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((s=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:n}=s.data;this.removeMemberList(e),t.TUIStore.update(a.GRP,"currentGroup",n)}return s}))}setGroupMemberMuteTime(e){return this.getEngine().chat.setGroupMemberMuteTime(e)}setGroupMemberRole(e){return this.getEngine().chat.setGroupMemberRole(e)}setGroupMemberNameCard(e){return this.getEngine().chat.setGroupMemberNameCard(e)}setGroupMemberCustomField(e){return this.getEngine().chat.setGroupMemberCustomField(e)}markGroupMemberList(e){return this.getEngine().chat.markGroupMemberList(e)}}class Ft extends se{constructor(){super()}static getInstance(){return Ft.instance||(Ft.instance=new Ft),Ft.instance}init(){const e=this.getEngine();e.eventCenter.addEvent(e.EVENT.FRIEND_LIST_UPDATED,this.onFriendListUpdated.bind(this)),e.eventCenter.addEvent(e.EVENT.FRIEND_APPLICATION_LIST_UPDATED,this.onFriendApplicationListUpdated.bind(this))}onFriendListUpdated(e){this.getEngine().TUIStore.update(a.FRIEND,"friendList",e)}onFriendApplicationListUpdated(e){const{friendApplicationList:t,unreadCount:s=0}=e,n=this.getEngine();n.TUIStore.update(a.FRIEND,"friendApplicationList",t),n.TUIStore.update(a.FRIEND,"friendApplicationUnreadCount",s)}getFriendList(){return this.getEngine().chat.getFriendList()}getFriendRemark(e){const t=this.getEngine().TUIStore.getData(a.FRIEND,"friendList"),s={};return e.forEach((e=>{for(let n=0;n<t.length;n++)t[n].userID!==e||(s[e]=t[n].remark)})),s}addFriend(e){return this.getEngine().chat.addFriend(e)}deleteFriend(e){return this.getEngine().chat.deleteFriend(e)}checkFriend(e){return this.getEngine().chat.checkFriend(e)}getFriendProfile(e){return this.getEngine().chat.getFriendProfile(e)}updateFriend(e){return this.getEngine().chat.updateFriend(e)}acceptFriendApplication(e){return this.getEngine().chat.acceptFriendApplication(e)}refuseFriendApplication(e){return this.getEngine().chat.refuseFriendApplication({userID:e})}deleteFriendApplication(e){return this.getEngine().chat.deleteFriendApplication(e)}setFriendApplicationRead(){return this.getEngine().chat.setFriendApplicationRead()}}class $t{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(e){return"function"!=typeof e&&console.error("middleware must be a function"),this.cache.push(e),this}next(){if(this.middlewares&&this.middlewares.length>0){return this.middlewares.shift().call(this,this.options,this.next.bind(this))}}run(e){return this.middlewares=this.cache.map((function(e){return e})),this.options=e,this.next()}}function Ht(e,t,s){const n=Object.create(null);Object.keys(s).forEach((s=>{if(!t[s])return;n[s]=t[s];const i=new $t;t[s]=function(){const r=Array.from(arguments);return i.use((function(t,n){return e.isInited?n():Promise.reject({code:h.NOT_INIT,message:`${s} | ${d.NOT_INIT}`})})).use((function(e,i){return n[s].apply(t,e)})),i.run(r)}}))}console.log("TUIChatEngine.VERSION:2.1.0");const Yt=Q.getInstance(),Bt=W.getInstance(),Kt=pe.getInstance(),qt=Dt.getInstance(),zt=Ct.getInstance(),Jt=Gt.getInstance(),Wt=wt.getInstance(),Xt=Vt.getInstance(),Zt=Ft.getInstance();Yt.mount(o.TUIStore,Kt),Yt.mount(o.TUITranslate,qt),Yt.mount(o.TUIConversation,zt),Yt.mount(o.TUIUser,Jt),Yt.mount(o.TUIChat,Wt),Yt.mount(o.TUIGroup,Xt),Yt.mount(o.TUIFriend,Zt),Ht(Yt,Yt,f),Ht(Yt,zt,m),Ht(Yt,Wt,E),Ht(Yt,Xt,v),Ht(Yt,Jt,T),Ht(Yt,Zt,I);export{a as StoreName,Yt as TUIChatEngine,Wt as TUIChatService,zt as TUIConversationService,Zt as TUIFriendService,Bt as TUIGlobal,Xt as TUIGroupService,Kt as TUIStore,qt as TUITranslateService,Jt as TUIUserService,Yt as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencentcloud/chat-uikit-engine",
3
- "version": "2.0.8",
3
+ "version": "2.1.0",
4
4
  "description": "Tencent Cloud TUIChatEngine SDK for Chat TUIKit",
5
5
  "main": "index.js",
6
6
  "keywords": [