@rongcloud/electron 5.12.4 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@rongcloud/engine"),t=require("electron"),o=require("child_process"),r=require("path"),n=require("os"),i=require("http"),s=require("https"),a=require("zlib"),c=require("url"),u=require("net"),p=require("events"),d=require("tls"),l=require("fs"),f=require("crypto");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function C(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var g=C(n),v=h(a),_=function(e,t){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},_(e,t)};function S(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var y,m=function(){return m=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},m.apply(this,arguments)};function E(e,t,o,r){return new(o||(o=Promise))((function(n,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function P(e,t){var o,r,n,i,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,r&&(n=2&i[0]?r.return:i[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;switch(r=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){s.label=i[1];break}if(6===i[0]&&s.label<n[1]){s.label=n[1],n=i;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(i);break}n[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{o=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function T(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e.P_INIT_O="P-init-O",e.P_DB_OPEN_O="P-db_open-O",e.P_DB_UPGRATE_START_S="P-db_upgrate_start-S",e.P_DB_UPGRATING_S="P-db_upgrating-S",e.P_DB_UPGRATE_COMPLETE_S="P-db_upgrate_complete-S",e.P_CALL_MAIN_SYNC_E="P-call_main_sync-E",e.P_CALL_MAIN_E="P-call_main-E",e.P_SEND_2_MAIN_E="P-send_2_main-E",e.P_REGTYP_O="P-regtype-O",e.P_CALL_ADDON_E="P-call_addon-E",e.P_CALL_ADDON_T="P-call_addon-T",e.P_CALL_ADDON_O="P-call_addon-O",e.P_CALL_ADDON_R="P-call_addon-R",e.P_CALL_EXTRA_E="P-call_extra-E",e.P_CONNECT_S="P-connect-S",e.P_CONNECT_T="P-connect-T",e.P_CONNECT_O="P-connect-O",e.P_CONNECT_ENTRY_S="P-connect_entry-S",e.P_REPORT_VER_O="P-report_version-O",e.P_PARSE_JSON_MSGS_E="P-parse_json_messsages-E",e.P_PARSE_JSON_MSGS_R="P-parse_json_messsages-R",e.P_RECEIVE_MESSAGE_E="P-receive_message-E",e.P_HTTP_REQ_E="P-http_request-E",e.P_SET_MSG_EXTEN_O="P-set_msg_extension-O",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.P_PARSE_JSON_SUBSCRIBE_DATA_E="P-parse_json_subscribe_data-E",e.P_PARSE_JSON_USER_PROFILE_E="P-parse_json_user_profile-E",e.P_PARSE_JSON_USER_PROFILE_LIST_E="P-parse_json_user_profile_list-E",e.P_WRITE_LOG_T="P_WRITE_LOG_T",e.P_WRITE_LOG_R="P_WRITE_LOG_R",e.P_PARSE_JSON_E="P-parse_json-E"}(y||(y={}));var I,R={flushTimestamp:Date.now(),queue:[],locked:!1};function O(){I&&clearInterval(I)}function N(e,t){O(),I=setInterval((function(){return U(e,t)}),1e4)}function M(){for(var e,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];(e=R.queue).push.apply(e,t)}var b=200;function U(e,t){var o=R.queue,r=R.flushTimestamp;if(!(R.locked||0===o.length||Date.now()-r<3e4&&o.length<b)){R.locked=!0;var n=t.createTraceId(),i=t.getSessionId(),s=o.splice(0,b).map((function(e){var t=e.sessionId,o=e.level,r=e.time,n=e.type,s=e.tag,a=e.loggerId,c=e.content,u=e.traceId;return{level:o,time:r,type:n,tag:s,sessionId:i+":"+t,content:{loggerId:a,content:c,traceId:u}}}));t.debug(y.P_WRITE_LOG_T,"writingLen: "+s.length+", queueLen: "+o.length,n);var a=JSON.stringify(s);e.writeLog(a),t.debug(y.P_WRITE_LOG_R,"write done, queueLen: "+o.length,n),R.flushTimestamp=Date.now(),R.locked=!1,setTimeout((function(){return U(e,t)}))}}var x,L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t.prototype.flush=function(e){M(e)},t}(e.BasicLogger),w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t.prototype.flush=function(e){M(e)},t}(e.BasicStatistic),A=function(e,t){var o,r=Buffer.from(e),n=r.length;for(t.push(n),o=0;o<n;o++)t.push(r[o])},k=function(e){return"string"==typeof e},D=function(e){return k(e)?e.toUpperCase():""},J=function(e,t){var o="";return 2!==e.length?o="Unexpected number of bytes received.":5!==e[0]?o="Unexpected SOCKS version number: "+e[0]+".":255===e[1]?o="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(o="Unexpected SOCKS authentication method: "+e[1]+"."),o},G=function(e){var t="";return 2!==e.length?t="Unexpected number of bytes received.":1!==e[0]?t="Unexpected authentication method code: "+e[0]+".":0!==e[1]&&(t="Username and password authentication failure: "+e[1]+"."),t},F=function(e){var t=D(e.method)||"GET",o=e.pathname||"/",r=e.headers||{},n=e.search||"";r.Host=e.host||"loclahost";var i="";for(var s in i=t+" "+(o+n)+" HTTP/1.1\n",r){if(Object.hasOwnProperty.call(r,s))i+=s+": "+r[s]+"\n"}return e.body&&(i+="Content-Length: "+e.body.length+"\n"),i+="\n","POST"===t&&e.body&&(i+=""+e.body),i},B=function(e){return new Promise((function(t){var o,r;e.socket.once("data",(function(r){var n,i=J(r,o);if(!i)return 2===r[1]?(e.socket.once("data",(function(o){var r=G(o);r?e.emit("error",new Error("SOCKS authentication failed. "+r)):t()})),n=[1],A(e.socksUsername,n),A(e.socksPassword,n),void e.write(Buffer.from(n))):void t();e.emit("error",new Error("SOCKS authentication failed. "+i))})),o=[0],e.socksUsername&&o.push(2),(r=Buffer.alloc(2+o.length))[0]=5,r[1]=o.length,o.forEach((function(e,t){r[2+t]=e})),e.write(r)}))},j=function(e,t,o){return new Promise((function(r){var n,i;switch(e.socket.once("data",(function(t){var o;5!==t[0]?o="Unexpected SOCKS version number: "+t[0]+".":0!==t[1]?o=function(e){switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return"Unknown status code "+e}}(t[1])+".":0!==t[2]&&(o="The reserved byte must be 0x00."),o?e.emit("error",new Error("SOCKS connection failed. "+o)):r()})),(n=[]).push(5),n.push(1),n.push(0),u.isIP(t)){case 0:n.push(3),A(t,n);break;case 4:n.push(1),function(e,t){var o,r,n=e.split(".");for(o=0;o<4;o++)r=parseInt(n[o],10),t.push(r)}(t,n);break;case 6:e.emit("error",new Error("Does not support IPV6"))}n.length+=2,(i=Buffer.from(n)).writeUInt16BE(o,i.length-2),e.write(i)}))},V=function(e){function t(t){var o=e.call(this)||this;return o.readable=!0,o.socket=new u.Socket,o.options=t,o.socksHost=t.socksHost||"localhost",o.socksPort=t.socksPort||1080,o.socksUsername=t.socksUsername||"",o.socksPassword=t.socksPassword||"",o.socket.on("error",(function(e){o.emit("error",e)})),o.on("error",(function(){o.socket.destroyed||o.socket.destroy()})),o.on("end",o.end),o}return S(t,e),t.prototype.ref=function(){return this.socket.ref()},t.prototype.unref=function(){return this.socket.unref()},t.prototype.setTimeout=function(e,t){return this.socket.setTimeout(e,t)},t.prototype.setNoDelay=function(e){return this.socket.setNoDelay(e)},t.prototype.setKeepAlive=function(e,t){return this.socket.setKeepAlive(e,t)},t.prototype.address=function(){return this.socket.address()},t.prototype.cork=function(){return this.socket.cork()},t.prototype.uncork=function(){return this.socket.uncork()},t.prototype.pause=function(){return this.socket.pause()},t.prototype.resume=function(){return this.socket.resume()},t.prototype.pipe=function(e){return this.socket.pipe(e)},t.prototype.end=function(e,t){var o=this.socket.end(e,t);return this.writable=this.socket.writable,o},t.prototype.destroy=function(e){return this.socket.destroy(e)},t.prototype.setEncoding=function(e){return this.socket.setEncoding(e)},t.prototype.write=function(e,t,o){return this.socket.write(e,t,o)},t.prototype.read=function(e){return this.socket.read(e)},t.prototype.connect=function(e,t){var o=this;if("string"==typeof e&&/^\d+$/.test(e)&&(e=parseInt(e,10)),!Number.isInteger(e)||e<1||e>65535)throw new TypeError("Invalid port: "+e);if(!t||"string"!=typeof t)throw new TypeError("Invalid host: "+t);return this.socket.connect({port:this.socksPort,host:this.socksHost},(function(){return E(o,void 0,void 0,(function(){var o;return P(this,(function(r){switch(r.label){case 0:return[4,B(this)];case 1:return r.sent(),[4,j(this,t,e)];case 2:return r.sent(),this.onProxied(),o=F(this.options),this.socket.write(Buffer.from(o)),[2]}}))}))})),this},t.prototype.onProxied=function(){var e=this;this.socket.on("close",(function(t){e.emit("close",t)})),this.socket.on("end",(function(){e.emit("end")})),this.socket.on("data",(function(t){e.emit("data",t)})),this.writable=!0,this.readable=!0,this.emit("connect")},t}(p.EventEmitter),q=function(e){var t,o=e.hostname,r=e.port;return!e.host||o&&r||(t=e.host.split(":")),!r&&t&&(r=parseInt(t[1],10)||0),!o&&t&&(o=t[0]),new V(e).connect(r,o)},H=function(e){function t(t){var o=e.call(this)||this;return o.createConnection=q,o}return S(t,e),t}(i.Agent),K=function(e,t,o){return(t=m(m({},t),c.parse(e))).port||(t.port=80),t.agent=new H(t),i.request(t,o)},W=function(e){var t,o;return t=q(e),o=t.onProxied,t.onProxied=function(){e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&(e.servername=e.host.split(":")[0]),t.socket=d.connect(e,(function(){t.authorized=t.socket.authorized,o.call(t)})),t.socket.on("error",(function(e){t.emit("error",e)}))},t},Q=function(e){function t(t,o){var r=e.call(this,o)||this;return r.url=t,r.socksHost=o.socksHost||"localhost",r.socksPort=o.socksPort||1080,r.createConnection=W,r}return S(t,e),t}(s.Agent),Y=function(e,t,o,r){var n,i;return t.protocol="https:",!t.port&&t.host&&(n=t.host.split(":"),t.port=n[0],t.port=n[1]),t.port||(t.port=443),i=new Q(e,t),t.agent=i,s.request(e,t,o)},X=null;function z(t,o,r){void 0===r&&(r=!1);var n=o.url,a=o.headers,c=o.body,u=o.method,p=o.query,d=o.timeout,l=void 0===d?e.HTTP_TIMEOUT:d;return new Promise((function(o){var d=/^https/.test(n),f={headers:m(m({},a),{"Accept-Encoding":"gzip, br"}),method:u};d&&(f.rejectUnauthorized=r);var h=null;X?((f=m(m({},f),X)).body=c,h=d?Y:K):(h=i.request,d&&(f.agent=new s.Agent(f),h=s.request));var C=h(e.appendUrl(n,p),f,(function(e){var t,r,n=e.statusCode,i="";if("gzip"===(null===(t=e.headers)||void 0===t?void 0:t["content-encoding"])){var s=v.default.createGunzip();e.pipe(s),s.on("data",(function(e){i+=e})),s.on("end",(function(){o({status:n,data:i})}))}else if("br"===(null===(r=e.headers)||void 0===r?void 0:r["content-encoding"])){var a=v.default.createBrotliDecompress();e.pipe(a),a.on("data",(function(e){i+=e})),a.on("end",(function(){o({status:n,data:i})}))}else e.setEncoding("utf8"),e.on("data",(function(e){i+=e})),e.once("end",(function(){o({status:n||0,data:i})}))}));C.once("timeout",(function(){t.warn(y.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:n,method:u,query:p,timeout:l})),o({status:0})})),C.setTimeout(l),C.once("error",(function(e){t.warn(y.P_HTTP_REQ_E,JSON.stringify({msg:e.stack,url:n,method:u,query:p,timeout:l})),o({status:0})})),C.write(c),C.end()}))}function $(t,o){return t?(X=m(m({},X),t),o.info(e.LogTagId.A_SET_PROXY_O,JSON.stringify({msg:"set proxy",data:X})),{code:e.ErrorCode.SUCCESS}):(X=null,o.info(e.LogTagId.A_REMOVE_PROXY_O,JSON.stringify({msg:"remove proxy"})),{code:e.ErrorCode.SUCCESS})}function Z(){var t=X||void 0;return{code:e.ErrorCode.SUCCESS,data:t}}!function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.EVENT=1]="EVENT",e[e.CALLBACK=2]="CALLBACK"}(x||(x={}));var ee=function(){function t(t,o,r,n){var i=this;this.p=t,this.emit=o,this.callback=r,this.errorHandle=n,this.count=0,this.maps={},this.p.on("message",(function(e){var t=e.type,s=e.data;switch(t){case x.EVENT:var a=s,c=a.eventName,u=a.data;null==o||o.apply(void 0,T([c],u,!1));break;case x.RESPONSE:var p=s,d=p.reqId,l=p.success,f=p.data,h=i.maps[d];if(!h)return;h({success:l,data:f}),delete i.maps[d];break;case x.CALLBACK:null==r||r(s);break;case x.ERROR:var C=s.msg;null==n||n(C)}})),this.p.on("error",(function(e){null==n||n("SubProcessProxy error "+e)})),this.p.on("exit",(function(t,o){if(0!==t){for(var r in i.maps){if(Object.prototype.hasOwnProperty.call(i.maps,r))(0,i.maps[r])({success:!0,data:{code:e.ErrorCode.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==n||n("SubProcessProxy exit "+t+" "+o,!0)}})),this.p.on("close",(function(e,t){console.log("SubProcessProxy close",e,t)}))}return t.prototype.call=function(t){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return this.p.killed||this.p.exitCode?[2,Promise.resolve({success:!1,data:{code:e.ErrorCode.SUB_PROCESS_EXIT,msg:"sub process exit"}})]:[2,new Promise((function(e){var n=++r.count;r.maps[n]=e;var i={reqId:n,method:t,args:o,hasResponse:!0};r.p.send(i)}))]}))}))},t.prototype.send=function(e){for(var t,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return E(this,void 0,void 0,(function(){var r;return P(this,(function(n){return(this.p.killed||this.p.exitCode)&&(null===(t=this.errorHandle)||void 0===t||t.call(this,"sub process exit")),r={reqId:-1,method:e,args:o},this.p.send(r),[2]}))}))},t.prototype.destroy=function(){this.send("destroy")},t}(),te=[],oe=!1,re=function(){return E(void 0,void 0,void 0,(function(){var t,o,r,n,i,s,a,c,u,p,d,l,f;return P(this,(function(h){return oe||0===te.length||(oe=!0,t=te.shift(),o=t.args,r=t.resolve,n=o.addon,i=o.startTime,s=o.endTime,a=o.level,c=o.realtimeReport,u=0,p=0,d=[],l=function(t){u+=t.length;var o=t.split(","),n=o[0],i=o[1],s=o[2],l=o[3],f=o[4],h=o.slice(5);if(u>e.REAT_TIME_LOG_SIZE&&parseInt(i,10)!==p)r(d);else{p=parseInt(i,10);try{if(!c&&a<0)return;var C={time:parseInt(i,10),level:parseInt(l,10),sessionId:n,type:s,tag:f,content:h.join(",")};d.push(C)}catch(e){console.error(e)}}},f=function(e){r(d),oe=!1,re()},n.getFullLog(a,i,s,!1,l,f)),[2]}))}))},ne=function(t){function n(o,r,n,i,s){void 0===s&&(s=!1);var a="Electron|"+process.versions.electron+"|"+process.arch+"|"+process.platform;return t.call(this,r,n,a,{getLogs:function(e,t,r,n){return E(this,void 0,void 0,(function(){return P(this,(function(i){switch(i.label){case 0:return[4,(s={startTime:e,endTime:t,level:r,realtimeReport:n,addon:o},E(void 0,void 0,void 0,(function(){return P(this,(function(e){return[2,new Promise((function(e){te.push({resolve:e,args:s}),re()}))]}))})))];case 1:return[2,{logs:i.sent(),dbReady:!0}]}var s}))}))},getTimestamp4RealtimeLog:function(){var t=o.getStoreValue(e.StoreKeys.REALTIME_LOG_TIMESTAMP);return parseInt(t,10)||0},setTimestamp4RealtimeLog:function(t){o.setStoreValue(e.StoreKeys.REALTIME_LOG_TIMESTAMP,t.toString())}},i,s)||this}return S(n,t),n.prototype.send=function(e){return z(this.logger,e)},n.prototype.stop=function(){this._subProcess&&this._subProcess.destroy(),t.prototype.stop.call(this)},n.prototype.compressLogs=function(e){return E(this,void 0,void 0,(function(){var t,n,i,s;return P(this,(function(a){switch(a.label){case 0:return this._subProcess||(t=o.fork(r.resolve(__dirname,"sub-process.js")),this._subProcess=new ee(t)),[4,this._subProcess.call("compressLogs",e)];case 1:return n=a.sent(),i=n.success,s=n.data,i?[2,{success:i,data:s.data}]:[2,{success:i,data:""}]}}))}))},n}(e.BasicReporter),ie=[e.EConnectProtocol.RMTP,e.EConnectProtocol.TLS];"darwin"===process.platform&&ie.push(e.EConnectProtocol.QUIC);var se=function(e){return"RongCloud/navis/"+e+"/navi-cache.json"},ae="deviceId",ce=function(e){return"RongCloud/caches/"+e+"/staticConfig.json"},ue=function(e){return"RongCloud/cloudControl/"+e+"/cloudControl.json"},pe=null,de=function(){var e,t=Date.now(),o=[n.arch(),n.platform(),process.pid,t,Math.floor(Math.random()*t)].join("__");return e=o,f.createHash("md5").update(e).digest("hex")},le=function(e){if(pe)return pe;var t=r.resolve(e,ae);return l.existsSync(t)?pe=l.readFileSync(t).toString():(pe=de(),l.writeFileSync(t,pe),pe)},fe=function(){function e(e){this._callCppProxy=e,this._setTime=15962112e5}return e.prototype._setToProtocol=function(e,t,o,r,n,i){var s=JSON.stringify(n);"{}"!==s&&e.info(y.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:r,ext:n})),this._callCppProxy("setMessageExtension",t,o,r,s,i)},e.prototype.setLocalFromReceiveMsg=function(e,t){var o=t.channelId,r=t.conversationType,n=t.targetId,i=t.messageUId,s=t.expansion,a=t.sentTime;if(s&&0!==Object.keys(s).length){var c={};for(var u in s)c[u]={v:"",ts:0},c[u].v=s[u],c[u].ts=a;this._setToProtocol(e,r,n,i,c,o||"")}},e.prototype.setLocalFromExtMsg=function(e,t){var o=t.channelId,r=t.conversationType,n=t.targetId,i=t.content,s=t.sentTime,a=i,c=a.put,u=this._callCppProxy("getMessage",a.mid),p=JSON.parse(u).extMsg,d=JSON.parse(p||"{}");if(c)for(var l in c){var f=d[l];f&&f.ts<s-this._setTime?(f.v=c[l],f.ts=s-this._setTime):(d[l]={v:"",ts:0},d[l].v=c[l],d[l].ts=s-this._setTime)}a.del&&a.del.forEach((function(e){delete d[e]})),this._setToProtocol(e,r,n,a.mid,d,o||"")},e.prototype.parseReceiveExpansion=function(e){var t=JSON.parse(e.extMsg||"{}"),o={};for(var r in t)o[r]=t[r].v;return o},e.prototype.parseConverOrHisExpansion=function(e){var t=JSON.parse(e.extMsg),o=JSON.parse(t||"{}"),r={};for(var n in o)r[n]=o[n].v;return r},e}();function he(e){void 0===e&&(e="IPv4");for(var t=n.networkInterfaces(),o=[],r=0,i=Object.values(t);r<i.length;r++){var s=i[r];if(s&&-1!==Object.prototype.toString.call(s).indexOf("Array")){var a=s.filter((function(t){return!(t.internal||(o=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(o))||t.family&&t.family!==e);var o})).map((function(e){return e.mac}));o.push.apply(o,a)}}return o.length?T([],o,!0).sort()[0]:""}var Ce,ge=function(e,t,o){return E(void 0,void 0,void 0,(function(){var r,n;return P(this,(function(i){return r=f.createDecipheriv("aes-256-cbc",t,o),n=r.update(e,"base64","utf-8"),[2,n+=r.final("utf8")]}))}))},ve=function(e){if(!l.existsSync(e)){var t=r.resolve(e,"..");l.existsSync(t)||ve(t),l.mkdirSync(e)}},_e=function(e){return Object.entries(e).map((function(e){var t=e[0],o=e[1];return{key:t,value:String(o)}}))},Se=function(e){return{removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}},ye=function(t){function o(e,o,n,i,s){var a=t.call(this,e,o,n,s)||this;a.naviPath="",a._caches={},a.naviPath=i+"/"+se(e);var c=r.dirname(a.naviPath);return l.existsSync(c)||ve(c),a}return S(o,t),o.prototype.httpRequest=function(t,o,r,n){return E(this,void 0,void 0,(function(){var i,s,a,c,u;return P(this,(function(p){switch(p.label){case 0:return i="token="+encodeURIComponent(r)+"&v="+e.FORMATED_VERSION+"&p=PC&ev=5.12.4&m="+he(),s=t+"/navi.json?r="+Date.now()+"&env="+this._environment,this.logger.info(e.LogTagId.L_REQUEST_T,JSON.stringify({url:s,body:i}),n),[4,z(this.logger,{method:"POST",headers:{appId:o},body:i,url:s,timeout:e.NAVI_REQ_TIMEOUT})];case 1:if(200!==(a=p.sent()).status)return this.logger.warn(e.LogTagId.L_REQUEST_R,JSON.stringify({url:s,code:a.status}),n),[2,{code:this.transHttpCode(a.status)}];this.logger.info(e.LogTagId.L_REQUEST_R,JSON.stringify({url:s,data:a.data}),n);try{return c=JSON.parse(a.data),u=/^https/.test(s)?"https":"http",c.protocol=u,c.code&&200!==c.code?[2,{code:this.transHttpCode(c.code)}]:[2,{code:e.ErrorCode.SUCCESS,data:c}]}catch(t){return this.logger.error(e.LogTagId.L_PARSE_NAVI_E,a.data,n),[2,{code:e.ErrorCode.RC_NAVI_REQ_FAILED}]}return[2]}}))}))},o.prototype.httpRequestV2=function(t,o,r,n){return E(this,void 0,void 0,(function(){var i,s,a,c;return P(this,(function(u){switch(u.label){case 0:return i=this.getNaviV2RequestOption({appkey:o,token:r,uri:t,platform:"electron",protocol:ie.join(","),mac:he()}),this.logger.info(e.LogTagId.L_REQUEST_T,JSON.stringify({url:i.url,body:i.body,headers:i.headers}),n),[4,z(this.logger,i)];case 1:if(200!==(s=u.sent()).status)return this.logger.warn(e.LogTagId.L_REQUEST_R,JSON.stringify({url:i.url,code:s.status}),n),[2,{code:this.transHttpCode(s.status)}];this.logger.info(e.LogTagId.L_REQUEST_R,JSON.stringify({url:i.url,data:s.data}),n);try{return a=JSON.parse(s.data),c=/^https/.test(i.url)?"https":"http",a.protocol=c,[2,{code:e.ErrorCode.SUCCESS,data:a}]}catch(t){return this.logger.error(e.LogTagId.L_PARSE_NAVI_E,s.data,n),[2,{code:e.ErrorCode.RC_NAVI_REQ_FAILED}]}return[2]}}))}))},o.prototype.getNaviCache=function(t){var o=this.getCatchKey(t),r=this._caches[o];if(r)return r;if(!l.existsSync(this.naviPath))return null;var n=l.readFileSync(this.naviPath,{encoding:"utf8"});try{return this._caches=JSON.parse(n),this._caches[o]}catch(t){this.logger.error(e.LogTagId.L_PARSE_NAVI_E,n)}return null},o.prototype.setNaviCache=function(t,o){var r=Date.now(),n=this.getCatchKey(t);if(e.notEmptyObject(this._caches))for(var i in this._caches){(r-this._caches[i].timestamp>e.NAVI_CACHE_DURATION||n===i)&&delete this._caches[i]}this._caches[n]={token:t,naviInfo:o,timestamp:Date.now(),environment:this._environment},l.writeFileSync(this.naviPath,JSON.stringify(this._caches))},o.prototype.setEnvironment=function(e){this._environment=e},o}(e.BasicNavi);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.NOT_INIT=-1]="NOT_INIT",e[e.CANCELED=-2]="CANCELED",e[e.REPEAT=-3]="REPEAT"}(Ce||(Ce={}));var me,Ee=function(t){function o(o,r,n,i,s,a){var c=t.call(this,o,n,i,s,a)||this;return c.callCppProxy=r,c._connectedTime=0,c._naviInfo=null,c._excludeLogTag=["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"],c.connectResolve=null,c._startTime=0,c._tcpDuration=0,c.pingResolve=null,c.callCppProxy("setConnectionStatusListener",c._onConnectionStatusChange.bind(c),(function(e){c.logger.info(y.P_DB_OPEN_O,e)}),(function(){return c.recvPong(e.ErrorCode.SUCCESS)}),c._onConnectionStatusChange.bind(c),c._onTcpConnectResponse.bind(c),(function(){var e;c.logger.info(y.P_DB_UPGRATE_START_S),null===(e=a.onDBUpgrateStart)||void 0===e||e.call(a)}),(function(e){var t;c.logger.info(y.P_DB_UPGRATING_S,e),null===(t=a.onDBUpgrading)||void 0===t||t.call(a,e)}),(function(e){var t;c.logger.info(y.P_DB_UPGRATE_COMPLETE_S,e),null===(t=a.onDBUpgradeComplete)||void 0===t||t.call(a,e)})),c}return S(o,t),o.prototype.getConnectedTime=function(){return this._connectedTime},o.prototype.connectWithToken=function(t,o,r,n){var i=this;return new Promise((function(s){i._naviInfo=o,i.connectResolve={resolve:s,traceId:n,userId:o.userId};var a={},c=Z().data;c&&(a={proxy_passwd:c.socksPassword||"",proxy_name:c.socksUsername||"",proxy_port:c.socksPort||1082,proxy_host:c.socksHost||"localhost",proxy_type:0});var u=JSON.stringify(m(m({},a),{call_plus:i._openCallPlus})),p=i.getCmpList(o,!0).filter((function(e){return ie.includes(e.protocol)})).sort((function(e,t){return e.weight>t.weight?-1:1})),d=[];p.forEach((function(t){var o=d.find((function(e){return e.addr===t.addr}));o?o.protocol!==e.EConnectProtocol.QUIC&&t.protocol!==e.EConnectProtocol.QUIC||(o.race=!0,o.protocol=e.EConnectProtocol.QUIC):(t.race=!1,d.push(t))})),i.logger.info(y.P_CONNECT_O,JSON.stringify({use:d,catche:i.cmpWeightCache,proxy:a,FORMATED_VERSION:e.FORMATED_VERSION,reconnectKickEnable:r}),n),i._startTime=Date.now();try{i.callCppProxy("connectWithToken",t,e.FORMATED_VERSION,JSON.stringify(m(m({},o),{serverAddr:d,tagBlacklist:i._excludeLogTag.join(",")})),r,u)}catch(t){i.logger.error(y.P_CALL_ADDON_E,null==t?void 0:t.stack,n),i.recvConnectRes(e.ErrorCode.RC_SOCKET_NOT_CREATED)}}))},o.prototype.close=function(e,t){void 0===t&&(t=!0),e||this.callCppProxy("disconnect",t)},o.prototype.sendPing=function(t){var o=this;return new Promise((function(r){o.pingResolve=r,o.callCppProxy("sendHeartbeat"),setTimeout((function(){return o.recvPong(e.ErrorCode.TIMEOUT)}),t)}))},o.prototype.recvPong=function(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)},o.prototype._onConnectionStatusChange=function(t,o){switch(this.logger.info(y.P_CONNECT_S,JSON.stringify({status:t,delay:o})),t){case e.ErrorCode.SUCCESS:this.recvConnectRes(e.ErrorCode.SUCCESS);break;case e.ErrorCode.RC_CONN_REDIRECTED:case 32061:this.recvConnectRes(e.ErrorCode.RC_CONN_REDIRECTED,!0);break;case 11:case 10:case 12:break;case e.ErrorCode.RC_SOCKET_DISCONNECTED:this.recvConnectRes(t,!1);break;case e.ErrorCode.RC_SOCKET_NOT_CREATED:case e.ErrorCode.RC_CONN_ACK_TIMEOUT:case e.ErrorCode.RC_TCP_RESET:this.recvConnectRes(t);break;case e.ErrorCode.RC_UDP_DISCONNECTED:this.recvConnectRes(t,!0,o);break;default:this.recvConnectRes(t,!0)}},o.prototype.recvConnectRes=function(t,o,r){if(this.connectResolve){var n=this.connectResolve,i=n.resolve,s=n.userId,a=Date.now()-(this._startTime+this._tcpDuration),c={bid:e.getbundleId(),cod:t,net:this.getNetwork().type,dur:a,spr:0,cid:this.uuid+"_"+this.retryCount,v:e.StatisticsVersion.CURRENT,count:this.retryCount};return this.statisticLog.record(e.StatisticsTag.IM_CMP_RMTP,JSON.stringify(c)),t===e.ErrorCode.SUCCESS&&(this._connectedTime=Date.now()-this.callCppProxy("getDeltaTime")),i({code:t,data:s}),void(this.connectResolve=null)}if(o)this.onDisconnectByServer(t,r);else{if(t===e.ErrorCode.RC_SOCKET_DISCONNECTED)if(this.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return;this.onDisconenctUnusual(t)}},o.prototype._onTcpConnectResponse=function(t,o,r,n,i,s,a){var c,u=this.cmpWeightCache.findIndex((function(e){return e.addr===o+":"+r})),p={bid:e.getbundleId(),ptc:e.ProtocalType.TCP,cod:t,net:this.getNetwork().type,dur:n,spr:0,pr:(null===(c=this._naviInfo)||void 0===c?void 0:c.type)||0,hos:o+":"+r,idx:u,rct:this.retryCount?e.ConnectType.RECONNECT:e.ConnectType.CONNECT,cid:this.uuid+"_"+this.retryCount,v:e.StatisticsVersion.CURRENT,rsn:this.reason,ddu:i,count:this.retryCount,weight:u>=0?this.cmpWeightCache[u].weight:-1};if(this.statisticLog.record(e.StatisticsTag.IM_CMP,JSON.stringify(p)),this.logger.info(y.P_CONNECT_ENTRY_S,JSON.stringify({code:t,host:o,port:r,duration:n,dnsDuration:i,index:s,isQuic:a})),t===Ce.SUCCESS)this.curCmpUrl=o+":"+r,this.updateCmpWeight(o+":"+r,!0,a);else if(t!==Ce.NOT_INIT){var d=r&&0!==r?o+":"+r:""+o;this.updateCmpWeight(d,!1)}},o}(e.AConnectionMgr),Pe=function(t){function o(e,o,n){var i=t.call(this,e,o)||this;i.appkey=e,i.logger=o,i.dbpath=n,i._cachePath="",i._cachePath=n+"/"+ce(e);var s=r.dirname(i._cachePath);return l.existsSync(s)||ve(s),i}return S(o,t),o.prototype.getCache=function(){return l.existsSync(this._cachePath)&&l.readFileSync(this._cachePath,{encoding:"utf8"})||null},o.prototype.setCache=function(e){l.writeFileSync(this._cachePath,e)},o.prototype.clearCache=function(){l.writeFileSync(this._cachePath,"")},o.prototype.sendRequest=function(e){return E(this,void 0,void 0,(function(){var t,o,r;return P(this,(function(n){switch(n.label){case 0:return[4,z(this.logger,{url:e,body:""})];case 1:return t=n.sent(),o=t.status,r=t.data,[2,{code:o,data:r}]}}))}))},o.prototype.decryptData=function(t){return E(this,void 0,void 0,(function(){var o,r;return P(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,ge(t,e.STATIC_CONFIG_KEY,e.STATIC_CONFIG_IV)];case 1:return o=n.sent(),[2,JSON.parse(o)];case 2:return r=n.sent(),this.logger.error(e.LogTagId.L_GET_STATIC_CONF_E,JSON.stringify({error:null==r?void 0:r.stack})),[3,3];case 3:return[2]}}))}))},o}(e.BasicStaticConfigManager),Te=function(t){function o(e,o,n,i,s,a,c){var u=t.call(this,o,e,n,a)||this;u.deviceId=i,u.model="",u.catchFilePath="",u.addon=c,u.model="Electron|"+process.platform+"|"+process.arch,u.catchFilePath=s+"/"+ue(e);var p=r.dirname(u.catchFilePath);return l.existsSync(p)||ve(p),u.init(),u}return S(o,t),o.prototype.httpRequest=function(t,o,r,n){return E(this,void 0,void 0,(function(){var i,s,a,c,u,p,d,l;return P(this,(function(f){switch(f.label){case 0:return(i=n).deviceId=this.deviceId,i.model=this.model,s={url:t,method:o,headers:r,body:JSON.stringify(i)},this.logger.info(e.LogTagId.L_REQUEST_T,JSON.stringify(s)),[4,z(this.logger,s)];case 1:a=f.sent(),c=a.status,u=a.data,p=void 0===u?"":u,this.logger.info(e.LogTagId.L_REQUEST_R,JSON.stringify({status:c,data:p}));try{return d=JSON.parse(p),l=d.data,[2,{code:c,data:l}]}catch(t){return this.logger.warn(e.LogTagId.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:c,data:p,error:t})),[2,{code:c,msg:t}]}return[2]}}))}))},o.prototype.setCloudControllerCache=function(t){l.writeFileSync(this.catchFilePath,JSON.stringify(t)),this.logger.info(e.LogTagId.L_CLOUD_SET_CACHE_O,JSON.stringify(t))},o.prototype.getLocalCloudControllerCache=function(){if(!l.existsSync(this.catchFilePath))return null;var t=l.readFileSync(this.catchFilePath,{encoding:"utf8"});return this.logger.info(e.LogTagId.L_CLOUD_GET_CACHE_O,JSON.stringify({appkey:this.appkey,data:t})),t},o.prototype.setMRTRConfig=function(t){var o={mrtrChatroom:t.chatroom,mrtrGroup:t.group,mrtrPrivate:t.private,mrtrUltraGroup:t.ultraGroup};this.logger.info(e.LogTagId.L_CLOUD_SET_MRTR_O,JSON.stringify(o)),this.addon.setCloudConfig(JSON.stringify(o))},o}(e.BaseCloudController);!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(me||(me={}));var Ie,Re=function(){function t(t,o,r,n,i,s,a){var c=this;this._appkey=t,this._cppProtocol=o,this._dbpath=r,this._dispatchEvent=n,this._enableSyncEmptyTopConversation=i,this._logOutputLevel=s,this._customMessageType={},this.cloudControllerUri="",this.cloudControllerLock=!0,this.cloudControllerMsgs=[],this._buildSubscribeEventData=function(t){var o=[];try{JSON.parse(t).list.forEach((function(t){var r=JSON.parse(t.obj),n=r.userId,i=r.subscribeType,s=r.subscribeTime,a=r.duration,u=r.operationType,p=r.details,d=void 0===p?[]:p,l=r.userProfile,f={userId:n,subscribeType:i,subscribeTime:s,expiry:a,operationType:u};[e.SubscribeType.ONLINE_STATUS,e.SubscribeType.FRIEND_ONLINE_STATUS].includes(i)&&(f.details=d.map((function(e){var t=JSON.parse(e);return{changeTime:t.changeTime,eventValue:t.changeValue,platform:t.platform}}))),[e.SubscribeType.USER_PROFILE,e.SubscribeType.FRIEND_USER_PROFILE].includes(i)&&(f.userProfile=c._string2userProfileInfo(l)),o.push(f)}))}catch(e){c.logger.error(y.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==e?void 0:e.stack,data:t}))}return o},this._chatroomCache=[],this.rtcHeartbeatResolves={};var u=this._dbpath,p=le(u);this.logger=new L(this._appkey,"RC-M","IM"),this._cppProtocol.initWithAppkey(t,u,e.FORMATED_VERSION,this.logger.getSessionId()),this._cppProtocol.setConsoleLogLevel((this._logOutputLevel||e.LogL.WARN)+1),this.statisticLog=new w(this._appkey,"RC-M","IM"),this.logger.setOutputLevel(this._logOutputLevel),N(this._cppProtocol,this.logger),this.reporter=new ne(this._cppProtocol,t,p,this.logger,a),this.logger.info(y.P_INIT_O,JSON.stringify({appkey:t,dbpath:u,proto_commit:this._cppProtocol.getNodeVersion(),deviceId:p,commit:"15c70e524b4791db3eb5b654a6368fce0d9438ab",processName:process.title,processPId:process.pid,disableLogReport:a})),this._callCppProxy("setDeviceId",p),this._staticConfigManager=new Pe(t,this.logger,u),this.navi=new ye(t,this.logger,this.statisticLog,u,this._staticConfigManager),this.tcpMgr=new Ee(t,this._callCppProxy.bind(this),this.navi,this.logger,this.statisticLog,{onConnected:this.onConnected.bind(this),onSuspend:this.onSuspend.bind(this),onDisconnected:this.onDisconnected.bind(this),onConnecting:this.onConnecting.bind(this),onDBUpgrateStart:this.dbUpgradeStart.bind(this),onDBUpgrading:this.dbUpgrading.bind(this),onDBUpgradeComplete:this.dbUpgradeComplete.bind(this)}),this._enableCreateEmptyTopConversation(this._enableSyncEmptyTopConversation),this._initCloudController(p,u),this._registerMsgTypes(),this._setOnReceiveMessageListener(),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),this._msgExpansionHandler=new fe(this._callCppProxy.bind(this))}return t.prototype._initCloudController=function(t,o){var r=e.urlCenter.getCloudControllerUrl();this.cloudControllerUri=r[0],this.cloudController=new Te(this._appkey,this.logger,this.reporter,t,o,this.statisticLog,this._cppProtocol),e.isStartCloudController()&&this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,e.InvokerType.init)},t.prototype.callProxy=function(t){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return E(this,void 0,void 0,(function(){var r,n,i;return P(this,(function(s){switch(s.label){case 0:if(!(r=this[t]))return this.logger.warn(y.P_CALL_MAIN_E,JSON.stringify({method:t,error:"not found"})),[2,Promise.resolve({code:e.ErrorCode.NOT_SUPPORT})];n="",s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.call.apply(r,T([this],o,!1))];case 2:return[2,s.sent()];case 3:return i=s.sent(),n=JSON.stringify({error:null==i?void 0:i.stack,method:t}),this.logger.error(y.P_CALL_MAIN_E,n),[3,4];case 4:return[2,{code:e.ErrorCode.MAIN_PROCESS_ERROR,msg:n}]}}))}))},t.prototype.sendProxy=function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return E(this,void 0,void 0,(function(){var o;return P(this,(function(r){if(!(o=this[e]))return this.logger.warn(y.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2];try{o.call.apply(o,T([this],t,!1))}catch(t){this.logger.error(y.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}return[2]}))}))},t.prototype.registerRenderers=function(t){var o=t.navigators,r=t.areaCode,n=t.logServerUrl,i=t.environment;this._environment=i||"default",this.navi.setEnvironment(i),e.urlCenter.init({areaCode:r,navigators:o,logServerUrl:n})},t.prototype.onConnected=function(){return E(this,void 0,void 0,(function(){var e,t,o;return P(this,(function(r){switch(r.label){case 0:return e=this.getNaviInfoFromCache(),this.reporter.checkStart(e),this._try2RejoinChatroom(),t=this._dispatchEvent,o=["onConnected"],[4,this.getMainProcessCache()];case 1:return t.apply(this,o.concat([r.sent()])),[2]}}))}))},t.prototype.onConnecting=function(){this._dispatchEvent("onConnecting",void 0)},t.prototype.onSuspend=function(e){this._dispatchEvent("onSuspend",e)},t.prototype.onDisconnected=function(e){this._dispatchEvent("onDisconnected",e)},t.prototype.dbUpgradeStart=function(){this._dispatchEvent("databaseUpgradeWillStart")},t.prototype.dbUpgrading=function(e){this._dispatchEvent("databaseUpgrading",e)},t.prototype.dbUpgradeComplete=function(e){this._dispatchEvent("databaseUpgradeDidComplete",e)},t.prototype._callCppProxy=function(e){for(var t,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];var n=this.logger.createTraceId();try{return this.logger.debug(y.P_CALL_ADDON_O,JSON.stringify({method:e,content:o}),n),(t=this._cppProtocol)[e].apply(t,o)}catch(t){throw this.logger.error(y.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),n),t}},t.prototype.refetchNaviInfo=function(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())},t.prototype.sendHTTPRequest=function(e){return z(this.logger,e)},t.prototype.onRendererLogsReceived=function(e){M.apply(void 0,e)},t.prototype.onRendererNetworkStatusReceived=function(t,o){if(this.tcpMgr.setNetwork(t,o),t.status&&e.isStartCloudController()&&this.cloudController){var r=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,e.InvokerType.newWorkChange,r)}},t.prototype.destroy=function(){this.reporter.stop(),this._cppProtocol,O(),this._cppProtocol.destroy(),process.exit(0)},t.prototype.callExtra=function(t){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];var n=this[t];if(!n)return this.logger.warn(y.P_CALL_EXTRA_E,JSON.stringify({method:t,error:"not found"})),Promise.resolve({code:e.ErrorCode.NOT_SUPPORT});try{return n.call.apply(n,T([this],o,!1))}catch(e){this.logger.error(y.P_CALL_EXTRA_E,JSON.stringify({error:null==e?void 0:e.stack,method:t}))}return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})},t.prototype.getConversationsByPage=function(t,o,r,n,i){var s,a=this,c=this._callCppProxy("getConversationListByPageWithTopPriority",t,o,r,i||!1,n||"");try{s=JSON.parse(c).list.map((function(e){return a._buildConversation(e.obj)}))}catch(t){return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:s})},t.prototype.getUnreadConversationList=function(t){var o,r=this,n=this._callCppProxy("getUnreadConversationList",t);try{o=JSON.parse(n).list.map((function(e){return r._buildConversation(e.obj)}))}catch(t){return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:o})},t.prototype.getConversationListWithAllChannel=function(){var t,o=this,r=[e.ConversationType.PRIVATE,e.ConversationType.GROUP,e.ConversationType.SYSTEM,e.ConversationType.APP_PUBLIC_SERVICE,e.ConversationType.PUBLIC_SERVICE],n=this._callCppProxy("getConversationListWithAllChannel",r);try{t=JSON.parse(n).list.map((function(e){return o._buildConversation(e.obj)}))}catch(t){return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})},t.prototype.getConversationListWithAllChannelByPage=function(t,o){var r,n=this,i=[e.ConversationType.PRIVATE,e.ConversationType.GROUP,e.ConversationType.SYSTEM,e.ConversationType.APP_PUBLIC_SERVICE,e.ConversationType.PUBLIC_SERVICE],s=this._callCppProxy("getConversationListWithAllChannelByPage",i,t,o);try{r=JSON.parse(s).list.map((function(e){return n._buildConversation(e.obj)}))}catch(t){return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:r})},t.prototype.getHistoryMessagesByObjectNames=function(t,o,r,n,i,s,a){var c=0===s,u=n+1,p=this._callCppProxy("getHistoryMessagesByObjectNames",t,o,r,u,i,c,a||""),d=[];try{var l=JSON.parse(p).list;l.reverse();for(var f=0;f<l.length;f++){var h=this._buildMessage(l[f].obj);d[f]=h}}catch(t){return Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:{list:u===d.length?d.slice(1,u):d,hasMore:n<d.length}})},t.prototype.updateMessageReceiptStatus=function(t,o,r,n){void 0===n&&(n="");var i=this._callCppProxy("updateMessageReceiptStatus",t,o,r,n);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:i})},t.prototype.getNaviInfoFromCache=function(){return this.tcpMgr.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())},t.prototype.createLogger=function(e,t){return/^RC/.test(e)?null:new L(this._appkey,e,t)},t.prototype.getConnectedTime=function(){return this.tcpMgr.getConnectedTime()},t.prototype.getServerTime=function(){return Date.now()-this._cppProtocol.getDeltaTime()},t.prototype.getCurrentUserId=function(){return this.tcpMgr.getCurrentUserId()},t.prototype.getMainProcessCache=function(){var e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),o=this.getNaviInfoFromCache(),r=this.tcpMgr.getCurrentUserId(),n=this.getDeviceId(),i=this._cppProtocol.getDeltaTime();return Promise.resolve({connectedTime:e,deviceId:n,crtUserId:r,naviInfo:o,connectionStatus:t,deltaTime:i})},t.prototype._enableCreateEmptyTopConversation=function(e){this._callCppProxy("enableCreateEmptyTopConversation",e)},t.prototype._registerMsgTypes=function(){for(var t in e.SEND_MESSAGE_TYPE_OPTION["RC:RcCmd"]={isCounted:!1,isPersited:!1},e.SEND_MESSAGE_TYPE_OPTION){var o=e.SEND_MESSAGE_TYPE_OPTION[t],r=o.isCounted,n=o.isPersited,i=o.searchProps,s=0;n&&(s|=1),r&&(s|=2),"RC:TypSts"===t&&(s=16),this._callCppProxy("registerMessageType",t,s,i||[])}},t.prototype._buildIsMentioned=function(t,o){var r,n=!1;if(e.isObject(t))r=t;else try{r=t?JSON.parse(t):t}catch(e){r=t,this.logger.error(y.P_PARSE_JSON_MSGS_E,JSON.stringify({content:t}))}return e.isObject(r)&&(n=!!r.mentionedInfo),{isMentioned:n,msgContent:r}},t.prototype._buildMsgOption=function(t){var o={isCounted:!1,isPersited:!1};return t in e.SEND_MESSAGE_TYPE_OPTION?o=e.SEND_MESSAGE_TYPE_OPTION[t]:t in this._customMessageType&&(o=this._customMessageType[t]),o},t.prototype._buildSupportExt=function(e,t,o){var r=null;return e&&(r=this._msgExpansionHandler.parseReceiveExpansion(o),"conversation"!==t&&"history"!==t||(r=this._msgExpansionHandler.parseConverOrHisExpansion(o))),r},t.prototype._handleReadReceiptRequest=function(e){var t=JSON.parse(e),o=this.getNaviInfoFromCache();if(!(null==o?void 0:o.grpRRVer))return t;var r=t,n=r.hasRespond,i=r.readerInfo,s=void 0===i?{}:i,a=r.readCount,c=r.totalCount,u=r.readerList,p=void 0===u?[]:u,d={readCount:a,totalCount:c};if(1===(null==o?void 0:o.grpRRVer)){var l=[];for(var f in s)l.push({userId:f,readTime:s[f]});d.readerList=l,d.hasRespond=n}return 3===(null==o?void 0:o.grpRRVer)&&(d.readerList=p),d},t.prototype._buildMessage=function(t,o){var r;void 0===o&&(o={});var n=o.isOffLineMessage,i=o.buildFrom,s=JSON.parse(t),a=s.channelId,c=s.conversationType,u=s.targetId,p=s.senderUserId,d=s.content,l=s.objectName,f=s.messageUid,h=s.direction,C=s.status,g=s.messageId,v=s.sentTime,_=s.readReceiptRequest,S=s.supportExt,y=s.pushContent,E=s.pushTitle,P=s.pushId,T=s.pushConfig,I=s.templateId,R=s.disableTitle,O=s.forcePushDetail,N=s.hasMore,M=s.directedUsers,b=s.noNotification,U=s.disableUpdateLastMessage,x=this._buildIsMentioned(d,g),L=x.isMentioned,w=x.msgContent,A=this._buildMsgOption(l),k=this._buildSupportExt(S,i,s),D=e.isUndefined(n)?v<this.tcpMgr.getConnectedTime():n,J={};T&&(J=e.pushJSONToConfigs(this.logger,T,P));var G=m(m({},J),{pushTitle:E,pushContent:y,pushData:y,disablePushTitle:R,forceShowDetailContent:O,templateId:I}),F={channelId:a,conversationType:c,targetId:u,senderUserId:p,content:w||{},messageType:l,messageUId:f||"",messageDirection:h,isOffLineMessage:D,sentTime:v,receivedTime:0,isPersited:A.isPersited,isCounted:A.isCounted,isMentioned:L,disableNotification:b,isStatusMessage:(null===(r=this._customMessageType[l])||void 0===r?void 0:r.isStatusMessage)||!1,canIncludeExpansion:S,expansion:S?k:null,receivedStatus:C,receivedStatusInfo:e.transformReceivedStatusInfo(C),messageId:g,pushConfig:G,hasMore:N,directedUserIds:M||[],disableUpdateLastMessage:U};if(h===e.MessageDirection.RECEIVE?F.receivedStatus=this._compatibleReceivedStatus(F.receivedStatusInfo):h===e.MessageDirection.SEND&&(F.sentStatus=C),_){var B=this._handleReadReceiptRequest(_);F.readReceiptInfo=B}return F},t.prototype._compatibleReceivedStatus=function(t){var o=e.ReceivedStatus.UNREAD;return t.isRead?o=e.ReceivedStatus.READ:t.isListened?o=e.ReceivedStatus.LISTENED:t.isDownload?o=e.ReceivedStatus.DOWNLOADED:t.isRetrieved&&(o=e.ReceivedStatus.RETRIEVED),o},t.prototype._updateReadReceiptInfo=function(e,t){var o=this._callCppProxy("getMessage",e),r=JSON.parse(o),n=r.readReceiptRequest?JSON.parse(r.readReceiptRequest):{},i=m(m({},n),t);this._callCppProxy("updateReadReceiptRequestInfo",e,JSON.stringify(i))},t.prototype._processRRRspMsg=function(e,t,o){if(t!==this.getCurrentUserId())for(var r=0,n=e[this.getCurrentUserId()]||[];r<n.length;r++){h=n[r];var i=this._callCppProxy("getMessage",h),s=JSON.parse(i),a=s.readReceiptRequest?JSON.parse(s.readReceiptRequest):{},c=a.isReceiptRequestMessage,u=a.readerList,p=void 0===u?[]:u;c&&!p.includes(t)&&(p.push(t),this._callCppProxy("updateReadReceiptRequestInfo",h,JSON.stringify({isReceiptRequestMessage:c,readerList:p})))}else for(var d in e)for(var l=0,f=e[d];l<f.length;l++){var h=f[l];this._callCppProxy("updateReadReceiptRequestInfo",h,JSON.stringify({isReceiptRequestMessage:!0,hasRespond:!0}))}},t.prototype._processRSMsg=function(t){var o=t.conversationType,r=t.targetId,n=t.content,i=t.channelId,s=n.msgId,a=n.rrn,c=n.tmn,u=n.endMsgTime;o===e.ConversationType.PRIVATE?this.updateMessageReceiptStatus(o,r,u,i||""):this._updateReadReceiptInfo(s,{readCount:a,totalCount:c});var p={conversationType:o,targetId:r,channelId:i};this._sendMessageReadReceipt(o===e.ConversationType.PRIVATE?{privateReadReceipt:m(m({},p),{endMsgTime:n.endMsgTime})}:{groupReadReceipt:m(m({},p),{totalCount:n.tmn,readedCount:n.rrn,messageUId:n.msgId})})},t.prototype._processSRSMsg=function(e){var t=this.getNaviInfoFromCache(),o=e.conversationType,r=e.targetId,n=e.content,i=e.channelId,s=e.senderUserId,a=e.sentTime;return s===this.tcpMgr.getCurrentUserId()&&(this._callCppProxy("clearUnreadCountByTimestamp",o,r,n.lastMessageSendTime,i||""),1!==(null==t?void 0:t.sesDriven)||(a>this.tcpMgr.getConnectedTime()||this._sendsyncReadStatus({conversationType:o,targetId:r,channelId:i,timestamp:n.lastMessageSendTime}),!1))},t.prototype._buildConversation=function(t){var o=JSON.parse(t),r=o.channelId,n=o.conversationType,i=o.targetId,s=o.unreadCount,a=o.lastestMsg,c=o.isTop,u=o.blockStatus,p=o.matchCount,d=o.hasUnreadMention,l=o.conversationTime,f=o.draft,h=u>0?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE;return{channelId:r,conversationType:n,targetId:i,unreadMessageCount:s,latestMessage:-1===JSON.parse(a).messageId?null:this._buildMessage(a),hasMentioned:d,mentionedInfo:null,notificationStatus:h,isTop:c,lastUnreadTime:0,matchCount:p,operationTime:l,notificationLevel:u,draft:f}},t.prototype._convertResultList=function(e,t){var o=JSON.parse(e).list;return o=o.map((function(e){var o=JSON.parse(e.obj);return t?t(o):o}))},t.prototype._handleNotNotificationMessage=function(t){var o,r=t.messageType,n=t.senderUserId,i=t.content;if(r===e.MessageType.LOG_COMMAND&&t.senderUserId===e.RC_DEFAULT_USER){var s=t.content,a=s.startTime,c=s.endTime,u=s.platform,p=s.logId,d=s.uri;return this.reporter.report(parseInt(a,10),parseInt(c,10),u,d,p,t.messageUId),!0}if(r===e.MessageType.CLOUD_CONTROL&&n===e.RC_DEFAULT_USER)return this.cloudControllerMsgs.push(t),this._ccMsgHandler(),!0;if(r===e.MessageType.READ_STATE)return this._processRSMsg(t),!0;if("RC:MsgExMsg"===r)return this._msgExpansionHandler.setLocalFromExtMsg(this.logger,t),this._sendMessageExpansion(t),!0;if(r===e.MessageType.SYNC_READ_STATUS&&!this._processSRSMsg(t))return!0;if(r===e.MessageType.DELIVERED)return this._callCppProxy("setMessageDeliverTime",JSON.stringify(i)),this._sendMessageDelivered(t.content.map((function(e){return{deliverTime:e.time,messageUId:e.messageUId,objectName:e.objectName,targetId:e.targetId}}))),!0;if(r===e.MessageType.DELIVERED_MSG){var l={totalCount:t.content.tmn,list:null===(o=t.content.dl)||void 0===o?void 0:o.map((function(e){return{MessageUId:e.msgId,deliveryCount:e.drn}}))};return this._sendGroupMessageDeliveredStatus(l),!0}return!1},t.prototype._setOnReceiveMessageListener=function(){var t=this;this._cppProtocol.setOnReceiveMessageListener((function(o,r,n,i){try{var s=t._buildMessage(o,{isOffLineMessage:n}),a=s.messageType,c=s.channelId,u=void 0===c?"":c,p=s.senderUserId,d=s.content,l=s.sentTime,f=s.conversationType,h=s.targetId;if(t._handleNotNotificationMessage(s))return;if(a===e.MessageType.READ_RECEIPT_REQUEST&&d.messageUId&&t._updateReadReceiptInfo(d.messageUId,{isReceiptRequestMessage:!0,hasRespond:!1}),a===e.MessageType.READ_RECEIPT_RESPONSE&&d.receiptMessageDic&&t._processRRRspMsg(d.receiptMessageDic,p,l),a===e.MessageType.GROUP_READ_RECEIPT_REQUEST){var C=d.msgId,g=d.rrn,v=d.tmn;t._updateReadReceiptInfo(C,{readCount:g,totalCount:v})}s.canIncludeExpansion&&t._msgExpansionHandler.setLocalFromReceiveMsg(t.logger,s),a===e.MessageType.READ_RECEIPT&&p===t.tcpMgr.getCurrentUserId()&&t._callCppProxy("clearUnreadCountByTimestamp",f,h,d.lastMessageSendTime,u);var _=!0;if(0!==r||i||(_=!1),a===e.MessageType.RECALL){if(!t.handleRecalledMessage(s))return;var S=t._fixRecallContentInfo(s);f=S.conversationType,h=S.targetId}t._sendMessageNotification(Object.assign(s,{hasMoreMsg:_,conversationType:f,targetId:h}))}catch(e){t.logger.error(y.P_RECEIVE_MESSAGE_E,JSON.stringify({error:null==e?void 0:e.stack,message:o}))}}),(function(){t._sendPullOfflineFinished()}))},t.prototype._ccMsgHandler=function(){var t;return E(this,void 0,void 0,(function(){var o,r;return P(this,(function(n){switch(n.label){case 0:return this.cloudControllerLock?(this.cloudControllerLock=!1,this.cloudControllerMsgs.shift()?(o=this.tcpMgr.getToken(),[4,null===(t=this.cloudController)||void 0===t?void 0:t.request(this.cloudControllerUri,e.InvokerType.other,o)]):[3,2]):[2];case 1:r=n.sent()||0,this.cloudControllerMsgs=this.cloudControllerMsgs.filter((function(e){return e.sentTime>r})),this.cloudControllerLock=!0,this._ccMsgHandler(),n.label=2;case 2:return[2]}}))}))},t.prototype._fixRecallContentInfo=function(e){var t=e.conversationType,o=e.targetId;return e.senderUserId===this.tcpMgr.getCurrentUserId()&&(t=e.content.conversationType||t,o=e.content.targetId||o),{conversationType:t,targetId:o}},t.prototype.handleRecalledMessage=function(t){var o=t.content,r=o.messageUId,n=o.sentTime;if(!r)return!0;var i=this._callCppProxy("getMessage",r),s=this._buildMessage(i,{isOffLineMessage:!1});if(t.content.isDelete)return-1===s.messageId||this._callCppProxy("deleteMessages",[s.messageId]),!0;if(s.messageType===e.MessageType.RECALL_NOTIFICATION_MESSAGE)return!1;var a={recallTime:Date.now(),admin:!!t.content.isAdmin,originalObjectName:s.messageType,originalMessageContent:s.content,recallActionTime:t.sentTime,operatorId:t.senderUserId};if(t.content.user&&(a.user=t.content.user),t.content.extra&&(a.extra=t.content.extra),s.messageType===e.MessageType.TextMessage&&(a.recallContent=s.content.content),-1===s.messageId){var c=t.conversationType,u=t.targetId,p=t.senderUserId,d=t.channelId,l=t.messageDirection;return this._callCppProxy("insertMessage",c,u,p,e.MessageType.RECALL_NOTIFICATION_MESSAGE,JSON.stringify(a),(function(){}),(function(){}),l,1,30,n,"",0,r,!1,!0,JSON.stringify({}),d||""),!0}return s.receivedStatus||this.setMessageReceivedStatus(s.messageId,1),this._callCppProxy("setMessageContent",s.messageId,JSON.stringify(a),e.MessageType.RECALL_NOTIFICATION_MESSAGE),!0},t.prototype._sendMessageExpansion=function(e){var t=e.channelId,o=void 0===t?"":t,r=e.content,n=e.conversationType,i=e.targetId,s=r,a=s.put,c=s.del,u=s.mid,p={};a&&(p.updatedExpansion={channelId:o,messageUId:u,expansion:a,conversationType:n,targetId:i}),c&&(p.deletedExpansion={channelId:o,messageUId:u,deletedKeys:c,conversationType:n,targetId:i}),this._dispatchEvent("expansion",p)},t.prototype._sendMessageNotification=function(e){this._dispatchEvent("batchMessage",e)},t.prototype._sendPullOfflineFinished=function(){this._dispatchEvent("pullFinished",null)},t.prototype._sendMessageDelivered=function(e){this._dispatchEvent("messageDelivered",e)},t.prototype._sendGroupMessageDeliveredStatus=function(e){this._dispatchEvent("groupMessageDeliveredStatus",e)},t.prototype._sendChatroomStatus=function(e){this._dispatchEvent("chatroom",e)},t.prototype._sendMessageReadReceipt=function(e){this._dispatchEvent("messageReadReceipt",e)},t.prototype._sendsyncReadStatus=function(e){this._dispatchEvent("syncReadStatus",e)},t.prototype._setConversationStatusListener=function(){var t=this;this._cppProtocol.setConversationStatusListener((function(o){var r=JSON.parse(o).list,n=[];r.forEach((function(t){var o=JSON.parse(t.obj),r=o.conversationType,i=o.targetId,s=o.status,a=o.channelId,c={notificationStatus:2,isTop:!1};s.forEach((function(t){var o=JSON.parse(t.item);1===o.type?c.notificationStatus=1===Number(o.value)?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE:c.isTop=1===Number(o.value)})),n.push({channelId:a,conversationType:r,targetId:i,updatedItems:{notificationStatus:{val:c.notificationStatus,time:0},isTop:{val:c.isTop,time:0}}})})),t._dispatchEvent("conversation",n)}),(function(e){t._dispatchEvent("conversationTag",e)}),(function(e,o,r,n){t._callCppProxy("clearUnreadCountByTimestamp",e,o,n,r||""),t._sendsyncReadStatus({conversationType:e,targetId:o,channelId:r,timestamp:n})}))},t.prototype._setPushNotificationListener=function(){var e=this;this._cppProtocol.setPushNotificationListener((function(){}),(function(t){e._dispatchEvent("tag",t),e._getRTCProfile()}))},t.prototype._getRTCProfile=function(){var e=this._callCppProxy("getRTCProfile");if(e){var t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);var o=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",o)}},t.prototype._setRTCLivingRoomEventListener=function(){var e=this;this._cppProtocol.setRTCRoomEventListener((function(t){e._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(t))}))},t.prototype._setChatroomEventListener=function(){var e=this;this._cppProtocol.setChatroomEventListener((function(t,o){e._sendChatroomStatus({chatroomDestroyed:t})}))},t.prototype._setCallInfoListener=function(){var e=this;this._cppProtocol.setCallInfoListener((function(t){var o=[];try{JSON.parse(t).list.forEach((function(e){Object.entries(e).forEach((function(e){var t=e[0],r=e[1];o.push({key:t,value:r})}))}))}catch(t){e.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:t}))}e._dispatchEvent("callInfo",JSON.stringify({list:o}))}))},t.prototype._setSubscribeEventListener=function(){var t=this;this._cppProtocol.setSubscribeEventListener((function(){}),(function(e){t._dispatchEvent("syncSubscribedUserStatusFinished",e)}),(function(e){var o=t._buildSubscribeEventData(e).map((function(e){return{userId:e.userId,subscribeType:e.subscribeType,subscribeTime:e.subscribeTime,expiry:e.expiry,operationType:e.operationType}}));t._dispatchEvent("subscribedRelationChange",o)}),(function(o){var r=t._buildSubscribeEventData(o).map((function(t){var o=t.userId,r=t.subscribeType,n=t.subscribeTime,i=t.expiry,s=t.details,a=t.userProfile,c={userId:o,subscribeType:r,subscribeTime:n,expiry:i};return[e.SubscribeType.ONLINE_STATUS,e.SubscribeType.FRIEND_ONLINE_STATUS].includes(r)?c.details=s:[e.SubscribeType.USER_PROFILE,e.SubscribeType.FRIEND_USER_PROFILE].includes(r)&&(c.userProfile=a),c}));t._dispatchEvent("subscribedUserStatusChange",r)}))},t.prototype._setUserProfileListener=function(){var e=this;this._cppProtocol.setUserProfileListener((function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){e._dispatchEvent("ownUserProfileChanged",e._string2userProfileInfo(t))}))},t.prototype._onGroupOperationChanged=function(e,t,o,r,n){var i,s,a=[];try{i=JSON.parse(r),a=JSON.parse(n),s=JSON.parse(e);var c={groupId:i[0]?i[0].groupId:"",operatorInfo:this._convertGroupMemberInfoList([s])[0],operation:t,operationTime:o};0===t?c.groupInfo=this._convertGroupInfoList(i)[0]:c.memberInfos=this._convertGroupMemberInfoList(a),this._dispatchEvent("groupOperation",c)}catch(t){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:r,membersJson:n,operatorInfo:e}))}},t.prototype._onGroupInfoChanged=function(t,o,r,n,i){try{var s=JSON.parse(r),a=JSON.parse(n);switch(t){case e.GroupInfoChangeSubChangeType.GROUP_INFO_CHANGE:this._dispatchEvent("groupInfoChanged",{operatorInfo:this._convertGroupMemberInfoList([s])[0],operationTime:i,groupInfo:this._convertUpdateGroupInfoList(a)[0]});break;case e.GroupInfoChangeSubChangeType.GROUP_REMARK_DELETE:case e.GroupInfoChangeSubChangeType.GROUP_REMARK_SET:var c=t===e.GroupInfoChangeSubChangeType.GROUP_REMARK_SET?e.GroupOperationType.ADD:e.GroupOperationType.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:o,operationType:c,operationTime:i,groupRemark:a[0]?a[0].remark:""})}}catch(e){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:n,operatorInfoJson:r}))}},t.prototype._onGroupMemberInfoChanged=function(e,t,o,r){try{var n=JSON.parse(t),i=JSON.parse(o),s={groupId:e,operatorInfo:this._convertGroupMemberInfoList([n])[0],memberInfo:this._convertGroupMemberInfoList([i])[0],operationTime:r};this._dispatchEvent("groupMemberInfoChanged",s)}catch(e){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:o}))}},t.prototype._onGroupRequestChanged=function(e,t,o,r){try{var n=JSON.parse(o),i=n.groupId,s=n.joinUser,a=n.approverUser,c=n.inviterUser,u=n.type,p=n.status,d=n.direction,l=n.remark,f=m(m(m(m({groupId:i},s&&{joinMemberInfo:this._convertGroupMemberInfoList([s])[0]}),c&&c.userId&&{inviterInfo:this._convertGroupMemberInfoList([c])[0]}),a&&a.userId&&{operatorInfo:this._convertGroupMemberInfoList([a])[0]}),{status:p,direction:d,type:u,operationTime:r,reason:l});this._dispatchEvent("groupApplicationEvent",f)}catch(e){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:o}))}},t.prototype._onFavoriteMembersChanged=function(t,o,r,n){try{var i=JSON.parse(r),s=[];i&&e.isArray(i.list)&&(s=i.list.map((function(e){return e.value}))),this._dispatchEvent("groupFollowsChangedSync",{groupId:t,operationType:o,operationTime:n,userIds:s})}catch(e){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:r}))}},t.prototype._setEntrustGroupListener=function(){this._cppProtocol.setEntrustGroupListener(this._onGroupOperationChanged.bind(this),this._onGroupInfoChanged.bind(this),this._onGroupMemberInfoChanged.bind(this),this._onGroupRequestChanged.bind(this),this._onFavoriteMembersChanged.bind(this))},t.prototype._onFriendApplicationStatusChanged=function(e,t,o,r,n,i){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:o,directionType:r,operationTime:n,extra:null!=i?i:""})},t.prototype._onFriendAdd=function(e,t,o,r,n){this._dispatchEvent("friendAdd",{userId:t,name:o,portraitUri:r,directionType:e,operationTime:n})},t.prototype._onFriendDelete=function(e,t,o){this._dispatchEvent("friendDelete",{userIds:t,directionType:e,operationTime:o})},t.prototype._onFriendsClearedFromServer=function(e){this._dispatchEvent("friendCleared",e)},t.prototype._onFriendInfoChangedSync=function(e,t,o){try{var r=JSON.parse(o);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:r.list})}catch(e){this.logger.error(y.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:o}))}},t.prototype._setFriendEventListener=function(){this._cppProtocol.setFriendEventListener(this._onFriendApplicationStatusChanged.bind(this),this._onFriendAdd.bind(this),this._onFriendDelete.bind(this),this._onFriendsClearedFromServer.bind(this),this._onFriendInfoChangedSync.bind(this))},t.prototype.registerMessageType=function(e,t,o,r,n){var i=0;t&&(i|=1),o&&(i|=2),n&&(i=16),this._customMessageType[e]={isCounted:o,isPersited:t,isStatusMessage:n},this.logger.info(y.P_REGTYP_O,JSON.stringify({type:e,opt:i,search:r})),this._callCppProxy("registerMessageType",e,i,r||[])},t.prototype.connect=function(e,t,o,r){return this.tcpMgr.connect(e,t,o,r)},t.prototype.reconnect=function(t,o,r){var n=e.ErrorCode.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(t,o,r,n)},t.prototype.reportSDKInfo=function(e){var t=JSON.stringify(m(m({},e),{"electron-main":"5.12.4"}));this.logger.info(y.P_REPORT_VER_O,t),this._callCppProxy("uploadSDKVersion",t,"")},t.prototype.disconnect=function(e){e=e||!0,this._chatroomCache.length=0,this.reporter.stop(),$(null,this.logger),this.tcpMgr.disconnect(e)},t.prototype.logout=function(){this.disconnect()},t.prototype.setUserStatusListener=function(e,t){this._cppProtocol.setOnReceiveStatusListener((function(e,o){t({userId:e,status:o})}));var o=e.userIds||[];o.length&&this.subscribeUserStatus(o)},t.prototype.subscribeUserStatus=function(t){var o=this;return new Promise((function(r){o._callCppProxy("subscribeUserStatus",t,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.setUserStatus=function(t){var o=this;return new Promise((function(r){o._callCppProxy("setUserStatus",t,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.getUserStatus=function(t){var o=this;return new Promise((function(r){o._callCppProxy("getUserStatus",t,(function(t){setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:{status:t}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype._handleDirectionalUserIdList=function(t,o){var r=t.messageType,n=t.content,i=t.directionalUserIdList,s=void 0===i?[]:i,a=o===e.ConversationType.GROUP;if(r===e.MessageType.READ_RECEIPT_RESPONSE&&n.receiptMessageDic&&a)for(var c in n.receiptMessageDic)s.push(c);return r===e.MessageType.SYNC_READ_STATUS&&e.isSupportDirectMessage(o)&&(s=[this.getCurrentUserId()]),s},t.prototype._handleMessage2Callback=function(t,o){var r=this;if("RC:MsgExMsg"===t.messageType&&this._msgExpansionHandler.setLocalFromExtMsg(this.logger,t),t.messageType===e.MessageType.READ_RECEIPT_REQUEST)this._updateReadReceiptInfo(o.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});else if(t.messageType===e.MessageType.READ_RECEIPT_RESPONSE){var n=o.content.receiptMessageDic;if(!n)return;for(var i in n)n[i].forEach((function(e){r._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}},t.prototype.sendMessage=function(t,o,r,n,i){var s=this;void 0===i&&(i=this.logger.createTraceId());var a=r.messageType,c=r.content,u=r.expansion,p=r.pushConfig,d=r.pushContent,l=void 0===d?"":d,f=r.pushData,h=void 0===f?"":f,C=r.directionalUserIdList,g=void 0===C?[]:C,v=r.disableNotification,_=void 0!==v&&v,S=r.canIncludeExpansion,m=void 0!==S&&S,E=r.isVoipPush,P=void 0!==E&&E,T=r.channelId,I=void 0===T?"":T,R=r.messageId,O=void 0===R?0:R,N=r.disableUpdateLastMessage,M=void 0!==N&&N,b=p||{},U=b.iOSConfig,x=b.androidConfig,L=b.harmonyOSConfig,w=b.templateId,A=void 0===w?"":w,k=b.pushTitle,D=void 0===k?"":k,J=b.pushContent,G=void 0===J?l:J,F=b.pushData,B=void 0===F?h:F,j=b.disablePushTitle,V=void 0!==j&&j,q=b.forceShowDetailContent,H=void 0!==q&&q,K=e.pushConfigsToJSON(U,x,L);return new Promise((function(p){l=G,h=B;var d=(null==x?void 0:x.notificationId)||"";g=s._handleDirectionalUserIdList(r,t);var f={};for(var C in u)f[C]={v:""},f[C].v=u[C];var v=A;s.logger.info(y.P_SEND_MSG_T,JSON.stringify({messageType:a,conversationType:t,targetId:o,channelId:I}),i);var S=s._callCppProxy("sendMessage",(function(t,o){var n=s._buildMessage(t,{isOffLineMessage:!1});if(s.logger.info(y.P_SEND_MSG_R,JSON.stringify({code:o,messageUId:n.messageUId}),i),o===e.ErrorCode.SENSITIVE_REPLACE)return setTimeout((function(){p({code:o})}),0);[e.MessageType.READ_RECEIPT_REQUEST,e.MessageType.READ_RECEIPT_RESPONSE,e.MessageType.EXPANSION_NOTIFY].findIndex((function(e){return e===n.messageType}))>-1&&s._handleMessage2Callback(n,r),n.canIncludeExpansion&&s._msgExpansionHandler.setLocalFromReceiveMsg(s.logger,n),setTimeout((function(){p({code:e.ErrorCode.SUCCESS,data:n})}),0)}),(function(e,t){var o=s._buildMessage(e,{isOffLineMessage:!1});s.logger.warn(y.P_SEND_MSG_R,JSON.stringify({code:t,messageId:o.messageId}),i),o.sentTime=Date.now()-s._cppProtocol.getDeltaTime(),setTimeout((function(){p({code:t,data:o})}),0)}),t,o,a,JSON.stringify(c),g,_,V,H,l,h,d,D,K,v,m,JSON.stringify(f),P,I,O,M),E=JSON.parse(S);null==n||n(E.messageId)}))},t.prototype.recallMsg=function(t,o,r,n,i){var s=this;return new Promise((function(a){var c,u=i.user,p=i.pushContent,d=i.channelId,l=i.extra,f=i.pushConfig,h=i.disableNotification,C=i.isDelete,g=i.directionalUserIdList,v=i.disableUpdateLastMessage,_={conversationType:t,targetId:o,messageUId:r,sentTime:n,user:u,extra:l,channelId:d,isDelete:C||!1};u&&(_.user=u),l&&(_.extra=l);var S={conversationType:t,targetId:o,senderUserId:s.tcpMgr.getCurrentUserId(),content:_,objectName:e.MessageType.RECALL,messageUid:r,direction:e.MessageDirection.SEND,status:e.ReceivedStatus.UNREAD,sentTime:n,channelId:d},y=s._buildMessage(JSON.stringify(S),{isOffLineMessage:!1});s._callCppProxy("recallMessage",(function(){s.handleRecalledMessage(y),y.pushConfig=f,setTimeout((function(){a({code:e.ErrorCode.SUCCESS,data:y})}),0)}),(function(e){setTimeout((function(){a({code:e})}),0)}),e.MessageType.RECALL,JSON.stringify(_),h||!1,(null==f?void 0:f.disablePushTitle)||!1,(null==f?void 0:f.forceShowDetailContent)||!1,p||"",(null==f?void 0:f.pushData)||"",(null===(c=null==f?void 0:f.androidConfig)||void 0===c?void 0:c.notificationId)||"",(null==f?void 0:f.pushTitle)||"",e.pushConfigsToJSON(null==f?void 0:f.iOSConfig,null==f?void 0:f.androidConfig,null==f?void 0:f.harmonyOSConfig),(null==f?void 0:f.templateId)||"",d,g||[],r,null!=v&&v)}))},t.prototype.getHistoryMessage=function(t,o,r,n,i,s,a){var c=this;return new Promise((function(u){r=r||0;var p=0===i,d=n+1,l=c._callCppProxy("getHistoryMessages",t,o,r,d,a,p,s),f=JSON.parse(l).list,h=[];f.reverse();for(var C=0;C<f.length;C++){var g=c._buildMessage(f[C].obj);h[C]=g}u({code:e.ErrorCode.SUCCESS,data:{list:d===h.length?h.slice(1,d):h,hasMore:n<h.length}})}))},t.prototype.getMessages=function(t,o,r,n,i,s){var a=this;return new Promise((function(c){var u=0===i,p=r,d=0!==r,l=n+1;d&&(p+=u?1:-1,l++);for(var f=a._callCppProxy("getMessages",t,o,p,l,u,s),h=JSON.parse(f).list,C=[],g=0;g<h.length;g++){var v=a._buildMessage(h[g].obj);C[g]=v}var _=a._computeRepairInfo(C,u,r,p,l),S=_.isNeedRepair,y=void 0!==S&&S,m=_.repairTime,E=void 0===m?0:m;if(!y)return d&&(C.shift(),l--),C.reverse(),void c({code:e.ErrorCode.SUCCESS,data:{list:l===C.length?C.slice(1,l):C,hasMore:n<C.length}});a._processRepairHisMsg(t,o,r,n,i,s,E,c)}))},t.prototype._computeRepairInfo=function(e,t,o,r,n){var i=!1,s=0,a=this.getNaviInfoFromCache()||{},c=a.repairHisMsg,u=void 0===c?0:c,p=a.historyMsg;if(1!==u||!p)return{isNeedRepair:i,repairTime:s};var d=e.findIndex((function(e){return e.hasMore||0===Object.keys(e.content).length}));return t&&d>=0?(i=!0,s=e[d].hasMore?e[d].sentTime:e[d].sentTime+1):!t&&d>=1?(i=!0,s=e[d-1].sentTime):e.length<n||0===o?(i=!0,s=o):e.length>0&&e[0].sentTime!==o&&(i=!0,s=r),{isNeedRepair:i,repairTime:s}},t.prototype._processRepairHisMsg=function(e,t,o,r,n,i,s,a){var c=this,u=function(s){for(var u=0===n,p=r+1,d=c._callCppProxy("getMessages",e,t,o,p,u,i),l=JSON.parse(d).list,f=[],h=0;h<l.length;h++){var C=c._buildMessage(l[h].obj);f[h]=C}f.reverse(),a({code:s,data:{list:p<=f.length?f.slice(1,p):f,hasMore:r<f.length}})},p=r+10>100?100:r+10;this._callCppProxy("getRemoteHistoryMessages",e,t,s,p,(function(){return u(0)}),(function(e){u(e)}),n,!0,i,!1)},t.prototype.getContinuousMessages=function(t,o,r,n,i,s){var a=this;return new Promise((function(c){r=r||0;var u=0===i;a._callCppProxy("getContinuousMessages",t,o,r,n,(function(t,o,r){var n=JSON.parse(t).list,i=[];n.reverse();for(var s=0;s<n.length;s++){var u=a._buildMessage(n[s].obj);i[s]=u}setTimeout((function(){c({code:e.ErrorCode.SUCCESS,data:{list:i,timestamp:o,hasMore:r}})}))}),(function(e){setTimeout((function(){c({code:e})}),0)}),u,s)}))},t.prototype.getRemoteHistoryMessages=function(t,o,r,n,i,s){var a=this;return new Promise((function(c){r=r||0;a._callCppProxy("getRemoteHistoryMessages",t,o,r,n,(function(t,o){var r=JSON.parse(t).list,n=[];r.reverse();for(var i=0;i<r.length;i++){var s=a._buildMessage(r[i].obj);n[i]=s}setTimeout((function(){c({code:e.ErrorCode.SUCCESS,data:{list:n,hasMore:!!o}})}),0)}),(function(e){setTimeout((function(){c({code:e})}),0)}),i,!0,s,!0)}))},t.prototype.deleteRemoteMessage=function(t,o,r,n){var i=this;return new Promise((function(s){var a=JSON.stringify(r);i._callCppProxy("deleteRemoteHistoryMessages",t,o,a,!1,n,(function(){setTimeout((function(){s(e.ErrorCode.SUCCESS)}),0)}),s)}))},t.prototype.deleteRemoteMessageByTimestamp=function(t,o,r,n){var i=this;return new Promise((function(s){i._callCppProxy("clearRemoteHistoryMessages",t,o,r,(function(){setTimeout((function(){s(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){s(e)}),0)}),n)}))},t.prototype.clearMessages=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("clearMessages",t,o,r),i(e.ErrorCode.SUCCESS)}))},t.prototype.getConversationList=function(t,o,r,n,i){var s=this;return void 0===i&&(i=""),new Promise((function(t){for(var o=s._callCppProxy("getConversationList",[1,3,6,7],i),r=JSON.parse(o).list,n=[],a=0;a<r.length;a++)n.push(s._buildConversation(r[a].obj));t({code:e.ErrorCode.SUCCESS,data:n})}))},t.prototype.getConversation=function(t,o,r){var n=this;return new Promise((function(i){var s=n._callCppProxy("getConversation",t,o,r);if(s)i({code:e.ErrorCode.SUCCESS,data:n._buildConversation(s)});else{var a=n._callCppProxy("getHistoryMessages",t,o,0,1,"",!0,r),c=void 0;try{c=JSON.parse(a).list}catch(e){n.logger.error(y.P_PARSE_JSON_MSGS_E,null==e?void 0:e.stack),c=[]}var u=null;c.length>0&&(u=n._buildMessage(c[0].obj));var p=n._callCppProxy("getConversationNotificationStatus",t,o,r),d=n._callCppProxy("getConversationTopStatus",t,o,r);i({code:e.ErrorCode.SUCCESS,data:{conversationType:t,targetId:o,channelId:r,unreadMessageCount:0,latestMessage:u,notificationStatus:p?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE,isTop:Boolean(d),lastUnreadTime:0}})}}))},t.prototype.removeConversation=function(t,o,r){var n=this._callCppProxy("removeConversation",t,o,r);return Promise.resolve(n?e.ErrorCode.SUCCESS:e.ErrorCode.CONVER_REMOVE_ERROR)},t.prototype.batchRemoveConversation=function(t){var o=t.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId}})),r=this._callCppProxy("removeConversationInBatches",JSON.stringify(o));return Promise.resolve(r?e.ErrorCode.SUCCESS:e.ErrorCode.CONVER_REMOVE_ERROR)},t.prototype.clearConversations=function(t,o){var r=this;return new Promise((function(n){var i=[];i=e.isArray(t)?t:[e.ConversationType.PRIVATE,e.ConversationType.GROUP,e.ConversationType.SYSTEM,e.ConversationType.PUBLIC_SERVICE],r._callCppProxy("clearConversations",i,o||""),n(e.ErrorCode.SUCCESS)}))},t.prototype.getAllConversationUnreadCount=function(t,o,r){var n=this._callCppProxy("getTotalUnreadCount",o,r,t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},t.prototype.getConversationUnreadCount=function(t,o,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){var s=n._callCppProxy("getUnreadCount",t,o,r);i({code:e.ErrorCode.SUCCESS,data:s})}))},t.prototype.clearConversationUnreadCount=function(t,o,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){n._callCppProxy("clearUnreadCount",t,o,r),i(e.ErrorCode.SUCCESS)}))},t.prototype.clearUnreadCountByTimestamp=function(t,o,r,n){var i=this;return new Promise((function(s){i._callCppProxy("clearUnreadCountByTimestamp",t,o,r,n),s(e.ErrorCode.SUCCESS)}))},t.prototype.getFirstUnreadMessage=function(t,o,r){var n=this;return new Promise((function(i){var s=n._callCppProxy("getTheFirstUnreadMessage",t,o,r),a=n._buildMessage(s);i({code:e.ErrorCode.SUCCESS,data:-1!==a.messageId?a:null})}))},t.prototype.getFirstUnreadMessageInfo=function(t,o,r){var n=this;return new Promise((function(i,s){var a=n._callCppProxy("getTheFirstUnreadMessage",t,o,r),c=n._buildMessage(a);i({code:e.ErrorCode.SUCCESS,data:-1!==c.messageId?{messageUId:c.messageUId,sentTime:c.sentTime}:null})}))},t.prototype.batchSetConversationToTop=function(t,o,r){var n=this;return new Promise((function(i,s){var a=t.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,is_top:o}}));n._callCppProxy("setIsTopInBatches",JSON.stringify(a),r||!1),i(e.ErrorCode.SUCCESS)}))},t.prototype.setConversationStatus=function(t,o,r,n,i,s){var a=this;return new Promise((function(s){a._callCppProxy("setConversationStatus",t,o,r,n,(function(){setTimeout((function(){s(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){s(e)}),0)}),i,!0)}))},t.prototype.setConversationToTop=function(t,o,r,n,i){var s=this;return new Promise((function(i){i(s._callCppProxy("setConversationToTop",t,o,r,n,!0,!0)?e.ErrorCode.SUCCESS:e.ErrorCode.RC_MSG_DATA_INCOMPLETE)}))},t.prototype.getConversationNotificationStatus=function(t,o,r){var n=this;return new Promise((function(i){var s=n._callCppProxy("getConversationNotificationStatus",t,o,r);i({code:e.ErrorCode.SUCCESS,data:s?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE})}))},t.prototype.setConversationTypeNotificationLevel=function(t,o){var r=this;return new Promise((function(n,i){r._callCppProxy("setBlockPushLevelForType",t,o,(function(){n({code:e.ErrorCode.SUCCESS})}),(function(e){n({code:e})}))}))},t.prototype.getConversationTypeNotificationLevel=function(t){var o=this;return new Promise((function(r,n){var i=o._callCppProxy("getBlockPushLevelForType",t);r({code:e.ErrorCode.SUCCESS,data:i})}))},t.prototype.searchConversationByContent=function(t,o,r,n){var i=this;return new Promise((function(s){n=n||[1,3,6,7];for(var a=i._callCppProxy("searchConversationByContent",n,t,o,r),c=JSON.parse(a).list,u=[],p=0;p<c.length;p++)u[p]=i._buildConversation(c[p].obj);s({code:e.ErrorCode.SUCCESS,data:u})}))},t.prototype.searchConversationByContentWithAllChannel=function(t,o,r){var n=this;return new Promise((function(i){r=r||[1,3,6,7];for(var s=n._callCppProxy("searchConversationByContentWithAllChannel",r,t,o),a=JSON.parse(s).list,c=[],u=0;u<a.length;u++)c[u]=n._buildConversation(a[u].obj);i({code:e.ErrorCode.SUCCESS,data:c})}))},t.prototype.searchMessageByContent=function(t,o,r,n,i,s,a){var c=this;return new Promise((function(s){c._callCppProxy("searchMessageByContent",t,o,r,n,i,1,(function(t,o){for(var r=t?JSON.parse(t).list:[],n=[],i=0;i<r.length;i++)n[i]=c._buildMessage(r[i].obj);setTimeout((function(){s({code:e.ErrorCode.SUCCESS,data:{messages:n,count:o}})}),0)}),a)}))},t.prototype.searchMessageByContentAndMessageType=function(t,o,r,n,i,s,a){var c=this;return new Promise((function(u){c._callCppProxy("searchMessageByContentAndObjectName",o,t,a||"",void 0===a,r,s,i,n,1,(function(t,o){for(var r=t?JSON.parse(t).list:[],n=[],i=0;i<r.length;i++)n[i]=c._buildMessage(r[i].obj);setTimeout((function(){u({code:e.ErrorCode.SUCCESS,data:{messages:n,count:o}})}),0)}))}))},t.prototype.searchMessagesByUser=function(t,o,r,n,i,s){var a=this;return new Promise((function(c){a._callCppProxy("getMessageBySender",t,o,r,n,i,s,(function(t){for(var o=t?JSON.parse(t).list:[],r=[],n=0;n<o.length;n++)r[n]=a._buildMessage(o[n].obj);setTimeout((function(){c({code:e.ErrorCode.SUCCESS,data:{messages:r}})}),0)}))}))},t.prototype.searchMessageByContentWithAllChannel=function(t,o,r,n,i){var s=this;return new Promise((function(a){s._callCppProxy("searchMessageByContentWithAllChannel",t,o,r,n,i,1,(function(t,o){for(var r=t?JSON.parse(t).list:[],n=[],i=0;i<r.length;i++)n[i]=s._buildMessage(r[i].obj);setTimeout((function(){a({code:e.ErrorCode.SUCCESS,data:{messages:n,count:o}})}),0)}))}))},t.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(t,o,r,n,i,s,a){var c=this;return new Promise((function(u){c._callCppProxy("searchMessageByTimestampWithAllChannel",t,o,r,n,i,s,a,(function(t){for(var o=t?JSON.parse(t).list:[],r=[],n=0;n<o.length;n++)r[n]=c._buildMessage(o[n].obj);setTimeout((function(){u({code:e.ErrorCode.SUCCESS,data:{messages:r}})}),0)}))}))},t.prototype.getUnreadMentionedMessages=function(e,t,o){for(var r=JSON.parse(this._callCppProxy("getUnreadMentionedMessages",e,t,o)).list,n=0;n<r.length;n++)r[n]=this._buildMessage(r[n].obj);return r},t.prototype.addToBlacklist=function(t){var o=this;return new Promise((function(r){o._callCppProxy("addToBlacklist",t,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.removeFromBlacklist=function(t){var o=this;return new Promise((function(r){o._callCppProxy("removeFromBlacklist",t,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.getBlacklist=function(){var t=this;return new Promise((function(o){t._callCppProxy("getBlacklist",(function(t){setTimeout((function(){o({code:e.ErrorCode.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},t.prototype.getBlacklistStatus=function(t){var o=this;return new Promise((function(r){o._callCppProxy("getBlacklistStatus",t,(function(t){setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype.insertMessage=function(t,o,r){var n=this,i=r.content,s=r.senderUserId,a=r.messageType,c=r.messageDirection,u=r.readStatus,p=r.sentStatus,d=r.sentTime,l=r.searchContent,f=r.isUnread,h=r.messageUId,C=r.disableNotification,g=r.canIncludeExpansion,v=r.expansionMsg,_=r.channelId,S=r.directedUserIds,y=r.disableUpdateLastMessage;i=JSON.stringify(i);var m={};if(d=d||0,v){var E=JSON.parse(v);for(var P in E)m[P]={v:"",ts:0},m[P].v=E[P],m[P].ts=d}return new Promise((function(r){var v=f?0:1,E=n._callCppProxy("insertMessage",t,o,s,a,i,(function(){}),(function(e){setTimeout((function(){r({code:e})}),0)}),c,u||0,p||10,d,l||"",v,h||"",!!C,!!g,JSON.stringify(m),_||"",S||[],y||!1),P=n._buildMessage(E,{isOffLineMessage:!1});P.messageUId=h,P.sentTime=d,r({code:-1===P.messageId?e.ErrorCode.MSG_INSERT_ERROR:e.ErrorCode.SUCCESS,data:P})}))},t.prototype.batchInsertMessage=function(t,o){var r=this;return void 0===o&&(o=!1),new Promise((function(n){var i=t.map((function(t){var o=t.content,r=t.senderUserId,n=t.messageType,i=t.messageDirection,s=t.receivedStatus,a=void 0===s?0:s,c=t.sentStatus,u=t.sentTime,p=t.searchContent,d=t.isUnread,l=t.messageUId,f=t.disableNotification,h=t.canIncludeExpansion,C=t.expansion,g=t.channelId,v=t.conversationType,_=t.targetId,S=t.source,y=t.isMentioned,m=t.receivedStatusInfo,E=t.directedUserIds,P=t.disableUpdateLastMessage,T=a;m&&(T=e.transformReceivedStatusFlag(m));var I={};if(u=u||0,C)for(var R in C)I[R]={v:"",ts:0},I[R].v=C[R],I[R].ts=u;return{conversationType:v,targetId:_,channelId:g||"",direction:i,senderUserId:r,status:c||10,sentTime:u,objectName:n,content:JSON.stringify(o),messageUid:l||"",noNotification:!!f,supportExt:!!h,extMsg:JSON.stringify(I),readStatus:T,searchContent:p||"",isUnread:!!d,source:S||"",isMention:y,directedUsers:E,disableUpdateLastMessage:P||!1}})),s=r._callCppProxy("insertMessages",JSON.stringify(i),o);n({code:s?e.ErrorCode.SUCCESS:e.ErrorCode.MSG_INSERT_ERROR,data:s||!1})}))},t.prototype.getMessageCount=function(t,o,r){var n=this;return new Promise((function(i){var s=n._callCppProxy("getMessageCount",t,o,r);i({code:e.ErrorCode.SUCCESS,data:s})}))},t.prototype.deleteMessages=function(t){var o=this;return new Promise((function(r){o._callCppProxy("deleteMessages",t),r(e.ErrorCode.SUCCESS)}))},t.prototype.deleteMessagesByTimestamp=function(t,o,r,n,i){var s=this;return new Promise((function(a){s._callCppProxy("deleteMessagesByTimestamp",t,o,r,n,i),a(e.ErrorCode.SUCCESS)}))},t.prototype.batchClearMessagesByTimestamp=function(t){var o=this;return new Promise((function(r,n){var i=t.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}}));o._callCppProxy("deleteMessageBySendTimeInBatches",JSON.stringify(i)),r(e.ErrorCode.SUCCESS)}))},t.prototype.batchClearRemoteHistoryMessages=function(t,o){var r=this;return new Promise((function(n,i){var s=t.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}}));r._callCppProxy("deleteRemoteMessageBySendTimeInBatches",JSON.stringify(s),o||!1,(function(){setTimeout((function(){n(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},t.prototype.getMessage=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("getMessage",t),i=o._buildMessage(n,{isOffLineMessage:!1});r({code:e.ErrorCode.SUCCESS,data:i})}))},t.prototype.setMessageContent=function(t,o,r){var n=this;return new Promise((function(i){o=JSON.stringify(o),n._callCppProxy("setMessageContent",t,o,r),i(e.ErrorCode.SUCCESS)}))},t.prototype.setMessageSearchField=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("setMessageSearchField",t,o,r),i(e.ErrorCode.SUCCESS)}))},t.prototype.setMessageSentStatus=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("setMessageSentStatus",t,o),n(e.ErrorCode.SUCCESS)}))},t.prototype.setMessageReceivedStatus=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("setMessageReceivedStatus",t,o),n(e.ErrorCode.SUCCESS)}))},t.prototype.saveConversationMessageDraft=function(t,o,r,n){var i=this;return new Promise((function(s){i._callCppProxy("saveTextMessageDraft",t,o,r,n||"")&&s(e.ErrorCode.SUCCESS),s(e.ErrorCode.DRAFT_SAVE_ERROR)}))},t.prototype.getConversationMessageDraft=function(t,o,r){var n=this;return new Promise((function(i){var s=n._callCppProxy("getTextMessageDraft",t,o,r||"");i({code:e.ErrorCode.SUCCESS,data:s})}))},t.prototype.clearConversationMessageDraft=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("clearTextMessageDraft",t,o,r||"")&&i(e.ErrorCode.SUCCESS),i(e.ErrorCode.DRAFT_REMOVE_ERROR)}))},t.prototype.pullConversationStatus=function(e){throw new Error("Method not implemented.")},t.prototype.batchSetConversationStatus=function(t){var o=t[0],r=o.conversationType,n=o.targetId,i=o.isTop,s=o.notificationStatus,a=o.channelId,c=o.isUpdateTime,u=void 0===c||c,p=this._callCppProxy("getConversationNotificationStatus",r,n,a||""),d=this._callCppProxy("getConversationTopStatus",r,n,a||""),l=e.isUndefined(s)?Boolean(p):s===e.NotificationStatus.OPEN,f=e.isUndefined(i)?Boolean(d):i;return this.setConversationStatus(r,n,l,f,a,u)},t.prototype.getConversationNotificationLevel=function(t,o,r){return E(this,void 0,void 0,(function(){var n;return P(this,(function(i){return n=this._callCppProxy("getBlockPushLevelForConversation",o,r,t),[2,Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})]}))}))},t.prototype.setConversationNotificationLevel=function(t,o,r,n){var i=this;return void 0===n&&(n=""),new Promise((function(s){i._callCppProxy("setBlockPushLevelForConversation",o,n,t,r,(function(){setTimeout((function(){s(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){s(e)}),0)}))}))},t.prototype.batchSetConversationNotificationLevel=function(t,o){var r=this;return new Promise((function(n,i){var s=t.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:o}}));r._callCppProxy("setBlockPushLevelInBatches",JSON.stringify(s),(function(){setTimeout((function(){n(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},t.prototype.getTotalUnreadCountByLevels=function(t,o,r){if(r){var n=this._callCppProxy("getUnreadMentionedCountByLevel",t,o);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})}var i=this._callCppProxy("getUnreadCountByLevel",t,o);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:i})},t.prototype.pullUserSettings=function(e){throw new Error("Method not implemented.")},t.prototype.sendReadReceiptMessage=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("sendReadReceipt",t,r||"",o,(function(){o.forEach((function(e){n._updateReadReceiptInfo(e,{hasRespond:!0});try{var t=JSON.parse(n._callCppProxy("getMessage",e)).messageId;n.setMessageReceivedStatus(t,1)}catch(t){n.logger.error(y.P_PARSE_JSON_MSGS_E,JSON.stringify({messageUId:e,error:null==t?void 0:t.stack}))}})),setTimeout((function(){i({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.getMessageReader=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("getMessageReader",t,r,o,(function(t,r){var s=[],a={};(t=JSON.parse(t)).list.forEach((function(e){var t=JSON.parse(e.obj),o=t.id,r=t.time;s.push({userId:o,readTime:r}),a[o]=r}));var c={readerInfo:a,readCount:s.length,totalCount:r};n._updateReadReceiptInfo(o,c),setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{list:s,totalMemberCount:r}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.sendReadReceiptMessageV4=function(t,o,r){var n=this;return new Promise((function(i){var s=t.conversationType,a=t.targetId,c=t.channelId;n._callCppProxy("sendMessageReadReceipt",s,a,c||"",o,r,(function(){setTimeout((function(){i({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.getMessageReadReceiptV4=function(t,o){var r=this;return new Promise((function(n){var i=t.targetId,s=t.channelId;r._callCppProxy("getMessageReadReceipt",i,s||"",o,(function(t,i,s){var a=[],c=r._callCppProxy("getMessage",o),u=JSON.parse(c);try{JSON.parse(s).list.forEach((function(e){var t=JSON.parse(e.obj),o=t.id,r=t.time;a.push({userId:o,readTime:r})}))}catch(e){r.logger.error(y.P_PARSE_JSON_E,"method: getMessageReadReceipt, info: "+s+", error: "+e)}var p=JSON.parse(u.readReceiptRequest||"{}"),d=p.readerList,l=void 0===d?[]:d,f=p.readCount,h=void 0===f?0:f,C=!1;l.length<a.length&&(l=a,C=!0),h<i&&(h=i,C=!0),C&&r._callCppProxy("updateReadReceiptRequestInfo",o,JSON.stringify({readerList:l,readCount:h,totalCount:t})),setTimeout((function(){n({code:e.ErrorCode.SUCCESS,data:{list:a,totalCount:t,readCount:h}})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype.updateConversationReadTime=function(t,o){var r=this;return new Promise((function(n){var i=t.conversationType,s=t.targetId,a=t.channelId;r._callCppProxy("updateConversationReadTime",i,s,a||"",o,(function(){setTimeout((function(){n({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype._addChatroomCache=function(e,t,o,r){this._rmChatroomCache(e),this._chatroomCache.push({chatroomId:e,joinExist:o,count:t,extra:r})},t.prototype._rmChatroomCache=function(e){this._chatroomCache=this._chatroomCache.filter((function(t){return t.chatroomId!==e}))},t.prototype._try2RejoinChatroom=function(){var t=this;if(0!==this._chatroomCache.length){var o=this.logger.createTraceId();this._chatroomCache.forEach((function(r){return E(t,void 0,void 0,(function(){var t,n,i,s,a,c,u;return P(this,(function(p){switch(p.label){case 0:return t=r.chatroomId,n=r.joinExist,i=r.count,s=r.extra,this.logger.info(e.LogTagId.L_REJOIN_CHATROOM_T,t,o),[4,this._joinChrm(t,i,n,!1,s)];case 1:return a=p.sent(),c=a.code,u=a.data,c===e.ErrorCode.SUCCESS?(this.logger.info(e.LogTagId.L_REJOIN_CHATROOM_R,t,o),this._sendChatroomStatus({rejoinedRoom:m({chatroomId:t,count:i},u)}),[2]):(c===e.ErrorCode.RC_CHATROOM_USER_KICKED&&this._rmChatroomCache(t),this._sendChatroomStatus({rejoinedRoom:{chatroomId:t,errorCode:c}}),this.logger.warn(e.LogTagId.L_REJOIN_CHATROOM_R,"chrmId: "+t+", code: "+c,o),[2])}}))}))}))}},t.prototype._joinChrm=function(t,o,r,n,i){var s=this,a=r?"joinExistChatRoom":"joinChatRoom";return new Promise((function(c){n&&s._callCppProxy("clearMessages",e.ConversationType.CHATROOM,t,""),s._callCppProxy(a,t,o,(function(n,a,u,p,d,l,f){s._addChatroomCache(t,o,r,i||""),setTimeout((function(){c({code:e.ErrorCode.SUCCESS,data:{createTime:Number(n),memberCount:a,isAllChatroomBanned:u,isCurrentUserBanned:p,isCurrentChatroomBanned:d,isCurrentChatroomInWhitelist:l,joinTime:f}})}),0)}),(function(e){setTimeout((function(){c({code:e})}),0)}),i||"")}))},t.prototype.joinChatroom=function(e,t,o){return E(this,void 0,void 0,(function(){return P(this,(function(r){switch(r.label){case 0:return[4,this._joinChrm(e,t,!1,!0,o)];case 1:return[2,r.sent().code]}}))}))},t.prototype.joinExistChatroom=function(e,t,o){return this._joinChrm(e,t,!0,!0,o)},t.prototype.quitChatroom=function(t){var o=this;return this._rmChatroomCache(t),new Promise((function(r){o._callCppProxy("quitChatRoom",t,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.getChatroomInfo=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("getChatroomInfo",t,o,r,(function(t,o){var r=t?JSON.parse(t).list:[],n=[];if(r.length>0)for(var s=0;s<r.length;s++)n.push(JSON.parse(r[s].obj));setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{userInfos:n,userCount:o}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.getChatroomHistoryMessages=function(t,o,r,n){var i=this;return new Promise((function(s){i._callCppProxy("getChatroomHistoryMessage",t,o,r,n,(function(t){var o;try{o=JSON.parse(t)}catch(e){o={list:[],hasMore:!1}}var r=o.list;if(r&&r.length)try{o.list=r.map((function(e){return i._buildMessage(e.obj)}))}catch(e){o.list=[]}setTimeout((function(){s({code:e.ErrorCode.SUCCESS,data:o})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),"")}))},t.prototype.setChatroomEntry=function(t,o){var r=this;return new Promise((function(n){var i='[{"key":"'+o.key+'", "value":"'+o.value+'"}]';r._callCppProxy("setChatroomKV",t,i,!!o.isAutoDelete,!!o.isOverwrite,(function(){setTimeout((function(){n(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},t.prototype.setChatroomEntries=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("setChatroomKV",t,JSON.stringify(o.entries),!!o.isAutoDelete,!!o.isOverwrite,(function(){n({code:e.ErrorCode.SUCCESS})}),(function(e){n({code:e})}))}))},t.prototype.forceSetChatroomEntry=function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.setChatroomEntry(e,t)},t.prototype.removeChatroomEntry=function(t,o){var r=this,n=[o.key];return new Promise((function(i){r._callCppProxy("deleteChatroomKV",t,n,!!o.isOverwrite,(function(){i(e.ErrorCode.SUCCESS)}),(function(e){i(e)}))}))},t.prototype.forceRemoveChatroomEntry=function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.removeChatroomEntry(e,t)},t.prototype.removeChatroomEntries=function(t,o){var r=this;return new Promise((function(n){var i=o.entries.map((function(e){return e.key}));r._callCppProxy("deleteChatroomKV",t,i,!!o.isOverwrite,(function(){n({code:e.ErrorCode.SUCCESS})}),(function(e){n({code:e})}))}))},t.prototype.getChatroomEntry=function(t,o){return E(this,void 0,void 0,(function(){var r;return P(this,(function(n){switch(n.label){case 0:return[4,this.getAllChatroomEntry(t)];case 1:return(r=n.sent()).code===e.ErrorCode.SUCCESS?[2,{code:e.ErrorCode.SUCCESS,data:r.data?r.data[o]:null}]:[2,{code:r.code}]}}))}))},t.prototype.getAllChatroomEntry=function(t){var o=this;return new Promise((function(r){o._callCppProxy("getChatroomKV",t,(function(t){var o={};try{(t?JSON.parse(t):{list:[]}).list.map((function(e){return JSON.parse(e.obj)})).forEach((function(e){o[e.key]=e.value?e.value:""}))}catch(e){}setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:o})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype.removeChatroomFromCatch=function(e){this._rmChatroomCache(e)},t.prototype.getFileToken=function(t,o,r,n,i,s){var a=this;return r=r||"",n=n||"",i=i||"",new Promise((function(c){var u;u=n&&"uploads"!==n?o||"":e.getUploadFileName(t,o);var p=a.getNaviInfoFromCache(),d={uploadDomain:e.getMinionURL(p,a.logger),env:a._environment};s=s?Math.ceil(s):0,a._callCppProxy("getUploadToken",t,u,r,n,i,JSON.stringify(d),s,(function(t,o,r,n,i,s,a,p,d,l,f,h,C,g,v,_,S,y,m,E,P,T,I){setTimeout((function(){c({code:e.ErrorCode.SUCCESS,data:{token:t,deadline:0,bosToken:o,bosDate:r,path:n,osskeyId:i,ossPolicy:s,ossSign:a,ossBucketName:p,fileName:u,s3Credential:d,s3Algorithm:l,s3Date:f,s3Policy:h,s3Signature:C,s3BucketName:g,stcAuthorization:v,stcContentSha256:_,stcDate:S,stcBucketName:y,minioAuthorization:m,minioContentSha256:E,minioDate:P,minioBucketName:T,downloadAuthInfo:I?JSON.parse(I):null}})}),0)}),(function(e){setTimeout((function(){c({code:e})}),0)}))}))},t.prototype.getFileUrl=function(t,o,r,n){var i=this;return new Promise((function(s){var a=i.getNaviInfoFromCache(),c={url:e.getMinionURL(a,i.logger)};i._callCppProxy("getDownloadUrl",t,r,n,o-1,JSON.stringify(c),-1,(function(t){setTimeout((function(){s({code:e.ErrorCode.SUCCESS,data:{downloadUrl:t}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}))}))},t.prototype.clearData=function(){var t=this;return new Promise((function(o){var r=t._callCppProxy("clearData");o({code:e.ErrorCode.SUCCESS,data:r})}))},t.prototype.getDeviceId=function(){var e=this._dbpath;return le(e)},t.prototype.getVoIPKey=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("getVoIPKey",t,o,"",(function(t){setTimeout((function(){n({code:e.ErrorCode.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype.bindRTCRoomForChatroom=function(t){var o=this;return new Promise((function(r){var n=t.chatRoomId,i=t.rtcRoomId;o._callCppProxy("bindRTCRoomForChatroom",n,i,(function(){setTimeout((function(){r(e.ErrorCode.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))},t.prototype.getGroupMessageDeliverList=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("getGroupMessageDeliverList",t,r,o,(function(t,o){var r=JSON.parse(t).list.map((function(e){return{time:JSON.parse(e.obj).time,userId:JSON.parse(e.obj).id}}));setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{totalCount:o,list:r}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.getPrivateMessageDeliverTime=function(t,o){var r=this;return new Promise((function(n){var i=r._callCppProxy("getMessageDeliverTime",t);if(i)n({code:e.ErrorCode.SUCCESS,data:i});else{r._callCppProxy("getPrivateMessageDeliverList",o,t,(function(t){var o=0,r=JSON.parse(t).list;if(r.length>0){var i=JSON.parse(r[0].obj).time;o=i}setTimeout((function(){n({code:e.ErrorCode.SUCCESS,data:o})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}}))},t.prototype.rtcSignaling=function(t,o,r,n){var i=this;return new Promise((function(s){i._callCppProxy("rtcSignaling",t,o,r,n,(function(t){var o=Array.prototype.slice.call(t);s({code:e.ErrorCode.SUCCESS,buffer:o})}),(function(e){s({code:e})}),30)}))},t.prototype._setRTCHeartbeatListener=function(){var e=this;this._cppProtocol.setRTCHeartbeatListener((function(t,o){var r=e.rtcHeartbeatResolves[t];if(r){var n=r.find((function(e){return""===e.seqId}));n&&(n.seqId=o)}}),(function(t,o,r,n){var i=e.rtcHeartbeatResolves[t];if(i){var s=i.findIndex((function(e){return e.seqId===r}));-1!==s&&i.splice(s,1)[0].resolve({code:o,data:{version:Number(n)}})}}))},t.prototype.rtcPing=function(e,t,o){var r=this;return new Promise((function(t){var o={resolve:t,seqId:""},n=r.rtcHeartbeatResolves[e];n?n.push(o):r.rtcHeartbeatResolves[e]=[o],r._callCppProxy("sendRTCHeartbeat",[e],30)}))},t.prototype.createTag=function(t){var o=this;return new Promise((function(r){o._callCppProxy("addTag",t.tagId,t.tagName,(function(){setTimeout((function(){r({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype.removeTag=function(t){var o=this;return new Promise((function(r){o._callCppProxy("deleteTag",t,(function(){setTimeout((function(){r({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype.updateTag=function(t){var o=this;return new Promise((function(r){o._callCppProxy("renameTag",t.tagId,t.tagName,(function(){setTimeout((function(){r({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},t.prototype.getTagList=function(){var t=this;return new Promise((function(o){var r=t._callCppProxy("getTags"),n=t._convertResultList(r,(function(e){return{tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime}}));o({code:e.ErrorCode.SUCCESS,data:n})}))},t.prototype.addTagForConversations=function(t,o){var r=this;return new Promise((function(n){o.forEach((function(e){e.conversationType&&(e.type=e.conversationType)}));r._callCppProxy("addConversationsForTag",t,JSON.stringify(o),(function(){setTimeout((function(){n({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype.removeTagForConversations=function(t,o){var r=this;return new Promise((function(n){o.forEach((function(e){e.conversationType&&(e.type=e.conversationType)})),r._callCppProxy("removeConversationsForTag",t,JSON.stringify(o),(function(){setTimeout((function(){n({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype.removeTagsForConversation=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("removeTagsForConversation",t.conversationType,t.targetId,t.channelId||"",o,(function(){setTimeout((function(){n({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},t.prototype.getConversationListByTag=function(t,o,r,n){var i=this;return new Promise((function(s){var a=i._callCppProxy("getConversationsForTagByPage",t,o,r||20,n||""),c=i._convertResultList(a,(function(e){return m(m({},i._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})}));s({code:e.ErrorCode.SUCCESS,data:c})}))},t.prototype.getUnreadCountByTag=function(t,o){var r=this;return new Promise((function(n){var i=r._callCppProxy("getConversationUnreadCountForTag",t,o);n({code:e.ErrorCode.SUCCESS,data:i})}))},t.prototype.setConversationStatusInTag=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("setConversationToTopForTag",t,o.conversationType,o.targetId,o.channelId||"",r.isTop||!1,(function(){setTimeout((function(){i({code:e.ErrorCode.SUCCESS})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.getTagsForConversation=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("getTagsForConversation",t.conversationType,t.targetId,t.channelId||""),i=o._convertResultList(n,(function(e){return{tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime}}));r({code:e.ErrorCode.SUCCESS,data:i})}))},t.prototype.getBlockConversationList=function(){throw new Error("Method not implemented.")},t.prototype.getTopConversationList=function(t,o){var r=this;return new Promise((function(n){var i=e.isUndefined(o)?r._callCppProxy("getTopConversations",t):r._callCppProxy("getTopConversations",t,o),s=JSON.parse(i).list.map((function(e){return r._buildConversation(e.obj)}));n({code:e.ErrorCode.SUCCESS,data:s})}))},t.prototype.getUnreadMentionedCount=function(e){throw new Error("Method not implemented.")},t.prototype.getAllUnreadMentionedCount=function(){var t=this;return new Promise((function(o){var r=t._callCppProxy("getUnreadAndMentionCount",[e.ConversationType.GROUP],"");o({code:e.ErrorCode.SUCCESS,data:r})}))},t.prototype.getOSInfo=function(){return E(this,void 0,void 0,(function(){var t;return P(this,(function(o){return t={arch:g.arch(),platform:g.platform(),type:g.type(),version:g.version(),release:g.release(),uptime:g.uptime(),cpus:g.cpus(),freemem:g.freemem(),totalmem:g.totalmem(),networkInterfaces:g.networkInterfaces()},[2,{code:e.ErrorCode.SUCCESS,data:t}]}))}))},t.prototype.getMainProcessInfo=function(){return E(this,void 0,void 0,(function(){return P(this,(function(t){return[2,{code:e.ErrorCode.SUCCESS,data:{title:process.title,pid:process.pid,ppid:process.ppid,platform:process.platform,arch:process.arch,uptime:process.uptime(),cpuUsage:process.cpuUsage(),memoryUsage:process.memoryUsage(),resourceUsage:process.resourceUsage()}}]}))}))},t.prototype.setCallInfo=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("callInfoSignaling",t,o,r,(function(t,o){setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{key:t,value:o}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},t.prototype.setProxy=function(t){return this.tcpMgr.getConnectionStatus()!==e.RCConnectionStatus.DISCONNECTED?Promise.resolve({code:e.ErrorCode.RC_CONN_PROXY_UNAVAILABLE}):Promise.resolve($(t,this.logger))},t.prototype.getProxy=function(){return Promise.resolve(Z())},t.prototype.testProxy=function(t,o){return function(t,o,r){return new Promise((function(n){var i=/^https/.test(o)?Y:K;r.info(e.LogTagId.A_TEST_PROXY_O,JSON.stringify({msg:"test proxy",proxy:t,testHost:o}));var s=i(o,t,(function(e){var t=200===e.statusCode?0:e.statusCode;e.setEncoding("utf8");var o="";e.on("data",(function(e){o+=e})),e.once("end",(function(){n({status:t||0,data:o})}))}));s.once("timeout",(function(){return n({status:0})})),s.once("error",(function(e){return n({status:0,data:e.stack})})),s.end()}))}(t,o,this.logger)},t.prototype.checkDuplicateMessage=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("checkDuplicateMessage",t);r({code:e.ErrorCode.SUCCESS,data:n})}))},t.prototype.subscribeUser=function(t,o,r){var n=this;return new Promise((function(i){n._callCppProxy("updateSubscribeStatus",o,e.SubscribeOperationType.SUBSCRIBE,t,(function(){i({code:e.ErrorCode.SUCCESS})}),(function(e,t){i({code:e,data:t})}),r)}))},t.prototype.unSubscribeUser=function(t,o){var r=this;return new Promise((function(n){r._callCppProxy("updateSubscribeStatus",o,e.SubscribeOperationType.UNSUBSCRIBE,t,(function(){n({code:e.ErrorCode.SUCCESS})}),(function(e){n({code:e})}),0)}))},t.prototype.getSubscribeUserList=function(t,o,r){var n=this._callCppProxy("getSubscribeUserList",t,o,r),i=this._buildSubscribeEventData(n).map((function(t){var o=t.userId,r=t.subscribeType,n=t.subscribeTime,i=t.expiry,s=t.details,a={userId:o,subscribeType:r,subscribeTime:n,expiry:i};return r===e.SubscribeType.ONLINE_STATUS&&(a.details=e.completeSubscriptionPlatformStatus(s)),a}));return Promise.resolve({code:e.ErrorCode.SUCCESS,data:i})},t.prototype.setDuplicateMessageConfig=function(t){var o=this._callCppProxy("setDuplicateMessageConfig",[e.ConversationType.CHATROOM],me.cuid,t);return Promise.resolve({code:o})},t.prototype.getSubscribeUserStatus=function(t,o){var r=this._callCppProxy("getSubscribeStatusByUserIds",t,o),n=this._buildSubscribeEventData(r).map((function(t){var o=t.userId,r=t.subscribeType,n=t.subscribeTime,i=t.expiry,s=t.details,a={userId:o,subscribeType:r,subscribeTime:n,expiry:i};return r===e.SubscribeType.ONLINE_STATUS&&(a.details=e.completeSubscriptionPlatformStatus(s)),a}));return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},t.prototype.updateMyUserProfile=function(e){var t=this;return new Promise((function(o){var r=[],n=[];Object.keys(e).forEach((function(t){var o;if("extraProfile"===t&&e.extraProfile){if(e.extraProfile){var i=e.extraProfile;Object.keys(i).forEach((function(e){n.push(JSON.stringify({key:e,value:i[e]||""}))}))}}else r.push(JSON.stringify({key:t,value:(null===(o=e[t])||void 0===o?void 0:o.toString())||""}))})),t._callCppProxy("updateUserProfile",r,n,(function(e,t){o({code:e,data:{errorKey:t}})}))}))},t.prototype.getUserProfiles=function(e){var t=this;return new Promise((function(o){t._callCppProxy("getUserProfiles",e,(function(e,r){o({code:e,data:t._string2UserProfileInfoList(r)})}))}))},t.prototype.getMyUserProfile=function(){var e=this;return new Promise((function(t){e._callCppProxy("getOwnUserProfile",(function(o,r){t({code:o,data:e._string2userProfileInfo(r)})}))}))},t.prototype._string2userProfileInfo=function(e){var t;try{var o=JSON.parse(e),r=o.userProfile.reduce((function(e,t){var o=JSON.parse(t);return["gender","role","level"].includes(o.key)?e[o.key]=Number(o.value):e[o.key]=o.value,e}),{});return r.userId=o.userId,r.extraProfile=(null===(t=o.userExtProfile)||void 0===t?void 0:t.reduce((function(e,t){var o=JSON.parse(t);return e[o.key]=o.value,e}),{}))||{},r}catch(t){this.logger.error(y.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}},t.prototype._string2UserProfileInfoList=function(e){var t=this;try{return JSON.parse(e).list.map((function(e){return t._string2userProfileInfo(e.obj)}))}catch(t){this.logger.error(y.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]},t.prototype.updateMyUserProfileVisibility=function(t){var o=this;return new Promise((function(r){o._callCppProxy("updateUserProfilePermission",t,(function(){r({code:e.ErrorCode.SUCCESS})}),(function(e){r({code:e})}))}))},t.prototype.getMyUserProfileVisibility=function(){var e=this;return new Promise((function(t){e._callCppProxy("getUserProfilePermission",(function(e,o){t({code:e,data:o})}))}))},t.prototype.searchUserProfileByUniqueId=function(e){var t=this;return new Promise((function(o){t._callCppProxy("getUserProfileByUniqueId",e,(function(e,r){o({code:e,data:t._string2userProfileInfo(r)})}))}))},t.prototype.getMatchedMessage=function(t,o,r,n){var i,s=this._callCppProxy("getMatchedMessage",t.conversationType,t.targetId,o,r,n,t.channelId||""),a=[];try{i=JSON.parse(s).list;for(var c=0;c<i.length;c++){var u=this._buildMessage(i[c].obj);a.push(u)}}catch(t){return this.logger.error(y.P_PARSE_JSON_MSGS_E,s),Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:a})},t.prototype.getConversations=function(t){var o,r=this,n=t.map((function(e){var t=e.conversationType,o=e.targetId,r=e.channelId;return{targetId:o,channelId:void 0===r?"":r,type:t}})),i=this._callCppProxy("getConversations",JSON.stringify(n));try{o=JSON.parse(i).list.map((function(e){return r._buildConversation(e.obj)}))}catch(t){return this.logger.error(y.P_PARSE_JSON_MSGS_E,i),Promise.resolve({code:e.ErrorCode.MAIN_PROCESS_ERROR})}return Promise.resolve({code:e.ErrorCode.SUCCESS,data:o})},t.prototype.handleErrorCode=function(t,o){t!==e.ErrorCode.SUCCESS&&setTimeout((function(){o({code:t})}),0)},t.prototype._convertGroupInfoList=function(t,o){return t&&0!==t.length?t.map((function(t){var o=t.groupId,r=t.baseInfo,n=t.createTime,i=t.createUserId,s=t.extraInfo,a=t.memberCount,c=t.ownerId,u=t.remark,p=t.joinTime,d=t.role,l=e.arrayToKeyValue(r),f=e.arrayToKeyValue(s);return{groupId:o,groupName:l.name||"",portraitUri:l.portraitUrl||"",introduction:l.introduction||"",notice:l.announcement||"",joinPermission:~~l.joinPerm,removeMemberPermission:~~l.removePerm,invitePermission:~~l.memInvitePerm,inviteHandlePermission:~~l.invitePerm,groupInfoEditPermission:~~l.profilePerm,memberInfoEditPermission:~~l.memProfilePerm,extProfile:f,creatorId:i||"",ownerId:c||"",createTime:n||0,membersCount:a||0,remark:u||"",joinedTime:p||0,role:d||e.GroupMemberRole.UNDEF}})):[]},t.prototype._convertUpdateGroupInfoList=function(t){return t&&0!==t.length?t.map((function(t){var o=t.groupId,r=t.baseInfo,n=t.createTime,i=t.createUserId,s=t.extraInfo,a=t.memberCount,c=t.ownerId,u=t.remark,p=t.joinTime,d=t.role,l=e.arrayToKeyValue(r),f=e.arrayToKeyValue(s);return m(m(m(m(m(m(m(m(m({groupId:o},e.formatGroupBaseInfo(l)),s.length>0&&{extProfile:f}),i&&{creatorId:i}),c&&{ownerId:c}),n&&{createTime:n}),a&&{membersCount:a}),u&&{remark:u}),p&&{joinedTime:p}),d&&{role:d})})):[]},t.prototype._convertGroupMemberInfoList=function(e){return e&&0!==e.length?e.map((function(e){var t=e.userId,o=e.nickname,r=e.groupNickname,n=e.portraitUrl,i=e.joinTime;return{userId:t,name:o||"",portraitUri:n||"",nickname:r||"",role:e.role||0,joinedTime:i||0,extra:e.extra||""}})):[]},t.prototype.createGroup=function(t,o,r,n){return E(this,void 0,void 0,(function(){var i=this;return P(this,(function(s){return[2,new Promise((function(s){var a=_e(o),c=_e(r||{}),u=i._callCppProxy("createGroup",t,n,JSON.stringify(a),JSON.stringify(c),(function(t,o,r){t===e.ErrorCode.SUCCESS?setTimeout((function(){s({code:t,data:{processCode:o}})}),0):setTimeout((function(){s({code:t,msg:null!=r?r:""})}),0)}));i.handleErrorCode(u,s)}))]}))}))},t.prototype.updateGroupInfo=function(t,o,r){return E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=_e(o),a=_e(null!=r?r:{}),c=n._callCppProxy("updateGroupInfo",t,JSON.stringify(s),JSON.stringify(a),(function(t,o){t===e.ErrorCode.SUCCESS?setTimeout((function(){i({code:t})}),0):setTimeout((function(){i({code:t,msg:null!=o?o:""})}),0)}));n.handleErrorCode(c,i)}))]}))}))},t.prototype.getGroupsInfo=function(t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=o._callCppProxy("getGroupInfoByIds",t,(function(t,n,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){o.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){r({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:o._convertGroupInfoList(a)})}),0)}else setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))]}))}))},t.prototype.kickGroupMembers=function(e,t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=Se(o),s=r._callCppProxy("kickOutGroupMember",e,t,JSON.stringify(i),(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(s,n)}))]}))}))},t.prototype.quitGroup=function(e,t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=Se(t),i=o._callCppProxy("quitGroup",e,JSON.stringify(n),(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(i,r)}))]}))}))},t.prototype.dismissGroup=function(e){return E(this,void 0,void 0,(function(){var t=this;return P(this,(function(o){return[2,new Promise((function(o){var r=t._callCppProxy("disbandGroup",e,(function(e,t){setTimeout((function(){o({code:e})}),0)}));t.handleErrorCode(r,o)}))]}))}))},t.prototype.transferGroupOwner=function(e,t,o,r){return E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=Se(r),a=n._callCppProxy("transferGroup",e,t,o,JSON.stringify(s),(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))},t.prototype.setGroupManagers=function(e,t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("updateGroupAdmins",t,o,e,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))},t.prototype.getGroupMembersByRole=function(t,o,r){return E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=o===e.GroupMemberRole.UNDEF?[1,2,3]:[o],a=n._callCppProxy("getGroupMembers",t,s,r.pageToken||"",r.count,r.order?1:0,(function(t,o,r,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){n.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){i({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{totalCount:null!=r?r:0,data:c,pageToken:null!=o?o:""}})}),0)}else setTimeout((function(){i({code:t})}),0)}));n.handleErrorCode(a,i)}))]}))}))},t.prototype.getGroupMembers=function(t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("getGroupMembersByIds",t,o,(function(t,o,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){r.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){n({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=r._convertGroupMemberInfoList(a);setTimeout((function(){n({code:e.ErrorCode.SUCCESS,data:c})}),0)}else setTimeout((function(){n({code:t})}),0)}));r.handleErrorCode(i,n)}))]}))}))},t.prototype.setGroupMemberInfo=function(e,t,o,r){return E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=n._callCppProxy("updateGroupMemberInfo",e,t,o,r||"",(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(s,i)}))]}))}))},t.prototype.searchGroupMembers=function(t,o,r){return E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=r.order?1:0,a=n._callCppProxy("getGroupMembersByNickname",t,o,r.pageToken||"",r.count,s,(function(t,o,r,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){n.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){i({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:e.ErrorCode.SUCCESS,data:{data:c,pageToken:o,totalCount:r}})}),0)}else setTimeout((function(){i({code:t})}),0)}));n.handleErrorCode(a,i)}))]}))}))},t.prototype.joinGroup=function(t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=o._callCppProxy("joinGroup",t,(function(t,o,n){t===e.ErrorCode.SUCCESS?setTimeout((function(){r({code:t,data:{processCode:o}})}),0):setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))]}))}))},t.prototype.inviteUsersToGroup=function(t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("inviteUsersToGroup",t,o,(function(t,o,r){t===e.ErrorCode.SUCCESS?setTimeout((function(){n({code:t,data:{processCode:o}})}),0):setTimeout((function(){n({code:t})}),0)}));r.handleErrorCode(i,n)}))]}))}))},t.prototype.memberInviteResponse=function(t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=t.groupId,i=t.inviterId,s=t.optType,a=t.optResult,c=t.joinUserId,u=t.reason,p=1===s?1:0,d=p&&c?c:"",l=o._callCppProxy("handleGroupInvite",n,d,i,a,p,null!=u?u:"",(function(t,o,n){t===e.ErrorCode.SUCCESS?setTimeout((function(){r({code:t,data:{processCode:o}})}),0):setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(l,r)}))]}))}))},t.prototype.getGroupApplications=function(t,o,r){return void 0===o&&(o=[]),void 0===r&&(r=[]),E(this,void 0,void 0,(function(){var n=this;return P(this,(function(i){return[2,new Promise((function(i){var s=t.order?1:0,a=n._callCppProxy("getGroupRequests",o,r,"",t.pageToken||"",t.count,s,(function(t,o,r,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){n.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){i({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=a.map((function(e){var t=e.groupId,o=e.joinUser,r=e.approverUser,n=e.inviterUser,i=e.type;return{groupId:t,joinMemberInfo:o,inviterInfo:n,operatorInfo:r,status:e.status,direction:e.direction,type:i,operationTime:e.operateTime,reason:e.remark}}));setTimeout((function(){i({code:t,data:{totalCount:r,data:c,pageToken:o}})}),0)}else setTimeout((function(){i({code:t})}),0)}));n.handleErrorCode(a,i)}))]}))}))},t.prototype.getJoinedGroupsByRole=function(t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=o.order?1:0,s=t===e.GroupMemberRole.UNDEF?[1,2,3]:[t],a=r._callCppProxy("getGroups",s,o.pageToken||"",o.count,i,(function(t,o,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){r.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){n({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=r._convertGroupInfoList(a);setTimeout((function(){n({code:t,data:{totalCount:i,data:c,pageToken:o}})}),0)}else setTimeout((function(){n({code:t})}),0)}));r.handleErrorCode(a,n)}))]}))}))},t.prototype.searchJoinedGroups=function(t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=o.order?1:0,s=r._callCppProxy("getGroupsByGroupName",t,o.pageToken||"",o.count,i,(function(t,o,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){r.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){n({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=r._convertGroupInfoList(a);setTimeout((function(){n({code:t,data:{totalCount:i,data:c,pageToken:o}})}),0)}else setTimeout((function(){n({code:t})}),0)}));r.handleErrorCode(s,n)}))]}))}))},t.prototype.getJoinedGroups=function(t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=o._callCppProxy("getGroupsByIds",t,(function(t,n,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){o.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){r({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=o._convertGroupInfoList(a);setTimeout((function(){r({code:t,data:c})}),0)}else setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))]}))}))},t.prototype.setGroupRemark=function(t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=o?e.GroupOperationType.ADD:e.GroupOperationType.REMOVE,s=r._callCppProxy("updateGroupRemark",t,o||"",i,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(s,n)}))]}))}))},t.prototype.setGroupFollows=function(e,t,o){return E(this,void 0,void 0,(function(){var r=this;return P(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("updateFavoriteMembers",t,o,e,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))},t.prototype.getGroupFollows=function(t){return E(this,void 0,void 0,(function(){var o=this;return P(this,(function(r){return[2,new Promise((function(r){var n=o._callCppProxy("getGroupFavoriteMembers",t,"",1e3,0,(function(t,n,i,s){if(t===e.ErrorCode.SUCCESS){var a=[];try{a=JSON.parse(s)}catch(t){o.logger.error(y.P_PARSE_JSON_MSGS_E,s),setTimeout((function(){r({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var c=a.map((function(e){return{userId:e.userId,time:e.followTime}}));setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:c})}),0)}else setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))]}))}))},t.prototype.addFriend=function(e,t,o){var r=this;return new Promise((function(n){var i=r._callCppProxy("addFriend",e,t,o,(function(e,t,o){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))},t.prototype.deleteFriends=function(e,t){var o=this;return new Promise((function(r){var n=o._callCppProxy("removeFriends",e,t,(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(n,r)}))},t.prototype.acceptFriendApplication=function(e){var t=this;return new Promise((function(o){var r=t._callCppProxy("acceptFriendRequest",e,"",(function(e,t){setTimeout((function(){o({code:e})}),0)}));t.handleErrorCode(r,o)}))},t.prototype.refuseFriendApplication=function(e,t){var o=this;return new Promise((function(r){var n=o._callCppProxy("rejectFriendRequest",e,t||"",(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(n,r)}))},t.prototype.setFriendInfo=function(e,t,o){var r=this;return new Promise((function(n){var i=_e(null!=o?o:{}),s=r._callCppProxy("setFriendInfo",e,t,JSON.stringify(i),(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(s,n)}))},t.prototype.checkFriends=function(t,o){var r=this;return new Promise((function(n){var i=r._callCppProxy("checkFriendRelationship",t,o,(function(t,o){if(t===e.ErrorCode.SUCCESS){var r=JSON.parse(o).map((function(e){return{userId:e.userId,relationType:e.status}}));setTimeout((function(){n({code:t,data:r})}),0)}else setTimeout((function(){n({code:t})}),0)}));r.handleErrorCode(i,n)}))},t.prototype.getFriends=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("getFriends",t,0,(function(t,n){try{if(t===e.ErrorCode.SUCCESS){var i=JSON.parse(n),s=o._convertFriendInfo(i);setTimeout((function(){r({code:t,data:{data:s,pageToken:""}})}),0)}else setTimeout((function(){r({code:t})}),0)}catch(t){o.logger.error(y.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}}));o.handleErrorCode(n,r)}))},t.prototype.getFriendApplications=function(t,o,r){var n=this;return new Promise((function(i){var s=t.order?1:0,a=3;o&&1===o.length&&(a=null==o?void 0:o[0]);var c=n._callCppProxy("getFriendRequestListByPage",a,r||[0,1,2,3],t.count,t.pageToken||"",s,(function(t,o,r){if(t===e.ErrorCode.SUCCESS){var s=[];try{s=JSON.parse(r)}catch(t){n.logger.error(y.P_PARSE_JSON_MSGS_E,r),setTimeout((function(){i({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}var a=s.map((function(e){return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.friendRequestType,applicationStatus:e.friendRequestStatus,operationTime:e.operateTime,remark:e.extra}}));setTimeout((function(){i({code:t,data:{data:a,pageToken:null!=o?o:""}})}),0)}else setTimeout((function(){i({code:t})}),0)}));n.handleErrorCode(c,i)}))},t.prototype.deleteFriendApplication=function(t,o){return Promise.resolve({code:e.ErrorCode.NOT_SUPPORT})},t.prototype._convertFriendInfo=function(e){return e.map((function(e){var t=e.userId,o=e.userName,r=e.remark;return{userId:t,name:o,portraitUri:e.portraitUrl,remark:r,directionType:e.friendType,extProfile:e.extProfiles,addTime:e.addTime,inBlackList:!!e.friendAttribute}}))},t.prototype.getFriendsInfo=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("getFriendByIds",t,(function(t,n){if(t===e.ErrorCode.SUCCESS){var i=JSON.parse(n),s=o._convertFriendInfo(i);setTimeout((function(){r({code:t,data:s})}),0)}else setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))},t.prototype.searchFriendsInfo=function(t){var o=this;return new Promise((function(r){var n=o._callCppProxy("getFriendByNickname",t,(function(t,n){if(t===e.ErrorCode.SUCCESS)try{var i=JSON.parse(n),s=o._convertFriendInfo(i);setTimeout((function(){r({code:e.ErrorCode.SUCCESS,data:s})}),0)}catch(t){o.logger.error(y.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:e.ErrorCode.MAIN_PROCESS_ERROR})}),0)}else setTimeout((function(){r({code:t})}),0)}));o.handleErrorCode(n,r)}))},t.prototype.setFriendAddPermission=function(e){var t=this;return new Promise((function(o){var r=t._callCppProxy("setFriendAuthPermission",e,(function(e,t){setTimeout((function(){o({code:e})}),0)}));t.handleErrorCode(r,o)}))},t.prototype.getFriendAddPermission=function(){var e=this;return new Promise((function(t){var o=e._callCppProxy("getFriendAuthPermission",(function(e,o){setTimeout((function(){t({code:e,data:o})}),0)}));e.handleErrorCode(o,t)}))},t.prototype.setDataBaseLogConfig=function(e){this._callCppProxy("setDataBaseLogConfig",e)},t}(),Oe=r.resolve(__dirname,"binding","electron-"+n.platform()+"-"+n.arch()+".node"),Ne={addon:null},Me=(Ie=process,{sendError:function(e){Ie.send({type:x.ERROR,data:{msg:e}})},sendEvent:function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];Ie.send({type:x.EVENT,data:{eventName:e,data:t}})},sendResponse:function(e){Ie.send({type:x.RESPONSE,data:e})},sendCallback:function(e){Ie.send({type:x.CALLBACK,data:e})}}).sendError;try{Ne.addon=require(Oe)}catch(e){console.error("error ->",Oe,"\n",e),Me(e.toString())}Ne.addon||console.error("error -> cannot find module: ",Oe);var be,Ue=Ne.addon,xe=function(){function e(e,t,o,r,n,i,s){this.sendCallback=i,this._cppService=new Re(e,Ue,t,n,r,o,s)}return e.prototype.call=function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];return E(this,void 0,void 0,(function(){var o,r=this;return P(this,(function(n){switch(n.label){case 0:return"sendMessage"===e&&(t[3]=function(e){var o=t[3];r.sendCallback({reqId:o,data:e})}),[4,(o=this._cppService).callProxy.apply(o,T([e],t,!1))];case 1:return[2,{success:!0,data:n.sent()}]}}))}))},e.prototype.send=function(e){for(var t,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];(t=this._cppService).sendProxy.apply(t,T([e],o,!1))},e.prototype.destroy=function(){this._cppService.destroy()},e}(),Le=function(){function n(o,r,n,i,s,a){var c=this;void 0===a&&(a=!1),this._appkey=o,this._dbpath=r,this._logOutputLevel=n,this._runInMainProcess=i,this._enableSyncEmptyTopConversation=s,this._disableLogReport=a,this._catch={crtUserId:"",connectedTime:0,naviInfo:null,connectionStatus:2,deviceId:"",deltaTime:0},this._connectionStatus=e.RCConnectionStatus.DISCONNECTED,this._connectInfo={token:"",reconnectKickEnable:!1,openCallPlus:!1,traceId:""},this._registerMessageTypeList=[],this._isProcessQuit=!1,this._rendererInitOptions=null,this._senders={},this._callbackCache={},this._createServiceProxy(),t.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",(function(e,t){for(var o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];return E(c,void 0,void 0,(function(){var r,n;return P(this,(function(i){switch(i.label){case 0:return[4,(n=this._cppServiceProcessProxy).call.apply(n,T([t],o,!1))];case 1:return r=i.sent(),e.returnValue=r.data,[2]}}))}))})),t.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",(function(e,t,o){for(var r=[],n=3;n<arguments.length;n++)r[n-3]=arguments[n];return E(c,void 0,void 0,(function(){var n,i,s;return P(this,(function(a){switch(a.label){case 0:return"sendMessage"===o&&(n=r[3],this._callbackCache[n]=e.sender),"connect"===o&&(this._connectInfo={token:r[0],reconnectKickEnable:r[1],openCallPlus:r[2],traceId:r[3]}),[4,(s=this._cppServiceProcessProxy).call.apply(s,T([o],r,!1))];case 1:if(!(i=a.sent()).success)throw new Error(i.data.msg);return this._send2Renderer(e.sender,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,i.data),[2]}}))}))})),t.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(function(e,t){for(var o,r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];"registerMessageType"===t&&c._registerMessageTypeList.push({objectName:r[0],isPersited:r[1],isCounted:r[2],searchProps:r[3]}),(o=c._cppServiceProcessProxy).send.apply(o,T([t],r,!1))})),t.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this)),t.app.on("before-quit",(function(){c._isProcessQuit=!0,c.destroy()})),t.app.on("window-all-closed",(function(){c._isProcessQuit=!0,c.destroy()}))}return n.prototype._send2Renderer=function(e,t){for(var o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];e.isDestroyed()?delete this._senders[e.id]:e.send.apply(e,T([t],o,!1))},n.prototype._send2AllRenderer=function(e,t,o){var r=this;void 0===o&&(o=[]),Object.keys(this._senders).forEach((function(n){var i=r._senders[n];o.includes(i)||r._send2Renderer(i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e,t)}))},n.prototype._registerRenderers=function(e,t){var o=this,r=e.sender,n=r.id;this._rendererInitOptions||(this._rendererInitOptions=t),this._cppServiceProcessProxy.send("registerRenderers",t),this._senders[n]||(this._senders[n]=r,r.once("destroyed",(function(){delete o._senders[n]})))},n.prototype.getMainCache=function(){return this._catch},n.prototype._restartSubProcessProxy=function(){var t=this;if(this._createServiceProxy(),this._connectionStatus!==e.RCConnectionStatus.DISCONNECTED){this._send2AllRenderer("onSuspend",e.ErrorCode.SUB_PROCESS_EXIT),this._registerMessageTypeList.forEach((function(e){t._cppServiceProcessProxy.send("registerMessageType",e.objectName,e.isPersited,e.isCounted,e.searchProps)})),this._cppServiceProcessProxy.send("registerRenderers",this._rendererInitOptions);var o=this._connectInfo,r=o.token,n=o.reconnectKickEnable,i=o.openCallPlus;this._cppServiceProcessProxy.send("reconnect",r,n,i)}},n.prototype._eventNotifyHandler=function(t){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];var n=o[0],i=o[1];switch(t){case"onConnected":this._catch=n,this._connectionStatus=e.RCConnectionStatus.CONNECTED;break;case"onSuspend":this._connectionStatus=e.RCConnectionStatus.SUSPENDED;break;case"onDisconnected":this._connectionStatus=e.RCConnectionStatus.DISCONNECTED;break;case"onConnecting":this._connectionStatus=e.RCConnectionStatus.CONNECTING}this._send2AllRenderer(t,n,i)},n.prototype._callbackHandler=function(e){var t=e.reqId,o=e.data;this._callbackCache[t]&&this._send2Renderer(this._callbackCache[t],"__RC_CHANNEL_RESULT_FROM_MAIN__",t,o)},n.prototype._createServiceProxy=function(){var e=this,n=this._dbpath||r.resolve(t.app.getPath("userData"));if(this._runInMainProcess)this._cppServiceProcessProxy=new xe(this._appkey,n,this._logOutputLevel,this._enableSyncEmptyTopConversation,this._eventNotifyHandler.bind(this),this._callbackHandler.bind(this),this._disableLogReport);else{var i=o.fork(r.resolve(__dirname,"cppServiceProcess.js"),[this._appkey,n,this._enableSyncEmptyTopConversation.toString(),this._logOutputLevel.toString(),this._disableLogReport.toString()]);this._cppServiceProcessProxy=new ee(i,this._eventNotifyHandler.bind(this),this._callbackHandler.bind(this),(function(t,o){void 0===o&&(o=!1);var r="sub process exit, msg: "+t+", isRestart: "+o+", _isProcessQuit: "+e._isProcessQuit;if(console.error(r),o&&!e._isProcessQuit)return e._restartSubProcessProxy()}))}},n.prototype.destroy=function(){this._cppServiceProcessProxy.destroy()},n.prototype.setDataBaseLogConfig=function(e){this._cppServiceProcessProxy.call("setDataBaseLogConfig",e)},n}(),we=function(){function e(e,t,o,r,n,i){this._rcMain=new Le(e,t,o,r,n,i)}return e.prototype.getCppProto=function(){var e=this;return{destroy:function(){console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),e.destroy()}}},e.prototype.destroy=function(){this._rcMain.destroy()},e.prototype.getDeviceId=function(){return this._rcMain.getMainCache().deviceId},e.prototype.getServerTime=function(){return this._rcMain.getMainCache().connectedTime},e.prototype.setDatabaseOperationTimeThreshold=function(e){return this._rcMain.setDataBaseLogConfig(e)},e}();module.exports=function(t){return function(t,o){if(be)return be;if(!t)throw new Error("Initializ failed, `appkey` is required!");return be=new we(t,(null==o?void 0:o.dbpath)||"",(null==o?void 0:o.logOutputLevel)||e.LogL.WARN,(null==o?void 0:o.runInMainProcess)||!1,!!(null==o?void 0:o.enableSyncEmptyTopConversation),(null==o?void 0:o.disableLogReport)||!1)}(t.appkey,t)};
1
+ "use strict";var e=require("electron"),t=require("child_process"),n=require("path"),o=require("os"),r=require("http"),i=require("https"),s=require("zlib"),a=require("url"),_=require("net"),c=require("events"),u=require("tls"),E=require("fs"),R=require("crypto");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var p,C,I,T,S,h,N,f,O,A,g,P,v,L,m,y,M,U,D,G,V,b,F,w,x,B,k,H,J,Y,W,K,j,X,Q,q,Z,z,$,ee,te,ne,oe,re,ie,se,ae,_e,ce,ue,Ee,Re,le,de,pe,Ce,Ie,Te,Se,he,Ne,fe,Oe,Ae,ge,Pe,ve,Le,me=d(o),ye=l(s);!function(e){e[e.QINIU=1]="QINIU",e[e.ALI=2]="ALI",e[e.AWS=3]="AWS",e[e.STC=4]="STC",e[e.MINIO=5]="MINIO"}(p||(p={})),function(e){e.L_IMSDK_VER_O="L-imsdk_ver-O",e.A_INIT_O="A-init-O",e.A_INIT_REPEAT_O="A_INIT_REPEAT_O",e.L_INIT_O="L-init-O",e.A_DESTROY_O="A_DESTROY_O",e.L_DESTROY_O="L_DESTROY_O",e.A_CONNECT_T="A-connect-T",e.A_CONNECT_R="A-connect-R",e.A_CONNECT_S="A-connect-S",e.A_DISCONNECT_O="A-disconnect-O",e.A_RECONNECT_T="A-reconnect-T",e.A_RECONNECT_R="A_RECONNECT_R",e.L_CONNECT_T="L-connect-T",e.L_CONNECT_R="L-connect-R",e.L_CONNECT_S="L-connect-S",e.L_DB_UPGRATE_START_S="L-db_upgrate_start-S",e.L_DB_UPGRATING_S="L-db_upgrating-S",e.L_DB_UPGRATE_COMPLETE_S="L-db_upgrate_complete-S",e.L_NOTIFY_ULTRA_ONLINE_S="L-notify-ultra-online-S",e.L_ULTRA_SYNC_DONE_S="L-ultra-sync-done-S",e.L_BATCH_MESSAGE_O="L-BATCH_MESSAGE-O",e.A_MSG_LISTENER_E="A-MSG_LISTENER-E",e.O="L-original-O",e.T="L-TEST-O",e.L_INSTALL_PLUGIN_T="L-INSTALL_PLUGIN-T",e.L_INSTALL_PLUGIN_R="L-INSTALL_PLUGIN-R",e.L_NAVI_CONF_E="L-NAVI_CONF_ERROR-E",e.L_NAVI_CMP_R="L-NAVI_CPM-R",e.A_SEND_MSG_T="A-send_msg-T",e.A_SEND_MSG_R="A-send_msg-R",e.L_SEND_MSG_T="L-send_msg-T",e.L_SEND_MSG_R="L-send_msg-R",e.L_PULL_MSG_T="L-pull_msg-T",e.L_PULL_MSG_R="L-pull_msg-R",e.L_PULL_MSG_E="L-pull_msg-E",e.L_PULL_MSG_O="L-pull_msg-O",e.L_PULL_ULTRA_MSG_T="L-pull_ultra_msg-T",e.L_PULL_ULTRA_MSG_R="L-pull_ultra_msg-R",e.L_PULL_CHATROOM_KV_T="L-pull_chatroom_kv-T",e.L_PULL_CHATROOM_KV_R="L-pull_chatroom_kv-R",e.L_PULL_CHATROOM_MSG_T="L-pull_chatroom_msg-T",e.L_PULL_CHATROOM_MSG_R="L-pull_chatroom_msg-R",e.L_RECV_MULTI_SYNC_MSG_O="L-recv_multi_sync_msg-O",e.L_RECV_S_MSG_O="L-recv_s_msg-O",e.A_DELETE_MESSAGES_S="A-delete_messages-S",e.P_DELETE_MSG_S="P-delete_msg-S",e.L_PULL_CONVERSATION_S="L-pull_conversation-S",e.L_RECALL_ULTRA_MSG_S="L-recall_ultra_msg-S",e.A_REGTYP_O="A-regtyp-O",e.P_REGTYP_E="P-regtype-E",e.L_GET_NAVI_T="L-get_navi-T",e.L_GET_NAVI_R="L-get_navi-R",e.L_REQUEST_T="L-request-T",e.L_REQUEST_R="L-request-R",e.L_PARSE_NAVI_E="L-parse_navi-E",e.L_ENV_S="L-Env-S",e.L_GET_INDEX_NAVI_S="L-get_index_navi-S",e.A_JOIN_CHATROOM_T="A-join_chatroom-T",e.A_JOIN_CHATROOM_R="A-join_chatroom-R",e.L_JOIN_CHATROOM_T="L-join_chatroom-T",e.L_JOIN_CHATROOM_R="L-join_chatroom-R",e.A_QUIT_CHATROOM_T="A-quit_chatroom-T",e.A_QUIT_CHATROOM_R="A-quit_chatroom-R",e.L_REJOIN_CHATROOM_T="L-rejoin_chatroom-T",e.L_REJOIN_CHATROOM_R="L-rejoin_chatroom-R",e.L_REJOIN_CHATROOM_S="L-rejoin_chatroom-S",e.L_MEDIA_S="L-media-S",e.L_MEDIA_UPLOAD_T="L-media_upload-T",e.L_MEDIA_UPLOAD_R="L-media_upload-R",e.G_UPLOAD_LOG_S="G-upload_log-S",e.G_REPORT_LOG_S="G-report_log-S",e.G_UPLOAD_LOG_E="G-upload_log-E",e.G_GET_REAL_TIMELOG_COMMAND_S="G-get_real_timelog_command-S",e.L_CHECK_ALIVE_IM_T="L-check_alive_im-T",e.L_CHECK_ALIVE_IM_R="L-check_alive_im-R",e.L_CHECK_ALIVE_IM_S="L-check_alive_im-S",e.A_GET_HISTORY_MSG_T="A-get_history_msg-T",e.A_GET_HISTORY_MSG_R="A-get_history_msg-R",e.L_GET_HISTORY_MSG_T="L-get_history_msg-T",e.L_GET_HISTORY_MSG_R="L-get_history_msg-R",e.A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E="A-get_privage_message_deliver_time-E",e.A_GET_GROUP_MESSAGE_DELIVER_LIST_E="A-get_group_message_deliver_list-E",e.A_CALLBACK_O="A-callback-O",e.A_CALLBACK_E="A-callback-E",e.L_CALLBACK_E="L-callback-E",e.A_SEND_MESSAGE_READ_RECEIPT_V4_T="A-send_message_read_receipt_V4-T",e.A_SEND_MESSAGE_READ_RECEIPT_V4_R="A-send_message_read_receipt_V4-R",e.A_GET_MESSAGE_READ_RECEIPT_V4_T="A-get_message_read_receipt_V4-T",e.A_GET_MESSAGE_READ_RECEIPT_V4_R="A-get_message_read_receipt_V4-R",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_T="A-batch_get_message_read_receipt_info_V4-T",e.A_BATCH_GET_MESSAGE_READ_RECEIPT_INFO_V4_R="A-batch_get_message_read_receipt_info_V4-R",e.A_SYNC_READ_STATUS_T="A-sync_read_status-T",e.A_SYNC_READ_STATUS_R="A-sync_read_status-R",e.A_GET_TOP_CONVERSATION_LIST_E="A-get_top_conversation_list-E",e.L_PB_ENCODE_E="L-pb-encode-E",e.L_PB_DECODE_E="L-pb-decode-E",e.L_NOTIFY_NAVI_CHANGE_E="L-notify_navi_change-E",e.L_REPORT_FULL_LOG_O="L-report_full_log-O",e.L_REPORT_FULL_LOG_T="L-report_full_log-T",e.L_REPORT_FULL_LOG_R="L-report_full_log-R",e.L_REPORT_LOG_POLICY_E="L-parse_navi_logpolicy-E",e.L_UNSUPPORT_INDEXDB_O="L-unsupport_IndexDB-O",e.L_LOGDB_OPEN_FAILED_E="L-logDB_open_failed-E",e.L_LOGDB_CLOSED_S="L-logDB_closed-S",e.L_LOGDB_ERROR_E="L-logDB_error-S",e.L_LOGDB_ABORT_S="L-logDB_abort-S",e.L_REALTIME_LOG_R="L_REALTIME_LOG_R",e.L_REALTIME_LOG_O="L_REALTIME_LOG_O",e.L_REALTIME_LOG_T="L_REALTIME_LOG_T",e.L_STATISTIC_LOG_R="L_STATISTIC_LOG_R",e.L_STATISTIC_LOG_O="L_STATISTIC_LOG_O",e.L_STATISTIC_LOG_T="L_STATISTIC_LOG_T",e.L_UNKNOWN_TOPIC_E="L_UNKNOWN_TOPIC_E",e.L_RECV_RMTP_O="L_RECV_RMTP_O",e.L_RECV_RMTP_E="L_RECV_RMTP_E",e.L_RECV_S_NTF_O="L-recv_s_ntf_O",e.L_VER_REPORT_T="L-VER_REPORT-T",e.L_VER_REPORT_R="L-VER_REPORT-R",e.L_CALL_MAIN_SYNC_O="L_CALL_MAIN_SYNC_O",e.L_UNSUPPORT_NTF_FROM_MAIN_E="L_UNSUPPORT_NTF_FROM_MAIN_E",e.A_SET_MSG_CONTENT_O="A_SET_MSG_CONTENT_O",e.A_REMOVE_PROXY_O="A-remove_proxy-O",e.A_SET_PROXY_O="A-set_proxy-O",e.A_TEST_PROXY_O="A-test_proxy-O",e.L_WEBSOCKET_DISACCORD_E="L-websocket_disaccord-e",e.A_SEARCH_MESSAGE_BY_USER_T="A-search_messages_by_user-T",e.A_SEARCH_MESSAGE_BY_USER_R="A-search_messages_by_user-R",e.L_GET_STATIC_CONF_T="L-get_static_conf-T",e.L_GET_STATIC_CONF_R="L-get_static_conf-R",e.L_GET_STATIC_CONF_E="L-get_static_conf-E",e.L_CLOUD_DISABLED="L-cloud_disabled",e.L_CLOUD_EXPIRE="L-cloud_expire",e.L_CLOUD_OVERCLOCK="L-cloud_overclock",e.L_CLOUD_APPKEY_REGION_E="L-cloud_appkey_region_error",e.L_CLOUD_CONFIG_DATA_E="L-cloud_config_data_error",e.L_CLOUD_SET_CACHE_O="L-cloud_set_cache-O",e.L_CLOUD_GET_CACHE_O="L-cloud_get_cache-O",e.L_CLOUD_MSG_NTF_O="L-cloud_msg_ntf-O",e.L_CLOUD_SET_AREA_CODE_O="L-cloud_set_area_code-O",e.L_CLOUD_SET_MRTR_O="L-cloud_set_mrtr-O",e.L_SYNC_SUBSCRIBED_USER_STATUS_FINISHED_S="L-sync_subscribed_user_status_finished-S",e.L_PULL_SUBSCRIBED_USER_RELATION_T="L-pull_subscribed_user_relation-T",e.L_PULL_SUBSCRIBED_USER_RELATION_R="L-pull_subscribed_user_relation-R",e.L_PULL_SUBSCRIBED_USER_STATUS_T="L-pull_subscribed_user_status-T",e.L_PULL_SUBSCRIBED_USER_STATUS_R="L-pull_subscribed_user_status-R",e.L_OWN_USER_PROFILE_CHANGED_S="L-own_user_profile_changed-S",e.L_QUERY_SUBSCRIBE_DATA_T="L-query_subscribe_data-T",e.L_QUERY_SUBSCRIBE_DATA_R="L-query_subscribe_data-R",e.L_PULL_USER_PROFILE_T="L-pull_user_profile-T",e.L_PULL_USER_PROFILE_R="L-pull_user_profile-R",e.L_PULL_OWN_PROFILE_T="L-pull_own_profile-T",e.L_PULL_OWN_PROFILE_R="L-pull_own_profile-R",e.L_QUERY_FRIEND_LIST_T="L-query_friend_list-T",e.L_QUERY_FRIEND_LIST_R="L-query_friend_list-R",e.L_PULL_USER_PROFILE_REQ_T="L-pull_user_profile_req-T",e.L_PULL_USER_PROFILE_REQ_R="L-pull_user_profile_req-R",e.L_PULL_EVENT_CHANGE_NOTIFY_ULTRA_ONLINE_S="L-pull_event_change_notify_ultra_online-S",e.L_PULL_EVENT_CHANGE_T="L-pull_event_change-T",e.L_PULL_EVENT_CHANGE_R="L-pull_event_change-R",e.L_PARSE_JSON_E="L-parse_json-E"}(C||(C={})),function(e){e[e.BOTH=2]="BOTH"}(I||(I={})),function(e){e[e.BOTH=2]="BOTH"}(T||(T={})),function(e){e[e.FREE=1]="FREE",e[e.NEED_VERIFY=2]="NEED_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(S||(S={})),function(e){e[e.NONE=0]="NONE",e[e.IN_MY_FRIEND_LIST=1]="IN_MY_FRIEND_LIST",e[e.IN_OTHER_FRIEND_LIST=2]="IN_OTHER_FRIEND_LIST",e[e.BOTH_WAY=3]="BOTH_WAY"}(h||(h={})),function(e){e[e.SENT=1]="SENT",e[e.RECEIVED=2]="RECEIVED"}(N||(N={})),function(e){e[e.UNHANDLED=0]="UNHANDLED",e[e.ACCEPTED=1]="ACCEPTED",e[e.REFUSED=2]="REFUSED",e[e.EXPIRED=3]="EXPIRED"}(f||(f={})),function(e){e[e.FRIEND_APPLICATION=31]="FRIEND_APPLICATION"}(O||(O={})),function(e){e[e.FRIEND_APPLY=0]="FRIEND_APPLY",e[e.FRIEND_REFUSE=1]="FRIEND_REFUSE",e[e.FRIEND_USER_INFO=2]="FRIEND_USER_INFO",e[e.FRIENDS_INPUT=3]="FRIENDS_INPUT",e[e.FRIEND_CLEAR=4]="FRIEND_CLEAR",e[e.FRIEND_INFO_CHANGE=5]="FRIEND_INFO_CHANGE",e[e.FRIEND_INFO_CHANGE_SYNC=6]="FRIEND_INFO_CHANGE_SYNC"}(A||(A={})),function(e){e[e.OWNER_VERIFY=0]="OWNER_VERIFY",e[e.FREE=1]="FREE",e[e.OWNER_OR_MANAGER_VERIFY=2]="OWNER_OR_MANAGER_VERIFY",e[e.NO_ONE_ALLOWED=3]="NO_ONE_ALLOWED"}(g||(g={})),function(e){e[e.OWNER=0]="OWNER",e[e.OWNER_OR_MANAGER=1]="OWNER_OR_MANAGER",e[e.EVERYONE=2]="EVERYONE"}(P||(P={})),function(e){e[e.OWNER_OR_MANAGER_OR_SELF=0]="OWNER_OR_MANAGER_OR_SELF",e[e.OWNER_OR_SELF=1]="OWNER_OR_SELF",e[e.SELF=2]="SELF"}(v||(v={})),function(e){e[e.FREE=0]="FREE",e[e.INVITEE_VERIFY=1]="INVITEE_VERIFY"}(L||(L={})),function(e){e[e.UNDEF=0]="UNDEF",e[e.NORMAL=1]="NORMAL",e[e.MANAGER=2]="MANAGER",e[e.OWNER=3]="OWNER"}(m||(m={})),function(e){e[e.CREATE=0]="CREATE",e[e.JOIN=1]="JOIN",e[e.KICK=2]="KICK",e[e.QUIT=3]="QUIT",e[e.DISMISS=4]="DISMISS",e[e.ADD_MANAGER=5]="ADD_MANAGER",e[e.REMOVE_MANAGER=6]="REMOVE_MANAGER",e[e.TRANSFER_GROUP_OWNER=7]="TRANSFER_GROUP_OWNER"}(y||(y={})),function(e){e[e.GROUP_INFO_CHANGE=0]="GROUP_INFO_CHANGE",e[e.MEMBER_PROFILE_CHANGE=1]="MEMBER_PROFILE_CHANGE",e[e.GROUP_REMARK_SET=2]="GROUP_REMARK_SET",e[e.GROUP_REMARK_DELETE=3]="GROUP_REMARK_DELETE"}(M||(M={})),function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE"}(U||(U={})),function(e){e[e.MANAGER_UNHANDLED=0]="MANAGER_UNHANDLED",e[e.MANAGER_REFUSED=1]="MANAGER_REFUSED",e[e.INVITEE_UNHANDLED=2]="INVITEE_UNHANDLED",e[e.INVITEE_REFUSED=3]="INVITEE_REFUSED",e[e.JOINED=4]="JOINED",e[e.EXPIRED=5]="EXPIRED"}(D||(D={})),function(e){e[e.REFUSE=0]="REFUSE",e[e.ACCEPT=1]="ACCEPT"}(G||(G={})),function(e){e[e.APPLICANT=0]="APPLICANT",e[e.MANAGER=1]="MANAGER"}(V||(V={})),function(e){e[e.GROUP_OPERATION=11]="GROUP_OPERATION",e[e.GROUP_PROFILE_CHANGE=12]="GROUP_PROFILE_CHANGE",e[e.GROUP_APPLICATION_INVITATION=13]="GROUP_APPLICATION_INVITATION",e[e.GROUP_FOLLOW_USER_CHANGE=14]="GROUP_FOLLOW_USER_CHANGE"}(b||(b={})),function(e){e[e.APPLICATION=0]="APPLICATION",e[e.INVITATION=1]="INVITATION"}(F||(F={})),function(e){e[e.APPLICATION_SENT=0]="APPLICATION_SENT",e[e.INVITATION_SENT=1]="INVITATION_SENT",e[e.INVITATION_RECEIVED=2]="INVITATION_RECEIVED",e[e.APPLICATION_RECEIVED=3]="APPLICATION_RECEIVED"}(w||(w={})),function(e){e[e.UPDATE=1]="UPDATE",e[e.DELETE=2]="DELETE"}(x||(x={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(B||(B={})),function(e){e[e.LeaveOnMyOwn=0]="LeaveOnMyOwn",e[e.OtherDeviceLogin=1]="OtherDeviceLogin"}(k||(k={})),function(e){e[e.QUIT=0]="QUIT",e[e.JOIN=1]="JOIN"}(H||(H={})),function(e){e[e.UnmuteUsers=0]="UnmuteUsers",e[e.MuteUsers=1]="MuteUsers",e[e.UnmuteAll=2]="UnmuteAll",e[e.MuteAll=3]="MuteAll",e[e.RemoveWhitelist=4]="RemoveWhitelist",e[e.AddWhitelist=5]="AddWhitelist",e[e.UnmuteGloble=6]="UnmuteGloble",e[e.MuteGloble=7]="MuteGloble"}(J||(J={})),function(e){e[e.Deblock=0]="Deblock",e[e.Blocked=1]="Blocked"}(Y||(Y={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ACTIVE_DISCONNECT=2]="ACTIVE_DISCONNECT",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.FORBIDDEN_IN_PRIVATE=20106]="FORBIDDEN_IN_PRIVATE",e[e.SYS_CONVERSATION_NOT_SUPPORT_MESSAGE=20109]="SYS_CONVERSATION_NOT_SUPPORT_MESSAGE",e[e.CLOUD_DATA_CENTER_INVALID=20512]="CLOUD_DATA_CENTER_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.OPERATION_BLOCKED=20605]="OPERATION_BLOCKED",e[e.OPERATION_NOT_SUPPORT=20606]="OPERATION_NOT_SUPPORT",e[e.REQUEST_OVER_FREQUENCY=20607]="REQUEST_OVER_FREQUENCY",e[e.NOT_IN_DISCUSSION=21406]="NOT_IN_DISCUSSION",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.SENSITIVE_REPLACE=21502]="SENSITIVE_REPLACE",e[e.MESSAGE_EXPAND_NOT_EXIST=22201]="MESSAGE_EXPAND_NOT_EXIST",e[e.MESSAGE_EXPAND_NOT_SUPPORT=22202]="MESSAGE_EXPAND_NOT_SUPPORT",e[e.MESSAGE_EXPAND_FORMAT_ERROR=22203]="MESSAGE_EXPAND_FORMAT_ERROR",e[e.MESSAGE_EXPAND_NOT_AUTHORIZED=22204]="MESSAGE_EXPAND_NOT_AUTHORIZED",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.NOT_IN_CHATROOM=23406]="NOT_IN_CHATROOM",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.FORBIDDEN_IN_CHATROOM=23408]="FORBIDDEN_IN_CHATROOM",e[e.RC_CHATROOM_USER_KICKED=23409]="RC_CHATROOM_USER_KICKED",e[e.RC_CHATROOM_NOT_EXIST=23410]="RC_CHATROOM_NOT_EXIST",e[e.RC_CHATROOM_IS_FULL=23411]="RC_CHATROOM_IS_FULL",e[e.RC_CHATROOM_PATAMETER_INVALID=23412]="RC_CHATROOM_PATAMETER_INVALID",e[e.CHATROOM_GET_HISTORYMSG_ERROR=23413]="CHATROOM_GET_HISTORYMSG_ERROR",e[e.CHATROOM_NOT_OPEN_HISTORYMSG_STORE=23414]="CHATROOM_NOT_OPEN_HISTORYMSG_STORE",e[e.CHATROOM_KV_EXCEED=23423]="CHATROOM_KV_EXCEED",e[e.CHATROOM_KV_OVERWRITE_INVALID=23424]="CHATROOM_KV_OVERWRITE_INVALID",e[e.CHATROOM_SET_PROPERTY_OVER_FREQUENCY=23425]="CHATROOM_SET_PROPERTY_OVER_FREQUENCY",e[e.CHATROOM_KV_STORE_NOT_OPEN=23426]="CHATROOM_KV_STORE_NOT_OPEN",e[e.CHATROOM_KEY_NOT_EXIST=23427]="CHATROOM_KEY_NOT_EXIST",e[e.CHATROOM_KV_STORE_NOT_ALL_SUCCESS=23428]="CHATROOM_KV_STORE_NOT_ALL_SUCCESS",e[e.CHATROOM_KV_STORE_OUT_LIMIT=23429]="CHATROOM_KV_STORE_OUT_LIMIT",e[e.CHATROOM_KV_SET_ERROR=23431]="CHATROOM_KV_SET_ERROR",e[e.HAVNODEVICEID=24001]="HAVNODEVICEID",e[e.DEVICEIDISHAVE=24002]="DEVICEIDISHAVE",e[e.FEILD=24009]="FEILD",e[e.INTERNALERRROR=24015]="INTERNALERRROR",e[e.RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET=24360]="RC_USER_PROFILE_KEY_NOT_ALLOW_SDK_SET",e[e.RC_USER_PROFILE_KEY_NOT_EXIST=24361]="RC_USER_PROFILE_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KEY_NOT_EXIST=24362]="RC_USER_PROFILE_EXT_KEY_NOT_EXIST",e[e.RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT=24363]="RC_USER_PROFILE_EXT_KV_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT=24364]="RC_USER_PROFILE_VALUE_LENGTH_EXCEED_LIMIT",e[e.RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT=24365]="RC_USER_PROFILE_QUERY_COUNT_EXCEED_LIMIT",e[e.RC_USER_PROFILE_USER_NOT_EXIST=24366]="RC_USER_PROFILE_USER_NOT_EXIST",e[e.RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS=24367]="RC_USER_PROFILE_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_USER_PROFILE_VALUE_EXCEED_RANGE=24368]="RC_USER_PROFILE_VALUE_EXCEED_RANGE",e[e.RC_USER_PROFILE_SERVICE_UNAVAILABLE=24369]="RC_USER_PROFILE_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_UNAVAILABLE=24401]="ULTRA_GROUP_SERVICE_UNAVAILABLE",e[e.ULTRA_GROUP_SERVICE_ERROR=24402]="ULTRA_GROUP_SERVICE_ERROR",e[e.ULTRA_GROUP_PARAMETER_ERROR=24403]="ULTRA_GROUP_PARAMETER_ERROR",e[e.ULTRA_GROUP_UNKNOWN_ERROR=24404]="ULTRA_GROUP_UNKNOWN_ERROR",e[e.NOT_IN_ULTRA_GROUP=24406]="NOT_IN_ULTRA_GROUP",e[e.FORBIDDEN_IN_ULTRA_GROUP=24408]="FORBIDDEN_IN_ULTRA_GROUP",e[e.ULTRA_GROUP_NOT_EXIST=24410]="ULTRA_GROUP_NOT_EXIST",e[e.ULTRA_GROUP_MEMBERS_OVERSIZE=24411]="ULTRA_GROUP_MEMBERS_OVERSIZE",e[e.ULTRA_GROUP_JOINED_OVERSIZE=24412]="ULTRA_GROUP_JOINED_OVERSIZE",e[e.ULTRA_GROUP_CHANNELS_OVERSIZE=24413]="ULTRA_GROUP_CHANNELS_OVERSIZE",e[e.ULTRA_GROUP_CHANNEL_ID_NOT_EXIST=24414]="ULTRA_GROUP_CHANNEL_ID_NOT_EXIST",e[e.ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY=24415]="ULTRA_GROUP_MESSAGE_SENT_OVER_FREQUENCY",e[e.ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL=24416]="ULTRA_GROUP_USER_NOT_IN_PRIVATE_CHANNEL",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.MESSAGE_STORAGE_SERVICE_UNAVAILABLE=25102]="MESSAGE_STORAGE_SERVICE_UNAVAILABLE",e[e.RC_SERVER_UNKOWN_ERROR=25104]="RC_SERVER_UNKOWN_ERROR",e[e.RECALL_MESSAGE_USER_INVALID=25107]="RECALL_MESSAGE_USER_INVALID",e[e.RC_ENTRUST_SERVER_ERROR=25402]="RC_ENTRUST_SERVER_ERROR",e[e.RC_ENTRUST_SERVER_PARAMETER_ERROR=25403]="RC_ENTRUST_SERVER_PARAMETER_ERROR",e[e.RC_GROUP_ILLEGAL_ERROR=25404]="RC_GROUP_ILLEGAL_ERROR",e[e.RC_GROUP_AUTHORITY_ERROR=25405]="RC_GROUP_AUTHORITY_ERROR",e[e.RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT=25406]="RC_GROUP_PARAMETER_LENGTH_EXCEED_LIMIT",e[e.RC_GROUP_PARAMETER_FORMAT_ERROR=25407]="RC_GROUP_PARAMETER_FORMAT_ERROR",e[e.RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS=25408]="RC_GROUP_PARAMETER_VALUE_CAN_ONLY_BE_NUMBERS",e[e.RC_GROUP_ID_ALREADY_EXIST=25409]="RC_GROUP_ID_ALREADY_EXIST",e[e.RC_GROUP_ID_NOT_EXIST=25410]="RC_GROUP_ID_NOT_EXIST",e[e.RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT=25411]="RC_GROUP_MEMBERS_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_MEMBERS_ALREADY_IN_GROUP=25412]="RC_GROUP_MEMBERS_ALREADY_IN_GROUP",e[e.RC_GROUP_NOT_ALLOW_SDK_OPERATION=25413]="RC_GROUP_NOT_ALLOW_SDK_OPERATION",e[e.RC_GROUP_NOT_ALLOW_JOIN=25414]="RC_GROUP_NOT_ALLOW_JOIN",e[e.RC_GROUP_EXT_KEY_NOT_EXIST=25415]="RC_GROUP_EXT_KEY_NOT_EXIST",e[e.RC_GROUP_REQUEST_OVERFREQUENCY=25416]="RC_GROUP_REQUEST_OVERFREQUENCY",e[e.RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK=25417]="RC_GROUP_OWNER_NOT_ALLOW_QUIT_OR_KICK",e[e.RC_GROUP_USER_NOT_IN_GROUP=25418]="RC_GROUP_USER_NOT_IN_GROUP",e[e.RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT=25419]="RC_GROUP_MANAGER_OR_FOLLOW_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP=25420]="RC_GROUP_USER_IS_NOT_MANAGER_IN_GROUP",e[e.RC_GROUP_APPLICATION_NOT_EXIST=25421]="RC_GROUP_APPLICATION_NOT_EXIST",e[e.RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT=25422]="RC_GROUP_QUERY_GROUP_COUNT_EXCEED_LIMIT",e[e.RC_GROUP_NAME_INVALID=25423]="RC_GROUP_NAME_INVALID",e[e.RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT=25424]="RC_GROUP_JOIN_GROUP_NEED_MANAGER_ACCEPT",e[e.RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER=25425]="RC_GROUP_OWNER_NOT_ALLOW_BE_MANAGER",e[e.RC_GROUP_NO_INVITE_PERMISSION=25426]="RC_GROUP_NO_INVITE_PERMISSION",e[e.RC_GROUP_NEED_INVITEE_ACCEPT=25427]="RC_GROUP_NEED_INVITEE_ACCEPT",e[e.RC_GROUP_APPLICATION_ALREADY_HANDLE=25428]="RC_GROUP_APPLICATION_ALREADY_HANDLE",e[e.RC_GROUP_OLD_GROUP_NOT_ENTRUST=25429]="RC_GROUP_OLD_GROUP_NOT_ENTRUST",e[e.RC_GROUP_ID_INVALID=25430]="RC_GROUP_ID_INVALID",e[e.RC_PAGE_TOKEN_PARSING_FAILED=25432]="RC_PAGE_TOKEN_PARSING_FAILED",e[e.RC_FRIEND_ALREADY_FRIEND=25460]="RC_FRIEND_ALREADY_FRIEND",e[e.RC_FRIEND_NEED_ACCEPT=25461]="RC_FRIEND_NEED_ACCEPT",e[e.RC_FRIEND_IN_OTHER_BLACK_LIST=25462]="RC_FRIEND_IN_OTHER_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_OTHER_WHITE_LIST=25463]="RC_FRIEND_NOT_IN_OTHER_WHITE_LIST",e[e.RC_FRIEND_IN_MY_BLACK_LIST=25464]="RC_FRIEND_IN_MY_BLACK_LIST",e[e.RC_FRIEND_NOT_IN_MY_WHITE_LIST=25465]="RC_FRIEND_NOT_IN_MY_WHITE_LIST",e[e.RC_FRIEND_APPLICATION_NOT_EXIST=25466]="RC_FRIEND_APPLICATION_NOT_EXIST",e[e.RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT=25467]="RC_FRIEND_MY_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT=25468]="RC_FRIEND_OTHER_FRIEND_COUNT_EXCEED_LIMIT",e[e.RC_FRIEND_NOT_FRIEND=25469]="RC_FRIEND_NOT_FRIEND",e[e.RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT=25470]="RC_FRIEND_FIELDS_LENGTH_EXCEED_LIMIT",e[e.RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND=25471]="RC_FRIEND_OTHER_NOT_ALLOW_ADD_FRIEND",e[e.RC_FRIEND_NOT_EXIST=25472]="RC_FRIEND_NOT_EXIST",e[e.RC_FRIEND_NOT_ALLOW_ADD_SELF=25473]="RC_FRIEND_NOT_ALLOW_ADD_SELF",e[e.PUSH_PARAMETER_INVALID=26001]="PUSH_PARAMETER_INVALID",e[e.USER_SETTING_SYNCED_ERROR=26002]="USER_SETTING_SYNCED_ERROR",e[e.CONVERSATION_TAG_OVERSIZE=26004]="CONVERSATION_TAG_OVERSIZE",e[e.RC_READ_RECEIPT_V4_INVALID=26005]="RC_READ_RECEIPT_V4_INVALID",e[e.RC_SERVER_DRIVE_UNREAD_COUNT_INVALID=26006]="RC_SERVER_DRIVE_UNREAD_COUNT_INVALID",e[e.RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED=26007]="RC_SERVER_PARAMETER_MESSAGEUIDS_CONFUSED",e[e.RC_SERVER_PARAMETER_MESSAGEUID_INVALID=26009]="RC_SERVER_PARAMETER_MESSAGEUID_INVALID",e[e.RC_SERVER_PARAMETER_INVALID=26010]="RC_SERVER_PARAMETER_INVALID",e[e.RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE=26020]="RC_SUBSCRIBE_ONLINE_SERVICE_UNAVAILABLE",e[e.RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT=26021]="RC_BESUBSCRIBED_USERIDS_COUNT_EXCEED_LIMIT",e[e.RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT=26022]="RC_SUBSCRIBED_USERIDS_EXCEED_LIMIT",e[e.RC_FILE_SIZE_EXCEED_LIMIT=26106]="RC_FILE_SIZE_EXCEED_LIMIT",e[e.INVALID_PARAMETER_SIZE_NOT_FOUND=26107]="INVALID_PARAMETER_SIZE_NOT_FOUND",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_HTTP_SEND_FAIL=30004]="RC_HTTP_SEND_FAIL",e[e.RC_HTTP_REQ_FAIL=30005]="RC_HTTP_REQ_FAIL",e[e.RC_HTTP_RECV_FAIL=30006]="RC_HTTP_RECV_FAIL",e[e.RC_NAVI_REQ_FAILED=30007]="RC_NAVI_REQ_FAILED",e[e.RC_NODE_NOT_FOUND=30008]="RC_NODE_NOT_FOUND",e[e.RC_DOMAIN_NOT_RESOLVE=30009]="RC_DOMAIN_NOT_RESOLVE",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PING_EXCEED_LIMIT=30012]="RC_PING_EXCEED_LIMIT",e[e.PONG_RECEIVED_ERROR=30013]="PONG_RECEIVED_ERROR",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.CONNECT_OVER_FREQUENCY=30015]="CONNECT_OVER_FREQUENCY",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_NETWORK_DOWN=30019]="RC_NETWORK_DOWN",e[e.RC_TCP_DISCONNECTED_NO_RMTP=30021]="RC_TCP_DISCONNECTED_NO_RMTP",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_PROTO_VERSION_ERROR=31001]="RC_CONN_PROTO_VERSION_ERROR",e[e.RC_CONN_IDENTIFIER_REJECTED=31002]="RC_CONN_IDENTIFIER_REJECTED",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_TOKEN_INCORRECT=31004]="RC_CONN_TOKEN_INCORRECT",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_CONN_REDIRECTED=31006]="RC_CONN_REDIRECTED",e[e.RC_CONN_PACKAGE_NAME_INVALID=31007]="RC_CONN_PACKAGE_NAME_INVALID",e[e.RC_CONN_APP_BLOCKED_OR_DELETED=31008]="RC_CONN_APP_BLOCKED_OR_DELETED",e[e.RC_CONN_USER_BLOCKED=31009]="RC_CONN_USER_BLOCKED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_EXCEPTION=31011]="RC_DISCONN_EXCEPTION",e[e.CONNECTION_ENCRYPT_AUTHORIZED_ERROR=31012]="CONNECTION_ENCRYPT_AUTHORIZED_ERROR",e[e.RC_CONN_TOKEN_EXPIRED=31020]="RC_CONN_TOKEN_EXPIRED",e[e.RC_CONN_DEVICE_ERROR=31021]="RC_CONN_DEVICE_ERROR",e[e.RC_CONN_HOSTNAME_ERROR=31022]="RC_CONN_HOSTNAME_ERROR",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.RC_LISCENSE_COUNT_OUT_OF_LIMIT=31024]="RC_LISCENSE_COUNT_OUT_OF_LIMIT",e[e.RC_CONN_WRONG_CLUSTER=31025]="RC_CONN_WRONG_CLUSTER",e[e.RC_APP_AUTH_NOT_PASS=31026]="RC_APP_AUTH_NOT_PASS",e[e.RC_OTP_USED=31027]="RC_OTP_USED",e[e.RC_PLATFORM_ERROR=31028]="RC_PLATFORM_ERROR",e[e.RC_ACCOUNT_CANCELLATION=31029]="RC_ACCOUNT_CANCELLATION",e[e.RC_LICENSE_EXPIRED=31030]="RC_LICENSE_EXPIRED",e[e.RC_QUERY_ACK_NO_DATA=32001]="RC_QUERY_ACK_NO_DATA",e[e.RC_MSG_DATA_INCOMPLETE=32002]="RC_MSG_DATA_INCOMPLETE",e[e.RC_UDP_DISCONNECTED=32011]="RC_UDP_DISCONNECTED",e[e.RC_TCP_RESET=32054]="RC_TCP_RESET",e[e.CONNECTION_REFUSED=32061]="CONNECTION_REFUSED",e[e.PROTOCOL_MESSAGE_SAVED_ERROR=33e3]="PROTOCOL_MESSAGE_SAVED_ERROR",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_DATABASE_ERROR=33002]="BIZ_ERROR_DATABASE_ERROR",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_NO_CHANNEL=33004]="BIZ_ERROR_NO_CHANNEL",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_ROAMING_SERVICE_UNAVAILABLE=33007]="MSG_ROAMING_SERVICE_UNAVAILABLE",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.TAG_NOT_EXIST=33100]="TAG_NOT_EXIST",e[e.TAG_EXISTS=33101]="TAG_EXISTS",e[e.NO_TAG_IN_CONVER=33102]="NO_TAG_IN_CONVER",e[e.RC_CONNECTION_EXIST=34001]="RC_CONNECTION_EXIST",e[e.PACKAGE_ENVIRONMENT_ERROR=34005]="PACKAGE_ENVIRONMENT_ERROR",e[e.CONNECTION_TIMEOUT=34006]="CONNECTION_TIMEOUT",e[e.MESSAGE_KV_NOT_SUPPORT=34008]="MESSAGE_KV_NOT_SUPPORT",e[e.MESSAGE_EXPANDED_ERROR=34009]="MESSAGE_EXPANDED_ERROR",e[e.EXPANSION_LIMIT_EXCEET=34010]="EXPANSION_LIMIT_EXCEET",e[e.UPLOAD_FAIL=34011]="UPLOAD_FAIL",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.READ_RECEIPT_ERROR=34014]="READ_RECEIPT_ERROR",e[e.PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE=34016]="PUSH_CONTENT_CONFIG_SERVICE_UNAVAILABLE",e[e.MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE=34017]="MESSAGE_INTERCEPTION_PRODUCED_NULL_MESSAGE",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.MESSAGE_NOT_REGISTERED=34021]="MESSAGE_NOT_REGISTERED",e[e.METHOD_NOT_SUPPORT=34022]="METHOD_NOT_SUPPORT",e[e.ULTRA_GROUP_CHANNEL_NOT_EXIST=34024]="ULTRA_GROUP_CHANNEL_NOT_EXIST",e[e.INCONSISTENT_CONVERSATION_TYPE=34025]="INCONSISTENT_CONVERSATION_TYPE",e[e.CONVERSATION_TYPE_NOT_SUPPORT=34201]="CONVERSATION_TYPE_NOT_SUPPORT",e[e.INVALID_PARAMETER_TIMESTAMP=34202]="INVALID_PARAMETER_TIMESTAMP",e[e.INVALID_PARAMETER_MESSAGE_UID=34203]="INVALID_PARAMETER_MESSAGE_UID",e[e.INVALID_PARAMETER_MESSAGE_ID=34204]="INVALID_PARAMETER_MESSAGE_ID",e[e.INVALID_PARAMETER_MESSAGE_CONTENT=34205]="INVALID_PARAMETER_MESSAGE_CONTENT",e[e.MSG_LIMIT_ERROR=34206]="MSG_LIMIT_ERROR",e[e.INVALID_PARAMETER_MEDIA_TYPE=34207]="INVALID_PARAMETER_MEDIA_TYPE",e[e.INVALID_PARAMETER_CONVERSATION_TYPE=34209]="INVALID_PARAMETER_CONVERSATION_TYPE",e[e.INVALID_PARAMETER_TARGET_ID=34210]="INVALID_PARAMETER_TARGET_ID",e[e.INVALID_PARAMETER_CHANNEL_ID=34211]="INVALID_PARAMETER_CHANNEL_ID",e[e.INVALID_PARAMETER_TAG_ID=34212]="INVALID_PARAMETER_TAG_ID",e[e.INVALID_PARAMETER_TAG_NAME=34213]="INVALID_PARAMETER_TAG_NAME",e[e.INVALID_PARAMETER_USER_ID=34214]="INVALID_PARAMETER_USER_ID",e[e.INVALID_PARAMETER_USERIDLIST=34215]="INVALID_PARAMETER_USERIDLIST",e[e.INVALID_PARAMETER_DOWNLOADMEDIAFILENAME=34217]="INVALID_PARAMETER_DOWNLOADMEDIAFILENAME",e[e.INVALID_PARAMETER_MESSAGE_EXPANSION=34220]="INVALID_PARAMETER_MESSAGE_EXPANSION",e[e.INVALID_PARAMETER_TIMESTRING=34224]="INVALID_PARAMETER_TIMESTRING",e[e.INVALID_PARAMETER_CONVERSATION=34225]="INVALID_PARAMETER_CONVERSATION",e[e.INVALID_PARAMETER_NOTIFICATION_LEVEL=34228]="INVALID_PARAMETER_NOTIFICATION_LEVEL",e[e.INVALID_PARAMETER_MESSAGE_ARRAY=34229]="INVALID_PARAMETER_MESSAGE_ARRAY",e[e.INVALID_PARAMETER_RECEIVED_STATUS=34230]="INVALID_PARAMETER_RECEIVED_STATUS",e[e.INVALID_PARAMETER_CHANNEL_TYPE=34231]="INVALID_PARAMETER_CHANNEL_TYPE",e[e.INVALID_PARAMETER_COUNT=34232]="INVALID_PARAMETER_COUNT",e[e.INVALID_PARAMETER_MEDIA_URL=34235]="INVALID_PARAMETER_MEDIA_URL",e[e.INVALID_PARAMETER_UNIQUE_ID=34236]="INVALID_PARAMETER_UNIQUE_ID",e[e.INVALID_PARAMETER_PROXY=34238]="INVALID_PARAMETER_PROXY",e[e.INVALID_PARAMETER_TESTHOST=34239]="INVALID_PARAMETER_TESTHOST",e[e.INVALID_CONNECT_TESTHOST_FAILED=34240]="INVALID_CONNECT_TESTHOST_FAILED",e[e.INVALID_PARAMETER_CONVERSATIONS=34242]="INVALID_PARAMETER_CONVERSATIONS",e[e.INVALID_PARAMETER_SENT_STATUS=34244]="INVALID_PARAMETER_SENT_STATUS",e[e.RC_CONN_PROXY_UNAVAILABLE=34245]="RC_CONN_PROXY_UNAVAILABLE",e[e.INVALID_PARAMETER_RTCROOMID=34259]="INVALID_PARAMETER_RTCROOMID",e[e.INVALID_PARAMETER_KEY=34260]="INVALID_PARAMETER_KEY",e[e.INVALID_PARAMETER_KEYS=34261]="INVALID_PARAMETER_KEYS",e[e.INVALID_PARAMETER_VALUE=34262]="INVALID_PARAMETER_VALUE",e[e.INVALID_PARAMETER_ENTRIES=34263]="INVALID_PARAMETER_ENTRIES",e[e.INVALID_PARAMETER_NOTIFICATION_EXTRA=34264]="INVALID_PARAMETER_NOTIFICATION_EXTRA",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME=34271]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME",e[e.INVALID_PARAMETER_BEFORE=34272]="INVALID_PARAMETER_BEFORE",e[e.INVALID_PARAMETER_AFTER=34273]="INVALID_PARAMETER_AFTER",e[e.INVALID_PARAMETER_KEYWORD=34274]="INVALID_PARAMETER_KEYWORD",e[e.INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST=34275]="INVALID_PARAMETER_MESSAGE_OBJECT_NAME_LIST",e[e.INVALID_PARAMETER_OFFSET=34276]="INVALID_PARAMETER_OFFSET",e[e.INVALID_PARAMETER_START_TIME=34277]="INVALID_PARAMETER_START_TIME",e[e.INVALID_PARAMETER_END_TIME=34278]="INVALID_PARAMETER_END_TIME",e[e.INVALID_PARAMETER_LIMIT=34279]="INVALID_PARAMETER_LIMIT",e[e.INVALID_MESSAGE_DIRECTION=34280]="INVALID_MESSAGE_DIRECTION",e[e.INVALID_MESSAGE_SENT_STATUS=34281]="INVALID_MESSAGE_SENT_STATUS",e[e.INVALID_PARAMETER_TARGETID_LIST=34282]="INVALID_PARAMETER_TARGETID_LIST",e[e.INVALID_PARAMETER_SPAN_MINUTES=34283]="INVALID_PARAMETER_SPAN_MINUTES",e[e.INVALID_PARAMETER_CONVERSATION_TYPE_LIST=34284]="INVALID_PARAMETER_CONVERSATION_TYPE_LIST",e[e.INVALID_PARAMETER_CONVERSATION_LIST=34287]="INVALID_PARAMETER_CONVERSATION_LIST",e[e.INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST=34288]="INVALID_PARAMETER_CLEAR_MESSAGE_OPTION_LIST",e[e.INVALID_PARAMETER_START_MESSAGE_UID=34289]="INVALID_PARAMETER_START_MESSAGE_UID",e[e.INVALID_PARAMETER_END_MESSAGE_UID=34290]="INVALID_PARAMETER_END_MESSAGE_UID",e[e.READ_RECEIPT_V4_NOT_SUPPORT=34291]="READ_RECEIPT_V4_NOT_SUPPORT",e[e.READ_RECEIPT_V4_UPDATE_NOT_SUPPORT=34292]="READ_RECEIPT_V4_UPDATE_NOT_SUPPORT",e[e.RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE=34296]="RC_DIRECTIONAL_MESSAGE_INVALID_CONVERSATION_TYPE",e[e.RC_DB_NOT_INIT=34301]="RC_DB_NOT_INIT",e[e.RC_DB_CORRUPT=34302]="RC_DB_CORRUPT",e[e.RC_DB_SQL_ERROR=34303]="RC_DB_SQL_ERROR",e[e.RC_DB_DATA_NOT_FOUND=34304]="RC_DB_DATA_NOT_FOUND",e[e.RC_NET_DATA_ERROR=34305]="RC_NET_DATA_ERROR",e[e.INVALID_PARAMETER_SUBSCRIBE_TYPE=34306]="INVALID_PARAMETER_SUBSCRIBE_TYPE",e[e.INVALID_PARAMETER_SUBSCRIBE_EXPIRY=34307]="INVALID_PARAMETER_SUBSCRIBE_EXPIRY",e[e.INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS=34308]="INVALID_PARAMETER_SUBSCRIBE_PUBLISHER_USERIDS",e[e.INVALID_PARAMETER_SUBSCRIBE_PAGESIZE=34309]="INVALID_PARAMETER_SUBSCRIBE_PAGESIZE",e[e.SUB_PROCESS_EXIT=34310]="SUB_PROCESS_EXIT",e[e.ADDON_NOT_EXIST=34311]="ADDON_NOT_EXIST",e[e.INVALID_PARAMETER_USER_PROFILE=34312]="INVALID_PARAMETER_USER_PROFILE",e[e.INVALID_PARAMETER_USER_PROFILE_VISIBILITY=34313]="INVALID_PARAMETER_USER_PROFILE_VISIBILITY",e[e.INVALID_PARAMETER_EXTRA=34314]="INVALID_PARAMETER_EXTRA",e[e.DB_UPGRADE_FAILED=34315]="DB_UPGRADE_FAILED",e[e.INVALID_PARAMETER_GROUP_INFO=34318]="INVALID_PARAMETER_GROUP_INFO",e[e.INVALID_PARAMETER_GROUP_ID=34319]="INVALID_PARAMETER_GROUP_ID",e[e.INVALID_PARAMETER_GROUP_NAME=34320]="INVALID_PARAMETER_GROUP_NAME",e[e.INVALID_PARAMETER_GROUP_IDS=34321]="INVALID_PARAMETER_GROUP_IDS",e[e.INVALID_PARAMETER_GROUP_MEMBER_ROLE=34322]="INVALID_PARAMETER_GROUP_MEMBER_ROLE",e[e.INVALID_PARAMETER_GROUP_APPLICATION_STATUS=34323]="INVALID_PARAMETER_GROUP_APPLICATION_STATUS",e[e.INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION=34324]="INVALID_PARAMETER_GROUP_APPLICATION_DIRECTION",e[e.INVALID_PARAMETER_NICK_NAME=34325]="INVALID_PARAMETER_NICK_NAME",e[e.INVALID_PARAMETER_REASON=34326]="INVALID_PARAMETER_REASON",e[e.INVALID_PARAMETER_REMARK=34327]="INVALID_PARAMETER_REMARK",e[e.INVALID_PARAMETER_PAGING_QUERY_OPTION=34328]="INVALID_PARAMETER_PAGING_QUERY_OPTION",e[e.NET_DATA_IS_SYNCHRONIZING=34329]="NET_DATA_IS_SYNCHRONIZING",e[e.INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE=34330]="INVALID_PARAMETER_QUERY_FRIENDS_DIRECTION_TYPE",e[e.INVALID_PARAMETER_DIRECTION_TYPE=34331]="INVALID_PARAMETER_DIRECTION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_TYPE=34332]="INVALID_PARAMETER_FRIEND_APPLICATION_TYPE",e[e.INVALID_PARAMETER_FRIEND_APPLICATION_STATUS=34333]="INVALID_PARAMETER_FRIEND_APPLICATION_STATUS",e[e.INVALID_PARAMETER_FRIEND_ADD_PERMISSION=34334]="INVALID_PARAMETER_FRIEND_ADD_PERMISSION",e[e.INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS=34335]="INVALID_PARAMETER_FRIEND_INFO_EXT_FIELDS",e[e.RC_REAL_TIME_CONVERSATION_UNAVAILABLE=34336]="RC_REAL_TIME_CONVERSATION_UNAVAILABLE",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.GROUP_MATCH_ERROR=35002]="GROUP_MATCH_ERROR",e[e.NOT_SUPPORT=35004]="NOT_SUPPORT",e[e.MAIN_PROCESS_ERROR=35005]="MAIN_PROCESS_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.SERVER_UNAVAILABLE=35008]="SERVER_UNAVAILABLE",e[e.HOSTNAME_ERROR=35009]="HOSTNAME_ERROR",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.DRAFT_SAVE_ERROR=35015]="DRAFT_SAVE_ERROR",e[e.DRAFT_REMOVE_ERROR=35016]="DRAFT_REMOVE_ERROR",e[e.CONVER_REMOVE_ERROR=35020]="CONVER_REMOVE_ERROR",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.SEARCH_PROPS_LIMIT_ERROR=35022]="SEARCH_PROPS_LIMIT_ERROR",e[e.INVALID_PARAMETER_MESSAGE_TYPE=35024]="INVALID_PARAMETER_MESSAGE_TYPE",e[e.INVALID_PARAMETER_ORDER=35025]="INVALID_PARAMETER_ORDER",e[e.INVALID_PARAMETER_DRAFT=35028]="INVALID_PARAMETER_DRAFT",e[e.INVALID_PARAMETER_MESSAGE=35029]="INVALID_PARAMETER_MESSAGE",e[e.INVALID_PARAMETER_PUSH_CONTENT=35030]="INVALID_PARAMETER_PUSH_CONTENT",e[e.INVALID_PARAMETER_SENDOPTIONS=35031]="INVALID_PARAMETER_SENDOPTIONS",e[e.INVALID_PARAMETER_CONTENT_DISPOSITION=35032]="INVALID_PARAMETER_CONTENT_DISPOSITION",e[e.INVALID_PARAMETER_SAVE_NAME=35033]="INVALID_PARAMETER_SAVE_NAME",e[e.INVALID_PARAMETER_SERVER_TYPE=35034]="INVALID_PARAMETER_SERVER_TYPE",e[e.INVALID_PARAMETER_CLEAN_SPACE=35035]="INVALID_PARAMETER_CLEAN_SPACE",e[e.INVALID_PARAMETER_CAN_INCLUDE_EXPANSION=35036]="INVALID_PARAMETER_CAN_INCLUDE_EXPANSION",e[e.INVALID_PARAMETER_DISABLE_NOTIFICATION=35037]="INVALID_PARAMETER_DISABLE_NOTIFICATION",e[e.INVALID_PARAMETER_CHECK_DUPLICATE=35038]="INVALID_PARAMETER_CHECK_DUPLICATE",e[e.INVALID_PARAMETER_IS_AUTO_DELETE=35039]="INVALID_PARAMETER_IS_AUTO_DELETE",e[e.INVALID_PARAMETER_IS_SEND_NOTIFICATION=35040]="INVALID_PARAMETER_IS_SEND_NOTIFICATION",e[e.INVALID_PARAMETER_IS_FORCE=35041]="INVALID_PARAMETER_IS_FORCE",e[e.INVALID_PARAMETER_IS_TOP=35042]="INVALID_PARAMETER_IS_TOP",e[e.INVALID_PARAMETER_IS_UPDATE_TIME=35043]="INVALID_PARAMETER_IS_UPDATE_TIME",e[e.INVALID_PARAMETER_CONTAIN_MUTED=35044]="INVALID_PARAMETER_CONTAIN_MUTED",e[e.INVALID_PARAMETER_IS_STATUS_MESSAGE=35045]="INVALID_PARAMETER_IS_STATUS_MESSAGE",e[e.INVALID_PARAMETER_IS_MENTIONED=35046]="INVALID_PARAMETER_IS_MENTIONED",e[e.INVALID_PARAMETER_IS_VOIP_PUSH=35047]="INVALID_PARAMETER_IS_VOIP_PUSH",e[e.INVALID_PARAMETER_MENTIONED_TYPE=35048]="INVALID_PARAMETER_MENTIONED_TYPE",e[e.INVALID_PARAMETER_PUSH_CONFIG=35049]="INVALID_PARAMETER_PUSH_CONFIG",e[e.INVALID_PARAMETER_PUSH_DATA=35050]="INVALID_PARAMETER_PUSH_DATA",e[e.DNS_PROXY_TIMEOUT=35051]="DNS_PROXY_TIMEOUT",e[e.DNS_PROXY_ERROR=35052]="DNS_PROXY_ERROR",e[e.DNS_PROXY_DATA_DESTRUCTUR_ERROR=35053]="DNS_PROXY_DATA_DESTRUCTUR_ERROR",e[e.INVALID_DISABLE_UPDATE_LAST_MESSAGE=35054]="INVALID_DISABLE_UPDATE_LAST_MESSAGE",e[e.CHATROOM_ID_ISNULL=36001]="CHATROOM_ID_ISNULL",e[e.CHARTOOM_JOIN_ERROR=36002]="CHARTOOM_JOIN_ERROR",e[e.CHATROOM_HISMESSAGE_ERROR=36003]="CHATROOM_HISMESSAGE_ERROR",e[e.CHATROOM_KV_NOT_FOUND=36004]="CHATROOM_KV_NOT_FOUND",e[e.BLACK_ADD_ERROR=37001]="BLACK_ADD_ERROR",e[e.BLACK_GETSTATUS_ERROR=37002]="BLACK_GETSTATUS_ERROR",e[e.BLACK_REMOVE_ERROR=37003]="BLACK_REMOVE_ERROR",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.QNTKN_GET_ERROR=41002]="QNTKN_GET_ERROR",e[e.TIMEOUT=-1]="TIMEOUT"}(W||(W={})),function(e){e[e.NONE=0]="NONE",e[e.PRIVATE=1]="PRIVATE",e[e.DISCUSSION=2]="DISCUSSION",e[e.GROUP=3]="GROUP",e[e.CHATROOM=4]="CHATROOM",e[e.CUSTOMER_SERVICE=5]="CUSTOMER_SERVICE",e[e.SYSTEM=6]="SYSTEM",e[e.APP_PUBLIC_SERVICE=7]="APP_PUBLIC_SERVICE",e[e.PUBLIC_SERVICE=8]="PUBLIC_SERVICE",e[e.ULTRA_GROUP=10]="ULTRA_GROUP",e[e.RTC_ROOM=12]="RTC_ROOM"}(K||(K={})),function(e){e[e.RMTP=1]="RMTP",e[e.TLS=2]="TLS",e[e.RPP=3]="RPP",e[e.QUIC=4]="QUIC",e[e.WS=5]="WS",e[e.WSS=6]="WSS",e[e.HTTP=11]="HTTP",e[e.HTTPS=12]="HTTPS"}(j||(j={})),function(e){e[e.IMAGE=1]="IMAGE",e[e.AUDIO=2]="AUDIO",e[e.VIDEO=3]="VIDEO",e[e.FILE=4]="FILE",e[e.SIGHT=5]="SIGHT",e[e.COMBINE_HTML=6]="COMBINE_HTML"}(X||(X={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Q||(Q={})),function(e){e.TextMessage="RC:TxtMsg",e.VOICE="RC:VcMsg",e.HQ_VOICE="RC:HQVCMsg",e.IMAGE="RC:ImgMsg",e.GIF="RC:GIFMsg",e.RICH_CONTENT="RC:ImgTextMsg",e.LOCATION="RC:LBSMsg",e.FILE="RC:FileMsg",e.SIGHT="RC:SightMsg",e.COMBINE="RC:CombineMsg",e.COMBINE_V2="RC:CombineV2Msg",e.CHRM_KV_NOTIFY="RC:chrmKVNotiMsg",e.LOG_COMMAND="RC:LogCmdMsg",e.EXPANSION_NOTIFY="RC:MsgExMsg",e.REFERENCE="RC:ReferenceMsg",e.RECALL="RC:RcCmd",e.RECALL_NOTIFICATION_MESSAGE="RC:RcNtf",e.READ_RECEIPT="RC:ReadNtf",e.READ_RECEIPT_REQUEST="RC:RRReqMsg",e.READ_RECEIPT_RESPONSE="RC:RRRspMsg",e.SYNC_READ_STATUS="RC:SRSMsg",e.GROUP_READ_RECEIPT_REQUEST="RC:RRMsg",e.READ_STATE="RC:RSMsg",e.DELIVERED="RC:Delivered",e.DELIVERED_MSG="RC:DRMsg",e.CHATROOM_MERGE_CHANGE="RC:ChrmMemChange",e.CHATROOM_SYNC_MSG="RC:ChrmSyncMsg",e.CHATROOM_MERGE_BLOCK="RC:ChrmBlockMsg",e.CHATROOM_MERGE_BAN="RC:ChrmBanMsg",e.TYPING_STATUS="RC:TypSts",e.INTERCEPT="RC:InterceptMsg",e.CLOUD_CONTROL="RC:CCConfigChangeRequestMsg"}(q||(q={})),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(Z||(Z={})),function(e){e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(z||(z={})),function(e){e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY",e[e.MSG_RECALL=3]="MSG_RECALL",e[e.CHANNEL_CHANGE=4]="CHANNEL_CHANGE",e[e.USER_GROUP_CHANGE=5]="USER_GROUP_CHANGE"}($||($={})),function(e){e[e.CHANNEL_DELETE=1]="CHANNEL_DELETE",e[e.PUBLIC_TO_PRIVATE=2]="PUBLIC_TO_PRIVATE",e[e.PRIVATE_TO_PUBLIC=3]="PRIVATE_TO_PUBLIC",e[e.PRIVATE_CHANNEL_USER_JOIN_PUBLIC=4]="PRIVATE_CHANNEL_USER_JOIN_PUBLIC",e[e.CHANNEL_USER_KICKED=5]="CHANNEL_USER_KICKED",e[e.PUBLIC_TO_PRIVATE_USER_NOT_IN=6]="PUBLIC_TO_PRIVATE_USER_NOT_IN"}(ee||(ee={})),function(e){e[e.REMOVE_USER_GROUP=1]="REMOVE_USER_GROUP",e[e.JOIN_USER_GROUP=2]="JOIN_USER_GROUP",e[e.EXIT_USER_GROUP=3]="EXIT_USER_GROUP",e[e.CHANNEL_BIND_USER_GROUP=4]="CHANNEL_BIND_USER_GROUP",e[e.CHANNEL_UNBIND_USER_GROUP=5]="CHANNEL_UNBIND_USER_GROUP"}(te||(te={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(ne||(ne={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(oe||(oe={})),function(e){e[e.typing=0]="typing"}(re||(re={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(ie||(ie={})),function(e){e[e.Other=0]="Other",e[e.iOS=1]="iOS",e[e.Android=2]="Android",e[e.Web=3]="Web",e[e.PC=4]="PC",e[e.Mini=5]="Mini",e[e.HarmonyOS=6]="HarmonyOS"}(se||(se={})),function(e){e[e.ONLINE_STATUS=1]="ONLINE_STATUS",e[e.USER_PROFILE=2]="USER_PROFILE",e[e.FRIEND_ONLINE_STATUS=3]="FRIEND_ONLINE_STATUS",e[e.FRIEND_USER_PROFILE=4]="FRIEND_USER_PROFILE"}(ae||(ae={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(_e||(_e={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(ce||(ce={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(ue||(ue={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(Ee||(Ee={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(Re||(Re={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(le||(le={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(de||(de={})),function(e){e.IM_NAVI="IM-stats_navi-S",e.IM_WEBSOCKET="IM-stats_websocket-S",e.IM_CONNECTION_DURATION="IM-stats_con_dur-S",e.IM_CMP="IM-stats_cmp-S",e.IM_CMP_RMTP="IM-stats_cmp_rmtp-S",e.IM_STATS_CS="IM-stats_cs-S",e.IM_NETWORK_CHANGE="IM-stats_network_change-S",e.L_CLOUD_INFO_FETCH_T="L-cloud_info_fetch-T",e.L_CLOUD_INFO_FETCH_R="L-cloud_info_fetch-R",e.IM_MSG_SEND="IM-msg_send-S",e.IM_MSG_RECEIVE="IM-msg_receive-S"}(pe||(pe={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Ce||(Ce={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(Ie||(Ie={})),function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(Te||(Te={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(Se||(Se={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(he||(he={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Ne||(Ne={})),function(e){e[e.CURRENT=2]="CURRENT"}(fe||(fe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(Oe||(Oe={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(Ae||(Ae={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(ge||(ge={})),function(e){e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT=0]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_DEFAULT",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE=1]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_MENTION_MESSAGE",e[e.PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED=5]="PUSH_NOTIFICATION_QUIET_HOURS_LEVEL_BLOCKED"}(Pe||(Pe={})),function(e){e.WIFI="wifi",e.FOUR_G="4g",e.THREE_G="3g",e.TWO_G="2g",e.FIVE_G="2g",e.THREE_GENT="3gnet",e.UNKONWN="unknown"}(ve||(ve={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Le||(Le={}));var Me=72e5,Ue={"RC:TxtMsg":{isCounted:!0,isPersited:!0},"RC:ImgMsg":{isCounted:!0,isPersited:!0},"RC:VcMsg":{isCounted:!0,isPersited:!0},"RC:ImgTextMsg":{isCounted:!0,isPersited:!0,searchProps:["content","title"]},"RC:FileMsg":{isCounted:!0,isPersited:!0,searchProps:["name"]},"RC:HQVCMsg":{isCounted:!0,isPersited:!0},"RC:LBSMsg":{isCounted:!0,isPersited:!0},"RC:PSImgTxtMsg":{isCounted:!0,isPersited:!0},"RC:PSMultiImgTxtMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpMsg":{isCounted:!0,isPersited:!0},"RCJrmf:RpOpendMsg":{isCounted:!0,isPersited:!0},"RC:CombineMsg":{isCounted:!0,isPersited:!0},"RC:CombineV2Msg":{isCounted:!0,isPersited:!0},"RC:ReferenceMsg":{isCounted:!0,isPersited:!0,searchProps:["content"]},"RC:SightMsg":{isCounted:!0,isPersited:!0},"RC:GIFMsg":{isCounted:!0,isPersited:!0},"RC:RLStart":{isCounted:!0,isPersited:!0},"RC:RLEnd":{isCounted:!0,isPersited:!0},"RC:InfoNtf":{isCounted:!1,isPersited:!0},"RC:ContactNtf":{isCounted:!1,isPersited:!0},"RC:ProfileNtf":{isCounted:!1,isPersited:!0},"RC:CmdNtf":{isCounted:!1,isPersited:!0},"RC:GrpNtf":{isCounted:!1,isPersited:!0},"RC:RcCmd":{isCounted:!1,isPersited:!0},"RC:RcNtf":{isCounted:!1,isPersited:!0},"RC:CmdMsg":{isCounted:!1,isPersited:!1},"RC:TypSts":{isCounted:!1,isPersited:!1},"RC:PSCmd":{isCounted:!1,isPersited:!1},"RC:SRSMsg":{isCounted:!1,isPersited:!1},"RC:RRReqMsg":{isCounted:!1,isPersited:!1},"RC:RRRspMsg":{isCounted:!1,isPersited:!1},"RC:CsChaR":{isCounted:!1,isPersited:!1},"RC:CSCha":{isCounted:!1,isPersited:!1},"RC:CsEva":{isCounted:!1,isPersited:!1},"RC:CsContact":{isCounted:!1,isPersited:!1},"RC:CsHs":{isCounted:!1,isPersited:!1},"RC:CsHsR":{isCounted:!1,isPersited:!1},"RC:CsSp":{isCounted:!1,isPersited:!1},"RC:CsEnd":{isCounted:!1,isPersited:!1},"RC:CsUpdate":{isCounted:!1,isPersited:!1},"RC:ReadNtf":{isCounted:!1,isPersited:!1},"RC:chrmKVNotiMsg":{isCounted:!1,isPersited:!1},"RC:VCAccept":{isCounted:!1,isPersited:!1},"RC:VCRinging":{isCounted:!1,isPersited:!1},"RC:VCSummary":{isCounted:!1,isPersited:!1},"RC:VCHangup":{isCounted:!1,isPersited:!1},"RC:VCInvite":{isCounted:!1,isPersited:!1},"RC:VCModifyMedia":{isCounted:!1,isPersited:!1},"RC:VCModifyMem":{isCounted:!1,isPersited:!1},"RC:MsgExMsg":{isCounted:!1,isPersited:!1},"RC:Delivered":{isCounted:!1,isPersited:!1},"RC:RRMsg":{isCounted:!1,isPersited:!1},"RC:LogCmdMsg":{isCounted:!1,isPersited:!1},"RC:InterceptMsg":{isCounted:!1,isPersited:!1},"RC:RLJoin":{isCounted:!1,isPersited:!1},"RC:RLQuit":{isCounted:!1,isPersited:!1},"RC:RL":{isCounted:!1,isPersited:!1},"RC:CCConfigChangeRequestMsg":{isCounted:!1,isPersited:!1}},De="5.14.0".replace(/-.+$/,""),Ge="rongcloudsystem",Ve="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};Ve.engine="5.14.0";var be=function(){function e(){}return e.add=function(e,t){Ve[e]=t},e.validEngine=function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var n=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return Ve.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=n},e.getInfo=function(){return Ve},e}();var Fe=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=Math.floor(36*Math.random());return("x"===e?t:3&t|8).toString(36)}))},we=function(e){void 0===e&&(e=22);var t,n=Date.now(),o=n.toString(36),r=Math.floor(Math.random()*n).toString(36),i=e-o.length-r.length;return[r,o,i>0?(t=i,Array.from({length:t}).map((function(){return Math.floor(36*Math.random()).toString(36)})).join("")):""].join("").slice(0,e)}(22),xe=Date.now(),Be=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},ke=function(e){return"[object Object]"===Object.prototype.toString.call(e)},He=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},Je=function(e){return function(e){return"string"==typeof e}(e)&&/https?:\/\//.test(e)},Ye=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},We=function(e,t){return We=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])},We(e,t)};function Ke(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var je=function(){return je=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},je.apply(this,arguments)};function Xe(e,t,n,o){return new(n||(n=Promise))((function(r,i){function s(e){try{_(o.next(e))}catch(e){i(e)}}function a(e){try{_(o.throw(e))}catch(e){i(e)}}function _(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}_((o=o.apply(e,t||[])).next())}))}function Qe(e,t){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function qe(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ze(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function ze(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var $e=function(e){return{isRead:(e&Te.READ)===Te.READ,isListened:(e&Te.LISTENED)===Te.LISTENED,isDownload:(e&Te.DOWNLOADED)===Te.DOWNLOADED,isRetrieved:(e&Te.RETRIEVED)===Te.RETRIEVED}},et=function(e){return[se.Android,se.iOS,se.Web,se.PC,se.Mini,se.HarmonyOS].map((function(t){var n=e.findIndex((function(e){return e.platform===t}));return-1===n?{platform:t,changeTime:0,eventValue:0}:e[n]}))},tt=function(e,t,n){return t?1===n?j.TLS:j.RMTP:"http"===e?j.WS:j.WSS},nt=function(e,t){var n=e.server,o=e.backupServer,r=e.bs,i=e.serverAddr,s=e.protocol,a=e.openTLS;if(i)return ze([],Ze(i.filter((function(e){return e.addr}))),!1);var _=[],c=[];return n&&c.push(n),(o||r||"").split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,o){e&&_.push({addr:e,protocol:tt(s,t,a),weight:n.length-o,race:!1})})),ze([],Ze(_),!1)},ot=function(e){return e.reduce((function(e,t){return e[t.key]=t.value,e}),{})},rt=function(e,t){var n=Math.floor(1e3*Math.random()%1e4),o=Fe(),r=function(e){e=e||"-";var t=new Date,n=t.getFullYear(),o=t.getMonth()+1,r=t.getDate();return"".concat(n).concat(e).concat(o).concat(e).concat(r)}(),i=(new Date).getTime(),s="";if(t){var a=t.split(".");s=".".concat(a[a.length-1])}return"".concat(e,"__RC-").concat(r,"_").concat(n,"_").concat(i).concat(o).concat(s)},it=function(e,t,n){void 0===e&&(e={}),void 0===t&&(t={}),void 0===n&&(n={});var o=t.channelIdMi,r=t.channelIdHW,i=t.channelIdOPPO,s=t.typeVivo,a=t.importanceHW,_=t.categoryHW,c=t.imageUrlHW,u=t.categoryVivo,E=t.importanceHonor,R=t.imageUrlHonor,l=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.threadId,o=e.apnsCollapseId,r=e.category,i=e.richMediaUri,s=e.interruptionLevel,a=t.googleConfig,_={};_["thread-id"]=n||"",_["apns-collapse-id"]=o||"",_.category=r||"",_.richMediaUri=i||"",_["interruption-level"]=s||"active";var c={};c.collapse_key=null==a?void 0:a.collapseKey,c.imageUrl=null==a?void 0:a.imageUrl;var u=null==a?void 0:a.priority;return u&&!["high","normal"].includes(u)&&(u="normal"),c.priority=u,{APNS:_,FCM:c}}(e,t),d=[{HW:{channelId:r||"",importance:a||"NORMAL",image:c||"",category:_||""}},{MI:{channelId:o||""}},{OPPO:{channelId:i||""}},{VIVO:{classification:s||"",category:u||""}},{APNS:l.APNS},{FCM:l.FCM},{HONOR:{importance:E||de.NORMAL,image:R||""}},{OHOS:{category:n.category||null,image:n.image||""}}];return JSON.stringify(d)},st=function(){var e=be.getInfo(),t="electron";for(var n in e)"engine"!==n&&(t=["imlib-v2-adapter","imlib-v4-adapter","imlib-next"].includes(n)?n:"electron");return t};function at(e,t){var n;if(!e)return"";var o="undefined"!=typeof window&&"https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol);return/^https?:\/\//.test(e)?o?e.replace(/^https?:\/\//i,"https://"):e:t!==j.HTTP||o?"https://".concat(e):"http://".concat(e)}var _t=function(e,t){if(!e)return"";var n=e.ossConfig,o=void 0===n?"":n,r="";try{var i=JSON.parse(o);if(i.length>0){var s=i.find((function(e){return e.minio}));s&&(r=s.minio)}}catch(e){t.warn(C.L_PARSE_JSON_E,JSON.stringify({ossConfig:o,error:e}))}return r};!function(e){function t(t){var n=e.call(this,t)||this;return n.name="CMSYError",n}Ke(t,e),t.InvalidParameters=function(e){return(null==e?void 0:e.length)?new t("Invalid parameter -> ".concat(e)):new t("Invalid parameters.")},t.ParameterTypeError=function(){return new t("Wrong parameter type")}}(Error);var ct=function(){function e(){this._map=new Map,this._piped=new Set}return e.prototype._addItem=function(e,t,n,o,r){void 0===r&&(r=0);var i=Symbol(),s=this._map.get(e)||this._map.set(e,[]).get(e),a={symbol:i,priority:Math.min(r,100),listener:t.bind(o),once:n},_=s.findIndex((function(e){return e.priority>r}));return-1===_?s.push(a):s.splice(_,0,a),i},e.prototype.on=function(e,t,n,o){return void 0===o&&(o=0),this._addItem(e,t,!1,n,o)},e.prototype.once=function(e,t,n,o){return void 0===o&&(o=0),this._addItem(e,t,!0,n,o)},e.prototype.off=function(e){var t,n;try{for(var o=qe(this._map),r=o.next();!r.done;r=o.next()){var i=Ze(r.value,2),s=(i[0],i[1]),a=s.findIndex((function(t){return t.symbol===e}));if(-1!==a)return void s.splice(a,1)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this._map.get(e);if(o&&o.length>0)for(var r=o.length-1;r>=0;r-=1){var i=o[r],s=i.once,a=i.listener;s&&o.splice(r,1);try{a.apply(void 0,ze([],Ze(t),!1))}catch(e){null===console||void 0===console||console.error(e)}}ze([],Ze(this._piped.values()),!1).forEach((function(n){return n.emit.apply(n,ze([e],Ze(t),!1))}))},e.prototype.removeAll=function(e){this._map.delete(e)},e.prototype.clear=function(){this._piped.clear(),this._map.clear()},e.prototype.pipe=function(e){this._piped.add(e)},e}();!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._versionQueue=[],t._isPulling=null,t._dataVersion=0,t._invervalTimer=-1,t._intervalGap=0,t}Ke(t,e),t.prototype.setInitVersion=function(e,t){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(n){switch(n.label){case 0:return 0!==this._dataVersion?[2]:(this._dataVersion=e,t?[4,this._execPulling()]:[3,2]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.push=function(e){e<this._dataVersion||(this._versionQueue.push(e),0!==this._dataVersion&&this._execPulling())},t.prototype._execPulling=function(){return Xe(this,void 0,void 0,(function(){var e,t,n,o,r;return Qe(this,(function(i){switch(i.label){case 0:return this._isPulling?[4,this._isPulling]:[3,2];case 1:return i.sent(),[2];case 2:return this._isPulling=this._sendRequest(this._dataVersion),[4,this._isPulling];case 3:if(e=i.sent(),t=e.code,n=e.version,o=e.hasNext,this._isPulling=null,0!==t)return[2];if(void 0===n||n<this._dataVersion)throw new Error("version error, please check: lastVersion: ".concat(this._dataVersion,", newVersion: ").concat(n));return r=this._versionQueue.filter((function(e){return e>n})),this._versionQueue=ze([],Ze(r),!1),this._dataVersion=n,this._resetIntervalTimer(),o?(this._execPulling(),[2]):(this._versionQueue.length>0&&(this._versionQueue.length=0,this._execPulling()),[2])}}))}))},t.prototype.startInterval=function(e){var t=this;-1===this._invervalTimer&&(this._intervalGap=e,this._invervalTimer=setInterval((function(){return t._execPulling()}),e))},t.prototype._resetIntervalTimer=function(){var e=this;-1!==this._invervalTimer&&(clearInterval(this._invervalTimer),this._invervalTimer=setInterval((function(){return e._execPulling()}),this._intervalGap))},t.prototype.stopInterval=function(){-1!==this._invervalTimer&&clearInterval(this._invervalTimer)},t.prototype.reset=function(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=0}}(ct);var ut,Et,Rt,lt=function(){function e(e,t,n){this.code=e,this.msg=t,this.data=n,this.isOk=0===e}return e.prototype.next=function(e){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(t){return this.isOk?[2,e(this.data)]:[2,this.wipe()]}))}))},e.prototype.trans=function(e){return this.isOk?dt(e(this.data)):this.wipe()},e.prototype.tryTrans=function(e){return this.isOk?e(this.data):this.wipe()},e.prototype.wipe=function(){return this.isOk?dt(void 0,this.msg):Ct(this.code,this.msg)},e.ok=function(t,n){return new e(0,n||"success",t)},e.unknown=function(e,t,n){return 0===e?dt(t,n):Ct(e,n)},e.fail=function(t,n,o){return new e(t,n||"fail: ".concat(t),o)},e}(),dt=lt.ok,pt=lt.unknown,Ct=lt.fail,It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Tt(e){var t,n,o,r,i,s,a="",_=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");_<e.length;)t=It.indexOf(e.charAt(_++))<<2|(r=It.indexOf(e.charAt(_++)))>>4,n=(15&r)<<4|(i=It.indexOf(e.charAt(_++)))>>2,o=(3&i)<<6|(s=It.indexOf(e.charAt(_++))),a+=String.fromCharCode(t),64!==i&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(o));return a}!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(ut||(ut={})),function(e){e[e.BJ=1]="BJ",e[e.SG=2]="SG",e[e.NA=3]="NA",e[e.SG_A=4]="SG_A",e[e.SG_B=4]="SG_B",e[e.SA=5]="SA"}(Rt||(Rt={}));var St=((Et={})[Rt.BJ]={naviUrlBase64:["bmF2LnJvbmctZWRnZS5jb20=","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5yb25nLWVkZ2UuY29t",protocol:j.HTTPS,weight:-1}],miniCmpBase64:["d3Mucm9uZy1lZGdlLmNvbQ==","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnJvbmctZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="]},Et[Rt.SG]={naviUrlBase64:["bmF2LnNnLWxpZ2h0LWVkZ2UuY29t","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1saWdodC1lZGdlLmNvbQ==",protocol:j.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="]},Et[Rt.NA]={naviUrlBase64:["bmF2LnVzLWxpZ2h0LWVkZ2UuY29t","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi51cy1saWdodC1lZGdlLmNvbQ==",protocol:j.HTTPS,weight:-1}],miniCmpBase64:["d3MudXMtbGlnaHQtZWRnZS5jb20=","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnVzLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="]},Et[Rt.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:j.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2ctYi1saWdodC1lZGdlLmNvbQ==","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNnLWItbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="]},Et[Rt.SA]={naviUrlBase64:["bmF2LnNhdS1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zYXUtbGlnaHQtZWRnZS5jb20=",protocol:j.HTTPS,weight:-1}],miniCmpBase64:["d3Muc2F1LWxpZ2h0LWVkZ2UuY29t","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["Y2xvdWRjb250cm9sLnNhdS1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"]},Et);function ht(e){return Rt[e]?e:Rt.BJ}var Nt,ft=function(){function e(){this.initOption={}}return e.prototype.init=function(e){this.initOption=e},e.prototype.getNaviUrlList=function(e,t){var n,o=this.initOption||{},r=o.areaCode,i=o.navigators,s=(n=r,void 0===n&&(n=Rt.BJ),St[ht(n)].naviUrlBase64).map((function(e){return Tt(e)})),a=[],_=Ze(e.split("@"),2)[1];t&&(a=_?_.split(";"):[]);var c=i&&i.length>0?ze(ze([],Ze(a),!1),Ze(i),!1):ze(ze([],Ze(a),!1),Ze(s),!1);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return at(e)}))},e.prototype.getLogUrlPolicyList=function(e,t){var n,o=e||{},r=o.log,i=o.logPolicy,s=this.initOption||{},a=s.areaCode,_=s.logServerUrl,c=(n=a,void 0===n&&(n=Rt.BJ),St[ht(n)].logUrlBase64).map((function(e){return je(je({},e),{addr:Tt(e.addr)})})),u=[],E={level:1,itv:6,times:5};if(r)u.push.apply(u,ze([],Ze(r.addrs),!1)),Object.assign(E,r.policy);else if(i)try{var R=JSON.parse(i);u.push({addr:R.url,protocol:j.HTTPS,weight:1}),E.level=R.level,E.itv=R.itv,E.times=R.times}catch(n){t.warn(C.L_REPORT_LOG_POLICY_E,JSON.stringify({policy:e.logPolicy}))}var l=_?ze([{addr:_,protocol:j.HTTPS,weight:101}],Ze(u),!1):ze(ze([],Ze(u),!1),Ze(c),!1);return{policy:E,addrs:l.filter((function(e,t){return l.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return je(je({},e),{addr:at(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}},e.prototype.getMiniCmpUrlList=function(){var e,t,n=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Rt.BJ),St[ht(t)].miniCmpBase64).map((function(e){return Tt(e)})),o=(this.initOption||{}).miniCMPProxy;return o&&o.length>0?o:n},e.prototype.getStaticConfigUrl=function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Rt.BJ),St[ht(t)].staticConfigUrlBase64).map((function(e){return Tt(e)}))},e.prototype.getCloudControllerUrl=function(e){var t,n,o=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(n=o,void 0===n&&(n=Rt.BJ),St[ht(n)].cloudControllerUrlBase64).map((function(e){return Tt(e)}))},e.prototype.getAreaCode=function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:Rt.BJ},e.prototype.setAreaCode=function(e){return!(!e||!Rt[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)},e}(),Ot=new ft,At=function(){function e(e,t){this.appkey=e,this.logger=t,this.staticUrls=[]}return e.prototype.getStaticConfig=function(){var e;return Xe(this,void 0,void 0,(function(){var t,n,o,r,i,s,a,_;return Qe(this,(function(c){switch(c.label){case 0:if(!(t=this.getCache()))return[3,6];c.label=1;case 1:return c.trys.push([1,4,,5]),n=JSON.parse(t),Date.now()-(null==n?void 0:n.time)<18e5?[4,this.decryptData(n.val)]:[3,3];case 2:return o=c.sent(),(r=o.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:r.map((function(e){return at(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return i=c.sent(),this.logger.error(C.L_GET_STATIC_CONF_E,JSON.stringify({error:null==i?void 0:i.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(s=c.sent())?[4,this.decryptData(s)]:[2];case 8:return(null==(a=c.sent())?void 0:a.areaCode)!==Ot.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:s})),this.staticUrls=(null==a?void 0:a.bootstrap)||[],(_=null===(e=null==a?void 0:a.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:_.map((function(e){return at(e.addr,e.protocol)}))||[]}])}}))}))},e.prototype._requestHandle=function(){return Xe(this,void 0,void 0,(function(){var e,t,n,o,r,i,s,a,_,c,u;return Qe(this,(function(E){switch(E.label){case 0:e=(e=ze(ze([],Ze(this.staticUrls),!1),Ze(Ot.getStaticConfigUrl()),!1).map((function(e){return at(e)}))).filter((function(t,n){return e.indexOf(t)===n})),E.label=1;case 1:E.trys.push([1,6,7,8]),t=qe(e),n=t.next(),E.label=2;case 2:return n.done?[3,5]:(o=n.value,this.logger.info(C.L_GET_STATIC_CONF_T,JSON.stringify({url:o})),r=Date.now(),[4,this.sendRequest("".concat(o,"/").concat(this.appkey))]);case 3:if(i=E.sent(),s=i.code,a=i.data,200===s)return this.logger.info(C.L_GET_STATIC_CONF_R,JSON.stringify({url:o,code:s,duration:Date.now()-r})),[2,a];this.logger.warn(C.L_GET_STATIC_CONF_R,JSON.stringify({url:o,code:s,duration:Date.now()-r})),E.label=4;case 4:return n=t.next(),[3,2];case 5:return[3,8];case 6:return _=E.sent(),c={error:_},[3,8];case 7:try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(c)throw c.error}return[7];case 8:return[2]}}))}))},e}();!function(e){e[e.STATISTICS=-2]="STATISTICS",e[e.RECORD=-1]="RECORD",e[e.FATAL=0]="FATAL",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG"}(Nt||(Nt={}));var gt,Pt=function(){function e(e,t,n){this._appkey=e,this._id=t,this._type=n,this.outputLevel=Nt.WARN,this.debug=this._log.bind(this,Nt.DEBUG),this.info=this._log.bind(this,Nt.INFO),this.warn=this._log.bind(this,Nt.WARN),this.error=this._log.bind(this,Nt.ERROR),this.__statistics=this._log.bind(this,Nt.STATISTICS),this.record=this.__statistics}return e.prototype._writer=function(e,t,n,o){var r=new Date;/^[\w-]+$/.test(t)?e!==Nt.DEBUG&&this.flush({time:+r,sessionId:we,type:this._type,loggerId:this._id,tag:t,level:e,content:n,traceId:o}):console.error("".concat((new Date).toISOString(),"[").concat(this._id,"]['ERROR']: ").concat(t," | ").concat(n," | ").concat(o))},e.prototype.createTraceId=function(){return"".concat(++e._traceIdCount)},e.prototype.getSessionId=function(){return we},e.prototype._stdout=function(e,t,n,o,r){var i;if(!(e<=Nt.FATAL)&&console&&!(e>this.outputLevel)){var s=["error","warn","info","debug"][e-1];null===(i=console)||void 0===i||i[s]("".concat(n,"[").concat(this._id,"][").concat(s.toUpperCase(),"]: ").concat(t," | ").concat(o," | ").concat(r))}},e.prototype.setOutputLevel=function(e){(function(e){return[Nt.DEBUG,Nt.INFO,Nt.WARN,Nt.ERROR].some((function(t){return t===e}))})(e)&&(this.outputLevel=e)},e.prototype._log=function(e,t,n,o){this._stdout(e,t,(new Date).toISOString(),n,o),this._writer(e,t,n,o)},e._traceIdCount=0,e}(),vt=function(){function e(e,t,n,o,r,i){void 0===i&&(i=!1),this.appkey=e,this.deviceId=t,this.deviceInfo=n,this.logDB=o,this.logger=r,this.disableLogReport=i,this.userId="",this.timer=null,this.started=!1,this.reportFailedNumber=0,this.itvByNavi=6,this.timesByNavi=5}return e.prototype.checkStart=function(e,t){return Xe(this,void 0,void 0,(function(){var n,o,r;return Qe(this,(function(i){return this.started?[2]:(this.userId=e.userId,!e.logSwitch||this.disableLogReport||(n=Ot.getLogUrlPolicyList(e,this.logger),o=n.policy,r=n.addrs,this.started=!0,this.itvByNavi=o.itv,this.timesByNavi=o.times,r.length>0&&this.realtimeReport(r[0].addr,o.level,o.itv,t)),[2])}))}))},e.prototype._sendLogs2Realtime=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a,_,c,u,E,R,l,d;return Qe(this,(function(p){switch(p.label){case 0:return this.logger.debug(C.L_REALTIME_LOG_O,JSON.stringify({count:e.length}),t),r=o,[4,this.compressLogs(e)];case 1:return a=p.sent(),_=a.success,c=a.data,_||this.logger.warn(C.L_REALTIME_LOG_O,"compress failed",t),this.logger.debug(C.L_REALTIME_LOG_O,"compress done",t),u=Je(n)?n:"https://".concat(n),u+="?version=".concat("5.14.0","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:u,body:c,method:"POST"})];case 2:if(E=p.sent(),R=E.status,l=E.data,this.logger.debug(C.L_REALTIME_LOG_R,JSON.stringify({status:R,data:l}),t),200===R){if(this.reportFailedNumber=0,l)try{(d=JSON.parse(l)).nextTime&&(r=d.nextTime),i=d.level,s=d.logSwitch}catch(e){this.logger.warn(C.L_PARSE_JSON_E,JSON.stringify({error:null==e?void 0:e.stack}),t)}this.logDB.setTimestamp4RealtimeLog(e[e.length-1].time+1)}else this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(r+=r),this.reportFailedNumber++;return[2,{itv:r,level:i,logSwitch:s}]}}))}))},e.prototype.realtimeReport=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a,_,c,u,E,R,l,d,p=this;return Qe(this,(function(I){switch(I.label){case 0:return r=Date.now(),i=this.logDB.getTimestamp4RealtimeLog()||xe,s=Math.max(r-5e3,i),a=this.logger.createTraceId(),this.logger.debug(C.L_REALTIME_LOG_T,JSON.stringify({startTime:i,endTime:s,level:t,itv:n}),a),[4,this.logDB.getLogs(i,s,t,!0,o)];case 1:return _=I.sent(),c=_.dbReady,u=_.logs,c?[3,2]:(this.logger.warn(C.L_REALTIME_LOG_R,"db error",a),[3,4]);case 2:return u.length>0?[4,this._sendLogs2Realtime(u,a,e,n)]:[3,4];case 3:if(E=I.sent(),R=E.itv,l=E.level,d=E.logSwitch,n=R,void 0!==l&&(t=l),0===d)return[2];I.label=4;case 4:return this.started&&(this.timer&&clearTimeout(this.timer),n>=60&&this.itvByNavi<60&&(n=60),this.timer=setTimeout((function(){return p.realtimeReport(e,t,n,o)}),1e3*n)),[2]}}))}))},e.prototype.report=function(e,t,n,o,r,i,s){return void 0===s&&(s=!1),Xe(this,void 0,void 0,(function(){var a,_,c,u,E,R,l,d,p,I;return Qe(this,(function(T){switch(T.label){case 0:return"web"!==n.toLowerCase()||this.disableLogReport?[2]:(a=this.logger.createTraceId(),this.logger.info(C.L_REPORT_FULL_LOG_T,JSON.stringify({startTime:e,endTime:t,logId:r,messageUId:i,isCloudControl:s}),a),[4,this.logDB.getLogs(e,t,Nt.DEBUG,!1)]);case 1:return _=T.sent(),c=_.dbReady,u=_.logs,this.logger.info(C.L_REPORT_FULL_LOG_O,JSON.stringify({count:u.length}),a),E=Je(o)?o:"https://".concat(o),E+="?version=".concat("5.14.0","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(r),c?u.length>0?[4,this.compressLogs(u)]:[3,3]:[3,5];case 2:return l=T.sent(),d=l.success,p=l.data,R=d?p:"compress failed",[3,4];case 3:R="no data",T.label=4;case 4:return[3,6];case 5:R="no database",T.label=6;case 6:return this.logger.debug(C.L_REPORT_FULL_LOG_O,"compress done",a),s&&(E+="&source=cloud"),[4,this.send({url:E,body:R,method:"POST"})];case 7:return I=T.sent().status,this.logger.info(C.L_REPORT_FULL_LOG_R,JSON.stringify({status:I}),a),[2]}}))}))},e.prototype.stop=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1},e}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(gt||(gt={}));var Lt=function(){function e(e){this.reporter=e,this.logId="",this.uploadTask=[],this.taskLock=!0}return e.prototype.uploadLogCmdTask=function(e){this.uploadTask.push(e),this.enqueueTask()},e.prototype.reportLogCmdTask=function(e){var t,n,o,r,i=this;this.taskLock=!1;var s=null!==(t=e.startTime)&&void 0!==t?t:0,a=null!==(n=e.endTime)&&void 0!==n?n:0,_=null!==(o=e.platform)&&void 0!==o?o:"",c=null!==(r=e.uri)&&void 0!==r?r:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(s,a,_,c,e.logId,"",!0).finally((function(){i.taskLock=!0,i.uploadTask.length>0&&i.enqueueTask()})))},e.prototype.enqueueTask=function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}},e}();var mt,yt,Mt=function(){function e(e,t,n){this.logger=e,this.appkey=t,this.reporter=n,this.isEable=!0,this.expire=0,this.interval=0,this.timestamp=0,this.lastRequestTime=0,this.changeAreaCode=0,this._cache=null,this.uploadTaskManage=new Lt(n)}return e.prototype.init=function(){try{var e=this.getLocalCloudControllerCache();this._cache=e?JSON.parse(e):{timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}catch(e){this._cache={timestamp:0,lastRequestTime:0,cc:{temporary:!1,enable:!0,expire:72e5,interval:6e5},uploadLog:{temporary:!0,tasks:[]},mrtr:{chatroom:0,group:0,private:0,ultraGroup:0,temporary:!1}}}this._cache&&(this.interval=this._cache.cc.interval,this.expire=this._cache.cc.expire,this.timestamp=this._cache.timestamp||0,this.isEable=this._cache.cc.enable,this.lastRequestTime=this._cache.lastRequestTime,this.logCmdMsgTasks(this._cache),this.setMRTRConfig(this._handleMrtrData(this._cache.mrtr)))},e.prototype.isExire=function(){return(new Date).getTime()-this.timestamp<this.expire},e.prototype.isOverclock=function(){return(new Date).getTime()-this.lastRequestTime<this.interval},e.prototype.logCmdMsgTasks=function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===q.LOG_COMMAND&&t.uploadTaskManage.uploadLogCmdTask(e)}))},e.prototype.dataHandle=function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,Ye(e)&&(t.timestamp=e.timestamp,e.uploadLog&&!e.uploadLog.temporary&&(t.uploadLog=e.uploadLog),e.cc&&!e.cc.temporary&&(t.cc=e.cc),e.mrtr&&!e.mrtr.temporary&&(t.mrtr=this._handleMrtrData(e.mrtr)),e.mrtr&&this.setMRTRConfig(this._handleMrtrData(e.mrtr))),this.setCloudControllerCache(t),this.expire=t.cc.expire,this.interval=t.cc.interval,this.timestamp=t.timestamp,this.logCmdMsgTasks(e)},e.prototype.request=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o,r,i,s,a,_,c,u,E,R;return Qe(this,(function(l){switch(l.label){case 0:return!this.isEable&&t===gt.init&&this.isExire()?(this.logger.info(C.L_CLOUD_DISABLED,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===gt.newWorkChange&&this.isOverclock()?(this.logger.info(C.L_CLOUD_OVERCLOCK,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(o=at(e),this.lastRequestTime=(new Date).getTime(),r="".concat(o,"/v1/config"),i={"Content-Type":"application/json","RC-App-Key":this.appkey},n&&(i["RC-Token"]=n),s={platform:"web",version:"5.14.0",timestamp:this.timestamp},this.logger.record(pe.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!n,uri:r})),[4,this.httpRequest(r,Le.POST,i,s)]);case 1:return a=l.sent(),_=a.code,c=a.data,this.logger.record(pe.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),_===W.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(u=c.targetRegion,this.changeAreaCode===u?[2,this.timestamp]:(E=Ot.setAreaCode(u),this.logger.info(C.L_CLOUD_SET_AREA_CODE_O,JSON.stringify({isChangeSuccess:E,originAreaCode:Ot.getAreaCode(),newAreaCode:u})),this.changeAreaCode=u,(R=Ot.getCloudControllerUrl(u))[0]?[2,this.request(R[0],gt.other)]:(this.logger.info(C.L_CLOUD_APPKEY_REGION_E,JSON.stringify({appkey:this.appkey,uri:r,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))},e.prototype._handleMrtrData=function(e){return{chatroom:(null==e?void 0:e.chatroom)||0,group:(null==e?void 0:e.group)||0,private:(null==e?void 0:e.private)||0,ultraGroup:(null==e?void 0:e.ultraGroup)||0,temporary:!!(null==e?void 0:e.temporary)}},e}(),Ut=function(e){return e===W.RC_CONN_REDIRECTED},Dt=function(){function e(e,t,n,o){this.appkey=e,this.navi=t,this.logger=n,this.listener=o,this.token="",this.curCmpUrl="",this.reconnectKick=!1,this._connectDurSwitch=!1,this.retryCount=0,this.uuid="",this.reason=0,this.connectedTime=0,this._network={status:!0,type:ve.UNKONWN},this._checkAliveTimer=null,this._crtConnectionStatus=ue.DISCONNECTED,this._crtUserId="",this._openCallPlus=!1,this._crtConnectionTask=null,this.reconnectTimer=null,this._failedCount=0,this.ALLOW_FAILED_TIMES=2}return e.prototype.getToken=function(){return this.token},e.prototype.getCurrentUserId=function(){return this._crtUserId},e.prototype.setConnectionStatus=function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus=e,this._connectDurSwitch&&e!==ue.CONNECTED&&e!==ue.CONNECTING){var n={bid:st(),cod:t,net:this.getNetwork().type,dur:Date.now()-this.connectedTime,cid:"".concat(this.uuid,"_").concat(this.retryCount)};this.logger.record(pe.IM_CONNECTION_DURATION,JSON.stringify(n)),this._connectDurSwitch=!1}switch(e){case ue.CONNECTED:this.logger.info(C.L_CONNECT_S,e),this.checkAlive(),this.listener.onConnected();break;case ue.CONNECTING:this.logger.warn(C.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.listener.onConnecting();break;case ue.SUSPENDED:this.logger.warn(C.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),Ut(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onSuspend(t);break;default:this.logger.warn(C.L_CONNECT_S,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),this.listener.onDisconnected(t)}}},e.prototype.getConnectionStatus=function(){return this._crtConnectionStatus},e.prototype.setNetwork=function(e,t){if(!t){var n={cid:"".concat(this.uuid,"_").concat(this.retryCount),cn:e.type,on:this._network.type};this.logger.record(pe.IM_NETWORK_CHANGE,JSON.stringify(n))}this._network=e},e.prototype.getNetwork=function(){return this._network},e.prototype.connect=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a;return Qe(this,(function(_){switch(_.label){case 0:return this._crtConnectionStatus===ue.CONNECTED?[2,dt(this._crtUserId)]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=n,this.retryCount=0,this.uuid=Fe(),this.token=e,this.reconnectKick=t,this.setConnectionStatus(ue.CONNECTING),r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:Ae.CONNECT,net:this.getNetwork().type,spr:0},this.logger.record(pe.IM_STATS_CS,JSON.stringify(r),o),[4,this.try2Connect(e,t,!1,o,!0)]);case 1:return i=_.sent(),s=i.code,a=i.data,s!==W.SUCCESS?(this.setConnectionStatus(ue.DISCONNECTED,s),[2,Ct(s)]):(this.setConnectionStatus(ue.CONNECTED),[2,dt(a)])}}))}))},e.prototype.try2Connect=function(e,t,n,o,r){return Xe(this,void 0,void 0,(function(){var i;return Qe(this,(function(s){switch(s.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,n,o,r),[4,this._crtConnectionTask]);case 1:return i=s.sent(),this._crtConnectionTask=null,[2,i]}}))}))},e.prototype.createConnectionTask=function(e,t,n,o,r){return Xe(this,void 0,void 0,(function(){var i,s,a,_,c,u,E,R,l;return Qe(this,(function(d){switch(d.label){case 0:return i={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this.reason},[4,this.navi.request(e,n,!1,o,i)];case 1:return s=d.sent(),a=s.code,_=s.data,a!==W.SUCCESS?[2,Ct(a)]:1===(c=_).type?[2,Ct(W.PACKAGE_ENVIRONMENT_ERROR)]:(this.logger.info(C.L_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:t}),o),[4,this.connectWithToken(e.replace(/@.+$/,"@"),c,t,o)]);case 2:return u=d.sent(),E=u.code,R=u.data,Ut(E)?(this.logger.warn(C.L_CONNECT_R,"redirect code: ".concat(E),o),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,o,r)]):[W.RC_TCP_RESET,W.RC_CONN_ACK_TIMEOUT,W.RC_TCP_DISCONNECTED_NO_RMTP].includes(E)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),l=this.cmpWeightCache.every((function(e){return e.failed})),r&&l?(this.logger.warn(C.L_CONNECT_R,"cpp code:".concat(E,",reture code:").concat(W.SERVER_UNAVAILABLE),o),[2,Ct(W.SERVER_UNAVAILABLE)]):(this.logger.warn(C.L_CONNECT_R,"cmp ack timeout, code: ".concat(E),o),this.setConnectionStatus(ue.SUSPENDED,E),this.setConnectionStatus(ue.CONNECTING),[2,this.createConnectionTask(e,t,!1,o,r)])):E!==W.SUCCESS?(this.logger.warn(C.L_CONNECT_R,"code: ".concat(E),o),[2,Ct(E)]):(this.logger.info(C.L_CONNECT_R,"userId: ".concat(R),o),this._connectDurSwitch=!0,this._crtUserId=R,[2,dt(R)])}}))}))},e.prototype.setReconnectReason=function(e){switch(e){case W.TIMEOUT:return void(this.reason=Ae.TIMEOUT);case W.RC_CONN_REDIRECTED:return void(this.reason=Ae.REDIRECTED);default:this.reason=Ae.RECONNECT}},e.prototype.try2Reconnect=function(e,t){return Xe(this,void 0,void 0,(function(){var n,o,r=this;return Qe(this,(function(i){return n=this.logger.createTraceId(),this.logger.debug(C.T,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),n),this.stopReconnectTimer(),o=function(){return Xe(r,void 0,void 0,(function(){var r,i;return Qe(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus!==ue.SUSPENDED?[2]:(this.setConnectionStatus(ue.CONNECTING,t),this.setReconnectReason(t),this.retryCount+=1,r={cid:"".concat(this.uuid,"_").concat(this.retryCount),reason:this.reason,net:this.getNetwork().type,spr:0},this.logger.record(pe.IM_STATS_CS,JSON.stringify(r)),[4,this.try2Connect(this.token,!0,e,n,!1)]);case 1:return i=s.sent().code,this.reconnectTimer=null,i===W.SUCCESS?(this.setConnectionStatus(ue.CONNECTED),[2]):[W.SERVER_UNAVAILABLE,W.TIMEOUT,W.RC_SOCKET_DISCONNECTED,W.RC_SOCKET_NOT_CREATED,W.RC_CONN_ACK_TIMEOUT,W.RC_TCP_RESET,W.RC_NAVI_REQ_FAILED,W.RC_NETWORK_DOWN,W.RC_TCP_DISCONNECTED_NO_RMTP].includes(i)?(this._crtConnectionStatus!==ue.CONNECTING||(this.setConnectionStatus(ue.SUSPENDED,i),this.reconnectTimer=setTimeout(o,5e3)),[2]):(this.setConnectionStatus(ue.DISCONNECTED,i),[2])}}))}))},o(),[2]}))}))},e.prototype.onDisconnectByServer=function(e,t){var n=this;return Ut(e)?(this.setConnectionStatus(ue.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===W.RC_UDP_DISCONNECTED?(this.setConnectionStatus(ue.SUSPENDED,e),void setTimeout((function(){n.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(ue.DISCONNECTED,e)},e.prototype.onDisconenctUnusual=function(e){this.setConnectionStatus(ue.SUSPENDED,e),this.try2Reconnect(!1,e)},e.prototype.checkAlive=function(){return Xe(this,void 0,void 0,(function(){var e,t,n=this;return Qe(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==ue.CONNECTED?(this._failedCount=0,this.logger.debug(C.L_CHECK_ALIVE_IM_S,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.info(C.L_CHECK_ALIVE_IM_T,null,e),[4,this.sendPing(15e3)]);case 1:return(t=o.sent())===W.SUCCESS?(this.logger.info(C.L_CHECK_ALIVE_IM_R,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return n.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==ue.CONNECTED?[2]:(this._failedCount+=1,this.logger.info(C.L_CHECK_ALIVE_IM_R,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(C.L_CHECK_ALIVE_IM_S,"ping timeout, close connection to reconnect!"),this.close(!0,!1),this.setConnectionStatus(ue.SUSPENDED,W.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,W.RC_PING_EXCEED_LIMIT),[2]))}}))}))},e.prototype.disconnect=function(e){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(t){switch(t.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.setConnectionStatus(ue.DISCONNECTED,W.ACTIVE_DISCONNECT),this.close(!1,e),[2]}}))}))},e.prototype.stopReconnectTimer=function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)},e.prototype.getCmpList=function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return ze([],Ze(this.cmpWeightCache),!1);var n=nt(e,t);return this.cmpWeightCache=ze([],Ze(n),!1),ze([],Ze(n),!1)},e.prototype.updateCmpWeight=function(e,t,n){if(this.cmpWeightCache){var o=this.cmpWeightCache.find((function(t){return n?t.addr===e&&t.protocol===j.QUIC:t.addr===e}));if(o)if(t){var r=Math.max.apply(Math,ze([],Ze(this.cmpWeightCache.map((function(e){return e.weight}))),!1));o.weight!==r&&(o.weight=r+1)}else{var i=Math.min.apply(Math,ze([],Ze(this.cmpWeightCache.map((function(e){return e.weight}))),!1));o.weight!==i&&(o.weight=i-1),o.failed=!0}}},e.prototype.clearCmpWeightCache=function(){this.cmpWeightCache=void 0},e.prototype.reconnect=function(e,t,n,o){this.token=e,this.reconnectKick=t,this._openCallPlus=n,this.onDisconenctUnusual(o)},e}(),Gt=function(e){return e.replace(/@.+$/,"@")},Vt=function(){function e(e,t,n,o,r){void 0===o&&(o=!0),void 0===r&&(r=!0),this.appkey=e,this.logger=t,this.staticConfigManager=n,this.isRequestProfile=o,this.isUseDynamicNaviUrl=r,this.crtRequest=null,this._environment="default"}return e.prototype.getCatchKey=function(e){return e+(this._environment?"-".concat(this._environment):"")},e.prototype.request=function(e,t,n,o,r){return Xe(this,void 0,void 0,(function(){var i;return Qe(this,(function(s){switch(s.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,n,o,r),[4,this.crtRequest]);case 1:return i=s.sent(),this.crtRequest=null,[2,i]}}))}))},e.prototype.sendRequest=function(e,t,n,o,r){var i;return Xe(this,void 0,void 0,(function(){var s,a,_,c,u,E,R,l,d,p,I,T,S,h;return Qe(this,(function(N){switch(N.label){case 0:return s=Gt(e),a=this.getNaviCache(s),!t&&a&&(_=a.timestamp,c=a.naviInfo,n||Date.now()-_<Me)?(this.logger.info(C.L_REQUEST_T,JSON.stringify({fromCache:!0,naviInfo:c}),o),u={bid:st(),ptc:he.NAVI,cod:W.SUCCESS,net:null==r?void 0:r.type,dur:0,spr:0,pr:null!==(i=c.type)&&void 0!==i?i:0,hos:"",cache:Ne.LOCAL,v:fe.CURRENT,rsn:null==r?void 0:r.reason,cid:"".concat(null==r?void 0:r.uuid,"_").concat(null==r?void 0:r.retryCount),count:null==r?void 0:r.retryCount},this.logger.record(pe.IM_NAVI,JSON.stringify(u),o),[2,dt(c)]):(E=Ot.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(C.L_GET_NAVI_T,JSON.stringify({token:e,uris:E}),o),[4,this.requestHandler(E,e,o,r)]);case 1:return R=N.sent(),l=R.code,d=R.data,l===W.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(p=N.sent())?void 0:p.navi)&&(null==p?void 0:p.navi.length)>0?(I=p.navi,[4,this.requestHandler(I,e,o,r)]):[3,4];case 3:T=N.sent(),l=T.code,d=T.data,N.label=4;case 4:return l!==W.SUCCESS?(this.logger.warn(C.L_GET_NAVI_R,l,o),[2,Ct(l)]):(S=d).code&&200!==S.code?(this.logger.warn(C.L_GET_NAVI_R,S.code,o),[2,Ct(this.transHttpCode(S.code))]):nt(S).length>0?(this.logger.info(C.L_GET_NAVI_R,JSON.stringify({naviInfo:S}),o),this.setNaviCache(s,S),[2,pt(l,S)]):(h={server:S.server,backupServer:S.backupServer,serverAddr:S.serverAddr,bs:S.bs},this.logger.warn(C.L_GET_NAVI_R,"navi server address invalid: ".concat(JSON.stringify(h)),o),[2,Ct(W.SERVER_UNAVAILABLE)])}}))}))},e.prototype.requestHandler=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a,_,c,u,E,R;return Qe(this,(function(l){switch(l.label){case 0:r=0,i=e.length,l.label=1;case 1:return r<i?(s=r===e.length-1,a=this.useV2Navi()?this.httpRequestV2:this.httpRequest,_=Date.now(),[4,a.call(this,e[r],this.appkey,t,n,s)]):[3,4];case 2:if(c=l.sent(),u=c.code,E=c.data,R={bid:st(),ptc:he.NAVI,cod:u,net:null==o?void 0:o.type,dur:Date.now()-_,spr:0,pr:(null==E?void 0:E.type)||0,hos:e[r],cache:Ne.REQUEST,v:fe.CURRENT,rsn:null==o?void 0:o.reason,cid:"".concat(null==o?void 0:o.uuid,"_").concat(null==o?void 0:o.retryCount),count:null==o?void 0:o.retryCount},this.logger.record(pe.IM_NAVI,JSON.stringify(R),n),[W.SUCCESS,W.RC_CONN_TOKEN_INCORRECT,W.RC_LICENSE_EXPIRED].includes(u))return[2,pt(u,E)];l.label=3;case 3:return r+=1,[3,1];case 4:return[2,Ct(W.RC_NAVI_REQ_FAILED)]}}))}))},e.prototype.transHttpCode=function(e){switch(e){case 401:case 403:return W.RC_CONN_TOKEN_INCORRECT;case 416:return W.RC_LICENSE_EXPIRED;default:return W.RC_NAVI_REQ_FAILED}},e.prototype.getNaviInfoFromCache=function(e){var t=this.getNaviCache(Gt(e));return t?t.naviInfo:null},e.prototype.updateVoipCallInfo=function(e,t){var n=this.getNaviInfoFromCache(e);n&&this.setNaviCache(Gt(e),je(je({},n),{voipCallInfo:t}))},e.prototype.getNaviV2RequestOption=function(e){var t,n=e.uri,o=e.token,r=e.platform,i=e.protocol,s=e.mac;t="".concat(n,"/v2/navi.json?cloud=").concat(0);var a="token=".concat(encodeURIComponent(o),"&version=").concat("5.14.0","&platfrom=").concat(r);return s&&(a+="&m=".concat(s)),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(i,";rtc=4;log=2")},body:a,url:t,timeout:1e4}},e.prototype.useV2Navi=function(){return!0},e}();!function(e){e.P_INIT_O="P-init-O",e.P_DB_OPEN_O="P-db_open-O",e.P_DB_UPGRATE_START_S="P-db_upgrate_start-S",e.P_DB_UPGRATING_S="P-db_upgrating-S",e.P_DB_UPGRATE_COMPLETE_S="P-db_upgrate_complete-S",e.P_CALL_MAIN_SYNC_E="P-call_main_sync-E",e.P_CALL_MAIN_E="P-call_main-E",e.P_SEND_2_MAIN_E="P-send_2_main-E",e.P_REGTYP_O="P-regtype-O",e.P_CALL_ADDON_E="P-call_addon-E",e.P_CALL_ADDON_T="P-call_addon-T",e.P_CALL_ADDON_O="P-call_addon-O",e.P_CALL_ADDON_R="P-call_addon-R",e.P_CALL_EXTRA_E="P-call_extra-E",e.P_CONNECT_S="P-connect-S",e.P_CONNECT_T="P-connect-T",e.P_CONNECT_O="P-connect-O",e.P_CONNECT_ENTRY_S="P-connect_entry-S",e.P_REPORT_VER_O="P-report_version-O",e.P_PARSE_JSON_MSGS_E="P-parse_json_messsages-E",e.P_PARSE_JSON_MSGS_R="P-parse_json_messsages-R",e.P_RECEIVE_MESSAGE_E="P-receive_message-E",e.P_HTTP_REQ_E="P-http_request-E",e.P_SET_MSG_EXTEN_O="P-set_msg_extension-O",e.P_SEND_MSG_T="P-send_msg-T",e.P_SEND_MSG_R="P-send_msg-R",e.P_PARSE_JSON_SUBSCRIBE_DATA_E="P-parse_json_subscribe_data-E",e.P_PARSE_JSON_USER_PROFILE_E="P-parse_json_user_profile-E",e.P_PARSE_JSON_USER_PROFILE_LIST_E="P-parse_json_user_profile_list-E",e.P_WRITE_LOG_T="P_WRITE_LOG_T",e.P_WRITE_LOG_R="P_WRITE_LOG_R",e.P_PARSE_JSON_E="P-parse_json-E"}(mt||(mt={})),function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.EVENT=1]="EVENT",e[e.CALLBACK=2]="CALLBACK"}(yt||(yt={}));var bt,Ft=n.resolve(__dirname,"binding","electron-".concat(o.platform(),"-").concat(o.arch(),".node")),wt={addon:null},xt=(bt=process,{sendError:function(e){bt.send({type:yt.ERROR,data:{msg:e}})},sendEvent:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];bt.send({type:yt.EVENT,data:{eventName:e,data:t}})},sendResponse:function(e){bt.send({type:yt.RESPONSE,data:e})},sendCallback:function(e){bt.send({type:yt.CALLBACK,data:e})}}).sendError;try{wt.addon=require(Ft)}catch(e){console.error("error ->",Ft,"\n",e),xt(e.toString())}wt.addon||console.error("error -> cannot find module: ",Ft);var Bt,kt=wt.addon,Ht={flushTimestamp:Date.now(),queue:[],locked:!1};function Jt(){Bt&&clearInterval(Bt)}function Yt(e){Jt(),Bt=setInterval((function(){return jt(e)}),1e4)}function Wt(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=Ht.queue).push.apply(e,ze([],Ze(t),!1))}var Kt=200;function jt(e){var t=Ht.queue,n=Ht.flushTimestamp;if(!(Ht.locked||0===t.length||Date.now()-n<3e4&&t.length<Kt)){Ht.locked=!0;var o=e.createTraceId(),r=e.getSessionId(),i=t.splice(0,Kt).map((function(e){var t=e.sessionId,n=e.level,o=e.time,i=e.type,s=e.tag,a=e.loggerId,_=e.content,c=e.traceId;return{level:n,time:o,type:i,tag:s,sessionId:"".concat(r,":").concat(t),content:{loggerId:a,content:_,traceId:c}}}));e.debug(mt.P_WRITE_LOG_T,"writingLen: ".concat(i.length,", queueLen: ").concat(t.length),o);var s=JSON.stringify(i);kt.writeLog(s),e.debug(mt.P_WRITE_LOG_R,"write done, queueLen: ".concat(t.length),o),Ht.flushTimestamp=Date.now(),Ht.locked=!1,setTimeout((function(){return jt(e)}))}}var Xt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ke(t,e),t.prototype.flush=function(e){Wt(e)},t}(Pt),Qt=function(e,t){var n,o=Buffer.from(e),r=o.length;for(t.push(r),n=0;n<r;n++)t.push(o[n])},qt=function(e){return"string"==typeof e},Zt=function(e){return qt(e)?e.toUpperCase():""},zt=function(e,t){var n="";return 2!==e.length?n="Unexpected number of bytes received.":5!==e[0]?n="Unexpected SOCKS version number: ".concat(e[0],"."):255===e[1]?n="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(n="Unexpected SOCKS authentication method: ".concat(e[1],".")),n},$t=function(e){var t="";return 2!==e.length?t="Unexpected number of bytes received.":1!==e[0]?t="Unexpected authentication method code: ".concat(e[0],"."):0!==e[1]&&(t="Username and password authentication failure: ".concat(e[1],".")),t},en=function(e){var t=Zt(e.method)||"GET",n=e.pathname||"/",o=e.headers||{},r=e.search||"";o.Host=e.host||"loclahost";var i="";for(var s in i="".concat(t," ").concat(n+r," HTTP/1.1\n"),o)if(Object.hasOwnProperty.call(o,s)){var a=o[s];i+="".concat(s,": ").concat(a,"\n")}return e.body&&(i+="Content-Length: ".concat(e.body.length,"\n")),i+="\n","POST"===t&&e.body&&(i+="".concat(e.body)),i},tn=function(e){return new Promise((function(t){var n,o;e.socket.once("data",(function(o){var r,i=zt(o,n);if(!i)return 2===o[1]?(e.socket.once("data",(function(n){var o=$t(n);o?e.emit("error",new Error("SOCKS authentication failed. ".concat(o))):t()})),r=[1],Qt(e.socksUsername,r),Qt(e.socksPassword,r),void e.write(Buffer.from(r))):void t();e.emit("error",new Error("SOCKS authentication failed. ".concat(i)))})),n=[0],e.socksUsername&&n.push(2),(o=Buffer.alloc(2+n.length))[0]=5,o[1]=n.length,n.forEach((function(e,t){o[2+t]=e})),e.write(o)}))},nn=function(e,t,n){return new Promise((function(o){var r,i;switch(e.socket.once("data",(function(t){var n;5!==t[0]?n="Unexpected SOCKS version number: ".concat(t[0],"."):0!==t[1]?n="".concat(function(e){switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return"Unknown status code ".concat(e)}}(t[1]),"."):0!==t[2]&&(n="The reserved byte must be 0x00."),n?e.emit("error",new Error("SOCKS connection failed. ".concat(n))):o()})),(r=[]).push(5),r.push(1),r.push(0),_.isIP(t)){case 0:r.push(3),Qt(t,r);break;case 4:r.push(1),function(e,t){var n,o,r=e.split(".");for(n=0;n<4;n++)o=parseInt(r[n],10),t.push(o)}(t,r);break;case 6:e.emit("error",new Error("Does not support IPV6"))}r.length+=2,(i=Buffer.from(r)).writeUInt16BE(n,i.length-2),e.write(i)}))},on=function(e){function t(t){var n=e.call(this)||this;return n.readable=!0,n.socket=new _.Socket,n.options=t,n.socksHost=t.socksHost||"localhost",n.socksPort=t.socksPort||1080,n.socksUsername=t.socksUsername||"",n.socksPassword=t.socksPassword||"",n.socket.on("error",(function(e){n.emit("error",e)})),n.on("error",(function(){n.socket.destroyed||n.socket.destroy()})),n.on("end",n.end),n}return Ke(t,e),t.prototype.ref=function(){return this.socket.ref()},t.prototype.unref=function(){return this.socket.unref()},t.prototype.setTimeout=function(e,t){return this.socket.setTimeout(e,t)},t.prototype.setNoDelay=function(e){return this.socket.setNoDelay(e)},t.prototype.setKeepAlive=function(e,t){return this.socket.setKeepAlive(e,t)},t.prototype.address=function(){return this.socket.address()},t.prototype.cork=function(){return this.socket.cork()},t.prototype.uncork=function(){return this.socket.uncork()},t.prototype.pause=function(){return this.socket.pause()},t.prototype.resume=function(){return this.socket.resume()},t.prototype.pipe=function(e){return this.socket.pipe(e)},t.prototype.end=function(e,t){var n=this.socket.end(e,t);return this.writable=this.socket.writable,n},t.prototype.destroy=function(e){return this.socket.destroy(e)},t.prototype.setEncoding=function(e){return this.socket.setEncoding(e)},t.prototype.write=function(e,t,n){return this.socket.write(e,t,n)},t.prototype.read=function(e){return this.socket.read(e)},t.prototype.connect=function(e,t){var n=this;if("string"==typeof e&&/^\d+$/.test(e)&&(e=parseInt(e,10)),!Number.isInteger(e)||e<1||e>65535)throw new TypeError("Invalid port: ".concat(e));if(!t||"string"!=typeof t)throw new TypeError("Invalid host: ".concat(t));return this.socket.connect({port:this.socksPort,host:this.socksHost},(function(){return Xe(n,void 0,void 0,(function(){var n;return Qe(this,(function(o){switch(o.label){case 0:return[4,tn(this)];case 1:return o.sent(),[4,nn(this,t,e)];case 2:return o.sent(),this.onProxied(),n=en(this.options),this.socket.write(Buffer.from(n)),[2]}}))}))})),this},t.prototype.onProxied=function(){var e=this;this.socket.on("close",(function(t){e.emit("close",t)})),this.socket.on("end",(function(){e.emit("end")})),this.socket.on("data",(function(t){e.emit("data",t)})),this.writable=!0,this.readable=!0,this.emit("connect")},t}(c.EventEmitter),rn=function(e){var t,n=e.hostname,o=e.port;return!e.host||n&&o||(t=e.host.split(":")),!o&&t&&(o=parseInt(t[1],10)||0),!n&&t&&(n=Ze(t,1)[0]),new on(e).connect(o,n)},sn=function(e){function t(t){var n=e.call(this)||this;return n.createConnection=rn,n}return Ke(t,e),t}(r.Agent),an=function(e,t,n){return(t=je(je({},t),a.parse(e))).port||(t.port=80),t.agent=new sn(t),r.request(t,n)},_n=function(e){var t,n;return t=rn(e),n=t.onProxied,t.onProxied=function(){var o;e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&(o=Ze(e.host.split(":"),1),e.servername=o[0]),t.socket=u.connect(e,(function(){t.authorized=t.socket.authorized,n.call(t)})),t.socket.on("error",(function(e){t.emit("error",e)}))},t},cn=function(e){function t(t,n){var o=e.call(this,n)||this;return o.url=t,o.socksHost=n.socksHost||"localhost",o.socksPort=n.socksPort||1080,o.createConnection=_n,o}return Ke(t,e),t}(i.Agent),un=function(e,t,n,o){var r,s;return t.protocol="https:",!t.port&&t.host&&(r=Ze(t.host.split(":"),2),t.port=r[0],t.port=r[1]),t.port||(t.port=443),s=new cn(e,t),t.agent=s,i.request(e,t,n)},En=null;function Rn(e,t,n){void 0===n&&(n=!1);var o=t.url,s=t.headers,a=t.body,_=t.method,c=t.query,u=t.timeout,E=void 0===u?6e4:u;return new Promise((function(t){var u=/^https/.test(o),R={headers:je(je({},s),{"Accept-Encoding":"gzip, br"}),method:_};u&&(R.rejectUnauthorized=n);var l=null;En?((R=je(je({},R),En)).body=a,l=u?un:an):(l=r.request,u&&(R.agent=new i.Agent(R),l=i.request));var d=l(function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var n=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return n.length?[e,n.join("&")].join("?"):e}(o,c),R,(function(e){var n,o,r=e.statusCode,i="";if("gzip"===(null===(n=e.headers)||void 0===n?void 0:n["content-encoding"])){var s=ye.default.createGunzip();e.pipe(s),s.on("data",(function(e){i+=e})),s.on("end",(function(){t({status:r,data:i})}))}else if("br"===(null===(o=e.headers)||void 0===o?void 0:o["content-encoding"])){var a=ye.default.createBrotliDecompress();e.pipe(a),a.on("data",(function(e){i+=e})),a.on("end",(function(){t({status:r,data:i})}))}else e.setEncoding("utf8"),e.on("data",(function(e){i+=e})),e.once("end",(function(){t({status:r||0,data:i})}))}));d.once("timeout",(function(){e.warn(mt.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:o,method:_,query:c,timeout:E})),t({status:0})})),d.setTimeout(E),d.once("error",(function(n){e.warn(mt.P_HTTP_REQ_E,JSON.stringify({msg:n.stack,url:o,method:_,query:c,timeout:E})),t({status:0})})),d.write(a),d.end()}))}function ln(e,t){return e?(En=je(je({},En),e),t.info(C.A_SET_PROXY_O,JSON.stringify({msg:"set proxy",data:En})),{code:W.SUCCESS}):(En=null,t.info(C.A_REMOVE_PROXY_O,JSON.stringify({msg:"remove proxy"})),{code:W.SUCCESS})}function dn(){var e=En||void 0;return{code:W.SUCCESS,data:e}}var pn=function(){function e(e,t,n,o){var r=this;this.p=e,this.emit=t,this.callback=n,this.errorHandle=o,this.count=0,this.maps={},this.p.on("message",(function(e){var i=e.type,s=e.data;switch(i){case yt.EVENT:var a=s,_=a.eventName,c=a.data;null==t||t.apply(void 0,ze([_],Ze(c),!1));break;case yt.RESPONSE:var u=s,E=u.reqId,R=u.success,l=u.data,d=r.maps[E];if(!d)return;d({success:R,data:l}),delete r.maps[E];break;case yt.CALLBACK:null==n||n(s);break;case yt.ERROR:var p=s.msg;null==o||o(p)}})),this.p.on("error",(function(e){null==o||o("SubProcessProxy error ".concat(e))})),this.p.on("exit",(function(e,t){if(0!==e){for(var n in r.maps){if(Object.prototype.hasOwnProperty.call(r.maps,n))(0,r.maps[n])({success:!0,data:{code:W.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==o||o("SubProcessProxy exit ".concat(e," ").concat(t),!0)}})),this.p.on("close",(function(e,t){console.log("SubProcessProxy close",e,t)}))}return e.prototype.call=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return this.p.killed||this.p.exitCode?[2,Promise.resolve({success:!1,data:{code:W.SUB_PROCESS_EXIT,msg:"sub process exit"}})]:[2,new Promise((function(o){var r=++n.count;n.maps[r]=o;var i={reqId:r,method:e,args:t,hasResponse:!0};n.p.send(i)}))]}))}))},e.prototype.send=function(e){for(var t,n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return Xe(this,void 0,void 0,(function(){var o;return Qe(this,(function(r){return(this.p.killed||this.p.exitCode)&&(null===(t=this.errorHandle)||void 0===t||t.call(this,"sub process exit")),o={reqId:-1,method:e,args:n},this.p.send(o),[2]}))}))},e.prototype.destroy=function(){this.send("destroy")},e}(),Cn="rc-realtime-log-timestamp",In=[],Tn=!1,Sn=function(){return Xe(void 0,void 0,void 0,(function(){var e,t,n,o,r,i,s,a,_,c,u,E;return Qe(this,(function(R){return Tn||0===In.length||(Tn=!0,e=In.shift(),t=e.args,n=e.resolve,o=t.startTime,r=t.endTime,i=t.level,s=t.realtimeReport,a=0,_=0,c=[],u=function(e){a+=e.length;var t=Ze(e.split(",")),o=t[0],r=t[1],u=t[2],E=t[3],R=t[4],l=t.slice(5);if(a>20971520&&parseInt(r,10)!==_)n(c);else{_=parseInt(r,10);try{if(!s&&i<0)return;var d={time:parseInt(r,10),level:parseInt(E,10),sessionId:o,type:u,tag:R,content:l.join(",")};c.push(d)}catch(e){console.error(e)}}},E=function(e){n(c),Tn=!1,Sn()},kt.getFullLog(i,o,r,!1,u,E)),[2]}))}))},hn=function(e){function o(t,n,o,r){void 0===r&&(r=!1);var i,s=process.versions.electron,a="Electron|".concat(s,"|").concat(process.arch,"|").concat(process.platform);return i=e.call(this,t,n,a,{getLogs:function(e,t,n,o){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(r){switch(r.label){case 0:return[4,(i={startTime:e,endTime:t,level:n,realtimeReport:o},Xe(void 0,void 0,void 0,(function(){return Qe(this,(function(e){return[2,new Promise((function(e){In.push({resolve:e,args:i}),Sn()}))]}))})))];case 1:return[2,{logs:r.sent(),dbReady:!0}]}var i}))}))},getTimestamp4RealtimeLog:function(){var e=kt.getStoreValue(Cn);return parseInt(e,10)||0},setTimestamp4RealtimeLog:function(e){kt.setStoreValue(Cn,e.toString())}},o,r)||this,i}return Ke(o,e),o.prototype.send=function(e){return Rn(this.logger,e)},o.prototype.stop=function(){this._subProcess&&this._subProcess.destroy(),e.prototype.stop.call(this)},o.prototype.compressLogs=function(e){return Xe(this,void 0,void 0,(function(){var o,r,i,s;return Qe(this,(function(a){switch(a.label){case 0:return this._subProcess||(o=t.fork(n.resolve(__dirname,"sub-process.js")),this._subProcess=new pn(o)),[4,this._subProcess.call("compressLogs",e)];case 1:return r=a.sent(),i=r.success,s=r.data,i?[2,{success:i,data:s.data}]:[2,{success:i,data:""}]}}))}))},o}(vt),Nn=[j.RMTP,j.TLS];"darwin"===process.platform&&Nn.push(j.QUIC);var fn=function(e){return"RongCloud/navis/".concat(e,"/navi-cache.json")},On="deviceId",An=function(e){return"RongCloud/caches/".concat(e,"/staticConfig.json")},gn=function(e){return"RongCloud/cloudControl/".concat(e,"/cloudControl.json")},Pn=null,vn=function(){var e,t=Date.now(),n=[o.arch(),o.platform(),process.pid,t,Math.floor(Math.random()*t)].join("__");return e=n,R.createHash("md5").update(e).digest("hex")},Ln=function(e){if(Pn)return Pn;var t=n.resolve(e,On);return E.existsSync(t)?Pn=E.readFileSync(t).toString():(Pn=vn(),E.writeFileSync(t,Pn),Pn)},mn=function(){function e(e){this._callCppProxy=e,this._setTime=15962112e5}return e.prototype._setToProtocol=function(e,t,n,o,r,i){var s=JSON.stringify(r);"{}"!==s&&e.info(mt.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:o,ext:r})),this._callCppProxy("setMessageExtension",t,n,o,s,i)},e.prototype.setLocalFromReceiveMsg=function(e,t){var n=t.channelId,o=t.conversationType,r=t.targetId,i=t.messageUId,s=t.expansion,a=t.sentTime;if(s&&0!==Object.keys(s).length){var _={};for(var c in s)_[c]={v:"",ts:0},_[c].v=s[c],_[c].ts=a;this._setToProtocol(e,o,r,i,_,n||"")}},e.prototype.setLocalFromExtMsg=function(e,t){var n=t.channelId,o=t.conversationType,r=t.targetId,i=t.content,s=t.sentTime,a=i,_=a.put,c=this._callCppProxy("getMessage",a.mid),u=JSON.parse(c).extMsg,E=JSON.parse(u||"{}");if(_)for(var R in _){var l=E[R];l&&l.ts<s-this._setTime?(l.v=_[R],l.ts=s-this._setTime):(E[R]={v:"",ts:0},E[R].v=_[R],E[R].ts=s-this._setTime)}a.del&&a.del.forEach((function(e){delete E[e]})),this._setToProtocol(e,o,r,a.mid,E,n||"")},e.prototype.parseReceiveExpansion=function(e){var t=JSON.parse(e.extMsg||"{}"),n={};for(var o in t)n[o]=t[o].v;return n},e.prototype.parseConverOrHisExpansion=function(e){var t=JSON.parse(e.extMsg),n=JSON.parse(t||"{}"),o={};for(var r in n)o[r]=n[r].v;return o},e}();function yn(e){var t,n;void 0===e&&(e="IPv4");var r=o.networkInterfaces(),i=[];try{for(var s=qe(Object.values(r)),a=s.next();!a.done;a=s.next()){var _=a.value;if(_&&-1!==Object.prototype.toString.call(_).indexOf("Array")){var c=_.filter((function(t){return!(t.internal||(n=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(n))||t.family&&t.family!==e);var n})).map((function(e){return e.mac}));i.push.apply(i,ze([],Ze(c),!1))}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i.length?ze([],Ze(i),!1).sort()[0]:""}var Mn,Un=function(e,t,n){return Xe(void 0,void 0,void 0,(function(){var o,r;return Qe(this,(function(i){return o=R.createDecipheriv("aes-256-cbc",t,n),r=o.update(e,"base64","utf-8"),[2,r+=o.final("utf8")]}))}))},Dn=function(e){if(!E.existsSync(e)){var t=n.resolve(e,"..");E.existsSync(t)||Dn(t),E.mkdirSync(e)}},Gn=function(e){return Object.entries(e).map((function(e){var t=Ze(e,2),n=t[0],o=t[1];return{key:n,value:String(o)}}))},Vn=function(e){return{removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}},bn=function(e){function t(t,o,r,i){var s=e.call(this,t,o,i)||this;s.naviPath="",s._caches={},s.naviPath="".concat(r,"/").concat(fn(t));var a=n.dirname(s.naviPath);return E.existsSync(a)||Dn(a),s}return Ke(t,e),t.prototype.httpRequest=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a,_;return Qe(this,(function(c){switch(c.label){case 0:return r="token=".concat(encodeURIComponent(n),"&v=").concat(De,"&p=PC&ev=").concat("5.14.0","&m=").concat(yn()),i="".concat(e,"/navi.json?r=").concat(Date.now(),"&env=").concat(this._environment),this.logger.info(C.L_REQUEST_T,JSON.stringify({url:i,body:r}),o),[4,Rn(this.logger,{method:"POST",headers:{appId:t},body:r,url:i,timeout:1e4})];case 1:if(200!==(s=c.sent()).status)return this.logger.warn(C.L_REQUEST_R,JSON.stringify({url:i,code:s.status}),o),[2,Ct(this.transHttpCode(s.status))];this.logger.info(C.L_REQUEST_R,JSON.stringify({url:i,data:s.data}),o);try{return a=JSON.parse(s.data),_=/^https/.test(i)?"https":"http",a.protocol=_,a.code&&200!==a.code?[2,Ct(this.transHttpCode(a.code))]:[2,dt(a)]}catch(e){return this.logger.error(C.L_PARSE_NAVI_E,s.data,o),[2,Ct(W.RC_NAVI_REQ_FAILED)]}return[2]}}))}))},t.prototype.httpRequestV2=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a;return Qe(this,(function(_){switch(_.label){case 0:return r=this.getNaviV2RequestOption({appkey:t,token:n,uri:e,platform:"electron",protocol:Nn.join(","),mac:yn()}),this.logger.info(C.L_REQUEST_T,JSON.stringify({url:r.url,body:r.body,headers:r.headers}),o),[4,Rn(this.logger,r)];case 1:if(200!==(i=_.sent()).status)return this.logger.warn(C.L_REQUEST_R,JSON.stringify({url:r.url,code:i.status}),o),[2,Ct(this.transHttpCode(i.status))];this.logger.info(C.L_REQUEST_R,JSON.stringify({url:r.url,data:i.data}),o);try{return s=JSON.parse(i.data),a=/^https/.test(r.url)?"https":"http",s.protocol=a,[2,dt(s)]}catch(e){return this.logger.error(C.L_PARSE_NAVI_E,i.data,o),[2,Ct(W.RC_NAVI_REQ_FAILED)]}return[2]}}))}))},t.prototype.getNaviCache=function(e){var t=this.getCatchKey(e),n=this._caches[t];if(n)return n;if(!E.existsSync(this.naviPath))return null;var o=E.readFileSync(this.naviPath,{encoding:"utf8"});try{return this._caches=JSON.parse(o),this._caches[t]}catch(e){this.logger.error(C.L_PARSE_NAVI_E,o)}return null},t.prototype.setNaviCache=function(e,t){var n=Date.now(),o=this.getCatchKey(e);if(Ye(this._caches))for(var r in this._caches){(n-this._caches[r].timestamp>Me||o===r)&&delete this._caches[r]}this._caches[o]={token:e,naviInfo:t,timestamp:Date.now(),environment:this._environment},E.writeFileSync(this.naviPath,JSON.stringify(this._caches))},t.prototype.setEnvironment=function(e){this._environment=e},t}(Vt);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.NOT_INIT=-1]="NOT_INIT",e[e.CANCELED=-2]="CANCELED",e[e.REPEAT=-3]="REPEAT"}(Mn||(Mn={}));var Fn,wn=function(e){function t(t,n,o,r,i){var s=e.call(this,t,o,r,i)||this;return s.callCppProxy=n,s._connectedTime=0,s._naviInfo=null,s._excludeLogTag=["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"],s.connectResolve=null,s._startTime=0,s._tcpDuration=0,s.pingResolve=null,s.callCppProxy("setConnectionStatusListener",s._onConnectionStatusChange.bind(s),(function(e){s.logger.info(mt.P_DB_OPEN_O,e)}),(function(){return s.recvPong(W.SUCCESS)}),s._onConnectionStatusChange.bind(s),s._onTcpConnectResponse.bind(s),(function(){var e;s.logger.info(mt.P_DB_UPGRATE_START_S),null===(e=i.onDBUpgrateStart)||void 0===e||e.call(i)}),(function(e){var t;s.logger.info(mt.P_DB_UPGRATING_S,e),null===(t=i.onDBUpgrading)||void 0===t||t.call(i,e)}),(function(e){var t;s.logger.info(mt.P_DB_UPGRATE_COMPLETE_S,e),null===(t=i.onDBUpgradeComplete)||void 0===t||t.call(i,e)})),s}return Ke(t,e),t.prototype.getConnectedTime=function(){return this._connectedTime},t.prototype.connectWithToken=function(e,t,n,o){var r=this;return new Promise((function(i){r._naviInfo=t,r.connectResolve={resolve:i,traceId:o,userId:t.userId};var s={},a=dn().data;a&&(s={proxy_passwd:a.socksPassword||"",proxy_name:a.socksUsername||"",proxy_port:a.socksPort||1082,proxy_host:a.socksHost||"localhost",proxy_type:0});var _=JSON.stringify(je(je({},s),{call_plus:r._openCallPlus})),c=r.getCmpList(t,!0).filter((function(e){return Nn.includes(e.protocol)})).sort((function(e,t){return e.weight>t.weight?-1:1})),u=[];c.forEach((function(e){var t=u.find((function(t){return t.addr===e.addr}));t?t.protocol!==j.QUIC&&e.protocol!==j.QUIC||(t.race=!0,t.protocol=j.QUIC):(e.race=!1,u.push(e))})),r.logger.info(mt.P_CONNECT_O,JSON.stringify({use:u,catche:r.cmpWeightCache,proxy:s,FORMATED_VERSION:De,reconnectKickEnable:n}),o),r._startTime=Date.now();try{r.callCppProxy("connectWithToken",e,De,JSON.stringify(je(je({},t),{serverAddr:u,tagBlacklist:r._excludeLogTag.join(",")})),n,_)}catch(e){r.logger.error(mt.P_CALL_ADDON_E,null==e?void 0:e.stack,o),r.recvConnectRes(W.RC_SOCKET_NOT_CREATED)}}))},t.prototype.close=function(e,t){void 0===t&&(t=!0),e||this.callCppProxy("disconnect",t)},t.prototype.sendPing=function(e){var t=this;return new Promise((function(n){t.pingResolve=n,t.callCppProxy("sendHeartbeat"),setTimeout((function(){return t.recvPong(W.TIMEOUT)}),e)}))},t.prototype.recvPong=function(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)},t.prototype._onConnectionStatusChange=function(e,t){switch(this.logger.info(mt.P_CONNECT_S,JSON.stringify({status:e,delay:t})),e){case W.SUCCESS:this.recvConnectRes(W.SUCCESS);break;case W.RC_CONN_REDIRECTED:case 32061:this.recvConnectRes(W.RC_CONN_REDIRECTED,!0);break;case 11:case 10:case 12:break;case W.RC_SOCKET_DISCONNECTED:this.recvConnectRes(e,!1);break;case W.RC_SOCKET_NOT_CREATED:case W.RC_CONN_ACK_TIMEOUT:case W.RC_TCP_RESET:this.recvConnectRes(e);break;case W.RC_UDP_DISCONNECTED:this.recvConnectRes(e,!0,t);break;default:this.recvConnectRes(e,!0)}},t.prototype.recvConnectRes=function(e,t,n){if(this.connectResolve){var o=this.connectResolve,r=o.resolve,i=o.userId,s=Date.now()-(this._startTime+this._tcpDuration),a={bid:st(),cod:e,net:this.getNetwork().type,dur:s,spr:0,cid:"".concat(this.uuid,"_").concat(this.retryCount),v:fe.CURRENT,count:this.retryCount};return this.logger.record(pe.IM_CMP_RMTP,JSON.stringify(a)),e===W.SUCCESS&&(this._connectedTime=Date.now()-this.callCppProxy("getDeltaTime")),r(pt(e,i)),void(this.connectResolve=null)}if(t)this.onDisconnectByServer(e,n);else{if(e===W.RC_SOCKET_DISCONNECTED)if(this.getConnectionStatus()!==ue.CONNECTED)return;this.onDisconenctUnusual(e)}},t.prototype._onTcpConnectResponse=function(e,t,n,o,r,i,s){var a,_=this.cmpWeightCache.findIndex((function(e){return e.addr==="".concat(t,":").concat(n)})),c={bid:st(),ptc:he.TCP,cod:e,net:this.getNetwork().type,dur:o,spr:0,pr:(null===(a=this._naviInfo)||void 0===a?void 0:a.type)||0,hos:"".concat(t,":").concat(n),idx:_,rct:this.retryCount?Oe.RECONNECT:Oe.CONNECT,cid:"".concat(this.uuid,"_").concat(this.retryCount),v:fe.CURRENT,rsn:this.reason,ddu:r,count:this.retryCount,weight:_>=0?this.cmpWeightCache[_].weight:-1};if(this.logger.record(pe.IM_CMP,JSON.stringify(c)),this.logger.info(mt.P_CONNECT_ENTRY_S,JSON.stringify({code:e,host:t,port:n,duration:o,dnsDuration:r,index:i,isQuic:s})),e===Mn.SUCCESS)this.curCmpUrl="".concat(t,":").concat(n),this.updateCmpWeight("".concat(t,":").concat(n),!0,s);else if(e!==Mn.NOT_INIT){var u=n&&0!==n?"".concat(t,":").concat(n):"".concat(t);this.updateCmpWeight(u,!1)}},t}(Dt),xn=function(e){function t(t,o,r){var i=e.call(this,t,o)||this;i.appkey=t,i.logger=o,i.dbpath=r,i._cachePath="",i._cachePath="".concat(r,"/").concat(An(t));var s=n.dirname(i._cachePath);return E.existsSync(s)||Dn(s),i}return Ke(t,e),t.prototype.getCache=function(){return E.existsSync(this._cachePath)&&E.readFileSync(this._cachePath,{encoding:"utf8"})||null},t.prototype.setCache=function(e){E.writeFileSync(this._cachePath,e)},t.prototype.clearCache=function(){E.writeFileSync(this._cachePath,"")},t.prototype.sendRequest=function(e){return Xe(this,void 0,void 0,(function(){var t,n,o;return Qe(this,(function(r){switch(r.label){case 0:return[4,Rn(this.logger,{url:e,body:""})];case 1:return t=r.sent(),n=t.status,o=t.data,[2,{code:n,data:o}]}}))}))},t.prototype.decryptData=function(e){return Xe(this,void 0,void 0,(function(){var t,n;return Qe(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,Un(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91")];case 1:return t=o.sent(),[2,JSON.parse(t)];case 2:return n=o.sent(),this.logger.error(C.L_GET_STATIC_CONF_E,JSON.stringify({error:null==n?void 0:n.stack})),[3,3];case 3:return[2]}}))}))},t}(At),Bn=function(e){function t(t,o,r,i,s){var a=e.call(this,o,t,r)||this;a.deviceId=i,a.model="",a.catchFilePath="",a.model="Electron|".concat(process.platform,"|").concat(process.arch),a.catchFilePath="".concat(s,"/").concat(gn(t));var _=n.dirname(a.catchFilePath);return E.existsSync(_)||Dn(_),a.init(),a}return Ke(t,e),t.prototype.httpRequest=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r,i,s,a,_,c,u,E;return Qe(this,(function(R){switch(R.label){case 0:return(r=o).deviceId=this.deviceId,r.model=this.model,i={url:e,method:t,headers:n,body:JSON.stringify(r)},this.logger.info(C.L_REQUEST_T,JSON.stringify(i)),[4,Rn(this.logger,i)];case 1:s=R.sent(),a=s.status,_=s.data,c=void 0===_?"":_,this.logger.info(C.L_REQUEST_R,JSON.stringify({status:a,data:c}));try{return u=JSON.parse(c),E=u.data,[2,{code:a,data:E}]}catch(e){return this.logger.warn(C.L_CLOUD_CONFIG_DATA_E,JSON.stringify({status:a,data:c,error:e})),[2,{code:a,msg:e}]}return[2]}}))}))},t.prototype.setCloudControllerCache=function(e){E.writeFileSync(this.catchFilePath,JSON.stringify(e)),this.logger.info(C.L_CLOUD_SET_CACHE_O,JSON.stringify(e))},t.prototype.getLocalCloudControllerCache=function(){if(!E.existsSync(this.catchFilePath))return null;var e=E.readFileSync(this.catchFilePath,{encoding:"utf8"});return this.logger.info(C.L_CLOUD_GET_CACHE_O,JSON.stringify({appkey:this.appkey,data:e})),e},t.prototype.setMRTRConfig=function(e){var t={mrtrChatroom:e.chatroom,mrtrGroup:e.group,mrtrPrivate:e.private,mrtrUltraGroup:e.ultraGroup};this.logger.info(C.L_CLOUD_SET_MRTR_O,JSON.stringify(t)),kt.setCloudConfig(JSON.stringify(t))},t}(Mt),kn=function(){function e(e,t){var n=this;this._logger=e,this._method=t,this._traceId=this._logger.createTraceId(),this._promise=new Promise((function(e){n._resolve=e}))}return e.create=function(t,n){return new e(t,n)},e.prototype.invoke=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=this,r=o._method,i=o._traceId,s=o._logger;s.debug(mt.P_CALL_ADDON_T,JSON.stringify({method:r,params:t}),i);try{e=kt[r].apply(kt,ze([],Ze(t),!1))}catch(e){throw s.error(mt.P_CALL_ADDON_E,JSON.stringify({stack:null==e?void 0:e.stack,method:r}),i),e}return e!==W.SUCCESS&&this.fail(e),this},e.prototype.ok=function(e){this._logger.debug(mt.P_CALL_ADDON_R,"success",this._traceId),this._flush(dt(e))},e.prototype.fail=function(e){this._logger.warn(mt.P_CALL_ADDON_R,"faile: ".concat(e),this._traceId),this._flush(Ct(e))},e.prototype._flush=function(e){var t=this;setTimeout((function(){return t._resolve(e)}),0)},e.prototype.result=function(){return this._promise},e}();!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(Fn||(Fn={}));var Hn,Jn=function(){function e(e,t,n,o,r,i){var s=this;this._appkey=e,this._dbpath=t,this._dispatchEvent=n,this._enableSyncEmptyTopConversation=o,this._logOutputLevel=r,this._customMessageType={},this.cloudControllerUri="",this.cloudControllerLock=!0,this.cloudControllerMsgs=[],this._buildSubscribeEventData=function(e){var t=[];try{JSON.parse(e).list.forEach((function(e){var n=JSON.parse(e.obj),o=n.userId,r=n.subscribeType,i=n.subscribeTime,a=n.duration,_=n.operationType,c=n.details,u=void 0===c?[]:c,E=n.userProfile,R={userId:o,subscribeType:r,subscribeTime:i,expiry:a,operationType:_};[ae.ONLINE_STATUS,ae.FRIEND_ONLINE_STATUS].includes(r)&&(R.details=u.map((function(e){var t=JSON.parse(e);return{changeTime:t.changeTime,eventValue:t.changeValue,platform:t.platform}}))),[ae.USER_PROFILE,ae.FRIEND_USER_PROFILE].includes(r)&&(R.userProfile=s._string2userProfileInfo(E)),t.push(R)}))}catch(t){s.logger.error(mt.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==t?void 0:t.stack,data:e}))}return t},this._chatroomCache=[],this.rtcHeartbeatResolves={};var a=this._dbpath,_=Ln(a);this.logger=new Xt(this._appkey,"RC-M","IM"),kt.initWithAppkey(e,a,De,this.logger.getSessionId()),kt.setConsoleLogLevel((this._logOutputLevel||Nt.WARN)+1),this.logger.setOutputLevel(this._logOutputLevel),Yt(this.logger),this.reporter=new hn(e,_,this.logger,i),this.logger.info(mt.P_INIT_O,JSON.stringify({appkey:e,dbpath:a,proto_commit:kt.getNodeVersion(),deviceId:_,commit:"06a72f5bcd8bece97ac41ef1ebdb817e57484d7f",processName:process.title,processPId:process.pid,disableLogReport:i})),this._callCppProxy("setDeviceId",_),this._staticConfigManager=new xn(e,this.logger,a),this.navi=new bn(e,this.logger,a,this._staticConfigManager),this.tcpMgr=new wn(e,this._callCppProxy.bind(this),this.navi,this.logger,{onConnected:this.onConnected.bind(this),onSuspend:this.onSuspend.bind(this),onDisconnected:this.onDisconnected.bind(this),onConnecting:this.onConnecting.bind(this),onDBUpgrateStart:this.dbUpgradeStart.bind(this),onDBUpgrading:this.dbUpgrading.bind(this),onDBUpgradeComplete:this.dbUpgradeComplete.bind(this)}),this._enableCreateEmptyTopConversation(this._enableSyncEmptyTopConversation),this._initCloudController(_,a),this._registerMsgTypes(),this._setOnReceiveMessageListener(),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),this._msgExpansionHandler=new mn(this._callCppProxy.bind(this))}return e.prototype._initCloudController=function(e,t){var n;n=Ze(Ot.getCloudControllerUrl(),1),this.cloudControllerUri=n[0],this.cloudController=new Bn(this._appkey,this.logger,this.reporter,e,t),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,gt.init)},e.prototype.callProxy=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Xe(this,void 0,void 0,(function(){var n,o,r;return Qe(this,(function(i){switch(i.label){case 0:if(!(n=this[e]))return this.logger.warn(mt.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2,Promise.resolve({code:W.NOT_SUPPORT})];o="",i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n.call.apply(n,ze([this],Ze(t),!1))];case 2:return[2,i.sent()];case 3:return r=i.sent(),o=JSON.stringify({error:null==r?void 0:r.stack,method:e}),this.logger.error(mt.P_CALL_MAIN_E,o),[3,4];case 4:return[2,{code:W.MAIN_PROCESS_ERROR,msg:o}]}}))}))},e.prototype.sendProxy=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Xe(this,void 0,void 0,(function(){var n;return Qe(this,(function(o){if(!(n=this[e]))return this.logger.warn(mt.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2];try{n.call.apply(n,ze([this],Ze(t),!1))}catch(t){this.logger.error(mt.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}return[2]}))}))},e.prototype.registerRenderers=function(e){var t=e.navigators,n=e.areaCode,o=e.logServerUrl,r=e.environment;this._environment=r||"default",this.navi.setEnvironment(r),Ot.init({areaCode:n,navigators:t,logServerUrl:o})},e.prototype.onConnected=function(){return Xe(this,void 0,void 0,(function(){var e,t,n;return Qe(this,(function(o){switch(o.label){case 0:return e=this.getNaviInfoFromCache(),this.reporter.checkStart(e,""),this._try2RejoinChatroom(),t=this._dispatchEvent,n=["onConnected"],[4,this.getMainProcessCache()];case 1:return t.apply(this,n.concat([o.sent()])),[2]}}))}))},e.prototype.onConnecting=function(){this._dispatchEvent("onConnecting",void 0)},e.prototype.onSuspend=function(e){this._dispatchEvent("onSuspend",e)},e.prototype.onDisconnected=function(e){this._dispatchEvent("onDisconnected",e)},e.prototype.dbUpgradeStart=function(){this._dispatchEvent("databaseUpgradeWillStart")},e.prototype.dbUpgrading=function(e){this._dispatchEvent("databaseUpgrading",e)},e.prototype.dbUpgradeComplete=function(e){this._dispatchEvent("databaseUpgradeDidComplete",e)},e.prototype._callCppProxy=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.logger.createTraceId();try{return this.logger.debug(mt.P_CALL_ADDON_O,JSON.stringify({method:e,content:t}),o),kt[e].apply(kt,ze([],Ze(t),!1))}catch(t){throw this.logger.error(mt.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),o),t}},e.prototype.refetchNaviInfo=function(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())},e.prototype.sendHTTPRequest=function(e){return Rn(this.logger,e)},e.prototype.onRendererLogsReceived=function(e){Wt.apply(void 0,ze([],Ze(e),!1))},e.prototype.setNetwork=function(e,t){if(this.tcpMgr.setNetwork(e,t),e.status&&this.cloudController){var n=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,gt.newWorkChange,n)}},e.prototype.destroy=function(){this.reporter.stop(),Jt(),kt.destroy(),process.exit(0)},e.prototype.callExtra=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this[e];if(!o)return this.logger.warn(mt.P_CALL_EXTRA_E,JSON.stringify({method:e,error:"not found"})),Promise.resolve({code:W.NOT_SUPPORT});try{return o.call.apply(o,ze([this],Ze(t),!1))}catch(t){this.logger.error(mt.P_CALL_EXTRA_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}return Promise.resolve({code:W.MAIN_PROCESS_ERROR})},e.prototype.getConversationsByPage=function(e,t,n,o,r){var i,s=this,a=this._callCppProxy("getConversationListByPageWithTopPriority",e,t,n,r||!1,o||"");try{i=JSON.parse(a).list.map((function(e){return s._buildConversation(e.obj)}))}catch(e){return Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:i})},e.prototype.getUnreadConversationList=function(e){var t,n=this,o=this._callCppProxy("getUnreadConversationList",e);try{t=JSON.parse(o).list.map((function(e){return n._buildConversation(e.obj)}))}catch(e){return Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:t})},e.prototype.getConversationListWithAllChannel=function(){var e,t=this,n=[K.PRIVATE,K.GROUP,K.SYSTEM,K.APP_PUBLIC_SERVICE,K.PUBLIC_SERVICE],o=this._callCppProxy("getConversationListWithAllChannel",n);try{e=JSON.parse(o).list.map((function(e){return t._buildConversation(e.obj)}))}catch(e){return Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:e})},e.prototype.getConversationListWithAllChannelByPage=function(e,t){var n,o=this,r=[K.PRIVATE,K.GROUP,K.SYSTEM,K.APP_PUBLIC_SERVICE,K.PUBLIC_SERVICE],i=this._callCppProxy("getConversationListWithAllChannelByPage",r,e,t);try{n=JSON.parse(i).list.map((function(e){return o._buildConversation(e.obj)}))}catch(e){return Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:n})},e.prototype.getHistoryMessagesByObjectNames=function(e,t,n,o,r,i,s){var a=0===i,_=o+1,c=this._callCppProxy("getHistoryMessagesByObjectNames",e,t,n,_,r,a,s||""),u=[];try{var E=JSON.parse(c).list;E.reverse();for(var R=0;R<E.length;R++){var l=this._buildMessage(E[R].obj);u[R]=l}}catch(e){return Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:{list:_===u.length?u.slice(1,_):u,hasMore:o<u.length}})},e.prototype.updateMessageReceiptStatus=function(e,t,n,o){void 0===o&&(o="");var r=this._callCppProxy("updateMessageReceiptStatus",e,t,n,o);return Promise.resolve({code:W.SUCCESS,data:r})},e.prototype.getNaviInfoFromCache=function(){return this.tcpMgr.getConnectionStatus()!==ue.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())},e.prototype.createLogger=function(e,t){return/^RC/.test(e)?null:new Xt(this._appkey,e,t)},e.prototype.getConnectedTime=function(){return this.tcpMgr.getConnectedTime()},e.prototype.getServerTime=function(){return Date.now()-kt.getDeltaTime()},e.prototype.getCurrentUserId=function(){return this.tcpMgr.getCurrentUserId()},e.prototype.getMainProcessCache=function(){var e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),n=this.getNaviInfoFromCache(),o=this.tcpMgr.getCurrentUserId(),r=this.getDeviceId(),i=kt.getDeltaTime();return Promise.resolve({connectedTime:e,deviceId:r,crtUserId:o,naviInfo:n,connectionStatus:t,deltaTime:i})},e.prototype._enableCreateEmptyTopConversation=function(e){this._callCppProxy("enableCreateEmptyTopConversation",e)},e.prototype._registerMsgTypes=function(){for(var e in Ue["RC:RcCmd"]={isCounted:!1,isPersited:!1},Ue){var t=Ue[e],n=t.isCounted,o=t.isPersited,r=t.searchProps,i=0;o&&(i|=1),n&&(i|=2),"RC:TypSts"===e&&(i=16),this._callCppProxy("registerMessageType",e,i,r||[])}},e.prototype._buildIsMentioned=function(e,t){var n,o=!1;if(ke(e))n=e;else try{n=e?JSON.parse(e):e}catch(t){n=e,this.logger.error(mt.P_PARSE_JSON_MSGS_E,JSON.stringify({content:e}))}return ke(n)&&(o=!!n.mentionedInfo),{isMentioned:o,msgContent:n}},e.prototype._buildMsgOption=function(e){var t={isCounted:!1,isPersited:!1};return e in Ue?t=Ue[e]:e in this._customMessageType&&(t=this._customMessageType[e]),t},e.prototype._buildSupportExt=function(e,t,n){var o=null;return e&&(o=this._msgExpansionHandler.parseReceiveExpansion(n),"conversation"!==t&&"history"!==t||(o=this._msgExpansionHandler.parseConverOrHisExpansion(n))),o},e.prototype._handleReadReceiptRequest=function(e){var t=JSON.parse(e),n=this.getNaviInfoFromCache();if(!(null==n?void 0:n.grpRRVer))return t;var o=t,r=o.hasRespond,i=o.readerInfo,s=void 0===i?{}:i,a=o.readCount,_=o.totalCount,c=o.readerList,u=void 0===c?[]:c,E={readCount:a,totalCount:_};if(1===(null==n?void 0:n.grpRRVer)){var R=[];for(var l in s)R.push({userId:l,readTime:s[l]});E.readerList=R,E.hasRespond=r}return 3===(null==n?void 0:n.grpRRVer)&&(E.readerList=u),E},e.prototype._buildMessage=function(e,t){var n;void 0===t&&(t={});var o=t.isOffLineMessage,r=t.buildFrom,i=JSON.parse(e),s=i.channelId,a=i.conversationType,_=i.targetId,c=i.senderUserId,u=i.content,E=i.objectName,R=i.messageUid,l=i.direction,d=i.status,p=i.messageId,I=i.sentTime,T=i.readReceiptRequest,S=i.supportExt,h=i.pushContent,N=i.pushTitle,f=i.pushId,O=i.pushConfig,A=i.templateId,g=i.disableTitle,P=i.forcePushDetail,v=i.hasMore,L=i.directedUsers,m=i.noNotification,y=i.disableUpdateLastMessage,M=this._buildIsMentioned(u,p),U=M.isMentioned,D=M.msgContent,G=this._buildMsgOption(E),V=this._buildSupportExt(S,r,i),b=He(o)?I<this.tcpMgr.getConnectedTime():o,F={};O&&(F=function(e,t,n){var o={},r={notificationId:n||""},i={};if(!t)return{iOSConfig:o,androidConfig:r,harmonyOSConfig:i};try{var s=JSON.parse(t);null==s||s.forEach((function(e){var t,n,s,a,_,c,u,E,R,l,d,p,C=Object.keys(e);if(0!==C.length){var I=C[0];switch(I){case"HW":return r.channelIdHW=null===(t=e[I])||void 0===t?void 0:t.channelId,r.importanceHW=null===(n=e[I])||void 0===n?void 0:n.importance,r.imageUrlHW=null===(s=e[I])||void 0===s?void 0:s.image,void(r.categoryHW=null===(a=e[I])||void 0===a?void 0:a.category);case"MI":return void(r.channelIdMi=null===(_=e[I])||void 0===_?void 0:_.channelId);case"OPPO":return void(r.channelIdOPPO=null===(c=e[I])||void 0===c?void 0:c.channelId);case"VIVO":return r.typeVivo=null===(u=e[I])||void 0===u?void 0:u.classification,void(r.categoryVivo=null===(E=e[I])||void 0===E?void 0:E.category);case"APNS":return o.threadId=e[I]["thread-id"],o.apnsCollapseId=e[I]["apns-collapse-id"],o.category=e[I].category,o.richMediaUri=e[I].richMediaUri,void(o.interruptionLevel=e[I]["interruption-level"]);case"FCM":return void(r.googleConfig={collapseKey:e[I].collapse_key||"",imageUrl:e[I].imageUrl||"",priority:e[I].priority||""});case"HONOR":return r.importanceHonor=null===(R=e[I])||void 0===R?void 0:R.importance,void(r.imageUrlHonor=null===(l=e[I])||void 0===l?void 0:l.image);case"OHOS":i.category=null===(d=e[I])||void 0===d?void 0:d.category,i.image=null===(p=e[I])||void 0===p?void 0:p.image}}}))}catch(n){e.error(C.O,"Wrong format for pushConfigs field! content: ".concat(t))}return{iOSConfig:o,androidConfig:r,harmonyOSConfig:i}}(this.logger,O,f));var w=je(je({},F),{pushTitle:N,pushContent:h,pushData:h,disablePushTitle:g,forceShowDetailContent:P,templateId:A}),x={channelId:s,conversationType:a,targetId:_,senderUserId:c,content:D||{},messageType:E,messageUId:R||"",messageDirection:l,isOffLineMessage:b,sentTime:I,receivedTime:0,isPersited:G.isPersited,isCounted:G.isCounted,isMentioned:U,disableNotification:m,isStatusMessage:(null===(n=this._customMessageType[E])||void 0===n?void 0:n.isStatusMessage)||!1,canIncludeExpansion:S,expansion:S?V:null,receivedStatus:d,receivedStatusInfo:$e(d),messageId:p,pushConfig:w,hasMore:v,directedUserIds:L||[],disableUpdateLastMessage:y};if(l===le.RECEIVE?x.receivedStatus=this._compatibleReceivedStatus(x.receivedStatusInfo):l===le.SEND&&(x.sentStatus=d),T){var B=this._handleReadReceiptRequest(T);x.readReceiptInfo=B}return x},e.prototype._compatibleReceivedStatus=function(e){var t=Te.UNREAD;return e.isRead?t=Te.READ:e.isListened?t=Te.LISTENED:e.isDownload?t=Te.DOWNLOADED:e.isRetrieved&&(t=Te.RETRIEVED),t},e.prototype._updateReadReceiptInfo=function(e,t){var n=this._callCppProxy("getMessage",e),o=JSON.parse(n),r=o.readReceiptRequest?JSON.parse(o.readReceiptRequest):{},i=je(je({},r),t);this._callCppProxy("updateReadReceiptRequestInfo",e,JSON.stringify(i))},e.prototype._processRRRspMsg=function(e,t,n){var o,r,i,s;if(t!==this.getCurrentUserId()){var a=e[this.getCurrentUserId()]||[];try{for(var _=qe(a),c=_.next();!c.done;c=_.next()){h=c.value;var u=this._callCppProxy("getMessage",h),E=JSON.parse(u),R=E.readReceiptRequest?JSON.parse(E.readReceiptRequest):{},l=R.isReceiptRequestMessage,d=R.readerList,p=void 0===d?[]:d;l&&!p.includes(t)&&(p.push(t),this._callCppProxy("updateReadReceiptRequestInfo",h,JSON.stringify({isReceiptRequestMessage:l,readerList:p})))}}catch(e){i={error:e}}finally{try{c&&!c.done&&(s=_.return)&&s.call(_)}finally{if(i)throw i.error}}}else for(var C in e){var I=e[C];try{for(var T=(o=void 0,qe(I)),S=T.next();!S.done;S=T.next()){var h=S.value;this._callCppProxy("updateReadReceiptRequestInfo",h,JSON.stringify({isReceiptRequestMessage:!0,hasRespond:!0}))}}catch(e){o={error:e}}finally{try{S&&!S.done&&(r=T.return)&&r.call(T)}finally{if(o)throw o.error}}}},e.prototype._processRSMsg=function(e){var t=e.conversationType,n=e.targetId,o=e.content,r=e.channelId,i=o.msgId,s=o.rrn,a=o.tmn,_=o.endMsgTime;t===K.PRIVATE?this.updateMessageReceiptStatus(t,n,_,r||""):this._updateReadReceiptInfo(i,{readCount:s,totalCount:a});var c={conversationType:t,targetId:n,channelId:r};this._sendMessageReadReceipt(t===K.PRIVATE?{privateReadReceipt:je(je({},c),{endMsgTime:o.endMsgTime})}:{groupReadReceipt:je(je({},c),{totalCount:o.tmn,readedCount:o.rrn,messageUId:o.msgId})})},e.prototype._processSRSMsg=function(e){var t=this.getNaviInfoFromCache(),n=e.conversationType,o=e.targetId,r=e.content,i=e.channelId,s=e.senderUserId,a=e.sentTime;return s===this.tcpMgr.getCurrentUserId()&&(this._callCppProxy("clearUnreadCountByTimestamp",n,o,r.lastMessageSendTime,i||""),1!==(null==t?void 0:t.sesDriven)||(a>this.tcpMgr.getConnectedTime()||this._sendsyncReadStatus({conversationType:n,targetId:o,channelId:i,timestamp:r.lastMessageSendTime}),!1))},e.prototype._buildConversation=function(e){var t=JSON.parse(e),n=t.channelId,o=t.conversationType,r=t.targetId,i=t.unreadCount,s=t.lastestMsg,a=t.isTop,_=t.blockStatus,c=t.matchCount,u=t.hasUnreadMention,E=t.conversationTime,R=t.draft,l=_>0?Ce.OPEN:Ce.CLOSE;return{channelId:n,conversationType:o,targetId:r,unreadMessageCount:i,latestMessage:-1===JSON.parse(s).messageId?null:this._buildMessage(s),hasMentioned:u,mentionedInfo:null,notificationStatus:l,isTop:a,lastUnreadTime:0,matchCount:c,operationTime:E,notificationLevel:_,draft:R}},e.prototype._convertResultList=function(e,t){var n=JSON.parse(e).list;return n=n.map((function(e){var n=JSON.parse(e.obj);return t?t(n):n}))},e.prototype._handleNotNotificationMessage=function(e){var t,n=e.messageType,o=e.senderUserId,r=e.content;if(n===q.LOG_COMMAND&&e.senderUserId===Ge){var i=e.content,s=i.startTime,a=i.endTime,_=i.platform,c=i.logId,u=i.uri;return this.reporter.report(parseInt(s,10),parseInt(a,10),_,u,c,e.messageUId),!0}if(n===q.CLOUD_CONTROL&&o===Ge)return this.cloudControllerMsgs.push(e),this._ccMsgHandler(),!0;if(n===q.READ_STATE)return this._processRSMsg(e),!0;if("RC:MsgExMsg"===n)return this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e),this._sendMessageExpansion(e),!0;if(n===q.SYNC_READ_STATUS&&!this._processSRSMsg(e))return!0;if(n===q.DELIVERED)return this._callCppProxy("setMessageDeliverTime",JSON.stringify(r)),this._sendMessageDelivered(e.content.map((function(e){return{deliverTime:e.time,messageUId:e.messageUId,objectName:e.objectName,targetId:e.targetId}}))),!0;if(n===q.DELIVERED_MSG){var E={totalCount:e.content.tmn,list:null===(t=e.content.dl)||void 0===t?void 0:t.map((function(e){return{MessageUId:e.msgId,deliveryCount:e.drn}}))};return this._sendGroupMessageDeliveredStatus(E),!0}return!1},e.prototype._setOnReceiveMessageListener=function(){var e=this;kt.setOnReceiveMessageListener((function(t,n,o,r){try{var i=e._buildMessage(t,{isOffLineMessage:o}),s=i.messageType,a=i.channelId,_=void 0===a?"":a,c=i.senderUserId,u=i.content,E=i.sentTime,R=i.conversationType,l=i.targetId;if(e._handleNotNotificationMessage(i))return;if(s===q.READ_RECEIPT_REQUEST&&u.messageUId&&e._updateReadReceiptInfo(u.messageUId,{isReceiptRequestMessage:!0,hasRespond:!1}),s===q.READ_RECEIPT_RESPONSE&&u.receiptMessageDic&&e._processRRRspMsg(u.receiptMessageDic,c,E),s===q.GROUP_READ_RECEIPT_REQUEST){var d=u.msgId,p=u.rrn,C=u.tmn;e._updateReadReceiptInfo(d,{readCount:p,totalCount:C})}i.canIncludeExpansion&&e._msgExpansionHandler.setLocalFromReceiveMsg(e.logger,i),s===q.READ_RECEIPT&&c===e.tcpMgr.getCurrentUserId()&&e._callCppProxy("clearUnreadCountByTimestamp",R,l,u.lastMessageSendTime,_);var I=!0;if(0!==n||r||(I=!1),s===q.RECALL){if(!e.handleRecalledMessage(i))return;var T=e._fixRecallContentInfo(i);R=T.conversationType,l=T.targetId}e._sendMessageNotification(Object.assign(i,{hasMoreMsg:I,conversationType:R,targetId:l}))}catch(n){e.logger.error(mt.P_RECEIVE_MESSAGE_E,JSON.stringify({error:null==n?void 0:n.stack,message:t}))}}),(function(){e._sendPullOfflineFinished()}))},e.prototype._ccMsgHandler=function(){var e;return Xe(this,void 0,void 0,(function(){var t,n;return Qe(this,(function(o){switch(o.label){case 0:return this.cloudControllerLock?(this.cloudControllerLock=!1,this.cloudControllerMsgs.shift()?(t=this.tcpMgr.getToken(),[4,null===(e=this.cloudController)||void 0===e?void 0:e.request(this.cloudControllerUri,gt.other,t)]):[3,2]):[2];case 1:n=o.sent()||0,this.cloudControllerMsgs=this.cloudControllerMsgs.filter((function(e){return e.sentTime>n})),this.cloudControllerLock=!0,this._ccMsgHandler(),o.label=2;case 2:return[2]}}))}))},e.prototype._fixRecallContentInfo=function(e){var t=e.conversationType,n=e.targetId;return e.senderUserId===this.tcpMgr.getCurrentUserId()&&(t=e.content.conversationType||t,n=e.content.targetId||n),{conversationType:t,targetId:n}},e.prototype.handleRecalledMessage=function(e){var t=e.content,n=t.messageUId,o=t.sentTime;if(!n)return!0;var r=this._callCppProxy("getMessage",n),i=this._buildMessage(r,{isOffLineMessage:!1});if(e.content.isDelete)return-1===i.messageId||this._callCppProxy("deleteMessages",[i.messageId]),!0;if(i.messageType===q.RECALL_NOTIFICATION_MESSAGE)return!1;var s={recallTime:Date.now(),admin:!!e.content.isAdmin,originalObjectName:i.messageType,originalMessageContent:i.content,recallActionTime:e.sentTime,operatorId:e.senderUserId};if(e.content.user&&(s.user=e.content.user),e.content.extra&&(s.extra=e.content.extra),i.messageType===q.TextMessage&&(s.recallContent=i.content.content),-1===i.messageId){var a=e.conversationType,_=e.targetId,c=e.senderUserId,u=e.channelId,E=e.messageDirection;return this._callCppProxy("insertMessage",a,_,c,q.RECALL_NOTIFICATION_MESSAGE,JSON.stringify(s),(function(){}),(function(){}),E,1,30,o,"",0,n,!1,!0,JSON.stringify({}),u||""),!0}return i.receivedStatus||this.setMessageReceivedStatus(i.messageId,1),this._callCppProxy("setMessageContent",i.messageId,JSON.stringify(s),q.RECALL_NOTIFICATION_MESSAGE),!0},e.prototype._sendMessageExpansion=function(e){var t=e.channelId,n=void 0===t?"":t,o=e.content,r=e.conversationType,i=e.targetId,s=o,a=s.put,_=s.del,c=s.mid,u={};a&&(u.updatedExpansion={channelId:n,messageUId:c,expansion:a,conversationType:r,targetId:i}),_&&(u.deletedExpansion={channelId:n,messageUId:c,deletedKeys:_,conversationType:r,targetId:i}),this._dispatchEvent("expansion",u)},e.prototype._sendMessageNotification=function(e){this._dispatchEvent("batchMessage",e)},e.prototype._sendPullOfflineFinished=function(){this._dispatchEvent("pullFinished",null)},e.prototype._sendMessageDelivered=function(e){this._dispatchEvent("messageDelivered",e)},e.prototype._sendGroupMessageDeliveredStatus=function(e){this._dispatchEvent("groupMessageDeliveredStatus",e)},e.prototype._sendChatroomStatus=function(e){this._dispatchEvent("chatroom",e)},e.prototype._sendMessageReadReceipt=function(e){this._dispatchEvent("messageReadReceipt",e)},e.prototype._sendsyncReadStatus=function(e){this._dispatchEvent("syncReadStatus",e)},e.prototype._setConversationStatusListener=function(){var e=this;kt.setConversationStatusListener((function(t){var n=JSON.parse(t).list,o=[];n.forEach((function(e){var t=JSON.parse(e.obj),n=t.conversationType,r=t.targetId,i=t.status,s=t.channelId,a={notificationStatus:2,isTop:!1};i.forEach((function(e){var t=JSON.parse(e.item);1===t.type?a.notificationStatus=1===Number(t.value)?Ce.OPEN:Ce.CLOSE:a.isTop=1===Number(t.value)})),o.push({channelId:s,conversationType:n,targetId:r,updatedItems:{notificationStatus:{val:a.notificationStatus,time:0},isTop:{val:a.isTop,time:0}}})})),e._dispatchEvent("conversation",o)}),(function(t){e._dispatchEvent("conversationTag",t)}),(function(t,n,o,r){e._callCppProxy("clearUnreadCountByTimestamp",t,n,r,o||""),e._sendsyncReadStatus({conversationType:t,targetId:n,channelId:o,timestamp:r})}))},e.prototype._setPushNotificationListener=function(){var e=this;kt.setPushNotificationListener((function(){}),(function(t){e._dispatchEvent("tag",t),e._getRTCProfile()}))},e.prototype._getRTCProfile=function(){var e=this._callCppProxy("getRTCProfile");if(e){var t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);var n=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",n)}},e.prototype._setRTCLivingRoomEventListener=function(){var e=this;kt.setRTCRoomEventListener((function(t){e._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(t))}))},e.prototype._setChatroomEventListener=function(){var e=this;kt.setChatroomEventListener((function(t,n){e._sendChatroomStatus({chatroomDestroyed:t})}))},e.prototype._setCallInfoListener=function(){var e=this;kt.setCallInfoListener((function(t){var n=[];try{JSON.parse(t).list.forEach((function(e){Object.entries(e).forEach((function(e){var t=Ze(e,2),o=t[0],r=t[1];n.push({key:o,value:r})}))}))}catch(t){e.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:t}))}e._dispatchEvent("callInfo",JSON.stringify({list:n}))}))},e.prototype._setSubscribeEventListener=function(){var e=this;kt.setSubscribeEventListener((function(){}),(function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){var n=e._buildSubscribeEventData(t).map((function(e){return{userId:e.userId,subscribeType:e.subscribeType,subscribeTime:e.subscribeTime,expiry:e.expiry,operationType:e.operationType}}));e._dispatchEvent("subscribedRelationChange",n)}),(function(t){var n=e._buildSubscribeEventData(t).map((function(e){var t=e.userId,n=e.subscribeType,o=e.subscribeTime,r=e.expiry,i=e.details,s=e.userProfile,a={userId:t,subscribeType:n,subscribeTime:o,expiry:r};return[ae.ONLINE_STATUS,ae.FRIEND_ONLINE_STATUS].includes(n)?a.details=i:[ae.USER_PROFILE,ae.FRIEND_USER_PROFILE].includes(n)&&(a.userProfile=s),a}));e._dispatchEvent("subscribedUserStatusChange",n)}))},e.prototype._setUserProfileListener=function(){var e=this;kt.setUserProfileListener((function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){e._dispatchEvent("ownUserProfileChanged",e._string2userProfileInfo(t))}))},e.prototype._onGroupOperationChanged=function(e,t,n,o,r){var i,s,a,_=[];try{s=JSON.parse(o),_=JSON.parse(r),a=JSON.parse(e);var c={groupId:s[0]?s[0].groupId:"",operatorInfo:this._convertGroupMemberInfoList([a])[0],operation:t,operationTime:n};0===t?(i=Ze(this._convertGroupInfoList(s),1),c.groupInfo=i[0]):c.memberInfos=this._convertGroupMemberInfoList(_),this._dispatchEvent("groupOperation",c)}catch(t){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:o,membersJson:r,operatorInfo:e}))}},e.prototype._onGroupInfoChanged=function(e,t,n,o,r,i){try{var s=JSON.parse(n),a=this._convertUpdateGroupInfoList(JSON.parse(r))[0];switch(e){case M.GROUP_INFO_CHANGE:this._dispatchEvent("groupInfoChanged",{operatorInfo:this._convertGroupMemberInfoList([s])[0],operationTime:i,groupInfo:a,changedGroupInfo:a,fullGroupInfo:o?this._convertUpdateGroupInfoList(JSON.parse(o))[0]:void 0});break;case M.GROUP_REMARK_DELETE:case M.GROUP_REMARK_SET:var _=e===M.GROUP_REMARK_SET?U.ADD:U.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:t,operationType:_,operationTime:i,groupRemark:(null==a?void 0:a.remark)||""})}}catch(e){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:r,operatorInfoJson:n}))}},e.prototype._onGroupMemberInfoChanged=function(e,t,n,o){try{var r=JSON.parse(t),i=JSON.parse(n),s={groupId:e,operatorInfo:this._convertGroupMemberInfoList([r])[0],memberInfo:this._convertGroupMemberInfoList([i])[0],operationTime:o};this._dispatchEvent("groupMemberInfoChanged",s)}catch(e){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:n}))}},e.prototype._onGroupRequestChanged=function(e,t,n,o){try{var r=JSON.parse(n),i=r.groupId,s=r.joinUser,a=r.approverUser,_=r.inviterUser,c=r.type,u=r.status,E=r.direction,R=r.remark,l=je(je(je(je({groupId:i},s&&{joinMemberInfo:this._convertGroupMemberInfoList([s])[0]}),_&&_.userId&&{inviterInfo:this._convertGroupMemberInfoList([_])[0]}),a&&a.userId&&{operatorInfo:this._convertGroupMemberInfoList([a])[0]}),{status:u,direction:E,type:c,operationTime:o,reason:R});this._dispatchEvent("groupApplicationEvent",l)}catch(e){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:n}))}},e.prototype._onFavoriteMembersChanged=function(e,t,n,o){try{var r=JSON.parse(n),i=[];r&&Be(r.list)&&(i=r.list.map((function(e){return e.value}))),this._dispatchEvent("groupFollowsChangedSync",{groupId:e,operationType:t,operationTime:o,userIds:i})}catch(e){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:n}))}},e.prototype._setEntrustGroupListener=function(){kt.setEntrustGroupListener(this._onGroupOperationChanged.bind(this),this._onGroupInfoChanged.bind(this),this._onGroupMemberInfoChanged.bind(this),this._onGroupRequestChanged.bind(this),this._onFavoriteMembersChanged.bind(this))},e.prototype._onFriendApplicationStatusChanged=function(e,t,n,o,r,i){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:n,directionType:o,operationTime:r,extra:null!=i?i:""})},e.prototype._onFriendAdd=function(e,t,n,o,r){this._dispatchEvent("friendAdd",{userId:t,name:n,portraitUri:o,directionType:e,operationTime:r})},e.prototype._onFriendDelete=function(e,t,n){this._dispatchEvent("friendDelete",{userIds:t,directionType:e,operationTime:n})},e.prototype._onFriendsClearedFromServer=function(e){this._dispatchEvent("friendCleared",e)},e.prototype._onFriendInfoChangedSync=function(e,t,n){try{var o=JSON.parse(n);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:o.list})}catch(e){this.logger.error(mt.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:n}))}},e.prototype._setFriendEventListener=function(){kt.setFriendEventListener(this._onFriendApplicationStatusChanged.bind(this),this._onFriendAdd.bind(this),this._onFriendDelete.bind(this),this._onFriendsClearedFromServer.bind(this),this._onFriendInfoChangedSync.bind(this))},e.prototype.registerMessageType=function(e,t,n,o,r){var i=0;t&&(i|=1),n&&(i|=2),r&&(i=16),this._customMessageType[e]={isCounted:n,isPersited:t,isStatusMessage:r},this.logger.info(mt.P_REGTYP_O,JSON.stringify({type:e,opt:i,search:o})),this._callCppProxy("registerMessageType",e,i,o||[])},e.prototype.connect=function(e,t,n,o){return this.tcpMgr.connect(e,t,n,o)},e.prototype.reconnect=function(e,t,n){var o=W.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(e,t,n,o)},e.prototype.reportSDKInfo=function(e){var t=JSON.stringify(je(je({},e),{"electron-main":"5.14.0"}));this.logger.info(mt.P_REPORT_VER_O,t),this._callCppProxy("uploadSDKVersion",t,"")},e.prototype.disconnect=function(e){e=e||!0,this._chatroomCache.length=0,this.reporter.stop(),ln(null,this.logger),this.tcpMgr.disconnect(e)},e.prototype.logout=function(){this.disconnect()},e.prototype.setUserStatusListener=function(e,t){kt.setOnReceiveStatusListener((function(e,n){t({userId:e,status:n})}));var n=e.userIds||[];n.length&&this.subscribeUserStatus(n)},e.prototype.subscribeUserStatus=function(e){var t=this;return new Promise((function(n){t._callCppProxy("subscribeUserStatus",e,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.setUserStatus=function(e){var t=this;return new Promise((function(n){t._callCppProxy("setUserStatus",e,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.getUserStatus=function(e){var t=this;return new Promise((function(n){t._callCppProxy("getUserStatus",e,(function(e){setTimeout((function(){n({code:W.SUCCESS,data:{status:e}})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype._handleDirectionalUserIdList=function(e,t){var n=e.messageType,o=e.content,r=e.directionalUserIdList,i=void 0===r?[]:r,s=t===K.GROUP;if(n===q.READ_RECEIPT_RESPONSE&&o.receiptMessageDic&&s)for(var a in o.receiptMessageDic)i.push(a);return n===q.SYNC_READ_STATUS&&function(e){return[K.GROUP,K.DISCUSSION,K.ULTRA_GROUP,K.PUBLIC_SERVICE,K.APP_PUBLIC_SERVICE].includes(e)}(t)&&(i=[this.getCurrentUserId()]),i},e.prototype._handleMessage2Callback=function(e,t){var n=this;if("RC:MsgExMsg"===e.messageType&&this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e),e.messageType===q.READ_RECEIPT_REQUEST)this._updateReadReceiptInfo(t.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});else if(e.messageType===q.READ_RECEIPT_RESPONSE){var o=t.content.receiptMessageDic;if(!o)return;for(var r in o)o[r].forEach((function(e){n._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}},e.prototype.sendMessage=function(e,t,n,o,r){var i=this;void 0===r&&(r=this.logger.createTraceId());var s=n.messageType,a=n.content,_=n.expansion,c=n.pushConfig,u=n.pushContent,E=void 0===u?"":u,R=n.pushData,l=void 0===R?"":R,d=n.directionalUserIdList,p=void 0===d?[]:d,C=n.disableNotification,I=void 0!==C&&C,T=n.canIncludeExpansion,S=void 0!==T&&T,h=n.isVoipPush,N=void 0!==h&&h,f=n.channelId,O=void 0===f?"":f,A=n.messageId,g=void 0===A?0:A,P=n.disableUpdateLastMessage,v=void 0!==P&&P,L=c||{},m=L.iOSConfig,y=L.androidConfig,M=L.harmonyOSConfig,U=L.templateId,D=void 0===U?"":U,G=L.pushTitle,V=void 0===G?"":G,b=L.pushContent,F=void 0===b?E:b,w=L.pushData,x=void 0===w?l:w,B=L.disablePushTitle,k=void 0!==B&&B,H=L.forceShowDetailContent,J=void 0!==H&&H,Y=it(m,y,M);return new Promise((function(c){E=F,l=x;var u=(null==y?void 0:y.notificationId)||"";p=i._handleDirectionalUserIdList(n,e);var R={};for(var d in _)R[d]={v:""},R[d].v=_[d];var C=D;i.logger.info(mt.P_SEND_MSG_T,JSON.stringify({messageType:s,conversationType:e,targetId:t,channelId:O}),r);var T=i._callCppProxy("sendMessage",(function(e,t){var o=i._buildMessage(e,{isOffLineMessage:!1});if(i.logger.info(mt.P_SEND_MSG_R,JSON.stringify({code:t,messageUId:o.messageUId}),r),t===W.SENSITIVE_REPLACE)return setTimeout((function(){c({code:t})}),0);[q.READ_RECEIPT_REQUEST,q.READ_RECEIPT_RESPONSE,q.EXPANSION_NOTIFY].findIndex((function(e){return e===o.messageType}))>-1&&i._handleMessage2Callback(o,n),o.canIncludeExpansion&&i._msgExpansionHandler.setLocalFromReceiveMsg(i.logger,o),setTimeout((function(){c({code:W.SUCCESS,data:o})}),0)}),(function(e,t){var n=i._buildMessage(e,{isOffLineMessage:!1});i.logger.warn(mt.P_SEND_MSG_R,JSON.stringify({code:t,messageId:n.messageId}),r),n.sentTime=Date.now()-kt.getDeltaTime(),setTimeout((function(){c({code:t,data:n})}),0)}),e,t,s,JSON.stringify(a),p,I,k,J,E,l,u,V,Y,C,S,JSON.stringify(R),N,O,g,v),h=JSON.parse(T);null==o||o(h.messageId)}))},e.prototype.recallMsg=function(e,t,n,o,r){var i=this;return new Promise((function(s){var a,_=r.user,c=r.pushContent,u=r.channelId,E=r.extra,R=r.pushConfig,l=r.disableNotification,d=r.isDelete,p=r.directionalUserIdList,C=r.disableUpdateLastMessage,I={conversationType:e,targetId:t,messageUId:n,sentTime:o,user:_,extra:E,channelId:u,isDelete:d||!1};_&&(I.user=_),E&&(I.extra=E);var T={conversationType:e,targetId:t,senderUserId:i.tcpMgr.getCurrentUserId(),content:I,objectName:q.RECALL,messageUid:n,direction:le.SEND,status:Te.UNREAD,sentTime:o,channelId:u},S=i._buildMessage(JSON.stringify(T),{isOffLineMessage:!1});i._callCppProxy("recallMessage",(function(){i.handleRecalledMessage(S),S.pushConfig=R,setTimeout((function(){s({code:W.SUCCESS,data:S})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),q.RECALL,JSON.stringify(I),l||!1,(null==R?void 0:R.disablePushTitle)||!1,(null==R?void 0:R.forceShowDetailContent)||!1,c||"",(null==R?void 0:R.pushData)||"",(null===(a=null==R?void 0:R.androidConfig)||void 0===a?void 0:a.notificationId)||"",(null==R?void 0:R.pushTitle)||"",it(null==R?void 0:R.iOSConfig,null==R?void 0:R.androidConfig,null==R?void 0:R.harmonyOSConfig),(null==R?void 0:R.templateId)||"",u,p||[],n,null!=C&&C)}))},e.prototype.getHistoryMessage=function(e,t,n,o,r,i,s){var a=this;return new Promise((function(_){n=n||0;var c=0===r,u=o+1,E=a._callCppProxy("getHistoryMessages",e,t,n,u,s,c,i),R=JSON.parse(E).list,l=[];R.reverse();for(var d=0;d<R.length;d++){var p=a._buildMessage(R[d].obj);l[d]=p}_({code:W.SUCCESS,data:{list:u===l.length?l.slice(1,u):l,hasMore:o<l.length}})}))},e.prototype.getMessages=function(e,t,n,o,r,i){var s=this;return new Promise((function(a){var _=0===r,c=n,u=0!==n,E=o+1;u&&(c+=_?1:-1,E++);for(var R=s._callCppProxy("getMessages",e,t,c,E,_,i),l=JSON.parse(R).list,d=[],p=0;p<l.length;p++){var C=s._buildMessage(l[p].obj);d[p]=C}var I=s._computeRepairInfo(d,_,n,c,E),T=I.isNeedRepair,S=void 0!==T&&T,h=I.repairTime,N=void 0===h?0:h;if(!S)return u&&(d.shift(),E--),d.reverse(),void a({code:W.SUCCESS,data:{list:E===d.length?d.slice(1,E):d,hasMore:o<d.length}});s._processRepairHisMsg(e,t,n,o,r,i,N,a)}))},e.prototype._computeRepairInfo=function(e,t,n,o,r){var i=!1,s=0,a=this.getNaviInfoFromCache()||{},_=a.repairHisMsg,c=void 0===_?0:_,u=a.historyMsg;if(1!==c||!u)return{isNeedRepair:i,repairTime:s};var E=e.findIndex((function(e){return e.hasMore||0===Object.keys(e.content).length}));return t&&E>=0?(i=!0,s=e[E].hasMore?e[E].sentTime:e[E].sentTime+1):!t&&E>=1?(i=!0,s=e[E-1].sentTime):e.length<r||0===n?(i=!0,s=n):e.length>0&&e[0].sentTime!==n&&(i=!0,s=o),{isNeedRepair:i,repairTime:s}},e.prototype._processRepairHisMsg=function(e,t,n,o,r,i,s,a){var _=this,c=function(s){for(var c=0===r,u=o+1,E=_._callCppProxy("getMessages",e,t,n,u,c,i),R=JSON.parse(E).list,l=[],d=0;d<R.length;d++){var p=_._buildMessage(R[d].obj);l[d]=p}l.reverse(),a({code:s,data:{list:u<=l.length?l.slice(1,u):l,hasMore:o<l.length}})},u=o+10>100?100:o+10;this._callCppProxy("getRemoteHistoryMessages",e,t,s,u,(function(){return c(0)}),(function(e){c(e)}),r,!0,i,!1)},e.prototype.getContinuousMessages=function(e,t,n,o,r,i){var s=this;return new Promise((function(a){n=n||0;var _=0===r;s._callCppProxy("getContinuousMessages",e,t,n,o,(function(e,t,n){var o=JSON.parse(e).list,r=[];o.reverse();for(var i=0;i<o.length;i++){var _=s._buildMessage(o[i].obj);r[i]=_}setTimeout((function(){a({code:W.SUCCESS,data:{list:r,timestamp:t,hasMore:n}})}))}),(function(e){setTimeout((function(){a({code:e})}),0)}),_,i)}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,r,i){var s=this;return new Promise((function(a){n=n||0;s._callCppProxy("getRemoteHistoryMessages",e,t,n,o,(function(e,t){var n=JSON.parse(e).list,o=[];n.reverse();for(var r=0;r<n.length;r++){var i=s._buildMessage(n[r].obj);o[r]=i}setTimeout((function(){a({code:W.SUCCESS,data:{list:o,hasMore:!!t}})}),0)}),(function(e){setTimeout((function(){a({code:e})}),0)}),r,!0,i,!0)}))},e.prototype.deleteRemoteMessage=function(e,t,n,o){var r=this;return new Promise((function(i){var s=JSON.stringify(n);r._callCppProxy("deleteRemoteHistoryMessages",e,t,s,!1,o,(function(){setTimeout((function(){i(W.SUCCESS)}),0)}),i)}))},e.prototype.deleteRemoteMessageByTimestamp=function(e,t,n,o){var r=this;return new Promise((function(i){r._callCppProxy("clearRemoteHistoryMessages",e,t,n,(function(){setTimeout((function(){i(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){i(e)}),0)}),o)}))},e.prototype.clearMessages=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("clearMessages",e,t,n),r(W.SUCCESS)}))},e.prototype.getConversationList=function(e,t,n,o,r){var i=this;return void 0===r&&(r=""),new Promise((function(e){for(var t=i._callCppProxy("getConversationList",[1,3,6,7],r),n=JSON.parse(t).list,o=[],s=0;s<n.length;s++)o.push(i._buildConversation(n[s].obj));e({code:W.SUCCESS,data:o})}))},e.prototype.getConversation=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("getConversation",e,t,n);if(i)r({code:W.SUCCESS,data:o._buildConversation(i)});else{var s=o._callCppProxy("getHistoryMessages",e,t,0,1,"",!0,n),a=void 0;try{a=JSON.parse(s).list}catch(e){o.logger.error(mt.P_PARSE_JSON_MSGS_E,null==e?void 0:e.stack),a=[]}var _=null;a.length>0&&(_=o._buildMessage(a[0].obj));var c=o._callCppProxy("getConversationNotificationStatus",e,t,n),u=o._callCppProxy("getConversationTopStatus",e,t,n);r({code:W.SUCCESS,data:{conversationType:e,targetId:t,channelId:n,unreadMessageCount:0,latestMessage:_,notificationStatus:c?Ce.OPEN:Ce.CLOSE,isTop:Boolean(u),lastUnreadTime:0}})}}))},e.prototype.removeConversation=function(e,t,n){var o=this._callCppProxy("removeConversation",e,t,n);return Promise.resolve(o?W.SUCCESS:W.CONVER_REMOVE_ERROR)},e.prototype.batchRemoveConversation=function(e){var t=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId}})),n=this._callCppProxy("removeConversationInBatches",JSON.stringify(t));return Promise.resolve(n?W.SUCCESS:W.CONVER_REMOVE_ERROR)},e.prototype.clearConversations=function(e,t){var n=this;return new Promise((function(o){var r=[];r=Be(e)?e:[K.PRIVATE,K.GROUP,K.SYSTEM,K.PUBLIC_SERVICE],n._callCppProxy("clearConversations",r,t||""),o(W.SUCCESS)}))},e.prototype.getAllConversationUnreadCount=function(e,t,n){var o=this._callCppProxy("getTotalUnreadCount",t,n,e);return Promise.resolve({code:W.SUCCESS,data:o})},e.prototype.getConversationUnreadCount=function(e,t,n){var o=this;return void 0===n&&(n=""),new Promise((function(r){var i=o._callCppProxy("getUnreadCount",e,t,n);r({code:W.SUCCESS,data:i})}))},e.prototype.clearConversationUnreadCount=function(e,t,n){var o=this;return void 0===n&&(n=""),new Promise((function(r){o._callCppProxy("clearUnreadCount",e,t,n),r(W.SUCCESS)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var r=this;return new Promise((function(i){r._callCppProxy("clearUnreadCountByTimestamp",e,t,n,o),i(W.SUCCESS)}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("getTheFirstUnreadMessage",e,t,n),s=o._buildMessage(i);r({code:W.SUCCESS,data:-1!==s.messageId?s:null})}))},e.prototype.getFirstUnreadMessageInfo=function(e,t,n){var o=this;return new Promise((function(r,i){var s=o._callCppProxy("getTheFirstUnreadMessage",e,t,n),a=o._buildMessage(s);r({code:W.SUCCESS,data:-1!==a.messageId?{messageUId:a.messageUId,sentTime:a.sentTime}:null})}))},e.prototype.batchSetConversationToTop=function(e,t,n){var o=this;return new Promise((function(r,i){var s=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,is_top:t}}));o._callCppProxy("setIsTopInBatches",JSON.stringify(s),n||!1),r(W.SUCCESS)}))},e.prototype.setConversationStatus=function(e,t,n,o,r,i){var s=this;return new Promise((function(i){s._callCppProxy("setConversationStatus",e,t,n,o,(function(){setTimeout((function(){i(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){i(e)}),0)}),r,!0)}))},e.prototype.setConversationToTop=function(e,t,n,o,r){var i=this;return new Promise((function(r){r(i._callCppProxy("setConversationToTop",e,t,n,o,!0,!0)?W.SUCCESS:W.RC_MSG_DATA_INCOMPLETE)}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("getConversationNotificationStatus",e,t,n);r({code:W.SUCCESS,data:i?Ce.OPEN:Ce.CLOSE})}))},e.prototype.setConversationTypeNotificationLevel=function(e,t){var n=this;return new Promise((function(o,r){n._callCppProxy("setBlockPushLevelForType",e,t,(function(){o({code:W.SUCCESS})}),(function(e){o({code:e})}))}))},e.prototype.getConversationTypeNotificationLevel=function(e){var t=this;return new Promise((function(n,o){var r=t._callCppProxy("getBlockPushLevelForType",e);n({code:W.SUCCESS,data:r})}))},e.prototype.searchConversationByContent=function(e,t,n,o){var r=this;return new Promise((function(i){o=o||[1,3,6,7];for(var s=r._callCppProxy("searchConversationByContent",o,e,t,n),a=JSON.parse(s).list,_=[],c=0;c<a.length;c++)_[c]=r._buildConversation(a[c].obj);i({code:W.SUCCESS,data:_})}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n){var o=this;return new Promise((function(r){n=n||[1,3,6,7];for(var i=o._callCppProxy("searchConversationByContentWithAllChannel",n,e,t),s=JSON.parse(i).list,a=[],_=0;_<s.length;_++)a[_]=o._buildConversation(s[_].obj);r({code:W.SUCCESS,data:a})}))},e.prototype.searchMessageByContent=function(e,t,n,o,r,i,s){var a=this;return new Promise((function(i){a._callCppProxy("searchMessageByContent",e,t,n,o,r,1,(function(e,t){for(var n=e?JSON.parse(e).list:[],o=[],r=0;r<n.length;r++)o[r]=a._buildMessage(n[r].obj);setTimeout((function(){i({code:W.SUCCESS,data:{messages:o,count:t}})}),0)}),s)}))},e.prototype.searchMessageByContentAndMessageType=function(e,t,n,o,r,i,s){var a=this;return new Promise((function(_){a._callCppProxy("searchMessageByContentAndObjectName",t,e,s||"",void 0===s,n,i,r,o,1,(function(e,t){for(var n=e?JSON.parse(e).list:[],o=[],r=0;r<n.length;r++)o[r]=a._buildMessage(n[r].obj);setTimeout((function(){_({code:W.SUCCESS,data:{messages:o,count:t}})}),0)}))}))},e.prototype.searchMessagesByUser=function(e,t,n,o,r,i){var s=this;return new Promise((function(a){s._callCppProxy("getMessageBySender",e,t,n,o,r,i,(function(e){for(var t=e?JSON.parse(e).list:[],n=[],o=0;o<t.length;o++)n[o]=s._buildMessage(t[o].obj);setTimeout((function(){a({code:W.SUCCESS,data:{messages:n}})}),0)}))}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,r){var i=this;return new Promise((function(s){i._callCppProxy("searchMessageByContentWithAllChannel",e,t,n,o,r,1,(function(e,t){for(var n=e?JSON.parse(e).list:[],o=[],r=0;r<n.length;r++)o[r]=i._buildMessage(n[r].obj);setTimeout((function(){s({code:W.SUCCESS,data:{messages:o,count:t}})}),0)}))}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,r,i,s){var a=this;return new Promise((function(_){a._callCppProxy("searchMessageByTimestampWithAllChannel",e,t,n,o,r,i,s,(function(e){for(var t=e?JSON.parse(e).list:[],n=[],o=0;o<t.length;o++)n[o]=a._buildMessage(t[o].obj);setTimeout((function(){_({code:W.SUCCESS,data:{messages:n}})}),0)}))}))},e.prototype.getUnreadMentionedMessages=function(e,t,n){for(var o=JSON.parse(this._callCppProxy("getUnreadMentionedMessages",e,t,n)).list,r=0;r<o.length;r++)o[r]=this._buildMessage(o[r].obj);return o},e.prototype.addToBlacklist=function(e){var t=this;return new Promise((function(n){t._callCppProxy("addToBlacklist",e,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.removeFromBlacklist=function(e){var t=this;return new Promise((function(n){t._callCppProxy("removeFromBlacklist",e,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.getBlacklist=function(){var e=this;return new Promise((function(t){e._callCppProxy("getBlacklist",(function(e){setTimeout((function(){t({code:W.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){t({code:e})}),0)}))}))},e.prototype.getBlacklistStatus=function(e){var t=this;return new Promise((function(n){t._callCppProxy("getBlacklistStatus",e,(function(e){setTimeout((function(){n({code:W.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype.insertMessage=function(e,t,n){var o=this,r=n.content,i=n.senderUserId,s=n.messageType,a=n.messageDirection,_=n.readStatus,c=n.sentStatus,u=n.sentTime,E=n.searchContent,R=n.isUnread,l=n.messageUId,d=n.disableNotification,p=n.canIncludeExpansion,C=n.expansionMsg,I=n.channelId,T=n.directedUserIds,S=n.disableUpdateLastMessage;r=JSON.stringify(r);var h={};if(u=u||0,C){var N=JSON.parse(C);for(var f in N)h[f]={v:"",ts:0},h[f].v=N[f],h[f].ts=u}return new Promise((function(n){var C=R?0:1,N=o._callCppProxy("insertMessage",e,t,i,s,r,(function(){}),(function(e){setTimeout((function(){n({code:e})}),0)}),a,_||0,c||10,u,E||"",C,l||"",!!d,!!p,JSON.stringify(h),I||"",T||[],S||!1),f=o._buildMessage(N,{isOffLineMessage:!1});f.messageUId=l,f.sentTime=u,n({code:-1===f.messageId?W.MSG_INSERT_ERROR:W.SUCCESS,data:f})}))},e.prototype.batchInsertMessage=function(e,t){var n=this;return void 0===t&&(t=!1),new Promise((function(o){var r=e.map((function(e){var t=e.content,n=e.senderUserId,o=e.messageType,r=e.messageDirection,i=e.receivedStatus,s=void 0===i?0:i,a=e.sentStatus,_=e.sentTime,c=e.searchContent,u=e.isUnread,E=e.messageUId,R=e.disableNotification,l=e.canIncludeExpansion,d=e.expansion,p=e.channelId,C=e.conversationType,I=e.targetId,T=e.source,S=e.isMentioned,h=e.receivedStatusInfo,N=e.directedUserIds,f=e.disableUpdateLastMessage,O=s;h&&(O=function(e){var t=Te.UNREAD;return(null==e?void 0:e.isRead)&&(t|=Te.READ),(null==e?void 0:e.isListened)&&(t|=Te.LISTENED),(null==e?void 0:e.isDownload)&&(t|=Te.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=Te.RETRIEVED),t}(h));var A={};if(_=_||0,d)for(var g in d)A[g]={v:"",ts:0},A[g].v=d[g],A[g].ts=_;return{conversationType:C,targetId:I,channelId:p||"",direction:r,senderUserId:n,status:a||10,sentTime:_,objectName:o,content:JSON.stringify(t),messageUid:E||"",noNotification:!!R,supportExt:!!l,extMsg:JSON.stringify(A),readStatus:O,searchContent:c||"",isUnread:!!u,source:T||"",isMention:S,directedUsers:N,disableUpdateLastMessage:f||!1}})),i=n._callCppProxy("insertMessages",JSON.stringify(r),t);o({code:i?W.SUCCESS:W.MSG_INSERT_ERROR,data:i||!1})}))},e.prototype.getMessageCount=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("getMessageCount",e,t,n);r({code:W.SUCCESS,data:i})}))},e.prototype.deleteMessages=function(e){var t=this;return new Promise((function(n){t._callCppProxy("deleteMessages",e),n(W.SUCCESS)}))},e.prototype.deleteMessagesByTimestamp=function(e,t,n,o,r){var i=this;return new Promise((function(s){i._callCppProxy("deleteMessagesByTimestamp",e,t,n,o,r),s(W.SUCCESS)}))},e.prototype.batchClearMessagesByTimestamp=function(e){var t=this;return new Promise((function(n,o){var r=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}}));t._callCppProxy("deleteMessageBySendTimeInBatches",JSON.stringify(r)),n(W.SUCCESS)}))},e.prototype.batchClearRemoteHistoryMessages=function(e,t){var n=this;return new Promise((function(o,r){var i=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}}));n._callCppProxy("deleteRemoteMessageBySendTimeInBatches",JSON.stringify(i),t||!1,(function(){setTimeout((function(){o(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){o(e)}),0)}))}))},e.prototype.getMessage=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("getMessage",e),r=t._buildMessage(o,{isOffLineMessage:!1});n({code:W.SUCCESS,data:r})}))},e.prototype.setMessageContent=function(e,t,n){var o=this;return new Promise((function(r){t=JSON.stringify(t),o._callCppProxy("setMessageContent",e,t,n),r(W.SUCCESS)}))},e.prototype.setMessageSearchField=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("setMessageSearchField",e,t,n),r(W.SUCCESS)}))},e.prototype.setMessageSentStatus=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("setMessageSentStatus",e,t),o(W.SUCCESS)}))},e.prototype.setMessageReceivedStatus=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("setMessageReceivedStatus",e,t),o(W.SUCCESS)}))},e.prototype.saveConversationMessageDraft=function(e,t,n,o){var r=this;return new Promise((function(i){r._callCppProxy("saveTextMessageDraft",e,t,n,o||"")&&i(W.SUCCESS),i(W.DRAFT_SAVE_ERROR)}))},e.prototype.getConversationMessageDraft=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("getTextMessageDraft",e,t,n||"");r({code:W.SUCCESS,data:i})}))},e.prototype.clearConversationMessageDraft=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("clearTextMessageDraft",e,t,n||"")&&r(W.SUCCESS),r(W.DRAFT_REMOVE_ERROR)}))},e.prototype.pullConversationStatus=function(e){throw new Error("Method not implemented.")},e.prototype.batchSetConversationStatus=function(e){var t=e[0],n=t.conversationType,o=t.targetId,r=t.isTop,i=t.notificationStatus,s=t.channelId,a=t.isUpdateTime,_=void 0===a||a,c=this._callCppProxy("getConversationNotificationStatus",n,o,s||""),u=this._callCppProxy("getConversationTopStatus",n,o,s||""),E=He(i)?Boolean(c):i===Ce.OPEN,R=He(r)?Boolean(u):r;return this.setConversationStatus(n,o,E,R,s,_)},e.prototype.getConversationNotificationLevel=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o;return Qe(this,(function(r){return o=this._callCppProxy("getBlockPushLevelForConversation",t,n,e),[2,Promise.resolve({code:W.SUCCESS,data:o})]}))}))},e.prototype.setConversationNotificationLevel=function(e,t,n,o){var r=this;return void 0===o&&(o=""),new Promise((function(i){r._callCppProxy("setBlockPushLevelForConversation",t,o,e,n,(function(){setTimeout((function(){i(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){i(e)}),0)}))}))},e.prototype.batchSetConversationNotificationLevel=function(e,t){var n=this;return new Promise((function(o,r){var i=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:t}}));n._callCppProxy("setBlockPushLevelInBatches",JSON.stringify(i),(function(){setTimeout((function(){o(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){o(e)}),0)}))}))},e.prototype.getTotalUnreadCountByLevels=function(e,t,n){if(n){var o=this._callCppProxy("getUnreadMentionedCountByLevel",e,t);return Promise.resolve({code:W.SUCCESS,data:o})}var r=this._callCppProxy("getUnreadCountByLevel",e,t);return Promise.resolve({code:W.SUCCESS,data:r})},e.prototype.pullUserSettings=function(e){throw new Error("Method not implemented.")},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("sendReadReceipt",e,n||"",t,(function(){t.forEach((function(e){o._updateReadReceiptInfo(e,{hasRespond:!0});try{var t=JSON.parse(o._callCppProxy("getMessage",e)).messageId;o.setMessageReceivedStatus(t,1)}catch(t){o.logger.error(mt.P_PARSE_JSON_MSGS_E,JSON.stringify({messageUId:e,error:null==t?void 0:t.stack}))}})),setTimeout((function(){r({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.getMessageReader=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("getMessageReader",e,n,t,(function(e,n){var i=[],s={};(e=JSON.parse(e)).list.forEach((function(e){var t=JSON.parse(e.obj),n=t.id,o=t.time;i.push({userId:n,readTime:o}),s[n]=o}));var a={readerInfo:s,readCount:i.length,totalCount:n};o._updateReadReceiptInfo(t,a),setTimeout((function(){r({code:W.SUCCESS,data:{list:i,totalMemberCount:n}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.sendReadReceiptMessageV4=function(e,t,n){var o=this;return new Promise((function(r){var i=e.conversationType,s=e.targetId,a=e.channelId;o._callCppProxy("sendMessageReadReceipt",i,s,a||"",t,n,(function(){setTimeout((function(){r({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.getMessageReadReceiptV4=function(e,t){var n=this;return new Promise((function(o){var r=e.targetId,i=e.channelId;n._callCppProxy("getMessageReadReceipt",r,i||"",t,(function(e,r,i){var s=[],a=n._callCppProxy("getMessage",t),_=JSON.parse(a);try{JSON.parse(i).list.forEach((function(e){var t=JSON.parse(e.obj),n=t.id,o=t.time;s.push({userId:n,readTime:o})}))}catch(e){n.logger.error(mt.P_PARSE_JSON_E,"method: getMessageReadReceipt, info: ".concat(i,", error: ").concat(e))}var c=JSON.parse(_.readReceiptRequest||"{}"),u=c.readerList,E=void 0===u?[]:u,R=c.readCount,l=void 0===R?0:R,d=!1;E.length<s.length&&(E=s,d=!0),l<r&&(l=r,d=!0),d&&n._callCppProxy("updateReadReceiptRequestInfo",t,JSON.stringify({readerList:E,readCount:l,totalCount:e})),setTimeout((function(){o({code:W.SUCCESS,data:{list:s,totalCount:e,readCount:l}})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype.updateConversationReadTime=function(e,t){var n=this;return new Promise((function(o){var r=e.conversationType,i=e.targetId,s=e.channelId;n._callCppProxy("updateConversationReadTime",r,i,s||"",t,(function(){setTimeout((function(){o({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype._addChatroomCache=function(e,t,n,o){this._rmChatroomCache(e),this._chatroomCache.push({chatroomId:e,joinExist:n,count:t,extra:o})},e.prototype._rmChatroomCache=function(e){this._chatroomCache=this._chatroomCache.filter((function(t){return t.chatroomId!==e}))},e.prototype._try2RejoinChatroom=function(){var e=this;if(0!==this._chatroomCache.length){var t=this.logger.createTraceId();this._chatroomCache.forEach((function(n){return Xe(e,void 0,void 0,(function(){var e,o,r,i,s,a,_;return Qe(this,(function(c){switch(c.label){case 0:return e=n.chatroomId,o=n.joinExist,r=n.count,i=n.extra,this.logger.info(C.L_REJOIN_CHATROOM_T,e,t),[4,this._joinChrm(e,r,o,!1,i)];case 1:return s=c.sent(),a=s.code,_=s.data,a===W.SUCCESS?(this.logger.info(C.L_REJOIN_CHATROOM_R,e,t),this._sendChatroomStatus({rejoinedRoom:je({chatroomId:e,count:r},_)}),[2]):(a===W.RC_CHATROOM_USER_KICKED&&this._rmChatroomCache(e),this._sendChatroomStatus({rejoinedRoom:{chatroomId:e,errorCode:a}}),this.logger.warn(C.L_REJOIN_CHATROOM_R,"chrmId: ".concat(e,", code: ").concat(a),t),[2])}}))}))}))}},e.prototype._joinChrm=function(e,t,n,o,r){var i=this,s=n?"joinExistChatRoom":"joinChatRoom";return new Promise((function(a){o&&i._callCppProxy("clearMessages",K.CHATROOM,e,""),i._callCppProxy(s,e,t,(function(o,s,_,c,u,E,R){i._addChatroomCache(e,t,n,r||""),setTimeout((function(){a({code:W.SUCCESS,data:{createTime:Number(o),memberCount:s,isAllChatroomBanned:_,isCurrentUserBanned:c,isCurrentChatroomBanned:u,isCurrentChatroomInWhitelist:E,joinTime:R}})}),0)}),(function(e){setTimeout((function(){a({code:e})}),0)}),r||"")}))},e.prototype.joinChatroom=function(e,t,n){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(o){switch(o.label){case 0:return[4,this._joinChrm(e,t,!1,!0,n)];case 1:return[2,o.sent().code]}}))}))},e.prototype.joinExistChatroom=function(e,t,n){return this._joinChrm(e,t,!0,!0,n)},e.prototype.quitChatroom=function(e){var t=this;return this._rmChatroomCache(e),new Promise((function(n){t._callCppProxy("quitChatRoom",e,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.getChatroomInfo=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("getChatroomInfo",e,t,n,(function(e,t){var n=e?JSON.parse(e).list:[],o=[];if(n.length>0)for(var i=0;i<n.length;i++)o.push(JSON.parse(n[i].obj));setTimeout((function(){r({code:W.SUCCESS,data:{userInfos:o,userCount:t}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.getChatroomHistoryMessages=function(e,t,n,o){var r=this;return new Promise((function(i){r._callCppProxy("getChatroomHistoryMessage",e,t,n,o,(function(e){var t;try{t=JSON.parse(e)}catch(e){t={list:[],hasMore:!1}}var n=t.list;if(n&&n.length)try{t.list=n.map((function(e){return r._buildMessage(e.obj)}))}catch(e){t.list=[]}setTimeout((function(){i({code:W.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}),"")}))},e.prototype.setChatroomEntry=function(e,t){var n=this;return new Promise((function(o){var r='[{"key":"'.concat(t.key,'", "value":"').concat(t.value,'"}]');n._callCppProxy("setChatroomKV",e,r,!!t.isAutoDelete,!!t.isOverwrite,(function(){setTimeout((function(){o(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){o(e)}),0)}))}))},e.prototype.setChatroomEntries=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("setChatroomKV",e,JSON.stringify(t.entries),!!t.isAutoDelete,!!t.isOverwrite,(function(){o({code:W.SUCCESS})}),(function(e){o({code:e})}))}))},e.prototype.forceSetChatroomEntry=function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.setChatroomEntry(e,t)},e.prototype.removeChatroomEntry=function(e,t){var n=this,o=[t.key];return new Promise((function(r){n._callCppProxy("deleteChatroomKV",e,o,!!t.isOverwrite,(function(){r(W.SUCCESS)}),(function(e){r(e)}))}))},e.prototype.forceRemoveChatroomEntry=function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.removeChatroomEntry(e,t)},e.prototype.removeChatroomEntries=function(e,t){var n=this;return new Promise((function(o){var r=t.entries.map((function(e){return e.key}));n._callCppProxy("deleteChatroomKV",e,r,!!t.isOverwrite,(function(){o({code:W.SUCCESS})}),(function(e){o({code:e})}))}))},e.prototype.getChatroomEntry=function(e,t){return Xe(this,void 0,void 0,(function(){var n,o,r;return Qe(this,(function(i){switch(i.label){case 0:return[4,this.getAllChatroomEntry(e)];case 1:return n=i.sent(),o=n.code,r=n.data,o!==W.SUCCESS?[2,{code:o}]:r&&r[t]?[2,{code:o,data:r[t]}]:[2,{code:W.CHATROOM_KEY_NOT_EXIST}]}}))}))},e.prototype.getAllChatroomEntry=function(e){var t=this;return new Promise((function(n){t._callCppProxy("getChatroomKV",e,(function(e){var t={};try{(e?JSON.parse(e):{list:[]}).list.map((function(e){return JSON.parse(e.obj)})).forEach((function(e){t[e.key]=e.value?e.value:""}))}catch(e){}setTimeout((function(){n({code:W.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype.removeChatroomFromCatch=function(e){this._rmChatroomCache(e)},e.prototype.getFileToken=function(e,t,n,o,r,i){var s=this;return n=n||"",o=o||"",r=r||"",new Promise((function(a){var _;_=o&&"uploads"!==o?t||"":rt(e,t);var c=s.getNaviInfoFromCache(),u={uploadDomain:_t(c,s.logger),env:s._environment};i=i?Math.ceil(i):0,s._callCppProxy("getUploadToken",e,_,n,o,r,JSON.stringify(u),i,(function(e,t,n,o,r,i,s,c,u,E,R,l,d,p,C,I,T,S,h,N,f,O,A){setTimeout((function(){a({code:W.SUCCESS,data:{token:e,deadline:0,bosToken:t,bosDate:n,path:o,osskeyId:r,ossPolicy:i,ossSign:s,ossBucketName:c,fileName:_,s3Credential:u,s3Algorithm:E,s3Date:R,s3Policy:l,s3Signature:d,s3BucketName:p,stcAuthorization:C,stcContentSha256:I,stcDate:T,stcBucketName:S,minioAuthorization:h,minioContentSha256:N,minioDate:f,minioBucketName:O,downloadAuthInfo:A?JSON.parse(A):null}})}),0)}),(function(e){setTimeout((function(){a({code:e})}),0)}))}))},e.prototype.getFileUrl=function(e,t,n,o){var r=this;return new Promise((function(i){var s=r.getNaviInfoFromCache(),a={url:_t(s,r.logger)};r._callCppProxy("getDownloadUrl",e,n,o,t-1,JSON.stringify(a),-1,(function(e){setTimeout((function(){i({code:W.SUCCESS,data:{downloadUrl:e}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))},e.prototype.clearData=function(){var e=this;return new Promise((function(t){var n=e._callCppProxy("clearData");t({code:W.SUCCESS,data:n})}))},e.prototype.getDeviceId=function(){var e=this._dbpath;return Ln(e)},e.prototype.getVoIPKey=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("getVoIPKey",e,t,"",(function(e){setTimeout((function(){o({code:W.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype.bindRTCRoomForChatroom=function(e){var t=this;return new Promise((function(n){var o=e.chatRoomId,r=e.rtcRoomId;t._callCppProxy("bindRTCRoomForChatroom",o,r,(function(){setTimeout((function(){n(W.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("getGroupMessageDeliverList",e,n,t,(function(e,t){var n=JSON.parse(e).list.map((function(e){return{time:JSON.parse(e.obj).time,userId:JSON.parse(e.obj).id}}));setTimeout((function(){r({code:W.SUCCESS,data:{totalCount:t,list:n}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;return new Promise((function(o){var r=n._callCppProxy("getMessageDeliverTime",e);if(r)o({code:W.SUCCESS,data:r});else{n._callCppProxy("getPrivateMessageDeliverList",t,e,(function(e){var t=0,n=JSON.parse(e).list;if(n.length>0){var r=JSON.parse(n[0].obj).time;t=r}setTimeout((function(){o({code:W.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}}))},e.prototype.rtcSignaling=function(e,t,n,o){var r=this;return new Promise((function(i){r._callCppProxy("rtcSignaling",e,t,n,o,(function(e){var t=Array.prototype.slice.call(e);i({code:W.SUCCESS,buffer:t})}),(function(e){i({code:e})}),30)}))},e.prototype._setRTCHeartbeatListener=function(){var e=this;kt.setRTCHeartbeatListener((function(t,n){var o=e.rtcHeartbeatResolves[t];if(o){var r=o.find((function(e){return""===e.seqId}));r&&(r.seqId=n)}}),(function(t,n,o,r){var i=e.rtcHeartbeatResolves[t];if(i){var s=i.findIndex((function(e){return e.seqId===o}));-1!==s&&i.splice(s,1)[0].resolve({code:n,data:{version:Number(r)}})}}))},e.prototype.rtcPing=function(e,t,n){var o=this;return new Promise((function(t){var n={resolve:t,seqId:""},r=o.rtcHeartbeatResolves[e];r?r.push(n):o.rtcHeartbeatResolves[e]=[n],o._callCppProxy("sendRTCHeartbeat",[e],30)}))},e.prototype.createTag=function(e){var t=this;return new Promise((function(n){t._callCppProxy("addTag",e.tagId,e.tagName,(function(){setTimeout((function(){n({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype.removeTag=function(e){var t=this;return new Promise((function(n){t._callCppProxy("deleteTag",e,(function(){setTimeout((function(){n({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype.updateTag=function(e){var t=this;return new Promise((function(n){t._callCppProxy("renameTag",e.tagId,e.tagName,(function(){setTimeout((function(){n({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))},e.prototype.getTagList=function(){var e=this;return new Promise((function(t){var n=e._callCppProxy("getTags"),o=e._convertResultList(n,(function(e){return{tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime}}));t({code:W.SUCCESS,data:o})}))},e.prototype.addTagForConversations=function(e,t){var n=this;return new Promise((function(o){t.forEach((function(e){e.conversationType&&(e.type=e.conversationType)}));n._callCppProxy("addConversationsForTag",e,JSON.stringify(t),(function(){setTimeout((function(){o({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype.removeTagForConversations=function(e,t){var n=this;return new Promise((function(o){t.forEach((function(e){e.conversationType&&(e.type=e.conversationType)})),n._callCppProxy("removeConversationsForTag",e,JSON.stringify(t),(function(){setTimeout((function(){o({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype.removeTagsForConversation=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("removeTagsForConversation",e.conversationType,e.targetId,e.channelId||"",t,(function(){setTimeout((function(){o({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){o({code:e})}),0)}))}))},e.prototype.getConversationListByTag=function(e,t,n,o){var r=this;return new Promise((function(i){var s=r._callCppProxy("getConversationsForTagByPage",e,t,n||20,o||""),a=r._convertResultList(s,(function(e){return je(je({},r._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})}));i({code:W.SUCCESS,data:a})}))},e.prototype.getUnreadCountByTag=function(e,t){var n=this;return new Promise((function(o){var r=n._callCppProxy("getConversationUnreadCountForTag",e,t);o({code:W.SUCCESS,data:r})}))},e.prototype.setConversationStatusInTag=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("setConversationToTopForTag",e,t.conversationType,t.targetId,t.channelId||"",n.isTop||!1,(function(){setTimeout((function(){r({code:W.SUCCESS})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.getTagsForConversation=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("getTagsForConversation",e.conversationType,e.targetId,e.channelId||""),r=t._convertResultList(o,(function(e){return{tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime}}));n({code:W.SUCCESS,data:r})}))},e.prototype.getBlockConversationList=function(){throw new Error("Method not implemented.")},e.prototype.getTopConversationList=function(e,t){var n=this;return new Promise((function(o){var r=He(t)?n._callCppProxy("getTopConversations",e):n._callCppProxy("getTopConversations",e,t),i=JSON.parse(r).list.map((function(e){return n._buildConversation(e.obj)}));o({code:W.SUCCESS,data:i})}))},e.prototype.getUnreadMentionedCount=function(e){throw new Error("Method not implemented.")},e.prototype.getAllUnreadMentionedCount=function(){var e=this;return new Promise((function(t){var n=e._callCppProxy("getUnreadAndMentionCount",[K.GROUP],"");t({code:W.SUCCESS,data:n})}))},e.prototype.getOSInfo=function(){return Xe(this,void 0,void 0,(function(){var e;return Qe(this,(function(t){return e={arch:me.arch(),platform:me.platform(),type:me.type(),version:me.version(),release:me.release(),uptime:me.uptime(),cpus:me.cpus(),freemem:me.freemem(),totalmem:me.totalmem(),networkInterfaces:me.networkInterfaces()},[2,{code:W.SUCCESS,data:e}]}))}))},e.prototype.getMainProcessInfo=function(){return Xe(this,void 0,void 0,(function(){return Qe(this,(function(e){return[2,{code:W.SUCCESS,data:{title:process.title,pid:process.pid,ppid:process.ppid,platform:process.platform,arch:process.arch,uptime:process.uptime(),cpuUsage:process.cpuUsage(),memoryUsage:process.memoryUsage(),resourceUsage:process.resourceUsage()}}]}))}))},e.prototype.setCallInfo=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("callInfoSignaling",e,t,n,(function(e,t){setTimeout((function(){r({code:W.SUCCESS,data:{key:e,value:t}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))},e.prototype.setProxy=function(e){return this.tcpMgr.getConnectionStatus()!==ue.DISCONNECTED?Promise.resolve({code:W.RC_CONN_PROXY_UNAVAILABLE}):Promise.resolve(ln(e,this.logger))},e.prototype.getProxy=function(){return Promise.resolve(dn())},e.prototype.testProxy=function(e,t){return function(e,t,n){return new Promise((function(o){var r=/^https/.test(t)?un:an;n.info(C.A_TEST_PROXY_O,JSON.stringify({msg:"test proxy",proxy:e,testHost:t}));var i=r(t,e,(function(e){var t=200===e.statusCode?0:e.statusCode;e.setEncoding("utf8");var n="";e.on("data",(function(e){n+=e})),e.once("end",(function(){o({status:t||0,data:n})}))}));i.once("timeout",(function(){return o({status:0})})),i.once("error",(function(e){return o({status:0,data:e.stack})})),i.end()}))}(e,t,this.logger)},e.prototype.checkDuplicateMessage=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("checkDuplicateMessage",e);n({code:W.SUCCESS,data:o})}))},e.prototype.subscribeUser=function(e,t,n){var o=this;return new Promise((function(r){o._callCppProxy("updateSubscribeStatus",t,_e.SUBSCRIBE,e,(function(){r({code:W.SUCCESS})}),(function(e,t){r({code:e,data:t})}),n)}))},e.prototype.unSubscribeUser=function(e,t){var n=this;return new Promise((function(o){n._callCppProxy("updateSubscribeStatus",t,_e.UNSUBSCRIBE,e,(function(){o({code:W.SUCCESS})}),(function(e){o({code:e})}),0)}))},e.prototype.getSubscribeUserList=function(e,t,n){var o=this._callCppProxy("getSubscribeUserList",e,t,n),r=this._buildSubscribeEventData(o).map((function(e){var t=e.userId,n=e.subscribeType,o=e.subscribeTime,r=e.expiry,i=e.details,s={userId:t,subscribeType:n,subscribeTime:o,expiry:r};return n===ae.ONLINE_STATUS&&(s.details=et(i)),s}));return Promise.resolve({code:W.SUCCESS,data:r})},e.prototype.setDuplicateMessageConfig=function(e){var t=this._callCppProxy("setDuplicateMessageConfig",[K.CHATROOM],Fn.cuid,e);return Promise.resolve({code:t})},e.prototype.getSubscribeUserStatus=function(e,t){var n=this._callCppProxy("getSubscribeStatusByUserIds",e,t),o=this._buildSubscribeEventData(n).map((function(e){var t=e.userId,n=e.subscribeType,o=e.subscribeTime,r=e.expiry,i=e.details,s={userId:t,subscribeType:n,subscribeTime:o,expiry:r};return n===ae.ONLINE_STATUS&&(s.details=et(i)),s}));return Promise.resolve({code:W.SUCCESS,data:o})},e.prototype.updateMyUserProfile=function(e){var t=this;return new Promise((function(n){var o=[],r=[];Object.keys(e).forEach((function(t){var n;if("extraProfile"===t&&e.extraProfile){if(e.extraProfile){var i=e.extraProfile;Object.keys(i).forEach((function(e){r.push(JSON.stringify({key:e,value:i[e]||""}))}))}}else o.push(JSON.stringify({key:t,value:(null===(n=e[t])||void 0===n?void 0:n.toString())||""}))})),t._callCppProxy("updateUserProfile",o,r,(function(e,t){n({code:e,data:{errorKey:t}})}))}))},e.prototype.getUserProfiles=function(e){var t=this;return new Promise((function(n){t._callCppProxy("getUserProfiles",e,(function(e,o){n({code:e,data:t._string2UserProfileInfoList(o)})}))}))},e.prototype.getMyUserProfile=function(){var e=this;return new Promise((function(t){e._callCppProxy("getOwnUserProfile",(function(n,o){t({code:n,data:e._string2userProfileInfo(o)})}))}))},e.prototype._string2userProfileInfo=function(e){var t;try{var n=JSON.parse(e),o=n.userProfile.reduce((function(e,t){var n=JSON.parse(t);return["gender","role","level"].includes(n.key)?e[n.key]=Number(n.value):e[n.key]=n.value,e}),{});return o.userId=n.userId,o.extraProfile=(null===(t=n.userExtProfile)||void 0===t?void 0:t.reduce((function(e,t){var n=JSON.parse(t);return e[n.key]=n.value,e}),{}))||{},o}catch(t){this.logger.error(mt.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}},e.prototype._string2UserProfileInfoList=function(e){var t=this;try{return JSON.parse(e).list.map((function(e){return t._string2userProfileInfo(e.obj)}))}catch(t){this.logger.error(mt.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]},e.prototype.updateMyUserProfileVisibility=function(e){var t=this;return new Promise((function(n){t._callCppProxy("updateUserProfilePermission",e,(function(){n({code:W.SUCCESS})}),(function(e){n({code:e})}))}))},e.prototype.getMyUserProfileVisibility=function(){var e=this;return new Promise((function(t){e._callCppProxy("getUserProfilePermission",(function(e,n){t({code:e,data:n})}))}))},e.prototype.searchUserProfileByUniqueId=function(e){var t=this;return new Promise((function(n){t._callCppProxy("getUserProfileByUniqueId",e,(function(e,o){n({code:e,data:t._string2userProfileInfo(o)})}))}))},e.prototype.getMatchedMessage=function(e,t,n,o){var r,i=this._callCppProxy("getMatchedMessage",e.conversationType,e.targetId,t,n,o,e.channelId||""),s=[];try{r=JSON.parse(i).list;for(var a=0;a<r.length;a++){var _=this._buildMessage(r[a].obj);s.push(_)}}catch(e){return this.logger.error(mt.P_PARSE_JSON_MSGS_E,i),Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:s})},e.prototype.getConversations=function(e){var t,n=this,o=e.map((function(e){var t=e.conversationType,n=e.targetId,o=e.channelId;return{targetId:n,channelId:void 0===o?"":o,type:t}})),r=this._callCppProxy("getConversations",JSON.stringify(o));try{t=JSON.parse(r).list.map((function(e){return n._buildConversation(e.obj)}))}catch(e){return this.logger.error(mt.P_PARSE_JSON_MSGS_E,r),Promise.resolve({code:W.MAIN_PROCESS_ERROR})}return Promise.resolve({code:W.SUCCESS,data:t})},e.prototype.handleErrorCode=function(e,t){e!==W.SUCCESS&&setTimeout((function(){return t(Ct(e))}),0)},e.prototype._convertGroupInfoList=function(e,t){return e&&0!==e.length?e.map((function(e){var t=e.groupId,n=e.baseInfo,o=e.createTime,r=e.createUserId,i=e.extraInfo,s=e.memberCount,a=e.ownerId,_=e.remark,c=e.joinTime,u=e.role,E=ot(n),R=ot(i);return{groupId:t,groupName:E.name||"",portraitUri:E.portraitUrl||"",introduction:E.introduction||"",notice:E.announcement||"",joinPermission:~~E.joinPerm,removeMemberPermission:~~E.removePerm,invitePermission:~~E.memInvitePerm,inviteHandlePermission:~~E.invitePerm,groupInfoEditPermission:~~E.profilePerm,memberInfoEditPermission:~~E.memProfilePerm,extProfile:R,creatorId:r||"",ownerId:a||"",createTime:o||0,membersCount:s||0,remark:_||"",joinedTime:c||0,role:u||m.UNDEF}})):[]},e.prototype._convertUpdateGroupInfoList=function(e){return e&&0!==e.length?e.map((function(e){var t=e.groupId,n=e.baseInfo,o=e.createTime,r=e.createUserId,i=e.extraInfo,s=e.memberCount,a=e.ownerId,_=e.remark,c=e.joinTime,u=e.role,E=ot(n),R=ot(i);return je(je(je(je(je(je(je(je(je({groupId:t},function(e){return je(je(je(je(je(je(je(je(je(je({},e.name&&{groupName:e.name}),e.portraitUrl&&{portraitUri:e.portraitUrl}),e.introduction&&{introduction:e.introduction}),e.announcement&&{notice:e.announcement}),e.joinPerm&&{joinPermission:~~e.joinPerm}),e.removePerm&&{removeMemberPermission:~~e.removePerm}),e.memInvitePerm&&{invitePermission:~~e.memInvitePerm}),e.invitePerm&&{inviteHandlePermission:~~e.invitePerm}),e.profilePerm&&{groupInfoEditPermission:~~e.profilePerm}),e.memProfilePerm&&{memberInfoEditPermission:~~e.memProfilePerm})}(E)),i.length>0&&{extProfile:R}),r&&{creatorId:r}),a&&{ownerId:a}),o&&{createTime:o}),s&&{membersCount:s}),_&&{remark:_}),c&&{joinedTime:c}),u&&{role:u})})):[]},e.prototype._convertGroupMemberInfoList=function(e){return e&&0!==e.length?e.map((function(e){var t=e.userId,n=e.nickname,o=e.groupNickname,r=e.portraitUrl,i=e.joinTime;return{userId:t,name:n||"",portraitUri:r||"",nickname:o||"",role:e.role||0,joinedTime:i||0,extra:e.extra||""}})):[]},e.prototype.createGroup=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r=this;return Qe(this,(function(i){return[2,new Promise((function(i){var s=Gn(t),a=Gn(n||{}),_=r._callCppProxy("createGroup",e,o,JSON.stringify(s),JSON.stringify(a),(function(e,t,n){e===W.SUCCESS?setTimeout((function(){i({code:e,data:{processCode:t}})}),0):setTimeout((function(){i({code:e,msg:null!=n?n:""})}),0)}));r.handleErrorCode(_,i)}))]}))}))},e.prototype.updateGroupInfo=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=Gn(t),s=Gn(null!=n?n:{}),a=o._callCppProxy("updateGroupInfo",e,JSON.stringify(i),JSON.stringify(s),(function(e,t){e===W.SUCCESS?setTimeout((function(){r({code:e})}),0):setTimeout((function(){r({code:e,msg:null!=t?t:""})}),0)}));o.handleErrorCode(a,r)}))]}))}))},e.prototype.getGroupsInfo=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=t._callCppProxy("getGroupInfoByIds",e,(function(e,o,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){t.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){n({code:W.MAIN_PROCESS_ERROR})}),0)}setTimeout((function(){n({code:W.SUCCESS,data:t._convertGroupInfoList(s)})}),0)}else setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))]}))}))},e.prototype.kickGroupMembers=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=Vn(n),s=o._callCppProxy("kickOutGroupMember",e,t,JSON.stringify(i),(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(s,r)}))]}))}))},e.prototype.quitGroup=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=Vn(t),i=n._callCppProxy("quitGroup",e,JSON.stringify(r),(function(e,t){setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(i,o)}))]}))}))},e.prototype.dismissGroup=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=t._callCppProxy("disbandGroup",e,(function(e,t){setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))]}))}))},e.prototype.transferGroupOwner=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r=this;return Qe(this,(function(i){return[2,new Promise((function(i){var s=Vn(o),a=r._callCppProxy("transferGroup",e,t,n,JSON.stringify(s),(function(e,t){setTimeout((function(){i({code:e})}),0)}));r.handleErrorCode(a,i)}))]}))}))},e.prototype.setGroupManagers=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=o._callCppProxy("updateGroupAdmins",t,n,e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(i,r)}))]}))}))},e.prototype.getGroupMembersByRole=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=t===m.UNDEF?[1,2,3]:[t],s=o._callCppProxy("getGroupMembers",e,i,n.pageToken||"",n.count,n.order?1:0,(function(e,t,n,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){o.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){r({code:W.MAIN_PROCESS_ERROR})}),0)}var a=o._convertGroupMemberInfoList(s);setTimeout((function(){r({code:W.SUCCESS,data:{totalCount:null!=n?n:0,data:a,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(s,r)}))]}))}))},e.prototype.getGroupMembers=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=n._callCppProxy("getGroupMembersByIds",e,t,(function(e,t,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){n.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){o({code:W.MAIN_PROCESS_ERROR})}),0)}var a=n._convertGroupMemberInfoList(s);setTimeout((function(){o({code:W.SUCCESS,data:a})}),0)}else setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(r,o)}))]}))}))},e.prototype.setGroupMemberInfo=function(e,t,n,o){return Xe(this,void 0,void 0,(function(){var r=this;return Qe(this,(function(i){return[2,new Promise((function(i){var s=r._callCppProxy("updateGroupMemberInfo",e,t,n,o||"",(function(e,t){setTimeout((function(){i({code:e})}),0)}));r.handleErrorCode(s,i)}))]}))}))},e.prototype.searchGroupMembers=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=n.order?1:0,s=o._callCppProxy("getGroupMembersByNickname",e,t,n.pageToken||"",n.count,i,(function(e,t,n,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){o.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){r({code:W.MAIN_PROCESS_ERROR})}),0)}var a=o._convertGroupMemberInfoList(s);setTimeout((function(){r({code:W.SUCCESS,data:{data:a,pageToken:t,totalCount:n}})}),0)}else setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(s,r)}))]}))}))},e.prototype.joinGroup=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=t._callCppProxy("joinGroup",e,(function(e,t,o){e===W.SUCCESS?setTimeout((function(){n({code:e,data:{processCode:t}})}),0):setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))]}))}))},e.prototype.inviteUsersToGroup=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=n._callCppProxy("inviteUsersToGroup",e,t,(function(e,t,n){e===W.SUCCESS?setTimeout((function(){o({code:e,data:{processCode:t}})}),0):setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(r,o)}))]}))}))},e.prototype.memberInviteResponse=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=e.groupId,r=e.inviterId,i=e.optType,s=e.optResult,a=e.joinUserId,_=e.reason,c=1===i?1:0,u=c&&a?a:"",E=t._callCppProxy("handleGroupInvite",o,u,r,s,c,null!=_?_:"",(function(e,t,o){e===W.SUCCESS?setTimeout((function(){n({code:e,data:{processCode:t}})}),0):setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(E,n)}))]}))}))},e.prototype.getGroupApplications=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=e.order?1:0,s=o._callCppProxy("getGroupRequests",t,n,"",e.pageToken||"",e.count,i,(function(e,t,n,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){o.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){r({code:W.MAIN_PROCESS_ERROR})}),0)}var a=s.map((function(e){var t=e.groupId,n=e.joinUser,o=e.approverUser,r=e.inviterUser,i=e.type;return{groupId:t,joinMemberInfo:n,inviterInfo:r,operatorInfo:o,status:e.status,direction:e.direction,type:i,operationTime:e.operateTime,reason:e.remark}}));setTimeout((function(){r({code:e,data:{totalCount:n,data:a,pageToken:t}})}),0)}else setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(s,r)}))]}))}))},e.prototype.getJoinedGroupsByRole=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=t.order?1:0,i=e===m.UNDEF?[1,2,3]:[e],s=n._callCppProxy("getGroups",i,t.pageToken||"",t.count,r,(function(e,t,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){n.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){o({code:W.MAIN_PROCESS_ERROR})}),0)}var a=n._convertGroupInfoList(s);setTimeout((function(){o({code:e,data:{totalCount:r,data:a,pageToken:t}})}),0)}else setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(s,o)}))]}))}))},e.prototype.searchJoinedGroups=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=t.order?1:0,i=n._callCppProxy("getGroupsByGroupName",e,t.pageToken||"",t.count,r,(function(e,t,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){n.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){o({code:W.MAIN_PROCESS_ERROR})}),0)}var a=n._convertGroupInfoList(s);setTimeout((function(){o({code:e,data:{totalCount:r,data:a,pageToken:t}})}),0)}else setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(i,o)}))]}))}))},e.prototype.getJoinedGroups=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=t._callCppProxy("getGroupsByIds",e,(function(e,o,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){t.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){n({code:W.MAIN_PROCESS_ERROR})}),0)}var a=t._convertGroupInfoList(s);setTimeout((function(){n({code:e,data:a})}),0)}else setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))]}))}))},e.prototype.setGroupRemark=function(e,t){return Xe(this,void 0,void 0,(function(){var n=this;return Qe(this,(function(o){return[2,new Promise((function(o){var r=t?U.ADD:U.REMOVE,i=n._callCppProxy("updateGroupRemark",e,t||"",r,(function(e,t){setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(i,o)}))]}))}))},e.prototype.setGroupFollows=function(e,t,n){return Xe(this,void 0,void 0,(function(){var o=this;return Qe(this,(function(r){return[2,new Promise((function(r){var i=o._callCppProxy("updateFavoriteMembers",t,n,e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(i,r)}))]}))}))},e.prototype.getGroupFollows=function(e){return Xe(this,void 0,void 0,(function(){var t=this;return Qe(this,(function(n){return[2,new Promise((function(n){var o=t._callCppProxy("getGroupFavoriteMembers",e,"",1e3,0,(function(e,o,r,i){if(e===W.SUCCESS){var s=[];try{s=JSON.parse(i)}catch(e){t.logger.error(mt.P_PARSE_JSON_MSGS_E,i),setTimeout((function(){n({code:W.MAIN_PROCESS_ERROR})}),0)}var a=s.map((function(e){return{userId:e.userId,time:e.followTime}}));setTimeout((function(){n({code:W.SUCCESS,data:a})}),0)}else setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))]}))}))},e.prototype.addFriend=function(e,t,n){var o=this;return new Promise((function(r){var i=o._callCppProxy("addFriend",e,t,n,(function(e,t,n){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(i,r)}))},e.prototype.deleteFriends=function(e,t){var n=this;return new Promise((function(o){var r=n._callCppProxy("removeFriends",e,t,(function(e,t){setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(r,o)}))},e.prototype.acceptFriendApplication=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("acceptFriendRequest",e,"",(function(e,t){setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))},e.prototype.refuseFriendApplication=function(e,t){var n=this;return new Promise((function(o){var r=n._callCppProxy("rejectFriendRequest",e,t||"",(function(e,t){setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(r,o)}))},e.prototype.setFriendInfo=function(e,t,n){var o=this;return new Promise((function(r){var i=Gn(null!=n?n:{}),s=o._callCppProxy("setFriendInfo",e,t,JSON.stringify(i),(function(e,t){setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(s,r)}))},e.prototype.checkFriends=function(e,t){var n=this;return new Promise((function(o){var r=n._callCppProxy("checkFriendRelationship",e,t,(function(e,t){if(e===W.SUCCESS){var n=JSON.parse(t).map((function(e){return{userId:e.userId,relationType:e.status}}));setTimeout((function(){o({code:e,data:n})}),0)}else setTimeout((function(){o({code:e})}),0)}));n.handleErrorCode(r,o)}))},e.prototype.getFriends=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("getFriends",e,0,(function(e,o){try{if(e===W.SUCCESS){var r=JSON.parse(o),i=t._convertFriendInfo(r);setTimeout((function(){n({code:e,data:{data:i,pageToken:""}})}),0)}else setTimeout((function(){n({code:e})}),0)}catch(e){t.logger.error(mt.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:W.MAIN_PROCESS_ERROR})}),0)}}));t.handleErrorCode(o,n)}))},e.prototype.getFriendApplications=function(e,t,n){var o=this;return new Promise((function(r){var i=e.order?1:0,s=3;t&&1===t.length&&(s=null==t?void 0:t[0]);var a=o._callCppProxy("getFriendRequestListByPage",s,n||[0,1,2,3],e.count,e.pageToken||"",i,(function(e,t,n){if(e===W.SUCCESS){var i=[];try{i=JSON.parse(n)}catch(e){o.logger.error(mt.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:W.MAIN_PROCESS_ERROR})}),0)}var s=i.map((function(e){return{userId:e.userId,name:e.name,portraitUri:e.portraitUrl,applicationType:e.friendRequestType,applicationStatus:e.friendRequestStatus,operationTime:e.operateTime,remark:e.extra}}));setTimeout((function(){r({code:e,data:{data:s,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){r({code:e})}),0)}));o.handleErrorCode(a,r)}))},e.prototype.deleteFriendApplication=function(e,t){return Promise.resolve({code:W.NOT_SUPPORT})},e.prototype._convertFriendInfo=function(e){return e.map((function(e){var t=e.userId,n=e.userName,o=e.remark;return{userId:t,name:n,portraitUri:e.portraitUrl,remark:o,directionType:e.friendType,extProfile:e.extProfiles,addTime:e.addTime,inBlackList:!!e.friendAttribute}}))},e.prototype.getFriendsInfo=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("getFriendByIds",e,(function(e,o){if(e===W.SUCCESS){var r=JSON.parse(o),i=t._convertFriendInfo(r);setTimeout((function(){n({code:e,data:i})}),0)}else setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))},e.prototype.searchFriendsInfo=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("getFriendByNickname",e,(function(e,o){if(e===W.SUCCESS)try{var r=JSON.parse(o),i=t._convertFriendInfo(r);setTimeout((function(){n({code:W.SUCCESS,data:i})}),0)}catch(e){t.logger.error(mt.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:W.MAIN_PROCESS_ERROR})}),0)}else setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))},e.prototype.setFriendAddPermission=function(e){var t=this;return new Promise((function(n){var o=t._callCppProxy("setFriendAuthPermission",e,(function(e,t){setTimeout((function(){n({code:e})}),0)}));t.handleErrorCode(o,n)}))},e.prototype.getFriendAddPermission=function(){var e=this;return new Promise((function(t){var n=e._callCppProxy("getFriendAuthPermission",(function(e,n){setTimeout((function(){t({code:e,data:n})}),0)}));e.handleErrorCode(n,t)}))},e.prototype.setNotificationQuietHoursWithSetting=function(e){var t=e.startTime,n=e.spanMinutes,o=e.level,r=e.timezone,i=kn.create(this.logger,"addPushSetting");return i.invoke(t,n,o,r||"",(function(){return i.ok()}),(function(e){return i.fail(e)})).result()},e.prototype.removeNotificationQuietHoursSetting=function(){var e=kn.create(this.logger,"removePushSetting");return e.invoke((function(){return e.ok()}),(function(t){return e.fail(t)})).result()},e.prototype.getNotificationQuietHoursSetting=function(){var e=kn.create(this.logger,"queryPushSetting");return e.invoke((function(t,n,o,r){var i={startTime:t,spanMinutes:n,level:o,timezone:r};e.ok(i)}),(function(t){return e.fail(t)})).result()},e.prototype.setDataBaseLogConfig=function(e){this._callCppProxy("setDataBaseLogConfig",e)},e}(),Yn=function(){function e(e,t,n,o,r,i,s){this.sendCallback=i,this._cppService=new Jn(e,t,r,o,n,s)}return e.prototype.call=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Xe(this,void 0,void 0,(function(){var n,o,r=this;return Qe(this,(function(i){switch(i.label){case 0:return"sendMessage"===e&&(n=t[3],t[3]=function(e){r.sendCallback({reqId:n,data:e})}),[4,(o=this._cppService).callProxy.apply(o,ze([e],Ze(t),!1))];case 1:return[2,{success:!0,data:i.sent()}]}}))}))},e.prototype.send=function(e){for(var t,n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];(t=this._cppService).sendProxy.apply(t,ze([e],Ze(n),!1))},e.prototype.destroy=function(){this._cppService.destroy()},e}(),Wn=function(){function o(t,n,o,r,i,s){var a=this;void 0===s&&(s=!1),this._appkey=t,this._dbpath=n,this._logOutputLevel=o,this._runInMainProcess=r,this._enableSyncEmptyTopConversation=i,this._disableLogReport=s,this._catch={crtUserId:"",connectedTime:0,naviInfo:null,connectionStatus:2,deviceId:"",deltaTime:0},this._connectionStatus=ue.DISCONNECTED,this._connectInfo={token:"",reconnectKickEnable:!1,openCallPlus:!1,traceId:""},this._registerMessageTypeList=[],this._isProcessQuit=!1,this._rendererInitOptions=null,this._senders={},this._callbackCache={},this._createServiceProxy(),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",(function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return Xe(a,void 0,void 0,(function(){var o,r;return Qe(this,(function(i){switch(i.label){case 0:return[4,(r=this._cppServiceProcessProxy).call.apply(r,ze([t],Ze(n),!1))];case 1:return o=i.sent(),e.returnValue=o.data,[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",(function(e,t,n){for(var o=[],r=3;r<arguments.length;r++)o[r-3]=arguments[r];return Xe(a,void 0,void 0,(function(){var r,i,s;return Qe(this,(function(a){switch(a.label){case 0:return"sendMessage"===n&&(r=o[3],this._callbackCache[r]=e.sender),"connect"===n&&(this._connectInfo={token:o[0],reconnectKickEnable:o[1],openCallPlus:o[2],traceId:o[3]}),[4,(s=this._cppServiceProcessProxy).call.apply(s,ze([n],Ze(o),!1))];case 1:if(!(i=a.sent()).success)throw new Error(i.data.msg);return this._send2Renderer(e.sender,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,i.data),[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(function(e,t){for(var n,o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];"registerMessageType"===t&&a._registerMessageTypeList.push({objectName:o[0],isPersited:o[1],isCounted:o[2],searchProps:o[3]}),(n=a._cppServiceProcessProxy).send.apply(n,ze([t],Ze(o),!1))})),e.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this)),e.app.on("before-quit",(function(){a._isProcessQuit=!0,a.destroy()})),e.app.on("window-all-closed",(function(){a._isProcessQuit=!0,a.destroy()}))}return o.prototype._send2Renderer=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];e.isDestroyed()?delete this._senders[e.id]:e.send.apply(e,ze([t],Ze(n),!1))},o.prototype._send2AllRenderer=function(e,t,n){var o=this;void 0===n&&(n=[]),Object.keys(this._senders).forEach((function(r){var i=o._senders[r];n.includes(i)||o._send2Renderer(i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e,t)}))},o.prototype._registerRenderers=function(e,t){var n=this,o=e.sender,r=o.id;this._rendererInitOptions||(this._rendererInitOptions=t),this._cppServiceProcessProxy.send("registerRenderers",t),this._senders[r]||(this._senders[r]=o,o.once("destroyed",(function(){delete n._senders[r]})))},o.prototype.getMainCache=function(){return this._catch},o.prototype._restartSubProcessProxy=function(){var e=this;if(this._createServiceProxy(),this._connectionStatus!==ue.DISCONNECTED){this._send2AllRenderer("onSuspend",W.SUB_PROCESS_EXIT),this._registerMessageTypeList.forEach((function(t){e._cppServiceProcessProxy.send("registerMessageType",t.objectName,t.isPersited,t.isCounted,t.searchProps)})),this._cppServiceProcessProxy.send("registerRenderers",this._rendererInitOptions);var t=this._connectInfo,n=t.token,o=t.reconnectKickEnable,r=t.openCallPlus;this._cppServiceProcessProxy.send("reconnect",n,o,r)}},o.prototype._eventNotifyHandler=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=Ze(t,2),r=o[0],i=o[1];switch(e){case"onConnected":this._catch=r,this._connectionStatus=ue.CONNECTED;break;case"onSuspend":this._connectionStatus=ue.SUSPENDED;break;case"onDisconnected":this._connectionStatus=ue.DISCONNECTED;break;case"onConnecting":this._connectionStatus=ue.CONNECTING}this._send2AllRenderer(e,r,i)},o.prototype._callbackHandler=function(e){var t=e.reqId,n=e.data;this._callbackCache[t]&&this._send2Renderer(this._callbackCache[t],"__RC_CHANNEL_RESULT_FROM_MAIN__",t,n)},o.prototype._createServiceProxy=function(){var o=this,r=this._dbpath||n.resolve(e.app.getPath("userData"));if(this._runInMainProcess)this._cppServiceProcessProxy=new Yn(this._appkey,r,this._logOutputLevel,this._enableSyncEmptyTopConversation,this._eventNotifyHandler.bind(this),this._callbackHandler.bind(this),this._disableLogReport);else{var i=t.fork(n.resolve(__dirname,"cppServiceProcess.js"),[this._appkey,r,this._enableSyncEmptyTopConversation.toString(),this._logOutputLevel.toString(),this._disableLogReport.toString()]);this._cppServiceProcessProxy=new pn(i,this._eventNotifyHandler.bind(this),this._callbackHandler.bind(this),(function(e,t){void 0===t&&(t=!1);var n="sub process exit, msg: ".concat(e,", isRestart: ").concat(t,", _isProcessQuit: ").concat(o._isProcessQuit);if(console.error(n),t&&!o._isProcessQuit)return o._restartSubProcessProxy()}))}},o.prototype.destroy=function(){this._cppServiceProcessProxy.destroy()},o.prototype.setDataBaseLogConfig=function(e){this._cppServiceProcessProxy.call("setDataBaseLogConfig",e)},o}(),Kn=function(){function e(e,t,n,o,r,i){this._rcMain=new Wn(e,t,n,o,r,i)}return e.prototype.getCppProto=function(){var e=this;return{destroy:function(){console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),e.destroy()}}},e.prototype.destroy=function(){this._rcMain.destroy()},e.prototype.getDeviceId=function(){return this._rcMain.getMainCache().deviceId},e.prototype.getServerTime=function(){return this._rcMain.getMainCache().connectedTime},e.prototype.setDatabaseOperationTimeThreshold=function(e){return this._rcMain.setDataBaseLogConfig(e)},e}();module.exports=function(e){return function(e,t){if(Hn)return Hn;if(!e)throw new Error("Initializ failed, `appkey` is required!");return Hn=new Kn(e,(null==t?void 0:t.dbpath)||"",(null==t?void 0:t.logOutputLevel)||Nt.WARN,(null==t?void 0:t.runInMainProcess)||!1,!!(null==t?void 0:t.enableSyncEmptyTopConversation),(null==t?void 0:t.disableLogReport)||!1)}(e.appkey,e)};