@rongcloud/imlib-v2-adapter 5.8.4 → 5.8.5

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.esm.js CHANGED
@@ -1 +1 @@
1
- import{httpRequest as e,NetworkType as t,HttpMethod as n,HTTP_TIMEOUT as o,appendUrl as a,ErrorCode as s,SEND_MESSAGE_TYPE_OPTION as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as u,AssertRules as d,LogTagId as l,isArray as h,ConversationType as C,VersionManage as f,AppStorage as p,APIContext as S,logger as v}from"@rongcloud/engine";export{AreaCode,ChatroomEntryType,ChatroomSyncStatusReason,ChatroomUserChangeType,ChrmMemBanType,ChrmMemOperateType,ChrmSyncStatus,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var I;!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"}(I||(I={}));var m,y=I;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(m||(m={}));var R=m,T=function(){return T=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},T.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 E(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])}}}var N=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))},O=N();var U=null,_=function(e){return M(void 0,void 0,void 0,(function(){var t;return E(this,(function(n){switch(n.label){case 0:return[4,A.getNetworkType()];case 1:return t=n.sent(),U({status:"online"===e.type,type:t}),[2]}}))}))};var A={tag:"browser",httpReq:e,localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:O,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),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 e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.UNKONWN},n=e.type,o=e.effectiveType,a=n||o||t.UNKONWN;return Promise.resolve(a)},setNetworkStatusListener:function(e){U=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",_),window.addEventListener("online",_))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",_),window.removeEventListener("online",_)),U=null}},L=N(),B=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},w={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},k=null,x=function(e){var t=e.isConnected,n=e.networkType;k({status:t,type:n})};var P={tag:"wechat",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){wx.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:w,sessionStorage:w,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),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(e){wx.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){k=e,wx.onNetworkStatusChange(x)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(x),k=null}},b=N(),G=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){}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,n=e.networkType;K({status:t,type:n})};var W={tag:"alipay",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i),d=e.dataType||"json";return new Promise((function(e){my.request({url:u,method:t,headers:c,timeout:r,data:g,dataType:d,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,my.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(F),K=null}},H=N(),V=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){}}},j={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},J=null,q=function(e){var t=e.isConnected,n=e.networkType;J({status:t,type:n})};var Y={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:H,localStorage:j,sessionStorage:j,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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),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(e){tt.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){J=e,tt.onNetworkStatusChange(q)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(q),J=null}},Q=N(),z=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){}}},X={setItem:z("setStorageSync"),getItem:z("getStorageSync"),removeItem:z("removeStorageSync"),clear:z("clearStorageSync")},$=null,Z=function(e){var t=e.isConnected,n=e.networkType;$({status:t,type:n})};var ee={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Q,localStorage:X,sessionStorage:X,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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),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 E(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){$=e,swan.onNetworkStatusChange(Z)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(Z),$=null}},te=N(),ne=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},oe={setItem:ne("setStorageSync"),getItem:ne("getStorageSync"),removeItem:ne("removeStorageSync"),clear:ne("clearStorageSync")},ae=null,se=function(e){var t=e.isConnected,n=e.networkType;ae({status:t,type:n})};var re={tag:"jingdong",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){jd.request({url:u,method:t,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:oe,sessionStorage:oe,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:te,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ae=e,jd.onNetworkStatusChange(se)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(se),ae=null}},ce=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)}}},ie={setItem:ce("setStorageSync"),getItem:ce("getStorageSync"),removeItem:ce("removeStorageSync"),clear:ce("clearStorageSync")},ge=null,ue=function(e){var t=e.isConnected,n=e.networkType;ge({status:t,type:n})};var de={tag:"uniapp",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){uni.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:ie,sessionStorage:ie,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),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){uni.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ge=e,uni.onNetworkStatusChange(ue)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(ue),ge=null}},le=function(e){return e&&e.request&&e.getSystemInfo},he="undefined"!=typeof uni&&le(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return de;case"mp-jd":return re;case"mp-baidu":return ee;case"mp-toutiao":return Y;case"mp-alipay":return W;case"mp-weixin":return P;default:return A}}():"undefined"!=typeof jd&&le(jd)?re:"undefined"!=typeof my&&le(my)?W:"undefined"!=typeof tt&&le(tt)?Y:"undefined"!=typeof swan&&le(swan)?ee:"undefined"!=typeof wx&&le(wx)?P:A;function Ce(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var fe=function(){function e(){}return e.set=function(t){if(r[t.messageType]&&r[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Ce(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=Ce(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=Ce(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),pe={"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"},Se={};function ve(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 u=fe.get(n,o,t||"");(!s||u&&s.sentTime<u.sentTime)&&(s=u)}var d=s?Ie(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:i}}function Ie(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,u=e.sentTime,d=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,f=e.expansion,p=e.messageId,S=e.sentStatus,v=e.channelId,I=e.readReceiptInfo,m=e.pushConfig,R="";return s in pe?R=pe[s]:s in Se?R=Se[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},R="UnknownMessage"),d||(d=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:v||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:R,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:u,receivedStatus:d,receivedTime:l,objectName:s,messageId:p,sentStatus:S||y.SENT,disableNotification:C,canIncludeExpansion:h,expansion:f,readReceiptInfo:I,pushConfig:m}}function me(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&s&&c===i.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&s){var u="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,h)}}function ye(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function Re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var Te=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 Me(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new Te(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var Ee,Ne,Oe=Me("ReadReceiptResponseMessage","RC:RRRspMsg"),Ue=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;u("callback",e,d.CALLBACK),u("conversationTypes",t,d.ARRAY),u("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===s.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(ve(e))})):r.forEach((function(e){c.push(ve(e))})),ye(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(a)),Re(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;u("callback",n,d.CALLBACK),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,a,r;return E(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==s.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(r?ve(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===s.SUCCESS?(o._isCPPMode||fe.remove(e,t,o.channelId),ye(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("draftText",n,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("callback",e,d.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===s.SUCCESS?ye(e.onSuccess,a):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),Re(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},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===s.SUCCESS?ye(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),Re(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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),Re(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;u("callback",e,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===s.SUCCESS?ye(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),Re(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.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===s.SUCCESS?ye(n.onSuccess,e.data?Ie(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),Re(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",o,d.CALLBACK),u("status",n,d.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===s.SUCCESS?ye(o.onSuccess):(a.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),Re(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,a,r,g,h){var C=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("msg",n,d.OBJECT,!0),u("callback",o,d.CALLBACK),u("isMentioned",a,d.BOOLEAN),u("pushContent",r,d.ONLY_STRING),u("pushData",g,d.ONLY_STRING),u("options.userIds",null==h?void 0:h.userIds,d.ARRAY),u("options.isVoipPush",null==h?void 0:h.isVoipPush,d.BOOLEAN),u("options.disableNotification",null==h?void 0:h.disableNotification,d.BOOLEAN),u("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,d.BOOLEAN),u("options.expansion",null==h?void 0:h.expansion,d.OBJECT),u("options.pushConfig",null==h?void 0:h.pushConfig,d.OBJECT),u("options.resendMessageId",null==h?void 0:h.resendMessageId,d.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var f=!(!(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,u=a.canIncludeExpansion,d=a.pushConfig,l=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(h,a,n);r=r||"",g=g||"";var S=Object.assign(n,T(T({isMentioned:a,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:f})),v=this._context.getCurrentUserId(),I=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),I),this._context.sendMessage(e,t,S,o.onBefore,I).then((function(a){var r=a.code,g=a.data,u=r===s.SUCCESS?"info":"warn";if(C.logger[u](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),I),r===s.SUCCESS){C._isCPPMode||fe.set(g);var d=Ie(g);me(d,v,C._context.getConnectedTime(),C._readReceiptTimeout,C._storage),ye(o.onSuccess,d)}else C.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),Re(o.onError,r,Ie({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:v,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:y.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;u("message.conversationType",e.conversationType,d.NUMBER,!0),u("message.targetId",e.targetId,d.STRING,!0),u("message.messageUId",e.messageUId,d.STRING,!0),u("message.sentTime",e.sentTime,d.NUMBER,!0),u("callback",t,d.CALLBACK),u("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),u("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),u("options.extra",null==n?void 0:n.extra,d.STRING);var a=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(a,",messageUId:").concat(c));var g=T({channelId:this.channelId},n);this._context.recallMessage(a,r,c,i,g).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?(o._isCPPMode||fe.set(a),ye(t.onSuccess,Ie(a))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),Re(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("typingContentType",n,d.STRING,!0),u("callback",o,d.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===s.SUCCESS?"info":"warn";a.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===s.SUCCESS?ye(o.onSuccess,Ie(r)):(a.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),Re(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 u=setInterval((function(){1===c.length&&clearInterval(u);var a=c.splice(0,1)[0],i=new Oe({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),ye(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),Re(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;u("messageUIds",e,d.ARRAY,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];u("messageUId",c,d.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(a){var r=a.code;r===s.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;u("messageUId",e,d.STRING,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===s.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;u("expansion",e,d.OBJECT,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Re(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;u("keys",e,d.ARRAY,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Re(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,a,r,c){var i=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK,!0),u("order",c,d.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===s.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),Ie(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ye(a.onSuccess,u,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ye(a.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Re(a.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("messages",n,d.ARRAY,!0),u("callback",o,d.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===s.SUCCESS){if(!a._isCPPMode){var c=fe.get(e,t,a.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&fe.remove(e,t,a.channelId)}))}ye(o.onSuccess)}else a.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),Re(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;u("param.conversationType",e.conversationType,d.NUMBER,!0),u("param.targetId",e.targetId,d.STRING,!0),u("param.timestamp",e.timestamp,d.NUMBER,!0),u("callback",t,d.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),Re(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){u("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?ye(e.onSuccess,o.map(ve)):Re(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){u("callback",e,d.CALLBACK),u("index",t,d.NUMBER),u("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?ye(e.onSuccess,o.map(ve)):Re(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,f=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=a.isUnread,v={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:f,sentStatus:p,searchContent:a.searchContent,isUnread:S,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,v).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?ye(o.onSuccess,Ie(a)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),Re(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?ye(n.onSuccess,o):Re(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?ye(n.onSuccess,o):Re(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){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===s.SUCCESS?ye(a.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),Re(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,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===s.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return Ie(e)}));ye(a.onSuccess,g,i)}else ye(a.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),Re(a.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(a){a===s.SUCCESS?(o._isCPPMode||fe.remove(e,t,o.channelId),ye(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(ve(e))})),ye(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),Re(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(ve(e))})),ye(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),Re(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,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,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(Ie(e))})),ye(c.onSuccess,a,u)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),Re(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(Ie(e))})),ye(r.onSuccess,a,u)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Re(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,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(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===s.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(Ie(e))})),ye(i.onSuccess,a)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Re(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 Ie(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=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===s.SUCCESS?ye(o.onSuccess,!0):(a.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),Re(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 a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},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 a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),Re(n.onError,a))}))},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 a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),Re(t.onError,a))}))},e}(),_e=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Ae=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new Ue(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(s.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(u("channelId",e,d.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,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;u("channelIds",e,d.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.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.8.4"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return M(this,void 0,void 0,(function(){return E(this,(function(t){switch(t.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(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;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),a),this._context.joinChatroom(e,t,a).then((function(t){var r=t===s.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),a),t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.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(a){var r=a===s.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),Re(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var a=this;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.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===s.SUCCESS?ye(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),Re(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("entry.key",e.key,d.STRING,!0),u("entry.value",e.value,d.STRING,!0)})),u("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),u("callback",n,d.CALLBACK),t.entries.length>10)Re(n.onError,s.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(a)),Re(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("key",e,d.STRING,!0)}))}(t);var a="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(a));var r=T({},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===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(a)),Re(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("key",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,r=t.data;a===s.SUCCESS?ye(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),Re(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),Re(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,a){var r=this;void 0===a&&(a=0),u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.CALLBACK),u("timestamp",a,d.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,a).then((function(t){var n=t.code,a=t.data;if(n===s.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return Ie(e)}));ye(o.onSuccess,g,i)}else ye(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),Re(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){u("fileType",e,d.NUMBER,!0),u("fileName",n,d.STRING),u("callback",t,d.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){u("fileType",e,d.NUMBER,!0),u("fileName",t,d.STRING,!0),u("saveName",n,d.STRING),u("callback",o,d.CALLBACK),u("serverType",s,d.NUMBER),u("uploadRes",a,d.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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagId",e.tagId,(function(e){return e.length<=10})),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("tag.tagName",e.tagName,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("tagId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagName",e.tagName,d.STRING,!0),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("callback",t,d.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?e.onSuccess(a||[]):(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;u("conversationType",e.type,d.NUMBER),u("targetId",e.targetId,d.STRING),u("channelId",e.channelId,d.ONLY_STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(_e(e)).then((function(e){var o=e.code,a=e.data;o===s.SUCCESS?t.onSuccess(a||[]):(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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return _e(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return _e(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING),u("tagIds",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("tagId",e,d.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(_e(e),t).then((function(e){var a=e.code;e.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("startTime",n,d.NUMBER,!0),u("callback",o,d.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===s.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?Ie(s):null,u=g||{},d=u.messageType,l=u.sentTime,h=u.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(c)):(a.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("containMuted",t,d.BOOLEAN,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:a,data:r})),a===s.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("conversation.targetId",t.targetId,d.STRING,!0),u("conversation.type",t.type,d.NUMBER,!0),u("conversation.channelId",t.channelId,d.ONLY_STRING),u("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,_e(t),n).then((function(t){var n=t.code;t.data,n===s.SUCCESS?o.onSuccess():(a.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.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,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==s.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(a)),t.onError&&Re(t.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?Ie(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return Ie(e)}));return void ye(t.onSuccess,u,g)}t.onSuccess&&ye(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){u("callback",t,d.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ye(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;u("status",e,d.NUMBER),u("callback",t,d.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===s.SUCCESS?ye(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),Re(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),Re(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),Re(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),Re(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;u("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?ye(e.onSuccess,a):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),Re(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),Re(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("content.senderUserId",n.senderUserId,d.STRING,!0),u("content.messageDirection",n.messageDirection,d.NUMBER,!0),u("content.objectName",n.objectName,d.STRING,!0),u("callback",o,d.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.batchInsertMessage=function(e,t,n){var o,a,s=this;for(var r in u("messages",e,(function(t){return h(t)&&!(e.length<=0||e.length>=500)}),!0),u("checkDuplicate",t,d.BOOLEAN),u("callback",n,d.CALLBACK),e)u("message",e[r],d.OBJECT,!0),u("message.conversationType",e[r].conversationType,(function(e){return[C.PRIVATE,C.DISCUSSION,C.GROUP,C.CUSTOMER_SERVICE,C.SYSTEM,C.APP_PUBLIC_SERVICE,C.PUBLIC_SERVICE].includes(e)}),!0),u("message.targetId",e[r].targetId,d.STRING,!0),u("message.senderUserId",e[r].senderUserId,d.STRING,!0),u("message.messageType",e[r].messageType,d.STRING,!0),u("message.content",e[r].content,d.OBJECT,!0),u("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),u("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),u("message.expansion",e[r].expansion,d.OBJECT),u("message.disableNotification",e[r].disableNotification,d.BOOLEAN),u("message.sentTime",e[r].sentTime,d.NUMBER),u("message.sentStatus",e[r].sentStatus,d.NUMBER),u("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),u("options.searchContent",null===(a=e[r])||void 0===a?void 0:a.searchContent,d.STRING);this.assertCPPMode((function(){s._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK),u("options.order",s.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var a=this;u("messageIds",n,d.ARRAY,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===s.SUCCESS?ye(o.onSuccess,!0):(a.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),Re(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("cleanSpace",o,d.BOOLEAN),u("callback",a,d.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;u("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,Ie(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),Re(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("sentStatus",t,d.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===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),Re(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("receivedStatus",t,d.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===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),Re(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var a=this;u("messageId",e,d.NUMBER,!0),u("objectName",n,d.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,t,n).then((function(e){e===s.SUCCESS?ye(o.onSuccess,!0):Re(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("searchFiles",n,d.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;u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",n,d.ARRAY),u("customMessageType",o,d.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=[]),u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",o,d.ARRAY),u("customMessageType",n,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("total",s,d.NUMBER),u("callback",r,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("callback",s,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("startTime",o,d.NUMBER),u("endTime",a,d.NUMBER),u("offset",s,d.NUMBER),u("limit",r,d.NUMBER),u("callback",c,d.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?(u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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}(),Le=1;f.add("imlib-v2-adapter","5.8.4");var Be,we,ke=null,xe={init:function(e,t,n){var o;void 0===n&&(n={}),u("appkey",e,d.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||he;Be=new p(a,"API-V2"),Ne=S.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ke=Ne.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ke.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Le=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),Ee=new Ae(Ne,{readReceiptTimeout:Le},ke,Be),v.init(ke)},getInstance:function(){return Ee},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Ne.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==ke||ke.error(l.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){Ne.assignWatcher({message:function(t,n,o){try{var a=Ie(t),s=Ne.getCurrentUserId(),r=Ne.getConnectedTime();me(a,s,r,Le,Be),a=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,a.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,s,r,Le,Be),g()||fe.set(t),e.onReceived(a,void 0,o)}catch(e){null==ke||ke.error(l.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){Ne.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==ke||ke.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Ne.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ke||ke.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Ne.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ke||ke.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Ne.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ke||ke.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Ne.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ke||ke.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Ne.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ke||ke.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Ne.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Ne.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Ne.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ke||ke.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Ne.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ke||ke.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,a,r;return E(this,(function(c){switch(c.label){case 0:return o=null==ke?void 0:ke.createTraceId(),null==ke||ke.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Ne.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===s.SUCCESS?"info":"warn",null==ke||ke[r](l.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===s.SUCCESS?(t.onSuccess(a.userId),i=new Date(Ne.getConnectedTime()-1e3*Le*60*60*24).getTime(),Be.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=Be.get(e).dealtime;t&&i-t>0&&Be.remove(e)}else if(/RECEIVED$/.test(e)){var n=Be.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&i-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?Be.remove(e):Be.set(e,n))}}))):a.code===s.RC_CONN_TOKEN_INCORRECT?(null==ke||ke.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ke||ke.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var i}))}))},reconnect:function(e,t,n){var o=null==ke?void 0:ke.createTraceId();null==ke||ke.info(l.A_RECONNECT_T,null,o),Ne.reconnect(n).then((function(t){var n=t.code===s.SUCCESS?"info":"warn";null==ke||ke[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===s.SUCCESS?e.onSuccess(t.userId):(null==ke||ke.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Se,getMessageObjectName:function(e){var t=T(T({},pe),Se);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=Me(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,Ne.registerMessageType(t,n.isPersited,n.isCounted,o)}},Pe=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},be=function(e,t){this.isCounted=e,this.isPersited=t},Ge=Me("TextMessage","RC:TxtMsg"),De=Me("LocationMessage","RC:LBSMsg"),Ke=Me("TypingStatusMessage","RC:TypSts"),Fe=Me("ImageMessage","RC:ImgMsg"),We=Me("RichContentMessage","RC:ImgTextMsg"),He=Me("VoiceMessage","RC:VcMsg"),Ve=Me("HQVoiceMessage","RC:HQVCMsg"),je=Me("FileMessage","RC:FileMsg"),Je=Me("SightMessage","RC:SightMsg"),qe=Me("GIFMessage","RC:GIFMsg"),Ye=Me("ReadReceiptMessage","RC:ReadNtf"),Qe=Me("ReadReceiptRequestMessage","RC:RRReqMsg"),ze=Me("RCCombineMessage","RC:CombineMsg"),Xe=function(e,t,n,o,a,s,r,c,i,g,u,d,l,h,C,f,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=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=f,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"}(we||(we={}));var $e,Ze=Me("AcceptMessage","RC:VCAccept"),et=Me("RingingMessage","RC:VCRinging"),nt=Me("SummaryMessage","RC:VCSummary"),ot=Me("HungupMessage","RC:VCHangup"),at=Me("InviteMessage","RC:VCInvite"),st=Me("MediaModifyMessage","RC:VCModifyMedia"),rt=Me("MemberModifyMessage","RC:VCModifyMem"),ct=Me("lastMessageSendTime","RC:SRSMsg"),it=Me("ReferenceMessage","RC:ReferenceMsg"),gt=Me("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),ut=Me("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}($e||($e={}));var dt=$e,lt={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=xe);export{Ze as AcceptMessage,Te as BaseMessage,Ue as ChannelClient,lt as ConnectionState,je as FileMessage,qe as GIFMessage,R as GetChatRoomType,Ve as HQVoiceMessage,ot as HungupMessage,Ae as IMClient,Fe as ImageMessage,at as InviteMessage,De as LocationMessage,st as MediaModifyMessage,rt as MemberModifyMessage,Pe as MentionedInfo,dt as MentionedType,Xe as Message,be as MessageTag,ut as PublicServiceMultiRichContentMessage,gt as PublicServiceRichContentMessage,ze as RCCombineMessage,Ye as ReadReceiptMessage,Qe as ReadReceiptRequestMessage,Oe as ReadReceiptResponseMessage,it as ReferenceMessage,We as RichContentMessage,et as RingingMessage,xe as RongIMClient,y as SentStatus,Je as SightMessage,nt as SummaryMessage,ct as SyncReadStatusMessage,Ge as TextMessage,Ke as TypingStatusMessage,we as VoIPMediaType,He as VoiceMessage};
1
+ import{httpRequest as e,NetworkType as t,HttpMethod as n,HTTP_TIMEOUT as o,appendUrl as a,ErrorCode as s,SEND_MESSAGE_TYPE_OPTION as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as u,AssertRules as d,LogTagId as l,isArray as h,ConversationType as C,VersionManage as f,AppStorage as p,APIContext as S,logger as v}from"@rongcloud/engine";export{AreaCode,ChatroomEntryType,ChatroomSyncStatusReason,ChatroomUserChangeType,ChrmMemBanType,ChrmMemOperateType,ChrmSyncStatus,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var I;!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"}(I||(I={}));var m,y=I;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(m||(m={}));var R=m,T=function(){return T=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},T.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 E(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])}}}var N=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))},O=N();var U=null,_=function(e){return M(void 0,void 0,void 0,(function(){var t;return E(this,(function(n){switch(n.label){case 0:return[4,A.getNetworkType()];case 1:return t=n.sent(),U({status:"online"===e.type,type:t}),[2]}}))}))};var A={tag:"browser",httpReq:e,localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:O,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),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 e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.UNKONWN},n=e.type,o=e.effectiveType,a=n||o||t.UNKONWN;return Promise.resolve(a)},setNetworkStatusListener:function(e){U=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",_),window.addEventListener("online",_))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",_),window.removeEventListener("online",_)),U=null}},L=N(),B=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},w={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},k=null,x=function(e){var t=e.isConnected,n=e.networkType;k({status:t,type:n})};var P={tag:"wechat",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){wx.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:w,sessionStorage:w,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),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(e){wx.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){k=e,wx.onNetworkStatusChange(x)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(x),k=null}},b=N(),G=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){}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,n=e.networkType;K({status:t,type:n})};var W={tag:"alipay",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i),d=e.dataType||"json";return new Promise((function(e){my.request({url:u,method:t,headers:c,timeout:r,data:g,dataType:d,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,my.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(F),K=null}},H=N(),V=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){}}},j={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},J=null,q=function(e){var t=e.isConnected,n=e.networkType;J({status:t,type:n})};var Y={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:H,localStorage:j,sessionStorage:j,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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),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(e){tt.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){J=e,tt.onNetworkStatusChange(q)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(q),J=null}},Q=N(),z=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){}}},X={setItem:z("setStorageSync"),getItem:z("getStorageSync"),removeItem:z("removeStorageSync"),clear:z("clearStorageSync")},$=null,Z=function(e){var t=e.isConnected,n=e.networkType;$({status:t,type:n})};var ee={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:Q,localStorage:X,sessionStorage:X,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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),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 E(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){$=e,swan.onNetworkStatusChange(Z)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(Z),$=null}},te=N(),ne=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},oe={setItem:ne("setStorageSync"),getItem:ne("getStorageSync"),removeItem:ne("removeStorageSync"),clear:ne("clearStorageSync")},ae=null,se=function(e){var t=e.isConnected,n=e.networkType;ae({status:t,type:n})};var re={tag:"jingdong",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){jd.request({url:u,method:t,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:oe,sessionStorage:oe,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:te,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ae=e,jd.onNetworkStatusChange(se)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(se),ae=null}},ce=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)}}},ie={setItem:ce("setStorageSync"),getItem:ce("getStorageSync"),removeItem:ce("removeStorageSync"),clear:ce("clearStorageSync")},ge=null,ue=function(e){var t=e.isConnected,n=e.networkType;ge({status:t,type:n})};var de={tag:"uniapp",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){uni.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:ie,sessionStorage:ie,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),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){uni.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ge=e,uni.onNetworkStatusChange(ue)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(ue),ge=null}},le=function(e){return e&&e.request&&e.getSystemInfo},he="undefined"!=typeof uni&&le(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return de;case"mp-jd":return re;case"mp-baidu":return ee;case"mp-toutiao":return Y;case"mp-alipay":return W;case"mp-weixin":return P;default:return A}}():"undefined"!=typeof jd&&le(jd)?re:"undefined"!=typeof my&&le(my)?W:"undefined"!=typeof tt&&le(tt)?Y:"undefined"!=typeof swan&&le(swan)?ee:"undefined"!=typeof wx&&le(wx)?P:A;function Ce(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var fe=function(){function e(){}return e.set=function(t){if(r[t.messageType]&&r[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Ce(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=Ce(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=Ce(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),pe={"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"},Se={};function ve(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 u=fe.get(n,o,t||"");(!s||u&&s.sentTime<u.sentTime)&&(s=u)}var d=s?Ie(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:i}}function Ie(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,u=e.sentTime,d=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,f=e.expansion,p=e.messageId,S=e.sentStatus,v=e.channelId,I=e.readReceiptInfo,m=e.pushConfig,R="";return s in pe?R=pe[s]:s in Se?R=Se[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},R="UnknownMessage"),d||(d=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:v||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:R,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:u,receivedStatus:d,receivedTime:l,objectName:s,messageId:p,sentStatus:S||y.SENT,disableNotification:C,canIncludeExpansion:h,expansion:f,readReceiptInfo:I,pushConfig:m}}function me(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&s&&c===i.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&s){var u="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,h)}}function ye(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function Re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var Te=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 Me(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new Te(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var Ee,Ne,Oe=Me("ReadReceiptResponseMessage","RC:RRRspMsg"),Ue=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;u("callback",e,d.CALLBACK),u("conversationTypes",t,d.ARRAY),u("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===s.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(ve(e))})):r.forEach((function(e){c.push(ve(e))})),ye(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(a)),Re(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;u("callback",n,d.CALLBACK),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,a,r;return E(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==s.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(r?ve(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===s.SUCCESS?(o._isCPPMode||fe.remove(e,t,o.channelId),ye(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("draftText",n,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("callback",e,d.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===s.SUCCESS?ye(e.onSuccess,a):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),Re(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},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===s.SUCCESS?ye(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),Re(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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),Re(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;u("callback",e,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===s.SUCCESS?ye(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),Re(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.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===s.SUCCESS?ye(n.onSuccess,e.data?Ie(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),Re(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",o,d.CALLBACK),u("status",n,d.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===s.SUCCESS?ye(o.onSuccess):(a.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),Re(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,a,r,g,h){var C=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("msg",n,d.OBJECT,!0),u("callback",o,d.CALLBACK),u("isMentioned",a,d.BOOLEAN),u("pushContent",r,d.ONLY_STRING),u("pushData",g,d.ONLY_STRING),u("options.userIds",null==h?void 0:h.userIds,d.ARRAY),u("options.isVoipPush",null==h?void 0:h.isVoipPush,d.BOOLEAN),u("options.disableNotification",null==h?void 0:h.disableNotification,d.BOOLEAN),u("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,d.BOOLEAN),u("options.expansion",null==h?void 0:h.expansion,d.OBJECT),u("options.pushConfig",null==h?void 0:h.pushConfig,d.OBJECT),u("options.resendMessageId",null==h?void 0:h.resendMessageId,d.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var f=!(!(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,u=a.canIncludeExpansion,d=a.pushConfig,l=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(h,a,n);r=r||"",g=g||"";var S=Object.assign(n,T(T({isMentioned:a,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:f})),v=this._context.getCurrentUserId(),I=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),I),this._context.sendMessage(e,t,S,o.onBefore,I).then((function(a){var r=a.code,g=a.data,u=r===s.SUCCESS?"info":"warn";if(C.logger[u](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),I),r===s.SUCCESS){C._isCPPMode||fe.set(g);var d=Ie(g);me(d,v,C._context.getConnectedTime(),C._readReceiptTimeout,C._storage),ye(o.onSuccess,d)}else C.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),Re(o.onError,r,Ie({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:v,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:y.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;u("message.conversationType",e.conversationType,d.NUMBER,!0),u("message.targetId",e.targetId,d.STRING,!0),u("message.messageUId",e.messageUId,d.STRING,!0),u("message.sentTime",e.sentTime,d.NUMBER,!0),u("callback",t,d.CALLBACK),u("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),u("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),u("options.extra",null==n?void 0:n.extra,d.STRING);var a=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(a,",messageUId:").concat(c));var g=T({channelId:this.channelId},n);this._context.recallMessage(a,r,c,i,g).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?(o._isCPPMode||fe.set(a),ye(t.onSuccess,Ie(a))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),Re(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("typingContentType",n,d.STRING,!0),u("callback",o,d.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===s.SUCCESS?"info":"warn";a.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===s.SUCCESS?ye(o.onSuccess,Ie(r)):(a.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),Re(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 u=setInterval((function(){1===c.length&&clearInterval(u);var a=c.splice(0,1)[0],i=new Oe({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),ye(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),Re(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;u("messageUIds",e,d.ARRAY,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];u("messageUId",c,d.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(a){var r=a.code;r===s.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;u("messageUId",e,d.STRING,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===s.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;u("expansion",e,d.OBJECT,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Re(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;u("keys",e,d.ARRAY,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Re(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,a,r,c){var i=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK,!0),u("order",c,d.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===s.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),Ie(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ye(a.onSuccess,u,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ye(a.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Re(a.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("messages",n,d.ARRAY,!0),u("callback",o,d.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===s.SUCCESS){if(!a._isCPPMode){var c=fe.get(e,t,a.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&fe.remove(e,t,a.channelId)}))}ye(o.onSuccess)}else a.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),Re(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;u("param.conversationType",e.conversationType,d.NUMBER,!0),u("param.targetId",e.targetId,d.STRING,!0),u("param.timestamp",e.timestamp,d.NUMBER,!0),u("callback",t,d.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),Re(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){u("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?ye(e.onSuccess,o.map(ve)):Re(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){u("callback",e,d.CALLBACK),u("index",t,d.NUMBER),u("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?ye(e.onSuccess,o.map(ve)):Re(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,f=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=a.isUnread,v={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:f,sentStatus:p,searchContent:a.searchContent,isUnread:S,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,v).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?ye(o.onSuccess,Ie(a)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),Re(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?ye(n.onSuccess,o):Re(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?ye(n.onSuccess,o):Re(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){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===s.SUCCESS?ye(a.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),Re(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,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===s.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return Ie(e)}));ye(a.onSuccess,g,i)}else ye(a.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),Re(a.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(a){a===s.SUCCESS?(o._isCPPMode||fe.remove(e,t,o.channelId),ye(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(ve(e))})),ye(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),Re(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(ve(e))})),ye(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),Re(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,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,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(Ie(e))})),ye(c.onSuccess,a,u)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),Re(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(Ie(e))})),ye(r.onSuccess,a,u)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Re(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,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(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===s.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(Ie(e))})),ye(i.onSuccess,a)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Re(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 Ie(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=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===s.SUCCESS?ye(o.onSuccess,!0):(a.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),Re(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 a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),Re(n.onError,a))}))},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 a=e.code,r=e.data;a===s.SUCCESS?ye(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),Re(n.onError,a))}))},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 a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),Re(t.onError,a))}))},e}(),_e=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Ae=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new Ue(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(s.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(u("channelId",e,d.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,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;u("channelIds",e,d.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.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.8.5"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return M(this,void 0,void 0,(function(){return E(this,(function(t){switch(t.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(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;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),a),this._context.joinChatroom(e,t,a).then((function(t){var r=t===s.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),a),t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.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(a){var r=a===s.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),Re(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var a=this;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.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===s.SUCCESS?ye(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),Re(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("entry.key",e.key,d.STRING,!0),u("entry.value",e.value,d.STRING,!0)})),u("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),u("callback",n,d.CALLBACK),t.entries.length>10)Re(n.onError,s.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(a)),Re(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("key",e,d.STRING,!0)}))}(t);var a="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(a));var r=T({},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===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(a)),Re(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===s.SUCCESS?ye(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Re(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("key",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,r=t.data;a===s.SUCCESS?ye(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),Re(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),Re(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,a){var r=this;void 0===a&&(a=0),u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.CALLBACK),u("timestamp",a,d.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,a).then((function(t){var n=t.code,a=t.data;if(n===s.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return Ie(e)}));ye(o.onSuccess,g,i)}else ye(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),Re(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){u("fileType",e,d.NUMBER,!0),u("fileName",n,d.STRING),u("callback",t,d.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){u("fileType",e,d.NUMBER,!0),u("fileName",t,d.STRING,!0),u("saveName",n,d.STRING),u("callback",o,d.CALLBACK),u("serverType",s,d.NUMBER),u("uploadRes",a,d.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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagId",e.tagId,(function(e){return e.length<=10})),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("tag.tagName",e.tagName,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("tagId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagName",e.tagName,d.STRING,!0),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("callback",t,d.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?e.onSuccess(a||[]):(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;u("conversationType",e.type,d.NUMBER),u("targetId",e.targetId,d.STRING),u("channelId",e.channelId,d.ONLY_STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(_e(e)).then((function(e){var o=e.code,a=e.data;o===s.SUCCESS?t.onSuccess(a||[]):(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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return _e(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return _e(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING),u("tagIds",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("tagId",e,d.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(_e(e),t).then((function(e){var a=e.code;e.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("startTime",n,d.NUMBER,!0),u("callback",o,d.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===s.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?Ie(s):null,u=g||{},d=u.messageType,l=u.sentTime,h=u.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(c)):(a.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("containMuted",t,d.BOOLEAN,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:a,data:r})),a===s.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("conversation.targetId",t.targetId,d.STRING,!0),u("conversation.type",t.type,d.NUMBER,!0),u("conversation.channelId",t.channelId,d.ONLY_STRING),u("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,_e(t),n).then((function(t){var n=t.code;t.data,n===s.SUCCESS?o.onSuccess():(a.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.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,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==s.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(a)),t.onError&&Re(t.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?Ie(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return Ie(e)}));return void ye(t.onSuccess,u,g)}t.onSuccess&&ye(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){u("callback",t,d.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ye(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;u("status",e,d.NUMBER),u("callback",t,d.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===s.SUCCESS?ye(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),Re(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),Re(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),Re(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===s.SUCCESS?ye(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),Re(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;u("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?ye(e.onSuccess,a):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),Re(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),Re(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("content.senderUserId",n.senderUserId,d.STRING,!0),u("content.messageDirection",n.messageDirection,d.NUMBER,!0),u("content.objectName",n.objectName,d.STRING,!0),u("callback",o,d.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.batchInsertMessage=function(e,t,n){var o,a,s=this;for(var r in u("messages",e,(function(t){return h(t)&&!(e.length<=0||e.length>=500)}),!0),u("checkDuplicate",t,d.BOOLEAN),u("callback",n,d.CALLBACK),e)u("message",e[r],d.OBJECT,!0),u("message.conversationType",e[r].conversationType,(function(e){return[C.PRIVATE,C.DISCUSSION,C.GROUP,C.CUSTOMER_SERVICE,C.SYSTEM,C.APP_PUBLIC_SERVICE,C.PUBLIC_SERVICE].includes(e)}),!0),u("message.targetId",e[r].targetId,d.STRING,!0),u("message.senderUserId",e[r].senderUserId,d.STRING,!0),u("message.messageType",e[r].messageType,d.STRING,!0),u("message.content",e[r].content,d.OBJECT,!0),u("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),u("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),u("message.expansion",e[r].expansion,d.OBJECT),u("message.disableNotification",e[r].disableNotification,d.BOOLEAN),u("message.sentTime",e[r].sentTime,d.NUMBER),u("message.sentStatus",e[r].sentStatus,d.NUMBER),u("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),u("options.searchContent",null===(a=e[r])||void 0===a?void 0:a.searchContent,d.STRING);this.assertCPPMode((function(){s._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK),u("options.order",s.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var a=this;u("messageIds",n,d.ARRAY,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===s.SUCCESS?ye(o.onSuccess,!0):(a.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),Re(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("cleanSpace",o,d.BOOLEAN),u("callback",a,d.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;u("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?ye(t.onSuccess,Ie(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),Re(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("sentStatus",t,d.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===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),Re(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("receivedStatus",t,d.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===s.SUCCESS?ye(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),Re(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var a=this;u("messageId",e,d.NUMBER,!0),u("objectName",n,d.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,t,n).then((function(e){e===s.SUCCESS?ye(o.onSuccess,!0):Re(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("searchFiles",n,d.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;u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",n,d.ARRAY),u("customMessageType",o,d.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=[]),u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",o,d.ARRAY),u("customMessageType",n,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("total",s,d.NUMBER),u("callback",r,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("callback",s,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("startTime",o,d.NUMBER),u("endTime",a,d.NUMBER),u("offset",s,d.NUMBER),u("limit",r,d.NUMBER),u("callback",c,d.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?(u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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}(),Le=1;f.add("imlib-v2-adapter","5.8.5");var Be,we,ke=null,xe={init:function(e,t,n){var o;void 0===n&&(n={}),u("appkey",e,d.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||he;Be=new p(a,"API-V2"),Ne=S.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ke=Ne.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ke.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Le=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),Ee=new Ae(Ne,{readReceiptTimeout:Le},ke,Be),v.init(ke)},getInstance:function(){return Ee},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Ne.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==ke||ke.error(l.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){Ne.assignWatcher({message:function(t,n,o){try{var a=Ie(t),s=Ne.getCurrentUserId(),r=Ne.getConnectedTime();me(a,s,r,Le,Be),a=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,a.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,s,r,Le,Be),g()||fe.set(t),e.onReceived(a,void 0,o)}catch(e){null==ke||ke.error(l.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){Ne.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==ke||ke.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Ne.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ke||ke.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Ne.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ke||ke.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Ne.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ke||ke.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Ne.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ke||ke.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Ne.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ke||ke.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Ne.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Ne.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Ne.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ke||ke.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Ne.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ke||ke.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,a,r;return E(this,(function(c){switch(c.label){case 0:return o=null==ke?void 0:ke.createTraceId(),null==ke||ke.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Ne.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===s.SUCCESS?"info":"warn",null==ke||ke[r](l.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===s.SUCCESS?(t.onSuccess(a.userId),i=new Date(Ne.getConnectedTime()-1e3*Le*60*60*24).getTime(),Be.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=Be.get(e).dealtime;t&&i-t>0&&Be.remove(e)}else if(/RECEIVED$/.test(e)){var n=Be.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&i-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?Be.remove(e):Be.set(e,n))}}))):a.code===s.RC_CONN_TOKEN_INCORRECT?(null==ke||ke.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ke||ke.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var i}))}))},reconnect:function(e,t,n){var o=null==ke?void 0:ke.createTraceId();null==ke||ke.info(l.A_RECONNECT_T,null,o),Ne.reconnect(n).then((function(t){var n=t.code===s.SUCCESS?"info":"warn";null==ke||ke[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===s.SUCCESS?e.onSuccess(t.userId):(null==ke||ke.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Se,getMessageObjectName:function(e){var t=T(T({},pe),Se);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=Me(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,Ne.registerMessageType(t,n.isPersited,n.isCounted,o)}},Pe=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},be=function(e,t){this.isCounted=e,this.isPersited=t},Ge=Me("TextMessage","RC:TxtMsg"),De=Me("LocationMessage","RC:LBSMsg"),Ke=Me("TypingStatusMessage","RC:TypSts"),Fe=Me("ImageMessage","RC:ImgMsg"),We=Me("RichContentMessage","RC:ImgTextMsg"),He=Me("VoiceMessage","RC:VcMsg"),Ve=Me("HQVoiceMessage","RC:HQVCMsg"),je=Me("FileMessage","RC:FileMsg"),Je=Me("SightMessage","RC:SightMsg"),qe=Me("GIFMessage","RC:GIFMsg"),Ye=Me("ReadReceiptMessage","RC:ReadNtf"),Qe=Me("ReadReceiptRequestMessage","RC:RRReqMsg"),ze=Me("RCCombineMessage","RC:CombineMsg"),Xe=function(e,t,n,o,a,s,r,c,i,g,u,d,l,h,C,f,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=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=f,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"}(we||(we={}));var $e,Ze=Me("AcceptMessage","RC:VCAccept"),et=Me("RingingMessage","RC:VCRinging"),nt=Me("SummaryMessage","RC:VCSummary"),ot=Me("HungupMessage","RC:VCHangup"),at=Me("InviteMessage","RC:VCInvite"),st=Me("MediaModifyMessage","RC:VCModifyMedia"),rt=Me("MemberModifyMessage","RC:VCModifyMem"),ct=Me("lastMessageSendTime","RC:SRSMsg"),it=Me("ReferenceMessage","RC:ReferenceMsg"),gt=Me("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),ut=Me("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}($e||($e={}));var dt=$e,lt={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=xe);export{Ze as AcceptMessage,Te as BaseMessage,Ue as ChannelClient,lt as ConnectionState,je as FileMessage,qe as GIFMessage,R as GetChatRoomType,Ve as HQVoiceMessage,ot as HungupMessage,Ae as IMClient,Fe as ImageMessage,at as InviteMessage,De as LocationMessage,st as MediaModifyMessage,rt as MemberModifyMessage,Pe as MentionedInfo,dt as MentionedType,Xe as Message,be as MessageTag,ut as PublicServiceMultiRichContentMessage,gt as PublicServiceRichContentMessage,ze as RCCombineMessage,Ye as ReadReceiptMessage,Qe as ReadReceiptRequestMessage,Oe as ReadReceiptResponseMessage,it as ReferenceMessage,We as RichContentMessage,et as RingingMessage,xe as RongIMClient,y as SentStatus,Je as SightMessage,nt as SummaryMessage,ct as SyncReadStatusMessage,Ge as TextMessage,Ke as TypingStatusMessage,we as VoIPMediaType,He 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 s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function r(e,t,s,n){return new(s||(s=Promise))((function(o,a){function r(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((n=n.apply(e,t||[])).next())}))}function c(e,t){var s,n,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],n=0}finally{s=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=i();var u=null,d=function(e){return r(void 0,void 0,void 0,(function(){var t;return c(this,(function(s){switch(s.label){case 0:return[4,l.getNetworkType()];case 1:return t=s.sent(),u({status:"online"===e.type,type:t}),[2]}}))}))};var l={tag:"browser",httpReq:t.httpRequest,localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.NetworkType.UNKONWN},s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return Promise.resolve(o)},setNetworkStatusListener:function(e){u=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",d),window.addEventListener("online",d))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",d),window.removeEventListener("online",d)),u=null}},C=i(),h=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},p={setItem:h("setStorageSync"),getItem:h("getStorageSync"),removeItem:h("removeStorageSync"),clear:h("clearStorageSync")},f=null,I=function(e){var t=e.isConnected,s=e.networkType;f({status:t,type:s})};var R={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:p,sessionStorage:p,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:C,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),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){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){f=e,wx.onNetworkStatusChange(I)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(I),f=null}},T=i(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];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 n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m=null,y=function(e){var t=e.isConnected,s=e.networkType;m({status:t,type:s})};var E={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=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:s,headers:o,timeout:n,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:v,sessionStorage:v,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){m=e,my.onNetworkStatusChange(y)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(y),m=null}},M=i(),A=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},N=null,O=function(e){var t=e.isConnected,s=e.networkType;N({status:t,type:s})};var U={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:M,localStorage:L,sessionStorage:L,httpReq:function(e){return new Promise((function(s){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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){N=e,tt.onNetworkStatusChange(O)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(O),N=null}},_=i(),B=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},x={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},w=null,P=function(e){var t=e.isConnected,s=e.networkType;w({status:t,type:s})};var k={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,localStorage:x,sessionStorage:x,httpReq:function(e){return new Promise((function(s,n){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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.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 s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){w=e,swan.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(P),w=null}},b=i(),G=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,s=e.networkType;K({status:t,type:s})};var j={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:s,headers:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,jd.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(F),K=null}},H=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},W={setItem:H("setStorageSync"),getItem:H("getStorageSync"),removeItem:H("removeStorageSync"),clear:H("clearStorageSync")},V=null,J=function(e){var t=e.isConnected,s=e.networkType;V({status:t,type:s})};var q={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:W,sessionStorage:W,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={complete:function(){},url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),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(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){V=e,uni.onNetworkStatusChange(J)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(J),V=null}},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 q;case"mp-jd":return j;case"mp-baidu":return k;case"mp-toutiao":return U;case"mp-alipay":return E;case"mp-weixin":return R;default:return l}}():"undefined"!=typeof jd&&Y(jd)?j:"undefined"!=typeof my&&Y(my)?E:"undefined"!=typeof tt&&Y(tt)?U:"undefined"!=typeof swan&&Y(swan)?k:"undefined"!=typeof wx&&Y(wx)?R:l;function z(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var X=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=z(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=z(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=z(t,s,n);delete e.map[o]},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={};function ee(e){var s=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=X.get(n,o,s||"");(!r||u&&r.sentTime<u.sentTime)&&(r=u)}var d=r?te(r):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function te(e){var s=e.conversationType,o=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,p=e.disableNotification,f=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m="";return c in $?m=$[c]:c in Z?m=Z[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},m="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:a,content:r,messageType:m,messageUId:i,messageDirection:g,offLineMessage:u,sentTime:d,receivedStatus:l,receivedTime:C,objectName:c,messageId:I,sentStatus:R||n.SENT,disableNotification:p,canIncludeExpansion:h,expansion:f,readReceiptInfo:S,pushConfig:v}}function se(e,s,n,o,a){var r=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===t.MessageDirection.SEND){var g="".concat(s).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var u="".concat(s).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,C)}}function ne(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function oe(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var ae=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function re(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new ae(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var ce,ie,ge=re("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,s,n,o,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(ee(e))})):r.forEach((function(e){c.push(ee(e))})),ne(e.onSuccess,c)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),oe(e.onError,a))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(s,",conversationType:").concat(e)),r(o,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),n.onError(a),[2]):(n.onSuccess(r?ee(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(s,",conversationType:").concat(e)),this._context.removeConversation(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(s)),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),oe(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?ne(n.onSuccess,e.data?te(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),oe(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.sendMessage=function(e,s,o,r,c,i,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,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==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var l=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),C=function(e,t,s){var n,o=e||{},a=o.userIds,r=o.isVoipPush,c=o.disableNotification,i=o.isFilerWhiteBlacklist,g=o.expansion,u=o.canIncludeExpansion,d=o.pushConfig,l=o.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,n=h.type}return{mentionedType:n,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(u,c,o);i=i||"",g=g||"";var h=Object.assign(o,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:o.objectName,channelId:this.channelId,isStatusMessage:l})),p=this._context.getCurrentUserId(),f=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:s,channelId:this.channelId}),f),this._context.sendMessage(e,s,h,r.onBefore,f).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(d.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),f),c===t.ErrorCode.SUCCESS){d._isCPPMode||X.set(i);var C=te(i);se(C,p,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),ne(r.onSuccess,C)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),oe(r.onError,c,te({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:s,senderUserId:p,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:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=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",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.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 u=a({channelId:this.channelId},n);this._context.recallMessage(r,c,i,g,u).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||X.set(a),ne(s.onSuccess,te(a))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(c,",messageUId:").concat(i)),oe(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},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:s,channelId:r.channelId}),c),this._context.sendMessage(e,s,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(s,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(s,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var u={};u[g]=c[g].uIds,c[g].isResponse||i.push(u)}if(0===i.length)return void n.onSuccess(null);var d=setInterval((function(){1===i.length&&clearInterval(d);var a=i.splice(0,1)[0],g=new ge({receiptMessageDic:a});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,o._storage.set(r,c),ne(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(s,",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(s,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReader(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion,g=s.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 s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.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 s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,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(s,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,c,this.channelId,r,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),te(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),ne(a.onSuccess,u,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),ne(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),oe(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=X.get(e,s,a.channelId);c&&n.forEach((function(t){c.messageUId===t.messageUId&&X.remove(e,s,a.channelId)}))}ne(o.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),oe(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=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",s,t.AssertRules.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),oe(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,p=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var f=a.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:h,sentStatus:p,searchContent:a.searchContent,isUnread:f,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return te(e)}));ne(a.onSuccess,g,i)}else ne(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(s)),oe(a.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearMessages(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.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===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.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===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,s,n,o,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(te(e))})),ne(c.onSuccess,a,u)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(s)),oe(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(te(e))})),ne(r.onSuccess,a,u)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(te(e))})),ne(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return te(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(s)),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),oe(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),oe(s.onError,a))}))},e}(),de=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},le=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(s,"' 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 s=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=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 s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.8.4"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return r(this,void 0,void 0,(function(){return c(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.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,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},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,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){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,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.sendMessage=function(e,t,s,n,o,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,n,o,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,a,r)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,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:s,joinExist:!1}),a),this._context.joinChatroom(e,s,a).then((function(s){var r=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?ne(o.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(n,",chatRoomId:").concat(e)),oe(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=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)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)oe(n.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,s).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),oe(n.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},s);c.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),oe(n.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(s)),this._context.getChatroomEntry(e,s).then((function(s){var a=s.code,r=s.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),oe(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,s,n,a).then((function(s){var n=s.code,a=s.data;if(n===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return te(e)}));ne(o.onSuccess,g,i)}else ne(o.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),oe(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,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(s)),this._context.getFileUrl(e,s,n,a,r).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(de(e)).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(o)),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.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,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.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,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=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",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(s,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(de(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),n.onError(a))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,r=s.data,c=[];n===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?te(a):null,u=g||{},d=u.messageType,l=u.sentTime,C=u.receivedStatus;return{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:C}}(e))})),o.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,s).then((function(s){var a=s.code,r=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?n.onSuccess(r||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(s.targetId,",type").concat(s.type)),this._context.setConversationStatusInTag(e,de(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&oe(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?te(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return te(e)}));return void ne(s.onSuccess,u,g)}s.onSuccess&&ne(s.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ne(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),oe(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),oe(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(o)),oe(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),oe(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,a,r=this;for(var c in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[c],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[c].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[c].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[c].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[c].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[c].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[c].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[c].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[c].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[c].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[c].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[c].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[c])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[c])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){r._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,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,s,n,o,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,n,o){var a=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),oe(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,te(r)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),oe(s.onError,a))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):oe(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,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,s,n,o,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,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,s,n,o,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Ce=1;t.VersionManage.add("imlib-v2-adapter","5.8.4");var he,pe,fe=null,Ie={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||Q;he=new t.AppStorage(a,"API-V2"),ie=t.APIContext.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(fe=ie.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),fe.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Ce=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ce=new le(ie,{readReceiptTimeout:Ce},fe,he),t.logger.init(fe)},getInstance:function(){return ce},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ie.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){ie.assignWatcher({message:function(s,n,o){try{var a=te(s),r=ie.getCurrentUserId(),c=ie.getConnectedTime();se(a,r,c,Ce,he),a=function(e,t,s,n,o){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=o.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,o.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,r,c,Ce,he),t.usingCppEngine()||X.set(s),e.onReceived(a,void 0,o)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){ie.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:o,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ie.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ie.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ie.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ie.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==fe||fe.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ie.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ie.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ie.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ie.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ie.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,n){return r(this,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return o=null==fe?void 0:fe.createTraceId(),null==fe||fe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ie.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==fe||fe[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(ie.getConnectedTime()-1e3*Ce*60*60*24).getTime(),he.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=he.get(e).dealtime;t&&i-t>0&&he.remove(e)}else if(/RECEIVED$/.test(e)){var s=he.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&i-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?he.remove(e):he.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==fe||fe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==fe||fe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}var i}))}))},reconnect:function(e,s,n){var o=null==fe?void 0:fe.createTraceId();null==fe||fe.info(t.LogTagId.A_RECONNECT_T,null,o),ie.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==fe||fe[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==fe||fe.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=a(a({},$),Z);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=re(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,ie.registerMessageType(t,s.isPersited,s.isCounted,n)}},Re=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},Te=function(e,t){this.isCounted=e,this.isPersited=t},Se=re("TextMessage","RC:TxtMsg"),ve=re("LocationMessage","RC:LBSMsg"),me=re("TypingStatusMessage","RC:TypSts"),ye=re("ImageMessage","RC:ImgMsg"),Ee=re("RichContentMessage","RC:ImgTextMsg"),Me=re("VoiceMessage","RC:VcMsg"),Ae=re("HQVoiceMessage","RC:HQVCMsg"),Le=re("FileMessage","RC:FileMsg"),Ne=re("SightMessage","RC:SightMsg"),Oe=re("GIFMessage","RC:GIFMsg"),Ue=re("ReadReceiptMessage","RC:ReadNtf"),_e=re("ReadReceiptRequestMessage","RC:RRReqMsg"),Be=re("RCCombineMessage","RC:CombineMsg"),xe=function(e,t,s,n,o,a,r,c,i,g,u,d,l,C,h,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};exports.VoIPMediaType=void 0,(pe=exports.VoIPMediaType||(exports.VoIPMediaType={}))[pe.MEDIA_AUDIO=1]="MEDIA_AUDIO",pe[pe.MEDIA_VEDIO=2]="MEDIA_VEDIO",pe[pe.MEDIA_VIDEO=2]="MEDIA_VIDEO";var we,Pe=re("AcceptMessage","RC:VCAccept"),ke=re("RingingMessage","RC:VCRinging"),be=re("SummaryMessage","RC:VCSummary"),Ge=re("HungupMessage","RC:VCHangup"),De=re("InviteMessage","RC:VCInvite"),Ke=re("MediaModifyMessage","RC:VCModifyMedia"),Fe=re("MemberModifyMessage","RC:VCModifyMem"),je=re("lastMessageSendTime","RC:SRSMsg"),He=re("ReferenceMessage","RC:ReferenceMsg"),We=re("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ve=re("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(we||(we={}));var Je=we;window&&(window.RongIMClient=Ie),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"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,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Pe,exports.BaseMessage=ae,exports.ChannelClient=ue,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Le,exports.GIFMessage=Oe,exports.GetChatRoomType=o,exports.HQVoiceMessage=Ae,exports.HungupMessage=Ge,exports.IMClient=le,exports.ImageMessage=ye,exports.InviteMessage=De,exports.LocationMessage=ve,exports.MediaModifyMessage=Ke,exports.MemberModifyMessage=Fe,exports.MentionedInfo=Re,exports.MentionedType=Je,exports.Message=xe,exports.MessageTag=Te,exports.PublicServiceMultiRichContentMessage=Ve,exports.PublicServiceRichContentMessage=We,exports.RCCombineMessage=Be,exports.ReadReceiptMessage=Ue,exports.ReadReceiptRequestMessage=_e,exports.ReadReceiptResponseMessage=ge,exports.ReferenceMessage=He,exports.RichContentMessage=Ee,exports.RingingMessage=ke,exports.RongIMClient=Ie,exports.SentStatus=n,exports.SightMessage=Ne,exports.SummaryMessage=be,exports.SyncReadStatusMessage=je,exports.TextMessage=Se,exports.TypingStatusMessage=me,exports.VoiceMessage=Me;
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 s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function r(e,t,s,n){return new(s||(s=Promise))((function(o,a){function r(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((n=n.apply(e,t||[])).next())}))}function c(e,t){var s,n,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],n=0}finally{s=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=i();var u=null,d=function(e){return r(void 0,void 0,void 0,(function(){var t;return c(this,(function(s){switch(s.label){case 0:return[4,l.getNetworkType()];case 1:return t=s.sent(),u({status:"online"===e.type,type:t}),[2]}}))}))};var l={tag:"browser",httpReq:t.httpRequest,localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.NetworkType.UNKONWN},s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return Promise.resolve(o)},setNetworkStatusListener:function(e){u=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",d),window.addEventListener("online",d))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",d),window.removeEventListener("online",d)),u=null}},C=i(),h=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},p={setItem:h("setStorageSync"),getItem:h("getStorageSync"),removeItem:h("removeStorageSync"),clear:h("clearStorageSync")},f=null,I=function(e){var t=e.isConnected,s=e.networkType;f({status:t,type:s})};var R={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:p,sessionStorage:p,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:C,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),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){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){f=e,wx.onNetworkStatusChange(I)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(I),f=null}},T=i(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];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 n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m=null,y=function(e){var t=e.isConnected,s=e.networkType;m({status:t,type:s})};var E={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=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:s,headers:o,timeout:n,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:v,sessionStorage:v,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){m=e,my.onNetworkStatusChange(y)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(y),m=null}},M=i(),A=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},N=null,O=function(e){var t=e.isConnected,s=e.networkType;N({status:t,type:s})};var U={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:M,localStorage:L,sessionStorage:L,httpReq:function(e){return new Promise((function(s){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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){N=e,tt.onNetworkStatusChange(O)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(O),N=null}},_=i(),B=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},x={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},w=null,P=function(e){var t=e.isConnected,s=e.networkType;w({status:t,type:s})};var k={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,localStorage:x,sessionStorage:x,httpReq:function(e){return new Promise((function(s,n){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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.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 s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){w=e,swan.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(P),w=null}},b=i(),G=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,s=e.networkType;K({status:t,type:s})};var j={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:s,headers:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,jd.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(F),K=null}},H=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},W={setItem:H("setStorageSync"),getItem:H("getStorageSync"),removeItem:H("removeStorageSync"),clear:H("clearStorageSync")},V=null,J=function(e){var t=e.isConnected,s=e.networkType;V({status:t,type:s})};var q={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:W,sessionStorage:W,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={complete:function(){},url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),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(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){V=e,uni.onNetworkStatusChange(J)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(J),V=null}},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 q;case"mp-jd":return j;case"mp-baidu":return k;case"mp-toutiao":return U;case"mp-alipay":return E;case"mp-weixin":return R;default:return l}}():"undefined"!=typeof jd&&Y(jd)?j:"undefined"!=typeof my&&Y(my)?E:"undefined"!=typeof tt&&Y(tt)?U:"undefined"!=typeof swan&&Y(swan)?k:"undefined"!=typeof wx&&Y(wx)?R:l;function z(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var X=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=z(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=z(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=z(t,s,n);delete e.map[o]},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={};function ee(e){var s=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=X.get(n,o,s||"");(!r||u&&r.sentTime<u.sentTime)&&(r=u)}var d=r?te(r):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function te(e){var s=e.conversationType,o=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,p=e.disableNotification,f=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m="";return c in $?m=$[c]:c in Z?m=Z[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},m="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:a,content:r,messageType:m,messageUId:i,messageDirection:g,offLineMessage:u,sentTime:d,receivedStatus:l,receivedTime:C,objectName:c,messageId:I,sentStatus:R||n.SENT,disableNotification:p,canIncludeExpansion:h,expansion:f,readReceiptInfo:S,pushConfig:v}}function se(e,s,n,o,a){var r=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===t.MessageDirection.SEND){var g="".concat(s).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var u="".concat(s).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,C)}}function ne(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function oe(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var ae=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function re(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new ae(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var ce,ie,ge=re("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,s,n,o,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(ee(e))})):r.forEach((function(e){c.push(ee(e))})),ne(e.onSuccess,c)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),oe(e.onError,a))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(s,",conversationType:").concat(e)),r(o,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),n.onError(a),[2]):(n.onSuccess(r?ee(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(s,",conversationType:").concat(e)),this._context.removeConversation(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(s)),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),oe(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?ne(n.onSuccess,e.data?te(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),oe(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.sendMessage=function(e,s,o,r,c,i,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,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==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var l=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),C=function(e,t,s){var n,o=e||{},a=o.userIds,r=o.isVoipPush,c=o.disableNotification,i=o.isFilerWhiteBlacklist,g=o.expansion,u=o.canIncludeExpansion,d=o.pushConfig,l=o.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,n=h.type}return{mentionedType:n,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(u,c,o);i=i||"",g=g||"";var h=Object.assign(o,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:o.objectName,channelId:this.channelId,isStatusMessage:l})),p=this._context.getCurrentUserId(),f=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:s,channelId:this.channelId}),f),this._context.sendMessage(e,s,h,r.onBefore,f).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(d.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),f),c===t.ErrorCode.SUCCESS){d._isCPPMode||X.set(i);var C=te(i);se(C,p,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),ne(r.onSuccess,C)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),oe(r.onError,c,te({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:s,senderUserId:p,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:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=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",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.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 u=a({channelId:this.channelId},n);this._context.recallMessage(r,c,i,g,u).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||X.set(a),ne(s.onSuccess,te(a))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(c,",messageUId:").concat(i)),oe(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},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:s,channelId:r.channelId}),c),this._context.sendMessage(e,s,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(s,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(s,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var u={};u[g]=c[g].uIds,c[g].isResponse||i.push(u)}if(0===i.length)return void n.onSuccess(null);var d=setInterval((function(){1===i.length&&clearInterval(d);var a=i.splice(0,1)[0],g=new ge({receiptMessageDic:a});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,o._storage.set(r,c),ne(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(s,",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(s,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReader(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion,g=s.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 s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.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 s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,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(s,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,c,this.channelId,r,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),te(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),ne(a.onSuccess,u,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),ne(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),oe(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=X.get(e,s,a.channelId);c&&n.forEach((function(t){c.messageUId===t.messageUId&&X.remove(e,s,a.channelId)}))}ne(o.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),oe(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=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",s,t.AssertRules.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),oe(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,p=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var f=a.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:h,sentStatus:p,searchContent:a.searchContent,isUnread:f,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return te(e)}));ne(a.onSuccess,g,i)}else ne(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(s)),oe(a.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearMessages(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.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===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.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===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,s,n,o,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(te(e))})),ne(c.onSuccess,a,u)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(s)),oe(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(te(e))})),ne(r.onSuccess,a,u)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(te(e))})),ne(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return te(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(s)),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),oe(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),oe(s.onError,a))}))},e}(),de=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},le=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(s,"' 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 s=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=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 s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.8.5"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return r(this,void 0,void 0,(function(){return c(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.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,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},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,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){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,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.sendMessage=function(e,t,s,n,o,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,n,o,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,a,r)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,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:s,joinExist:!1}),a),this._context.joinChatroom(e,s,a).then((function(s){var r=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?ne(o.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(n,",chatRoomId:").concat(e)),oe(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=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)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)oe(n.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,s).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),oe(n.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},s);c.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),oe(n.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(s)),this._context.getChatroomEntry(e,s).then((function(s){var a=s.code,r=s.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),oe(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,s,n,a).then((function(s){var n=s.code,a=s.data;if(n===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return te(e)}));ne(o.onSuccess,g,i)}else ne(o.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),oe(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,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(s)),this._context.getFileUrl(e,s,n,a,r).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=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",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(de(e)).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(o)),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.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,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.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,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=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",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(s,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(de(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),n.onError(a))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,r=s.data,c=[];n===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?te(a):null,u=g||{},d=u.messageType,l=u.sentTime,C=u.receivedStatus;return{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:C}}(e))})),o.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,s).then((function(s){var a=s.code,r=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?n.onSuccess(r||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(s.targetId,",type").concat(s.type)),this._context.setConversationStatusInTag(e,de(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&oe(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?te(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return te(e)}));return void ne(s.onSuccess,u,g)}s.onSuccess&&ne(s.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ne(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),oe(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),oe(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(o)),oe(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),oe(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,a,r=this;for(var c in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[c],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[c].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[c].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[c].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[c].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[c].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[c].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[c].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[c].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[c].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[c].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[c].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[c])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[c])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){r._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,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,s,n,o,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,n,o){var a=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),oe(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,te(r)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),oe(s.onError,a))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):oe(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,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,s,n,o,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,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,s,n,o,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Ce=1;t.VersionManage.add("imlib-v2-adapter","5.8.5");var he,pe,fe=null,Ie={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||Q;he=new t.AppStorage(a,"API-V2"),ie=t.APIContext.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(fe=ie.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),fe.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Ce=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ce=new le(ie,{readReceiptTimeout:Ce},fe,he),t.logger.init(fe)},getInstance:function(){return ce},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ie.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){ie.assignWatcher({message:function(s,n,o){try{var a=te(s),r=ie.getCurrentUserId(),c=ie.getConnectedTime();se(a,r,c,Ce,he),a=function(e,t,s,n,o){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=o.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,o.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,r,c,Ce,he),t.usingCppEngine()||X.set(s),e.onReceived(a,void 0,o)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){ie.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:o,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ie.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ie.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ie.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ie.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==fe||fe.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ie.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ie.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ie.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ie.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ie.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,n){return r(this,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return o=null==fe?void 0:fe.createTraceId(),null==fe||fe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ie.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==fe||fe[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(ie.getConnectedTime()-1e3*Ce*60*60*24).getTime(),he.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=he.get(e).dealtime;t&&i-t>0&&he.remove(e)}else if(/RECEIVED$/.test(e)){var s=he.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&i-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?he.remove(e):he.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==fe||fe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==fe||fe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}var i}))}))},reconnect:function(e,s,n){var o=null==fe?void 0:fe.createTraceId();null==fe||fe.info(t.LogTagId.A_RECONNECT_T,null,o),ie.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==fe||fe[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==fe||fe.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=a(a({},$),Z);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=re(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,ie.registerMessageType(t,s.isPersited,s.isCounted,n)}},Re=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},Te=function(e,t){this.isCounted=e,this.isPersited=t},Se=re("TextMessage","RC:TxtMsg"),ve=re("LocationMessage","RC:LBSMsg"),me=re("TypingStatusMessage","RC:TypSts"),ye=re("ImageMessage","RC:ImgMsg"),Ee=re("RichContentMessage","RC:ImgTextMsg"),Me=re("VoiceMessage","RC:VcMsg"),Ae=re("HQVoiceMessage","RC:HQVCMsg"),Le=re("FileMessage","RC:FileMsg"),Ne=re("SightMessage","RC:SightMsg"),Oe=re("GIFMessage","RC:GIFMsg"),Ue=re("ReadReceiptMessage","RC:ReadNtf"),_e=re("ReadReceiptRequestMessage","RC:RRReqMsg"),Be=re("RCCombineMessage","RC:CombineMsg"),xe=function(e,t,s,n,o,a,r,c,i,g,u,d,l,C,h,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};exports.VoIPMediaType=void 0,(pe=exports.VoIPMediaType||(exports.VoIPMediaType={}))[pe.MEDIA_AUDIO=1]="MEDIA_AUDIO",pe[pe.MEDIA_VEDIO=2]="MEDIA_VEDIO",pe[pe.MEDIA_VIDEO=2]="MEDIA_VIDEO";var we,Pe=re("AcceptMessage","RC:VCAccept"),ke=re("RingingMessage","RC:VCRinging"),be=re("SummaryMessage","RC:VCSummary"),Ge=re("HungupMessage","RC:VCHangup"),De=re("InviteMessage","RC:VCInvite"),Ke=re("MediaModifyMessage","RC:VCModifyMedia"),Fe=re("MemberModifyMessage","RC:VCModifyMem"),je=re("lastMessageSendTime","RC:SRSMsg"),He=re("ReferenceMessage","RC:ReferenceMsg"),We=re("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ve=re("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(we||(we={}));var Je=we;window&&(window.RongIMClient=Ie),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"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,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Pe,exports.BaseMessage=ae,exports.ChannelClient=ue,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Le,exports.GIFMessage=Oe,exports.GetChatRoomType=o,exports.HQVoiceMessage=Ae,exports.HungupMessage=Ge,exports.IMClient=le,exports.ImageMessage=ye,exports.InviteMessage=De,exports.LocationMessage=ve,exports.MediaModifyMessage=Ke,exports.MemberModifyMessage=Fe,exports.MentionedInfo=Re,exports.MentionedType=Je,exports.Message=xe,exports.MessageTag=Te,exports.PublicServiceMultiRichContentMessage=Ve,exports.PublicServiceRichContentMessage=We,exports.RCCombineMessage=Be,exports.ReadReceiptMessage=Ue,exports.ReadReceiptRequestMessage=_e,exports.ReadReceiptResponseMessage=ge,exports.ReferenceMessage=He,exports.RichContentMessage=Ee,exports.RingingMessage=ke,exports.RongIMClient=Ie,exports.SentStatus=n,exports.SightMessage=Ne,exports.SummaryMessage=be,exports.SyncReadStatusMessage=je,exports.TextMessage=Se,exports.TypingStatusMessage=me,exports.VoiceMessage=Me;
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.8.4",
13
+ "version": "5.8.5",
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.8.4"
24
+ "@rongcloud/engine": "=5.8.5"
25
25
  }
26
26
  }