@rongcloud/imlib-v2-adapter 5.6.0-beem → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +4 -0
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
package/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,AppStorage as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as d,AssertRules as u,LogTagId as l,todo as h,RTCApiType as f,VersionManage as C,APIContext as p,ConnectResultCode as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var m;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(m||(m={}));var v,I=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var R=v,y=function(){return y=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},y.apply(this,arguments)};function M(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&s[0]?o.return:s[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,s[1])).done)return a;switch(o=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(6===s[0]&&r.label<a[1]){r.label=a[1],a=s;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(s);break}a[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function E(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var O=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},U=O();var N={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status||0})},n.ontimeout=function(){e({status:n.status||0})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status||0})},setTimeout((function(){n.abort(),e({status:n.status||0})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:U,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},_=O(),A=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},B={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:L,sessionStorage:L,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},w=O(),x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},k={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},P={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:k,sessionStorage:k,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:w,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},b=O(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},G={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},F={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,localStorage:G,sessionStorage:G,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},K=O(),W=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},H={setItem:W("setStorageSync"),getItem:W("getStorageSync"),removeItem:W("removeStorageSync"),clear:W("clearStorageSync")},J={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:K,localStorage:H,sessionStorage:H,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return M(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},V=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},q={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},j={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:q,sessionStorage:q,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Y=function(e){return e&&e.request&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return j;case"mp-baidu":return J;case"mp-toutiao":return F;case"mp-alipay":return P;case"mp-weixin":return B;default:return N}}():"undefined"!=typeof my&&Y(my)?P:"undefined"!=typeof tt&&Y(tt)?F:"undefined"!=typeof swan&&Y(swan)?J:"undefined"!=typeof wx&&Y(wx)?B:N;function X(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var z=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=X(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=X(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=X(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),$={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},Z={},ee=new r(Q,"API-V2");function te(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.matchCount;if(!g()){var d=z.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?ne(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:i}}function ne(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,r=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,C=e.expansion,p=e.messageId,S=e.sentStatus,m=e.channelId,v=e.readReceiptInfo,R=e.pushConfig,y="";return s in $?y=$[s]:s in Z?y=Z[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},y="UnknownMessage"),u||(u=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:m||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:y,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||I.SENT,disableNotification:f,canIncludeExpansion:h,expansion:C,readReceiptInfo:v,pushConfig:R}}function oe(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,s=e.messageType,r=e.messageDirection;if("ReadReceiptRequestMessage"===s&&a&&r===i.SEND){var c="".concat(t).concat(e.content.messageUId,"SENT");ee.set(c,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===s&&a){var g="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=ee.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,ee.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,ee.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},ee.set(g,l)}}}function ae(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function se(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var re=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function ce(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new re(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var ie,ge,de=ce("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,n,o,a){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=ee,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),d("conversationTypes",t,u.ARRAY),d("count",n,u.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(te(e))})):r.forEach((function(e){c.push(te(e))})),ae(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(s)),se(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;d("callback",n,u.CALLBACK),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?te(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||z.remove(e,t,o.channelId),ae(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("draftText",n,u.STRING,!0),this.logger.info(l.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?ae(e.onSuccess,s):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),se(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(l.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?ae(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),se(e.onError,t))})):this.logger.error(l.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),se(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?ae(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),se(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?ae(n.onSuccess,e.data?ne(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),se(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",o,u.CALLBACK),d("status",n,u.OBJECT,!0),this.logger.info(l.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?ae(o.onSuccess):(s.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),se(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,s,r,g,h){var f=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("msg",n,u.OBJECT,!0),d("callback",o,u.CALLBACK),d("isMentioned",s,u.BOOLEAN),d("pushContent",r,u.ONLY_STRING),d("pushData",g,u.ONLY_STRING),d("options.userIds",null==h?void 0:h.userIds,u.ARRAY),d("options.isVoipPush",null==h?void 0:h.isVoipPush,u.BOOLEAN),d("options.disableNotification",null==h?void 0:h.disableNotification,u.BOOLEAN),d("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,u.BOOLEAN),d("options.expansion",null==h?void 0:h.expansion,u.OBJECT),d("options.pushConfig",null==h?void 0:h.pushConfig,u.OBJECT),d("options.resendMessageId",null==h?void 0:h.resendMessageId,u.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var C=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=[];if(t){var f=(n||{}).content.mentionedInfo;h=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(h,s,n),S=Object.assign(n,y(y({isMentioned:s,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:C})),m=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var r=s.code,g=s.data,d=r===a.SUCCESS?"info":"warn";if(f.logger[d](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),r===a.SUCCESS){f._isCPPMode||z.set(g);var u=ne(g);oe(u,m,f._context.getConnectedTime(),f._readReceiptTimeout),ae(o.onSuccess,u)}else f.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),se(o.onError,r,ne({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:m,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:C,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;d("message.conversationType",e.conversationType,u.NUMBER,!0),d("message.targetId",e.targetId,u.STRING,!0),d("message.messageUId",e.messageUId,u.STRING,!0),d("message.sentTime",e.sentTime,u.NUMBER,!0),d("callback",t,u.CALLBACK),d("options.disableNotification",null==n?void 0:n.disableNotification,u.BOOLEAN),d("options.pushConfig",null==n?void 0:n.pushConfig,u.OBJECT),d("options.extra",null==n?void 0:n.extra,u.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var g=y({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,g).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||z.set(s),ae(t.onSuccess,ne(s))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),se(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("typingContentType",n,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?ae(o.onSuccess,ne(r)):(s.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),se(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(l.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new de({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),ae(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),se(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;d("messageUIds",e,u.ARRAY,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];d("messageUId",c,u.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;d("messageUId",e,u.STRING,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(l.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;d("expansion",e,u.OBJECT,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,g=t.expansion;this.logger.info(l.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),se(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;d("keys",e,u.ARRAY,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(l.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),se(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",s,u.CALLBACK,!0),d("order",c,u.NUMBER),this.logger.info(l.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(l.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,g).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),ne(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ae(s.onSuccess,d,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ae(s.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),se(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("messages",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=z.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&z.remove(e,t,s.channelId)}))}ae(o.onSuccess)}else s.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),se(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;d("param.conversationType",e.conversationType,u.NUMBER,!0),d("param.targetId",e.targetId,u.STRING,!0),d("param.timestamp",e.timestamp,u.NUMBER,!0),d("callback",t,u.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),se(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){d("callback",e,u.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ae(e.onSuccess,o.map(te)):se(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){d("callback",e,u.CALLBACK),d("index",t,u.NUMBER),d("limit",n,u.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ae(e.onSuccess,o.map(te)):se(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,h=n.expansion,f=n.disableNotification,C=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,m={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:C,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:f,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,m).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?ae(o.onSuccess,ne(s)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),se(o.onError,n))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?ae(s.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),se(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return ne(e)}));ae(s.onSuccess,g,i)}else ae(s.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),se(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(l.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||z.remove(e,t,o.channelId),ae(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(l.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(te(e))})),ae(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),se(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info("searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(te(e))})),ae(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),se(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(ne(e))})),ae(c.onSuccess,s,d)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),se(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info("searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(ne(e))})),ae(r.onSuccess,s,d)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),se(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info("searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(ne(e))})),ae(i.onSuccess,s)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),se(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(l.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return ne(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(l.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?ae(o.onSuccess,!0):(s.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),se(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(l.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info("getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),se(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info("getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),se(t.onError,s))}))},e}(),le=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},he=function(){function e(e,t,n){this._context=e,this._options=t,this.logger=n,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(l.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(l.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(l.O,"getChannel method is only available in protocol stack mode"),null;if(d("channelId",e,u.STRING,!0),e.length>20)return this.logger.error(l.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(l.O,"Only 1000 channels can be obtained"),null;var t=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;d("channelIds",e,u.ARRAY,!0),this.logger.info(l.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return M(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(l.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(l.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),se(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?ae(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),se(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("entry.key",e.key,u.STRING,!0),d("entry.value",e.value,u.STRING,!0)})),d("options.isAutoDelete",e.isAutoDelete,u.BOOLEAN)}(t),d("callback",n,u.CALLBACK),t.entries.length>10)se(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),se(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("key",e,u.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(s));var r=y({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),se(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("key",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?ae(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),se(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),se(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),d("timestamp",s,u.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return ne(e)}));ae(o.onSuccess,g,i)}else ae(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),se(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){d("fileType",e,u.NUMBER,!0),d("fileName",n,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){d("fileType",e,u.NUMBER,!0),d("fileName",t,u.STRING,!0),d("saveName",n,u.STRING),d("callback",o,u.CALLBACK),d("serverType",s,u.NUMBER),d("uploadRes",a,u.OBJECT),this.logger.info(l.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagId",e.tagId,(function(e){return e.length<=10})),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("tag.tagName",e.tagName,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;d("tagId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagName",e.tagName,u.STRING,!0),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("callback",t,u.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;d("callback",e,u.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(l.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(l.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;d("conversationType",e.type,u.NUMBER),d("targetId",e.targetId,u.STRING),d("channelId",e.channelId,u.ONLY_STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(le(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(l.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(l.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return le(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return le(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING),d("tagIds",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("tagId",e,u.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(le(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(l.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("startTime",n,u.NUMBER,!0),d("callback",o,u.CALLBACK,!0),this.logger.info(l.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?ne(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("containMuted",t,u.BOOLEAN,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("conversation.targetId",t.targetId,u.STRING,!0),d("conversation.type",t.type,u.NUMBER,!0),d("conversation.channelId",t.channelId,u.ONLY_STRING),d("status.isTop",null==n?void 0:n.isTop,u.BOOLEAN,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,le(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,E([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(s)),t.onError&&se(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?ne(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return ne(e)}));return void ae(t.onSuccess,d,g)}t.onSuccess&&ae(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){d("callback",t,u.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ae(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(l.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;d("status",e,u.NUMBER),d("callback",t,u.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?ae(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),se(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),se(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),se(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),se(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;d("callback",e,u.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?ae(e.onSuccess,s):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),se(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),se(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("content.senderUserId",n.senderUserId,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",a,u.CALLBACK),d("options.order",s.order,u.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;d("messageIds",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?ae(o.onSuccess,!0):(s.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),se(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("cleanSpace",o,u.BOOLEAN),d("callback",a,u.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;d("callback",t,u.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,ne(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),se(t.onError,s))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("sentStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),se(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("receivedStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),se(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;d("messageId",e,u.NUMBER,!0),d("objectName",n,u.ONLY_STRING,!0),this.logger.info(l.O,"setMessageContent ->messageId:".concat(e,",objectName:").concat(n)),this.assertCPPMode((function(){s._context.setMessageContent(e,t,n).then((function(t){t===a.SUCCESS?ae(o.onSuccess,!0):(s.logger.warn(l.O,"setMessageContent ->code:".concat(t,",messageId:").concat(e)),se(o.onError,t))}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("searchFiles",n,u.STRING,!0),this.logger.info(l.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",n,u.ARRAY),d("customMessageType",o,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",o,u.ARRAY),d("customMessageType",n,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("total",s,u.NUMBER),d("callback",r,u.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("callback",s,u.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("startTime",o,u.NUMBER),d("endTime",a,u.NUMBER),d("offset",s,u.NUMBER),d("limit",r,u.NUMBER),d("callback",c,u.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(l.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(o){var s=o.code,r=o.data;if(s!==a.SUCCESS)n.logger.warn(l.O,"getRTCUserInfoList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s);else{var c=null==r?void 0:r.users;t.onSuccess(c)}})).catch((function(o){n.logger.warn(l.O,"getRTCUserInfoList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.getRTCUserList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCUserList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCUserList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(t||{}))),this._context.setRTCUserInfo(e.id,t.key,t.value).then((function(s){s!==a.SUCCESS?(o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(s,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(s)):n.onSuccess(!0)})).catch((function(a){o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(t.keys)),this._context.removeRTCUserInfo(e.id,t.keys).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"removeRTCUserInfo ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"removeRTCUserInfo ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e.prototype.getRTCRoomInfo=function(e,t){var n=this;this.logger.info(l.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCRoomInfo ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCRoomInfo ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCRoomInfo=function(e,t,n){throw h("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,t,n){throw h("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"joinRTCRoom ->roomId:".concat(e.id));var o=e.mode||0;this._context.joinRTCRoom(e.id,o).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"joinRTCRoom ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"joinRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.quitRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(o){o!==a.SUCCESS?(n.logger.warn(l.O,"quitRTCRoom ->code:".concat(o,",roomId:").concat(e.id)),t.onError(o)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"quitRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.RTCPing=function(e,t){var n=this;this.logger.info(l.O,"RTCPing ->roomId:".concat(e.id));var o=e.mode||0;this._context.rtcPing(e.id,o).then((function(o){var s=o.code;s!==a.SUCCESS?(n.logger.warn(l.O,"RTCPing ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"RTCPing ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCData=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"setRTCData ->roomId:".concat(e,",key:").concat(t)),this._context.setRTCData(e,t,n,o,s,c).then((function(t){t!==a.SUCCESS?(i.logger.warn(l.O,"setRTCData ->code:".concat(t,",roomId:").concat(e)),r.onError(t)):r.onSuccess(!0)})).catch((function(t){i.logger.warn(l.O,"setRTCData ->error:".concat(t,",roomId:").concat(e)),r.onError(t)}))},e.prototype.getRTCData=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"getRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.getRTCData(e,t,n,o).then((function(t){var n=t.code,o=t.data;n!==a.SUCCESS?(r.logger.warn(l.O,"getRTCData ->code:".concat(n,",roomId:").concat(e)),s.onError(n)):s.onSuccess(o)})).catch((function(t){r.logger.warn(l.O,"setRTCUserInfo ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.removeRTCData=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.removeRTCData(e,t,n,o,r).then((function(t){t!==a.SUCCESS?(c.logger.warn(l.O,"removeRTCData ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){c.logger.warn(l.O,"removeRTCData ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.setRTCUserData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.PERSON,a,s)},e.prototype.setRTCUserTotalRes=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,t,n,o).then((function(t){t!==a.SUCCESS?(r.logger.warn(l.O,"setRTCUserTotalRes ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){r.logger.warn(l.O,"setRTCUserTotalRes ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.getRTCUserData=function(e,t,n,o){this.getRTCData(e,t,n,f.PERSON,o)},e.prototype.removeRTCUserData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.PERSON,o,a)},e.prototype.setRTCRoomData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.ROOM,a,s)},e.prototype.getRTCRoomData=function(e,t,n,o){this.getRTCData(e,t,n,f.ROOM,o)},e.prototype.removeRTCRoomData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.ROOM,o,a)},e.prototype.setRTCOutData=function(e,t,n,o,a){throw h("setRTCOutData")},e.prototype.getRTCOutData=function(e,t,n){throw h("getRTCOutData")},e.prototype.getRTCToken=function(e,t){var n=this;this.logger.info(l.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCToken ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCToken ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCState=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,t.report).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"setRTCState ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"setRTCState ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e}(),fe=[],Ce=[],pe={message:function(e){fe.forEach((function(t){return t(ne(e))}))},status:function(e){Ce.forEach((function(t){return t(e)}))}},Se=1;C.add("imlib-v2-adapter","5.6.0-beem");var me,ve=null,Ie={init:function(e,t,n){void 0===n&&(n={}),d("appkey",e,u.STRING,!0),ge=p.init(Q,{appkey:e,apiVersion:"5.6.0-beem",navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,checkCA:n.checkCA,httpInMainProcess:!!n.httpInMainProcess}),(ve=ge.createLogger("RC-IM","IM")).info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Se=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ie=new he(ge,{readReceiptTimeout:Se},ve)},getInstance:function(){return ie},setConnectionStatusListener:function(e){var t=null==ve?void 0:ve.createTraceId();ge.assignWatcher({connectionState:function(n){null==ve||ve.info(l.A_CONNECT_S,JSON.stringify({status:n}),t),z.clear(),e.onChanged(n)}})},setOnReceiveMessageListener:function(e){ge.assignWatcher({message:function(t,n,o){try{var a=ne(t),s=ge.getCurrentUserId(),r=ge.getConnectedTime();oe(a,s,r,Se),a=function(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var s=e.content,r=((s=s||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=ee.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,ee.set(c,i));s.receiptMessageDic[t]=g,e.content=s}return e}(a,s,r,Se),g()||z.set(t),null==ve||ve.info(l.A_PULL_MSG_O,JSON.stringify({message:t.messageUId})),e.onReceived(a,void 0,o)}catch(e){null==ve||ve.error(l.O,"setOnReceiveMessageListener ->error:".concat(e))}}})},setConversationStatusListener:function(e){ge.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==ve||ve.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ge.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ve||ve.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ge.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ve||ve.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ge.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ve||ve.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ge.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ve||ve.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ge.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ve||ve.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ge.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ge.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ge.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ge.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==ve?void 0:ve.createTraceId(),null==ve||ve.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ge.connect(e,!1,n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==ve||ve[r](l.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(ge.getConnectedTime()-1e3*Se*60*60*24).getTime(),ee.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=ee.get(e).dealtime;t&&c-t>0&&ee.remove(e)}else if(/RECEIVED$/.test(e)){var n=ee.get(e),o=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!==o&&(0===n.length?ee.remove(e):ee.set(e,n))}}))):s.code===a.RC_CONN_USER_OR_PASSWD_ERROR?(null==ve||ve.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ve||ve.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==ve?void 0:ve.createTraceId();null==ve||ve.info(l.A_RECONNECT_T,null,o),ge.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==ve||ve[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==ve||ve.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=y(y({},$),Z);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=ce(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,ge.registerMessageType(t,n.isPersited,n.isCounted,o)},messageWatch:function(e){var t=this;fe.push((function(n){var o,a;null==ve||ve.info(l.O,"messageWatch ->message:".concat(JSON.stringify(n||{})));try{e(n),null===(a=(o=t._voipProvider).onReceived)||void 0===a||a.call(o,n)}catch(e){null==ve||ve.error(l.O,"messageWatch ->error:".concat(e))}})),ge.assignWatcher({rtcInnerWatcher:pe})},statusWatch:function(e){Ce.push((function(t){null==ve||ve.info(l.O,"statusWatch ->status:".concat(t));try{e(t)}catch(e){null==ve||ve.error(l.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},Re=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},ye=function(e,t){this.isCounted=e,this.isPersited=t},Me=ce("TextMessage","RC:TxtMsg"),Te=ce("LocationMessage","RC:LBSMsg"),Ee=ce("TypingStatusMessage","RC:TypSts"),Oe=ce("ImageMessage","RC:ImgMsg"),Ue=ce("RichContentMessage","RC:ImgTextMsg"),Ne=ce("VoiceMessage","RC:VcMsg"),_e=ce("HQVoiceMessage","RC:HQVCMsg"),Ae=ce("FileMessage","RC:FileMsg"),Le=ce("SightMessage","RC:SightMsg"),Be=ce("GIFMessage","RC:GIFMsg"),we=ce("ReadReceiptMessage","RC:ReadNtf"),xe=ce("ReadReceiptRequestMessage","RC:RRReqMsg"),ke=ce("RCCombineMessage","RC:CombineMsg"),Pe=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,f,C,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=f,this.expansion=C,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(me||(me={}));var be,De=ce("AcceptMessage","RC:VCAccept"),Ge=ce("RingingMessage","RC:VCRinging"),Fe=ce("SummaryMessage","RC:VCSummary"),Ke=ce("HungupMessage","RC:VCHangup"),We=ce("InviteMessage","RC:VCInvite"),He=ce("MediaModifyMessage","RC:VCModifyMedia"),Je=ce("MemberModifyMessage","RC:VCModifyMem"),Ve=ce("lastMessageSendTime","RC:SRSMsg"),qe=ce("ReferenceMessage","RC:ReferenceMsg"),je=ce("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ye=ce("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(be||(be={}));var Qe=be,Xe=S;window&&(window.RongIMClient=Ie);export{De as AcceptMessage,re as BaseMessage,ue as ChannelClient,Xe as ConnectionState,Ae as FileMessage,Be as GIFMessage,R as GetChatRoomType,_e as HQVoiceMessage,Ke as HungupMessage,he as IMClient,Oe as ImageMessage,We as InviteMessage,Te as LocationMessage,He as MediaModifyMessage,Je as MemberModifyMessage,Re as MentionedInfo,Qe as MentionedType,Pe as Message,ye as MessageTag,Ye as PublicServiceMultiRichContentMessage,je as PublicServiceRichContentMessage,ke as RCCombineMessage,we as ReadReceiptMessage,xe as ReadReceiptRequestMessage,de as ReadReceiptResponseMessage,qe as ReferenceMessage,Ue as RichContentMessage,Ge as RingingMessage,Ie as RongIMClient,I as SentStatus,Le as SightMessage,Fe as SummaryMessage,Ve as SyncReadStatusMessage,Me as TextMessage,Ee as TypingStatusMessage,me as VoIPMediaType,Ne as VoiceMessage};
|
|
1
|
+
import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,AppStorage as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as d,AssertRules as u,LogTagId as l,todo as h,RTCApiType as f,VersionManage as C,APIContext as p,ConnectResultCode as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var m;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(m||(m={}));var v,I=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var R=v,y=function(){return y=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},y.apply(this,arguments)};function M(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}function E(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var O=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},U=O();var N={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status||0})},n.ontimeout=function(){e({status:n.status||0})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status||0})},setTimeout((function(){n.abort(),e({status:n.status||0})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:U,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},_=O(),A=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},B={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:L,sessionStorage:L,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},w=O(),x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},k={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},P={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:k,sessionStorage:k,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:w,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},b=O(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},G={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},F={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,localStorage:G,sessionStorage:G,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},K=O(),W=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},H={setItem:W("setStorageSync"),getItem:W("getStorageSync"),removeItem:W("removeStorageSync"),clear:W("clearStorageSync")},V={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:K,localStorage:H,sessionStorage:H,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return M(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},J=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},q={setItem:J("setStorageSync"),getItem:J("getStorageSync"),removeItem:J("removeStorageSync"),clear:J("clearStorageSync")},j={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:q,sessionStorage:q,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Y=function(e){return e&&e.request&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return j;case"mp-baidu":return V;case"mp-toutiao":return F;case"mp-alipay":return P;case"mp-weixin":return B;default:return N}}():"undefined"!=typeof my&&Y(my)?P:"undefined"!=typeof tt&&Y(tt)?F:"undefined"!=typeof swan&&Y(swan)?V:"undefined"!=typeof wx&&Y(wx)?B:N;function X(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var z=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=X(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=X(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=X(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),$={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},Z={},ee=new r(Q,"API-V2");function te(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.matchCount;if(!g()){var d=z.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?ne(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:i}}function ne(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,r=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,C=e.expansion,p=e.messageId,S=e.sentStatus,m=e.channelId,v=e.readReceiptInfo,R=e.pushConfig,y="";return s in $?y=$[s]:s in Z?y=Z[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},y="UnknownMessage"),u||(u=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:m||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:y,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||I.SENT,disableNotification:f,canIncludeExpansion:h,expansion:C,readReceiptInfo:v,pushConfig:R}}function oe(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,s=e.messageType,r=e.messageDirection;if("ReadReceiptRequestMessage"===s&&a&&r===i.SEND){var c="".concat(t).concat(e.content.messageUId,"SENT");ee.set(c,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===s&&a){var g="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=ee.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,ee.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,ee.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},ee.set(g,l)}}}function ae(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function se(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var re=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function ce(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new re(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var ie,ge,de=ce("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,n,o,a){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=ee,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),d("conversationTypes",t,u.ARRAY),d("count",n,u.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(te(e))})):r.forEach((function(e){c.push(te(e))})),ae(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(s)),se(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;d("callback",n,u.CALLBACK),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?te(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||z.remove(e,t,o.channelId),ae(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("draftText",n,u.STRING,!0),this.logger.info(l.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?ae(e.onSuccess,s):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),se(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(l.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?ae(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),se(e.onError,t))})):this.logger.error(l.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),se(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?ae(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),se(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?ae(n.onSuccess,e.data?ne(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),se(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",o,u.CALLBACK),d("status",n,u.OBJECT,!0),this.logger.info(l.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?ae(o.onSuccess):(s.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),se(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,s,r,g,h){var f=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("msg",n,u.OBJECT,!0),d("callback",o,u.CALLBACK),d("isMentioned",s,u.BOOLEAN),d("pushContent",r,u.ONLY_STRING),d("pushData",g,u.ONLY_STRING),d("options.userIds",null==h?void 0:h.userIds,u.ARRAY),d("options.isVoipPush",null==h?void 0:h.isVoipPush,u.BOOLEAN),d("options.disableNotification",null==h?void 0:h.disableNotification,u.BOOLEAN),d("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,u.BOOLEAN),d("options.expansion",null==h?void 0:h.expansion,u.OBJECT),d("options.pushConfig",null==h?void 0:h.pushConfig,u.OBJECT),d("options.resendMessageId",null==h?void 0:h.resendMessageId,u.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var C=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=[];if(t){var f=(n||{}).content.mentionedInfo;h=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(h,s,n),S=Object.assign(n,y(y({isMentioned:s,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:C})),m=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var r=s.code,g=s.data,d=r===a.SUCCESS?"info":"warn";if(f.logger[d](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),r===a.SUCCESS){f._isCPPMode||z.set(g);var u=ne(g);oe(u,m,f._context.getConnectedTime(),f._readReceiptTimeout),ae(o.onSuccess,u)}else f.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),se(o.onError,r,ne({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:m,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:C,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;d("message.conversationType",e.conversationType,u.NUMBER,!0),d("message.targetId",e.targetId,u.STRING,!0),d("message.messageUId",e.messageUId,u.STRING,!0),d("message.sentTime",e.sentTime,u.NUMBER,!0),d("callback",t,u.CALLBACK),d("options.disableNotification",null==n?void 0:n.disableNotification,u.BOOLEAN),d("options.pushConfig",null==n?void 0:n.pushConfig,u.OBJECT),d("options.extra",null==n?void 0:n.extra,u.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var g=y({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,g).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||z.set(s),ae(t.onSuccess,ne(s))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),se(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("typingContentType",n,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?ae(o.onSuccess,ne(r)):(s.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),se(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(l.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new de({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),ae(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),se(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;d("messageUIds",e,u.ARRAY,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];d("messageUId",c,u.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;d("messageUId",e,u.STRING,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(l.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;d("expansion",e,u.OBJECT,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,g=t.expansion;this.logger.info(l.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),se(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;d("keys",e,u.ARRAY,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(l.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),se(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",s,u.CALLBACK,!0),d("order",c,u.NUMBER),this.logger.info(l.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(l.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,g).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),ne(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ae(s.onSuccess,d,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ae(s.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),se(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("messages",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=z.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&z.remove(e,t,s.channelId)}))}ae(o.onSuccess)}else s.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),se(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;d("param.conversationType",e.conversationType,u.NUMBER,!0),d("param.targetId",e.targetId,u.STRING,!0),d("param.timestamp",e.timestamp,u.NUMBER,!0),d("callback",t,u.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),se(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){d("callback",e,u.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ae(e.onSuccess,o.map(te)):se(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){d("callback",e,u.CALLBACK),d("index",t,u.NUMBER),d("limit",n,u.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ae(e.onSuccess,o.map(te)):se(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,h=n.expansion,f=n.disableNotification,C=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,m={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:C,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:f,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,m).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?ae(o.onSuccess,ne(s)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),se(o.onError,n))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?ae(s.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),se(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return ne(e)}));ae(s.onSuccess,g,i)}else ae(s.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),se(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(l.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||z.remove(e,t,o.channelId),ae(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(l.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(te(e))})),ae(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),se(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info(l.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(te(e))})),ae(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),se(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(ne(e))})),ae(c.onSuccess,s,d)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),se(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(ne(e))})),ae(r.onSuccess,s,d)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),se(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(ne(e))})),ae(i.onSuccess,s)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),se(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(l.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return ne(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(l.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?ae(o.onSuccess,!0):(s.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),se(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(l.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),se(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(l.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ae(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),se(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(l.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),se(t.onError,s))}))},e}(),le=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},he=function(){function e(e,t,n){this._context=e,this._options=t,this.logger=n,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(l.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(l.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(l.O,"getChannel method is only available in protocol stack mode"),null;if(d("channelId",e,u.STRING,!0),e.length>20)return this.logger.error(l.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(l.O,"Only 1000 channels can be obtained"),null;var t=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;d("channelIds",e,u.ARRAY,!0),this.logger.info(l.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return M(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(l.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(l.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),se(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?ae(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),se(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("entry.key",e.key,u.STRING,!0),d("entry.value",e.value,u.STRING,!0)})),d("options.isAutoDelete",e.isAutoDelete,u.BOOLEAN)}(t),d("callback",n,u.CALLBACK),t.entries.length>10)se(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),se(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("key",e,u.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(s));var r=y({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),se(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),se(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("key",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?ae(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),se(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),se(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),d("timestamp",s,u.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return ne(e)}));ae(o.onSuccess,g,i)}else ae(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),se(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){d("fileType",e,u.NUMBER,!0),d("fileName",n,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){d("fileType",e,u.NUMBER,!0),d("fileName",t,u.STRING,!0),d("saveName",n,u.STRING),d("callback",o,u.CALLBACK),d("serverType",s,u.NUMBER),d("uploadRes",a,u.OBJECT),this.logger.info(l.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagId",e.tagId,(function(e){return e.length<=10})),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("tag.tagName",e.tagName,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;d("tagId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagName",e.tagName,u.STRING,!0),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("callback",t,u.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;d("callback",e,u.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(l.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(l.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;d("conversationType",e.type,u.NUMBER),d("targetId",e.targetId,u.STRING),d("channelId",e.channelId,u.ONLY_STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(le(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(l.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(l.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return le(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return le(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING),d("tagIds",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("tagId",e,u.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(le(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(l.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("startTime",n,u.NUMBER,!0),d("callback",o,u.CALLBACK,!0),this.logger.info(l.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?ne(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("containMuted",t,u.BOOLEAN,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("conversation.targetId",t.targetId,u.STRING,!0),d("conversation.type",t.type,u.NUMBER,!0),d("conversation.channelId",t.channelId,u.ONLY_STRING),d("status.isTop",null==n?void 0:n.isTop,u.BOOLEAN,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,le(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,E([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(s)),t.onError&&se(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?ne(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return ne(e)}));return void ae(t.onSuccess,d,g)}t.onSuccess&&ae(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){d("callback",t,u.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ae(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(l.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;d("status",e,u.NUMBER),d("callback",t,u.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?ae(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),se(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),se(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),se(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?ae(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),se(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;d("callback",e,u.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?ae(e.onSuccess,s):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),se(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),se(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("content.senderUserId",n.senderUserId,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",a,u.CALLBACK),d("options.order",s.order,u.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;d("messageIds",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?ae(o.onSuccess,!0):(s.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),se(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("cleanSpace",o,u.BOOLEAN),d("callback",a,u.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;d("callback",t,u.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ae(t.onSuccess,ne(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),se(t.onError,s))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("sentStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),se(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("receivedStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?ae(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),se(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;d("messageId",e,u.NUMBER,!0),d("objectName",n,u.ONLY_STRING,!0),this.assertCPPMode((function(){s.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),s._context.setMessageContent(e,t,n).then((function(e){e===a.SUCCESS?ae(o.onSuccess,!0):se(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("searchFiles",n,u.STRING,!0),this.logger.info(l.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",n,u.ARRAY),d("customMessageType",o,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",o,u.ARRAY),d("customMessageType",n,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("total",s,u.NUMBER),d("callback",r,u.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("callback",s,u.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("startTime",o,u.NUMBER),d("endTime",a,u.NUMBER),d("offset",s,u.NUMBER),d("limit",r,u.NUMBER),d("callback",c,u.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(l.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(o){var s=o.code,r=o.data;if(s!==a.SUCCESS)n.logger.warn(l.O,"getRTCUserInfoList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s);else{var c=null==r?void 0:r.users;t.onSuccess(c)}})).catch((function(o){n.logger.warn(l.O,"getRTCUserInfoList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.getRTCUserList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCUserList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCUserList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(t||{}))),this._context.setRTCUserInfo(e.id,t.key,t.value).then((function(s){s!==a.SUCCESS?(o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(s,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(s)):n.onSuccess(!0)})).catch((function(a){o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(t.keys)),this._context.removeRTCUserInfo(e.id,t.keys).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"removeRTCUserInfo ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"removeRTCUserInfo ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e.prototype.getRTCRoomInfo=function(e,t){var n=this;this.logger.info(l.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCRoomInfo ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCRoomInfo ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCRoomInfo=function(e,t,n){throw h("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,t,n){throw h("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"joinRTCRoom ->roomId:".concat(e.id));var o=e.mode||0;this._context.joinRTCRoom(e.id,o).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"joinRTCRoom ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"joinRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.quitRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(o){o!==a.SUCCESS?(n.logger.warn(l.O,"quitRTCRoom ->code:".concat(o,",roomId:").concat(e.id)),t.onError(o)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"quitRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.RTCPing=function(e,t){var n=this;this.logger.info(l.O,"RTCPing ->roomId:".concat(e.id));var o=e.mode||0;this._context.rtcPing(e.id,o).then((function(o){var s=o.code;s!==a.SUCCESS?(n.logger.warn(l.O,"RTCPing ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"RTCPing ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCData=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"setRTCData ->roomId:".concat(e,",key:").concat(t)),this._context.setRTCData(e,t,n,o,s,c).then((function(t){t!==a.SUCCESS?(i.logger.warn(l.O,"setRTCData ->code:".concat(t,",roomId:").concat(e)),r.onError(t)):r.onSuccess(!0)})).catch((function(t){i.logger.warn(l.O,"setRTCData ->error:".concat(t,",roomId:").concat(e)),r.onError(t)}))},e.prototype.getRTCData=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"getRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.getRTCData(e,t,n,o).then((function(t){var n=t.code,o=t.data;n!==a.SUCCESS?(r.logger.warn(l.O,"getRTCData ->code:".concat(n,",roomId:").concat(e)),s.onError(n)):s.onSuccess(o)})).catch((function(t){r.logger.warn(l.O,"setRTCUserInfo ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.removeRTCData=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.removeRTCData(e,t,n,o,r).then((function(t){t!==a.SUCCESS?(c.logger.warn(l.O,"removeRTCData ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){c.logger.warn(l.O,"removeRTCData ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.setRTCUserData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.PERSON,a,s)},e.prototype.setRTCUserTotalRes=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,t,n,o).then((function(t){t!==a.SUCCESS?(r.logger.warn(l.O,"setRTCUserTotalRes ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){r.logger.warn(l.O,"setRTCUserTotalRes ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.getRTCUserData=function(e,t,n,o){this.getRTCData(e,t,n,f.PERSON,o)},e.prototype.removeRTCUserData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.PERSON,o,a)},e.prototype.setRTCRoomData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.ROOM,a,s)},e.prototype.getRTCRoomData=function(e,t,n,o){this.getRTCData(e,t,n,f.ROOM,o)},e.prototype.removeRTCRoomData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.ROOM,o,a)},e.prototype.setRTCOutData=function(e,t,n,o,a){throw h("setRTCOutData")},e.prototype.getRTCOutData=function(e,t,n){throw h("getRTCOutData")},e.prototype.getRTCToken=function(e,t){var n=this;this.logger.info(l.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCToken ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCToken ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCState=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,t.report).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"setRTCState ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"setRTCState ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e}(),fe=[],Ce=[],pe={message:function(e){fe.forEach((function(t){return t(ne(e))}))},status:function(e){Ce.forEach((function(t){return t(e)}))}},Se=1;C.add("imlib-v2-adapter","5.6.0");var me,ve=null,Ie={init:function(e,t,n){void 0===n&&(n={}),d("appkey",e,u.STRING,!0),ge=p.init(Q,{appkey:e,apiVersion:"5.6.0",navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,checkCA:n.checkCA,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ve=ge.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ve.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Se=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ie=new he(ge,{readReceiptTimeout:Se},ve)},getInstance:function(){return ie},setConnectionStatusListener:function(e){null==ve||ve.createTraceId(),ge.assignWatcher({connectionState:function(t){z.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){ge.assignWatcher({message:function(t,n,o){try{var a=ne(t),s=ge.getCurrentUserId(),r=ge.getConnectedTime();oe(a,s,r,Se),a=function(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var s=e.content,r=((s=s||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=ee.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,ee.set(c,i));s.receiptMessageDic[t]=g,e.content=s}return e}(a,s,r,Se),g()||z.set(t),e.onReceived(a,void 0,o)}catch(e){null==ve||ve.error(l.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){ge.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==ve||ve.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ge.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ve||ve.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ge.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ve||ve.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ge.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ve||ve.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ge.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ve||ve.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ge.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ve||ve.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ge.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ge.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ge.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ge.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==ve?void 0:ve.createTraceId(),null==ve||ve.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ge.connect(e,!1,n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==ve||ve[r](l.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(ge.getConnectedTime()-1e3*Se*60*60*24).getTime(),ee.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=ee.get(e).dealtime;t&&c-t>0&&ee.remove(e)}else if(/RECEIVED$/.test(e)){var n=ee.get(e),o=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!==o&&(0===n.length?ee.remove(e):ee.set(e,n))}}))):s.code===a.RC_CONN_USER_OR_PASSWD_ERROR?(null==ve||ve.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ve||ve.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==ve?void 0:ve.createTraceId();null==ve||ve.info(l.A_RECONNECT_T,null,o),ge.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==ve||ve[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==ve||ve.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=y(y({},$),Z);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=ce(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,ge.registerMessageType(t,n.isPersited,n.isCounted,o)},messageWatch:function(e){var t=this;fe.push((function(n){var o,a;null==ve||ve.info(l.O,"messageWatch ->message:".concat(JSON.stringify(n||{})));try{e(n),null===(a=(o=t._voipProvider).onReceived)||void 0===a||a.call(o,n)}catch(e){null==ve||ve.error(l.O,"messageWatch ->error:".concat(e))}})),ge.assignWatcher({rtcInnerWatcher:pe})},statusWatch:function(e){Ce.push((function(t){null==ve||ve.info(l.O,"statusWatch ->status:".concat(t));try{e(t)}catch(e){null==ve||ve.error(l.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},Re=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},ye=function(e,t){this.isCounted=e,this.isPersited=t},Me=ce("TextMessage","RC:TxtMsg"),Te=ce("LocationMessage","RC:LBSMsg"),Ee=ce("TypingStatusMessage","RC:TypSts"),Oe=ce("ImageMessage","RC:ImgMsg"),Ue=ce("RichContentMessage","RC:ImgTextMsg"),Ne=ce("VoiceMessage","RC:VcMsg"),_e=ce("HQVoiceMessage","RC:HQVCMsg"),Ae=ce("FileMessage","RC:FileMsg"),Le=ce("SightMessage","RC:SightMsg"),Be=ce("GIFMessage","RC:GIFMsg"),we=ce("ReadReceiptMessage","RC:ReadNtf"),xe=ce("ReadReceiptRequestMessage","RC:RRReqMsg"),ke=ce("RCCombineMessage","RC:CombineMsg"),Pe=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,f,C,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=f,this.expansion=C,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(me||(me={}));var be,De=ce("AcceptMessage","RC:VCAccept"),Ge=ce("RingingMessage","RC:VCRinging"),Fe=ce("SummaryMessage","RC:VCSummary"),Ke=ce("HungupMessage","RC:VCHangup"),We=ce("InviteMessage","RC:VCInvite"),He=ce("MediaModifyMessage","RC:VCModifyMedia"),Ve=ce("MemberModifyMessage","RC:VCModifyMem"),Je=ce("lastMessageSendTime","RC:SRSMsg"),qe=ce("ReferenceMessage","RC:ReferenceMsg"),je=ce("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ye=ce("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(be||(be={}));var Qe=be,Xe=S;window&&(window.RongIMClient=Ie);export{De as AcceptMessage,re as BaseMessage,ue as ChannelClient,Xe as ConnectionState,Ae as FileMessage,Be as GIFMessage,R as GetChatRoomType,_e as HQVoiceMessage,Ke as HungupMessage,he as IMClient,Oe as ImageMessage,We as InviteMessage,Te as LocationMessage,He as MediaModifyMessage,Ve as MemberModifyMessage,Re as MentionedInfo,Qe as MentionedType,Pe as Message,ye as MessageTag,Ye as PublicServiceMultiRichContentMessage,je as PublicServiceRichContentMessage,ke as RCCombineMessage,we as ReadReceiptMessage,xe as ReadReceiptRequestMessage,de as ReadReceiptResponseMessage,qe as ReferenceMessage,Ue as RichContentMessage,Ge as RingingMessage,Ie as RongIMClient,I as SentStatus,Le as SightMessage,Fe as SummaryMessage,Je as SyncReadStatusMessage,Me as TextMessage,Ee as TypingStatusMessage,me as VoIPMediaType,Ne as VoiceMessage};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var o,s=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(o||(o={}));var n=o,a=function(){return a=Object.assign||function(e){for(var t,o=1,s=arguments.length;o<s;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function r(e,t,o,s){return new(o||(o=Promise))((function(n,a){function r(e){try{i(s.next(e))}catch(e){a(e)}}function c(e){try{i(s.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}i((s=s.apply(e,t||[])).next())}))}function c(e,t){var o,s,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;r;)try{if(o=1,s&&(n=2&a[0]?s.return:a[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,a[1])).done)return n;switch(s=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,s=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],s=0}finally{o=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function i(e,t,o){if(o||2===arguments.length)for(var s,n=0,a=t.length;n<a;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var g=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],o=0,s=t.length;o<s;o++)if(!e[t[o]])return!1;return!0}(uni))},d=g();var u={tag:"browser",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(o,c),n&&a.setRequestHeader)for(var g in n)a.setRequestHeader(g,n[g]);if(i){a.timeout=s,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){a.abort(),e({status:a.status||0})}),s),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:d,createWebSocket:function(e,t){var o=new WebSocket(e,t);return o.binaryType="arraybuffer",{onClose:function(e){o.onclose=function(t){var o=t.code,s=t.reason;e(o,s)}},onError:function(e){o.onerror=e},onMessage:function(e){o.onmessage=function(t){e(t.data)}},onOpen:function(e){o.onopen=e},send:function(e){o.send(e)},close:function(e,t){o.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,o=e.type,s=e.effectiveType,n=o||s||t.NetworkType.UNKONWN;return new Promise((function(e){e(n)}))}},l=g(),C=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},h={setItem:C("setStorageSync"),getItem:C("getStorageSync"),removeItem:C("removeStorageSync"),clear:C("clearStorageSync")},f={tag:"wechat",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:h,sessionStorage:h,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:l,createWebSocket:function(e,t){var o=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},p=g(),R=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var s=my[e]({key:t[0]}).data;return s?JSON.stringify(s):s}catch(e){}}},I={setItem:R("setStorageSync"),getItem:R("getStorageSync"),removeItem:R("removeStorageSync"),clear:R("clearStorageSync")},T={tag:"alipay",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:o,headers:n,timeout:s,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:I,sessionStorage:I,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:p,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},S=g(),m=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return tt[e].apply(tt,t)}catch(e){}}},v={setItem:m("setStorageSync"),getItem:m("getStorageSync"),removeItem:m("removeStorageSync"),clear:m("clearStorageSync")},M={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:S,localStorage:v,sessionStorage:v,httpReq:function(e){return new Promise((function(o){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},y=g(),E=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return swan[e].apply(swan,t)}catch(e){}}},A={setItem:E("setStorageSync"),getItem:E("getStorageSync"),removeItem:E("removeStorageSync"),clear:E("clearStorageSync")},L={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:y,localStorage:A,sessionStorage:A,httpReq:function(e){return new Promise((function(o,s){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},O=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},U={setItem:O("setStorageSync"),getItem:O("getStorageSync"),removeItem:O("removeStorageSync"),clear:O("clearStorageSync")},N={tag:"uniapp",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:U,sessionStorage:U,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var o={complete:function(){},url:e,protocols:t},s=uni.connectSocket(o);return{onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},_=function(e){return e&&e.request&&e.getSystemInfo},x="undefined"!=typeof uni&&_(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return N;case"mp-baidu":return L;case"mp-toutiao":return M;case"mp-alipay":return T;case"mp-weixin":return f;default:return u}}():"undefined"!=typeof my&&_(my)?T:"undefined"!=typeof tt&&_(tt)?M:"undefined"!=typeof swan&&_(swan)?L:"undefined"!=typeof wx&&_(wx)?f:u;function B(e,t,o){return"".concat(e,"_").concat(t,"_").concat(o)}var w=function(){function e(){}return e.set=function(o){if(t.SEND_MESSAGE_TYPE_OPTION[o.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[o.messageType].isPersited){var s=e.get(o.conversationType,o.targetId,o.channelId||"");if(!s||s.sentTime<o.sentTime){var n=B(o.conversationType,o.targetId,o.channelId||"");e.map[n]=o}}},e.get=function(t,o,s){var n=B(t,o,s);return e.map[n]||null},e.remove=function(t,o,s){var n=B(t,o,s);delete e.map[n]},e.clear=function(){e.map={}},e.map={},e}(),P={"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"},b={},k=new t.AppStorage(x,"API-V2");function D(e){var o=e.channelId,s=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=w.get(s,n,o||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?G(r):null;return{channelId:o||"",conversationType:s,targetId:n,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function G(e){var o=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,p=e.expansion,R=e.messageId,I=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,m=e.pushConfig,v="";return c in P?v=P[c]:c in b?v=b[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},v="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:T||"",conversationType:o,targetId:n,senderUserId:a,content:r,messageType:v,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:R,sentStatus:I||s.SENT,disableNotification:f,canIncludeExpansion:h,expansion:p,readReceiptInfo:S,pushConfig:m}}function F(e,o,s,n){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&a&&c===t.MessageDirection.SEND){var i="".concat(o).concat(e.content.messageUId,"SENT");k.set(i,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&a){var g="".concat(o).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=k.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,k.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,k.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},k.set(g,l)}}}function K(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}function H(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}var W=function(e,t,o,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=o,this.isPersited=s,this.isCounted=n};function j(e,t,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0);var n=function(n){return new W(e,t,n,o,s)};return n.MessageType=e,n.ObjectName=t,n}var V,J,q=j("ReadReceiptResponseMessage","RC:RRRspMsg"),Y=function(){function e(e,t,o,s,n){this.logger=e,this._context=t,this.channelId=o,this._isCPPMode=s,this._readReceiptTimeout=n,this._storage=k,this._draftMap={}}return e.prototype.getConversationList=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER),this._context.getConversationList(s,void 0,0,0,this.channelId).then((function(s){var a=s.code,r=s.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(o?r.forEach((function(e){o.indexOf(e.conversationType)>-1&&c.push(D(e))})):r.forEach((function(e){c.push(D(e))})),K(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),H(e.onError,a))}))},e.prototype.getConversation=function(e,o,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(o,",conversationType:").concat(e)),r(n,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,o,this.channelId)];case 1:return n=c.sent(),a=n.code,r=n.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(o)),s.onError(a),[2]):(s.onSuccess(r?D(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(o,",conversationType:").concat(e)),this._context.removeConversation(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||w.remove(e,o,n.channelId),K(s.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,o,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]=s,!0)},e.prototype.getTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(o)),this._context.getTotalUnreadCount(this.channelId,o,s).then((function(o){var s=o.code,a=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(s)),H(e.onError,s))}))},e.prototype.getUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadCount(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.clearConversations=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(o)),this._isCPPMode?this._context.clearConversations(o,this.channelId).then((function(o){o===t.ErrorCode.SUCCESS?K(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(o)),H(e.onError,o))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCount(e,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(o)),H(s.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){s===t.ErrorCode.SUCCESS?K(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(s)),H(e.onError,s))}))},e.prototype.getFirstUnreadMessage=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,o,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?K(s.onSuccess,e.data?G(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(o)),H(s.onError,e.code))}))},e.prototype.setConversationStatus=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(o,",status:").concat(s));var r=s.isTop,c=s.notificationStatus;this._context.setConversationStatus(e,o,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(o)),H(n.onError,e))}))},e.prototype.sendMessage=function(e,o,n,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("msg",n,t.AssertRules.OBJECT,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("isMentioned",c,t.AssertRules.BOOLEAN),t.assert("pushContent",i,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,o){var s,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,u=n.pushConfig,l=n.resendMessageId,C=[];if(t){var h=(o||{}).content.mentionedInfo;C=h.userIdList,s=h.type}return{mentionedType:s,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(d,c,n),h=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:l})),f=this._context.getCurrentUserId(),p=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:o,channelId:this.channelId}),p),this._context.sendMessage(e,o,h,r.onBefore,p).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),p),c===t.ErrorCode.SUCCESS){u._isCPPMode||w.set(i);var C=G(i);F(C,f,u._context.getConnectedTime(),u._readReceiptTimeout),K(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(o)),H(r.onError,c,G({isMentioned:!!h.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:o,senderUserId:f,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:s.FAILED}))}))},e.prototype.sendRecallMessage=function(e,o,s){var n=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",o,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 r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},s);this._context.recallMessage(r,c,i,g,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(n._isCPPMode||w.set(a),K(o.onSuccess,G(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(c,",messageUId:").concat(i)),H(o.onError,s))}))},e.prototype.sendTypingStatusMessage=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(o,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:s},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:o,channelId:r.channelId}),c),this._context.sendMessage(e,o,r,void 0,c).then((function(e){var s=e.code,r=e.data,i=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),s===t.ErrorCode.SUCCESS?K(n.onSuccess,G(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(o)),H(n.onError,s))}))},e.prototype.sendReceiptResponse=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(o,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(o,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var d={};d[g]=c[g].uIds,c[g].isResponse||i.push(d)}if(0===i.length)return void s.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new q({receiptMessageDic:a});n.sendMessage(e,o,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),K(s.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(o)),H(s.onError,e)}})}),200)}else s.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,o,s){var n=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(o,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(o,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(a)}))},e.prototype.getMessageReader=function(e,o,s){var n=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(o,",messageUId:").concat(e)),this._context.getMessageReader(o,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?s.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(a)}))},e.prototype.updateMessageExpansion=function(e,o,s){var n=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion,g=o.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var o=e.code;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),H(s.onError,o))}))},e.prototype.removeMessageExpansionForKey=function(e,o,s){var n=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var o=e.code;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),H(s.onError,o))}))},e.prototype.getHistoryMessages=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",c,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:o,conversationType:e,channelId:"",timestamp:s,count:n}),g),this._context.getHistoryMessage(e,o,s,n,c,this.channelId,r,g).then((function(e){var o=e.code,s=e.data;if(o===t.ErrorCode.SUCCESS)if(s){var n=s.list,r=s.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),G(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:c.join(",")}),g),K(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),K(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),H(a.onError,o)}))},e.prototype.deleteRemoteMessages=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("messages",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,o,s,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=w.get(e,o,a.channelId);c&&s.forEach((function(t){c.messageUId===t.messageUId&&w.remove(e,o,a.channelId)}))}K(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(o)),H(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,o){var s=this;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",o,t.AssertRules.CALLBACK);var n=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(n)),this._context.deleteRemoteMessageByTimestamp(n,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),H(o.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,n.map(D)):H(e.onError,s)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,o,s){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",o,t.AssertRules.NUMBER),t.assert("limit",s,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(o,s).then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,n.map(D)):H(e.onError,s)}))},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={});var c=s.senderUserId,i=s.objectName,g=s.content,d=s.messageDirection;s.messageUId;var u=s.canIncludeExpansion,l=s.expansion,C=s.disableNotification,h=s.sentTime,f=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e));var p=a.isUnread,R={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:f,searchContent:a.searchContent,isUnread:p,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,o,R).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?K(n.onSuccess,G(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(o)),H(n.onError,s))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,o,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(o)),H(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,o,s,n,i,this.channelId).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return G(e)}));K(a.onSuccess,g,i)}else K(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(o)),H(a.onError,s)}))},e.prototype.clearMessages=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearMessages(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||w.remove(e,o,n.channelId),K(s.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,s).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(D(e))})),K(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),H(o.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),this.logger.info("searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,n).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(D(e))})),K(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),H(o.onError,n))}))},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(o,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,o,s,n,a,r,this.channelId).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(G(e))})),K(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(o)),H(c.onError,s)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;this.logger.info("searchMessageByContentWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,o,s,n,a).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(G(e))})),K(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(o)),H(r.onError,s)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;this.logger.info("searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c).then((function(e){var s=e.code,n=e.data,a=[];s===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(G(e))})),K(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(o)),H(i.onError,s))}))},e.prototype.getUnreadMentionedMessages=function(e,o){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,o,this.channelId).map((function(e){return G(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,o,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(o)),H(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,o,s){var n=this;this.logger.info("getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(o)),this._context.getGroupMessageDeliverList(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(o)),H(s.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,o){var s=this;this.logger.info("getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),H(o.onError,a))}))},e}(),Q=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},X=function(){function e(e,o,s){this._context=e,this._options=o,this.logger=s,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new Y(this.logger,e,"",this._isCPPMode,o.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,o,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(o,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=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 o=new Y(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=o,o},e.prototype.deleteChannels=function(e){var o=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 o._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,o){this._defaultChannelClient.getConversationList(e,t,o)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,o){void 0===o&&(o=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,o)},e.prototype.getConversation=function(e,t,o){return this._defaultChannelClient.getConversation(e,t,o)},e.prototype.removeConversation=function(e,t,o){return this._defaultChannelClient.removeConversation(e,t,o)},e.prototype.saveTextMessageDraft=function(e,t,o){return this._defaultChannelClient.saveTextMessageDraft(e,t,o)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,o){return this._defaultChannelClient.getTotalUnreadCount(e,t,o)},e.prototype.getUnreadCount=function(e,t,o){return this._defaultChannelClient.getUnreadCount(e,t,o)},e.prototype.getConversationUnreadCount=function(e,o){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,o){this._defaultChannelClient.clearUnreadCount(e,t,o)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,o,s){return this._defaultChannelClient.setConversationStatus(e,t,o,s)},e.prototype.sendMessage=function(e,t,o,s,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,o,s,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,o){return this._defaultChannelClient.sendRecallMessage(e,t,o)},e.prototype.sendTypingStatusMessage=function(e,t,o,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,o,s)},e.prototype.sendReceiptResponse=function(e,t,o){return this._defaultChannelClient.sendReceiptResponse(e,t,o)},e.prototype.sendReadReceiptMessage=function(e,t,o){return this._defaultChannelClient.sendReadReceiptMessage(e,t,o)},e.prototype.getMessageReader=function(e,t,o){this._defaultChannelClient.getMessageReader(e,t,o)},e.prototype.updateMessageExpansion=function(e,t,o){this._defaultChannelClient.updateMessageExpansion(e,t,o)},e.prototype.removeMessageExpansionForKey=function(e,t,o){this._defaultChannelClient.removeMessageExpansionForKey(e,t,o)},e.prototype.getHistoryMessages=function(e,t,o,s,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,o,s,n,a,r)},e.prototype.joinChatRoom=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,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:o,joinExist:!1}),a),this._context.joinChatroom(e,o,a).then((function(o){var r=o===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),a),o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.quitChatRoom=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var n=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),n),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";s.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),H(o.onError,a))}))},e.prototype.getChatRoomInfo=function(e,o,s,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,o,s).then((function(o){var s=o.code,r=o.data;s===t.ErrorCode.SUCCESS?K(n.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(s,",chatRoomId:").concat(e)),H(n.onError,s))}))},e.prototype.setChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.setChatRoomEntries=function(e,o,s){var n=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)}(o),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o).then((function(e){var o=e.code,r=e.data;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(o,",").concat(a)),H(s.onError,o,r))}))}},e.prototype.forceSetChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.removeChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.removeChatRoomEntries=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(o);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},o);c.entries=o.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(o,",").concat(r)),H(s.onError,o,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.getChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(o)),this._context.getChatroomEntry(e,o).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),H(s.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),H(o.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,o,s,n,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,o,s,a).then((function(o){var s=o.code,a=o.data;if(s===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return G(e)}));K(n.onSuccess,g,i)}else K(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),H(n.onError,s)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,o,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,o,s)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,o,s,n,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(a)),this._context.getFileToken(e,s,n,a).then(o.onSuccess).catch(o.onError)},e.prototype.getFileUrl=function(e,o,s,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING,!0),t.assert("saveName",s,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("serverType",r,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(o)),this._context.getFileUrl(e,o,s,a,r).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.removeTag=function(e,o){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n)}))},e.prototype.updateTag=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.getTagList=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))},e.prototype.getTagsForConversation=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Q(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?o.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),o.onError(n))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),o.onError(e)}))},e.prototype.addTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Q(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Q(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagsForConversation=function(e,o,s){var n=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",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(o,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Q(e),o).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(o)),s.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(o)),s.onError(e)}))},e.prototype.getConversationListByTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("startTime",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,s,o).then((function(o){var s=o.code,r=o.data,c=[];s===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,o=e.conversationType,s=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?G(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:o,targetId:s,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.getUnreadCountByTag=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",o,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,o).then((function(o){var a=o.code,r=o.data;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?s.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.setConversationStatusInTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",o.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",o.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",o.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(o.targetId,",type").concat(o.type)),this._context.setConversationStatusInTag(e,Q(o),s).then((function(o){var s=o.code;o.data,s===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.callExtra=function(e,o){for(var s,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,i([e],a,!1)).then((function(s){var a=s.code,r=s.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),o.onError&&H(o.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?G(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return G(e)}));return void K(o.onSuccess,d,g)}o.onSuccess&&K(o.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,o){t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){K(o.onSuccess,!1)}),"hasRemoteUnreadMessages",o)},e.prototype.setUserStatusListener=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,o)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,o){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",o,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?K(o.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),H(o.onError,e))}))}),"setUserStatus",o)},e.prototype.getUserStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),H(o.onError,a))}))}),"getUserStatus",o)},e.prototype.addToBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),H(o.onError,n))}))}),"addToBlacklist",o)},e.prototype.removeFromBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),H(o.onError,n))}))}),"removeFromBlacklist",o)},e.prototype.getBlacklist=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getBlacklist().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?K(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),H(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),H(o.onError,a))}))}),"getBlacklistStatus",o)},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,o,s,n,a)}),"insertMessage",n)},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",r.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){c._defaultChannelClient.getRemoteHistoryMessages(e,o,s,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,o,s,n){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,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?K(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),H(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",n,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,o,s,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,o,s)}),"clearMessages",s)},e.prototype.getMessage=function(e,o){var s=this;t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,G(r)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),H(o.onError,a))}))}),"getMessage",o)},e.prototype.setMessageSentStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSentStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(o,",messageId:").concat(e)),H(s.onError,o))}))}),"setMessageSentStatus",s)},e.prototype.setMessageReceivedStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageReceivedStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(o,",messageId:").concat(e)),H(s.onError,o))}))}),"setMessageReceivedStatus",s)},e.prototype.setMessageContent=function(e,o,s,n){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",s,t.AssertRules.ONLY_STRING,!0),this.logger.info(t.LogTagId.O,"setMessageContent ->messageId:".concat(e,",objectName:").concat(s)),this.assertCPPMode((function(){a._context.setMessageContent(e,o,s).then((function(o){o===t.ErrorCode.SUCCESS?K(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"setMessageContent ->code:".concat(o,",messageId:").concat(e)),H(n.onError,o))}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,o,s){var n=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(){n._context.setMessageSearchField(e,o,s)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,o,s,n)}),"searchConversationByContent",o)},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,o,s,n)}),"searchConversationByContentWithAllChannel",o)},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",r,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,o,s,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,o,s,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("startTime",n,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",r,t.AssertRules.NUMBER),t.assert("limit",c,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,o){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,o)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,o,s,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,o){return this._defaultChannelClient.getFirstUnreadMessage(e,t,o)},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,o,s)}),"getConversationNotificationStatus",s)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,o){this._defaultChannelClient.getGroupMessageDeliverList(e,t,o)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a);else{var c=null==r?void 0:r.users;o.onSuccess(c)}})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.getRTCUserList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCUserList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(o||{}))),this._context.setRTCUserInfo(e.id,o.key,o.value).then((function(a){a!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)):s.onSuccess(!0)})).catch((function(a){n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(o.keys)),this._context.removeRTCUserInfo(e.id,o.keys).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e.prototype.getRTCRoomInfo=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCRoomInfo=function(e,o,s){throw t.todo("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,o,s){throw t.todo("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"joinRTCRoom ->roomId:".concat(e.id));var n=e.mode||0;this._context.joinRTCRoom(e.id,n).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"joinRTCRoom ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"joinRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.quitRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(n){n!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"quitRTCRoom ->code:".concat(n,",roomId:").concat(e.id)),o.onError(n)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"quitRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.RTCPing=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"RTCPing ->roomId:".concat(e.id));var n=e.mode||0;this._context.rtcPing(e.id,n).then((function(n){var a=n.code;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"RTCPing ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"RTCPing ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCData=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"setRTCData ->roomId:".concat(e,",key:").concat(o)),this._context.setRTCData(e,o,s,n,a,c).then((function(o){o!==t.ErrorCode.SUCCESS?(i.logger.warn(t.LogTagId.O,"setRTCData ->code:".concat(o,",roomId:").concat(e)),r.onError(o)):r.onSuccess(!0)})).catch((function(o){i.logger.warn(t.LogTagId.O,"setRTCData ->error:".concat(o,",roomId:").concat(e)),r.onError(o)}))},e.prototype.getRTCData=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"getRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.getRTCData(e,o,s,n).then((function(o){var s=o.code,n=o.data;s!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"getRTCData ->code:".concat(s,",roomId:").concat(e)),a.onError(s)):a.onSuccess(n)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserInfo ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.removeRTCData=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.removeRTCData(e,o,s,n,r).then((function(o){o!==t.ErrorCode.SUCCESS?(c.logger.warn(t.LogTagId.O,"removeRTCData ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){c.logger.warn(t.LogTagId.O,"removeRTCData ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.setRTCUserData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.PERSON,a,r)},e.prototype.setRTCUserTotalRes=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,o,s,n).then((function(o){o!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.getRTCUserData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.PERSON,n)},e.prototype.removeRTCUserData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.PERSON,n,a)},e.prototype.setRTCRoomData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.ROOM,a,r)},e.prototype.getRTCRoomData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.ROOM,n)},e.prototype.removeRTCRoomData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.ROOM,n,a)},e.prototype.setRTCOutData=function(e,o,s,n,a){throw t.todo("setRTCOutData")},e.prototype.getRTCOutData=function(e,o,s){throw t.todo("getRTCOutData")},e.prototype.getRTCToken=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCToken ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCToken ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCState=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,o.report).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCState ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"setRTCState ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e}(),z=[],$=[],Z={message:function(e){z.forEach((function(t){return t(G(e))}))},status:function(e){$.forEach((function(t){return t(e)}))}},ee=1;t.VersionManage.add("imlib-v2-adapter","5.6.0-beem");var te,oe=null,se={init:function(e,o,s){void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),J=t.APIContext.init(x,{appkey:e,apiVersion:"5.6.0-beem",navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,checkCA:s.checkCA,httpInMainProcess:!!s.httpInMainProcess}),(oe=J.createLogger("RC-IM","IM")).info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:s.navi?[s.navi]:[],typingExpireTime:s.typingExpireTime})),ee=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),V=new X(J,{readReceiptTimeout:ee},oe)},getInstance:function(){return V},setConnectionStatusListener:function(e){var o=null==oe?void 0:oe.createTraceId();J.assignWatcher({connectionState:function(s){null==oe||oe.info(t.LogTagId.A_CONNECT_S,JSON.stringify({status:s}),o),w.clear(),e.onChanged(s)}})},setOnReceiveMessageListener:function(e){J.assignWatcher({message:function(o,s,n){try{var a=G(o),r=J.getCurrentUserId(),c=J.getConnectedTime();F(a,r,c,ee),a=function(e,t,o,s){var n=new Date(o-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!n)return e;var a=e.content,r=((a=a||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=k.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,k.set(c,i));a.receiptMessageDic[t]=g,e.content=a}return e}(a,r,c,ee),t.usingCppEngine()||w.set(o),null==oe||oe.info(t.LogTagId.A_PULL_MSG_O,JSON.stringify({message:o.messageUId})),e.onReceived(a,void 0,n)}catch(e){null==oe||oe.error(t.LogTagId.O,"setOnReceiveMessageListener ->error:".concat(e))}}})},setConversationStatusListener:function(e){J.assignWatcher({conversationState:function(o){try{var s=[];o.forEach((function(e){var t=e.updatedItems,o=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&s.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:n,channelId:a||"",updatedTime:r.time})})),s.length>0&&e.onChanged(s)}catch(e){null==oe||oe.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){J.assignWatcher({expansion:function(o){try{o.updatedExpansion&&e.onUpdated(o.updatedExpansion),o.deletedExpansion&&e.onDeleted(o.deletedExpansion)}catch(e){null==oe||oe.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){J.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==oe||oe.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){J.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==oe||oe.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){J.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==oe||oe.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){J.assignWatcher({typingState:function(o){try{e.onChanged(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){J.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){J.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){J.assignWatcher({messageDelivered:function(o){try{e.onDelivered(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){J.assignWatcher({groupMessageDeliveredStatus:function(o){try{e.onDelivered(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,o,s){return r(this,void 0,void 0,(function(){var n,a,r,i;return c(this,(function(c){switch(c.label){case 0:return n=null==oe?void 0:oe.createTraceId(),null==oe||oe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,J.connect(e,!1,s,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==oe||oe[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(o.onSuccess(a.userId),i=new Date(J.getConnectedTime()-1e3*ee*60*60*24).getTime(),k.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=k.get(e).dealtime;t&&i-t>0&&k.remove(e)}else if(/RECEIVED$/.test(e)){var o=k.get(e),s=Object.keys(o).length;Object.keys(o).forEach((function(e){var t=o[e].dealtime;t&&i-t>0&&delete o[e]})),Object.keys(o).length!==s&&(0===o.length?k.remove(e):k.set(e,o))}}))):a.code===t.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR?(null==oe||oe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onTokenIncorrect()):(null==oe||oe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onError(a.code)),[2]}}))}))},reconnect:function(e,o,s){var n=null==oe?void 0:oe.createTraceId();null==oe||oe.info(t.LogTagId.A_RECONNECT_T,null,n),J.reconnect(s).then((function(o){var s=o.code===t.ErrorCode.SUCCESS?"info":"warn";null==oe||oe[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:o.code,userId:o.userId}),n),o.code===t.ErrorCode.SUCCESS?e.onSuccess(o.userId):(null==oe||oe.warn(t.LogTagId.O,"reconnect ->code:".concat(o.code)),e.onError(o.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:b,getMessageObjectName:function(e){var t=a(a({},P),b);return Object.keys(t).find((function(o){return t[o]===e}))||e},registerMessageType:function(e,t,o,s){this.RegisterMessage[e]=j(e,t,o.isPersited,o.isCounted),this.RegisterMessageTypeMapping[t]=e,J.registerMessageType(t,o.isPersited,o.isCounted,s)},messageWatch:function(e){var o=this;z.push((function(s){var n,a;null==oe||oe.info(t.LogTagId.O,"messageWatch ->message:".concat(JSON.stringify(s||{})));try{e(s),null===(a=(n=o._voipProvider).onReceived)||void 0===a||a.call(n,s)}catch(e){null==oe||oe.error(t.LogTagId.O,"messageWatch ->error:".concat(e))}})),J.assignWatcher({rtcInnerWatcher:Z})},statusWatch:function(e){$.push((function(o){null==oe||oe.info(t.LogTagId.O,"statusWatch ->status:".concat(o));try{e(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},ne=function(e,t,o){this.type=e,this.userIdList=t,this.mentionedContent=o},ae=function(e,t){this.isCounted=e,this.isPersited=t},re=j("TextMessage","RC:TxtMsg"),ce=j("LocationMessage","RC:LBSMsg"),ie=j("TypingStatusMessage","RC:TypSts"),ge=j("ImageMessage","RC:ImgMsg"),de=j("RichContentMessage","RC:ImgTextMsg"),ue=j("VoiceMessage","RC:VcMsg"),le=j("HQVoiceMessage","RC:HQVCMsg"),Ce=j("FileMessage","RC:FileMsg"),he=j("SightMessage","RC:SightMsg"),fe=j("GIFMessage","RC:GIFMsg"),pe=j("ReadReceiptMessage","RC:ReadNtf"),Re=j("ReadReceiptRequestMessage","RC:RRReqMsg"),Ie=j("RCCombineMessage","RC:CombineMsg"),Te=function(e,t,o,s,n,a,r,c,i,g,d,u,l,C,h,f,p,R){this.conversationType=e,this.targetId=t,this.senderUserId=o,this.content=s,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=f,this.receiptResponse=p,this.disableNotification=R};exports.VoIPMediaType=void 0,(te=exports.VoIPMediaType||(exports.VoIPMediaType={}))[te.MEDIA_AUDIO=1]="MEDIA_AUDIO",te[te.MEDIA_VEDIO=2]="MEDIA_VEDIO",te[te.MEDIA_VIDEO=2]="MEDIA_VIDEO";var Se,me=j("AcceptMessage","RC:VCAccept"),ve=j("RingingMessage","RC:VCRinging"),Me=j("SummaryMessage","RC:VCSummary"),ye=j("HungupMessage","RC:VCHangup"),Ee=j("InviteMessage","RC:VCInvite"),Ae=j("MediaModifyMessage","RC:VCModifyMedia"),Le=j("MemberModifyMessage","RC:VCModifyMem"),Oe=j("lastMessageSendTime","RC:SRSMsg"),Ue=j("ReferenceMessage","RC:ReferenceMsg"),Ne=j("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),_e=j("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Se||(Se={}));var xe=Se,Be=t.ConnectResultCode;window&&(window.RongIMClient=se),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),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,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),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,"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=me,exports.BaseMessage=W,exports.ChannelClient=Y,exports.ConnectionState=Be,exports.FileMessage=Ce,exports.GIFMessage=fe,exports.GetChatRoomType=n,exports.HQVoiceMessage=le,exports.HungupMessage=ye,exports.IMClient=X,exports.ImageMessage=ge,exports.InviteMessage=Ee,exports.LocationMessage=ce,exports.MediaModifyMessage=Ae,exports.MemberModifyMessage=Le,exports.MentionedInfo=ne,exports.MentionedType=xe,exports.Message=Te,exports.MessageTag=ae,exports.PublicServiceMultiRichContentMessage=_e,exports.PublicServiceRichContentMessage=Ne,exports.RCCombineMessage=Ie,exports.ReadReceiptMessage=pe,exports.ReadReceiptRequestMessage=Re,exports.ReadReceiptResponseMessage=q,exports.ReferenceMessage=Ue,exports.RichContentMessage=de,exports.RingingMessage=ve,exports.RongIMClient=se,exports.SentStatus=s,exports.SightMessage=he,exports.SummaryMessage=Me,exports.SyncReadStatusMessage=Oe,exports.TextMessage=re,exports.TypingStatusMessage=ie,exports.VoiceMessage=ue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var o,s=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(o||(o={}));var n=o,a=function(){return a=Object.assign||function(e){for(var t,o=1,s=arguments.length;o<s;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function r(e,t,o,s){return new(o||(o=Promise))((function(n,a){function r(e){try{i(s.next(e))}catch(e){a(e)}}function c(e){try{i(s.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}i((s=s.apply(e,t||[])).next())}))}function c(e,t){var o,s,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(o=1,s&&(n=2&c[0]?s.return:c[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,c[1])).done)return n;switch(s=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){r.label=c[1];break}if(6===c[0]&&r.label<n[1]){r.label=n[1],n=c;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(c);break}n[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],s=0}finally{o=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}function i(e,t,o){if(o||2===arguments.length)for(var s,n=0,a=t.length;n<a;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var g=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],o=0,s=t.length;o<s;o++)if(!e[t[o]])return!1;return!0}(uni))},d=g();var u={tag:"browser",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(o,c),n&&a.setRequestHeader)for(var g in n)a.setRequestHeader(g,n[g]);if(i){a.timeout=s,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){a.abort(),e({status:a.status||0})}),s),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:d,createWebSocket:function(e,t){var o=new WebSocket(e,t);return o.binaryType="arraybuffer",{onClose:function(e){o.onclose=function(t){var o=t.code,s=t.reason;e(o,s)}},onError:function(e){o.onerror=e},onMessage:function(e){o.onmessage=function(t){e(t.data)}},onOpen:function(e){o.onopen=e},send:function(e){o.send(e)},close:function(e,t){o.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,o=e.type,s=e.effectiveType,n=o||s||t.NetworkType.UNKONWN;return new Promise((function(e){e(n)}))}},l=g(),C=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},h={setItem:C("setStorageSync"),getItem:C("getStorageSync"),removeItem:C("removeStorageSync"),clear:C("clearStorageSync")},f={tag:"wechat",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:h,sessionStorage:h,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:l,createWebSocket:function(e,t){var o=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},p=g(),R=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var s=my[e]({key:t[0]}).data;return s?JSON.stringify(s):s}catch(e){}}},I={setItem:R("setStorageSync"),getItem:R("getStorageSync"),removeItem:R("removeStorageSync"),clear:R("clearStorageSync")},T={tag:"alipay",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:o,headers:n,timeout:s,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:I,sessionStorage:I,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:p,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},S=g(),m=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return tt[e].apply(tt,t)}catch(e){}}},v={setItem:m("setStorageSync"),getItem:m("getStorageSync"),removeItem:m("removeStorageSync"),clear:m("clearStorageSync")},M={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:S,localStorage:v,sessionStorage:v,httpReq:function(e){return new Promise((function(o){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},y=g(),E=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return swan[e].apply(swan,t)}catch(e){}}},A={setItem:E("setStorageSync"),getItem:E("getStorageSync"),removeItem:E("removeStorageSync"),clear:E("clearStorageSync")},L={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:y,localStorage:A,sessionStorage:A,httpReq:function(e){return new Promise((function(o,s){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},O=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},U={setItem:O("setStorageSync"),getItem:O("getStorageSync"),removeItem:O("removeStorageSync"),clear:O("clearStorageSync")},N={tag:"uniapp",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:U,sessionStorage:U,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var o={complete:function(){},url:e,protocols:t},s=uni.connectSocket(o);return{onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},_=function(e){return e&&e.request&&e.getSystemInfo},x="undefined"!=typeof uni&&_(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return N;case"mp-baidu":return L;case"mp-toutiao":return M;case"mp-alipay":return T;case"mp-weixin":return f;default:return u}}():"undefined"!=typeof my&&_(my)?T:"undefined"!=typeof tt&&_(tt)?M:"undefined"!=typeof swan&&_(swan)?L:"undefined"!=typeof wx&&_(wx)?f:u;function B(e,t,o){return"".concat(e,"_").concat(t,"_").concat(o)}var w=function(){function e(){}return e.set=function(o){if(t.SEND_MESSAGE_TYPE_OPTION[o.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[o.messageType].isPersited){var s=e.get(o.conversationType,o.targetId,o.channelId||"");if(!s||s.sentTime<o.sentTime){var n=B(o.conversationType,o.targetId,o.channelId||"");e.map[n]=o}}},e.get=function(t,o,s){var n=B(t,o,s);return e.map[n]||null},e.remove=function(t,o,s){var n=B(t,o,s);delete e.map[n]},e.clear=function(){e.map={}},e.map={},e}(),P={"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"},b={},k=new t.AppStorage(x,"API-V2");function D(e){var o=e.channelId,s=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=w.get(s,n,o||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?G(r):null;return{channelId:o||"",conversationType:s,targetId:n,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function G(e){var o=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,p=e.expansion,R=e.messageId,I=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,m=e.pushConfig,v="";return c in P?v=P[c]:c in b?v=b[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},v="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:T||"",conversationType:o,targetId:n,senderUserId:a,content:r,messageType:v,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:R,sentStatus:I||s.SENT,disableNotification:f,canIncludeExpansion:h,expansion:p,readReceiptInfo:S,pushConfig:m}}function F(e,o,s,n){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&a&&c===t.MessageDirection.SEND){var i="".concat(o).concat(e.content.messageUId,"SENT");k.set(i,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&a){var g="".concat(o).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=k.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,k.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,k.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},k.set(g,l)}}}function K(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}function H(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}var W=function(e,t,o,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=o,this.isPersited=s,this.isCounted=n};function j(e,t,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0);var n=function(n){return new W(e,t,n,o,s)};return n.MessageType=e,n.ObjectName=t,n}var V,J,q=j("ReadReceiptResponseMessage","RC:RRRspMsg"),Y=function(){function e(e,t,o,s,n){this.logger=e,this._context=t,this.channelId=o,this._isCPPMode=s,this._readReceiptTimeout=n,this._storage=k,this._draftMap={}}return e.prototype.getConversationList=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER),this._context.getConversationList(s,void 0,0,0,this.channelId).then((function(s){var a=s.code,r=s.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(o?r.forEach((function(e){o.indexOf(e.conversationType)>-1&&c.push(D(e))})):r.forEach((function(e){c.push(D(e))})),K(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),H(e.onError,a))}))},e.prototype.getConversation=function(e,o,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(o,",conversationType:").concat(e)),r(n,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,o,this.channelId)];case 1:return n=c.sent(),a=n.code,r=n.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(o)),s.onError(a),[2]):(s.onSuccess(r?D(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(o,",conversationType:").concat(e)),this._context.removeConversation(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||w.remove(e,o,n.channelId),K(s.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,o,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]=s,!0)},e.prototype.getTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(o)),this._context.getTotalUnreadCount(this.channelId,o,s).then((function(o){var s=o.code,a=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(s)),H(e.onError,s))}))},e.prototype.getUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadCount(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.clearConversations=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(o)),this._isCPPMode?this._context.clearConversations(o,this.channelId).then((function(o){o===t.ErrorCode.SUCCESS?K(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(o)),H(e.onError,o))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCount(e,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(o)),H(s.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){s===t.ErrorCode.SUCCESS?K(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(s)),H(e.onError,s))}))},e.prototype.getFirstUnreadMessage=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,o,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?K(s.onSuccess,e.data?G(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(o)),H(s.onError,e.code))}))},e.prototype.setConversationStatus=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(o,",status:").concat(s));var r=s.isTop,c=s.notificationStatus;this._context.setConversationStatus(e,o,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(o)),H(n.onError,e))}))},e.prototype.sendMessage=function(e,o,n,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("msg",n,t.AssertRules.OBJECT,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("isMentioned",c,t.AssertRules.BOOLEAN),t.assert("pushContent",i,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,o){var s,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,u=n.pushConfig,l=n.resendMessageId,C=[];if(t){var h=(o||{}).content.mentionedInfo;C=h.userIdList,s=h.type}return{mentionedType:s,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(d,c,n),h=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:l})),f=this._context.getCurrentUserId(),p=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:o,channelId:this.channelId}),p),this._context.sendMessage(e,o,h,r.onBefore,p).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),p),c===t.ErrorCode.SUCCESS){u._isCPPMode||w.set(i);var C=G(i);F(C,f,u._context.getConnectedTime(),u._readReceiptTimeout),K(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(o)),H(r.onError,c,G({isMentioned:!!h.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:o,senderUserId:f,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:s.FAILED}))}))},e.prototype.sendRecallMessage=function(e,o,s){var n=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",o,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 r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},s);this._context.recallMessage(r,c,i,g,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(n._isCPPMode||w.set(a),K(o.onSuccess,G(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(c,",messageUId:").concat(i)),H(o.onError,s))}))},e.prototype.sendTypingStatusMessage=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(o,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:s},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:o,channelId:r.channelId}),c),this._context.sendMessage(e,o,r,void 0,c).then((function(e){var s=e.code,r=e.data,i=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),s===t.ErrorCode.SUCCESS?K(n.onSuccess,G(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(o)),H(n.onError,s))}))},e.prototype.sendReceiptResponse=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(o,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(o,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var d={};d[g]=c[g].uIds,c[g].isResponse||i.push(d)}if(0===i.length)return void s.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new q({receiptMessageDic:a});n.sendMessage(e,o,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),K(s.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(o)),H(s.onError,e)}})}),200)}else s.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,o,s){var n=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(o,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(o,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(a)}))},e.prototype.getMessageReader=function(e,o,s){var n=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(o,",messageUId:").concat(e)),this._context.getMessageReader(o,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?s.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(a)}))},e.prototype.updateMessageExpansion=function(e,o,s){var n=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion,g=o.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var o=e.code;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),H(s.onError,o))}))},e.prototype.removeMessageExpansionForKey=function(e,o,s){var n=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var o=e.code;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),H(s.onError,o))}))},e.prototype.getHistoryMessages=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",c,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:o,conversationType:e,channelId:"",timestamp:s,count:n}),g),this._context.getHistoryMessage(e,o,s,n,c,this.channelId,r,g).then((function(e){var o=e.code,s=e.data;if(o===t.ErrorCode.SUCCESS)if(s){var n=s.list,r=s.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),G(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:c.join(",")}),g),K(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),K(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),H(a.onError,o)}))},e.prototype.deleteRemoteMessages=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("messages",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,o,s,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=w.get(e,o,a.channelId);c&&s.forEach((function(t){c.messageUId===t.messageUId&&w.remove(e,o,a.channelId)}))}K(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(o)),H(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,o){var s=this;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",o,t.AssertRules.CALLBACK);var n=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(n)),this._context.deleteRemoteMessageByTimestamp(n,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),H(o.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,n.map(D)):H(e.onError,s)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,o,s){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",o,t.AssertRules.NUMBER),t.assert("limit",s,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(o,s).then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?K(e.onSuccess,n.map(D)):H(e.onError,s)}))},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={});var c=s.senderUserId,i=s.objectName,g=s.content,d=s.messageDirection;s.messageUId;var u=s.canIncludeExpansion,l=s.expansion,C=s.disableNotification,h=s.sentTime,f=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e));var p=a.isUnread,R={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:f,searchContent:a.searchContent,isUnread:p,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,o,R).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?K(n.onSuccess,G(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(o)),H(n.onError,s))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,o,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(o)),H(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,o,s,n,i,this.channelId).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return G(e)}));K(a.onSuccess,g,i)}else K(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(o)),H(a.onError,s)}))},e.prototype.clearMessages=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearMessages(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||w.remove(e,o,n.channelId),K(s.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,s).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(D(e))})),K(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),H(o.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,n).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(D(e))})),K(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),H(o.onError,n))}))},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(o,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,o,s,n,a,r,this.channelId).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(G(e))})),K(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(o)),H(c.onError,s)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,o,s,n,a).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(G(e))})),K(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(o)),H(r.onError,s)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c).then((function(e){var s=e.code,n=e.data,a=[];s===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(G(e))})),K(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(o)),H(i.onError,s))}))},e.prototype.getUnreadMentionedMessages=function(e,o){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,o,this.channelId).map((function(e){return G(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,o,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?K(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(o)),H(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(o)),H(s.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(o)),this._context.getGroupMessageDeliverList(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(o)),H(s.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),H(o.onError,a))}))},e}(),Q=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},X=function(){function e(e,o,s){this._context=e,this._options=o,this.logger=s,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new Y(this.logger,e,"",this._isCPPMode,o.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,o,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(o,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=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 o=new Y(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=o,o},e.prototype.deleteChannels=function(e){var o=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 o._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,o){this._defaultChannelClient.getConversationList(e,t,o)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,o){void 0===o&&(o=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,o)},e.prototype.getConversation=function(e,t,o){return this._defaultChannelClient.getConversation(e,t,o)},e.prototype.removeConversation=function(e,t,o){return this._defaultChannelClient.removeConversation(e,t,o)},e.prototype.saveTextMessageDraft=function(e,t,o){return this._defaultChannelClient.saveTextMessageDraft(e,t,o)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,o){return this._defaultChannelClient.getTotalUnreadCount(e,t,o)},e.prototype.getUnreadCount=function(e,t,o){return this._defaultChannelClient.getUnreadCount(e,t,o)},e.prototype.getConversationUnreadCount=function(e,o){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,o){this._defaultChannelClient.clearUnreadCount(e,t,o)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,o,s){return this._defaultChannelClient.setConversationStatus(e,t,o,s)},e.prototype.sendMessage=function(e,t,o,s,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,o,s,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,o){return this._defaultChannelClient.sendRecallMessage(e,t,o)},e.prototype.sendTypingStatusMessage=function(e,t,o,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,o,s)},e.prototype.sendReceiptResponse=function(e,t,o){return this._defaultChannelClient.sendReceiptResponse(e,t,o)},e.prototype.sendReadReceiptMessage=function(e,t,o){return this._defaultChannelClient.sendReadReceiptMessage(e,t,o)},e.prototype.getMessageReader=function(e,t,o){this._defaultChannelClient.getMessageReader(e,t,o)},e.prototype.updateMessageExpansion=function(e,t,o){this._defaultChannelClient.updateMessageExpansion(e,t,o)},e.prototype.removeMessageExpansionForKey=function(e,t,o){this._defaultChannelClient.removeMessageExpansionForKey(e,t,o)},e.prototype.getHistoryMessages=function(e,t,o,s,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,o,s,n,a,r)},e.prototype.joinChatRoom=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,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:o,joinExist:!1}),a),this._context.joinChatroom(e,o,a).then((function(o){var r=o===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),a),o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.quitChatRoom=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var n=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),n),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";s.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),H(o.onError,a))}))},e.prototype.getChatRoomInfo=function(e,o,s,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,o,s).then((function(o){var s=o.code,r=o.data;s===t.ErrorCode.SUCCESS?K(n.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(s,",chatRoomId:").concat(e)),H(n.onError,s))}))},e.prototype.setChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.setChatRoomEntries=function(e,o,s){var n=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)}(o),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o).then((function(e){var o=e.code,r=e.data;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(o,",").concat(a)),H(s.onError,o,r))}))}},e.prototype.forceSetChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.removeChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.removeChatRoomEntries=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(o);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},o);c.entries=o.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(o,",").concat(r)),H(s.onError,o,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,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,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),H(s.onError,o))}))},e.prototype.getChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(o)),this._context.getChatroomEntry(e,o).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?K(s.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),H(s.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),H(o.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,o,s,n,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,o,s,a).then((function(o){var s=o.code,a=o.data;if(s===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return G(e)}));K(n.onSuccess,g,i)}else K(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),H(n.onError,s)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,o,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,o,s)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,o,s,n,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(a)),this._context.getFileToken(e,s,n,a).then(o.onSuccess).catch(o.onError)},e.prototype.getFileUrl=function(e,o,s,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING,!0),t.assert("saveName",s,t.AssertRules.STRING),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("serverType",r,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(o)),this._context.getFileUrl(e,o,s,a,r).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.removeTag=function(e,o){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n)}))},e.prototype.updateTag=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.getTagList=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))},e.prototype.getTagsForConversation=function(e,o){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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Q(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?o.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),o.onError(n))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),o.onError(e)}))},e.prototype.addTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Q(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Q(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagsForConversation=function(e,o,s){var n=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",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(o,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Q(e),o).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(o)),s.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(o)),s.onError(e)}))},e.prototype.getConversationListByTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("startTime",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,s,o).then((function(o){var s=o.code,r=o.data,c=[];s===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,o=e.conversationType,s=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?G(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:o,targetId:s,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.getUnreadCountByTag=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",o,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,o).then((function(o){var a=o.code,r=o.data;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?s.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.setConversationStatusInTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",o.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",o.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",o.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(o.targetId,",type").concat(o.type)),this._context.setConversationStatusInTag(e,Q(o),s).then((function(o){var s=o.code;o.data,s===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.callExtra=function(e,o){for(var s,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,i([e],a,!1)).then((function(s){var a=s.code,r=s.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),o.onError&&H(o.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?G(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return G(e)}));return void K(o.onSuccess,d,g)}o.onSuccess&&K(o.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,o){t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){K(o.onSuccess,!1)}),"hasRemoteUnreadMessages",o)},e.prototype.setUserStatusListener=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,o)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,o){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",o,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?K(o.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),H(o.onError,e))}))}),"setUserStatus",o)},e.prototype.getUserStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),H(o.onError,a))}))}),"getUserStatus",o)},e.prototype.addToBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),H(o.onError,n))}))}),"addToBlacklist",o)},e.prototype.removeFromBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?K(o.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),H(o.onError,n))}))}),"removeFromBlacklist",o)},e.prototype.getBlacklist=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getBlacklist().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?K(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),H(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),H(o.onError,a))}))}),"getBlacklistStatus",o)},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,o,s,n,a)}),"insertMessage",n)},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("count",n,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",r.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){c._defaultChannelClient.getRemoteHistoryMessages(e,o,s,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,o,s,n){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,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?K(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),H(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",n,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,o,s,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,o,s)}),"clearMessages",s)},e.prototype.getMessage=function(e,o){var s=this;t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?K(o.onSuccess,G(r)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),H(o.onError,a))}))}),"getMessage",o)},e.prototype.setMessageSentStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSentStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(o,",messageId:").concat(e)),H(s.onError,o))}))}),"setMessageSentStatus",s)},e.prototype.setMessageReceivedStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageReceivedStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?K(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(o,",messageId:").concat(e)),H(s.onError,o))}))}),"setMessageReceivedStatus",s)},e.prototype.setMessageContent=function(e,o,s,n){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,o,s).then((function(e){e===t.ErrorCode.SUCCESS?K(n.onSuccess,!0):H(n.onError,e)}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,o,s){var n=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(){n._context.setMessageSearchField(e,o,s)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,o,s,n)}),"searchConversationByContent",o)},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,o,s,n)}),"searchConversationByContentWithAllChannel",o)},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",r,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,o,s,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,o,s,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,t.AssertRules.STRING,!0),t.assert("startTime",n,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",r,t.AssertRules.NUMBER),t.assert("limit",c,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,o){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,o)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,o,s,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,o){return this._defaultChannelClient.getFirstUnreadMessage(e,t,o)},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,o,s)}),"getConversationNotificationStatus",s)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,o){this._defaultChannelClient.getGroupMessageDeliverList(e,t,o)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a);else{var c=null==r?void 0:r.users;o.onSuccess(c)}})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.getRTCUserList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCUserList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(o||{}))),this._context.setRTCUserInfo(e.id,o.key,o.value).then((function(a){a!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)):s.onSuccess(!0)})).catch((function(a){n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(o.keys)),this._context.removeRTCUserInfo(e.id,o.keys).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e.prototype.getRTCRoomInfo=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCRoomInfo=function(e,o,s){throw t.todo("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,o,s){throw t.todo("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"joinRTCRoom ->roomId:".concat(e.id));var n=e.mode||0;this._context.joinRTCRoom(e.id,n).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"joinRTCRoom ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"joinRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.quitRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(n){n!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"quitRTCRoom ->code:".concat(n,",roomId:").concat(e.id)),o.onError(n)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"quitRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.RTCPing=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"RTCPing ->roomId:".concat(e.id));var n=e.mode||0;this._context.rtcPing(e.id,n).then((function(n){var a=n.code;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"RTCPing ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"RTCPing ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCData=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"setRTCData ->roomId:".concat(e,",key:").concat(o)),this._context.setRTCData(e,o,s,n,a,c).then((function(o){o!==t.ErrorCode.SUCCESS?(i.logger.warn(t.LogTagId.O,"setRTCData ->code:".concat(o,",roomId:").concat(e)),r.onError(o)):r.onSuccess(!0)})).catch((function(o){i.logger.warn(t.LogTagId.O,"setRTCData ->error:".concat(o,",roomId:").concat(e)),r.onError(o)}))},e.prototype.getRTCData=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"getRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.getRTCData(e,o,s,n).then((function(o){var s=o.code,n=o.data;s!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"getRTCData ->code:".concat(s,",roomId:").concat(e)),a.onError(s)):a.onSuccess(n)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserInfo ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.removeRTCData=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.removeRTCData(e,o,s,n,r).then((function(o){o!==t.ErrorCode.SUCCESS?(c.logger.warn(t.LogTagId.O,"removeRTCData ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){c.logger.warn(t.LogTagId.O,"removeRTCData ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.setRTCUserData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.PERSON,a,r)},e.prototype.setRTCUserTotalRes=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,o,s,n).then((function(o){o!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.getRTCUserData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.PERSON,n)},e.prototype.removeRTCUserData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.PERSON,n,a)},e.prototype.setRTCRoomData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.ROOM,a,r)},e.prototype.getRTCRoomData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.ROOM,n)},e.prototype.removeRTCRoomData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.ROOM,n,a)},e.prototype.setRTCOutData=function(e,o,s,n,a){throw t.todo("setRTCOutData")},e.prototype.getRTCOutData=function(e,o,s){throw t.todo("getRTCOutData")},e.prototype.getRTCToken=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCToken ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCToken ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCState=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,o.report).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCState ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"setRTCState ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e}(),z=[],$=[],Z={message:function(e){z.forEach((function(t){return t(G(e))}))},status:function(e){$.forEach((function(t){return t(e)}))}},ee=1;t.VersionManage.add("imlib-v2-adapter","5.6.0");var te,oe=null,se={init:function(e,o,s){void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),J=t.APIContext.init(x,{appkey:e,apiVersion:"5.6.0",navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,checkCA:s.checkCA,httpInMainProcess:!!s.httpInMainProcess,logExpireTime:s.logExpireTime}),(oe=J.createLogger("RC-IM","IM")).setOutputLevel(s.logOutputLevel),oe.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:s.navi?[s.navi]:[],typingExpireTime:s.typingExpireTime})),ee=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),V=new X(J,{readReceiptTimeout:ee},oe)},getInstance:function(){return V},setConnectionStatusListener:function(e){null==oe||oe.createTraceId(),J.assignWatcher({connectionState:function(t){w.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){J.assignWatcher({message:function(o,s,n){try{var a=G(o),r=J.getCurrentUserId(),c=J.getConnectedTime();F(a,r,c,ee),a=function(e,t,o,s){var n=new Date(o-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!n)return e;var a=e.content,r=((a=a||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=k.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,k.set(c,i));a.receiptMessageDic[t]=g,e.content=a}return e}(a,r,c,ee),t.usingCppEngine()||w.set(o),e.onReceived(a,void 0,n)}catch(e){null==oe||oe.error(t.LogTagId.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){J.assignWatcher({conversationState:function(o){try{var s=[];o.forEach((function(e){var t=e.updatedItems,o=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&s.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:n,channelId:a||"",updatedTime:r.time})})),s.length>0&&e.onChanged(s)}catch(e){null==oe||oe.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){J.assignWatcher({expansion:function(o){try{o.updatedExpansion&&e.onUpdated(o.updatedExpansion),o.deletedExpansion&&e.onDeleted(o.deletedExpansion)}catch(e){null==oe||oe.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){J.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==oe||oe.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){J.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==oe||oe.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){J.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==oe||oe.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){J.assignWatcher({typingState:function(o){try{e.onChanged(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){J.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){J.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){J.assignWatcher({messageDelivered:function(o){try{e.onDelivered(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){J.assignWatcher({groupMessageDeliveredStatus:function(o){try{e.onDelivered(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,o,s){return r(this,void 0,void 0,(function(){var n,a,r,i;return c(this,(function(c){switch(c.label){case 0:return n=null==oe?void 0:oe.createTraceId(),null==oe||oe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,J.connect(e,!1,s,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==oe||oe[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(o.onSuccess(a.userId),i=new Date(J.getConnectedTime()-1e3*ee*60*60*24).getTime(),k.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=k.get(e).dealtime;t&&i-t>0&&k.remove(e)}else if(/RECEIVED$/.test(e)){var o=k.get(e),s=Object.keys(o).length;Object.keys(o).forEach((function(e){var t=o[e].dealtime;t&&i-t>0&&delete o[e]})),Object.keys(o).length!==s&&(0===o.length?k.remove(e):k.set(e,o))}}))):a.code===t.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR?(null==oe||oe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onTokenIncorrect()):(null==oe||oe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onError(a.code)),[2]}}))}))},reconnect:function(e,o,s){var n=null==oe?void 0:oe.createTraceId();null==oe||oe.info(t.LogTagId.A_RECONNECT_T,null,n),J.reconnect(s).then((function(o){var s=o.code===t.ErrorCode.SUCCESS?"info":"warn";null==oe||oe[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:o.code,userId:o.userId}),n),o.code===t.ErrorCode.SUCCESS?e.onSuccess(o.userId):(null==oe||oe.warn(t.LogTagId.O,"reconnect ->code:".concat(o.code)),e.onError(o.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:b,getMessageObjectName:function(e){var t=a(a({},P),b);return Object.keys(t).find((function(o){return t[o]===e}))||e},registerMessageType:function(e,t,o,s){this.RegisterMessage[e]=j(e,t,o.isPersited,o.isCounted),this.RegisterMessageTypeMapping[t]=e,J.registerMessageType(t,o.isPersited,o.isCounted,s)},messageWatch:function(e){var o=this;z.push((function(s){var n,a;null==oe||oe.info(t.LogTagId.O,"messageWatch ->message:".concat(JSON.stringify(s||{})));try{e(s),null===(a=(n=o._voipProvider).onReceived)||void 0===a||a.call(n,s)}catch(e){null==oe||oe.error(t.LogTagId.O,"messageWatch ->error:".concat(e))}})),J.assignWatcher({rtcInnerWatcher:Z})},statusWatch:function(e){$.push((function(o){null==oe||oe.info(t.LogTagId.O,"statusWatch ->status:".concat(o));try{e(o)}catch(e){null==oe||oe.error(t.LogTagId.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},ne=function(e,t,o){this.type=e,this.userIdList=t,this.mentionedContent=o},ae=function(e,t){this.isCounted=e,this.isPersited=t},re=j("TextMessage","RC:TxtMsg"),ce=j("LocationMessage","RC:LBSMsg"),ie=j("TypingStatusMessage","RC:TypSts"),ge=j("ImageMessage","RC:ImgMsg"),de=j("RichContentMessage","RC:ImgTextMsg"),ue=j("VoiceMessage","RC:VcMsg"),le=j("HQVoiceMessage","RC:HQVCMsg"),Ce=j("FileMessage","RC:FileMsg"),he=j("SightMessage","RC:SightMsg"),fe=j("GIFMessage","RC:GIFMsg"),pe=j("ReadReceiptMessage","RC:ReadNtf"),Re=j("ReadReceiptRequestMessage","RC:RRReqMsg"),Ie=j("RCCombineMessage","RC:CombineMsg"),Te=function(e,t,o,s,n,a,r,c,i,g,d,u,l,C,h,f,p,R){this.conversationType=e,this.targetId=t,this.senderUserId=o,this.content=s,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=f,this.receiptResponse=p,this.disableNotification=R};exports.VoIPMediaType=void 0,(te=exports.VoIPMediaType||(exports.VoIPMediaType={}))[te.MEDIA_AUDIO=1]="MEDIA_AUDIO",te[te.MEDIA_VEDIO=2]="MEDIA_VEDIO",te[te.MEDIA_VIDEO=2]="MEDIA_VIDEO";var Se,me=j("AcceptMessage","RC:VCAccept"),ve=j("RingingMessage","RC:VCRinging"),Me=j("SummaryMessage","RC:VCSummary"),ye=j("HungupMessage","RC:VCHangup"),Ee=j("InviteMessage","RC:VCInvite"),Ae=j("MediaModifyMessage","RC:VCModifyMedia"),Le=j("MemberModifyMessage","RC:VCModifyMem"),Oe=j("lastMessageSendTime","RC:SRSMsg"),Ue=j("ReferenceMessage","RC:ReferenceMsg"),Ne=j("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),_e=j("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Se||(Se={}));var xe=Se,Be=t.ConnectResultCode;window&&(window.RongIMClient=se),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),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,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),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,"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=me,exports.BaseMessage=W,exports.ChannelClient=Y,exports.ConnectionState=Be,exports.FileMessage=Ce,exports.GIFMessage=fe,exports.GetChatRoomType=n,exports.HQVoiceMessage=le,exports.HungupMessage=ye,exports.IMClient=X,exports.ImageMessage=ge,exports.InviteMessage=Ee,exports.LocationMessage=ce,exports.MediaModifyMessage=Ae,exports.MemberModifyMessage=Le,exports.MentionedInfo=ne,exports.MentionedType=xe,exports.Message=Te,exports.MessageTag=ae,exports.PublicServiceMultiRichContentMessage=_e,exports.PublicServiceRichContentMessage=Ne,exports.RCCombineMessage=Ie,exports.ReadReceiptMessage=pe,exports.ReadReceiptRequestMessage=Re,exports.ReadReceiptResponseMessage=q,exports.ReferenceMessage=Ue,exports.RichContentMessage=de,exports.RingingMessage=ve,exports.RongIMClient=se,exports.SentStatus=s,exports.SightMessage=he,exports.SummaryMessage=Me,exports.SyncReadStatusMessage=Oe,exports.TextMessage=re,exports.TypingStatusMessage=ie,exports.VoiceMessage=ue;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"types": "index.d.ts",
|
|
12
12
|
"module": "index.esm.js",
|
|
13
|
-
"version": "5.6.0
|
|
13
|
+
"version": "5.6.0",
|
|
14
14
|
"author": "pass-web@rongcloud.cn",
|
|
15
15
|
"license": "LGPL 2.1",
|
|
16
16
|
"homepage": "https://www.rongcloud.cn",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"globals": "RongIMLib"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@rongcloud/engine": "=5.6.0
|
|
24
|
+
"@rongcloud/engine": "=5.6.0"
|
|
25
25
|
}
|
|
26
26
|
}
|