@rongcloud/imlib-v2-adapter 5.16.1 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/index.mjs +1 -1
- package/package.json +2 -2
package/index.mjs
CHANGED
|
@@ -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
|
-
***************************************************************************** */function R(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function M(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&s[0]?o.return:s[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,s[1])).done)return a;switch(o=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(6===s[0]&&r.label<a[1]){r.label=a[1],a=s;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(s);break}a[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function y(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var T=function(){function t(){}return t.set=function(n){if(e[n.messageType]&&e[n.messageType].isPersited){var o=t.get(n.conversationType,n.targetId,n.channelId||"");if(!o||o.sentTime<n.sentTime){var a=y(n.conversationType,n.targetId,n.channelId||"");t.map[a]=n}}},t.get=function(e,n,o){var a=y(e,n,o);return t.map[a]||null},t.remove=function(e,n,o){var a=y(e,n,o);delete t.map[a]},t.clear=function(){t.map={}},t.map={},t}(),E={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage","RC:RcNtf":"NotificationMessage"},N={};function O(e){var t=e.channelId,n=e.conversationType,a=e.targetId,s=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!o()){var d=T.get(n,a,t||"");(!r||d&&r.sentTime<d.sentTime)&&(r=d)}var l=r?U(r):null;return{channelId:t||"",conversationType:n,targetId:a,unreadMessageCount:s,latestMessage:l,latestMessageId:null==l?void 0:l.messageId,objectName:null==l?void 0:l.messageType,sentTime:null==l?void 0:l.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==l?void 0:l.receivedStatus,matchCount:g}}function U(e){var n=e.conversationType,o=e.targetId,a=e.senderUserId,s=e.content,r=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,u=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,p=e.expansion,f=e.messageId,I=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,R=e.pushConfig,M="";return r in E?M=E[r]:r in N?M=N[r]:(s={message:{content:s,objectName:r},messageName:"UnknownMessage"},M="UnknownMessage"),l||(l=t.UNREAD),void 0===f&&(f=~~(16777215*Math.random())),{channelId:v||"",conversationType:n,targetId:o,senderUserId:a,content:s,messageType:M,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:l,receivedTime:u,objectName:r,messageId:f,sentStatus:I||S.SENT,disableNotification:C,canIncludeExpansion:h,expansion:p,readReceiptInfo:m,pushConfig:R}}function _(e,t,o,a,s){var r=new Date(o-1e3*a*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===n.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");s.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),l=s.get(d);if(l){if(e.senderUserId in l)return void(l[e.senderUserId].uIds&&-1===l[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(l[e.senderUserId].uIds.push(e.content.messageUId),l[e.senderUserId].dealtime=e.sentTime,l[e.senderUserId].isResponse=!1,s.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void s.set(d,l)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},s.set(d,h)}}function A(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function B(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var L=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function x(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new L(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var b,P,w=x("ReadReceiptResponseMessage","RC:RRRspMsg"),k=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),a("conversationTypes",t,s.ARRAY),a("count",n,s.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,s=n.data,i=[];s=s||[],a===r.SUCCESS?(t?s.forEach((function(e){t.indexOf(e.conversationType)>-1&&i.push(O(e))})):s.forEach((function(e){i.push(O(e))})),A(e.onSuccess,i)):(o.logger.warn(c.O,"getConversationList -> code:".concat(a)),B(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;a("callback",n,s.CALLBACK),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),R(o,void 0,void 0,(function(){var o,a,s;return M(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(this.logger.warn(c.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(s?O(s):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||T.remove(e,t,o.channelId),A(n.onSuccess)):(o.logger.warn(c.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("draftText",n,s.STRING,!0),this.logger.info(c.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?A(e.onSuccess,a):(o.logger.warn(c.O,"getTotalUnreadCount ->code:".concat(n)),B(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(c.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===r.SUCCESS?A(e.onSuccess,!0):(n.logger.warn(c.O,"clearConversations ->code:".concat(t)),B(e.onError,t))})):this.logger.error(c.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),B(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===r.SUCCESS?A(e.onSuccess,!0):(t.logger.warn(c.O,"clearUnreadCount ->code:".concat(n)),B(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===r.SUCCESS?A(n.onSuccess,e.data?U(e.data):null):(o.logger.warn(c.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),B(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",o,s.CALLBACK),a("status",n,s.OBJECT,!0),this.logger.info(c.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var g=n.isTop,d=n.notificationStatus;this._context.setConversationStatus(e,t,g,d,this.channelId).then((function(e){e===r.SUCCESS?A(o.onSuccess):(i.logger.warn(c.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),B(o.onError,e))}))},e.prototype.sendMessage=function(e,o,g,d,l,u,h,C){var p=this;a("conversationType",e,s.NUMBER,!0),a("targetId",o,s.STRING,!0),a("msg",g,s.OBJECT,!0),a("callback",d,s.CALLBACK),a("isMentioned",l,s.BOOLEAN),a("pushContent",u,s.ONLY_STRING),a("pushData",h,s.ONLY_STRING),a("options.userIds",null==C?void 0:C.userIds,s.ARRAY),a("options.isVoipPush",null==C?void 0:C.isVoipPush,s.BOOLEAN),a("options.disableNotification",null==C?void 0:C.disableNotification,s.BOOLEAN),a("options.canIncludeExpansion",null==C?void 0:C.canIncludeExpansion,s.BOOLEAN),a("options.expansion",null==C?void 0:C.expansion,s.OBJECT),a("options.pushConfig",null==C?void 0:C.pushConfig,s.OBJECT),a("options.resendMessageId",null==C?void 0:C.resendMessageId,s.NUMBER),this.logger.info(c.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var f=!(!(null==C?void 0:C.isStatusMessage)&&!(null==C?void 0:C.isStatus)),I=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,l=a.pushConfig,u=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(C,l,g);u=u||"",h=h||"";var v=Object.assign(g,m(m({isMentioned:l,pushContent:u,pushData:h},I),{messageType:g.objectName,channelId:this.channelId,isStatusMessage:f})),R=this._context.getCurrentUserId(),M=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:v.messageType,conversationType:e,targetId:o,channelId:this.channelId}),M),this._context.sendMessage(e,o,v,d.onBefore,M).then((function(a){var s=a.code,l=a.data,u=s===r.SUCCESS?"info":"warn";if(p.logger[u](c.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:l?l.messageUId:"",messageId:l?l.messageId:""}),M),s===r.SUCCESS){p._isCPPMode||T.set(l);var h=U(l);_(h,R,p._context.getConnectedTime(),p._readReceiptTimeout,p._storage),A(d.onSuccess,h)}else p.logger.warn(c.O,"sendMessage ->code:".concat(s,",targetId:").concat(o)),B(d.onError,s,U({isMentioned:!!v.isMentioned,content:g.content,messageType:g.messageType,isPersited:g.isPersited,isCounted:g.isCounted,disableNotification:!!(null==C?void 0:C.disableNotification),canIncludeExpansion:!!(null==C?void 0:C.canIncludeExpansion),expansion:(null==C?void 0:C.expansion)||null,conversationType:e,targetId:o,senderUserId:R,messageUId:"",messageDirection:n.SEND,isOffLineMessage:!1,sentTime:(null==l?void 0:l.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:t.UNREAD,receivedStatusInfo:i(t.UNREAD),messageId:null==l?void 0:l.messageId,sentStatus:S.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;a("message.conversationType",e.conversationType,s.NUMBER,!0),a("message.targetId",e.targetId,s.STRING,!0),a("message.messageUId",e.messageUId,s.STRING,!0),a("message.sentTime",e.sentTime,s.NUMBER,!0),a("callback",t,s.CALLBACK),a("options.disableNotification",null==n?void 0:n.disableNotification,s.BOOLEAN),a("options.pushConfig",null==n?void 0:n.pushConfig,s.OBJECT),a("options.extra",null==n?void 0:n.extra,s.STRING);var i=e.conversationType,g=e.targetId,d=e.messageUId,l=e.sentTime;this.logger.info(c.O,"sendRecallMessage ->targetId:".concat(g,",conversationType:").concat(i,",messageUId:").concat(d));var u={conversationType:i,targetId:g,channelId:this.channelId},h=m({messageUId:d,sentTime:l},n);this._context.recallMessage(u,h).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?(o._isCPPMode||T.set(a),A(t.onSuccess,U(a))):(o.logger.warn(c.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(g,",messageUId:").concat(d)),B(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("typingContentType",n,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var g={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},d=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:g.messageType,conversationType:e,targetId:t,channelId:g.channelId}),d),this._context.sendMessage(e,t,g,void 0,d).then((function(e){var n=e.code,a=e.data,s=n===r.SUCCESS?"info":"warn";i.logger[s](c.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:a?a.messageUId:"",messageId:a?a.messageId:""}),d),n===r.SUCCESS?A(o.onSuccess,U(a)):(i.logger.warn(c.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),B(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(c.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var i=[];for(var g in r){var d={};d[g]=r[g].uIds,r[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new w({receiptMessageDic:a});o.sendMessage(e,t,g,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),A(n.onSuccess,e)},onError:function(e){o.logger.warn(c.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),B(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o,i,g=this;a("messageUIds",e,s.ARRAY,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));try{for(var d=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),l=d.next();!l.done;l=d.next()){var u=l.value;a("messageUId",u,s.STRING)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(o){var a=o.code;a===r.SUCCESS?n.onSuccess():(g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a))})).catch((function(o){g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(o,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(o)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;a("messageUId",e,s.STRING,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var s=a.code,i=a.data;s===r.SUCCESS?n.onSuccess(i):(o.logger.warn(c.O,"getMessageReader ->code:".concat(s,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(s))})).catch((function(a){o.logger.warn(c.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;a("expansion",e,s.OBJECT,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.expansion,h=t.objectName;this.logger.info(c.O,"updateMessageExpansion ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({messageType:h,conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,originExpansion:u,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),B(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;a("keys",e,s.ARRAY,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.objectName;this.logger.info(c.O,"removeMessageExpansionForKey ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,keys:e,channelId:this.channelId,messageType:u}).then((function(e){var t=e.code;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),B(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,i,g,d){var l=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",i,s.CALLBACK,!0),a("order",d,s.NUMBER),this.logger.info(c.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var u=this.logger.createTraceId();this.logger.info(c.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),u),this._context.getHistoryMessage(e,t,n,o,d,this.channelId,g,u).then((function(e){var t=e.code,n=e.data;if(t===r.SUCCESS)if(n){var o=n.list,a=n.hasMore,s=[],g=o.map((function(e){return s.push(e.messageUId),U(e)}));l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:s.join(",")}),u),A(i.onSuccess,g,a)}else l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),A(i.onSuccess,[],!1);else l.logger.warn(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),B(i.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("messages",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(a){if(a===r.SUCCESS){if(!i._isCPPMode){var s=T.get(e,t,i.channelId);s&&n.forEach((function(n){s.messageUId===n.messageUId&&T.remove(e,t,i.channelId)}))}A(o.onSuccess)}else i.logger.warn(c.O,"deleteRemoteMessages ->code:".concat(a,",targetId:").concat(t)),B(o.onError,a)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;a("param.conversationType",e.conversationType,s.NUMBER,!0),a("param.targetId",e.targetId,s.STRING,!0),a("param.timestamp",e.timestamp,s.NUMBER,!0),a("callback",t,s.CALLBACK);var o=e.conversationType,i=e.targetId,g=e.timestamp;this.logger.info(c.O,"clearRemoteHistoryMessages ->targetId:".concat(i,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,i,g,this.channelId).then((function(e){e===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"clearRemoteHistoryMessages ->code:".concat(e)),B(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){a("callback",e,s.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?A(e.onSuccess,o.map(O)):B(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){a("callback",e,s.CALLBACK),a("index",t,s.NUMBER),a("limit",n,s.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?A(e.onSuccess,o.map(O)):B(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={});var i=n.senderUserId,g=n.objectName,d=n.content,l=n.messageDirection,u=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,p=n.sentTime,f=n.sentStatus;this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var I=a.isUnread,S={senderUserId:i,messageType:g,content:d,messageDirection:l,sentTime:p,sentStatus:f,searchContent:a.searchContent,isUnread:I,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,S).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?A(o.onSuccess,U(a)):(s.logger.warn(c.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),B(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?A(n.onSuccess,o):B(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?A(n.onSuccess,o):B(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;this.logger.info(c.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===r.SUCCESS?A(a.onSuccess,!0):(s.logger.warn(c.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),B(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var g=s.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,g,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===r.SUCCESS)if(o){var s=o.list,g=o.hasMore,d=s.map((function(e){return U(e)}));A(a.onSuccess,d,g)}else A(a.onSuccess,[],!1);else i.logger.warn(c.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),B(a.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(c.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||T.remove(e,t,o.channelId),A(n.onSuccess,!0)):(o.logger.warn(c.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;this.logger.info(c.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(O(e))})),A(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),B(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(c.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(O(e))})),A(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),B(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,i){var g=this;this.logger.info(c.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,a,s,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var s=o=o||{},d=s.messages,l=s.count;d.forEach((function(e){a.push(U(e))})),A(i.onSuccess,a,l)}else g.logger.warn(c.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),B(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var g=o=o||{},d=g.messages,l=g.count;d.forEach((function(e){a.push(U(e))})),A(s.onSuccess,a,l)}else i.logger.warn(c.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),B(s.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,i,g){var d=this;this.logger.info(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(s,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,i).then((function(e){var n=e.code,o=e.data,a=[];n===r.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(U(e))})),A(g.onSuccess,a)):(d.logger.warn(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),B(g.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(c.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return U(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;this.logger.info(c.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):(a.logger.warn(c.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),B(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(c.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(c.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),B(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(c.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),B(t.onError,a))}))},e}(),G=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},D=function(){function e(e,t,n,a){this._context=e,this._options=t,this.logger=n,this._storage=a,this._channelClient={},this._isCPPMode=o(),this._defaultChannelClient=new k(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(r.NOT_SUPPORT),void this.logger.error(c.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(c.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(c.O,"getChannel method is only available in protocol stack mode"),null;if(a("channelId",e,s.STRING,!0),e.length>20)return this.logger.error(c.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(c.O,"Only 1000 channels can be obtained"),null;var t=new k(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;a("channelIds",e,s.ARRAY,!0),this.logger.info(c.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.16.1"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return R(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return this.logger.info(c.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(c.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"joinChatRoom ->chatRoomId:".concat(e));var i=this.logger.createTraceId();this.logger.info(c.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),i),this._context.joinChatroom(e,t,i).then((function(t){var a=t===r.SUCCESS?"info":"warn";o.logger[a](c.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),i),t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(c.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var s=a===r.SUCCESS?"info":"warn";n.logger[s](c.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),B(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var i=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?A(o.onSuccess,{userInfos:(null==a?void 0:a.userInfos)||[],userTotalNums:(null==a?void 0:a.userCount)||0}):(i.logger.warn(c.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),B(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("entry.key",e.key,s.STRING,!0),a("entry.value",e.value,s.STRING,!0)})),a("options.isAutoDelete",e.isAutoDelete,s.BOOLEAN)}(t),a("callback",n,s.CALLBACK),t.entries.length>10)B(n.onError,r.CHATROOM_KV_STORE_OUT_LIMIT);else{var i="id:".concat(e);this.logger.info(c.O,"set chatroom entry->".concat(i)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"set chatroom entry fail ->code+:".concat(t,",").concat(i)),B(n.onError,t,a))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("key",e,s.STRING,!0)}))}(t);var i="id:".concat(e);this.logger.debug(c.O,"remove chatroom entry->".concat(i));var g=m({},t);g.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,g).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(i)),B(n.onError,t,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("key",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,s=t.data;a===r.SUCCESS?A(n.onSuccess,s||""):(o.logger.warn(c.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),B(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),B(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,i){var g=this;void 0===i&&(i=0),a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),a("timestamp",i,s.NUMBER),this.logger.info(c.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,i).then((function(t){var n=t.code,a=t.data;if(n===r.SUCCESS)if(a){var s=a.list,i=a.hasMore,d=s.map((function(e){return U(e)}));A(o.onSuccess,d,i)}else A(o.onSuccess,[],!1);else g.logger.warn(c.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),B(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,r){a("fileType",e,s.NUMBER,!0),a("fileName",n,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(r)),this._context.getFileToken(e,n,o,r).then((function(e){t.onSuccess(m(m({},e),{bos:""}))})).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,r,i){a("fileType",e,s.NUMBER,!0),a("fileName",t,s.STRING,!0),a("saveName",n,s.STRING),a("callback",o,s.CALLBACK),a("serverType",i,s.NUMBER),a("uploadRes",r,s.OBJECT),this.logger.info(c.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),r?o.onSuccess(r):this._context.getFileUrl(e,t,i||g.QINIU,n).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagId",e.tagId,(function(e){return e.length<=10})),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("tag.tagName",e.tagName,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;a("tagId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagName",e.tagName,s.STRING,!0),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("callback",t,s.CALLBACK),this.logger.info(c.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;a("callback",e,s.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?e.onSuccess(a||[]):(t.logger.warn(c.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(c.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;a("conversationType",e.type,s.NUMBER),a("targetId",e.targetId,s.STRING),a("channelId",e.channelId,s.ONLY_STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(G(e)).then((function(e){var o=e.code,a=e.data;o===r.SUCCESS?t.onSuccess(a||[]):(n.logger.warn(c.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(c.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return G(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return G(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING),a("tagIds",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("tagId",e,s.STRING,!0)})),this.logger.info(c.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(G(e),t).then((function(e){var a=e.code;e.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).catch((function(e){o.logger.warn(c.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("startTime",n,s.NUMBER,!0),a("callback",o,s.CALLBACK,!0),this.logger.info(c.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,a=t.data,s=[];n===r.SUCCESS?((a=a||[]).forEach((function(e){s.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?U(s):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(s)):(i.logger.warn(c.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("containMuted",t,s.BOOLEAN,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,s=t.data;o.logger.info(c.O,JSON.stringify({code:a,data:s})),a===r.SUCCESS?n.onSuccess(s||0):(o.logger.warn(c.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("conversation.targetId",t.targetId,s.STRING,!0),a("conversation.type",t.type,s.NUMBER,!0),a("conversation.channelId",t.channelId,s.ONLY_STRING),a("status.isTop",null==n?void 0:n.isTop,s.BOOLEAN,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,G(t),n).then((function(t){var n=t.code;t.data,n===r.SUCCESS?o.onSuccess():(i.logger.warn(c.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];this.logger.info(c.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,a,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){a={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return r}(a),!1)).then((function(n){var a=n.code,s=n.data;if(a!==r.SUCCESS)o.logger.warn(c.O,"callExtra ->code:".concat(a)),t.onError&&B(t.onError,a);else{if("getConversationsByPage"===e&&s.forEach((function(e){e.latestMessage=e.latestMessage?U(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=s,g=i.list,d=i.hasMore,l=g.map((function(e){return U(e)}));return void A(t.onSuccess,l,d)}t.onSuccess&&A(t.onSuccess,s)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){a("callback",t,s.CALLBACK),this.logger.info(c.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){A(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(c.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;a("status",e,s.NUMBER),a("callback",t,s.CALLBACK),this.logger.info(c.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===r.SUCCESS?A(t.onSuccess,!0):(n.logger.warn(c.O,"setUserStatus ->code:".concat(e)),B(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),B(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),B(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),B(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;a("callback",e,s.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?A(e.onSuccess,a):(t.logger.warn(c.O,"getBlacklist ->code:".concat(o)),B(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),B(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,r){var i=this;void 0===r&&(r={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("content.senderUserId",n.senderUserId,s.STRING,!0),a("content.messageDirection",n.messageDirection,s.NUMBER,!0),a("content.objectName",n.objectName,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){i._defaultChannelClient.insertMessage(e,t,n,o,r)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,r,c=this;for(var i in a("messages",e,(function(t){return d(t)&&!(e.length<=0||e.length>=500)}),!0),a("checkDuplicate",t,s.BOOLEAN),a("callback",n,s.CALLBACK),e)a("message",e[i],s.OBJECT,!0),a("message.conversationType",e[i].conversationType,(function(e){return[l.PRIVATE,l.DISCUSSION,l.GROUP,l.CUSTOMER_SERVICE,l.SYSTEM,l.APP_PUBLIC_SERVICE,l.PUBLIC_SERVICE].includes(e)}),!0),a("message.targetId",e[i].targetId,s.STRING,!0),a("message.senderUserId",e[i].senderUserId,s.STRING,!0),a("message.messageType",e[i].messageType,s.STRING,!0),a("message.content",e[i].content,s.OBJECT,!0),a("message.messageDirection",e[i].messageDirection,s.NUMBER,!0),a("message.canIncludeExpansion",e[i].canIncludeExpansion,s.BOOLEAN),a("message.expansion",e[i].expansion,s.OBJECT),a("message.disableNotification",e[i].disableNotification,s.BOOLEAN),a("message.sentTime",e[i].sentTime,s.NUMBER),a("message.sentStatus",e[i].sentStatus,s.NUMBER),a("options.isUnread",null===(o=e[i])||void 0===o?void 0:o.isUnread,s.BOOLEAN),a("options.searchContent",null===(r=e[i])||void 0===r?void 0:r.searchContent,s.STRING);this.assertCPPMode((function(){c._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,r,c){var i=this;void 0===c&&(c={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",r,s.CALLBACK),a("options.order",c.order,s.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,r,c)}),"getRemoteHistoryMessages",r)},e.prototype.deleteLocalMessages=function(e,t,n,o){var i=this;a("messageIds",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){i._context.deleteMessages(n).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):(i.logger.warn(c.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),B(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,r){var c=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("cleanSpace",o,s.BOOLEAN),a("callback",r,s.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,r)}),"deleteLocalMessagesByTimestamp",r)},e.prototype.clearMessages=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;a("callback",t,s.CALLBACK),this.assertCPPMode((function(){n._context.getLocalMessage(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,U(s)):(n.logger.warn(c.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),B(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("sentStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),B(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("receivedStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),B(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var i=this;a("messageId",e,s.NUMBER,!0),a("objectName",n,s.ONLY_STRING,!0),this.assertCPPMode((function(){i.logger.info(c.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),i._context.setMessageContent(e,t,n).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):B(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("searchFiles",n,s.STRING,!0),this.logger.info(c.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var r=this;a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",n,s.ARRAY),a("customMessageType",o,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var r=this;void 0===n&&(n=[]),a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",o,s.ARRAY),a("customMessageType",n,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,r,c,i){var g=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("total",c,s.NUMBER),a("callback",i,s.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContent(e,t,n,o,r,c,i)}),"searchMessageByContent",i)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,r,c){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("callback",c,s.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,r,c)}),"searchMessageByContentWithAllChannel",c)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,r,c,i,g){var d=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("startTime",o,s.NUMBER),a("endTime",r,s.NUMBER),a("offset",c,s.NUMBER),a("limit",i,s.NUMBER),a("callback",g,s.CALLBACK),this.assertCPPMode((function(){d._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,r,c,i,g)}),"searchMessageByContentInTimeRangeWithAllChannel",g)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(c.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var r=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),this.assertCPPMode((function(){r._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),K=1;u.add("imlib-v2-adapter","5.16.1");var F,V,H=null,W={init:function(e,t,n){var o;void 0===n&&(n={}),a("appkey",e,s.STRING,!0),F=new h("API-V2"),P=C.init({appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime,environment:null!==(o=n.environment)&&void 0!==o?o:"default"}),H=P.logger,K=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),b=new D(P,{readReceiptTimeout:K},H,F),p.init(H)},getInstance:function(){return b},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){P.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==H||H.error(c.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){P.assignWatcher({message:function(t,n,a){try{var s=U(t),r=P.getCurrentUserId(),i=P.getConnectedTime();_(s,r,i,K,F),s=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[l]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[l]]=g.count,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(s,r,i,K,F),o()||T.set(t),e.onReceived(s,void 0,a)}catch(e){null==H||H.error(c.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){P.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==H||H.error(c.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){P.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==H||H.error(c.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){P.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==H||H.error(c.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){P.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==H||H.error(c.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){P.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==H||H.error(c.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){P.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==H||H.error(c.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){P.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){P.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){P.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==H||H.error(c.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){P.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==H||H.error(c.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return R(this,void 0,void 0,(function(){var o,a,s;return M(this,(function(i){switch(i.label){case 0:return o=null==H?void 0:H.createTraceId(),null==H||H.info(c.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,P.connect(e,!!n,o)];case 1:return a=i.sent(),s=a.code===r.SUCCESS?"info":"warn",null==H||H[s](c.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===r.SUCCESS?(t.onSuccess(a.userId),g=new Date(P.getConnectedTime()-1e3*K*60*60*24).getTime(),F.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=F.get(e).dealtime;t&&g-t>0&&F.remove(e)}else if(/RECEIVED$/.test(e)){var n=F.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&g-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?F.remove(e):F.set(e,n))}}))):a.code===r.RC_CONN_TOKEN_INCORRECT?(null==H||H.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==H||H.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var g}))}))},reconnect:function(e,t,n){var o=null==H?void 0:H.createTraceId();null==H||H.info(c.A_RECONNECT_T,null,o),P.reconnect(n).then((function(t){var n=t.code===r.SUCCESS?"info":"warn";null==H||H[n](c.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===r.SUCCESS?e.onSuccess(t.userId):(null==H||H.warn(c.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:N,getMessageObjectName:function(e){var t=m(m({},E),N);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=x(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,P.registerMessageType(t,n.isPersited,n.isCounted,o)}},J=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},j=function(e,t){this.isCounted=e,this.isPersited=t},Y=x("TextMessage","RC:TxtMsg"),q=x("LocationMessage","RC:LBSMsg"),Q=x("TypingStatusMessage","RC:TypSts"),X=x("ImageMessage","RC:ImgMsg"),$=x("RichContentMessage","RC:ImgTextMsg"),z=x("VoiceMessage","RC:VcMsg"),Z=x("HQVoiceMessage","RC:HQVCMsg"),ee=x("FileMessage","RC:FileMsg"),te=x("SightMessage","RC:SightMsg"),ne=x("GIFMessage","RC:GIFMsg"),oe=x("ReadReceiptMessage","RC:ReadNtf"),ae=x("ReadReceiptRequestMessage","RC:RRReqMsg"),se=x("RCCombineMessage","RC:CombineMsg"),re=function(e,t,n,o,a,s,r,c,i,g,d,l,u,h,C,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(V||(V={}));var ce,ie=x("AcceptMessage","RC:VCAccept"),ge=x("RingingMessage","RC:VCRinging"),de=x("SummaryMessage","RC:VCSummary"),le=x("HungupMessage","RC:VCHangup"),ue=x("InviteMessage","RC:VCInvite"),he=x("MediaModifyMessage","RC:VCModifyMedia"),Ce=x("MemberModifyMessage","RC:VCModifyMem"),pe=x("lastMessageSendTime","RC:SRSMsg"),fe=x("ReferenceMessage","RC:ReferenceMsg"),Ie=x("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Se=x("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(ce||(ce={}));var ve=ce,me={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=W);export{ie as AcceptMessage,L as BaseMessage,k as ChannelClient,me as ConnectionState,ee as FileMessage,ne as GIFMessage,v as GetChatRoomType,Z as HQVoiceMessage,le as HungupMessage,D as IMClient,X as ImageMessage,ue as InviteMessage,q as LocationMessage,he as MediaModifyMessage,Ce as MemberModifyMessage,J as MentionedInfo,ve as MentionedType,re as Message,j as MessageTag,Se as PublicServiceMultiRichContentMessage,Ie as PublicServiceRichContentMessage,se as RCCombineMessage,oe as ReadReceiptMessage,ae as ReadReceiptRequestMessage,w as ReadReceiptResponseMessage,fe as ReferenceMessage,$ as RichContentMessage,ge as RingingMessage,W as RongIMClient,S as SentStatus,te as SightMessage,de as SummaryMessage,pe as SyncReadStatusMessage,Y as TextMessage,Q as TypingStatusMessage,V as VoIPMediaType,z as VoiceMessage};
|
|
15
|
+
***************************************************************************** */function R(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function M(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&s[0]?o.return:s[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,s[1])).done)return a;switch(o=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(6===s[0]&&r.label<a[1]){r.label=a[1],a=s;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(s);break}a[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function y(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var T=function(){function t(){}return t.set=function(n){if(e[n.messageType]&&e[n.messageType].isPersited){var o=t.get(n.conversationType,n.targetId,n.channelId||"");if(!o||o.sentTime<n.sentTime){var a=y(n.conversationType,n.targetId,n.channelId||"");t.map[a]=n}}},t.get=function(e,n,o){var a=y(e,n,o);return t.map[a]||null},t.remove=function(e,n,o){var a=y(e,n,o);delete t.map[a]},t.clear=function(){t.map={}},t.map={},t}(),E={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage","RC:RcNtf":"NotificationMessage"},N={};function O(e){var t=e.channelId,n=e.conversationType,a=e.targetId,s=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!o()){var d=T.get(n,a,t||"");(!r||d&&r.sentTime<d.sentTime)&&(r=d)}var l=r?U(r):null;return{channelId:t||"",conversationType:n,targetId:a,unreadMessageCount:s,latestMessage:l,latestMessageId:null==l?void 0:l.messageId,objectName:null==l?void 0:l.messageType,sentTime:null==l?void 0:l.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==l?void 0:l.receivedStatus,matchCount:g}}function U(e){var n=e.conversationType,o=e.targetId,a=e.senderUserId,s=e.content,r=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,u=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,p=e.expansion,f=e.messageId,I=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,R=e.pushConfig,M="";return r in E?M=E[r]:r in N?M=N[r]:(s={message:{content:s,objectName:r},messageName:"UnknownMessage"},M="UnknownMessage"),l||(l=t.UNREAD),void 0===f&&(f=~~(16777215*Math.random())),{channelId:v||"",conversationType:n,targetId:o,senderUserId:a,content:s,messageType:M,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:l,receivedTime:u,objectName:r,messageId:f,sentStatus:I||S.SENT,disableNotification:C,canIncludeExpansion:h,expansion:p,readReceiptInfo:m,pushConfig:R}}function _(e,t,o,a,s){var r=new Date(o-1e3*a*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===n.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");s.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),l=s.get(d);if(l){if(e.senderUserId in l)return void(l[e.senderUserId].uIds&&-1===l[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(l[e.senderUserId].uIds.push(e.content.messageUId),l[e.senderUserId].dealtime=e.sentTime,l[e.senderUserId].isResponse=!1,s.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void s.set(d,l)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},s.set(d,h)}}function A(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function B(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var L=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function x(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new L(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var b,P,w=x("ReadReceiptResponseMessage","RC:RRRspMsg"),k=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),a("conversationTypes",t,s.ARRAY),a("count",n,s.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,s=n.data,i=[];s=s||[],a===r.SUCCESS?(t?s.forEach((function(e){t.indexOf(e.conversationType)>-1&&i.push(O(e))})):s.forEach((function(e){i.push(O(e))})),A(e.onSuccess,i)):(o.logger.warn(c.O,"getConversationList -> code:".concat(a)),B(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;a("callback",n,s.CALLBACK),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),R(o,void 0,void 0,(function(){var o,a,s;return M(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(this.logger.warn(c.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(s?O(s):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||T.remove(e,t,o.channelId),A(n.onSuccess)):(o.logger.warn(c.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("draftText",n,s.STRING,!0),this.logger.info(c.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?A(e.onSuccess,a):(o.logger.warn(c.O,"getTotalUnreadCount ->code:".concat(n)),B(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(c.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===r.SUCCESS?A(e.onSuccess,!0):(n.logger.warn(c.O,"clearConversations ->code:".concat(t)),B(e.onError,t))})):this.logger.error(c.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),B(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===r.SUCCESS?A(e.onSuccess,!0):(t.logger.warn(c.O,"clearUnreadCount ->code:".concat(n)),B(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===r.SUCCESS?A(n.onSuccess,e.data?U(e.data):null):(o.logger.warn(c.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),B(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",o,s.CALLBACK),a("status",n,s.OBJECT,!0),this.logger.info(c.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var g=n.isTop,d=n.notificationStatus;this._context.setConversationStatus(e,t,g,d,this.channelId).then((function(e){e===r.SUCCESS?A(o.onSuccess):(i.logger.warn(c.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),B(o.onError,e))}))},e.prototype.sendMessage=function(e,o,g,d,l,u,h,C){var p=this;a("conversationType",e,s.NUMBER,!0),a("targetId",o,s.STRING,!0),a("msg",g,s.OBJECT,!0),a("callback",d,s.CALLBACK),a("isMentioned",l,s.BOOLEAN),a("pushContent",u,s.ONLY_STRING),a("pushData",h,s.ONLY_STRING),a("options.userIds",null==C?void 0:C.userIds,s.ARRAY),a("options.isVoipPush",null==C?void 0:C.isVoipPush,s.BOOLEAN),a("options.disableNotification",null==C?void 0:C.disableNotification,s.BOOLEAN),a("options.canIncludeExpansion",null==C?void 0:C.canIncludeExpansion,s.BOOLEAN),a("options.expansion",null==C?void 0:C.expansion,s.OBJECT),a("options.pushConfig",null==C?void 0:C.pushConfig,s.OBJECT),a("options.resendMessageId",null==C?void 0:C.resendMessageId,s.NUMBER),this.logger.info(c.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var f=!(!(null==C?void 0:C.isStatusMessage)&&!(null==C?void 0:C.isStatus)),I=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,l=a.pushConfig,u=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(C,l,g);u=u||"",h=h||"";var v=Object.assign(g,m(m({isMentioned:l,pushContent:u,pushData:h},I),{messageType:g.objectName,channelId:this.channelId,isStatusMessage:f})),R=this._context.getCurrentUserId(),M=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:v.messageType,conversationType:e,targetId:o,channelId:this.channelId}),M),this._context.sendMessage(e,o,v,d.onBefore,M).then((function(a){var s=a.code,l=a.data,u=s===r.SUCCESS?"info":"warn";if(p.logger[u](c.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:l?l.messageUId:"",messageId:l?l.messageId:""}),M),s===r.SUCCESS){p._isCPPMode||T.set(l);var h=U(l);_(h,R,p._context.getConnectedTime(),p._readReceiptTimeout,p._storage),A(d.onSuccess,h)}else p.logger.warn(c.O,"sendMessage ->code:".concat(s,",targetId:").concat(o)),B(d.onError,s,U({isMentioned:!!v.isMentioned,content:g.content,messageType:g.messageType,isPersited:g.isPersited,isCounted:g.isCounted,disableNotification:!!(null==C?void 0:C.disableNotification),canIncludeExpansion:!!(null==C?void 0:C.canIncludeExpansion),expansion:(null==C?void 0:C.expansion)||null,conversationType:e,targetId:o,senderUserId:R,messageUId:"",messageDirection:n.SEND,isOffLineMessage:!1,sentTime:(null==l?void 0:l.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:t.UNREAD,receivedStatusInfo:i(t.UNREAD),messageId:null==l?void 0:l.messageId,sentStatus:S.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;a("message.conversationType",e.conversationType,s.NUMBER,!0),a("message.targetId",e.targetId,s.STRING,!0),a("message.messageUId",e.messageUId,s.STRING,!0),a("message.sentTime",e.sentTime,s.NUMBER,!0),a("callback",t,s.CALLBACK),a("options.disableNotification",null==n?void 0:n.disableNotification,s.BOOLEAN),a("options.pushConfig",null==n?void 0:n.pushConfig,s.OBJECT),a("options.extra",null==n?void 0:n.extra,s.STRING);var i=e.conversationType,g=e.targetId,d=e.messageUId,l=e.sentTime;this.logger.info(c.O,"sendRecallMessage ->targetId:".concat(g,",conversationType:").concat(i,",messageUId:").concat(d));var u={conversationType:i,targetId:g,channelId:this.channelId},h=m({messageUId:d,sentTime:l},n);this._context.recallMessage(u,h).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?(o._isCPPMode||T.set(a),A(t.onSuccess,U(a))):(o.logger.warn(c.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(g,",messageUId:").concat(d)),B(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("typingContentType",n,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var g={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},d=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:g.messageType,conversationType:e,targetId:t,channelId:g.channelId}),d),this._context.sendMessage(e,t,g,void 0,d).then((function(e){var n=e.code,a=e.data,s=n===r.SUCCESS?"info":"warn";i.logger[s](c.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:a?a.messageUId:"",messageId:a?a.messageId:""}),d),n===r.SUCCESS?A(o.onSuccess,U(a)):(i.logger.warn(c.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),B(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(c.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var i=[];for(var g in r){var d={};d[g]=r[g].uIds,r[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new w({receiptMessageDic:a});o.sendMessage(e,t,g,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),A(n.onSuccess,e)},onError:function(e){o.logger.warn(c.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),B(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o,i,g=this;a("messageUIds",e,s.ARRAY,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));try{for(var d=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),l=d.next();!l.done;l=d.next()){var u=l.value;a("messageUId",u,s.STRING)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(o){var a=o.code;a===r.SUCCESS?n.onSuccess():(g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a))})).catch((function(o){g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(o,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(o)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;a("messageUId",e,s.STRING,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var s=a.code,i=a.data;s===r.SUCCESS?n.onSuccess(i):(o.logger.warn(c.O,"getMessageReader ->code:".concat(s,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(s))})).catch((function(a){o.logger.warn(c.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;a("expansion",e,s.OBJECT,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.expansion,h=t.objectName;this.logger.info(c.O,"updateMessageExpansion ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({messageType:h,conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,originExpansion:u,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),B(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;a("keys",e,s.ARRAY,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.objectName;this.logger.info(c.O,"removeMessageExpansionForKey ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,keys:e,channelId:this.channelId,messageType:u}).then((function(e){var t=e.code;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),B(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,i,g,d){var l=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",i,s.CALLBACK,!0),a("order",d,s.NUMBER),this.logger.info(c.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var u=this.logger.createTraceId();this.logger.info(c.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),u),this._context.getHistoryMessage(e,t,n,o,d,this.channelId,g,u).then((function(e){var t=e.code,n=e.data;if(t===r.SUCCESS)if(n){var o=n.list,a=n.hasMore,s=[],g=o.map((function(e){return s.push(e.messageUId),U(e)}));l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:s.join(",")}),u),A(i.onSuccess,g,a)}else l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),A(i.onSuccess,[],!1);else l.logger.warn(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),B(i.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("messages",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(a){if(a===r.SUCCESS){if(!i._isCPPMode){var s=T.get(e,t,i.channelId);s&&n.forEach((function(n){s.messageUId===n.messageUId&&T.remove(e,t,i.channelId)}))}A(o.onSuccess)}else i.logger.warn(c.O,"deleteRemoteMessages ->code:".concat(a,",targetId:").concat(t)),B(o.onError,a)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;a("param.conversationType",e.conversationType,s.NUMBER,!0),a("param.targetId",e.targetId,s.STRING,!0),a("param.timestamp",e.timestamp,s.NUMBER,!0),a("callback",t,s.CALLBACK);var o=e.conversationType,i=e.targetId,g=e.timestamp;this.logger.info(c.O,"clearRemoteHistoryMessages ->targetId:".concat(i,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,i,g,this.channelId).then((function(e){e===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"clearRemoteHistoryMessages ->code:".concat(e)),B(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){a("callback",e,s.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?A(e.onSuccess,o.map(O)):B(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){a("callback",e,s.CALLBACK),a("index",t,s.NUMBER),a("limit",n,s.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?A(e.onSuccess,o.map(O)):B(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={});var i=n.senderUserId,g=n.objectName,d=n.content,l=n.messageDirection,u=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,p=n.sentTime,f=n.sentStatus;this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var I=a.isUnread,S={senderUserId:i,messageType:g,content:d,messageDirection:l,sentTime:p,sentStatus:f,searchContent:a.searchContent,isUnread:I,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,S).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?A(o.onSuccess,U(a)):(s.logger.warn(c.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),B(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?A(n.onSuccess,o):B(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?A(n.onSuccess,o):B(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;this.logger.info(c.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===r.SUCCESS?A(a.onSuccess,!0):(s.logger.warn(c.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),B(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var g=s.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,g,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===r.SUCCESS)if(o){var s=o.list,g=o.hasMore,d=s.map((function(e){return U(e)}));A(a.onSuccess,d,g)}else A(a.onSuccess,[],!1);else i.logger.warn(c.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),B(a.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(c.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||T.remove(e,t,o.channelId),A(n.onSuccess,!0)):(o.logger.warn(c.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;this.logger.info(c.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(O(e))})),A(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),B(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(c.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(O(e))})),A(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),B(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,i){var g=this;this.logger.info(c.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,a,s,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var s=o=o||{},d=s.messages,l=s.count;d.forEach((function(e){a.push(U(e))})),A(i.onSuccess,a,l)}else g.logger.warn(c.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),B(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var g=o=o||{},d=g.messages,l=g.count;d.forEach((function(e){a.push(U(e))})),A(s.onSuccess,a,l)}else i.logger.warn(c.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),B(s.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,i,g){var d=this;this.logger.info(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(s,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,i).then((function(e){var n=e.code,o=e.data,a=[];n===r.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(U(e))})),A(g.onSuccess,a)):(d.logger.warn(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),B(g.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(c.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return U(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;this.logger.info(c.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):(a.logger.warn(c.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),B(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(c.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),B(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(c.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?A(n.onSuccess,s):(o.logger.warn(c.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),B(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(c.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),B(t.onError,a))}))},e}(),G=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},D=function(){function e(e,t,n,a){this._context=e,this._options=t,this.logger=n,this._storage=a,this._channelClient={},this._isCPPMode=o(),this._defaultChannelClient=new k(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(r.NOT_SUPPORT),void this.logger.error(c.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(c.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(c.O,"getChannel method is only available in protocol stack mode"),null;if(a("channelId",e,s.STRING,!0),e.length>20)return this.logger.error(c.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(c.O,"Only 1000 channels can be obtained"),null;var t=new k(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;a("channelIds",e,s.ARRAY,!0),this.logger.info(c.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.18.0"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return R(this,void 0,void 0,(function(){return M(this,(function(t){switch(t.label){case 0:return this.logger.info(c.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(c.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"joinChatRoom ->chatRoomId:".concat(e));var i=this.logger.createTraceId();this.logger.info(c.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),i),this._context.joinChatroom(e,t,i).then((function(t){var a=t===r.SUCCESS?"info":"warn";o.logger[a](c.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),i),t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(c.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var s=a===r.SUCCESS?"info":"warn";n.logger[s](c.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),B(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var i=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?A(o.onSuccess,{userInfos:(null==a?void 0:a.userInfos)||[],userTotalNums:(null==a?void 0:a.userCount)||0}):(i.logger.warn(c.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),B(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("entry.key",e.key,s.STRING,!0),a("entry.value",e.value,s.STRING,!0)})),a("options.isAutoDelete",e.isAutoDelete,s.BOOLEAN)}(t),a("callback",n,s.CALLBACK),t.entries.length>10)B(n.onError,r.CHATROOM_KV_STORE_OUT_LIMIT);else{var i="id:".concat(e);this.logger.info(c.O,"set chatroom entry->".concat(i)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"set chatroom entry fail ->code+:".concat(t,",").concat(i)),B(n.onError,t,a))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("key",e,s.STRING,!0)}))}(t);var i="id:".concat(e);this.logger.debug(c.O,"remove chatroom entry->".concat(i));var g=m({},t);g.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,g).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(i)),B(n.onError,t,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess):(o.logger.warn(c.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),B(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("key",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,s=t.data;a===r.SUCCESS?A(n.onSuccess,s||""):(o.logger.warn(c.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),B(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),B(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,i){var g=this;void 0===i&&(i=0),a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),a("timestamp",i,s.NUMBER),this.logger.info(c.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,i).then((function(t){var n=t.code,a=t.data;if(n===r.SUCCESS)if(a){var s=a.list,i=a.hasMore,d=s.map((function(e){return U(e)}));A(o.onSuccess,d,i)}else A(o.onSuccess,[],!1);else g.logger.warn(c.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),B(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,r){a("fileType",e,s.NUMBER,!0),a("fileName",n,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(r)),this._context.getFileToken(e,n,o,r).then((function(e){t.onSuccess(m(m({},e),{bos:""}))})).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,r,i){a("fileType",e,s.NUMBER,!0),a("fileName",t,s.STRING,!0),a("saveName",n,s.STRING),a("callback",o,s.CALLBACK),a("serverType",i,s.NUMBER),a("uploadRes",r,s.OBJECT),this.logger.info(c.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),r?o.onSuccess(r):this._context.getFileUrl(e,t,i||g.QINIU,n).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagId",e.tagId,(function(e){return e.length<=10})),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("tag.tagName",e.tagName,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;a("tagId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagName",e.tagName,s.STRING,!0),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("callback",t,s.CALLBACK),this.logger.info(c.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;a("callback",e,s.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?e.onSuccess(a||[]):(t.logger.warn(c.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(c.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;a("conversationType",e.type,s.NUMBER),a("targetId",e.targetId,s.STRING),a("channelId",e.channelId,s.ONLY_STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(G(e)).then((function(e){var o=e.code,a=e.data;o===r.SUCCESS?t.onSuccess(a||[]):(n.logger.warn(c.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(c.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return G(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return G(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING),a("tagIds",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("tagId",e,s.STRING,!0)})),this.logger.info(c.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(G(e),t).then((function(e){var a=e.code;e.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).catch((function(e){o.logger.warn(c.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("startTime",n,s.NUMBER,!0),a("callback",o,s.CALLBACK,!0),this.logger.info(c.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,a=t.data,s=[];n===r.SUCCESS?((a=a||[]).forEach((function(e){s.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?U(s):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(s)):(i.logger.warn(c.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("containMuted",t,s.BOOLEAN,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,s=t.data;o.logger.info(c.O,JSON.stringify({code:a,data:s})),a===r.SUCCESS?n.onSuccess(s||0):(o.logger.warn(c.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("conversation.targetId",t.targetId,s.STRING,!0),a("conversation.type",t.type,s.NUMBER,!0),a("conversation.channelId",t.channelId,s.ONLY_STRING),a("status.isTop",null==n?void 0:n.isTop,s.BOOLEAN,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,G(t),n).then((function(t){var n=t.code;t.data,n===r.SUCCESS?o.onSuccess():(i.logger.warn(c.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];this.logger.info(c.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,a,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){a={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return r}(a),!1)).then((function(n){var a=n.code,s=n.data;if(a!==r.SUCCESS)o.logger.warn(c.O,"callExtra ->code:".concat(a)),t.onError&&B(t.onError,a);else{if("getConversationsByPage"===e&&s.forEach((function(e){e.latestMessage=e.latestMessage?U(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=s,g=i.list,d=i.hasMore,l=g.map((function(e){return U(e)}));return void A(t.onSuccess,l,d)}t.onSuccess&&A(t.onSuccess,s)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){a("callback",t,s.CALLBACK),this.logger.info(c.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){A(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(c.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;a("status",e,s.NUMBER),a("callback",t,s.CALLBACK),this.logger.info(c.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===r.SUCCESS?A(t.onSuccess,!0):(n.logger.warn(c.O,"setUserStatus ->code:".concat(e)),B(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),B(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),B(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===r.SUCCESS?A(t.onSuccess):(n.logger.warn(c.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),B(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;a("callback",e,s.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?A(e.onSuccess,a):(t.logger.warn(c.O,"getBlacklist ->code:".concat(o)),B(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,s):(n.logger.warn(c.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),B(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,r){var i=this;void 0===r&&(r={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("content.senderUserId",n.senderUserId,s.STRING,!0),a("content.messageDirection",n.messageDirection,s.NUMBER,!0),a("content.objectName",n.objectName,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){i._defaultChannelClient.insertMessage(e,t,n,o,r)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,r,c=this;for(var i in a("messages",e,(function(t){return d(t)&&!(e.length<=0||e.length>=500)}),!0),a("checkDuplicate",t,s.BOOLEAN),a("callback",n,s.CALLBACK),e)a("message",e[i],s.OBJECT,!0),a("message.conversationType",e[i].conversationType,(function(e){return[l.PRIVATE,l.DISCUSSION,l.GROUP,l.CUSTOMER_SERVICE,l.SYSTEM,l.APP_PUBLIC_SERVICE,l.PUBLIC_SERVICE].includes(e)}),!0),a("message.targetId",e[i].targetId,s.STRING,!0),a("message.senderUserId",e[i].senderUserId,s.STRING,!0),a("message.messageType",e[i].messageType,s.STRING,!0),a("message.content",e[i].content,s.OBJECT,!0),a("message.messageDirection",e[i].messageDirection,s.NUMBER,!0),a("message.canIncludeExpansion",e[i].canIncludeExpansion,s.BOOLEAN),a("message.expansion",e[i].expansion,s.OBJECT),a("message.disableNotification",e[i].disableNotification,s.BOOLEAN),a("message.sentTime",e[i].sentTime,s.NUMBER),a("message.sentStatus",e[i].sentStatus,s.NUMBER),a("options.isUnread",null===(o=e[i])||void 0===o?void 0:o.isUnread,s.BOOLEAN),a("options.searchContent",null===(r=e[i])||void 0===r?void 0:r.searchContent,s.STRING);this.assertCPPMode((function(){c._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,r,c){var i=this;void 0===c&&(c={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",r,s.CALLBACK),a("options.order",c.order,s.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,r,c)}),"getRemoteHistoryMessages",r)},e.prototype.deleteLocalMessages=function(e,t,n,o){var i=this;a("messageIds",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){i._context.deleteMessages(n).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):(i.logger.warn(c.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),B(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,r){var c=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("cleanSpace",o,s.BOOLEAN),a("callback",r,s.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,r)}),"deleteLocalMessagesByTimestamp",r)},e.prototype.clearMessages=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;a("callback",t,s.CALLBACK),this.assertCPPMode((function(){n._context.getLocalMessage(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?A(t.onSuccess,U(s)):(n.logger.warn(c.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),B(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("sentStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),B(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("receivedStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===r.SUCCESS?A(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),B(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var i=this;a("messageId",e,s.NUMBER,!0),a("objectName",n,s.ONLY_STRING,!0),this.assertCPPMode((function(){i.logger.info(c.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),i._context.setMessageContent(e,t,n).then((function(e){e===r.SUCCESS?A(o.onSuccess,!0):B(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("searchFiles",n,s.STRING,!0),this.logger.info(c.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var r=this;a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",n,s.ARRAY),a("customMessageType",o,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var r=this;void 0===n&&(n=[]),a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",o,s.ARRAY),a("customMessageType",n,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,r,c,i){var g=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("total",c,s.NUMBER),a("callback",i,s.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContent(e,t,n,o,r,c,i)}),"searchMessageByContent",i)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,r,c){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("callback",c,s.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,r,c)}),"searchMessageByContentWithAllChannel",c)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,r,c,i,g){var d=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("startTime",o,s.NUMBER),a("endTime",r,s.NUMBER),a("offset",c,s.NUMBER),a("limit",i,s.NUMBER),a("callback",g,s.CALLBACK),this.assertCPPMode((function(){d._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,r,c,i,g)}),"searchMessageByContentInTimeRangeWithAllChannel",g)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(c.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var r=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),this.assertCPPMode((function(){r._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),K=1;u.add("imlib-v2-adapter","5.18.0");var F,V,H=null,W={init:function(e,t,n){var o;void 0===n&&(n={}),a("appkey",e,s.STRING,!0),F=new h("API-V2"),P=C.init({appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime,environment:null!==(o=n.environment)&&void 0!==o?o:"default"}),H=P.logger,K=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),b=new D(P,{readReceiptTimeout:K},H,F),p.init(H)},getInstance:function(){return b},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){P.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==H||H.error(c.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){P.assignWatcher({message:function(t,n,a){try{var s=U(t),r=P.getCurrentUserId(),i=P.getConnectedTime();_(s,r,i,K,F),s=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[l]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[l]]=g.count,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(s,r,i,K,F),o()||T.set(t),e.onReceived(s,void 0,a)}catch(e){null==H||H.error(c.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){P.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==H||H.error(c.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){P.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==H||H.error(c.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){P.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==H||H.error(c.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){P.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==H||H.error(c.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){P.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==H||H.error(c.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){P.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==H||H.error(c.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){P.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){P.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){P.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==H||H.error(c.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){P.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==H||H.error(c.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return R(this,void 0,void 0,(function(){var o,a,s;return M(this,(function(i){switch(i.label){case 0:return o=null==H?void 0:H.createTraceId(),null==H||H.info(c.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,P.connect(e,!!n,o)];case 1:return a=i.sent(),s=a.code===r.SUCCESS?"info":"warn",null==H||H[s](c.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===r.SUCCESS?(t.onSuccess(a.userId),g=new Date(P.getConnectedTime()-1e3*K*60*60*24).getTime(),F.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=F.get(e).dealtime;t&&g-t>0&&F.remove(e)}else if(/RECEIVED$/.test(e)){var n=F.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&g-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?F.remove(e):F.set(e,n))}}))):a.code===r.RC_CONN_TOKEN_INCORRECT?(null==H||H.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==H||H.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var g}))}))},reconnect:function(e,t,n){var o=null==H?void 0:H.createTraceId();null==H||H.info(c.A_RECONNECT_T,null,o),P.reconnect(n).then((function(t){var n=t.code===r.SUCCESS?"info":"warn";null==H||H[n](c.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===r.SUCCESS?e.onSuccess(t.userId):(null==H||H.warn(c.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:N,getMessageObjectName:function(e){var t=m(m({},E),N);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=x(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,P.registerMessageType(t,n.isPersited,n.isCounted,o)}},J=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},j=function(e,t){this.isCounted=e,this.isPersited=t},Y=x("TextMessage","RC:TxtMsg"),q=x("LocationMessage","RC:LBSMsg"),Q=x("TypingStatusMessage","RC:TypSts"),X=x("ImageMessage","RC:ImgMsg"),$=x("RichContentMessage","RC:ImgTextMsg"),z=x("VoiceMessage","RC:VcMsg"),Z=x("HQVoiceMessage","RC:HQVCMsg"),ee=x("FileMessage","RC:FileMsg"),te=x("SightMessage","RC:SightMsg"),ne=x("GIFMessage","RC:GIFMsg"),oe=x("ReadReceiptMessage","RC:ReadNtf"),ae=x("ReadReceiptRequestMessage","RC:RRReqMsg"),se=x("RCCombineMessage","RC:CombineMsg"),re=function(e,t,n,o,a,s,r,c,i,g,d,l,u,h,C,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(V||(V={}));var ce,ie=x("AcceptMessage","RC:VCAccept"),ge=x("RingingMessage","RC:VCRinging"),de=x("SummaryMessage","RC:VCSummary"),le=x("HungupMessage","RC:VCHangup"),ue=x("InviteMessage","RC:VCInvite"),he=x("MediaModifyMessage","RC:VCModifyMedia"),Ce=x("MemberModifyMessage","RC:VCModifyMem"),pe=x("lastMessageSendTime","RC:SRSMsg"),fe=x("ReferenceMessage","RC:ReferenceMsg"),Ie=x("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Se=x("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(ce||(ce={}));var ve=ce,me={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=W);export{ie as AcceptMessage,L as BaseMessage,k as ChannelClient,me as ConnectionState,ee as FileMessage,ne as GIFMessage,v as GetChatRoomType,Z as HQVoiceMessage,le as HungupMessage,D as IMClient,X as ImageMessage,ue as InviteMessage,q as LocationMessage,he as MediaModifyMessage,Ce as MemberModifyMessage,J as MentionedInfo,ve as MentionedType,re as Message,j as MessageTag,Se as PublicServiceMultiRichContentMessage,Ie as PublicServiceRichContentMessage,se as RCCombineMessage,oe as ReadReceiptMessage,ae as ReadReceiptRequestMessage,w as ReadReceiptResponseMessage,fe as ReferenceMessage,$ as RichContentMessage,ge as RingingMessage,W as RongIMClient,S as SentStatus,te as SightMessage,de as SummaryMessage,pe as SyncReadStatusMessage,Y as TextMessage,Q as TypingStatusMessage,V as VoIPMediaType,z as VoiceMessage};
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"types": "./index.d.ts"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
-
"version": "5.
|
|
22
|
+
"version": "5.18.0",
|
|
23
23
|
"author": "pass-web@rongcloud.cn",
|
|
24
24
|
"license": "LGPL 2.1",
|
|
25
25
|
"homepage": "https://www.rongcloud.cn",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"globals": "RongIMLib"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@rongcloud/engine": "=5.
|
|
33
|
+
"@rongcloud/engine": "=5.18.0"
|
|
34
34
|
}
|
|
35
35
|
}
|