@rongcloud/imlib-v2-adapter 5.20.0 → 5.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.cjs
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 o(e,t,n,s){return new(n||(n=Promise))((function(r,a){function o(e){try{c(s.next(e))}catch(e){a(e)}}function i(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,i)}c((s=s.apply(e,t||[])).next())}))}function i(e,t){var n,s,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],s=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}function c(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var l=function(){function e(){}return Object.defineProperty(e,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(t.getMessageTypeDescription(n.messageType).isPersited){var s=e.get(n.conversationType,n.targetId,n.channelId||"");if(!s||s.sentTime<n.sentTime){var r=c(n.conversationType,n.targetId,n.channelId||"");e.map[r]=n}}}}),Object.defineProperty(e,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){var r=c(t,n,s);return e.map[r]||null}}),Object.defineProperty(e,"remove",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){var r=c(t,n,s);delete e.map[r]}}),Object.defineProperty(e,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.map={}}}),Object.defineProperty(e,"map",{enumerable:!0,configurable:!0,writable:!0,value:{}}),e}(),g={"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"},u={};function d(e){var n=e.channelId,s=e.conversationType,r=e.targetId,a=e.unreadMessageCount,o=e.latestMessage,i=e.isTop,c=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=l.get(s,r,n||"");(!o||u&&o.sentTime<u.sentTime)&&(o=u)}var d=o?f(o):null;return{channelId:n||"",conversationType:s,targetId:r,unreadMessageCount:a||0,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:i||!1,notificationStatus:c||t.NotificationStatus.CLOSE,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function f(e){var n=e.conversationType,r=e.targetId,a=e.senderUserId,o=e.content,i=e.messageType,c=e.messageUId,l=e.messageDirection,d=e.isOffLineMessage,f=e.sentTime,p=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,b=e.disableNotification,I=e.expansion,R=e.messageId,v=e.sentStatus,m=e.channelId,y=e.readReceiptInfo,T=e.pushConfig,S="";return i in g?S=g[i]:i in u?S=u[i]:(o={message:{content:o,objectName:i},messageName:"UnknownMessage"},S="UnknownMessage"),p||(p=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:m||"",conversationType:n,targetId:r,senderUserId:a,content:o,messageType:S,messageUId:c,messageDirection:l,offLineMessage:d,sentTime:f,receivedStatus:p,receivedTime:C,objectName:i,messageId:R,sentStatus:v||s.SENT,disableNotification:b,canIncludeExpansion:h,expansion:I,readReceiptInfo:y,pushConfig:T}}function p(e,n,s,r,a){var o=new Date(s-1e3*r*60*60*24).getTime()-e.sentTime<0,i=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===i&&o&&c===t.MessageDirection.SEND){var l="".concat(n).concat(e.content.messageUId,"SENT");a.set(l,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===i&&o){var g="".concat(n).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(g);if(u){if(e.senderUserId in u)return void(u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(g,u)));var d={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return u[e.senderUserId]=d,void a.set(g,u)}var f={};f[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(g,f)}}function C(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function h(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var b=function(e,t,n,s,r){void 0===s&&(s=!0),void 0===r&&(r=!0),Object.defineProperty(this,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"objectName",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"isPersited",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isCounted",{enumerable:!0,configurable:!0,writable:!0,value:r})};function I(e,t,n,s){void 0===n&&(n=!0),void 0===s&&(s=!0);var r=function(r){return new b(e,t,r,n,s)};return r.MessageType=e,r.ObjectName=t,r}var R,v,m=I("ReadReceiptResponseMessage","RC:RRRspMsg"),y=function(){function e(e,t,n,s,r,a){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"channelId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isCPPMode",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_readReceiptTimeout",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_draftMap",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getConversationList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER);var a={type:t.ConversationListFilterType.TIMESTAMP,params:{startTime:0,count:s||300,channelId:this.channelId}};this._context.getConversationListByFilter(a).then((function(s){var a=s.code,o=s.data,i=[];o=o||[],a===t.ErrorCode.SUCCESS?(n?o.forEach((function(e){n.indexOf(e.conversationType)>-1&&i.push(d(e))})):o.forEach((function(e){i.push(d(e))})),C(e.onSuccess,i)):(r.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),h(e.onError,a))}))}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",s,t.AssertRules.CALLBACK),o(r,void 0,void 0,(function(){var t,r,a,o;return i(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation({conversationType:e,targetId:n,channelId:this.channelId})];case 1:return t=i.sent(),r=t.isOk,a=t.code,o=t.data,r?(s.onSuccess(d(o)),[2]):(s.onError(a),[2])}}))}))}}),Object.defineProperty(e.prototype,"removeConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",s,t.AssertRules.CALLBACK),this._context.removeConversation({conversationType:e,targetId:n,channelId:this.channelId}).then((function(t){t.isOk?(r._isCPPMode||l.remove(e,n,r.channelId),C(s.onSuccess)):h(s.onError,t.code)}))}}),Object.defineProperty(e.prototype,"saveTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var r=this._context.getCurrentUserId();return!!r&&((this._draftMap[r]=this._draftMap[r]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]=s,!0)}}),Object.defineProperty(e.prototype,"getTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]}}),Object.defineProperty(e.prototype,"clearTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTotalUnreadCount(this.channelId,n,s).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"getUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getUnreadCount(e,n,this.channelId).then((function(e){var a=e.code,o=e.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o):(r.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(n)),this._isCPPMode?this._context.clearConversations(n,this.channelId).then((function(n){n===t.ErrorCode.SUCCESS?C(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(n)),h(e.onError,n))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")}}),Object.defineProperty(e.prototype,"clearUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearUnreadCount(e,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(n)),h(s.onError,e))}))}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){var r=s.code;r===t.ErrorCode.SUCCESS?C(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(r)),h(e.onError,r))}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,n,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?C(s.onSuccess,e.data?f(e.data):null):(r.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(n)),h(s.onError,e.code))}))}}),Object.defineProperty(e.prototype,"setConversationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0);var a=s.isTop,o=s.notificationStatus,i={conversationType:e,targetId:n,channelId:this.channelId},c=[];if(void 0!==a&&c.push(this._context.batchSetConversationToTop([i],!!a,!1,!1)),void 0!==o){var l=t.trans2NotificationLevel(o);c.push(this._context.batchSetConversationNotificationLevel([i],l))}Promise.all(c).then((function(e){var n=t.ErrorCode.SUCCESS;e.forEach((function(e){e.isOk||(n=e.code)})),n===t.ErrorCode.SUCCESS?C(r.onSuccess):h(r.onError,n)}))}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,r,o,i,c,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("msg",r,t.AssertRules.OBJECT,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("isMentioned",i,t.AssertRules.BOOLEAN),t.assert("pushContent",c,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(n,",conversationType:").concat(e));var b=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),I=function(e,t,n){var s,r=e||{},a=r.userIds,o=r.isVoipPush,i=r.disableNotification,c=r.isFilerWhiteBlacklist,l=r.expansion,g=r.canIncludeExpansion,u=r.pushConfig,d=r.resendMessageId,f=[];if(t){var p=(n||{}).content.mentionedInfo;f=p.userIdList,s=p.type}return{mentionedType:s,mentionedUserIdList:f,directionalUserIdList:a,isVoipPush:o,disableNotification:i,isFilerWhiteBlacklist:c,expansion:l,canIncludeExpansion:g,pushConfig:u,messageId:d}}(u,i,r);c=c||"",g=g||"";var R=Object.assign(r,a(a({isMentioned:i,pushContent:c,pushData:g},I),{messageType:r.objectName,channelId:this.channelId,isStatusMessage:b})),v=this._context.getCurrentUserId(),m=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:R.messageType,conversationType:e,targetId:n,channelId:this.channelId}),m),this._context.sendMessage(e,n,R,o.onBefore,m).then((function(a){var i=a.code,c=a.data,g=i===t.ErrorCode.SUCCESS?"info":"warn";if(d.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:i,messageUId:c?c.messageUId:"",messageId:c?c.messageId:""}),m),i===t.ErrorCode.SUCCESS){d._isCPPMode||l.set(c);var I=f(c);p(I,v,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),C(o.onSuccess,I)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(i,",targetId:").concat(n)),h(o.onError,i,f({isMentioned:!!R.isMentioned,content:r.content,messageType:r.messageType,isPersited:r.isPersited,isCounted:r.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:n,senderUserId:v,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==c?void 0:c.sentTime)||0,receivedTime:0,isStatusMessage:b,receivedStatus:t.ReceivedStatus.UNREAD,receivedStatusInfo:t.trans2IReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==c?void 0:c.messageId,sentStatus:s.FAILED}))}))}}),Object.defineProperty(e.prototype,"sendRecallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==s?void 0:s.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==s?void 0:s.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==s?void 0:s.extra,t.AssertRules.STRING);var o=e.conversationType,i=e.targetId,c=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(i,",conversationType:").concat(o,",messageUId:").concat(c));var u={conversationType:o,targetId:i,channelId:this.channelId},d=a({messageUId:c,sentTime:g},s);this._context.recallMessage(u,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(r._isCPPMode||l.set(a),C(n.onSuccess,f(a))):(r.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(i,",messageUId:").concat(c)),h(n.onError,s))}))}}),Object.defineProperty(e.prototype,"sendTypingStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(n,",conversationType:").concat(e));var o={messageType:"RC:TypSts",content:{typingContentType:s},isStatusMessage:!0,channelId:this.channelId},i=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:o.messageType,conversationType:e,targetId:n,channelId:o.channelId}),i),this._context.sendMessage(e,n,o,void 0,i).then((function(e){var s=e.code,o=e.data,c=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[c](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:o?o.messageUId:"",messageId:o?o.messageId:""}),i),s===t.ErrorCode.SUCCESS?C(r.onSuccess,f(o)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(n)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"sendReceiptResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(n,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),o="".concat(a).concat(e).concat(n,"RECEIVED"),i=this._storage.get(o);if(i){var c=[];for(var l in i){var g={};g[l]=i[l].uIds,i[l].isResponse||c.push(g)}if(0===c.length)return void s.onSuccess(null);var u=setInterval((function(){1===c.length&&clearInterval(u);var a=c.splice(0,1)[0],l=new m({receiptMessageDic:a});r.sendMessage(e,n,l,{onSuccess:function(e){var t=Object.keys(a)[0];i[t].isResponse=!0,r._storage.set(o,i),C(s.onSuccess,e)},onError:function(e){r.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(n)),h(s.onError,e)}})}),200)}else s.onSuccess(null)}}),Object.defineProperty(e.prototype,"sendReadReceiptMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r,a,o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(n,",messageUIds:").concat(e));try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],s=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),c=i.next();!c.done;c=i.next()){var l=c.value;t.assert("messageUId",l,t.AssertRules.STRING)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=i.return)&&a.call(i)}finally{if(r)throw r.error}}this._context.sendReadReceiptMessage(n,e,this.channelId).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(n,",messageUIds:").concat(e)),s.onError(a))})).catch((function(r){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(n,",messageUIds:").concat(e)),s.onError(r)}))}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(n,",messageUId:").concat(e)),this._context.getMessageReader(n,e,this.channelId).then((function(a){var o=a.code,i=a.data;o===t.ErrorCode.SUCCESS?s.onSuccess(i):(r.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(o,",targetId:").concat(n,",messageUId:").concat(e)),s.onError(o))})).catch((function(a){r.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(n,",messageUId:").concat(e)),s.onError(a)}))}}),Object.defineProperty(e.prototype,"updateMessageExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",n,t.AssertRules.OBJECT,!0);var a=n.conversationType,o=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,l=n.expansion,g=n.objectName;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(o,",messageUId:").concat(i,",conversationType:").concat(a)),this._context.sendExpansionMessage({messageType:g,conversationType:a,targetId:o,messageUId:i,canIncludeExpansion:c,originExpansion:l,expansion:e,channelId:this.channelId}).then((function(e){var n=e.code;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(n,",targetId:").concat(o,",messageUId:").concat(i)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeMessageExpansionForKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",n,t.AssertRules.OBJECT,!0);var a=n.conversationType,o=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,l=n.objectName;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(o,",messageUId:").concat(i,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:o,messageUId:i,canIncludeExpansion:c,keys:e,channelId:this.channelId,messageType:l}).then((function(e){var n=e.code;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(n,",targetId:").concat(o,",messageUId:").concat(i)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"getHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",r,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",i,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(n,",conversationType:").concat(e,",timestamp:").concat(s));var l=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:n,conversationType:e,channelId:"",timestamp:s,count:r}),l),this._context.getHistoryMessage(e,n,s,r,i,this.channelId,o,l).then((function(e){var n=e.code,s=e.data;if(n===t.ErrorCode.SUCCESS)if(s){var r=s.list,o=s.hasMore,i=[],g=r.map((function(e){return i.push(e.messageUId),f(e)}));c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:i.join(",")}),l),C(a.onSuccess,g,o)}else c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:""}),l),C(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:""}),l),h(a.onError,n)}))}}),Object.defineProperty(e.prototype,"deleteRemoteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("callback",r,t.AssertRules.CALLBACK),this._context.deleteRemoteMessage({conversationType:e,targetId:n,channelId:this.channelId},s).then((function(t){if(t.isOk){if(!a._isCPPMode){var o=l.get(e,n,a.channelId);o&&s.forEach((function(t){o.messageUId===t.messageUId&&l.remove(e,n,a.channelId)}))}C(r.onSuccess)}else h(r.onError,t.code)}))}}),Object.defineProperty(e.prototype,"clearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK);var s=e.conversationType,r=e.targetId,a=e.timestamp;this._context.deleteRemoteMessageByTimestamp({conversationType:s,targetId:r,channelId:this.channelId},a).then((function(e){e.isOk?C(n.onSuccess):h(n.onError,e.code)}))}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.assert("callback",e,t.AssertRules.CALLBACK);var n={type:t.ConversationListFilterType.ALL};this._context.getConversationListByFilter(n).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r.map(d)):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannelByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListByFilter({type:t.ConversationListFilterType.PAGE_INDEX,params:{index:n,limit:s}}).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r.map(d)):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a={});var i=s.senderUserId,c=s.objectName,l=s.content,g=s.messageDirection,u=s.canIncludeExpansion,d=s.expansion,p=s.disableNotification,b=s.sentTime,I=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(n,",conversationType:").concat(e));var R=a.isUnread,v={senderUserId:i,messageType:c,content:l,messageDirection:g,sentTime:b,sentStatus:I,searchContent:a.searchContent,isUnread:R,messageUId:"",disableNotification:p,canIncludeExpansion:u,expansionMsg:JSON.stringify(d),channelId:this.channelId};this._context.insertMessage(e,n,v).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?C(r.onSuccess,f(a)):(o.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(n)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.batchInsertMessage(e,n).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,r):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.getMessageCount(e,n).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,r):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"deleteLocalMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(n,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,n,s,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(a.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(n)),h(a.onError,e))}))}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(n,",conversationType:").concat(e));var c=o.order||0;this._context.getRemoteHistoryMessages(e,n,s,r,c,this.channelId).then((function(e){var s=e.code,r=e.data;if(s===t.ErrorCode.SUCCESS)if(r){var o=r.list,c=r.hasMore,l=o.map((function(e){return f(e)}));C(a.onSuccess,l,c)}else C(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(n)),h(a.onError,s)}))}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearMessages(e,n,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(r._isCPPMode||l.remove(e,n,r.channelId),C(s.onSuccess,!0)):(r.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,r,this.channelId,s).then((function(s){var r=s.code,o=s.data,i=[];o=o||[],r===t.ErrorCode.SUCCESS?(o.forEach((function(e){i.push(d(e))})),C(n.onSuccess,i)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(r,",keyword:").concat(e)),h(n.onError,r))}))}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;void 0===s&&(s=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,r).then((function(s){var r=s.code,o=s.data,i=[];o=o||[],r===t.ErrorCode.SUCCESS?(o.forEach((function(e){i.push(d(e))})),C(n.onSuccess,i)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(r,",keyword:").concat(e)),h(n.onError,r))}))}}),Object.defineProperty(e.prototype,"searchMessageByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(n,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,n,s,r,a,o,this.channelId).then((function(e){var s=e.code,r=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var o=r=r||{},l=o.messages,g=o.count;l.forEach((function(e){a.push(f(e))})),C(i.onSuccess,a,g)}else c.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(n)),h(i.onError,s)}))}}),Object.defineProperty(e.prototype,"searchMessageByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(n," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(r,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,n,s,r,a).then((function(e){var s=e.code,r=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var c=r=r||{},l=c.messages,g=c.count;l.forEach((function(e){a.push(f(e))})),C(o.onSuccess,a,g)}else i.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(n)),h(o.onError,s)}))}}),Object.defineProperty(e.prototype,"searchMessageByContentInTimeRangeWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i,c){var l=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(n," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(r,", endTime: ").concat(a,", offset: ").concat(o,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,n,s,r,a,o,i).then((function(e){var s=e.code,r=e.data,a=[];s===t.ErrorCode.SUCCESS?((r=r||{}).messages.forEach((function(e){a.push(f(e))})),C(c.onSuccess,a)):(l.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(n)),h(c.onError,s))}))}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,n,this.channelId).map((function(e){return f(e)}))}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,n,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(n)),h(r.onError,e))}))}}),Object.defineProperty(e.prototype,"getConversationNotificationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.getConversationNotificationLevel({conversationType:e,targetId:n,channelId:this.channelId}).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,t.trans2NotificationStatus(r)):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"getGroupMessageDeliverList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(n)),this._context.getGroupMessageDeliverList(e,n,this.channelId).then((function(e){var a=e.code,o=e.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o):(r.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"getPrivateMessageDeliverTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),h(n.onError,a))}))}}),e}(),T=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},S=function(){function e(e,n,s,r){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_channelClient",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_defaultChannelClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isCPPMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new y(this.logger,e,"",this._isCPPMode,n.readReceiptTimeout,this._storage)}return Object.defineProperty(e.prototype,"assertCPPMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(n,"' is unusable!"));e()}}),Object.defineProperty(e.prototype,"install",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.install(e,t)}}),Object.defineProperty(e.prototype,"getChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.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(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var n=new y(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=n,n}}),Object.defineProperty(e.prototype,"deleteChannels",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete n._channelClient[e]}))}),"deleteChannels")}}),Object.defineProperty(e.prototype,"getNavi",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getNaviInfoFromCache()||{}}}),Object.defineProperty(e.prototype,"getSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{version:"5.20.0"}}}),Object.defineProperty(e.prototype,"getAppInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{appKey:this._context.appkey}}}),Object.defineProperty(e.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentUserId()}}),Object.defineProperty(e.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"logout",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.disconnect()}}),Object.defineProperty(e.prototype,"clearCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getDeviceId()}}),Object.defineProperty(e.prototype,"getConversationList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannelByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)}}),Object.defineProperty(e.prototype,"removeConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)}}),Object.defineProperty(e.prototype,"saveTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)}}),Object.defineProperty(e.prototype,"getTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)}}),Object.defineProperty(e.prototype,"clearTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"getUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){this.logger.error(t.LogTagId.O,"Method is deprecated")}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearConversations(e,t)}}),Object.defineProperty(e.prototype,"clearUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._defaultChannelClient.clearAllUnreadCount(e)}}),Object.defineProperty(e.prototype,"setConversationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.setConversationStatus(e,t,n,s)}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s,r,a,o,i,c){return this._defaultChannelClient.sendMessage(e,t,n,s,r,a,o,c)}}),Object.defineProperty(e.prototype,"sendRecallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)}}),Object.defineProperty(e.prototype,"sendTypingStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,s)}}),Object.defineProperty(e.prototype,"sendReceiptResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)}}),Object.defineProperty(e.prototype,"sendReadReceiptMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)}}),Object.defineProperty(e.prototype,"updateMessageExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)}}),Object.defineProperty(e.prototype,"removeMessageExpansionForKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)}}),Object.defineProperty(e.prototype,"getHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s,r,a,o){return this._defaultChannelClient.getHistoryMessages(e,t,n,s,r,a,o)}}),Object.defineProperty(e.prototype,"joinChatRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:n,joinExist:!1}),a),this._context.joinChatroom(e,n,a).then((function(n){var o=n===t.ErrorCode.SUCCESS?"info":"warn";r.logger[o](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:n,timestamp:(new Date).getTime()}),a),n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"quitChatRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var r=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),r),this._context.quitChatroom(e).then((function(a){var o=a===t.ErrorCode.SUCCESS?"info":"warn";s.logger[o](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),r),a===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),h(n.onError,a))}))}}),Object.defineProperty(e.prototype,"getChatRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,n,s).then((function(n){var s=n.code,o=n.data;s===t.ErrorCode.SUCCESS?C(r.onSuccess,{userInfos:(null==o?void 0:o.userInfos)||[],userTotalNums:(null==o?void 0:o.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(s,",chatRoomId:").concat(e)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"setChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"setChatRoomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(n),t.assert("callback",s,t.AssertRules.CALLBACK),n.entries.length>10)h(s.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(t.LogTagId.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,n).then((function(e){var n=e.code,o=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(n,",").concat(a)),h(s.onError,n,o))}))}}}),Object.defineProperty(e.prototype,"forceSetChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeChatRoomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(n);var o="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(o));var i=a({},n);i.entries=n.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,i).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(n,",").concat(o)),h(s.onError,n,a))}))}}),Object.defineProperty(e.prototype,"forceRemoveChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"getChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(n)),this._context.getChatroomEntry(e,n).then((function(n){var a=n.code,o=n.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o||""):(r.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"getAllChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),h(n.onError,a))}))}}),Object.defineProperty(e.prototype,"getChatRoomHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,n,s,a).then((function(n){var s=n.code,a=n.data;if(s===t.ErrorCode.SUCCESS)if(a){var i=a.list,c=a.hasMore,l=i.map((function(e){return f(e)}));C(r.onSuccess,l,c)}else C(r.onSuccess,[],!1);else o.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),h(r.onError,s)}))}}),Object.defineProperty(e.prototype,"setDeviceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(e.prototype,"getCurrentConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getConnectionStatus()}}),Object.defineProperty(e.prototype,"deleteRemoteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,s)}}),Object.defineProperty(e.prototype,"clearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)}}),Object.defineProperty(e.prototype,"getFileToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,o){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(o)),this._context.getFileToken(e,s,r,o).then((function(e){n.onSuccess(a(a({},e),{bos:""}))})).catch(n.onError)}}),Object.defineProperty(e.prototype,"getFileUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING,!0),t.assert("saveName",s,t.AssertRules.STRING),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("serverType",o,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(n)),a?r.onSuccess(a):this._context.getFileUrl(e,n,o||t.UploadMethod.QINIU,s).then(r.onSuccess).catch(r.onError)}}),Object.defineProperty(e.prototype,"createTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(r,",tagId:").concat(e.tagId)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"removeTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(r,",tagId:").concat(e)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"updateTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(r,",tagId:").concat(e.tagId)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"getTagList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var r=s.code,a=s.data;r===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(r)),e.onError(r))})).catch((function(s){n.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))}}),Object.defineProperty(e.prototype,"getTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(T(e)).then((function(e){var r=e.code,a=e.data;r===t.ErrorCode.SUCCESS?n.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(r)),n.onError(r))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),n.onError(e)}))}}),Object.defineProperty(e.prototype,"addTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,n.map((function(e){return T(e)}))).then((function(n){var a=n.code;n.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"removeTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,n.map((function(e){return T(e)}))).then((function(n){var a=n.code;n.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"removeTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(n,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(T(e),n).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(n)),s.onError(a))})).catch((function(e){r.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(n)),s.onError(e)}))}}),Object.defineProperty(e.prototype,"getConversationListByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("startTime",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,s,n).then((function(n){var s=n.code,o=n.data,i=[];s===t.ErrorCode.SUCCESS?((o=o||[]).forEach((function(e){i.push(function(e){var n=e.channelId,s=e.conversationType,r=e.targetId,a=e.unreadMessageCount,o=e.latestMessage,i=e.isTop,c=e.notificationStatus,l=e.isTopInTag,g=o?f(o):null,u=g||{},d=u.messageType,p=u.sentTime,C=u.receivedStatus;return{channelId:n||"",conversationType:s,targetId:r,unreadMessageCount:a||0,latestMessage:g,isTopInTag:l,latestMessageId:u.messageId,objectName:d,sentTime:p,isTop:i||!1,notificationStatus:c||t.NotificationStatus.CLOSE,receivedStatus:C}}(e))})),r.onSuccess(i)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),r.onError(s))})).catch((function(n){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(n,",tagId:").concat(e)),r.onError(n)}))}}),Object.defineProperty(e.prototype,"getUnreadCountByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",n,t.AssertRules.BOOLEAN,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,n).then((function(n){var a=n.code,o=n.data;r.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:o})),a===t.ErrorCode.SUCCESS?s.onSuccess(o||0):(r.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"setConversationStatusInTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",n.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",n.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",n.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(n.targetId,",type").concat(n.type)),this._context.setConversationStatusInTag(e,T(n),s).then((function(n){var s=n.code;n.data,s===t.ErrorCode.SUCCESS?r.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),r.onError(s))})).catch((function(n){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(n,",tagId:").concat(e)),r.onError(n)}))}}),Object.defineProperty(e.prototype,"callExtra",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){for(var s,r=this,a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,function(e,t,n){if(n||2===arguments.length)for(var s,r=0,a=t.length;r<a;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var s,r,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}(a),!1)).then((function(s){var a=s.code,o=s.data;if(a!==t.ErrorCode.SUCCESS)r.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),n.onError&&h(n.onError,a);else{if("getHistoryMessagesByObjectNames"===e){var i=o,c=i.list,l=i.hasMore,g=c.map((function(e){return f(e)}));return void C(n.onSuccess,g,l)}n.onSuccess&&C(n.onSuccess,o)}}))}}),Object.defineProperty(e.prototype,"hasRemoteUnreadMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){C(n.onSuccess,!1)}),"hasRemoteUnreadMessages",n)}}),Object.defineProperty(e.prototype,"setUserStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,n)}),"setUserStatusListener")}}),Object.defineProperty(e.prototype,"setUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){s._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?C(n.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),h(n.onError,e))}))}),"setUserStatus",n)}}),Object.defineProperty(e.prototype,"getUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),h(n.onError,a))}))}),"getUserStatus",n)}}),Object.defineProperty(e.prototype,"addToBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(r){r===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(r,",useerId:").concat(e)),h(n.onError,r))}))}),"addToBlacklist",n)}}),Object.defineProperty(e.prototype,"removeFromBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(r){r===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(r,",useerId:").concat(e)),h(n.onError,r))}))}),"removeFromBlacklist",n)}}),Object.defineProperty(e.prototype,"getBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getBlacklist().then((function(s){var r=s.code,a=s.data;r===t.ErrorCode.SUCCESS?C(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(r)),h(e.onError,r))}))}),"getBlacklist",e)}}),Object.defineProperty(e.prototype,"getBlacklistStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),h(n.onError,a))}))}),"getBlacklistStatus",n)}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",s.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",s.objectName,t.AssertRules.STRING,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(n,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){o._defaultChannelClient.insertMessage(e,n,s,r,a)}),"insertMessage",r)}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r,a,o=this;for(var i in t.assert("messages",e,(function(n){return t.isArray(n)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",n,t.AssertRules.BOOLEAN),t.assert("callback",s,t.AssertRules.CALLBACK),e)t.assert("message",e[i],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[i].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[i].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[i].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[i].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[i].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[i].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[i].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[i].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[i].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[i].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[i].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(r=e[i])||void 0===r?void 0:r.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[i])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){o._defaultChannelClient.batchInsertMessage(e,n,s)}),"batchInsertMessage",s)}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.getMessageCount(e,n,s)}),"getMessageCount",s)}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;void 0===o&&(o={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",r,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",o.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,n,s,r,a,o)}),"getRemoteHistoryMessages",a)}}),Object.defineProperty(e.prototype,"deleteLocalMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(s)),this.assertCPPMode((function(){a._context.deleteMessages(s).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),h(r.onError,e))}))}),"deleteLocalMessages",r)}}),Object.defineProperty(e.prototype,"deleteLocalMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",r,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.deleteLocalMessagesByTimestamp(e,n,s,r,a)}),"deleteLocalMessagesByTimestamp",a)}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.clearMessages(e,n,s)}),"clearMessages",s)}}),Object.defineProperty(e.prototype,"getMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getLocalMessage(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,f(o)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),h(n.onError,a))}))}),"getMessage",n)}}),Object.defineProperty(e.prototype,"setMessageSentStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",n,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(n)),this.assertCPPMode((function(){r._context.setMessageSentStatus(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(n,",messageId:").concat(e)),h(s.onError,n))}))}),"setMessageSentStatus",s)}}),Object.defineProperty(e.prototype,"setMessageReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",n,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(n)),this.assertCPPMode((function(){r._context.setMessageReceivedStatus(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(n,",messageId:").concat(e)),h(s.onError,n))}))}),"setMessageReceivedStatus",s)}}),Object.defineProperty(e.prototype,"setMessageContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",s,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:s})),a._context.setMessageContent(e,n,s).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):h(r.onError,e)}))}),"setMessageContent",r)}}),Object.defineProperty(e.prototype,"setMessageSearchField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(s)),this.assertCPPMode((function(){r._context.setMessageSearchField(e,n,s)}),"setMessageSearchField")}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",r,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,n,s,r)}),"searchConversationByContent",n)}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationTypes",r,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,n,s,r)}),"searchConversationByContentWithAllChannel",n)}}),Object.defineProperty(e.prototype,"searchMessageByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",r,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",o,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,n,s,r,a,o,i)}),"searchMessageByContent",i)}}),Object.defineProperty(e.prototype,"searchMessageByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",r,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,n,s,r,a,o)}),"searchMessageByContentWithAllChannel",o)}}),Object.defineProperty(e.prototype,"searchMessageByContentInTimeRangeWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i,c){var l=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("startTime",r,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",o,t.AssertRules.NUMBER),t.assert("limit",i,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){l._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,n,s,r,a,o,i,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,n)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,n,s,r)}),"clearUnreadCountByTimestamp",r)}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationNotificationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.assertCPPMode((function(){r._defaultChannelClient.getConversationNotificationStatus(e,n,s)}),"getConversationNotificationStatus",s)}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getServerTime()}}),Object.defineProperty(e.prototype,"getGroupMessageDeliverList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)}}),Object.defineProperty(e.prototype,"getPrivateMessageDeliverTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)}}),e}(),E=1;t.VersionManage.add("imlib-v2-adapter","5.20.0");var M,A,O=null,L={init:function(e,n,s){var r;void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),M=new t.AppStorage("API-V2"),v=t.APIContext.init({appkey:e,navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,httpInMainProcess:!!s.httpInMainProcess,logExpireTime:s.logExpireTime,environment:null!==(r=s.environment)&&void 0!==r?r:"default",eventLoopBlockingCheck:s.eventLoopBlockingCheck}),O=v.logger,E=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),R=new S(v,{readReceiptTimeout:E},O,M),t.logger.init(O)},getInstance:function(){return R},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){v.assignWatcher({connection:function(n,s){try{e.onChanged(n,s)}catch(e){null==O||O.error(t.LogTagId.L_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){v.assignWatcher({message:function(n,s,r){try{var a=f(n),o=v.getCurrentUserId(),i=v.getConnectedTime();p(a,o,i,E,M),a=function(e,t,n,s,r){var a=new Date(n-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var o=e.content,i=((o=o||{}).receiptMessageDic||{})[t],c="",l={};if(e.receiptResponse=e.receiptResponse||{},i){for(var g=[],u=0;u<i.length;u++)c="".concat(t).concat(i[u],"SENT"),(l=r.get(c))&&!(e.senderUserId in l.userIds)&&(g.push(i[u]),l.count+=1,l.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[i[u]]=l.count,r.set(c,l));o.receiptMessageDic[t]=g,e.content=o}return e}(a,o,i,E,M),t.usingCppEngine()||l.set(n),e.onReceived(a,void 0,r)}catch(e){null==O||O.error(t.LogTagId.L_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){v.assignWatcher({conversationState:function(n){try{var s=[];n.forEach((function(e){var t=e.updatedItems,n=e.conversationType,r=e.targetId,a=e.channelId,o=(t=t||{}).notificationStatus,i=t.isTop;o&&i&&s.push({notificationStatus:o.val,isTop:i.val,conversationType:n,targetId:r,channelId:a||"",updatedTime:o.time})})),s.length>0&&e.onChanged(s)}catch(e){null==O||O.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){v.assignWatcher({expansion:function(n){try{n.updatedExpansion&&e.onUpdated(n.updatedExpansion),n.deletedExpansion&&e.onDeleted(n.deletedExpansion)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){v.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){v.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){v.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==O||O.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){v.assignWatcher({typingState:function(n){try{e.onChanged(n)}catch(e){null==O||O.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){v.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){v.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){v.assignWatcher({messageDelivered:function(n){try{e.onDelivered(n)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){v.assignWatcher({groupMessageDeliveredStatus:function(n){try{e.onDelivered(n)}catch(e){null==O||O.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,n,s){return o(this,void 0,void 0,(function(){var r,a,o;return i(this,(function(i){switch(i.label){case 0:return r=null==O?void 0:O.createTraceId(),null==O||O.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),r),[4,v.connect(e,!!s,r)];case 1:return a=i.sent(),o=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==O||O[o](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),r),a.code===t.ErrorCode.SUCCESS?(n.onSuccess(a.userId),c=new Date(v.getConnectedTime()-1e3*E*60*60*24).getTime(),M.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=M.get(e).dealtime;t&&c-t>0&&M.remove(e)}else if(/RECEIVED$/.test(e)){var n=M.get(e),s=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==s&&(0===n.length?M.remove(e):M.set(e,n))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),n.onTokenIncorrect()):(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),n.onError(a.code)),[2]}var c}))}))},reconnect:function(e,n,s){var r=null==O?void 0:O.createTraceId();null==O||O.info(t.LogTagId.A_RECONNECT_T,null,r),v.reconnect(s).then((function(n){var s=n.code===t.ErrorCode.SUCCESS?"info":"warn";null==O||O[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:n.code,userId:n.userId}),r),n.code===t.ErrorCode.SUCCESS?e.onSuccess(n.userId):(null==O||O.warn(t.LogTagId.O,"reconnect ->code:".concat(n.code)),e.onError(n.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:u,getMessageObjectName:function(e){var t=a(a({},g),u);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,s){this.RegisterMessage[e]=I(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,v.registerMessageType(t,n.isPersited,n.isCounted,s)}},P=function(e,t,n){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"userIdList",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"mentionedContent",{enumerable:!0,configurable:!0,writable:!0,value:n})},N=function(e,t){Object.defineProperty(this,"isCounted",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"isPersited",{enumerable:!0,configurable:!0,writable:!0,value:t})},U=I("TextMessage","RC:TxtMsg"),w=I("LocationMessage","RC:LBSMsg"),_=I("TypingStatusMessage","RC:TypSts"),B=I("ImageMessage","RC:ImgMsg"),x=I("RichContentMessage","RC:ImgTextMsg"),j=I("VoiceMessage","RC:VcMsg"),k=I("HQVoiceMessage","RC:HQVCMsg"),G=I("FileMessage","RC:FileMsg"),D=I("SightMessage","RC:SightMsg"),K=I("GIFMessage","RC:GIFMsg"),F=I("ReadReceiptMessage","RC:ReadNtf"),V=I("ReadReceiptRequestMessage","RC:RRReqMsg"),H=I("RCCombineMessage","RC:CombineMsg"),J=function(e,t,n,s,r,a,o,i,c,l,g,u,d,f,p,C,h,b){Object.defineProperty(this,"conversationType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"senderUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"objectName",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"messageUId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"messageDirection",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"offLineMessage",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"sentStatus",{enumerable:!0,configurable:!0,writable:!0,value:g}),Object.defineProperty(this,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"receivedStatus",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"receivedTime",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"canIncludeExpansion",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(this,"expansion",{enumerable:!0,configurable:!0,writable:!0,value:C}),Object.defineProperty(this,"receiptResponse",{enumerable:!0,configurable:!0,writable:!0,value:h}),Object.defineProperty(this,"disableNotification",{enumerable:!0,configurable:!0,writable:!0,value:b})};exports.VoIPMediaType=void 0,(A=exports.VoIPMediaType||(exports.VoIPMediaType={}))[A.MEDIA_AUDIO=1]="MEDIA_AUDIO",A[A.MEDIA_VEDIO=2]="MEDIA_VEDIO",A[A.MEDIA_VIDEO=2]="MEDIA_VIDEO";var W,Y=I("AcceptMessage","RC:VCAccept"),q=I("RingingMessage","RC:VCRinging"),Q=I("SummaryMessage","RC:VCSummary"),X=I("HungupMessage","RC:VCHangup"),$=I("InviteMessage","RC:VCInvite"),z=I("MediaModifyMessage","RC:VCModifyMedia"),Z=I("MemberModifyMessage","RC:VCModifyMem"),ee=I("lastMessageSendTime","RC:SRSMsg"),te=I("ReferenceMessage","RC:ReferenceMsg"),ne=I("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),se=I("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(W||(W={}));var re=W;window&&(window.RongIMClient=L),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Y,exports.BaseMessage=b,exports.ChannelClient=y,exports.ConnectionState={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},exports.FileMessage=G,exports.GIFMessage=K,exports.GetChatRoomType=r,exports.HQVoiceMessage=k,exports.HungupMessage=X,exports.IMClient=S,exports.ImageMessage=B,exports.InviteMessage=$,exports.LocationMessage=w,exports.MediaModifyMessage=z,exports.MemberModifyMessage=Z,exports.MentionedInfo=P,exports.MentionedType=re,exports.Message=J,exports.MessageTag=N,exports.PublicServiceMultiRichContentMessage=se,exports.PublicServiceRichContentMessage=ne,exports.RCCombineMessage=H,exports.ReadReceiptMessage=F,exports.ReadReceiptRequestMessage=V,exports.ReadReceiptResponseMessage=m,exports.ReferenceMessage=te,exports.RichContentMessage=x,exports.RingingMessage=q,exports.RongIMClient=L,exports.SentStatus=s,exports.SightMessage=D,exports.SummaryMessage=Q,exports.SyncReadStatusMessage=ee,exports.TextMessage=U,exports.TypingStatusMessage=_,exports.VoiceMessage=j;
|
|
15
|
+
***************************************************************************** */function o(e,t,n,s){return new(n||(n=Promise))((function(r,a){function o(e){try{c(s.next(e))}catch(e){a(e)}}function i(e){try{c(s.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,i)}c((s=s.apply(e,t||[])).next())}))}function i(e,t){var n,s,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,s&&(r=2&a[0]?s.return:a[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;switch(s=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,s=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],s=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}function c(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var l=function(){function e(){}return Object.defineProperty(e,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(t.getMessageTypeDescription(n.messageType).isPersited){var s=e.get(n.conversationType,n.targetId,n.channelId||"");if(!s||s.sentTime<n.sentTime){var r=c(n.conversationType,n.targetId,n.channelId||"");e.map[r]=n}}}}),Object.defineProperty(e,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){var r=c(t,n,s);return e.map[r]||null}}),Object.defineProperty(e,"remove",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){var r=c(t,n,s);delete e.map[r]}}),Object.defineProperty(e,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.map={}}}),Object.defineProperty(e,"map",{enumerable:!0,configurable:!0,writable:!0,value:{}}),e}(),g={"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"},u={};function d(e){var n=e.channelId,s=e.conversationType,r=e.targetId,a=e.unreadMessageCount,o=e.latestMessage,i=e.isTop,c=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=l.get(s,r,n||"");(!o||u&&o.sentTime<u.sentTime)&&(o=u)}var d=o?f(o):null;return{channelId:n||"",conversationType:s,targetId:r,unreadMessageCount:a||0,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:i||!1,notificationStatus:c||t.NotificationStatus.CLOSE,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function f(e){var n=e.conversationType,r=e.targetId,a=e.senderUserId,o=e.content,i=e.messageType,c=e.messageUId,l=e.messageDirection,d=e.isOffLineMessage,f=e.sentTime,p=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,b=e.disableNotification,I=e.expansion,R=e.messageId,v=e.sentStatus,m=e.channelId,y=e.readReceiptInfo,T=e.pushConfig,S="";return i in g?S=g[i]:i in u?S=u[i]:(o={message:{content:o,objectName:i},messageName:"UnknownMessage"},S="UnknownMessage"),p||(p=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:m||"",conversationType:n,targetId:r,senderUserId:a,content:o,messageType:S,messageUId:c,messageDirection:l,offLineMessage:d,sentTime:f,receivedStatus:p,receivedTime:C,objectName:i,messageId:R,sentStatus:v||s.SENT,disableNotification:b,canIncludeExpansion:h,expansion:I,readReceiptInfo:y,pushConfig:T}}function p(e,n,s,r,a){var o=new Date(s-1e3*r*60*60*24).getTime()-e.sentTime<0,i=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===i&&o&&c===t.MessageDirection.SEND){var l="".concat(n).concat(e.content.messageUId,"SENT");a.set(l,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===i&&o){var g="".concat(n).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(g);if(u){if(e.senderUserId in u)return void(u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(g,u)));var d={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return u[e.senderUserId]=d,void a.set(g,u)}var f={};f[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(g,f)}}function C(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function h(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var b=function(e,t,n,s,r){void 0===s&&(s=!0),void 0===r&&(r=!0),Object.defineProperty(this,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"objectName",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"isPersited",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isCounted",{enumerable:!0,configurable:!0,writable:!0,value:r})};function I(e,t,n,s){void 0===n&&(n=!0),void 0===s&&(s=!0);var r=function(r){return new b(e,t,r,n,s)};return r.MessageType=e,r.ObjectName=t,r}var R,v,m=I("ReadReceiptResponseMessage","RC:RRRspMsg"),y=function(){function e(e,t,n,s,r,a){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"channelId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_isCPPMode",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_readReceiptTimeout",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_draftMap",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getConversationList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER);var a={type:t.ConversationListFilterType.TIMESTAMP,params:{startTime:0,count:s||300,channelId:this.channelId}};this._context.getConversationListByFilter(a).then((function(s){var a=s.code,o=s.data,i=[];o=o||[],a===t.ErrorCode.SUCCESS?(n?o.forEach((function(e){n.indexOf(e.conversationType)>-1&&i.push(d(e))})):o.forEach((function(e){i.push(d(e))})),C(e.onSuccess,i)):(r.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),h(e.onError,a))}))}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",s,t.AssertRules.CALLBACK),o(r,void 0,void 0,(function(){var t,r,a,o;return i(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation({conversationType:e,targetId:n,channelId:this.channelId})];case 1:return t=i.sent(),r=t.isOk,a=t.code,o=t.data,r?(s.onSuccess(d(o)),[2]):(s.onError(a),[2])}}))}))}}),Object.defineProperty(e.prototype,"removeConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("callback",s,t.AssertRules.CALLBACK),this._context.removeConversation({conversationType:e,targetId:n,channelId:this.channelId}).then((function(t){t.isOk?(r._isCPPMode||l.remove(e,n,r.channelId),C(s.onSuccess)):h(s.onError,t.code)}))}}),Object.defineProperty(e.prototype,"saveTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var r=this._context.getCurrentUserId();return!!r&&((this._draftMap[r]=this._draftMap[r]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]=s,!0)}}),Object.defineProperty(e.prototype,"getTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]}}),Object.defineProperty(e.prototype,"clearTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(n,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(n,"_").concat(this.channelId)]}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTotalUnreadCount(this.channelId,n,s).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"getUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getUnreadCount(e,n,this.channelId).then((function(e){var a=e.code,o=e.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o):(r.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(n)),this._isCPPMode?this._context.clearConversations(n,this.channelId).then((function(n){n===t.ErrorCode.SUCCESS?C(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(n)),h(e.onError,n))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")}}),Object.defineProperty(e.prototype,"clearUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearUnreadCount(e,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(n)),h(s.onError,e))}))}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){var r=s.code;r===t.ErrorCode.SUCCESS?C(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(r)),h(e.onError,r))}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,n,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?C(s.onSuccess,e.data?f(e.data):null):(r.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(n)),h(s.onError,e.code))}))}}),Object.defineProperty(e.prototype,"setConversationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0);var a=s.isTop,o=s.notificationStatus,i={conversationType:e,targetId:n,channelId:this.channelId},c=[];if(void 0!==a&&c.push(this._context.batchSetConversationToTop([i],!!a,!1,!1)),void 0!==o){var l=t.trans2NotificationLevel(o);c.push(this._context.batchSetConversationNotificationLevel([i],l))}Promise.all(c).then((function(e){var n=t.ErrorCode.SUCCESS;e.forEach((function(e){e.isOk||(n=e.code)})),n===t.ErrorCode.SUCCESS?C(r.onSuccess):h(r.onError,n)}))}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,r,o,i,c,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("msg",r,t.AssertRules.OBJECT,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("isMentioned",i,t.AssertRules.BOOLEAN),t.assert("pushContent",c,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(n,",conversationType:").concat(e));var b=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),I=function(e,t,n){var s,r=e||{},a=r.userIds,o=r.isVoipPush,i=r.disableNotification,c=r.isFilerWhiteBlacklist,l=r.expansion,g=r.canIncludeExpansion,u=r.pushConfig,d=r.resendMessageId,f=[];if(t){var p=(n||{}).content.mentionedInfo;f=p.userIdList,s=p.type}return{mentionedType:s,mentionedUserIdList:f,directionalUserIdList:a,isVoipPush:o,disableNotification:i,isFilerWhiteBlacklist:c,expansion:l,canIncludeExpansion:g,pushConfig:u,messageId:d}}(u,i,r);c=c||"",g=g||"";var R=Object.assign(r,a(a({isMentioned:i,pushContent:c,pushData:g},I),{messageType:r.objectName,channelId:this.channelId,isStatusMessage:b})),v=this._context.getCurrentUserId(),m=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:R.messageType,conversationType:e,targetId:n,channelId:this.channelId}),m),this._context.sendMessage(e,n,R,o.onBefore,m).then((function(a){var i=a.code,c=a.data,g=i===t.ErrorCode.SUCCESS?"info":"warn";if(d.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:i,messageUId:c?c.messageUId:"",messageId:c?c.messageId:""}),m),i===t.ErrorCode.SUCCESS){d._isCPPMode||l.set(c);var I=f(c);p(I,v,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),C(o.onSuccess,I)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(i,",targetId:").concat(n)),h(o.onError,i,f({isMentioned:!!R.isMentioned,content:r.content,messageType:r.messageType,isPersited:r.isPersited,isCounted:r.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:n,senderUserId:v,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==c?void 0:c.sentTime)||0,receivedTime:0,isStatusMessage:b,receivedStatus:t.ReceivedStatus.UNREAD,receivedStatusInfo:t.trans2IReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==c?void 0:c.messageId,sentStatus:s.FAILED}))}))}}),Object.defineProperty(e.prototype,"sendRecallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==s?void 0:s.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==s?void 0:s.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==s?void 0:s.extra,t.AssertRules.STRING);var o=e.conversationType,i=e.targetId,c=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(i,",conversationType:").concat(o,",messageUId:").concat(c));var u={conversationType:o,targetId:i,channelId:this.channelId},d=a({messageUId:c,sentTime:g},s);this._context.recallMessage(u,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(r._isCPPMode||l.set(a),C(n.onSuccess,f(a))):(r.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(i,",messageUId:").concat(c)),h(n.onError,s))}))}}),Object.defineProperty(e.prototype,"sendTypingStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(n,",conversationType:").concat(e));var o={messageType:"RC:TypSts",content:{typingContentType:s},isStatusMessage:!0,channelId:this.channelId},i=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:o.messageType,conversationType:e,targetId:n,channelId:o.channelId}),i),this._context.sendMessage(e,n,o,void 0,i).then((function(e){var s=e.code,o=e.data,c=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[c](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:o?o.messageUId:"",messageId:o?o.messageId:""}),i),s===t.ErrorCode.SUCCESS?C(r.onSuccess,f(o)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(n)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"sendReceiptResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(n,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),o="".concat(a).concat(e).concat(n,"RECEIVED"),i=this._storage.get(o);if(i){var c=[];for(var l in i){var g={};g[l]=i[l].uIds,i[l].isResponse||c.push(g)}if(0===c.length)return void s.onSuccess(null);var u=setInterval((function(){1===c.length&&clearInterval(u);var a=c.splice(0,1)[0],l=new m({receiptMessageDic:a});r.sendMessage(e,n,l,{onSuccess:function(e){var t=Object.keys(a)[0];i[t].isResponse=!0,r._storage.set(o,i),C(s.onSuccess,e)},onError:function(e){r.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(n)),h(s.onError,e)}})}),200)}else s.onSuccess(null)}}),Object.defineProperty(e.prototype,"sendReadReceiptMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r,a,o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(n,",messageUIds:").concat(e));try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],s=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),c=i.next();!c.done;c=i.next()){var l=c.value;t.assert("messageUId",l,t.AssertRules.STRING)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=i.return)&&a.call(i)}finally{if(r)throw r.error}}this._context.sendReadReceiptMessage(n,e,this.channelId).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(n,",messageUIds:").concat(e)),s.onError(a))})).catch((function(r){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(n,",messageUIds:").concat(e)),s.onError(r)}))}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(n,",messageUId:").concat(e)),this._context.getMessageReader(n,e,this.channelId).then((function(a){var o=a.code,i=a.data;o===t.ErrorCode.SUCCESS?s.onSuccess(i):(r.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(o,",targetId:").concat(n,",messageUId:").concat(e)),s.onError(o))})).catch((function(a){r.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(n,",messageUId:").concat(e)),s.onError(a)}))}}),Object.defineProperty(e.prototype,"updateMessageExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",n,t.AssertRules.OBJECT,!0);var a=n.conversationType,o=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,l=n.expansion,g=n.objectName;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(o,",messageUId:").concat(i,",conversationType:").concat(a)),this._context.sendExpansionMessage({messageType:g,conversationType:a,targetId:o,messageUId:i,canIncludeExpansion:c,originExpansion:l,expansion:e,channelId:this.channelId}).then((function(e){var n=e.code;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(n,",targetId:").concat(o,",messageUId:").concat(i)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeMessageExpansionForKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",n,t.AssertRules.OBJECT,!0);var a=n.conversationType,o=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,l=n.objectName;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(o,",messageUId:").concat(i,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:o,messageUId:i,canIncludeExpansion:c,keys:e,channelId:this.channelId,messageType:l}).then((function(e){var n=e.code;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(n,",targetId:").concat(o,",messageUId:").concat(i)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"getHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",r,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",i,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(n,",conversationType:").concat(e,",timestamp:").concat(s));var l=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:n,conversationType:e,channelId:"",timestamp:s,count:r}),l),this._context.getHistoryMessage(e,n,s,r,i,this.channelId,o,l).then((function(e){var n=e.code,s=e.data;if(n===t.ErrorCode.SUCCESS)if(s){var r=s.list,o=s.hasMore,i=[],g=r.map((function(e){return i.push(e.messageUId),f(e)}));c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:i.join(",")}),l),C(a.onSuccess,g,o)}else c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:""}),l),C(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:n,messageUIds:""}),l),h(a.onError,n)}))}}),Object.defineProperty(e.prototype,"deleteRemoteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("callback",r,t.AssertRules.CALLBACK),this._context.deleteRemoteMessage({conversationType:e,targetId:n,channelId:this.channelId},s).then((function(t){if(t.isOk){if(!a._isCPPMode){var o=l.get(e,n,a.channelId);o&&s.forEach((function(t){o.messageUId===t.messageUId&&l.remove(e,n,a.channelId)}))}C(r.onSuccess)}else h(r.onError,t.code)}))}}),Object.defineProperty(e.prototype,"clearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK);var s=e.conversationType,r=e.targetId,a=e.timestamp;this._context.deleteRemoteMessageByTimestamp({conversationType:s,targetId:r,channelId:this.channelId},a).then((function(e){e.isOk?C(n.onSuccess):h(n.onError,e.code)}))}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.assert("callback",e,t.AssertRules.CALLBACK);var n={type:t.ConversationListFilterType.ALL};this._context.getConversationListByFilter(n).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r.map(d)):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannelByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListByFilter({type:t.ConversationListFilterType.PAGE_INDEX,params:{index:n,limit:s}}).then((function(n){var s=n.code,r=n.data;s===t.ErrorCode.SUCCESS?C(e.onSuccess,r.map(d)):h(e.onError,s)}))}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a={});var i=s.senderUserId,c=s.objectName,l=s.content,g=s.messageDirection,u=s.canIncludeExpansion,d=s.expansion,p=s.disableNotification,b=s.sentTime,I=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(n,",conversationType:").concat(e));var R=a.isUnread,v={senderUserId:i,messageType:c,content:l,messageDirection:g,sentTime:b,sentStatus:I,searchContent:a.searchContent,isUnread:R,messageUId:"",disableNotification:p,canIncludeExpansion:u,expansionMsg:JSON.stringify(d),channelId:this.channelId};this._context.insertMessage(e,n,v).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?C(r.onSuccess,f(a)):(o.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(n)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.batchInsertMessage(e,n).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,r):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.getMessageCount(e,n).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,r):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"deleteLocalMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(n,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,n,s,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(a.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(n)),h(a.onError,e))}))}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(n,",conversationType:").concat(e));var c=o.order||0;this._context.getRemoteHistoryMessages(e,n,s,r,c,this.channelId).then((function(e){var s=e.code,r=e.data;if(s===t.ErrorCode.SUCCESS)if(r){var o=r.list,c=r.hasMore,l=o.map((function(e){return f(e)}));C(a.onSuccess,l,c)}else C(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(n)),h(a.onError,s)}))}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearMessages(e,n,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(r._isCPPMode||l.remove(e,n,r.channelId),C(s.onSuccess,!0)):(r.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,r,this.channelId,s).then((function(s){var r=s.code,o=s.data,i=[];o=o||[],r===t.ErrorCode.SUCCESS?(o.forEach((function(e){i.push(d(e))})),C(n.onSuccess,i)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(r,",keyword:").concat(e)),h(n.onError,r))}))}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;void 0===s&&(s=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,r).then((function(s){var r=s.code,o=s.data,i=[];o=o||[],r===t.ErrorCode.SUCCESS?(o.forEach((function(e){i.push(d(e))})),C(n.onSuccess,i)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(r,",keyword:").concat(e)),h(n.onError,r))}))}}),Object.defineProperty(e.prototype,"searchMessageByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(n,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,n,s,r,a,o,this.channelId).then((function(e){var s=e.code,r=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var o=r=r||{},l=o.messages,g=o.count;l.forEach((function(e){a.push(f(e))})),C(i.onSuccess,a,g)}else c.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(n)),h(i.onError,s)}))}}),Object.defineProperty(e.prototype,"searchMessageByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(n," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(r,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,n,s,r,a).then((function(e){var s=e.code,r=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var c=r=r||{},l=c.messages,g=c.count;l.forEach((function(e){a.push(f(e))})),C(o.onSuccess,a,g)}else i.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(n)),h(o.onError,s)}))}}),Object.defineProperty(e.prototype,"searchMessageByContentInTimeRangeWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i,c){var l=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(n," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(r,", endTime: ").concat(a,", offset: ").concat(o,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,n,s,r,a,o,i).then((function(e){var s=e.code,r=e.data,a=[];s===t.ErrorCode.SUCCESS?((r=r||{}).messages.forEach((function(e){a.push(f(e))})),C(c.onSuccess,a)):(l.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(n)),h(c.onError,s))}))}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(n,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,n,this.channelId).map((function(e){return f(e)}))}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(n,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,n,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(n)),h(r.onError,e))}))}}),Object.defineProperty(e.prototype,"getConversationNotificationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){this._context.getConversationNotificationLevel({conversationType:e,targetId:n,channelId:this.channelId}).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess,t.trans2NotificationStatus(r)):h(s.onError,n)}))}}),Object.defineProperty(e.prototype,"getGroupMessageDeliverList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(n)),this._context.getGroupMessageDeliverList(e,n,this.channelId).then((function(e){var a=e.code,o=e.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o):(r.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(n)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"getPrivateMessageDeliverTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),h(n.onError,a))}))}}),e}(),T=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},S=function(){function e(e,n,s,r){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_storage",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_channelClient",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_defaultChannelClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isCPPMode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new y(this.logger,e,"",this._isCPPMode,n.readReceiptTimeout,this._storage)}return Object.defineProperty(e.prototype,"assertCPPMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(n,"' is unusable!"));e()}}),Object.defineProperty(e.prototype,"install",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.install(e,t)}}),Object.defineProperty(e.prototype,"getChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.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(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var n=new y(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=n,n}}),Object.defineProperty(e.prototype,"deleteChannels",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete n._channelClient[e]}))}),"deleteChannels")}}),Object.defineProperty(e.prototype,"getNavi",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getNaviInfoFromCache()||{}}}),Object.defineProperty(e.prototype,"getSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{version:"5.20.1"}}}),Object.defineProperty(e.prototype,"getAppInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{appKey:this._context.appkey}}}),Object.defineProperty(e.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentUserId()}}),Object.defineProperty(e.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"logout",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.disconnect()}}),Object.defineProperty(e.prototype,"clearCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getDeviceId()}}),Object.defineProperty(e.prototype,"getConversationList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)}}),Object.defineProperty(e.prototype,"getConversationListWithAllChannelByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)}}),Object.defineProperty(e.prototype,"removeConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)}}),Object.defineProperty(e.prototype,"saveTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)}}),Object.defineProperty(e.prototype,"getTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)}}),Object.defineProperty(e.prototype,"clearTextMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"getUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){this.logger.error(t.LogTagId.O,"Method is deprecated")}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearConversations(e,t)}}),Object.defineProperty(e.prototype,"clearUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._defaultChannelClient.clearAllUnreadCount(e)}}),Object.defineProperty(e.prototype,"setConversationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.setConversationStatus(e,t,n,s)}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s,r,a,o,i,c){return this._defaultChannelClient.sendMessage(e,t,n,s,r,a,o,c)}}),Object.defineProperty(e.prototype,"sendRecallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)}}),Object.defineProperty(e.prototype,"sendTypingStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,s)}}),Object.defineProperty(e.prototype,"sendReceiptResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)}}),Object.defineProperty(e.prototype,"sendReadReceiptMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)}}),Object.defineProperty(e.prototype,"updateMessageExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)}}),Object.defineProperty(e.prototype,"removeMessageExpansionForKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)}}),Object.defineProperty(e.prototype,"getHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s,r,a,o){return this._defaultChannelClient.getHistoryMessages(e,t,n,s,r,a,o)}}),Object.defineProperty(e.prototype,"joinChatRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:n,joinExist:!1}),a),this._context.joinChatroom(e,n,a).then((function(n){var o=n===t.ErrorCode.SUCCESS?"info":"warn";r.logger[o](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:n,timestamp:(new Date).getTime()}),a),n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"quitChatRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var r=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),r),this._context.quitChatroom(e).then((function(a){var o=a===t.ErrorCode.SUCCESS?"info":"warn";s.logger[o](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),r),a===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),h(n.onError,a))}))}}),Object.defineProperty(e.prototype,"getChatRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,n,s).then((function(n){var s=n.code,o=n.data;s===t.ErrorCode.SUCCESS?C(r.onSuccess,{userInfos:(null==o?void 0:o.userInfos)||[],userTotalNums:(null==o?void 0:o.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(s,",chatRoomId:").concat(e)),h(r.onError,s))}))}}),Object.defineProperty(e.prototype,"setChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"setChatRoomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(n),t.assert("callback",s,t.AssertRules.CALLBACK),n.entries.length>10)h(s.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(t.LogTagId.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,n).then((function(e){var n=e.code,o=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(n,",").concat(a)),h(s.onError,n,o))}))}}}),Object.defineProperty(e.prototype,"forceSetChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"removeChatRoomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(n);var o="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(o));var i=a({},n);i.entries=n.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,i).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(n,",").concat(o)),h(s.onError,n,a))}))}}),Object.defineProperty(e.prototype,"forceRemoveChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",n,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess):(r.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(n,",chatRoomId:").concat(e)),h(s.onError,n))}))}}),Object.defineProperty(e.prototype,"getChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(n)),this._context.getChatroomEntry(e,n).then((function(n){var a=n.code,o=n.data;a===t.ErrorCode.SUCCESS?C(s.onSuccess,o||""):(r.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),h(s.onError,a))}))}}),Object.defineProperty(e.prototype,"getAllChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),h(n.onError,a))}))}}),Object.defineProperty(e.prototype,"getChatRoomHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,n,s,a).then((function(n){var s=n.code,a=n.data;if(s===t.ErrorCode.SUCCESS)if(a){var i=a.list,c=a.hasMore,l=i.map((function(e){return f(e)}));C(r.onSuccess,l,c)}else C(r.onSuccess,[],!1);else o.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),h(r.onError,s)}))}}),Object.defineProperty(e.prototype,"setDeviceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(e.prototype,"getCurrentConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getConnectionStatus()}}),Object.defineProperty(e.prototype,"deleteRemoteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,s)}}),Object.defineProperty(e.prototype,"clearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)}}),Object.defineProperty(e.prototype,"getFileToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,o){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(o)),this._context.getFileToken(e,s,r,o).then((function(e){n.onSuccess(a(a({},e),{bos:""}))})).catch(n.onError)}}),Object.defineProperty(e.prototype,"getFileUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING,!0),t.assert("saveName",s,t.AssertRules.STRING),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("serverType",o,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(n)),a?r.onSuccess(a):this._context.getFileUrl(e,n,o||t.UploadMethod.QINIU,s).then(r.onSuccess).catch(r.onError)}}),Object.defineProperty(e.prototype,"createTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(r,",tagId:").concat(e.tagId)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"removeTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(r,",tagId:").concat(e)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"updateTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),n.onError(a))})).catch((function(r){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(r,",tagId:").concat(e.tagId)),n.onError(r)}))}}),Object.defineProperty(e.prototype,"getTagList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var r=s.code,a=s.data;r===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(r)),e.onError(r))})).catch((function(s){n.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))}}),Object.defineProperty(e.prototype,"getTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(T(e)).then((function(e){var r=e.code,a=e.data;r===t.ErrorCode.SUCCESS?n.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(r)),n.onError(r))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),n.onError(e)}))}}),Object.defineProperty(e.prototype,"addTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,n.map((function(e){return T(e)}))).then((function(n){var a=n.code;n.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"removeTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,n.map((function(e){return T(e)}))).then((function(n){var a=n.code;n.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"removeTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),n.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(n,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(T(e),n).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(r.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(n)),s.onError(a))})).catch((function(e){r.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(n)),s.onError(e)}))}}),Object.defineProperty(e.prototype,"getConversationListByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("startTime",s,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,s,n).then((function(n){var s=n.code,o=n.data,i=[];s===t.ErrorCode.SUCCESS?((o=o||[]).forEach((function(e){i.push(function(e){var n=e.channelId,s=e.conversationType,r=e.targetId,a=e.unreadMessageCount,o=e.latestMessage,i=e.isTop,c=e.notificationStatus,l=e.isTopInTag,g=o?f(o):null,u=g||{},d=u.messageType,p=u.sentTime,C=u.receivedStatus;return{channelId:n||"",conversationType:s,targetId:r,unreadMessageCount:a||0,latestMessage:g,isTopInTag:l,latestMessageId:u.messageId,objectName:d,sentTime:p,isTop:i||!1,notificationStatus:c||t.NotificationStatus.CLOSE,receivedStatus:C}}(e))})),r.onSuccess(i)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),r.onError(s))})).catch((function(n){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(n,",tagId:").concat(e)),r.onError(n)}))}}),Object.defineProperty(e.prototype,"getUnreadCountByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",n,t.AssertRules.BOOLEAN,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,n).then((function(n){var a=n.code,o=n.data;r.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:o})),a===t.ErrorCode.SUCCESS?s.onSuccess(o||0):(r.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(n,",tagId:").concat(e)),s.onError(n)}))}}),Object.defineProperty(e.prototype,"setConversationStatusInTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",n.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",n.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",n.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(n.targetId,",type").concat(n.type)),this._context.setConversationStatusInTag(e,T(n),s).then((function(n){var s=n.code;n.data,s===t.ErrorCode.SUCCESS?r.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),r.onError(s))})).catch((function(n){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(n,",tagId:").concat(e)),r.onError(n)}))}}),Object.defineProperty(e.prototype,"callExtra",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){for(var s,r=this,a=[],o=2;o<arguments.length;o++)a[o-2]=arguments[o];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,function(e,t,n){if(n||2===arguments.length)for(var s,r=0,a=t.length;r<a;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var s,r,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(s=a.next()).done;)o.push(s.value)}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}(a),!1)).then((function(s){var a=s.code,o=s.data;if(a!==t.ErrorCode.SUCCESS)r.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),n.onError&&h(n.onError,a);else{if("getHistoryMessagesByObjectNames"===e){var i=o,c=i.list,l=i.hasMore,g=c.map((function(e){return f(e)}));return void C(n.onSuccess,g,l)}n.onSuccess&&C(n.onSuccess,o)}}))}}),Object.defineProperty(e.prototype,"hasRemoteUnreadMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){C(n.onSuccess,!1)}),"hasRemoteUnreadMessages",n)}}),Object.defineProperty(e.prototype,"setUserStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,n)}),"setUserStatusListener")}}),Object.defineProperty(e.prototype,"setUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){s._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?C(n.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),h(n.onError,e))}))}),"setUserStatus",n)}}),Object.defineProperty(e.prototype,"getUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),h(n.onError,a))}))}),"getUserStatus",n)}}),Object.defineProperty(e.prototype,"addToBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(r){r===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(r,",useerId:").concat(e)),h(n.onError,r))}))}),"addToBlacklist",n)}}),Object.defineProperty(e.prototype,"removeFromBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(r){r===t.ErrorCode.SUCCESS?C(n.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(r,",useerId:").concat(e)),h(n.onError,r))}))}),"removeFromBlacklist",n)}}),Object.defineProperty(e.prototype,"getBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getBlacklist().then((function(s){var r=s.code,a=s.data;r===t.ErrorCode.SUCCESS?C(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(r)),h(e.onError,r))}))}),"getBlacklist",e)}}),Object.defineProperty(e.prototype,"getBlacklistStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,o):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),h(n.onError,a))}))}),"getBlacklistStatus",n)}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",s.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",s.objectName,t.AssertRules.STRING,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(n,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){o._defaultChannelClient.insertMessage(e,n,s,r,a)}),"insertMessage",r)}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r,a,o=this;for(var i in t.assert("messages",e,(function(n){return t.isArray(n)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",n,t.AssertRules.BOOLEAN),t.assert("callback",s,t.AssertRules.CALLBACK),e)t.assert("message",e[i],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[i].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[i].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[i].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[i].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[i].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[i].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[i].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[i].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[i].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[i].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[i].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(r=e[i])||void 0===r?void 0:r.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[i])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){o._defaultChannelClient.batchInsertMessage(e,n,s)}),"batchInsertMessage",s)}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.getMessageCount(e,n,s)}),"getMessageCount",s)}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;void 0===o&&(o={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",r,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",o.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,n,s,r,a,o)}),"getRemoteHistoryMessages",a)}}),Object.defineProperty(e.prototype,"deleteLocalMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",r,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(s)),this.assertCPPMode((function(){a._context.deleteMessages(s).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),h(r.onError,e))}))}),"deleteLocalMessages",r)}}),Object.defineProperty(e.prototype,"deleteLocalMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",r,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.deleteLocalMessagesByTimestamp(e,n,s,r,a)}),"deleteLocalMessagesByTimestamp",a)}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.clearMessages(e,n,s)}),"clearMessages",s)}}),Object.defineProperty(e.prototype,"getMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){var s=this;t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getLocalMessage(e).then((function(r){var a=r.code,o=r.data;a===t.ErrorCode.SUCCESS?C(n.onSuccess,f(o)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),h(n.onError,a))}))}),"getMessage",n)}}),Object.defineProperty(e.prototype,"setMessageSentStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",n,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(n)),this.assertCPPMode((function(){r._context.setMessageSentStatus(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(n,",messageId:").concat(e)),h(s.onError,n))}))}),"setMessageSentStatus",s)}}),Object.defineProperty(e.prototype,"setMessageReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",n,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(n)),this.assertCPPMode((function(){r._context.setMessageReceivedStatus(e,n).then((function(n){n===t.ErrorCode.SUCCESS?C(s.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(n,",messageId:").concat(e)),h(s.onError,n))}))}),"setMessageReceivedStatus",s)}}),Object.defineProperty(e.prototype,"setMessageContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",s,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:s})),a._context.setMessageContent(e,n,s).then((function(e){e===t.ErrorCode.SUCCESS?C(r.onSuccess,!0):h(r.onError,e)}))}),"setMessageContent",r)}}),Object.defineProperty(e.prototype,"setMessageSearchField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(s)),this.assertCPPMode((function(){r._context.setMessageSearchField(e,n,s)}),"setMessageSearchField")}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",r,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,n,s,r)}),"searchConversationByContent",n)}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationTypes",r,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,n,s,r)}),"searchConversationByContentWithAllChannel",n)}}),Object.defineProperty(e.prototype,"searchMessageByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",r,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",o,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,n,s,r,a,o,i)}),"searchMessageByContent",i)}}),Object.defineProperty(e.prototype,"searchMessageByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",r,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,n,s,r,a,o)}),"searchMessageByContentWithAllChannel",o)}}),Object.defineProperty(e.prototype,"searchMessageByContentInTimeRangeWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r,a,o,i,c){var l=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("startTime",r,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",o,t.AssertRules.NUMBER),t.assert("limit",i,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){l._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,n,s,r,a,o,i,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,n)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s,r){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,n,s,r)}),"clearUnreadCountByTimestamp",r)}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)}}),Object.defineProperty(e.prototype,"getConversationNotificationStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,n,s){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",n,t.AssertRules.STRING,!0),this.assertCPPMode((function(){r._defaultChannelClient.getConversationNotificationStatus(e,n,s)}),"getConversationNotificationStatus",s)}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getServerTime()}}),Object.defineProperty(e.prototype,"getGroupMessageDeliverList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)}}),Object.defineProperty(e.prototype,"getPrivateMessageDeliverTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)}}),e}(),E=1;t.VersionManage.add("imlib-v2-adapter","5.20.1");var M,A,O=null,L={init:function(e,n,s){var r;void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),M=new t.AppStorage("API-V2"),v=t.APIContext.init({appkey:e,navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,httpInMainProcess:!!s.httpInMainProcess,logExpireTime:s.logExpireTime,environment:null!==(r=s.environment)&&void 0!==r?r:"default",eventLoopBlockingCheck:s.eventLoopBlockingCheck}),O=v.logger,E=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),R=new S(v,{readReceiptTimeout:E},O,M),t.logger.init(O)},getInstance:function(){return R},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){v.assignWatcher({connection:function(n,s){try{e.onChanged(n,s)}catch(e){null==O||O.error(t.LogTagId.L_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){v.assignWatcher({message:function(n,s,r){try{var a=f(n),o=v.getCurrentUserId(),i=v.getConnectedTime();p(a,o,i,E,M),a=function(e,t,n,s,r){var a=new Date(n-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var o=e.content,i=((o=o||{}).receiptMessageDic||{})[t],c="",l={};if(e.receiptResponse=e.receiptResponse||{},i){for(var g=[],u=0;u<i.length;u++)c="".concat(t).concat(i[u],"SENT"),(l=r.get(c))&&!(e.senderUserId in l.userIds)&&(g.push(i[u]),l.count+=1,l.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[i[u]]=l.count,r.set(c,l));o.receiptMessageDic[t]=g,e.content=o}return e}(a,o,i,E,M),t.usingCppEngine()||l.set(n),e.onReceived(a,void 0,r)}catch(e){null==O||O.error(t.LogTagId.L_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){v.assignWatcher({conversationState:function(n){try{var s=[];n.forEach((function(e){var t=e.updatedItems,n=e.conversationType,r=e.targetId,a=e.channelId,o=(t=t||{}).notificationStatus,i=t.isTop;o&&i&&s.push({notificationStatus:o.val,isTop:i.val,conversationType:n,targetId:r,channelId:a||"",updatedTime:o.time})})),s.length>0&&e.onChanged(s)}catch(e){null==O||O.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){v.assignWatcher({expansion:function(n){try{n.updatedExpansion&&e.onUpdated(n.updatedExpansion),n.deletedExpansion&&e.onDeleted(n.deletedExpansion)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){v.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){v.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){v.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==O||O.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){v.assignWatcher({typingState:function(n){try{e.onChanged(n)}catch(e){null==O||O.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){v.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){v.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){v.assignWatcher({messageDelivered:function(n){try{e.onDelivered(n)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){v.assignWatcher({groupMessageDeliveredStatus:function(n){try{e.onDelivered(n)}catch(e){null==O||O.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,n,s){return o(this,void 0,void 0,(function(){var r,a,o;return i(this,(function(i){switch(i.label){case 0:return r=null==O?void 0:O.createTraceId(),null==O||O.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),r),[4,v.connect(e,!!s,r)];case 1:return a=i.sent(),o=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==O||O[o](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),r),a.code===t.ErrorCode.SUCCESS?(n.onSuccess(a.userId),c=new Date(v.getConnectedTime()-1e3*E*60*60*24).getTime(),M.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=M.get(e).dealtime;t&&c-t>0&&M.remove(e)}else if(/RECEIVED$/.test(e)){var n=M.get(e),s=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==s&&(0===n.length?M.remove(e):M.set(e,n))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),n.onTokenIncorrect()):(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),n.onError(a.code)),[2]}var c}))}))},reconnect:function(e,n,s){var r=null==O?void 0:O.createTraceId();null==O||O.info(t.LogTagId.A_RECONNECT_T,null,r),v.reconnect(s).then((function(n){var s=n.code===t.ErrorCode.SUCCESS?"info":"warn";null==O||O[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:n.code,userId:n.userId}),r),n.code===t.ErrorCode.SUCCESS?e.onSuccess(n.userId):(null==O||O.warn(t.LogTagId.O,"reconnect ->code:".concat(n.code)),e.onError(n.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:u,getMessageObjectName:function(e){var t=a(a({},g),u);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,s){this.RegisterMessage[e]=I(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,v.registerMessageType(t,n.isPersited,n.isCounted,s)}},P=function(e,t,n){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"userIdList",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"mentionedContent",{enumerable:!0,configurable:!0,writable:!0,value:n})},N=function(e,t){Object.defineProperty(this,"isCounted",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"isPersited",{enumerable:!0,configurable:!0,writable:!0,value:t})},U=I("TextMessage","RC:TxtMsg"),w=I("LocationMessage","RC:LBSMsg"),_=I("TypingStatusMessage","RC:TypSts"),B=I("ImageMessage","RC:ImgMsg"),x=I("RichContentMessage","RC:ImgTextMsg"),j=I("VoiceMessage","RC:VcMsg"),k=I("HQVoiceMessage","RC:HQVCMsg"),G=I("FileMessage","RC:FileMsg"),D=I("SightMessage","RC:SightMsg"),K=I("GIFMessage","RC:GIFMsg"),F=I("ReadReceiptMessage","RC:ReadNtf"),V=I("ReadReceiptRequestMessage","RC:RRReqMsg"),H=I("RCCombineMessage","RC:CombineMsg"),J=function(e,t,n,s,r,a,o,i,c,l,g,u,d,f,p,C,h,b){Object.defineProperty(this,"conversationType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"targetId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"senderUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"content",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"objectName",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"messageId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"messageUId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"messageDirection",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"offLineMessage",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(this,"sentStatus",{enumerable:!0,configurable:!0,writable:!0,value:g}),Object.defineProperty(this,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"receivedStatus",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(this,"receivedTime",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.defineProperty(this,"canIncludeExpansion",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(this,"expansion",{enumerable:!0,configurable:!0,writable:!0,value:C}),Object.defineProperty(this,"receiptResponse",{enumerable:!0,configurable:!0,writable:!0,value:h}),Object.defineProperty(this,"disableNotification",{enumerable:!0,configurable:!0,writable:!0,value:b})};exports.VoIPMediaType=void 0,(A=exports.VoIPMediaType||(exports.VoIPMediaType={}))[A.MEDIA_AUDIO=1]="MEDIA_AUDIO",A[A.MEDIA_VEDIO=2]="MEDIA_VEDIO",A[A.MEDIA_VIDEO=2]="MEDIA_VIDEO";var W,Y=I("AcceptMessage","RC:VCAccept"),q=I("RingingMessage","RC:VCRinging"),Q=I("SummaryMessage","RC:VCSummary"),X=I("HungupMessage","RC:VCHangup"),$=I("InviteMessage","RC:VCInvite"),z=I("MediaModifyMessage","RC:VCModifyMedia"),Z=I("MemberModifyMessage","RC:VCModifyMem"),ee=I("lastMessageSendTime","RC:SRSMsg"),te=I("ReferenceMessage","RC:ReferenceMsg"),ne=I("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),se=I("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(W||(W={}));var re=W;window&&(window.RongIMClient=L),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Y,exports.BaseMessage=b,exports.ChannelClient=y,exports.ConnectionState={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},exports.FileMessage=G,exports.GIFMessage=K,exports.GetChatRoomType=r,exports.HQVoiceMessage=k,exports.HungupMessage=X,exports.IMClient=S,exports.ImageMessage=B,exports.InviteMessage=$,exports.LocationMessage=w,exports.MediaModifyMessage=z,exports.MemberModifyMessage=Z,exports.MentionedInfo=P,exports.MentionedType=re,exports.Message=J,exports.MessageTag=N,exports.PublicServiceMultiRichContentMessage=se,exports.PublicServiceRichContentMessage=ne,exports.RCCombineMessage=H,exports.ReadReceiptMessage=F,exports.ReadReceiptRequestMessage=V,exports.ReadReceiptResponseMessage=m,exports.ReferenceMessage=te,exports.RichContentMessage=x,exports.RingingMessage=q,exports.RongIMClient=L,exports.SentStatus=s,exports.SightMessage=D,exports.SummaryMessage=Q,exports.SyncReadStatusMessage=ee,exports.TextMessage=U,exports.TypingStatusMessage=_,exports.VoiceMessage=j;
|