@tencentcloud/chat-uikit-engine 0.0.6 → 0.0.8
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/index.d.ts +61 -5
- package/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -391,8 +391,55 @@ interface SetMemberCustomFiledParams extends GroupServiceBasicParams, MSetMember
|
|
|
391
391
|
}
|
|
392
392
|
interface MarkMemberParams extends GroupServiceBasicParams, MMarkMemberParams {
|
|
393
393
|
}
|
|
394
|
-
interface
|
|
394
|
+
interface Friend {
|
|
395
|
+
userID: string;
|
|
396
|
+
remark: string;
|
|
397
|
+
groupList: Array<any>;
|
|
398
|
+
source: string;
|
|
399
|
+
wording: string;
|
|
400
|
+
profile: any;
|
|
401
|
+
friendCustomFriend: Array<any>;
|
|
402
|
+
}
|
|
403
|
+
interface FriendApplication {
|
|
404
|
+
userID: string;
|
|
405
|
+
avatar: string;
|
|
406
|
+
nick: string;
|
|
407
|
+
time: number;
|
|
408
|
+
source: string;
|
|
409
|
+
wording: string;
|
|
410
|
+
type: string;
|
|
411
|
+
}
|
|
412
|
+
interface AddFriendParams {
|
|
413
|
+
to: string;
|
|
414
|
+
source: string;
|
|
415
|
+
remark?: string;
|
|
416
|
+
groupName?: string;
|
|
417
|
+
wording?: string;
|
|
418
|
+
type?: string;
|
|
419
|
+
}
|
|
420
|
+
interface DeleteFriendParams {
|
|
395
421
|
userIDList: Array<string>;
|
|
422
|
+
type?: string;
|
|
423
|
+
}
|
|
424
|
+
interface CheckFriendParams {
|
|
425
|
+
userIDList: Array<string>;
|
|
426
|
+
type?: string;
|
|
427
|
+
}
|
|
428
|
+
interface GetFriendProfileParams {
|
|
429
|
+
userIDList: Array<string>;
|
|
430
|
+
}
|
|
431
|
+
interface UpdateFriendParams {
|
|
432
|
+
userID: string;
|
|
433
|
+
remark?: string;
|
|
434
|
+
friendCustomField?: Array<any>;
|
|
435
|
+
}
|
|
436
|
+
interface AcceptFriendApplicationParams {
|
|
437
|
+
userID: string;
|
|
438
|
+
remark?: string;
|
|
439
|
+
type: string;
|
|
440
|
+
}
|
|
441
|
+
interface DeleteFriendApplicationParams {
|
|
442
|
+
userID: string;
|
|
396
443
|
type: string;
|
|
397
444
|
}
|
|
398
445
|
|
|
@@ -436,6 +483,7 @@ declare enum StoreName {
|
|
|
436
483
|
CHAT = "chat",
|
|
437
484
|
GRP = "group",
|
|
438
485
|
USER = "user",
|
|
486
|
+
FRIEND = "friend",
|
|
439
487
|
CUSTOM = "custom"
|
|
440
488
|
}
|
|
441
489
|
|
|
@@ -505,7 +553,7 @@ interface IMessageHandler {
|
|
|
505
553
|
handleMergeMessage(message: Message): object;
|
|
506
554
|
handleGroupTipsMessage(message: Message): object;
|
|
507
555
|
handleGroupSystemMessage(message: Message): object;
|
|
508
|
-
handleCallKitSignaling(message: any): string;
|
|
556
|
+
handleCallKitSignaling(message: any): string | undefined;
|
|
509
557
|
}
|
|
510
558
|
|
|
511
559
|
interface ITUIChatService extends TUIBase {
|
|
@@ -580,7 +628,6 @@ interface ITUIUserService extends TUIBase {
|
|
|
580
628
|
switchMessageReadStatus(displayMessageReadReceipt: boolean): void;
|
|
581
629
|
getUserProfile(options?: UserIDListParams): Promise<any>;
|
|
582
630
|
updateMyProfile(options: UpdateMyProfileParams): Promise<any>;
|
|
583
|
-
getBlacklist(): Promise<any>;
|
|
584
631
|
addToBlacklist(options: UserIDListParams): Promise<any>;
|
|
585
632
|
removeFromBlacklist(options: UserIDListParams): Promise<any>;
|
|
586
633
|
getUserStatus(options: UserIDListParams): Promise<any>;
|
|
@@ -591,7 +638,16 @@ interface ITUIUserService extends TUIBase {
|
|
|
591
638
|
interface ITUIFriendService {
|
|
592
639
|
init(): void;
|
|
593
640
|
getFriendList(): Promise<any>;
|
|
594
|
-
|
|
641
|
+
getFriendRemark(userIDList: Array<string>): Object;
|
|
642
|
+
addFriend(options: AddFriendParams): Promise<any>;
|
|
643
|
+
deleteFriend(options: DeleteFriendParams): Promise<any>;
|
|
644
|
+
checkFriend(options: CheckFriendParams): Promise<any>;
|
|
645
|
+
getFriendProfile(options: GetFriendProfileParams): Promise<any>;
|
|
646
|
+
updateFriend(options: UpdateFriendParams): Promise<any>;
|
|
647
|
+
acceptFriendApplication(options: AcceptFriendApplicationParams): Promise<any>;
|
|
648
|
+
refuseFriendApplication(userID: string): Promise<any>;
|
|
649
|
+
deleteFriendApplication(options: DeleteFriendApplicationParams): Promise<any>;
|
|
650
|
+
setFriendApplicationRead(): Promise<any>;
|
|
595
651
|
}
|
|
596
652
|
|
|
597
653
|
interface ITUIChatEngine {
|
|
@@ -626,4 +682,4 @@ declare const tuiChat: ITUIChatService;
|
|
|
626
682
|
declare const tuiGroup: ITUIGroupService;
|
|
627
683
|
declare const tuiFriend: ITUIFriendService;
|
|
628
684
|
|
|
629
|
-
export { AddMemberParams, ChangGroupOwnerParams, CountersParams, CreateGroupParams, DeleteMemberParams, ForwardMessageParams, GetGroupMessageReadParams, GetGroupProfileParams, GetMemberListParams, GetMemberProfileParams, GetMessageListParams, 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, 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, UpdateGroupParams, UpdateMyProfileParams, UserIDListParams,
|
|
685
|
+
export { AcceptFriendApplicationParams, AddFriendParams, AddMemberParams, ChangGroupOwnerParams, CheckFriendParams, CountersParams, CreateGroupParams, DeleteFriendApplicationParams, DeleteFriendParams, DeleteMemberParams, ForwardMessageParams, Friend, FriendApplication, GetFriendProfileParams, GetGroupMessageReadParams, GetGroupProfileParams, GetMemberListParams, GetMemberProfileParams, GetMessageListParams, 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, 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, handleGroupApplicationParams, sendForwardMessageParams };
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@tencentcloud/chat";import t from"tim-upload-plugin";import n from"tim-profanity-filter-plugin";function s(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]])}return n}function i(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{u(s.next(e))}catch(e){r(e)}}function a(e){try{u(s.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((s=s.apply(e,t||[])).next())}))}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 n of this.events[e].keys())n.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.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.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)}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_MODIFIED,this.onMessageReadReceiptReceived,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.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)}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)}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)}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)}}var o,a,u,g,c,l,p,h,d;!function(e){e.TUIGlobal="TUIGlobal",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.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",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"}(g||(g={})),function(e){e.ADD="add",e.REMOVE="remove"}(c||(c={})),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"}(p||(p={})),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,消息不存在."}(h||(h={})),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,isReady:1,setLogLevel:1,destroy:1},m={deleteConversation:1,pinConversation:1,muteConversation:1,switchConversation:1,getConversationProfile:1,clearHistoryMessage:1},v={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},E={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},y={switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1},S={getFriendList:1},T=function(e){return void 0===e},I=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 O=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},_=(e,t=6,n=.5)=>{let s=t;return e.catch((e=>{if(0===s)throw e;const t=setTimeout((()=>{clearTimeout(t),s--}),1e3*n)}))};class C{constructor(){this.EVENT=e.EVENT,this.TYPES=e.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return C.instance||(C.instance=new C),C.instance}mount(e,t){this[e]=t}login(e){const{chat:t,SDKAppID:n,userID:s}=e;return this.createChat(e),this.userID=s,this.TUIGlobal.initOfficial(n),this.eventCenter=new r(this),this.eventCenter.removeEvents(),this.initStore(),this.initService(),t&&t.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),Promise.resolve({})):(this.registerPlugin(e),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(e))}logout(){return this.userID="",this.isInited=!1,this.chat.logout()}isReady(){return this.chat.isReady()}setLogLevel(e){return this.chat.setLogLevel(e)}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),console.log("TUIEngine.initStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIGroup.init(),this.TUIUser.init(),this.TUIFriend.init(),this.isInited=!0,console.log("TUIEngine.initService ok.")}createChat(t){const{chat:n}=t,i=s(t,["chat"]);T(n)?this.chat=e.create(Object.assign(Object.assign({},i),{scene:"chat-uikit-engine"})):this.chat=n}loginChat(e){const{userID:t,userSig:n}=e;return new Promise(((e,s)=>{this.chat.login({userID:t,userSig:n}).then((t=>{console.log("TUIChatEngine.loginChat ok."),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:s,imResponse:t})})).catch((e=>{s(e)}))}))}registerPlugin(e){const{useUploadPlugin:s=!1,useProfanityFilterPlugin:i=!1,TUIOfflinePush:r,offlinePushConfig:o}=e;!0===s&&this.chat.registerPlugin({"tim-upload-plugin":t}),!0===i&&this.chat.registerPlugin({"tim-profanity-filter-plugin":n}),"app"!==this.TUIGlobal.getPlatform()||T(r)||T(o)||this.chat.registerPlugin({"tim-offline-push-plugin":r,offlinePushConfig:o})}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")}}const D="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),P="undefined"!=typeof uni&&"undefined"==typeof window,R=D||P,U="undefined"!=typeof uni,x=("undefined"!=typeof uni||"undefined"!=typeof window)&&!R,G=D?wx:U?uni:window,j=x&&window&&window.navigator&&window.navigator.userAgent||"",N=/Android/i.test(j),k=/(?:Windows Phone)/.test(j),L=/(?:SymbianOS)/.test(j),A=/iPad/i.test(j)||/iPhone/i.test(j)||/iPod/i.test(j),w=N||k||L||A,$=x&&!w;class V{constructor(){this.global=G,this.isOfficial=!1}static getInstance(){return V.instance||(V.instance=new V),V.instance}initOfficial(e){this.isOfficial=1400187352===e||1400188366===e}getPlatform(){let e="";return $?e="pc":w?e="h5":D?e="wechat":P&&!D&&(e="app"),e}}class F{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,autoSubOnlineStatus:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",displayMessageReadReceipt:!1},this.store={userProfile:{},displayOnlineStatus:!1,autoSubOnlineStatus:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",displayMessageReadReceipt:!1}}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:n=0,customStatus:s=""}=e;n===u.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:n,customStatus:s})})):this.store.userStatusList.clear()}}class Y{getEngine(){return C.getInstance()}}const H="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",B="https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.svg",K="https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png",q="https://web.sdk.qcloud.com/im/assets/emoji/",z="https://web.sdk.qcloud.com/im/assets/face-elem/",J="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&",W="https://apis.map.qq.com/ws/staticmap/v2/?",X={"[NO]":"emoji_0@2x.png","[OK]":"emoji_1@2x.png","[下雨]":"emoji_2@2x.png","[么么哒]":"emoji_3@2x.png","[乒乓]":"emoji_4@2x.png","[便便]":"emoji_5@2x.png","[信封]":"emoji_6@2x.png","[偷笑]":"emoji_7@2x.png","[傲慢]":"emoji_8@2x.png","[再见]":"emoji_9@2x.png","[冷汗]":"emoji_10@2x.png","[凋谢]":"emoji_11@2x.png","[刀]":"emoji_12@2x.png","[删除]":"emoji_13@2x.png","[勾引]":"emoji_14@2x.png","[发呆]":"emoji_15@2x.png","[发抖]":"emoji_16@2x.png","[可怜]":"emoji_17@2x.png","[可爱]":"emoji_18@2x.png","[右哼哼]":"emoji_19@2x.png","[右太极]":"emoji_20@2x.png","[右车头]":"emoji_21@2x.png","[吐]":"emoji_22@2x.png","[吓]":"emoji_23@2x.png","[咒骂]":"emoji_24@2x.png","[咖啡]":"emoji_25@2x.png","[啤酒]":"emoji_26@2x.png","[嘘]":"emoji_27@2x.png","[回头]":"emoji_28@2x.png","[困]":"emoji_29@2x.png","[坏笑]":"emoji_30@2x.png","[多云]":"emoji_31@2x.png","[大兵]":"emoji_32@2x.png","[大哭]":"emoji_33@2x.png","[太阳]":"emoji_34@2x.png","[奋斗]":"emoji_35@2x.png","[奶瓶]":"emoji_36@2x.png","[委屈]":"emoji_37@2x.png","[害羞]":"emoji_38@2x.png","[尴尬]":"emoji_39@2x.png","[左哼哼]":"emoji_40@2x.png","[左太极]":"emoji_41@2x.png","[左车头]":"emoji_42@2x.png","[差劲]":"emoji_43@2x.png","[弱]":"emoji_44@2x.png","[强]":"emoji_45@2x.png","[彩带]":"emoji_46@2x.png","[彩球]":"emoji_47@2x.png","[得意]":"emoji_48@2x.png","[微笑]":"emoji_49@2x.png","[心碎了]":"emoji_50@2x.png","[快哭了]":"emoji_51@2x.png","[怄火]":"emoji_52@2x.png","[怒]":"emoji_53@2x.png","[惊恐]":"emoji_54@2x.png","[惊讶]":"emoji_55@2x.png","[憨笑]":"emoji_56@2x.png","[手枪]":"emoji_57@2x.png","[打哈欠]":"emoji_58@2x.png","[抓狂]":"emoji_59@2x.png","[折磨]":"emoji_60@2x.png","[抠鼻]":"emoji_61@2x.png","[抱抱]":"emoji_62@2x.png","[抱拳]":"emoji_63@2x.png","[拳头]":"emoji_64@2x.png","[挥手]":"emoji_65@2x.png","[握手]":"emoji_66@2x.png","[撇嘴]":"emoji_67@2x.png","[擦汗]":"emoji_68@2x.png","[敲打]":"emoji_69@2x.png","[晕]":"emoji_70@2x.png","[月亮]":"emoji_71@2x.png","[棒棒糖]":"emoji_72@2x.png","[汽车]":"emoji_73@2x.png","[沙发]":"emoji_74@2x.png","[流汗]":"emoji_75@2x.png","[流泪]":"emoji_76@2x.png","[激动]":"emoji_77@2x.png","[灯泡]":"emoji_78@2x.png","[炸弹]":"emoji_79@2x.png","[熊猫]":"emoji_80@2x.png","[爆筋]":"emoji_81@2x.png","[爱你]":"emoji_82@2x.png","[爱心]":"emoji_83@2x.png","[爱情]":"emoji_84@2x.png","[猪头]":"emoji_85@2x.png","[猫咪]":"emoji_86@2x.png","[献吻]":"emoji_87@2x.png","[玫瑰]":"emoji_88@2x.png","[瓢虫]":"emoji_89@2x.png","[疑问]":"emoji_90@2x.png","[白眼]":"emoji_91@2x.png","[皮球]":"emoji_92@2x.png","[睡觉]":"emoji_93@2x.png","[磕头]":"emoji_94@2x.png","[示爱]":"emoji_95@2x.png","[礼品袋]":"emoji_96@2x.png","[礼物]":"emoji_97@2x.png","[篮球]":"emoji_98@2x.png","[米饭]":"emoji_99@2x.png","[糗大了]":"emoji_100@2x.png","[红双喜]":"emoji_101@2x.png","[红灯笼]":"emoji_102@2x.png","[纸巾]":"emoji_103@2x.png","[胜利]":"emoji_104@2x.png","[色]":"emoji_105@2x.png","[药]":"emoji_106@2x.png","[菜刀]":"emoji_107@2x.png","[蛋糕]":"emoji_108@2x.png","[蜡烛]":"emoji_109@2x.png","[街舞]":"emoji_110@2x.png","[衰]":"emoji_111@2x.png","[西瓜]":"emoji_112@2x.png","[调皮]":"emoji_113@2x.png","[象棋]":"emoji_114@2x.png","[跳绳]":"emoji_115@2x.png","[跳跳]":"emoji_116@2x.png","[车厢]":"emoji_117@2x.png","[转圈]":"emoji_118@2x.png","[鄙视]":"emoji_119@2x.png","[酷]":"emoji_120@2x.png","[钞票]":"emoji_121@2x.png","[钻戒]":"emoji_122@2x.png","[闪电]":"emoji_123@2x.png","[闭嘴]":"emoji_124@2x.png","[闹钟]":"emoji_125@2x.png","[阴险]":"emoji_126@2x.png","[难过]":"emoji_127@2x.png","[雨伞]":"emoji_128@2x.png","[青蛙]":"emoji_129@2x.png","[面条]":"emoji_130@2x.png","[鞭炮]":"emoji_131@2x.png","[风车]":"emoji_132@2x.png","[飞吻]":"emoji_133@2x.png","[飞机]":"emoji_134@2x.png","[饥饿]":"emoji_135@2x.png","[香蕉]":"emoji_136@2x.png","[骷髅]":"emoji_137@2x.png","[麦克风]":"emoji_138@2x.png","[麻将]":"emoji_139@2x.png","[鼓掌]":"emoji_140@2x.png","[龇牙]":"emoji_141@2x.png"};class Z extends Y{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._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{I(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 n=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[n]}else if(this.type===e.TYPES.CONV_GROUP){const n=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=n}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,n,s,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:H;break;case o.TYPES.CONV_GROUP:a=b(null===(n=this.groupProfile)||void 0===n?void 0:n.avatar)?null===(s=this.groupProfile)||void 0===s?void 0:s.avatar:B;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:K}return a}getShowName(){var e,t,n,s;const i=this.getEngine();let r="";switch(this.type){case i.TYPES.CONV_C2C:r=(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===(n=this.groupProfile)||void 0===n?void 0:n.name)||(null===(s=this.groupProfile)||void 0===s?void 0:s.groupID)||"";break;case i.TYPES.CONV_SYSTEM:r=i.TUITranslate.t("系统通知")||""}return r}getGroupAtInfo(){const e=this.getEngine().TUITranslate.t.bind(this),t=[`[${e("TUIConversation.有人@我")}]`,`[${e("TUIConversation.@所有人")}]`,`[${e("TUIConversation.@所有人")}][${e("TUIConversation.有人@我")}]`];let n="";for(let e=0;e<this.groupAtInfoList.length;e++)this.groupAtInfoList[e].atTypeArray[0]&&this.unreadCount>0&&(n=t[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;let t="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(t=function(e,t){const n=6e4,s=36e5,i=24*s,r=(new Date).getTime()-e;let o="";if(r<0)return o;const a=r/n,u=r/s,g=r/i,c=r/6048e5;if(c>=1&&c<=4)o=` ${parseInt(`${c}`,10)} ${t("time.周")}${t("time.前")}`;else if(g>=1&&g<=6)o=` ${parseInt(`${g}`,10)} ${t("time.天")}${t("time.前")}`;else if(u>=1&&u<=23)o=` ${parseInt(`${u}`,10)} ${t("time.小时")}${t("time.前")}`;else if(a>=1&&a<=59)o=` ${parseInt(`${a}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(r>=0&&r<=n)o=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),o=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return o}(1e3*this.lastMessage.lastTime,this.getEngine().TUITranslate.t.bind(this))),t}getLastMessageText(){var e;const t=this.getEngine(),n=t.TUITranslate.t.bind(this),s=this.lastMessage,i=this._conversation;let r="",o="";const a=i.unreadCount>0&&i.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?n(`[${i.unreadCount>99?"99+":i.unreadCount}条]`):"";if(i.type===t.TYPES.CONV_GROUP&&(r=s.fromAccount===i.groupProfile.selfInfo.userID?n("TUIConversation.我")||"":s.nameCard||s.nick||s.fromAccount),s.type===t.TYPES.MSG_TEXT)o=s.payload.text;else if(s.type===t.TYPES.MSG_CUSTOM){const n=O(null===(e=null==s?void 0:s.payload)||void 0===e?void 0:e.data);if(1===(null==n?void 0:n.businessID))return o=t.TUIChat.messageHandler.handleCallKitSignaling(s),o;o=s.messageForShow}else o=s.messageForShow;return s.isRevoked&&(o=n("TUIChat.撤回了一条消息")||""),i.type===t.TYPES.CONV_GROUP&&s.type===t.TYPES.MSG_GRP_TIP?o:`${a}${r?`${r}:`:""}${o}`}}class Q{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=>{const n=new Z(e);t.push(n)})),this.store.conversationList=t}}class ee extends Y{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.getEngine().TYPES.MSG_GRP_SYS_NOTICE]:e=>this.getEngine().TUIChat.messageHandler.handleGroupSystemMessage(e)},this._message=e,this.progress=0,this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{I(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{I(t)||(this[t]=e[t])}))}getMessage(){return this._message}modifyMessage(e){return e.type&&this._message.type!==e.type&&!e.payload?Promise.reject({code:p.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.getEngine().chat.getSignalingInfo(this._message)}getMessageContent(){const e=this.messageHandlers[this.type];return e?e(this._message):{}}getMessageReaction(){const e=Object.assign({},this._message.cloudCustomData?O(this._message.cloudCustomData):{});return e.messageReact?e.messageReact:void 0}addMessageReaction(e){const t=this.setMessageReaction(e);if(t)return _(this.getEngine().TUIChat.modifyMessage(t))}deleteMessageReaction(e){const t=this.setMessageReaction(e,c.REMOVE);if(t)return _(this.getEngine().TUIChat.modifyMessage(t))}setMessageReaction(e,t=c.ADD){const n=this.getEngine().getMyUserID(),s=this._message,i=Object.assign({messageReact:{}},s.cloudCustomData?O(s.cloudCustomData):{}),r=Object.assign({reacts:{},version:1},i.messageReact),o=r.reacts[e]||[],a=o.indexOf(n),u=-1===a&&t===c.REMOVE,g=a>=0&&t===c.ADD;if(!u&&!g)return-1===a?o.push(n):o.splice(a,1),r.reacts[e]=o,r.reacts=Object.keys(r.reacts).filter((e=>r.reacts[e].length>0)).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r.reacts[t]})),{}),i.messageReact=r,s.cloudCustomData=JSON.stringify(i),s}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class te{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},typingStatus:!1},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},typingStatus:!1}}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),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let n=e;e instanceof ee||(n=this.getModel(e.ID),n?n.updateProperties(e):n=new ee(e)),t.push(n)})),this.store.messageList=t}}class ne extends Y{constructor(e){super(),this.groupAttributes={},this.groupCounters={},this.initProxy(e)}initProxy(e){Object.keys(e).forEach((t=>{I(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 se{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 ne?t:new ne(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 ne?e:new ne(e)))}}class ie{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 re{constructor(){this.storeMap={[a.USER]:new F,[a.CONV]:new Q,[a.CHAT]:new te,[a.GRP]:new se},this.task={}}static getInstance(){return re.instance||(re.instance=new re),re.instance}watch(e,t){this.task[e]||(this.task[e]={});const n=this.task[e];Object.keys(t).forEach((s=>{const i=t[s];n[s]||(n[s]=new Map),n[s].set(i,1),this.notifyOnWatch(e,s,i)}))}unwatch(e,t){if(!this.task[e])return;const n=this.task[e];Object.keys(t).forEach((e=>{n[e].delete(t[e])}))}update(e,t,n){var s;e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ie),null===(s=this.storeMap[e])||void 0===s||s.update(t,n),this.notify(e,t)}getData(e,t){var n;return e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ie),null===(n=this.storeMap[e])||void 0===n?void 0:n.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=[],n=!1){if(e in this.storeMap){const s=this.storeMap[e];0===t.length&&(t=Object.keys(null==s?void 0:s.store)),s.reset(t),n&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,n){const s=this.getData(e,t);n&&n.call(this,s)}notify(e,t){if(!this.task[e])return;const n=this.task[e];if(n[t]){const s=n[t],i=this.getData(e,t);for(const[e]of s.entries())e.call(this,i)}}}function oe(e){return oe="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},oe(e)}function ae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ue(e){var t=function(e,t){if("object"!==oe(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!==oe(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===oe(t)?t:String(t)}function ge(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,ue(s.key),s)}}function ce(e,t,n){return t&&ge(e.prototype,t),n&&ge(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function le(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e,t){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pe(e,t)}function he(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&&pe(e,t)}function de(e,t){if(t&&("object"===oe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return le(e)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}function me(e,t,n){return(t=ue(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function Ee(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 ve(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ve(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 ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function Se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Te={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)}},Ie=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ae(this,e),this.init(t,n)}return ce(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||Te,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),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,s){return s&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Se(Se({},{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}()),be=function(){function e(){ae(this,e),this.observers={}}return ce(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.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,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function Oe(){var e,t,n=new Promise((function(n,s){e=n,t=s}));return n.resolve=e,n.reject=t,n}function Me(e){return null==e?"":""+e}function _e(e,t,n){function s(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=s(r.shift());!e[o]&&n&&(e[o]=new n),e=Object.prototype.hasOwnProperty.call(e,o)?e[o]:{}}return i()?{}:{obj:e,k:s(r.shift())}}function Ce(e,t,n){var s=_e(e,t,Object);s.obj[s.k]=n}function De(e,t){var n=_e(e,t),s=n.obj,i=n.k;if(s)return s[i]}function Pe(e,t,n){var s=De(e,n);return void 0!==s?s:De(t,n)}function Re(e,t,n){for(var s in t)"__proto__"!==s&&"constructor"!==s&&(s in e?"string"==typeof e[s]||e[s]instanceof String||"string"==typeof t[s]||t[s]instanceof String?n&&(e[s]=t[s]):Re(e[s],t[s],n):e[s]=t[s]);return e}function Ue(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var xe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Ge(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return xe[e]})):e}var je="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Ne=[" ",",","?","!",";"];function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ae(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 n,s=fe(e);if(t){var i=fe(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return de(this,n)}}function we(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var s=t.split(n),i=e,r=0;r<s.length;++r){if(!i)return;if("string"==typeof i[s[r]]&&r+1<s.length)return;if(void 0===i[s[r]]){for(var o=2,a=s.slice(r,r+o).join(n),u=i[a];void 0===u&&s.length>r+o;)o++,u=i[a=s.slice(r,r+o).join(n)];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 g=s.slice(r+o).join(n);return g?we(u,g,n):void 0}i=i[s[r]]}return i}}var $e=function(e){he(n,be);var t=Ae(n);function n(e){var s,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ae(this,n),s=t.call(this),je&&be.call(le(s)),s.data=e||{},s.options=i,void 0===s.options.keySeparator&&(s.options.keySeparator="."),void 0===s.options.ignoreJSONStructure&&(s.options.ignoreJSONStructure=!0),s}return ce(n,[{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,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,r=void 0!==s.ignoreJSONStructure?s.ignoreJSONStructure:this.options.ignoreJSONStructure,o=[e,t];n&&"string"!=typeof n&&(o=o.concat(n)),n&&"string"==typeof n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."));var a=De(this.data,o);return a||!r||"string"!=typeof n?a:we(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},r=this.options.keySeparator;void 0===r&&(r=".");var o=[e,t];n&&(o=o.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(s=t,t=(o=e.split("."))[1]),this.addNamespaces(t),Ce(this.data,o,s),i.silent||this.emit("added",e,t,n,s)}},{key:"addResources",value:function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});s.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,s,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(s=n,n=t,t=(o=e.split("."))[1]),this.addNamespaces(t);var a=De(this.data,o)||{};s?Re(a,n,i):a=Le(Le({},a),n),Ce(this.data,o,a),r.silent||this.emit("added",e,t,n)}},{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?Le(Le({},{}),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}}]),n}(),Ve={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,s,i){var r=this;return e.forEach((function(e){r.processors[e]&&(t=r.processors[e].process(t,n,s,i))})),t}};function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function He(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 n,s=fe(e);if(t){var i=fe(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return de(this,n)}}var Be={},Ke=function(e){he(n,be);var t=He(n);function n(e){var s,i,r,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ae(this,n),s=t.call(this),je&&be.call(le(s)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,o=le(s),i.forEach((function(e){r[e]&&(o[e]=r[e])})),s.options=a,void 0===s.options.keySeparator&&(s.options.keySeparator="."),s.logger=Ie.create("translator"),s}return ce(n,[{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 n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],r=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var s=Ne.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===s.length)return!0;var i=new RegExp("(".concat(s.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),r=!i.test(e);if(!r){var o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r}(e,n,s));if(r&&!o){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var u=e.split(n);(n!==s||n===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(s)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,s){var i=this;if("object"!==oe(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),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,g=a.namespaces,c=g[g.length-1],l=t.lng||this.language,p=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(p){var h=t.nsSeparator||this.options.nsSeparator;return r?{res:"".concat(c).concat(h).concat(u),usedKey:u,exactUsedKey:u,usedLng:l,usedNS:c}:"".concat(c).concat(h).concat(u)}return r?{res:u,usedKey:u,exactUsedKey:u,usedLng:l,usedNS:c}:u}var d=this.resolve(e,t),f=d&&d.res,m=d&&d.usedKey||u,v=d&&d.exactUsedKey||u,E=Object.prototype.toString.apply(f),y=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject;if(S&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(E)<0&&("string"!=typeof y||"[object Array]"!==E)){if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var T=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,f,Ye(Ye({},t),{},{ns:g})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return r?(d.res=T,d):T}if(o){var I="[object Array]"===E,b=I?[]:{},O=I?v:m;for(var M in f)if(Object.prototype.hasOwnProperty.call(f,M)){var _="".concat(O).concat(o).concat(M);b[M]=this.translate(_,Ye(Ye({},t),{joinArrays:!1,ns:g})),b[M]===_&&(b[M]=f[M])}f=b}}else if(S&&"string"==typeof y&&"[object Array]"===E)(f=f.join(y))&&(f=this.extendTranslation(f,e,t,s));else{var C=!1,D=!1,P=void 0!==t.count&&"string"!=typeof t.count,R=n.hasDefaultValue(t),U=P?this.pluralResolver.getSuffix(l,t.count,t):"",x=t["defaultValue".concat(U)]||t.defaultValue;!this.isValidLookup(f)&&R&&(C=!0,f=x),this.isValidLookup(f)||(D=!0,f=u);var G=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&D?void 0:f,j=R&&x!==f&&this.options.updateMissing;if(D||C||j){if(this.logger.log(j?"updateKey":"missingKey",l,c,u,j?x:f),o){var N=this.resolve(u,Ye(Ye({},t),{},{keySeparator:!1}));N&&N.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 k=[],L=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&L&&L[0])for(var A=0;A<L.length;A++)k.push(L[A]);else"all"===this.options.saveMissingTo?k=this.languageUtils.toResolveHierarchy(t.lng||this.language):k.push(t.lng||this.language);var w=function(e,n,s){var r=R&&s!==f?s:G;i.options.missingKeyHandler?i.options.missingKeyHandler(e,c,n,r,j,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,c,n,r,j,t),i.emit("missingKey",e,c,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?k.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){w([e],u+n,t["defaultValue".concat(n)]||x)}))})):w(k,u,x))}f=this.extendTranslation(f,e,t,d,s),D&&f===u&&this.options.appendNamespaceToMissingKey&&(f="".concat(c,":").concat(u)),(D||C)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(c,":").concat(u):u,C?f:void 0):this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d):f}},{key:"extendTranslation",value:function(e,t,n,s,i){var r=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,Ye(Ye({},this.options.interpolation.defaultVariables),n),s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(Ye(Ye({},n),{interpolation:Ye(Ye({},this.options.interpolation),n.interpolation)}));var o,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var u=e.match(this.interpolator.nestingRegexp);o=u&&u.length}var g=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(g=Ye(Ye({},this.options.interpolation.defaultVariables),g)),e=this.interpolator.interpolate(e,g,n.lng||this.language,n),a){var c=e.match(this.interpolator.nestingRegexp);o<(c&&c.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,s=new Array(e),o=0;o<e;o++)s[o]=arguments[o];return i&&i[0]===s[0]&&!n.context?(r.logger.warn("It seems you are nesting recursively key: ".concat(s[0]," in key: ").concat(t[0])),null):r.translate.apply(r,s.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var l=n.postProcess||this.options.postProcess,p="string"==typeof l?[l]:l;return null!=e&&p&&p.length&&!1!==n.applyPostProcessor&&(e=Ve.handle(p,e,t,this.options&&this.options.postProcessPassResolved?Ye({i18nResolved:s},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,s,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),g=u.key;n=g;var c=u.namespaces;o.options.fallbackNS&&(c=c.concat(o.options.fallbackNS));var l=void 0!==a.count&&"string"!=typeof a.count,p=l&&!a.ordinal&&0===a.count&&o.pluralResolver.shouldUseIntlApi(),h=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);c.forEach((function(e){o.isValidLookup(t)||(r=e,!Be["".concat(d[0],"-").concat(e)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(r)&&(Be["".concat(d[0],"-").concat(e)]=!0,o.logger.warn('key "'.concat(n,'" 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(n){if(!o.isValidLookup(t)){i=n;var r,u=[g];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(u,g,n,e,a);else{var c;l&&(c=o.pluralResolver.getSuffix(n,a.count,a));var d="".concat(o.options.pluralSeparator,"zero");if(l&&(u.push(g+c),p&&u.push(g+d)),h){var f="".concat(g).concat(o.options.contextSeparator).concat(a.context);u.push(f),l&&(u.push(f+c),p&&u.push(f+d))}}for(;r=u.pop();)o.isValidLookup(t)||(s=r,t=o.getResource(n,e,r,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:s,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,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}]),n}();function qe(e){return e.charAt(0).toUpperCase()+e.slice(1)}var ze=function(){function e(t){ae(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Ie.create("languageUtils")}return ce(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"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=qe(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=qe(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=qe(n[2].toLowerCase()))),n.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,n=this;return e?(e.forEach((function(e){if(!t){var s=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(s)||(t=s)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var s=n.getLanguagePartFromCode(e);if(n.isSupportedCode(s))return t=s;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(s))return e}))}})),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 n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.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)),s.forEach((function(e){i.indexOf(e)<0&&r(n.formatLanguageCode(e))})),i}}]),e}(),Je=[{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}],We={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)}},Xe=["v1","v2","v3"],Ze={zero:0,one:1,two:2,few:3,many:4,other:5};var Qe=function(){function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ae(this,e),this.languageUtils=t,this.options=s,this.logger=Ie.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=(n={},Je.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:We[e.fc]}}))})),n)}return ce(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]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,n);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((function(e,t){return Ze[e]-Ze[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):s.numbers.map((function(s){return t.getSuffix(e,s,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this.getRule(e,n);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(t)):this.getSuffixRetroCompatible(s,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,s=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[s];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var r=function(){return n.options.prepend&&i.toString()?n.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&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Xe.includes(this.options.compatibilityJSON)}}]),e}();function et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function tt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?et(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):et(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var nt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,e),this.logger=Ie.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return ce(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:Ge,this.escapeValue=void 0===t.escapeValue||t.escapeValue,this.useRawValueToEscape=void 0!==t.useRawValueToEscape&&t.useRawValueToEscape,this.prefix=t.prefix?Ue(t.prefix):t.prefixEscaped||"{{",this.suffix=t.suffix?Ue(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?Ue(t.nestingPrefix):t.nestingPrefixEscaped||Ue("$t("),this.nestingSuffix=t.nestingSuffix?Ue(t.nestingSuffix):t.nestingSuffixEscaped||Ue(")"),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 n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,s){var i,r,o,a=this,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function g(e){return e.replace(/\$/g,"$$$$")}var c=function(e){if(e.indexOf(a.formatSeparator)<0){var i=Pe(t,u,e);return a.alwaysFormat?a.format(i,void 0,n,tt(tt(tt({},s),t),{},{interpolationkey:e})):i}var r=e.split(a.formatSeparator),o=r.shift().trim(),g=r.join(a.formatSeparator).trim();return a.format(Pe(t,u,o),g,n,tt(tt(tt({},s),t),{},{interpolationkey:o}))};this.resetRegExp();var l=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&void 0!==s.interpolation.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:function(e){return g(e)}},{regex:this.regexp,safeValue:function(e){return a.escapeValue?g(a.escape(e)):g(e)}}].forEach((function(t){for(o=0;i=t.regex.exec(e);){var n=i[1].trim();if(void 0===(r=c(n)))if("function"==typeof l){var u=l(e,i,s);r="string"==typeof u?u:""}else if(s&&Object.prototype.hasOwnProperty.call(s,n))r="";else{if(p){r=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),r=""}else"string"==typeof r||a.useRawValueToEscape||(r=Me(r));var g=t.safeValue(r);if(e=e.replace(i[0],g),p?(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 n,s,i,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var s=e.split(new RegExp("".concat(n,"[ ]*{"))),r="{".concat(s[1]);e=s[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=tt(tt({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(r)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var u=[];(i=(i=tt({},o)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var g=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var c=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=c.shift(),u=c,g=!0}if((s=t(a.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof s)return s;"string"!=typeof s&&(s=Me(s)),s||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),s=""),g&&(s=u.reduce((function(e,t){return r.format(e,t,o.lng,tt(tt({},o),{},{interpolationkey:n[1].trim()}))}),s.trim())),e=e.replace(n[0],s),this.regexp.lastIndex=0}return e}}]),e}();function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?st(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rt(e){var t={};return function(n,s,i){var r=s+JSON.stringify(i),o=t[r];return o||(o=e(s,i),t[r]=o),o(n)}}var ot=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ae(this,e),this.logger=Ie.create("formatter"),this.options=t,this.formats={number:rt((function(e,t){var n=new Intl.NumberFormat(e,it({},t));return function(e){return n.format(e)}})),currency:rt((function(e,t){var n=new Intl.NumberFormat(e,it(it({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:rt((function(e,t){var n=new Intl.DateTimeFormat(e,it({},t));return function(e){return n.format(e)}})),relativetime:rt((function(e,t){var n=new Intl.RelativeTimeFormat(e,it({},t));return function(e){return n.format(e,t.range||"day")}})),list:rt((function(e,t){var n=new Intl.ListFormat(e,it({},t));return function(e){return n.format(e)}}))},this.init(t)}return ce(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()]=rt(t)}},{key:"format",value:function(e,t,n){var s=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(),n={};if(e.indexOf("(")>-1){var s=e.split("(");t=s[0].toLowerCase().trim();var i=s[1].substring(0,s[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=Ee(e.split(":")),s=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=i),"false"===i&&(n[s.trim()]=!1),"true"===i&&(n[s.trim()]=!0),isNaN(i)||(n[s.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),o=r.formatName,a=r.formatOptions;if(s.formats[o]){var u=e;try{var g=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},c=g.locale||g.lng||i.locale||i.lng||n;u=s.formats[o](e,c,it(it(it({},a),i),g))}catch(e){s.logger.warn(e)}return u}return s.logger.warn("there was no format function for ".concat(o)),e}),e)}}]),e}();function at(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?at(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):at(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gt(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 n,s=fe(e);if(t){var i=fe(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return de(this,n)}}var ct=function(e){he(n,be);var t=gt(n);function n(e,s,i){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ae(this,n),r=t.call(this),je&&be.call(le(r)),r.backend=e,r.store=s,r.services=i,r.languageUtils=i.languageUtils,r.options=o,r.logger=Ie.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 ce(n,[{key:"queueLoad",value:function(e,t,n,s){var i=this,r={},o={},a={},u={};return e.forEach((function(e){var s=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.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,s=!1,void 0===o[a]&&(o[a]=!0),void 0===r[a]&&(r[a]=!0),void 0===u[t]&&(u[t]=!0)))})),s||(a[e]=!0)})),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,n){var s=e.split("|"),i=s[0],r=s[1];t&&this.emit("failedLoading",i,r,t),n&&this.store.addResourceBundle(i,r,n),this.state[e]=t?-1:2;var o={};this.queue.forEach((function(n){var s,a,u,g,c,l;s=n.loaded,a=r,g=_e(s,[i],Object),c=g.obj,l=g.k,c[l]=c[l]||[],u&&(c[l]=c[l].concat(a)),u||c[l].push(a),function(e,t){void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){o[e]||(o[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===o[e][t]&&(o[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var s=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:n,tried:i,wait:r,callback:o});else{this.readingCalls++;var a=function(a,u){if(s.readingCalls--,s.waitingReads.length>0){var g=s.waitingReads.shift();s.read(g.lng,g.ns,g.fcName,g.tried,g.wait,g.callback)}a&&u&&i<s.maxRetries?setTimeout((function(){s.read.call(s,e,t,n,i+1,2*r,o)}),r):o(a,u)},u=this.backend[n].bind(this.backend);if(2!==u.length)return u(e,t,a);try{var g=u(e,t);g&&"function"==typeof g.then?g.then((function(e){return a(null,e)})).catch(a):a(null,g)}catch(e){a(e)}}}},{key:"prepareLoading",value:function(e,t){var n=this,s=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,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(function(s,o){s&&t.logger.warn("".concat(n,"loading namespace ").concat(r," for language ").concat(i," failed"),s),!s&&o&&t.logger.log("".concat(n,"loaded namespace ").concat(r," for language ").concat(i),o),t.loaded(e,s,o)}))}},{key:"saveMissing",value:function(e,t,n,s,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(n,'" 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!=n&&""!==n){if(this.backend&&this.backend.create){var a=ut(ut({},r),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var g;(g=5===u.length?u(e,t,n,s,a):u(e,t,n,s))&&"function"==typeof g.then?g.then((function(e){return o(null,e)})).catch(o):o(null,g)}catch(e){o(e)}else u(e,t,n,s,o,a)}e&&e[0]&&this.store.addResource(e[0],t,n,s)}}}]),n}();function lt(){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"===oe(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===oe(e[2])||"object"===oe(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,s){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function pt(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 ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function dt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ht(Object(n),!0).forEach((function(t){me(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ht(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ft(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 n,s=fe(e);if(t){var i=fe(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return de(this,n)}}function mt(){}var vt=function(e){he(n,be);var t=ft(n);function n(){var e,s,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(ae(this,n),e=t.call(this),je&&be.call(le(e)),e.options=pt(i),e.services={},e.logger=Ie,e.modules={external:[]},s=le(e),Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach((function(e){"function"==typeof s[e]&&(s[e]=s[e].bind(s))})),r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),de(e,le(e));setTimeout((function(){e.init(i,r)}),0)}return e}return ce(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=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 s=lt();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=dt(dt(dt({},s),this.options),pt(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=dt(dt({},s.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?Ie.init(i(this.modules.logger),this.options):Ie.init(null,this.options),this.modules.formatter?r=this.modules.formatter:"undefined"!=typeof Intl&&(r=ot);var o=new ze(this.options);this.store=new $e(this.options.resources,this.options);var a=this.services;a.logger=Ie,a.resourceStore=this.store,a.languageUtils=o,a.pluralResolver=new Qe(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!r||this.options.interpolation.format&&this.options.interpolation.format!==s.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 nt(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new ct(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];e.emit.apply(e,[t].concat(s))})),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 Ke(this.services,this.options),this.translator.on("*",(function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];e.emit.apply(e,[t].concat(s))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=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 n;return(n=e.store)[t].apply(n,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var g=Oe(),c=function(){var t=function(t,s){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),g.resolve(s),n(t,s)};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?c():setTimeout(c,0),g}},{key:"loadResources",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mt,s="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(s&&"cimode"===s.toLowerCase())return n();var i=[],r=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(s)r(s);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),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var s=Oe();return e||(e=this.languages),t||(t=this.options.ns),n||(n=mt),this.services.backendConnector.reload(e,t,(function(e){s.resolve(),n(e)})),s}},{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&&Ve.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 n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var s=Oe();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},r=function(r){e||r||!n.services.languageDetector||(r=[]);var o="string"==typeof r?r:n.services.languageUtils.getBestMatchFromCodes(r);o&&(n.language||i(o),n.translator.language||n.translator.changeLanguage(o),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(o)),n.loadResources(o,(function(e){!function(e,r){r?(i(r),n.translator.changeLanguage(r),n.isLanguageChangingTo=void 0,n.emit("languageChanged",r),n.logger.log("languageChanged",r)):n.isLanguageChangingTo=void 0,s.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,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()),s}},{key:"getFixedT",value:function(e,t,n){var s=this,i=function e(t,i){var r;if("object"!==oe(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=s.options.overloadTranslationOptionHandler([t,i].concat(a))}else r=dt({},i);r.lng=r.lng||e.lng,r.lngs=r.lngs||e.lngs,r.ns=r.ns||e.ns,r.keyPrefix=r.keyPrefix||n||e.keyPrefix;var g,c=s.options.keySeparator||".";return g=r.keyPrefix&&Array.isArray(t)?t.map((function(e){return"".concat(r.keyPrefix).concat(c).concat(e)})):r.keyPrefix?"".concat(r.keyPrefix).concat(c).concat(t):t,s.t(g,r)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,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,n=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 s=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;var o=function(e,n){var s=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===s||2===s};if(n.precheck){var a=n.precheck(this,o);if(void 0!==a)return a}return!!this.hasResourceBundle(s,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(s,e)||i&&!o(r,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,s=Oe();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=Oe();"string"==typeof e&&(e=[e]);var s=this.options.preload||[],i=e.filter((function(e){return s.indexOf(e)<0}));return i.length?(this.options.preload=s.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(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 ze(lt());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]:{},s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mt,i=dt(dt(dt({},this.options),t),{isClone:!0}),r=new n(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=dt({},this.services),r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r.translator=new Ke(r.services,r.options),r.translator.on("*",(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];r.emit.apply(r,[e].concat(n))})),r.init(i,s),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}}}]),n}();me(vt,"createInstance",(function(){return new vt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var Et=vt.createInstance();Et.createInstance=vt.createInstance,Et.createInstance,Et.dir,Et.init,Et.loadResources,Et.reloadResources,Et.use,Et.changeLanguage,Et.getFixedT,Et.t,Et.exists,Et.setDefaultNamespace,Et.hasLoadedNamespace,Et.loadNamespaces,Et.loadLanguages;class yt extends Y{constructor(){super(),this.languages=null}static getInstance(){return yt.instance||(yt.instance=new yt),yt.instance}provideLanguages(e){"wechat"!==this.getEngine().TUIGlobal.getPlatform()&&(this.languages=e,console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){"wechat"!==this.getEngine().TUIGlobal.getPlatform()&&(this.languages?Et.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."))}t(e){if(!this.languages){let t=e;return!T(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}return Et.t(e)}}class St extends Y{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return St.instance||(St.instance=new St),St.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)),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)}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:n,isSyncCompleted:s}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${n.length} isSyncCompleted:${s}`),n.length>0){this.onConversationListUpdated(n);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return i(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,n=this.getEngine();if(!e)return n.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(a.CONV,"currentConversationID",""),n.TUIStore.update(a.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(n.TYPES.CONV_C2C)&&!e.startsWith(n.TYPES.CONV_GROUP))return console.warn(`${t} conversationID is invalid, conversationID:${e}`),Promise.reject({code:p.INVALID_CONV_ID,message:d.INVALID_CONV_ID});const s=n.TUIStore.getData(a.CONV,"currentConversationID");if(s&&s===e)return this.setMessageRead(s),console.warn(`${t} please check conversationID, conversationID:${e}`),Promise.resolve({code:p.CONV_ID_SAME,message:d.CONV_ID_SAME});const i=yield this.getConversationModel(e);return T(i)?(console.warn(`${t} target conversation is not exist, conversationID:${e}`),Promise.reject({code:p.CONV_NOT_EXIST,message:d.CONV_NOT_EXIST})):(s&&this.setMessageRead(s),e&&this.setMessageRead(e),n.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(a.CONV,"currentConversationID",e),n.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(T(t))try{const n=yield this.getConversationProfile(e);n.data&&n.data.conversation&&(t=new Z(n.data.conversation))}catch(e){t=void 0}return t}))}findConversation(e){let t;const n=this.getEngine().TUIStore.getData(a.CONV,"conversationList");for(let s=0;s<n.length;s++)if(n[s].conversationID===e){t=n[s];break}return t}updateCurrentConversation(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"currentConversationID"),n=this.findConversation(t);n&&e.TUIStore.update(a.CONV,"currentConversation",n)}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 n=this.getEngine().TUIStore.getData(a.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${n}`),e===n&&(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 Tt{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){this.getEngine().eventCenter.addEvent(this.getEngine().EVENT.PROFILE_UPDATED,this.onProfileUpdated.bind(this))}onProfileUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(a.USER,"userProfile");e.forEach((e=>{e.userID===n.userID&&t.TUIStore.update(a.USER,"userProfile",e)}))}getUserProfile(e){const t=this.getEngine();return T(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)}getBlacklist(){return this.getEngine().chat.getBlacklist()}addToBlacklist(e){return this.getEngine().chat.addToBlacklist(e)}removeFromBlacklist(e){return this.getEngine().chat.removeFromBlacklist(e)}}function It(e,t,n=!0){!function(e,t){R?G.setStorageSync(e,t):Mt()&&localStorage.setItem(e,JSON.stringify(t))}(n?Ot(e):e,t)}function bt(e,t=!0){try{return function(e){if(R)return G.getStorageSync(e);if(Mt()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}return}(t?Ot(e):e)}catch(e){return void console.warn("Storage.getStorageItem error:",e)}}function Ot(e){return`chat_engine_${e}`}function Mt(){return navigator&&navigator.cookieEnabled&&localStorage}class _t{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=bt("displayOnlineStatus")||!1;e.TUIStore.update(a.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){this.getEngine().TUIStore.watch(a.CONV,{conversationList:e=>{this.startToSubscribe(e)}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(a.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:n=!1}=e;if(t.TUIStore.update(a.USER,"displayOnlineStatus",n),It("displayOnlineStatus",n),!0===n){const e=t.TUIStore.getData(a.CONV,"conversationList");this.startToSubscribe(e)}else this.unsubscribeUserStatus()}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:n}=e.data;return n.length>0&&t.TUIStore.update(a.USER,"userStatusList",n),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;if(0!==(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length))return this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const{userIDList:t=[]}=e||{},n=this.getEngine();return n.chat.unsubscribeUserStatus({userIDList:t}).then((e=>{const{failureUserList:s}=e.data,i=[];return t.forEach((e=>{s.includes(e)||i.push({userID:e,statusType:u.UNSUB_USER})})),n.TUIStore.update(a.USER,"userStatusList",i),e})).catch((e=>Promise.reject(e)))}startToSubscribe(e){const t=this.getEngine(),n=t.TUIStore.getData(a.USER,"userStatusList"),s=[];if(e.forEach((e=>{if(e.type===t.TYPES.CONV_C2C){const i=e.conversationID.replace(t.TYPES.CONV_C2C,"");n.has(i)||s.push(i)}})),0===s.length)return;!0===t.TUIStore.getData(a.USER,"displayOnlineStatus")&&t.chat.isReady()&&(this.subscribeUserStatus({userIDList:s}),this.getUserStatus({userIDList:s}))}}class Ct extends Y{constructor(){super(),this.userProfileHandler=new Tt(this),this.userStatusHandler=new _t(this)}static getInstance(){return Ct.instance||(Ct.instance=new Ct),Ct.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=bt("displayMessageReadReceipt")||!1;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),It("displayMessageReadReceipt",e)}getUserProfile(e){return this.userProfileHandler.getUserProfile(e)}updateMyProfile(e){return this.userProfileHandler.updateMyProfile(e)}getBlacklist(){return this.userProfileHandler.getBlacklist()}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 Dt{constructor(e){this.TUIChatService=e}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=`${z}${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=`${J}pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`${W}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 n=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||n||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`[${this.t("message.custom.自定义消息")}]`,businessID:n?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,n,s,i,r,o;const a=this.getEngine(),u={text:""};let g=(null==e?void 0:e.nick)||(null===(n=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===n?void 0:n.join(","));switch((null===(i=null===(s=null==e?void 0:e.payload)||void 0===s?void 0:s.memberList)||void 0===i?void 0:i.length)>0&&(g="",null===(o=null===(r=null==e?void 0:e.payload)||void 0===r?void 0:r.memberList)||void 0===o||o.map((e=>{g+=`${(null==e?void 0:e.nick)||(null==e?void 0:e.userID)},`})),g=null==g?void 0:g.slice(0,-1)),e.payload.operationType){case a.TYPES.GRP_TIP_MBR_JOIN:u.text=`${g} ${this.t("message.tip.加入群组")}`;break;case a.TYPES.GRP_TIP_MBR_QUIT:u.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.退出群组")}`;break;case a.TYPES.GRP_TIP_MBR_KICKED_OUT:u.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.被")}${this.t("message.tip.踢出群组")}`;break;case a.TYPES.GRP_TIP_MBR_SET_ADMIN:u.text=`${this.t("message.tip.群成员")}:${g} ${this.t("message.tip.成为管理员")}`;break;case a.TYPES.GRP_TIP_MBR_CANCELED_ADMIN:u.text=`${this.t("message.tip.群成员")}:${g} ${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.群成员")}:${g} ${this.t("message.tip.被禁言")}`:u.text=`${this.t("message.tip.群成员")}:${g} ${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,n={text:""};switch(e.payload.operationType){case 1:n.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${t}`;break;case 2:n.text=`${this.t("message.tip.成功加入群组")}:${t}`;break;case 3:n.text=`${this.t("message.tip.申请加入群组")}:${t} ${this.t("message.tip.被拒绝")}`;break;case 4:n.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}:${t}`;break;case 5:n.text=`${this.t("message.tip.群")}:${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:n.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}:${t}`;break;case 7:case 12:n.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${t}`;break;case 8:n.text=`${this.t("message.tip.你退出群组")}:${t}`;break;case 9:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}:${t} ${this.t("message.tip.的管理员")}`;break;case 10:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}:${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:n.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}:${t}`;break;case 14:n.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}:${t}`;break;case 255:n.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:n.text="未解析的群系统通知"}return n}handleCallKitSignaling(e){var t;let n={},s={};try{n=O(e.payload.data)}catch(e){}if(1!==n.businessID)return"";try{s=O(n.data)}catch(e){}let i="";null===(t=null==n?void 0:n.inviteeList)||void 0===t||t.forEach(((e,t)=>{var s;t<(null===(s=null==n?void 0:n.inviteeList)||void 0===s?void 0:s.length)-1?i+=`"${e}"、`:i+=`"${e}" `}));const r=`"${null==n?void 0:n.inviter}" `;switch(n.actionType){case 1:return s.call_end>0&&!n.groupID?`${this.t("message.custom.通话时长")}:${function(e){const t=e;let n,s,i,r="";return t>=3600?(n=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),s=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&&(s=parseInt(""+i/60,10)<10?`0${parseInt(""+i/60,10)}`:parseInt(""+i/60,10),i=i%60<10?"0"+i%60:i%60),r=`${n}:${s}:${i}`):t>=60&&t<3600?(s=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:${s}:${i}`):t<60&&(i=t<10?`0${t}`:t,r=`00:00:${i}`),r}(s.call_end)}`:n.groupID&&n.timeout>0?`${r}${this.t("message.custom.发起通话")}`:n.groupID?`${this.t("message.custom.结束群聊")}`:s.data&&"switchToAudio"===s.data.cmd?`${this.t("message.custom.切换语音通话")}`:s.data&&"switchToVideo"===s.data.cmd?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`;case 2:return`${n.groupID?r:""}${this.t("message.custom.取消通话")}`;case 3:return s.data&&"switchToAudio"===s.data.cmd?`${this.t("message.custom.切换语音通话")}`:s.data&&"switchToVideo"===s.data.cmd?`${this.t("message.custom.切换视频通话")}`:`${n.groupID?i:""}${this.t("message.custom.已接听")}`;case 4:return`${n.groupID?i:""}${this.t("message.custom.拒绝通话")}`;case 5:return s.data&&"switchToAudio"===s.data.cmd?`${this.t("message.custom.切换语音通话")}`:s.data&&"switchToVideo"===s.data.cmd?`${this.t("message.custom.切换视频通话")}`:`${n.groupID?i:""}${this.t("message.custom.无应答")}`;default:return""}}handleCreateGroupCustomMessage(e){let t;try{const n=O(e.payload.data);"group_create"===n.businessID&&(t=`${n.opUser} ${n.content}`)}catch(e){}return t}decodeText(e){const t=[];let n=e.text,s=-1,i=-1;for(;""!==n;)switch(s=n.indexOf("["),i=n.indexOf("]"),s){case 0:if(-1===i)t.push({name:"text",text:n}),n="";else{const e=n.slice(0,i+1);X[e]?(t.push({name:"img",src:q+X[e]}),n=n.substring(i+1)):(t.push({name:"text",text:"["}),n=n.slice(1))}break;case-1:t.push({name:"text",text:n}),n="";break;default:t.push({name:"text",text:n.slice(0,s)}),n=n.substring(s)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:n}=e,{newGroupProfile:s,memberList:i,operatorID:r}=n;let o="";const a=t||r,u=Object.keys(s)[0];switch(u){case"muteAllMembers":o=s[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.修改群名为")} ${s[u]}`;break;case"notification":o=`${a} ${this.t("message.tip.发布新公告")}`}return o}}class Pt{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(),n=t.TUIStore.getData(a.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const s=O(e.payload.data);if(s.businessID===g.BUSINESS_ID){const{typingStatus:e,userAction:i}=s;if(e===g.STATUS_START||i===g.ACTION_START_ID)return n?(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!==g.STATUS_END&&i!==g.ACTION_END_ID||this.clearTypingStatus()}}}filterTypingMessage(e=[]){return 0===e.length?[]:(this.handleLastMessage(e[e.length-1]),e.filter((e=>{if(e.type===this.getEngine().TYPES.MSG_CUSTOM){return O(e.payload.data).businessID!==g.BUSINESS_ID}return!0})))}createTypingMessage(e=g.STATUS_END,t=""){const{BUSINESS_ID:n,STATUS_START:s,VERSION:i,ACTION_START_ID:r,ACTION_END_ID:o,ACTION_START:a,ACTION_END:u,NEED_TYPING:c}=g;return{to:t,conversationType:this.getEngine().TYPES.CONV_C2C,payload:{data:JSON.stringify({businessID:n,typingStatus:e,version:i,userAction:e===s?r:o,actionParam:e===s?a:u}),description:"",extension:""},cloudCustomData:JSON.stringify({messageFeature:{needTyping:c,version:i}})}}sendTyping(e=!1,t=""){if(e){this.typingTo=t;const e=this.createTypingMessage(g.STATUS_START,t);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}else this.sendTypingEnd()}sendTypingEnd(){if(this.typingTo){const e=this.createTypingMessage(g.STATUS_END,this.typingTo);this.getEngine().TUIChat.sendCustomMessage(e,{onlineUserOnly:!0})}this.typingTo=""}}class Rt{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(),n=t.TUIStore.getData(a.CONV,"currentConversationID"),s=[];e.forEach((e=>{const{messageID:i}=e,r=t.chat.findMessage(i);r&&n===r.conversationID&&s.push(r)})),s.length>0&&t.TUIChat.updateMessageList(s,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const n=e.getMessage();t.push(n)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),n=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(n)}getMessageReadReceiptList(e){const t=this.getEngine();return!t.TUIStore.getData(a.USER,"displayMessageReadReceipt")||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP?Promise.resolve(e):t.chat.getMessageReadReceiptList(e).then((e=>e.data.messageList)).catch((()=>Promise.resolve(e)))}}const Ut=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 n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1};class xt extends Y{constructor(){super(),this.messageHandler=new Dt(this),this.typingHandler=new Pt(this),this.readReceiptHandler=new Rt(this)}static getInstance(){return xt.instance||(xt.instance=new xt),xt.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)),this.onCurrentConversationIDUpdated(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"push")}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{currentConversationID:t=>{e.TUIStore.reset(a.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),Ut(t)||this.getMessageList()}})}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const n=this.getEngine().chat.sendMessage(e,t);return this.getResponse(n)}getResponse(e,t=!0,n=!0){return e.then((e=>{const n=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(n,"edit"),e})).catch((e=>{var t;return n&&(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=""){const n=this.getStoreData(a.CONV,"currentConversationID"),s=e.filter((e=>e.conversationID===n));if(!t||0===s.length)return;const i=this.getStoreData(a.CHAT,"messageList");let r=[];switch(t){case"edit":for(const e of i){const t=s.find((t=>t.ID===e.ID));r.push(t||e)}break;case"resend":r=i.filter((e=>e.ID!==s[0].ID)).concat(s);break;case"send":r=i.concat(this.typingHandler.filterTypingMessage(s));break;case"push":r=i.concat(this.typingHandler.filterTypingMessage(s)),this.getEngine().chat.setMessageRead({conversationID:n});break;case"unshift":r=s.filter((e=>0===i.length||!i.find((t=>t.ID===e.ID)))),r.push(...i)}this.getEngine().TUIStore.update(a.CHAT,"messageList",r)}enterTypingState(){this.sendTyping(!0)}leaveTypingState(){this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),n=this.getStoreData(a.CONV,"currentConversationID");if(!n.startsWith(t.TYPES.CONV_C2C))return;const s=n.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,s)}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 n=this.getEngine(),s={abstract:"",type:0};switch(e.type){case n.TYPES.MSG_TEXT:s.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,s.type=1;break;case n.TYPES.MSG_CUSTOM:s.abstract=this.t("[自定义消息]"),s.type=2;break;case n.TYPES.MSG_IMAGE:s.abstract=this.t("[图片]"),s.type=3;break;case n.TYPES.MSG_AUDIO:s.abstract=this.t("[语音]"),s.type=4;break;case n.TYPES.MSG_VIDEO:s.abstract=this.t("[视频]"),s.type=5;break;case n.TYPES.MSG_FILE:s.abstract=this.t("[文件]"),s.type=6;break;case n.TYPES.MSG_FACE:s.abstract=this.t("[表情]"),s.type=7}return s}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:n,type:s}=this.getMessageAbstractAndType(e),i={messageAbstract:n,messageSender:e.nick||e.from,messageID:e.ID},r=Object.assign(Object.assign({},i),{messageType:s,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=O(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(r.messageRootID=t.messageReply.messageRootID)}return{messageReply:r,messageReplyRoot:i}}getMessageInfo(e,t,n){const{messageReply:s,messageReplyRoot:i}=this.genMessageReply(t,n),r=e.cloudCustomData?O(e.cloudCustomData):{};let o;if(r.messageReply?r.messageReply=Object.assign(Object.assign({},s),r.messageReply):r.messageReply=s,"reply"===n){const{messageRootID:e}=s;o=this.getEngine().chat.findMessage(e);const t=o.cloudCustomData?O(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 n=this.getEngine(),{message:s,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};s&&(r=this.getMessageInfo(e,s,i));const o=n.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),n.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const n=this.getEngine(),{message:s,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};s&&(r=this.getMessageInfo(e,s,i));const o=n.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),n.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const n=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendAudioMessage(e,t){const n=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendVideoMessage(e,t){const n=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendCustomMessage(e,t){const n=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFaceMessage(e,t){const n=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFileMessage(e,t){const n=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendLocationMessage(e,t){const n=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendMergerMessage(e,t){const n=this.getEngine().chat.createMergerMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}onProgress(e,t){const n=this.getEngine().TUIStore.getMessageModel(e);if(n){const e=t-n.progress;n.progress=t,(e>=.1||1===t)&&this.updateMessageList([n],"edit")}}setAbstractList(e){const t=this.getEngine(),n=e.nick||e.from;let s="";switch(e.type){case t.TYPES.MSG_TEXT:return s=e.payload.text||"",s.length>20&&(s=s.slice(0,20)),`${n}: ${s}`;case t.TYPES.MSG_MERGER:return`${n}: ${this.t("[聊天记录]")}`;case t.TYPES.MSG_IMAGE:return`${n}: ${this.t("[图片]")}`;case t.TYPES.MSG_AUDIO:return`${n}: ${this.t("[音频]")}`;case t.TYPES.MSG_VIDEO:return`${n}: ${this.t("[视频]")}`;case t.TYPES.MSG_CUSTOM:return`${n}: ${this.t("[自定义消息]")}`;case t.TYPES.MSG_FILE:return`${n}: ${this.t("[文件]")}`;case t.TYPES.MSG_FACE:return`${n}: ${this.t("[动画表情]")}`}}genMergerForwardPayload(e){const{conversationType:t,nick:n,from:s,to:i}=e[0],r=[];return e.forEach((e=>{r.push(this.setAbstractList(e))})),{messageList:e,title:"GROUP"===t?"群聊的聊天记录":`${n||s} 和 ${i} 的聊天记录`,abstractList:r,compatibleText:"请升级IMSDK到v2.10.1或更高版本查看此消息"}}sendMergerForwardMessage(e,t,n){const s=[];for(let i=0;i<e.length;i++){const{conversationID:r,type:o}=e[i],a={to:r.replace(`${o}`,""),conversationType:o,payload:this.genMergerForwardPayload(t)},u=this.getEngine().chat.createMergerMessage(a);s.push(this.sendMessage(u,n))}return Promise.all(s)}getOriginMessageList(e){return e.map((e=>e instanceof ee?e.getMessage():e))}sendForwardMessage(e,t,n){t=this.getOriginMessageList(t);const i=n||{},{needMerge:r=!1}=i,o=s(i,["needMerge"]);if(r)return this.sendMergerForwardMessage(e,t,o);const a=[];for(let n=0;n<e.length;n++){const{conversationID:s,type:i}=e[n],r={to:s.replace(`${i}`,""),conversationType:i};for(let e=0;e<t.length;e++){Reflect.set(r,"payload",t[e]);const n=this.getEngine().chat.createForwardMessage(r);a.push(this.sendMessage(n,o))}}return Promise.all(a)}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:n={}}=e.code;throw t===l.MSG_MODIFY_CONFLICT?console.warn(`${h.MSG_MODIFY_CONFLICT} data.message: ${null==n?void 0:n.message}`):t===l.MSG_MODIFY_DISABLED_IN_AVCHATROOM?console.warn(h.MSG_MODIFY_DISABLED_IN_AVCHATROOM):t===l.MODIFY_MESSAGE_NOT_EXIST&&console.warn(h.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:p.GET_MSG_LIST_ERROR,message:d.GET_MSG_LIST_ERROR});if(this.getStoreData(a.CHAT,"isCompleted"))return Promise.resolve({data:{messageList:[],nextReqMessageID:"",isCompleted:!0}});return t.chat.getMessageList(e).then((e=>{const{messageList:n,nextReqMessageID:s,isCompleted:i}=e.data;return this.readReceiptHandler.getMessageReadReceiptList(n).then((n=>(this.updateMessageList(n,"unshift"),t.TUIStore.update(a.CHAT,"nextReqMessageID",s),t.TUIStore.update(a.CHAT,"isCompleted",i),e.data.messageList=n,e)))})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e)}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e.getMessage())}translateText(e){return this.getEngine().chat.translateText(e)}}class Gt extends Y{constructor(){super()}static getInstance(){return Gt.instance||(Gt.instance=new Gt),Gt.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 n=t.TUIStore.getData(a.GRP,"currentGroupID");e.forEach((e=>{e.groupID===n&&t.TUIStore.update(a.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupID");let s=t.TUIStore.getData(a.GRP,"groupList");const{groupID:i,groupAttributes:r}=e;n===i&&t.TUIStore.update(a.GRP,"currentGroupAttributes",r),s=s.map((e=>(e.groupID===i&&(e.groupAttributes=r),e))),t.TUIStore.update(a.GRP,"groupList",s)}onGroupCounterUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupID"),s=t.TUIStore.getData(a.GRP,"currentGroupCounters")||{};let i=t.TUIStore.getData(a.GRP,"groupList");const{groupID:r,key:o,value:u}=e;n===r&&(s[o]=u,t.TUIStore.update(a.GRP,"currentGroupCounters",s)),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(),n=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:n}=e,{operationType:s,userIDList:i}=n,r=t.TUIStore.getData(a.GRP,"currentGroupID");switch(s){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&&n.push(e)})),n.length>0&&t.TUIStore.update(a.GRP,"groupSystemNoticeList",n)}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 n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:s}=n.data;this.updateMemberList(s)}}))}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(),n=t.TUIStore.getData(a.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(n===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.getGroupProfile({groupID:e}),yield this.getGroupMemberList({groupID:e});const n=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:s}=n.data;t.TUIStore.update(a.GRP,"currentGroupAttributes",s);const i=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:r}=i.data;t.TUIStore.update(a.GRP,"currentGroupCounters",r)}catch(e){Promise.reject(e)}const s=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(s)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{group:e}=n.data;t.TUIStore.update(a.GRP,"currentGroup",e)}return n}))))}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){return this.getEngine().chat.searchGroupByID(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(),n=[...(t.TUIStore.getData(a.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(a.GRP,"currentGroupMemberList",n)}addMemberList(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t)try{const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:s}=n.data;this.updateMemberList(s)}catch(t){const n=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(n)}}))}removeMemberList(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(a.GRP,"currentGroupMemberList",n)}getGroupMemberList(e){const t=this.getEngine();return t.chat.getGroupMemberList(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{memberList:e}=n.data;this.updateMemberList(e)}return n}))))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:s}=n.data;t.TUIStore.update(a.GRP,"currentGroup",s),this.addMemberList(e)}return n}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((n=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:s}=n.data;this.removeMemberList(e),t.TUIStore.update(a.GRP,"currentGroup",s)}return n}))}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 jt extends Y{constructor(){super()}static getInstance(){return jt.instance||(jt.instance=new jt),jt.instance}init(){}getFriendList(){return this.getEngine().chat.getFriendList()}checkFriend(e){return this.getEngine().chat.checkFriend(e)}}class Nt{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(e){if("function"!=typeof e)throw"middleware must be a function";return 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 kt(e,t,n){const s=Object.create(null);Object.keys(n).forEach((n=>{if(!t[n])return;s[n]=t[n];const i=new Nt;t[n]=function(){const r=Array.from(arguments);return i.use((function(t,s){return e.isInited?s():Promise.reject({code:p.NOT_INIT,message:`${n} | ${d.NOT_INIT}`})})).use((function(e,i){return s[n].apply(t,e)})),i.run(r)}}))}console.log("TUIChatEngine.VERSION:0.0.6");const Lt=C.getInstance(),At=V.getInstance(),wt=re.getInstance(),$t=yt.getInstance(),Vt=St.getInstance(),Ft=Ct.getInstance(),Yt=xt.getInstance(),Ht=Gt.getInstance(),Bt=jt.getInstance();Lt.mount(o.TUIGlobal,At),Lt.mount(o.TUIStore,wt),Lt.mount(o.TUITranslate,$t),Lt.mount(o.TUIConversation,Vt),Lt.mount(o.TUIUser,Ft),Lt.mount(o.TUIChat,Yt),Lt.mount(o.TUIGroup,Ht),Lt.mount(o.TUIFriend,Bt),kt(Lt,Lt,f),kt(Lt,Vt,m),kt(Lt,Yt,v),kt(Lt,Ht,E),kt(Lt,Ft,y),kt(Lt,Bt,S);export{a as StoreName,Yt as TUIChatService,Vt as TUIConversationService,Bt as TUIFriendService,At as TUIGlobal,Ht as TUIGroupService,wt as TUIStore,$t as TUITranslateService,Ft as TUIUserService,Lt as default};
|
|
1
|
+
import e from"@tencentcloud/chat";import t from"tim-upload-plugin";import n from"tim-profanity-filter-plugin";function s(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]])}return n}function i(e,t,n,s){return new(n||(n=Promise))((function(i,r){function o(e){try{u(s.next(e))}catch(e){r(e)}}function a(e){try{u(s.throw(e))}catch(e){r(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}u((s=s.apply(e,t||[])).next())}))}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 n of this.events[e].keys())n.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.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_MODIFIED,this.onMessageReadReceiptReceived,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)}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.TUIGlobal="TUIGlobal",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.CONV="conversation",e.CHAT="chat",e.GRP="group",e.USER="user",e.FRIEND="friend",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},v={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},E={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},y={switchUserStatus:1,switchMessageReadStatus:1,getUserProfile:1,updateMyProfile:1,addToBlacklist:1,removeFromBlacklist:1},T={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},I=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 O=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},D=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},_=(e,t=6,n=.5)=>{let s=t;return e.catch((e=>{if(0===s)throw e;const t=setTimeout((()=>{clearTimeout(t),s--}),1e3*n)}))};class M{constructor(){this.EVENT=e.EVENT,this.TYPES=e.TYPES,this.loginStatusPromise=new Map,this.userID="",this.isInited=!1}static getInstance(){return M.instance||(M.instance=new M),M.instance}mount(e,t){this[e]=t}login(e){const{chat:t,SDKAppID:n,userID:s}=e;return this.createChat(e),this.userID=s,this.TUIGlobal.initOfficial(n),this.eventCenter=new r(this),this.eventCenter.removeEvents(),this.initStore(),this.initService(),t&&t.isReady()?(console.log("TUIChatEngine.login ok, from TUICore."),Promise.resolve({})):(this.registerPlugin(e),this.eventCenter.addEvent(this.EVENT.SDK_READY,(()=>{this.onSDKReady()})),this.eventCenter.addEvent(this.EVENT.SDK_NOT_READY,(()=>{this.onSDKNotReady()})),this.loginChat(e))}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),console.log("TUIEngine.initStore ok.")}initService(){this.TUIChat.init(),this.TUIConversation.init(),this.TUIGroup.init(),this.TUIUser.init(),this.TUIFriend.init(),this.isInited=!0,console.log("TUIEngine.initService ok.")}createChat(t){const{chat:n}=t,i=s(t,["chat"]);S(n)?this.chat=e.create(Object.assign(Object.assign({},i),{scene:"chat-uikit-engine"})):this.chat=n}loginChat(e){const{userID:t,userSig:n}=e;return new Promise(((e,s)=>{this.chat.login({userID:t,userSig:n}).then((t=>{console.log("TUIChatEngine.loginChat ok."),t.data.repeatLogin&&this.chat.isReady()&&e(t),this.loginStatusPromise.set("login",{resolve:e,reject:s,imResponse:t})})).catch((e=>{s(e)}))}))}registerPlugin(e){const{useUploadPlugin:s=!1,useProfanityFilterPlugin:i=!1,TUIOfflinePush:r,offlinePushConfig:o}=e;!0===s&&this.chat.registerPlugin({"tim-upload-plugin":t}),!0===i&&this.chat.registerPlugin({"tim-profanity-filter-plugin":n}),"app"!==this.TUIGlobal.getPlatform()||S(r)||S(o)||this.chat.registerPlugin({"tim-offline-push-plugin":r,offlinePushConfig:o})}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")}}const C="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),P="undefined"!=typeof uni&&"undefined"==typeof window,U=C||P,R="undefined"!=typeof uni,x=("undefined"!=typeof uni||"undefined"!=typeof window)&&!U,G=C?wx:R?uni:window,j=x&&window&&window.navigator&&window.navigator.userAgent||"",N=/Android/i.test(j),A=/(?:Windows Phone)/.test(j),L=/(?:SymbianOS)/.test(j),k=/iPad/i.test(j)||/iPhone/i.test(j)||/iPod/i.test(j),w=N||A||L||k,V=x&&!w;class ${constructor(){this.global=G,this.isOfficial=!1}static getInstance(){return $.instance||($.instance=new $),$.instance}initOfficial(e){this.isOfficial=1400187352===e||1400188366===e}getPlatform(){let e="";return V?e="pc":w?e="h5":C?e="wechat":P&&!C&&(e="app"),e}}class F{constructor(){this.defaultStore={userProfile:{},displayOnlineStatus:!1,autoSubOnlineStatus:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",displayMessageReadReceipt:!1,userBlacklist:[]},this.store={userProfile:{},displayOnlineStatus:!1,autoSubOnlineStatus:!0,userStatusList:new Map,kickedOut:"",netStateChange:"",displayMessageReadReceipt:!1,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:n=0,customStatus:s=""}=e;n===u.UNSUB_USER?this.store.userStatusList.delete(t):this.store.userStatusList.set(t,{statusType:n,customStatus:s})})):this.store.userStatusList.clear()}}class Y{getEngine(){return M.getInstance()}}const H="https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png",B="https://web.sdk.qcloud.com/im/demo/TUIkit/web/img/constomer.svg",K="https://web.sdk.qcloud.com/component/TUIKit/assets/group_avatar.png",q="https://web.sdk.qcloud.com/im/assets/emoji/",z="https://web.sdk.qcloud.com/im/assets/face-elem/",J="https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&",W="https://apis.map.qq.com/ws/staticmap/v2/?",X={"[NO]":"emoji_0@2x.png","[OK]":"emoji_1@2x.png","[下雨]":"emoji_2@2x.png","[么么哒]":"emoji_3@2x.png","[乒乓]":"emoji_4@2x.png","[便便]":"emoji_5@2x.png","[信封]":"emoji_6@2x.png","[偷笑]":"emoji_7@2x.png","[傲慢]":"emoji_8@2x.png","[再见]":"emoji_9@2x.png","[冷汗]":"emoji_10@2x.png","[凋谢]":"emoji_11@2x.png","[刀]":"emoji_12@2x.png","[删除]":"emoji_13@2x.png","[勾引]":"emoji_14@2x.png","[发呆]":"emoji_15@2x.png","[发抖]":"emoji_16@2x.png","[可怜]":"emoji_17@2x.png","[可爱]":"emoji_18@2x.png","[右哼哼]":"emoji_19@2x.png","[右太极]":"emoji_20@2x.png","[右车头]":"emoji_21@2x.png","[吐]":"emoji_22@2x.png","[吓]":"emoji_23@2x.png","[咒骂]":"emoji_24@2x.png","[咖啡]":"emoji_25@2x.png","[啤酒]":"emoji_26@2x.png","[嘘]":"emoji_27@2x.png","[回头]":"emoji_28@2x.png","[困]":"emoji_29@2x.png","[坏笑]":"emoji_30@2x.png","[多云]":"emoji_31@2x.png","[大兵]":"emoji_32@2x.png","[大哭]":"emoji_33@2x.png","[太阳]":"emoji_34@2x.png","[奋斗]":"emoji_35@2x.png","[奶瓶]":"emoji_36@2x.png","[委屈]":"emoji_37@2x.png","[害羞]":"emoji_38@2x.png","[尴尬]":"emoji_39@2x.png","[左哼哼]":"emoji_40@2x.png","[左太极]":"emoji_41@2x.png","[左车头]":"emoji_42@2x.png","[差劲]":"emoji_43@2x.png","[弱]":"emoji_44@2x.png","[强]":"emoji_45@2x.png","[彩带]":"emoji_46@2x.png","[彩球]":"emoji_47@2x.png","[得意]":"emoji_48@2x.png","[微笑]":"emoji_49@2x.png","[心碎了]":"emoji_50@2x.png","[快哭了]":"emoji_51@2x.png","[怄火]":"emoji_52@2x.png","[怒]":"emoji_53@2x.png","[惊恐]":"emoji_54@2x.png","[惊讶]":"emoji_55@2x.png","[憨笑]":"emoji_56@2x.png","[手枪]":"emoji_57@2x.png","[打哈欠]":"emoji_58@2x.png","[抓狂]":"emoji_59@2x.png","[折磨]":"emoji_60@2x.png","[抠鼻]":"emoji_61@2x.png","[抱抱]":"emoji_62@2x.png","[抱拳]":"emoji_63@2x.png","[拳头]":"emoji_64@2x.png","[挥手]":"emoji_65@2x.png","[握手]":"emoji_66@2x.png","[撇嘴]":"emoji_67@2x.png","[擦汗]":"emoji_68@2x.png","[敲打]":"emoji_69@2x.png","[晕]":"emoji_70@2x.png","[月亮]":"emoji_71@2x.png","[棒棒糖]":"emoji_72@2x.png","[汽车]":"emoji_73@2x.png","[沙发]":"emoji_74@2x.png","[流汗]":"emoji_75@2x.png","[流泪]":"emoji_76@2x.png","[激动]":"emoji_77@2x.png","[灯泡]":"emoji_78@2x.png","[炸弹]":"emoji_79@2x.png","[熊猫]":"emoji_80@2x.png","[爆筋]":"emoji_81@2x.png","[爱你]":"emoji_82@2x.png","[爱心]":"emoji_83@2x.png","[爱情]":"emoji_84@2x.png","[猪头]":"emoji_85@2x.png","[猫咪]":"emoji_86@2x.png","[献吻]":"emoji_87@2x.png","[玫瑰]":"emoji_88@2x.png","[瓢虫]":"emoji_89@2x.png","[疑问]":"emoji_90@2x.png","[白眼]":"emoji_91@2x.png","[皮球]":"emoji_92@2x.png","[睡觉]":"emoji_93@2x.png","[磕头]":"emoji_94@2x.png","[示爱]":"emoji_95@2x.png","[礼品袋]":"emoji_96@2x.png","[礼物]":"emoji_97@2x.png","[篮球]":"emoji_98@2x.png","[米饭]":"emoji_99@2x.png","[糗大了]":"emoji_100@2x.png","[红双喜]":"emoji_101@2x.png","[红灯笼]":"emoji_102@2x.png","[纸巾]":"emoji_103@2x.png","[胜利]":"emoji_104@2x.png","[色]":"emoji_105@2x.png","[药]":"emoji_106@2x.png","[菜刀]":"emoji_107@2x.png","[蛋糕]":"emoji_108@2x.png","[蜡烛]":"emoji_109@2x.png","[街舞]":"emoji_110@2x.png","[衰]":"emoji_111@2x.png","[西瓜]":"emoji_112@2x.png","[调皮]":"emoji_113@2x.png","[象棋]":"emoji_114@2x.png","[跳绳]":"emoji_115@2x.png","[跳跳]":"emoji_116@2x.png","[车厢]":"emoji_117@2x.png","[转圈]":"emoji_118@2x.png","[鄙视]":"emoji_119@2x.png","[酷]":"emoji_120@2x.png","[钞票]":"emoji_121@2x.png","[钻戒]":"emoji_122@2x.png","[闪电]":"emoji_123@2x.png","[闭嘴]":"emoji_124@2x.png","[闹钟]":"emoji_125@2x.png","[阴险]":"emoji_126@2x.png","[难过]":"emoji_127@2x.png","[雨伞]":"emoji_128@2x.png","[青蛙]":"emoji_129@2x.png","[面条]":"emoji_130@2x.png","[鞭炮]":"emoji_131@2x.png","[风车]":"emoji_132@2x.png","[飞吻]":"emoji_133@2x.png","[飞机]":"emoji_134@2x.png","[饥饿]":"emoji_135@2x.png","[香蕉]":"emoji_136@2x.png","[骷髅]":"emoji_137@2x.png","[麦克风]":"emoji_138@2x.png","[麻将]":"emoji_139@2x.png","[鼓掌]":"emoji_140@2x.png","[龇牙]":"emoji_141@2x.png"};class Z extends Y{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._conversation=e}initProxy(e){Object.keys(e).forEach((t=>{I(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 n=this.conversationID.replace(e.TYPES.CONV_C2C,"");t.userIDList=[n]}else if(this.type===e.TYPES.CONV_GROUP){const n=this.conversationID.replace(e.TYPES.CONV_GROUP,"");t.groupID=n}return e.TUIConversation.muteConversation(t)}getAvatar(){var e,t,n,s,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:H;break;case o.TYPES.CONV_GROUP:a=b(null===(n=this.groupProfile)||void 0===n?void 0:n.avatar)?null===(s=this.groupProfile)||void 0===s?void 0:s.avatar:B;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:K}return a}getShowName(){var e,t,n,s;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===(n=this.groupProfile)||void 0===n?void 0:n.name)||(null===(s=this.groupProfile)||void 0===s?void 0:s.groupID)||"";break;case i.TYPES.CONV_SYSTEM:r=i.TUITranslate.t("系统通知")||""}return r}getGroupAtInfo(){const e=this.getEngine().TUITranslate.t.bind(this),t=[`[${e("TUIConversation.有人@我")}]`,`[${e("TUIConversation.@所有人")}]`,`[${e("TUIConversation.@所有人")}][${e("TUIConversation.有人@我")}]`];let n="";for(let e=0;e<this.groupAtInfoList.length;e++)this.groupAtInfoList[e].atTypeArray[0]&&this.unreadCount>0&&(n=t[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;let t="";return(null===(e=this.lastMessage)||void 0===e?void 0:e.lastTime)>0&&(t=function(e,t){const n=6e4,s=36e5,i=24*s,r=(new Date).getTime()-e;let o="";if(r<0)return o;const a=r/n,u=r/s,c=r/i,g=r/6048e5;if(g>=1&&g<=4)o=` ${parseInt(`${g}`,10)} ${t("time.周")}${t("time.前")}`;else if(c>=1&&c<=6)o=` ${parseInt(`${c}`,10)} ${t("time.天")}${t("time.前")}`;else if(u>=1&&u<=23)o=` ${parseInt(`${u}`,10)} ${t("time.小时")}${t("time.前")}`;else if(a>=1&&a<=59)o=` ${parseInt(`${a}`,10)} ${t("time.分钟")}${t("time.前")}`;else if(r>=0&&r<=n)o=`${t("time.刚刚")}`;else{const t=new Date;t.setTime(e),o=`${t.getFullYear()}-${t.getMonth()+1<10?`0${t.getMonth()+1}`:t.getMonth()+1}-${t.getDate()<10?`0${t.getDate()}`:t.getDate()}`}return o}(1e3*this.lastMessage.lastTime,this.getEngine().TUITranslate.t.bind(this))),t}getLastMessageText(){var e;const t=this.getEngine(),n=t.TUITranslate.t.bind(this),s=this.lastMessage,i=this._conversation;let r="",o="";const a=i.unreadCount>0&&i.messageRemindType===t.TYPES.MSG_REMIND_ACPT_NOT_NOTE?n(`[${i.unreadCount>99?"99+":i.unreadCount}条]`):"";if(i.type===t.TYPES.CONV_GROUP)if(s.fromAccount===t.getMyUserID())r=n("TUIConversation.我")||"";else{const e=s.fromAccount;r=t.TUIFriend.getFriendRemark([e])[e]||s.nameCard||s.nick||e}if(s.type===t.TYPES.MSG_TEXT)o=s.payload.text;else if(s.type===t.TYPES.MSG_CUSTOM){const n=O(null===(e=null==s?void 0:s.payload)||void 0===e?void 0:e.data);if(1===(null==n?void 0:n.businessID))return o=t.TUIChat.messageHandler.handleCallKitSignaling(s),o;o=s.messageForShow}else o=s.messageForShow;return s.isRevoked&&(o=n("TUIChat.撤回了一条消息")||""),i.type===t.TYPES.CONV_GROUP&&s.type===t.TYPES.MSG_GRP_TIP?o:`${a}${r?`${r}:`:""}${o}`}}class Q{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=>{const n=new Z(e);t.push(n)})),this.store.conversationList=t}}class ee extends Y{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.progress=0,this.initProperties(e)}initProperties(e){Object.keys(e).forEach((t=>{I(t)||(this[t]=e[t])}))}updateProperties(e){this._message=e,Object.keys(e).forEach((t=>{I(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.getEngine().chat.getSignalingInfo(this._message)}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})}getMessageReaction(){const e=Object.assign({},this._message.cloudCustomData?O(this._message.cloudCustomData):{});return e.messageReact?e.messageReact:void 0}addMessageReaction(e){const t=this.setMessageReaction(e);if(t)return _(this.getEngine().TUIChat.modifyMessage(t))}deleteMessageReaction(e){const t=this.setMessageReaction(e,g.REMOVE);if(t)return _(this.getEngine().TUIChat.modifyMessage(t))}setMessageReaction(e,t=g.ADD){const n=this.getEngine().getMyUserID(),s=this._message,i=Object.assign({messageReact:{}},s.cloudCustomData?O(s.cloudCustomData):{}),r=Object.assign({reacts:{},version:1},i.messageReact),o=r.reacts[e]||[],a=o.indexOf(n),u=-1===a&&t===g.REMOVE,c=a>=0&&t===g.ADD;if(!u&&!c)return-1===a?o.push(n):o.splice(a,1),r.reacts[e]=o,r.reacts=Object.keys(r.reacts).filter((e=>r.reacts[e].length>0)).reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r.reacts[t]})),{}),i.messageReact=r,s.cloudCustomData=JSON.stringify(i),s}sendForwardMessage(e){return this.getEngine().TUIChat.sendForwardMessage(e,[this._message])}}class te{constructor(){this.defaultStore={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},typingStatus:!1},this.store={messageList:[],isCompleted:!1,nextReqMessageID:"",quoteMessage:{},typingStatus:!1}}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),e.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:this.defaultStore[t]})),{}))}updateMessageList(e){const t=[];e.forEach((e=>{let n=e;e instanceof ee||(n=this.getModel(e.ID),n?n.updateProperties(e):n=new ee(e)),t.push(n)})),this.store.messageList=t}}class ne extends Y{constructor(e){super(),this.groupAttributes={},this.groupCounters={},this.initProxy(e)}initProxy(e){Object.keys(e).forEach((t=>{I(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 se{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 ne?t:new ne(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 ne?e:new ne(e)))}}class ie{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 re{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 oe{constructor(){this.storeMap={[a.USER]:new F,[a.CONV]:new Q,[a.CHAT]:new te,[a.GRP]:new se,[a.FRIEND]:new re},this.task={}}static getInstance(){return oe.instance||(oe.instance=new oe),oe.instance}watch(e,t){this.task[e]||(this.task[e]={});const n=this.task[e];Object.keys(t).forEach((s=>{const i=t[s];n[s]||(n[s]=new Map),n[s].set(i,1),this.notifyOnWatch(e,s,i)}))}unwatch(e,t){if(!this.task[e])return;const n=this.task[e];Object.keys(t).forEach((e=>{n[e].delete(t[e])}))}update(e,t,n){var s;e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ie),null===(s=this.storeMap[e])||void 0===s||s.update(t,n),this.notify(e,t)}getData(e,t){var n;return e!==a.CUSTOM||this.storeMap[e]||(this.storeMap[e]=new ie),null===(n=this.storeMap[e])||void 0===n?void 0:n.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=[],n=!1){if(e in this.storeMap){const s=this.storeMap[e];0===t.length&&(t=Object.keys(null==s?void 0:s.store)),s.reset(t),n&&t.forEach((t=>{this.notify(e,t)}))}}notifyOnWatch(e,t,n){const s=this.getData(e,t);n&&n.call(this,s)}notify(e,t){if(!this.task[e])return;const n=this.task[e];if(n[t]){const s=n[t],i=this.getData(e,t);for(const[e]of s.entries())e.call(this,i)}}}function ae(e){return ae="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},ae(e)}function ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e){var t=function(e,t){if("object"!==ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!==ae(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ae(t)?t:String(t)}function ge(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,ce(s.key),s)}}function le(e,t,n){return t&&ge(e.prototype,t),n&&ge(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function he(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e,t){return pe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pe(e,t)}function de(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&&pe(e,t)}function fe(e,t){if(t&&("object"===ae(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return he(e)}function me(e){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},me(e)}function ve(e,t,n){return(t=ce(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function ye(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 Ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ee(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 Te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function Se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ie={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)}},be=new(function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ue(this,e),this.init(t,n)}return le(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||Ie,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),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"log","",!0)}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","",!0)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"error","")}},{key:"deprecate",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}},{key:"forward",value:function(e,t,n,s){return s&&!this.debug?null:("string"==typeof e[0]&&(e[0]="".concat(n).concat(this.prefix," ").concat(e[0])),this.logger[t](e))}},{key:"create",value:function(t){return new e(this.logger,Se(Se({},{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}()),Oe=function(){function e(){ue(this,e),this.observers={}}return le(e,[{key:"on",value:function(e,t){var n=this;return e.split(" ").forEach((function(e){n.observers[e]=n.observers[e]||[],n.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,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];this.observers[e]&&[].concat(this.observers[e]).forEach((function(e){e.apply(void 0,n)}));this.observers["*"]&&[].concat(this.observers["*"]).forEach((function(t){t.apply(t,[e].concat(n))}))}}]),e}();function De(){var e,t,n=new Promise((function(n,s){e=n,t=s}));return n.resolve=e,n.reject=t,n}function _e(e){return null==e?"":""+e}function Me(e,t,n){function s(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=s(r.shift());!e[o]&&n&&(e[o]=new n),e=Object.prototype.hasOwnProperty.call(e,o)?e[o]:{}}return i()?{}:{obj:e,k:s(r.shift())}}function Ce(e,t,n){var s=Me(e,t,Object);s.obj[s.k]=n}function Pe(e,t){var n=Me(e,t),s=n.obj,i=n.k;if(s)return s[i]}function Ue(e,t,n){var s=Pe(e,n);return void 0!==s?s:Pe(t,n)}function Re(e,t,n){for(var s in t)"__proto__"!==s&&"constructor"!==s&&(s in e?"string"==typeof e[s]||e[s]instanceof String||"string"==typeof t[s]||t[s]instanceof String?n&&(e[s]=t[s]):Re(e[s],t[s],n):e[s]=t[s]);return e}function xe(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ge={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function je(e){return"string"==typeof e?e.replace(/[&<>"'\/]/g,(function(e){return Ge[e]})):e}var Ne="undefined"!=typeof window&&window.navigator&&void 0===window.navigator.userAgentData&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Ae=[" ",",","?","!",";"];function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function we(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 n,s=me(e);if(t){var i=me(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return fe(this,n)}}function Ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(e){if(e[t])return e[t];for(var s=t.split(n),i=e,r=0;r<s.length;++r){if(!i)return;if("string"==typeof i[s[r]]&&r+1<s.length)return;if(void 0===i[s[r]]){for(var o=2,a=s.slice(r,r+o).join(n),u=i[a];void 0===u&&s.length>r+o;)o++,u=i[a=s.slice(r,r+o).join(n)];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=s.slice(r+o).join(n);return c?Ve(u,c,n):void 0}i=i[s[r]]}return i}}var $e=function(e){de(n,Oe);var t=we(n);function n(e){var s,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};return ue(this,n),s=t.call(this),Ne&&Oe.call(he(s)),s.data=e||{},s.options=i,void 0===s.options.keySeparator&&(s.options.keySeparator="."),void 0===s.options.ignoreJSONStructure&&(s.options.ignoreJSONStructure=!0),s}return le(n,[{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,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,r=void 0!==s.ignoreJSONStructure?s.ignoreJSONStructure:this.options.ignoreJSONStructure,o=[e,t];n&&"string"!=typeof n&&(o=o.concat(n)),n&&"string"==typeof n&&(o=o.concat(i?n.split(i):n)),e.indexOf(".")>-1&&(o=e.split("."));var a=Pe(this.data,o);return a||!r||"string"!=typeof n?a:Ve(this.data&&this.data[e]&&this.data[e][t],n,i)}},{key:"addResource",value:function(e,t,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},r=this.options.keySeparator;void 0===r&&(r=".");var o=[e,t];n&&(o=o.concat(r?n.split(r):n)),e.indexOf(".")>-1&&(s=t,t=(o=e.split("."))[1]),this.addNamespaces(t),Ce(this.data,o,s),i.silent||this.emit("added",e,t,n,s)}},{key:"addResources",value:function(e,t,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var i in n)"string"!=typeof n[i]&&"[object Array]"!==Object.prototype.toString.apply(n[i])||this.addResource(e,t,i,n[i],{silent:!0});s.silent||this.emit("added",e,t,n)}},{key:"addResourceBundle",value:function(e,t,n,s,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},o=[e,t];e.indexOf(".")>-1&&(s=n,n=t,t=(o=e.split("."))[1]),this.addNamespaces(t);var a=Pe(this.data,o)||{};s?Re(a,n,i):a=ke(ke({},a),n),Ce(this.data,o,a),r.silent||this.emit("added",e,t,n)}},{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?ke(ke({},{}),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}}]),n}(),Fe={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,n,s,i){var r=this;return e.forEach((function(e){r.processors[e]&&(t=r.processors[e].process(t,n,s,i))})),t}};function Ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Be(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 n,s=me(e);if(t){var i=me(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return fe(this,n)}}var Ke={},qe=function(e){de(n,Oe);var t=Be(n);function n(e){var s,i,r,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ue(this,n),s=t.call(this),Ne&&Oe.call(he(s)),i=["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r=e,o=he(s),i.forEach((function(e){r[e]&&(o[e]=r[e])})),s.options=a,void 0===s.options.keySeparator&&(s.options.keySeparator="."),s.logger=be.create("translator"),s}return le(n,[{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 n=this.resolve(e,t);return n&&void 0!==n.res}},{key:"extractFromKey",value:function(e,t){var n=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===n&&(n=":");var s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,i=t.ns||this.options.defaultNS||[],r=n&&e.indexOf(n)>-1,o=!(this.options.userDefinedKeySeparator||t.keySeparator||this.options.userDefinedNsSeparator||t.nsSeparator||function(e,t,n){t=t||"",n=n||"";var s=Ae.filter((function(e){return t.indexOf(e)<0&&n.indexOf(e)<0}));if(0===s.length)return!0;var i=new RegExp("(".concat(s.map((function(e){return"?"===e?"\\?":e})).join("|"),")")),r=!i.test(e);if(!r){var o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(r=!0)}return r}(e,n,s));if(r&&!o){var a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:i};var u=e.split(n);(n!==s||n===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),e=u.join(s)}return"string"==typeof i&&(i=[i]),{key:e,namespaces:i}}},{key:"translate",value:function(e,t,s){var i=this;if("object"!==ae(t)&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),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,v=d&&d.exactUsedKey||u,E=Object.prototype.toString.apply(f),y=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,T=!this.i18nFormat||this.i18nFormat.handleAsObject;if(T&&f&&("string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f)&&["[object Number]","[object Function]","[object RegExp]"].indexOf(E)<0&&("string"!=typeof y||"[object Array]"!==E)){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,He(He({},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 I="[object Array]"===E,b=I?[]:{},O=I?v:m;for(var D in f)if(Object.prototype.hasOwnProperty.call(f,D)){var _="".concat(O).concat(o).concat(D);b[D]=this.translate(_,He(He({},t),{joinArrays:!1,ns:c})),b[D]===_&&(b[D]=f[D])}f=b}}else if(T&&"string"==typeof y&&"[object Array]"===E)(f=f.join(y))&&(f=this.extendTranslation(f,e,t,s));else{var M=!1,C=!1,P=void 0!==t.count&&"string"!=typeof t.count,U=n.hasDefaultValue(t),R=P?this.pluralResolver.getSuffix(l,t.count,t):"",x=t["defaultValue".concat(R)]||t.defaultValue;!this.isValidLookup(f)&&U&&(M=!0,f=x),this.isValidLookup(f)||(C=!0,f=u);var G=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:f,j=U&&x!==f&&this.options.updateMissing;if(C||M||j){if(this.logger.log(j?"updateKey":"missingKey",l,g,u,j?x:f),o){var N=this.resolve(u,He(He({},t),{},{keySeparator:!1}));N&&N.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 A=[],L=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&L&&L[0])for(var k=0;k<L.length;k++)A.push(L[k]);else"all"===this.options.saveMissingTo?A=this.languageUtils.toResolveHierarchy(t.lng||this.language):A.push(t.lng||this.language);var w=function(e,n,s){var r=U&&s!==f?s:G;i.options.missingKeyHandler?i.options.missingKeyHandler(e,g,n,r,j,t):i.backendConnector&&i.backendConnector.saveMissing&&i.backendConnector.saveMissing(e,g,n,r,j,t),i.emit("missingKey",e,g,n,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&P?A.forEach((function(e){i.pluralResolver.getSuffixes(e,t).forEach((function(n){w([e],u+n,t["defaultValue".concat(n)]||x)}))})):w(A,u,x))}f=this.extendTranslation(f,e,t,d,s),C&&f===u&&this.options.appendNamespaceToMissingKey&&(f="".concat(g,":").concat(u)),(C||M)&&this.options.parseMissingKeyHandler&&(f="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(g,":").concat(u):u,M?f:void 0):this.options.parseMissingKeyHandler(f))}return r?(d.res=f,d):f}},{key:"extendTranslation",value:function(e,t,n,s,i){var r=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,He(He({},this.options.interpolation.defaultVariables),n),s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init(He(He({},n),{interpolation:He(He({},this.options.interpolation),n.interpolation)}));var o,a="string"==typeof e&&(n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(a){var u=e.match(this.interpolator.nestingRegexp);o=u&&u.length}var c=n.replace&&"string"!=typeof n.replace?n.replace:n;if(this.options.interpolation.defaultVariables&&(c=He(He({},this.options.interpolation.defaultVariables),c)),e=this.interpolator.interpolate(e,c,n.lng||this.language,n),a){var g=e.match(this.interpolator.nestingRegexp);o<(g&&g.length)&&(n.nest=!1)}!1!==n.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,s=new Array(e),o=0;o<e;o++)s[o]=arguments[o];return i&&i[0]===s[0]&&!n.context?(r.logger.warn("It seems you are nesting recursively key: ".concat(s[0]," in key: ").concat(t[0])),null):r.translate.apply(r,s.concat([t]))}),n)),n.interpolation&&this.interpolator.reset()}var l=n.postProcess||this.options.postProcess,h="string"==typeof l?[l]:l;return null!=e&&h&&h.length&&!1!==n.applyPostProcessor&&(e=Fe.handle(h,e,t,this.options&&this.options.postProcessPassResolved?He({i18nResolved:s},n):n,this)),e}},{key:"resolve",value:function(e){var t,n,s,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;n=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,!Ke["".concat(d[0],"-").concat(e)]&&o.utils&&o.utils.hasLoadedNamespace&&!o.utils.hasLoadedNamespace(r)&&(Ke["".concat(d[0],"-").concat(e)]=!0,o.logger.warn('key "'.concat(n,'" 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(n){if(!o.isValidLookup(t)){i=n;var r,u=[c];if(o.i18nFormat&&o.i18nFormat.addLookupKeys)o.i18nFormat.addLookupKeys(u,c,n,e,a);else{var g;l&&(g=o.pluralResolver.getSuffix(n,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)||(s=r,t=o.getResource(n,e,r,a))}})))}))}})),{res:t,usedKey:n,exactUsedKey:s,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,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,n,s):this.resourceStore.getResource(e,t,n,s)}}],[{key:"hasDefaultValue",value:function(e){var t="defaultValue";for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t===n.substring(0,12)&&void 0!==e[n])return!0;return!1}}]),n}();function ze(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Je=function(){function e(t){ue(this,e),this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=be.create("languageUtils")}return le(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"],n=e.split("-");return this.options.lowerCaseLng?n=n.map((function(e){return e.toLowerCase()})):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=ze(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),t.indexOf(n[1].toLowerCase())>-1&&(n[1]=ze(n[1].toLowerCase())),t.indexOf(n[2].toLowerCase())>-1&&(n[2]=ze(n[2].toLowerCase()))),n.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,n=this;return e?(e.forEach((function(e){if(!t){var s=n.formatLanguageCode(e);n.options.supportedLngs&&!n.isSupportedCode(s)||(t=s)}})),!t&&this.options.supportedLngs&&e.forEach((function(e){if(!t){var s=n.getLanguagePartFromCode(e);if(n.isSupportedCode(s))return t=s;t=n.options.supportedLngs.find((function(e){if(0===e.indexOf(s))return e}))}})),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 n=e[t];return n||(n=e[this.getScriptPartFromCode(t)]),n||(n=e[this.formatLanguageCode(t)]),n||(n=e[this.getLanguagePartFromCode(t)]),n||(n=e.default),n||[]}},{key:"toResolveHierarchy",value:function(e,t){var n=this,s=this.getFallbackCodes(t||this.options.fallbackLng||[],e),i=[],r=function(e){e&&(n.isSupportedCode(e)?i.push(e):n.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)),s.forEach((function(e){i.indexOf(e)<0&&r(n.formatLanguageCode(e))})),i}}]),e}(),We=[{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}],Xe={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)}},Ze=["v1","v2","v3"],Qe={zero:0,one:1,two:2,few:3,many:4,other:5};var et=function(){function e(t){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ue(this,e),this.languageUtils=t,this.options=s,this.logger=be.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=(n={},We.forEach((function(e){e.lngs.forEach((function(t){n[t]={numbers:e.nr,plurals:Xe[e.fc]}}))})),n)}return le(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]:{},n=this.getRule(e,t);return this.shouldUseIntlApi()?n&&n.resolvedOptions().pluralCategories.length>1:n&&n.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,n).map((function(e){return"".concat(t).concat(e)}))}},{key:"getSuffixes",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=this.getRule(e,n);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((function(e,t){return Qe[e]-Qe[t]})).map((function(e){return"".concat(t.options.prepend).concat(e)})):s.numbers.map((function(s){return t.getSuffix(e,s,n)})):[]}},{key:"getSuffix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this.getRule(e,n);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(t)):this.getSuffixRetroCompatible(s,t):(this.logger.warn("no plural rule found for: ".concat(e)),"")}},{key:"getSuffixRetroCompatible",value:function(e,t){var n=this,s=e.noAbs?e.plurals(t):e.plurals(Math.abs(t)),i=e.numbers[s];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var r=function(){return n.options.prepend&&i.toString()?n.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&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Ze.includes(this.options.compatibilityJSON)}}]),e}();function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var st=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ue(this,e),this.logger=be.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||function(e){return e},this.init(t)}return le(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:je,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 n="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(n,"g")}},{key:"interpolate",value:function(e,t,n,s){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=Ue(t,u,e);return a.alwaysFormat?a.format(i,void 0,n,nt(nt(nt({},s),t),{},{interpolationkey:e})):i}var r=e.split(a.formatSeparator),o=r.shift().trim(),c=r.join(a.formatSeparator).trim();return a.format(Ue(t,u,o),c,n,nt(nt(nt({},s),t),{},{interpolationkey:o}))};this.resetRegExp();var l=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,h=s&&s.interpolation&&void 0!==s.interpolation.skipOnVariables?s.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 n=i[1].trim();if(void 0===(r=g(n)))if("function"==typeof l){var u=l(e,i,s);r="string"==typeof u?u:""}else if(s&&Object.prototype.hasOwnProperty.call(s,n))r="";else{if(h){r=i[0];continue}a.logger.warn("missed to pass in variable ".concat(n," for interpolating ").concat(e)),r=""}else"string"==typeof r||a.useRawValueToEscape||(r=_e(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 n,s,i,r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};function a(e,t){var n=this.nestingOptionsSeparator;if(e.indexOf(n)<0)return e;var s=e.split(new RegExp("".concat(n,"[ ]*{"))),r="{".concat(s[1]);e=s[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=nt(nt({},t),i))}catch(t){return this.logger.warn("failed parsing options string in nesting for key ".concat(e),t),"".concat(e).concat(n).concat(r)}return delete i.defaultValue,e}for(;n=this.nestingRegexp.exec(e);){var u=[];(i=(i=nt({},o)).replace&&"string"!=typeof i.replace?i.replace:i).applyPostProcessor=!1,delete i.defaultValue;var c=!1;if(-1!==n[0].indexOf(this.formatSeparator)&&!/{.*}/.test(n[1])){var g=n[1].split(this.formatSeparator).map((function(e){return e.trim()}));n[1]=g.shift(),u=g,c=!0}if((s=t(a.call(this,n[1].trim(),i),i))&&n[0]===e&&"string"!=typeof s)return s;"string"!=typeof s&&(s=_e(s)),s||(this.logger.warn("missed to resolve ".concat(n[1]," for nesting ").concat(e)),s=""),c&&(s=u.reduce((function(e,t){return r.format(e,t,o.lng,nt(nt({},o),{},{interpolationkey:n[1].trim()}))}),s.trim())),e=e.replace(n[0],s),this.regexp.lastIndex=0}return e}}]),e}();function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?it(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ot(e){var t={};return function(n,s,i){var r=s+JSON.stringify(i),o=t[r];return o||(o=e(s,i),t[r]=o),o(n)}}var at=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ue(this,e),this.logger=be.create("formatter"),this.options=t,this.formats={number:ot((function(e,t){var n=new Intl.NumberFormat(e,rt({},t));return function(e){return n.format(e)}})),currency:ot((function(e,t){var n=new Intl.NumberFormat(e,rt(rt({},t),{},{style:"currency"}));return function(e){return n.format(e)}})),datetime:ot((function(e,t){var n=new Intl.DateTimeFormat(e,rt({},t));return function(e){return n.format(e)}})),relativetime:ot((function(e,t){var n=new Intl.RelativeTimeFormat(e,rt({},t));return function(e){return n.format(e,t.range||"day")}})),list:ot((function(e,t){var n=new Intl.ListFormat(e,rt({},t));return function(e){return n.format(e)}}))},this.init(t)}return le(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()]=ot(t)}},{key:"format",value:function(e,t,n){var s=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(),n={};if(e.indexOf("(")>-1){var s=e.split("(");t=s[0].toLowerCase().trim();var i=s[1].substring(0,s[1].length-1);"currency"===t&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach((function(e){if(e){var t=ye(e.split(":")),s=t[0],i=t.slice(1).join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=i),"false"===i&&(n[s.trim()]=!1),"true"===i&&(n[s.trim()]=!0),isNaN(i)||(n[s.trim()]=parseInt(i,10))}}))}return{formatName:t,formatOptions:n}}(t),o=r.formatName,a=r.formatOptions;if(s.formats[o]){var u=e;try{var c=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},g=c.locale||c.lng||i.locale||i.lng||n;u=s.formats[o](e,g,rt(rt(rt({},a),i),c))}catch(e){s.logger.warn(e)}return u}return s.logger.warn("there was no format function for ".concat(o)),e}),e)}}]),e}();function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function ct(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function gt(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 n,s=me(e);if(t){var i=me(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return fe(this,n)}}var lt=function(e){de(n,Oe);var t=gt(n);function n(e,s,i){var r,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ue(this,n),r=t.call(this),Ne&&Oe.call(he(r)),r.backend=e,r.store=s,r.services=i,r.languageUtils=i.languageUtils,r.options=o,r.logger=be.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 le(n,[{key:"queueLoad",value:function(e,t,n,s){var i=this,r={},o={},a={},u={};return e.forEach((function(e){var s=!0;t.forEach((function(t){var a="".concat(e,"|").concat(t);!n.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,s=!1,void 0===o[a]&&(o[a]=!0),void 0===r[a]&&(r[a]=!0),void 0===u[t]&&(u[t]=!0)))})),s||(a[e]=!0)})),(Object.keys(r).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(r),pending:Object.keys(o),toLoadLanguages:Object.keys(a),toLoadNamespaces:Object.keys(u)}}},{key:"loaded",value:function(e,t,n){var s=e.split("|"),i=s[0],r=s[1];t&&this.emit("failedLoading",i,r,t),n&&this.store.addResourceBundle(i,r,n),this.state[e]=t?-1:2;var o={};this.queue.forEach((function(n){var s,a,u,c,g,l;s=n.loaded,a=r,c=Me(s,[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--)}(n,e),t&&n.errors.push(t),0!==n.pendingCount||n.done||(Object.keys(n.loaded).forEach((function(e){o[e]||(o[e]={});var t=n.loaded[e];t.length&&t.forEach((function(t){void 0===o[e][t]&&(o[e][t]=!0)}))})),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((function(e){return!e.done}))}},{key:"read",value:function(e,t,n){var s=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:n,tried:i,wait:r,callback:o});else{this.readingCalls++;var a=function(a,u){if(s.readingCalls--,s.waitingReads.length>0){var c=s.waitingReads.shift();s.read(c.lng,c.ns,c.fcName,c.tried,c.wait,c.callback)}a&&u&&i<s.maxRetries?setTimeout((function(){s.read.call(s,e,t,n,i+1,2*r,o)}),r):o(a,u)},u=this.backend[n].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 n=this,s=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,s,i);if(!r.toLoad.length)return r.pending.length||i(),null;r.toLoad.forEach((function(e){n.loadOne(e)}))}},{key:"load",value:function(e,t,n){this.prepareLoading(e,t,{},n)}},{key:"reload",value:function(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}},{key:"loadOne",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(function(s,o){s&&t.logger.warn("".concat(n,"loading namespace ").concat(r," for language ").concat(i," failed"),s),!s&&o&&t.logger.log("".concat(n,"loaded namespace ").concat(r," for language ").concat(i),o),t.loaded(e,s,o)}))}},{key:"saveMissing",value:function(e,t,n,s,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(n,'" 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!=n&&""!==n){if(this.backend&&this.backend.create){var a=ct(ct({},r),{},{isUpdate:i}),u=this.backend.create.bind(this.backend);if(u.length<6)try{var c;(c=5===u.length?u(e,t,n,s,a):u(e,t,n,s))&&"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,n,s,o,a)}e&&e[0]&&this.store.addResource(e[0],t,n,s)}}}]),n}();function ht(){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"===ae(e[1])&&(t=e[1]),"string"==typeof e[1]&&(t.defaultValue=e[1]),"string"==typeof e[2]&&(t.tDescription=e[2]),"object"===ae(e[2])||"object"===ae(e[3])){var n=e[3]||e[2];Object.keys(n).forEach((function(e){t[e]=n[e]}))}return t},interpolation:{escapeValue:!0,format:function(e,t,n,s){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function pt(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 dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mt(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 n,s=me(e);if(t){var i=me(this).constructor;n=Reflect.construct(s,arguments,i)}else n=s.apply(this,arguments);return fe(this,n)}}function vt(){}var Et=function(e){de(n,Oe);var t=mt(n);function n(){var e,s,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(ue(this,n),e=t.call(this),Ne&&Oe.call(he(e)),e.options=pt(i),e.services={},e.logger=be,e.modules={external:[]},s=he(e),Object.getOwnPropertyNames(Object.getPrototypeOf(s)).forEach((function(e){"function"==typeof s[e]&&(s[e]=s[e].bind(s))})),r&&!e.isInitialized&&!i.isClone){if(!e.options.initImmediate)return e.init(i,r),fe(e,he(e));setTimeout((function(){e.init(i,r)}),0)}return e}return le(n,[{key:"init",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(n=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 s=ht();function i(e){return e?"function"==typeof e?new e:e:null}if(this.options=ft(ft(ft({},s),this.options),pt(t)),"v1"!==this.options.compatibilityAPI&&(this.options.interpolation=ft(ft({},s.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?be.init(i(this.modules.logger),this.options):be.init(null,this.options),this.modules.formatter?r=this.modules.formatter:"undefined"!=typeof Intl&&(r=at);var o=new Je(this.options);this.store=new $e(this.options.resources,this.options);var a=this.services;a.logger=be,a.resourceStore=this.store,a.languageUtils=o,a.pluralResolver=new et(o,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!r||this.options.interpolation.format&&this.options.interpolation.format!==s.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 st(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new lt(i(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",(function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];e.emit.apply(e,[t].concat(s))})),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 n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];e.emit.apply(e,[t].concat(s))})),this.modules.external.forEach((function(t){t.init&&t.init(e)}))}if(this.format=this.options.interpolation.format,n||(n=vt),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 n;return(n=e.store)[t].apply(n,arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((function(t){e[t]=function(){var n;return(n=e.store)[t].apply(n,arguments),e}}));var c=De(),g=function(){var t=function(t,s){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(s),n(t,s)};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,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt,s="string"==typeof e?e:this.language;if("function"==typeof e&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(s&&"cimode"===s.toLowerCase())return n();var i=[],r=function(e){e&&t.services.languageUtils.toResolveHierarchy(e).forEach((function(e){i.indexOf(e)<0&&i.push(e)}))};if(s)r(s);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),n(e)}))}else n(null)}},{key:"reloadResources",value:function(e,t,n){var s=De();return e||(e=this.languages),t||(t=this.options.ns),n||(n=vt),this.services.backendConnector.reload(e,t,(function(e){s.resolve(),n(e)})),s}},{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&&Fe.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 n=this.languages[t];if(!(["cimode","dev"].indexOf(n)>-1)&&this.store.hasLanguageSomeTranslations(n)){this.resolvedLanguage=n;break}}}},{key:"changeLanguage",value:function(e,t){var n=this;this.isLanguageChangingTo=e;var s=De();this.emit("languageChanging",e);var i=function(e){n.language=e,n.languages=n.services.languageUtils.toResolveHierarchy(e),n.resolvedLanguage=void 0,n.setResolvedLanguage(e)},r=function(r){e||r||!n.services.languageDetector||(r=[]);var o="string"==typeof r?r:n.services.languageUtils.getBestMatchFromCodes(r);o&&(n.language||i(o),n.translator.language||n.translator.changeLanguage(o),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage&&n.services.languageDetector.cacheUserLanguage(o)),n.loadResources(o,(function(e){!function(e,r){r?(i(r),n.translator.changeLanguage(r),n.isLanguageChangingTo=void 0,n.emit("languageChanged",r),n.logger.log("languageChanged",r)):n.isLanguageChangingTo=void 0,s.resolve((function(){return n.t.apply(n,arguments)})),t&&t(e,(function(){return n.t.apply(n,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()),s}},{key:"getFixedT",value:function(e,t,n){var s=this,i=function e(t,i){var r;if("object"!==ae(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=s.options.overloadTranslationOptionHandler([t,i].concat(a))}else r=ft({},i);r.lng=r.lng||e.lng,r.lngs=r.lngs||e.lngs,r.ns=r.ns||e.ns,r.keyPrefix=r.keyPrefix||n||e.keyPrefix;var c,g=s.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,s.t(c,r)};return"string"==typeof e?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=n,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,n=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 s=this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;var o=function(e,n){var s=t.services.backendConnector.state["".concat(e,"|").concat(n)];return-1===s||2===s};if(n.precheck){var a=n.precheck(this,o);if(void 0!==a)return a}return!!this.hasResourceBundle(s,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(s,e)||i&&!o(r,e)))}},{key:"loadNamespaces",value:function(e,t){var n=this,s=De();return this.options.ns?("string"==typeof e&&(e=[e]),e.forEach((function(e){n.options.ns.indexOf(e)<0&&n.options.ns.push(e)})),this.loadResources((function(e){s.resolve(),t&&t(e)})),s):(t&&t(),Promise.resolve())}},{key:"loadLanguages",value:function(e,t){var n=De();"string"==typeof e&&(e=[e]);var s=this.options.preload||[],i=e.filter((function(e){return s.indexOf(e)<0}));return i.length?(this.options.preload=s.concat(i),this.loadResources((function(e){n.resolve(),t&&t(e)})),n):(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 Je(ht());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]:{},s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt,i=ft(ft(ft({},this.options),t),{isClone:!0}),r=new n(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=ft({},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,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];r.emit.apply(r,[e].concat(n))})),r.init(i,s),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}}}]),n}();ve(Et,"createInstance",(function(){return new Et(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}));var yt=Et.createInstance();yt.createInstance=Et.createInstance,yt.createInstance,yt.dir,yt.init,yt.loadResources,yt.reloadResources,yt.use,yt.changeLanguage,yt.getFixedT,yt.t,yt.exists,yt.setDefaultNamespace,yt.hasLoadedNamespace,yt.loadNamespaces,yt.loadLanguages;class Tt extends Y{constructor(){super(),this.languages=null}static getInstance(){return Tt.instance||(Tt.instance=new Tt),Tt.instance}provideLanguages(e){"wechat"!==this.getEngine().TUIGlobal.getPlatform()&&(this.languages=e,console.log("TUITranslateService.provideLanguages ok."))}useI18n(e){"wechat"!==this.getEngine().TUIGlobal.getPlatform()&&(this.languages?yt.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."))}t(e){if(!this.languages){let t=e;return!S(e)&&e.indexOf(".")>-1&&(t=e.split(".").pop()||""),t}return yt.t(e)}}class St extends Y{constructor(){super(),this.serv="TUIConversationService"}static getInstance(){return St.instance||(St.instance=new St),St.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)),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)}getConversationInitData(){const e=this.getEngine();e.chat.isReady()&&e.chat.getConversationList().then((t=>{const{conversationList:n,isSyncCompleted:s}=t.data;if(console.log(`${this.serv}.init, getConversationList count:${n.length} isSyncCompleted:${s}`),n.length>0){this.onConversationListUpdated(n);const t=e.chat.getTotalUnreadMessageCount();this.onTotalUnreadCountUpdated(t)}}))}switchConversation(e){return i(this,void 0,void 0,(function*(){const t=`${this.serv}.switchConversation`,n=this.getEngine();if(!e)return n.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(a.CONV,"currentConversationID",""),n.TUIStore.update(a.CONV,"currentConversation",null),console.log(`${t} conversationID is empty, conversationID:${e}`),Promise.resolve({});if(!e.startsWith(n.TYPES.CONV_C2C)&&!e.startsWith(n.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 s=n.TUIStore.getData(a.CONV,"currentConversationID");if(s&&s===e)return this.setMessageRead(s),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})):(s&&this.setMessageRead(s),e&&this.setMessageRead(e),n.TUIStore.reset(a.CHAT,["messageList","isCompleted","nextReqMessageID"]),n.TUIStore.update(a.CONV,"currentConversationID",e),n.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 n=yield this.getConversationProfile(e);n.data&&n.data.conversation&&(t=new Z(n.data.conversation))}catch(e){t=void 0}return t}))}findConversation(e){let t;const n=this.getEngine().TUIStore.getData(a.CONV,"conversationList");for(let s=0;s<n.length;s++)if(n[s].conversationID===e){t=n[s];break}return t}updateCurrentConversation(){const e=this.getEngine(),t=e.TUIStore.getData(a.CONV,"currentConversationID"),n=this.findConversation(t);n&&e.TUIStore.update(a.CONV,"currentConversation",n)}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 n=this.getEngine().TUIStore.getData(a.CONV,"currentConversationID");return console.log(`${this.serv}.deleteConversation conversationID:${e} currentConversationID:${n}`),e===n&&(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 It{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(),n=t.TUIStore.getData(a.USER,"userProfile");e.forEach((e=>{e.userID===n.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 n=0;for(;n<e.length;)t.push(e.slice(n,n+=100));const s=[];t.forEach((e=>{s.push(this.TUIUserService.getUserProfile({userIDList:e}))}));const i=[];return Promise.all(s).then((e=>(e.forEach((e=>{const t=e.data.map((e=>{const{userID:t,nick:n,avatar:s}=e;return{userID:t,nick:n,avatar:s}}));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 bt(e,t,n=!0){!function(e,t){U?G.setStorageSync(e,t):_t()&&localStorage.setItem(e,JSON.stringify(t))}(n?Dt(e):e,t)}function Ot(e,t=!0){try{return function(e){if(U)return G.getStorageSync(e);if(_t()){const t=localStorage.getItem(e);if("undefined"!==t)return JSON.parse(t)}return}(t?Dt(e):e)}catch(e){return void console.warn("Storage.getStorageItem error:",e)}}function Dt(e){return`chat_engine_${e}`}function _t(){return navigator&&navigator.cookieEnabled&&localStorage}class Mt{constructor(e){this.TUIUserService=e}getEngine(){return this.TUIUserService.getEngine()}init(){const e=this.getEngine(),t=Ot("displayOnlineStatus")||!1;e.TUIStore.update(a.USER,"displayOnlineStatus",t),e.eventCenter.addEvent(e.EVENT.USER_STATUS_UPDATED,this.onUserStatusUpdated.bind(this)),this.onConversationListUpdated()}onConversationListUpdated(){this.getEngine().TUIStore.watch(a.CONV,{conversationList:e=>{this.startToSubscribe(e)}})}onUserStatusUpdated(e){this.getEngine().TUIStore.update(a.USER,"userStatusList",e)}switchUserStatus(e){const t=this.getEngine(),{displayOnlineStatus:n=!1}=e;if(t.TUIStore.update(a.USER,"displayOnlineStatus",n),bt("displayOnlineStatus",n),!0===n){const e=t.TUIStore.getData(a.CONV,"conversationList");this.startToSubscribe(e)}else this.unsubscribeUserStatus()}getUserStatus(e){const t=this.getEngine();return t.chat.getUserStatus(e).then((e=>{const{successUserList:n}=e.data;return n.length>0&&t.TUIStore.update(a.USER,"userStatusList",n),e})).catch((e=>Promise.reject(e)))}subscribeUserStatus(e){var t;if(0!==(null===(t=null==e?void 0:e.userIDList)||void 0===t?void 0:t.length))return this.getEngine().chat.subscribeUserStatus(e)}unsubscribeUserStatus(e){const{userIDList:t=[]}=e||{},n=this.getEngine();return n.chat.unsubscribeUserStatus({userIDList:t}).then((e=>{const{failureUserList:s}=e.data,i=[];return t.forEach((e=>{s.includes(e)||i.push({userID:e,statusType:u.UNSUB_USER})})),n.TUIStore.update(a.USER,"userStatusList",i),e})).catch((e=>Promise.reject(e)))}startToSubscribe(e){const t=this.getEngine(),n=t.TUIStore.getData(a.USER,"userStatusList"),s=[];if(e.forEach((e=>{if(e.type===t.TYPES.CONV_C2C){const i=e.conversationID.replace(t.TYPES.CONV_C2C,"");n.has(i)||s.push(i)}})),0===s.length)return;!0===t.TUIStore.getData(a.USER,"displayOnlineStatus")&&t.chat.isReady()&&(this.subscribeUserStatus({userIDList:s}),this.getUserStatus({userIDList:s}))}}class Ct extends Y{constructor(){super(),this.userProfileHandler=new It(this),this.userStatusHandler=new Mt(this)}static getInstance(){return Ct.instance||(Ct.instance=new Ct),Ct.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=Ot("displayMessageReadReceipt")||!1;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),bt("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 Pt{constructor(e){this.TUIChatService=e}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=`${z}${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=`${J}pointx=${t.lon}&pointy=${t.lat}&name=${e.payload.description}`,t.url=`${W}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:D(e.payload.fileSize)}}handleCustomMessage(e){var t;const n=this.handleCreateGroupCustomMessage(e);return{custom:this.handleCallKitSignaling(e)||n||(null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.extension)||`[${this.t("message.custom.自定义消息")}]`,businessID:n?"group_create":""}}handleMergeMessage(e){return Object.assign({},e.payload)}handleGroupTipsMessage(e){var t,n,s,i,r,o;const a=this.getEngine(),u={text:""};let c=(null==e?void 0:e.nick)||(null===(n=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.userIDList)||void 0===n?void 0:n.join(","));switch((null===(i=null===(s=null==e?void 0:e.payload)||void 0===s?void 0:s.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=>{c+=`${(null==e?void 0:e.nick)||(null==e?void 0:e.userID)},`})),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,n={text:""};switch(e.payload.operationType){case 1:n.text=`${e.payload.operatorID} ${this.t("message.tip.申请加入群组")}:${t}`;break;case 2:n.text=`${this.t("message.tip.成功加入群组")}:${t}`;break;case 3:n.text=`${this.t("message.tip.申请加入群组")}:${t} ${this.t("message.tip.被拒绝")}`;break;case 4:n.text=`${this.t("message.tip.你被管理员")}${e.payload.operatorID} ${this.t("message.tip.踢出群组")}:${t}`;break;case 5:n.text=`${this.t("message.tip.群")}:${t} ${this.t("message.tip.被")} ${e.payload.operatorID} ${this.t("message.tip.解散")}`;break;case 6:n.text=`${e.payload.operatorID} ${this.t("message.tip.创建群")}:${t}`;break;case 7:case 12:n.text=`${e.payload.operatorID} ${this.t("message.tip.邀请你加群")}:${t}`;break;case 8:n.text=`${this.t("message.tip.你退出群组")}:${t}`;break;case 9:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.设置为群")}:${t} ${this.t("message.tip.的管理员")}`;break;case 10:n.text=`${this.t("message.tip.你被")}${e.payload.operatorID} ${this.t("message.tip.撤销群")}:${t} ${this.t("message.tip.的管理员身份")}`;break;case 13:n.text=`${e.payload.operatorID} ${this.t("message.tip.同意加群")}:${t}`;break;case 14:n.text=`${e.payload.operatorID} ${this.t("message.tip.拒接加群")}:${t}`;break;case 255:n.text=`${this.t("message.tip.自定义群系统通知")}: ${e.payload.userDefinedField}`;break;default:n.text="未解析的群系统通知"}return n}handleCallKitSignaling(e){var t,n,s,i,r,o,a,u,c;const g=O(e.payload.data);if(1!==(null==g?void 0:g.businessID))return"";const l=O(null==g?void 0:g.data);let h="";null===(t=null==g?void 0:g.inviteeList)||void 0===t||t.forEach((e=>{h+=`${e}、`})),h=h.substring(0,h.lastIndexOf("、"));const p=null==g?void 0:g.inviter;switch(null==g?void 0:g.actionType){case 1:return"audioCall"!==(null===(n=null==l?void 0:l.data)||void 0===n?void 0:n.cmd)&&"videoCall"!==(null===(s=null==l?void 0:l.data)||void 0===s?void 0:s.cmd)||!(null==g?void 0:g.groupID)?"hangup"===(null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.cmd)?(null==g?void 0:g.groupID)?`${this.t("message.custom.结束群聊")}`:`${this.t("message.custom.通话时长")}:${function(e){const t=e;let n,s,i,r="";return t>=3600?(n=parseInt(""+t/3600,10)<10?`0${parseInt(""+t/3600,10)}`:parseInt(""+t/3600,10),s=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&&(s=parseInt(""+i/60,10)<10?`0${parseInt(""+i/60,10)}`:parseInt(""+i/60,10),i=i%60<10?"0"+i%60:i%60),r=`${n}:${s}:${i}`):t>=60&&t<3600?(s=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:${s}:${i}`):t<60&&(i=t<10?`0${t}`:t,r=`00:00:${i}`),r}(null==l?void 0:l.call_end)}`:"switchToAudio"===(null===(r=null==l?void 0:l.data)||void 0===r?void 0:r.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(o=null==l?void 0:l.data)||void 0===o?void 0:o.cmd)?`${this.t("message.custom.切换视频通话")}`:`${this.t("message.custom.发起通话")}`:`${p} ${this.t("message.custom.发起通话")}`;case 2:return(null==g?void 0:g.groupID)?`${p} ${this.t("message.custom.取消通话")}`:this.t("message.custom.取消通话");case 3:return"switchToAudio"===(null===(a=null==l?void 0:l.data)||void 0===a?void 0:a.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null===(u=null==l?void 0:l.data)||void 0===u?void 0:u.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==g?void 0:g.groupID)?`${h} ${this.t("message.custom.已接听")}`:this.t("message.custom.已接听");case 4:return(null==g?void 0:g.groupID)?`${h} ${this.t("message.custom.拒绝通话")}`:this.t("message.custom.拒绝通话");case 5:return"switchToAudio"===(null===(c=null==l?void 0:l.data)||void 0===c?void 0:c.cmd)?`${this.t("message.custom.切换语音通话")}`:"switchToVideo"===(null==l?void 0:l.data.cmd)?`${this.t("message.custom.切换视频通话")}`:(null==g?void 0:g.groupID)?`${h} ${this.t("message.custom.无应答")}`:this.t("message.custom.无应答");default:return""}}handleCreateGroupCustomMessage(e){let t;try{const n=O(e.payload.data);"group_create"===n.businessID&&(t=`${n.opUser} ${n.content}`)}catch(e){}return t}decodeText(e){const t=[];let n=e.text,s=-1,i=-1;for(;""!==n;)switch(s=n.indexOf("["),i=n.indexOf("]"),s){case 0:if(-1===i)t.push({name:"text",text:n}),n="";else{const e=n.slice(0,i+1);X[e]?(t.push({name:"img",src:q+X[e]}),n=n.substring(i+1)):(t.push({name:"text",text:"["}),n=n.slice(1))}break;case-1:t.push({name:"text",text:n}),n="";break;default:t.push({name:"text",text:n.slice(0,s)}),n=n.substring(s)}return t}handleGroupProfileUpdated(e){const{nick:t,payload:n}=e,{newGroupProfile:s,memberList:i,operatorID:r}=n;let o="";const a=t||r,u=Object.keys(s)[0];switch(u){case"muteAllMembers":o=s[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.修改群名为")} ${s[u]}`;break;case"notification":o=`${a} ${this.t("message.tip.发布新公告")}`}return o}}class Ut{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(),n=t.TUIStore.getData(a.CHAT,"typingStatus");if(e.type===this.getEngine().TYPES.MSG_CUSTOM&&"in"===e.flow){const s=O(e.payload.data);if(s.businessID===c.BUSINESS_ID){const{typingStatus:e,userAction:i}=s;if(e===c.STATUS_START||i===c.ACTION_START_ID)return n?(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=[]){return 0===e.length?[]:(this.handleLastMessage(e[e.length-1]),e.filter((e=>{if(e.type===this.getEngine().TYPES.MSG_CUSTOM){return O(e.payload.data).businessID!==c.BUSINESS_ID}return!0})))}createTypingMessage(e=c.STATUS_END,t=""){const{BUSINESS_ID:n,STATUS_START:s,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:n,typingStatus:e,version:i,userAction:e===s?r:o,actionParam:e===s?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 Rt{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(),n=t.TUIStore.getData(a.CONV,"currentConversationID"),s=[];e.forEach((e=>{const{messageID:i}=e,r=t.chat.findMessage(i);r&&n===r.conversationID&&s.push(r)})),s.length>0&&t.TUIChat.updateMessageList(s,"edit")}sendMessageReadReceipt(e){const t=[];return e.forEach((e=>{const n=e.getMessage();t.push(n)})),this.getEngine().chat.sendMessageReadReceipt(t)}getGroupMessageReadMemberList(e){const t=e.message.getMessage(),n=Object.assign(Object.assign({},e),{message:t});return this.getEngine().chat.getGroupMessageReadMemberList(n)}getMessageReadReceiptList(e){const t=this.getEngine();return!t.TUIStore.getData(a.USER,"displayMessageReadReceipt")||0===e.length||e[0].conversationType!==t.TYPES.CONV_GROUP?Promise.resolve(e):t.chat.getMessageReadReceiptList(e).then((e=>e.data.messageList)).catch((()=>Promise.resolve(e)))}}const xt=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 n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(e)){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}return!1};class Gt extends Y{constructor(){super(),this.messageHandler=new Pt(this),this.typingHandler=new Ut(this),this.readReceiptHandler=new Rt(this)}static getInstance(){return Gt.instance||(Gt.instance=new Gt),Gt.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)),this.onCurrentConversationIDUpdated(),this.readReceiptHandler.init()}onMessageReceived(e){this.updateMessageList(e,"push")}onMessageModified(e){this.updateMessageList(e,"edit")}onMessageRevoked(e){this.updateMessageList(e,"edit")}onCurrentConversationIDUpdated(){const e=this.getEngine();e.TUIStore.watch(a.CONV,{currentConversationID:t=>{e.TUIStore.reset(a.CHAT),this.typingHandler.clearTypingStatus(),this.typingHandler.sendTypingEnd(),xt(t)||this.getMessageList()}})}onMessageReadByPeer(e){this.updateMessageList(e,"edit")}getStoreData(e,t){return this.getEngine().TUIStore.getData(e,t)}sendMessage(e,t){this.updateMessageList([e],"send");const n=this.getEngine().chat.sendMessage(e,t);return this.getResponse(n)}getResponse(e,t=!0,n=!0){return e.then((e=>{const n=e.data.messageList?e.data.messageList:[e.data.message];return t&&this.updateMessageList(n,"edit"),e})).catch((e=>{var t;return n&&(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=""){const n=this.getStoreData(a.CONV,"currentConversationID"),s=e.filter((e=>e.conversationID===n));if(!t||0===s.length)return;const i=this.getStoreData(a.CHAT,"messageList");let r=[];switch(t){case"edit":for(const e of i){const t=s.find((t=>t.ID===e.ID));r.push(t||e)}break;case"resend":r=i.filter((e=>e.ID!==s[0].ID)).concat(s);break;case"send":r=i.concat(this.typingHandler.filterTypingMessage(s));break;case"push":r=i.concat(this.typingHandler.filterTypingMessage(s)),this.getEngine().chat.setMessageRead({conversationID:n});break;case"unshift":r=s.filter((e=>0===i.length||!i.find((t=>t.ID===e.ID)))),r.push(...i)}this.getEngine().TUIStore.update(a.CHAT,"messageList",r)}enterTypingState(){this.sendTyping(!0)}leaveTypingState(){this.sendTyping(!1)}sendTyping(e){const t=this.getEngine(),n=this.getStoreData(a.CONV,"currentConversationID");if(!n.startsWith(t.TYPES.CONV_C2C))return;const s=n.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,s)}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 n=this.getEngine(),s={abstract:"",type:0};switch(e.type){case n.TYPES.MSG_TEXT:s.abstract=null===(t=null==e?void 0:e.payload)||void 0===t?void 0:t.text,s.type=1;break;case n.TYPES.MSG_CUSTOM:s.abstract=this.t("[自定义消息]"),s.type=2;break;case n.TYPES.MSG_IMAGE:s.abstract=this.t("[图片]"),s.type=3;break;case n.TYPES.MSG_AUDIO:s.abstract=this.t("[语音]"),s.type=4;break;case n.TYPES.MSG_VIDEO:s.abstract=this.t("[视频]"),s.type=5;break;case n.TYPES.MSG_FILE:s.abstract=this.t("[文件]"),s.type=6;break;case n.TYPES.MSG_FACE:s.abstract=this.t("[表情]"),s.type=7}return s}genMessageReply(e,t){if("reply"!==t&&"quote"!==t)return{};const{abstract:n,type:s}=this.getMessageAbstractAndType(e),i={messageAbstract:n,messageSender:e.nick||e.from,messageID:e.ID},r=Object.assign(Object.assign({},i),{messageType:s,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=O(e.cloudCustomData);t.messageReply&&t.messageReply.messageRootID&&(r.messageRootID=t.messageReply.messageRootID)}return{messageReply:r,messageReplyRoot:i}}getMessageInfo(e,t,n){const{messageReply:s,messageReplyRoot:i}=this.genMessageReply(t,n),r=e.cloudCustomData?O(e.cloudCustomData):{};let o;if(r.messageReply?r.messageReply=Object.assign(Object.assign({},s),r.messageReply):r.messageReply=s,"reply"===n){const{messageRootID:e}=s;o=this.getEngine().chat.findMessage(e);const t=o.cloudCustomData?O(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 n=this.getEngine(),{message:s,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};s&&(r=this.getMessageInfo(e,s,i));const o=n.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),n.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendTextAtMessage(e,t){const n=this.getEngine(),{message:s,type:i}=this.getStoreData(a.CHAT,"quoteMessage");let r={cloudCustomData:e.cloudCustomData||"",rootMessage:void 0};s&&(r=this.getMessageInfo(e,s,i));const o=n.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),n.TUIStore.reset(a.CHAT,["quoteMessage"],!0),e)))}sendImageMessage(e,t){const n=this.getEngine().chat.createImageMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendAudioMessage(e,t){const n=this.getEngine().chat.createAudioMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendVideoMessage(e,t){const n=this.getEngine().chat.createVideoMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendCustomMessage(e,t){const n=this.getEngine().chat.createCustomMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFaceMessage(e,t){const n=this.getEngine().chat.createFaceMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendFileMessage(e,t){const n=this.getEngine().chat.createFileMessage(Object.assign(Object.assign(Object.assign({},this.getCurrentConvInfo()),e),{onProgress:e=>{this.onProgress(n.ID,e)}}));return this.sendMessage(n,t)}sendLocationMessage(e,t){const n=this.getEngine().chat.createLocationMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}sendMergerMessage(e,t){const n=this.getEngine().chat.createMergerMessage(Object.assign(Object.assign({},this.getCurrentConvInfo()),e));return this.sendMessage(n,t)}onProgress(e,t){const n=this.getEngine().TUIStore.getMessageModel(e);if(n){const e=t-n.progress;n.progress=t,(e>=.1||1===t)&&this.updateMessageList([n],"edit")}}setAbstractList(e){const t=this.getEngine(),n=e.nick||e.from;let s="";switch(e.type){case t.TYPES.MSG_TEXT:return s=e.payload.text||"",s.length>20&&(s=s.slice(0,20)),`${n}: ${s}`;case t.TYPES.MSG_MERGER:return`${n}: ${this.t("[聊天记录]")}`;case t.TYPES.MSG_IMAGE:return`${n}: ${this.t("[图片]")}`;case t.TYPES.MSG_AUDIO:return`${n}: ${this.t("[音频]")}`;case t.TYPES.MSG_VIDEO:return`${n}: ${this.t("[视频]")}`;case t.TYPES.MSG_CUSTOM:return`${n}: ${this.t("[自定义消息]")}`;case t.TYPES.MSG_FILE:return`${n}: ${this.t("[文件]")}`;case t.TYPES.MSG_FACE:return`${n}: ${this.t("[动画表情]")}`}}genMergerForwardPayload(e){const{conversationType:t,nick:n,from:s,to:i}=e[0],r=[];return e.forEach((e=>{r.push(this.setAbstractList(e))})),{messageList:e,title:"GROUP"===t?"群聊的聊天记录":`${n||s} 和 ${i} 的聊天记录`,abstractList:r,compatibleText:"请升级IMSDK到v2.10.1或更高版本查看此消息"}}sendMergerForwardMessage(e,t,n){const s=[];for(let i=0;i<e.length;i++){const{conversationID:r,type:o}=e[i],a={to:r.replace(`${o}`,""),conversationType:o,payload:this.genMergerForwardPayload(t)},u=this.getEngine().chat.createMergerMessage(a);s.push(this.sendMessage(u,n))}return Promise.all(s)}getOriginMessageList(e){return e.map((e=>e instanceof ee?e.getMessage():e))}sendForwardMessage(e,t,n){t=this.getOriginMessageList(t);const i=n||{},{needMerge:r=!1}=i,o=s(i,["needMerge"]);if(r)return this.sendMergerForwardMessage(e,t,o);const a=[];for(let n=0;n<e.length;n++){const{conversationID:s,type:i}=e[n],r={to:s.replace(`${i}`,""),conversationType:i};for(let e=0;e<t.length;e++){Reflect.set(r,"payload",t[e]);const n=this.getEngine().chat.createForwardMessage(r);a.push(this.sendMessage(n,o))}}return Promise.all(a)}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:n={}}=e.code;throw t===l.MSG_MODIFY_CONFLICT?console.warn(`${p.MSG_MODIFY_CONFLICT} data.message: ${null==n?void 0:n.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}});return t.chat.getMessageList(e).then((e=>{const{messageList:n,nextReqMessageID:s,isCompleted:i}=e.data;return this.readReceiptHandler.getMessageReadReceiptList(n).then((n=>(this.updateMessageList(n,"unshift"),t.TUIStore.update(a.CHAT,"nextReqMessageID",s),t.TUIStore.update(a.CHAT,"isCompleted",i),e.data.messageList=n,e)))})).catch((e=>Promise.reject(e)))}sendMessageReadReceipt(e){return this.readReceiptHandler.sendMessageReadReceipt(e)}getGroupMessageReadMemberList(e){return this.readReceiptHandler.getGroupMessageReadMemberList(e)}downloadMergedMessages(e){return this.getEngine().chat.downloadMergerMessage(e.getMessage())}translateText(e){return this.getEngine().chat.translateText(e)}}class jt extends Y{constructor(){super()}static getInstance(){return jt.instance||(jt.instance=new jt),jt.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 n=t.TUIStore.getData(a.GRP,"currentGroupID");e.forEach((e=>{e.groupID===n&&t.TUIStore.update(a.GRP,"currentGroup",e)}))}onGroupAttributesUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupID");let s=t.TUIStore.getData(a.GRP,"groupList");const{groupID:i,groupAttributes:r}=e;n===i&&t.TUIStore.update(a.GRP,"currentGroupAttributes",r),s=s.map((e=>(e.groupID===i&&(e.groupAttributes=r),e))),t.TUIStore.update(a.GRP,"groupList",s)}onGroupCounterUpdated(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupID"),s=t.TUIStore.getData(a.GRP,"currentGroupCounters")||{};let i=t.TUIStore.getData(a.GRP,"groupList");const{groupID:r,key:o,value:u}=e;n===r&&(s[o]=u,t.TUIStore.update(a.GRP,"currentGroupCounters",s)),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(),n=[];e.forEach((e=>{if(e.type===t.TYPES.MSG_GRP_TIP){const{payload:n}=e,{operationType:s,userIDList:i}=n,r=t.TUIStore.getData(a.GRP,"currentGroupID");switch(s){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&&n.push(e)})),n.length>0&&t.TUIStore.update(a.GRP,"groupSystemNoticeList",n)}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 n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:s}=n.data;this.updateMemberList(s)}}))}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(),n=t.TUIStore.getData(a.GRP,"currentGroupID");if(!e)return this.resetCurrentStore(),Promise.resolve({});if(n===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.getGroupProfile({groupID:e}),yield this.getGroupMemberList({groupID:e});const n=yield this.getGroupAttributes({groupID:e,keyList:[]}),{groupAttributes:s}=n.data;t.TUIStore.update(a.GRP,"currentGroupAttributes",s);const i=yield this.getGroupCounters({groupID:e,keyList:[]}),{counters:r}=i.data;t.TUIStore.update(a.GRP,"currentGroupCounters",r)}catch(e){Promise.reject(e)}const s=t.TUIStore.getData(a.GRP,"currentGroup");return Promise.resolve(s)}))}getGroupProfile(e){const t=this.getEngine();return t.chat.getGroupProfile(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{group:e}=n.data;t.TUIStore.update(a.GRP,"currentGroup",e)}return n}))))}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){return this.getEngine().chat.searchGroupByID(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(),n=[...(t.TUIStore.getData(a.GRP,"currentGroupMemberList")||[]).filter((t=>!e.find((e=>e.userID===t.userID)))),...e];t.TUIStore.update(a.GRP,"currentGroupMemberList",n)}addMemberList(e){return i(this,void 0,void 0,(function*(){const t=this.getEngine().TUIStore.getData(a.GRP,"currentGroupID");if(t)try{const n=yield this.getGroupMemberProfile({groupID:t,userIDList:e}),{memberList:s}=n.data;this.updateMemberList(s)}catch(t){const n=e.map((e=>({userID:e,avatar:"",nick:"",role:"",joinTime:0,nameCard:"",muteUntil:0,memberCustomField:[]})));this.updateMemberList(n)}}))}removeMemberList(e){const t=this.getEngine(),n=t.TUIStore.getData(a.GRP,"currentGroupMemberList").filter((t=>-1===e.indexOf(t.userID)));t.TUIStore.update(a.GRP,"currentGroupMemberList",n)}getGroupMemberList(e){const t=this.getEngine();return t.chat.getGroupMemberList(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{memberList:e}=n.data;this.updateMemberList(e)}return n}))))}getGroupMemberProfile(e){return this.getEngine().chat.getGroupMemberProfile(e)}addGroupMember(e){const t=this.getEngine();return t.chat.addGroupMember(e).then((n=>i(this,void 0,void 0,(function*(){if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{successUserIDList:e,group:s}=n.data;t.TUIStore.update(a.GRP,"currentGroup",s),this.addMemberList(e)}return n}))))}deleteGroupMember(e){const t=this.getEngine();return t.chat.deleteGroupMember(e).then((n=>{if(t.TUIStore.getData(a.GRP,"currentGroupID")===e.groupID){const{userIDList:e,group:s}=n.data;this.removeMemberList(e),t.TUIStore.update(a.GRP,"currentGroup",s)}return n}))}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 Nt extends Y{constructor(){super()}static getInstance(){return Nt.instance||(Nt.instance=new Nt),Nt.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:n=0}=e,s=this.getEngine();s.TUIStore.update(a.FRIEND,"friendApplicationList",t),s.TUIStore.update(a.FRIEND,"friendApplicationUnreadCount",n)}getFriendList(){return this.getEngine().chat.getFriendList()}getFriendRemark(e){const t=this.getEngine().TUIStore.getData(a.FRIEND,"friendList"),n={};return e.forEach((e=>{for(let s=0;s<t.length;s++)t[s].userID!==e||(n[e]=t[s].remark)})),n}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 At{constructor(){this.cache=[],this.middlewares=[],this.options=null}use(e){if("function"!=typeof e)throw"middleware must be a function";return 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 Lt(e,t,n){const s=Object.create(null);Object.keys(n).forEach((n=>{if(!t[n])return;s[n]=t[n];const i=new At;t[n]=function(){const r=Array.from(arguments);return i.use((function(t,s){return e.isInited?s():Promise.reject({code:h.NOT_INIT,message:`${n} | ${d.NOT_INIT}`})})).use((function(e,i){return s[n].apply(t,e)})),i.run(r)}}))}console.log("TUIChatEngine.VERSION:0.0.8");const kt=M.getInstance(),wt=$.getInstance(),Vt=oe.getInstance(),$t=Tt.getInstance(),Ft=St.getInstance(),Yt=Ct.getInstance(),Ht=Gt.getInstance(),Bt=jt.getInstance(),Kt=Nt.getInstance();kt.mount(o.TUIGlobal,wt),kt.mount(o.TUIStore,Vt),kt.mount(o.TUITranslate,$t),kt.mount(o.TUIConversation,Ft),kt.mount(o.TUIUser,Yt),kt.mount(o.TUIChat,Ht),kt.mount(o.TUIGroup,Bt),kt.mount(o.TUIFriend,Kt),Lt(kt,kt,f),Lt(kt,Ft,m),Lt(kt,Ht,v),Lt(kt,Bt,E),Lt(kt,Yt,y),Lt(kt,Kt,T);export{a as StoreName,Ht as TUIChatService,Ft as TUIConversationService,Kt as TUIFriendService,wt as TUIGlobal,Bt as TUIGroupService,Vt as TUIStore,$t as TUITranslateService,Yt as TUIUserService,kt as default};
|