@rongcloud/imlib-next 5.1.0 → 5.1.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
@@ -413,6 +413,15 @@ interface IExtraData {
413
413
  */
414
414
  extra?: string;
415
415
  }
416
+ /**
417
+ * 缩略图配置
418
+ */
419
+ interface IThumbnailConfig {
420
+ maxHeight?: number;
421
+ maxWidth?: number;
422
+ quality?: number;
423
+ scale?: number;
424
+ }
416
425
 
417
426
  /**
418
427
  * 获取会话列表
@@ -863,7 +872,9 @@ declare const sendImageMessage: (conversation: IConversationOption, msgBody: ISe
863
872
  onComplete?: ((fileInfo: {
864
873
  url: string;
865
874
  }) => (void | BaseMessage)) | undefined;
866
- } | undefined, sendOptions?: ISendMessageOptions | undefined) => Promise<IAsyncRes<IAReceivedMessage>>;
875
+ } | undefined, sendOptions?: ({
876
+ thumbnailConfig?: IThumbnailConfig | undefined;
877
+ } & ISendMessageOptions) | undefined) => Promise<IAsyncRes<IAReceivedMessage>>;
867
878
  /**
868
879
  * 发送高清语音消息,待发送的文件必须为 AAC 音频文件
869
880
  */
@@ -918,9 +929,18 @@ declare function sendReadReceiptMessage(targetId: string, messageUId: string, ti
918
929
  */
919
930
  declare function sendReadReceiptRequest(targetId: string, messageUId: string, channelId?: string): Promise<IAsyncRes<void>>;
920
931
  /**
921
- * 发送群阅读回执响应
932
+ * @deprecated 已废弃,请使用 sendReadReceiptResponseV2
922
933
  */
923
934
  declare function sendReadReceiptResponse(targetId: string, messageUIds: string[], channelId?: string): Promise<IAsyncRes<void>>;
935
+ /**
936
+ * 发送群阅读回执响应V2
937
+ * @param targetId 群组Id
938
+ * @param messageList 要回执的消息列表,结构为: {senderUserId: [messageUId1, messageUId2]}
939
+ * @param channelId
940
+ */
941
+ declare function sendReadReceiptResponseV2(targetId: string, messageList: {
942
+ [senderUserId: string]: string[];
943
+ }, channelId?: string): Promise<IAsyncRes<void>>;
924
944
  /**
925
945
  * 多端同步阅读状态
926
946
  * @param conversation
@@ -1234,4 +1254,4 @@ declare const MessageType: {
1234
1254
  RECALL_MESSAGE_TYPE: string;
1235
1255
  };
1236
1256
 
1237
- 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, addConversationsToTag, addEventListener, addTag, clearAllMessagesUnreadStatus, 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 };
1257
+ 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, addConversationsToTag, addEventListener, addTag, clearAllMessagesUnreadStatus, 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, 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 h,isString as p,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 d,CONNECTION_TYPE as u,APIContext as l,EventEmitter as g,AssertRules as f,isValidConversationType as m,isString as h,UploadMethod as p,FileType as v,isValidFileType as I,usingCppEngine 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";
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)}}},H={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},k={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:H,sessionStorage:H,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 k;case"mp-weixin":return P;default:return U}}():"undefined"!=typeof wx&&Y(wx)?P:"undefined"!=typeof my&&Y(my)?k:"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,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:d,messageUId:u,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"}(_||(_={}));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",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, Commit: 2c7b87b264d0534922349ed20fac1501d3fadbbf"),[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 he(e,t,n){Z.once(e,t,n)}function pe(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(){return N(this,void 0,void 0,(function(){return R(this,(function(e){switch(e.label){case 0:return[4,ee.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))}function Me(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 _e(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return h()?(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 Ue(){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 xe(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 be(){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 Ae(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 Pe(){return N(this,void 0,void 0,(function(){return R(this,(function(e){return O.debug("getAllUnreadMentionedCount"),[2,ee.imClient.context.getAllUnreadMentionedCount()]}))}))}var Le=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)},De=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 He(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 Ge(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 Be(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 qe(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("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 Fe(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 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("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 ze(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),De(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 Ke(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 Xe(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),De(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 je(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 p(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 We(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 Je(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 Ye=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 Qe(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new Ye(e,o,t,n)}}var $e,Ze,et=Qe("RC:ImgMsg"),nt=Qe("RC:HQVCMsg"),ot=Qe("RC:SightMsg"),at=Qe("RC:TxtMsg"),rt=Qe("RC:CombineMsg"),it=Qe("RC:FileMsg"),st=Qe("RC:GIFMsg"),ct=Qe("RC:VcMsg"),dt=Qe("RC:LBSMsg"),ut=Qe("RC:ReferenceMsg"),lt=Qe("RC:ImgTextMsg"),gt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=pt()+ft[0][1]||r,ft.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):ft.length?gt[ft[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";ht(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);ht(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>mt)throw new Error("the file size is over 5GB!");var a=t||{};t=t||Ze;var r=new XMLHttpRequest,i=pt();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var s=i+ft[0][1]+a.bosUploadPath;ft.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 ft.length?gt[ft[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>mt)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=ft[0][1];ft.shift(),e=e||$e,t=(t=t||{})||Ze;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):ft.length?gt[ft[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=ft[0][1];var c=i+t.s3BucketName+"."+s;console.log("uploadS3:url",c),ft.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(ft.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),gt[ft[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://"+ft[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;ft.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(ft.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),gt[ft[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)}},ft=[],mt=5368709120;function ht(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 vt(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 h of l)u.push(m(c,h));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 It={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=St()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),Ct(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=St()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,Ct(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function St(){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 Ct(e,t){for(var n in e)t(n,e[n])}var Tt,Et=0;function yt(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:It.form,genUId:St};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;Ct(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($e=e,Ze=t,ft=[],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&&ft.push(e)})),e.length!==ft.length&&(ft=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else ft=[["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)vt(e,t,n);else{var r=t.data(e,t);gt[ft[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Tt=e,o){Tt=Et+e/n*(n-Et)}else Et=Tt;t.onProgress(Tt,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 Nt={init:function(e){return new yt(e)},dataType:It,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 Rt=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)},Ot=function(e,t){var n=e.file,o=e.compress;Rt(n,o,t)},wt=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=Nt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Nt.init(e);t(n)}};var Mt,_t,Ut=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||Ot;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},xt=function(e){var t=this;this.instance=e,this.upload=function(e,n){Ut({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},bt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};Ut(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},At=function(e,t){wt(e,(function(n){var o={maxHeight:e.height||160,maxWidth:e.width||160,quality:e.quality||.5,scale:e.scale||2.4},a=new bt(n,o);t(a)}))},Pt=function(e,t){wt(e,(function(e){var n=new xt(e);t(n)}))},Lt=At;Nt.dataType;function Dt(e){return Mt=Mt||new AudioContext,new Promise((function(t,n){Mt.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Ht(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 Gt(e,t,n){return N(this,void 0,void 0,(function(){var o,a,c,d,u,l,g,m,h;return R(this,(function(p){switch(p.label){case 0:return n=n||{},t instanceof Ye==!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=e.conversationType,a=e.targetId,c=e.channelId,d="conversationType:"+o+",targetId:"+a,O.debug("send message ->"+d),(u=Object.assign(n,t)).channelId=c||"",[4,ee.imClient.context.sendMessage(o,a,u)]);case 1:return l=p.sent(),g=l.code,m=l.data,g===r.SUCCESS?(h=$(m),[2,{code:g,data:h}]):(O.warn("send message fail ->"+g+":"+ne[g]+","+d),[2,{code:g,msg:ne[g],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:o,targetId:a,channelId:c||"",senderUserId:ee.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:C.SEND,isOffLineMessage:!1,sentTime:(null==m?void 0:m.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD})}])}}))}))}function Bt(e,t,n){return Gt(e,new at(t),n)}function qt(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,!_t){_t="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&&(_t=i.qiniu)}catch(e){}}var s={domain:_t,getToken:function(e){ee.imClient.context.getFileToken(o).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}};(o===I.IMAGE?Lt:Pt)(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(Dt).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):((s=new FileReader).onload=function(){s.result?Dt(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);Gt(n,c,i).then(s)},onFail:function(e){s({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}})}))}}var Ft=qt(I.FILE,(function(e,t){return new it({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),Vt=qt(I.IMAGE,(function(e,t){return new et({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),zt=qt(I.AUDIO,(function(e,t){return new nt({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),Kt=qt(I.SIGHT,(function(e,t){return new ot({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 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.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 jt(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 Wt(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 Ye("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,Gt(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 Jt(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 Ye("RC:RRReqMsg",{messageUId:t}),[4,Gt({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 Yt(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 Ye("RC:RRRspMsg",{receiptMessageDic:(g={},g[d]=t,g)}),[4,Gt(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 Qt(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 Ye("RC:SRSMsg",{lastMessageSendTime:t}),[4,Gt(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 $t(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 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",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 en(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 tn(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 nn(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 on(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 an(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 rn(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),Qe(e,t,n)}function sn(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return h()?(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 cn(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,p,v,I,S,C;return R(this,(function(T){switch(T.label){case 0:return h()?(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,p=n.searchContent,v={senderUserId:o,messageType:a,content:i,messageDirection:s,sentTime:g,sentStatus:f,searchContent:p,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 dn(e){return N(this,void 0,void 0,(function(){var t,n,o;return R(this,(function(a){switch(a.label){case 0:return h()?[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 un(e){if(!h())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 ln(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 h()?(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 gn(e,t,n){return N(this,void 0,void 0,(function(){var o;return R(this,(function(a){switch(a.label){case 0:return h()?(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 fn(e){return N(this,void 0,void 0,(function(){var t;return R(this,(function(n){switch(n.label){case 0:return h()?(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 mn(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 h()?(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 hn(e,t){return N(this,void 0,void 0,(function(){var n;return R(this,(function(o){switch(o.label){case 0:return h()?(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 h()?(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 vn(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 In(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 Sn(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 Cn(){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 Tn(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 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("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 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("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 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("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 Rn(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 On(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 wn(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 Mn(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]}])}}))}))}qt(I.COMBINE_HTML,(function(e,t){return new rt({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var _n={COMET:"comet",WEBSOCKET:"websocket"},Un={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"),E.validEngine("~5.1.0")||O.error("The current engine version '"+E.getInfo().engine+"' error,imlib required engine version at least '~5.1.0'.");export{Ye as BaseMessage,rt as CombineMessage,_n as ConnectType,_ as Events,it as FileMessage,st as GIFMessage,nt as HQVoiceMessage,et as ImageMessage,dt as LocationMessage,Un as MessageType,ut as ReferenceMessage,lt as RichContentMessage,ot as SightMessage,at as TextMessage,ct as VoiceMessage,En as addConversationsToTag,me as addEventListener,vn as addTag,we as clearAllMessagesUnreadStatus,Ie as clearEventListeners,en as clearHistoryMessages,fn as clearMessages,Oe as clearMessagesUnreadStatus,ye as clearTextMessageDraft,hn as clearUnreadCountByTimestamp,de as connect,gn as deleteLocalMessagesByTimestamp,Zt as deleteMessages,ue as disconnect,Xe as forceRemoveChatRoomEntry,Ve as forceSetChatRoomEntry,We as getAllChatRoomEntries,Pe as getAllUnreadMentionedCount,Ue as getBlockedConversationList,je as getChatRoomEntry,Be as getChatRoomInfo,Je as getChatroomHistoryMessages,le as getConnectionStatus,Se as getConversationList,_e as getConversationNotificationStatus,On as getConversationsFromTagByPage,fe as getCurrentUserId,Ht as getFileToken,kt as getFileUrl,sn as getFirstUnreadMessage,Xt as getHistoryMessages,dn as getMessage,an as getMessageReader,jt as getRemoteHistoryMessages,ge as getServerTime,Cn as getTags,Tn as getTagsFromConversation,Te as getTextMessageDraft,be as getTopConversationList,Ne as getTotalUnreadCount,Re as getUnreadCount,wn as getUnreadCountByTag,Ae as getUnreadMentionedCount,un as getUnreadMentionedMessages,se as init,cn as insertMessage,ce as installPlugin,He as joinChatRoom,ke as joinExistChatRoom,he as onceEventListener,Ge as quitChatRoom,$t as recallMessage,rn as registerMessageType,Ke as removeChatRoomEntries,ze as removeChatRoomEntry,Ce as removeConversation,yn as removeConversationsFromTag,pe as removeEventListener,ve as removeEventListeners,nn as removeMessageExpansionForKey,In as removeTag,Rn as removeTagFromConversations,Nn as removeTagsFromConversation,Ee as saveTextMessageDraft,mn as searchConversationByContent,ln as searchMessages,Ft as sendFileMessage,zt as sendHQVoiceMessage,Vt as sendImageMessage,Gt as sendMessage,Wt as sendReadReceiptMessage,Jt as sendReadReceiptRequest,Yt as sendReadReceiptResponse,Kt as sendSightMessage,Qt as sendSyncReadStatusMessage,Bt as sendTextMessage,on as sendTypingStatusMessage,Fe as setChatRoomEntries,qe as setChatRoomEntry,Me as setConversationNotificationStatus,xe as setConversationToTop,Mn as setConversationToTopInTag,pn as setMessageReceivedStatus,tn as updateMessageExpansion,Sn 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 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||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,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: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,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: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,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: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,d=e.receivedTime,u=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:d,messageUId:u,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(d))}));var a=null==n?void 0:n.connectType;return a?u.WEBSOCKET!==a&&u.COMET!==a&&(w.warn("RongIMLib connectionType must be "+u.WEBSOCKET+" or "+u.COMET),a=u.WEBSOCKET):a=u.WEBSOCKET,o._context=l.init($,{appkey:n.appkey,apiVersion:"5.1.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(){e.emit(U.DISCONNECT)},onSuspend:function(){e.emit(U.SUSPEND)},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 de(e,t){return null==ee?void 0:ee.context.install(e,t)}function ue(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return s("token",e,f.STRING,!0),w.warn("RongIMLib Version: 5.1.1, Commit: 756868a83166be55e30e49e5685b1644456ea30f"),[4,ee.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:oe[t.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){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,d=e.isTop,u=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:d,channelId:u,unreadMentionedCount:l}}(e)})),[2,{code:0,data:i}]):(w.warn("get conversation list fail ->"+o+":"+oe[o]),[2,{code:o,msg:oe[o]}])}}))}))}function Te(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,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.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 Ee(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,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.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 ye(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,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,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 Ne(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,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,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 Re(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d;return O(this,(function(u){switch(u.label){case 0:if(w.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,te.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}]:(w.warn("getTotalUnreadCount fail ->"+c+":"+oe[c]),[2,{code:c,msg:oe[c]}])}}))}))}function Oe(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,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.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 we(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,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.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 Me(){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 _e(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,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,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 Ue(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,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.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 xe(){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 be(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,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,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 Ae(){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 Pe(e){return R(this,void 0,void 0,(function(){return O(this,(function(t){return s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),w.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,te.imClient.context.getUnreadMentionedCount(e)]}))}))}function Le(){return R(this,void 0,void 0,(function(){return O(this,(function(e){return w.debug("getAllUnreadMentionedCount"),[2,te.imClient.context.getAllUnreadMentionedCount()]}))}))}var De=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)},He=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 ke(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,f.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 Ge(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,f.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 Be(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 qe(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,f.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 Fe(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,f.STRING,!0),De(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 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("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,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 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,f.STRING,!0),De(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 Ke(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,f.STRING,!0),He(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 je(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(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,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=d.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 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,f.STRING,!0),He(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 We(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 h(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 Je(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 Ye(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(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,w.debug("get chatroom history message->"+n),[4,te.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 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 Qe=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 $e(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new Qe(e,o,t,n)}}var Ze,et,nt=$e("RC:ImgMsg"),ot=$e("RC:HQVCMsg"),at=$e("RC:SightMsg"),rt=$e("RC:TxtMsg"),it=$e("RC:CombineMsg"),st=$e("RC:FileMsg"),ct=$e("RC:GIFMsg"),dt=$e("RC:VcMsg"),ut=$e("RC:LBSMsg"),lt=$e("RC:ReferenceMsg"),gt=$e("RC:ImgTextMsg"),ft={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=vt()+mt[0][1]||r,mt.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=p?p.QINIU:"",200===i.status?n.onCompleted(a):mt.length?ft[mt[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";pt(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);pt(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>ht)throw new Error("the file size is over 5GB!");var a=t||{};t=t||et;var r=new XMLHttpRequest,i=vt();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var s=i+mt[0][1]+a.bosUploadPath;mt.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 mt.length?ft[mt[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>ht)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=mt[0][1];mt.shift(),e=e||Ze,t=(t=t||{})||et;var i=new XMLHttpRequest,s=vt()+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=p?p.ALI:"",200===i.status?n.onCompleted(e):mt.length?ft[mt[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=vt();const s=mt[0][1];var c=i+t.s3BucketName+"."+s;console.log("uploadS3:url",c),mt.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=p.AWS,console.log("UploadMethod:",p),200===r.status||204===r.status)n.onCompleted(a);else if(mt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),ft[mt[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;vt();var r="https://"+mt[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;mt.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=p?p.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(mt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),ft[mt[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)}},mt=[],ht=5368709120;function pt(e,t){for(var n in e)t(n,e[n])}function vt(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function It(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";te.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)te.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=p.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var u=[];for(var h of l)u.push(m(c,h));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;te.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 St={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=Ct()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),Tt(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=Ct()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,Tt(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Ct(){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 Tt(e,t){for(var n in e)t(n,e[n])}var Et,yt=0;function Nt(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:St.form,genUId:Ct};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;Tt(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(Ze=e,et=t,mt=[],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&&mt.push(e)})),e.length!==mt.length&&(mt=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else mt=[["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)It(e,t,n);else{var r=t.data(e,t);ft[mt[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Et=e,o){Et=yt+e/n*(n-yt)}else yt=Et;t.onProgress(Et,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 Rt={init:function(e){return new Nt(e)},dataType:St,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 Ot=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)},wt=function(e,t){var n=e.file,o=e.compress;Ot(n,o,t)},Mt=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=Rt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Rt.init(e);t(n)}};var _t,Ut,xt=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||wt;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},bt=function(e){var t=this;this.instance=e,this.upload=function(e,n){xt({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},At=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};xt(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Pt=function(e,t){Mt(e,(function(n){var o={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},a=new At(n,o);t(a)}))},Lt=function(e,t){Mt(e,(function(e){var n=new bt(e);t(n)}))},Dt=Pt;Rt.dataType;function Ht(e){return _t=_t||new AudioContext,new Promise((function(t,n){_t.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function kt(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 Gt(e,t,n,o,a){return s("fileType",e,I,!0),s("filename",t,f.STRING),s("saveName",n,f.STRING),s("serverType",a,f.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 Bt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,c,d,u,l,g,m,h;return O(this,(function(p){switch(p.label){case 0:return n=n||{},t instanceof Qe==!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,f.CHANNEL_ID),o=e.conversationType,a=e.targetId,c=e.channelId,d="conversationType:"+o+",targetId:"+a,w.debug("send message ->"+d),(u=Object.assign(n,t)).channelId=c||"",[4,te.imClient.context.sendMessage(o,a,u)]);case 1:return l=p.sent(),g=l.code,m=l.data,g===r.SUCCESS?(h=Z(m),[2,{code:g,data:h}]):(w.warn("send message fail ->"+g+":"+oe[g]+","+d),[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:C.SEND,isOffLineMessage:!1,sentTime:(null==m?void 0:m.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD})}])}}))}))}function qt(e,t,n){return Bt(e,new rt(t),n)}function Ft(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=v.FILE),a=t===v.IMAGE?v.IMAGE:v.FILE,!Ut){Ut="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&&(Ut=s.qiniu)}catch(e){}}var c=N({domain:Ut,getToken:function(e){te.imClient.context.getFileToken(a).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},o);(a===v.IMAGE?Dt:Lt)(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 Gt(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===v.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Ht).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):((s=new FileReader).onload=function(){s.result?Ht(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===v.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);Bt(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 Vt=Ft(v.FILE,(function(e,t){return new st({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),zt=Ft(v.IMAGE,(function(e,t){return new nt({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Kt=Ft(v.AUDIO,(function(e,t){return new ot({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),jt=Ft(v.SIGHT,(function(e,t){return new at({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 Xt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(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,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=d.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 Wt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(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,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=d.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 Jt(e,t,n,o){return R(this,void 0,void 0,(function(){var a,r,i,s,c;return O(this,(function(d){switch(d.label){case 0:return a={targetId:e,conversationType:T.PRIVATE,channelId:o},r=new Qe("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,Bt(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 Yt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,r,i,c;return O(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,w.debug("send read receipt message ->"+o),a=new Qe("RC:RRReqMsg",{messageUId:t}),[4,Bt({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 Qt(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 $t(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c,d,u,l;return O(this,(function(g){switch(g.label){case 0:return s("targetId",e,f.STRING,!0),s("messageList",t,f.OBJECT,!0),s("channelId",n,f.CHANNEL_ID),Object.keys(t).forEach((function(e){s(e,t[e],f.ARRAY)})),o={targetId:e,conversationType:T.GROUP,channelId:n},i=te.imClient.context.getInfoFromCache(),0!==(c=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(d=new Qe("RC:RRRspMsg",{receiptMessageDic:t}),[4,Bt(o,d)]);case 1:return a=g.sent(),[3,4];case 2:return 1!==c?[3,4]:(u=[],Object.keys(t).forEach((function(e){t[e].forEach((function(e){-1===u.indexOf(e)&&u.push(e)}))})),u.length?[4,te.imClient.context.sendReadReceiptMessage(e,u,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 Zt(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,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 Qe("RC:SRSMsg",{lastMessageSendTime:t}),[4,Bt(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 en(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(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,w.debug("recall message ->"+o),[4,te.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:Z(c)}]:(w.warn("recall message fail ->"+i+":"+oe[i]+","+o),[2,{code:i,msg:oe[i]}])}}))}))}function tn(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,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,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 nn(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,f.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.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 on(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d,u,l;return O(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,w.debug("update message expansion ->"+u),[4,te.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?(w.warn("update message expansion fail ->"+l+":"+oe[l]+","+u),[2,{code:l,msg:oe[l]}]):[2,{code:l}]}}))}))}function an(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d,u;return O(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,w.debug("remove message expansion ->"+d),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:i,keys:e,channelId:c})];case 1:return(u=l.sent().code)!==r.SUCCESS?(w.warn("remove message expansion fail ->"+u+":"+oe[u]+","+d),[2,{code:u,msg:oe[u]}]):[2,{code:u}]}}))}))}function rn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return O(this,(function(d){switch(d.label){case 0:return s("typingContentType",t,f.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=d.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 sn(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c;return O(this,(function(d){switch(d.label){case 0:return s("messageUId",t,f.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=d.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 cn(e,t,n,o){return s("messageType",e,f.STRING,!0),s("isPersited",t,f.BOOLEAN,!0),s("isCounted",n,f.BOOLEAN,!0),te.imClient.context.registerMessageType(e,t,n,o),$e(e,t,n)}function dn(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()?(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,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 un(e,t,n){return void 0===n&&(n={}),R(this,void 0,void 0,(function(){var o,a,i,s,c,d,u,l,g,f,m,h,p,v,I,C;return O(this,(function(T){switch(T.label){case 0:return S()?(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,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:d,expansionMsg:JSON.stringify(u),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,C=v.data,I===r.SUCCESS?[2,{code:I,data:Z(C)}]:(w.warn("insertMessage ->code:"+I+",targetId:"+e.targetId),[2,{code:I,msg:oe[I]}])}}))}))}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 S()?[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 gn(e){if(!S())return{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]};s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.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 fn(e,t,n,o){return R(this,void 0,void 0,(function(){var a,i,c,d;return O(this,(function(u){switch(u.label){case 0:return S()?(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,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=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(Z(e))})),[2,{code:i,data:{messages:d,count:null==c?void 0:c.count}}]):(w.warn("searchMessages ->code:"+i+",targetId:"+e.targetId),[2,{code:i,msg:oe[i]}])}}))}))}function mn(e,t,n){return R(this,void 0,void 0,(function(){var o;return O(this,(function(a){switch(a.label){case 0:return S()?(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,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 hn(e){return R(this,void 0,void 0,(function(){var t;return O(this,(function(n){switch(n.label){case 0:return S()?(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 pn(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 S()?(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 vn(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return S()?(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 In(e,t){return R(this,void 0,void 0,(function(){var n;return O(this,(function(o){switch(o.label){case 0:return S()?(s("messageId",e,f.NUMBER,!0),s("receivedStatus",t,f.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 Sn(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,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),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 Cn(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,f.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 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,f.STRING,!0),s("tag.tagName",e.tagName,f.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 En(){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 yn(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,f.NUMBER),s("targetId",e.targetId,f.STRING),s("channelId",e.channelId,f.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 Nn(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,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)})),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 Rn(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,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)})),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 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("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)})),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 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,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)})),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,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,f.STRING,!0),s("count",t,f.NUMBER,!0),s("startTime",n,f.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 _n(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,f.STRING,!0),s("containMuted",t,f.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 Un(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,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),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]}])}}))}))}Ft(v.COMBINE_HTML,(function(e,t){return new it({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var xn={COMET:"comet",WEBSOCKET:"websocket"},bn={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.1"),E.validEngine("~5.1.1")||w.error("The current engine version '"+E.getInfo().engine+"' error,imlib required engine version at least '~5.1.1'.");export{Qe as BaseMessage,it as CombineMessage,xn as ConnectType,U as Events,st as FileMessage,ct as GIFMessage,ot as HQVoiceMessage,nt as ImageMessage,ut as LocationMessage,bn as MessageType,lt as ReferenceMessage,gt as RichContentMessage,at as SightMessage,rt as TextMessage,dt as VoiceMessage,Nn as addConversationsToTag,he as addEventListener,Sn as addTag,Me as clearAllMessagesUnreadStatus,Se as clearEventListeners,nn as clearHistoryMessages,hn as clearMessages,we as clearMessagesUnreadStatus,Ne as clearTextMessageDraft,vn as clearUnreadCountByTimestamp,ue as connect,mn as deleteLocalMessagesByTimestamp,tn as deleteMessages,le as disconnect,Xe as forceRemoveChatRoomEntry,ze as forceSetChatRoomEntry,Je as getAllChatRoomEntries,Le as getAllUnreadMentionedCount,xe as getBlockedConversationList,We as getChatRoomEntry,qe as getChatRoomInfo,Ye as getChatroomHistoryMessages,ge as getConnectionStatus,Ce as getConversationList,Ue as getConversationNotificationStatus,Mn as getConversationsFromTagByPage,me as getCurrentUserId,kt as getFileToken,Gt as getFileUrl,dn as getFirstUnreadMessage,Xt as getHistoryMessages,ln as getMessage,sn as getMessageReader,Wt as getRemoteHistoryMessages,fe as getServerTime,En as getTags,yn as getTagsFromConversation,Ee as getTextMessageDraft,Ae as getTopConversationList,Re as getTotalUnreadCount,Oe as getUnreadCount,_n as getUnreadCountByTag,Pe as getUnreadMentionedCount,gn as getUnreadMentionedMessages,ce as init,un as insertMessage,de as installPlugin,ke as joinChatRoom,Ge as joinExistChatRoom,pe as onceEventListener,Be as quitChatRoom,en as recallMessage,cn as registerMessageType,je as removeChatRoomEntries,Ke as removeChatRoomEntry,Te as removeConversation,Rn as removeConversationsFromTag,ve as removeEventListener,Ie as removeEventListeners,an as removeMessageExpansionForKey,Cn as removeTag,wn as removeTagFromConversations,On as removeTagsFromConversation,ye as saveTextMessageDraft,pn as searchConversationByContent,fn as searchMessages,Vt as sendFileMessage,Kt as sendHQVoiceMessage,zt as sendImageMessage,Bt as sendMessage,Jt as sendReadReceiptMessage,Yt as sendReadReceiptRequest,Qt as sendReadReceiptResponse,$t as sendReadReceiptResponseV2,jt as sendSightMessage,Zt as sendSyncReadStatusMessage,qt as sendTextMessage,rn as sendTypingStatusMessage,Ve as setChatRoomEntries,Fe as setChatRoomEntry,_e as setConversationNotificationStatus,be as setConversationToTop,Un as setConversationToTopInTag,In as setMessageReceivedStatus,on as updateMessageExpansion,Tn as updateTag};