@rongcloud/imlib-next 5.1.0-rtc-roompk.1 → 5.1.2-alpha.1

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { LogLevel, MessageDirection, IReadReceiptInfo, IPushConfig, IPluginGenerator, IAsyncRes, ConnectionStatus, IEventListener, NotificationStatus, IConversationOption, ConversationType, IBaseConversationInfo, IChatroomInfo, IChatRoomEntry, IChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatRoomEntries, MentionedType, ErrorCode, IUserProfile, IMessageReaderResponse, IReceivedMessage, IReceivedConversation, ITagParam, ITagInfo, IConversationTag, IReceivedConversationByTag, FileType, IUploadAuth, UploadMethod } from '@rongcloud/engine';
2
- export { ConnectionStatus, ConversationType, ErrorCode, IBlockedMessageInfo, IChatRoomEntries, IChatRoomEntry, IChatroomListenerData, IConversationOption, IDeletedExpansion, IExpansionListenerData, IPluginGenerator, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IUpdatedExpansion, LogLevel, MentionedType, MessageBlockType, MessageDirection, NotificationStatus, ReceivedStatus, UploadMethod } from '@rongcloud/engine';
1
+ import { LogLevel, MessageDirection, IReadReceiptInfo, IPushConfig, IPluginGenerator, IAsyncRes, ConnectionStatus, IEventListener, NotificationStatus, IConversationOption, ConversationType, ErrorCode, IBaseConversationInfo, IConversationState, IChatroomInfo, IChatRoomEntry, IChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatRoomEntries, MentionedType, IUserProfile, IMessageReaderResponse, IReceivedMessage, IReceivedConversation, ITagParam, ITagInfo, IConversationTag, IReceivedConversationByTag, FileType, IUploadAuth, UploadMethod } from '@rongcloud/engine';
2
+ export { ConnectionStatus, ConversationType, ErrorCode, IBlockedMessageInfo, IChatRoomEntries, IChatRoomEntry, IChatroomListenerData, IConversationOption, IConversationState, IDeletedExpansion, IExpansionListenerData, IPluginGenerator, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IUpdatedExpansion, LogLevel, MentionedType, MessageBlockType, MessageDirection, NotificationStatus, ReceivedStatus, UploadMethod } from '@rongcloud/engine';
3
3
 
4
4
  declare type IInitOption = {
5
5
  /**
@@ -178,8 +178,10 @@ declare const init: (initOption: IInitOption) => void;
178
178
  declare function installPlugin<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
179
179
  /**
180
180
  * 建立 IM 连接
181
+ * @param token
182
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
181
183
  */
182
- declare function connect(token: string): Promise<IAsyncRes<{
184
+ declare function connect(token: string, reconnectKickEnable?: boolean): Promise<IAsyncRes<{
183
185
  userId: string;
184
186
  }>>;
185
187
  /**
@@ -217,6 +219,7 @@ declare function removeEventListeners(eventType: string): void;
217
219
  * 清理所有事件
218
220
  */
219
221
  declare function clearEventListeners(): void;
222
+ declare function __addSDKVersion(name: string, version: string): void;
220
223
 
221
224
  interface IConversationUpdateItem {
222
225
  time: number;
@@ -336,10 +339,12 @@ interface ISendMessageOptions {
336
339
  /**
337
340
  * `@` 消息类型
338
341
  * @description `1: @ 所有人 2: @ 指定用户`
342
+ * @deprecated 推荐使用 content.mentionedInfo.type
339
343
  */
340
344
  mentionedType?: 1 | 2;
341
345
  /**
342
346
  * 被 @ 的用户 Id 列表,当 `mentionedType` 值为 `1` 时,该值可为空
347
+ * @deprecated 推荐使用 content.mentionedInfo.userIdList
343
348
  */
344
349
  mentionedUserIdList?: string[];
345
350
  /**
@@ -369,10 +374,6 @@ interface ISendMessageOptions {
369
374
  * 移动端推送配置
370
375
  */
371
376
  pushConfig?: IPushConfig;
372
- /**
373
- * 消息的客户端标识
374
- */
375
- messageId?: string;
376
377
  }
377
378
  interface IInsertOptions {
378
379
  /**
@@ -415,6 +416,15 @@ interface IExtraData {
415
416
  */
416
417
  extra?: string;
417
418
  }
419
+ /**
420
+ * 缩略图配置
421
+ */
422
+ interface IThumbnailConfig {
423
+ maxHeight?: number;
424
+ maxWidth?: number;
425
+ quality?: number;
426
+ scale?: number;
427
+ }
418
428
 
419
429
  /**
420
430
  * 获取会话列表
@@ -482,6 +492,11 @@ declare function getUnreadCount(options: IConversationOption): Promise<IAsyncRes
482
492
  * 原:clearUnreadCount
483
493
  */
484
494
  declare function clearMessagesUnreadStatus(options: IConversationOption): Promise<IAsyncRes<number>>;
495
+ /**
496
+ * 清理全部未读数
497
+ * @returns
498
+ */
499
+ declare function clearAllMessagesUnreadStatus(): Promise<IAsyncRes<ErrorCode>>;
485
500
  /**
486
501
  * 设置会话免打扰
487
502
  * 原: setConversationStatus,免打扰和置顶一体的
@@ -517,6 +532,10 @@ declare function getUnreadMentionedCount(options: IConversationOption): Promise<
517
532
  * 获取所有群会话 @ 消息未读数
518
533
  */
519
534
  declare function getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
535
+ /**
536
+ * 获取本地全部会话的状态
537
+ */
538
+ declare function getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
520
539
 
521
540
  /**
522
541
  * 加入聊天室
@@ -829,6 +848,7 @@ declare function sendTextMessage(conversation: IConversationOption, messageBody:
829
848
  declare type ISendBody = IUserInfo & IExtraData & {
830
849
  file: Blob;
831
850
  };
851
+ declare type ISendFileMessageOptions = ISendBody;
832
852
  /**
833
853
  * 发送文件消息
834
854
  */
@@ -844,6 +864,7 @@ declare const sendFileMessage: (conversation: IConversationOption, msgBody: ISen
844
864
  url: string;
845
865
  }) => (void | BaseMessage)) | undefined;
846
866
  } | undefined, sendOptions?: ISendMessageOptions | undefined) => Promise<IAsyncRes<IAReceivedMessage>>;
867
+ declare type ISendImageMessageOptions = ISendBody;
847
868
  /**
848
869
  * 发送图片消息
849
870
  */
@@ -858,7 +879,9 @@ declare const sendImageMessage: (conversation: IConversationOption, msgBody: ISe
858
879
  onComplete?: ((fileInfo: {
859
880
  url: string;
860
881
  }) => (void | BaseMessage)) | undefined;
861
- } | undefined, sendOptions?: ISendMessageOptions | undefined) => Promise<IAsyncRes<IAReceivedMessage>>;
882
+ } | undefined, sendOptions?: ({
883
+ thumbnailConfig?: IThumbnailConfig | undefined;
884
+ } & ISendMessageOptions) | undefined) => Promise<IAsyncRes<IAReceivedMessage>>;
862
885
  /**
863
886
  * 发送高清语音消息,待发送的文件必须为 AAC 音频文件
864
887
  */
