@rongcloud/imlib-next 5.4.3 → 5.4.4

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.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},n.apply(this,arguments)};function o(e,t,n,o){return new(n||(n=Promise))((function(s,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function i(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}c((o=o.apply(e,t||[])).next())}))}function s(e,t){var n,o,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(r){return function(i){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(s=2&r[0]?o.return:r[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,r[1])).done)return s;switch(o=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,o=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],o=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,i])}}}var r=new e.Logger("RCIM"),a=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},i=a();var c,u,d={tag:"browser",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(e){var t,r=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),c="[object XDomainRequest]"===Object.prototype.toString.call(r);if(r.open(n,i),s&&r.setRequestHeader)for(var u in s)r.setRequestHeader(u,s[u]);if(c){r.timeout=o,r.onload=function(){e({data:r.responseText,status:r.status||200})},r.onerror=function(){e({status:r.status||0})},r.ontimeout=function(){e({status:r.status||0})};var d="object"==typeof a?JSON.stringify(a):a;r.send(d)}else r.onreadystatechange=function(){4===r.readyState&&e({data:r.responseText,status:r.status})},r.onerror=function(){e({status:r.status||0})},setTimeout((function(){r.abort(),e({status:r.status||0})}),o),r.send(a)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||console.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:i,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},createDataChannel:function(t,n){return this.isSupportSocket()&&"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,s=n||o||e.NetworkType.UNKONWN;return new Promise((function(e){e(s)}))}},l=a(),g=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"wechat"},{traceId:s}),wx[t].apply(wx,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"wechat"},{traceId:s}),console.error(n)}}},p={setItem:g("setStorageSync"),getItem:g("getStorageSync"),removeItem:g("removeStorageSync"),clear:g("clearStorageSync")},f={tag:"wechat",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(t){wx.request({url:i,method:n,headers:s,timeout:o,data:a,success:function(e){t({data:e.data,status:e.statusCode})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:p,sessionStorage:p,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:l,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},m=a(),C=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"alipay"},{traceId:s}),my[t].apply(my,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"alipay"},{traceId:s}),console.error(n)}}},v={setItem:C("setStorageSync"),getItem:C("getStorageSync"),removeItem:C("removeStorageSync"),clear:C("clearStorageSync")},h={tag:"alipay",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r),c=t.dataType||"json";return new Promise((function(t){my.request({url:i,method:n,headers:s,timeout:o,data:a,dataType:c,success:function(e){t({data:e.data,status:e.status})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:v,sessionStorage:v,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:m,createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},I=a(),T=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"toutiao"},{traceId:s}),tt[t].apply(tt,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"toutiao"},{traceId:s}),console.error(n)}}},E={setItem:T("setStorageSync"),getItem:T("getStorageSync"),removeItem:T("removeStorageSync"),clear:T("clearStorageSync")},S={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:I,localStorage:E,sessionStorage:E,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},R=a(),y=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"baidu"},{traceId:s}),swan[t].apply(swan,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"baidu"},{traceId:s}),console.error(n)}}},N={setItem:y("setStorageSync"),getItem:y("getStorageSync"),removeItem:y("removeStorageSync"),clear:y("clearStorageSync")},A={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:R,localStorage:N,sessionStorage:N,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))]}))}))}},U=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"uniapp"},{traceId:s}),uni[t].apply(uni,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"uniapp"},{traceId:s}),console.error(n)}}},O={setItem:U("setStorageSync"),getItem:U("getStorageSync"),removeItem:U("removeStorageSync"),clear:U("clearStorageSync")},_={tag:"uniapp",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(t){uni.request({url:i,method:n,headers:s,timeout:o,data:a,success:function(e){t({data:e.data,status:e.statusCode})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:O,sessionStorage:O,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},x=function(e){return e&&e.canIUse&&e.getSystemInfo},M="undefined"!=typeof uni&&x(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return _;case"mp-baidu":return A;case"mp-toutiao":return S;case"mp-alipay":return h;case"mp-weixin":return f;default:return d}}():"undefined"!=typeof my&&x(my)?h:"undefined"!=typeof tt&&x(tt)?S:"undefined"!=typeof swan&&x(swan)?A:"undefined"!=typeof wx&&x(wx)?f:d;function w(t){var n=t.conversationType,o=t.channelId,s=t.messageType,r=t.content,a=t.senderUserId,i=t.targetId,c=t.sentTime,u=t.receivedTime,d=t.messageUId,l=t.messageDirection,g=t.isPersited,p=t.isCounted,f=t.isOffLineMessage,m=t.canIncludeExpansion,C=t.expansion,v=t.receivedStatus,h=t.disableNotification,I=t.isMentioned,T=t.isStatusMessage,E=t.readReceiptInfo,S=t.pushConfig,R=t.messageId,y=t.isInterrupt,N=t.isModifyMessage,A=t.channelType,U=t.sentStatus;v||(v=e.ReceivedStatus.UNREAD);var O={messageType:s,channelId:o||"",content:r,senderUserId:a,targetId:i,conversationType:n,sentTime:c,receivedTime:u,messageUId:d,messageDirection:l,isPersited:g,isCounted:p,isMentioned:I,disableNotification:h,isStatusMessage:T,canIncludeExpansion:m,expansion:C,receivedStatus:v,readReceiptInfo:E,pushConfig:S,messageId:R,isInterrupt:y,isModifyMessage:N,sentStatus:U};return n!==e.ConversationType.ULTRA_GROUP&&(O.isOffLineMessage=f),n===e.ConversationType.ULTRA_GROUP&&e.isNumber(A)&&(O.channelType=A),O}function L(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,s=e.unreadMessageCount,r=e.hasMentioned,a=e.mentionedInfo,i=e.lastUnreadTime,c=e.notificationStatus,u=e.notificationLevel,d=e.isTop,l=e.channelId,g=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&w(o),unreadMessageCount:s,hasMentioned:r,mentionedInfo:r?{type:null==a?void 0:a.type,userIdList:null==a?void 0:a.userIdList}:void 0,lastUnreadTime:i,notificationStatus:c,notificationLevel:u,isTop:d,channelId:l,unreadMentionedCount:g}}function b(e,t){r.warn("Method '".concat(e,"' is deprecated, please use '").concat(t,"' instead"))}exports.Events=void 0,(c=exports.Events||(exports.Events={})).CONNECTING="CONNECTING",c.CONNECTED="CONNECTED",c.DISCONNECT="DISCONNECT",c.SUSPEND="SUSPEND",c.MESSAGES="MESSAGES",c.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",c.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",c.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",c.CONVERSATION="CONVERSATION",c.CHATROOM="CHATROOM",c.EXPANSION="EXPANSION",c.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",c.TAG="TAG",c.CONVERSATION_TAG="CONVERSATION_TAG",c.TYPING_STATUS="TYPING_STATUS",c.MESSAGE_BLOCKED="MESSAGE_BLOCKED",c.ULTRA_GROUP_ENABLE="ULTRA_GROUP_ENABLE",c.OPERATE_STATUS="OPERATE_STATUS",c.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED="ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED",c.ULTRA_GROUP_MESSAGE_MODIFIED="ULTRA_GROUP_MESSAGE_MODIFIED",c.ULTRA_GROUP_MESSAGE_RECALLED="ULTRA_GROUP_MESSAGE_RECALLED",c.ULTRA_GROUP_CHANNEL_TYPE_CHANGE="ULTRA_GROUP_CHANNEL_TYPE_CHANGE",c.ULTRA_GROUP_CHANNEL_DELETE="ULTRA_GROUP_CHANNEL_DELETE",c.ULTRA_GROUP_CHANNEL_USER_KICKED="ULTRA_GROUP_CHANNEL_USER_KICKED",exports.SentStatus=void 0,(u=exports.SentStatus||(exports.SentStatus={}))[u.SENDING=10]="SENDING",u[u.FAILED=20]="FAILED",u[u.SENT=30]="SENT",u[u.RECEIVED=40]="RECEIVED",u[u.READ=50]="READ",u[u.DESTROYED=60]="DESTROYED";var P,G=function(n){function o(t){var s=n.call(this)||this;if(o.imClient)return r.error("Please do not repeatedly perform the init method"),o.imClient;s.initOptions=t,e.assert("options.navigators",t.navigators,(function(t){return e.isArray(t)&&(0===t.length||t.every(e.isHttpUrl))})),r.setLogLevel(t.logLevel),r.setLogStdout(t.logStdout);var a=null==t?void 0:t.connectType;return a?e.CONNECTION_TYPE.WEBSOCKET!==a&&e.CONNECTION_TYPE.COMET!==a&&(r.warn("RongIMLib connectionType must be ".concat(e.CONNECTION_TYPE.WEBSOCKET," or ").concat(e.CONNECTION_TYPE.COMET)),a=e.CONNECTION_TYPE.WEBSOCKET):a=e.CONNECTION_TYPE.WEBSOCKET,e.logger.info(e.LogTagId.A_INIT_O,{appkey:t.appkey,navigators:t.navigators||[],connectionType:a,logLevel:t.logLevel}),s._context=e.APIContext.init(M,{appkey:t.appkey,apiVersion:"5.4.3",navigators:t.navigators||[],miniCMPProxy:t.customCMP||[],connectionType:a,logLevel:t.logLevel,logStdout:t.logStdout,indexDBSwitch:t.indexDBSwitch,checkCA:t.checkCA}),s.watch(),o.imClient=s,s}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(o,n),Object.defineProperty(o.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),o.prototype.watch=function(){var t=this,n=e.logger.ID(),o={onConnecting:function(){t.emit(exports.Events.CONNECTING)},onConnected:function(){t.emit(exports.Events.CONNECTED)},onDisconnect:function(o){e.logger.info(e.LogTagId.A_CONNECT_S,{status:o},{traceId:n}),t.emit(exports.Events.DISCONNECT,o)},onSuspend:function(o){e.logger.info(e.LogTagId.A_CONNECT_S,{status:o},{traceId:n}),t.emit(exports.Events.SUSPEND,o)},batchMessage:function(e){t.emit(exports.Events.MESSAGES,{messages:e.map((function(e){return w(e)}))})},typingState:function(e){t.emit(exports.Events.TYPING_STATUS,{status:e})},readReceiptReceived:function(e,n,o){t.emit(exports.Events.READ_RECEIPT_RECEIVED,{conversation:e,messageUId:n,sentTime:o})},messageReceiptRequest:function(e,n,o){t.emit(exports.Events.MESSAGE_RECEIPT_REQUEST,{conversation:e,messageUId:n,senderUserId:o})},messageReceiptResponse:function(e,n,o){t.emit(exports.Events.MESSAGE_RECEIPT_RESPONSE,{conversation:e,receivedUserId:n,messageUIdList:o})},conversationState:function(n){var o=n.map((function(t){var n=t.conversationType;return n===e.ConversationType.ULTRA_GROUP?{conversation:{conversationType:n,latestMessage:t.latestMessage?w(t.latestMessage):null,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount,unreadMentionedCount:t.unreadMentionedCount,versionTime:t.versionTime,notificationStatus:t.notificationStatus,notificationLevel:t.notificationLevel,lastUnreadTime:t.lastUnreadTime,channelId:t.channelId}}:{conversation:{conversationType:n,latestMessage:t.latestMessage?w(t.latestMessage):null,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount,hasMentioned:t.hasMentioned,mentionedInfo:t.mentionedInfo,lastUnreadTime:t.lastUnreadTime,notificationStatus:t.notificationStatus,notificationLevel:t.notificationLevel,isTop:t.isTop,channelId:t.channelId,unreadMentionedCount:t.unreadMentionedCount},updatedItems:t.updatedItems}}));t.emit(exports.Events.CONVERSATION,{conversationList:o})},chatroomState:function(e){t.emit(exports.Events.CHATROOM,e)},expansion:function(e){t.emit(exports.Events.EXPANSION,e)},pullFinished:function(){t.emit(exports.Events.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){t.emit(exports.Events.TAG)},conversationTagChanged:function(){t.emit(exports.Events.CONVERSATION_TAG)},messageBlocked:function(e){t.emit(exports.Events.MESSAGE_BLOCKED,e)},ultraGroupEnable:function(e){t.emit(exports.Events.ULTRA_GROUP_ENABLE,e)},operateStatus:function(e){t.emit(exports.Events.OPERATE_STATUS,e)},ultraGroupMessageExpansionUpdated:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED,e)},ultraGroupMessageModified:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_MODIFIED,e)},ultraGroupMessageRecalled:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_RECALLED,e)},ultraGroupChannelChangeType:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_TYPE_CHANGE,e)},ultraGroupChannelUserKicked:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_USER_KICKED,e)},ultraGroupChannelDelete:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_DELETE,e)}};this.context.assignWatcher(o)},o}(e.EventEmitter),D={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL:{code:e.ErrorCode.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL,msg:"ultra group user not in private channel"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:e.ErrorCode.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},B={},k={};for(var H in D){var F=D[H],q=F.code;B[q]=H,k[q]=F}D.ROAMING_SERVICE_UNAVAILABLE.code;var V=function(t,n){void 0===n&&(n=""),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID);var o="conversationType:"+t.conversationType+",targetId:"+t.targetId;return r.debug("".concat(n," -> ").concat(o)),o},z=function(t,n,a){return void 0===a&&(a=""),o(void 0,void 0,void 0,(function(){var o,i;return s(this,(function(s){switch(s.label){case 0:return o=V(t,a),[4,n()];case 1:return(i=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("".concat(a," fail -> ").concat(i," : ").concat(B[i]," , ").concat(o)),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))};var K=function(t){e.assert("options.key",t.key,e.AssertRules.STRING,!0),e.assert("options.value",t.value,e.AssertRules.STRING,!0),e.assert("options.isAutoDelete",t.isAutoDelete,e.AssertRules.BOOLEAN),e.assert("options.isSendNotification",t.isSendNotification,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)},j=function(t){e.assert("options.key",t.key,e.AssertRules.STRING,!0),e.assert("options.isSendNotification",t.isSendNotification,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)};var J=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function W(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new J(e,o,t,n)}}var Y,X,Q=W("RC:ImgMsg"),Z=W("RC:HQVCMsg"),$=W("RC:SightMsg"),ee=W("RC:TxtMsg"),te=W("RC:CombineMsg"),ne=W("RC:FileMsg"),oe=W("RC:GIFMsg"),se=W("RC:VcMsg"),re=W("RC:LBSMsg"),ae=W("RC:ReferenceMsg"),ie=W("RC:ImgTextMsg"),ce={qiniu:function(t,n,o,s){var r=G.imClient.context.getInfoFromCache();if(1===(null==r?void 0:r.type)&&n.chunk_size&&s.size>n.chunk_size){var a=e.getUUID(),i=s.name.substr(s.name.lastIndexOf("."));a+=i,s.uniqueName=a,me(s,n,o)}else fe(t,n,o,s)},baidu:function(e,t,n,o){if(o.size>de)throw new Error("the file size is over 5GB!");var s=t||{};t=t||X;var r=new XMLHttpRequest,a=le();if(!s.uploadHost.bos&&!s.bosUploadPath)return;var i=a+ue[0][1]+s.bosUploadPath;ue.shift();var c=s.bosHeader||{},u={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:i,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState)if(JSON.parse(r.responseText||"{}").filename=t.uniqueValue,200===r.status){n.onCompleted(u,!0)}else ue.length?ce[ue[0][0]](e,t,n,o):n.onError("upload fail")},r.open(t.method,i,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(t,n,o,s){if(s.size>de)throw new Error("the file size is over 5GB!");var r=new FormData;r.set("file",t.get("file")),r.set("key",t.get("key")),r.set("token",t.get("token"));var a=ue[0][1];ue.shift(),t=t||Y,n=(n=n||{})||X;var i=new XMLHttpRequest,c=le()+n.ossBucketName+"."+a;i.upload&&n.support_options&&(i.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var t=JSON.parse(i.responseText||"{}");t.name=n.uniqueValue,t.filename=n.uploadFileName,t.uploadMethod=e.UploadMethod?e.UploadMethod.ALI:"",200===i.status?o.onCompleted(t):ue.length?ce[ue[0][0]](r,n,o,s):o.onError("upload fail")}},i.open(n.method,c,!0),console.log("ali:url",c);var u=n.aliHeader||{};t.set("OSSAccessKeyId",u.osskeyId),t.set("policy",u.ossPolicy),t.set("Signature",u.ossSign),t.set("success_action_status",200),t.delete("key"),t.append("key",n.uploadFileName),t.delete("file"),t.append("file",s),i.send(t)},s3:function(t,n,o,s){var r=new FormData,a=new XMLHttpRequest,i=le(),c=n.contentDisposition,u=ue[0][1],d=i+n.s3BucketName+"."+u;console.log("uploadS3:url",d),ue.shift(),a.upload&&n.support_options&&(a.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=JSON.parse(a.responseText||"{}");if(r.name=n.uniqueValue,r.filename=n.uploadFileName,r.uploadMethod=e.UploadMethod.AWS,200===a.status||204===a.status)o.onCompleted(r);else if(ue.length){var i=new FormData;i.set("file",t.get("file")),i.set("key",t.get("key")),i.set("token",t.get("token")),ce[ue[0][0]](i,n,o,s)}else o.onError("upload fail")}},a.open(n.method,d,!0);var l=n?n.s3Header:{},g=s&&s.type;c?r.set("Content-Disposition",c+";"):r.set("Content-Disposition","text/html"===g?"inline;":"attachment;");r.set("Content-Type",g),r.set("x-amz-credential",l.s3Credential),r.set("x-amz-algorithm",l.s3Algorithm),r.set("x-amz-date",l.s3Date),r.set("policy",l.s3Policy),r.set("x-amz-signature",l.s3Signature),r.set("key",n.uploadFileName),r.set("file",s),a.send(r)},stc:function(t,n,o,s){var r=new XMLHttpRequest,a=n.contentDisposition,i="https://"+ue[0][1]+"/"+n.stcBucketName+"/"+n.uploadFileName;ue.shift(),r.upload&&n.support_options&&(r.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=JSON.parse(r.responseText||"{}");if(a.name=n.uniqueValue,a.filename=n.uploadFileName,a.uploadMethod=e.UploadMethod?e.UploadMethod.STC:"",200===r.status||204===r.status)o.onCompleted(a);else if(ue.length){var i=new FormData;i.set("file",t.get("file")),i.set("key",t.get("key")),i.set("token",t.get("token")),ce[ue[0][0]](i,n,o,s)}else o.onError("upload fail")}},r.open("PUT",i,!0);var c=n?n.stcHeader:{};r.setRequestHeader("Content-Type",s.type),a?r.setRequestHeader("Content-Disposition",a+";"):r.setRequestHeader("Content-Disposition","text/html"===s.type?"inline;":"attachment;");r.setRequestHeader("Authorization",c.stcAuthorization),r.setRequestHeader("x-amz-content-sha256",c.stcContentSha256),r.setRequestHeader("x-amz-date",c.stcDate),r.send(s)}},ue=[],de=5368709120;function le(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}var ge,pe=(ge="RC-upload-",{get:function(e){e=ge+e;var t=localStorage.getItem(e);if(t)return null!==(t=JSON.parse(t||"{}"))&&t.type&&t.data?t.data:null},set:function(e,t){var n=localStorage;e=ge+e,t={data:t,type:typeof t,updateTime:Date.now()},n.setItem(e,JSON.stringify(t))},remove:function(e){e=ge+e,localStorage.removeItem(e)}});function fe(t,n,o,s){var r="https://"+n.uploadHost.qiniu,a=(/http/.test(ue[0][1])?"":le())+ue[0][1]||r;n.isChunk||ue.shift();var i=new XMLHttpRequest;i.upload&&n.support_options&&(i.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)}),i.onreadystatechange=function(){if(4===i.readyState){var r=JSON.parse(i.responseText||"{}");r.filename=n.uniqueValue,r.uploadMethod=e.UploadMethod?e.UploadMethod.QINIU:"",200===i.status||204===i.status?o.onCompleted(r):ue.length?ce[ue[0][0]](t,n,o,s):o.onError("upload fail")}},i.open(n.method,a,!0),o.onOpen(i),n.stream&&i.setRequestHeader("authorization","UpToken "+n.multi_parmas.token),function(e,t){for(var n in e)t(n,e[n])}(n.headers,(function(e,t){i.setRequestHeader(e,t)})),i.send(t)}function me(t,n,o,s){var r=0,a=s||e.getUUID(),i=pe.get(a);i&&(t.uniqueName=i.sessionId,r=i.offset);var c=Math.min(n.chunk_size,t.size-r),u=t.slice(r,r+c),d=t.uniqueName;n.multi_parmas.name=d,n.filesize=t.size;var l="bytes="+r+"-"+(r+c);n.headers={Range:l,"X-File-TransactionId":d,"X-File-Total-Size":t.size},n.isChunk=!0,u.name=t.name,u=function(e,t,n){var o=new FormData;for(var s in t.unique_key&&o.append(t.unique_key,n),o.append(t.file_data_name,e,e.name),t.multi_parmas){var r=t.multi_parmas[s];o.append(s,r)}return o}(u,n,t.uniqueName),fe(u,n,{onCompleted:function(e){r+=c;var s=t.uniqueName;pe.set(a,{offset:r,sessionId:s}),r<t.size?me(t,n,o,a):(r=0,pe.remove(a),o.onCompleted(e))},onError:function(e){console.error(e),o.onError(e)},onProgress:function(e,t){var s=e+r;o.onProgress(s,n.filesize)},onOpen:function(e){o.onOpen(e)}},t)}function Ce(t,n,o){var s,r,a=t&&t.type||"text/plain",i=a.indexOf("image")>-1?1:4,c=n.contentDisposition,u=Math.ceil(t.size/n.stc_chunk_size),d=n&&JSON.parse(n.ossConfig?n.ossConfig:"");Array.isArray(d)||(d=[]);var l=d.find((function(e){return Object.keys(e).includes("stc")})),g="uploads";G.imClient.context.getFileToken(i,s,"POST",g).then((function(e){s=e.fileName,r="https://"+l.stc+"/"+n.stcBucketName+"/"+s,console.log("uploadStcMultipart:url",r);var i=new XMLHttpRequest;i.open("POST",r+"?"+g,!0),c?i.setRequestHeader("Content-Disposition",c+";"):i.setRequestHeader("Content-Disposition","text/html"===t.type?"inline;":"attachment;"),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",a),i.send(),i.onreadystatechange=function(){if(4===i.readyState){var e=i.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",e),200===i.status||204===i.status?function(e){for(var t=[],n=1;n<=u;n++)t.push(C(e,n));m(e,t)}(Array.isArray(e)&&e[1]):o.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){o.onError("uploadStcMultipart:"+e)}));var p=[],f=new Map;function m(c,d){d&&Array.isArray(d)&&0!==d.length&&Promise.all(d).then((function(){var d="uploadId="+c;if(f.size===u)G.imClient.context.getFileToken(i,s,"POST",d).then((function(s){console.log("onSuccess",s),console.log("onSuccess:uploadId",c);var i=new XMLHttpRequest;i.open("POST",r+"?"+d,!0),i.setRequestHeader("Authorization",s&&s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s&&s.stcContentSha256),i.setRequestHeader("x-amz-date",s&&s.stcDate),i.setRequestHeader("Content-Type",a);var u="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",l=Array.from(f.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",l),l.forEach((function(e){u+="<Part><ETag>".concat(f.get(e),"</ETag><PartNumber>").concat(e,"</PartNumber></Part>")})),u+="</CompleteMultipartUpload>",i.send(u),console.log("xml",u),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var s={name:t.name,filename:n.uploadFileName,uploadMethod:e.UploadMethod.STC};o.onCompleted(s)}else o.onError("uploadStcMultipart:upload does not end")}}),(function(e){o.onError("uploadStcMultipart:"+e)}));else{for(var l=[],g=0,v=p;g<v.length;g++){var h=v[g];l.push(C(c,h))}m(c,l)}}),(function(e){console.error(e),o.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");for(var t=[],n=0,s=p;n<s.length;n++){var r=s[n];t.push(C(c,r))}m(c,t)}))}function C(e,o){return new Promise((function(c,u){var d="partNumber="+o+"&uploadId="+e;G.imClient.context.getFileToken(i,s,"PUT",d).then((function(e){console.log("signature "+o+" onSuccess",e);var s=t&&t.slice((o-1)*n.stc_chunk_size,o*n.stc_chunk_size);console.log("fileChunk:size",s.size);var i=new XMLHttpRequest;i.open("PUT",r+"?"+d,!0),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",a),i.send(s),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var e=i.getResponseHeader("etag");console.log("etag:"+o,e),f.set(o,e),c(e)}else p.includes(o)||p.push(o),u(o)}}),(function(e){console.log("getETags:签名验证失败"),p.includes(o)||p.push(o),u(o)}))}))}}var ve={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),s=he()+o;n.append(t.unique_key,s),t.uniqueValue=s}return n.append(t.file_data_name,e),Ie(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),s=he()+o;n[t.unique_key]=s,t.uniqueValue=s}return n[t.file_data_name]=e,Ie(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function he(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function Ie(e,t){for(var n in e)t(n,e[n])}var Te,Ee=0,Se=function(){function e(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:ve.form,genUId:he};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e)}return e.prototype.setOptions=function(e){var t=this;Ie(e,(function(e,n){t.options[e]=n}))},e.prototype.upload=function(e,t){if(e){var n=this;!function(e,t,n){var o,s;Y=e,X=t,ue=[];var r,a=G.imClient.context.getInfoFromCache();if(1===(null==a?void 0:a.type)&&(null===(o=G.imClient.initOptions)||void 0===o?void 0:o.uploadDomain))ue=[["qiniu",null===(s=G.imClient.initOptions)||void 0===s?void 0:s.uploadDomain]];else if(t.ossConfig){var i,c,u=JSON.parse(t.ossConfig),d="",l=[];u.forEach((function(e){var t=Number(e.p)-1;for(var n in e)"aliyun"===n&&(d=e[n]),"s3"===n&&(i=e[n]),"stc"===n&&(c=e[n]),"p"!==n&&(l[t]=[n,e[n]])})),l.forEach((function(e){e&&ue.push(e)})),u.length!==ue.length&&(ue=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",d],["s3",i],["stc",c]])}else ue=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];if(t.ossConfig){var g=t&&JSON.parse(t.ossConfig);Array.isArray(g)||(g=[]),r=g.find((function(e){return Object.keys(e).includes("stc")}))}if(r&&1===parseInt(r.p)&&e.size>=4194304)Ce(e,t,n);else{var p=t.data(e,t);ce[ue[0][0]](p,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){(Te=e,o)?Te=Ee+e/n*(n-Ee):Ee=Te;t.onProgress(Te,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},e.prototype.cancel=function(){this.xhr&&this.xhr.abort()},e}();var Re,ye,Ne={init:function(e){return new Se(e)},dataType:ve,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),s=new FileReader;s.readAsDataURL(e),s.onload=function(e){var s=e.target.result,r=new Image;r.src=s;var a=r.width,i=r.height,c=function(e,t){var n=1,o=e.width,s=t.maxWidth||0;s>0&&o>s&&(n=s/o);var r=e.height,a=t.maxHeight||0;if(a>0&&r>a){var i=a/r;n=Math.min(n,i)}var c=t.maxSize||0,u=Math.ceil(e.size/1e3);if(u>c){var d=c/u;n=Math.min(n,d)}return n}({width:a,height:i,size:e.total},t),u=s;c<1&&(u=function(e,t,n){return o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n),o.toDataURL("image/jpg")}(r,a*c,i*c)),n(u)}}},Ae=function(e,t,n){var o=document.createElement("canvas"),s=o.getContext("2d"),r=new Image,a="string"==typeof e;r.onload=function(a){var i=function(e,t,n){var o,s,r,a=e<t,i=0,c=0;return(a?t/e:e/t)>n.scale?(a?(s=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,i=((s=e/(o=t/100))-n.maxWidth)/2),{w:s,h:r,x:-i,y:-c}):(a?(o=t/n.maxHeight,r=n.maxHeight,s=e/o):(o=e/n.maxWidth,s=n.maxWidth,r=t/o),{w:s,h:r,x:-i,y:-c})}(r.width,r.height,t);o.width=i.w>t.maxWidth?t.maxWidth:i.w,o.height=i.h>t.maxHeight?t.maxHeight:i.h,s.drawImage(r,i.x,i.y,i.w,i.h);var c=o.toDataURL("string"==typeof e?"image/jpg":e.type,t.quality);c=c.replace(/data:image\/[^;]+;base64,/,""),n(c)},r.src=a?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},Ue=function(e,t){var n=e.file,o=e.compress;Ae(n,o,t)},Oe=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n);var s=Ne.init(e);t(s)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Ne.init(e);t(n)}},_e=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||Ue;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},xe=function(){function e(e){this.instance=e}return e.prototype.upload=function(e,t){_e({file:e},this.instance,t)},e.prototype.cancel=function(){this.instance.cancel()},e}(),Me=function(){function e(e,t){this.instance=e,this.cfg=t}return e.prototype.upload=function(e,t){var n={file:e,compress:this.cfg};_e(n,this.instance,t)},e.prototype.cancel=function(){this.instance.cancel()},e}(),we=function(e,t){Oe(e,(function(n){var o,s,r,a,i={maxHeight:(null===(o=e.thumbnailConfig)||void 0===o?void 0:o.maxHeight)||160,maxWidth:(null===(s=e.thumbnailConfig)||void 0===s?void 0:s.maxWidth)||160,quality:(null===(r=e.thumbnailConfig)||void 0===r?void 0:r.quality)||.5,scale:(null===(a=e.thumbnailConfig)||void 0===a?void 0:a.scale)||2.4},c=new Me(n,i);t(c)}))},Le=function(e,t){Oe(e,(function(e){var n=new xe(e);t(n)}))},be=we;Ne.dataType;function Pe(t,r,a,i){var c,u=this;void 0===r&&(r=e.FileType.FILE),c=r===e.FileType.IMAGE?e.FileType.IMAGE:e.FileType.FILE;var d=G.imClient.context.getInfoFromCache();if(!ye&&(ye="upload.qiniup.com",d&&d.ossConfig))try{var l=JSON.parse(d.ossConfig).find((function(e){return void 0!==e.qiniu}));l&&(ye=l.qiniu)}catch(e){}var g=n({domain:ye,getToken:function(e){G.imClient.context.getFileToken(c).then((function(t){e(t.token,t)})).catch((function(e){a.onFail(e)}))}},i);(c===e.FileType.IMAGE?be:Le)(g,(function(i){i.upload(t,{onProgress:function(e,t){var n,o=Math.floor(e/t*100);null===(n=a.onProgress)||void 0===n||n.call(a,o)},onCompleted:function(i){return o(u,void 0,void 0,(function(){return s(this,(function(u){return 1===(null==d?void 0:d.type)?function(t,o,s,r,a){var i,c={type:s.type,name:r.rc_url.file_name,downloadUrl:(null===(i=G.imClient.initOptions)||void 0===i?void 0:i.uploadDomain)+r.rc_url.path};if(t===e.FileType.AUDIO)return void Ge(s).then((function(e){a.onSuccess(n(n({},c),e))}));t===e.FileType.IMAGE&&(c.thumbnail=r.thumbnail),a.onSuccess(c)}(r,0,t,i,a):function(t,r,a,i,c){var u=this;Be(r,i.filename,i.name,i,i.uploadMethod).then((function(d){return o(u,void 0,void 0,(function(){var o;return s(this,(function(s){return 0!==d.code?(c.onFail(d),[2]):((o=d.data).type=a.type,o.name=i.name||i.filename,t===e.FileType.AUDIO?(Ge(a).then((function(e){c.onSuccess(n(n({},o),e))})),[2]):(r===e.FileType.IMAGE&&(o.thumbnail=i.thumbnail),c.onSuccess(o),[2]))}))}))})).catch((function(e){c.onFail(e)}))}(r,c,t,i,a),[2]}))}))},onError:function(e){a.onFail(e)}})}))}function Ge(e){return new Promise((function(t){if("function"==typeof e.arrayBuffer)return e.arrayBuffer().then(De).then((function(e){t(e)}));var n=new FileReader;n.onload=function(){n.result?De(n.result).then((function(e){t(e)}),(function(){t({})})):t({})},n.onerror=function(){t({duration:0})},n.readAsArrayBuffer(e)}))}function De(e){return Re=Re||new AudioContext,new Promise((function(t,n){Re.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Be(t,n,o,s,r){return e.assert("fileType",t,e.isValidFileType,!0),e.assert("filename",n,e.AssertRules.STRING),e.assert("saveName",o,e.AssertRules.STRING),e.assert("serverType",r,e.AssertRules.NUMBER),new Promise((function(a){G.imClient.context.getFileUrl(t,n,o,s,r).then((function(t){a({code:e.ErrorCode.SUCCESS,data:t})})).catch((function(e){a({code:e})}))}))}function ke(t,a,i){return o(this,void 0,void 0,(function(){var o,c,u,d,l,g,p,f,m,C,v,h;return s(this,(function(s){switch(s.label){case 0:return i=i||{},a instanceof J==!1?(r.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,D.ILLGAL_PARAMS]):(e.assert("conversation",t,e.AssertRules.OBJECT,!0),o=t.conversationType,c=t.targetId,u=t.channelId,e.assert("conversation.targetId",c,e.AssertRules.STRING,!0),e.assert("conversation.conversationType",o,e.AssertRules.NUMBER),e.assert("conversation.channelId",u,e.AssertRules.CHANNEL_ID),e.assert("options.isStatusMessage",null==i?void 0:i.isStatusMessage,e.AssertRules.BOOLEAN),e.assert("options.disableNotification",null==i?void 0:i.disableNotification,e.AssertRules.BOOLEAN),e.assert("options.pushContent",null==i?void 0:i.pushContent,e.AssertRules.STRING),e.assert("options.pushData",null==i?void 0:i.pushData,e.AssertRules.STRING),e.assert("options.isMentioned",null==i?void 0:i.isMentioned,e.AssertRules.BOOLEAN),e.assert("options.mentionedType",null==i?void 0:i.mentionedType,e.AssertRules.NUMBER),e.assert("options.mentionedUserIdList",null==i?void 0:i.mentionedUserIdList,e.AssertRules.ARRAY),e.assert("options.directionalUserIdList",null==i?void 0:i.directionalUserIdList,e.AssertRules.ARRAY),e.assert("options.isVoipPush",null==i?void 0:i.isVoipPush,e.AssertRules.BOOLEAN),e.assert("options.canIncludeExpansion",null==i?void 0:i.canIncludeExpansion,e.AssertRules.BOOLEAN),e.assert("options.expansion",null==i?void 0:i.expansion,e.AssertRules.OBJECT),e.assert("options.pushConfig",null==i?void 0:i.pushConfig,e.AssertRules.OBJECT),d="conversationType:"+o+",targetId:"+c,r.debug("send message ->"+d),l=function(e,t,o){var s=e.isStatusMessage,r=e.disableNotification,a=e.pushContent,i=e.pushData,c=e.isMentioned,u=e.mentionedType,d=e.mentionedUserIdList,l=e.directionalUserIdList,g=e.isVoipPush,p=e.canIncludeExpansion,f=e.expansion,m=e.isFilerWhiteBlacklist,C=e.pushConfig,v=o.channelId;return n({isStatusMessage:s,disableNotification:r,pushContent:a,pushData:i,isMentioned:c,mentionedType:u,mentionedUserIdList:d,directionalUserIdList:l,isVoipPush:g,canIncludeExpansion:p,expansion:f,isFilerWhiteBlacklist:m,pushConfig:C,channelId:v||""},t)}(i,a,t),g={isMentioned:!!i.isMentioned,content:a.content,messageType:a.messageType,isPersited:a.isPersited||!1,isCounted:a.isCounted||!1,disableNotification:!!(null==i?void 0:i.disableNotification),canIncludeExpansion:!!(null==i?void 0:i.canIncludeExpansion),expansion:(null==i?void 0:i.expansion)||null,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,senderUserId:G.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:e.MessageDirection.SEND,receivedTime:0,isStatusMessage:i.isStatusMessage||!1,receivedStatus:e.ReceivedStatus.UNREAD,isOffLineMessage:!1,pushConfig:null==i?void 0:i.pushConfig},o!==e.ConversationType.ULTRA_GROUP&&(g.isOffLineMessage=!1),p=function(t){g.messageId=t;try{(null==i?void 0:i.onSendBefore)&&i.onSendBefore(w(g))}catch(t){e.logger.error('Callback method "onSendBefore" execution error',t)}},f=e.logger.ID(),e.logger.info(e.LogTagId.A_SEND_MSG_T,{messageType:a.messageType,conversationType:o,targetId:c,channelId:u},{traceId:f}),[4,G.imClient.context.sendMessage(o,c,l,p,f)]);case 1:return m=s.sent(),C=m.code,v=m.data,(C===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_SEND_MSG_R,{code:C,messageUId:v?v.messageUId:"",messageId:v?v.messageId:""},{traceId:f}),C===e.ErrorCode.SUCCESS?(h=w(v),[2,{code:C,data:h}]):(r.warn("send message fail ->"+C+":"+B[C]+","+d),g.sentTime=(null==v?void 0:v.sentTime)||0,[2,{code:C,msg:B[C],data:w(g)}])}}))}))}function He(t,n){return function(o,s,r,a){e.assert("sendOptions.contentDisposition",null==a?void 0:a.contentDisposition,(function(e){return["inline","attachment"].includes(e)}));var i={contentDisposition:null==a?void 0:a.contentDisposition};if(a&&"thumbnailConfig"in a){var c=null==a?void 0:a.thumbnailConfig;e.assert("sendOptions.maxHeight",null==c?void 0:c.maxHeight,e.AssertRules.NUMBER),e.assert("sendOptions.maxWidth",null==c?void 0:c.maxWidth,e.AssertRules.NUMBER),e.assert("sendOptions.quality",null==c?void 0:c.quality,e.AssertRules.NUMBER),e.assert("sendOptions.scale",null==c?void 0:c.scale,e.AssertRules.NUMBER),i.thumbnailConfig=c}return new Promise((function(c){var u=e.logger.ID();e.logger.info(e.LogTagId.L_MEDIA_UPLOAD_T,{filesize:s.file.size,type:t},{traceId:u}),Pe(s.file,t,{onProgress:null==r?void 0:r.onProgress,onSuccess:function(t){var i,d=(null===(i=null==r?void 0:r.onComplete)||void 0===i?void 0:i.call(r,{url:t.downloadUrl}))||n(t,s);t&&t.downloadUrl&&e.logger.info(e.LogTagId.L_MEDIA_UPLOAD_R,{downurl:t.downloadUrl,code:e.ErrorCode.SUCCESS},{traceId:u}),ke(o,d,a).then(c)},onFail:function(t){e.logger.warn(e.LogTagId.L_MEDIA_UPLOAD_R,{code:e.ErrorCode.UPLOAD_FILE_FAILED},{traceId:u}),c({code:e.ErrorCode.UPLOAD_FILE_FAILED,msg:t||e.ErrorCode[e.ErrorCode.UPLOAD_FILE_FAILED]})}},i)}))}}var Fe=He(e.FileType.FILE,(function(e,t){return new ne({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),qe=He(e.FileType.IMAGE,(function(e,t){return new Q({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Ve=He(e.FileType.AUDIO,(function(e,t){return new Z({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),ze=He(e.FileType.SIGHT,(function(e,t){return new $({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));He(e.FileType.COMBINE_HTML,(function(e,t){return new te({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Ke=Object.freeze({__proto__:null,getAllConversationList:function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("channelId",t,e.AssertRules.ONLY_STRING),r.info("getAllConversationList -> channelId: ".concat(t)),e.isUndefined(t)?[4,G.imClient.context.getConversationListWithAllChannel()]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),[3,4];case 2:return[4,G.imClient.context.getConversationList(void 0,void 0,void 0,void 0,t)];case 3:n=s.sent(),s.label=4;case 4:return o=n.code,a=n.data,o===e.ErrorCode.SUCCESS&&a?(i=a.map((function(e){return L(e)})),[2,{code:o,data:i}]):(r.warn("getAllConversationList fail -> code: ".concat(o," channelId: ").concat(t)),[2,{code:o,msg:B[o]}])}}))}))},getConversationList:function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,u,d,l;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("startTime",t,e.AssertRules.NUMBER,!0),e.assert("count",n,e.AssertRules.NUMBER,!0),e.assert("channelId",a,e.AssertRules.ONLY_STRING),o="startTime: ".concat(t,", count: ").concat(n,", channelId: ").concat(a),r.info("getConversationList -> ".concat(o)),e.isUndefined(a)?[4,G.imClient.context.getConversationListWithAllChannelByPage(t,n)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return i=s.sent(),[3,4];case 2:return c=[1,2,3,5,6,7,8],[4,G.imClient.context.getConversationsByPage(c,t,n,a)];case 3:i=s.sent(),s.label=4;case 4:return u=i.code,d=i.data,u===e.ErrorCode.SUCCESS&&d?(l=d.map((function(e){return L(e)})),[2,{code:u,data:l}]):(r.warn("getConversationList fail -> code: ".concat(u," ").concat(o)),[2,{code:u,msg:B[u]}])}}))}))},searchConversationByContent:function t(n,a,i){return o(this,void 0,void 0,(function(){var o,c,u,d,l;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("messageTypes",a,e.AssertRules.ARRAY,!0),e.assert("channelId",i,e.AssertRules.ONLY_STRING),a.forEach((function(t){e.assert("messageType",t,e.AssertRules.STRING,!0)})),o="keyword: ".concat(n,", messageTypes: ").concat(JSON.stringify(a),", channelId: ").concat(i),r.info("searchConversationByContent -> ".concat(t)),e.isUndefined(i)?[4,G.imClient.context.searchConversationByContentWithAllChannel(n,a)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return c=s.sent(),[3,4];case 2:return[4,G.imClient.context.searchConversationByContent(n,a,i)];case 3:c=s.sent(),s.label=4;case 4:return u=c.code,d=c.data,u===e.ErrorCode.SUCCESS&&d?(l=d.map((function(e){return L(e)})),[2,{code:u,data:l}]):(r.warn("searchConversationByContent fail -> code: ".concat(u," ").concat(o)),[2,{code:u,msg:B[u]}])}}))}))},searchMessages:function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,u,d,l,g,p,f,m,C;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("startTime",a,e.AssertRules.NUMBER,!0),e.assert("count",i,e.AssertRules.NUMBER,!0),o="conversation: ".concat(JSON.stringify(t),", keyword: ").concat(n,", timestamp: ").concat(a,", count: ").concat(i),r.info("searchMessages -> ".concat(o)),c=t.targetId,u=t.conversationType,d=t.channelId,e.isUndefined(d)?[4,G.imClient.context.searchMessageByContentWithAllChannel(u,c,n,a,i)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return l=s.sent(),[3,4];case 2:return 0,[4,G.imClient.context.searchMessageByContent(u,c,n,a,i,0,d)];case 3:l=s.sent(),s.label=4;case 4:return g=l.code,p=l.data,g===e.ErrorCode.SUCCESS&&p?(f=p.messages,m=p.count,C=f.map((function(e){return w(e)})),[2,{code:g,data:{messages:C,count:m}}]):(r.warn("searchMessages fail -> code: ".concat(g," ").concat(o)),[2,{code:g,msg:B[g]}])}}))}))},searchMessageInTimeRange:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g,p,f,m;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("option",n,e.AssertRules.OBJECT,!0),e.assert("option.keyword",n.keyword,e.AssertRules.STRING,!0),e.assert("option.startTime",n.startTime,e.AssertRules.NUMBER,!0),e.assert("option.endTime",n.endTime,e.AssertRules.NUMBER,!0),e.assert("option.offset",n.offset,e.AssertRules.NUMBER),e.assert("option.limit",n.limit,e.AssertRules.NUMBER),o="conversation: ".concat(JSON.stringify(t),", option: ").concat(JSON.stringify(n)),r.info("searchMessageInTimeRange -> ".concat(o)),a=t.conversationType,i=t.targetId,c=n.keyword,u=n.startTime,d=n.endTime,l=n.offset,g=n.limit,l=l||0,g=g||5,[4,G.imClient.context.searchMessageByContentInTimeRangeWithAllChannel(a,i,c,u,d,l,g)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return p=s.sent(),f=p.code,m=p.data,f===e.ErrorCode.SUCCESS&&m?[2,{code:f,data:{messages:m.messages.map((function(e){return w(e)}))}}]:(r.warn("searchMessageInTimeRange fail -> code: ".concat(f,", ").concat(o)),[2,{code:f}])}}))}))},getHistoryMessagesByMessageTypes:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g,p,f,m,C,v,h,I;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("option",n,e.AssertRules.OBJECT,!0),o=n.count,a=n.timestamp,i=n.order,c=n.messageTypes,e.assert("option.count",o,e.AssertRules.NUMBER),e.assert("option.timestamp",a,e.AssertRules.NUMBER),e.assert("option.order",i,(function(e){return[0,1].includes(e)})),e.assert("option.messageTypes",c,e.AssertRules.ARRAY,!0),c.forEach((function(t){e.assert("option.messageType",t,e.AssertRules.STRING,!0)})),u="conversation: ".concat(JSON.stringify(t),", option: ").concat(JSON.stringify(n)),r.info("getHistoryMessagesByMessageTypes -> ".concat(u)),d=t.conversationType,l=t.targetId,g=t.channelId,o||(o=20),a||(a=0),i||(i=0),g||(g=""),[4,G.imClient.context.getHistoryMessagesByObjectNames(d,l,a,o,c,i,g)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return p=s.sent(),f=p.code,m=p.data,f===e.ErrorCode.SUCCESS?(v=(C=m).list,h=C.hasMore,I=v.map((function(e){return w(e)})),[2,{code:f,data:{messages:I,hasMore:h}}]):(r.warn("getHistoryMessagesByMessageTypes fail -> code: ".concat(f," ").concat(u)),[2,{code:f,msg:B[f]}])}}))}))},setMessageStatusToRead:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),o="conversation: ".concat(JSON.stringify(t),", timestamp: ").concat(n),r.info("updateSentMsgReceiptStatus -> ".concat(o)),a=t.conversationType,i=t.targetId,c=t.channelId,[4,G.imClient.context.setMessageStatusToRead(a,i,n,c)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,s.sent()]}}))}))},setMessageReceivedStatus:function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("receivedStatus",n,(function(t){return!e.isUndefined(e.ReceivedStatus[t])}),!0),r.info("setMessageReceivedStatus -> messageId: ".concat(t,", receivedStatus: ").concat(n)),[4,G.imClient.context.setMessageReceivedStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},setMessageSentStatus:function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("sentStatus",n,(function(t){return!e.isUndefined(exports.SentStatus[t])}),!0),r.info("setMessageSentStatus ->messageId: ".concat(t,", sentStatus: ").concat(n)),[4,G.imClient.context.setMessageSentStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},setMessageContent:function(t,n,a){return void 0===a&&(a=""),o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("content",n,e.AssertRules.OBJECT,!0),e.assert("messageType",a,e.AssertRules.ONLY_STRING,!0),r.info("setMessageSentStatus ->messageId: ".concat(t,", messageType: ").concat(a)),[4,G.imClient.context.setMessageContent(t,n,a)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},deleteMessages:function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.usingCppEngine()?(e.assert("messageIds",t,e.AssertRules.ARRAY,!0),t.forEach((function(t){e.assert("messageId",t,e.AssertRules.NUMBER,!0)})),r.info("deleteMessages ->messageIds: ".concat(JSON.stringify(t))),[4,G.imClient.context.deleteMessages(t)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:n.sent()}]}}))}))},clearMessages:function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(r.info("clearMessages ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearMessages(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(n=o.sent())===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("clearMessages ->code:"+n+",targetId:"+t.targetId),[2,{code:n,msg:B[n]}])}}))}))},deleteMessagesByTimestamp:function(t,n,a){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),e.assert("cleanSpace",a,e.AssertRules.BOOLEAN),[4,G.imClient.context.deleteMessagesByTimestamp(t.conversationType,t.targetId,n,a,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("deleteMessagesByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},insertMessage:function(t,n,a){return void 0===a&&(a={}),o(this,void 0,void 0,(function(){var o,i,c,u,d,l,g,p,f,m,C,v,h,I,T,E;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(o=n.senderUserId,i=n.messageType,c=n.content,u=n.messageDirection,d=n.messageUId,l=n.canIncludeExpansion,g=n.expansion,p=n.disableNotification,f=n.sentTime,m=n.sentStatus,r.info("insertMessage ->targetId:"+t.targetId+",conversationType:"+t.conversationType),C=a.isUnread,v=a.searchContent,h={senderUserId:o,messageType:i,content:c,messageDirection:u,sentTime:f,sentStatus:m,searchContent:v,isUnread:C,messageUId:d,disableNotification:p,canIncludeExpansion:l,expansionMsg:JSON.stringify(g),channelId:t.channelId||""},[4,G.imClient.context.insertMessage(t.conversationType,t.targetId,h)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return I=s.sent(),T=I.code,E=I.data,T===e.ErrorCode.SUCCESS?[2,{code:T,data:w(E)}]:(r.warn("insertMessage ->code:"+T+",targetId:"+t.targetId),[2,{code:T,msg:B[T]}])}}))}))},clearLocalData:function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(r.info("clearData -> "),[4,G.imClient.context.clearData()]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return t=s.sent(),n=t.code,o=t.data,[2,{code:n,data:o}]}}))}))}}),je=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n};e.VersionManage.add("imlib-next","5.4.3"),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return e.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return e.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return e.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return e.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return e.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return e.FileType}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return e.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return e.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return e.LogTagId}}),Object.defineProperty(exports,"MentionedType",{enumerable:!0,get:function(){return e.MentionedType}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return e.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return e.MessageDirection}}),Object.defineProperty(exports,"NotificationLevel",{enumerable:!0,get:function(){return e.NotificationLevel}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return e.NotificationStatus}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return e.ReceivedStatus}}),Object.defineProperty(exports,"UltraGroupChannelType",{enumerable:!0,get:function(){return e.UltraGroupChannelType}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return e.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return e.logger}}),exports.BaseMessage=J,exports.CombineMessage=te,exports.ConnectType={COMET:"comet",WEBSOCKET:"websocket"},exports.FileMessage=ne,exports.GIFMessage=oe,exports.HQVoiceMessage=Z,exports.ImageMessage=Q,exports.LocationMessage=re,exports.MentionedInfoBody=je,exports.MessageType={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"},exports.ReferenceMessage=ae,exports.RichContentMessage=ie,exports.SightMessage=$,exports.TextMessage=ee,exports.VoiceMessage=se,exports.__addSDKVersion=function(t,n){e.VersionManage.add(t,n)},exports.addConversationsToTag=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("addTagForConversations ->tagId:"+t),[4,G.imClient.context.addTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("addTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.addEventListener=function(e,t,n){P.on(e,t,n)},exports.addTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tag.tagId",t.tagId,e.AssertRules.STRING,!0),e.assert("tag.tagId",t.tagId,(function(e){return e.length<=10})),e.assert("tag.tagName",t.tagName,(function(e){return e.length<=15})),e.assert("tag.tagName",t.tagName,e.AssertRules.STRING,!0),r.info("createTag ->tagId:"+t.tagId+",tagName:"+t.tagName),[4,G.imClient.context.createTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("createTag ->code:"+n+",tagId:"+t.tagId),[2,{code:n,msg:B[n]}])}}))}))},exports.addToBlacklist=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("addToBlacklist -> userId: ".concat(t)),[4,G.imClient.context.addToBlacklist(t)];case 1:return[2,{code:n.sent()}]}}))}))},exports.bindRTCRoomForChatroom=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return[4,G.imClient.context.bindRTCRoomForChatroom(e)];case 1:return[2,{code:t=n.sent(),msg:B[t]}]}}))}))},exports.clearAllMessagesUnreadStatus=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,G.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))},exports.clearEventListeners=function(){P.clear()},exports.clearHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",n,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("clear message ->"+o),[4,G.imClient.context.deleteRemoteMessageByTimestamp(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("clear message ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:e.ErrorCode.SUCCESS}]}}))}))},exports.clearMessages=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return b("RongIMLib.clearMessages","RongIMLib.ElectronExtension.clearMessages"),e.usingCppEngine()?(r.info("clearMessages ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearMessages(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(n=o.sent())===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("clearMessages ->code:"+n+",targetId:"+t.targetId),[2,{code:n,msg:B[n]}])}}))}))},exports.clearMessagesUnreadStatus=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.clearUnreadCount(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("clear unreadMsgNum ->"+o),n!==e.ErrorCode.SUCCESS?(r.warn("clear unreadMsgNum fail ->"+n+":"+B[n]+","+o),[2,{code:n,msg:B[n]}]):[2,{code:n}]}}))}))},exports.clearTextMessageDraft=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),n="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("delete draft ->"+n),[4,G.imClient.context.clearConversationMessageDraft(t.conversationType,t.targetId,t.channelId)];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("delete draft fail ->"+o+":"+B[o]+","+n),[2,{code:o,msg:B[o]}])}}))}))},exports.clearUnreadCountByTimestamp=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(r.info("clearUnreadCountByTimestamp ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearUnreadCountByTimestamp(t.conversationType,t.targetId,n,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("clearUnreadCountByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.connect=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("token",t,e.AssertRules.STRING,!0),r.warn("RongIMLib Version: ".concat("5.4.3",", Commit: ").concat("b3936f05590d2beb491dee0dbb7071eeb648e941")),o=e.logger.ID(),e.logger.info(e.LogTagId.A_CONNECT_T,{token:t,reconnectKickEnable:n},{traceId:o}),[4,P.context.connect(t,!1,n,o)];case 1:return a=s.sent(),(a.code===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_CONNECT_R,{code:a.code,userId:a.userId},{traceId:o}),a.code===e.ErrorCode.SUCCESS?[2,{code:a.code,data:{userId:a.userId}}]:[2,{code:a.code,msg:B[a.code]}]}}))}))},exports.deleteLocalMessagesByTimestamp=function(t,n,a){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.deleteLocalMessagesByTimestamp","RongIMLib.ElectronExtension.deleteMessagesByTimestamp"),e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),e.assert("cleanSpace",a,e.AssertRules.BOOLEAN),[4,G.imClient.context.deleteMessagesByTimestamp(t.conversationType,t.targetId,n,a,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),e.logger.debug(e.LogTagId.A_DELETE_MESSAGES_S,{code:o,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,timestamp:n}),o===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.deleteMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options",n,(function(t){return e.isArray(t)&&t.length}),!0),n.forEach((function(t){e.assert("options.messageUId",t.messageUId,e.AssertRules.STRING,!0),e.assert("options.sentTime",t.sentTime,e.AssertRules.NUMBER,!0),e.assert("options.messageDirection",t.messageDirection,(function(e){return 1===e||2===e}),!0)})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("delete messages ->"+o),[4,G.imClient.context.deleteRemoteMessage(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("delete message fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:e.ErrorCode.SUCCESS}]}}))}))},exports.disconnect=function(){return e.logger.info(e.LogTagId.A_DISCONNECT_O,{}),P.context.disconnect()},exports.electronExtension=Ke,exports.forceRemoveChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),j(n),o="id:"+t,r.debug("force remove chatroom entry ->"+o),[4,G.imClient.context.forceRemoveChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("force remove chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.forceSetChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),K(n),o="id:"+t,r.debug("force set chatroom entry ->"+o),[4,G.imClient.context.forceSetChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("force set chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.getAllChatRoomEntries=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return n="id:"+t,r.debug("get all chatroom entries->"+n),[4,G.imClient.context.getAllChatroomEntries(t)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS&&i?[2,{code:a,data:i}]:(r.warn("get all chatroom entries fail ->code+:"+B[a]+","+n),[2,{code:a,msg:B[a]}])}}))}))},exports.getAllConversationState=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,G.imClient.context.getAllConversationState()]}))}))},exports.getAllUltraGroupUnreadCount=function(){return o(this,void 0,void 0,(function(){var t,n,o,a;return s(this,(function(s){switch(s.label){case 0:return t="getAllUltraGroupUnreadCount",[4,G.imClient.context.getAllUltraGroupUnreadCount()];case 1:return n=s.sent(),o=n.code,a=n.data,r.debug(t),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("".concat(t," fail ->").concat(o,": ").concat(B[o])),[2,{code:o,msg:B[o]}])}}))}))},exports.getAllUltraGroupUnreadMentionedCount=function(){return o(this,void 0,void 0,(function(){var t,n,o,a;return s(this,(function(s){switch(s.label){case 0:return t="getAllUltraGroupUnreadMentionedCount",!0,[4,G.imClient.context.getAllUltraGroupUnreadCount(true)];case 1:return n=s.sent(),o=n.code,a=n.data,r.debug(t),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("".concat(t," fail ->").concat(o,": ").concat(B[o])),[2,{code:o,msg:B[o]}])}}))}))},exports.getAllUnreadMentionedCount=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return r.debug("getAllUnreadMentionedCount"),[2,G.imClient.context.getAllUnreadMentionedCount()]}))}))},exports.getBlacklist=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return r.info("getBlacklist -> "),[4,G.imClient.context.getBlacklist()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS&&o?[2,{code:n,data:o}]:(r.warn("getBlacklist fail -> code: ".concat(n)),[2,{code:n}])}}))}))},exports.getBlacklistStatus=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("getBlacklistStatus -> userId: ".concat(t)),[4,G.imClient.context.getBlacklistStatus(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:0===a}]:(r.warn("getBlacklistStatus fail -> code: ".concat(o,", userId: ").concat(t)),[2,{code:o}])}}))}))},exports.getBlockUltraGroupList=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return[4,G.imClient.context.getBlockUltraGroupList()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:o}]:(r.warn("get block ultragroup ->"+n+":"+B[n]),[2,{code:n,msg:B[n]}])}}))}))},exports.getBlockedConversationList=function(){return o(this,void 0,void 0,(function(){var e,t,n;return s(this,(function(o){switch(o.label){case 0:return[4,G.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))},exports.getChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("key",n,(function(t){return e.isString(t)&&/[\w+=-]+/.test(t)&&t.length<=128}),!0),o="id:"+t,r.debug("get chatroom entry->"+o),[4,G.imClient.context.getChatroomEntry(t,n)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?[2,{code:i,data:c}]:(r.warn("get chatroom entry fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getChatRoomInfo=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER),e.assert("options.order",n.order,(function(e){return[0,1,2].includes(e)})),o="id:"+t,r.debug("get chatroom info ->"+o),[4,G.imClient.context.getChatroomInfo(t,n.count,n.order)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?[2,{code:i,data:c}]:(r.warn("get chatroom info fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getChatroomHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",n.count,e.AssertRules.NUMBER),e.assert("options.order",n.order,(function(e){return 0===e||1===e})),o="id:"+t,r.debug("get chatroom history message->"+o),[4,G.imClient.context.getChatRoomHistoryMessages(t,n.count,n.order,n.timestamp)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?(u=c.list.map((function(e){return w(e)})),[2,{code:i,data:{list:u,hasMore:!!c.hasMore}}]):(r.warn("get chatroom history message fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getConnectionStatus=function(){return P.context.getConnectionStatus()},exports.getConversation=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getConversation(t.conversationType,t.targetId,t.channelId||"")];case 1:return n=s.sent(),o=n.code,a=n.data,o!==e.ErrorCode.SUCCESS?(r.warn("getConversation ->code:"+o+", targetId:"+t.targetId),[2,{code:o,msg:B[o]}]):[2,{code:o,data:a?L(a):null}]}}))}))},exports.getConversationList=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return r.debug("get conversation list ->"),[4,G.imClient.context.getConversationList(null==t?void 0:t.count,void 0,null==t?void 0:t.startTime,null==t?void 0:t.order,n)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS&&i?[2,{code:0,data:i.map((function(e){return L(e)}))}]:(r.warn("get conversation list fail ->"+a+":"+B[a]),[2,{code:a,msg:B[a]}])}}))}))},exports.getConversationNotificationLevel=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return n=V(t,"getConversationNotificationLevel"),[4,G.imClient.context.getConversationNotificationLevel(t.conversationType,t.targetId,t.channelId)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("getConversationNotificationLevel fail -> ".concat(a," : ").concat(B[a]," , ").concat(n)),[2,{code:a,msg:B[a]}])}}))}))},exports.getConversationNotificationStatus=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.info("getConversationNotificationStatus ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.getConversationNotificationStatus(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("getConversationNotificationStatus ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.getConversationsFromTagByPage=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("count",n,e.AssertRules.NUMBER,!0),e.assert("startTime",a,e.AssertRules.NUMBER,!0),r.info("getConversationListByTag ->tagId:"+t),[4,G.imClient.context.getConversationListByTag(t,a,n)];case 1:return o=s.sent(),i=o.code,c=o.data,i===e.ErrorCode.SUCCESS?[2,{code:i,data:c}]:(r.warn("getConversationListByTag ->code:"+i+",tagId:"+t),[2,{code:i,msg:B[i]}])}}))}))},exports.getCurrentUserId=function(){return P.context.getCurrentUserId()},exports.getDeviceId=function(){return P.context.getDeviceId()},exports.getFileToken=function(t,n,o,s){return new Promise((function(r){G.imClient.context.getFileToken(t,n,o,s).then((function(t){r({code:e.ErrorCode.SUCCESS,data:t})})).catch((function(e){r({code:e,msg:B[e]})}))}))},exports.getFileUrl=Be,exports.getFirstUnreadMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getFirstUnreadMessage(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("insertMessage ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.getHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",null==n?void 0:n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",null==n?void 0:n.count,e.AssertRules.NUMBER),e.assert("options.order",null==n?void 0:n.order,(function(e){return 0===e||1===e})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get history message ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_GET_HISTORY_MSG_T,{targetId:t.targetId,conversationType:t.conversationType,channelId:t.channelId,timestamp:null==n?void 0:n.timestamp,count:null==n?void 0:n.count},{traceId:a}),[4,G.imClient.context.getHistoryMessage(t.conversationType,t.targetId,null==n?void 0:n.timestamp,null==n?void 0:n.count,null==n?void 0:n.order,null==t?void 0:t.channelId,"",a)];case 1:return i=s.sent(),c=i.code,u=i.data,c===e.ErrorCode.SUCCESS&&u?(d=u.list.map((function(e){return w(e)})),e.logger.info(e.LogTagId.A_GET_HISTORY_MSG_R,{code:c,messageLength:d.length},{traceId:a}),[2,{code:c,data:{list:d,hasMore:u.hasMore}}]):(e.logger.warn(e.LogTagId.A_GET_HISTORY_MSG_R,{code:c,messageUIds:""},{traceId:a}),r.warn("get history message fail ->"+c+":"+B[c]+","+o),[2,{code:c,msg:B[c]}])}}))}))},exports.getMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?[4,G.imClient.context.getMessage(t)]:[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:w(a)}]:(r.warn("getMessage ->code:"+o+",messageId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.getMessageReader=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("messageUId",n,e.AssertRules.STRING,!0),o="messageUId:"+n+",targetId:"+t,r.debug("get message reader ->"+o),[4,G.imClient.context.getMessageReader(t,n,a)];case 1:return i=s.sent(),c=i.code,u=i.data,c===e.ErrorCode.SUCCESS?[2,{code:c,data:u}]:(r.warn("get message reader fail ->"+c+":"+B[c]+","+o),[2,{code:c,msg:B[c]}])}}))}))},exports.getRemoteHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",null==n?void 0:n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",null==n?void 0:n.count,e.AssertRules.NUMBER),e.assert("options.order",null==n?void 0:n.order,(function(e){return 0===e||1===e})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get history message ->"+o),[4,G.imClient.context.getRemoteHistoryMessages(t.conversationType,t.targetId,(null==n?void 0:n.timestamp)||0,(null==n?void 0:n.count)||20,(null==n?void 0:n.order)||0,t.channelId||"")];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?(u=c.list.map((function(e){return w(e)})),[2,{code:i,data:{list:u,hasMore:c.hasMore}}]):(r.warn("get history message fail ->"+i+":"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getServerTime=function(){return P.context.getServerTime()},exports.getTags=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return[4,G.imClient.context.getTagList()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:o}]:(r.warn("getTagList ->code:"+n),[2,{code:n,msg:B[n]}])}}))}))},exports.getTagsFromConversation=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER),e.assert("targetId",t.targetId,e.AssertRules.STRING),e.assert("channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.info("getTagsForConversation ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.getTagsForConversation(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:[2,{code:o,msg:B[o]}]}}))}))},exports.getTextMessageDraft=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getConversationMessageDraft(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,i="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get draft ->"+i),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a||""}]:(r.warn("get draft fail ->"+o+":"+B[o]+","+i),[2,{code:o,msg:B[o]}])}}))}))},exports.getTopConversationList=function(){return o(this,void 0,void 0,(function(){var e,t,n;return s(this,(function(o){switch(o.label){case 0:return[4,G.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))},exports.getTotalUnreadCount=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d;return s(this,(function(s){switch(s.label){case 0:if(r.debug("get total unread count -> ConversationType:"+JSON.stringify(n)+" includeMuted:"+t),e.assert("includeMuted",t,e.AssertRules.BOOLEAN,!1),e.assert("conversationTypes",n,e.AssertRules.ARRAY,!1),n)for(o=0,a=n;o<a.length;o++)i=a[o],e.assert("conversationType",i,e.isValidConversationType);return[4,G.imClient.context.getTotalUnreadCount("",n,t)];case 1:return c=s.sent(),u=c.code,d=c.data,u===e.ErrorCode.SUCCESS?[2,{code:u,data:d}]:(r.warn("getTotalUnreadCount fail ->"+u+":"+B[u]),[2,{code:u,msg:B[u]}])}}))}))},exports.getUltraGroupDefaultNotificationLevel=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),n="getUltraGroupDefaultNotificationLevel",o="targetId: ".concat(t.targetId,", channelId: ").concat(t.channelId),r.debug("".concat(n," -> ").concat(o)),[4,G.imClient.context.getUltraGroupDefaultNotificationLevel(t.targetId,t.channelId)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS?[2,{code:i,data:c}]:(r.warn("".concat(n," fail -> ").concat(i," : ").concat(B[i]," , ").concat(o)),[2,{code:i,msg:B[i]}])}}))}))},exports.getUltraGroupList=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!1),e.assert("options.channelType",t.channelType,(function(t){return void 0!==e.UltraGroupChannelType[t]}),!1),[4,G.imClient.context.getUltraGroupList(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:a}]:(r.warn("get ultragroup ->"+o+":"+B[o]),[2,{code:o,msg:B[o]}])}}))}))},exports.getUltraGroupMessageListByMessageUId=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("msgs",n,e.AssertRules.ARRAY,!0),o=t.targetId,a=t.conversationType,i=t.channelId,c=[],n.forEach((function(e){var t=e.sendTime,n=e.messageUId;c.push({sendTime:t,messageUId:n,channelId:i})})),u={targetId:o,conversationType:a,messages:c},[4,G.imClient.context.getUltraGroupMessageListByMessageUId(u)];case 1:return d=s.sent(),l=d.code,g=d.data,l===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:g}]:(r.warn("get UltraGroup MessageList by messageUId ->"+l+":"+B[l]),[2,{code:l,msg:B[l]}])}}))}))},exports.getUltraGroupUnreadCountByTargetId=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t,e.AssertRules.STRING,!0),n="getUltraGroupUnreadCountByTargetId",[4,G.imClient.context.getUltraGroupUnreadCountByTargetId(t)];case 1:return o=s.sent(),a=o.code,i=o.data,c="targetId: ".concat(t),r.debug("".concat(n," -> ").concat(c)),a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("".concat(n," fail -> ").concat(a,": ").concat(B[a],", ").concat(c)),[2,{code:a,msg:B[a]}])}}))}))},exports.getUltraGroupUnreadMentionedCountByTargetId=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("cotargetIdntent",t,e.AssertRules.STRING,!0),r.debug("get UltraGroup unreadMentionedCount by targetId:"+t),[4,G.imClient.context.getUltraGroupUnreadMentionedCountByTargetId(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:a}]:(r.warn("get UltraGroup unreadMentionedCount by targetId error ->"+o+":"+B[o]),[2,{code:o,msg:B[o]}])}}))}))},exports.getUnreadCount=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getUnreadCount(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,i="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get unreadCount ->"+i),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("get unreadCount fail ->"+o+":"+B[o]+","+i),[2,{code:o,msg:B[o]}])}}))}))},exports.getUnreadCountByTag=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("containMuted",n,e.AssertRules.BOOLEAN,!0),r.info("getUnreadCountByTag ->tagId:"+t),[4,G.imClient.context.getUnreadCountByTag(t,n)];case 1:return o=s.sent(),a=o.code,i=o.data,r.info(a,i),a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("getUnreadCountByTag ->code:"+a+",tagId:"+t),[2,{code:a,msg:B[a]}])}}))}))},exports.getUnreadMentionedCount=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.debug("getUnreadMentionedCount"+t.targetId+",channelId:"+t.channelId),[2,G.imClient.context.getUnreadMentionedCount(t)]}))}))},exports.getUnreadMentionedMessages=function(t){if(!e.usingCppEngine())return{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]};e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0);var n=G.imClient.context.getUnreadMentionedMessages(t.conversationType,t.targetId),o=[];return n&&n.length&&n.forEach((function(e){return o.push(w(e))})),{code:e.ErrorCode.SUCCESS,data:o}},exports.init=function(e){P=P||new G(e)},exports.insertMessage=function(t,n,a){return void 0===a&&(a={}),o(this,void 0,void 0,(function(){var o,i,c,u,d,l,g,p,f,m,C,v,h,I,T,E;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.insertMessage","RongIMLib.ElectronExtension.insertMessage"),e.usingCppEngine()?(o=n.senderUserId,i=n.messageType,c=n.content,u=n.messageDirection,d=n.messageUId,l=n.canIncludeExpansion,g=n.expansion,p=n.disableNotification,f=n.sentTime,m=n.sentStatus,r.info("insertMessage ->targetId:"+t.targetId+",conversationType:"+t.conversationType),C=a.isUnread,v=a.searchContent,h={senderUserId:o,messageType:i,content:c,messageDirection:u,sentTime:f,sentStatus:m,searchContent:v,isUnread:C,messageUId:d,disableNotification:p,canIncludeExpansion:l,expansionMsg:JSON.stringify(g),channelId:t.channelId||""},[4,G.imClient.context.insertMessage(t.conversationType,t.targetId,h)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return I=s.sent(),T=I.code,E=I.data,T===e.ErrorCode.SUCCESS?[2,{code:T,data:w(E)}]:(r.warn("insertMessage ->code:"+T+",targetId:"+t.targetId),[2,{code:T,msg:B[T]}])}}))}))},exports.installPlugin=function(e,t){return null==P?void 0:P.context.install(e,t)},exports.joinChatRoom=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER,!0),o="id:"+t,r.debug("join chatroom ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_JOIN_CHATROOM_T,{chatroomId:t,count:n.count,joinExist:!1},{traceId:a}),[4,G.imClient.context.joinChatroom(t,n.count,a)];case 1:return i=s.sent(),(i===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_JOIN_CHATROOM_R,{code:i,timestamp:(new Date).getTime()},{traceId:a}),i!==e.ErrorCode.SUCCESS?(r.warn("join chatroom fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))},exports.joinExistChatRoom=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER,!0),o="id:"+t,r.debug("join exist chatroom ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_JOIN_CHATROOM_T,{chatroomId:t,count:n.count,joinExist:!0},{traceId:a}),[4,G.imClient.context.joinExistChatroom(t,n.count,a)];case 1:return i=s.sent(),(i===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_JOIN_CHATROOM_R,{code:i,timestamp:(new Date).getTime()},{traceId:a}),i!==e.ErrorCode.SUCCESS?(r.warn("join exist chatroom fail ->code:"+B[i]+","+o),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))},exports.modifyMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g,p,f;return s(this,(function(s){switch(s.label){case 0:return e.assert("content",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.senderUserId,u=n.sentTime,d=n.canIncludeExpansion,l=n.channelId,g="conversationType:"+o+",targetId:"+a+",channelId:"+l+",messageUId:"+i,r.debug("update ultragroup message expansion ->"+g),p={targetId:a,channelId:l,conversationType:o,fromUserId:c,sendTime:u,canIncludeExpansion:d,messageUId:i,content:t},[4,G.imClient.context.modifyMessage(p)];case 1:return(f=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("modify ultraGroup message ->"+f+":"+B[f]),[2,{code:f,msg:B[f]}])}}))}))},exports.onceEventListener=function(e,t,n){P.once(e,t,n)},exports.quitChatRoom=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return n="id:"+t,r.debug("quit chatroom ->"+n),o=e.logger.ID(),e.logger.info(e.LogTagId.A_QUIT_CHATROOM_T,{chatroomId:t},{traceId:o}),[4,G.imClient.context.quitChatroom(t)];case 1:return a=s.sent(),(a===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_QUIT_CHATROOM_R,{code:a},{traceId:o}),a!==e.ErrorCode.SUCCESS?(r.warn("quit chatroom fail ->code+:"+B[a]+","+n),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.recallMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.messageUId",n.messageUId,e.AssertRules.STRING,!0),e.assert("options.sentTime",n.sentTime,e.AssertRules.NUMBER,!0),e.assert("options.disableNotification",null==n?void 0:n.disableNotification,e.AssertRules.BOOLEAN),e.assert("options.pushConfig",null==n?void 0:n.pushConfig,e.AssertRules.OBJECT),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o={user:n.user,channelId:t.channelId||"",disableNotification:null==n?void 0:n.disableNotification,pushConfig:null==n?void 0:n.pushConfig,extra:n.extra,isDelete:n.isDelete},a="conversationType:"+t.conversationType+",targetId:"+t.targetId+",messageUId:"+n.messageUId,r.debug("recall message ->"+a),[4,G.imClient.context.recallMessage(t.conversationType,t.targetId,n.messageUId,n.sentTime,o)];case 1:return i=s.sent(),c=i.code,u=i.data,c===e.ErrorCode.SUCCESS&&u?[2,{code:c,data:w(u)}]:c===e.ErrorCode.SUCCESS?[2,{code:c}]:(r.warn("recall message fail ->"+c+":"+B[c]+","+a),[2,{code:c,msg:B[c]}])}}))}))},exports.registerMessageType=function(t,n,o,s,r){return e.assert("messageType",t,e.AssertRules.STRING,!0),e.assert("isPersited",n,e.AssertRules.BOOLEAN,!0),e.assert("isCounted",o,e.AssertRules.BOOLEAN,!0),e.assert("isStatusMessage",r,e.AssertRules.BOOLEAN,!1),e.logger.info(e.LogTagId.A_REGTYP_O,{messageType:t,isCounted:o,isStatusMessage:r,isPersited:n}),G.imClient.context.registerMessageType(t,n,o,s,r),W(t,n,o)},exports.removeAllExpansionForUltraGroupMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c,u,d,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("message",t,e.AssertRules.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.sentTime,c=t.canIncludeExpansion,u=t.channelId,d="conversationType:"+n+",targetId:"+o+",channelId:"+u+",messageUId:"+a,r.debug("remove all expansion for ultraGroup message ->"+d),l={targetId:o,channelId:u,conversationType:n,sendTime:i,canIncludeExpansion:c,messageUId:a,removeAll:!0},[4,G.imClient.context.expandUltraMessage(l)];case 1:return(g=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("remove all expansion for ultraGroup message ->"+g+":"+B[g]),[2,{code:g,msg:B[g]}])}}))}))},exports.removeChatRoomEntries=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),function(t){t.entries.forEach((function(t){e.assert("key",t,e.AssertRules.STRING,!0)})),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)}(n),o="id:"+t,r.debug("remove chatroom entry->"+o),(a=Object.assign({},n)).entries=n.entries.map((function(e){return{key:e}})),[4,G.imClient.context.removeChatroomEntries(t,a)];case 1:return i=s.sent(),c=i.code,u=i.data,c!==e.ErrorCode.SUCCESS?(r.warn("remove chatroom entry fail ->code+:"+B[c]+","+o),[2,{code:c,msg:B[c],data:u}]):[2,{code:c}]}}))}))},exports.removeChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),j(n),o="id:"+t,r.debug("remove chatroom entry->"+o),[4,G.imClient.context.removeChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("remove chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.removeConversation=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.removeConversation(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("destroy conversation ->"+o),n!==e.ErrorCode.SUCCESS?(r.warn("destroy conversation fail ->"+n+":"+B[n]+","+o),[2,{code:n,msg:B[n]}]):[2,{code:n}]}}))}))},exports.removeConversationsFromTag=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("removeTagForConversations ->tagId:"+t),[4,G.imClient.context.removeTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.removeEventListener=function(e,t,n){P.off(e,t,n)},exports.removeEventListeners=function(e){P.removeAll(e)},exports.removeExpansionForUltraGroupMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g,p;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.ARRAY,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.sentTime,u=n.canIncludeExpansion,d=n.channelId,l="conversationType:"+o+",targetId:"+a+",channelId:"+d+",messageUId:"+i,r.debug("remove expansion for ultragroup message ->"+l),g={targetId:a,channelId:d,conversationType:o,sendTime:c,canIncludeExpansion:u,messageUId:i,keys:t},[4,G.imClient.context.expandUltraMessage(g)];case 1:return(p=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("remove expansion for ultraGroup message ->"+p+":"+B[p]),[2,{code:p,msg:B[p]}])}}))}))},exports.removeFromBlacklist=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("removeFromBlacklist -> userId: ".concat(t)),[4,G.imClient.context.removeFromBlacklist(t)];case 1:return[2,{code:n.sent()}]}}))}))},exports.removeMessageExpansionForKey=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l;return s(this,(function(s){switch(s.label){case 0:return e.assert("keys",t,e.AssertRules.ARRAY,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,u=n.channelId,d="conversationType:"+o+",targetId:"+a+",messageUId:"+i,r.debug("remove message expansion ->"+d),[4,G.imClient.context.sendExpansionMessage({conversationType:o,targetId:a,messageUId:i,canIncludeExpansion:c,keys:t,channelId:u})];case 1:return(l=s.sent().code)!==e.ErrorCode.SUCCESS?(r.warn("remove message expansion fail ->"+l+":"+B[l]+","+d),[2,{code:l,msg:B[l]}]):[2,{code:l}]}}))}))},exports.removeTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),r.info("removeTag ->tagId:"+t),[4,G.imClient.context.removeTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("removeTag ->code:"+n+",tagId:"+t),[2,{code:n,msg:B[n]}])}}))}))},exports.removeTagFromConversations=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("removeTagForConversations ->tagId:"+t),[4,G.imClient.context.removeTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.removeTagsFromConversation=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("tagIds",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("tagId",t,e.AssertRules.STRING,!0)})),r.info("removeTagsForConversation ->tagIds:"+n+",targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.removeTagsForConversation(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagsForConversation ->code:"+o+",tagIds:"+n),[2,{code:o,msg:B[o]}])}}))}))},exports.saveTextMessageDraft=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("draft",n,e.AssertRules.STRING,!0),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("set draft ->"+o),[4,G.imClient.context.saveConversationMessageDraft(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())===e.ErrorCode.SUCCESS?[2,{code:a}]:(r.warn("set draft fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}])}}))}))},exports.searchConversationByContent=function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,u;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.searchConversationByContent","RongIMLib.ElectronExtension.searchConversationByContent"),e.usingCppEngine()?(r.info("searchConversationByContent ->keyword:"+t),[4,G.imClient.context.searchConversationByContent(t,a,i,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),c=o.code,u=o.data,c===e.ErrorCode.SUCCESS?[2,{code:c,data:u}]:(r.warn("searchConversationByContent ->code:"+c+",keyword:"+t),[2,{code:c,msg:B[c]}])}}))}))},exports.searchMessages=function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,u,d;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.searchMessages","RongIMLib.ElectronExtension.searchMessages"),e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("timestamp",a,e.AssertRules.NUMBER),e.assert("count",i,e.AssertRules.NUMBER),1,[4,G.imClient.context.searchMessageByContent(t.conversationType,t.targetId,n,a,i,1,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),c=o.code,u=o.data,c===e.ErrorCode.SUCCESS?(d=[],(null==u?void 0:u.messages)&&u.messages.length&&u.messages.forEach((function(e){return d.push(w(e))})),[2,{code:c,data:{messages:d,count:null==u?void 0:u.count}}]):(r.warn("searchMessages ->code:"+c+",targetId:"+t.targetId),[2,{code:c,msg:B[c]}])}}))}))},exports.sendFileMessage=Fe,exports.sendHQVoiceMessage=Ve,exports.sendImageMessage=qe,exports.sendMessage=ke,exports.sendReadReceiptMessage=function(t,n,r,a){return o(this,void 0,void 0,(function(){var o,i,c,u,d;return s(this,(function(s){switch(s.label){case 0:return o={targetId:t,conversationType:e.ConversationType.PRIVATE,channelId:a},i=new J("RC:ReadNtf",{messageUId:n,lastMessageSendTime:r,type:1}),[4,ke(o,i)];case 1:return c=s.sent(),u=c.code,d=c.msg,0===u?[2,{code:u}]:[2,{code:u,msg:d}]}}))}))},exports.sendReadReceiptRequest=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,u,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("messageUId",n,e.AssertRules.STRING,!0),e.assert("channelId",a,e.AssertRules.CHANNEL_ID),o="messageUId:"+n+",targetId:"+t,r.debug("send read receipt message ->"+o),i=new J("RC:RRReqMsg",{messageUId:n}),[4,ke({targetId:t,conversationType:e.ConversationType.GROUP,channelId:a},i)];case 1:return c=s.sent(),u=c.code,d=c.msg,0===u?[2,{code:u}]:[2,{code:u,msg:d}]}}))}))},exports.sendReadReceiptResponse=function(e,t,n){return o(this,void 0,void 0,(function(){return s(this,(function(e){throw new Error("This method is deprecated, please use method sendReadReceiptResponseV2.")}))}))},exports.sendReadReceiptResponseV2=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,u,d,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),e.assert("messageList",n,e.AssertRules.OBJECT,!0),e.assert("channelId",a,e.AssertRules.CHANNEL_ID),Object.keys(n).forEach((function(t){e.assert(t,n[t],e.AssertRules.ARRAY)})),o={targetId:t,conversationType:e.ConversationType.GROUP,channelId:a},c=G.imClient.context.getInfoFromCache(),0!==(u=(null==c?void 0:c.grpRRVer)||0)?[3,2]:(d=new J("RC:RRRspMsg",{receiptMessageDic:n}),[4,ke(o,d)]);case 1:return i=s.sent(),[3,4];case 2:return 1!==u?[3,4]:(l=[],Object.keys(n).forEach((function(e){n[e].forEach((function(e){-1===l.indexOf(e)&&l.push(e)}))})),l.length?[4,G.imClient.context.sendReadReceiptMessage(t,l,a)]:(r.warn("Error in parameter messageList."),[2,{code:e.ErrorCode.PARAMETER_ERROR}]));case 3:i=s.sent(),s.label=4;case 4:return(g=i.code)===e.ErrorCode.SUCCESS?[2,{code:g}]:(r.warn("send read receipt message fail ->"+g+":"+B[g]),[2,{code:g,msg:B[g]}])}}))}))},exports.sendSightMessage=ze,exports.sendSyncReadStatusMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,r,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversation.type",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("lastMessageSendTime",n,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o=new J("RC:SRSMsg",{lastMessageSendTime:n}),[4,ke(t,o)];case 1:return r=s.sent(),a=r.code,i=r.msg,0===a?[2,{code:a}]:[2,{code:a,msg:i}]}}))}))},exports.sendTextMessage=function(e,t,n){return ke(e,new ee(t),n)},exports.sendTypingStatusMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("typingContentType",n,e.AssertRules.STRING,!0),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("send typing status message ->"+o),a={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:t.channelId},i=e.logger.ID(),e.logger.info(e.LogTagId.A_SEND_MSG_T,{messageType:a.messageType,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},{traceId:i}),[4,G.imClient.context.sendMessage(t.conversationType,t.targetId,a,void 0,i)];case 1:return c=s.sent(),u=c.code,d=c.data,(u===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_SEND_MSG_R,{code:u,messageUId:d?d.messageUId:"",messageId:d?d.messageId:""},{traceId:i}),u===e.ErrorCode.SUCCESS?[2,{code:u,data:w(d)}]:(r.warn("send typing status message fail ->"+u+":"+B[u]+","+o),[2,{code:u,msg:B[u]}])}}))}))},exports.sendUltraGroupTypingStatus=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),[4,G.imClient.context.sendUltraGroupTypingStatus(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("send ultraGroup OperateStatus ->"+n+":"+B[n]),[2,{code:n,msg:B[n]}])}}))}))},exports.setChatRoomEntries=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),function(t){t.entries.forEach((function(t){e.assert("entry.key",t.key,e.AssertRules.STRING,!0),e.assert("entry.value",t.value,e.AssertRules.STRING,!0)})),e.assert("options.isAutoDelete",t.isAutoDelete,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING),e.assert("options.isForce",t.isForce,e.AssertRules.BOOLEAN)}(n),n.entries.length>10?[2,D.CHATROOM_KV_STORE_OUT_LIMIT]:(o="id:"+t,r.debug("set chatroom entry->"+o),[4,G.imClient.context.setChatroomEntries(t,n)]);case 1:return a=s.sent(),i=a.code,c=a.data,i!==e.ErrorCode.SUCCESS?(r.warn("set chatroom entry fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i],data:c}]):[2,{code:i}]}}))}))},exports.setChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),K(n),o="id:"+t,r.debug("set chatroom entry->"+o),[4,G.imClient.context.setChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("set chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.setConversationNotificationLevel=function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){return e.assert("notificationLevel",n,(function(n){return t.conversationType===e.ConversationType.PRIVATE?[e.NotificationLevel.ALL_MESSAGE,e.NotificationLevel.NOT_SET,e.NotificationLevel.AT_MESSAGE_NOTIFICATION].includes(n):void 0!==e.NotificationLevel[n]}),!0),[2,z(t,(function(){return G.imClient.context.setConversationNotificationLevel(t.conversationType,t.targetId,n,t.channelId)}),"setConversationNotificationLevel")]}))}))},exports.setConversationNotificationStatus=function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){return e.assert("notificationStatus",n,(function(e){return 1===e||2===e}),!0),[2,z(t,(function(){return G.imClient.context.setConversationStatus(t.conversationType,t.targetId,void 0,n,t.channelId)}),"setConversationNotificationStatus")]}))}))},exports.setConversationToTop=function(t,n){return void 0===n&&(n=!0),o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.type",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("set conversation status ->"+o),[4,G.imClient.context.setConversationStatus(t.conversationType,t.targetId,n,void 0,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("set conversation status fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.setConversationToTopInTag=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversation.targetId",n.targetId,e.AssertRules.STRING,!0),e.assert("conversation.conversationType",n.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",n.channelId,e.AssertRules.CHANNEL_ID),e.assert("status.isTop",a,e.AssertRules.BOOLEAN,!0),r.info("setConversationStatusInTag ->tagId:"+t+",targetId:"+n.targetId+",conversationType"+n.conversationType),[4,G.imClient.context.setConversationStatusInTag(t,n,{isTop:a})];case 1:return o=s.sent(),(i=o.code)===e.ErrorCode.SUCCESS?[2,{code:i}]:(r.warn("setConversationStatusInTag ->code:"+i+",tagId:"+t),[2,{code:i,msg:B[i]}])}}))}))},exports.setMessageReceivedStatus=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.setMessageReceivedStatus","RongIMLib.ElectronExtension.setMessageReceivedStatus"),e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("receivedStatus",n,e.AssertRules.NUMBER,!0),r.info("setMessageReceivedStatus ->messageId:"+t+",receivedStatus:"+n),[4,G.imClient.context.setMessageReceivedStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("setMessageReceivedStatus ->code:"+o+",messageId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.setUltraGroupDefaultNotificationLevel=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),t.channelId=t.channelId||"",e.assert("options.channelId",t.channelId,e.AssertRules.ONLY_STRING,!0),e.assert("notificationLevel",n,(function(t){return void 0!==e.NotificationLevel[t]}),!0),o="setUltraGroupDefaultNotificationLevel",a="targetId: ".concat(t.targetId,", channelId: ").concat(t.channelId),r.debug("".concat(o," -> ").concat(a)),[4,G.imClient.context.setUltraGroupDefaultNotificationLevel(t.targetId,n,t.channelId)];case 1:return(i=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:i}]:(r.warn("".concat(o," fail -> ").concat(i," : ").concat(B[i]," , ").concat(a)),[2,{code:i,msg:B[i]}])}}))}))},exports.updateExpansionForUltraGroupMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g,p;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.sentTime,u=n.canIncludeExpansion,d=n.channelId,l="conversationType:"+o+",targetId:"+a+",channelId:"+d+",messageUId:"+i,r.debug("update expansion for ultragroup message ->"+l),g={targetId:a,channelId:d,conversationType:o,sendTime:c,canIncludeExpansion:u,messageUId:i,expansion:t},[4,G.imClient.context.expandUltraMessage(g)];case 1:return(p=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("update expansion for ultragroup message ->"+p+":"+B[p]),[2,{code:p,msg:B[p]}])}}))}))},exports.updateMessageExpansion=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,u,d,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,u=n.expansion,d=n.channelId,l="conversationType:"+o+",targetId:"+a+",messageUId:"+i,r.debug("update message expansion ->"+l),[4,G.imClient.context.sendExpansionMessage({conversationType:o,targetId:a,messageUId:i,expansion:t,canIncludeExpansion:c,originExpansion:u,channelId:d})];case 1:return(g=s.sent().code)!==e.ErrorCode.SUCCESS?(r.warn("update message expansion fail ->"+g+":"+B[g]+","+l),[2,{code:g,msg:B[g]}]):[2,{code:g}]}}))}))},exports.updateTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tag.tagId",t.tagId,e.AssertRules.STRING,!0),e.assert("tag.tagName",t.tagName,e.AssertRules.STRING,!0),e.assert("tag.tagName",t.tagName,(function(e){return e.length<=15})),r.info("updateTag ->tagId:"+t.tagId+",tagName:"+t.tagName),[4,G.imClient.context.updateTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("updateTag ->code:"+n+",tagId:"+t.tagId),[2,{code:n,msg:B[n]}])}}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};var n=function(){return n=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},n.apply(this,arguments)};function o(e,t,n,o){return new(n||(n=Promise))((function(s,r){function a(e){try{c(o.next(e))}catch(e){r(e)}}function i(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}c((o=o.apply(e,t||[])).next())}))}function s(e,t){var n,o,s,r,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(r){return function(i){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(s=2&r[0]?o.return:r[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,r[1])).done)return s;switch(o=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,o=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(s=a.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){a=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){a.label=r[1];break}if(6===r[0]&&a.label<s[1]){a.label=s[1],s=r;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(r);break}s[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],o=0}finally{n=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,i])}}}var r=new e.Logger("RCIM"),a=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},i=a();var c,d,u={tag:"browser",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(e){var t,r=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),c="[object XDomainRequest]"===Object.prototype.toString.call(r);if(r.open(n,i),s&&r.setRequestHeader)for(var d in s)r.setRequestHeader(d,s[d]);if(c){r.timeout=o,r.onload=function(){e({data:r.responseText,status:r.status||200})},r.onerror=function(){e({status:r.status||0})},r.ontimeout=function(){e({status:r.status||0})};var u="object"==typeof a?JSON.stringify(a):a;r.send(u)}else r.onreadystatechange=function(){4===r.readyState&&e({data:r.responseText,status:r.status})},r.onerror=function(){e({status:r.status||0})},setTimeout((function(){r.abort(),e({status:r.status||0})}),o),r.send(a)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||console.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:i,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},createDataChannel:function(t,n){return this.isSupportSocket()&&"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,s=n||o||e.NetworkType.UNKONWN;return new Promise((function(e){e(s)}))}},l=a(),g=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"wechat"},{traceId:s}),wx[t].apply(wx,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"wechat"},{traceId:s}),console.error(n)}}},p={setItem:g("setStorageSync"),getItem:g("getStorageSync"),removeItem:g("removeStorageSync"),clear:g("clearStorageSync")},f={tag:"wechat",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(t){wx.request({url:i,method:n,headers:s,timeout:o,data:a,success:function(e){t({data:e.data,status:e.statusCode})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:p,sessionStorage:p,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:l,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},m=a(),C=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"alipay"},{traceId:s}),my[t].apply(my,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"alipay"},{traceId:s}),console.error(n)}}},v={setItem:C("setStorageSync"),getItem:C("getStorageSync"),removeItem:C("removeStorageSync"),clear:C("clearStorageSync")},h={tag:"alipay",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r),c=t.dataType||"json";return new Promise((function(t){my.request({url:i,method:n,headers:s,timeout:o,data:a,dataType:c,success:function(e){t({data:e.data,status:e.status})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:v,sessionStorage:v,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:m,createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},I=a(),T=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"toutiao"},{traceId:s}),tt[t].apply(tt,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"toutiao"},{traceId:s}),console.error(n)}}},E={setItem:T("setStorageSync"),getItem:T("getStorageSync"),removeItem:T("removeStorageSync"),clear:T("clearStorageSync")},S={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:I,localStorage:E,sessionStorage:E,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},R=a(),y=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"baidu"},{traceId:s}),swan[t].apply(swan,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"baidu"},{traceId:s}),console.error(n)}}},N={setItem:y("setStorageSync"),getItem:y("getStorageSync"),removeItem:y("removeStorageSync"),clear:y("clearStorageSync")},A={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:R,localStorage:N,sessionStorage:N,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))]}))}))}},U=function(t){return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var s=e.logger.ID();try{return e.logger.info(e.LogTagId.A_CALLBACK_O,{func_name:t,source:"uniapp"},{traceId:s}),uni[t].apply(uni,n)}catch(n){e.logger.error(e.LogTagId.A_CALLBACK_E,{func_name:t,source:"uniapp"},{traceId:s}),console.error(n)}}},O={setItem:U("setStorageSync"),getItem:U("getStorageSync"),removeItem:U("removeStorageSync"),clear:U("clearStorageSync")},x={tag:"uniapp",httpReq:function(t){var n=t.method||e.HttpMethod.GET,o=t.timeout||6e4,s=t.headers,r=t.query,a=t.body,i=e.appendUrl(t.url,r);return new Promise((function(t){uni.request({url:i,method:n,headers:s,timeout:o,data:a,success:function(e){t({data:e.data,status:e.statusCode})},fail:function(){t({status:e.ErrorCode.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:O,sessionStorage:O,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(t,n){return"websocket"===n?new e.WebSocketChannel(this,t):new e.CometChannel(this,t)},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.NetworkType.UNKONWN)}})}))}},_=function(e){return e&&e.canIUse&&e.getSystemInfo},M="undefined"!=typeof uni&&_(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return x;case"mp-baidu":return A;case"mp-toutiao":return S;case"mp-alipay":return h;case"mp-weixin":return f;default:return u}}():"undefined"!=typeof my&&_(my)?h:"undefined"!=typeof tt&&_(tt)?S:"undefined"!=typeof swan&&_(swan)?A:"undefined"!=typeof wx&&_(wx)?f:u;function w(t){var n=t.conversationType,o=t.channelId,s=t.messageType,r=t.content,a=t.senderUserId,i=t.targetId,c=t.sentTime,d=t.receivedTime,u=t.messageUId,l=t.messageDirection,g=t.isPersited,p=t.isCounted,f=t.isOffLineMessage,m=t.canIncludeExpansion,C=t.expansion,v=t.receivedStatus,h=t.disableNotification,I=t.isMentioned,T=t.isStatusMessage,E=t.readReceiptInfo,S=t.pushConfig,R=t.messageId,y=t.isInterrupt,N=t.isModifyMessage,A=t.channelType,U=t.sentStatus;v||(v=e.ReceivedStatus.UNREAD);var O={messageType:s,channelId:o||"",content:r,senderUserId:a,targetId:i,conversationType:n,sentTime:c,receivedTime:d,messageUId:u,messageDirection:l,isPersited:g,isCounted:p,isMentioned:I,disableNotification:h,isStatusMessage:T,canIncludeExpansion:m,expansion:C,receivedStatus:v,readReceiptInfo:E,pushConfig:S,messageId:R,isInterrupt:y,isModifyMessage:N,sentStatus:U};return n!==e.ConversationType.ULTRA_GROUP&&(O.isOffLineMessage=f),n===e.ConversationType.ULTRA_GROUP&&e.isNumber(A)&&(O.channelType=A),O}function L(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,s=e.unreadMessageCount,r=e.hasMentioned,a=e.mentionedInfo,i=e.lastUnreadTime,c=e.notificationStatus,d=e.notificationLevel,u=e.isTop,l=e.channelId,g=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&w(o),unreadMessageCount:s,hasMentioned:r,mentionedInfo:r?{type:null==a?void 0:a.type,userIdList:null==a?void 0:a.userIdList}:void 0,lastUnreadTime:i,notificationStatus:c,notificationLevel:d,isTop:u,channelId:l,unreadMentionedCount:g}}function b(e,t){r.warn("Method '".concat(e,"' is deprecated, please use '").concat(t,"' instead"))}exports.Events=void 0,(c=exports.Events||(exports.Events={})).CONNECTING="CONNECTING",c.CONNECTED="CONNECTED",c.DISCONNECT="DISCONNECT",c.SUSPEND="SUSPEND",c.MESSAGES="MESSAGES",c.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",c.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",c.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",c.CONVERSATION="CONVERSATION",c.CHATROOM="CHATROOM",c.EXPANSION="EXPANSION",c.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",c.TAG="TAG",c.CONVERSATION_TAG="CONVERSATION_TAG",c.TYPING_STATUS="TYPING_STATUS",c.MESSAGE_BLOCKED="MESSAGE_BLOCKED",c.ULTRA_GROUP_ENABLE="ULTRA_GROUP_ENABLE",c.OPERATE_STATUS="OPERATE_STATUS",c.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED="ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED",c.ULTRA_GROUP_MESSAGE_MODIFIED="ULTRA_GROUP_MESSAGE_MODIFIED",c.ULTRA_GROUP_MESSAGE_RECALLED="ULTRA_GROUP_MESSAGE_RECALLED",c.ULTRA_GROUP_CHANNEL_TYPE_CHANGE="ULTRA_GROUP_CHANNEL_TYPE_CHANGE",c.ULTRA_GROUP_CHANNEL_DELETE="ULTRA_GROUP_CHANNEL_DELETE",c.ULTRA_GROUP_CHANNEL_USER_KICKED="ULTRA_GROUP_CHANNEL_USER_KICKED",exports.SentStatus=void 0,(d=exports.SentStatus||(exports.SentStatus={}))[d.SENDING=10]="SENDING",d[d.FAILED=20]="FAILED",d[d.SENT=30]="SENT",d[d.RECEIVED=40]="RECEIVED",d[d.READ=50]="READ",d[d.DESTROYED=60]="DESTROYED";var P,G=function(n){function o(t){var s=n.call(this)||this;if(o.imClient)return r.error("Please do not repeatedly perform the init method"),o.imClient;s.initOptions=t,e.assert("options.navigators",t.navigators,(function(t){return e.isArray(t)&&(0===t.length||t.every(e.isHttpUrl))})),r.setLogLevel(t.logLevel),r.setLogStdout(t.logStdout);var a=null==t?void 0:t.connectType;return a?e.CONNECTION_TYPE.WEBSOCKET!==a&&e.CONNECTION_TYPE.COMET!==a&&(r.warn("RongIMLib connectionType must be ".concat(e.CONNECTION_TYPE.WEBSOCKET," or ").concat(e.CONNECTION_TYPE.COMET)),a=e.CONNECTION_TYPE.WEBSOCKET):a=e.CONNECTION_TYPE.WEBSOCKET,e.logger.info(e.LogTagId.A_INIT_O,{appkey:t.appkey,navigators:t.navigators||[],connectionType:a,logLevel:t.logLevel}),s._context=e.APIContext.init(M,{appkey:t.appkey,apiVersion:"5.4.4",navigators:t.navigators||[],miniCMPProxy:t.customCMP||[],connectionType:a,logLevel:t.logLevel,logStdout:t.logStdout,indexDBSwitch:t.indexDBSwitch,checkCA:t.checkCA}),s.watch(),o.imClient=s,s}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(o,n),Object.defineProperty(o.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),o.prototype.watch=function(){var t=this,n=e.logger.ID(),o={onConnecting:function(){t.emit(exports.Events.CONNECTING)},onConnected:function(){t.emit(exports.Events.CONNECTED)},onDisconnect:function(o){e.logger.info(e.LogTagId.A_CONNECT_S,{status:o},{traceId:n}),t.emit(exports.Events.DISCONNECT,o)},onSuspend:function(o){e.logger.info(e.LogTagId.A_CONNECT_S,{status:o},{traceId:n}),t.emit(exports.Events.SUSPEND,o)},batchMessage:function(e){t.emit(exports.Events.MESSAGES,{messages:e.map((function(e){return w(e)}))})},typingState:function(e){t.emit(exports.Events.TYPING_STATUS,{status:e})},readReceiptReceived:function(e,n,o){t.emit(exports.Events.READ_RECEIPT_RECEIVED,{conversation:e,messageUId:n,sentTime:o})},messageReceiptRequest:function(e,n,o){t.emit(exports.Events.MESSAGE_RECEIPT_REQUEST,{conversation:e,messageUId:n,senderUserId:o})},messageReceiptResponse:function(e,n,o){t.emit(exports.Events.MESSAGE_RECEIPT_RESPONSE,{conversation:e,receivedUserId:n,messageUIdList:o})},conversationState:function(n){var o=n.map((function(t){var n=t.conversationType;return n===e.ConversationType.ULTRA_GROUP?{conversation:{conversationType:n,latestMessage:t.latestMessage?w(t.latestMessage):null,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount,unreadMentionedCount:t.unreadMentionedCount,versionTime:t.versionTime,notificationStatus:t.notificationStatus,notificationLevel:t.notificationLevel,lastUnreadTime:t.lastUnreadTime,channelId:t.channelId}}:{conversation:{conversationType:n,latestMessage:t.latestMessage?w(t.latestMessage):null,targetId:t.targetId,unreadMessageCount:t.unreadMessageCount,hasMentioned:t.hasMentioned,mentionedInfo:t.mentionedInfo,lastUnreadTime:t.lastUnreadTime,notificationStatus:t.notificationStatus,notificationLevel:t.notificationLevel,isTop:t.isTop,channelId:t.channelId,unreadMentionedCount:t.unreadMentionedCount},updatedItems:t.updatedItems}}));t.emit(exports.Events.CONVERSATION,{conversationList:o})},chatroomState:function(e){t.emit(exports.Events.CHATROOM,e)},expansion:function(e){t.emit(exports.Events.EXPANSION,e)},pullFinished:function(){t.emit(exports.Events.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){t.emit(exports.Events.TAG)},conversationTagChanged:function(){t.emit(exports.Events.CONVERSATION_TAG)},messageBlocked:function(e){t.emit(exports.Events.MESSAGE_BLOCKED,e)},ultraGroupEnable:function(e){t.emit(exports.Events.ULTRA_GROUP_ENABLE,e)},operateStatus:function(e){t.emit(exports.Events.OPERATE_STATUS,e)},ultraGroupMessageExpansionUpdated:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED,e)},ultraGroupMessageModified:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_MODIFIED,e)},ultraGroupMessageRecalled:function(e){t.emit(exports.Events.ULTRA_GROUP_MESSAGE_RECALLED,e)},ultraGroupChannelChangeType:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_TYPE_CHANGE,e)},ultraGroupChannelUserKicked:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_USER_KICKED,e)},ultraGroupChannelDelete:function(e){t.emit(exports.Events.ULTRA_GROUP_CHANNEL_DELETE,e)}};this.context.assignWatcher(o)},o}(e.EventEmitter),D={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL:{code:e.ErrorCode.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL,msg:"ultra group user not in private channel"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:e.ErrorCode.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},B={};for(var k in D){var H=D[k].code;B[H]=k}D.ROAMING_SERVICE_UNAVAILABLE.code;var F=function(t,n){void 0===n&&(n=""),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID);var o="conversationType:"+t.conversationType+",targetId:"+t.targetId;return r.debug("".concat(n," -> ").concat(o)),o},q=function(t,n,a){return void 0===a&&(a=""),o(void 0,void 0,void 0,(function(){var o,i;return s(this,(function(s){switch(s.label){case 0:return o=F(t,a),[4,n()];case 1:return(i=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("".concat(a," fail -> ").concat(i," : ").concat(B[i]," , ").concat(o)),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))};var V=function(t){e.assert("options.key",t.key,e.AssertRules.STRING,!0),e.assert("options.value",t.value,e.AssertRules.STRING,!0),e.assert("options.isAutoDelete",t.isAutoDelete,e.AssertRules.BOOLEAN),e.assert("options.isSendNotification",t.isSendNotification,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)},z=function(t){e.assert("options.key",t.key,e.AssertRules.STRING,!0),e.assert("options.isSendNotification",t.isSendNotification,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)};var K=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function j(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new K(e,o,t,n)}}var J,W,Y=j("RC:ImgMsg"),X=j("RC:HQVCMsg"),Q=j("RC:SightMsg"),Z=j("RC:TxtMsg"),$=j("RC:CombineMsg"),ee=j("RC:FileMsg"),te=j("RC:GIFMsg"),ne=j("RC:VcMsg"),oe=j("RC:LBSMsg"),se=j("RC:ReferenceMsg"),re=j("RC:ImgTextMsg"),ae={qiniu:function(t,n,o,s){var r=G.imClient.context.getInfoFromCache();if(1===(null==r?void 0:r.type)&&n.chunk_size&&s.size>n.chunk_size){var a=e.getUUID(),i=s.name.substr(s.name.lastIndexOf("."));a+=i,s.uniqueName=a,pe(s,n,o)}else ge(t,n,o,s)},baidu:function(e,t,n,o){if(o.size>ce)throw new Error("the file size is over 5GB!");var s=t||{};t=t||W;var r=new XMLHttpRequest,a=de();if(!s.uploadHost.bos&&!s.bosUploadPath)return;var i=a+ie[0][1]+s.bosUploadPath;ie.shift();var c=s.bosHeader||{},d={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:i,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState)if(JSON.parse(r.responseText||"{}").filename=t.uniqueValue,200===r.status){n.onCompleted(d,!0)}else ie.length?ae[ie[0][0]](e,t,n,o):n.onError("upload fail")},r.open(t.method,i,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(t,n,o,s){if(s.size>ce)throw new Error("the file size is over 5GB!");var r=new FormData;r.set("file",t.get("file")),r.set("key",t.get("key")),r.set("token",t.get("token"));var a=ie[0][1];ie.shift(),t=t||J,n=(n=n||{})||W;var i=new XMLHttpRequest,c=de()+n.ossBucketName+"."+a;i.upload&&n.support_options&&(i.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var t=JSON.parse(i.responseText||"{}");t.name=n.uniqueValue,t.filename=n.uploadFileName,t.uploadMethod=e.UploadMethod?e.UploadMethod.ALI:"",200===i.status?o.onCompleted(t):ie.length?ae[ie[0][0]](r,n,o,s):o.onError("upload fail")}},i.open(n.method,c,!0),console.log("ali:url",c);var d=n.aliHeader||{};t.set("OSSAccessKeyId",d.osskeyId),t.set("policy",d.ossPolicy),t.set("Signature",d.ossSign),t.set("success_action_status",200),t.delete("key"),t.append("key",n.uploadFileName),t.delete("file"),t.append("file",s),i.send(t)},s3:function(t,n,o,s){var r=new FormData,a=new XMLHttpRequest,i=de(),c=n.contentDisposition,d=ie[0][1],u=i+n.s3BucketName+"."+d;console.log("uploadS3:url",u),ie.shift(),a.upload&&n.support_options&&(a.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=JSON.parse(a.responseText||"{}");if(r.name=n.uniqueValue,r.filename=n.uploadFileName,r.uploadMethod=e.UploadMethod.AWS,200===a.status||204===a.status)o.onCompleted(r);else if(ie.length){var i=new FormData;i.set("file",t.get("file")),i.set("key",t.get("key")),i.set("token",t.get("token")),ae[ie[0][0]](i,n,o,s)}else o.onError("upload fail")}},a.open(n.method,u,!0);var l=n?n.s3Header:{},g=s&&s.type;c?r.set("Content-Disposition",c+";"):r.set("Content-Disposition","text/html"===g?"inline;":"attachment;");r.set("Content-Type",g),r.set("x-amz-credential",l.s3Credential),r.set("x-amz-algorithm",l.s3Algorithm),r.set("x-amz-date",l.s3Date),r.set("policy",l.s3Policy),r.set("x-amz-signature",l.s3Signature),r.set("key",n.uploadFileName),r.set("file",s),a.send(r)},stc:function(t,n,o,s){var r=new XMLHttpRequest,a=n.contentDisposition,i="https://"+ie[0][1]+"/"+n.stcBucketName+"/"+n.uploadFileName;ie.shift(),r.upload&&n.support_options&&(r.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=JSON.parse(r.responseText||"{}");if(a.name=n.uniqueValue,a.filename=n.uploadFileName,a.uploadMethod=e.UploadMethod?e.UploadMethod.STC:"",200===r.status||204===r.status)o.onCompleted(a);else if(ie.length){var i=new FormData;i.set("file",t.get("file")),i.set("key",t.get("key")),i.set("token",t.get("token")),ae[ie[0][0]](i,n,o,s)}else o.onError("upload fail")}},r.open("PUT",i,!0);var c=n?n.stcHeader:{};r.setRequestHeader("Content-Type",s.type),a?r.setRequestHeader("Content-Disposition",a+";"):r.setRequestHeader("Content-Disposition","text/html"===s.type?"inline;":"attachment;");r.setRequestHeader("Authorization",c.stcAuthorization),r.setRequestHeader("x-amz-content-sha256",c.stcContentSha256),r.setRequestHeader("x-amz-date",c.stcDate),r.send(s)}},ie=[],ce=5368709120;function de(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}var ue,le=(ue="RC-upload-",{get:function(e){e=ue+e;var t=localStorage.getItem(e);if(t)return null!==(t=JSON.parse(t||"{}"))&&t.type&&t.data?t.data:null},set:function(e,t){var n=localStorage;e=ue+e,t={data:t,type:typeof t,updateTime:Date.now()},n.setItem(e,JSON.stringify(t))},remove:function(e){e=ue+e,localStorage.removeItem(e)}});function ge(t,n,o,s){var r="https://"+n.uploadHost.qiniu,a=(/http/.test(ie[0][1])?"":de())+ie[0][1]||r;n.isChunk||ie.shift();var i=new XMLHttpRequest;i.upload&&n.support_options&&(i.upload.onprogress=function(e){o.onProgress(e.loaded,e.total)}),i.onreadystatechange=function(){if(4===i.readyState){var r=JSON.parse(i.responseText||"{}");r.filename=n.uniqueValue,r.uploadMethod=e.UploadMethod?e.UploadMethod.QINIU:"",200===i.status||204===i.status?o.onCompleted(r):ie.length?ae[ie[0][0]](t,n,o,s):o.onError("upload fail")}},i.open(n.method,a,!0),o.onOpen(i),n.stream&&i.setRequestHeader("authorization","UpToken "+n.multi_parmas.token),function(e,t){for(var n in e)t(n,e[n])}(n.headers,(function(e,t){i.setRequestHeader(e,t)})),i.send(t)}function pe(t,n,o,s){var r=0,a=s||e.getUUID(),i=le.get(a);i&&(t.uniqueName=i.sessionId,r=i.offset);var c=Math.min(n.chunk_size,t.size-r),d=t.slice(r,r+c),u=t.uniqueName;n.multi_parmas.name=u,n.filesize=t.size;var l="bytes="+r+"-"+(r+c);n.headers={Range:l,"X-File-TransactionId":u,"X-File-Total-Size":t.size},n.isChunk=!0,d.name=t.name,d=function(e,t,n){var o=new FormData;for(var s in t.unique_key&&o.append(t.unique_key,n),o.append(t.file_data_name,e,e.name),t.multi_parmas){var r=t.multi_parmas[s];o.append(s,r)}return o}(d,n,t.uniqueName),ge(d,n,{onCompleted:function(e){r+=c;var s=t.uniqueName;le.set(a,{offset:r,sessionId:s}),r<t.size?pe(t,n,o,a):(r=0,le.remove(a),o.onCompleted(e))},onError:function(e){console.error(e),o.onError(e)},onProgress:function(e,t){var s=e+r;o.onProgress(s,n.filesize)},onOpen:function(e){o.onOpen(e)}},t)}function fe(t,n,o){var s,r,a=t&&t.type||"text/plain",i=a.indexOf("image")>-1?1:4,c=n.contentDisposition,d=Math.ceil(t.size/n.stc_chunk_size),u=n&&JSON.parse(n.ossConfig?n.ossConfig:"");Array.isArray(u)||(u=[]);var l=u.find((function(e){return Object.keys(e).includes("stc")})),g="uploads";G.imClient.context.getFileToken(i,s,"POST",g).then((function(e){s=e.fileName,r="https://"+l.stc+"/"+n.stcBucketName+"/"+s,console.log("uploadStcMultipart:url",r);var i=new XMLHttpRequest;i.open("POST",r+"?"+g,!0),c?i.setRequestHeader("Content-Disposition",c+";"):i.setRequestHeader("Content-Disposition","text/html"===t.type?"inline;":"attachment;"),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",a),i.send(),i.onreadystatechange=function(){if(4===i.readyState){var e=i.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",e),200===i.status||204===i.status?function(e){for(var t=[],n=1;n<=d;n++)t.push(C(e,n));m(e,t)}(Array.isArray(e)&&e[1]):o.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){o.onError("uploadStcMultipart:"+e)}));var p=[],f=new Map;function m(c,u){u&&Array.isArray(u)&&0!==u.length&&Promise.all(u).then((function(){var u="uploadId="+c;if(f.size===d)G.imClient.context.getFileToken(i,s,"POST",u).then((function(s){console.log("onSuccess",s),console.log("onSuccess:uploadId",c);var i=new XMLHttpRequest;i.open("POST",r+"?"+u,!0),i.setRequestHeader("Authorization",s&&s.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",s&&s.stcContentSha256),i.setRequestHeader("x-amz-date",s&&s.stcDate),i.setRequestHeader("Content-Type",a);var d="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",l=Array.from(f.keys()||[]).sort((function(e,t){return e-t}));console.log("keys",l),l.forEach((function(e){d+="<Part><ETag>".concat(f.get(e),"</ETag><PartNumber>").concat(e,"</PartNumber></Part>")})),d+="</CompleteMultipartUpload>",i.send(d),console.log("xml",d),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var s={name:t.name,filename:n.uploadFileName,uploadMethod:e.UploadMethod.STC};o.onCompleted(s)}else o.onError("uploadStcMultipart:upload does not end")}}),(function(e){o.onError("uploadStcMultipart:"+e)}));else{for(var l=[],g=0,v=p;g<v.length;g++){var h=v[g];l.push(C(c,h))}m(c,l)}}),(function(e){console.error(e),o.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");for(var t=[],n=0,s=p;n<s.length;n++){var r=s[n];t.push(C(c,r))}m(c,t)}))}function C(e,o){return new Promise((function(c,d){var u="partNumber="+o+"&uploadId="+e;G.imClient.context.getFileToken(i,s,"PUT",u).then((function(e){console.log("signature "+o+" onSuccess",e);var s=t&&t.slice((o-1)*n.stc_chunk_size,o*n.stc_chunk_size);console.log("fileChunk:size",s.size);var i=new XMLHttpRequest;i.open("PUT",r+"?"+u,!0),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",a),i.send(s),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var e=i.getResponseHeader("etag");console.log("etag:"+o,e),f.set(o,e),c(e)}else p.includes(o)||p.push(o),d(o)}}),(function(e){console.log("getETags:签名验证失败"),p.includes(o)||p.push(o),d(o)}))}))}}var me={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),s=Ce()+o;n.append(t.unique_key,s),t.uniqueValue=s}return n.append(t.file_data_name,e),ve(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),s=Ce()+o;n[t.unique_key]=s,t.uniqueValue=s}return n[t.file_data_name]=e,ve(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function Ce(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function ve(e,t){for(var n in e)t(n,e[n])}var he,Ie=0,Te=function(){function e(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:me.form,genUId:Ce};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e)}return e.prototype.setOptions=function(e){var t=this;ve(e,(function(e,n){t.options[e]=n}))},e.prototype.upload=function(e,t){if(e){var n=this;!function(e,t,n){var o,s;J=e,W=t,ie=[];var r,a=G.imClient.context.getInfoFromCache();if(1===(null==a?void 0:a.type)&&(null===(o=G.imClient.initOptions)||void 0===o?void 0:o.uploadDomain))ie=[["qiniu",null===(s=G.imClient.initOptions)||void 0===s?void 0:s.uploadDomain]];else if(t.ossConfig){var i,c,d=JSON.parse(t.ossConfig),u="",l=[];d.forEach((function(e){var t=Number(e.p)-1;for(var n in e)"aliyun"===n&&(u=e[n]),"s3"===n&&(i=e[n]),"stc"===n&&(c=e[n]),"p"!==n&&(l[t]=[n,e[n]])})),l.forEach((function(e){e&&ie.push(e)})),d.length!==ie.length&&(ie=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",u],["s3",i],["stc",c]])}else ie=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];if(t.ossConfig){var g=t&&JSON.parse(t.ossConfig);Array.isArray(g)||(g=[]),r=g.find((function(e){return Object.keys(e).includes("stc")}))}if(r&&1===parseInt(r.p)&&e.size>=4194304)fe(e,t,n);else{var p=t.data(e,t);ae[ie[0][0]](p,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){(he=e,o)?he=Ie+e/n*(n-Ie):Ie=he;t.onProgress(he,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},e.prototype.cancel=function(){this.xhr&&this.xhr.abort()},e}();var Ee,Se,Re={init:function(e){return new Te(e)},dataType:me,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),s=new FileReader;s.readAsDataURL(e),s.onload=function(e){var s=e.target.result,r=new Image;r.src=s;var a=r.width,i=r.height,c=function(e,t){var n=1,o=e.width,s=t.maxWidth||0;s>0&&o>s&&(n=s/o);var r=e.height,a=t.maxHeight||0;if(a>0&&r>a){var i=a/r;n=Math.min(n,i)}var c=t.maxSize||0,d=Math.ceil(e.size/1e3);if(d>c){var u=c/d;n=Math.min(n,u)}return n}({width:a,height:i,size:e.total},t),d=s;c<1&&(d=function(e,t,n){return o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n),o.toDataURL("image/jpg")}(r,a*c,i*c)),n(d)}}},ye=function(e,t,n){var o=document.createElement("canvas"),s=o.getContext("2d"),r=new Image,a="string"==typeof e;r.onload=function(a){var i=function(e,t,n){var o,s,r,a=e<t,i=0,c=0;return(a?t/e:e/t)>n.scale?(a?(s=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,i=((s=e/(o=t/100))-n.maxWidth)/2),{w:s,h:r,x:-i,y:-c}):(a?(o=t/n.maxHeight,r=n.maxHeight,s=e/o):(o=e/n.maxWidth,s=n.maxWidth,r=t/o),{w:s,h:r,x:-i,y:-c})}(r.width,r.height,t);o.width=i.w>t.maxWidth?t.maxWidth:i.w,o.height=i.h>t.maxHeight?t.maxHeight:i.h,s.drawImage(r,i.x,i.y,i.w,i.h);var c=o.toDataURL("string"==typeof e?"image/jpg":e.type,t.quality);c=c.replace(/data:image\/[^;]+;base64,/,""),n(c)},r.src=a?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},Ne=function(e,t){var n=e.file,o=e.compress;ye(n,o,t)},Ae=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n);var s=Re.init(e);t(s)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Re.init(e);t(n)}},Ue=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||Ne;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Oe=function(){function e(e){this.instance=e}return e.prototype.upload=function(e,t){Ue({file:e},this.instance,t)},e.prototype.cancel=function(){this.instance.cancel()},e}(),xe=function(){function e(e,t){this.instance=e,this.cfg=t}return e.prototype.upload=function(e,t){var n={file:e,compress:this.cfg};Ue(n,this.instance,t)},e.prototype.cancel=function(){this.instance.cancel()},e}(),_e=function(e,t){Ae(e,(function(n){var o,s,r,a,i={maxHeight:(null===(o=e.thumbnailConfig)||void 0===o?void 0:o.maxHeight)||160,maxWidth:(null===(s=e.thumbnailConfig)||void 0===s?void 0:s.maxWidth)||160,quality:(null===(r=e.thumbnailConfig)||void 0===r?void 0:r.quality)||.5,scale:(null===(a=e.thumbnailConfig)||void 0===a?void 0:a.scale)||2.4},c=new xe(n,i);t(c)}))},Me=function(e,t){Ae(e,(function(e){var n=new Oe(e);t(n)}))},we=_e;Re.dataType;function Le(t,r,a,i){var c,d=this;void 0===r&&(r=e.FileType.FILE),c=r===e.FileType.IMAGE?e.FileType.IMAGE:e.FileType.FILE;var u=G.imClient.context.getInfoFromCache();if(!Se&&(Se="upload.qiniup.com",u&&u.ossConfig))try{var l=JSON.parse(u.ossConfig).find((function(e){return void 0!==e.qiniu}));l&&(Se=l.qiniu)}catch(e){}var g=n({domain:Se,getToken:function(e){G.imClient.context.getFileToken(c).then((function(t){e(t.token,t)})).catch((function(e){a.onFail(e)}))}},i);(c===e.FileType.IMAGE?we:Me)(g,(function(i){i.upload(t,{onProgress:function(e,t){var n,o=Math.floor(e/t*100);null===(n=a.onProgress)||void 0===n||n.call(a,o)},onCompleted:function(i){return o(d,void 0,void 0,(function(){return s(this,(function(d){return 1===(null==u?void 0:u.type)?function(t,o,s,r,a){var i,c={type:s.type,name:r.rc_url.file_name,downloadUrl:(null===(i=G.imClient.initOptions)||void 0===i?void 0:i.uploadDomain)+r.rc_url.path};if(t===e.FileType.AUDIO)return void be(s).then((function(e){a.onSuccess(n(n({},c),e))}));t===e.FileType.IMAGE&&(c.thumbnail=r.thumbnail),a.onSuccess(c)}(r,0,t,i,a):function(t,r,a,i,c){var d=this;Ge(r,i.filename,i.name,i,i.uploadMethod).then((function(u){return o(d,void 0,void 0,(function(){var o;return s(this,(function(s){return 0!==u.code?(c.onFail(u),[2]):((o=u.data).type=a.type,o.name=i.name||i.filename,t===e.FileType.AUDIO?(be(a).then((function(e){c.onSuccess(n(n({},o),e))})),[2]):(r===e.FileType.IMAGE&&(o.thumbnail=i.thumbnail),c.onSuccess(o),[2]))}))}))})).catch((function(e){c.onFail(e)}))}(r,c,t,i,a),[2]}))}))},onError:function(e){a.onFail(e)}})}))}function be(e){return new Promise((function(t){if("function"==typeof e.arrayBuffer)return e.arrayBuffer().then(Pe).then((function(e){t(e)}));var n=new FileReader;n.onload=function(){n.result?Pe(n.result).then((function(e){t(e)}),(function(){t({})})):t({})},n.onerror=function(){t({duration:0})},n.readAsArrayBuffer(e)}))}function Pe(e){return Ee=Ee||new AudioContext,new Promise((function(t,n){Ee.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Ge(t,n,o,s,r){return e.assert("fileType",t,e.isValidFileType,!0),e.assert("filename",n,e.AssertRules.STRING),e.assert("saveName",o,e.AssertRules.STRING),e.assert("serverType",r,e.AssertRules.NUMBER),new Promise((function(a){G.imClient.context.getFileUrl(t,n,o,s,r).then((function(t){a({code:e.ErrorCode.SUCCESS,data:t})})).catch((function(e){a({code:e})}))}))}function De(t,a,i){return o(this,void 0,void 0,(function(){var o,c,d,u,l,g,p,f,m,C,v,h;return s(this,(function(s){switch(s.label){case 0:return i=i||{},a instanceof K==!1?(r.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,D.ILLGAL_PARAMS]):(e.assert("conversation",t,e.AssertRules.OBJECT,!0),o=t.conversationType,c=t.targetId,d=t.channelId,e.assert("conversation.targetId",c,e.AssertRules.STRING,!0),e.assert("conversation.conversationType",o,e.AssertRules.NUMBER),e.assert("conversation.channelId",d,e.AssertRules.CHANNEL_ID),e.assert("options.isStatusMessage",null==i?void 0:i.isStatusMessage,e.AssertRules.BOOLEAN),e.assert("options.disableNotification",null==i?void 0:i.disableNotification,e.AssertRules.BOOLEAN),e.assert("options.pushContent",null==i?void 0:i.pushContent,e.AssertRules.STRING),e.assert("options.pushData",null==i?void 0:i.pushData,e.AssertRules.STRING),e.assert("options.isMentioned",null==i?void 0:i.isMentioned,e.AssertRules.BOOLEAN),e.assert("options.mentionedType",null==i?void 0:i.mentionedType,e.AssertRules.NUMBER),e.assert("options.mentionedUserIdList",null==i?void 0:i.mentionedUserIdList,e.AssertRules.ARRAY),e.assert("options.directionalUserIdList",null==i?void 0:i.directionalUserIdList,e.AssertRules.ARRAY),e.assert("options.isVoipPush",null==i?void 0:i.isVoipPush,e.AssertRules.BOOLEAN),e.assert("options.canIncludeExpansion",null==i?void 0:i.canIncludeExpansion,e.AssertRules.BOOLEAN),e.assert("options.expansion",null==i?void 0:i.expansion,e.AssertRules.OBJECT),e.assert("options.pushConfig",null==i?void 0:i.pushConfig,e.AssertRules.OBJECT),u="conversationType:"+o+",targetId:"+c,r.debug("send message ->"+u),l=function(e,t,o){var s=e.isStatusMessage,r=e.disableNotification,a=e.pushContent,i=e.pushData,c=e.isMentioned,d=e.mentionedType,u=e.mentionedUserIdList,l=e.directionalUserIdList,g=e.isVoipPush,p=e.canIncludeExpansion,f=e.expansion,m=e.isFilerWhiteBlacklist,C=e.pushConfig,v=o.channelId;return n({isStatusMessage:s,disableNotification:r,pushContent:a,pushData:i,isMentioned:c,mentionedType:d,mentionedUserIdList:u,directionalUserIdList:l,isVoipPush:g,canIncludeExpansion:p,expansion:f,isFilerWhiteBlacklist:m,pushConfig:C,channelId:v||""},t)}(i,a,t),g={isMentioned:!!i.isMentioned,content:a.content,messageType:a.messageType,isPersited:a.isPersited||!1,isCounted:a.isCounted||!1,disableNotification:!!(null==i?void 0:i.disableNotification),canIncludeExpansion:!!(null==i?void 0:i.canIncludeExpansion),expansion:(null==i?void 0:i.expansion)||null,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,senderUserId:G.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:e.MessageDirection.SEND,receivedTime:0,isStatusMessage:i.isStatusMessage||!1,receivedStatus:e.ReceivedStatus.UNREAD,isOffLineMessage:!1,pushConfig:null==i?void 0:i.pushConfig},o!==e.ConversationType.ULTRA_GROUP&&(g.isOffLineMessage=!1),p=function(t){g.messageId=t;try{(null==i?void 0:i.onSendBefore)&&i.onSendBefore(w(g))}catch(t){e.logger.error('Callback method "onSendBefore" execution error',t)}},f=e.logger.ID(),e.logger.info(e.LogTagId.A_SEND_MSG_T,{messageType:a.messageType,conversationType:o,targetId:c,channelId:d},{traceId:f}),[4,G.imClient.context.sendMessage(o,c,l,p,f)]);case 1:return m=s.sent(),C=m.code,v=m.data,(C===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_SEND_MSG_R,{code:C,messageUId:v?v.messageUId:"",messageId:v?v.messageId:""},{traceId:f}),C===e.ErrorCode.SUCCESS?(h=w(v),[2,{code:C,data:h}]):(r.warn("send message fail ->"+C+":"+B[C]+","+u),g.sentTime=(null==v?void 0:v.sentTime)||0,[2,{code:C,msg:B[C],data:w(g)}])}}))}))}function Be(t,n){return function(o,s,r,a){e.assert("sendOptions.contentDisposition",null==a?void 0:a.contentDisposition,(function(e){return["inline","attachment"].includes(e)}));var i={contentDisposition:null==a?void 0:a.contentDisposition};if(a&&"thumbnailConfig"in a){var c=null==a?void 0:a.thumbnailConfig;e.assert("sendOptions.maxHeight",null==c?void 0:c.maxHeight,e.AssertRules.NUMBER),e.assert("sendOptions.maxWidth",null==c?void 0:c.maxWidth,e.AssertRules.NUMBER),e.assert("sendOptions.quality",null==c?void 0:c.quality,e.AssertRules.NUMBER),e.assert("sendOptions.scale",null==c?void 0:c.scale,e.AssertRules.NUMBER),i.thumbnailConfig=c}return new Promise((function(c){var d=e.logger.ID();e.logger.info(e.LogTagId.L_MEDIA_UPLOAD_T,{filesize:s.file.size,type:t},{traceId:d}),Le(s.file,t,{onProgress:null==r?void 0:r.onProgress,onSuccess:function(t){var i,u=(null===(i=null==r?void 0:r.onComplete)||void 0===i?void 0:i.call(r,{url:t.downloadUrl}))||n(t,s);t&&t.downloadUrl&&e.logger.info(e.LogTagId.L_MEDIA_UPLOAD_R,{downurl:t.downloadUrl,code:e.ErrorCode.SUCCESS},{traceId:d}),De(o,u,a).then(c)},onFail:function(t){e.logger.warn(e.LogTagId.L_MEDIA_UPLOAD_R,{code:e.ErrorCode.UPLOAD_FILE_FAILED},{traceId:d}),c({code:e.ErrorCode.UPLOAD_FILE_FAILED,msg:t||e.ErrorCode[e.ErrorCode.UPLOAD_FILE_FAILED]})}},i)}))}}var ke=Be(e.FileType.FILE,(function(e,t){return new ee({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),He=Be(e.FileType.IMAGE,(function(e,t){return new Y({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Fe=Be(e.FileType.AUDIO,(function(e,t){return new X({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),qe=Be(e.FileType.SIGHT,(function(e,t){return new Q({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));Be(e.FileType.COMBINE_HTML,(function(e,t){return new $({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Ve=Object.freeze({__proto__:null,getAllConversationList:function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("channelId",t,e.AssertRules.ONLY_STRING),r.info("getAllConversationList -> channelId: ".concat(t)),e.isUndefined(t)?[4,G.imClient.context.getConversationListWithAllChannel()]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),[3,4];case 2:return[4,G.imClient.context.getConversationList(void 0,void 0,void 0,void 0,t)];case 3:n=s.sent(),s.label=4;case 4:return o=n.code,a=n.data,o===e.ErrorCode.SUCCESS&&a?(i=a.map((function(e){return L(e)})),[2,{code:o,data:i}]):(r.warn("getAllConversationList fail -> code: ".concat(o," channelId: ").concat(t)),[2,{code:o,msg:B[o]}])}}))}))},getConversationList:function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,d,u,l;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("startTime",t,e.AssertRules.NUMBER,!0),e.assert("count",n,e.AssertRules.NUMBER,!0),e.assert("channelId",a,e.AssertRules.ONLY_STRING),o="startTime: ".concat(t,", count: ").concat(n,", channelId: ").concat(a),r.info("getConversationList -> ".concat(o)),e.isUndefined(a)?[4,G.imClient.context.getConversationListWithAllChannelByPage(t,n)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return i=s.sent(),[3,4];case 2:return c=[1,2,3,5,6,7,8],[4,G.imClient.context.getConversationsByPage(c,t,n,a)];case 3:i=s.sent(),s.label=4;case 4:return d=i.code,u=i.data,d===e.ErrorCode.SUCCESS&&u?(l=u.map((function(e){return L(e)})),[2,{code:d,data:l}]):(r.warn("getConversationList fail -> code: ".concat(d," ").concat(o)),[2,{code:d,msg:B[d]}])}}))}))},searchConversationByContent:function t(n,a,i){return o(this,void 0,void 0,(function(){var o,c,d,u,l;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("messageTypes",a,e.AssertRules.ARRAY,!0),e.assert("channelId",i,e.AssertRules.ONLY_STRING),a.forEach((function(t){e.assert("messageType",t,e.AssertRules.STRING,!0)})),o="keyword: ".concat(n,", messageTypes: ").concat(JSON.stringify(a),", channelId: ").concat(i),r.info("searchConversationByContent -> ".concat(t)),e.isUndefined(i)?[4,G.imClient.context.searchConversationByContentWithAllChannel(n,a)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return c=s.sent(),[3,4];case 2:return[4,G.imClient.context.searchConversationByContent(n,a,i)];case 3:c=s.sent(),s.label=4;case 4:return d=c.code,u=c.data,d===e.ErrorCode.SUCCESS&&u?(l=u.map((function(e){return L(e)})),[2,{code:d,data:l}]):(r.warn("searchConversationByContent fail -> code: ".concat(d," ").concat(o)),[2,{code:d,msg:B[d]}])}}))}))},searchMessages:function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,d,u,l,g,p,f,m,C;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("startTime",a,e.AssertRules.NUMBER,!0),e.assert("count",i,e.AssertRules.NUMBER,!0),o="conversation: ".concat(JSON.stringify(t),", keyword: ").concat(n,", timestamp: ").concat(a,", count: ").concat(i),r.info("searchMessages -> ".concat(o)),c=t.targetId,d=t.conversationType,u=t.channelId,e.isUndefined(u)?[4,G.imClient.context.searchMessageByContentWithAllChannel(d,c,n,a,i)]:[3,2]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return l=s.sent(),[3,4];case 2:return 0,[4,G.imClient.context.searchMessageByContent(d,c,n,a,i,0,u)];case 3:l=s.sent(),s.label=4;case 4:return g=l.code,p=l.data,g===e.ErrorCode.SUCCESS&&p?(f=p.messages,m=p.count,C=f.map((function(e){return w(e)})),[2,{code:g,data:{messages:C,count:m}}]):(r.warn("searchMessages fail -> code: ".concat(g," ").concat(o)),[2,{code:g,msg:B[g]}])}}))}))},searchMessageInTimeRange:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g,p,f,m;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("option",n,e.AssertRules.OBJECT,!0),e.assert("option.keyword",n.keyword,e.AssertRules.STRING,!0),e.assert("option.startTime",n.startTime,e.AssertRules.NUMBER,!0),e.assert("option.endTime",n.endTime,e.AssertRules.NUMBER,!0),e.assert("option.offset",n.offset,e.AssertRules.NUMBER),e.assert("option.limit",n.limit,e.AssertRules.NUMBER),o="conversation: ".concat(JSON.stringify(t),", option: ").concat(JSON.stringify(n)),r.info("searchMessageInTimeRange -> ".concat(o)),a=t.conversationType,i=t.targetId,c=n.keyword,d=n.startTime,u=n.endTime,l=n.offset,g=n.limit,l=l||0,g=g||5,[4,G.imClient.context.searchMessageByContentInTimeRangeWithAllChannel(a,i,c,d,u,l,g)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return p=s.sent(),f=p.code,m=p.data,f===e.ErrorCode.SUCCESS&&m?[2,{code:f,data:{messages:m.messages.map((function(e){return w(e)}))}}]:(r.warn("searchMessageInTimeRange fail -> code: ".concat(f,", ").concat(o)),[2,{code:f}])}}))}))},getHistoryMessagesByMessageTypes:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g,p,f,m,C,v,h,I;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("option",n,e.AssertRules.OBJECT,!0),o=n.count,a=n.timestamp,i=n.order,c=n.messageTypes,e.assert("option.count",o,e.AssertRules.NUMBER),e.assert("option.timestamp",a,e.AssertRules.NUMBER),e.assert("option.order",i,(function(e){return[0,1].includes(e)})),e.assert("option.messageTypes",c,e.AssertRules.ARRAY,!0),c.forEach((function(t){e.assert("option.messageType",t,e.AssertRules.STRING,!0)})),d="conversation: ".concat(JSON.stringify(t),", option: ").concat(JSON.stringify(n)),r.info("getHistoryMessagesByMessageTypes -> ".concat(d)),u=t.conversationType,l=t.targetId,g=t.channelId,o||(o=20),a||(a=0),i||(i=0),g||(g=""),[4,G.imClient.context.getHistoryMessagesByObjectNames(u,l,a,o,c,i,g)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return p=s.sent(),f=p.code,m=p.data,f===e.ErrorCode.SUCCESS?(v=(C=m).list,h=C.hasMore,I=v.map((function(e){return w(e)})),[2,{code:f,data:{messages:I,hasMore:h}}]):(r.warn("getHistoryMessagesByMessageTypes fail -> code: ".concat(f," ").concat(d)),[2,{code:f,msg:B[f]}])}}))}))},setMessageStatusToRead:function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation",t,e.AssertRules.CONVERSATION,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),o="conversation: ".concat(JSON.stringify(t),", timestamp: ").concat(n),r.info("updateSentMsgReceiptStatus -> ".concat(o)),a=t.conversationType,i=t.targetId,c=t.channelId,[4,G.imClient.context.setMessageStatusToRead(a,i,n,c)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,s.sent()]}}))}))},setMessageReceivedStatus:function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("receivedStatus",n,(function(t){return!e.isUndefined(e.ReceivedStatus[t])}),!0),r.info("setMessageReceivedStatus -> messageId: ".concat(t,", receivedStatus: ").concat(n)),[4,G.imClient.context.setMessageReceivedStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},setMessageSentStatus:function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("sentStatus",n,(function(t){return!e.isUndefined(exports.SentStatus[t])}),!0),r.info("setMessageSentStatus ->messageId: ".concat(t,", sentStatus: ").concat(n)),[4,G.imClient.context.setMessageSentStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},setMessageContent:function(t,n,a){return void 0===a&&(a=""),o(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("content",n,e.AssertRules.OBJECT,!0),e.assert("messageType",a,e.AssertRules.ONLY_STRING,!0),r.info("setMessageSentStatus ->messageId: ".concat(t,", messageType: ").concat(a)),[4,G.imClient.context.setMessageContent(t,n,a)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:o.sent()}]}}))}))},deleteMessages:function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.usingCppEngine()?(e.assert("messageIds",t,e.AssertRules.ARRAY,!0),t.forEach((function(t){e.assert("messageId",t,e.AssertRules.NUMBER,!0)})),r.info("deleteMessages ->messageIds: ".concat(JSON.stringify(t))),[4,G.imClient.context.deleteMessages(t)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return[2,{code:n.sent()}]}}))}))},clearMessages:function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.usingCppEngine()?(r.info("clearMessages ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearMessages(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(n=o.sent())===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("clearMessages ->code:"+n+",targetId:"+t.targetId),[2,{code:n,msg:B[n]}])}}))}))},deleteMessagesByTimestamp:function(t,n,a){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),e.assert("cleanSpace",a,e.AssertRules.BOOLEAN),[4,G.imClient.context.deleteMessagesByTimestamp(t.conversationType,t.targetId,n,a,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("deleteMessagesByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},insertMessage:function(t,n,a){return void 0===a&&(a={}),o(this,void 0,void 0,(function(){var o,i,c,d,u,l,g,p,f,m,C,v,h,I,T,E;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(o=n.senderUserId,i=n.messageType,c=n.content,d=n.messageDirection,u=n.messageUId,l=n.canIncludeExpansion,g=n.expansion,p=n.disableNotification,f=n.sentTime,m=n.sentStatus,r.info("insertMessage ->targetId:"+t.targetId+",conversationType:"+t.conversationType),C=a.isUnread,v=a.searchContent,h={senderUserId:o,messageType:i,content:c,messageDirection:d,sentTime:f,sentStatus:m,searchContent:v,isUnread:C,messageUId:u,disableNotification:p,canIncludeExpansion:l,expansionMsg:JSON.stringify(g),channelId:t.channelId||""},[4,G.imClient.context.insertMessage(t.conversationType,t.targetId,h)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return I=s.sent(),T=I.code,E=I.data,T===e.ErrorCode.SUCCESS?[2,{code:T,data:w(E)}]:(r.warn("insertMessage ->code:"+T+",targetId:"+t.targetId),[2,{code:T,msg:B[T]}])}}))}))},clearLocalData:function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(r.info("clearData -> "),[4,G.imClient.context.clearData()]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return t=s.sent(),n=t.code,o=t.data,[2,{code:n,data:o}]}}))}))}}),ze=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n};e.VersionManage.add("imlib-next","5.4.4"),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return e.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return e.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return e.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return e.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return e.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return e.FileType}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return e.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return e.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return e.LogTagId}}),Object.defineProperty(exports,"MentionedType",{enumerable:!0,get:function(){return e.MentionedType}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return e.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return e.MessageDirection}}),Object.defineProperty(exports,"NotificationLevel",{enumerable:!0,get:function(){return e.NotificationLevel}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return e.NotificationStatus}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return e.ReceivedStatus}}),Object.defineProperty(exports,"UltraGroupChannelType",{enumerable:!0,get:function(){return e.UltraGroupChannelType}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return e.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return e.logger}}),exports.BaseMessage=K,exports.CombineMessage=$,exports.ConnectType={COMET:"comet",WEBSOCKET:"websocket"},exports.FileMessage=ee,exports.GIFMessage=te,exports.HQVoiceMessage=X,exports.ImageMessage=Y,exports.LocationMessage=oe,exports.MentionedInfoBody=ze,exports.MessageType={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"},exports.ReferenceMessage=se,exports.RichContentMessage=re,exports.SightMessage=Q,exports.TextMessage=Z,exports.VoiceMessage=ne,exports.__addSDKVersion=function(t,n){e.VersionManage.add(t,n)},exports.addConversationsToTag=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("addTagForConversations ->tagId:"+t),[4,G.imClient.context.addTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("addTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.addEventListener=function(e,t,n){P.on(e,t,n)},exports.addTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tag.tagId",t.tagId,e.AssertRules.STRING,!0),e.assert("tag.tagId",t.tagId,(function(e){return e.length<=10})),e.assert("tag.tagName",t.tagName,(function(e){return e.length<=15})),e.assert("tag.tagName",t.tagName,e.AssertRules.STRING,!0),r.info("createTag ->tagId:"+t.tagId+",tagName:"+t.tagName),[4,G.imClient.context.createTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("createTag ->code:"+n+",tagId:"+t.tagId),[2,{code:n,msg:B[n]}])}}))}))},exports.addToBlacklist=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("addToBlacklist -> userId: ".concat(t)),[4,G.imClient.context.addToBlacklist(t)];case 1:return[2,{code:n.sent()}]}}))}))},exports.bindRTCRoomForChatroom=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return[4,G.imClient.context.bindRTCRoomForChatroom(e)];case 1:return[2,{code:t=n.sent(),msg:B[t]}]}}))}))},exports.clearAllMessagesUnreadStatus=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,G.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))},exports.clearEventListeners=function(){P.clear()},exports.clearHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",n,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("clear message ->"+o),[4,G.imClient.context.deleteRemoteMessageByTimestamp(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("clear message ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:e.ErrorCode.SUCCESS}]}}))}))},exports.clearMessages=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return b("RongIMLib.clearMessages","RongIMLib.ElectronExtension.clearMessages"),e.usingCppEngine()?(r.info("clearMessages ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearMessages(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(n=o.sent())===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("clearMessages ->code:"+n+",targetId:"+t.targetId),[2,{code:n,msg:B[n]}])}}))}))},exports.clearMessagesUnreadStatus=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.clearUnreadCount(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("clear unreadMsgNum ->"+o),n!==e.ErrorCode.SUCCESS?(r.warn("clear unreadMsgNum fail ->"+n+":"+B[n]+","+o),[2,{code:n,msg:B[n]}]):[2,{code:n}]}}))}))},exports.clearTextMessageDraft=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),n="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("delete draft ->"+n),[4,G.imClient.context.clearConversationMessageDraft(t.conversationType,t.targetId,t.channelId)];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("delete draft fail ->"+o+":"+B[o]+","+n),[2,{code:o,msg:B[o]}])}}))}))},exports.clearUnreadCountByTimestamp=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(r.info("clearUnreadCountByTimestamp ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.clearUnreadCountByTimestamp(t.conversationType,t.targetId,n,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("clearUnreadCountByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.connect=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("token",t,e.AssertRules.STRING,!0),r.warn("RongIMLib Version: ".concat("5.4.4",", Commit: ").concat("7424002f9596c7e72553dfa017dfee5e8f975906")),o=e.logger.ID(),e.logger.info(e.LogTagId.A_CONNECT_T,{token:t,reconnectKickEnable:n},{traceId:o}),[4,P.context.connect(t,!1,n,o)];case 1:return a=s.sent(),(a.code===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_CONNECT_R,{code:a.code,userId:a.userId},{traceId:o}),a.code===e.ErrorCode.SUCCESS?[2,{code:a.code,data:{userId:a.userId}}]:[2,{code:a.code,msg:B[a.code]}]}}))}))},exports.deleteLocalMessagesByTimestamp=function(t,n,a){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.deleteLocalMessagesByTimestamp","RongIMLib.ElectronExtension.deleteMessagesByTimestamp"),e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("timestamp",n,e.AssertRules.NUMBER,!0),e.assert("cleanSpace",a,e.AssertRules.BOOLEAN),[4,G.imClient.context.deleteMessagesByTimestamp(t.conversationType,t.targetId,n,a,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),e.logger.debug(e.LogTagId.A_DELETE_MESSAGES_S,{code:o,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,timestamp:n}),o===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.deleteMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options",n,(function(t){return e.isArray(t)&&t.length}),!0),n.forEach((function(t){e.assert("options.messageUId",t.messageUId,e.AssertRules.STRING,!0),e.assert("options.sentTime",t.sentTime,e.AssertRules.NUMBER,!0),e.assert("options.messageDirection",t.messageDirection,(function(e){return 1===e||2===e}),!0)})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("delete messages ->"+o),[4,G.imClient.context.deleteRemoteMessage(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("delete message fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:e.ErrorCode.SUCCESS}]}}))}))},exports.disconnect=function(){return e.logger.info(e.LogTagId.A_DISCONNECT_O,{}),P.context.disconnect()},exports.electronExtension=Ve,exports.forceRemoveChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),z(n),o="id:"+t,r.debug("force remove chatroom entry ->"+o),[4,G.imClient.context.forceRemoveChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("force remove chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.forceSetChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),V(n),o="id:"+t,r.debug("force set chatroom entry ->"+o),[4,G.imClient.context.forceSetChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("force set chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.getAllChatRoomEntries=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return n="id:"+t,r.debug("get all chatroom entries->"+n),[4,G.imClient.context.getAllChatroomEntries(t)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS&&i?[2,{code:a,data:i}]:(r.warn("get all chatroom entries fail ->code+:"+B[a]+","+n),[2,{code:a,msg:B[a]}])}}))}))},exports.getAllConversationState=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,G.imClient.context.getAllConversationState()]}))}))},exports.getAllUltraGroupUnreadCount=function(){return o(this,void 0,void 0,(function(){var t,n,o,a;return s(this,(function(s){switch(s.label){case 0:return t="getAllUltraGroupUnreadCount",[4,G.imClient.context.getAllUltraGroupUnreadCount()];case 1:return n=s.sent(),o=n.code,a=n.data,r.debug(t),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("".concat(t," fail ->").concat(o,": ").concat(B[o])),[2,{code:o,msg:B[o]}])}}))}))},exports.getAllUltraGroupUnreadMentionedCount=function(){return o(this,void 0,void 0,(function(){var t,n,o,a;return s(this,(function(s){switch(s.label){case 0:return t="getAllUltraGroupUnreadMentionedCount",!0,[4,G.imClient.context.getAllUltraGroupUnreadCount(true)];case 1:return n=s.sent(),o=n.code,a=n.data,r.debug(t),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("".concat(t," fail ->").concat(o,": ").concat(B[o])),[2,{code:o,msg:B[o]}])}}))}))},exports.getAllUnreadMentionedCount=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return r.debug("getAllUnreadMentionedCount"),[2,G.imClient.context.getAllUnreadMentionedCount()]}))}))},exports.getBlacklist=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return r.info("getBlacklist -> "),[4,G.imClient.context.getBlacklist()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS&&o?[2,{code:n,data:o}]:(r.warn("getBlacklist fail -> code: ".concat(n)),[2,{code:n}])}}))}))},exports.getBlacklistStatus=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("getBlacklistStatus -> userId: ".concat(t)),[4,G.imClient.context.getBlacklistStatus(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:0===a}]:(r.warn("getBlacklistStatus fail -> code: ".concat(o,", userId: ").concat(t)),[2,{code:o}])}}))}))},exports.getBlockUltraGroupList=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return[4,G.imClient.context.getBlockUltraGroupList()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:o}]:(r.warn("get block ultragroup ->"+n+":"+B[n]),[2,{code:n,msg:B[n]}])}}))}))},exports.getBlockedConversationList=function(){return o(this,void 0,void 0,(function(){var e,t,n;return s(this,(function(o){switch(o.label){case 0:return[4,G.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))},exports.getChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("key",n,(function(t){return e.isString(t)&&/[\w+=-]+/.test(t)&&t.length<=128}),!0),o="id:"+t,r.debug("get chatroom entry->"+o),[4,G.imClient.context.getChatroomEntry(t,n)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?[2,{code:i,data:c}]:(r.warn("get chatroom entry fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getChatRoomInfo=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER),e.assert("options.order",n.order,(function(e){return[0,1,2].includes(e)})),o="id:"+t,r.debug("get chatroom info ->"+o),[4,G.imClient.context.getChatroomInfo(t,n.count,n.order)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?[2,{code:i,data:c}]:(r.warn("get chatroom info fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getChatroomHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",n.count,e.AssertRules.NUMBER),e.assert("options.order",n.order,(function(e){return 0===e||1===e})),o="id:"+t,r.debug("get chatroom history message->"+o),[4,G.imClient.context.getChatRoomHistoryMessages(t,n.count,n.order,n.timestamp)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?(d=c.list.map((function(e){return w(e)})),[2,{code:i,data:{list:d,hasMore:!!c.hasMore}}]):(r.warn("get chatroom history message fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getConnectionStatus=function(){return P.context.getConnectionStatus()},exports.getConversation=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getConversation(t.conversationType,t.targetId,t.channelId||"")];case 1:return n=s.sent(),o=n.code,a=n.data,o!==e.ErrorCode.SUCCESS?(r.warn("getConversation ->code:"+o+", targetId:"+t.targetId),[2,{code:o,msg:B[o]}]):[2,{code:o,data:a?L(a):null}]}}))}))},exports.getConversationList=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return r.debug("get conversation list ->"),[4,G.imClient.context.getConversationList(null==t?void 0:t.count,void 0,null==t?void 0:t.startTime,null==t?void 0:t.order,n)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS&&i?[2,{code:0,data:i.map((function(e){return L(e)}))}]:(r.warn("get conversation list fail ->"+a+":"+B[a]),[2,{code:a,msg:B[a]}])}}))}))},exports.getConversationNotificationLevel=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return n=F(t,"getConversationNotificationLevel"),[4,G.imClient.context.getConversationNotificationLevel(t.conversationType,t.targetId,t.channelId)];case 1:return o=s.sent(),a=o.code,i=o.data,a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("getConversationNotificationLevel fail -> ".concat(a," : ").concat(B[a]," , ").concat(n)),[2,{code:a,msg:B[a]}])}}))}))},exports.getConversationNotificationStatus=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.info("getConversationNotificationStatus ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.getConversationNotificationStatus(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("getConversationNotificationStatus ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.getConversationsFromTagByPage=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("count",n,e.AssertRules.NUMBER,!0),e.assert("startTime",a,e.AssertRules.NUMBER,!0),r.info("getConversationListByTag ->tagId:"+t),[4,G.imClient.context.getConversationListByTag(t,a,n)];case 1:return o=s.sent(),i=o.code,c=o.data,i===e.ErrorCode.SUCCESS?[2,{code:i,data:c}]:(r.warn("getConversationListByTag ->code:"+i+",tagId:"+t),[2,{code:i,msg:B[i]}])}}))}))},exports.getCurrentUserId=function(){return P.context.getCurrentUserId()},exports.getDeviceId=function(){return P.context.getDeviceId()},exports.getFileToken=function(t,n,o,s){return new Promise((function(r){G.imClient.context.getFileToken(t,n,o,s).then((function(t){r({code:e.ErrorCode.SUCCESS,data:t})})).catch((function(e){r({code:e,msg:B[e]})}))}))},exports.getFileUrl=Ge,exports.getFirstUnreadMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?(e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getFirstUnreadMessage(t.conversationType,t.targetId,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("insertMessage ->code:"+o+",targetId:"+t.targetId),[2,{code:o,msg:B[o]}])}}))}))},exports.getHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",null==n?void 0:n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",null==n?void 0:n.count,e.AssertRules.NUMBER),e.assert("options.order",null==n?void 0:n.order,(function(e){return 0===e||1===e})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get history message ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_GET_HISTORY_MSG_T,{targetId:t.targetId,conversationType:t.conversationType,channelId:t.channelId,timestamp:null==n?void 0:n.timestamp,count:null==n?void 0:n.count},{traceId:a}),[4,G.imClient.context.getHistoryMessage(t.conversationType,t.targetId,null==n?void 0:n.timestamp,null==n?void 0:n.count,null==n?void 0:n.order,null==t?void 0:t.channelId,"",a)];case 1:return i=s.sent(),c=i.code,d=i.data,c===e.ErrorCode.SUCCESS&&d?(u=d.list.map((function(e){return w(e)})),e.logger.info(e.LogTagId.A_GET_HISTORY_MSG_R,{code:c,messageLength:u.length},{traceId:a}),[2,{code:c,data:{list:u,hasMore:d.hasMore}}]):(e.logger.warn(e.LogTagId.A_GET_HISTORY_MSG_R,{code:c,messageUIds:""},{traceId:a}),r.warn("get history message fail ->"+c+":"+B[c]+","+o),[2,{code:c,msg:B[c]}])}}))}))},exports.getMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.usingCppEngine()?[4,G.imClient.context.getMessage(t)]:[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:w(a)}]:(r.warn("getMessage ->code:"+o+",messageId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.getMessageReader=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("messageUId",n,e.AssertRules.STRING,!0),o="messageUId:"+n+",targetId:"+t,r.debug("get message reader ->"+o),[4,G.imClient.context.getMessageReader(t,n,a)];case 1:return i=s.sent(),c=i.code,d=i.data,c===e.ErrorCode.SUCCESS?[2,{code:c,data:d}]:(r.warn("get message reader fail ->"+c+":"+B[c]+","+o),[2,{code:c,msg:B[c]}])}}))}))},exports.getRemoteHistoryMessages=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.timestamp",null==n?void 0:n.timestamp,e.AssertRules.NUMBER),e.assert("options.count",null==n?void 0:n.count,e.AssertRules.NUMBER),e.assert("options.order",null==n?void 0:n.order,(function(e){return 0===e||1===e})),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get history message ->"+o),[4,G.imClient.context.getRemoteHistoryMessages(t.conversationType,t.targetId,(null==n?void 0:n.timestamp)||0,(null==n?void 0:n.count)||20,(null==n?void 0:n.order)||0,t.channelId||"")];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS&&c?(d=c.list.map((function(e){return w(e)})),[2,{code:i,data:{list:d,hasMore:c.hasMore}}]):(r.warn("get history message fail ->"+i+":"+B[i]+","+o),[2,{code:i,msg:B[i]}])}}))}))},exports.getServerTime=function(){return P.context.getServerTime()},exports.getTags=function(){return o(this,void 0,void 0,(function(){var t,n,o;return s(this,(function(s){switch(s.label){case 0:return[4,G.imClient.context.getTagList()];case 1:return t=s.sent(),n=t.code,o=t.data,n===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:o}]:(r.warn("getTagList ->code:"+n),[2,{code:n,msg:B[n]}])}}))}))},exports.getTagsFromConversation=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER),e.assert("targetId",t.targetId,e.AssertRules.STRING),e.assert("channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.info("getTagsForConversation ->targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.getTagsForConversation(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:[2,{code:o,msg:B[o]}]}}))}))},exports.getTextMessageDraft=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getConversationMessageDraft(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,i="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get draft ->"+i),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a||""}]:(r.warn("get draft fail ->"+o+":"+B[o]+","+i),[2,{code:o,msg:B[o]}])}}))}))},exports.getTopConversationList=function(){return o(this,void 0,void 0,(function(){var e,t,n;return s(this,(function(o){switch(o.label){case 0:return[4,G.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))},exports.getTotalUnreadCount=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u;return s(this,(function(s){switch(s.label){case 0:if(r.debug("get total unread count -> ConversationType:"+JSON.stringify(n)+" includeMuted:"+t),e.assert("includeMuted",t,e.AssertRules.BOOLEAN,!1),e.assert("conversationTypes",n,e.AssertRules.ARRAY,!1),n)for(o=0,a=n;o<a.length;o++)i=a[o],e.assert("conversationType",i,e.isValidConversationType);return[4,G.imClient.context.getTotalUnreadCount("",n,t)];case 1:return c=s.sent(),d=c.code,u=c.data,d===e.ErrorCode.SUCCESS?[2,{code:d,data:u}]:(r.warn("getTotalUnreadCount fail ->"+d+":"+B[d]),[2,{code:d,msg:B[d]}])}}))}))},exports.getUltraGroupDefaultNotificationLevel=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),n="getUltraGroupDefaultNotificationLevel",o="targetId: ".concat(t.targetId,", channelId: ").concat(t.channelId),r.debug("".concat(n," -> ").concat(o)),[4,G.imClient.context.getUltraGroupDefaultNotificationLevel(t.targetId,t.channelId)];case 1:return a=s.sent(),i=a.code,c=a.data,i===e.ErrorCode.SUCCESS?[2,{code:i,data:c}]:(r.warn("".concat(n," fail -> ").concat(i," : ").concat(B[i]," , ").concat(o)),[2,{code:i,msg:B[i]}])}}))}))},exports.getUltraGroupList=function(t){return void 0===t&&(t={}),o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!1),e.assert("options.channelType",t.channelType,(function(t){return void 0!==e.UltraGroupChannelType[t]}),!1),[4,G.imClient.context.getUltraGroupList(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:a}]:(r.warn("get ultragroup ->"+o+":"+B[o]),[2,{code:o,msg:B[o]}])}}))}))},exports.getUltraGroupMessageListByMessageUId=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("msgs",n,e.AssertRules.ARRAY,!0),o=t.targetId,a=t.conversationType,i=t.channelId,c=[],n.forEach((function(e){var t=e.sendTime,n=e.messageUId;c.push({sendTime:t,messageUId:n,channelId:i})})),d={targetId:o,conversationType:a,messages:c},[4,G.imClient.context.getUltraGroupMessageListByMessageUId(d)];case 1:return u=s.sent(),l=u.code,g=u.data,l===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:g}]:(r.warn("get UltraGroup MessageList by messageUId ->"+l+":"+B[l]),[2,{code:l,msg:B[l]}])}}))}))},exports.getUltraGroupUnreadCountByTargetId=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t,e.AssertRules.STRING,!0),n="getUltraGroupUnreadCountByTargetId",[4,G.imClient.context.getUltraGroupUnreadCountByTargetId(t)];case 1:return o=s.sent(),a=o.code,i=o.data,c="targetId: ".concat(t),r.debug("".concat(n," -> ").concat(c)),a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("".concat(n," fail -> ").concat(a,": ").concat(B[a],", ").concat(c)),[2,{code:a,msg:B[a]}])}}))}))},exports.getUltraGroupUnreadMentionedCountByTargetId=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("cotargetIdntent",t,e.AssertRules.STRING,!0),r.debug("get UltraGroup unreadMentionedCount by targetId:"+t),[4,G.imClient.context.getUltraGroupUnreadMentionedCountByTargetId(t)];case 1:return n=s.sent(),o=n.code,a=n.data,o===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:a}]:(r.warn("get UltraGroup unreadMentionedCount by targetId error ->"+o+":"+B[o]),[2,{code:o,msg:B[o]}])}}))}))},exports.getUnreadCount=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.getUnreadCount(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o=n.code,a=n.data,i="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("get unreadCount ->"+i),o===e.ErrorCode.SUCCESS?[2,{code:o,data:a}]:(r.warn("get unreadCount fail ->"+o+":"+B[o]+","+i),[2,{code:o,msg:B[o]}])}}))}))},exports.getUnreadCountByTag=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("containMuted",n,e.AssertRules.BOOLEAN,!0),r.info("getUnreadCountByTag ->tagId:"+t),[4,G.imClient.context.getUnreadCountByTag(t,n)];case 1:return o=s.sent(),a=o.code,i=o.data,r.info(a,i),a===e.ErrorCode.SUCCESS?[2,{code:a,data:i}]:(r.warn("getUnreadCountByTag ->code:"+a+",tagId:"+t),[2,{code:a,msg:B[a]}])}}))}))},exports.getUnreadMentionedCount=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),r.debug("getUnreadMentionedCount"+t.targetId+",channelId:"+t.channelId),[2,G.imClient.context.getUnreadMentionedCount(t)]}))}))},exports.getUnreadMentionedMessages=function(t){if(!e.usingCppEngine())return{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]};e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0);var n=G.imClient.context.getUnreadMentionedMessages(t.conversationType,t.targetId),o=[];return n&&n.length&&n.forEach((function(e){return o.push(w(e))})),{code:e.ErrorCode.SUCCESS,data:o}},exports.init=function(e){P=P||new G(e)},exports.insertMessage=function(t,n,a){return void 0===a&&(a={}),o(this,void 0,void 0,(function(){var o,i,c,d,u,l,g,p,f,m,C,v,h,I,T,E;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.insertMessage","RongIMLib.ElectronExtension.insertMessage"),e.usingCppEngine()?(o=n.senderUserId,i=n.messageType,c=n.content,d=n.messageDirection,u=n.messageUId,l=n.canIncludeExpansion,g=n.expansion,p=n.disableNotification,f=n.sentTime,m=n.sentStatus,r.info("insertMessage ->targetId:"+t.targetId+",conversationType:"+t.conversationType),C=a.isUnread,v=a.searchContent,h={senderUserId:o,messageType:i,content:c,messageDirection:d,sentTime:f,sentStatus:m,searchContent:v,isUnread:C,messageUId:u,disableNotification:p,canIncludeExpansion:l,expansionMsg:JSON.stringify(g),channelId:t.channelId||""},[4,G.imClient.context.insertMessage(t.conversationType,t.targetId,h)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return I=s.sent(),T=I.code,E=I.data,T===e.ErrorCode.SUCCESS?[2,{code:T,data:w(E)}]:(r.warn("insertMessage ->code:"+T+",targetId:"+t.targetId),[2,{code:T,msg:B[T]}])}}))}))},exports.installPlugin=function(e,t){return null==P?void 0:P.context.install(e,t)},exports.joinChatRoom=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER,!0),o="id:"+t,r.debug("join chatroom ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_JOIN_CHATROOM_T,{chatroomId:t,count:n.count,joinExist:!1},{traceId:a}),[4,G.imClient.context.joinChatroom(t,n.count,a)];case 1:return i=s.sent(),(i===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_JOIN_CHATROOM_R,{code:i,timestamp:(new Date).getTime()},{traceId:a}),i!==e.ErrorCode.SUCCESS?(r.warn("join chatroom fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))},exports.joinExistChatRoom=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.count",n.count,e.AssertRules.NUMBER,!0),o="id:"+t,r.debug("join exist chatroom ->"+o),a=e.logger.ID(),e.logger.info(e.LogTagId.A_JOIN_CHATROOM_T,{chatroomId:t,count:n.count,joinExist:!0},{traceId:a}),[4,G.imClient.context.joinExistChatroom(t,n.count,a)];case 1:return i=s.sent(),(i===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_JOIN_CHATROOM_R,{code:i,timestamp:(new Date).getTime()},{traceId:a}),i!==e.ErrorCode.SUCCESS?(r.warn("join exist chatroom fail ->code:"+B[i]+","+o),[2,{code:i,msg:B[i]}]):[2,{code:i}]}}))}))},exports.modifyMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g,p,f;return s(this,(function(s){switch(s.label){case 0:return e.assert("content",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.senderUserId,d=n.sentTime,u=n.canIncludeExpansion,l=n.channelId,g="conversationType:"+o+",targetId:"+a+",channelId:"+l+",messageUId:"+i,r.debug("update ultragroup message expansion ->"+g),p={targetId:a,channelId:l,conversationType:o,fromUserId:c,sendTime:d,canIncludeExpansion:u,messageUId:i,content:t},[4,G.imClient.context.modifyMessage(p)];case 1:return(f=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("modify ultraGroup message ->"+f+":"+B[f]),[2,{code:f,msg:B[f]}])}}))}))},exports.onceEventListener=function(e,t,n){P.once(e,t,n)},exports.quitChatRoom=function(t){return o(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return n="id:"+t,r.debug("quit chatroom ->"+n),o=e.logger.ID(),e.logger.info(e.LogTagId.A_QUIT_CHATROOM_T,{chatroomId:t},{traceId:o}),[4,G.imClient.context.quitChatroom(t)];case 1:return a=s.sent(),(a===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_QUIT_CHATROOM_R,{code:a},{traceId:o}),a!==e.ErrorCode.SUCCESS?(r.warn("quit chatroom fail ->code+:"+B[a]+","+n),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.recallMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.messageUId",n.messageUId,e.AssertRules.STRING,!0),e.assert("options.sentTime",n.sentTime,e.AssertRules.NUMBER,!0),e.assert("options.disableNotification",null==n?void 0:n.disableNotification,e.AssertRules.BOOLEAN),e.assert("options.pushConfig",null==n?void 0:n.pushConfig,e.AssertRules.OBJECT),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o={user:n.user,channelId:t.channelId||"",disableNotification:null==n?void 0:n.disableNotification,pushConfig:null==n?void 0:n.pushConfig,extra:n.extra,isDelete:n.isDelete},a="conversationType:"+t.conversationType+",targetId:"+t.targetId+",messageUId:"+n.messageUId,r.debug("recall message ->"+a),[4,G.imClient.context.recallMessage(t.conversationType,t.targetId,n.messageUId,n.sentTime,o)];case 1:return i=s.sent(),c=i.code,d=i.data,c===e.ErrorCode.SUCCESS&&d?[2,{code:c,data:w(d)}]:c===e.ErrorCode.SUCCESS?[2,{code:c}]:(r.warn("recall message fail ->"+c+":"+B[c]+","+a),[2,{code:c,msg:B[c]}])}}))}))},exports.registerMessageType=function(t,n,o,s,r){return e.assert("messageType",t,e.AssertRules.STRING,!0),e.assert("isPersited",n,e.AssertRules.BOOLEAN,!0),e.assert("isCounted",o,e.AssertRules.BOOLEAN,!0),e.assert("isStatusMessage",r,e.AssertRules.BOOLEAN,!1),e.logger.info(e.LogTagId.A_REGTYP_O,{messageType:t,isCounted:o,isStatusMessage:r,isPersited:n}),G.imClient.context.registerMessageType(t,n,o,s,r),j(t,n,o)},exports.removeAllExpansionForUltraGroupMessage=function(t){return o(this,void 0,void 0,(function(){var n,o,a,i,c,d,u,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("message",t,e.AssertRules.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,t.senderUserId,i=t.sentTime,c=t.canIncludeExpansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",channelId:"+d+",messageUId:"+a,r.debug("remove all expansion for ultraGroup message ->"+u),l={targetId:o,channelId:d,conversationType:n,sendTime:i,canIncludeExpansion:c,messageUId:a,removeAll:!0},[4,G.imClient.context.expandUltraMessage(l)];case 1:return(g=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("remove all expansion for ultraGroup message ->"+g+":"+B[g]),[2,{code:g,msg:B[g]}])}}))}))},exports.removeChatRoomEntries=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),function(t){t.entries.forEach((function(t){e.assert("key",t,e.AssertRules.STRING,!0)})),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING)}(n),o="id:"+t,r.debug("remove chatroom entry->"+o),(a=Object.assign({},n)).entries=n.entries.map((function(e){return{key:e}})),[4,G.imClient.context.removeChatroomEntries(t,a)];case 1:return i=s.sent(),c=i.code,d=i.data,c!==e.ErrorCode.SUCCESS?(r.warn("remove chatroom entry fail ->code+:"+B[c]+","+o),[2,{code:c,msg:B[c],data:d}]):[2,{code:c}]}}))}))},exports.removeChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),z(n),o="id:"+t,r.debug("remove chatroom entry->"+o),[4,G.imClient.context.removeChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("remove chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.removeConversation=function(t){return o(this,void 0,void 0,(function(){var n,o;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),[4,G.imClient.context.removeConversation(t.conversationType,t.targetId,t.channelId)];case 1:return n=s.sent(),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("destroy conversation ->"+o),n!==e.ErrorCode.SUCCESS?(r.warn("destroy conversation fail ->"+n+":"+B[n]+","+o),[2,{code:n,msg:B[n]}]):[2,{code:n}]}}))}))},exports.removeConversationsFromTag=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("removeTagForConversations ->tagId:"+t),[4,G.imClient.context.removeTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.removeEventListener=function(e,t,n){P.off(e,t,n)},exports.removeEventListeners=function(e){P.removeAll(e)},exports.removeExpansionForUltraGroupMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g,p;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.ARRAY,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,n.senderUserId,c=n.sentTime,d=n.canIncludeExpansion,u=n.channelId,l="conversationType:"+o+",targetId:"+a+",channelId:"+u+",messageUId:"+i,r.debug("remove expansion for ultragroup message ->"+l),g={targetId:a,channelId:u,conversationType:o,sendTime:c,canIncludeExpansion:d,messageUId:i,keys:t},[4,G.imClient.context.expandUltraMessage(g)];case 1:return(p=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("remove expansion for ultraGroup message ->"+p+":"+B[p]),[2,{code:p,msg:B[p]}])}}))}))},exports.removeFromBlacklist=function(t){return o(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e.assert("userId",t,e.AssertRules.STRING,!0),r.info("removeFromBlacklist -> userId: ".concat(t)),[4,G.imClient.context.removeFromBlacklist(t)];case 1:return[2,{code:n.sent()}]}}))}))},exports.removeMessageExpansionForKey=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l;return s(this,(function(s){switch(s.label){case 0:return e.assert("keys",t,e.AssertRules.ARRAY,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,d=n.channelId,u="conversationType:"+o+",targetId:"+a+",messageUId:"+i,r.debug("remove message expansion ->"+u),[4,G.imClient.context.sendExpansionMessage({conversationType:o,targetId:a,messageUId:i,canIncludeExpansion:c,keys:t,channelId:d})];case 1:return(l=s.sent().code)!==e.ErrorCode.SUCCESS?(r.warn("remove message expansion fail ->"+l+":"+B[l]+","+u),[2,{code:l,msg:B[l]}]):[2,{code:l}]}}))}))},exports.removeTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),r.info("removeTag ->tagId:"+t),[4,G.imClient.context.removeTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("removeTag ->code:"+n+",tagId:"+t),[2,{code:n,msg:B[n]}])}}))}))},exports.removeTagFromConversations=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversations",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID)})),r.info("removeTagForConversations ->tagId:"+t),[4,G.imClient.context.removeTagForConversations(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagForConversations ->code:"+o+",tagId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.removeTagsFromConversation=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversation.conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("conversation.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("tagIds",n,e.AssertRules.ARRAY,!0),n.forEach((function(t){e.assert("tagId",t,e.AssertRules.STRING,!0)})),r.info("removeTagsForConversation ->tagIds:"+n+",targetId:"+t.targetId+",conversationType:"+t.conversationType),[4,G.imClient.context.removeTagsForConversation(t,n)];case 1:return(o=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("removeTagsForConversation ->code:"+o+",tagIds:"+n),[2,{code:o,msg:B[o]}])}}))}))},exports.saveTextMessageDraft=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("draft",n,e.AssertRules.STRING,!0),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("set draft ->"+o),[4,G.imClient.context.saveConversationMessageDraft(t.conversationType,t.targetId,n,t.channelId)];case 1:return(a=s.sent())===e.ErrorCode.SUCCESS?[2,{code:a}]:(r.warn("set draft fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}])}}))}))},exports.searchConversationByContent=function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,d;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.searchConversationByContent","RongIMLib.ElectronExtension.searchConversationByContent"),e.usingCppEngine()?(r.info("searchConversationByContent ->keyword:"+t),[4,G.imClient.context.searchConversationByContent(t,a,i,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),c=o.code,d=o.data,c===e.ErrorCode.SUCCESS?[2,{code:c,data:d}]:(r.warn("searchConversationByContent ->code:"+c+",keyword:"+t),[2,{code:c,msg:B[c]}])}}))}))},exports.searchMessages=function(t,n,a,i){return o(this,void 0,void 0,(function(){var o,c,d,u;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.searchMessages","RongIMLib.ElectronExtension.searchMessages"),e.usingCppEngine()?(e.assert("conversationType",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("keyword",n,e.AssertRules.STRING,!0),e.assert("timestamp",a,e.AssertRules.NUMBER),e.assert("count",i,e.AssertRules.NUMBER),1,[4,G.imClient.context.searchMessageByContent(t.conversationType,t.targetId,n,a,i,1,t.channelId)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return o=s.sent(),c=o.code,d=o.data,c===e.ErrorCode.SUCCESS?(u=[],(null==d?void 0:d.messages)&&d.messages.length&&d.messages.forEach((function(e){return u.push(w(e))})),[2,{code:c,data:{messages:u,count:null==d?void 0:d.count}}]):(r.warn("searchMessages ->code:"+c+",targetId:"+t.targetId),[2,{code:c,msg:B[c]}])}}))}))},exports.sendFileMessage=ke,exports.sendHQVoiceMessage=Fe,exports.sendImageMessage=He,exports.sendMessage=De,exports.sendReadReceiptMessage=function(t,n,r,a){return o(this,void 0,void 0,(function(){var o,i,c,d,u;return s(this,(function(s){switch(s.label){case 0:return o={targetId:t,conversationType:e.ConversationType.PRIVATE,channelId:a},i=new K("RC:ReadNtf",{messageUId:n,lastMessageSendTime:r,type:1}),[4,De(o,i)];case 1:return c=s.sent(),d=c.code,u=c.msg,0===d?[2,{code:d}]:[2,{code:d,msg:u}]}}))}))},exports.sendReadReceiptRequest=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,d,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("messageUId",n,e.AssertRules.STRING,!0),e.assert("channelId",a,e.AssertRules.CHANNEL_ID),o="messageUId:"+n+",targetId:"+t,r.debug("send read receipt message ->"+o),i=new K("RC:RRReqMsg",{messageUId:n}),[4,De({targetId:t,conversationType:e.ConversationType.GROUP,channelId:a},i)];case 1:return c=s.sent(),d=c.code,u=c.msg,0===d?[2,{code:d}]:[2,{code:d,msg:u}]}}))}))},exports.sendReadReceiptResponse=function(e,t,n){return o(this,void 0,void 0,(function(){return s(this,(function(e){throw new Error("This method is deprecated, please use method sendReadReceiptResponseV2.")}))}))},exports.sendReadReceiptResponseV2=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i,c,d,u,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),e.assert("messageList",n,e.AssertRules.OBJECT,!0),e.assert("channelId",a,e.AssertRules.CHANNEL_ID),Object.keys(n).forEach((function(t){e.assert(t,n[t],e.AssertRules.ARRAY)})),o={targetId:t,conversationType:e.ConversationType.GROUP,channelId:a},c=G.imClient.context.getInfoFromCache(),0!==(d=(null==c?void 0:c.grpRRVer)||0)?[3,2]:(u=new K("RC:RRRspMsg",{receiptMessageDic:n}),[4,De(o,u)]);case 1:return i=s.sent(),[3,4];case 2:return 1!==d?[3,4]:(l=[],Object.keys(n).forEach((function(e){n[e].forEach((function(e){-1===l.indexOf(e)&&l.push(e)}))})),l.length?[4,G.imClient.context.sendReadReceiptMessage(t,l,a)]:(r.warn("Error in parameter messageList."),[2,{code:e.ErrorCode.PARAMETER_ERROR}]));case 3:i=s.sent(),s.label=4;case 4:return(g=i.code)===e.ErrorCode.SUCCESS?[2,{code:g}]:(r.warn("send read receipt message fail ->"+g+":"+B[g]),[2,{code:g,msg:B[g]}])}}))}))},exports.sendSightMessage=qe,exports.sendSyncReadStatusMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,r,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("conversation.type",t.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("lastMessageSendTime",n,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",null==t?void 0:t.channelId,e.AssertRules.CHANNEL_ID),o=new K("RC:SRSMsg",{lastMessageSendTime:n}),[4,De(t,o)];case 1:return r=s.sent(),a=r.code,i=r.msg,0===a?[2,{code:a}]:[2,{code:a,msg:i}]}}))}))},exports.sendTextMessage=function(e,t,n){return De(e,new Z(t),n)},exports.sendTypingStatusMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u;return s(this,(function(s){switch(s.label){case 0:return e.assert("typingContentType",n,e.AssertRules.STRING,!0),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("send typing status message ->"+o),a={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:t.channelId},i=e.logger.ID(),e.logger.info(e.LogTagId.A_SEND_MSG_T,{messageType:a.messageType,conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId},{traceId:i}),[4,G.imClient.context.sendMessage(t.conversationType,t.targetId,a,void 0,i)];case 1:return c=s.sent(),d=c.code,u=c.data,(d===e.ErrorCode.SUCCESS?e.logger.info:e.logger.warn)(e.LogTagId.A_SEND_MSG_R,{code:d,messageUId:u?u.messageUId:"",messageId:u?u.messageId:""},{traceId:i}),d===e.ErrorCode.SUCCESS?[2,{code:d,data:w(u)}]:(r.warn("send typing status message fail ->"+d+":"+B[d]+","+o),[2,{code:d,msg:B[d]}])}}))}))},exports.sendUltraGroupTypingStatus=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),e.assert("options.conversationType",t.conversationType,e.isValidConversationType,!0),[4,G.imClient.context.sendUltraGroupTypingStatus(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("send ultraGroup OperateStatus ->"+n+":"+B[n]),[2,{code:n,msg:B[n]}])}}))}))},exports.setChatRoomEntries=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),function(t){t.entries.forEach((function(t){e.assert("entry.key",t.key,e.AssertRules.STRING,!0),e.assert("entry.value",t.value,e.AssertRules.STRING,!0)})),e.assert("options.isAutoDelete",t.isAutoDelete,e.AssertRules.BOOLEAN),e.assert("options.notificationExtra",t.notificationExtra,e.AssertRules.STRING),e.assert("options.isForce",t.isForce,e.AssertRules.BOOLEAN)}(n),n.entries.length>10?[2,D.CHATROOM_KV_STORE_OUT_LIMIT]:(o="id:"+t,r.debug("set chatroom entry->"+o),[4,G.imClient.context.setChatroomEntries(t,n)]);case 1:return a=s.sent(),i=a.code,c=a.data,i!==e.ErrorCode.SUCCESS?(r.warn("set chatroom entry fail ->code+:"+B[i]+","+o),[2,{code:i,msg:B[i],data:c}]):[2,{code:i}]}}))}))},exports.setChatRoomEntry=function(t,n){return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("targetId",t,e.AssertRules.STRING,!0),V(n),o="id:"+t,r.debug("set chatroom entry->"+o),[4,G.imClient.context.setChatroomEntry(t,n)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("set chatroom entry fail ->code+:"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.setConversationNotificationLevel=function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){return e.assert("notificationLevel",n,(function(n){return t.conversationType===e.ConversationType.PRIVATE?[e.NotificationLevel.ALL_MESSAGE,e.NotificationLevel.NOT_SET,e.NotificationLevel.AT_MESSAGE_NOTIFICATION].includes(n):void 0!==e.NotificationLevel[n]}),!0),[2,q(t,(function(){return G.imClient.context.setConversationNotificationLevel(t.conversationType,t.targetId,n,t.channelId)}),"setConversationNotificationLevel")]}))}))},exports.setConversationNotificationStatus=function(t,n){return o(this,void 0,void 0,(function(){return s(this,(function(o){return e.assert("notificationStatus",n,(function(e){return 1===e||2===e}),!0),[2,q(t,(function(){return G.imClient.context.setConversationStatus(t.conversationType,t.targetId,void 0,n,t.channelId)}),"setConversationNotificationStatus")]}))}))},exports.setConversationToTop=function(t,n){return void 0===n&&(n=!0),o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.type",t.conversationType,e.isValidConversationType,!0),e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),e.assert("options.channelId",t.channelId,e.AssertRules.CHANNEL_ID),o="conversationType:"+t.conversationType+",targetId:"+t.targetId,r.debug("set conversation status ->"+o),[4,G.imClient.context.setConversationStatus(t.conversationType,t.targetId,n,void 0,t.channelId)];case 1:return(a=s.sent())!==e.ErrorCode.SUCCESS?(r.warn("set conversation status fail ->"+a+":"+B[a]+","+o),[2,{code:a,msg:B[a]}]):[2,{code:a}]}}))}))},exports.setConversationToTopInTag=function(t,n,a){return o(this,void 0,void 0,(function(){var o,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("tagId",t,e.AssertRules.STRING,!0),e.assert("conversation.targetId",n.targetId,e.AssertRules.STRING,!0),e.assert("conversation.conversationType",n.conversationType,e.AssertRules.NUMBER,!0),e.assert("conversation.channelId",n.channelId,e.AssertRules.CHANNEL_ID),e.assert("status.isTop",a,e.AssertRules.BOOLEAN,!0),r.info("setConversationStatusInTag ->tagId:"+t+",targetId:"+n.targetId+",conversationType"+n.conversationType),[4,G.imClient.context.setConversationStatusInTag(t,n,{isTop:a})];case 1:return o=s.sent(),i=o.code,o.data,i===e.ErrorCode.SUCCESS?[2,{code:i}]:(r.warn("setConversationStatusInTag ->code:"+i+",tagId:"+t),[2,{code:i,msg:B[i]}])}}))}))},exports.setMessageReceivedStatus=function(t,n){return o(this,void 0,void 0,(function(){var o;return s(this,(function(s){switch(s.label){case 0:return b("RongIMLib.setMessageReceivedStatus","RongIMLib.ElectronExtension.setMessageReceivedStatus"),e.usingCppEngine()?(e.assert("messageId",t,e.AssertRules.NUMBER,!0),e.assert("receivedStatus",n,e.AssertRules.NUMBER,!0),r.info("setMessageReceivedStatus ->messageId:"+t+",receivedStatus:"+n),[4,G.imClient.context.setMessageReceivedStatus(t,n)]):[2,{code:e.ErrorCode.NOT_SUPPORT,msg:B[e.ErrorCode.NOT_SUPPORT]}];case 1:return(o=s.sent())===e.ErrorCode.SUCCESS?[2,{code:o}]:(r.warn("setMessageReceivedStatus ->code:"+o+",messageId:"+t),[2,{code:o,msg:B[o]}])}}))}))},exports.setUltraGroupDefaultNotificationLevel=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i;return s(this,(function(s){switch(s.label){case 0:return e.assert("options.targetId",t.targetId,e.AssertRules.STRING,!0),t.channelId=t.channelId||"",e.assert("options.channelId",t.channelId,e.AssertRules.ONLY_STRING,!0),e.assert("notificationLevel",n,(function(t){return void 0!==e.NotificationLevel[t]}),!0),o="setUltraGroupDefaultNotificationLevel",a="targetId: ".concat(t.targetId,", channelId: ").concat(t.channelId),r.debug("".concat(o," -> ").concat(a)),[4,G.imClient.context.setUltraGroupDefaultNotificationLevel(t.targetId,n,t.channelId)];case 1:return(i=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:i}]:(r.warn("".concat(o," fail -> ").concat(i," : ").concat(B[i]," , ").concat(a)),[2,{code:i,msg:B[i]}])}}))}))},exports.updateExpansionForUltraGroupMessage=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g,p;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,n.senderUserId,c=n.sentTime,d=n.canIncludeExpansion,n.expansion,u=n.channelId,l="conversationType:"+o+",targetId:"+a+",channelId:"+u+",messageUId:"+i,r.debug("update expansion for ultragroup message ->"+l),g={targetId:a,channelId:u,conversationType:o,sendTime:c,canIncludeExpansion:d,messageUId:i,expansion:t},[4,G.imClient.context.expandUltraMessage(g)];case 1:return(p=s.sent().code)===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS}]:(r.warn("update expansion for ultragroup message ->"+p+":"+B[p]),[2,{code:p,msg:B[p]}])}}))}))},exports.updateMessageExpansion=function(t,n){return o(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g;return s(this,(function(s){switch(s.label){case 0:return e.assert("expansion",t,e.AssertRules.OBJECT,!0),e.assert("message",n,e.AssertRules.OBJECT,!0),o=n.conversationType,a=n.targetId,i=n.messageUId,c=n.canIncludeExpansion,d=n.expansion,u=n.channelId,l="conversationType:"+o+",targetId:"+a+",messageUId:"+i,r.debug("update message expansion ->"+l),[4,G.imClient.context.sendExpansionMessage({conversationType:o,targetId:a,messageUId:i,expansion:t,canIncludeExpansion:c,originExpansion:d,channelId:u})];case 1:return(g=s.sent().code)!==e.ErrorCode.SUCCESS?(r.warn("update message expansion fail ->"+g+":"+B[g]+","+l),[2,{code:g,msg:B[g]}]):[2,{code:g}]}}))}))},exports.updateTag=function(t){return o(this,void 0,void 0,(function(){var n;return s(this,(function(o){switch(o.label){case 0:return e.assert("tag.tagId",t.tagId,e.AssertRules.STRING,!0),e.assert("tag.tagName",t.tagName,e.AssertRules.STRING,!0),e.assert("tag.tagName",t.tagName,(function(e){return e.length<=15})),r.info("updateTag ->tagId:"+t.tagId+",tagName:"+t.tagName),[4,G.imClient.context.updateTag(t)];case 1:return(n=o.sent().code)===e.ErrorCode.SUCCESS?[2,{code:n}]:(r.warn("updateTag ->code:"+n+",tagId:"+t.tagId),[2,{code:n,msg:B[n]}])}}))}))};