@@ -913,9 +936,18 @@ declare function sendReadReceiptMessage(targetId: string, messageUId: string, ti
913
936
  */
914
937
  declare function sendReadReceiptRequest(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<void>>;
915
938
  /**
916
- * 发送群阅读回执响应
939
+ * @deprecated 已废弃,请使用 sendReadReceiptResponseV2
917
940
  */
918
941
  declare function sendReadReceiptResponse(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes<void>>;
942
+ /**
943
+ * 发送群阅读回执响应V2
944
+ * @param targetId 群组Id
945
+ * @param messageList 要回执的消息列表,结构为: {senderUserId: [messageUId1, messageUId2]}
946
+ * @param channelId
947
+ */
948
+ declare function sendReadReceiptResponseV2(targetId: string, messageList: {
949
+ [senderUserId: string]: string[];
950
+ }, channelId?: string): Promise<IAsyncRes<void>>;
919
951
  /**
920
952
  * 多端同步阅读状态
921
953
  * @param conversation
@@ -1014,7 +1046,7 @@ declare function getMessageReader(targetId: string, messageUId: string, channelI
1014
1046
  * @param isCounted 是否计数
1015
1047
  * @param prototypes 消息属性名称
1016
1048
  */
1017
- declare function registerMessageType<T>(messageType: string, isPersited: boolean, isCounted: boolean, prototypes?: string[]): new (content: T) => BaseMessage<T>;
1049
+ declare function registerMessageType<T>(messageType: string, isPersited: boolean, isCounted: boolean, prototypes?: string[], isStatusMessage?: boolean): new (content: T) => BaseMessage<T>;
1018
1050
  /**
1019
1051
  * 获取第一条未读消息
1020
1052
  * @param conversation
@@ -1229,4 +1261,4 @@ declare const MessageType: {
1229
1261
  RECALL_MESSAGE_TYPE: string;
1230
1262
  };
1231
1263
 
1232
- export { BaseMessage, _default$6 as CombineMessage, ConnectType, Events, _default$5 as FileMessage, _default$4 as GIFMessage, GetHistoryMessageOption, GetHistoryMessageResult, _default$9 as HQVoiceMessage, IAReceivedConversation, IAReceivedMessage, ICombineMessageBody, IConversationUpdateItem, IFileMessageBody, IGIFMessageBody, IHQVoiceMessageBody, IImageMessageBody, IInitOption, ILocationMessageBody, IReceivedUpdateConversation, IReferenceMessageBody, IRichContentMessageBody, ISendMessageOptions, ISightMessageBody, ITextMessageBody, IVoiceMessageBody, _default$a as ImageMessage, _default$2 as LocationMessage, MentionedInfo$1 as MentionedInfo, MessageConstructor, MessageType, _default$1 as ReferenceMessage, _default as RichContentMessage, _default$8 as SightMessage, _default$7 as TextMessage, _default$3 as VoiceMessage, addConversationsToTag, addEventListener, addTag, clearEventListeners, clearHistoryMessages, clearMessages, clearMessagesUnreadStatus, clearTextMessageDraft, clearUnreadCountByTimestamp, connect, deleteLocalMessagesByTimestamp, deleteMessages, disconnect, forceRemoveChatRoomEntry, forceSetChatRoomEntry, getAllChatRoomEntries, getAllUnreadMentionedCount, getBlockedConversationList, getChatRoomEntry, getChatRoomInfo, getChatroomHistoryMessages, getConnectionStatus, getConversationList, getConversationNotificationStatus, getConversationsFromTagByPage, getCurrentUserId, getFileToken, getFileUrl, getFirstUnreadMessage, getHistoryMessages, getMessage, getMessageReader, getRemoteHistoryMessages, getServerTime, getTags, getTagsFromConversation, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadCountByTag, getUnreadMentionedCount, getUnreadMentionedMessages, init, insertMessage, installPlugin, joinChatRoom, joinExistChatRoom, onceEventListener, quitChatRoom, recallMessage, registerMessageType, removeChatRoomEntries, removeChatRoomEntry, removeConversation, removeConversationsFromTag, removeEventListener, removeEventListeners, removeMessageExpansionForKey, removeTag, removeTagFromConversations, removeTagsFromConversation, saveTextMessageDraft, searchConversationByContent, searchMessages, sendFileMessage, sendHQVoiceMessage, sendImageMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendSightMessage, sendSyncReadStatusMessage, sendTextMessage, sendTypingStatusMessage, setChatRoomEntries, setChatRoomEntry, setConversationNotificationStatus, setConversationToTop, setConversationToTopInTag, setMessageReceivedStatus, updateMessageExpansion, updateTag };
1264
+ export { BaseMessage, _default$6 as CombineMessage, ConnectType, Events, _default$5 as FileMessage, _default$4 as GIFMessage, GetHistoryMessageOption, GetHistoryMessageResult, _default$9 as HQVoiceMessage, IAReceivedConversation, IAReceivedMessage, ICombineMessageBody, IConversationUpdateItem, IFileMessageBody, IGIFMessageBody, IHQVoiceMessageBody, IImageMessageBody, IInitOption, ILocationMessageBody, IReceivedUpdateConversation, IReferenceMessageBody, IRichContentMessageBody, ISendFileMessageOptions, ISendImageMessageOptions, ISendMessageOptions, ISightMessageBody, ITextMessageBody, IVoiceMessageBody, _default$a as ImageMessage, _default$2 as LocationMessage, MentionedInfo$1 as MentionedInfo, MessageConstructor, MessageType, _default$1 as ReferenceMessage, _default as RichContentMessage, _default$8 as SightMessage, _default$7 as TextMessage, _default$3 as VoiceMessage, __addSDKVersion, addConversationsToTag, addEventListener, addTag, clearAllMessagesUnreadStatus, clearEventListeners, clearHistoryMessages, clearMessages, clearMessagesUnreadStatus, clearTextMessageDraft, clearUnreadCountByTimestamp, connect, deleteLocalMessagesByTimestamp, deleteMessages, disconnect, forceRemoveChatRoomEntry, forceSetChatRoomEntry, getAllChatRoomEntries, getAllConversationState, getAllUnreadMentionedCount, getBlockedConversationList, getChatRoomEntry, getChatRoomInfo, getChatroomHistoryMessages, getConnectionStatus, getConversationList, getConversationNotificationStatus, getConversationsFromTagByPage, getCurrentUserId, getFileToken, getFileUrl, getFirstUnreadMessage, getHistoryMessages, getMessage, getMessageReader, getRemoteHistoryMessages, getServerTime, getTags, getTagsFromConversation, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadCountByTag, getUnreadMentionedCount, getUnreadMentionedMessages, init, insertMessage, installPlugin, joinChatRoom, joinExistChatRoom, onceEventListener, quitChatRoom, recallMessage, registerMessageType, removeChatRoomEntries, removeChatRoomEntry, removeConversation, removeConversationsFromTag, removeEventListener, removeEventListeners, removeMessageExpansionForKey, removeTag, removeTagFromConversations, removeTagsFromConversation, saveTextMessageDraft, searchConversationByContent, searchMessages, sendFileMessage, sendHQVoiceMessage, sendImageMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendReadReceiptResponseV2, sendSightMessage, sendSyncReadStatusMessage, sendTextMessage, sendTypingStatusMessage, setChatRoomEntries, setChatRoomEntry, setConversationNotificationStatus, setConversationToTop, setConversationToTopInTag, setMessageReceivedStatus, updateMessageExpansion, updateTag };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import{Logger as e,WebSocketChannel as t,CometChannel as n,HttpMethod as o,appendUrl as a,ErrorCode as r,ReceivedStatus as i,assert as s,isArray as c,isHttpUrl as d,CONNECTION_TYPE as u,APIContext as l,EventEmitter as g,AssertRules as f,isValidConversationType as m,usingCppEngine as p,isString as h,UploadMethod as v,FileType as I,isValidFileType as S,MessageDirection as C,ConversationType as T,VersionManage as E}from"@rongcloud/engine";export{ConnectionStatus,ConversationType,ErrorCode,LogLevel,MentionedType,MessageBlockType,MessageDirection,NotificationStatus,ReceivedStatus,UploadMethod}from"@rongcloud/engine";
1
+ import{Logger as e,WebSocketChannel as t,CometChannel as n,HttpMethod as o,appendUrl as a,ErrorCode as r,ReceivedStatus as i,assert as s,isArray as c,isHttpUrl as u,CONNECTION_TYPE as d,APIContext as l,EventEmitter as g,VersionManage as f,AssertRules as m,isValidConversationType as h,isString as p,UploadMethod as v,FileType as I,isValidFileType as S,usingCppEngine as C,MessageDirection as T,ConversationType as E}from"@rongcloud/engine";export{ConnectionStatus,ConversationType,ErrorCode,LogLevel,MentionedType,MessageBlockType,MessageDirection,NotificationStatus,ReceivedStatus,UploadMethod}from"@rongcloud/engine";
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,4 +12,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var y=function(e,t){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},y(e,t)};function N(e,t,n,o){return new(n||(n=Promise))((function(a,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function R(e,t){var n,o,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return i.label++,{value:r[1],done:!1};case 5:i.label++,o=r[1],r=[0];continue;case 7:r=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){i=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){i.label=r[1];break}if(6===r[0]&&i.label<a[1]){i.label=a[1],a=r;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(r);break}a[2]&&i.ops.pop(),i.trys.pop();continue}r=t.call(e,i)}catch(e){r=[6,e],o=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}var O=new e("RCIM"),w=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},M=w();var _,U={tag:"browser",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,r=e.headers,i=e.query,s=e.body,c=a(e.url,i);return new Promise((function(e){var o,a=(o="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&o?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,c),r&&a.setRequestHeader)for(var d in r)a.setRequestHeader(d,r[d]);if(i){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var u="object"==typeof s?JSON.stringify(s):s;a.send(u)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(s)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||O.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:M,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,o){return this.isSupportSocket()&&"websocket"===o?new t(this,e):new n(this,e)}},x=w(),b=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){O.error(e)}}},A={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},P={tag:"wechat",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s);return new Promise((function(e){wx.request({url:d,method:t,headers:i,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:A,sessionStorage:A,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:x,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},L=w(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){O.error(e)}}},k={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},H={tag:"alipay",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:t,headers:i,timeout:n,data:c,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:k,sessionStorage:k,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},G=w(),B=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){O.error(e)}}},q={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},F={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,localStorage:q,sessionStorage:q,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},V=w(),z=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){O.error(e)}}},K={setItem:z("setStorageSync"),getItem:z("getStorageSync"),removeItem:z("removeStorageSync"),clear:z("clearStorageSync")},X={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,localStorage:K,sessionStorage:K,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},j=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){O.error(e)}}},W={setItem:j("setStorageSync"),getItem:j("getStorageSync"),removeItem:j("removeStorageSync"),clear:j("clearStorageSync")},J={tag:"uniapp",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s);return new Promise((function(e){uni.request({url:d,method:t,headers:i,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:W,sessionStorage:W,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},Y=function(e){return e&&e.canIUse&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return J;case"mp-baidu":return X;case"mp-toutiao":return F;case"mp-alipay":return H;case"mp-weixin":return P;default:return U}}():"undefined"!=typeof wx&&Y(wx)?P:"undefined"!=typeof my&&Y(my)?H:"undefined"!=typeof tt&&Y(tt)?F:"undefined"!=typeof swan&&Y(swan)?X:U;function $(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,s=e.targetId,c=e.sentTime,d=e.receivedTime,u=e.messageUId,l=e.messageDirection,g=e.isPersited,f=e.isCounted,m=e.isOffLineMessage,p=e.canIncludeExpansion,h=e.expansion,v=e.receivedStatus,I=e.disableNotification,S=e.isMentioned,C=e.isStatusMessage,T=e.readReceiptInfo,E=e.pushConfig,y=e.messageId;return v||(v=i.UNREAD),{messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:s,conversationType:t,sentTime:c,receivedTime:d,messageUId:u,messageDirection:l,isPersited:g,isCounted:f,isOffLineMessage:m,isMentioned:S,disableNotification:I,isStatusMessage:C,canIncludeExpansion:p,expansion:h,receivedStatus:v,readReceiptInfo:T,pushConfig:E,messageId:y}}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED"}(_||(_={}));var Z,ee=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return O.error("Please do not repeatedly perform the init method"),t.imClient;s("options.navigators",n.navigators,(function(e){return c(e)&&(0===e.length||e.every(d))}));var a=null==n?void 0:n.connectType;return a?u.WEBSOCKET!==a&&u.COMET!==a&&(O.warn("RongIMLib connectionType must be "+u.WEBSOCKET+" or "+u.COMET),a=u.WEBSOCKET):a=u.WEBSOCKET,o._context=l.init(Q,{appkey:n.appkey,apiVersion:"5.1.0-rtc-roompk.1",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:a,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),o.watch(),t.imClient=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(_.CONNECTING)},onConnected:function(){e.emit(_.CONNECTED)},onDisconnect:function(){e.emit(_.DISCONNECT)},onSuspend:function(){e.emit(_.SUSPEND)},batchMessage:function(t){e.emit(_.MESSAGES,{messages:t.map((function(e){return $(e)}))})},typingState:function(t){e.emit(_.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(_.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n){e.emit(_.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n})},messageReceiptResponse:function(t,n,o){e.emit(_.MESSAGE_RECEIPT_RESPONSE,{conversation:t,messageUId:n,responseUserIdList:o})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?$(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(_.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(_.CHATROOM,t)},expansion:function(t){e.emit(_.EXPANSION,t)},pullFinished:function(){e.emit(_.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(_.TAG)},conversationTagChanged:function(){e.emit(_.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(_.MESSAGE_BLOCKED,t)}};this.context.assignWatcher(t)},t}(g),te={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:r.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},ne={},oe={};for(var ae in te){var re=te[ae],ie=re.code;ne[ie]=ae,oe[ie]=re}te.ROAMING_SERVICE_UNAVAILABLE.code;var se=function(e){Z=Z||new ee(e)};function ce(e,t){return null==Z?void 0:Z.context.install(e,t)}function de(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return s("token",e,f.STRING,!0),O.warn("RongIMLib Version: 5.1.0-rtc-roompk.1, Commit: 3ee8bc4adaca082cd4cfb71ab8b88841c49bc991"),[4,Z.context.connect(e,!0)];case 1:return(t=n.sent()).code===r.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:ne[t.code]}]}}))}))}function ue(){return Z.context.disconnect()}function le(){return Z.context.getConnectionStatus()}function ge(){return Z.context.getServerTime()}function fe(){return Z.context.getCurrentUserId()}function me(e,t,n){Z.on(e,t,n)}function pe(e,t,n){Z.once(e,t,n)}function he(e,t,n){Z.off(e,t,n)}function ve(e){Z.removeAll(e)}function Ie(){Z.clear()}function Se(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i;return R(this,(function(s){switch(s.label){case 0:return O.debug("get conversation list ->"),[4,ee.imClient.context.getConversationList(null==e?void 0:e.count,void 0,null==e?void 0:e.startTime,null==e?void 0:e.order,t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?(i=a.map((function(e){return function(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,a=e.unreadMessageCount,r=e.hasMentioned,i=e.mentionedInfo,s=e.lastUnreadTime,c=e.notificationStatus,d=e.isTop,u=e.channelId,l=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&$(o),unreadMessageCount:a,hasMentioned:r,mentionedInfo:r?{type:null==i?void 0:i.type,userIdList:null==i?void 0:i.userIdList}:void 0,lastUnreadTime:s,notificationStatus:c,isTop:d,channelId:u,unreadMentionedCount:l}}(e)})),[2,{code:0,data:i}]):(O.warn("get conversation list fail ->"+o+":"+ne[o]),[2,{code:o,msg:ne[o]}])}}))}))}function Ce(e){return N(this,void 0,void 0,(function(){var t,n;return R(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("destroy conversation ->"+n),t!==r.SUCCESS?(O.warn("destroy conversation fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function Te(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return R(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(O.warn("get draft fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function Ee(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),s("draft",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set draft ->"+n),[4,ee.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("set draft fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}])}}))}))}function ye(e){return N(this,void 0,void 0,(function(){var t,n;return R(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete draft ->"+t),[4,ee.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("delete draft fail ->"+n+":"+ne[n]+","+t),[2,{code:n,msg:ne[n]}])}}))}))}function Ne(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c,d;return R(this,(function(u){switch(u.label){case 0:if(O.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),s("includeMuted",e,f.BOOLEAN,!1),s("conversationTypes",t,f.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],s("conversationType",a,m);return[4,ee.imClient.context.getTotalUnreadCount("",t,e)];case 1:return i=u.sent(),c=i.code,d=i.data,c===r.SUCCESS?[2,{code:c,data:d}]:(O.warn("getTotalUnreadCount fail ->"+c+":"+ne[c]),[2,{code:c,msg:ne[c]}])}}))}))}function Re(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return R(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("get unreadCount fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function Oe(e){return N(this,void 0,void 0,(function(){var t,n;return R(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(O.warn("clear unreadMsgNum fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function we(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),s("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Me(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return p()?(s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),O.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function _e(){return N(this,void 0,void 0,(function(){var e,t,n;return R(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function Ue(e,t){return void 0===t&&(t=!0),N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.type",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function xe(){return N(this,void 0,void 0,(function(){var e,t,n;return R(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function be(e){return N(this,void 0,void 0,(function(){return R(this,(function(t){return s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),O.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,ee.imClient.context.getUnreadMentionedCount(e)]}))}))}function Ae(){return N(this,void 0,void 0,(function(){return R(this,(function(e){return O.debug("getAllUnreadMentionedCount"),[2,ee.imClient.context.getAllUnreadMentionedCount()]}))}))}var Pe=function(e){s("options.key",e.key,f.STRING,!0),s("options.value",e.value,f.STRING,!0),s("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),s("options.isSendNotification",e.isSendNotification,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)},Le=function(e){s("options.key",e.key,f.STRING,!0),s("options.isSendNotification",e.isSendNotification,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)};function De(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,f.NUMBER,!0),n="id:"+e,O.debug("join chatroom ->"+n),[4,ee.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join chatroom fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function ke(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,f.NUMBER,!0),n="id:"+e,O.debug("join exist chatroom ->"+n),[4,ee.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join exist chatroom fail ->code:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function He(e){return N(this,void 0,void 0,(function(){var t,n;return R(this,(function(o){switch(o.label){case 0:return t="id:"+e,O.debug("quit chatroom ->"+t),[4,ee.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(O.warn("quit chatroom fail ->code+:"+ne[n]+","+t),[2,{code:n,msg:ne[n]}]):[2,{code:n}]}}))}))}function Ge(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i;return R(this,(function(c){switch(c.label){case 0:return s("options.count",t.count,f.NUMBER),s("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,O.debug("get chatroom info ->"+n),[4,ee.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(O.warn("get chatroom info fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Be(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Pe(t),n="id:"+e,O.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function qe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i;return R(this,(function(c){switch(c.label){case 0:return s("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){s("entry.key",e.key,f.STRING,!0),s("entry.value",e.value,f.STRING,!0)})),s("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)}(t),t.entries.length>10?[2,te.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,O.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntries(e,t)]);case 1:return o=c.sent(),a=o.code,i=o.data,a!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a],data:i}]):[2,{code:a}]}}))}))}function Fe(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Pe(t),n="id:"+e,O.debug("force set chatroom entry ->"+n),[4,ee.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Ve(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Le(t),n="id:"+e,O.debug("remove chatroom entry->"+n),[4,ee.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function ze(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){s("key",e,f.STRING,!0)})),s("options.notificationExtra",e.notificationExtra,f.STRING)}(t),n="id:"+e,O.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,ee.imClient.context.removeChatroomEntries(e,o)];case 1:return a=d.sent(),i=a.code,c=a.data,i!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+ne[i]+","+n),[2,{code:i,msg:ne[i],data:c}]):[2,{code:i}]}}))}))}function Ke(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Le(t),n="id:"+e,O.debug("force remove chatroom entry ->"+n),[4,ee.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Xe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i;return R(this,(function(c){switch(c.label){case 0:return s("key",t,(function(e){return h(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,O.debug("get chatroom entry->"+n),[4,ee.imClient.context.getChatroomEntry(e,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(O.warn("get chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function je(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return R(this,(function(i){switch(i.label){case 0:return t="id:"+e,O.debug("get all chatroom entries->"+t),[4,ee.imClient.context.getAllChatroomEntries(e)];case 1:return n=i.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?[2,{code:o,data:a}]:(O.warn("get all chatroom entries fail ->code+:"+ne[o]+","+t),[2,{code:o,msg:ne[o]}])}}))}))}function We(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("options.timestamp",t.timestamp,f.NUMBER),s("options.count",t.count,f.NUMBER),s("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,O.debug("get chatroom history message->"+n),[4,ee.imClient.context.getChatRoomHistoryMessages(e,t.count,t.order,t.timestamp)];case 1:return o=d.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:!!i.hasMore}}]):(O.warn("get chatroom history message fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}var Je=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function Ye(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new Je(e,o,t,n)}}var Qe,$e,Ze=Ye("RC:ImgMsg"),et=Ye("RC:HQVCMsg"),nt=Ye("RC:SightMsg"),ot=Ye("RC:TxtMsg"),at=Ye("RC:CombineMsg"),rt=Ye("RC:FileMsg"),it=Ye("RC:GIFMsg"),st=Ye("RC:VcMsg"),ct=Ye("RC:LBSMsg"),dt=Ye("RC:ReferenceMsg"),ut=Ye("RC:ImgTextMsg"),lt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=pt()+gt[0][1]||r,gt.shift();var i=new XMLHttpRequest;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var a=i.responseText||"{}";(a=JSON.parse(a)).filename=t.uniqueValue,a.uploadMethod=v?v.QINIU:"",200===i.status?n.onCompleted(a):gt.length?lt[gt[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";mt(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n);return e}(a+="/mkblk/"+e.size,t.multi_parmas));i.open(t.method,a,!0),n.onOpen(i),t.stream&&i.setRequestHeader("authorization","UpToken "+t.multi_parmas.token);mt(t.headers,(function(e,t){i.setRequestHeader(e,t)})),i.send(e)},baidu:function(e,t,n,o){if(console.log(o,t),o.size>ft)throw new Error("the file size is over 5GB!");var a=t||{};t=t||$e;var r=new XMLHttpRequest,i=pt();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var s=i+gt[0][1]+a.bosUploadPath;gt.shift();var c=a.bosHeader||{},d={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:s,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).filename=t.uniqueValue,200===r.status){n.onCompleted(d,!0)}else gt.length?lt[gt[0][0]](e,t,n,o):n.onError("upload fail")}},r.open(t.method,s,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(e,t,n,o){if(o.size>ft)throw new Error("the file size is over 5GB!");const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token"));const r=gt[0][1];gt.shift(),e=e||Qe,t=(t=t||{})||$e;var i=new XMLHttpRequest,s=pt()+t.ossBucketName+"."+r;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var e=i.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=v?v.ALI:"",200===i.status?n.onCompleted(e):gt.length?lt[gt[0][0]](a,t,n,o):n.onError("upload fail")}},i.open(t.method,s,!0),console.log("ali:url",s);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",o),i.send(e)},s3:function(e,t,n,o){var a=new FormData,r=new XMLHttpRequest,i=pt();const s=gt[0][1];var c=i+t.s3BucketName+"."+s;console.log("uploadS3:url",c),gt.shift(),r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).name=t.uniqueValue,a.filename=t.uploadFileName,a.uploadMethod=v.AWS,console.log("UploadMethod:",v),200===r.status||204===r.status)n.onCompleted(a);else if(gt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),lt[gt[0][0]](a,t,n,o)}else n.onError("upload fail")}},r.open(t.method,c,!0);var d=t?t.s3Header:{},u=o&&o.type;"text/html"===u?a.set("Content-Disposition","inline;"):a.set("Content-Disposition","attachment;");a.set("Content-Type",u),a.set("x-amz-credential",d.s3Credential),a.set("x-amz-algorithm",d.s3Algorithm),a.set("x-amz-date",d.s3Date),a.set("policy",d.s3Policy),a.set("x-amz-signature",d.s3Signature),a.set("key",t.uploadFileName),a.set("file",o),r.send(a)},stc:function(e,t,n,o){new FormData;var a=new XMLHttpRequest;pt();var r="https://"+gt[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;gt.shift(),a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=a.responseText||"{}";if((r=JSON.parse(r)).name=t.uniqueValue,r.filename=t.uploadFileName,r.uploadMethod=v?v.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(gt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),lt[gt[0][0]](a,t,n,o)}else n.onError("upload fail")}},a.open("PUT",r,!0);var i=t?t.stcHeader:{};a.setRequestHeader("Content-Type",o.type),"text/html"===o.type?a.setRequestHeader("Content-Disposition","inline;"):a.setRequestHeader("Content-Disposition","attachment;");a.setRequestHeader("Authorization",i.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",i.stcContentSha256),a.setRequestHeader("x-amz-date",i.stcDate),a.send(o)}},gt=[],ft=5368709120;function mt(e,t){for(var n in e)t(n,e[n])}function pt(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function ht(e,t,n){var o,a,r=e&&e.type||"text/plain",i=r.indexOf("image")>-1?1:4,s=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var d=c.find((e=>Object.keys(e).includes("stc"))),u="uploads";ee.imClient.getFileToken(i,o,"POST",u).then((function(e){o=e.fileName,a="https://"+d.stc+"/"+t.stcBucketName+"/"+o,console.log("uploadStcMultipart:url",a);var i=new XMLHttpRequest;i.open("POST",a+"?"+u,!0),"text/html"===r?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attacshment;"),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",r),i.send(),i.onreadystatechange=function(e){if(4===i.readyState){var t=i.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===i.status||204===i.status?function(e){for(var t=[],n=1;n<=s;n++)t.push(m(e,n));f(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],g=new Map;function f(c,d){d&&Array.isArray(d)&&0!==d.length&&Promise.all(d).then((()=>{var d="uploadId="+c;if(g.size===s)ee.imClient.context.getFileToken(i,o,"POST",d).then((function(o){console.log("onSuccess",o),console.log("onSuccess:uploadId",c);var i=new XMLHttpRequest;i.open("POST",a+"?"+d,!0),i.setRequestHeader("Authorization",o&&o.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",o&&o.stcContentSha256),i.setRequestHeader("x-amz-date",o&&o.stcDate),i.setRequestHeader("Content-Type",r);var s="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",u=Array.from(g.keys()||[]).sort(((e,t)=>e-t));console.log("keys",u),u.map((e=>{s+=`<Part><ETag>${g.get(e)}</ETag><PartNumber>${e}</PartNumber></Part>`})),s+="</CompleteMultipartUpload>",i.send(s),console.log("xml",s),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var o={};o.name=e.name,o.filename=t.uploadFileName,o.uploadMethod=v.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var u=[];for(var p of l)u.push(m(c,p));f(c,u)}}),(e=>{console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t=[];for(var o of l)t.push(m(c,o));f(c,t)}))}function m(n,s){return new Promise(((c,d)=>{var u="partNumber="+s+"&uploadId="+n;ee.imClient.context.getFileToken(i,o,"PUT",u).then((function(n){console.log("signature "+s+" onSuccess",n);var o=e&&e.slice((s-1)*t.stc_chunk_size,s*t.stc_chunk_size);console.log("fileChunk:size",o.size);var i=new XMLHttpRequest;i.open("PUT",a+"?"+u,!0),i.setRequestHeader("Authorization",n&&n.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),i.setRequestHeader("x-amz-date",n&&n.stcDate),i.setRequestHeader("Content-Type",r),i.send(o),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var e=i.getResponseHeader("etag");console.log("etag:"+s,e),g.set(s,e),c(e)}else l.includes(s)||l.push(s),d(s)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(s)||l.push(s),d(s)}))}))}}var vt={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=It()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),St(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=It()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,St(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function It(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function St(e,t){for(var n in e)t(n,e[n])}var Ct,Tt=0;function Et(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:vt.form,genUId:It};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;St(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(Qe=e,$e=t,gt=[],t.ossConfig){const e=JSON.parse(t.ossConfig);let n,o,a="";const r=[];e.forEach((e=>{const t=Number(e.p)-1;for(const i in e)"aliyun"===i&&(a=e[i]),"s3"===i&&(n=e[i]),"stc"===i&&(o=e[i]),"p"!==i&&(r[t]=[i,e[i]])})),r.forEach((function(e){e&&gt.push(e)})),e.length!==gt.length&&(gt=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else gt=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var o;if(t.ossConfig){var a=t&&JSON.parse(t.ossConfig);Array.isArray(a)||(a=[]),o=a.find((e=>Object.keys(e).includes("stc")))}if(o&&1===parseInt(o.p)&&e.size>=4194304)ht(e,t,n);else{var r=t.data(e,t);lt[gt[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Ct=e,o){Ct=Tt+e/n*(n-Tt)}else Tt=Ct;t.onProgress(Ct,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var yt={init:function(e){return new Et(e)},dataType:vt,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),a=new FileReader;a.readAsDataURL(e),a.onload=function(e){var a=e.target.result,r=new Image;r.src=a;var i=r.width,s=r.height,c=function(e,t){var n=1,o=e.width,a=t.maxWidth||0;a>0&&o>a&&(n=a/o);var r=e.height,i=t.maxHeight||0;if(i>0&&r>i){var s=i/r;n=Math.min(n,s)}var c=t.maxSize||0,d=Math.ceil(e.size/1e3);if(d>c){var u=c/d;n=Math.min(n,u)}return n}({width:i,height:s,size:e.total},t),d=a;c<1&&(d=function(e,t,n){o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n);var a="image/jpg";return o.toDataURL(a)}(r,i*c,s*c)),n(d)}}};const Nt=function(e,t,n){var o=document.createElement("canvas"),a=o.getContext("2d"),r=new Image;r.onload=function(){var i=function(e,t,n){var o,a,r,i=e<t,s=0,c=0;return(i?t/e:e/t)>n.scale?(i?(a=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,s=((a=e/(o=t/100))-n.maxWidth)/2),{w:a,h:r,x:-s,y:-c}):(i?(o=t/n.maxHeight,r=n.maxHeight,a=e/o):(o=e/n.maxWidth,a=n.maxWidth,r=t/o),{w:a,h:r,x:-s,y:-c})}(r.width,r.height,t);o.width=i.w>t.maxWidth?t.maxWidth:i.w,o.height=i.h>t.maxHeight?t.maxHeight:i.h,a.drawImage(r,i.x,i.y,i.w,i.h);try{var s=o.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");s=s.replace(c,""),n(s)}catch(e){throw new Error(e)}},r.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},Rt=function(e,t){var n=e.file,o=e.compress;Nt(n,o,t)},Ot=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",o);var a=yt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=yt.init(e);t(n)}};var wt,Mt,_t=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||Rt;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Ut=function(e){var t=this;this.instance=e,this.upload=function(e,n){_t({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},xt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};_t(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},bt=function(e,t){Ot(e,(function(n){var o={maxHeight:e.height||160,maxWidth:e.width||160,quality:e.quality||.5,scale:e.scale||2.4},a=new xt(n,o);t(a)}))},At=function(e,t){Ot(e,(function(e){var n=new Ut(e);t(n)}))},Pt=bt;yt.dataType;function Lt(e){return wt=wt||new AudioContext,new Promise((function(t,n){wt.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Dt(e,t,n,o){return new Promise((function(a){ee.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:ne[e]})}))}))}function kt(e,t,n,o,a){return s("fileType",e,S,!0),s("filename",t,f.STRING),s("saveName",n,f.STRING),s("serverType",a,f.NUMBER),new Promise((function(i){ee.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){i({code:r.SUCCESS,data:e})})).catch((function(e){i({code:e})}))}))}function Ht(e,t,n){return N(this,void 0,void 0,(function(){var o,a,c,d,u,l;return R(this,(function(g){switch(g.label){case 0:return n=n||{},t instanceof Je==!1?(O.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,te.ILLGAL_PARAMS]):(s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),o="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("send message ->"+o),(a=Object.assign(n,t)).channelId=e.channelId?e.channelId:a.channelId,[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,a)]);case 1:return c=g.sent(),d=c.code,u=c.data,d===r.SUCCESS?(l=$(u),[2,{code:d,data:l}]):(O.warn("send message fail ->"+d+":"+ne[d]+","+o),[2,{code:d,msg:ne[d],data:$({isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,senderUserId:ee.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:C.SEND,isOffLineMessage:!1,sentTime:(null==u?void 0:u.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD})}])}}))}))}function Gt(e,t,n){return Ht(e,new ot(t),n)}function Bt(e,t){return function(n,o,a,i){return new Promise((function(s){!function(e,t,n){var o,a=this;if(void 0===t&&(t=I.FILE),o=t===I.IMAGE?I.IMAGE:I.FILE,!Mt){Mt="upload.qiniup.com";var r=ee.imClient.context.getInfoFromCache();if(r&&r.ossConfig)try{var i=JSON.parse(r.ossConfig).find((function(e){return void 0!==e.qiniu}));i&&(Mt=i.qiniu)}catch(e){}}var s={domain:Mt,getToken:function(e){ee.imClient.context.getFileToken(o).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}};(o===I.IMAGE?Pt:At)(s,(function(r){r.upload(e,{onProgress:function(e,t){var o,a=Math.floor(e/t*100);null===(o=n.onProgress)||void 0===o||o.call(n,a)},onCompleted:function(r){return N(a,void 0,void 0,(function(){var a=this;return R(this,(function(i){return kt(o,r.filename,r.name,r,r.uploadMethod).then((function(i){return N(a,void 0,void 0,(function(){var a,s;return R(this,(function(c){return 0!==i.code?(n.onFail(i),[2]):((a=i.data).type=e.type,a.name=r.name||r.filename,t===I.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Lt).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):((s=new FileReader).onload=function(){s.result?Lt(s.result).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):n.onSuccess(a)},s.onerror=function(){a.duration=0,n.onSuccess(a)},s.readAsArrayBuffer(e)),[2]):(o===I.IMAGE&&(a.thumbnail=r.thumbnail),n.onSuccess(a),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(o.file,e,{onProgress:null==a?void 0:a.onProgress,onSuccess:function(e){var r,c=(null===(r=null==a?void 0:a.onComplete)||void 0===r?void 0:r.call(a,{url:e.downloadUrl}))||t(e,o);Ht(n,c,i).then(s)},onFail:function(e){s({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}})}))}}var qt=Bt(I.FILE,(function(e,t){return new rt({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),Ft=Bt(I.IMAGE,(function(e,t){return new Ze({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Vt=Bt(I.AUDIO,(function(e,t){return new et({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),zt=Bt(I.SIGHT,(function(e,t){return new nt({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));function Kt(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),s("options.count",null==t?void 0:t.count,f.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,ee.imClient.context.getHistoryMessage(e.conversationType,e.targetId,null==t?void 0:t.timestamp,null==t?void 0:t.count,null==t?void 0:t.order,null==e?void 0:e.channelId)];case 1:return o=d.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(O.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Xt(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),s("options.count",null==t?void 0:t.count,f.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,ee.imClient.context.getRemoteHistoryMessages(e.conversationType,e.targetId,(null==t?void 0:t.timestamp)||0,(null==t?void 0:t.count)||20,(null==t?void 0:t.order)||0,e.channelId||"")];case 1:return o=d.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(O.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function jt(e,t,n,o){return N(this,void 0,void 0,(function(){var a,r,i,s,c;return R(this,(function(d){switch(d.label){case 0:return a={targetId:e,conversationType:T.PRIVATE,channelId:o},r=new Je("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,Ht(a,r)];case 1:return i=d.sent(),s=i.code,c=i.msg,0===s?[2,{code:s}]:[2,{code:s,msg:c}]}}))}))}function Wt(e,t,n){return N(this,void 0,void 0,(function(){var o,a,r,i,c;return R(this,(function(d){switch(d.label){case 0:return s("messageUId",t,f.STRING,!0),s("channelId",n,f.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,O.debug("send read receipt message ->"+o),a=new Je("RC:RRReqMsg",{messageUId:t}),[4,Ht({targetId:e,conversationType:T.GROUP,channelId:n},a)];case 1:return r=d.sent(),i=r.code,c=r.msg,0===i?[2,{code:i}]:[2,{code:i,msg:c}]}}))}))}function Jt(e,t,n){return N(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g;return R(this,(function(m){switch(m.label){case 0:return s("targetId",e,f.STRING,!0),s("messageUIds",t,f.ARRAY,!0),s("channelId",n,f.CHANNEL_ID),o={targetId:e,conversationType:T.GROUP,channelId:n},i=ee.imClient.context.getInfoFromCache(),0!==(c=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(d=ee.imClient.context.getCurrentUserId(),u=new Je("RC:RRRspMsg",{receiptMessageDic:(g={},g[d]=t,g)}),[4,Ht(o,u)]);case 1:return a=m.sent(),[3,4];case 2:return 1!==c?[3,4]:[4,ee.imClient.context.sendReadReceiptMessage(e,t,n)];case 3:a=m.sent(),m.label=4;case 4:return(l=a.code)===r.SUCCESS?[2,{code:l}]:(O.warn("send read receipt message fail ->"+l+":"+ne[l]),[2,{code:l,msg:ne[l]}])}}))}))}function Yt(e,t){return N(this,void 0,void 0,(function(){var n,o,a,r;return R(this,(function(i){switch(i.label){case 0:return s("conversation.type",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("lastMessageSendTime",t,f.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n=new Je("RC:SRSMsg",{lastMessageSendTime:t}),[4,Ht(e,n)];case 1:return o=i.sent(),a=o.code,r=o.msg,0===a?[2,{code:a}]:[2,{code:a,msg:r}]}}))}))}function Qt(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("options.messageUId",t.messageUId,f.STRING,!0),s("options.sentTime",t.sentTime,f.NUMBER,!0),s("options.disableNotification",null==t?void 0:t.disableNotification,f.BOOLEAN),s("options.pushConfig",null==t?void 0:t.pushConfig,f.OBJECT),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n={user:t.user,channelId:e.channelId||"",disableNotification:null==t?void 0:t.disableNotification,pushConfig:null==t?void 0:t.pushConfig},o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+t.messageUId,O.debug("recall message ->"+o),[4,ee.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS&&c?[2,{code:i,data:$(c)}]:(O.warn("recall message fail ->"+i+":"+ne[i]+","+o),[2,{code:i,msg:ne[i]}])}}))}))}function $t(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options",t,(function(e){return c(e)&&e.length}),!0),t.forEach((function(e){s("options.messageUId",e.messageUId,f.STRING,!0),s("options.sentTime",e.sentTime,f.NUMBER,!0),s("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete messages ->"+n),[4,ee.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("delete message fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function Zt(e,t){return N(this,void 0,void 0,(function(){var n,o;return R(this,(function(a){switch(a.label){case 0:return s("options.timestamp",t,f.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear message ->"+n),[4,ee.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("clear message ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function en(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c,d,u,l;return R(this,(function(g){switch(g.label){case 0:return s("expansion",e,f.OBJECT,!0),s("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.expansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("update message expansion ->"+u),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:i,originExpansion:c,channelId:d})];case 1:return(l=g.sent().code)!==r.SUCCESS?(O.warn("update message expansion fail ->"+l+":"+ne[l]+","+u),[2,{code:l,msg:ne[l]}]):[2,{code:l}]}}))}))}function tn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c,d,u;return R(this,(function(l){switch(l.label){case 0:return s("keys",e,f.ARRAY,!0),s("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("remove message expansion ->"+d),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:i,keys:e,channelId:c})];case 1:return(u=l.sent().code)!==r.SUCCESS?(O.warn("remove message expansion fail ->"+u+":"+ne[u]+","+d),[2,{code:u,msg:ne[u]}]):[2,{code:u}]}}))}))}function nn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("typingContentType",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:$(c)}]:(O.warn("send typing status message fail ->"+i+":"+ne[i]+","+n),[2,{code:i,msg:ne[i]}])}}))}))}function on(e,t,n){return N(this,void 0,void 0,(function(){var o,a,i,c;return R(this,(function(d){switch(d.label){case 0:return s("messageUId",t,f.STRING,!0),o="messageUId:"+t+",targetId:"+e,O.debug("get message reader ->"+o),[4,ee.imClient.context.getMessageReader(e,t,n)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:c}]:(O.warn("get message reader fail ->"+i+":"+ne[i]+","+o),[2,{code:i,msg:ne[i]}])}}))}))}function an(e,t,n,o){return s("messageType",e,f.STRING,!0),s("isPersited",t,f.BOOLEAN,!0),s("isCounted",n,f.BOOLEAN,!0),ee.imClient.context.registerMessageType(e,t,n,o),Ye(e,t,n)}function rn(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return p()?(s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function sn(e,t,n){return void 0===n&&(n={}),N(this,void 0,void 0,(function(){var o,a,i,s,c,d,u,l,g,f,m,h,v,I,S,C;return R(this,(function(T){switch(T.label){case 0:return p()?(o=t.senderUserId,a=t.messageType,i=t.content,s=t.messageDirection,c=t.messageUId,d=t.canIncludeExpansion,u=t.expansion,l=t.disableNotification,g=t.sentTime,f=t.sentStatus,O.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,h=n.searchContent,v={senderUserId:o,messageType:a,content:i,messageDirection:s,sentTime:g,sentStatus:f,searchContent:h,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:d,expansionMsg:JSON.stringify(u),channelId:e.channelId||""},[4,ee.imClient.context.insertMessage(e.conversationType,e.targetId,v)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return I=T.sent(),S=I.code,C=I.data,S===r.SUCCESS?[2,{code:S,data:$(C)}]:(O.warn("insertMessage ->code:"+S+",targetId:"+e.targetId),[2,{code:S,msg:ne[S]}])}}))}))}function cn(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return p()?[4,ee.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:$(o)}]:(O.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function dn(e){if(!p())return{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]};s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0);var t=ee.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push($(e))})),{code:r.SUCCESS,data:n}}function un(e,t,n,o){return N(this,void 0,void 0,(function(){var a,i,c,d;return R(this,(function(u){switch(u.label){case 0:return p()?(s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0),s("keyword",t,f.STRING,!0),s("timestamp",n,f.NUMBER),s("count",o,f.NUMBER),1,[4,ee.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=u.sent(),i=a.code,c=a.data,i===r.SUCCESS?(d=[],(null==c?void 0:c.messages)&&c.messages.length&&c.messages.forEach((function(e){return d.push($(e))})),[2,{code:i,data:{messages:d,count:null==c?void 0:c.count}}]):(O.warn("searchMessages ->code:"+i+",targetId:"+e.targetId),[2,{code:i,msg:ne[i]}])}}))}))}function ln(e,t,n){return N(this,void 0,void 0,(function(){var o;return R(this,(function(a){switch(a.label){case 0:return p()?(s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0),s("timestamp",t,f.NUMBER,!0),s("cleanSpace",n,f.BOOLEAN),[4,ee.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:ne[o]}])}}))}))}function gn(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return p()?(O.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(O.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:ne[t]}])}}))}))}function fn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,i,s;return R(this,(function(c){switch(c.label){case 0:return p()?(O.info("searchConversationByContent ->keyword:"+e),[4,ee.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=c.sent(),i=a.code,s=a.data,i===r.SUCCESS?[2,{code:i,data:s}]:(O.warn("searchConversationByContent ->code:"+i+",keyword:"+e),[2,{code:i,msg:ne[i]}])}}))}))}function mn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return p()?(O.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function pn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return p()?(s("messageId",e,f.NUMBER,!0),s("receivedStatus",t,f.NUMBER,!0),O.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,ee.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function hn(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,f.STRING,!0),s("tag.tagId",e.tagId,(function(e){return e.length<=10})),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),s("tag.tagName",e.tagName,f.STRING,!0),O.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function vn(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return s("tagId",e,f.STRING,!0),O.info("removeTag ->tagId:"+e),[4,ee.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:ne[t]}])}}))}))}function In(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,f.STRING,!0),s("tag.tagName",e.tagName,f.STRING,!0),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),O.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function Sn(){return N(this,void 0,void 0,(function(){var e,t,n;return R(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("getTagList ->code:"+t),[2,{code:t,msg:ne[t]}])}}))}))}function Cn(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return s("conversationType",e.conversationType,f.NUMBER),s("targetId",e.targetId,f.STRING),s("channelId",e.channelId,f.CHANNEL_ID),O.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.getTagsForConversation(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:[2,{code:n,msg:ne[n]}]}}))}))}function Tn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),O.info("addTagForConversations ->tagId:"+e),[4,ee.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function En(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function yn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID),s("tagIds",t,f.ARRAY,!0),t.forEach((function(e){s("tagId",e,f.STRING,!0)})),O.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:ne[n]}])}}))}))}function Nn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function Rn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,i;return R(this,(function(c){switch(c.label){case 0:return s("tagId",e,f.STRING,!0),s("count",t,f.NUMBER,!0),s("startTime",n,f.NUMBER,!0),O.info("getConversationListByTag ->tagId:"+e),[4,ee.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS?[2,{code:a,data:i}]:(O.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}function On(e,t){return N(this,void 0,void 0,(function(){var n,o,a;return R(this,(function(i){switch(i.label){case 0:return s("tagId",e,f.STRING,!0),s("containMuted",t,f.BOOLEAN,!0),O.info("getUnreadCountByTag ->tagId:"+e),[4,ee.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=i.sent(),o=n.code,a=n.data,O.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(O.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:ne[o]}])}}))}))}function wn(e,t,n){return N(this,void 0,void 0,(function(){var o,a;return R(this,(function(i){switch(i.label){case 0:return s("tagId",e,f.STRING,!0),s("conversation.targetId",t.targetId,f.STRING,!0),s("conversation.conversationType",t.conversationType,f.NUMBER,!0),s("conversation.channelId",t.channelId,f.CHANNEL_ID),s("status.isTop",n,f.BOOLEAN,!0),O.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,ee.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=i.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(O.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}Bt(I.COMBINE_HTML,(function(e,t){return new at({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Mn={COMET:"comet",WEBSOCKET:"websocket"},_n={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"};E.add("imlib","5.1.0-rtc-roompk.1"),E.validEngine("5.1.0-rtc-roompk.1")||O.error("The current engine version '"+E.getInfo().engine+"' error,imlib required engine version at least '5.1.0-rtc-roompk.1'.");export{Je as BaseMessage,at as CombineMessage,Mn as ConnectType,_ as Events,rt as FileMessage,it as GIFMessage,et as HQVoiceMessage,Ze as ImageMessage,ct as LocationMessage,_n as MessageType,dt as ReferenceMessage,ut as RichContentMessage,nt as SightMessage,ot as TextMessage,st as VoiceMessage,Tn as addConversationsToTag,me as addEventListener,hn as addTag,Ie as clearEventListeners,Zt as clearHistoryMessages,gn as clearMessages,Oe as clearMessagesUnreadStatus,ye as clearTextMessageDraft,mn as clearUnreadCountByTimestamp,de as connect,ln as deleteLocalMessagesByTimestamp,$t as deleteMessages,ue as disconnect,Ke as forceRemoveChatRoomEntry,Fe as forceSetChatRoomEntry,je as getAllChatRoomEntries,Ae as getAllUnreadMentionedCount,_e as getBlockedConversationList,Xe as getChatRoomEntry,Ge as getChatRoomInfo,We as getChatroomHistoryMessages,le as getConnectionStatus,Se as getConversationList,Me as getConversationNotificationStatus,Rn as getConversationsFromTagByPage,fe as getCurrentUserId,Dt as getFileToken,kt as getFileUrl,rn as getFirstUnreadMessage,Kt as getHistoryMessages,cn as getMessage,on as getMessageReader,Xt as getRemoteHistoryMessages,ge as getServerTime,Sn as getTags,Cn as getTagsFromConversation,Te as getTextMessageDraft,xe as getTopConversationList,Ne as getTotalUnreadCount,Re as getUnreadCount,On as getUnreadCountByTag,be as getUnreadMentionedCount,dn as getUnreadMentionedMessages,se as init,sn as insertMessage,ce as installPlugin,De as joinChatRoom,ke as joinExistChatRoom,pe as onceEventListener,He as quitChatRoom,Qt as recallMessage,an as registerMessageType,ze as removeChatRoomEntries,Ve as removeChatRoomEntry,Ce as removeConversation,En as removeConversationsFromTag,he as removeEventListener,ve as removeEventListeners,tn as removeMessageExpansionForKey,vn as removeTag,Nn as removeTagFromConversations,yn as removeTagsFromConversation,Ee as saveTextMessageDraft,fn as searchConversationByContent,un as searchMessages,qt as sendFileMessage,Vt as sendHQVoiceMessage,Ft as sendImageMessage,Ht as sendMessage,jt as sendReadReceiptMessage,Wt as sendReadReceiptRequest,Jt as sendReadReceiptResponse,zt as sendSightMessage,Yt as sendSyncReadStatusMessage,Gt as sendTextMessage,nn as sendTypingStatusMessage,qe as setChatRoomEntries,Be as setChatRoomEntry,we as setConversationNotificationStatus,Ue as setConversationToTop,wn as setConversationToTopInTag,pn as setMessageReceivedStatus,en as updateMessageExpansion,In as updateTag};
15
+ ***************************************************************************** */var y=function(e,t){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},y(e,t)};var N=function(){return N=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},N.apply(this,arguments)};function R(e,t,n,o){return new(n||(n=Promise))((function(a,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function s(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function O(e,t){var n,o,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return i.label++,{value:r[1],done:!1};case 5:i.label++,o=r[1],r=[0];continue;case 7:r=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){i=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){i.label=r[1];break}if(6===r[0]&&i.label<a[1]){i.label=a[1],a=r;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(r);break}a[2]&&i.ops.pop(),i.trys.pop();continue}r=t.call(e,i)}catch(e){r=[6,e],o=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}var w=new e("RCIM"),M=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},_=M();var U,x={tag:"browser",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,r=e.headers,i=e.query,s=e.body,c=a(e.url,i);return new Promise((function(e){var o,a=(o="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&o?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,c),r&&a.setRequestHeader)for(var u in r)a.setRequestHeader(u,r[u]);if(i){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==typeof s?JSON.stringify(s):s;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(s)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||w.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:_,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,o){return this.isSupportSocket()&&"websocket"===o?new t(this,e):new n(this,e)}},b=M(),A=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){w.error(e)}}},P={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},L={tag:"wechat",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,u=a(e.url,s);return new Promise((function(e){wx.request({url:u,method:t,headers:i,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:P,sessionStorage:P,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},D=M(),H=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){w.error(e)}}},k={setItem:H("setStorageSync"),getItem:H("getStorageSync"),removeItem:H("removeStorageSync"),clear:H("clearStorageSync")},G={tag:"alipay",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,u=a(e.url,s),d=e.dataType||"json";return new Promise((function(e){my.request({url:u,method:t,headers:i,timeout:n,data:c,dataType:d,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:k,sessionStorage:k,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:D,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},B=M(),q=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){w.error(e)}}},F={setItem:q("setStorageSync"),getItem:q("getStorageSync"),removeItem:q("removeStorageSync"),clear:q("clearStorageSync")},V={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,localStorage:F,sessionStorage:F,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},z=M(),K=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){w.error(e)}}},j={setItem:K("setStorageSync"),getItem:K("getStorageSync"),removeItem:K("removeStorageSync"),clear:K("clearStorageSync")},X={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:z,localStorage:j,sessionStorage:j,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},W=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){w.error(e)}}},J={setItem:W("setStorageSync"),getItem:W("getStorageSync"),removeItem:W("removeStorageSync"),clear:W("clearStorageSync")},Y={tag:"uniapp",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,u=a(e.url,s);return new Promise((function(e){uni.request({url:u,method:t,headers:i,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:J,sessionStorage:J,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},Q=function(e){return e&&e.canIUse&&e.getSystemInfo},$="undefined"!=typeof uni&&Q(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return Y;case"mp-baidu":return X;case"mp-toutiao":return V;case"mp-alipay":return G;case"mp-weixin":return L;default:return x}}():"undefined"!=typeof wx&&Q(wx)?L:"undefined"!=typeof my&&Q(my)?G:"undefined"!=typeof tt&&Q(tt)?V:"undefined"!=typeof swan&&Q(swan)?X:x;function Z(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,s=e.targetId,c=e.sentTime,u=e.receivedTime,d=e.messageUId,l=e.messageDirection,g=e.isPersited,f=e.isCounted,m=e.isOffLineMessage,h=e.canIncludeExpansion,p=e.expansion,v=e.receivedStatus,I=e.disableNotification,S=e.isMentioned,C=e.isStatusMessage,T=e.readReceiptInfo,E=e.pushConfig,y=e.messageId;return v||(v=i.UNREAD),{messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:s,conversationType:t,sentTime:c,receivedTime:u,messageUId:d,messageDirection:l,isPersited:g,isCounted:f,isOffLineMessage:m,isMentioned:S,disableNotification:I,isStatusMessage:C,canIncludeExpansion:h,expansion:p,receivedStatus:v,readReceiptInfo:T,pushConfig:E,messageId:y}}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED"}(U||(U={}));var ee,te=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return w.error("Please do not repeatedly perform the init method"),t.imClient;s("options.navigators",n.navigators,(function(e){return c(e)&&(0===e.length||e.every(u))}));var a=null==n?void 0:n.connectType;return a?d.WEBSOCKET!==a&&d.COMET!==a&&(w.warn("RongIMLib connectionType must be "+d.WEBSOCKET+" or "+d.COMET),a=d.WEBSOCKET):a=d.WEBSOCKET,o._context=l.init($,{appkey:n.appkey,apiVersion:"5.1.2-alpha.1",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:a,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),o.watch(),t.imClient=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(U.CONNECTING)},onConnected:function(){e.emit(U.CONNECTED)},onDisconnect:function(t){e.emit(U.DISCONNECT,t)},onSuspend:function(t){e.emit(U.SUSPEND,t)},batchMessage:function(t){e.emit(U.MESSAGES,{messages:t.map((function(e){return Z(e)}))})},typingState:function(t){e.emit(U.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(U.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n,o){e.emit(U.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:o})},messageReceiptResponse:function(t,n,o){e.emit(U.MESSAGE_RECEIPT_RESPONSE,{conversation:t,receivedUserId:n,messageUIdList:o})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?Z(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(U.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(U.CHATROOM,t)},expansion:function(t){e.emit(U.EXPANSION,t)},pullFinished:function(){e.emit(U.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(U.TAG)},conversationTagChanged:function(){e.emit(U.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(U.MESSAGE_BLOCKED,t)}};this.context.assignWatcher(t)},t}(g),ne={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:r.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},oe={},ae={};for(var re in ne){var ie=ne[re],se=ie.code;oe[se]=re,ae[se]=ie}ne.ROAMING_SERVICE_UNAVAILABLE.code;var ce=function(e){ee=ee||new te(e)};function ue(e,t){return null==ee?void 0:ee.context.install(e,t)}function de(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return s("token",e,m.STRING,!0),w.warn("RongIMLib Version: 5.1.2-alpha.1, Commit: 8c42f18124b2d3f3f98ad8b74a366c0a7c97b68e"),[4,ee.context.connect(e,!1,t)];case 1:return(n=o.sent()).code===r.SUCCESS?[2,{code:n.code,data:{userId:n.userId}}]:[2,{code:n.code,msg:oe[n.code]}]}}))}))}function le(){return ee.context.disconnect()}function ge(){return ee.context.getConnectionStatus()}function fe(){return ee.context.getServerTime()}function me(){return ee.context.getCurrentUserId()}function he(e,t,n){ee.on(e,t,n)}function pe(e,t,n){ee.once(e,t,n)}function ve(e,t,n){ee.off(e,t,n)}function Ie(e){ee.removeAll(e)}function Se(){ee.clear()}function Ce(e,t){f.add(e,t)}function Te(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return O(this,(function(s){switch(s.label){case 0:return w.debug("get conversation list ->"),[4,te.imClient.context.getConversationList(null==e?void 0:e.count,void 0,null==e?void 0:e.startTime,null==e?void 0:e.order,t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?(i=a.map((function(e){return function(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,a=e.unreadMessageCount,r=e.hasMentioned,i=e.mentionedInfo,s=e.lastUnreadTime,c=e.notificationStatus,u=e.isTop,d=e.channelId,l=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&Z(o),unreadMessageCount:a,hasMentioned:r,mentionedInfo:r?{type:null==i?void 0:i.type,userIdList:null==i?void 0:i.userIdList}:void 0,lastUnreadTime:s,notificationStatus:c,isTop:u,channelId:d,unreadMentionedCount:l}}(e)})),[2,{code:0,data:i}]):(w.warn("get conversation list fail ->"+o+":"+oe[o]),[2,{code:o,msg:oe[o]}])}}))}))}function Ee(e){return R(this,void 0,void 0,(function(){var t,n;return O(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),[4,te.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("destroy conversation ->"+n),t!==r.SUCCESS?(w.warn("destroy conversation fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function ye(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return O(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),[4,te.imClient.context.getConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(w.warn("get draft fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Ne(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),s("draft",t,m.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set draft ->"+n),[4,te.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("set draft fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}])}}))}))}function Re(e){return R(this,void 0,void 0,(function(){var t,n;return O(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete draft ->"+t),[4,te.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("delete draft fail ->"+n+":"+oe[n]+","+t),[2,{code:n,msg:oe[n]}])}}))}))}function Oe(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,u;return O(this,(function(d){switch(d.label){case 0:if(w.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),s("includeMuted",e,m.BOOLEAN,!1),s("conversationTypes",t,m.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],s("conversationType",a,h);return[4,te.imClient.context.getTotalUnreadCount("",t,e)];case 1:return i=d.sent(),c=i.code,u=i.data,c===r.SUCCESS?[2,{code:c,data:u}]:(w.warn("getTotalUnreadCount fail ->"+c+":"+oe[c]),[2,{code:c,msg:oe[c]}])}}))}))}function we(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return O(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),[4,te.imClient.context.getUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("get unreadCount fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Me(e){return R(this,void 0,void 0,(function(){var t,n;return O(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),[4,te.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(w.warn("clear unreadMsgNum fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function _e(){return R(this,void 0,void 0,(function(){return O(this,(function(e){switch(e.label){case 0:return[4,te.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))}function Ue(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),s("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function xe(e){return R(this,void 0,void 0,(function(){var t,n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),w.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function be(){return R(this,void 0,void 0,(function(){var e,t,n;return O(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function Ae(e,t){return void 0===t&&(t=!0),R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.type",e.conversationType,h,!0),s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Pe(){return R(this,void 0,void 0,(function(){var e,t,n;return O(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function Le(e){return R(this,void 0,void 0,(function(){return O(this,(function(t){return s("options.targetId",e.targetId,m.STRING,!0),s("options.channelId",e.channelId,m.CHANNEL_ID),w.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,te.imClient.context.getUnreadMentionedCount(e)]}))}))}function De(){return R(this,void 0,void 0,(function(){return O(this,(function(e){return w.debug("getAllUnreadMentionedCount"),[2,te.imClient.context.getAllUnreadMentionedCount()]}))}))}function He(){return R(this,void 0,void 0,(function(){return O(this,(function(e){return[2,te.imClient.context.getAllConversationState()]}))}))}var ke=function(e){s("options.key",e.key,m.STRING,!0),s("options.value",e.value,m.STRING,!0),s("options.isAutoDelete",e.isAutoDelete,m.BOOLEAN),s("options.isSendNotification",e.isSendNotification,m.BOOLEAN),s("options.notificationExtra",e.notificationExtra,m.STRING)},Ge=function(e){s("options.key",e.key,m.STRING,!0),s("options.isSendNotification",e.isSendNotification,m.BOOLEAN),s("options.notificationExtra",e.notificationExtra,m.STRING)};function Be(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,m.NUMBER,!0),n="id:"+e,w.debug("join chatroom ->"+n),[4,te.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join chatroom fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function qe(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,m.NUMBER,!0),n="id:"+e,w.debug("join exist chatroom ->"+n),[4,te.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join exist chatroom fail ->code:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Fe(e){return R(this,void 0,void 0,(function(){var t,n;return O(this,(function(o){switch(o.label){case 0:return t="id:"+e,w.debug("quit chatroom ->"+t),[4,te.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(w.warn("quit chatroom fail ->code+:"+oe[n]+","+t),[2,{code:n,msg:oe[n]}]):[2,{code:n}]}}))}))}function Ve(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return O(this,(function(c){switch(c.label){case 0:return s("options.count",t.count,m.NUMBER),s("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,w.debug("get chatroom info ->"+n),[4,te.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(w.warn("get chatroom info fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function ze(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("targetId",e,m.STRING,!0),ke(t),n="id:"+e,w.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ke(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return O(this,(function(c){switch(c.label){case 0:return s("targetId",e,m.STRING,!0),function(e){e.entries.forEach((function(e){s("entry.key",e.key,m.STRING,!0),s("entry.value",e.value,m.STRING,!0)})),s("options.isAutoDelete",e.isAutoDelete,m.BOOLEAN),s("options.notificationExtra",e.notificationExtra,m.STRING)}(t),t.entries.length>10?[2,ne.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,w.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntries(e,t)]);case 1:return o=c.sent(),a=o.code,i=o.data,a!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a],data:i}]):[2,{code:a}]}}))}))}function je(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("targetId",e,m.STRING,!0),ke(t),n="id:"+e,w.debug("force set chatroom entry ->"+n),[4,te.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Xe(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("targetId",e,m.STRING,!0),Ge(t),n="id:"+e,w.debug("remove chatroom entry->"+n),[4,te.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function We(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("targetId",e,m.STRING,!0),function(e){e.entries.forEach((function(e){s("key",e,m.STRING,!0)})),s("options.notificationExtra",e.notificationExtra,m.STRING)}(t),n="id:"+e,w.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,te.imClient.context.removeChatroomEntries(e,o)];case 1:return a=u.sent(),i=a.code,c=a.data,i!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+oe[i]+","+n),[2,{code:i,msg:oe[i],data:c}]):[2,{code:i}]}}))}))}function Je(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("targetId",e,m.STRING,!0),Ge(t),n="id:"+e,w.debug("force remove chatroom entry ->"+n),[4,te.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ye(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return O(this,(function(c){switch(c.label){case 0:return s("key",t,(function(e){return p(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,w.debug("get chatroom entry->"+n),[4,te.imClient.context.getChatroomEntry(e,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(w.warn("get chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function Qe(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return O(this,(function(i){switch(i.label){case 0:return t="id:"+e,w.debug("get all chatroom entries->"+t),[4,te.imClient.context.getAllChatroomEntries(e)];case 1:return n=i.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?[2,{code:o,data:a}]:(w.warn("get all chatroom entries fail ->code+:"+oe[o]+","+t),[2,{code:o,msg:oe[o]}])}}))}))}function $e(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("options.timestamp",t.timestamp,m.NUMBER),s("options.count",t.count,m.NUMBER),s("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,w.debug("get chatroom history message->"+n),[4,te.imClient.context.getChatRoomHistoryMessages(e,t.count,t.order,t.timestamp)];case 1:return o=u.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:c,hasMore:!!i.hasMore}}]):(w.warn("get chatroom history message fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}var Ze=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function et(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new Ze(e,o,t,n)}}var nt,ot,at=et("RC:ImgMsg"),rt=et("RC:HQVCMsg"),it=et("RC:SightMsg"),st=et("RC:TxtMsg"),ct=et("RC:CombineMsg"),ut=et("RC:FileMsg"),dt=et("RC:GIFMsg"),lt=et("RC:VcMsg"),gt=et("RC:LBSMsg"),ft=et("RC:ReferenceMsg"),mt=et("RC:ImgTextMsg"),ht={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=St()+pt[0][1]||r,pt.shift();var i=new XMLHttpRequest;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var a=i.responseText||"{}";(a=JSON.parse(a)).filename=t.uniqueValue,a.uploadMethod=v?v.QINIU:"",200===i.status?n.onCompleted(a):pt.length?ht[pt[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";It(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n);return e}(a+="/mkblk/"+e.size,t.multi_parmas));i.open(t.method,a,!0),n.onOpen(i),t.stream&&i.setRequestHeader("authorization","UpToken "+t.multi_parmas.token);It(t.headers,(function(e,t){i.setRequestHeader(e,t)})),i.send(e)},baidu:function(e,t,n,o){if(console.log(o,t),o.size>vt)throw new Error("the file size is over 5GB!");var a=t||{};t=t||ot;var r=new XMLHttpRequest,i=St();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var s=i+pt[0][1]+a.bosUploadPath;pt.shift();var c=a.bosHeader||{},u={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:s,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).filename=t.uniqueValue,200===r.status){n.onCompleted(u,!0)}else pt.length?ht[pt[0][0]](e,t,n,o):n.onError("upload fail")}},r.open(t.method,s,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(e,t,n,o){if(o.size>vt)throw new Error("the file size is over 5GB!");const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token"));const r=pt[0][1];pt.shift(),e=e||nt,t=(t=t||{})||ot;var i=new XMLHttpRequest,s=St()+t.ossBucketName+"."+r;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var e=i.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=v?v.ALI:"",200===i.status?n.onCompleted(e):pt.length?ht[pt[0][0]](a,t,n,o):n.onError("upload fail")}},i.open(t.method,s,!0),console.log("ali:url",s);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",o),i.send(e)},s3:function(e,t,n,o){var a=new FormData,r=new XMLHttpRequest,i=St();const s=pt[0][1];var c=i+t.s3BucketName+"."+s;console.log("uploadS3:url",c),pt.shift(),r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).name=t.uniqueValue,a.filename=t.uploadFileName,a.uploadMethod=v.AWS,console.log("UploadMethod:",v),200===r.status||204===r.status)n.onCompleted(a);else if(pt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),ht[pt[0][0]](a,t,n,o)}else n.onError("upload fail")}},r.open(t.method,c,!0);var u=t?t.s3Header:{},d=o&&o.type;"text/html"===d?a.set("Content-Disposition","inline;"):a.set("Content-Disposition","attachment;");a.set("Content-Type",d),a.set("x-amz-credential",u.s3Credential),a.set("x-amz-algorithm",u.s3Algorithm),a.set("x-amz-date",u.s3Date),a.set("policy",u.s3Policy),a.set("x-amz-signature",u.s3Signature),a.set("key",t.uploadFileName),a.set("file",o),r.send(a)},stc:function(e,t,n,o){new FormData;var a=new XMLHttpRequest;St();var r="https://"+pt[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;pt.shift(),a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=a.responseText||"{}";if((r=JSON.parse(r)).name=t.uniqueValue,r.filename=t.uploadFileName,r.uploadMethod=v?v.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(pt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),ht[pt[0][0]](a,t,n,o)}else n.onError("upload fail")}},a.open("PUT",r,!0);var i=t?t.stcHeader:{};a.setRequestHeader("Content-Type",o.type),"text/html"===o.type?a.setRequestHeader("Content-Disposition","inline;"):a.setRequestHeader("Content-Disposition","attachment;");a.setRequestHeader("Authorization",i.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",i.stcContentSha256),a.setRequestHeader("x-amz-date",i.stcDate),a.send(o)}},pt=[],vt=5368709120;function It(e,t){for(var n in e)t(n,e[n])}function St(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function Ct(e,t,n){var o,a,r=e&&e.type||"text/plain",i=r.indexOf("image")>-1?1:4,s=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var u=c.find((e=>Object.keys(e).includes("stc"))),d="uploads";te.imClient.getFileToken(i,o,"POST",d).then((function(e){o=e.fileName,a="https://"+u.stc+"/"+t.stcBucketName+"/"+o,console.log("uploadStcMultipart:url",a);var i=new XMLHttpRequest;i.open("POST",a+"?"+d,!0),"text/html"===r?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attacshment;"),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",r),i.send(),i.onreadystatechange=function(e){if(4===i.readyState){var t=i.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===i.status||204===i.status?function(e){for(var t=[],n=1;n<=s;n++)t.push(m(e,n));f(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],g=new Map;function f(c,u){u&&Array.isArray(u)&&0!==u.length&&Promise.all(u).then((()=>{var u="uploadId="+c;if(g.size===s)te.imClient.context.getFileToken(i,o,"POST",u).then((function(o){console.log("onSuccess",o),console.log("onSuccess:uploadId",c);var i=new XMLHttpRequest;i.open("POST",a+"?"+u,!0),i.setRequestHeader("Authorization",o&&o.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",o&&o.stcContentSha256),i.setRequestHeader("x-amz-date",o&&o.stcDate),i.setRequestHeader("Content-Type",r);var s="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",d=Array.from(g.keys()||[]).sort(((e,t)=>e-t));console.log("keys",d),d.map((e=>{s+=`<Part><ETag>${g.get(e)}</ETag><PartNumber>${e}</PartNumber></Part>`})),s+="</CompleteMultipartUpload>",i.send(s),console.log("xml",s),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var o={};o.name=e.name,o.filename=t.uploadFileName,o.uploadMethod=v.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var d=[];for(var h of l)d.push(m(c,h));f(c,d)}}),(e=>{console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t=[];for(var o of l)t.push(m(c,o));f(c,t)}))}function m(n,s){return new Promise(((c,u)=>{var d="partNumber="+s+"&uploadId="+n;te.imClient.context.getFileToken(i,o,"PUT",d).then((function(n){console.log("signature "+s+" onSuccess",n);var o=e&&e.slice((s-1)*t.stc_chunk_size,s*t.stc_chunk_size);console.log("fileChunk:size",o.size);var i=new XMLHttpRequest;i.open("PUT",a+"?"+d,!0),i.setRequestHeader("Authorization",n&&n.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),i.setRequestHeader("x-amz-date",n&&n.stcDate),i.setRequestHeader("Content-Type",r),i.send(o),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var e=i.getResponseHeader("etag");console.log("etag:"+s,e),g.set(s,e),c(e)}else l.includes(s)||l.push(s),u(s)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(s)||l.push(s),u(s)}))}))}}var Tt={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=Et()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),yt(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=Et()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,yt(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Et(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function yt(e,t){for(var n in e)t(n,e[n])}var Nt,Rt=0;function Ot(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:Tt.form,genUId:Et};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;yt(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(nt=e,ot=t,pt=[],t.ossConfig){const e=JSON.parse(t.ossConfig);let n,o,a="";const r=[];e.forEach((e=>{const t=Number(e.p)-1;for(const i in e)"aliyun"===i&&(a=e[i]),"s3"===i&&(n=e[i]),"stc"===i&&(o=e[i]),"p"!==i&&(r[t]=[i,e[i]])})),r.forEach((function(e){e&&pt.push(e)})),e.length!==pt.length&&(pt=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else pt=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var o;if(t.ossConfig){var a=t&&JSON.parse(t.ossConfig);Array.isArray(a)||(a=[]),o=a.find((e=>Object.keys(e).includes("stc")))}if(o&&1===parseInt(o.p)&&e.size>=4194304)Ct(e,t,n);else{var r=t.data(e,t);ht[pt[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Nt=e,o){Nt=Rt+e/n*(n-Rt)}else Rt=Nt;t.onProgress(Nt,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var wt={init:function(e){return new Ot(e)},dataType:Tt,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),a=new FileReader;a.readAsDataURL(e),a.onload=function(e){var a=e.target.result,r=new Image;r.src=a;var i=r.width,s=r.height,c=function(e,t){var n=1,o=e.width,a=t.maxWidth||0;a>0&&o>a&&(n=a/o);var r=e.height,i=t.maxHeight||0;if(i>0&&r>i){var s=i/r;n=Math.min(n,s)}var c=t.maxSize||0,u=Math.ceil(e.size/1e3);if(u>c){var d=c/u;n=Math.min(n,d)}return n}({width:i,height:s,size:e.total},t),u=a;c<1&&(u=function(e,t,n){o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n);var a="image/jpg";return o.toDataURL(a)}(r,i*c,s*c)),n(u)}}};const Mt=function(e,t,n){var o=document.createElement("canvas"),a=o.getContext("2d"),r=new Image;r.onload=function(){var i=function(e,t,n){var o,a,r,i=e<t,s=0,c=0;return(i?t/e:e/t)>n.scale?(i?(a=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,s=((a=e/(o=t/100))-n.maxWidth)/2),{w:a,h:r,x:-s,y:-c}):(i?(o=t/n.maxHeight,r=n.maxHeight,a=e/o):(o=e/n.maxWidth,a=n.maxWidth,r=t/o),{w:a,h:r,x:-s,y:-c})}(r.width,r.height,t);o.width=i.w>t.maxWidth?t.maxWidth:i.w,o.height=i.h>t.maxHeight?t.maxHeight:i.h,a.drawImage(r,i.x,i.y,i.w,i.h);try{var s=o.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");s=s.replace(c,""),n(s)}catch(e){throw new Error(e)}},r.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},_t=function(e,t){var n=e.file,o=e.compress;Mt(n,o,t)},Ut=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",o);var a=wt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=wt.init(e);t(n)}};var xt,bt,At=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||_t;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Pt=function(e){var t=this;this.instance=e,this.upload=function(e,n){At({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Lt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};At(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Dt=function(e,t){Ut(e,(function(n){var o={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},a=new Lt(n,o);t(a)}))},Ht=function(e,t){Ut(e,(function(e){var n=new Pt(e);t(n)}))},kt=Dt;wt.dataType;function Gt(e){return xt=xt||new AudioContext,new Promise((function(t,n){xt.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Bt(e,t,n,o){return new Promise((function(a){te.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:oe[e]})}))}))}function qt(e,t,n,o,a){return s("fileType",e,S,!0),s("filename",t,m.STRING),s("saveName",n,m.STRING),s("serverType",a,m.NUMBER),new Promise((function(i){te.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){i({code:r.SUCCESS,data:e})})).catch((function(e){i({code:e})}))}))}function Ft(e,t,n){return R(this,void 0,void 0,(function(){var o,a,c,u,d,l,g,f,h;return O(this,(function(p){switch(p.label){case 0:return n=n||{},t instanceof Ze==!1?(w.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,ne.ILLGAL_PARAMS]):(s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),o=e.conversationType,a=e.targetId,c=e.channelId,u="conversationType:"+o+",targetId:"+a,w.debug("send message ->"+u),(d=Object.assign(n,t)).channelId=c||"",[4,te.imClient.context.sendMessage(o,a,d)]);case 1:return l=p.sent(),g=l.code,f=l.data,g===r.SUCCESS?(h=Z(f),[2,{code:g,data:h}]):(w.warn("send message fail ->"+g+":"+oe[g]+","+u),[2,{code:g,msg:oe[g],data:Z({isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:o,targetId:a,channelId:c||"",senderUserId:te.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:T.SEND,isOffLineMessage:!1,sentTime:(null==f?void 0:f.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD})}])}}))}))}function Vt(e,t,n){return Ft(e,new st(t),n)}function zt(e,t){return function(n,o,a,i){return new Promise((function(s){var c;!function(e,t,n,o){var a,r=this;if(void 0===t&&(t=I.FILE),a=t===I.IMAGE?I.IMAGE:I.FILE,!bt){bt="upload.qiniup.com";var i=te.imClient.context.getInfoFromCache();if(i&&i.ossConfig)try{var s=JSON.parse(i.ossConfig).find((function(e){return void 0!==e.qiniu}));s&&(bt=s.qiniu)}catch(e){}}var c=N({domain:bt,getToken:function(e){te.imClient.context.getFileToken(a).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},o);(a===I.IMAGE?kt:Ht)(c,(function(o){o.upload(e,{onProgress:function(e,t){var o,a=Math.floor(e/t*100);null===(o=n.onProgress)||void 0===o||o.call(n,a)},onCompleted:function(o){return R(r,void 0,void 0,(function(){var r=this;return O(this,(function(i){return qt(a,o.filename,o.name,o,o.uploadMethod).then((function(i){return R(r,void 0,void 0,(function(){var r,s;return O(this,(function(c){return 0!==i.code?(n.onFail(i),[2]):((r=i.data).type=e.type,r.name=o.name||o.filename,t===I.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Gt).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):((s=new FileReader).onload=function(){s.result?Gt(s.result).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):n.onSuccess(r)},s.onerror=function(){r.duration=0,n.onSuccess(r)},s.readAsArrayBuffer(e)),[2]):(a===I.IMAGE&&(r.thumbnail=o.thumbnail),n.onSuccess(r),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(o.file,e,{onProgress:null==a?void 0:a.onProgress,onSuccess:function(e){var r,c=(null===(r=null==a?void 0:a.onComplete)||void 0===r?void 0:r.call(a,{url:e.downloadUrl}))||t(e,o);Ft(n,c,i).then(s)},onFail:function(e){s({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}},(null===(c=i)||void 0===c?void 0:c.thumbnailConfig)||{})}))}}var Kt=zt(I.FILE,(function(e,t){return new ut({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),jt=zt(I.IMAGE,(function(e,t){return new at({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Xt=zt(I.AUDIO,(function(e,t){return new rt({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),Wt=zt(I.SIGHT,(function(e,t){return new it({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));function Jt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,m.NUMBER),s("options.count",null==t?void 0:t.count,m.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,te.imClient.context.getHistoryMessage(e.conversationType,e.targetId,null==t?void 0:t.timestamp,null==t?void 0:t.count,null==t?void 0:t.order,null==e?void 0:e.channelId)];case 1:return o=u.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(w.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function Yt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,m.NUMBER),s("options.count",null==t?void 0:t.count,m.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,te.imClient.context.getRemoteHistoryMessages(e.conversationType,e.targetId,(null==t?void 0:t.timestamp)||0,(null==t?void 0:t.count)||20,(null==t?void 0:t.order)||0,e.channelId||"")];case 1:return o=u.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(w.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function Qt(e,t,n,o){return R(this,void 0,void 0,(function(){var a,r,i,s,c;return O(this,(function(u){switch(u.label){case 0:return a={targetId:e,conversationType:E.PRIVATE,channelId:o},r=new Ze("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,Ft(a,r)];case 1:return i=u.sent(),s=i.code,c=i.msg,0===s?[2,{code:s}]:[2,{code:s,msg:c}]}}))}))}function $t(e,t,n){return R(this,void 0,void 0,(function(){var o,a,r,i,c;return O(this,(function(u){switch(u.label){case 0:return s("messageUId",t,m.STRING,!0),s("channelId",n,m.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,w.debug("send read receipt message ->"+o),a=new Ze("RC:RRReqMsg",{messageUId:t}),[4,Ft({targetId:e,conversationType:E.GROUP,channelId:n},a)];case 1:return r=u.sent(),i=r.code,c=r.msg,0===i?[2,{code:i}]:[2,{code:i,msg:c}]}}))}))}function Zt(e,t,n){return R(this,void 0,void 0,(function(){return O(this,(function(e){throw new Error("This method is deprecated, please use method sendReadReceiptResponseV2.")}))}))}function en(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c,u,d,l;return O(this,(function(g){switch(g.label){case 0:return s("targetId",e,m.STRING,!0),s("messageList",t,m.OBJECT,!0),s("channelId",n,m.CHANNEL_ID),Object.keys(t).forEach((function(e){s(e,t[e],m.ARRAY)})),o={targetId:e,conversationType:E.GROUP,channelId:n},i=te.imClient.context.getInfoFromCache(),0!==(c=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(u=new Ze("RC:RRRspMsg",{receiptMessageDic:t}),[4,Ft(o,u)]);case 1:return a=g.sent(),[3,4];case 2:return 1!==c?[3,4]:(d=[],Object.keys(t).forEach((function(e){t[e].forEach((function(e){-1===d.indexOf(e)&&d.push(e)}))})),d.length?[4,te.imClient.context.sendReadReceiptMessage(e,d,n)]:(w.warn("Error in parameter messageList."),[2,{code:r.PARAMETER_ERROR}]));case 3:a=g.sent(),g.label=4;case 4:return(l=a.code)===r.SUCCESS?[2,{code:l}]:(w.warn("send read receipt message fail ->"+l+":"+oe[l]),[2,{code:l,msg:oe[l]}])}}))}))}function tn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,r;return O(this,(function(i){switch(i.label){case 0:return s("conversation.type",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("lastMessageSendTime",t,m.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n=new Ze("RC:SRSMsg",{lastMessageSendTime:t}),[4,Ft(e,n)];case 1:return o=i.sent(),a=o.code,r=o.msg,0===a?[2,{code:a}]:[2,{code:a,msg:r}]}}))}))}function nn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("options.messageUId",t.messageUId,m.STRING,!0),s("options.sentTime",t.sentTime,m.NUMBER,!0),s("options.disableNotification",null==t?void 0:t.disableNotification,m.BOOLEAN),s("options.pushConfig",null==t?void 0:t.pushConfig,m.OBJECT),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n={user:t.user,channelId:e.channelId||"",disableNotification:null==t?void 0:t.disableNotification,pushConfig:null==t?void 0:t.pushConfig},o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+t.messageUId,w.debug("recall message ->"+o),[4,te.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=u.sent(),i=a.code,c=a.data,i===r.SUCCESS&&c?[2,{code:i,data:Z(c)}]:(w.warn("recall message fail ->"+i+":"+oe[i]+","+o),[2,{code:i,msg:oe[i]}])}}))}))}function on(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options",t,(function(e){return c(e)&&e.length}),!0),t.forEach((function(e){s("options.messageUId",e.messageUId,m.STRING,!0),s("options.sentTime",e.sentTime,m.NUMBER,!0),s("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete messages ->"+n),[4,te.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("delete message fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function an(e,t){return R(this,void 0,void 0,(function(){var n,o;return O(this,(function(a){switch(a.label){case 0:return s("options.timestamp",t,m.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear message ->"+n),[4,te.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("clear message ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function rn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,u,d,l;return O(this,(function(g){switch(g.label){case 0:return s("expansion",e,m.OBJECT,!0),s("message",t,m.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.expansion,u=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("update message expansion ->"+d),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:i,originExpansion:c,channelId:u})];case 1:return(l=g.sent().code)!==r.SUCCESS?(w.warn("update message expansion fail ->"+l+":"+oe[l]+","+d),[2,{code:l,msg:oe[l]}]):[2,{code:l}]}}))}))}function sn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,u,d;return O(this,(function(l){switch(l.label){case 0:return s("keys",e,m.ARRAY,!0),s("message",t,m.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("remove message expansion ->"+u),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:i,keys:e,channelId:c})];case 1:return(d=l.sent().code)!==r.SUCCESS?(w.warn("remove message expansion fail ->"+d+":"+oe[d]+","+u),[2,{code:d,msg:oe[d]}]):[2,{code:d}]}}))}))}function cn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("typingContentType",t,m.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,te.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=u.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:Z(c)}]:(w.warn("send typing status message fail ->"+i+":"+oe[i]+","+n),[2,{code:i,msg:oe[i]}])}}))}))}function un(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c;return O(this,(function(u){switch(u.label){case 0:return s("messageUId",t,m.STRING,!0),o="messageUId:"+t+",targetId:"+e,w.debug("get message reader ->"+o),[4,te.imClient.context.getMessageReader(e,t,n)];case 1:return a=u.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:c}]:(w.warn("get message reader fail ->"+i+":"+oe[i]+","+o),[2,{code:i,msg:oe[i]}])}}))}))}function dn(e,t,n,o,a){return s("messageType",e,m.STRING,!0),s("isPersited",t,m.BOOLEAN,!0),s("isCounted",n,m.BOOLEAN,!0),s("isStatusMessage",a,m.BOOLEAN,!1),te.imClient.context.registerMessageType(e,t,n,o,a),et(e,t,n)}function ln(e){return R(this,void 0,void 0,(function(){var t,n,o;return O(this,(function(a){switch(a.label){case 0:return C()?(s("conversation.conversationType",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("conversation.channelId",null==e?void 0:e.channelId,m.CHANNEL_ID),[4,te.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function gn(e,t,n){return void 0===n&&(n={}),R(this,void 0,void 0,(function(){var o,a,i,s,c,u,d,l,g,f,m,h,p,v,I,S;return O(this,(function(T){switch(T.label){case 0:return C()?(o=t.senderUserId,a=t.messageType,i=t.content,s=t.messageDirection,c=t.messageUId,u=t.canIncludeExpansion,d=t.expansion,l=t.disableNotification,g=t.sentTime,f=t.sentStatus,w.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,h=n.searchContent,p={senderUserId:o,messageType:a,content:i,messageDirection:s,sentTime:g,sentStatus:f,searchContent:h,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:u,expansionMsg:JSON.stringify(d),channelId:e.channelId||""},[4,te.imClient.context.insertMessage(e.conversationType,e.targetId,p)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return v=T.sent(),I=v.code,S=v.data,I===r.SUCCESS?[2,{code:I,data:Z(S)}]:(w.warn("insertMessage ->code:"+I+",targetId:"+e.targetId),[2,{code:I,msg:oe[I]}])}}))}))}function fn(e){return R(this,void 0,void 0,(function(){var t,n,o;return O(this,(function(a){switch(a.label){case 0:return C()?[4,te.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:Z(o)}]:(w.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function mn(e){if(!C())return{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]};s("conversationType",e.conversationType,m.NUMBER,!0),s("targetId",e.targetId,m.STRING,!0);var t=te.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push(Z(e))})),{code:r.SUCCESS,data:n}}function hn(e,t,n,o){return R(this,void 0,void 0,(function(){var a,i,c,u;return O(this,(function(d){switch(d.label){case 0:return C()?(s("conversationType",e.conversationType,m.NUMBER,!0),s("targetId",e.targetId,m.STRING,!0),s("keyword",t,m.STRING,!0),s("timestamp",n,m.NUMBER),s("count",o,m.NUMBER),1,[4,te.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS?(u=[],(null==c?void 0:c.messages)&&c.messages.length&&c.messages.forEach((function(e){return u.push(Z(e))})),[2,{code:i,data:{messages:u,count:null==c?void 0:c.count}}]):(w.warn("searchMessages ->code:"+i+",targetId:"+e.targetId),[2,{code:i,msg:oe[i]}])}}))}))}function pn(e,t,n){return R(this,void 0,void 0,(function(){var o;return O(this,(function(a){switch(a.label){case 0:return C()?(s("conversationType",e.conversationType,m.NUMBER,!0),s("targetId",e.targetId,m.STRING,!0),s("timestamp",t,m.NUMBER,!0),s("cleanSpace",n,m.BOOLEAN),[4,te.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:oe[o]}])}}))}))}function vn(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return C()?(w.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(w.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:oe[t]}])}}))}))}function In(e,t,n,o){return R(this,void 0,void 0,(function(){var a,i,s;return O(this,(function(c){switch(c.label){case 0:return C()?(w.info("searchConversationByContent ->keyword:"+e),[4,te.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=c.sent(),i=a.code,s=a.data,i===r.SUCCESS?[2,{code:i,data:s}]:(w.warn("searchConversationByContent ->code:"+i+",keyword:"+e),[2,{code:i,msg:oe[i]}])}}))}))}function Sn(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return C()?(w.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function Cn(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return C()?(s("messageId",e,m.NUMBER,!0),s("receivedStatus",t,m.NUMBER,!0),w.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,te.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Tn(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,m.STRING,!0),s("tag.tagId",e.tagId,(function(e){return e.length<=10})),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),s("tag.tagName",e.tagName,m.STRING,!0),w.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function En(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return s("tagId",e,m.STRING,!0),w.info("removeTag ->tagId:"+e),[4,te.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:oe[t]}])}}))}))}function yn(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,m.STRING,!0),s("tag.tagName",e.tagName,m.STRING,!0),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),w.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function Nn(){return R(this,void 0,void 0,(function(){var e,t,n;return O(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(w.warn("getTagList ->code:"+t),[2,{code:t,msg:oe[t]}])}}))}))}function Rn(e){return R(this,void 0,void 0,(function(){var t,n,o;return O(this,(function(a){switch(a.label){case 0:return s("conversationType",e.conversationType,m.NUMBER),s("targetId",e.targetId,m.STRING),s("channelId",e.channelId,m.CHANNEL_ID),w.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getTagsForConversation(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:[2,{code:n,msg:oe[n]}]}}))}))}function On(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return s("tagId",e,m.STRING,!0),s("conversations",t,m.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("conversation.channelId",e.channelId,m.CHANNEL_ID)})),w.info("addTagForConversations ->tagId:"+e),[4,te.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function wn(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return s("tagId",e,m.STRING,!0),s("conversations",t,m.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("conversation.channelId",e.channelId,m.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Mn(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return s("conversation.conversationType",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("conversation.channelId",e.channelId,m.CHANNEL_ID),s("tagIds",t,m.ARRAY,!0),t.forEach((function(e){s("tagId",e,m.STRING,!0)})),w.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:oe[n]}])}}))}))}function _n(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return s("tagId",e,m.STRING,!0),s("conversations",t,m.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,m.NUMBER,!0),s("conversation.targetId",e.targetId,m.STRING,!0),s("conversation.channelId",e.channelId,m.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Un(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i;return O(this,(function(c){switch(c.label){case 0:return s("tagId",e,m.STRING,!0),s("count",t,m.NUMBER,!0),s("startTime",n,m.NUMBER,!0),w.info("getConversationListByTag ->tagId:"+e),[4,te.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS?[2,{code:a,data:i}]:(w.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}function xn(e,t){return R(this,void 0,void 0,(function(){var n,o,a;return O(this,(function(i){switch(i.label){case 0:return s("tagId",e,m.STRING,!0),s("containMuted",t,m.BOOLEAN,!0),w.info("getUnreadCountByTag ->tagId:"+e),[4,te.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=i.sent(),o=n.code,a=n.data,w.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(w.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:oe[o]}])}}))}))}function bn(e,t,n){return R(this,void 0,void 0,(function(){var o,a;return O(this,(function(i){switch(i.label){case 0:return s("tagId",e,m.STRING,!0),s("conversation.targetId",t.targetId,m.STRING,!0),s("conversation.conversationType",t.conversationType,m.NUMBER,!0),s("conversation.channelId",t.channelId,m.CHANNEL_ID),s("status.isTop",n,m.BOOLEAN,!0),w.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,te.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=i.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(w.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}zt(I.COMBINE_HTML,(function(e,t){return new ct({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var An={COMET:"comet",WEBSOCKET:"websocket"},Pn={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"};f.add("imlib","5.1.2-alpha.1"),f.validEngine("~5.1.2-alpha.1")||w.error("The current engine version '"+f.getInfo().engine+"' error,imlib required engine version at least '~5.1.2-alpha.1'.");export{Ze as BaseMessage,ct as CombineMessage,An as ConnectType,U as Events,ut as FileMessage,dt as GIFMessage,rt as HQVoiceMessage,at as ImageMessage,gt as LocationMessage,Pn as MessageType,ft as ReferenceMessage,mt as RichContentMessage,it as SightMessage,st as TextMessage,lt as VoiceMessage,Ce as __addSDKVersion,On as addConversationsToTag,he as addEventListener,Tn as addTag,_e as clearAllMessagesUnreadStatus,Se as clearEventListeners,an as clearHistoryMessages,vn as clearMessages,Me as clearMessagesUnreadStatus,Re as clearTextMessageDraft,Sn as clearUnreadCountByTimestamp,de as connect,pn as deleteLocalMessagesByTimestamp,on as deleteMessages,le as disconnect,Je as forceRemoveChatRoomEntry,je as forceSetChatRoomEntry,Qe as getAllChatRoomEntries,He as getAllConversationState,De as getAllUnreadMentionedCount,be as getBlockedConversationList,Ye as getChatRoomEntry,Ve as getChatRoomInfo,$e as getChatroomHistoryMessages,ge as getConnectionStatus,Te as getConversationList,xe as getConversationNotificationStatus,Un as getConversationsFromTagByPage,me as getCurrentUserId,Bt as getFileToken,qt as getFileUrl,ln as getFirstUnreadMessage,Jt as getHistoryMessages,fn as getMessage,un as getMessageReader,Yt as getRemoteHistoryMessages,fe as getServerTime,Nn as getTags,Rn as getTagsFromConversation,ye as getTextMessageDraft,Pe as getTopConversationList,Oe as getTotalUnreadCount,we as getUnreadCount,xn as getUnreadCountByTag,Le as getUnreadMentionedCount,mn as getUnreadMentionedMessages,ce as init,gn as insertMessage,ue as installPlugin,Be as joinChatRoom,qe as joinExistChatRoom,pe as onceEventListener,Fe as quitChatRoom,nn as recallMessage,dn as registerMessageType,We as removeChatRoomEntries,Xe as removeChatRoomEntry,Ee as removeConversation,wn as removeConversationsFromTag,ve as removeEventListener,Ie as removeEventListeners,sn as removeMessageExpansionForKey,En as removeTag,_n as removeTagFromConversations,Mn as removeTagsFromConversation,Ne as saveTextMessageDraft,In as searchConversationByContent,hn as searchMessages,Kt as sendFileMessage,Xt as sendHQVoiceMessage,jt as sendImageMessage,Ft as sendMessage,Qt as sendReadReceiptMessage,$t as sendReadReceiptRequest,Zt as sendReadReceiptResponse,en as sendReadReceiptResponseV2,Wt as sendSightMessage,tn as sendSyncReadStatusMessage,Vt as sendTextMessage,cn as sendTypingStatusMessage,Ke as setChatRoomEntries,ze as setChatRoomEntry,Ue as setConversationNotificationStatus,Ae as setConversationToTop,bn as setConversationToTopInTag,Cn as setMessageReceivedStatus,rn as updateMessageExpansion,yn as updateTag};