@rongcloud/electron 5.26.1 → 5.28.0-c-tmp.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.cjs.js +1 -1
- package/index.esm.js +2 -2
- package/index.mjs +2 -2
- package/package.json +1 -1
- package/sub-process.cjs.js +1 -1
- package/sub-process.esm.js +1 -1
package/index.cjs
CHANGED
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
var Ae=function(e,t){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Ae(e,t)};function Le(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Ae(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Me,Ue=function(){return Ue=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ue.apply(this,arguments)};function De(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function we(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function je(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ve(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Ge(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function Fe(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function ke(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}!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"}(Me||(Me={}));var xe,He,Be,Je=0,We=1,Ye=2,Ke=3,Xe=4,Qe=5,Ze=function(e){var t=[Me.PRIVATE,Me.GROUP,Me.SYSTEM,Me.PUBLIC_SERVICE,Me.APP_PUBLIC_SERVICE];switch(e){case Je:return t;case We:return[Me.PRIVATE,Me.GROUP];case Ye:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP],!1);case Ke:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP,Me.CHATROOM],!1);case Xe:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP,Me.CHATROOM,Me.RTC_ROOM,Me.CUSTOMER_SERVICE,Me.DISCUSSION],!1);case Qe:return[Me.PRIVATE,Me.GROUP,Me.ULTRA_GROUP]}};!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"}(xe||(xe={})),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"}(He||(He={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Be||(Be={}));var qe,ze,$e,et,tt,rt,nt,it,ot,at,st,ut,ct,lt,_t,dt,ft,pt,Et,bt,Rt,ht="RC:TxtMsg",gt="RC:VcMsg",vt="RC:HQVCMsg",Ot="RC:LogCmdMsg",It="RC:MsgExMsg",Ct="RC:ReferenceMsg",St="RC:RcCmd",Tt="RC:RcNtf",Nt="RC:ReadNtf",Pt="RC:RRReqMsg",mt="RC:RRRspMsg",yt="RC:SRSMsg",At="RC:RRMsg",Lt="RC:RSMsg",Mt="RC:Delivered",Ut="RC:DRMsg",Dt="RC:CCConfigChangeRequestMsg";!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(qe||(qe={})),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"}(ze||(ze={})),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",e[e.UG_DEL=6]="UG_DEL"}($e||($e={})),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"}(et||(et={})),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"}(tt||(tt={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(rt||(rt={})),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"}(nt||(nt={})),function(e){e[e.typing=0]="typing"}(it||(it={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(ot||(ot={})),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"}(at||(at={})),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"}(st||(st={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(ut||(ut={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(ct||(ct={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(lt||(lt={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_t||(_t={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(dt||(dt={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(ft||(ft={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(pt||(pt={})),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"}(Et||(Et={})),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"}(bt||(bt={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Rt||(Rt={}));var wt,jt,Vt,Gt,Ft,kt,xt,Ht,Bt,Jt=function(e){return e<=bt.NOT_SET?Rt.CLOSE:Rt.OPEN};!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"}(wt||(wt={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(jt||(jt={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Vt||(Vt={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Gt||(Gt={})),function(e){e[e.CURRENT=2]="CURRENT"}(Ft||(Ft={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(kt||(kt={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(xt||(xt={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(Ht||(Ht={})),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"}(Bt||(Bt={}));var Wt,Yt,Kt=0;!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"}(Wt||(Wt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Yt||(Yt={}));var Xt=72e5,Qt="5.26.1".replace(/-.+$/,""),Zt="rongcloudsystem",qt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};qt.engine="5.26.1";var zt=function(){function e(){}return Object.defineProperty(e,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){["imlib-next","engine","electron-main","electron-renderer","imlib-v2-adapter","Global_IM_UIKit","IMKit","imkit-store","rtclib","calllib","callplus","plugin-wechat-rtc"].includes(e)&&(qt[e]=t)}}),Object.defineProperty(e,"validEngine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var r=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return qt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=r}}),Object.defineProperty(e,"getInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return qt}}),e}();var $t=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)}))},er=function(e){void 0===e&&(e=22);var t,r=Date.now(),n=r.toString(36),i=Math.floor(Math.random()*r).toString(36),o=e-n.length-i.length;return[i,n,o>0?(t=o,Array.from({length:t}).map((function(){return Math.floor(36*Math.random()).toString(36)})).join("")):""].join("").slice(0,e)}(22),tr=Date.now(),rr=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},nr=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},ir=function(e){return function(e){return"string"==typeof e}(e)&&/https?:\/\//.test(e)},or=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ar=function(e){return[at.Android,at.iOS,at.Web,at.PC,at.Mini,at.HarmonyOS].map((function(t){var r=e.findIndex((function(e){return e.platform===t}));return-1===r?{platform:t,changeTime:0,eventValue:0}:e[r]}))},sr=function(e,t,r){return t?1===r?xe.TLS:xe.RMTP:"http"===e?xe.WS:xe.WSS},ur=function(e,t){var r=e.server,n=e.backupServer,i=e.bs,o=e.serverAddr,a=e.protocol,s=e.openTLS;if(o)return Ge([],Ve(o.filter((function(e){return e.addr}))),!1);var u=[],c=[];return r&&c.push(r),(n||i||"").split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,n){e&&u.push({addr:e,protocol:sr(a,t,s),weight:r.length-n,race:!1})})),Ge([],Ve(u),!1)},cr=function(e){if(void 0!==e){var t=Number(e);return Number.isNaN(t)?void 0:t}},lr=function(e){return e.reduce((function(e,t){return e[t.key]=t.value,e}),{})},_r=function(e,t){var r=Math.floor(1e3*Math.random()%1e4),n=$t(),i=function(e){e=e||"-";var t=new Date,r=t.getFullYear(),n=t.getMonth()+1,i=t.getDate();return"".concat(r).concat(e).concat(n).concat(e).concat(i)}(),o=(new Date).getTime(),a="";if(t){var s=t.split(".");a=".".concat(s[s.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(r,"_").concat(o).concat(n).concat(a)},dr=function(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={});var n=t.channelIdMi,i=t.channelIdHW,o=t.channelIdOPPO,a=t.typeVivo,s=t.importanceHW,u=t.categoryHW,c=t.imageUrlHW,l=t.categoryVivo,_=t.importanceHonor,d=t.imageUrlHonor,f=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=e.threadId,n=e.apnsCollapseId,i=e.category,o=e.richMediaUri,a=e.interruptionLevel,s=t.googleConfig,u={};u["thread-id"]=r||"",u["apns-collapse-id"]=n||"",u.category=i||"",u.richMediaUri=o||"",u["interruption-level"]=a||"active";var c={};c.collapse_key=null==s?void 0:s.collapseKey,c.imageUrl=null==s?void 0:s.imageUrl;var l=null==s?void 0:s.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),c.priority=l,{APNS:u,FCM:c}}(e,t),p=[{HW:{channelId:i||"",importance:s||"NORMAL",image:c||"",category:u||""}},{MI:{channelId:n||""}},{OPPO:{channelId:o||""}},{VIVO:{classification:a||"",category:l||""}},{APNS:f.APNS},{FCM:f.FCM},{HONOR:{importance:_||pt.NORMAL,image:d||""}},{OHOS:{category:r.category||null,image:r.image||""}}];return JSON.stringify(p)},fr=function(){var e=zt.getInfo(),t="electron";for(var r in e)"engine"!==r&&(t=["imlib-v2-adapter","imlib-next"].includes(r)?r:"electron");return t};function pr(e,t){var r;if(!e)return"";var n="undefined"!=typeof window&&"https:"===(null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.protocol);return/^https?:\/\//.test(e)?n?e.replace(/^https?:\/\//i,"https://"):e:t!==xe.HTTP||n?"https://".concat(e):"http://".concat(e)}var Er,br=function(e,t){if(!e)return"";var r=e.ossConfig,n=void 0===r?"":r,i="";try{var o=JSON.parse(n);if(o.length>0){var a=o.find((function(e){return e.minio}));a&&(i=a.minio)}}catch(e){t.warn(Ne,JSON.stringify({ossConfig:n,error:e}))}return i},Rr=function(e){function t(t){var r=e.call(this,t)||this;return r.name="RCError",r}return Le(t,e),Object.defineProperty(t,"InvalidParameters",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(null==e?void 0:e.length)?new t("Invalid parameter -> ".concat(e)):new t("Invalid parameters.")}}),Object.defineProperty(t,"ParameterTypeError",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new t("Wrong parameter type")}}),t}(Error),hr=function(){function e(){Er.set(this,!1)}return Object.defineProperty(e.prototype,"stopPropagation",{enumerable:!1,configurable:!0,writable:!0,value:function(){ke(this,Er,!0,"f")}}),Object.defineProperty(e.prototype,"isStopPropagation",{get:function(){return Fe(this,Er,"f")},enumerable:!1,configurable:!0}),e}();Er=new WeakMap;var gr=function(){function e(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_piped",{enumerable:!0,configurable:!0,writable:!0,value:new Set})}return Object.defineProperty(e.prototype,"_addItem",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){void 0===i&&(i=0);var o=Symbol(),a=this._map.get(e)||this._map.set(e,[]).get(e),s={symbol:o,priority:Math.min(i,100),listener:t.bind(n),once:r},u=a.findIndex((function(e){return e.priority>i}));return-1===u?a.push(s):a.splice(u,0,s),o}}),Object.defineProperty(e.prototype,"on",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=0),this._addItem(e,t,!1,r,n)}}),Object.defineProperty(e.prototype,"once",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=0),this._addItem(e,t,!0,r,n)}}),Object.defineProperty(e.prototype,"off",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;try{for(var n=je(this._map),i=n.next();!i.done;i=n.next()){var o=Ve(i.value,2),a=(o[0],o[1]),s=a.findIndex((function(t){return t.symbol===e}));if(-1!==s)return void a.splice(s,1)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=this._map.get(e);if(n&&n.length>0)for(var i=new hr,o=0;o<n.length;o+=1){var a=n[o],s=a.once,u=a.listener;s&&n.splice(o,1);try{u.apply(void 0,Ge([i],Ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}if(i.isStopPropagation)return}Ge([],Ve(this._piped.values()),!1).forEach((function(r){return r.emit.apply(r,Ge([e],Ve(t),!1))}))}}),Object.defineProperty(e.prototype,"removeAll",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._map.delete(e)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._piped.clear(),this._map.clear()}}),Object.defineProperty(e.prototype,"pipe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._piped.add(e)}}),e}();!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_versionQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_pullingPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(t,"_dataVersion",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(t,"_invervalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(t,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),t}Le(t,e),Object.defineProperty(t.prototype,"length",{get:function(){return this._versionQueue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPulling",{get:function(){return null!==this._pullingPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setInitVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!1),De(this,void 0,void 0,(function(){return we(this,(function(r){return-1!==this._dataVersion||(this._dataVersion=e,t&&this._execPulling()),[2]}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e<this._dataVersion||(this._versionQueue.push(e),-1!==this._dataVersion&&this._execPulling())}}),Object.defineProperty(t.prototype,"_execPulling",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r,n,i,o;return we(this,(function(a){switch(a.label){case 0:return this._pullingPromise?[2]:(this._pullingPromise=this._handleSyncData(this._dataVersion),[4,this._pullingPromise]);case 1:if(e=a.sent(),t=e.isOk,r=e.data,this._pullingPromise=null,!t)return[2];if(void 0===(null==r?void 0:r.version)||r.version<this._dataVersion)throw new Error("version error, please check: lastVersion: ".concat(this._dataVersion,", newVersion: ").concat(null==r?void 0:r.version));return n=r.version,i=r.hasNext,o=this._versionQueue.filter((function(e){return e>n})),this._versionQueue=Ge([],Ve(o),!1),this._dataVersion=n,i?[2,this._execPulling()]:this._versionQueue.length>0?(this._versionQueue.length=0,[2,this._execPulling()]):[2]}}))}))}}),Object.defineProperty(t.prototype,"startInterval",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._started||(this._started=!0,t&&this._execPulling(),this._invervalTimer=setInterval((function(){return r._execPulling()}),e))}}),Object.defineProperty(t.prototype,"stopInterval",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._started=!1,clearInterval(this._invervalTimer),this._invervalTimer=-1)}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=-1}})}(gr),function(){function e(e,t){var r=this;Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._promise=new Promise((function(t){r._resolve=t,e(r._onResolve.bind(r))})),this._onCancel=t}Object.defineProperty(e.prototype,"_onResolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._resolve(e)}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._promise}}),Object.defineProperty(e.prototype,"abort",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._onCancel(this._onResolve.bind(this))}})}(),function(){function e(e,t){var r=this;Object.defineProperty(this,"handler",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"validate",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_handlerPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._handlerPromise=new Promise((function(e){r._resolve=e}))}Object.defineProperty(e.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){if(!this._resolve)throw new Error("BatchSync is closed");return this.validate&&!this.validate(e)||this._data.add(e),[2,this._handlerPromise]}))}))}}),Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t;return we(this,(function(r){switch(r.label){case 0:if(!this._resolve)throw new Error("BatchSync is closed");return e=this._resolve,this._resolve=null,t=Ge([],Ve(this._data.values()),!1),this._data.clear(),t.length>0?[4,this.handler(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return e(),[2,Promise.resolve()]}}))}))}})}();var vr=function(){function e(e,t,r){Object.defineProperty(this,"isOk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"msg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isOk=0===e,this.code=e,this.msg=t,this.data=r}return Object.defineProperty(e.prototype,"next",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){return this.isOk?[2,e(this.data)]:[2,this.wipe()]}))}))}}),Object.defineProperty(e.prototype,"or",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){return this.isOk?[2,this]:[2,e(this.code)]}))}))}}),Object.defineProperty(e.prototype,"orSync",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?this:e(this.code)}}),Object.defineProperty(e.prototype,"trans",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?Or(e(this.data)):this.wipe()}}),Object.defineProperty(e.prototype,"tryTrans",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?e(this.data):this.wipe()}}),Object.defineProperty(e.prototype,"errmsg",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify({code:this.code,msg:this.msg})}}),Object.defineProperty(e.prototype,"wipe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isOk?Or(void 0,this.msg):Ir(this.code,this.msg)}}),e}(),Or=function(e,t){return new vr(0,t||"success",e)},Ir=function(e,t,r){return new vr(e,t||"fail: ".concat(e),r)};!function(){function e(e){Object.defineProperty(this,"_apiName",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_isValid",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_code",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_errmsg",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}Object.defineProperty(e,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return new e(t)}}),Object.defineProperty(e.prototype,"isFailed",{get:function(){return!this._isValid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.isFailed&&0===this._code&&(this._code=e,this._errmsg=t||this._errmsg),this}}),Object.defineProperty(e.prototype,"setFailed",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._isValid=!1,this.fail(e,t)}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.isFailed&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this.isFailed?Ir(this._code,this._errmsg):Or()}}),Object.defineProperty(e.prototype,"check",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e(this),this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(void 0===n&&(n=!1),this.isFailed)return this;var i=n?r(t):null==t||r(t);return this._isValid=i,this.isFailed&&(this._errmsg="param '".concat(e,"' is invalid")),this}}),Object.defineProperty(e.prototype,"assert",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(void 0===n&&(n=!1),this.isFailed)return this;if(this.validate(e,t,r,n),this.isFailed)throw Rr.InvalidParameters("'".concat(e,"' at '").concat(this._apiName,"'"));return this}}),Object.defineProperty(e.prototype,"isString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(){return"string"==typeof t}),r)}}),Object.defineProperty(e.prototype,"assertString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(){return"string"==typeof t}),r)}}),Object.defineProperty(e.prototype,"isNotEmptyString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.isString(e,t,r).validate(e,t,(function(e){return e.trim().length>0}),r)}}),Object.defineProperty(e.prototype,"assertNotEmptyString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assertString(e,t,r),this.assert(e,t,(function(e){return e.trim().length>0}),r)}}),Object.defineProperty(e.prototype,"isLimitedString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isString(e,t,i).validate(e,t,(function(e){return e.length>=r&&e.length<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertString(e,t,i),this.assert(e,t,(function(e){return e.length>=r&&e.length<=n}),i)}}),Object.defineProperty(e.prototype,"isBoolean",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"boolean"==typeof e}),r)}}),Object.defineProperty(e.prototype,"assertBoolean",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"boolean"==typeof e}),r)}}),Object.defineProperty(e.prototype,"isNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),r)}}),Object.defineProperty(e.prototype,"assertNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),r)}}),Object.defineProperty(e.prototype,"isLimitedNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isNumber(e,t,i).validate(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertNumber(e,t,i),this.assert(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"isInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return Number.isInteger(e)}),r)}}),Object.defineProperty(e.prototype,"assertInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return Number.isInteger(e)}),r)}}),Object.defineProperty(e.prototype,"isLimitedInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isInteger(e,t,i).validate(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertInteger(e,t,i),this.assert(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"isArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),r)}}),Object.defineProperty(e.prototype,"assertArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),r)}}),Object.defineProperty(e.prototype,"isLimitedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===n&&(n=!1),void 0===i&&(i=1),this.isArray(e,t,n).validate(e,t,(function(e){return e.length>=i&&e.length<=r}),n)}}),Object.defineProperty(e.prototype,"assertLimitedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===n&&(n=!1),void 0===i&&(i=1),this.assertArray(e,t,n),this.assert(e,t,(function(e){return e.length>=i&&e.length<=r}),n)}}),Object.defineProperty(e.prototype,"isTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.isArray(e,t,n).validate(e,t,(function(e){return e.every(r)}),n)}}),Object.defineProperty(e.prototype,"assertTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.assertArray(e,t,n),this.assert(e,t,(function(e){return e.every(r)}),n)}}),Object.defineProperty(e.prototype,"isLimitedTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.isLimitedArray(e,t,r,i,o).validate(e,t,(function(e){return e.every(n)}),i)}}),Object.defineProperty(e.prototype,"assertLimitedTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.assertLimitedArray(e,t,r,i,o),this.assert(e,t,(function(e){return e.every(n)}),i)}}),Object.defineProperty(e.prototype,"isObject",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),r)}}),Object.defineProperty(e.prototype,"assertObject",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),r)}}),Object.defineProperty(e.prototype,"isValueOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.validate(e,t,(function(){return Object.values(r).includes(t)}),n)}}),Object.defineProperty(e.prototype,"assertValueOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.assert(e,t,(function(){return Object.values(r).includes(t)}),n)}}),Object.defineProperty(e.prototype,"isFunction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"function"==typeof e}),r)}}),Object.defineProperty(e.prototype,"assertFunction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"function"==typeof e}),r)}})}();var Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Sr(e){var t,r,n,i,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=Cr.indexOf(e.charAt(u++))<<2|(i=Cr.indexOf(e.charAt(u++)))>>4,r=(15&i)<<4|(o=Cr.indexOf(e.charAt(u++)))>>2,n=(3&o)<<6|(a=Cr.indexOf(e.charAt(u++))),s+=String.fromCharCode(t),64!==o&&(s+=String.fromCharCode(r)),64!==a&&(s+=String.fromCharCode(n));return s}var Tr,Nr=1732584193,Pr=4023233417,mr=2562383102,yr=271733878,Ar=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Lr=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745];function Mr(e,t){return e<<t|e>>>32-t}function Ur(e,t,r){return e&r|t&~r}function Dr(e,t,r){return e^t^r}function wr(e,t,r){return t^(e|~r)}function jr(e){for(var t=[],r=0;r<e.length;r+=4)t.push((e[r]||0)|(e[r+1]||0)<<8|(e[r+2]||0)<<16|(e[r+3]||0)<<24);return t}function Vr(e){var t=new Uint8Array(4);return t[0]=255&e,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}function Gr(e){var t=8*e.length,r=e.length%64<56?56-e.length%64:120-e.length%64,n=new Uint8Array(e.length+r+8);n.set(e),n[e.length]=128;for(var i=1;i<r;i++)n[e.length+i]=0;var o=new Uint8Array(8),a=4294967295&t,s=4294967295&Math.floor(t/4294967296);o.set(Vr(a),0),o.set(Vr(s),4),n.set(o,e.length+r);var u,c=Nr,l=Pr,_=mr,d=yr;for(i=0;i<n.length;i+=64){for(var f=jr(n.slice(i,i+64)),p=c,E=l,b=_,R=d,h=0;h<64;h++){var g=void 0,v=void 0;h<16?(g=(u=l)&_|~u&d,v=h):h<32?(g=Ur(l,_,d),v=(5*h+1)%16):h<48?(g=Dr(l,_,d),v=(3*h+5)%16):(g=wr(l,_,d),v=7*h%16);var O=d;d=_,_=l,l+=Mr(c+g+Lr[h]+f[v]&4294967295,Ar[h]),c=O}c=c+p&4294967295,l=l+E&4294967295,_=_+b&4294967295,d=d+R&4294967295}var I=new Uint8Array(16);return I.set(Vr(c),0),I.set(Vr(l),4),I.set(Vr(_),8),I.set(Vr(d),12),function(e){return Array.from(e).map((function(e){return e.toString(16).padStart(2,"0")})).join("")}(I)}function Fr(e){var t=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);var t=unescape(encodeURIComponent(e)).split("").map((function(e){return e.charCodeAt(0)}));return new Uint8Array(t)}(e);return Gr(t)}function kr(e){if(!e||0===e.length)return[];var t=new Set;return e.forEach((function(e){t.add(e)})),Array.from(t)}!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Tr||(Tr={}));var xr,Hr,Br=0,Jr=1;!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"}(Hr||(Hr={}));var Wr=((xr={})[Hr.BJ]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},xr[Hr.SG]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},xr[Hr.NA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},xr[Hr.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},xr[Hr.SA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},xr);function Yr(e){return Hr[e]?e:Hr.BJ}var Kr,Xr=function(){function e(){Object.defineProperty(this,"initOption",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.initOption=e}}),Object.defineProperty(e.prototype,"getNaviUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this.initOption||{},i=n.areaCode,o=n.navigators,a=(r=i,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].naviUrlBase64).map((function(e){return Sr(e)})),s=[],u=Ve(e.split("@"),2)[1];t&&(s=u?u.split(";"):[]);var c=o&&o.length>0?Ge(Ge([],Ve(s),!1),Ve(o),!1):Ge(Ge([],Ve(s),!1),Ve(a),!1);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return pr(e)}))}}),Object.defineProperty(e.prototype,"getLogUrlPolicyList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=e||{},i=n.log,o=n.logPolicy,a=this.initOption||{},s=a.areaCode,u=a.logServerUrl,c=(r=s,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].logUrlBase64).map((function(e){return Ue(Ue({},e),{addr:Sr(e.addr)})})),l=[],_={level:1,itv:6,times:5};if(i)l.push.apply(l,Ge([],Ve(i.addrs),!1)),Object.assign(_,i.policy);else if(o)try{var d=JSON.parse(o);l.push({addr:d.url,protocol:xe.HTTPS,weight:1}),_.level=d.level,_.itv=d.itv,_.times=d.times}catch(r){t.warn(ue,JSON.stringify({policy:e.logPolicy}))}var f=u?Ge([{addr:u,protocol:xe.HTTPS,weight:101}],Ve(l),!1):Ge(Ge([],Ve(l),!1),Ve(c),!1);return{policy:_,addrs:f.filter((function(e,t){return f.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return Ue(Ue({},e),{addr:pr(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}}}),Object.defineProperty(e.prototype,"getMiniCmpUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Hr.BJ),Wr[Yr(t)].miniCmpBase64).map((function(e){return Sr(e)})),n=(this.initOption||{}).miniCMPProxy;return n&&n.length>0?n:r}}),Object.defineProperty(e.prototype,"getStaticConfigUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Hr.BJ),Wr[Yr(t)].staticConfigUrlBase64).map((function(e){return Sr(e)}))}}),Object.defineProperty(e.prototype,"getCloudControllerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(r=n,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].cloudControllerUrlBase64).map((function(e){return Sr(e)}))}}),Object.defineProperty(e.prototype,"getAreaCode",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:Hr.BJ}}),Object.defineProperty(e.prototype,"setAreaCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!(!e||!Hr[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}}),Object.defineProperty(e.prototype,"getStatsUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=e||{},i=n.active,o=n.activeServer,a=(null==i?void 0:i.addrs)||[],s=(r=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].statsUrlBase64).map((function(e){return Sr(e)})),u=[];return 0!==a.length?u.push.apply(u,Ge([],Ve(a.sort((function(e,t){return t.weight-e.weight})).map((function(e){return pr(e.addr,e.protocol)}))),!1)):o&&u.push(pr(o,xe.HTTPS)),s.forEach((function(e){u.includes(e)||u.push(e)})),u}}),e}(),Qr=new Xr,Zr=function(){function e(e,t){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticUrls",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"getStaticConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return De(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,u;return we(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]),r=JSON.parse(t),Date.now()-(null==r?void 0:r.time)<18e5?[4,this.decryptData(r.val)]:[3,3];case 2:return n=c.sent(),(i=n.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:i.map((function(e){return pr(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return o=c.sent(),this.logger.error(Re,JSON.stringify({error:null==o?void 0:o.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(a=c.sent())?[4,this.decryptData(a)]:[2];case 8:return(null==(s=c.sent())?void 0:s.areaCode)!==Qr.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:a})),this.staticUrls=(null==s?void 0:s.bootstrap)||[],(u=null===(e=null==s?void 0:s.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:u.map((function(e){return pr(e.addr,e.protocol)}))||[]}])}}))}))}}),Object.defineProperty(e.prototype,"_requestHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,u,c,l;return we(this,(function(_){switch(_.label){case 0:e=(e=Ge(Ge([],Ve(this.staticUrls),!1),Ve(Qr.getStaticConfigUrl()),!1).map((function(e){return pr(e)}))).filter((function(t,r){return e.indexOf(t)===r})),_.label=1;case 1:_.trys.push([1,6,7,8]),t=je(e),r=t.next(),_.label=2;case 2:return r.done?[3,5]:(n=r.value,this.logger.info(Ee,JSON.stringify({url:n})),i=Date.now(),[4,this.sendRequest("".concat(n,"/").concat(this.appkey))]);case 3:if(o=_.sent(),a=o.code,s=o.data,200===a)return this.logger.info(be,JSON.stringify({url:n,code:a,duration:Date.now()-i})),[2,s];this.logger.warn(be,JSON.stringify({url:n,code:a,duration:Date.now()-i})),_.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return u=_.sent(),c={error:u},[3,8];case 7:try{r&&!r.done&&(l=t.return)&&l.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"}(Kr||(Kr={}));var qr,zr,$r=function(){function e(e,t,r,n){Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Kr.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}return Object.defineProperty(e.prototype,"_write",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.tag,r=e.level,n=e.content,i=e.traceId;/^[\w-]+$/.test(t)?r!==Kr.DEBUG&&this.logDB.write(e):console.error("".concat((new Date).toISOString(),"[").concat(this._id,"]['ERROR']: ").concat(t," | ").concat(n," | ").concat(i))}}),Object.defineProperty(e.prototype,"createTraceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"".concat(++e._traceIdCount)}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return er}}),Object.defineProperty(e.prototype,"_stdout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.time,r=e.tag,n=e.content,i=e.traceId,o=e.level,a=e.loggerId;if(console&&!(o<=Kr.FATAL||o>this.outputLevel)){var s=["error","warn","info","debug"][o-1],u="".concat(new Date(t).toISOString(),"[").concat(null!=a?a:this._id,"][").concat((s||"stat").toUpperCase(),"]: ").concat(r," | ").concat(n," | ").concat(i);console[s||"warn"](u)}}}),Object.defineProperty(e.prototype,"setOutputLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){(function(e){return[Kr.DEBUG,Kr.INFO,Kr.WARN,Kr.ERROR].some((function(t){return t===e}))})(e)&&(this.outputLevel=e)}}),Object.defineProperty(e.prototype,"_log",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i={time:Date.now(),level:e,tag:t,content:r,traceId:n,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(i),this._write(i)}}),Object.defineProperty(e.prototype,"summary",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){if(void 0===n&&(n={}),t.isOk){var a=null==i?void 0:i(t.data);this.info(e,JSON.stringify(Ue(Ue({isOk:!0},n),a)),r)}else{a=null==o?void 0:o(t.data);this.warn(e,JSON.stringify(Ue(Ue({code:t.code,msg:t.msg},n),a)),r)}}}),Object.defineProperty(e,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),e}(),en=function(){function e(e,t,r,n,i,o){void 0===o&&(o=!1),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"deviceInfo",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"reportFailedNumber",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"itvByNavi",{enumerable:!0,configurable:!0,writable:!0,value:6}),Object.defineProperty(this,"timesByNavi",{enumerable:!0,configurable:!0,writable:!0,value:5})}return Object.defineProperty(e.prototype,"_getLogs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return De(this,void 0,void 0,(function(){var a,s,u,c=this;return we(this,(function(l){switch(l.label){case 0:a=[],l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.logDB.read(e,t,r,n,o)];case 2:return s=l.sent(),rr(s.logs)?a=s.logs.filter((function(e){return!(!e||"object"!=typeof e)||(c.logger.warn(le,"Invalid log entry: not an object",i),!1)})):this.logger.warn(le,"Invalid logs result: not an array",i),[3,4];case 3:return u=l.sent(),this.logger.warn(le,"Error getting logs: ".concat(u instanceof Error?u.message:String(u)),i),[3,4];case 4:return[2,{logs:a}]}}))}))}}),Object.defineProperty(e.prototype,"checkStart",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){return this.started?[2]:(this.userId=e.userId,!e.logSwitch||this.disableLogReport||(r=Qr.getLogUrlPolicyList(e,this.logger),n=r.policy,i=r.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv,t)),[2])}))}))}}),Object.defineProperty(e.prototype,"_sendLogs2Realtime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f;return we(this,(function(p){switch(p.label){case 0:return this.logger.debug(_e,"compress logs: ".concat(e.length)),[4,this.compressLogs(e)];case 1:return i=p.sent(),o=i.success,a=i.data,o?(this.logger.debug(_e,"compress done",t),s=ir(r)?r:"https://".concat(r),s+="?version=".concat("5.26.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:s,body:a,method:"POST"})]):(this.logger.warn(le,"compress failed",t),[2,{isOk:!1,itv:n}]);case 2:if(u=p.sent(),c=u.status,l=u.data,this.logger.debug(le,JSON.stringify({status:c,data:l}),t),200!==c)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++,[2,{isOk:!1,itv:n}];if(this.reportFailedNumber=0,l)try{(f=JSON.parse(l)).nextTime&&(n=f.nextTime),_=f.level,d=f.logSwitch}catch(e){this.logger.warn(Ne,JSON.stringify({error:null==e?void 0:e.stack}),t)}return[2,{isOk:!0,itv:n,level:_,logSwitch:d}]}}))}))}}),Object.defineProperty(e.prototype,"realtimeReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f,p=this;return we(this,(function(E){switch(E.label){case 0:return i=Date.now(),o=this.logger.getTimestamp4RealtimeLog()||tr,a=Math.max(i-3e4,o+1),s=this.logger.createTraceId(),this.logger.debug(ce,JSON.stringify({startTime:o,endTime:a,level:t,itv:r}),s),[4,this._getLogs(o,a,t,!0,s,n)];case 1:return 0!==(u=E.sent().logs).length?[3,2]:(this.logger.debug(le,"no logs",s),[3,4]);case 2:return u.length>0?[4,this._sendLogs2Realtime(u,s,e,r)]:[3,4];case 3:c=E.sent(),l=c.itv,_=c.level,d=c.logSwitch,c.isOk&&(f=Math.max.apply(Math,Ge([],Ve(u.map((function(e){return e.time}))),!1)),this.logger.setTimestamp4RealtimeLog(f+1),0===d&&(this.started=!1),void 0!==_&&(t=_)),r=l,E.label=4;case 4:return this.started&&(r>=60&&this.itvByNavi<60&&(r=60),this.timer=setTimeout((function(){return p.realtimeReport(e,t,r,n)}),1e3*r)),[2]}}))}))}}),Object.defineProperty(e.prototype,"report",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){return void 0===a&&(a=!1),De(this,void 0,void 0,(function(){var s,u,c,l,_,d,f,p;return we(this,(function(E){switch(E.label){case 0:return"web"!==r.toLowerCase()||this.disableLogReport?[2]:(s=this.logger.createTraceId(),this.logger.info(ae,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o,isCloudControl:a}),s),[4,this._getLogs(e,t,Kr.DEBUG,!1,s)]);case 1:return u=E.sent().logs,this.logger.info(oe,JSON.stringify({count:u.length}),s),c=ir(n)?n:"https://".concat(n),c+="?version=".concat("5.26.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u.length>0?[4,this.compressLogs(u)]:[3,3];case 2:return _=E.sent(),d=_.success,f=_.data,l=d?f:"compress failed",[3,4];case 3:l="no data or no database",E.label=4;case 4:return this.logger.debug(oe,"compress done",s),a&&(c+="&source=cloud"),[4,this.send({url:c,body:l,method:"POST"})];case 5:return p=E.sent().status,this.logger.info(se,JSON.stringify({status:p}),s),[2]}}))}))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}),e}();function tn(e){try{return!(!e||"object"!=typeof e)&&("number"==typeof e.time&&("string"==typeof e.tag&&("string"==typeof e.sessionId&&("string"==typeof e.type&&"number"==typeof e.level))))}catch(e){return!1}}function rn(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,{logs:[]}]}))}))}function nn(){}var on=function(){function e(e,t){qr.set(this,void 0),zr.set(this,void 0),ke(this,qr,e,"f"),ke(this,zr,t,"f")}return Object.defineProperty(e.prototype,"read",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o,a;return we(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,Fe(this,qr,"f").call(this,e,t,r,n,i)];case 1:return(o=s.sent())&&Array.isArray(o.logs)?[2,{logs:o.logs.filter(tn)}]:[2,{logs:[]}];case 2:return a=s.sent(),console.error("[LogDBProxy] read error",a),[2,{logs:[]}];case 3:return[2]}}))}))}}),Object.defineProperty(e.prototype,"write",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{Fe(this,zr,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}}),Object.defineProperty(e.prototype,"setLogReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"function"==typeof e&&ke(this,qr,e,"f"),this}}),Object.defineProperty(e.prototype,"setLogWriter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"function"==typeof e&&ke(this,zr,e,"f"),this}}),e}();qr=new WeakMap,zr=new WeakMap;var an,sn=function(){function e(){}var t,r,n,i,o,a;return Object.defineProperty(e,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Fe(this,t,"f",r)||(ke(this,t,e,"f",r),e.info(Pe,"start"),Fe(this,t,"m",a).call(this))}}),Object.defineProperty(e,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){Fe(this,t,"f",r)&&(Fe(this,t,"f",r).info(Pe,"stop"),ke(this,t,null,"f",r),Fe(this,t,"f",n)&&(clearTimeout(Fe(this,t,"f",n)),ke(this,t,null,"f",n)))}}),t=e,a=function e(){var a=this,s=Date.now();ke(this,t,setTimeout((function(){var n=Date.now()-s;n>=Fe(a,t,"f",o)&&Fe(a,t,"f",r).warn(Pe,"delta time: ".concat(n,"ms")),Fe(a,t,"m",e).call(a)}),Fe(this,t,"f",i)),"f",n)},r={value:null},n={value:null},i={value:30},o={value:1500},e}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(an||(an={}));var un=function(){function e(e){Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"uploadTask",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"taskLock",{enumerable:!0,configurable:!0,writable:!0,value:!0})}return Object.defineProperty(e.prototype,"uploadLogCmdTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.uploadTask.push(e),this.enqueueTask()}}),Object.defineProperty(e.prototype,"reportLogCmdTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i,o=this;this.taskLock=!1;var a=null!==(t=e.startTime)&&void 0!==t?t:0,s=null!==(r=e.endTime)&&void 0!==r?r:0,u=null!==(n=e.platform)&&void 0!==n?n:"",c=null!==(i=e.uri)&&void 0!==i?i:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(a,s,u,c,e.logId,"",!0).finally((function(){o.taskLock=!0,o.uploadTask.length>0&&o.enqueueTask()})))}}),Object.defineProperty(e.prototype,"enqueueTask",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}}}),e}();var cn,ln,_n,dn,fn=function(){function e(e,t,r){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"isEable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"expire",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"interval",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastRequestTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uploadTaskManage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"changeAreaCode",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.uploadTaskManage=new un(r)}return Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value: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)))}}),Object.defineProperty(e.prototype,"isExire",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(new Date).getTime()-this.timestamp<this.expire}}),Object.defineProperty(e.prototype,"isOverclock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(new Date).getTime()-this.lastRequestTime<this.interval}}),Object.defineProperty(e.prototype,"logCmdMsgTasks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===Ot&&t.uploadTaskManage.uploadLogCmdTask(e)}))}}),Object.defineProperty(e.prototype,"dataHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,or(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)}}),Object.defineProperty(e.prototype,"request",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return!this.isEable&&t===an.init&&this.isExire()?(this.logger.info(he,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===an.newWorkChange&&this.isOverclock()?(this.logger.info(ge,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(n=pr(e),this.lastRequestTime=(new Date).getTime(),i="".concat(n,"/v1/config"),o={"Content-Type":"application/json","RC-App-Key":this.appkey},r&&(o["RC-Token"]=r),a={platform:"web",version:"5.26.1",timestamp:this.timestamp},this.logger.record(Et.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!r,uri:i})),[4,this.httpRequest(i,Yt.POST,o,a)]);case 1:return s=f.sent(),u=s.code,c=s.data,this.logger.record(Et.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),u===J.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(l=c.targetRegion,this.changeAreaCode===l?[2,this.timestamp]:(_=Qr.setAreaCode(l),this.logger.info(Se,JSON.stringify({isChangeSuccess:_,originAreaCode:Qr.getAreaCode(),newAreaCode:l})),this.changeAreaCode=l,(d=Qr.getCloudControllerUrl(l))[0]?[2,this.request(d[0],an.other)]:(this.logger.info(ve,JSON.stringify({appkey:this.appkey,uri:i,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))}}),Object.defineProperty(e.prototype,"_handleMrtrData",{enumerable:!1,configurable:!0,writable:!0,value: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}(),pn=function(e){return e===J.RC_CONN_REDIRECTED},En=function(e){function t(t,r,n){var i=e.call(this)||this;return cn.add(i),Object.defineProperty(i,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"navi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_fromSuspend",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(i,"token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"curCmpUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:""}),dn.set(i,0),Object.defineProperty(i,"_doConnectReason",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"_network",{enumerable:!0,configurable:!0,writable:!0,value:{status:!0,type:Wt.UNKONWN}}),Object.defineProperty(i,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:lt.DISCONNECTED}),Object.defineProperty(i,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(i,"cmpWeightCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_crtConnectionTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"reconnectTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_failedCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"ALLOW_FAILED_TIMES",{enumerable:!0,configurable:!0,writable:!0,value:2}),i}return Le(t,e),Object.defineProperty(t.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.token}}),Object.defineProperty(t.prototype,"cid",{get:function(){return"".concat(this.uuid,"_").concat(this.retryCount)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtUserId}}),Object.defineProperty(t.prototype,"setConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===lt.DISCONNECTED&&e===lt.CONNECTING&&(this._doConnectReason=xt.CONNECT,Fe(this,cn,"m",_n).call(this)),this._crtConnectionStatus===lt.CONNECTED&&e===lt.SUSPENDED&&(t===J.RC_PING_EXCEED_LIMIT?this._doConnectReason=xt.TIMEOUT:t===J.RC_CONN_REDIRECTED?this._doConnectReason=xt.REDIRECTED:this._doConnectReason=xt.RECONNECT),this._crtConnectionStatus===lt.CONNECTED){var r={bid:fr(),cod:t,net:this.getNetwork().type,dur:Date.now()-Fe(this,dn,"f"),cid:this.cid};this.logger.record(Et.IM_CONNECTION_DURATION,JSON.stringify(r)),e===lt.SUSPENDED&&Fe(this,cn,"m",_n).call(this)}switch(this._crtConnectionStatus=e,e){case lt.CONNECTED:this.logger.info(K,"status: ".concat(e)),this.checkAlive(),Fe(this,cn,"m",ln).call(this).emit("onConnected",this._fromSuspend);break;case lt.CONNECTING:this.logger.warn(K,"status: ".concat(e)),Fe(this,cn,"m",ln).call(this).emit("onConnecting");break;case lt.SUSPENDED:this._fromSuspend=!0,this.logger.warn(K,"status: ".concat(e,", code: ").concat(t)),pn(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),Fe(this,cn,"m",ln).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(K,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),Fe(this,cn,"m",ln).call(this).emit("onDisconnected",t)}}}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtConnectionStatus}}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return this._crtConnectionStatus===lt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!t){var r={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(Et.IM_NETWORK_CHANGE,JSON.stringify(r))}this._network=e}}),Object.defineProperty(t.prototype,"getNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._network}}),Object.defineProperty(t.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus===lt.CONNECTED?[2,Or(this._crtUserId)]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=r,this.token=e,this.setConnectionStatus(lt.CONNECTING),[4,this.try2Connect(e,t,!1,n,!0)]);case 1:return i=s.sent(),o=i.code,a=i.data,o!==J.SUCCESS?(this.setConnectionStatus(lt.DISCONNECTED,o),[2,Ir(o)]):(this.setConnectionStatus(lt.CONNECTED),[2,Or(a)])}}))}))}}),Object.defineProperty(t.prototype,"try2Connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o;return we(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,r,n,i),[4,this._crtConnectionTask]);case 1:return o=a.sent(),this._crtConnectionTask=null,[2,o]}}))}))}}),Object.defineProperty(t.prototype,"createConnectionTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o,a,s,u,c,l,_,d,f,p;return we(this,(function(E){switch(E.label){case 0:return o={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0},this.logger.record(Et.IM_STATS_CS,JSON.stringify(o)),a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},[4,this.navi.request(e,r,!1,n,a)];case 1:return s=E.sent(),u=s.code,c=s.data,u!==J.SUCCESS?[2,Ir(u)]:1===(l=c).type?[2,Ir(J.PACKAGE_ENVIRONMENT_ERROR)]:(this.logger.info(W,JSON.stringify({token:e,reconnectKickEnable:t}),n),[4,this._connectWithToken(e.replace(/@.+$/,"@"),l,t,n)]);case 2:return _=E.sent(),d=_.code,f=_.data,i||d===J.SUCCESS||(this.retryCount+=1),pn(d)?(this.logger.warn(Y,"redirect code: ".concat(d),n),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,n,i)]):[J.RC_TCP_RESET,J.RC_CONN_ACK_TIMEOUT,J.RC_TCP_DISCONNECTED_NO_RMTP,J.CONNECTION_REFUSED].includes(d)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),p=this.cmpWeightCache.every((function(e){return e.failed})),i&&p?(this.logger.warn(Y,"cpp code:".concat(d,",reture code:").concat(J.SERVER_UNAVAILABLE),n),[2,Ir(J.SERVER_UNAVAILABLE)]):(this.logger.warn(Y,"cmp ack timeout, code: ".concat(d),n),this.setConnectionStatus(lt.SUSPENDED,d),this.setConnectionStatus(lt.CONNECTING),[2,this.createConnectionTask(e,t,!1,n,i)])):d!==J.SUCCESS?(this.logger.warn(Y,"code: ".concat(d),n),[2,Ir(d)]):(this.logger.info(Y,"userId: ".concat(f),n),ke(this,dn,Date.now(),"f"),this._crtUserId=f,[2,Or(f)])}}))}))}}),Object.defineProperty(t.prototype,"try2Reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i=this;return we(this,(function(o){return r=this.logger.createTraceId(),this.logger.debug(X,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),r),this.stopReconnectTimer(),n=function(){return De(i,void 0,void 0,(function(){var i;return we(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==lt.SUSPENDED?[2]:(this.setConnectionStatus(lt.CONNECTING,t),[4,this.try2Connect(this.token,!0,e,r,!1)]);case 1:return i=o.sent().code,this.reconnectTimer=null,i===J.SUCCESS?(this.setConnectionStatus(lt.CONNECTED),[2]):[J.SERVER_UNAVAILABLE,J.TIMEOUT,J.RC_SOCKET_DISCONNECTED,J.RC_SOCKET_NOT_CREATED,J.RC_CONN_ACK_TIMEOUT,J.RC_TCP_RESET,J.RC_NAVI_REQ_FAILED,J.RC_NETWORK_DOWN,J.RC_TCP_DISCONNECTED_NO_RMTP].includes(i)?(this._crtConnectionStatus!==lt.CONNECTING||(this.setConnectionStatus(lt.SUSPENDED,i),this.reconnectTimer=setTimeout(n,5e3)),[2]):(this.setConnectionStatus(lt.DISCONNECTED,i),[2])}}))}))},n(),[2]}))}))}}),Object.defineProperty(t.prototype,"onDisconnectByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return pn(e)?(this.setConnectionStatus(lt.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===J.RC_UDP_DISCONNECTED?(this.setConnectionStatus(lt.SUSPENDED,e),void setTimeout((function(){r.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(lt.DISCONNECTED,e)}}),Object.defineProperty(t.prototype,"onDisconenctUnusual",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setConnectionStatus(lt.SUSPENDED,e),this.try2Reconnect(!1,e)}}),Object.defineProperty(t.prototype,"checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r=this;return we(this,(function(n){switch(n.label){case 0:return this._crtConnectionStatus!==lt.CONNECTED?(this._failedCount=0,this.logger.debug(ie,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.debug(re,null,e),[4,this.sendPing(15e3)]);case 1:return(t=n.sent())===J.SUCCESS?(this.logger.debug(ne,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return r.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==lt.CONNECTED?[2]:(this._failedCount+=1,this.logger.debug(ne,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(ie,"ping timeout, close connection to reconnect!"),[4,this.close(!0)]));case 2:return n.sent(),this.setConnectionStatus(lt.SUSPENDED,J.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,J.RC_PING_EXCEED_LIMIT),[2]}}))}))}}),Object.defineProperty(t.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){return we(this,(function(r){switch(r.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:r.sent(),r.label=2;case 2:return this.setConnectionStatus(lt.DISCONNECTED,J.ACTIVE_DISCONNECT),[2,this.close(!1,e,t)]}}))}))}}),Object.defineProperty(t.prototype,"stopReconnectTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}),Object.defineProperty(t.prototype,"getCmpList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return Ge([],Ve(this.cmpWeightCache),!1);var r=ur(e,t);return this.cmpWeightCache=Ge([],Ve(r),!1),Ge([],Ve(r),!1)}}),Object.defineProperty(t.prototype,"updateCmpWeight",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(this.cmpWeightCache){var n=this.cmpWeightCache.find((function(t){return r?t.addr===e&&t.protocol===xe.QUIC:t.addr===e}));if(n)if(t){var i=Math.max.apply(Math,Ge([],Ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));n.weight!==i&&(n.weight=i+1)}else{var o=Math.min.apply(Math,Ge([],Ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));n.weight!==o&&(n.weight=o-1),n.failed=!0}}}}),Object.defineProperty(t.prototype,"clearCmpWeightCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.cmpWeightCache=void 0}}),Object.defineProperty(t.prototype,"reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){this.token=e,this._openCallPlus=r,this.onDisconenctUnusual(n)}}),t}(gr);dn=new WeakMap,cn=new WeakSet,ln=function(){return this},_n=function(){this.uuid=$t(),this.retryCount=0};var bn=function(e){return e.replace(/@.+$/,"@")},Rn=function(){function e(e,t,r,n,i,o){void 0===n&&(n=!0),void 0===i&&(i=!0),void 0===o&&(o=!1),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"isRequestProfile",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"crtRequest",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:"default"})}return Object.defineProperty(e.prototype,"getCatchKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e+(this._environment?"-".concat(this._environment):"")}}),Object.defineProperty(e.prototype,"request",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o;return we(this,(function(a){switch(a.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,r,n,i),[4,this.crtRequest]);case 1:return o=a.sent(),this.crtRequest=null,[2,o]}}))}))}}),Object.defineProperty(e.prototype,"sendRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o;return De(this,void 0,void 0,(function(){var a,s,u,c,l,_,d,f,p,E,b,R,h,g,v,O,I;return we(this,(function(C){switch(C.label){case 0:return a=bn(e),s=this.getNaviCache(a),!t&&s&&(u=s.timestamp,c=s.naviInfo,r||Date.now()-u<Xt)?(this.logger.info(q,JSON.stringify({fromCache:!0,naviInfo:c}),n),i&&(l=i.uuid,_=i.retryCount,d=i.reason,f={bid:fr(),ptc:Vt.NAVI,cod:J.SUCCESS,net:i.type,dur:0,spr:0,pr:null!==(o=c.type)&&void 0!==o?o:0,hos:"",cache:Gt.LOCAL,v:Ft.CURRENT,rsn:d,cid:"".concat(l,"_").concat(_),count:_},this.logger.record(Et.IM_NAVI,JSON.stringify(f),n)),[2,Or(c)]):(p=Qr.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(Q,JSON.stringify({token:e,uris:p}),n),[4,this.requestHandler(p,e,n,i)]);case 1:return E=C.sent(),b=E.code,R=E.data,b===J.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(h=C.sent())?void 0:h.navi)&&(null==h?void 0:h.navi.length)>0?(g=h.navi,[4,this.requestHandler(g,e,n,i)]):[3,4];case 3:v=C.sent(),b=v.code,R=v.data,C.label=4;case 4:return b!==J.SUCCESS?(this.logger.warn(Z,b,n),[2,Ir(b)]):(O=R).code&&200!==O.code?(this.logger.warn(Z,O.code,n),[2,Ir(this.transHttpCode(O.code))]):ur(O).length>0?(this.logger.info(Z,JSON.stringify({naviInfo:O}),n),this.setNaviCache(a,O),[2,Or(O)]):(I={server:O.server,backupServer:O.backupServer,serverAddr:O.serverAddr,bs:O.bs},this.logger.warn(Z,"navi server address invalid: ".concat(JSON.stringify(I)),n),[2,Ir(J.SERVER_UNAVAILABLE)])}}))}))}}),Object.defineProperty(e.prototype,"requestHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:i=0,o=e.length,f.label=1;case 1:return i<o?(a=i===e.length-1,s=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,s.call(this,e[i],this.appkey,t,r,a)]):[3,4];case 2:if(c=f.sent(),l=c.code,_=c.data,d={bid:fr(),ptc:Vt.NAVI,cod:l,net:null==n?void 0:n.type,dur:Date.now()-u,spr:0,pr:(null==_?void 0:_.type)||0,hos:e[i],cache:Gt.REQUEST,v:Ft.CURRENT,rsn:null==n?void 0:n.reason,cid:"".concat(null==n?void 0:n.uuid,"_").concat(null==n?void 0:n.retryCount),count:null==n?void 0:n.retryCount},this.logger.record(Et.IM_NAVI,JSON.stringify(d),r),[J.SUCCESS,J.RC_CONN_TOKEN_INCORRECT,J.RC_LICENSE_EXPIRED].includes(l))return[2,l===J.SUCCESS?Or(_):Ir(l)];f.label=3;case 3:return i+=1,[3,1];case 4:return[2,Ir(J.RC_NAVI_REQ_FAILED)]}}))}))}}),Object.defineProperty(e.prototype,"transHttpCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){switch(e){case 401:case 403:return J.RC_CONN_TOKEN_INCORRECT;case 416:return J.RC_LICENSE_EXPIRED;default:return J.RC_NAVI_REQ_FAILED}}}),Object.defineProperty(e.prototype,"getNaviInfoFromCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getNaviCache(bn(e));return t?t.naviInfo:null}}),Object.defineProperty(e.prototype,"updateVoipCallInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getNaviInfoFromCache(e);r&&this.setNaviCache(bn(e),Ue(Ue({},r),{voipCallInfo:t}))}}),Object.defineProperty(e.prototype,"getNaviV2RequestOption",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.uri,n=e.token,i=e.platform,o=e.protocol,a=e.mac;t="".concat(r,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(n),"&v=").concat(Qt,"&platfrom=").concat(i);return a&&(s+="&m=".concat(a)),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2;iptype=v4,v6")},body:s,url:t,timeout:1e4}}}),Object.defineProperty(e.prototype,"useV2Navi",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!0}}),e}(),hn=new Map([["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:StreamMsg",{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:RcNtf",{isCounted:!1,isPersited:!0}],["RC:CmdMsg",{isCounted:!1,isPersited:!1}],["RC:TypSts",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:PSCmd",{isCounted:!1,isPersited:!1}],["RC:SRSMsg",{isCounted:!1,isPersited:!1}],["RC:RcCmd",{isCounted:!1,isPersited:!0}],["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,isStatusMessage:!0}],["RC:RLJoin",{isCounted:!1,isPersited:!1}],["RC:RLQuit",{isCounted:!1,isPersited:!1}],["RC:RL",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:CCConfigChangeRequestMsg",{isCounted:!1,isPersited:!1}]]);function gn(e,t){var r=hn.get(e);r&&!r.isCustom&&console.warn("Builtin message type '".concat(e,"' cannot be registered")),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),hn.set(e,Ue(Ue({},t),{isCustom:!0}))}function vn(e){return hn.get(e)||{isCustom:!0,isPersited:!1,isCounted:!1,isStatusMessage:!1}}function On(){return Array.from(hn.keys()).map((function(e){return Ue({objectName:e},hn.get(e))})).filter((function(e){return!e.isCustom}))}var In=0,Cn=1,Sn=2,Tn=3,Nn=4,Pn=5,mn=function(){function e(e,t,r,n){Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sourceLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.identifier=e,this.sourceLanguage=t||"auto",this.targetLanguage=r,this.text=n}return Object.defineProperty(e.prototype,"isValid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"string"==typeof this.identifier&&this.identifier.length>0&&"string"==typeof this.sourceLanguage&&(void 0===this.targetLanguage||"string"==typeof this.targetLanguage)&&(e?"string"==typeof this.text:void 0===this.text||"string"==typeof this.text)}}),Object.defineProperty(e.prototype,"toInnerParam",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{identifier:this.identifier,sourceLanguage:this.sourceLanguage,targetLanguage:this.targetLanguage,content:this.text}}}),e}();!function(e){function t(t,r,n,i){return e.call(this,t,r,n,i)||this}Le(t,e)}(mn),function(e){function t(t,r,n){return e.call(this,Fr(t),r,n,t)||this}Le(t,e)}(mn);var yn,An,Ln=0,Mn=0,Un=4,Dn=5;!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_R="P-connect-R",e.P_CONNECT_E="P-connect-E",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_O="P_WRITE_LOG_O",e.P_PARSE_JSON_E="P-parse_json-E",e.L_HANDLE_LOW_PRIORITY_MESSAGES_T="L-handle_low_priority_messages-T",e.L_HANDLE_LOW_PRIORITY_MESSAGES_R="L-handle_low_priority_messages-R",e.L_JS_CALLBACK_EXCEPTION_E="L-js_callback_exception-E",e.L_RECV_S_MSG_S="L-recv_s_msg-S",e.L_DISCARD_MSG_O="L-discard_msg-O"}(yn||(yn={})),function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.EVENT=1]="EVENT",e[e.CALLBACK=2]="CALLBACK"}(An||(An={}));var wn=function(e,t,r){return De(void 0,void 0,void 0,(function(){var n,o;return we(this,(function(a){return n=i.createDecipheriv("aes-256-cbc",t,r),o=n.update(e,"base64","utf-8"),[2,o+=n.final("utf8")]}))}))},jn=function(e){if(!o.existsSync(e)){var r=t.resolve(e,"..");o.existsSync(r)||jn(r),o.mkdirSync(e)}},Vn=function(e){return Object.entries(e).map((function(e){var t=Ve(e,2),r=t[0],n=t[1];return{key:r,value:String(n)}}))},Gn=function(e){return{removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}},Fn=function(){return"undefined"==typeof __dirname?t.dirname(a.fileURLToPath("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("index.cjs",document.baseURI).href)):__dirname};function kn(e){return JSON.parse(e).list.map((function(e){return e.value}))}var xn,Hn=t.resolve(Fn(),"binding","electron-".concat(r.platform(),"-").concat(r.arch(),".node")),Bn={addon:null},Jn=(xn=process,{sendError:function(e){xn.send({type:An.ERROR,data:{msg:e}})},sendEvent:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];xn.send({type:An.EVENT,data:{eventName:e,data:t}})},sendResponse:function(e){xn.send({type:An.RESPONSE,data:e})},sendCallback:function(e){xn.send({type:An.CALLBACK,data:e})}}).sendError;try{var Wn=require;Bn.addon=Wn(Hn)}catch(e){console.error("error ->",Hn,"\n",e),Jn(e.toString())}Bn.addon||console.error("error -> cannot find module: ",Hn);var Yn=Bn.addon,Kn=function(e,t){var r,n=Buffer.from(e),i=n.length;for(t.push(i),r=0;r<i;r++)t.push(n[r])},Xn=function(e){return"string"==typeof e},Qn=function(e){return Xn(e)?e.toUpperCase():""},Zn=function(e,t){var r="";return 2!==e.length?r="Unexpected number of bytes received.":5!==e[0]?r="Unexpected SOCKS version number: ".concat(e[0],"."):255===e[1]?r="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(r="Unexpected SOCKS authentication method: ".concat(e[1],".")),r},qn=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},zn=function(e){var t=Qn(e.method)||"GET",r=e.pathname||"/",n=e.headers||{},i=e.search||"";n.Host=e.host||"loclahost";var o="";for(var a in o="".concat(t," ").concat(r+i," HTTP/1.1\n"),n)if(Object.hasOwnProperty.call(n,a)){var s=n[a];o+="".concat(a,": ").concat(s,"\n")}return e.body&&(o+="Content-Length: ".concat(e.body.length,"\n")),o+="\n","POST"===t&&e.body&&(o+="".concat(e.body)),o},$n=function(e){return new Promise((function(t){var r,n;e.socket.once("data",(function(n){var i,o=Zn(n,r);if(!o)return 2===n[1]?(e.socket.once("data",(function(r){var n=qn(r);n?e.emit("error",new Error("SOCKS authentication failed. ".concat(n))):t()})),i=[1],Kn(e.socksUsername,i),Kn(e.socksPassword,i),void e.write(Buffer.from(i))):void t();e.emit("error",new Error("SOCKS authentication failed. ".concat(o)))})),r=[0],e.socksUsername&&r.push(2),(n=Buffer.alloc(2+r.length))[0]=5,n[1]=r.length,r.forEach((function(e,t){n[2+t]=e})),e.write(n)}))},ei=function(e,t,r){return new Promise((function(n){var i,o;switch(e.socket.once("data",(function(t){var r;5!==t[0]?r="Unexpected SOCKS version number: ".concat(t[0],"."):0!==t[1]?r="".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]&&(r="The reserved byte must be 0x00."),r?e.emit("error",new Error("SOCKS connection failed. ".concat(r))):n()})),(i=[]).push(5),i.push(1),i.push(0),l.isIP(t)){case 0:i.push(3),Kn(t,i);break;case 4:i.push(1),function(e,t){var r,n,i=e.split(".");for(r=0;r<4;r++)n=parseInt(i[r],10),t.push(n)}(t,i);break;case 6:e.emit("error",new Error("Does not support IPV6"))}i.length+=2,(o=Buffer.from(i)).writeUInt16BE(r,o.length-2),e.write(o)}))},ti=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"socket",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksUsername",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksPassword",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"writable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"readable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r.socket=new l.Socket,r.options=t,r.socksHost=t.socksHost||"localhost",r.socksPort=t.socksPort||1080,r.socksUsername=t.socksUsername||"",r.socksPassword=t.socksPassword||"",r.socket.on("error",(function(e){r.emit("error",e)})),r.on("error",(function(){r.socket.destroyed||r.socket.destroy()})),r.on("end",r.end),r}return Le(t,e),Object.defineProperty(t.prototype,"ref",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.ref()}}),Object.defineProperty(t.prototype,"unref",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.unref()}}),Object.defineProperty(t.prototype,"setTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.socket.setTimeout(e,t)}}),Object.defineProperty(t.prototype,"setNoDelay",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.setNoDelay(e)}}),Object.defineProperty(t.prototype,"setKeepAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.socket.setKeepAlive(e,t)}}),Object.defineProperty(t.prototype,"address",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.address()}}),Object.defineProperty(t.prototype,"cork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.cork()}}),Object.defineProperty(t.prototype,"uncork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.uncork()}}),Object.defineProperty(t.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.pause()}}),Object.defineProperty(t.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.resume()}}),Object.defineProperty(t.prototype,"pipe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.pipe(e)}}),Object.defineProperty(t.prototype,"end",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.socket.end(e,t);return this.writable=this.socket.writable,r}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.destroy(e)}}),Object.defineProperty(t.prototype,"setEncoding",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.setEncoding(e)}}),Object.defineProperty(t.prototype,"write",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.socket.write(e,t,r)}}),Object.defineProperty(t.prototype,"read",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.read(e)}}),Object.defineProperty(t.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=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 De(r,void 0,void 0,(function(){var r;return we(this,(function(n){switch(n.label){case 0:return[4,$n(this)];case 1:return n.sent(),[4,ei(this,t,e)];case 2:return n.sent(),this.onProxied(),r=zn(this.options),this.socket.write(Buffer.from(r)),[2]}}))}))})),this}}),Object.defineProperty(t.prototype,"onProxied",{enumerable:!1,configurable:!0,writable:!0,value: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}(_.EventEmitter),ri=function(e){var t,r=e.hostname,n=e.port;return!e.host||r&&n||(t=e.host.split(":")),!n&&t&&(n=parseInt(t[1],10)||0),!r&&t&&(r=Ve(t,1)[0]),new ti(e).connect(n,r)},ni=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.createConnection=ri,r}return Le(t,e),t}(s.Agent),ii=function(e,t,r){return(t=Ue(Ue({},t),a.parse(e))).port||(t.port=80),t.agent=new ni(t),s.request(t,r)},oi=function(e){var t,r;return t=ri(e),r=t.onProxied,t.onProxied=function(){var n;e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&(n=Ve(e.host.split(":"),1),e.servername=n[0]),t.socket=d.connect(e,(function(){t.authorized=t.socket.authorized,r.call(t)})),t.socket.on("error",(function(e){t.emit("error",e)}))},t},ai=function(e){function t(t,r){var n=e.call(this,r)||this;return Object.defineProperty(n,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.url=t,n.socksHost=r.socksHost||"localhost",n.socksPort=r.socksPort||1080,n.createConnection=oi,n}return Le(t,e),t}(u.Agent),si=function(e,t,r,n){var i,o;return t.protocol="https:",!t.port&&t.host&&(i=Ve(t.host.split(":"),2),t.port=i[0],t.port=i[1]),t.port||(t.port=443),o=new ai(e,t),t.agent=o,u.request(e,t,r)},ui=null;function ci(e,t,r){void 0===r&&(r=!1);var n=t.url,i=t.headers,o=t.body,a=t.method,c=t.query,l=t.timeout,_=void 0===l?6e4:l;return new Promise((function(t){var l=/^https/.test(n),d={headers:Ue(Ue({},i),{"Accept-Encoding":"gzip, br"}),method:a};l&&(d.rejectUnauthorized=r);var f=null;ui?((d=Ue(Ue({},d),ui)).body=o,f=l?si:ii):(f=s.request,l&&(d.agent=new u.Agent(d),f=u.request));var p=f(function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var r=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return r.length?[e,r.join("&")].join("?"):e}(n,c),d,(function(e){var r,n,i=e.statusCode,o="";if("gzip"===(null===(r=e.headers)||void 0===r?void 0:r["content-encoding"])){var a=E.default.createGunzip();e.pipe(a),a.on("data",(function(e){o+=e})),a.on("end",(function(){t({status:i,data:o})}))}else if("br"===(null===(n=e.headers)||void 0===n?void 0:n["content-encoding"])){var s=E.default.createBrotliDecompress();e.pipe(s),s.on("data",(function(e){o+=e})),s.on("end",(function(){t({status:i,data:o})}))}else e.setEncoding("utf8"),e.on("data",(function(e){o+=e})),e.once("end",(function(){t({status:i||0,data:o})}))}));p.once("timeout",(function(){e.warn(yn.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:n,method:a,query:c,timeout:_})),t({status:0})})),p.setTimeout(_),p.once("error",(function(r){e.warn(yn.P_HTTP_REQ_E,JSON.stringify({msg:r.stack,url:n,method:a,query:c,timeout:_})),t({status:0})})),p.write(o),p.end()}))}function li(e,t){return e?(ui=Ue(Ue({},ui),e),t.info(fe,JSON.stringify({msg:"set proxy",data:ui})),{code:J.SUCCESS}):(ui=null,t.info(de,JSON.stringify({msg:"remove proxy"})),{code:J.SUCCESS})}function _i(){var e=ui||void 0;return{code:J.SUCCESS,data:e}}var di,fi=function(){function e(e,t,r,n){var i=this;Object.defineProperty(this,"p",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callback",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"errorHandle",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"count",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.p.on("message",(function(e){var o=e.type,a=e.data;switch(o){case An.EVENT:var s=a,u=s.eventName,c=s.data;null==t||t.apply(void 0,Ge([u],Ve(c),!1));break;case An.RESPONSE:var l=a,_=l.reqId,d=l.success,f=l.data,p=i.maps[_];if(!p)return;p({success:d,data:f}),delete i.maps[_];break;case An.CALLBACK:null==r||r(a);break;case An.ERROR:var E=a.msg;null==n||n(E)}})),this.p.on("error",(function(e){null==n||n("SubProcessProxy error ".concat(e))})),this.p.on("exit",(function(e,t){if(0!==e){for(var r in i.maps){if(Object.prototype.hasOwnProperty.call(i.maps,r))(0,i.maps[r])({success:!0,data:{code:J.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==n||n("SubProcessProxy exit ".concat(e," ").concat(t),!0)}})),this.p.on("close",(function(e,t){console.log("SubProcessProxy close",e,t)}))}return Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return this.p.killed||this.p.exitCode?[2,Promise.resolve({success:!1,data:{code:J.SUB_PROCESS_EXIT,msg:"sub process exit"}})]:[2,new Promise((function(n){var i=++r.count;r.maps[i]=n;var o={reqId:i,method:e,args:t,hasResponse:!0};r.p.send(o)}))]}))}))}}),Object.defineProperty(e.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return De(this,void 0,void 0,(function(){var n;return we(this,(function(i){return(this.p.killed||this.p.exitCode)&&(null===(t=this.errorHandle)||void 0===t||t.call(this,"sub process exit")),n={reqId:-1,method:e,args:r},this.p.send(n),[2]}))}))}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.send("destroy")}}),e}(),pi=function(e,t,r,n,i){return De(void 0,void 0,void 0,(function(){var o,a,s,u,c,l;return we(this,(function(_){switch(_.label){case 0:return o=function(){var e,t=new Promise((function(t){e=t}));return{resolve:e,promise:t}}(),a=o.resolve,s=o.promise,Yn.getLog(e,t,r,n,(function(e){a(Or(e))}),(function(e){a(Ir(e))})),[4,s];case 1:return(u=_.sent()).isOk?(c=0,l=JSON.parse(u.data).filter((function(e){return c+=function(e){return e.content.length+e.tag.length+e.sessionId.length+e.type.length+2+13+6}(e),!!i||e.level>0})),[2,Or({logs:l,size:c})]):[2,u.wipe()]}}))}))},Ei=function(e,t,r){return De(void 0,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return n=e.startTime,i=e.endTime,o=e.level,a=e.isRealtimeReport,[4,pi(o,n,i,s=100,a)];case 1:return(u=f.sent()).isOk?(c=u.data,l=c.logs,_=c.size,0===l.length||(t+=_)>=20971520?[2]:l.length<s?(r.push.apply(r,Ge([],Ve(l),!1)),[2]):(d=l[l.length-1].time,e.startTime=d,r.push.apply(r,Ge([],Ve(l.filter((function(e){return e.time<d}))),!1)),[2,Ei(e,t,r)])):[2]}}))}))},bi=[],Ri=!1,hi=function(){return De(void 0,void 0,void 0,(function(){var e,t,r,n;return we(this,(function(i){switch(i.label){case 0:return Ri||0===bi.length?[2]:(Ri=!0,e=bi.shift(),t=e.resolve,r=e.args,[4,Ei(r,0,n=[])]);case 1:return i.sent(),t({logs:n,dbReady:!0}),Ri=!1,hi(),[2]}}))}))},gi=function(e){function r(t,r,n,i,o){void 0===i&&(i=!1);var a,s=process.versions.electron,u="Electron|".concat(s,"|").concat(process.arch,"|").concat(process.platform);return a=e.call(this,t,r,u,o,n,i)||this,Object.defineProperty(a,"_subProcess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a}return Le(r,e),Object.defineProperty(r.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return ci(this.logger,e)}}),Object.defineProperty(r.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._subProcess&&this._subProcess.destroy(),e.prototype.stop.call(this)}}),Object.defineProperty(r.prototype,"compressLogs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var r,i,o,a;return we(this,(function(s){switch(s.label){case 0:return this._subProcess||(r=n.fork(t.resolve(Fn(),"sub-process.cjs.js"),{stdio:["inherit","inherit","inherit","ipc"]}),this._subProcess=new fi(r)),[4,this._subProcess.call("compressLogs",e)];case 1:return i=s.sent(),o=i.success,a=i.data,o?[2,{success:o,data:a.data}]:[2,{success:o,data:""}]}}))}))}}),r}(en),vi="rc-realtime-log-timestamp",Oi=!1,Ii=function(){var e=new on(rn,nn);return e.setLogReader((function(e,t,r,n){return De(void 0,void 0,void 0,(function(){return we(this,(function(i){switch(i.label){case 0:return[4,(o={startTime:e,endTime:t,level:r,isRealtimeReport:n},De(void 0,void 0,void 0,(function(){return we(this,(function(e){return[2,new Promise((function(e){bi.push({resolve:e,args:o}),hi()}))]}))})))];case 1:return[2,{logs:i.sent().logs}]}var o}))}))})),e.setLogWriter((function(e){Si(e)})),e},Ci=[],Si=function(e){Oi&&(Ci.push(e),di||(di=setImmediate((function(){return function(){if(di&&(clearImmediate(di),di=null),Ci.length){var e=Ci.splice(0).map((function(e){var t=e.sessionId,r=e.level,n=e.time,i=e.type,o=e.tag,a=e.loggerId,s=e.content,u=e.traceId;return{level:r,time:n,type:i,tag:o,sessionId:"".concat(er,":").concat(er===t?"main":t),content:JSON.stringify({loggerId:a,content:s,traceId:u})}})),t=JSON.stringify(e);Yn.writeLog(t)}}()}))))},Ti=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n,i)||this;return Oi||(Oi=!0),o}return Le(t,e),Object.defineProperty(t.prototype,"getTimestamp4RealtimeLog",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Yn.getStoreValue(vi);return parseInt(e,10)||0}}),Object.defineProperty(t.prototype,"setTimestamp4RealtimeLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Yn.setStoreValue(vi,e.toString())}}),Object.defineProperty(t.prototype,"recvRendererLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._stdout(e),this._write(e)}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){Oi=!1}}),t}($r),Ni=function(){var e,t=Date.now(),n=[r.arch(),r.platform(),process.pid,t,Math.floor(Math.random()*t)].join("__");return e=n,i.createHash("md5").update(e).digest("hex")},Pi=function(){function e(e){Object.defineProperty(this,"_callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_setTime",{enumerable:!0,configurable:!0,writable:!0,value:15962112e5})}return Object.defineProperty(e.prototype,"_setToProtocol",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=JSON.stringify(r);"{}"!==n&&e.info(yn.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:t,ext:r})),this._callCppProxy("setMessageExtension",1,"1",t,n,"")}}),Object.defineProperty(e.prototype,"setLocalFromExtMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t.channelId,t.conversationType,t.targetId;var r=t.content,n=t.sentTime,i=r,o=i.put,a=this._callCppProxy("getMessage",i.mid),s=JSON.parse(a).extMsg,u=JSON.parse(s||"{}");if(o)for(var c in o){var l=u[c];l&&l.ts<n-this._setTime?(l.v=o[c],l.ts=n-this._setTime):(u[c]={v:"",ts:0},u[c].v=o[c],u[c].ts=n-this._setTime)}i.del&&i.del.forEach((function(e){delete u[e]})),this._setToProtocol(e,i.mid,u)}}),Object.defineProperty(e.prototype,"parseReceiveExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e.extMsg||"{}"),r={};for(var n in t)r[n]=t[n].v;return r}}),e}(),mi=[xe.RMTP,xe.TLS];"darwin"===process.platform&&mi.push(xe.QUIC);var yi=function(e){return"RongCloud/navis/".concat(e,"/navi-cache.json")},Ai=function(e){return"RongCloud/caches/".concat(e,"/staticConfig.json")},Li=function(e){return"RongCloud/cloudControl/".concat(e,"/cloudControl.json")};function Mi(e){var t,n;void 0===e&&(e="IPv4");var i=r.networkInterfaces(),o=[];try{for(var a=je(Object.values(i)),s=a.next();!s.done;s=a.next()){var u=s.value;if(u&&-1!==Object.prototype.toString.call(u).indexOf("Array")){var c=u.filter((function(t){return!(t.internal||(r=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(r))||t.family&&t.family!==e);var r})).map((function(e){return e.mac}));o.push.apply(o,Ge([],Ve(c),!1))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o.length?Ge([],Ve(o),!1).sort()[0]:""}var Ui,Di,wi=function(e){function r(r,n,i,a){var s=e.call(this,r,n,a)||this;Object.defineProperty(s,"naviPath",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(s,"_caches",{enumerable:!0,configurable:!0,writable:!0,value:{}}),s.naviPath="".concat(i,"/").concat(yi(r));var u=t.dirname(s.naviPath);return o.existsSync(u)||jn(u),s}return Le(r,e),Object.defineProperty(r.prototype,"httpRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return i="token=".concat(encodeURIComponent(r),"&v=").concat(Qt,"&p=PC&ev=").concat("5.26.1","&m=").concat(Mi()),o="".concat(e,"/navi.json?r=").concat(Date.now(),"&env=").concat(this._environment),this.logger.info(q,JSON.stringify({url:o,body:i}),n),[4,ci(this.logger,{method:"POST",headers:{appId:t},body:i,url:o,timeout:1e4})];case 1:if(200!==(a=c.sent()).status)return this.logger.warn(z,JSON.stringify({url:o,code:a.status}),n),[2,Ir(this.transHttpCode(a.status))];this.logger.info(z,JSON.stringify({url:o,data:a.data}),n);try{return s=JSON.parse(a.data),u=/^https/.test(o)?"https":"http",s.protocol=u,s.code&&200!==s.code?[2,Ir(this.transHttpCode(s.code))]:[2,Or(s)]}catch(e){return this.logger.error($,a.data,n),[2,Ir(J.RC_NAVI_REQ_FAILED)]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"httpRequestV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s;return we(this,(function(u){switch(u.label){case 0:return i=this.getNaviV2RequestOption({appkey:t,token:r,uri:e,platform:"electron",protocol:mi.join(","),mac:Mi()}),this.logger.info(q,JSON.stringify({url:i.url,body:i.body,headers:i.headers}),n),[4,ci(this.logger,i)];case 1:if(200!==(o=u.sent()).status)return this.logger.warn(z,JSON.stringify({url:i.url,code:o.status}),n),[2,Ir(this.transHttpCode(o.status))];this.logger.info(z,JSON.stringify({url:i.url,data:o.data}),n);try{return a=JSON.parse(o.data),s=/^https/.test(i.url)?"https":"http",a.protocol=s,[2,Or(a)]}catch(e){return this.logger.error($,o.data,n),[2,Ir(J.RC_NAVI_REQ_FAILED)]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"getNaviCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getCatchKey(e),r=this._caches[t];if(r)return r;if(!o.existsSync(this.naviPath))return null;var n=o.readFileSync(this.naviPath,{encoding:"utf8"});try{return this._caches=JSON.parse(n),this._caches[t]}catch(e){this.logger.error($,n)}return null}}),Object.defineProperty(r.prototype,"setNaviCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Date.now(),n=this.getCatchKey(e);if(or(this._caches))for(var i in this._caches){(r-this._caches[i].timestamp>Xt||n===i)&&delete this._caches[i]}this._caches[n]={token:e,naviInfo:t,timestamp:Date.now(),environment:this._environment},o.writeFileSync(this.naviPath,JSON.stringify(this._caches))}}),Object.defineProperty(r.prototype,"setEnvironment",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._environment=e}}),Object.defineProperty(r.prototype,"setUseNaviV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.useNaviV2=e}}),r}(Rn);function ji(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];var o,a=e.createTraceId();if(e.debug(yn.P_CALL_ADDON_T,JSON.stringify({method:r,params:n}),a),!Yn[r])throw e.error(yn.P_CALL_ADDON_E,"Method ".concat(r," not found in addon"),a),new Error("Method ".concat(r," not found in addon"));try{o=Yn[r].apply(Yn,Ge([],Ve(n),!1))}catch(t){throw e.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:r}),a),t}return e.debug(yn.P_CALL_ADDON_R,JSON.stringify({method:r,params:n,result:t?o:void 0}),a),o}var Vi,Gi,Fi,ki,xi=function(){function e(e,t,r){var n=this;Ui.add(this),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_method",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._traceId=null!=r?r:this._logger.createTraceId(),this._promise=new Promise((function(e){n._resolve=e}))}return Object.defineProperty(e,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return new e(t,r,n)}}),Object.defineProperty(e.prototype,"invoke",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(e=Fe(this,Ui,"m",Di)).call.apply(e,Ge([this,!0],Ve(t),!1))}}),Object.defineProperty(e.prototype,"asyncInvoke",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(e=Fe(this,Ui,"m",Di)).call.apply(e,Ge([this,!1],Ve(t),!1))}}),Object.defineProperty(e.prototype,"ok",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.debug(yn.P_CALL_ADDON_R,"success",this._traceId),this._flush(Or(e))}}),Object.defineProperty(e.prototype,"fail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.warn(yn.P_CALL_ADDON_R,"faile: ".concat(e),this._traceId),this._flush(Ir(e,"",t))}}),Object.defineProperty(e.prototype,"_flush",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;setImmediate((function(){return t._resolve(e)}))}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._promise}}),e}();Ui=new WeakSet,Di=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this,o=i._method,a=i._traceId,s=i._logger;s.debug(yn.P_CALL_ADDON_T,JSON.stringify({method:o,params:r}),a);try{t=Yn[o].apply(Yn,Ge([],Ve(r),!1))}catch(e){throw s.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==e?void 0:e.stack,method:o}),a),e}return e&&t!==J.SUCCESS&&this.fail(t),this},function(e){e[e.SUCCESS=0]="SUCCESS",e[e.NOT_INIT=-1]="NOT_INIT",e[e.CANCELED=-2]="CANCELED",e[e.REPEAT=-3]="REPEAT"}(ki||(ki={}));var Hi=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i)||this;return Vi.add(o),Object.defineProperty(o,"callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_naviInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(o,"_excludeLogTag",{enumerable:!0,configurable:!0,writable:!0,value:["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"]}),Object.defineProperty(o,"_connectingTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(o,"_tcpDuration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),o.callCppProxy("setConnectionStatusListener",Fe(o,Vi,"m",Gi).bind(o),(function(e){return o.logger.info(yn.P_DB_OPEN_O,e)}),(function(){return o.recvPong(J.SUCCESS)}),Fe(o,Vi,"m",Fi).bind(o),o._onTcpConnectResponse.bind(o),(function(){o.logger.info(yn.P_DB_UPGRATE_START_S),o.emit("onDBUpgrateStart")}),(function(e){o.logger.info(yn.P_DB_UPGRATING_S,e),o.emit("onDBUpgrading",e)}),(function(e){o.logger.info(yn.P_DB_UPGRATE_COMPLETE_S,e),o.emit("onDBUpgradeComplete",e)})),o}return Le(t,e),Object.defineProperty(t.prototype,"getConnectedTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._connectedTime}}),Object.defineProperty(t.prototype,"_connectWithToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f,p,E,b,R,h=this;return we(this,(function(g){switch(g.label){case 0:return i=this._connectingTask=xi.create(this.logger,"connectWithToken",n),this._naviInfo=t,o={},(a=_i().data)&&(o={proxy_passwd:a.socksPassword||"",proxy_name:a.socksUsername||"",proxy_port:a.socksPort||1082,proxy_host:a.socksHost||"localhost",proxy_type:0}),s=JSON.stringify(Ue(Ue({},o),{call_plus:this._openCallPlus,cid:this.cid})),u=this.getCmpList(t,!0).filter((function(e){return mi.includes(e.protocol)})).sort((function(e,t){return t.weight-e.weight})),c=[],u.forEach((function(e){var t=c.find((function(t){return t.addr===e.addr}));t?t.protocol!==xe.QUIC&&e.protocol!==xe.QUIC||(t.race=!0,t.protocol=xe.QUIC):(e.race=!1,c.push(e))})),this.logger.info(yn.P_CONNECT_T,JSON.stringify({}),n),l=Date.now(),[4,i.asyncInvoke(e,Qt,JSON.stringify(Ue(Ue({},t),{serverAddr:c,tagBlacklist:this._excludeLogTag.join(",")})),r,s).result()];case 1:return _=g.sent(),this.logger.summary(yn.P_CONNECT_R,_,n,{data:_.data}),d=JSON.parse(_.data),f=d.cid,p=d.userId,E=d.sessionId,b=Date.now()-(l+this._tcpDuration),R={bid:fr(),cod:_.code,net:this.getNetwork().type,dur:b,spr:0,cid:f,v:Ft.CURRENT,count:this.retryCount,sts:Date.now(),ssid:E},this.logger.record(Et.IM_CMP_RMTP,JSON.stringify(R)),this._connectingTask=null,[2,_.trans((function(e){return h._connectedTime=Date.now()-h.callCppProxy("getDeltaTime"),p}))]}}))}))}}),Object.defineProperty(t.prototype,"close",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){return we(this,(function(n){return e||this.callCppProxy("disconnect","boolean"!=typeof t||t,!!r),[2]}))}))}}),Object.defineProperty(t.prototype,"sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t.pingResolve=r,t.callCppProxy("sendHeartbeat"),setTimeout((function(){return t.recvPong(J.TIMEOUT)}),e)}))}}),Object.defineProperty(t.prototype,"recvPong",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)}}),Object.defineProperty(t.prototype,"recvConnectRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){t?this.onDisconnectByServer(e,r):e===J.RC_SOCKET_DISCONNECTED&&this.getConnectionStatus()!==lt.CONNECTED||this.onDisconenctUnusual(e)}}),Object.defineProperty(t.prototype,"_onTcpConnectResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s,u=this.cmpWeightCache.findIndex((function(e){return e.addr==="".concat(t,":").concat(r)})),c={bid:fr(),ptc:Vt.TCP,cod:e,net:this.getNetwork().type,dur:n,spr:0,pr:(null===(s=this._naviInfo)||void 0===s?void 0:s.type)||0,hos:"".concat(t,":").concat(r),idx:u,rct:this.retryCount?kt.RECONNECT:kt.CONNECT,cid:this.cid,v:Ft.CURRENT,rsn:this._doConnectReason,ddu:i,count:this.retryCount,weight:u>=0?this.cmpWeightCache[u].weight:-1};if(this.logger.record(Et.IM_CMP,JSON.stringify(c)),this.logger.info(yn.P_CONNECT_ENTRY_S,JSON.stringify({code:e,host:t,port:r,duration:n,dnsDuration:i,index:o,isQuic:a})),e===ki.SUCCESS)this.curCmpUrl="".concat(t,":").concat(r),this.updateCmpWeight("".concat(t,":").concat(r),!0,a);else if(e!==ki.NOT_INIT){var l=r&&0!==r?"".concat(t,":").concat(r):"".concat(t);this.updateCmpWeight(l,!1)}}}),t}(En);Vi=new WeakSet,Gi=function(e,t){10!==e&&(this._connectingTask?e===J.SUCCESS?this._connectingTask.ok(t):this._connectingTask.fail(e,t):this.logger.warn(yn.P_CONNECT_E,JSON.stringify({msg:"connect complete but no connecting task"})))},Fi=function(e,t){switch(this.logger.info(yn.P_CONNECT_S,JSON.stringify({status:e,delay:t})),e){case J.RC_CONN_REDIRECTED:this.recvConnectRes(e,!0);break;case 11:case 10:case 12:break;case J.CONNECTION_REFUSED:case J.RC_SOCKET_DISCONNECTED:case J.RC_SOCKET_NOT_CREATED:case J.RC_CONN_ACK_TIMEOUT:case J.RC_TCP_RESET:this.recvConnectRes(e,!1);break;case J.RC_UDP_DISCONNECTED:this.recvConnectRes(e,!0,t);break;default:this.recvConnectRes(e,!0)}};var Bi,Ji,Wi,Yi,Ki,Xi,Qi,Zi,qi,zi,$i,eo,to,ro,no,io,oo,ao=function(e){function r(r,n,i){var a=e.call(this,r,n)||this;Object.defineProperty(a,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"dbpath",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"_cachePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),a._cachePath="".concat(i,"/").concat(Ai(r));var s=t.dirname(a._cachePath);return o.existsSync(s)||jn(s),a}return Le(r,e),Object.defineProperty(r.prototype,"getCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o.existsSync(this._cachePath)&&o.readFileSync(this._cachePath,{encoding:"utf8"})||null}}),Object.defineProperty(r.prototype,"setCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){o.writeFileSync(this._cachePath,e)}}),Object.defineProperty(r.prototype,"clearCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){o.writeFileSync(this._cachePath,"")}}),Object.defineProperty(r.prototype,"sendRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r,n;return we(this,(function(i){switch(i.label){case 0:return[4,ci(this.logger,{url:e,body:""})];case 1:return t=i.sent(),r=t.status,n=t.data,[2,{code:r,data:n}]}}))}))}}),Object.defineProperty(r.prototype,"decryptData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,wn(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91")];case 1:return t=n.sent(),[2,JSON.parse(t)];case 2:return r=n.sent(),this.logger.error(Re,JSON.stringify({error:null==r?void 0:r.stack})),[3,3];case 3:return[2]}}))}))}}),r}(Zr),so=function(e){function r(r,n,i,a,s){var u=e.call(this,n,r,i)||this;Object.defineProperty(u,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"model",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(u,"catchFilePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),u.model="Electron|".concat(process.platform,"|").concat(process.arch),u.catchFilePath="".concat(s,"/").concat(Li(r));var c=t.dirname(u.catchFilePath);return o.existsSync(c)||jn(c),u.init(),u}return Le(r,e),Object.defineProperty(r.prototype,"httpRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return(i=n).deviceId=this.deviceId,i.model=this.model,o={url:e,method:t,headers:r,body:JSON.stringify(i)},a=this.logger.createTraceId(),this.logger.info(q,JSON.stringify(o),a),[4,ci(this.logger,o)];case 1:s=f.sent(),u=s.status,c=s.data,l=void 0===c?"":c,this.logger.info(z,JSON.stringify({status:u,data:l}),a);try{return _=JSON.parse(l),d=_.data,[2,{code:u,data:d}]}catch(e){return this.logger.warn(Oe,JSON.stringify({status:u,data:l,error:e})),[2,{code:u,msg:e}]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"setCloudControllerCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){o.writeFileSync(this.catchFilePath,JSON.stringify(e)),this.logger.info(Ie,JSON.stringify(e))}}),Object.defineProperty(r.prototype,"getLocalCloudControllerCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!o.existsSync(this.catchFilePath))return null;var e=o.readFileSync(this.catchFilePath,{encoding:"utf8"});return this.logger.info(Ce,JSON.stringify({appkey:this.appkey,data:e})),e}}),Object.defineProperty(r.prototype,"setMRTRConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={mrtrChatroom:e.chatroom,mrtrGroup:e.group,mrtrPrivate:e.private,mrtrUltraGroup:e.ultraGroup};this.logger.info(Te,JSON.stringify(t)),Yn.setCloudConfig(JSON.stringify(t))}}),r}(fn),uo=[Ot,Dt,It,yt,Lt,Pt,mt,Nt,At,Mt,Ut],co=function(){return{logCmdQueue:[],cloudControllerVers:[],srsmsgs:[],readNtfs:[],expansionMsgQueue:new Map,v1ReceiptMsgs:[],privateRSMsgs:[],groupRSMsgs:new Map,rrmsgs:new Map,messageUIds:new Set}},lo=function(){function e(){Object.defineProperty(this,"_report",{enumerable:!0,configurable:!0,writable:!0,value:co()}),Object.defineProperty(this,"_count",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"isLowPriorityMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return uo.includes(e)}}),Object.defineProperty(e.prototype,"isEmpty",{enumerable:!1,configurable:!0,writable:!0,value:function(){return 0===this._count}}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._count++;var n=e.messageType,i=e.senderUserId,o=e.content;if(n!==Ot)if(n!==Dt)if(n!==yt)if(n!==It)if(n!==Nt){if(n===Pt){var a=o.messageUId;if(!a)return;return this._report.messageUIds.add(a),void this._report.v1ReceiptMsgs.push(e)}if(n===mt){var s=o.receiptMessageDic;if(i!==t){var u=s[t];if(!u||0===u.length)return;return u.forEach((function(e){return r._report.messageUIds.add(e)})),void this._report.v1ReceiptMsgs.push(e)}return Object.values(s).forEach((function(e){e.forEach((function(e){return r._report.messageUIds.add(e)}))})),void this._report.v1ReceiptMsgs.push(e)}n!==At?n===Lt&&this._handleRSMsg(e):this._handleRRMsg(e)}else this._handleReadNtf(e);else this._handleExpansionNotify(e);else this._handleSRSMsg(e,t);else i===Zt&&this._report.cloudControllerVers.push(e.sentTime);else if(i===Zt){var c=o.startTime,l=o.endTime,_=o.platform,d=o.logId,f=o.uri;this._report.logCmdQueue.push({startTime:parseInt(c,10),endTime:parseInt(l,10),platform:_,logId:d,uri:f,messageUId:e.messageUId})}}}),Object.defineProperty(e.prototype,"_handleRSMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.senderUserId;var t=e.content,r=e.conversationType,n=e.targetId,i=e.channelId;if(r!==Me.PRIVATE){var o=t,a=o.msgId,s=o.rrn,u=o.tmn,c=this._report.groupRSMsgs.get(a);c?(c.totalCount=u,c.readedCount=s):this._report.groupRSMsgs.set(a,{totalCount:u,readedCount:s}),this._report.messageUIds.add(a)}else{var l=this._report.privateRSMsgs.find((function(e){return e.conversationType===r&&e.targetId===n&&e.channelId===i}));l?l.timestamp=Math.max(l.timestamp,t.endMsgTime):this._report.privateRSMsgs.push({conversationType:r,targetId:n,channelId:i,timestamp:t.endMsgTime})}}}),Object.defineProperty(e.prototype,"_handleRRMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content.msgId;this._report.rrmsgs.set(t,e),this._report.messageUIds.add(t)}}),Object.defineProperty(e.prototype,"_handleExpansionNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content,r=t.put,n=t.mid,i=t.del,o=t.clear;this._report.messageUIds.add(n),this._report.expansionMsgQueue.has(n)&&!o?this._report.expansionMsgQueue.get(n).push({put:r,del:i,clear:o}):this._report.expansionMsgQueue.set(n,[{put:r,del:i,clear:o}])}}),Object.defineProperty(e.prototype,"_handleSRSMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.conversationType,n=e.targetId,i=e.channelId;e.senderUserId===t&&(this._report.srsmsgs=this._report.srsmsgs.filter((function(e){return e.conversationType!==r||e.targetId!==n||e.channelId!==i})),this._report.srsmsgs.push(e))}}),Object.defineProperty(e.prototype,"_handleReadNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.conversationType,r=e.targetId,n=e.channelId;t===Me.PRIVATE&&(this._report.readNtfs=this._report.readNtfs.filter((function(i){return i.conversationType!==t||i.targetId!==r||i.channelId!==n||i.senderUserId!==e.senderUserId})),this._report.readNtfs.push(e))}}),Object.defineProperty(e.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._report;return this._report=co(),this._count=0,e}}),e}(),_o=function(){function e(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];try{t.apply(void 0,Ge([],Ve(n),!1))}catch(t){r.logger.error(yn.L_JS_CALLBACK_EXCEPTION_E,"name: ".concat(e,"\n").concat(t.stack))}}}}),e}();!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(oo||(oo={}));var fo=function(){function e(e,t,r,n,i,o,a){var s=this;Bi.add(this),Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_dbpath",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_dispatchEvent",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_enableSyncEmptyTopConversation",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logOutputLevel",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_msgExpansionHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tcpMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudControllerUri",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"cloudControllerLock",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"cloudControllerMsgs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enableReadReceiptStorage",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isConnected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_offlineFinishedPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullOfflineMessageFinished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_lowPriorityMessageHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_needDispatchMessageModifiedSyncCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_buildSubscribeEventData",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=[];try{JSON.parse(e).list.forEach((function(e){var r=JSON.parse(e.obj),n=r.userId,i=r.subscribeType,o=r.subscribeTime,a=r.duration,u=r.operationType,c=r.details,l=void 0===c?[]:c,_=r.userProfile,d={userId:n,subscribeType:i,subscribeTime:o,expiry:a,operationType:u};[st.ONLINE_STATUS,st.FRIEND_ONLINE_STATUS].includes(i)&&(d.details=l.map((function(e){var t=JSON.parse(e);return{changeTime:t.changeTime,eventValue:t.changeValue,platform:t.platform}}))),[st.USER_PROFILE,st.FRIEND_USER_PROFILE].includes(i)&&(d.userProfile=s._string2userProfileInfo(_)),t.push(d)}))}catch(t){s.logger.error(yn.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==t?void 0:t.stack,data:e}))}return t}}),Object.defineProperty(this,"_chatroomCache",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"rtcHeartbeatResolves",{enumerable:!0,configurable:!0,writable:!0,value:{}});var u=this._dbpath,c=this._deviceId=Ni(),l=Ii();this.logger=new Ti(this._appkey,"RC-M","IM",l),this._catcher=new _o(this.logger),Yn.initWithAppkey(e,u,Qt,this.logger.getSessionId()),Yn.setConsoleLogLevel((this._logOutputLevel||Kr.WARN)+1),this.logger.setOutputLevel(this._logOutputLevel),this.reporter=new gi(e,c,this.logger,o,l),this.logger.info(yn.P_INIT_O,JSON.stringify({appkey:e,dbpath:u,proto_commit:Yn.getNodeVersion(),deviceId:c,commit:"79e3500d1b67a53a1a4c877e24c856ec54d0db28",processName:process.title,processPId:process.pid,disableLogReport:o,eventLoopBlockingCheck:a})),a&&sn.start(this.logger),this._callCppProxy("setDeviceId",c),this._staticConfigManager=new ao(e,this.logger,u),this._lowPriorityMessageHandler=new lo,this.navi=new wi(e,this.logger,u,this._staticConfigManager),this.tcpMgr=new Hi(e,this._callCppProxy.bind(this),this.navi,this.logger),this.tcpMgr.on("onConnected",this.onConnected,this),this.tcpMgr.on("onSuspend",this.onSuspend,this),this.tcpMgr.on("onDisconnected",this.onDisconnected,this),this.tcpMgr.on("onConnecting",this.onConnecting,this),this.tcpMgr.on("onDBUpgrateStart",this.dbUpgradeStart,this),this.tcpMgr.on("onDBUpgrading",this.dbUpgrading,this),this.tcpMgr.on("onDBUpgradeComplete",this.dbUpgradeComplete,this),this._enableCreateEmptyTopConversation(this._enableSyncEmptyTopConversation),this._initCloudController(c,u),this._registerBuildinMessageTypes(),Yn.setOnReceiveMessageListener(Fe(this,Bi,"m",Ki).bind(this),Fe(this,Bi,"m",Xi).bind(this),this._handleMessageModified.bind(this)),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),Yn.setReadReceiptListener((function(e,t){var r=JSON.parse(t).map((function(e){return{identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount,users:e.readUsers.map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:e.mentioned}}))}}));s._dispatchEvent("readReceiptResponseV5",r)})),Yn.setTranslateEventListener((function(e){var t=JSON.parse(e).map((function(e){return{translateInfo:{targetLanguage:e.translateResult.targetLanguage,translatedText:e.translateResult.translatedText,status:e.translateResult.translateStatus},code:e.code,identifier:e.messageRecognitionIdentifier.messageUid,from:e.messageRecognitionIdentifier.inputSource}}));s._dispatchEvent("translateResponse",t)})),this._msgExpansionHandler=new Pi(this._callCppProxy.bind(this))}return Object.defineProperty(e.prototype,"_setDeviceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=r.cpus()[0].model,t=r.release();try{"darwin"===process.platform?t=n.execSync("sw_vers -ProductVersion",{encoding:"utf-8"}):"win32"===process.platform&&(t=n.execSync("ver",{encoding:"utf-8"}))}catch(e){this.logger.error(me,JSON.stringify({error:e}))}this._callCppProxy("setDeviceInfo","",e,"PC",t,"","")}}),Object.defineProperty(e.prototype,"_initCloudController",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;r=Ve(Qr.getCloudControllerUrl(),1),this.cloudControllerUri=r[0],this.cloudController=new so(this._appkey,this.logger,this.reporter,e,t),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,an.init)}}),Object.defineProperty(e.prototype,"callProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){switch(o.label){case 0:if(!(r=this[e]))return this.logger.warn(yn.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2,Promise.resolve({code:J.NOT_SUPPORT})];n="",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.call.apply(r,Ge([this],Ve(t),!1))];case 2:return[2,o.sent()];case 3:return i=o.sent(),n=JSON.stringify({error:null==i?void 0:i.stack,method:e}),this.logger.error(yn.P_CALL_MAIN_E,n),[3,4];case 4:return[2,{code:J.MAIN_PROCESS_ERROR,msg:n}]}}))}))}}),Object.defineProperty(e.prototype,"sendProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){if(!(r=this[e]))return this.logger.warn(yn.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2];try{r.call.apply(r,Ge([this],Ve(t),!1))}catch(t){this.logger.error(yn.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}return[2]}))}))}}),Object.defineProperty(e.prototype,"registerRenderers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.navigators,r=e.areaCode,n=e.logServerUrl,i=e.environment,o=e.useNaviV2,a=e.enableReadReceiptStorage;this._environment=i||"default",this.navi.setEnvironment(i),this._enableReadReceiptStorage=a,this.navi.setUseNaviV2(o),Qr.init({areaCode:r,navigators:t,logServerUrl:n})}}),Object.defineProperty(e.prototype,"onConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected=!0;var e=this.getNaviInfoFromCache();this.reporter.checkStart(e,""),this._try2RejoinChatroom();var t=this._getMainProcessCache();this._dispatchEvent("onConnected",t),this._offlineFinishedPending&&(this._offlineFinishedPending=!1,this.logger.info(ye),this._dispatchEvent("pullFinished")),this._needDispatchMessageModifiedSyncCompleted&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}}),Object.defineProperty(e.prototype,"onConnecting",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._needDispatchMessageModifiedSyncCompleted=!0,this._dispatchEvent("onConnecting")}}),Object.defineProperty(e.prototype,"onSuspend",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onSuspend",t)}}),Object.defineProperty(e.prototype,"onDisconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onDisconnected",t)}}),Object.defineProperty(e.prototype,"dbUpgradeStart",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._dispatchEvent("databaseUpgradeWillStart")}}),Object.defineProperty(e.prototype,"dbUpgrading",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._dispatchEvent("databaseUpgrading",t)}}),Object.defineProperty(e.prototype,"dbUpgradeComplete",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._dispatchEvent("databaseUpgradeDidComplete",t)}}),Object.defineProperty(e.prototype,"_callCppProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=this.logger.createTraceId();try{return this.logger.debug(yn.P_CALL_ADDON_O,JSON.stringify({method:e,content:t}),n),Yn[e].apply(Yn,Ge([],Ve(t),!1))}catch(t){throw this.logger.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),n),t}}}),Object.defineProperty(e.prototype,"refetchNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())}}),Object.defineProperty(e.prototype,"sendHTTPRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return ci(this.logger,e)}}),Object.defineProperty(e.prototype,"onReceiveRendererLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.logger.recvRendererLog(e)}}),Object.defineProperty(e.prototype,"setNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.tcpMgr.setNetwork(e,t),e.status&&this.cloudController){var r=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,an.newWorkChange,r)}}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){sn.stop(),this.reporter.stop(),this.logger.destroy(),Yn.destroy(),process.exit(0)}}),Object.defineProperty(e.prototype,"getHistoryMessagesByObjectNames",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s=0===o,u=n+1,c=this._callCppProxy("getHistoryMessagesByObjectNames",e,t,r,u,i,s,a||""),l=[];try{var _=JSON.parse(c).list;_.reverse();for(var d=0;d<_.length;d++){var f=this._buildMessage(_[d].obj);l[d]=f}}catch(e){return Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:{list:u===l.length?l.slice(1,u):l,hasMore:n<l.length}})}}),Object.defineProperty(e.prototype,"_updateMessageReceiptStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return ji(this.logger,!0,"updateMessageReceiptStatus",e,t,r,n||"")}}),Object.defineProperty(e.prototype,"updateMessageReceiptStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i;return we(this,(function(o){return i=this._updateMessageReceiptStatus(e,t,r,n),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getNaviInfoFromCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getConnectionStatus()!==lt.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())}}),Object.defineProperty(e.prototype,"getConnectedTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getConnectedTime()}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Date.now()-Yn.getDeltaTime()}}),Object.defineProperty(e.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getCurrentUserId()}}),Object.defineProperty(e.prototype,"_getMainProcessCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),r=this.getNaviInfoFromCache(),n=this.tcpMgr.getCurrentUserId();return{connectedTime:e,deviceId:this.getDeviceId(),crtUserId:n,naviInfo:r,connectionStatus:t,deltaTime:Yn.getDeltaTime()}}}),Object.defineProperty(e.prototype,"getMainProcessCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,this._getMainProcessCache()]}))}))}}),Object.defineProperty(e.prototype,"_enableCreateEmptyTopConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callCppProxy("enableCreateEmptyTopConversation",e)}}),Object.defineProperty(e.prototype,"_registerBuildinMessageTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;On().forEach((function(t){e.registerMessageType(t.objectName,t)}))}}),Object.defineProperty(e.prototype,"_parseMessageJsonContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;try{r=e?JSON.parse(e):{}}catch(n){r=e,this.logger.error(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({content:e,messageId:t}))}return r}}),Object.defineProperty(e.prototype,"_buildSupportExt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=null;return e&&(r=this._msgExpansionHandler.parseReceiveExpansion(t)),r}}),Object.defineProperty(e.prototype,"_handleReadReceiptRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e),r=this.getNaviInfoFromCache();if(!(null==r?void 0:r.grpRRVer))return t;var n=t,i=n.hasRespond,o=n.readerInfo,a=void 0===o?{}:o,s=n.readCount,u=n.totalCount,c=n.readerList,l=void 0===c?[]:c,_={readCount:s,totalCount:u};if(1===(null==r?void 0:r.grpRRVer)){var d=[];for(var f in a)d.push({userId:f,readTime:a[f]});_.readerList=d,_.hasRespond=i}return 3===(null==r?void 0:r.grpRRVer)&&(_.readerList=l),_}}),Object.defineProperty(e.prototype,"_buildMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=JSON.parse(e);return Fe(this,Bi,"m",Ji).call(this,r,t)}}),Object.defineProperty(e.prototype,"_compatibleReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=wt.UNREAD;return e.isRead?t=wt.READ:e.isListened?t=wt.LISTENED:e.isDownload?t=wt.DOWNLOADED:e.isRetrieved&&(t=wt.RETRIEVED),t}}),Object.defineProperty(e.prototype,"_updateReadReceiptInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callCppProxy("getMessage",e),n=JSON.parse(r),i=n.readReceiptRequest?JSON.parse(n.readReceiptRequest):{},o=Ue(Ue({},i),t);this._callCppProxy("updateReadReceiptRequestInfo",e,JSON.stringify(o))}}),Object.defineProperty(e.prototype,"_buildConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e);return Fe(this,Bi,"m",Wi).call(this,t)}}),Object.defineProperty(e.prototype,"_convertResultList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=JSON.parse(e).list;return r=r.map((function(e){var r=JSON.parse(e.obj);return t?t(r):r}))}}),Object.defineProperty(e.prototype,"_getMessagesByUIds",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(0===e.length)return[];var r=ji(this.logger,!1,"getMessageByUids",e);return JSON.parse(r).list.map((function(e){return Fe(t,Bi,"m",Ji).call(t,JSON.parse(e.obj))}))}}),Object.defineProperty(e.prototype,"_setMessageExtension",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){ji(this.logger,!1,"setMessageExtension",1,"1",e,JSON.stringify(t),"")}}),Object.defineProperty(e.prototype,"_handleLowPriorityMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this;if(!this._lowPriorityMessageHandler.isEmpty()){var i=Date.now(),o=this._lowPriorityMessageHandler.count,a=this.logger.createTraceId();this.logger.info(yn.L_HANDLE_LOW_PRIORITY_MESSAGES_T,JSON.stringify({startTime:i,count:o}),a);var s=this._lowPriorityMessageHandler.build(),u=s.srsmsgs,c=s.readNtfs,l=s.expansionMsgQueue,_=s.v1ReceiptMsgs,d=s.privateRSMsgs,f=s.groupRSMsgs,p=s.rrmsgs,E=s.logCmdQueue,b=s.cloudControllerVers,R=s.messageUIds,h=new Map;this._getMessagesByUIds(Ge([],Ve(R.values()),!1)).forEach((function(e){h.set(e.messageUId,e)})),this._handleExpansionMsgQueue(l,h),this._sendMessageNotification(c,!1),this._handlerReadReceiptMsgV1(_,h,e),this._handleSRSMsgs(u,t),this._handlerPrivateRSMsgs(d),this._handlerGroupRSMsgs(f,h),this._handlerRRMsgs(p,h),b.length>0&&((r=this.cloudControllerMsgs).push.apply(r,Ge([],Ve(b),!1)),this._ccMsgHandler()),E.forEach((function(e){var t=e.startTime,r=e.endTime,i=e.platform,o=e.logId,a=e.uri,s=e.messageUId;n.reporter.report(t,r,i,a,o,s)})),this.logger.info(yn.L_HANDLE_LOW_PRIORITY_MESSAGES_R,JSON.stringify({startTime:i,cost:Date.now()-i}),a)}}}),Object.defineProperty(e.prototype,"_updateReadReceiptRequestInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(0!==e.length){var t=e.map((function(e){return JSON.stringify({message_uid:e.messageUId,request_info:e.readReceiptInfo})}));ji(this.logger,!1,"updateReadReceiptRequestInfoList",t)}}}),Object.defineProperty(e.prototype,"_handlerRRMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[],n=[];Array.from(e.entries()).forEach((function(e){var i=Ve(e,2),o=i[0],a=i[1],s=t.get(o);if(s){var u=a.content,c=u.rrn,l=u.tmn,_=s.readReceiptInfo||{};_=Ue(Ue({},_),{readCount:c,totalCount:l}),s.readReceiptInfo=_,r.push({messageUId:o,readReceiptInfo:_}),n.push(a)}})),this._updateReadReceiptRequestInfoList(r),this._sendMessageNotification(n,!1)}}),Object.defineProperty(e.prototype,"_handlerGroupRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=[],i=[];Array.from(e.entries()).forEach((function(e){var r=Ve(e,2),o=r[0],a=r[1],s=a.totalCount,u=a.readedCount,c=t.get(o);if(c){var l=c.conversationType,_=c.targetId,d=c.channelId,f=c.readReceiptInfo||{};f=Ue(Ue({},f),{readCount:u,totalCount:s}),c.readReceiptInfo=f,n.push({messageUId:o,readReceiptInfo:f}),i.push({conversationType:l,targetId:_,channelId:d,readedCount:u,totalCount:s,messageUId:o})}})),this._updateReadReceiptRequestInfoList(n),i.forEach((function(e){return r._sendMessageReadReceipt({groupReadReceipt:e})}))}}),Object.defineProperty(e.prototype,"_handlerPrivateRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){var r=e.conversationType,n=e.targetId,i=e.channelId,o=e.timestamp;t._updateMessageReceiptStatus(r,n,o,i||""),t._sendMessageReadReceipt({privateReadReceipt:{conversationType:r,targetId:n,channelId:i||"",endMsgTime:o}})}))}}),Object.defineProperty(e.prototype,"_handleSRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;1!==this.getNaviInfoFromCache().sesDriven?this._sendMessageNotification(e,!1):e.forEach((function(e){var n=e.conversationType,i=e.targetId,o=e.channelId,a=e.sentTime,s=e.content;a>t||r._sendsyncReadStatus({conversationType:n,targetId:i,channelId:o,timestamp:s.lastMessageSendTime})}))}}),Object.defineProperty(e.prototype,"_handlerReadReceiptMsgV1",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(0!==e.length){var n=new Set,i=[];e.forEach((function(e){var o=e.messageType,a=e.senderUserId,s=e.content;if(o===Pt){var u=s.messageUId,c=t.get(u);if(!c||c.senderUserId!==a)return;return c.readReceiptInfo=a===r?{isReceiptRequestMessage:!0,readerList:[]}:{isReceiptRequestMessage:!0,hasRespond:!1},n.add(c),void i.push(e)}var l=s.receiptMessageDic;if(a===r)return Object.values(l).forEach((function(e){e.forEach((function(e){var r=t.get(e);r&&(r.readReceiptInfo=Ue(Ue({},r.readReceiptInfo),{hasRespond:!0}),n.add(r))}))})),void i.push(e);var _=l[r];_&&0!==_.length&&(_.forEach((function(e){var r=t.get(e);if(r){var i=r.readReceiptInfo,o=((null==i?void 0:i.readerList)||[]).concat(a);r.readReceiptInfo=Ue(Ue({},r.readReceiptInfo),{readerList:o}),n.add(r)}})),i.push(e))})),this._enableReadReceiptStorage&&this._updateReadReceiptRequestInfoList(Array.from(n.values()).map((function(e){return{messageUId:e.messageUId,readReceiptInfo:e.readReceiptInfo}}))),this._sendMessageNotification(i,!1)}}}),Object.defineProperty(e.prototype,"_handleExpansionMsgQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;0!==e.size&&Array.from(e.entries()).forEach((function(e){var n=Ve(e,2),i=n[0],o=n[1],a=t.get(i);if(a&&o.length){var s=new Set,u=new Set,c=a.expansion||{};o.forEach((function(e){var t=e.put,r=e.del;if(e.clear)return Object.keys(c).forEach((function(e){s.add(e),u.clear()})),void(c={});t&&(Object.keys(t).forEach((function(e){s.delete(e),u.add(e)})),c=Ue(Ue({},c),t)),r&&r.forEach((function(e){s.add(e),u.delete(e),delete c[e]}))})),a.expansion=c;var l={};Object.keys(c).forEach((function(e){l[e]={v:c[e]}})),r._setMessageExtension(i,l);var _={},d=a.conversationType,f=a.targetId,p=a.channelId,E=!1;s.size>0&&(E=!0,_.deletedExpansion={conversationType:d,targetId:f,channelId:p||"",messageUId:i,deletedKeys:Array.from(s)}),u.size>0&&(E=!0,_.updatedExpansion={conversationType:d,targetId:f,channelId:p||"",messageUId:i,expansion:c}),E&&r._dispatchEvent("expansion",_)}}))}}),Object.defineProperty(e.prototype,"_handleHighPriorityMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=e.filter((function(e){var t=e.messageType;if(t===Tt)return!1;if(t===St){if(!Fe(n,Bi,"m",Qi).call(n,e))return!1;var r=n._fixRecallContentInfo(e);e.conversationType=r.conversationType,e.targetId=r.targetId}return!0}));this._sendMessageNotification(i,t)}}),Object.defineProperty(e.prototype,"_ccMsgHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.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,an.other,t)]):[3,2]):[2];case 1:r=n.sent()||0,this.cloudControllerMsgs=this.cloudControllerMsgs.filter((function(e){return e>r})),this.cloudControllerLock=!0,this._ccMsgHandler(),n.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(e.prototype,"_fixRecallContentInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.conversationType,r=e.targetId;return e.senderUserId===this.tcpMgr.getCurrentUserId()&&(t=e.content.conversationType||t,r=e.content.targetId||r),{conversationType:t,targetId:r}}}),Object.defineProperty(e.prototype,"_sendMessageNotification",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.length>0&&this._dispatchEvent("batchMessage",e,void 0,t)}}),Object.defineProperty(e.prototype,"_sendPullOfflineFinished",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected?(this.logger.info(ye),this._dispatchEvent("pullFinished")):this._offlineFinishedPending=!0}}),Object.defineProperty(e.prototype,"_handleMessageModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;try{var n=JSON.parse(e).list;if(n.length>0){var i=n.map((function(e){return r._buildMessage(e.obj)}));this._dispatchEvent("messagesModified",i)}}catch(t){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t,result:e}))}this._needDispatchMessageModifiedSyncCompleted&&!t&&this._isConnected&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}}),Object.defineProperty(e.prototype,"_sendChatroomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("chatroom",e)}}),Object.defineProperty(e.prototype,"_sendMessageReadReceipt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("messageReadReceipt",e)}}),Object.defineProperty(e.prototype,"_sendsyncReadStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("syncReadStatus",e)}}),Object.defineProperty(e.prototype,"_setConversationStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setConversationStatusListener((function(t){var r=JSON.parse(t).list.map((function(e){var t=JSON.parse(e.obj),r={channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,updatedItems:{}};return t.status.forEach((function(e){var t=JSON.parse(e.item),n=t.type,i=t.value;if(1===n){var o=Number(i)||bt.NOT_SET;r.updatedItems.notificationLevel={val:o,time:0},r.updatedItems.notificationStatus={val:Jt(o),time:0}}else 2===n?r.updatedItems.isTop={val:"1"===i,time:0}:4===n&&(r.updatedItems.translateStrategy={val:Number(i),time:0})})),r}));r.length>0&&e._dispatchEvent("conversation",r)}),(function(t){e._dispatchEvent("conversationTag")}),(function(t,r,n,i){e._callCppProxy("clearUnreadCountByTimestamp",t,r,i,n||""),e._sendsyncReadStatus({conversationType:t,targetId:r,channelId:n,timestamp:i})}),(function(t){return e._dispatchEvent("conversationStatusSynced",t)}))}}),Object.defineProperty(e.prototype,"_setPushNotificationListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setPushNotificationListener((function(t){return e._getRTCProfile()}),(function(){return e._dispatchEvent("tag")}),(function(t){return e._dispatchEvent("userSettingsSynced",t)}),(function(t){return e._dispatchEvent("userSettingsChanged",{key:Jr,value:t})}),(function(t){return e._dispatchEvent("userSettingsChanged",{key:Br,value:t})}))}}),Object.defineProperty(e.prototype,"_getRTCProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callCppProxy("getRTCProfile");if(e){var t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);var r=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",r)}}}),Object.defineProperty(e.prototype,"_setRTCLivingRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setRTCRoomEventListener((function(t){e._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(t))}))}}),Object.defineProperty(e.prototype,"_setChatroomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setChatroomEventListener((function(t,r){e._sendChatroomStatus({chatroomDestroyed:t})}))}}),Object.defineProperty(e.prototype,"_setCallInfoListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setCallInfoListener((function(t){var r=[];try{JSON.parse(t).list.forEach((function(e){Object.entries(e).forEach((function(e){var t=Ve(e,2),n=t[0],i=t[1];r.push({key:n,value:i})}))}))}catch(t){e.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t}))}e._dispatchEvent("callInfo",JSON.stringify({list:r}))}))}}),Object.defineProperty(e.prototype,"_setSubscribeEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setSubscribeEventListener((function(){}),(function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){var r=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",r)}),(function(t){var r=e._buildSubscribeEventData(t).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a=e.userProfile,s={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return[st.ONLINE_STATUS,st.FRIEND_ONLINE_STATUS].includes(r)?s.details=o:[st.USER_PROFILE,st.FRIEND_USER_PROFILE].includes(r)&&(s.userProfile=a),s}));e._dispatchEvent("subscribedUserStatusChange",r)}))}}),Object.defineProperty(e.prototype,"_setUserProfileListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setUserProfileListener((function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){e._dispatchEvent("ownUserProfileChanged",e._string2userProfileInfo(t))}))}}),Object.defineProperty(e.prototype,"_onGroupOperationChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,u=[];try{a=JSON.parse(n),u=JSON.parse(i),s=JSON.parse(e);var c={groupId:a[0]?a[0].groupId:"",operatorInfo:this._convertGroupMemberInfoList([s])[0],operation:t,operationTime:r};0===t?(o=Ve(this._convertGroupInfoList(a),1),c.groupInfo=o[0]):c.memberInfos=this._convertGroupMemberInfoList(u),this._dispatchEvent("groupOperation",c)}catch(t){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:n,membersJson:i,operatorInfo:e}))}}}),Object.defineProperty(e.prototype,"_onGroupInfoChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){try{var a=JSON.parse(r),s=this._convertUpdateGroupInfoList(JSON.parse(i))[0];switch(e){case A.GROUP_INFO_CHANGE:this._dispatchEvent("groupInfoChanged",{operatorInfo:this._convertGroupMemberInfoList([a])[0],operationTime:o,groupInfo:s,changedGroupInfo:s,fullGroupInfo:n?this._convertUpdateGroupInfoList(JSON.parse(n))[0]:s});break;case A.GROUP_REMARK_DELETE:case A.GROUP_REMARK_SET:var u=e===A.GROUP_REMARK_SET?L.ADD:L.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:t,operationType:u,operationTime:o,groupRemark:(null==s?void 0:s.remark)||""})}}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:i,operatorInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onGroupMemberInfoChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(t),o=JSON.parse(r),a={groupId:e,operatorInfo:this._convertGroupMemberInfoList([i])[0],memberInfo:this._convertGroupMemberInfoList([o])[0],operationTime:n};this._dispatchEvent("groupMemberInfoChanged",a)}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onGroupRequestChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(r),o=i.groupId,a=i.joinUser,s=i.approverUser,u=i.inviterUser,c=i.type,l=i.status,_=i.direction,d=i.remark,f=Ue(Ue(Ue(Ue({groupId:o},a&&{joinMemberInfo:this._convertGroupMemberInfoList([a])[0]}),u&&u.userId&&{inviterInfo:this._convertGroupMemberInfoList([u])[0]}),s&&s.userId&&{operatorInfo:this._convertGroupMemberInfoList([s])[0]}),{status:l,direction:_,type:c,operationTime:n,reason:d});this._dispatchEvent("groupApplicationEvent",f)}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onFavoriteMembersChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(r),o=[];i&&rr(i.list)&&(o=i.list.map((function(e){return e.value}))),this._dispatchEvent("groupFollowsChangedSync",{groupId:e,operationType:t,operationTime:n,userIds:o})}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:r}))}}}),Object.defineProperty(e.prototype,"_setEntrustGroupListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){Yn.setEntrustGroupListener(this._onGroupOperationChanged.bind(this),this._onGroupInfoChanged.bind(this),this._onGroupMemberInfoChanged.bind(this),this._onGroupRequestChanged.bind(this),this._onFavoriteMembersChanged.bind(this))}}),Object.defineProperty(e.prototype,"_onFriendApplicationStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:r,directionType:n,operationTime:i,extra:null!=o?o:""})}}),Object.defineProperty(e.prototype,"_onFriendAdd",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){this._dispatchEvent("friendAdd",{userId:t,name:r,portraitUri:n,directionType:e,operationTime:i})}}),Object.defineProperty(e.prototype,"_onFriendDelete",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n={directionType:e,operationTime:r,userIds:JSON.parse(t).list.map((function(e){return e.value}))};this._dispatchEvent("friendDelete",n)}}),Object.defineProperty(e.prototype,"_onFriendsClearedFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("friendCleared",e)}}),Object.defineProperty(e.prototype,"_onFriendInfoChangedSync",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){try{var n=JSON.parse(r);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:n.list,operationTime:0})}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:r}))}}}),Object.defineProperty(e.prototype,"_setFriendEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){Yn.setFriendEventListener(this._onFriendApplicationStatusChanged.bind(this),this._onFriendAdd.bind(this),this._onFriendDelete.bind(this),this._onFriendsClearedFromServer.bind(this),this._onFriendInfoChangedSync.bind(this))}}),Object.defineProperty(e.prototype,"registerMessageType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=0,n=t.isCounted,i=t.isCustom,o=t.isPersited,a=t.isStatusMessage,s=t.searchProps;o&&(r|=1),n&&(r|=2),a&&(r=16),i&&(gn(e,t),this.logger.info(yn.P_REGTYP_O,JSON.stringify({type:e,opt:r,search:s}))),this._callCppProxy("registerMessageType",e,r,s||[])}}),Object.defineProperty(e.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.tcpMgr.connect(e,t,r,n)}}),Object.defineProperty(e.prototype,"reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=J.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(e,t,r,n)}}),Object.defineProperty(e.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.stringify(Ue(Ue({},e),{"electron-main":"5.26.1"}));this.logger.info(yn.P_REPORT_VER_O,t),this._callCppProxy("uploadSDKVersion",t,"")}}),Object.defineProperty(e.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){return we(this,(function(r){return e=e||!0,this._chatroomCache.length=0,this.reporter.stop(),li(null,this.logger),[2,this.tcpMgr.disconnect(e,t)]}))}))}}),Object.defineProperty(e.prototype,"setUserStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn.setOnReceiveStatusListener((function(e,r){t({userId:e,status:r})}));var r=e.userIds||[];r.length&&this.subscribeUserStatus(r)}}),Object.defineProperty(e.prototype,"subscribeUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("subscribeUserStatus",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"setUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("setUserStatus",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserStatus",e,(function(e){setTimeout((function(){r({code:J.SUCCESS,data:{status:e}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"_handleDirectionalUserIdList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.messageType,n=e.content,i=e.directionalUserIdList,o=void 0===i?[]:i,a=t===Me.GROUP;if(r===mt&&n.receiptMessageDic&&a)for(var s in n.receiptMessageDic)o.push(s);return r===yt&&function(e){return[Me.GROUP,Me.DISCUSSION,Me.ULTRA_GROUP,Me.PUBLIC_SERVICE,Me.APP_PUBLIC_SERVICE].includes(e)}(t)&&(o=[this.getCurrentUserId()]),o}}),Object.defineProperty(e.prototype,"_handleMessage2Callback",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;switch(e.messageType){case It:this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e);break;case Pt:this._enableReadReceiptStorage&&this._updateReadReceiptInfo(t.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});break;case mt:if(this._enableReadReceiptStorage){var n=t.content.receiptMessageDic;if(!n)return;for(var i in n)n[i].forEach((function(e){r._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}}}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this;void 0===i&&(i=this.logger.createTraceId());var a=r.messageType,s=r.content,u=r.expansion,c=r.pushConfig,l=r.pushContent,_=void 0===l?"":l,d=r.pushData,f=void 0===d?"":d,p=r.directionalUserIdList,E=void 0===p?[]:p,b=r.disableNotification,R=void 0!==b&&b,h=r.canIncludeExpansion,g=void 0!==h&&h,v=r.isVoipPush,O=void 0!==v&&v,I=r.channelId,C=void 0===I?"":I,S=r.messageId,T=void 0===S?0:S,N=r.disableUpdateLastMessage,P=void 0!==N&&N,m=r.needReceipt,y=c||{},A=y.iOSConfig,L=y.androidConfig,M=y.harmonyOSConfig,U=y.templateId,D=void 0===U?"":U,w=y.pushTitle,j=void 0===w?"":w,V=y.pushContent,G=void 0===V?_:V,F=y.pushData,k=void 0===F?f:F,x=y.disablePushTitle,H=void 0!==x&&x,B=y.forceShowDetailContent,W=void 0!==B&&B,Y=dr(A,L,M);return new Promise((function(c){_=G,f=k;var l=(null==L?void 0:L.notificationId)||"";E=o._handleDirectionalUserIdList(r,e);var d={};for(var p in u)d[p]={v:u[p]};var b=D;o.logger.info(yn.P_SEND_MSG_T,JSON.stringify({messageType:a,conversationType:e,targetId:t,channelId:C}),i);var h=o._callCppProxy("sendMessage",(function(e,t){var n=o._buildMessage(e,!1);if(o.logger.info(yn.P_SEND_MSG_R,JSON.stringify({code:t,messageUId:n.messageUId}),i),t===J.SENSITIVE_REPLACE)return setImmediate((function(){c({code:t})}));o._handleMessage2Callback(n,r),setImmediate((function(){c({code:J.SUCCESS,data:n})}))}),(function(e,t){var r=o._buildMessage(e,!1);o.logger.warn(yn.P_SEND_MSG_R,JSON.stringify({code:t,messageId:r.messageId}),i),r.sentTime=Date.now()-Yn.getDeltaTime(),setImmediate((function(){c({code:t,data:r})}))}),e,t,a,JSON.stringify(s),E,R,H,W,_,f,l,j,Y,b,g,JSON.stringify(d),O,C,T,P,!!m),v=JSON.parse(h);null==n||n(v.messageId)}))}}),Object.defineProperty(e.prototype,"recallMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d,f,p,E,b,R,h,g,v,O=this;return we(this,(function(I){return n=e.channelId||"",i=e.targetId,o=e.conversationType,a=t.user,s=t.pushContent,u=t.extra,c=t.pushConfig,l=t.disableNotification,_=t.isDelete,d=t.directionalUserIdList,f=t.disableUpdateLastMessage,p=t.isAdmin,E=t.messageUId,b=t.sentTime,R={conversationType:o,targetId:i,messageUId:E,sentTime:b,user:a,extra:u,channelId:n,isDelete:_||!1,isAdmin:p},a&&(R.user=a),u&&(R.extra=u),h={conversationType:o,targetId:i,senderUserId:this.tcpMgr.getCurrentUserId(),content:R,objectName:St,messageUid:E,direction:ft.SEND,status:wt.UNREAD,sentTime:b,channelId:n},g=this._buildMessage(JSON.stringify(h),!1),[2,(v=xi.create(this.logger,"recallMessage")).asyncInvoke((function(e){return De(O,void 0,void 0,(function(){return we(this,(function(e){return Fe(this,Bi,"m",Qi).call(this,g),g.pushConfig=c,v.ok(g),[2]}))}))}),(function(e){return v.fail(e)}),St,JSON.stringify(R),l||!1,(null==c?void 0:c.disablePushTitle)||!1,(null==c?void 0:c.forceShowDetailContent)||!1,s||"",(null==c?void 0:c.pushData)||"",(null===(r=null==c?void 0:c.androidConfig)||void 0===r?void 0:r.notificationId)||"",(null==c?void 0:c.pushTitle)||"",dr(null==c?void 0:c.iOSConfig,null==c?void 0:c.androidConfig,null==c?void 0:c.harmonyOSConfig),(null==c?void 0:c.templateId)||"",n,d||[],E,null!=f&&f).result()]}))}))}}),Object.defineProperty(e.prototype,"getHistoryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s=this;return new Promise((function(u){r=r||0;var c=0===i,l=n+1,_=s._callCppProxy("getHistoryMessages",e,t,r,l,a,c,o),d=JSON.parse(_).list,f=[];d.reverse();for(var p=0;p<d.length;p++){var E=s._buildMessage(d[p].obj);f[p]=E}u({code:J.SUCCESS,data:{list:l===f.length?f.slice(1,l):f,hasMore:n<f.length}})}))}}),Object.defineProperty(e.prototype,"getMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){var u=0===i,c=r,l=0!==r,_=n+1;l&&(c+=u?1:-1,_++);for(var d=a._callCppProxy("getMessages",e,t,c,_,u,o),f=JSON.parse(d).list,p=[],E=0;E<f.length;E++){var b=a._buildMessage(f[E].obj);p[E]=b}var R=a._computeRepairInfo(p,u,r,c,_),h=R.isNeedRepair,g=void 0!==h&&h,v=R.repairTime,O=void 0===v?0:v;if(!g)return l&&(p.shift(),_--),p.reverse(),void s({code:J.SUCCESS,data:{list:_===p.length?p.slice(1,_):p,hasMore:n<p.length}});a._processRepairHisMsg(e,t,r,n,i,o,O,s)}))}}),Object.defineProperty(e.prototype,"_computeRepairInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=!1,a=0,s=this.getNaviInfoFromCache()||{},u=s.repairHisMsg,c=void 0===u?0:u,l=s.historyMsg;if(1!==c||!l)return{isNeedRepair:o,repairTime:a};var _=e.findIndex((function(e){return e.hasMore||0===Object.keys(e.content).length}));return t&&_>=0?(o=!0,a=e[_].hasMore?e[_].sentTime:e[_].sentTime+1):!t&&_>=1?(o=!0,a=e[_-1].sentTime):e.length<i||0===r?(o=!0,a=r):e.length>0&&e[0].sentTime!==r&&(o=!0,a=n),{isNeedRepair:o,repairTime:a}}}),Object.defineProperty(e.prototype,"_processRepairHisMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a,s){var u=this,c=function(a){for(var c=0===i,l=n+1,_=u._callCppProxy("getMessages",e,t,r,l,c,o),d=JSON.parse(_).list,f=[],p=0;p<d.length;p++){var E=u._buildMessage(d[p].obj);f[p]=E}f.reverse(),s({code:a,data:{list:l<=f.length?f.slice(1,l):f,hasMore:n<f.length}})},l=n+10>100?100:n+10;this._callCppProxy("getRemoteHistoryMessages",e,t,a,l,(function(){return c(0)}),(function(e){c(e)}),i,!0,o,!1)}}),Object.defineProperty(e.prototype,"getContinuousMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){r=r||0;var u=0===i;a._callCppProxy("getContinuousMessages",e,t,r,n,(function(e,t,r){var n=JSON.parse(e).list,i=[];n.reverse();for(var o=0;o<n.length;o++){var u=a._buildMessage(n[o].obj);i[o]=u}setTimeout((function(){s({code:J.SUCCESS,data:{list:i,timestamp:t,hasMore:r}})}))}),(function(e){setTimeout((function(){s({code:e})}),0)}),u,o)}))}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){r=r||0;a._callCppProxy("getRemoteHistoryMessages",e,t,r,n,(function(e,t){var r=JSON.parse(e).list,n=[];r.reverse();for(var i=0;i<r.length;i++){var o=a._buildMessage(r[i].obj);n[i]=o}setTimeout((function(){s({code:J.SUCCESS,data:{list:n,hasMore:!!t}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),i,!0,o,!0)}))}}),Object.defineProperty(e.prototype,"deleteRemoteMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.conversationType,n=e.targetId,i=e.channelId,o=JSON.stringify(t),a=this.logger.createTraceId(),s=xi.create(this.logger,"deleteRemoteHistoryMessages",a);return s.asyncInvoke(r,n,o,!1,i||"",(function(){return s.ok()}),(function(e){return s.fail(e)})).result()}}),Object.defineProperty(e.prototype,"deleteRemoteMessageByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.logger.createTraceId(),n=xi.create(this.logger,"clearRemoteHistoryMessages",r);return n.asyncInvoke(e.conversationType,e.targetId,t,(function(){return n.ok()}),(function(e){return n.fail(e)}),e.channelId||"").result()}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("clearMessages",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"getConversationListByFilter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){switch(e.type){case In:return[2,Fe(this,Bi,"m",Zi).call(this,e.params)];case Sn:return[2,Ir(J.NOT_SUPPORT)];case Cn:return[2,Fe(this,Bi,"m",qi).call(this,e.params)];case Tn:return[2,Fe(this,Bi,"m",zi).call(this,e.params)];case Nn:return[2,Fe(this,Bi,"m",$i).call(this,e.params)];case Pn:return[2,Fe(this,Bi,"m",eo).call(this,e.params)]}return[2]}))}))}}),Object.defineProperty(e.prototype,"getUntaggedConversationListByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n;return we(this,(function(i){return n=ji(this.logger,!1,"getConversationsByPageWithoutTag",e,t,r),[2,Fe(this,Bi,"m",Yi).call(this,n).trans((function(e){return e.list}))]}))}))}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return(n=ji(this.logger,!0,"getConversation",e,t,r))?[2,Or(this._buildConversation(n))]:[4,this.getHistoryMessage(e,t,0,1,0,r,"")];case 1:return i=f.sent(),o=i.data,a=(null==o?void 0:o.list[0])||null,s=JSON.parse(ji(this.logger,!1,"getConversationStatus",JSON.stringify([{conversation_type:e,target_id:t,channel_id:r,channel_id_valid:"string"==typeof r&&r.length>0}])))[0],u=!!(null==s?void 0:s.is_top),c=(null==s?void 0:s.translate_strategy)||Ln,[4,this.getConversationNotificationLevel({conversationType:e,targetId:t,channelId:r})];case 2:return l=f.sent(),_=l.data,d={conversationType:e,targetId:t,channelId:r,latestMessage:a,lastUnreadTime:0,isTop:u,notificationLevel:_,notificationStatus:Jt(_),translateStrategy:c},[2,Or(d)]}}))}))}}),Object.defineProperty(e.prototype,"batchDeleteConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.identifiers,r=e.deleteRemotely,n=e.deleteMessages,i=xi.create(this.logger,"batchDeleteConversations",this.logger.createTraceId());return i.invoke({conversationIdentifiers:t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}})),deleteMessages:n,deleteRemotely:r},(function(){return i.ok()}),(function(e){return i.fail(e)})).result()}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=[];i=rr(e)?e:Ze(Ye),r._callCppProxy("clearConversations",i,t||""),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i;return we(this,(function(o){return n=t&&t.length>0?t:Ze(Ye),i=ji(this.logger,!0,"getTotalUnreadCount",n,r,e),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){var o=n._callCppProxy("getUnreadCount",e,t,r);i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"clearConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){n._callCppProxy("clearUnreadCount",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t=this;return we(this,(function(r){switch(r.label){case 0:return[4,Fe(this,Bi,"m",zi).call(this)];case 1:return(e=r.sent()).isOk?(e.data.list.forEach((function(e){var r=e.conversationType,n=e.targetId,i=e.channelId;ji(t.logger,!1,"clearUnreadCount",r,n,i||"")})),[2,Or()]):[2,e.wipe()]}}))}))}}),Object.defineProperty(e.prototype,"_clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){ji(this.logger,!1,"clearUnreadCountByTimestamp",e,t,r,n)}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){return we(this,(function(i){return this._clearUnreadCountByTimestamp(e,t,r,n),[2,J.SUCCESS]}))}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getTheFirstUnreadMessage",e,t,r),a=n._buildMessage(o);i({code:J.SUCCESS,data:-1!==a.messageId?a:null})}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessageInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i,o){var a=n._callCppProxy("getTheFirstUnreadMessage",e,t,r),s=n._buildMessage(a);i({code:J.SUCCESS,data:-1!==s.messageId?{messageUId:s.messageUId,sentTime:s.sentTime}:null})}))}}),Object.defineProperty(e.prototype,"batchSetConversationToTop",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Fe(this,Bi,"m",to).call(this,e,-1,t?1:0,-1,r,n)}}),Object.defineProperty(e.prototype,"batchSetConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.logger.createTraceId(),n=xi.create(this.logger,"setBlockPushLevelInBatches",r),i=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:t}}));return n.asyncInvoke(JSON.stringify(i),(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"batchSetConversationTranslateStrategy",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Fe(this,Bi,"m",to).call(this,e,-1,-1,t,!1,!1)}}),Object.defineProperty(e.prototype,"setConversationTypeNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"setBlockPushLevelForType",this.logger.createTraceId());return r.asyncInvoke(e,t,(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getConversationTypeNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t;return we(this,(function(r){return t=ji(this.logger,!0,"getBlockPushLevelForType",e),[2,Or(t)]}))}))}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s=this;return we(this,(function(u){switch(u.label){case 0:return i=this.logger.createTraceId(),[4,(o=xi.create(this.logger,"searchConversationByContent",i)).asyncInvoke(n,e,t,r,(function(e,t,r){e===J.SUCCESS?o.ok({result:t,matchedNumber:r}):o.fail(e)})).result()];case 1:return(a=u.sent()).isOk?[2,a.trans((function(e){return JSON.parse(e.result).map((function(e){return Fe(s,Bi,"m",Wi).call(s,e)}))}))]:[2,Or([])]}}))}))}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a=this;return we(this,(function(s){switch(s.label){case 0:return r=r||[1,3,6,7],n=this.logger.createTraceId(),[4,(i=xi.create(this.logger,"searchConversationByContentWithAllChannel",n)).asyncInvoke(r,e,t,(function(e,t,r){e===J.SUCCESS?i.ok({result:t,matchedNumber:r}):i.fail(e)})).result()];case 1:return(o=s.sent()).isOk?[2,o.trans((function(e){return JSON.parse(e.result).map((function(e){return Fe(a,Bi,"m",Wi).call(a,e)}))}))]:[2,Or([])]}}))}))}}),Object.defineProperty(e.prototype,"searchMessagesWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i,o;return De(this,void 0,void 0,(function(){var a,s,u,c,l=this;return we(this,(function(_){switch(_.label){case 0:return a=this.logger.createTraceId(),s=Fe(this,Bi,"m",ro).call(this,e.conversationFilter),u={keyword:e.keyword,limit:e.limit,desc:!e.order,offset:null!==(t=e.offset)&&void 0!==t?t:0,needMatchCount:!0,startTime:null===(r=e.timeRange)||void 0===r?void 0:r.startTime,endTime:null===(n=e.timeRange)||void 0===n?void 0:n.endTime,objectNames:kr((null===(i=e.messageFilter)||void 0===i?void 0:i.objectNames)||[]),senderIds:kr((null===(o=e.messageFilter)||void 0===o?void 0:o.senderIds)||[])},[4,(c=xi.create(this.logger,"searchMessage",a)).invoke(s,u,(function(e,t,r,n){e===J.SUCCESS?c.ok({result:t,totalMatched:r,conditionsMatched:n}):c.fail(e)})).result()];case 1:return[2,_.sent().trans((function(e){var t=e.result,r=e.totalMatched,n=e.conditionsMatched;return{messages:JSON.parse(t).list.map((function(e){return JSON.parse(e.obj)})).map((function(e){return Fe(l,Bi,"m",Ji).call(l,e)})),totalMatched:r,conditionsMatched:n}}))]}}))}))}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){for(var n=JSON.parse(this._callCppProxy("getUnreadMentionedMessages",e,t,r)).list,i=0;i<n.length;i++)n[i]=this._buildMessage(n[i].obj);return n}}),Object.defineProperty(e.prototype,"addToBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("addToBlacklist",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"removeFromBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("removeFromBlacklist",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getBlacklist",(function(e){setTimeout((function(){t({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){t({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getBlacklistStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getBlacklistStatus",e,(function(e){setTimeout((function(){r({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=r.content,o=r.senderUserId,a=r.messageType,s=r.messageDirection,u=r.readStatus,c=r.sentStatus,l=r.sentTime,_=r.searchContent,d=r.isUnread,f=r.messageUId,p=r.disableNotification,E=r.canIncludeExpansion,b=r.expansionMsg,R=r.channelId,h=r.directedUserIds,g=r.disableUpdateLastMessage;i=JSON.stringify(i);var v={};if(l=l||0,b){var O=JSON.parse(b);for(var I in O)v[I]={v:"",ts:0},v[I].v=O[I],v[I].ts=l}return new Promise((function(r){var b=d?0:1,O=n._callCppProxy("insertMessage",e,t,o,a,i,(function(){}),(function(e){setTimeout((function(){r({code:e})}),0)}),s,u||0,c||10,l,_||"",b,f||"",!!p,!!E,JSON.stringify(v),R||"",h||[],g||!1),I=n._buildMessage(O,!1);I.messageUId=f,I.sentTime=l,r({code:-1===I.messageId?J.MSG_INSERT_ERROR:J.SUCCESS,data:I})}))}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),new Promise((function(n){var i=e.map((function(e){var t=e.content,r=e.senderUserId,n=e.messageType,i=e.messageDirection,o=e.receivedStatus,a=void 0===o?0:o,s=e.sentStatus,u=e.sentTime,c=e.searchContent,l=e.isUnread,_=e.messageUId,d=e.disableNotification,f=e.canIncludeExpansion,p=e.expansion,E=e.channelId,b=e.conversationType,R=e.targetId,h=e.source,g=e.isMentioned,v=e.receivedStatusInfo,O=e.directedUserIds,I=e.disableUpdateLastMessage,C=a;v&&(C=function(e){var t=wt.UNREAD;return(null==e?void 0:e.isRead)&&(t|=wt.READ),(null==e?void 0:e.isListened)&&(t|=wt.LISTENED),(null==e?void 0:e.isDownload)&&(t|=wt.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=wt.RETRIEVED),t}(v));var S={};if(u=u||0,p)for(var T in p)S[T]={v:"",ts:0},S[T].v=p[T],S[T].ts=u;return{conversationType:b,targetId:R,channelId:E||"",direction:i,senderUserId:r,status:s||10,sentTime:u,objectName:n,content:JSON.stringify(t),messageUid:_||"",noNotification:!!d,supportExt:!!f,extMsg:JSON.stringify(S),readStatus:C,searchContent:c||"",isUnread:!!l,source:h||"",isMention:g,directedUsers:O,disableUpdateLastMessage:I||!1}})),o=r._callCppProxy("insertMessages",JSON.stringify(i),t);n({code:o?J.SUCCESS:J.MSG_INSERT_ERROR,data:o||!1})}))}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getMessageCount",e,t,r);i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"deleteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("deleteMessages",e),r(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"deleteMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this;return new Promise((function(a){o._callCppProxy("deleteMessagesByTimestamp",e,t,r,n,i),a(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"batchClearMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r,n){var i=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(i)),r(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"batchClearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}})),n=xi.create(this.logger,"deleteRemoteMessageBySendTimeInBatches",this.logger.createTraceId());return n.asyncInvoke(JSON.stringify(r),!!t,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){return t=ji(this.logger,!0,"getMessage",e),(r=this._buildMessage(t,!1)).messageId<=0?[2,Ir(J.RC_DB_DATA_NOT_FOUND,"msg not found: ".concat(e))]:[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"setMessageContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){t=JSON.stringify(t),n._callCppProxy("setMessageContent",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageSearchField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("setMessageSearchField",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageSentStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setMessageSentStatus",e,t),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setMessageReceivedStatus",e,t),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"saveConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return new Promise((function(o){i._callCppProxy("saveTextMessageDraft",e,t,r,n||"")&&o(J.SUCCESS),o(J.DRAFT_SAVE_ERROR)}))}}),Object.defineProperty(e.prototype,"getConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getTextMessageDraft",e,t,r||"");i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"clearConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("clearTextMessageDraft",e,t,r||"")&&i(J.SUCCESS),i(J.DRAFT_REMOVE_ERROR)}))}}),Object.defineProperty(e.prototype,"getConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r,n,i;return we(this,(function(o){return t=e.conversationType,r=e.targetId,n=e.channelId,i=ji(this.logger,!0,"getBlockPushLevelForConversation",r,n||"",t),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"setConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return void 0===n&&(n=""),new Promise((function(o){i._callCppProxy("setBlockPushLevelForConversation",t,n,e,r,(function(){setTimeout((function(){o(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){o(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getTotalUnreadCountByLevels",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(r){var n=this._callCppProxy("getUnreadMentionedCountByLevel",e,t);return Promise.resolve({code:J.SUCCESS,data:n})}var i=this._callCppProxy("getUnreadCountByLevel",e,t);return Promise.resolve({code:J.SUCCESS,data:i})}}),Object.defineProperty(e.prototype,"sendReadReceiptV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o=this;return we(this,(function(a){switch(a.label){case 0:return[4,(n=xi.create(this.logger,"sendReadReceipt",this.logger.createTraceId())).asyncInvoke(e,r||"",t,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()];case 1:return(i=a.sent()).isOk&&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(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({messageUId:e,error:null==t?void 0:t.stack}))}})),[2,i]}}))}))}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("getMessageReader",e,r,t,(function(e,r){var o=[],a={};(e=JSON.parse(e)).list.forEach((function(e){var t=JSON.parse(e.obj),r=t.id,n=t.time;o.push({userId:r,readTime:n}),a[r]=n}));var s={readerInfo:a,readCount:o.length,totalCount:r};n._updateReadReceiptInfo(t,s),setTimeout((function(){i({code:J.SUCCESS,data:{list:o,totalMemberCount:r}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"sendReadReceiptMessageV4",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=e.conversationType,a=e.targetId,s=e.channelId;n._callCppProxy("sendMessageReadReceipt",o,a,s||"",t,r,(function(){setTimeout((function(){i({code:J.SUCCESS})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getMessageReadReceiptV4",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=e.targetId,o=e.channelId;r._callCppProxy("getMessageReadReceipt",i,o||"",t,(function(e,i,o){var a=[],s=r._callCppProxy("getMessage",t),u=JSON.parse(s);try{JSON.parse(o).list.forEach((function(e){var t=JSON.parse(e.obj),r=t.id,n=t.time;a.push({userId:r,readTime:n})}))}catch(e){r.logger.error(yn.P_PARSE_JSON_E,"method: getMessageReadReceipt, info: ".concat(o,", error: ").concat(e))}var c=JSON.parse(u.readReceiptRequest||"{}"),l=c.readerList,_=void 0===l?[]:l,d=c.readCount,f=void 0===d?0:d,p=!1;_.length<a.length&&(_=a,p=!0),f<i&&(f=i,p=!0),p&&r._callCppProxy("updateReadReceiptRequestInfo",t,JSON.stringify({readerList:_,readCount:f,totalCount:e})),setTimeout((function(){n({code:J.SUCCESS,data:{list:a,totalCount:e,readCount:f}})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"updateConversationReadTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=e.conversationType,o=e.targetId,a=e.channelId;r._callCppProxy("updateConversationReadTime",i,o,a||"",t,(function(){setTimeout((function(){n({code:J.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"_addChatroomCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){this._rmChatroomCache(e),this._chatroomCache.push({chatroomId:e,joinExist:r,count:t,extra:n})}}),Object.defineProperty(e.prototype,"_rmChatroomCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._chatroomCache=this._chatroomCache.filter((function(t){return t.chatroomId!==e}))}}),Object.defineProperty(e.prototype,"_try2RejoinChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(0!==this._chatroomCache.length){var t=this.logger.createTraceId();this._chatroomCache.forEach((function(r){return De(e,void 0,void 0,(function(){var e,n,i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return e=r.chatroomId,n=r.joinExist,i=r.count,o=r.extra,this.logger.info(ee,e,t),[4,this._joinChrm(e,i,n,!1,o)];case 1:return a=c.sent(),s=a.code,u=a.data,s===J.SUCCESS?(this.logger.info(te,e,t),this._sendChatroomStatus({rejoinedRoom:Ue({chatroomId:e,count:i},u)}),[2]):(s===J.RC_CHATROOM_USER_KICKED&&this._rmChatroomCache(e),this._sendChatroomStatus({rejoinedRoom:{chatroomId:e,errorCode:s}}),this.logger.warn(te,"chrmId: ".concat(e,", code: ").concat(s),t),[2])}}))}))}))}}}),Object.defineProperty(e.prototype,"_joinChrm",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=r?"joinExistChatRoom":"joinChatRoom";return new Promise((function(s){n&&o._callCppProxy("clearMessages",Me.CHATROOM,e,""),o._callCppProxy(a,e,t,(function(n,a,u,c,l,_,d){o._addChatroomCache(e,t,r,i||""),setTimeout((function(){s({code:J.SUCCESS,data:{createTime:Number(n),memberCount:a,isAllChatroomBanned:u,isCurrentUserBanned:c,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:_,joinTime:d}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),i||"")}))}}),Object.defineProperty(e.prototype,"joinChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){return we(this,(function(n){switch(n.label){case 0:return[4,this._joinChrm(e,t,!1,!0,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"joinExistChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._joinChrm(e,t,!0,!0,r)}}),Object.defineProperty(e.prototype,"quitChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._rmChatroomCache(e),new Promise((function(r){t._callCppProxy("quitChatRoom",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getChatroomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("getChatroomInfo",e,t,r,(function(e,t){var r=e?JSON.parse(e).list:[],n=[];if(r.length>0)for(var o=0;o<r.length;o++)n.push(JSON.parse(r[o].obj));setTimeout((function(){i({code:J.SUCCESS,data:{userInfos:n,userCount:t}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getChatroomHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a=this;return we(this,(function(s){return i=this.logger.createTraceId(),[2,(o=xi.create(this.logger,"getChatroomHistoryMessage",i)).asyncInvoke(e,t,r,n,(function(e){var t;try{t=JSON.parse(e)}catch(e){t={list:[],hasMore:!1}}var r=t.list;if(r&&r.length)try{t.list=r.map((function(e){return a._buildMessage(e.obj)}))}catch(e){t.list=[]}o.ok(t)}),(function(e){return o.fail(e)}),"").result()]}))}))}}),Object.defineProperty(e.prototype,"setChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i='[{"key":"'.concat(t.key,'", "value":"').concat(t.value,'"}]');r._callCppProxy("setChatroomKV",e,i,!!t.isAutoDelete,!!t.isOverwrite,(function(){setTimeout((function(){n(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"setChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setChatroomKV",e,JSON.stringify(t.entries),!!t.isAutoDelete,!!t.isOverwrite,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}))}))}}),Object.defineProperty(e.prototype,"forceSetChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.setChatroomEntry(e,t)}}),Object.defineProperty(e.prototype,"removeChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=[t.key];return new Promise((function(i){r._callCppProxy("deleteChatroomKV",e,n,!!t.isOverwrite,(function(){i(J.SUCCESS)}),(function(e){i(e)}))}))}}),Object.defineProperty(e.prototype,"forceRemoveChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.removeChatroomEntry(e,t)}}),Object.defineProperty(e.prototype,"removeChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=t.entries.map((function(e){return e.key}));r._callCppProxy("deleteChatroomKV",e,i,!!t.isOverwrite,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}))}))}}),Object.defineProperty(e.prototype,"getChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){switch(o.label){case 0:return[4,this.getAllChatroomEntry(e)];case 1:return r=o.sent(),n=r.code,i=r.data,n!==J.SUCCESS?[2,{code:n}]:i&&i[t]?[2,{code:n,data:i[t]}]:[2,{code:J.CHATROOM_KEY_NOT_EXIST}]}}))}))}}),Object.defineProperty(e.prototype,"getAllChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){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(){r({code:J.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"removeChatroomFromCatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._rmChatroomCache(e)}}),Object.defineProperty(e.prototype,"getFileToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return r=r||"",n=n||"",i=i||"",new Promise((function(s){var u;u=n&&"uploads"!==n?t||"":_r(e,t);var c=a.getNaviInfoFromCache(),l={uploadDomain:br(c,a.logger),env:a._environment};o=o?Math.ceil(o):0,a._callCppProxy("getUploadToken",e,u,r,n,i,JSON.stringify(l),o,c.ipType||0,(function(e,t,r,n,i,o,a,c,l,_,d,f,p,E,b,R,h,g,v,O,I,C,S,T){setTimeout((function(){s({code:J.SUCCESS,data:{token:e,deadline:0,bosToken:t,bosDate:r,path:n,osskeyId:i,ossPolicy:o,ossSign:a,ossBucketName:c,fileName:u,s3Credential:l,s3Algorithm:_,s3Date:d,s3Policy:f,s3Signature:p,s3BucketName:E,stcAuthorization:b,stcContentSha256:R,stcDate:h,stcBucketName:g,minioAuthorization:v,minioContentSha256:O,minioDate:I,minioBucketName:C,downloadAuthInfo:S?JSON.parse(S):null}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getFileUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.getNaviInfoFromCache(),o=br(i,this.logger),a=this.logger.createTraceId(),s=xi.create(this.logger,"getDownloadUrl",a);return s.asyncInvoke(e,r,n,t-1,JSON.stringify({url:o}),-1,i.ipType||0,(function(e){return s.ok({downloadUrl:e})}),(function(e){return s.fail(e)})).result()}}),Object.defineProperty(e.prototype,"clearLocalData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"clearData"),[2,Or(e)]}))}))}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._deviceId}}),Object.defineProperty(e.prototype,"getVoIPKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("getVoIPKey",e,t,"",(function(e){setTimeout((function(){n({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"bindRTCRoomForChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=e.chatRoomId,i=e.rtcRoomId;t._callCppProxy("bindRTCRoomForChatroom",n,i,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return new Promise((function(o){i._callCppProxy("rtcSignaling",e,t,r,n,(function(e){var t=Array.prototype.slice.call(e);o({code:J.SUCCESS,buffer:t})}),(function(e){o({code:e})}),30)}))}}),Object.defineProperty(e.prototype,"_setRTCHeartbeatListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setRTCHeartbeatListener((function(t,r){var n=e.rtcHeartbeatResolves[t];if(n){var i=n.find((function(e){return""===e.seqId}));i&&(i.seqId=r)}}),(function(t,r,n,i){var o=e.rtcHeartbeatResolves[t];if(o){var a=o.findIndex((function(e){return e.seqId===n}));-1!==a&&o.splice(a,1)[0].resolve({code:r,data:{version:Number(i)}})}}))}}),Object.defineProperty(e.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(t){var r={resolve:t,seqId:""},i=n.rtcHeartbeatResolves[e];i?i.push(r):n.rtcHeartbeatResolves[e]=[r],n._callCppProxy("sendRTCHeartbeat",[e],30)}))}}),Object.defineProperty(e.prototype,"createTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"addTag");return t.asyncInvoke(e.tagId,e.tagName,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"deleteTag");return t.asyncInvoke(e,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"updateTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"renameTag");return t.asyncInvoke(e.tagId,e.tagName,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTagList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t;return we(this,(function(r){return e=ji(this.logger,!1,"getTags"),t=this._convertResultList(e,(function(e){return{tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime}})),[2,Or(t)]}))}))}}),Object.defineProperty(e.prototype,"addTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"addConversationsForTag"),n=t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId}}));return r.asyncInvoke(e,JSON.stringify(n),(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"removeConversationsForTag"),n=t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId}}));return r.asyncInvoke(e,JSON.stringify(n),(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"removeTagsForConversation");return r.asyncInvoke(e.conversationType,e.targetId,e.channelId||"",t,(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getConversationListByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o=this;return we(this,(function(a){return n=ji(this.logger,!1,"getConversationsForTagByPage",e,t,r,""),i=this._convertResultList(n,(function(e){return Ue(Ue({},o._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})})),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getUnreadCountByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){return r=ji(this.logger,!0,"getConversationUnreadCountForTag",e,t),[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"setConversationStatusInTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"setConversationToTopForTag");return n.asyncInvoke(e,t.conversationType,t.targetId,t.channelId||"",!!r.isTop,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){return t=ji(this.logger,!1,"getTagsForConversation",e.conversationType,e.targetId,e.channelId||""),r=this._convertResultList(t,(function(e){return{tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime}})),[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"getAllUnreadMentionedCount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){var r=e._callCppProxy("getUnreadAndMentionCount",[Me.GROUP],"");t({code:J.SUCCESS,data:r})}))}}),Object.defineProperty(e.prototype,"getOSInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e={arch:r.arch(),platform:r.platform(),type:r.type(),version:r.version(),release:r.release(),uptime:r.uptime(),cpus:r.cpus(),freemem:r.freemem(),totalmem:r.totalmem(),networkInterfaces:r.networkInterfaces()},[2,{code:J.SUCCESS,data:e}]}))}))}}),Object.defineProperty(e.prototype,"getMainProcessInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,{code:J.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()}}]}))}))}}),Object.defineProperty(e.prototype,"setCallInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("callInfoSignaling",e,t,r,(function(e,t){setTimeout((function(){i({code:J.SUCCESS,data:{key:e,value:t}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"setProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.tcpMgr.getConnectionStatus()!==lt.DISCONNECTED?Promise.resolve({code:J.RC_CONN_PROXY_UNAVAILABLE}):Promise.resolve(li(e,this.logger))}}),Object.defineProperty(e.prototype,"getProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Promise.resolve(_i())}}),Object.defineProperty(e.prototype,"testProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return function(e,t,r){return new Promise((function(n){var i=/^https/.test(t)?si:ii;r.info(pe,JSON.stringify({msg:"test proxy",proxy:e,testHost:t}));var o=i(t,e,(function(e){var t=200===e.statusCode?0:e.statusCode;e.setEncoding("utf8");var r="";e.on("data",(function(e){r+=e})),e.once("end",(function(){n({status:t||0,data:r})}))}));o.once("timeout",(function(){return n({status:0})})),o.once("error",(function(e){return n({status:0,data:e.stack})})),o.end()}))}(e,t,this.logger)}}),Object.defineProperty(e.prototype,"checkDuplicateMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("checkDuplicateMessage",e);r({code:J.SUCCESS,data:n})}))}}),Object.defineProperty(e.prototype,"subscribeUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("updateSubscribeStatus",t,ut.SUBSCRIBE,e,(function(){i({code:J.SUCCESS})}),(function(e,t){i({code:e,data:t})}),r)}))}}),Object.defineProperty(e.prototype,"unSubscribeUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("updateSubscribeStatus",t,ut.UNSUBSCRIBE,e,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}),0)}))}}),Object.defineProperty(e.prototype,"getSubscribeUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._callCppProxy("getSubscribeUserList",e,t,r),i=this._buildSubscribeEventData(n).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return r===st.ONLINE_STATUS&&(a.details=ar(o)),a}));return Promise.resolve({code:J.SUCCESS,data:i})}}),Object.defineProperty(e.prototype,"setDuplicateMessageConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callCppProxy("setDuplicateMessageConfig",[Me.CHATROOM],oo.cuid,e);return Promise.resolve({code:t})}}),Object.defineProperty(e.prototype,"getSubscribeUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callCppProxy("getSubscribeStatusByUserIds",e,t),n=this._buildSubscribeEventData(r).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return r===st.ONLINE_STATUS&&(a.details=ar(o)),a}));return Promise.resolve({code:J.SUCCESS,data:n})}}),Object.defineProperty(e.prototype,"updateMyUserProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[],r=[];Object.keys(e).forEach((function(n){var i;if("extraProfile"===n&&e.extraProfile){if(e.extraProfile){var o=e.extraProfile;Object.keys(o).forEach((function(e){r.push(JSON.stringify({key:e,value:o[e]||""}))}))}}else t.push(JSON.stringify({key:n,value:(null===(i=e[n])||void 0===i?void 0:i.toString())||""}))}));var n=xi.create(this.logger,"updateUserProfile");return n.invoke(t,r,(function(e,t){if(e===J.SUCCESS)n.ok();else{var r=kn(t);n.fail(e,{errorKey:r[0],errorKeys:r})}})).result()}}),Object.defineProperty(e.prototype,"getUserProfiles",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserProfiles",e,(function(e,n){r({code:e,data:t._string2UserProfileInfoList(n)})}))}))}}),Object.defineProperty(e.prototype,"getMyUserProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getOwnUserProfile",(function(r,n){t({code:r,data:e._string2userProfileInfo(n)})}))}))}}),Object.defineProperty(e.prototype,"_string2userProfileInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;try{var r=JSON.parse(e),n=r.userProfile.reduce((function(e,t){var r=JSON.parse(t);return["gender","role","level"].includes(r.key)?e[r.key]=Number(r.value):e[r.key]=r.value,e}),{});return n.userId=r.userId,n.extraProfile=(null===(t=r.userExtProfile)||void 0===t?void 0:t.reduce((function(e,t){var r=JSON.parse(t);return e[r.key]=r.value,e}),{}))||{},n}catch(t){this.logger.error(yn.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}}}),Object.defineProperty(e.prototype,"_string2UserProfileInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;try{return JSON.parse(e).list.map((function(e){return t._string2userProfileInfo(e.obj)}))}catch(t){this.logger.error(yn.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]}}),Object.defineProperty(e.prototype,"updateMyUserProfileVisibility",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("updateUserProfilePermission",e,(function(){r({code:J.SUCCESS})}),(function(e){r({code:e})}))}))}}),Object.defineProperty(e.prototype,"getMyUserProfileVisibility",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getUserProfilePermission",(function(e,r){t({code:e,data:r})}))}))}}),Object.defineProperty(e.prototype,"searchUserProfileByUniqueId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserProfileByUniqueId",e,(function(e,n){r({code:e,data:t._string2userProfileInfo(n)})}))}))}}),Object.defineProperty(e.prototype,"getMatchedMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o=this._callCppProxy("getMatchedMessage",e.conversationType,e.targetId,t,r,n,e.channelId||""),a=[];try{i=JSON.parse(o).list;for(var s=0;s<i.length;s++){var u=this._buildMessage(i[s].obj);a.push(u)}}catch(e){return this.logger.error(yn.P_PARSE_JSON_MSGS_E,o),Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:a})}}),Object.defineProperty(e.prototype,"getConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this,n=e.map((function(e){var t=e.conversationType,r=e.targetId,n=e.channelId;return{targetId:r,channelId:void 0===n?"":n,type:t}})),i=this._callCppProxy("getConversations",JSON.stringify(n));try{t=JSON.parse(i).list.map((function(e){return r._buildConversation(e.obj)}))}catch(e){return this.logger.error(yn.P_PARSE_JSON_MSGS_E,i),Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:t})}}),Object.defineProperty(e.prototype,"handleErrorCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e!==J.SUCCESS&&setTimeout((function(){return t(Ir(e))}),0)}}),Object.defineProperty(e.prototype,"_convertGroupInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&0!==e.length?e.map((function(e){var t=e.groupId,r=e.baseInfo,n=e.createTime,i=e.createUserId,o=e.extraInfo,a=e.memberCount,s=e.ownerId,u=e.remark,c=e.joinTime,l=e.role,_=lr(r),d=lr(o);return{groupId:t,groupName:_.name||"",portraitUri:_.portraitUrl||"",introduction:_.introduction||"",notice:_.announcement||"",joinPermission:~~_.joinPerm,removeMemberPermission:~~_.removePerm,invitePermission:~~_.memInvitePerm,inviteHandlePermission:~~_.invitePerm,groupInfoEditPermission:~~_.profilePerm,memberInfoEditPermission:~~_.memProfilePerm,extProfile:d,creatorId:i||"",ownerId:s||"",createTime:n||0,membersCount:a||0,remark:u||"",joinedTime:c||0,role:l||m.UNDEF}})):[]}}),Object.defineProperty(e.prototype,"_convertUpdateGroupInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&0!==e.length?e.map((function(e){var t=e.groupId,r=e.baseInfo,n=e.createTime,i=e.createUserId,o=e.extraInfo,a=e.memberCount,s=e.ownerId,u=e.remark,c=e.joinTime,l=e.role,_=lr(r),d=lr(o);return JSON.parse(JSON.stringify(Ue(Ue(Ue(Ue(Ue(Ue(Ue(Ue(Ue({groupId:t},function(e){return JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:cr(e.joinPerm),removeMemberPermission:cr(e.removePerm),invitePermission:cr(e.memInvitePerm),inviteHandlePermission:cr(e.invitePerm),groupInfoEditPermission:cr(e.profilePerm),memberInfoEditPermission:cr(e.memProfilePerm)}))}(_)),o.length>0&&{extProfile:d}),i&&{creatorId:i}),s&&{ownerId:s}),n&&{createTime:n}),a&&{membersCount:a}),u&&{remark:u}),c&&{joinedTime:c}),l&&{role:l})))})):[]}}),Object.defineProperty(e.prototype,"_convertGroupMemberInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&0!==e.length?e.map((function(e){var t=e.userId,r=e.nickname,n=e.groupNickname,i=e.portraitUrl,o=e.joinTime;return{userId:t,name:r||"",portraitUri:i||"",nickname:n||"",role:e.role||0,joinedTime:o||0,extra:e.extra||""}})):[]}}),Object.defineProperty(e.prototype,"createGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){return i=Vn(t),o=Vn(r||{}),[2,(a=xi.create(this.logger,"createGroup")).invoke(e,n,JSON.stringify(i),JSON.stringify(o),(function(e,t,r,n){e===J.SUCCESS?a.ok():a.fail(e,{errorKeys:kn(n),processCode:t})})).result()]}))}))}}),Object.defineProperty(e.prototype,"updateGroupInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o;return we(this,(function(a){return n=Vn(t),i=Vn(null!=r?r:{}),[2,(o=xi.create(this.logger,"updateGroupInfo")).invoke(e,JSON.stringify(n),JSON.stringify(i),(function(e,t,r,n){e===J.SUCCESS?o.ok():o.fail(e,{errorKeys:kn(n)})})).result()]}))}))}}),Object.defineProperty(e.prototype,"getGroupsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupInfoByIds",e,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}setTimeout((function(){r({code:J.SUCCESS,data:t._convertGroupInfoList(a)})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"kickGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=Gn(r),a=n._callCppProxy("kickOutGroupMember",e,t,JSON.stringify(o),(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"quitGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=Gn(t),o=r._callCppProxy("quitGroup",e,JSON.stringify(i),(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"dismissGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("disbandGroup",e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"transferGroupOwner",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i=this;return we(this,(function(o){return[2,new Promise((function(o){var a=Gn(n),s=i._callCppProxy("transferGroup",e,t,r,JSON.stringify(a),(function(e,t){setTimeout((function(){o({code:e})}),0)}));i.handleErrorCode(s,o)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupManagers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=n._callCppProxy("updateGroupAdmins",t,r,e,(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupMembersByRole",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=t===m.UNDEF?[1,2,3]:[t],a=n._callCppProxy("getGroupMembers",e,o,r.pageToken||"",r.count,r.order?1:0,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:J.SUCCESS,data:{totalCount:null!=r?r:0,data:s,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("getGroupMembersByIds",e,t,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupMemberInfoList(a);setTimeout((function(){n({code:J.SUCCESS,data:s})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupMemberInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i;return we(this,(function(o){return[2,(i=xi.create(this.logger,"updateGroupMemberInfo")).invoke(e,t,r,n||"",(function(e,t,r,n){e===J.SUCCESS?i.ok():i.fail(e,{errorKeys:kn(n)})})).result()]}))}))}}),Object.defineProperty(e.prototype,"searchGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=r.order?1:0,a=n._callCppProxy("getGroupMembersByNickname",e,t,r.pageToken||"",r.count,o,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:J.SUCCESS,data:{data:s,pageToken:t,totalCount:r}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"joinGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("joinGroup",e,(function(e,t,n){e===J.SUCCESS?setTimeout((function(){r({code:e,data:{processCode:t}})}),0):setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"inviteUsersToGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("inviteUsersToGroup",e,t,(function(e,t,r){e===J.SUCCESS?setTimeout((function(){n({code:e,data:{processCode:t}})}),0):setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))}}),Object.defineProperty(e.prototype,"memberInviteResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=e.groupId,i=e.inviterId,o=e.optType,a=e.optResult,s=e.joinUserId,u=e.reason,c=1===o?1:0,l=c&&s?s:"",_=t._callCppProxy("handleGroupInvite",n,l,i,a,c,null!=u?u:"",(function(e,t,n){e===J.SUCCESS?setTimeout((function(){r({code:e,data:{processCode:t}})}),0):setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(_,r)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupApplications",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===t&&(t=[]),void 0===r&&(r=[]),De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=e.order?1:0,a=n._callCppProxy("getGroupRequests",t,r,"",e.pageToken||"",e.count,o,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=a.map((function(e){var t=e.groupId,r=e.joinUser,n=e.approverUser,i=e.inviterUser,o=e.type;return{groupId:t,joinMemberInfo:r,inviterInfo:i,operatorInfo:n,status:e.status,direction:e.direction,type:o,operationTime:e.operateTime,reason:e.remark}}));setTimeout((function(){i({code:e,data:{totalCount:r,data:s,pageToken:t}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getJoinedGroupsByRole",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t.order?1:0,o=e===m.UNDEF?[1,2,3]:[e],a=r._callCppProxy("getGroups",o,t.pageToken||"",t.count,i,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupInfoList(a);setTimeout((function(){n({code:e,data:{totalCount:i,data:s,pageToken:t}})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(a,n)}))]}))}))}}),Object.defineProperty(e.prototype,"searchJoinedGroups",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t.order?1:0,o=r._callCppProxy("getGroupsByGroupName",e,t.pageToken||"",t.count,i,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupInfoList(a);setTimeout((function(){n({code:e,data:{totalCount:i,data:s,pageToken:t}})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"getJoinedGroups",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupsByIds",e,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}var s=t._convertGroupInfoList(a);setTimeout((function(){r({code:e,data:s})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t?L.ADD:L.REMOVE,o=r._callCppProxy("updateGroupRemark",e,t||"",i,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupFollows",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=n._callCppProxy("updateFavoriteMembers",t,r,e,(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupFollows",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupFavoriteMembers",e,"",1e3,0,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}var s=a.map((function(e){return{userId:e.userId,time:e.followTime}}));setTimeout((function(){r({code:J.SUCCESS,data:s})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"addFriend",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("addFriend",e,t,r,(function(e,t,r){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))}}),Object.defineProperty(e.prototype,"deleteFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("removeFriends",e,t,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"acceptFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("acceptFriendRequest",e,"",(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"refuseFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("rejectFriendRequest",e,t||"",(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"setFriendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"setFriendInfo"),i=Vn(null!=r?r:{});return n.invoke(e,t,JSON.stringify(i),(function(e,t,r,i){e===J.SUCCESS?n.ok():n.fail(e,{errorKeys:kn(i)})})).result()}}),Object.defineProperty(e.prototype,"checkFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("checkFriendRelationship",e,t,(function(e,t){if(e===J.SUCCESS){var r=JSON.parse(t).map((function(e){return{userId:e.userId,relationType:e.status}}));setTimeout((function(){n({code:e,data:r})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"getFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriends",e,0,(function(e,n){try{if(e===J.SUCCESS){var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:e,data:{data:o,pageToken:""}})}),0)}else setTimeout((function(){r({code:e})}),0)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"getFriendApplications",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=e.order?1:0,a=3;t&&1===t.length&&(a=null==t?void 0:t[0]);var s=n._callCppProxy("getFriendRequestListByPage",a,r||[0,1,2,3],e.count,e.pageToken||"",o,(function(e,t,r){if(e===J.SUCCESS){var o=[];try{o=JSON.parse(r)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,r),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var a=o.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:e,data:{data:a,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(s,i)}))}}),Object.defineProperty(e.prototype,"deleteFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Promise.resolve({code:J.NOT_SUPPORT})}}),Object.defineProperty(e.prototype,"_convertFriendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.map((function(e){var t=e.userId,r=e.userName,n=e.remark;return{userId:t,name:r,portraitUri:e.portraitUrl,remark:n,directionType:e.friendType,extProfile:e.extProfiles,addTime:e.addTime,inBlackList:!!e.friendAttribute}}))}}),Object.defineProperty(e.prototype,"getFriendsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriendByIds",e,(function(e,n){if(e===J.SUCCESS){var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:e,data:o})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"searchFriendsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriendByNickname",e,(function(e,n){if(e===J.SUCCESS)try{var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:J.SUCCESS,data:o})}),0)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"setFriendAddPermission",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("setFriendAuthPermission",e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"getFriendAddPermission",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){var r=e._callCppProxy("getFriendAuthPermission",(function(e,r){setTimeout((function(){t({code:e,data:r})}),0)}));e.handleErrorCode(r,t)}))}}),Object.defineProperty(e.prototype,"setNotificationQuietHoursWithSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.startTime,r=e.spanMinutes,n=e.level,i=e.timezone,o=xi.create(this.logger,"addPushSetting");return o.invoke(t,r,n,i||"",(function(){return o.ok()}),(function(e){return o.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeNotificationQuietHoursSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=xi.create(this.logger,"removePushSetting");return e.invoke((function(){return e.ok()}),(function(t){return e.fail(t)})).result()}}),Object.defineProperty(e.prototype,"getNotificationQuietHoursSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=xi.create(this.logger,"queryPushSetting");return e.invoke((function(t,r,n,i){var o={startTime:t,spanMinutes:r,level:n,timezone:i};e.ok(o)}),(function(t){return e.fail(t)})).result()}}),Object.defineProperty(e.prototype,"setDataBaseLogConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callCppProxy("setDataBaseLogConfig",e)}}),Object.defineProperty(e.prototype,"getStatsUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,Or(Qr.getStatsUrlList(this.getNaviInfoFromCache()))]}))}))}}),Object.defineProperty(e.prototype,"sendReadReceiptResponseV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"sendReadReceiptByReadReceiptType");return r.invoke(e.conversationType,e.targetId,e.channelId||"",Mn,t,(function(e,t,n){e!==J.SUCCESS?r.fail(e):r.ok()})).result()}}),Object.defineProperty(e.prototype,"getMessageReadReceiptInfoV5ByIdentifiers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.label){case 0:return t=e.map((function(e){var t=e.identifier,r=e.messageUId;return{conIdentifier:{type:t.conversationType,targetId:t.targetId,channelId:t.channelId||""},uid:r}})),[4,(r=xi.create(this.logger,"getReadReceiptCount")).invoke(JSON.stringify(t),(function(e,t){e!==J.SUCCESS?r.fail(e):r.ok(t)})).result()];case 1:return[2,n.sent().trans((function(e){return JSON.parse(e).map((function(e){return{identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount}}))}))]}}))}))}}),Object.defineProperty(e.prototype,"getMessagesReadReceiptUsersByPageV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"getReadReceiptUsersByUid");return n.invoke(e.conversationType,e.targetId,e.channelId||"",t,r.pageToken||"",!r.readStatus,r.pageCount,0===r.order,(function(e,t,r,i){if(e===J.SUCCESS){var o={pageToken:t,totalCount:i,users:JSON.parse(r).map((function(e){return JSON.parse(e)})).map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}}))};n.ok(o)}else n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getMessagesReadReceiptByUsersV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"getReadReceiptStatusForUsersInMessage");return n.invoke(e.conversationType,e.targetId,e.channelId||"",t,r,(function(e,t,r,i){if(e===J.SUCCESS){var o=JSON.parse(r).map((function(e){return JSON.parse(e)})).map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}}));n.ok({pageToken:"",totalCount:0,users:o})}else n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"requestSpeechToTextForMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=xi.create(this.logger,"speechToText");return r.invoke(e,(function(n,i){r.ok();var o=JSON.parse(i),a={status:o.status,text:o.text,isVisible:o.visible};setImmediate((function(){t._dispatchEvent("speechToTextResponse",{code:n,messageUId:e,sttInfo:a})}))})).result()}}),Object.defineProperty(e.prototype,"setMessageSpeechToTextVisible",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){return[2,(r=ji(this.logger,!0,"updateSpeechToTextVisible",e,t))===J.SUCCESS?Or():Ir(r)]}))}))}}),Object.defineProperty(e.prototype,"setTranslationLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"setPushSetting");return t.invoke(Un,e,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTranslationLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"getPushSetting",Un),[2,Or(e)]}))}))}}),Object.defineProperty(e.prototype,"setAutoTranslateEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"setPushSetting");return t.invoke(Dn,e?"1":"0",(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getAutoTranslateEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"getPushSetting",Dn),[2,Or("1"===e)]}))}))}}),Object.defineProperty(e.prototype,"translateWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){return i=ji(this.logger,!0,"getPushSetting",Un)||"zh",o=xi.create(this.logger,"translateMessages"),a=e.map((function(e){return{messageRecognitionIdentifier:{messageUid:e.identifier,customText:0===n?"":e.content,inputSource:n},sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage||i}})),[2,o.invoke(a,{forceRetranslate:r,translationServiceType:t},(function(e){e!==J.SUCCESS?o.fail(e):o.ok()})).result()]}))}))}}),Object.defineProperty(e.prototype,"modifyMessageWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.stringify(e.messageContent),r=xi.create(this.logger,"editMessage",this.logger.createTraceId());return r.asyncInvoke((function(){return r.ok()}),(function(e){return r.fail(e)}),e.messageUId,t).result()}}),Object.defineProperty(e.prototype,"refreshReferenceMessageWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this,o=xi.create(this.logger,"getQuotingMessageByUId");return o.asyncInvoke(t.conversationType,t.targetId,t.channelId||"",e,(function(e){o.fail(e)}),(function(e){o.ok(),setTimeout((function(){return Fe(i,Bi,"m",io).call(i,e,n)}),0)}),(function(e){o.ok(),setTimeout((function(){return Fe(i,Bi,"m",io).call(i,e,r)}),0)})).result()}}),e}();Bi=new WeakSet,Ji=function(e,t){var r=e.channelId,n=e.conversationType,i=e.targetId,o=e.senderUserId,a=e.content,s=e.objectName,u=e.messageUid,c=e.direction,l=e.status,_=e.messageId,d=e.sentTime,f=e.readReceiptRequest,p=e.supportExt,E=e.pushContent,b=e.pushTitle,R=e.pushId,h=e.pushConfig,g=e.templateId,v=e.disableTitle,O=e.forcePushDetail,I=e.hasMore,C=e.directedUsers,S=e.noNotification,T=e.disableUpdateLastMessage,N=e.needReceipt,P=e.sendReceipt,m=e.contentRecognition,y=e.convertExt,A=e.editTime,L=e.editContent,M=e.editStatus,U=e.quotedMsgStatus,D=this._parseMessageJsonContent(a,_),w=!!D.mentionedInfo;if(y){var j=JSON.parse(y);if(j.trans){var V=j.trans,G={targetLanguage:V.targetLanguage,translatedText:V.translatedText,status:V.translateStatus};D.translateInfo=G}}if(s===gt||s===vt){var F=m?JSON.parse(m):{status:Kt,text:"",visible:!1},k={status:F.status,text:F.text,isVisible:F.visible};D.sttInfo=k}var x=vn(s),H=this._buildSupportExt(p,e),B=nr(t)?d<this.tcpMgr.getConnectedTime():t,J={};h&&(J=function(e,t){var r={},n={notificationId:t||""},i={};if(!e)return{iOSConfig:r,androidConfig:n,harmonyOSConfig:i};try{var o=JSON.parse(e);null==o||o.forEach((function(e){var t,o,a,s,u,c,l,_,d,f,p,E,b=Object.keys(e);if(0!==b.length){var R=b[0];switch(R){case"HW":return n.channelIdHW=null===(t=e[R])||void 0===t?void 0:t.channelId,n.importanceHW=null===(o=e[R])||void 0===o?void 0:o.importance,n.imageUrlHW=null===(a=e[R])||void 0===a?void 0:a.image,void(n.categoryHW=null===(s=e[R])||void 0===s?void 0:s.category);case"MI":return void(n.channelIdMi=null===(u=e[R])||void 0===u?void 0:u.channelId);case"OPPO":return void(n.channelIdOPPO=null===(c=e[R])||void 0===c?void 0:c.channelId);case"VIVO":return n.typeVivo=null===(l=e[R])||void 0===l?void 0:l.classification,void(n.categoryVivo=null===(_=e[R])||void 0===_?void 0:_.category);case"APNS":return r.threadId=e[R]["thread-id"],r.apnsCollapseId=e[R]["apns-collapse-id"],r.category=e[R].category,r.richMediaUri=e[R].richMediaUri,void(r.interruptionLevel=e[R]["interruption-level"]);case"FCM":return void(n.googleConfig={collapseKey:e[R].collapse_key||"",imageUrl:e[R].imageUrl||"",priority:e[R].priority||""});case"HONOR":return n.importanceHonor=null===(d=e[R])||void 0===d?void 0:d.importance,void(n.imageUrlHonor=null===(f=e[R])||void 0===f?void 0:f.image);case"OHOS":i.category=null===(p=e[R])||void 0===p?void 0:p.category,i.image=null===(E=e[R])||void 0===E?void 0:E.image}}}))}catch(e){}return{iOSConfig:r,androidConfig:n,harmonyOSConfig:i}}(h,R));var W=Ue(Ue({},J),{pushTitle:b,pushContent:E,pushData:E,disablePushTitle:v,forceShowDetailContent:O,templateId:g}),Y={channelId:r,conversationType:n,targetId:i,senderUserId:o,content:D||{},messageType:s,messageUId:u||"",messageDirection:c,isOffLineMessage:B,sentTime:d,receivedTime:0,isPersited:x.isPersited,isCounted:x.isCounted,isMentioned:w,disableNotification:S,isStatusMessage:vn(s).isStatusMessage||!1,canIncludeExpansion:p,expansion:p?H:null,receivedStatus:0,receivedStatusInfo:void 0,sentStatus:void 0,messageId:_,pushConfig:W,hasMore:I,directedUserIds:C||[],disableUpdateLastMessage:T,needReceipt:N,sendReceipt:P};if(c===ft.RECEIVE?(Y.receivedStatus=l,Y.receivedStatusInfo=function(e){return{isRead:(e&wt.READ)===wt.READ,isListened:(e&wt.LISTENED)===wt.LISTENED,isDownload:(e&wt.DOWNLOADED)===wt.DOWNLOADED,isRetrieved:(e&wt.RETRIEVED)===wt.RETRIEVED}}(l)):Y.sentStatus=l,f){var K=this._handleReadReceiptRequest(f);Y.readReceiptInfo=K}if(A||M)try{Y.modifyInfo={timestamp:A,content:L?JSON.parse(L):{},status:M}}catch(e){this.logger.error(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({editContent:L,messageId:_}))}return s===Ct&&(Y.content.referMsgStatus=U),Y},Wi=function(e){var t=e.channelId,r=e.conversationType,n=e.targetId,i=e.unreadCount,o=e.lastestMsg,a=e.isTop,s=e.blockStatus,u=e.matchCount,c=e.hasUnreadMention,l=e.conversationTime,_=e.draft,d=e.translateStrategy;return{channelId:t,conversationType:r,targetId:n,unreadMessageCount:i,latestMessage:-1===JSON.parse(o).messageId?null:this._buildMessage(o),hasMentioned:c,notificationStatus:Jt(s),isTop:a,lastUnreadTime:0,matchCount:u,operationTime:l,notificationLevel:s,draft:_,translateStrategy:d}},Yi=function(e,t){var r=this;try{var n=JSON.parse(e).list.map((function(e){return r._buildConversation(e.obj)}));return Or({list:n,hasNext:t})}catch(e){return Ir(J.MAIN_PROCESS_ERROR,"parse conversation list result error")}},Ki=function(e){var t=JSON.parse(e),r=Fe(this,Bi,"m",Ji).call(this,t,!1),n=r.messageType,i=r.messageUId;if(this.logger.info(yn.L_RECV_S_MSG_S,JSON.stringify({messageUId:i,messageType:n})),this._lowPriorityMessageHandler.isLowPriorityMessage(n)){var o=this.tcpMgr.getCurrentUserId();return this._lowPriorityMessageHandler.push(r,o),void this._handleLowPriorityMessages(o,this.tcpMgr.getConnectedTime())}this._handleHighPriorityMessages([r],!1,!1)},Xi=function(e,t){var r=this,n=this.tcpMgr.getConnectedTime(),i=this.tcpMgr.getCurrentUserId(),o=[],a=[];JSON.parse(e).list.forEach((function(e){var t=JSON.parse(e.obj),s=t.sentTime<n,u=Fe(r,Bi,"m",Ji).call(r,t,s),c=u.messageType;r._lowPriorityMessageHandler.isLowPriorityMessage(c)?r._lowPriorityMessageHandler.push(u,i):s?o.push(u):a.push(u)})),o.length>0&&this._handleHighPriorityMessages(o,!!t,!0);var s=!1;(!t||a.length>0)&&!this._pullOfflineMessageFinished&&(s=this._pullOfflineMessageFinished=!0),a.length>0&&this._handleHighPriorityMessages(a,!!t,!1),(this._pullOfflineMessageFinished||this._lowPriorityMessageHandler.count>=1e4)&&this._handleLowPriorityMessages(i,n),s&&this._sendPullOfflineFinished()},Qi=function(e){var t=e.content,r=t.messageUId,n=t.sentTime;t.isAdmin;var i=t.isDelete;if("number"!=typeof n||"string"!=typeof r||!r.length)return this.logger.warn(yn.L_DISCARD_MSG_O,JSON.stringify({messageUId:e.messageUId,messageType:e.messageType})),!1;var o=this._callCppProxy("getMessage",r),a=this._buildMessage(o,!1),s=a.messageId>0;if(i)return s&&this._callCppProxy("deleteMessages",[a.messageId]),s;if(s&&a.messageType===Tt)return!1;var u={recallTime:Date.now(),admin:!!e.content.isAdmin,isDelete:!!e.content.isDelete,originalObjectName:a.messageType,originalMessageContent:a.content,recallActionTime:e.sentTime,operatorId:e.senderUserId};if(e.content.user&&(u.user=e.content.user),e.content.extra&&(u.extra=e.content.extra),a.messageType===ht&&(u.recallContent=a.content.content),!s){var c=e.conversationType,l=e.targetId,_=e.senderUserId,d=e.channelId,f=e.messageDirection;return this._callCppProxy("insertMessage",c,l,_,Tt,JSON.stringify(u),(function(){}),(function(){}),f,1,30,n,"",0,r,!1,!0,JSON.stringify({}),d||"",[],!1),!0}return a.receivedStatus||this.setMessageReceivedStatus(a.messageId,1),this._callCppProxy("setMessageContent",a.messageId,JSON.stringify(u),Tt),!0},Zi=function(e){return De(this,void 0,void 0,(function(){var t,r,n,i,o,a,s;return we(this,(function(u){return t=e.channelId,r=e.count,n=e.startTime,i=e.conversationTypes,o=e.topPriority,a=i&&i.length>0?i:Ze(Je),s=void 0===t?ji(this.logger,!1,"getConversationListWithAllChannel",a):ji(this.logger,!1,"getConversationListByPageWithTopPriority",a,n,r,!!o,t||""),[2,Fe(this,Bi,"m",Yi).call(this,s)]}))}))},qi=function(e){var t;return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){return r=null==e?void 0:e.channelId,n=((null===(t=null==e?void 0:e.conversationTypes)||void 0===t?void 0:t.length)||0)>0?e.conversationTypes:Ze(Je),i=nr(r)?ji(this.logger,!1,"getTopConversations",n):ji(this.logger,!1,"getTopConversations",n,r),[2,Fe(this,Bi,"m",Yi).call(this,i,!1)]}))}))},zi=function(e){var t;return De(this,void 0,void 0,(function(){var r,n;return we(this,(function(i){return r=((null===(t=null==e?void 0:e.conversationTypes)||void 0===t?void 0:t.length)||0)>0?e.conversationTypes:Ze(Je),n=ji(this.logger,!1,"getUnreadConversationList",r),[2,Fe(this,Bi,"m",Yi).call(this,n,!1)]}))}))},$i=function(e){return De(this,void 0,void 0,(function(){var t,r,n;return we(this,(function(i){return t=null==e?void 0:e.channelId,r=Ze(Je),n=void 0===t?ji(this.logger,!1,"getConversationListWithAllChannel",r):ji(this.logger,!1,"getConversationList",r,t),[2,Fe(this,Bi,"m",Yi).call(this,n,!1)]}))}))},eo=function(e){return De(this,void 0,void 0,(function(){var t,r,n,i,o;return we(this,(function(a){return t=e.index,r=e.limit,n=e.conversationTypes,i=n&&n.length>0?n:Ze(Je),o=ji(this.logger,!1,"getConversationListWithAllChannelByPage",i,t,r),[2,Fe(this,Bi,"m",Yi).call(this,o)]}))}))},to=function(e,t,r,n,i,o){var a=this.logger.createTraceId(),s=xi.create(this.logger,"updateConversationStatus",a),u=JSON.stringify(e.map((function(e){return{conversation_query_param:{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,channel_id_valid:"string"==typeof e.channelId&&e.channelId.length>0},block_op:t,translate_strategy_op:n,top_op:r,create_conversation:!!o,update_time:!!i}})));return s.invoke(u,(function(){return s.ok()}),(function(e){return s.fail(e)})).result()},ro=function(e){if(!e)return[];var t=[],r=function(e){if(0!==t.length){var r=[];e.forEach((function(e){r.push.apply(r,Ge([],Ve(t.map((function(t){return Ue(Ue({},t),e)}))),!1))})),t=r}else t.push.apply(t,Ge([],Ve(e),!1))},n=e.conversationTypes,i=void 0===n?[]:n,o=e.targetIds,a=void 0===o?[]:o,s=e.channelIds,u=void 0===s?[]:s,c=kr(i).map((function(e){return{conversationType:e}})),l=kr(a).map((function(e){return{targetId:e}})),_=kr(u).length?u.map((function(e){return{channelId:e}})):[{channelIdValid:!1}];return r(c),r(l),r(_),t},no=function(e){var t=this,r=[];return e&&e.length>0&&(r=e.map((function(e){var r=JSON.parse(e.obj);return{messageUId:r.msg_uid,message:r.code===J.SUCCESS?t._buildMessage(r.msg):void 0,code:r.code}}))),r},io=function(e,t){try{var r=JSON.parse(e).list;t(Fe(this,Bi,"m",no).call(this,r))}catch(t){this.logger.error(yn.P_PARSE_JSON_MSGS_E,e)}};var po,Eo=function(){function e(e,t,r,n,i,o,a,s){Object.defineProperty(this,"sendCallback",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_cppService",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._cppService=new fo(e,t,i,n,r,a,s)}return Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r,n,i,o,a=this;return we(this,(function(s){switch(s.label){case 0:return"sendMessage"===e&&(r=t[3],t[3]=function(e){a.sendCallback({reqId:r,data:e})}),"refreshReferenceMessageWithParams"===e&&(n=t[2],i=t[3],t[2]=function(e){a.sendCallback({reqId:n,data:e})},t[3]=function(e){a.sendCallback({reqId:i,data:e})}),[4,(o=this._cppService).callProxy.apply(o,Ge([e],Ve(t),!1))];case 1:return[2,{success:!0,data:s.sent()}]}}))}))}}),Object.defineProperty(e.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._cppService).sendProxy.apply(t,Ge([e],Ve(r),!1))}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._cppService.destroy()}}),e}(),bo=function(){function r(t,r,n,i,o,a){var s=this;void 0===o&&(o=!1),void 0===a&&(a=!1),Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_dbpath",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_logOutputLevel",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_enableSyncEmptyTopConversation",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_eventLoopBlockingCheck",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_cppServiceProcessProxy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catch",{enumerable:!0,configurable:!0,writable:!0,value:{crtUserId:"",connectedTime:0,naviInfo:null,connectionStatus:2,deviceId:"",deltaTime:0}}),Object.defineProperty(this,"_rendererInitOptions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_callbackCache",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._createServiceProxy(),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",(function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return De(s,void 0,void 0,(function(){var n,i;return we(this,(function(o){switch(o.label){case 0:return[4,(i=this._cppServiceProcessProxy).call.apply(i,Ge([t],Ve(r),!1))];case 1:return n=o.sent(),e.returnValue=n.data,[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",(function(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return De(s,void 0,void 0,(function(){var i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return"sendMessage"===r&&(i=n[3],this._callbackCache[i]=e.sender),"refreshReferenceMessageWithParams"===r&&(o=n[2],a=n[3],this._callbackCache[a]=e.sender,this._callbackCache[o]=e.sender),[4,(u=this._cppServiceProcessProxy).call.apply(u,Ge([r],Ve(n),!1))];case 1:if(!(s=c.sent()).success)throw new Error(s.data.msg);return this._send2Renderer(e.sender,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,s.data),[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(function(e,t){for(var r,n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];"registerMessageType"===t&&gn(n[0],n[1]),(r=s._cppServiceProcessProxy).send.apply(r,Ge([t],Ve(n),!1))})),e.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this)),e.app.on("before-quit",(function(){return s.destroy()})),e.app.on("window-all-closed",(function(){return s.destroy()}))}return Object.defineProperty(r.prototype,"_send2Renderer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e.isDestroyed()?delete this._senders[e.id]:e.send.apply(e,Ge([t],Ve(r),!1))}}),Object.defineProperty(r.prototype,"_send2AllRenderer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];Object.keys(this._senders).forEach((function(n){var i=t._senders[n];t._send2Renderer.apply(t,Ge([i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e],Ve(r),!1))}))}}),Object.defineProperty(r.prototype,"_registerRenderers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=e.sender,i=n.id;this._rendererInitOptions||(this._rendererInitOptions=t),this._cppServiceProcessProxy.send("registerRenderers",t),this._senders[i]||(this._senders[i]=n,n.once("destroyed",(function(){delete r._senders[i]})))}}),Object.defineProperty(r.prototype,"getMainCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._catch}}),Object.defineProperty(r.prototype,"_callbackHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.reqId,r=e.data;this._callbackCache[t]&&this._send2Renderer(this._callbackCache[t],"__RC_CHANNEL_RESULT_FROM_MAIN__",t,r)}}),Object.defineProperty(r.prototype,"_createServiceProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this._dbpath||t.resolve(e.app.getPath("userData"));this._cppServiceProcessProxy=new Eo(this._appkey,r,this._logOutputLevel,this._enableSyncEmptyTopConversation,this._send2AllRenderer.bind(this),this._callbackHandler.bind(this),this._disableLogReport,this._eventLoopBlockingCheck)}}),Object.defineProperty(r.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._cppServiceProcessProxy.destroy()}}),Object.defineProperty(r.prototype,"setDataBaseLogConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._cppServiceProcessProxy.call("setDataBaseLogConfig",e)}}),r}(),Ro=function(){function e(e,t,r,n,i,o){Object.defineProperty(this,"_rcMain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rcMain=new bo(e,t,r,n,i,o)}return Object.defineProperty(e.prototype,"getCppProto",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return{destroy:function(){console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),e.destroy()}}}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._rcMain.destroy()}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rcMain.getMainCache().deviceId}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rcMain.getMainCache().connectedTime}}),Object.defineProperty(e.prototype,"setDatabaseOperationTimeThreshold",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._rcMain.setDataBaseLogConfig(e)}}),e}();module.exports=function(e){return function(e){if(po)return po;if(!e.appkey)throw new Error("Initializ failed, `appkey` is required!");return po=new Ro(e.appkey,(null==e?void 0:e.dbpath)||"",(null==e?void 0:e.logOutputLevel)||Kr.WARN,!!(null==e?void 0:e.enableSyncEmptyTopConversation),(null==e?void 0:e.disableLogReport)||!1,(null==e?void 0:e.eventLoopBlockingCheck)||!1)}(e)};
|
|
16
|
+
var Ae=function(e,t){return Ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Ae(e,t)};function Le(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Ae(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Me,Ue=function(){return Ue=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ue.apply(this,arguments)};function De(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function we(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function je(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ve(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function Ge(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function Fe(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function ke(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}!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"}(Me||(Me={}));var xe,He,Be,Je=0,We=1,Ye=2,Ke=3,Xe=4,Qe=5,Ze=function(e){var t=[Me.PRIVATE,Me.GROUP,Me.SYSTEM,Me.PUBLIC_SERVICE,Me.APP_PUBLIC_SERVICE];switch(e){case Je:return t;case We:return[Me.PRIVATE,Me.GROUP];case Ye:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP],!1);case Ke:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP,Me.CHATROOM],!1);case Xe:return Ge(Ge([],Ve(t),!1),[Me.ULTRA_GROUP,Me.CHATROOM,Me.RTC_ROOM,Me.CUSTOMER_SERVICE,Me.DISCUSSION],!1);case Qe:return[Me.PRIVATE,Me.GROUP,Me.ULTRA_GROUP]}};!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"}(xe||(xe={})),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"}(He||(He={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(Be||(Be={}));var qe,ze,$e,et,tt,rt,nt,it,ot,at,st,ut,ct,lt,_t,dt,ft,pt,Et,bt,Rt,ht="RC:TxtMsg",gt="RC:VcMsg",vt="RC:HQVCMsg",Ot="RC:LogCmdMsg",It="RC:MsgExMsg",Ct="RC:ReferenceMsg",St="RC:RcCmd",Tt="RC:RcNtf",Nt="RC:ReadNtf",Pt="RC:RRReqMsg",mt="RC:RRRspMsg",yt="RC:SRSMsg",At="RC:RRMsg",Lt="RC:RSMsg",Mt="RC:Delivered",Ut="RC:DRMsg",Dt="RC:CCConfigChangeRequestMsg";!function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE"}(qe||(qe={})),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"}(ze||(ze={})),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",e[e.UG_DEL=6]="UG_DEL"}($e||($e={})),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"}(et||(et={})),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"}(tt||(tt={})),function(e){e[e.NOT_MENTIONED=0]="NOT_MENTIONED",e[e.ALL=1]="ALL",e[e.ME=2]="ME"}(rt||(rt={})),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"}(nt||(nt={})),function(e){e[e.typing=0]="typing"}(it||(it={})),function(e){e[e.ONLINE=1]="ONLINE",e[e.OFFLINE=0]="OFFLINE"}(ot||(ot={})),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"}(at||(at={})),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"}(st||(st={})),function(e){e[e.SUBSCRIBE=0]="SUBSCRIBE",e[e.UNSUBSCRIBE=1]="UNSUBSCRIBE"}(ut||(ut={})),function(e){e[e.NOT_SET=0]="NOT_SET",e[e.INVISIBLE=1]="INVISIBLE",e[e.EVERYONE=2]="EVERYONE",e[e.FriendVisible=3]="FriendVisible"}(ct||(ct={})),function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.SUSPENDED=3]="SUSPENDED"}(lt||(lt={})),function(e){e[e.GLOBAL=1]="GLOBAL",e[e.CUSTOM=2]="CUSTOM",e[e.THIRD_PARTY=3]="THIRD_PARTY"}(_t||(_t={})),function(e){e[e.MSG_ORIGINAL=0]="MSG_ORIGINAL",e[e.MSG_EXPANSION=1]="MSG_EXPANSION",e[e.MSG_MODIFY=2]="MSG_MODIFY"}(dt||(dt={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(ft||(ft={})),function(e){e.NORMAL="NORMAL",e.LOW="LOW"}(pt||(pt={})),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"}(Et||(Et={})),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"}(bt||(bt={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(Rt||(Rt={}));var wt,jt,Vt,Gt,Ft,kt,xt,Ht,Bt,Jt=function(e){return e<=bt.NOT_SET?Rt.CLOSE:Rt.OPEN};!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"}(wt||(wt={})),function(e){e[e.PRIVATE=1]="PRIVATE",e[e.OPEN=0]="OPEN"}(jt||(jt={})),function(e){e[e.NAVI=1]="NAVI",e[e.TCP=2]="TCP",e[e.WS=3]="WS"}(Vt||(Vt={})),function(e){e[e.REQUEST=0]="REQUEST",e[e.LOCAL=1]="LOCAL"}(Gt||(Gt={})),function(e){e[e.CURRENT=2]="CURRENT"}(Ft||(Ft={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT"}(kt||(kt={})),function(e){e[e.CONNECT=0]="CONNECT",e[e.RECONNECT=1]="RECONNECT",e[e.REDIRECTED=3]="REDIRECTED",e[e.TIMEOUT=4]="TIMEOUT"}(xt||(xt={})),function(e){e.PASSIVE="passive",e.ACTIVE="active",e.TIME_SENSITIVE="time-sensitive",e.CRITICAL="critical"}(Ht||(Ht={})),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"}(Bt||(Bt={}));var Wt,Yt,Kt=0;!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"}(Wt||(Wt={})),function(e){e.GET="GET",e.POST="POST",e.PUT="PUT"}(Yt||(Yt={}));var Xt=72e5,Qt="5.28.0-c-tmp.1".replace(/-.+$/,""),Zt="rongcloudsystem",qt="undefined"!=typeof window&&window?(window.__RCVersionInfo||(window.__RCVersionInfo={}),window.__RCVersionInfo):{};qt.engine="5.28.0-c-tmp.1";var zt=function(){function e(){}return Object.defineProperty(e,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){["imlib-next","engine","electron-main","electron-renderer","imlib-v2-adapter","Global_IM_UIKit","IMKit","imkit-store","rtclib","calllib","callplus","plugin-wechat-rtc"].includes(e)&&(qt[e]=t)}}),Object.defineProperty(e,"validEngine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.match(/\d+\.\d+\.\d+/);if(!t)return!1;var r=t[0].split(".").map((function(e){return e.padStart(3,"0")})).join("");return qt.engine.match(/\d+\.\d+\.\d+/)[0].split(".").map((function(e){return e.padStart(3,"0")})).join("")>=r}}),Object.defineProperty(e,"getInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return qt}}),e}();var $t=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)}))},er=function(e){void 0===e&&(e=22);var t,r=Date.now(),n=r.toString(36),i=Math.floor(Math.random()*r).toString(36),o=e-n.length-i.length;return[i,n,o>0?(t=o,Array.from({length:t}).map((function(){return Math.floor(36*Math.random()).toString(36)})).join("")):""].join("").slice(0,e)}(22),tr=Date.now(),rr=function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")},nr=function(e){return void 0===e||"[object Undefined]"===Object.prototype.toString.call(e)},ir=function(e){return function(e){return"string"==typeof e}(e)&&/https?:\/\//.test(e)},or=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1},ar=function(e){return[at.Android,at.iOS,at.Web,at.PC,at.Mini,at.HarmonyOS].map((function(t){var r=e.findIndex((function(e){return e.platform===t}));return-1===r?{platform:t,changeTime:0,eventValue:0}:e[r]}))},sr=function(e,t,r){return t?1===r?xe.TLS:xe.RMTP:"http"===e?xe.WS:xe.WSS},ur=function(e,t){var r=e.server,n=e.backupServer,i=e.bs,o=e.serverAddr,a=e.protocol,s=e.openTLS;if(o)return Ge([],Ve(o.filter((function(e){return e.addr}))),!1);var u=[],c=[];return r&&c.push(r),(n||i||"").split(",").forEach((function(e){c.indexOf(e)<0&&c.push(e)})),c.forEach((function(e,n){e&&u.push({addr:e,protocol:sr(a,t,s),weight:r.length-n,race:!1})})),Ge([],Ve(u),!1)},cr=function(e){if(void 0!==e){var t=Number(e);return Number.isNaN(t)?void 0:t}},lr=function(e){return e.reduce((function(e,t){return e[t.key]=t.value,e}),{})},_r=function(e,t){var r=Math.floor(1e3*Math.random()%1e4),n=$t(),i=function(e){e=e||"-";var t=new Date,r=t.getFullYear(),n=t.getMonth()+1,i=t.getDate();return"".concat(r).concat(e).concat(n).concat(e).concat(i)}(),o=(new Date).getTime(),a="";if(t){var s=t.split(".");a=".".concat(s[s.length-1])}return"".concat(e,"__RC-").concat(i,"_").concat(r,"_").concat(o).concat(n).concat(a)},dr=function(e,t,r){void 0===e&&(e={}),void 0===t&&(t={}),void 0===r&&(r={});var n=t.channelIdMi,i=t.channelIdHW,o=t.channelIdOPPO,a=t.typeVivo,s=t.importanceHW,u=t.categoryHW,c=t.imageUrlHW,l=t.categoryVivo,_=t.importanceHonor,d=t.imageUrlHonor,f=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var r=e.threadId,n=e.apnsCollapseId,i=e.category,o=e.richMediaUri,a=e.interruptionLevel,s=t.googleConfig,u={};u["thread-id"]=r||"",u["apns-collapse-id"]=n||"",u.category=i||"",u.richMediaUri=o||"",u["interruption-level"]=a||"active";var c={};c.collapse_key=null==s?void 0:s.collapseKey,c.imageUrl=null==s?void 0:s.imageUrl;var l=null==s?void 0:s.priority;return l&&!["high","normal"].includes(l)&&(l="normal"),c.priority=l,{APNS:u,FCM:c}}(e,t),p=[{HW:{channelId:i||"",importance:s||"NORMAL",image:c||"",category:u||""}},{MI:{channelId:n||""}},{OPPO:{channelId:o||""}},{VIVO:{classification:a||"",category:l||""}},{APNS:f.APNS},{FCM:f.FCM},{HONOR:{importance:_||pt.NORMAL,image:d||""}},{OHOS:{category:r.category||null,image:r.image||""}}];return JSON.stringify(p)},fr=function(){var e=zt.getInfo(),t="electron";for(var r in e)"engine"!==r&&(t=["imlib-v2-adapter","imlib-next"].includes(r)?r:"electron");return t};function pr(e,t){var r;if(!e)return"";var n="undefined"!=typeof window&&"https:"===(null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.protocol);return/^https?:\/\//.test(e)?n?e.replace(/^https?:\/\//i,"https://"):e:t!==xe.HTTP||n?"https://".concat(e):"http://".concat(e)}var Er,br=function(e,t){if(!e)return"";var r=e.ossConfig,n=void 0===r?"":r,i="";try{var o=JSON.parse(n);if(o.length>0){var a=o.find((function(e){return e.minio}));a&&(i=a.minio)}}catch(e){t.warn(Ne,JSON.stringify({ossConfig:n,error:e}))}return i},Rr=function(e){function t(t){var r=e.call(this,t)||this;return r.name="RCError",r}return Le(t,e),Object.defineProperty(t,"InvalidParameters",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return(null==e?void 0:e.length)?new t("Invalid parameter -> ".concat(e)):new t("Invalid parameters.")}}),Object.defineProperty(t,"ParameterTypeError",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new t("Wrong parameter type")}}),t}(Error),hr=function(){function e(){Er.set(this,!1)}return Object.defineProperty(e.prototype,"stopPropagation",{enumerable:!1,configurable:!0,writable:!0,value:function(){ke(this,Er,!0,"f")}}),Object.defineProperty(e.prototype,"isStopPropagation",{get:function(){return Fe(this,Er,"f")},enumerable:!1,configurable:!0}),e}();Er=new WeakMap;var gr=function(){function e(){Object.defineProperty(this,"_map",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_piped",{enumerable:!0,configurable:!0,writable:!0,value:new Set})}return Object.defineProperty(e.prototype,"_addItem",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){void 0===i&&(i=0);var o=Symbol(),a=this._map.get(e)||this._map.set(e,[]).get(e),s={symbol:o,priority:Math.min(i,100),listener:t.bind(n),once:r},u=a.findIndex((function(e){return e.priority>i}));return-1===u?a.push(s):a.splice(u,0,s),o}}),Object.defineProperty(e.prototype,"on",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=0),this._addItem(e,t,!1,r,n)}}),Object.defineProperty(e.prototype,"once",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=0),this._addItem(e,t,!0,r,n)}}),Object.defineProperty(e.prototype,"off",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;try{for(var n=je(this._map),i=n.next();!i.done;i=n.next()){var o=Ve(i.value,2),a=(o[0],o[1]),s=a.findIndex((function(t){return t.symbol===e}));if(-1!==s)return void a.splice(s,1)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=this._map.get(e);if(n&&n.length>0)for(var i=new hr,o=0;o<n.length;o+=1){var a=n[o],s=a.once,u=a.listener;s&&n.splice(o,1);try{u.apply(void 0,Ge([i],Ve(t),!1))}catch(e){null===console||void 0===console||console.error(e)}if(i.isStopPropagation)return}Ge([],Ve(this._piped.values()),!1).forEach((function(r){return r.emit.apply(r,Ge([e],Ve(t),!1))}))}}),Object.defineProperty(e.prototype,"removeAll",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._map.delete(e)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._piped.clear(),this._map.clear()}}),Object.defineProperty(e.prototype,"pipe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._piped.add(e)}}),e}();!function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_versionQueue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_pullingPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(t,"_dataVersion",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(t,"_invervalTimer",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(t,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),t}Le(t,e),Object.defineProperty(t.prototype,"length",{get:function(){return this._versionQueue.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPulling",{get:function(){return null!==this._pullingPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setInitVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!1),De(this,void 0,void 0,(function(){return we(this,(function(r){return-1!==this._dataVersion||(this._dataVersion=e,t&&this._execPulling()),[2]}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e<this._dataVersion||(this._versionQueue.push(e),-1!==this._dataVersion&&this._execPulling())}}),Object.defineProperty(t.prototype,"_execPulling",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r,n,i,o;return we(this,(function(a){switch(a.label){case 0:return this._pullingPromise?[2]:(this._pullingPromise=this._handleSyncData(this._dataVersion),[4,this._pullingPromise]);case 1:if(e=a.sent(),t=e.isOk,r=e.data,this._pullingPromise=null,!t)return[2];if(void 0===(null==r?void 0:r.version)||r.version<this._dataVersion)throw new Error("version error, please check: lastVersion: ".concat(this._dataVersion,", newVersion: ").concat(null==r?void 0:r.version));return n=r.version,i=r.hasNext,o=this._versionQueue.filter((function(e){return e>n})),this._versionQueue=Ge([],Ve(o),!1),this._dataVersion=n,i?[2,this._execPulling()]:this._versionQueue.length>0?(this._versionQueue.length=0,[2,this._execPulling()]):[2]}}))}))}}),Object.defineProperty(t.prototype,"startInterval",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._started||(this._started=!0,t&&this._execPulling(),this._invervalTimer=setInterval((function(){return r._execPulling()}),e))}}),Object.defineProperty(t.prototype,"stopInterval",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._started=!1,clearInterval(this._invervalTimer),this._invervalTimer=-1)}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.stopInterval(),this._versionQueue.length=0,this._dataVersion=-1}})}(gr),function(){function e(e,t){var r=this;Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_onCancel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._promise=new Promise((function(t){r._resolve=t,e(r._onResolve.bind(r))})),this._onCancel=t}Object.defineProperty(e.prototype,"_onResolve",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._resolve(e)}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._promise}}),Object.defineProperty(e.prototype,"abort",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._onCancel(this._onResolve.bind(this))}})}(),function(){function e(e,t){var r=this;Object.defineProperty(this,"handler",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"validate",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_handlerPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._handlerPromise=new Promise((function(e){r._resolve=e}))}Object.defineProperty(e.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){if(!this._resolve)throw new Error("BatchSync is closed");return this.validate&&!this.validate(e)||this._data.add(e),[2,this._handlerPromise]}))}))}}),Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t;return we(this,(function(r){switch(r.label){case 0:if(!this._resolve)throw new Error("BatchSync is closed");return e=this._resolve,this._resolve=null,t=Ge([],Ve(this._data.values()),!1),this._data.clear(),t.length>0?[4,this.handler(t)]:[3,2];case 1:r.sent(),r.label=2;case 2:return e(),[2,Promise.resolve()]}}))}))}})}();var vr=function(){function e(e,t,r){Object.defineProperty(this,"isOk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"msg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isOk=0===e,this.code=e,this.msg=t,this.data=r}return Object.defineProperty(e.prototype,"next",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){return this.isOk?[2,e(this.data)]:[2,this.wipe()]}))}))}}),Object.defineProperty(e.prototype,"or",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){return this.isOk?[2,this]:[2,e(this.code)]}))}))}}),Object.defineProperty(e.prototype,"orSync",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?this:e(this.code)}}),Object.defineProperty(e.prototype,"trans",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?Or(e(this.data)):this.wipe()}}),Object.defineProperty(e.prototype,"tryTrans",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.isOk?e(this.data):this.wipe()}}),Object.defineProperty(e.prototype,"errmsg",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify({code:this.code,msg:this.msg})}}),Object.defineProperty(e.prototype,"wipe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isOk?Or(void 0,this.msg):Ir(this.code,this.msg)}}),e}(),Or=function(e,t){return new vr(0,t||"success",e)},Ir=function(e,t,r){return new vr(e,t||"fail: ".concat(e),r)};!function(){function e(e){Object.defineProperty(this,"_apiName",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_isValid",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_code",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_errmsg",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}Object.defineProperty(e,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return new e(t)}}),Object.defineProperty(e.prototype,"isFailed",{get:function(){return!this._isValid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.isFailed&&0===this._code&&(this._code=e,this._errmsg=t||this._errmsg),this}}),Object.defineProperty(e.prototype,"setFailed",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._isValid=!1,this.fail(e,t)}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.isFailed&&0===this._code)throw new Error("Validator: result() should not be called without fail()");return this.isFailed?Ir(this._code,this._errmsg):Or()}}),Object.defineProperty(e.prototype,"check",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e(this),this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(void 0===n&&(n=!1),this.isFailed)return this;var i=n?r(t):null==t||r(t);return this._isValid=i,this.isFailed&&(this._errmsg="param '".concat(e,"' is invalid")),this}}),Object.defineProperty(e.prototype,"assert",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){if(void 0===n&&(n=!1),this.isFailed)return this;if(this.validate(e,t,r,n),this.isFailed)throw Rr.InvalidParameters("'".concat(e,"' at '").concat(this._apiName,"'"));return this}}),Object.defineProperty(e.prototype,"isString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(){return"string"==typeof t}),r)}}),Object.defineProperty(e.prototype,"assertString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(){return"string"==typeof t}),r)}}),Object.defineProperty(e.prototype,"isNotEmptyString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.isString(e,t,r).validate(e,t,(function(e){return e.trim().length>0}),r)}}),Object.defineProperty(e.prototype,"assertNotEmptyString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assertString(e,t,r),this.assert(e,t,(function(e){return e.trim().length>0}),r)}}),Object.defineProperty(e.prototype,"isLimitedString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isString(e,t,i).validate(e,t,(function(e){return e.length>=r&&e.length<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedString",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertString(e,t,i),this.assert(e,t,(function(e){return e.length>=r&&e.length<=n}),i)}}),Object.defineProperty(e.prototype,"isBoolean",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"boolean"==typeof e}),r)}}),Object.defineProperty(e.prototype,"assertBoolean",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"boolean"==typeof e}),r)}}),Object.defineProperty(e.prototype,"isNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),r)}}),Object.defineProperty(e.prototype,"assertNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"number"==typeof e&&!Number.isNaN(e)}),r)}}),Object.defineProperty(e.prototype,"isLimitedNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isNumber(e,t,i).validate(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedNumber",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertNumber(e,t,i),this.assert(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"isInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return Number.isInteger(e)}),r)}}),Object.defineProperty(e.prototype,"assertInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return Number.isInteger(e)}),r)}}),Object.defineProperty(e.prototype,"isLimitedInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.isInteger(e,t,i).validate(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"assertLimitedInteger",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=!1),this.assertInteger(e,t,i),this.assert(e,t,(function(e){return e>=r&&e<=n}),i)}}),Object.defineProperty(e.prototype,"isArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),r)}}),Object.defineProperty(e.prototype,"assertArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return-1!==Object.prototype.toString.call(e).indexOf("Array")}),r)}}),Object.defineProperty(e.prototype,"isLimitedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===n&&(n=!1),void 0===i&&(i=1),this.isArray(e,t,n).validate(e,t,(function(e){return e.length>=i&&e.length<=r}),n)}}),Object.defineProperty(e.prototype,"assertLimitedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===n&&(n=!1),void 0===i&&(i=1),this.assertArray(e,t,n),this.assert(e,t,(function(e){return e.length>=i&&e.length<=r}),n)}}),Object.defineProperty(e.prototype,"isTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.isArray(e,t,n).validate(e,t,(function(e){return e.every(r)}),n)}}),Object.defineProperty(e.prototype,"assertTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.assertArray(e,t,n),this.assert(e,t,(function(e){return e.every(r)}),n)}}),Object.defineProperty(e.prototype,"isLimitedTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.isLimitedArray(e,t,r,i,o).validate(e,t,(function(e){return e.every(n)}),i)}}),Object.defineProperty(e.prototype,"assertLimitedTypedArray",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return void 0===i&&(i=!1),void 0===o&&(o=1),this.assertLimitedArray(e,t,r,i,o),this.assert(e,t,(function(e){return e.every(n)}),i)}}),Object.defineProperty(e.prototype,"isObject",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),r)}}),Object.defineProperty(e.prototype,"assertObject",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"[object Object]"===Object.prototype.toString.call(e)}),r)}}),Object.defineProperty(e.prototype,"isValueOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.validate(e,t,(function(){return Object.values(r).includes(t)}),n)}}),Object.defineProperty(e.prototype,"assertValueOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),this.assert(e,t,(function(){return Object.values(r).includes(t)}),n)}}),Object.defineProperty(e.prototype,"isFunction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.validate(e,t,(function(e){return"function"==typeof e}),r)}}),Object.defineProperty(e.prototype,"assertFunction",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),this.assert(e,t,(function(e){return"function"==typeof e}),r)}})}();var Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function Sr(e){var t,r,n,i,o,a,s="",u=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");u<e.length;)t=Cr.indexOf(e.charAt(u++))<<2|(i=Cr.indexOf(e.charAt(u++)))>>4,r=(15&i)<<4|(o=Cr.indexOf(e.charAt(u++)))>>2,n=(3&o)<<6|(a=Cr.indexOf(e.charAt(u++))),s+=String.fromCharCode(t),64!==o&&(s+=String.fromCharCode(r)),64!==a&&(s+=String.fromCharCode(n));return s}var Tr,Nr=1732584193,Pr=4023233417,mr=2562383102,yr=271733878,Ar=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Lr=[3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745];function Mr(e,t){return e<<t|e>>>32-t}function Ur(e,t,r){return e&r|t&~r}function Dr(e,t,r){return e^t^r}function wr(e,t,r){return t^(e|~r)}function jr(e){for(var t=[],r=0;r<e.length;r+=4)t.push((e[r]||0)|(e[r+1]||0)<<8|(e[r+2]||0)<<16|(e[r+3]||0)<<24);return t}function Vr(e){var t=new Uint8Array(4);return t[0]=255&e,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}function Gr(e){var t=8*e.length,r=e.length%64<56?56-e.length%64:120-e.length%64,n=new Uint8Array(e.length+r+8);n.set(e),n[e.length]=128;for(var i=1;i<r;i++)n[e.length+i]=0;var o=new Uint8Array(8),a=4294967295&t,s=4294967295&Math.floor(t/4294967296);o.set(Vr(a),0),o.set(Vr(s),4),n.set(o,e.length+r);var u,c=Nr,l=Pr,_=mr,d=yr;for(i=0;i<n.length;i+=64){for(var f=jr(n.slice(i,i+64)),p=c,E=l,b=_,R=d,h=0;h<64;h++){var g=void 0,v=void 0;h<16?(g=(u=l)&_|~u&d,v=h):h<32?(g=Ur(l,_,d),v=(5*h+1)%16):h<48?(g=Dr(l,_,d),v=(3*h+5)%16):(g=wr(l,_,d),v=7*h%16);var O=d;d=_,_=l,l+=Mr(c+g+Lr[h]+f[v]&4294967295,Ar[h]),c=O}c=c+p&4294967295,l=l+E&4294967295,_=_+b&4294967295,d=d+R&4294967295}var I=new Uint8Array(16);return I.set(Vr(c),0),I.set(Vr(l),4),I.set(Vr(_),8),I.set(Vr(d),12),function(e){return Array.from(e).map((function(e){return e.toString(16).padStart(2,"0")})).join("")}(I)}function Fr(e){var t=function(e){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);var t=unescape(encodeURIComponent(e)).split("").map((function(e){return e.charCodeAt(0)}));return new Uint8Array(t)}(e);return Gr(t)}function kr(e){if(!e||0===e.length)return[];var t=new Set;return e.forEach((function(e){t.add(e)})),Array.from(t)}!function(e){e[e.add=1]="add",e[e.update=2]="update",e[e.delete=3]="delete"}(Tr||(Tr={}));var xr,Hr,Br=0,Jr=1;!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"}(Hr||(Hr={}));var Wr=((xr={})[Hr.BJ]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5yb25nLWVkZ2UuY29t","bmF2LWIucm9uZy1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24ucm9uZy1lZGdlLmNvbQ==",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnJvbmctZWRnZS5jb20=","d3MtYi5yb25nLWVkZ2UuY29t"],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWMtMS5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20="],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5yb25nLWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIucm9uZy1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5yb25nLWVkZ2UuY29t"]},xr[Hr.SG]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zZy1saWdodC1lZGdlLmNvbQ==","bmF2LWIuc2ctbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2ctbGlnaHQtZWRnZS5jb20=",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWxpZ2h0LWVkZ2UuY29t","d3MtYi5zZy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:["aHR0cHM6Ly9ib290c3RyYXBwcm9maWxlLWItMi5zMy5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29t"],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIuc2ctbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1saWdodC1lZGdlLmNvbQ=="]},xr[Hr.NA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi51cy1saWdodC1lZGdlLmNvbQ==","bmF2LWIudXMtbGlnaHQtZWRnZS5jb20="],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24udXMtbGlnaHQtZWRnZS5jb20=",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnVzLWxpZ2h0LWVkZ2UuY29t","d3MtYi51cy1saWdodC1lZGdlLmNvbQ=="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC51cy1saWdodC1lZGdlLmNvbQ==","Y2xvdWRjb250cm9sLWIudXMtbGlnaHQtZWRnZS5jb20="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy51cy1saWdodC1lZGdlLmNvbQ=="]},xr[Hr.SG_B]={naviUrlBase64:["bmF2LnNnLWItbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],logUrlBase64:[{addr:"Y29sbGVjdGlvbi5zZy1iLWxpZ2h0LWVkZ2UuY29t",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNnLWItbGlnaHQtZWRnZS5jb20=","d3MtYi5zZy1iLWxpZ2h0LWVkZ2UuY29t"],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zZy1iLWxpZ2h0LWVkZ2UuY29t","Y2xvdWRjb250cm9sLWIuc2ctYi1saWdodC1lZGdlLmNvbQ=="],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zZy1iLWxpZ2h0LWVkZ2UuY29t"]},xr[Hr.SA]={naviUrlBase64:["ZHVhbHN0YWNrLW5hdi5zYXUtbGlnaHQtZWRnZS5jb20=","bmF2LWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],logUrlBase64:[{addr:"ZHVhbHN0YWNrLWNvbGxlY3Rpb24uc2F1LWxpZ2h0LWVkZ2UuY29t",protocol:xe.HTTPS,weight:-1}],miniCmpBase64:["ZHVhbHN0YWNrLXdzLnNhdS1saWdodC1lZGdlLmNvbQ==","d3MtYi5zYXUtbGlnaHQtZWRnZS5jb20="],staticConfigUrlBase64:[],cloudControllerUrlBase64:["ZHVhbHN0YWNrLWNsb3VkY29udHJvbC5zYXUtbGlnaHQtZWRnZS5jb20=","Y2xvdWRjb250cm9sLWIuc2F1LWxpZ2h0LWVkZ2UuY29t"],statsUrlBase64:["aHR0cHM6Ly9zdGF0cy5zYXUtbGlnaHQtZWRnZS5jb20="]},xr);function Yr(e){return Hr[e]?e:Hr.BJ}var Kr,Xr=function(){function e(){Object.defineProperty(this,"initOption",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.initOption=e}}),Object.defineProperty(e.prototype,"getNaviUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this.initOption||{},i=n.areaCode,o=n.navigators,a=(r=i,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].naviUrlBase64).map((function(e){return Sr(e)})),s=[],u=Ve(e.split("@"),2)[1];t&&(s=u?u.split(";"):[]);var c=o&&o.length>0?Ge(Ge([],Ve(s),!1),Ve(o),!1):Ge(Ge([],Ve(s),!1),Ve(a),!1);return c.filter((function(e,t){return c.indexOf(e)===t})).map((function(e){return pr(e)}))}}),Object.defineProperty(e.prototype,"getLogUrlPolicyList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=e||{},i=n.log,o=n.logPolicy,a=this.initOption||{},s=a.areaCode,u=a.logServerUrl,c=(r=s,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].logUrlBase64).map((function(e){return Ue(Ue({},e),{addr:Sr(e.addr)})})),l=[],_={level:1,itv:6,times:5};if(i)l.push.apply(l,Ge([],Ve(i.addrs),!1)),Object.assign(_,i.policy);else if(o)try{var d=JSON.parse(o);l.push({addr:d.url,protocol:xe.HTTPS,weight:1}),_.level=d.level,_.itv=d.itv,_.times=d.times}catch(r){t.warn(ue,JSON.stringify({policy:e.logPolicy}))}var f=u?Ge([{addr:u,protocol:xe.HTTPS,weight:101}],Ve(l),!1):Ge(Ge([],Ve(l),!1),Ve(c),!1);return{policy:_,addrs:f.filter((function(e,t){return f.findIndex((function(t){return t.addr===e.addr&&t.protocol===e.protocol}))===t})).map((function(e){return Ue(Ue({},e),{addr:pr(e.addr,e.protocol)})})).sort((function(e,t){return t.weight-e.weight}))}}}),Object.defineProperty(e.prototype,"getMiniCmpUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r=(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Hr.BJ),Wr[Yr(t)].miniCmpBase64).map((function(e){return Sr(e)})),n=(this.initOption||{}).miniCMPProxy;return n&&n.length>0?n:r}}),Object.defineProperty(e.prototype,"getStaticConfigUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode,void 0===t&&(t=Hr.BJ),Wr[Yr(t)].staticConfigUrlBase64).map((function(e){return Sr(e)}))}}),Object.defineProperty(e.prototype,"getCloudControllerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=null!=e?e:null===(t=this.initOption)||void 0===t?void 0:t.areaCode;return(r=n,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].cloudControllerUrlBase64).map((function(e){return Sr(e)}))}}),Object.defineProperty(e.prototype,"getAreaCode",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return null!==(t=null===(e=this.initOption)||void 0===e?void 0:e.areaCode)&&void 0!==t?t:Hr.BJ}}),Object.defineProperty(e.prototype,"setAreaCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!(!e||!Hr[e]||e===this.initOption.areaCode)&&(this.initOption.areaCode=e,!0)}}),Object.defineProperty(e.prototype,"getStatsUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=e||{},i=n.active,o=n.activeServer,a=(null==i?void 0:i.addrs)||[],s=(r=null===(t=this.initOption)||void 0===t?void 0:t.areaCode,void 0===r&&(r=Hr.BJ),Wr[Yr(r)].statsUrlBase64).map((function(e){return Sr(e)})),u=[];return 0!==a.length?u.push.apply(u,Ge([],Ve(a.sort((function(e,t){return t.weight-e.weight})).map((function(e){return pr(e.addr,e.protocol)}))),!1)):o&&u.push(pr(o,xe.HTTPS)),s.forEach((function(e){u.includes(e)||u.push(e)})),u}}),e}(),Qr=new Xr,Zr=function(){function e(e,t){Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticUrls",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"getStaticConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return De(this,void 0,void 0,(function(){var t,r,n,i,o,a,s,u;return we(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]),r=JSON.parse(t),Date.now()-(null==r?void 0:r.time)<18e5?[4,this.decryptData(r.val)]:[3,3];case 2:return n=c.sent(),(i=n.resources.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:i.map((function(e){return pr(e.addr,e.protocol)}))||[]}];case 3:return[3,5];case 4:return o=c.sent(),this.logger.error(Re,JSON.stringify({error:null==o?void 0:o.stack})),[3,5];case 5:this.clearCache(),c.label=6;case 6:return[4,this._requestHandle()];case 7:return(a=c.sent())?[4,this.decryptData(a)]:[2];case 8:return(null==(s=c.sent())?void 0:s.areaCode)!==Qr.getAreaCode()?[2]:(this.setCache(JSON.stringify({time:Date.now(),val:a})),this.staticUrls=(null==s?void 0:s.bootstrap)||[],(u=null===(e=null==s?void 0:s.resources)||void 0===e?void 0:e.navi.slice()).sort((function(e,t){return t.weight-e.weight})),[2,{navi:u.map((function(e){return pr(e.addr,e.protocol)}))||[]}])}}))}))}}),Object.defineProperty(e.prototype,"_requestHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,u,c,l;return we(this,(function(_){switch(_.label){case 0:e=(e=Ge(Ge([],Ve(this.staticUrls),!1),Ve(Qr.getStaticConfigUrl()),!1).map((function(e){return pr(e)}))).filter((function(t,r){return e.indexOf(t)===r})),_.label=1;case 1:_.trys.push([1,6,7,8]),t=je(e),r=t.next(),_.label=2;case 2:return r.done?[3,5]:(n=r.value,this.logger.info(Ee,JSON.stringify({url:n})),i=Date.now(),[4,this.sendRequest("".concat(n,"/").concat(this.appkey))]);case 3:if(o=_.sent(),a=o.code,s=o.data,200===a)return this.logger.info(be,JSON.stringify({url:n,code:a,duration:Date.now()-i})),[2,s];this.logger.warn(be,JSON.stringify({url:n,code:a,duration:Date.now()-i})),_.label=4;case 4:return r=t.next(),[3,2];case 5:return[3,8];case 6:return u=_.sent(),c={error:u},[3,8];case 7:try{r&&!r.done&&(l=t.return)&&l.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"}(Kr||(Kr={}));var qr,zr,$r=function(){function e(e,t,r,n){Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_id",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_type",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"outputLevel",{enumerable:!0,configurable:!0,writable:!0,value:Kr.WARN}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.DEBUG)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.INFO)}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.WARN)}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.ERROR)}),Object.defineProperty(this,"__statistics",{enumerable:!0,configurable:!0,writable:!0,value:this._log.bind(this,Kr.STATISTICS)}),Object.defineProperty(this,"record",{enumerable:!0,configurable:!0,writable:!0,value:this.__statistics})}return Object.defineProperty(e.prototype,"_write",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.tag,r=e.level,n=e.content,i=e.traceId;/^[\w-]+$/.test(t)?r!==Kr.DEBUG&&this.logDB.write(e):console.error("".concat((new Date).toISOString(),"[").concat(this._id,"]['ERROR']: ").concat(t," | ").concat(n," | ").concat(i))}}),Object.defineProperty(e.prototype,"createTraceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"".concat(++e._traceIdCount)}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return er}}),Object.defineProperty(e.prototype,"_stdout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.time,r=e.tag,n=e.content,i=e.traceId,o=e.level,a=e.loggerId;if(console&&!(o<=Kr.FATAL||o>this.outputLevel)){var s=["error","warn","info","debug"][o-1],u="".concat(new Date(t).toISOString(),"[").concat(null!=a?a:this._id,"][").concat((s||"stat").toUpperCase(),"]: ").concat(r," | ").concat(n," | ").concat(i);console[s||"warn"](u)}}}),Object.defineProperty(e.prototype,"setOutputLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){(function(e){return[Kr.DEBUG,Kr.INFO,Kr.WARN,Kr.ERROR].some((function(t){return t===e}))})(e)&&(this.outputLevel=e)}}),Object.defineProperty(e.prototype,"_log",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i={time:Date.now(),level:e,tag:t,content:r,traceId:n,loggerId:this._id,sessionId:this.getSessionId(),type:this._type};this._stdout(i),this._write(i)}}),Object.defineProperty(e.prototype,"summary",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){if(void 0===n&&(n={}),t.isOk){var a=null==i?void 0:i(t.data);this.info(e,JSON.stringify(Ue(Ue({isOk:!0},n),a)),r)}else{a=null==o?void 0:o(t.data);this.warn(e,JSON.stringify(Ue(Ue({code:t.code,msg:t.msg},n),a)),r)}}}),Object.defineProperty(e,"_traceIdCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),e}(),en=function(){function e(e,t,r,n,i,o){void 0===o&&(o=!1),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"deviceInfo",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"logDB",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"userId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"reportFailedNumber",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"itvByNavi",{enumerable:!0,configurable:!0,writable:!0,value:6}),Object.defineProperty(this,"timesByNavi",{enumerable:!0,configurable:!0,writable:!0,value:5})}return Object.defineProperty(e.prototype,"_getLogs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return De(this,void 0,void 0,(function(){var a,s,u,c=this;return we(this,(function(l){switch(l.label){case 0:a=[],l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.logDB.read(e,t,r,n,o)];case 2:return s=l.sent(),rr(s.logs)?a=s.logs.filter((function(e){return!(!e||"object"!=typeof e)||(c.logger.warn(le,"Invalid log entry: not an object",i),!1)})):this.logger.warn(le,"Invalid logs result: not an array",i),[3,4];case 3:return u=l.sent(),this.logger.warn(le,"Error getting logs: ".concat(u instanceof Error?u.message:String(u)),i),[3,4];case 4:return[2,{logs:a}]}}))}))}}),Object.defineProperty(e.prototype,"checkStart",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){return this.started?[2]:(this.userId=e.userId,!e.logSwitch||this.disableLogReport||(r=Qr.getLogUrlPolicyList(e,this.logger),n=r.policy,i=r.addrs,this.started=!0,this.itvByNavi=n.itv,this.timesByNavi=n.times,i.length>0&&this.realtimeReport(i[0].addr,n.level,n.itv,t)),[2])}))}))}}),Object.defineProperty(e.prototype,"_sendLogs2Realtime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f;return we(this,(function(p){switch(p.label){case 0:return this.logger.debug(_e,"compress logs: ".concat(e.length)),[4,this.compressLogs(e)];case 1:return i=p.sent(),o=i.success,a=i.data,o?(this.logger.debug(_e,"compress done",t),s=ir(r)?r:"https://".concat(r),s+="?version=".concat("5.28.0-c-tmp.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web"),[4,this.send({url:s,body:a,method:"POST"})]):(this.logger.warn(le,"compress failed",t),[2,{isOk:!1,itv:n}]);case 2:if(u=p.sent(),c=u.status,l=u.data,this.logger.debug(le,JSON.stringify({status:c,data:l}),t),200!==c)return this.reportFailedNumber>this.timesByNavi&&this.itvByNavi<60&&(n+=n),this.reportFailedNumber++,[2,{isOk:!1,itv:n}];if(this.reportFailedNumber=0,l)try{(f=JSON.parse(l)).nextTime&&(n=f.nextTime),_=f.level,d=f.logSwitch}catch(e){this.logger.warn(Ne,JSON.stringify({error:null==e?void 0:e.stack}),t)}return[2,{isOk:!0,itv:n,level:_,logSwitch:d}]}}))}))}}),Object.defineProperty(e.prototype,"realtimeReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f,p=this;return we(this,(function(E){switch(E.label){case 0:return i=Date.now(),o=this.logger.getTimestamp4RealtimeLog()||tr,a=Math.max(i-3e4,o+1),s=this.logger.createTraceId(),this.logger.debug(ce,JSON.stringify({startTime:o,endTime:a,level:t,itv:r}),s),[4,this._getLogs(o,a,t,!0,s,n)];case 1:return 0!==(u=E.sent().logs).length?[3,2]:(this.logger.debug(le,"no logs",s),[3,4]);case 2:return u.length>0?[4,this._sendLogs2Realtime(u,s,e,r)]:[3,4];case 3:c=E.sent(),l=c.itv,_=c.level,d=c.logSwitch,c.isOk&&(f=Math.max.apply(Math,Ge([],Ve(u.map((function(e){return e.time}))),!1)),this.logger.setTimestamp4RealtimeLog(f+1),0===d&&(this.started=!1),void 0!==_&&(t=_)),r=l,E.label=4;case 4:return this.started&&(r>=60&&this.itvByNavi<60&&(r=60),this.timer=setTimeout((function(){return p.realtimeReport(e,t,r,n)}),1e3*r)),[2]}}))}))}}),Object.defineProperty(e.prototype,"report",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){return void 0===a&&(a=!1),De(this,void 0,void 0,(function(){var s,u,c,l,_,d,f,p;return we(this,(function(E){switch(E.label){case 0:return"web"!==r.toLowerCase()||this.disableLogReport?[2]:(s=this.logger.createTraceId(),this.logger.info(ae,JSON.stringify({startTime:e,endTime:t,logId:i,messageUId:o,isCloudControl:a}),s),[4,this._getLogs(e,t,Kr.DEBUG,!1,s)]);case 1:return u=E.sent().logs,this.logger.info(oe,JSON.stringify({count:u.length}),s),c=ir(n)?n:"https://".concat(n),c+="?version=".concat("5.28.0-c-tmp.1","&appkey=").concat(this.appkey,"&userId=").concat(encodeURIComponent(this.userId),"&deviceId=").concat(this.deviceId,"&deviceInfo=").concat(this.deviceInfo,"&platform=Web&logId=").concat(i),u.length>0?[4,this.compressLogs(u)]:[3,3];case 2:return _=E.sent(),d=_.success,f=_.data,l=d?f:"compress failed",[3,4];case 3:l="no data or no database",E.label=4;case 4:return this.logger.debug(oe,"compress done",s),a&&(c+="&source=cloud"),[4,this.send({url:c,body:l,method:"POST"})];case 5:return p=E.sent().status,this.logger.info(se,JSON.stringify({status:p}),s),[2]}}))}))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.started=!1}}),e}();function tn(e){try{return!(!e||"object"!=typeof e)&&("number"==typeof e.time&&("string"==typeof e.tag&&("string"==typeof e.sessionId&&("string"==typeof e.type&&"number"==typeof e.level))))}catch(e){return!1}}function rn(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,{logs:[]}]}))}))}function nn(){}var on=function(){function e(e,t){qr.set(this,void 0),zr.set(this,void 0),ke(this,qr,e,"f"),ke(this,zr,t,"f")}return Object.defineProperty(e.prototype,"read",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o,a;return we(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,Fe(this,qr,"f").call(this,e,t,r,n,i)];case 1:return(o=s.sent())&&Array.isArray(o.logs)?[2,{logs:o.logs.filter(tn)}]:[2,{logs:[]}];case 2:return a=s.sent(),console.error("[LogDBProxy] read error",a),[2,{logs:[]}];case 3:return[2]}}))}))}}),Object.defineProperty(e.prototype,"write",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{Fe(this,zr,"f").call(this,e)}catch(e){console.error("[LogDBProxy] write error",e)}}}),Object.defineProperty(e.prototype,"setLogReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"function"==typeof e&&ke(this,qr,e,"f"),this}}),Object.defineProperty(e.prototype,"setLogWriter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"function"==typeof e&&ke(this,zr,e,"f"),this}}),e}();qr=new WeakMap,zr=new WeakMap;var an,sn=function(){function e(){}var t,r,n,i,o,a;return Object.defineProperty(e,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Fe(this,t,"f",r)||(ke(this,t,e,"f",r),e.info(Pe,"start"),Fe(this,t,"m",a).call(this))}}),Object.defineProperty(e,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){Fe(this,t,"f",r)&&(Fe(this,t,"f",r).info(Pe,"stop"),ke(this,t,null,"f",r),Fe(this,t,"f",n)&&(clearTimeout(Fe(this,t,"f",n)),ke(this,t,null,"f",n)))}}),t=e,a=function e(){var a=this,s=Date.now();ke(this,t,setTimeout((function(){var n=Date.now()-s;n>=Fe(a,t,"f",o)&&Fe(a,t,"f",r).warn(Pe,"delta time: ".concat(n,"ms")),Fe(a,t,"m",e).call(a)}),Fe(this,t,"f",i)),"f",n)},r={value:null},n={value:null},i={value:30},o={value:1500},e}();!function(e){e[e.init=1]="init",e[e.newWorkChange=2]="newWorkChange",e[e.other=3]="other"}(an||(an={}));var un=function(){function e(e){Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"uploadTask",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"taskLock",{enumerable:!0,configurable:!0,writable:!0,value:!0})}return Object.defineProperty(e.prototype,"uploadLogCmdTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.uploadTask.push(e),this.enqueueTask()}}),Object.defineProperty(e.prototype,"reportLogCmdTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i,o=this;this.taskLock=!1;var a=null!==(t=e.startTime)&&void 0!==t?t:0,s=null!==(r=e.endTime)&&void 0!==r?r:0,u=null!==(n=e.platform)&&void 0!==n?n:"",c=null!==(i=e.uri)&&void 0!==i?i:"";e.logId!==this.logId&&""!==c&&(this.logId=e.logId,this.reporter.report(a,s,u,c,e.logId,"",!0).finally((function(){o.taskLock=!0,o.uploadTask.length>0&&o.enqueueTask()})))}}),Object.defineProperty(e.prototype,"enqueueTask",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.taskLock){var e=this.uploadTask.shift();e&&this.reportLogCmdTask(e)}}}),e}();var cn,ln,_n,dn,fn=function(){function e(e,t,r){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"isEable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"expire",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"interval",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"lastRequestTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"uploadTaskManage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"changeAreaCode",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_cache",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.uploadTaskManage=new un(r)}return Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value: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)))}}),Object.defineProperty(e.prototype,"isExire",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(new Date).getTime()-this.timestamp<this.expire}}),Object.defineProperty(e.prototype,"isOverclock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(new Date).getTime()-this.lastRequestTime<this.interval}}),Object.defineProperty(e.prototype,"logCmdMsgTasks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.uploadLog&&e.uploadLog.tasks.forEach((function(e){e.objectName===Ot&&t.uploadTaskManage.uploadLogCmdTask(e)}))}}),Object.defineProperty(e.prototype,"dataHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._cache;t.lastRequestTime=this.lastRequestTime,or(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)}}),Object.defineProperty(e.prototype,"request",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return!this.isEable&&t===an.init&&this.isExire()?(this.logger.info(he,JSON.stringify({msg:"cloud controller is disabled"})),[2,this.timestamp]):!this.isEable&&t===an.newWorkChange&&this.isOverclock()?(this.logger.info(ge,JSON.stringify({msg:"cloud controller is overclock"})),[2,this.timestamp]):(n=pr(e),this.lastRequestTime=(new Date).getTime(),i="".concat(n,"/v1/config"),o={"Content-Type":"application/json","RC-App-Key":this.appkey},r&&(o["RC-Token"]=r),a={platform:"web",version:"5.28.0-c-tmp.1",timestamp:this.timestamp},this.logger.record(Et.L_CLOUD_INFO_FETCH_T,JSON.stringify({appKey:this.appkey,timestamp:this.timestamp,token:!!r,uri:i})),[4,this.httpRequest(i,Yt.POST,o,a)]);case 1:return s=f.sent(),u=s.code,c=s.data,this.logger.record(Et.L_CLOUD_INFO_FETCH_R,JSON.stringify({appkey:this.appkey,info:c})),u===J.CLOUD_DATA_CENTER_INVALID&&c&&c.targetRegion?(l=c.targetRegion,this.changeAreaCode===l?[2,this.timestamp]:(_=Qr.setAreaCode(l),this.logger.info(Se,JSON.stringify({isChangeSuccess:_,originAreaCode:Qr.getAreaCode(),newAreaCode:l})),this.changeAreaCode=l,(d=Qr.getCloudControllerUrl(l))[0]?[2,this.request(d[0],an.other)]:(this.logger.info(ve,JSON.stringify({appkey:this.appkey,uri:i,msg:"appkey region error"})),[2,this.timestamp]))):(c&&this.dataHandle(c),[2,this.timestamp||this.lastRequestTime])}}))}))}}),Object.defineProperty(e.prototype,"_handleMrtrData",{enumerable:!1,configurable:!0,writable:!0,value: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}(),pn=function(e){return e===J.RC_CONN_REDIRECTED},En=function(e){function t(t,r,n){var i=e.call(this)||this;return cn.add(i),Object.defineProperty(i,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"navi",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_fromSuspend",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(i,"token",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"curCmpUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"retryCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:""}),dn.set(i,0),Object.defineProperty(i,"_doConnectReason",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"_network",{enumerable:!0,configurable:!0,writable:!0,value:{status:!0,type:Wt.UNKONWN}}),Object.defineProperty(i,"_checkAliveTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_crtConnectionStatus",{enumerable:!0,configurable:!0,writable:!0,value:lt.DISCONNECTED}),Object.defineProperty(i,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(i,"_openCallPlus",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(i,"cmpWeightCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_crtConnectionTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"reconnectTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"_failedCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(i,"ALLOW_FAILED_TIMES",{enumerable:!0,configurable:!0,writable:!0,value:2}),i}return Le(t,e),Object.defineProperty(t.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.token}}),Object.defineProperty(t.prototype,"cid",{get:function(){return"".concat(this.uuid,"_").concat(this.retryCount)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtUserId}}),Object.defineProperty(t.prototype,"setConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this._crtConnectionStatus!==e){if(this._crtConnectionStatus===lt.DISCONNECTED&&e===lt.CONNECTING&&(this._doConnectReason=xt.CONNECT,Fe(this,cn,"m",_n).call(this)),this._crtConnectionStatus===lt.CONNECTED&&e===lt.SUSPENDED&&(t===J.RC_PING_EXCEED_LIMIT?this._doConnectReason=xt.TIMEOUT:t===J.RC_CONN_REDIRECTED?this._doConnectReason=xt.REDIRECTED:this._doConnectReason=xt.RECONNECT),this._crtConnectionStatus===lt.CONNECTED){var r={bid:fr(),cod:t,net:this.getNetwork().type,dur:Date.now()-Fe(this,dn,"f"),cid:this.cid};this.logger.record(Et.IM_CONNECTION_DURATION,JSON.stringify(r)),e===lt.SUSPENDED&&Fe(this,cn,"m",_n).call(this)}switch(this._crtConnectionStatus=e,e){case lt.CONNECTED:this.logger.info(K,"status: ".concat(e)),this.checkAlive(),Fe(this,cn,"m",ln).call(this).emit("onConnected",this._fromSuspend);break;case lt.CONNECTING:this.logger.warn(K,"status: ".concat(e)),Fe(this,cn,"m",ln).call(this).emit("onConnecting");break;case lt.SUSPENDED:this._fromSuspend=!0,this.logger.warn(K,"status: ".concat(e,", code: ").concat(t)),pn(t)&&this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),Fe(this,cn,"m",ln).call(this).emit("onSuspend",t);break;default:this._fromSuspend=!1,this._crtUserId="",this.logger.warn(K,"status: ".concat(e,", code: ").concat(t)),this.clearCmpWeightCache(),this._checkAliveTimer&&clearTimeout(this._checkAliveTimer),Fe(this,cn,"m",ln).call(this).emit("onDisconnected",t)}}}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtConnectionStatus}}),Object.defineProperty(t.prototype,"isConnected",{get:function(){return this._crtConnectionStatus===lt.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(!t){var r={cid:this.cid,cn:e.type,on:this._network.type};this.logger.record(Et.IM_NETWORK_CHANGE,JSON.stringify(r))}this._network=e}}),Object.defineProperty(t.prototype,"getNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._network}}),Object.defineProperty(t.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){switch(s.label){case 0:return this._crtConnectionStatus===lt.CONNECTED?[2,Or(this._crtUserId)]:this._crtConnectionTask?[2,this._crtConnectionTask]:(this._openCallPlus=r,this.token=e,this.setConnectionStatus(lt.CONNECTING),[4,this.try2Connect(e,t,!1,n,!0)]);case 1:return i=s.sent(),o=i.code,a=i.data,o!==J.SUCCESS?(this.setConnectionStatus(lt.DISCONNECTED,o),[2,Ir(o)]):(this.setConnectionStatus(lt.CONNECTED),[2,Or(a)])}}))}))}}),Object.defineProperty(t.prototype,"try2Connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o;return we(this,(function(a){switch(a.label){case 0:return this._crtConnectionTask?[2,this._crtConnectionTask]:(this._crtConnectionTask=this.createConnectionTask(e,t,r,n,i),[4,this._crtConnectionTask]);case 1:return o=a.sent(),this._crtConnectionTask=null,[2,o]}}))}))}}),Object.defineProperty(t.prototype,"createConnectionTask",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o,a,s,u,c,l,_,d,f,p;return we(this,(function(E){switch(E.label){case 0:return o={cid:this.cid,reason:this._doConnectReason,net:this.getNetwork().type,spr:0,sts:Date.now(),timelimit:0},this.logger.record(Et.IM_STATS_CS,JSON.stringify(o)),a={retryCount:this.retryCount,uuid:this.uuid,type:this.getNetwork().type,reason:this._doConnectReason},[4,this.navi.request(e,r,!1,n,a)];case 1:return s=E.sent(),u=s.code,c=s.data,u!==J.SUCCESS?[2,Ir(u)]:1===(l=c).type?[2,Ir(J.PACKAGE_ENVIRONMENT_ERROR)]:(this.logger.info(W,JSON.stringify({token:e,reconnectKickEnable:t}),n),[4,this._connectWithToken(e.replace(/@.+$/,"@"),l,t,n)]);case 2:return _=E.sent(),d=_.code,f=_.data,i||d===J.SUCCESS||(this.retryCount+=1),pn(d)?(this.logger.warn(Y,"redirect code: ".concat(d),n),this.clearCmpWeightCache(),[2,this.createConnectionTask(e,t,!0,n,i)]):[J.RC_TCP_RESET,J.RC_CONN_ACK_TIMEOUT,J.RC_TCP_DISCONNECTED_NO_RMTP,J.CONNECTION_REFUSED].includes(d)&&this.cmpWeightCache&&this.cmpWeightCache.length>1?(this.updateCmpWeight(this.curCmpUrl,!1),p=this.cmpWeightCache.every((function(e){return e.failed})),i&&p?(this.logger.warn(Y,"cpp code:".concat(d,",reture code:").concat(J.SERVER_UNAVAILABLE),n),[2,Ir(J.SERVER_UNAVAILABLE)]):(this.logger.warn(Y,"cmp ack timeout, code: ".concat(d),n),this.setConnectionStatus(lt.SUSPENDED,d),this.setConnectionStatus(lt.CONNECTING),[2,this.createConnectionTask(e,t,!1,n,i)])):d!==J.SUCCESS?(this.logger.warn(Y,"code: ".concat(d),n),[2,Ir(d)]):(this.logger.info(Y,"userId: ".concat(f),n),ke(this,dn,Date.now(),"f"),this._crtUserId=f,[2,Or(f)])}}))}))}}),Object.defineProperty(t.prototype,"try2Reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i=this;return we(this,(function(o){return r=this.logger.createTraceId(),this.logger.debug(X,"try2Reconnect -> ignoreNaviCache: ".concat(e,", reason: ").concat(t),r),this.stopReconnectTimer(),n=function(){return De(i,void 0,void 0,(function(){var i;return we(this,(function(o){switch(o.label){case 0:return this._crtConnectionStatus!==lt.SUSPENDED?[2]:(this.setConnectionStatus(lt.CONNECTING,t),[4,this.try2Connect(this.token,!0,e,r,!1)]);case 1:return i=o.sent().code,this.reconnectTimer=null,i===J.SUCCESS?(this.setConnectionStatus(lt.CONNECTED),[2]):[J.SERVER_UNAVAILABLE,J.TIMEOUT,J.RC_SOCKET_DISCONNECTED,J.RC_SOCKET_NOT_CREATED,J.RC_CONN_ACK_TIMEOUT,J.RC_TCP_RESET,J.RC_NAVI_REQ_FAILED,J.RC_NETWORK_DOWN,J.RC_TCP_DISCONNECTED_NO_RMTP].includes(i)?(this._crtConnectionStatus!==lt.CONNECTING||(this.setConnectionStatus(lt.SUSPENDED,i),this.reconnectTimer=setTimeout(n,5e3)),[2]):(this.setConnectionStatus(lt.DISCONNECTED,i),[2])}}))}))},n(),[2]}))}))}}),Object.defineProperty(t.prototype,"onDisconnectByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return pn(e)?(this.setConnectionStatus(lt.SUSPENDED,e),void this.try2Reconnect(!0,e)):e===J.RC_UDP_DISCONNECTED?(this.setConnectionStatus(lt.SUSPENDED,e),void setTimeout((function(){r.try2Reconnect(!0,e)}),1e3*(t||0))):void this.setConnectionStatus(lt.DISCONNECTED,e)}}),Object.defineProperty(t.prototype,"onDisconenctUnusual",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.setConnectionStatus(lt.SUSPENDED,e),this.try2Reconnect(!1,e)}}),Object.defineProperty(t.prototype,"checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t,r=this;return we(this,(function(n){switch(n.label){case 0:return this._crtConnectionStatus!==lt.CONNECTED?(this._failedCount=0,this.logger.debug(ie,"stop ping because of no connection"),[2]):(e=this.logger.createTraceId(),this.logger.debug(re,null,e),[4,this.sendPing(15e3)]);case 1:return(t=n.sent())===J.SUCCESS?(this.logger.debug(ne,t,e),this._failedCount=0,this._checkAliveTimer=setTimeout((function(){return r.checkAlive()}),15e3),[2]):this._crtConnectionStatus!==lt.CONNECTED?[2]:(this._failedCount+=1,this.logger.debug(ne,"code: ".concat(t,", count: ").concat(this._failedCount),e),this._failedCount<this.ALLOW_FAILED_TIMES?[2,this.checkAlive()]:(this._failedCount=0,this.logger.warn(ie,"ping timeout, close connection to reconnect!"),[4,this.close(!0)]));case 2:return n.sent(),this.setConnectionStatus(lt.SUSPENDED,J.RC_PING_EXCEED_LIMIT),this.try2Reconnect(!1,J.RC_PING_EXCEED_LIMIT),[2]}}))}))}}),Object.defineProperty(t.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){return we(this,(function(r){switch(r.label){case 0:return this.stopReconnectTimer(),this._crtConnectionTask?[4,this._crtConnectionTask]:[3,2];case 1:r.sent(),r.label=2;case 2:return this.setConnectionStatus(lt.DISCONNECTED,J.ACTIVE_DISCONNECT),[2,this.close(!1,e,t)]}}))}))}}),Object.defineProperty(t.prototype,"stopReconnectTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}),Object.defineProperty(t.prototype,"getCmpList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.cmpWeightCache&&this.cmpWeightCache.length>0)return Ge([],Ve(this.cmpWeightCache),!1);var r=ur(e,t);return this.cmpWeightCache=Ge([],Ve(r),!1),Ge([],Ve(r),!1)}}),Object.defineProperty(t.prototype,"updateCmpWeight",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(this.cmpWeightCache){var n=this.cmpWeightCache.find((function(t){return r?t.addr===e&&t.protocol===xe.QUIC:t.addr===e}));if(n)if(t){var i=Math.max.apply(Math,Ge([],Ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));n.weight!==i&&(n.weight=i+1)}else{var o=Math.min.apply(Math,Ge([],Ve(this.cmpWeightCache.map((function(e){return e.weight}))),!1));n.weight!==o&&(n.weight=o-1),n.failed=!0}}}}),Object.defineProperty(t.prototype,"clearCmpWeightCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.cmpWeightCache=void 0}}),Object.defineProperty(t.prototype,"reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){this.token=e,this._openCallPlus=r,this.onDisconenctUnusual(n)}}),t}(gr);dn=new WeakMap,cn=new WeakSet,ln=function(){return this},_n=function(){this.uuid=$t(),this.retryCount=0};var bn=function(e){return e.replace(/@.+$/,"@")},Rn=function(){function e(e,t,r,n,i,o){void 0===n&&(n=!0),void 0===i&&(i=!0),void 0===o&&(o=!1),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"isRequestProfile",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"isUseDynamicNaviUrl",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"useNaviV2",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"crtRequest",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:"default"})}return Object.defineProperty(e.prototype,"getCatchKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e+(this._environment?"-".concat(this._environment):"")}}),Object.defineProperty(e.prototype,"request",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return De(this,void 0,void 0,(function(){var o;return we(this,(function(a){switch(a.label){case 0:return this.crtRequest?[2,this.crtRequest]:(this.crtRequest=this.sendRequest(e,t,r,n,i),[4,this.crtRequest]);case 1:return o=a.sent(),this.crtRequest=null,[2,o]}}))}))}}),Object.defineProperty(e.prototype,"sendRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o;return De(this,void 0,void 0,(function(){var a,s,u,c,l,_,d,f,p,E,b,R,h,g,v,O,I;return we(this,(function(C){switch(C.label){case 0:return a=bn(e),s=this.getNaviCache(a),!t&&s&&(u=s.timestamp,c=s.naviInfo,r||Date.now()-u<Xt)?(this.logger.info(q,JSON.stringify({fromCache:!0,naviInfo:c}),n),i&&(l=i.uuid,_=i.retryCount,d=i.reason,f={bid:fr(),ptc:Vt.NAVI,cod:J.SUCCESS,net:i.type,dur:0,spr:0,pr:null!==(o=c.type)&&void 0!==o?o:0,hos:"",cache:Gt.LOCAL,v:Ft.CURRENT,rsn:d,cid:"".concat(l,"_").concat(_),count:_},this.logger.record(Et.IM_NAVI,JSON.stringify(f),n)),[2,Or(c)]):(p=Qr.getNaviUrlList(e,this.isUseDynamicNaviUrl),this.logger.info(Q,JSON.stringify({token:e,uris:p}),n),[4,this.requestHandler(p,e,n,i)]);case 1:return E=C.sent(),b=E.code,R=E.data,b===J.RC_NAVI_REQ_FAILED&&this.isRequestProfile?[4,this.staticConfigManager.getStaticConfig()]:[3,4];case 2:return(null==(h=C.sent())?void 0:h.navi)&&(null==h?void 0:h.navi.length)>0?(g=h.navi,[4,this.requestHandler(g,e,n,i)]):[3,4];case 3:v=C.sent(),b=v.code,R=v.data,C.label=4;case 4:return b!==J.SUCCESS?(this.logger.warn(Z,b,n),[2,Ir(b)]):(O=R).code&&200!==O.code?(this.logger.warn(Z,O.code,n),[2,Ir(this.transHttpCode(O.code))]):ur(O).length>0?(this.logger.info(Z,JSON.stringify({naviInfo:O}),n),this.setNaviCache(a,O),[2,Or(O)]):(I={server:O.server,backupServer:O.backupServer,serverAddr:O.serverAddr,bs:O.bs},this.logger.warn(Z,"navi server address invalid: ".concat(JSON.stringify(I)),n),[2,Ir(J.SERVER_UNAVAILABLE)])}}))}))}}),Object.defineProperty(e.prototype,"requestHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:i=0,o=e.length,f.label=1;case 1:return i<o?(a=i===e.length-1,s=this.useV2Navi()?this.httpRequestV2:this.httpRequest,u=Date.now(),[4,s.call(this,e[i],this.appkey,t,r,a)]):[3,4];case 2:if(c=f.sent(),l=c.code,_=c.data,d={bid:fr(),ptc:Vt.NAVI,cod:l,net:null==n?void 0:n.type,dur:Date.now()-u,spr:0,pr:(null==_?void 0:_.type)||0,hos:e[i],cache:Gt.REQUEST,v:Ft.CURRENT,rsn:null==n?void 0:n.reason,cid:"".concat(null==n?void 0:n.uuid,"_").concat(null==n?void 0:n.retryCount),count:null==n?void 0:n.retryCount},this.logger.record(Et.IM_NAVI,JSON.stringify(d),r),[J.SUCCESS,J.RC_CONN_TOKEN_INCORRECT,J.RC_LICENSE_EXPIRED].includes(l))return[2,l===J.SUCCESS?Or(_):Ir(l)];f.label=3;case 3:return i+=1,[3,1];case 4:return[2,Ir(J.RC_NAVI_REQ_FAILED)]}}))}))}}),Object.defineProperty(e.prototype,"transHttpCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){switch(e){case 401:case 403:return J.RC_CONN_TOKEN_INCORRECT;case 416:return J.RC_LICENSE_EXPIRED;default:return J.RC_NAVI_REQ_FAILED}}}),Object.defineProperty(e.prototype,"getNaviInfoFromCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getNaviCache(bn(e));return t?t.naviInfo:null}}),Object.defineProperty(e.prototype,"updateVoipCallInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getNaviInfoFromCache(e);r&&this.setNaviCache(bn(e),Ue(Ue({},r),{voipCallInfo:t}))}}),Object.defineProperty(e.prototype,"getNaviV2RequestOption",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.uri,n=e.token,i=e.platform,o=e.protocol,a=e.mac;t="".concat(r,"/v2/navi.json?cloud=").concat(0);var s="token=".concat(encodeURIComponent(n),"&v=").concat(Qt,"&platfrom=").concat(i);return a&&(s+="&m=".concat(a)),{method:"POST",headers:{"RC-Appkey":this.appkey,"Content-Type":"Application/x-www-form-urlencoded","RC-Negotiate":"conn=".concat(o,";rtc=4;log=2;iptype=v4,v6")},body:s,url:t,timeout:1e4}}}),Object.defineProperty(e.prototype,"useV2Navi",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!0}}),e}(),hn=new Map([["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:StreamMsg",{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:RcNtf",{isCounted:!1,isPersited:!0}],["RC:CmdMsg",{isCounted:!1,isPersited:!1}],["RC:TypSts",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:PSCmd",{isCounted:!1,isPersited:!1}],["RC:SRSMsg",{isCounted:!1,isPersited:!1}],["RC:RcCmd",{isCounted:!1,isPersited:!0}],["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,isStatusMessage:!0}],["RC:RLJoin",{isCounted:!1,isPersited:!1}],["RC:RLQuit",{isCounted:!1,isPersited:!1}],["RC:RL",{isCounted:!1,isPersited:!1,isStatusMessage:!0}],["RC:CCConfigChangeRequestMsg",{isCounted:!1,isPersited:!1}]]);function gn(e,t){var r=hn.get(e);r&&!r.isCustom&&console.warn("Builtin message type '".concat(e,"' cannot be registered")),t.isStatusMessage&&(t.isCounted=t.isPersited=!1),hn.set(e,Ue(Ue({},t),{isCustom:!0}))}function vn(e){return hn.get(e)||{isCustom:!0,isPersited:!1,isCounted:!1,isStatusMessage:!1}}function On(){return Array.from(hn.keys()).map((function(e){return Ue({objectName:e},hn.get(e))})).filter((function(e){return!e.isCustom}))}var In=0,Cn=1,Sn=2,Tn=3,Nn=4,Pn=5,mn=function(){function e(e,t,r,n){Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sourceLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"targetLanguage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.identifier=e,this.sourceLanguage=t||"auto",this.targetLanguage=r,this.text=n}return Object.defineProperty(e.prototype,"isValid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"string"==typeof this.identifier&&this.identifier.length>0&&"string"==typeof this.sourceLanguage&&(void 0===this.targetLanguage||"string"==typeof this.targetLanguage)&&(e?"string"==typeof this.text:void 0===this.text||"string"==typeof this.text)}}),Object.defineProperty(e.prototype,"toInnerParam",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{identifier:this.identifier,sourceLanguage:this.sourceLanguage,targetLanguage:this.targetLanguage,content:this.text}}}),e}();!function(e){function t(t,r,n,i){return e.call(this,t,r,n,i)||this}Le(t,e)}(mn),function(e){function t(t,r,n){return e.call(this,Fr(t),r,n,t)||this}Le(t,e)}(mn);var yn,An,Ln=0,Mn=0,Un=4,Dn=5;!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_R="P-connect-R",e.P_CONNECT_E="P-connect-E",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_O="P_WRITE_LOG_O",e.P_PARSE_JSON_E="P-parse_json-E",e.L_HANDLE_LOW_PRIORITY_MESSAGES_T="L-handle_low_priority_messages-T",e.L_HANDLE_LOW_PRIORITY_MESSAGES_R="L-handle_low_priority_messages-R",e.L_JS_CALLBACK_EXCEPTION_E="L-js_callback_exception-E",e.L_RECV_S_MSG_S="L-recv_s_msg-S",e.L_DISCARD_MSG_O="L-discard_msg-O"}(yn||(yn={})),function(e){e[e.ERROR=-1]="ERROR",e[e.RESPONSE=0]="RESPONSE",e[e.EVENT=1]="EVENT",e[e.CALLBACK=2]="CALLBACK"}(An||(An={}));var wn=function(e,t,r){return De(void 0,void 0,void 0,(function(){var n,o;return we(this,(function(a){return n=i.createDecipheriv("aes-256-cbc",t,r),o=n.update(e,"base64","utf-8"),[2,o+=n.final("utf8")]}))}))},jn=function(e){if(!o.existsSync(e)){var r=t.resolve(e,"..");o.existsSync(r)||jn(r),o.mkdirSync(e)}},Vn=function(e){return Object.entries(e).map((function(e){var t=Ve(e,2),r=t[0],n=t[1];return{key:r,value:String(n)}}))},Gn=function(e){return{removeMute:!!(null==e?void 0:e.removeMuteStatus),removeWhiteList:!!(null==e?void 0:e.removeWhiteList),removeFavoriteMembers:!!(null==e?void 0:e.removeFollow)}},Fn=function(){return"undefined"==typeof __dirname?t.dirname(a.fileURLToPath("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("index.cjs",document.baseURI).href)):__dirname};function kn(e){return JSON.parse(e).list.map((function(e){return e.value}))}var xn,Hn=t.resolve(Fn(),"binding","electron-".concat(r.platform(),"-").concat(r.arch(),".node")),Bn={addon:null},Jn=(xn=process,{sendError:function(e){xn.send({type:An.ERROR,data:{msg:e}})},sendEvent:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];xn.send({type:An.EVENT,data:{eventName:e,data:t}})},sendResponse:function(e){xn.send({type:An.RESPONSE,data:e})},sendCallback:function(e){xn.send({type:An.CALLBACK,data:e})}}).sendError;try{var Wn=require;Bn.addon=Wn(Hn)}catch(e){console.error("error ->",Hn,"\n",e),Jn(e.toString())}Bn.addon||console.error("error -> cannot find module: ",Hn);var Yn=Bn.addon,Kn=function(e,t){var r,n=Buffer.from(e),i=n.length;for(t.push(i),r=0;r<i;r++)t.push(n[r])},Xn=function(e){return"string"==typeof e},Qn=function(e){return Xn(e)?e.toUpperCase():""},Zn=function(e,t){var r="";return 2!==e.length?r="Unexpected number of bytes received.":5!==e[0]?r="Unexpected SOCKS version number: ".concat(e[0],"."):255===e[1]?r="No acceptable authentication methods were offered.":-1===t.indexOf(e[1])&&(r="Unexpected SOCKS authentication method: ".concat(e[1],".")),r},qn=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},zn=function(e){var t=Qn(e.method)||"GET",r=e.pathname||"/",n=e.headers||{},i=e.search||"";n.Host=e.host||"loclahost";var o="";for(var a in o="".concat(t," ").concat(r+i," HTTP/1.1\n"),n)if(Object.hasOwnProperty.call(n,a)){var s=n[a];o+="".concat(a,": ").concat(s,"\n")}return e.body&&(o+="Content-Length: ".concat(e.body.length,"\n")),o+="\n","POST"===t&&e.body&&(o+="".concat(e.body)),o},$n=function(e){return new Promise((function(t){var r,n;e.socket.once("data",(function(n){var i,o=Zn(n,r);if(!o)return 2===n[1]?(e.socket.once("data",(function(r){var n=qn(r);n?e.emit("error",new Error("SOCKS authentication failed. ".concat(n))):t()})),i=[1],Kn(e.socksUsername,i),Kn(e.socksPassword,i),void e.write(Buffer.from(i))):void t();e.emit("error",new Error("SOCKS authentication failed. ".concat(o)))})),r=[0],e.socksUsername&&r.push(2),(n=Buffer.alloc(2+r.length))[0]=5,n[1]=r.length,r.forEach((function(e,t){n[2+t]=e})),e.write(n)}))},ei=function(e,t,r){return new Promise((function(n){var i,o;switch(e.socket.once("data",(function(t){var r;5!==t[0]?r="Unexpected SOCKS version number: ".concat(t[0],"."):0!==t[1]?r="".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]&&(r="The reserved byte must be 0x00."),r?e.emit("error",new Error("SOCKS connection failed. ".concat(r))):n()})),(i=[]).push(5),i.push(1),i.push(0),l.isIP(t)){case 0:i.push(3),Kn(t,i);break;case 4:i.push(1),function(e,t){var r,n,i=e.split(".");for(r=0;r<4;r++)n=parseInt(i[r],10),t.push(n)}(t,i);break;case 6:e.emit("error",new Error("Does not support IPV6"))}i.length+=2,(o=Buffer.from(i)).writeUInt16BE(r,o.length-2),e.write(o)}))},ti=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"socket",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksUsername",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"socksPassword",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"writable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"readable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),r.socket=new l.Socket,r.options=t,r.socksHost=t.socksHost||"localhost",r.socksPort=t.socksPort||1080,r.socksUsername=t.socksUsername||"",r.socksPassword=t.socksPassword||"",r.socket.on("error",(function(e){r.emit("error",e)})),r.on("error",(function(){r.socket.destroyed||r.socket.destroy()})),r.on("end",r.end),r}return Le(t,e),Object.defineProperty(t.prototype,"ref",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.ref()}}),Object.defineProperty(t.prototype,"unref",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.unref()}}),Object.defineProperty(t.prototype,"setTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.socket.setTimeout(e,t)}}),Object.defineProperty(t.prototype,"setNoDelay",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.setNoDelay(e)}}),Object.defineProperty(t.prototype,"setKeepAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.socket.setKeepAlive(e,t)}}),Object.defineProperty(t.prototype,"address",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.address()}}),Object.defineProperty(t.prototype,"cork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.cork()}}),Object.defineProperty(t.prototype,"uncork",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.uncork()}}),Object.defineProperty(t.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.pause()}}),Object.defineProperty(t.prototype,"resume",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.socket.resume()}}),Object.defineProperty(t.prototype,"pipe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.pipe(e)}}),Object.defineProperty(t.prototype,"end",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.socket.end(e,t);return this.writable=this.socket.writable,r}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.destroy(e)}}),Object.defineProperty(t.prototype,"setEncoding",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.setEncoding(e)}}),Object.defineProperty(t.prototype,"write",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.socket.write(e,t,r)}}),Object.defineProperty(t.prototype,"read",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.socket.read(e)}}),Object.defineProperty(t.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=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 De(r,void 0,void 0,(function(){var r;return we(this,(function(n){switch(n.label){case 0:return[4,$n(this)];case 1:return n.sent(),[4,ei(this,t,e)];case 2:return n.sent(),this.onProxied(),r=zn(this.options),this.socket.write(Buffer.from(r)),[2]}}))}))})),this}}),Object.defineProperty(t.prototype,"onProxied",{enumerable:!1,configurable:!0,writable:!0,value: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}(_.EventEmitter),ri=function(e){var t,r=e.hostname,n=e.port;return!e.host||r&&n||(t=e.host.split(":")),!n&&t&&(n=parseInt(t[1],10)||0),!r&&t&&(r=Ve(t,1)[0]),new ti(e).connect(n,r)},ni=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r.createConnection=ri,r}return Le(t,e),t}(s.Agent),ii=function(e,t,r){return(t=Ue(Ue({},t),a.parse(e))).port||(t.port=80),t.agent=new ni(t),s.request(t,r)},oi=function(e){var t,r;return t=ri(e),r=t.onProxied,t.onProxied=function(){var n;e.socket=t.socket,e.hostname?e.servername=e.hostname:e.host&&(n=Ve(e.host.split(":"),1),e.servername=n[0]),t.socket=d.connect(e,(function(){t.authorized=t.socket.authorized,r.call(t)})),t.socket.on("error",(function(e){t.emit("error",e)}))},t},ai=function(e){function t(t,r){var n=e.call(this,r)||this;return Object.defineProperty(n,"socksHost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"socksPort",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"createConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),n.url=t,n.socksHost=r.socksHost||"localhost",n.socksPort=r.socksPort||1080,n.createConnection=oi,n}return Le(t,e),t}(u.Agent),si=function(e,t,r,n){var i,o;return t.protocol="https:",!t.port&&t.host&&(i=Ve(t.host.split(":"),2),t.port=i[0],t.port=i[1]),t.port||(t.port=443),o=new ai(e,t),t.agent=o,u.request(e,t,r)},ui=null;function ci(e,t,r){void 0===r&&(r=!1);var n=t.url,i=t.headers,o=t.body,a=t.method,c=t.query,l=t.timeout,_=void 0===l?6e4:l;return new Promise((function(t){var l=/^https/.test(n),d={headers:Ue(Ue({},i),{"Accept-Encoding":"gzip, br"}),method:a};l&&(d.rejectUnauthorized=r);var f=null;ui?((d=Ue(Ue({},d),ui)).body=o,f=l?si:ii):(f=s.request,l&&(d.agent=new u.Agent(d),f=u.request));var p=f(function(e,t){if(e=e.replace(/\?$/,""),!t)return e;var r=Object.keys(t).map((function(e){return"".concat(e,"=").concat(t[e])})).filter((function(e){return!!e}));return r.length?[e,r.join("&")].join("?"):e}(n,c),d,(function(e){var r,n,i=e.statusCode,o="";if("gzip"===(null===(r=e.headers)||void 0===r?void 0:r["content-encoding"])){var a=E.default.createGunzip();e.pipe(a),a.on("data",(function(e){o+=e})),a.on("end",(function(){t({status:i,data:o})}))}else if("br"===(null===(n=e.headers)||void 0===n?void 0:n["content-encoding"])){var s=E.default.createBrotliDecompress();e.pipe(s),s.on("data",(function(e){o+=e})),s.on("end",(function(){t({status:i,data:o})}))}else e.setEncoding("utf8"),e.on("data",(function(e){o+=e})),e.once("end",(function(){t({status:i||0,data:o})}))}));p.once("timeout",(function(){e.warn(yn.P_HTTP_REQ_E,JSON.stringify({msg:"timeout",url:n,method:a,query:c,timeout:_})),t({status:0})})),p.setTimeout(_),p.once("error",(function(r){e.warn(yn.P_HTTP_REQ_E,JSON.stringify({msg:r.stack,url:n,method:a,query:c,timeout:_})),t({status:0})})),p.write(o),p.end()}))}function li(e,t){return e?(ui=Ue(Ue({},ui),e),t.info(fe,JSON.stringify({msg:"set proxy",data:ui})),{code:J.SUCCESS}):(ui=null,t.info(de,JSON.stringify({msg:"remove proxy"})),{code:J.SUCCESS})}function _i(){var e=ui||void 0;return{code:J.SUCCESS,data:e}}var di,fi=function(){function e(e,t,r,n){var i=this;Object.defineProperty(this,"p",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"emit",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callback",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"errorHandle",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"count",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this.p.on("message",(function(e){var o=e.type,a=e.data;switch(o){case An.EVENT:var s=a,u=s.eventName,c=s.data;null==t||t.apply(void 0,Ge([u],Ve(c),!1));break;case An.RESPONSE:var l=a,_=l.reqId,d=l.success,f=l.data,p=i.maps[_];if(!p)return;p({success:d,data:f}),delete i.maps[_];break;case An.CALLBACK:null==r||r(a);break;case An.ERROR:var E=a.msg;null==n||n(E)}})),this.p.on("error",(function(e){null==n||n("SubProcessProxy error ".concat(e))})),this.p.on("exit",(function(e,t){if(0!==e){for(var r in i.maps){if(Object.prototype.hasOwnProperty.call(i.maps,r))(0,i.maps[r])({success:!0,data:{code:J.SUB_PROCESS_EXIT,msg:"sub process exit"}})}null==n||n("SubProcessProxy exit ".concat(e," ").concat(t),!0)}})),this.p.on("close",(function(e,t){console.log("SubProcessProxy close",e,t)}))}return Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return this.p.killed||this.p.exitCode?[2,Promise.resolve({success:!1,data:{code:J.SUB_PROCESS_EXIT,msg:"sub process exit"}})]:[2,new Promise((function(n){var i=++r.count;r.maps[i]=n;var o={reqId:i,method:e,args:t,hasResponse:!0};r.p.send(o)}))]}))}))}}),Object.defineProperty(e.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return De(this,void 0,void 0,(function(){var n;return we(this,(function(i){return(this.p.killed||this.p.exitCode)&&(null===(t=this.errorHandle)||void 0===t||t.call(this,"sub process exit")),n={reqId:-1,method:e,args:r},this.p.send(n),[2]}))}))}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.send("destroy")}}),e}(),pi=function(e,t,r,n,i){return De(void 0,void 0,void 0,(function(){var o,a,s,u,c,l;return we(this,(function(_){switch(_.label){case 0:return o=function(){var e,t=new Promise((function(t){e=t}));return{resolve:e,promise:t}}(),a=o.resolve,s=o.promise,Yn.getLog(e,t,r,n,(function(e){a(Or(e))}),(function(e){a(Ir(e))})),[4,s];case 1:return(u=_.sent()).isOk?(c=0,l=JSON.parse(u.data).filter((function(e){return c+=function(e){return e.content.length+e.tag.length+e.sessionId.length+e.type.length+2+13+6}(e),!!i||e.level>0})),[2,Or({logs:l,size:c})]):[2,u.wipe()]}}))}))},Ei=function(e,t,r){return De(void 0,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return n=e.startTime,i=e.endTime,o=e.level,a=e.isRealtimeReport,[4,pi(o,n,i,s=300,a)];case 1:return(u=f.sent()).isOk?(c=u.data,l=c.logs,_=c.size,0===l.length||(t+=_)>=20971520?[2]:l.length<s?(r.push.apply(r,Ge([],Ve(l),!1)),[2]):(d=l[l.length-1].time,n===d&&(d+=1),e.startTime=d,r.push.apply(r,Ge([],Ve(l.filter((function(e){return e.time<d}))),!1)),[2,Ei(e,t,r)])):[2]}}))}))},bi=[],Ri=!1,hi=function(){return De(void 0,void 0,void 0,(function(){var e,t,r,n;return we(this,(function(i){switch(i.label){case 0:return Ri||0===bi.length?[2]:(Ri=!0,e=bi.shift(),t=e.resolve,r=e.args,[4,Ei(r,0,n=[])]);case 1:return i.sent(),t({logs:n,dbReady:!0}),Ri=!1,hi(),[2]}}))}))},gi=function(e){function r(t,r,n,i,o){void 0===i&&(i=!1);var a,s=process.versions.electron,u="Electron|".concat(s,"|").concat(process.arch,"|").concat(process.platform);return a=e.call(this,t,r,u,o,n,i)||this,Object.defineProperty(a,"_subProcess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a}return Le(r,e),Object.defineProperty(r.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return ci(this.logger,e)}}),Object.defineProperty(r.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._subProcess&&this._subProcess.destroy(),e.prototype.stop.call(this)}}),Object.defineProperty(r.prototype,"compressLogs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var r,i,o,a;return we(this,(function(s){switch(s.label){case 0:return this._subProcess||(r=n.fork(t.resolve(Fn(),"sub-process.cjs.js"),{stdio:["inherit","inherit","inherit","ipc"]}),this._subProcess=new fi(r)),[4,this._subProcess.call("compressLogs",e)];case 1:return i=s.sent(),o=i.success,a=i.data,o?[2,{success:o,data:a.data}]:[2,{success:o,data:""}]}}))}))}}),r}(en),vi="rc-realtime-log-timestamp",Oi=!1,Ii=function(){var e=new on(rn,nn);return e.setLogReader((function(e,t,r,n){return De(void 0,void 0,void 0,(function(){return we(this,(function(i){switch(i.label){case 0:return[4,(o={startTime:e,endTime:t,level:r,isRealtimeReport:n},De(void 0,void 0,void 0,(function(){return we(this,(function(e){return[2,new Promise((function(e){bi.push({resolve:e,args:o}),hi()}))]}))})))];case 1:return[2,{logs:i.sent().logs}]}var o}))}))})),e.setLogWriter((function(e){Si(e)})),e},Ci=[],Si=function(e){Oi&&(Ci.push(e),di||(di=setImmediate((function(){return function(){if(di&&(clearImmediate(di),di=null),Ci.length){var e=Ci.splice(0).map((function(e){var t=e.sessionId,r=e.level,n=e.time,i=e.type,o=e.tag,a=e.loggerId,s=e.content,u=e.traceId;return{level:r,time:n,type:i,tag:o,sessionId:"".concat(er,":").concat(er===t?"main":t),content:JSON.stringify({loggerId:a,content:s,traceId:u})}})),t=JSON.stringify(e);Yn.writeLog(t)}}()}))))},Ti=function(e){function t(t,r,n,i){var o=e.call(this,t,r,n,i)||this;return Oi||(Oi=!0),o}return Le(t,e),Object.defineProperty(t.prototype,"getTimestamp4RealtimeLog",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Yn.getStoreValue(vi);return parseInt(e,10)||0}}),Object.defineProperty(t.prototype,"setTimestamp4RealtimeLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Yn.setStoreValue(vi,e.toString())}}),Object.defineProperty(t.prototype,"recvRendererLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._stdout(e),this._write(e)}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){Oi=!1}}),t}($r),Ni=function(){var e,t=Date.now(),n=[r.arch(),r.platform(),process.pid,t,Math.floor(Math.random()*t)].join("__");return e=n,i.createHash("md5").update(e).digest("hex")},Pi=function(){function e(e){Object.defineProperty(this,"_callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_setTime",{enumerable:!0,configurable:!0,writable:!0,value:15962112e5})}return Object.defineProperty(e.prototype,"_setToProtocol",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=JSON.stringify(r);"{}"!==n&&e.info(yn.P_SET_MSG_EXTEN_O,JSON.stringify({messageUId:t,ext:r})),this._callCppProxy("setMessageExtension",1,"1",t,n,"")}}),Object.defineProperty(e.prototype,"setLocalFromExtMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){t.channelId,t.conversationType,t.targetId;var r=t.content,n=t.sentTime,i=r,o=i.put,a=this._callCppProxy("getMessage",i.mid),s=JSON.parse(a).extMsg,u=JSON.parse(s||"{}");if(o)for(var c in o){var l=u[c];l&&l.ts<n-this._setTime?(l.v=o[c],l.ts=n-this._setTime):(u[c]={v:"",ts:0},u[c].v=o[c],u[c].ts=n-this._setTime)}i.del&&i.del.forEach((function(e){delete u[e]})),this._setToProtocol(e,i.mid,u)}}),Object.defineProperty(e.prototype,"parseReceiveExpansion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e.extMsg||"{}"),r={};for(var n in t)r[n]=t[n].v;return r}}),e}(),mi=[xe.RMTP,xe.TLS];"darwin"===process.platform&&mi.push(xe.QUIC);var yi=function(e){return"RongCloud/navis/".concat(e,"/navi-cache.json")},Ai=function(e){return"RongCloud/caches/".concat(e,"/staticConfig.json")},Li=function(e){return"RongCloud/cloudControl/".concat(e,"/cloudControl.json")};function Mi(e){var t,n;void 0===e&&(e="IPv4");var i=r.networkInterfaces(),o=[];try{for(var a=je(Object.values(i)),s=a.next();!s.done;s=a.next()){var u=s.value;if(u&&-1!==Object.prototype.toString.call(u).indexOf("Array")){var c=u.filter((function(t){return!(t.internal||(r=t.mac,/^(0{1,2}[:-]){5}0{1,2}$/.test(r))||t.family&&t.family!==e);var r})).map((function(e){return e.mac}));o.push.apply(o,Ge([],Ve(c),!1))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o.length?Ge([],Ve(o),!1).sort()[0]:""}var Ui,Di,wi=function(e){function r(r,n,i,a){var s=e.call(this,r,n,a)||this;Object.defineProperty(s,"naviPath",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(s,"_caches",{enumerable:!0,configurable:!0,writable:!0,value:{}}),s.naviPath="".concat(i,"/").concat(yi(r));var u=t.dirname(s.naviPath);return o.existsSync(u)||jn(u),s}return Le(r,e),Object.defineProperty(r.prototype,"httpRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return i="token=".concat(encodeURIComponent(r),"&v=").concat(Qt,"&p=PC&ev=").concat("5.28.0-c-tmp.1","&m=").concat(Mi()),o="".concat(e,"/navi.json?r=").concat(Date.now(),"&env=").concat(this._environment),this.logger.info(q,JSON.stringify({url:o,body:i}),n),[4,ci(this.logger,{method:"POST",headers:{appId:t},body:i,url:o,timeout:1e4})];case 1:if(200!==(a=c.sent()).status)return this.logger.warn(z,JSON.stringify({url:o,code:a.status}),n),[2,Ir(this.transHttpCode(a.status))];this.logger.info(z,JSON.stringify({url:o,data:a.data}),n);try{return s=JSON.parse(a.data),u=/^https/.test(o)?"https":"http",s.protocol=u,s.code&&200!==s.code?[2,Ir(this.transHttpCode(s.code))]:[2,Or(s)]}catch(e){return this.logger.error($,a.data,n),[2,Ir(J.RC_NAVI_REQ_FAILED)]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"httpRequestV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s;return we(this,(function(u){switch(u.label){case 0:return i=this.getNaviV2RequestOption({appkey:t,token:r,uri:e,platform:"electron",protocol:mi.join(","),mac:Mi()}),this.logger.info(q,JSON.stringify({url:i.url,body:i.body,headers:i.headers}),n),[4,ci(this.logger,i)];case 1:if(200!==(o=u.sent()).status)return this.logger.warn(z,JSON.stringify({url:i.url,code:o.status}),n),[2,Ir(this.transHttpCode(o.status))];this.logger.info(z,JSON.stringify({url:i.url,data:o.data}),n);try{return a=JSON.parse(o.data),s=/^https/.test(i.url)?"https":"http",a.protocol=s,[2,Or(a)]}catch(e){return this.logger.error($,o.data,n),[2,Ir(J.RC_NAVI_REQ_FAILED)]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"getNaviCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getCatchKey(e),r=this._caches[t];if(r)return r;if(!o.existsSync(this.naviPath))return null;var n=o.readFileSync(this.naviPath,{encoding:"utf8"});try{return this._caches=JSON.parse(n),this._caches[t]}catch(e){this.logger.error($,n)}return null}}),Object.defineProperty(r.prototype,"setNaviCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Date.now(),n=this.getCatchKey(e);if(or(this._caches))for(var i in this._caches){(r-this._caches[i].timestamp>Xt||n===i)&&delete this._caches[i]}this._caches[n]={token:e,naviInfo:t,timestamp:Date.now(),environment:this._environment},o.writeFileSync(this.naviPath,JSON.stringify(this._caches))}}),Object.defineProperty(r.prototype,"setEnvironment",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._environment=e}}),Object.defineProperty(r.prototype,"setUseNaviV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.useNaviV2=e}}),r}(Rn);function ji(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];var o,a=e.createTraceId();if(e.debug(yn.P_CALL_ADDON_T,JSON.stringify({method:r,params:n}),a),!Yn[r])throw e.error(yn.P_CALL_ADDON_E,"Method ".concat(r," not found in addon"),a),new Error("Method ".concat(r," not found in addon"));try{o=Yn[r].apply(Yn,Ge([],Ve(n),!1))}catch(t){throw e.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:r}),a),t}return e.debug(yn.P_CALL_ADDON_R,JSON.stringify({method:r,params:n,result:t?o:void 0}),a),o}var Vi,Gi,Fi,ki,xi=function(){function e(e,t,r){var n=this;Ui.add(this),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_method",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_resolve",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._traceId=null!=r?r:this._logger.createTraceId(),this._promise=new Promise((function(e){n._resolve=e}))}return Object.defineProperty(e,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return new e(t,r,n)}}),Object.defineProperty(e.prototype,"invoke",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(e=Fe(this,Ui,"m",Di)).call.apply(e,Ge([this,!0],Ve(t),!1))}}),Object.defineProperty(e.prototype,"asyncInvoke",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(e=Fe(this,Ui,"m",Di)).call.apply(e,Ge([this,!1],Ve(t),!1))}}),Object.defineProperty(e.prototype,"ok",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.debug(yn.P_CALL_ADDON_R,"success",this._traceId),this._flush(Or(e))}}),Object.defineProperty(e.prototype,"fail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.warn(yn.P_CALL_ADDON_R,"faile: ".concat(e),this._traceId),this._flush(Ir(e,"",t))}}),Object.defineProperty(e.prototype,"_flush",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;setImmediate((function(){return t._resolve(e)}))}}),Object.defineProperty(e.prototype,"result",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._promise}}),e}();Ui=new WeakSet,Di=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this,o=i._method,a=i._traceId,s=i._logger;s.debug(yn.P_CALL_ADDON_T,JSON.stringify({method:o,params:r}),a);try{t=Yn[o].apply(Yn,Ge([],Ve(r),!1))}catch(e){throw s.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==e?void 0:e.stack,method:o}),a),e}return e&&t!==J.SUCCESS&&this.fail(t),this},function(e){e[e.SUCCESS=0]="SUCCESS",e[e.NOT_INIT=-1]="NOT_INIT",e[e.CANCELED=-2]="CANCELED",e[e.REPEAT=-3]="REPEAT"}(ki||(ki={}));var Hi=function(e){function t(t,r,n,i){var o=e.call(this,t,n,i)||this;return Vi.add(o),Object.defineProperty(o,"callCppProxy",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_connectedTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"_naviInfo",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(o,"_excludeLogTag",{enumerable:!0,configurable:!0,writable:!0,value:["P-API_RCGetValueForKey-T","P-API_RCGetValueForKey-E","P-API_RCGetValueForKey-R","P-API_RCSetValueForKey-T","P-API_RCSetValueForKey-E","P-API_RCSetValueForKey-R"]}),Object.defineProperty(o,"_connectingTask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(o,"_tcpDuration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(o,"pingResolve",{enumerable:!0,configurable:!0,writable:!0,value:null}),o.callCppProxy("setConnectionStatusListener",Fe(o,Vi,"m",Gi).bind(o),(function(e){return o.logger.info(yn.P_DB_OPEN_O,e)}),(function(){return o.recvPong(J.SUCCESS)}),Fe(o,Vi,"m",Fi).bind(o),o._onTcpConnectResponse.bind(o),(function(){o.logger.info(yn.P_DB_UPGRATE_START_S),o.emit("onDBUpgrateStart")}),(function(e){o.logger.info(yn.P_DB_UPGRATING_S,e),o.emit("onDBUpgrading",e)}),(function(e){o.logger.info(yn.P_DB_UPGRATE_COMPLETE_S,e),o.emit("onDBUpgradeComplete",e)})),o}return Le(t,e),Object.defineProperty(t.prototype,"getConnectedTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._connectedTime}}),Object.defineProperty(t.prototype,"_connectWithToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d,f,p,E,b,R,h=this;return we(this,(function(g){switch(g.label){case 0:return i=this._connectingTask=xi.create(this.logger,"connectWithToken",n),this._naviInfo=t,o={},(a=_i().data)&&(o={proxy_passwd:a.socksPassword||"",proxy_name:a.socksUsername||"",proxy_port:a.socksPort||1082,proxy_host:a.socksHost||"localhost",proxy_type:0}),s=JSON.stringify(Ue(Ue({},o),{call_plus:this._openCallPlus,cid:this.cid})),u=this.getCmpList(t,!0).filter((function(e){return mi.includes(e.protocol)})).sort((function(e,t){return t.weight-e.weight})),c=[],u.forEach((function(e){var t=c.find((function(t){return t.addr===e.addr}));t?t.protocol!==xe.QUIC&&e.protocol!==xe.QUIC||(t.race=!0,t.protocol=xe.QUIC):(e.race=!1,c.push(e))})),this.logger.info(yn.P_CONNECT_T,JSON.stringify({}),n),l=Date.now(),[4,i.asyncInvoke(e,Qt,JSON.stringify(Ue(Ue({},t),{serverAddr:c,tagBlacklist:this._excludeLogTag.join(",")})),r,s).result()];case 1:return _=g.sent(),this.logger.summary(yn.P_CONNECT_R,_,n,{data:_.data}),d=JSON.parse(_.data),f=d.cid,p=d.userId,E=d.sessionId,b=Date.now()-(l+this._tcpDuration),R={bid:fr(),cod:_.code,net:this.getNetwork().type,dur:b,spr:0,cid:f,v:Ft.CURRENT,count:this.retryCount,sts:Date.now(),ssid:E},this.logger.record(Et.IM_CMP_RMTP,JSON.stringify(R)),this._connectingTask=null,[2,_.trans((function(e){return h._connectedTime=Date.now()-h.callCppProxy("getDeltaTime"),p}))]}}))}))}}),Object.defineProperty(t.prototype,"close",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){return we(this,(function(n){return e||this.callCppProxy("disconnect","boolean"!=typeof t||t,!!r),[2]}))}))}}),Object.defineProperty(t.prototype,"sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t.pingResolve=r,t.callCppProxy("sendHeartbeat"),setTimeout((function(){return t.recvPong(J.TIMEOUT)}),e)}))}}),Object.defineProperty(t.prototype,"recvPong",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pingResolve&&(this.pingResolve(e),this.pingResolve=null)}}),Object.defineProperty(t.prototype,"recvConnectRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){t?this.onDisconnectByServer(e,r):e===J.RC_SOCKET_DISCONNECTED&&this.getConnectionStatus()!==lt.CONNECTED||this.onDisconenctUnusual(e)}}),Object.defineProperty(t.prototype,"_onTcpConnectResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s,u=this.cmpWeightCache.findIndex((function(e){return e.addr==="".concat(t,":").concat(r)})),c={bid:fr(),ptc:Vt.TCP,cod:e,net:this.getNetwork().type,dur:n,spr:0,pr:(null===(s=this._naviInfo)||void 0===s?void 0:s.type)||0,hos:"".concat(t,":").concat(r),idx:u,rct:this.retryCount?kt.RECONNECT:kt.CONNECT,cid:this.cid,v:Ft.CURRENT,rsn:this._doConnectReason,ddu:i,count:this.retryCount,weight:u>=0?this.cmpWeightCache[u].weight:-1};if(this.logger.record(Et.IM_CMP,JSON.stringify(c)),this.logger.info(yn.P_CONNECT_ENTRY_S,JSON.stringify({code:e,host:t,port:r,duration:n,dnsDuration:i,index:o,isQuic:a})),e===ki.SUCCESS)this.curCmpUrl="".concat(t,":").concat(r),this.updateCmpWeight("".concat(t,":").concat(r),!0,a);else if(e!==ki.NOT_INIT){var l=r&&0!==r?"".concat(t,":").concat(r):"".concat(t);this.updateCmpWeight(l,!1)}}}),t}(En);Vi=new WeakSet,Gi=function(e,t){10!==e&&(this._connectingTask?e===J.SUCCESS?this._connectingTask.ok(t):this._connectingTask.fail(e,t):this.logger.warn(yn.P_CONNECT_E,JSON.stringify({msg:"connect complete but no connecting task"})))},Fi=function(e,t){switch(this.logger.info(yn.P_CONNECT_S,JSON.stringify({status:e,delay:t})),e){case J.RC_CONN_REDIRECTED:this.recvConnectRes(e,!0);break;case 11:case 10:case 12:break;case J.CONNECTION_REFUSED:case J.RC_SOCKET_DISCONNECTED:case J.RC_SOCKET_NOT_CREATED:case J.RC_CONN_ACK_TIMEOUT:case J.RC_TCP_RESET:this.recvConnectRes(e,!1);break;case J.RC_UDP_DISCONNECTED:this.recvConnectRes(e,!0,t);break;default:this.recvConnectRes(e,!0)}};var Bi,Ji,Wi,Yi,Ki,Xi,Qi,Zi,qi,zi,$i,eo,to,ro,no,io,oo,ao=function(e){function r(r,n,i){var a=e.call(this,r,n)||this;Object.defineProperty(a,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"dbpath",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"_cachePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),a._cachePath="".concat(i,"/").concat(Ai(r));var s=t.dirname(a._cachePath);return o.existsSync(s)||jn(s),a}return Le(r,e),Object.defineProperty(r.prototype,"getCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o.existsSync(this._cachePath)&&o.readFileSync(this._cachePath,{encoding:"utf8"})||null}}),Object.defineProperty(r.prototype,"setCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){o.writeFileSync(this._cachePath,e)}}),Object.defineProperty(r.prototype,"clearCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){o.writeFileSync(this._cachePath,"")}}),Object.defineProperty(r.prototype,"sendRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r,n;return we(this,(function(i){switch(i.label){case 0:return[4,ci(this.logger,{url:e,body:""})];case 1:return t=i.sent(),r=t.status,n=t.data,[2,{code:r,data:n}]}}))}))}}),Object.defineProperty(r.prototype,"decryptData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,wn(e,"cd4936151214ce45dc1d12673a59d94c","51ad078e5eb17a91")];case 1:return t=n.sent(),[2,JSON.parse(t)];case 2:return r=n.sent(),this.logger.error(Re,JSON.stringify({error:null==r?void 0:r.stack})),[3,3];case 3:return[2]}}))}))}}),r}(Zr),so=function(e){function r(r,n,i,a,s){var u=e.call(this,n,r,i)||this;Object.defineProperty(u,"deviceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"model",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(u,"catchFilePath",{enumerable:!0,configurable:!0,writable:!0,value:""}),u.model="Electron|".concat(process.platform,"|").concat(process.arch),u.catchFilePath="".concat(s,"/").concat(Li(r));var c=t.dirname(u.catchFilePath);return o.existsSync(c)||jn(c),u.init(),u}return Le(r,e),Object.defineProperty(r.prototype,"httpRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return(i=n).deviceId=this.deviceId,i.model=this.model,o={url:e,method:t,headers:r,body:JSON.stringify(i)},a=this.logger.createTraceId(),this.logger.info(q,JSON.stringify(o),a),[4,ci(this.logger,o)];case 1:s=f.sent(),u=s.status,c=s.data,l=void 0===c?"":c,this.logger.info(z,JSON.stringify({status:u,data:l}),a);try{return _=JSON.parse(l),d=_.data,[2,{code:u,data:d}]}catch(e){return this.logger.warn(Oe,JSON.stringify({status:u,data:l,error:e})),[2,{code:u,msg:e}]}return[2]}}))}))}}),Object.defineProperty(r.prototype,"setCloudControllerCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){o.writeFileSync(this.catchFilePath,JSON.stringify(e)),this.logger.info(Ie,JSON.stringify(e))}}),Object.defineProperty(r.prototype,"getLocalCloudControllerCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!o.existsSync(this.catchFilePath))return null;var e=o.readFileSync(this.catchFilePath,{encoding:"utf8"});return this.logger.info(Ce,JSON.stringify({appkey:this.appkey,data:e})),e}}),Object.defineProperty(r.prototype,"setMRTRConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={mrtrChatroom:e.chatroom,mrtrGroup:e.group,mrtrPrivate:e.private,mrtrUltraGroup:e.ultraGroup};this.logger.info(Te,JSON.stringify(t)),Yn.setCloudConfig(JSON.stringify(t))}}),r}(fn),uo=[Ot,Dt,It,yt,Lt,Pt,mt,Nt,At,Mt,Ut],co=function(){return{logCmdQueue:[],cloudControllerVers:[],srsmsgs:[],readNtfs:[],expansionMsgQueue:new Map,v1ReceiptMsgs:[],privateRSMsgs:[],groupRSMsgs:new Map,rrmsgs:new Map,messageUIds:new Set}},lo=function(){function e(){Object.defineProperty(this,"_report",{enumerable:!0,configurable:!0,writable:!0,value:co()}),Object.defineProperty(this,"_count",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"isLowPriorityMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return uo.includes(e)}}),Object.defineProperty(e.prototype,"isEmpty",{enumerable:!1,configurable:!0,writable:!0,value:function(){return 0===this._count}}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._count++;var n=e.messageType,i=e.senderUserId,o=e.content;if(n!==Ot)if(n!==Dt)if(n!==yt)if(n!==It)if(n!==Nt){if(n===Pt){var a=o.messageUId;if(!a)return;return this._report.messageUIds.add(a),void this._report.v1ReceiptMsgs.push(e)}if(n===mt){var s=o.receiptMessageDic;if(i!==t){var u=s[t];if(!u||0===u.length)return;return u.forEach((function(e){return r._report.messageUIds.add(e)})),void this._report.v1ReceiptMsgs.push(e)}return Object.values(s).forEach((function(e){e.forEach((function(e){return r._report.messageUIds.add(e)}))})),void this._report.v1ReceiptMsgs.push(e)}n!==At?n===Lt&&this._handleRSMsg(e):this._handleRRMsg(e)}else this._handleReadNtf(e);else this._handleExpansionNotify(e);else this._handleSRSMsg(e,t);else i===Zt&&this._report.cloudControllerVers.push(e.sentTime);else if(i===Zt){var c=o.startTime,l=o.endTime,_=o.platform,d=o.logId,f=o.uri;this._report.logCmdQueue.push({startTime:parseInt(c,10),endTime:parseInt(l,10),platform:_,logId:d,uri:f,messageUId:e.messageUId})}}}),Object.defineProperty(e.prototype,"_handleRSMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.senderUserId;var t=e.content,r=e.conversationType,n=e.targetId,i=e.channelId;if(r!==Me.PRIVATE){var o=t,a=o.msgId,s=o.rrn,u=o.tmn,c=this._report.groupRSMsgs.get(a);c?(c.totalCount=u,c.readedCount=s):this._report.groupRSMsgs.set(a,{totalCount:u,readedCount:s}),this._report.messageUIds.add(a)}else{var l=this._report.privateRSMsgs.find((function(e){return e.conversationType===r&&e.targetId===n&&e.channelId===i}));l?l.timestamp=Math.max(l.timestamp,t.endMsgTime):this._report.privateRSMsgs.push({conversationType:r,targetId:n,channelId:i,timestamp:t.endMsgTime})}}}),Object.defineProperty(e.prototype,"_handleRRMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content.msgId;this._report.rrmsgs.set(t,e),this._report.messageUIds.add(t)}}),Object.defineProperty(e.prototype,"_handleExpansionNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content,r=t.put,n=t.mid,i=t.del,o=t.clear;this._report.messageUIds.add(n),this._report.expansionMsgQueue.has(n)&&!o?this._report.expansionMsgQueue.get(n).push({put:r,del:i,clear:o}):this._report.expansionMsgQueue.set(n,[{put:r,del:i,clear:o}])}}),Object.defineProperty(e.prototype,"_handleSRSMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.conversationType,n=e.targetId,i=e.channelId;e.senderUserId===t&&(this._report.srsmsgs=this._report.srsmsgs.filter((function(e){return e.conversationType!==r||e.targetId!==n||e.channelId!==i})),this._report.srsmsgs.push(e))}}),Object.defineProperty(e.prototype,"_handleReadNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.conversationType,r=e.targetId,n=e.channelId;t===Me.PRIVATE&&(this._report.readNtfs=this._report.readNtfs.filter((function(i){return i.conversationType!==t||i.targetId!==r||i.channelId!==n||i.senderUserId!==e.senderUserId})),this._report.readNtfs.push(e))}}),Object.defineProperty(e.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._report;return this._report=co(),this._count=0,e}}),e}(),_o=function(){function e(e){Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:e})}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];try{t.apply(void 0,Ge([],Ve(n),!1))}catch(t){r.logger.error(yn.L_JS_CALLBACK_EXCEPTION_E,"name: ".concat(e,"\n").concat(t.stack))}}}}),e}();!function(e){e[e.cuid=1]="cuid",e[e.uid=2]="uid",e[e.all=4]="all"}(oo||(oo={}));var fo=function(){function e(e,t,r,n,i,o,a){var s=this;Bi.add(this),Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_dbpath",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_dispatchEvent",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_enableSyncEmptyTopConversation",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logOutputLevel",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_msgExpansionHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"navi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tcpMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_environment",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_staticConfigManager",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudController",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cloudControllerUri",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"cloudControllerLock",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"cloudControllerMsgs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enableReadReceiptStorage",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isConnected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_offlineFinishedPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullOfflineMessageFinished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_lowPriorityMessageHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_needDispatchMessageModifiedSyncCompleted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_buildSubscribeEventData",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=[];try{JSON.parse(e).list.forEach((function(e){var r=JSON.parse(e.obj),n=r.userId,i=r.subscribeType,o=r.subscribeTime,a=r.duration,u=r.operationType,c=r.details,l=void 0===c?[]:c,_=r.userProfile,d={userId:n,subscribeType:i,subscribeTime:o,expiry:a,operationType:u};[st.ONLINE_STATUS,st.FRIEND_ONLINE_STATUS].includes(i)&&(d.details=l.map((function(e){var t=JSON.parse(e);return{changeTime:t.changeTime,eventValue:t.changeValue,platform:t.platform}}))),[st.USER_PROFILE,st.FRIEND_USER_PROFILE].includes(i)&&(d.userProfile=s._string2userProfileInfo(_)),t.push(d)}))}catch(t){s.logger.error(yn.P_PARSE_JSON_SUBSCRIBE_DATA_E,JSON.stringify({error:null==t?void 0:t.stack,data:e}))}return t}}),Object.defineProperty(this,"_chatroomCache",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"rtcHeartbeatResolves",{enumerable:!0,configurable:!0,writable:!0,value:{}});var u=this._dbpath,c=this._deviceId=Ni(),l=Ii();this.logger=new Ti(this._appkey,"RC-M","IM",l),this._catcher=new _o(this.logger),Yn.initWithAppkey(e,u,Qt,this.logger.getSessionId()),Yn.setConsoleLogLevel((this._logOutputLevel||Kr.WARN)+1),this.logger.setOutputLevel(this._logOutputLevel),this.reporter=new gi(e,c,this.logger,o,l),this.logger.info(yn.P_INIT_O,JSON.stringify({appkey:e,dbpath:u,proto_commit:Yn.getNodeVersion(),deviceId:c,commit:"83e1a99664eff9a00ecf185e6d1a0a0490405ee7",processName:process.title,processPId:process.pid,disableLogReport:o,eventLoopBlockingCheck:a})),a&&sn.start(this.logger),this._callCppProxy("setDeviceId",c),this._staticConfigManager=new ao(e,this.logger,u),this._lowPriorityMessageHandler=new lo,this.navi=new wi(e,this.logger,u,this._staticConfigManager),this.tcpMgr=new Hi(e,this._callCppProxy.bind(this),this.navi,this.logger),this.tcpMgr.on("onConnected",this.onConnected,this),this.tcpMgr.on("onSuspend",this.onSuspend,this),this.tcpMgr.on("onDisconnected",this.onDisconnected,this),this.tcpMgr.on("onConnecting",this.onConnecting,this),this.tcpMgr.on("onDBUpgrateStart",this.dbUpgradeStart,this),this.tcpMgr.on("onDBUpgrading",this.dbUpgrading,this),this.tcpMgr.on("onDBUpgradeComplete",this.dbUpgradeComplete,this),this._enableCreateEmptyTopConversation(this._enableSyncEmptyTopConversation),this._initCloudController(c,u),this._registerBuildinMessageTypes(),Yn.setOnReceiveMessageListener(Fe(this,Bi,"m",Ki).bind(this),Fe(this,Bi,"m",Xi).bind(this),this._handleMessageModified.bind(this)),Yn.setRTConversationListener((function(e){return s._dispatchEvent("sgRelationsSynced",e)})),this._setConversationStatusListener(),this._setPushNotificationListener(),this._setRTCHeartbeatListener(),this._setRTCLivingRoomEventListener(),this._setChatroomEventListener(),this._setCallInfoListener(),this._setSubscribeEventListener(),this._setUserProfileListener(),this._setEntrustGroupListener(),this._setFriendEventListener(),Yn.setReadReceiptListener((function(e,t){var r=JSON.parse(t).map((function(e){return{identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount,users:e.readUsers.map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:e.mentioned}}))}}));s._dispatchEvent("readReceiptResponseV5",r)})),Yn.setTranslateEventListener((function(e){var t=JSON.parse(e).map((function(e){return{translateInfo:{targetLanguage:e.translateResult.targetLanguage,translatedText:e.translateResult.translatedText,status:e.translateResult.translateStatus},code:e.code,identifier:e.messageRecognitionIdentifier.messageUid,from:e.messageRecognitionIdentifier.inputSource}}));s._dispatchEvent("translateResponse",t)})),this._msgExpansionHandler=new Pi(this._callCppProxy.bind(this))}return Object.defineProperty(e.prototype,"_setDeviceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=r.cpus()[0].model,t=r.release();try{"darwin"===process.platform?t=n.execSync("sw_vers -ProductVersion",{encoding:"utf-8"}):"win32"===process.platform&&(t=n.execSync("ver",{encoding:"utf-8"}))}catch(e){this.logger.error(me,JSON.stringify({error:e}))}this._callCppProxy("setDeviceInfo","",e,"PC",t,"","")}}),Object.defineProperty(e.prototype,"_initCloudController",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;r=Ve(Qr.getCloudControllerUrl(),1),this.cloudControllerUri=r[0],this.cloudController=new so(this._appkey,this.logger,this.reporter,e,t),this.cloudControllerUri&&this.cloudController.request(this.cloudControllerUri,an.init)}}),Object.defineProperty(e.prototype,"callProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){switch(o.label){case 0:if(!(r=this[e]))return this.logger.warn(yn.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2,Promise.resolve({code:J.NOT_SUPPORT})];n="",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.call.apply(r,Ge([this],Ve(t),!1))];case 2:return[2,o.sent()];case 3:return i=o.sent(),n=JSON.stringify({error:null==i?void 0:i.stack,method:e}),this.logger.error(yn.P_CALL_MAIN_E,n),[3,4];case 4:return[2,{code:J.MAIN_PROCESS_ERROR,msg:n}]}}))}))}}),Object.defineProperty(e.prototype,"sendProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){if(!(r=this[e]))return this.logger.warn(yn.P_CALL_MAIN_E,JSON.stringify({method:e,error:"not found"})),[2];try{r.call.apply(r,Ge([this],Ve(t),!1))}catch(t){this.logger.error(yn.P_CALL_MAIN_E,JSON.stringify({error:null==t?void 0:t.stack,method:e}))}return[2]}))}))}}),Object.defineProperty(e.prototype,"registerRenderers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.navigators,r=e.areaCode,n=e.logServerUrl,i=e.environment,o=e.useNaviV2,a=e.enableReadReceiptStorage;this._environment=i||"default",this.navi.setEnvironment(i),this._enableReadReceiptStorage=a,this.navi.setUseNaviV2(o),Qr.init({areaCode:r,navigators:t,logServerUrl:n})}}),Object.defineProperty(e.prototype,"onConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected=!0;var e=this.getNaviInfoFromCache();this.reporter.checkStart(e,""),this._try2RejoinChatroom();var t=this._getMainProcessCache();this._dispatchEvent("onConnected",t),this._offlineFinishedPending&&(this._offlineFinishedPending=!1,this.logger.info(ye),this._dispatchEvent("pullFinished")),this._needDispatchMessageModifiedSyncCompleted&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}}),Object.defineProperty(e.prototype,"onConnecting",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._needDispatchMessageModifiedSyncCompleted=!0,this._dispatchEvent("onConnecting")}}),Object.defineProperty(e.prototype,"onSuspend",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onSuspend",t)}}),Object.defineProperty(e.prototype,"onDisconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._isConnected=!1,this._pullOfflineMessageFinished=!1,this._offlineFinishedPending=!1,this._dispatchEvent("onDisconnected",t)}}),Object.defineProperty(e.prototype,"dbUpgradeStart",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._dispatchEvent("databaseUpgradeWillStart")}}),Object.defineProperty(e.prototype,"dbUpgrading",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._dispatchEvent("databaseUpgrading",t)}}),Object.defineProperty(e.prototype,"dbUpgradeComplete",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._dispatchEvent("databaseUpgradeDidComplete",t)}}),Object.defineProperty(e.prototype,"_callCppProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=this.logger.createTraceId();try{return this.logger.debug(yn.P_CALL_ADDON_O,JSON.stringify({method:e,content:t}),n),Yn[e].apply(Yn,Ge([],Ve(t),!1))}catch(t){throw this.logger.error(yn.P_CALL_ADDON_E,JSON.stringify({stack:null==t?void 0:t.stack,method:e}),n),t}}}),Object.defineProperty(e.prototype,"refetchNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.navi.request(this.tcpMgr.getToken(),!0,!0,this.logger.createTraceId())}}),Object.defineProperty(e.prototype,"sendHTTPRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return ci(this.logger,e)}}),Object.defineProperty(e.prototype,"onReceiveRendererLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.logger.recvRendererLog(e)}}),Object.defineProperty(e.prototype,"setNetwork",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(this.tcpMgr.setNetwork(e,t),e.status&&this.cloudController){var r=this.tcpMgr.getToken();this.cloudController.request(this.cloudControllerUri,an.newWorkChange,r)}}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){sn.stop(),this.reporter.stop(),this.logger.destroy(),Yn.destroy(),process.exit(0)}}),Object.defineProperty(e.prototype,"getHistoryMessagesByObjectNames",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s=0===o,u=n+1,c=this._callCppProxy("getHistoryMessagesByObjectNames",e,t,r,u,i,s,a||""),l=[];try{var _=JSON.parse(c).list;_.reverse();for(var d=0;d<_.length;d++){var f=this._buildMessage(_[d].obj);l[d]=f}}catch(e){return Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:{list:u===l.length?l.slice(1,u):l,hasMore:n<l.length}})}}),Object.defineProperty(e.prototype,"_updateMessageReceiptStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return ji(this.logger,!0,"updateMessageReceiptStatus",e,t,r,n||"")}}),Object.defineProperty(e.prototype,"updateMessageReceiptStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i;return we(this,(function(o){return i=this._updateMessageReceiptStatus(e,t,r,n),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getNaviInfoFromCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getConnectionStatus()!==lt.CONNECTED?null:this.navi.getNaviInfoFromCache(this.tcpMgr.getToken())}}),Object.defineProperty(e.prototype,"getConnectedTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getConnectedTime()}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Date.now()-Yn.getDeltaTime()}}),Object.defineProperty(e.prototype,"getCurrentUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.tcpMgr.getCurrentUserId()}}),Object.defineProperty(e.prototype,"_getMainProcessCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.tcpMgr.getConnectedTime(),t=this.tcpMgr.getConnectionStatus(),r=this.getNaviInfoFromCache(),n=this.tcpMgr.getCurrentUserId();return{connectedTime:e,deviceId:this.getDeviceId(),crtUserId:n,naviInfo:r,connectionStatus:t,deltaTime:Yn.getDeltaTime()}}}),Object.defineProperty(e.prototype,"getMainProcessCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,this._getMainProcessCache()]}))}))}}),Object.defineProperty(e.prototype,"_enableCreateEmptyTopConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callCppProxy("enableCreateEmptyTopConversation",e)}}),Object.defineProperty(e.prototype,"_registerBuildinMessageTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;On().forEach((function(t){e.registerMessageType(t.objectName,t)}))}}),Object.defineProperty(e.prototype,"_parseMessageJsonContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;try{r=e?JSON.parse(e):{}}catch(n){r=e,this.logger.error(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({content:e,messageId:t}))}return r}}),Object.defineProperty(e.prototype,"_buildSupportExt",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=null;return e&&(r=this._msgExpansionHandler.parseReceiveExpansion(t)),r}}),Object.defineProperty(e.prototype,"_handleReadReceiptRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e),r=this.getNaviInfoFromCache();if(!(null==r?void 0:r.grpRRVer))return t;var n=t,i=n.hasRespond,o=n.readerInfo,a=void 0===o?{}:o,s=n.readCount,u=n.totalCount,c=n.readerList,l=void 0===c?[]:c,_={readCount:s,totalCount:u};if(1===(null==r?void 0:r.grpRRVer)){var d=[];for(var f in a)d.push({userId:f,readTime:a[f]});_.readerList=d,_.hasRespond=i}return 3===(null==r?void 0:r.grpRRVer)&&(_.readerList=l),_}}),Object.defineProperty(e.prototype,"_buildMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=JSON.parse(e);return Fe(this,Bi,"m",Ji).call(this,r,t)}}),Object.defineProperty(e.prototype,"_compatibleReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=wt.UNREAD;return e.isRead?t=wt.READ:e.isListened?t=wt.LISTENED:e.isDownload?t=wt.DOWNLOADED:e.isRetrieved&&(t=wt.RETRIEVED),t}}),Object.defineProperty(e.prototype,"_updateReadReceiptInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callCppProxy("getMessage",e),n=JSON.parse(r),i=n.readReceiptRequest?JSON.parse(n.readReceiptRequest):{},o=Ue(Ue({},i),t);this._callCppProxy("updateReadReceiptRequestInfo",e,JSON.stringify(o))}}),Object.defineProperty(e.prototype,"_buildConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.parse(e);return Fe(this,Bi,"m",Wi).call(this,t)}}),Object.defineProperty(e.prototype,"_convertResultList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=JSON.parse(e).list;return r=r.map((function(e){var r=JSON.parse(e.obj);return t?t(r):r}))}}),Object.defineProperty(e.prototype,"_getMessagesByUIds",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(0===e.length)return[];var r=ji(this.logger,!1,"getMessageByUids",e);return JSON.parse(r).list.map((function(e){return Fe(t,Bi,"m",Ji).call(t,JSON.parse(e.obj))}))}}),Object.defineProperty(e.prototype,"_setMessageExtension",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){ji(this.logger,!1,"setMessageExtension",1,"1",e,JSON.stringify(t),"")}}),Object.defineProperty(e.prototype,"_handleLowPriorityMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this;if(!this._lowPriorityMessageHandler.isEmpty()){var i=Date.now(),o=this._lowPriorityMessageHandler.count,a=this.logger.createTraceId();this.logger.info(yn.L_HANDLE_LOW_PRIORITY_MESSAGES_T,JSON.stringify({startTime:i,count:o}),a);var s=this._lowPriorityMessageHandler.build(),u=s.srsmsgs,c=s.readNtfs,l=s.expansionMsgQueue,_=s.v1ReceiptMsgs,d=s.privateRSMsgs,f=s.groupRSMsgs,p=s.rrmsgs,E=s.logCmdQueue,b=s.cloudControllerVers,R=s.messageUIds,h=new Map;this._getMessagesByUIds(Ge([],Ve(R.values()),!1)).forEach((function(e){h.set(e.messageUId,e)})),this._handleExpansionMsgQueue(l,h),this._sendMessageNotification(c,!1),this._handlerReadReceiptMsgV1(_,h,e),this._handleSRSMsgs(u,t),this._handlerPrivateRSMsgs(d),this._handlerGroupRSMsgs(f,h),this._handlerRRMsgs(p,h),b.length>0&&((r=this.cloudControllerMsgs).push.apply(r,Ge([],Ve(b),!1)),this._ccMsgHandler()),E.forEach((function(e){var t=e.startTime,r=e.endTime,i=e.platform,o=e.logId,a=e.uri,s=e.messageUId;n.reporter.report(t,r,i,a,o,s)})),this.logger.info(yn.L_HANDLE_LOW_PRIORITY_MESSAGES_R,JSON.stringify({startTime:i,cost:Date.now()-i}),a)}}}),Object.defineProperty(e.prototype,"_updateReadReceiptRequestInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(0!==e.length){var t=e.map((function(e){return JSON.stringify({message_uid:e.messageUId,request_info:e.readReceiptInfo})}));ji(this.logger,!1,"updateReadReceiptRequestInfoList",t)}}}),Object.defineProperty(e.prototype,"_handlerRRMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[],n=[];Array.from(e.entries()).forEach((function(e){var i=Ve(e,2),o=i[0],a=i[1],s=t.get(o);if(s){var u=a.content,c=u.rrn,l=u.tmn,_=s.readReceiptInfo||{};_=Ue(Ue({},_),{readCount:c,totalCount:l}),s.readReceiptInfo=_,r.push({messageUId:o,readReceiptInfo:_}),n.push(a)}})),this._updateReadReceiptRequestInfoList(r),this._sendMessageNotification(n,!1)}}),Object.defineProperty(e.prototype,"_handlerGroupRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=[],i=[];Array.from(e.entries()).forEach((function(e){var r=Ve(e,2),o=r[0],a=r[1],s=a.totalCount,u=a.readedCount,c=t.get(o);if(c){var l=c.conversationType,_=c.targetId,d=c.channelId,f=c.readReceiptInfo||{};f=Ue(Ue({},f),{readCount:u,totalCount:s}),c.readReceiptInfo=f,n.push({messageUId:o,readReceiptInfo:f}),i.push({conversationType:l,targetId:_,channelId:d,readedCount:u,totalCount:s,messageUId:o})}})),this._updateReadReceiptRequestInfoList(n),i.forEach((function(e){return r._sendMessageReadReceipt({groupReadReceipt:e})}))}}),Object.defineProperty(e.prototype,"_handlerPrivateRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){var r=e.conversationType,n=e.targetId,i=e.channelId,o=e.timestamp;t._updateMessageReceiptStatus(r,n,o,i||""),t._sendMessageReadReceipt({privateReadReceipt:{conversationType:r,targetId:n,channelId:i||"",endMsgTime:o}})}))}}),Object.defineProperty(e.prototype,"_handleSRSMsgs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;1!==this.getNaviInfoFromCache().sesDriven?this._sendMessageNotification(e,!1):e.forEach((function(e){var n=e.conversationType,i=e.targetId,o=e.channelId,a=e.sentTime,s=e.content;a>t||r._sendsyncReadStatus({conversationType:n,targetId:i,channelId:o,timestamp:s.lastMessageSendTime})}))}}),Object.defineProperty(e.prototype,"_handlerReadReceiptMsgV1",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(0!==e.length){var n=new Set,i=[];e.forEach((function(e){var o=e.messageType,a=e.senderUserId,s=e.content;if(o===Pt){var u=s.messageUId,c=t.get(u);if(!c||c.senderUserId!==a)return;return c.readReceiptInfo=a===r?{isReceiptRequestMessage:!0,readerList:[]}:{isReceiptRequestMessage:!0,hasRespond:!1},n.add(c),void i.push(e)}var l=s.receiptMessageDic;if(a===r)return Object.values(l).forEach((function(e){e.forEach((function(e){var r=t.get(e);r&&(r.readReceiptInfo=Ue(Ue({},r.readReceiptInfo),{hasRespond:!0}),n.add(r))}))})),void i.push(e);var _=l[r];_&&0!==_.length&&(_.forEach((function(e){var r=t.get(e);if(r){var i=r.readReceiptInfo,o=((null==i?void 0:i.readerList)||[]).concat(a);r.readReceiptInfo=Ue(Ue({},r.readReceiptInfo),{readerList:o}),n.add(r)}})),i.push(e))})),this._enableReadReceiptStorage&&this._updateReadReceiptRequestInfoList(Array.from(n.values()).map((function(e){return{messageUId:e.messageUId,readReceiptInfo:e.readReceiptInfo}}))),this._sendMessageNotification(i,!1)}}}),Object.defineProperty(e.prototype,"_handleExpansionMsgQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;0!==e.size&&Array.from(e.entries()).forEach((function(e){var n=Ve(e,2),i=n[0],o=n[1],a=t.get(i);if(a&&o.length){var s=new Set,u=new Set,c=a.expansion||{};o.forEach((function(e){var t=e.put,r=e.del;if(e.clear)return Object.keys(c).forEach((function(e){s.add(e),u.clear()})),void(c={});t&&(Object.keys(t).forEach((function(e){s.delete(e),u.add(e)})),c=Ue(Ue({},c),t)),r&&r.forEach((function(e){s.add(e),u.delete(e),delete c[e]}))})),a.expansion=c;var l={};Object.keys(c).forEach((function(e){l[e]={v:c[e]}})),r._setMessageExtension(i,l);var _={},d=a.conversationType,f=a.targetId,p=a.channelId,E=!1;s.size>0&&(E=!0,_.deletedExpansion={conversationType:d,targetId:f,channelId:p||"",messageUId:i,deletedKeys:Array.from(s)}),u.size>0&&(E=!0,_.updatedExpansion={conversationType:d,targetId:f,channelId:p||"",messageUId:i,expansion:c}),E&&r._dispatchEvent("expansion",_)}}))}}),Object.defineProperty(e.prototype,"_handleHighPriorityMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=e.filter((function(e){var t=e.messageType;if(t===Tt)return!1;if(t===St){if(!Fe(n,Bi,"m",Qi).call(n,e))return!1;var r=n._fixRecallContentInfo(e);e.conversationType=r.conversationType,e.targetId=r.targetId}return!0}));this._sendMessageNotification(i,t)}}),Object.defineProperty(e.prototype,"_ccMsgHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.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,an.other,t)]):[3,2]):[2];case 1:r=n.sent()||0,this.cloudControllerMsgs=this.cloudControllerMsgs.filter((function(e){return e>r})),this.cloudControllerLock=!0,this._ccMsgHandler(),n.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(e.prototype,"_fixRecallContentInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.conversationType,r=e.targetId;return e.senderUserId===this.tcpMgr.getCurrentUserId()&&(t=e.content.conversationType||t,r=e.content.targetId||r),{conversationType:t,targetId:r}}}),Object.defineProperty(e.prototype,"_sendMessageNotification",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.length>0&&this._dispatchEvent("batchMessage",e,void 0,t)}}),Object.defineProperty(e.prototype,"_sendPullOfflineFinished",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._isConnected?(this.logger.info(ye),this._dispatchEvent("pullFinished")):this._offlineFinishedPending=!0}}),Object.defineProperty(e.prototype,"_handleMessageModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;try{var n=JSON.parse(e).list;if(n.length>0){var i=n.map((function(e){return r._buildMessage(e.obj)}));this._dispatchEvent("messagesModified",i)}}catch(t){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t,result:e}))}this._needDispatchMessageModifiedSyncCompleted&&!t&&this._isConnected&&(this._needDispatchMessageModifiedSyncCompleted=!1,this._dispatchEvent("messageModifiedSyncCompleted"))}}),Object.defineProperty(e.prototype,"_sendChatroomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("chatroom",e)}}),Object.defineProperty(e.prototype,"_sendMessageReadReceipt",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("messageReadReceipt",e)}}),Object.defineProperty(e.prototype,"_sendsyncReadStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("syncReadStatus",e)}}),Object.defineProperty(e.prototype,"_setConversationStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setConversationStatusListener((function(t){var r=JSON.parse(t).list.map((function(e){var t=JSON.parse(e.obj),r={channelId:t.channelId,conversationType:t.conversationType,targetId:t.targetId,updatedItems:{}};return t.status.forEach((function(e){var t=JSON.parse(e.item),n=t.type,i=t.value;if(1===n){var o=Number(i)||bt.NOT_SET;r.updatedItems.notificationLevel={val:o,time:0},r.updatedItems.notificationStatus={val:Jt(o),time:0}}else 2===n?r.updatedItems.isTop={val:"1"===i,time:0}:4===n&&(r.updatedItems.translateStrategy={val:Number(i),time:0})})),r}));r.length>0&&e._dispatchEvent("conversation",r)}),(function(t){e._dispatchEvent("conversationTag")}),(function(t,r,n,i){e._callCppProxy("clearUnreadCountByTimestamp",t,r,i,n||""),e._sendsyncReadStatus({conversationType:t,targetId:r,channelId:n,timestamp:i})}),(function(t){return e._dispatchEvent("conversationStatusSynced",t)}))}}),Object.defineProperty(e.prototype,"_setPushNotificationListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setPushNotificationListener((function(t){return e._getRTCProfile()}),(function(){return e._dispatchEvent("tag")}),(function(t){return e._dispatchEvent("userSettingsSynced",t)}),(function(t){return e._dispatchEvent("userSettingsChanged",{key:Jr,value:t})}),(function(t){return e._dispatchEvent("userSettingsChanged",{key:Br,value:t})}))}}),Object.defineProperty(e.prototype,"_getRTCProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._callCppProxy("getRTCProfile");if(e){var t=this.tcpMgr.getToken();this.navi.updateVoipCallInfo(t,e);var r=this.navi.getNaviInfoFromCache(t);this._dispatchEvent("onNaviDataChange",r)}}}),Object.defineProperty(e.prototype,"_setRTCLivingRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setRTCRoomEventListener((function(t){e._dispatchEvent("onRTCDataChange",Array.prototype.slice.call(t))}))}}),Object.defineProperty(e.prototype,"_setChatroomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setChatroomEventListener((function(t,r){e._sendChatroomStatus({chatroomDestroyed:t})}))}}),Object.defineProperty(e.prototype,"_setCallInfoListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setCallInfoListener((function(t){var r=[];try{JSON.parse(t).list.forEach((function(e){Object.entries(e).forEach((function(e){var t=Ve(e,2),n=t[0],i=t[1];r.push({key:n,value:i})}))}))}catch(t){e.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t}))}e._dispatchEvent("callInfo",JSON.stringify({list:r}))}))}}),Object.defineProperty(e.prototype,"_setSubscribeEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setSubscribeEventListener((function(){}),(function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){var r=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",r)}),(function(t){var r=e._buildSubscribeEventData(t).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a=e.userProfile,s={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return[st.ONLINE_STATUS,st.FRIEND_ONLINE_STATUS].includes(r)?s.details=o:[st.USER_PROFILE,st.FRIEND_USER_PROFILE].includes(r)&&(s.userProfile=a),s}));e._dispatchEvent("subscribedUserStatusChange",r)}))}}),Object.defineProperty(e.prototype,"_setUserProfileListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setUserProfileListener((function(t){e._dispatchEvent("syncSubscribedUserStatusFinished",t)}),(function(t){e._dispatchEvent("ownUserProfileChanged",e._string2userProfileInfo(t))}))}}),Object.defineProperty(e.prototype,"_onGroupOperationChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,u=[];try{a=JSON.parse(n),u=JSON.parse(i),s=JSON.parse(e);var c={groupId:a[0]?a[0].groupId:"",operatorInfo:this._convertGroupMemberInfoList([s])[0],operation:t,operationTime:r};0===t?(o=Ve(this._convertGroupInfoList(a),1),c.groupInfo=o[0]):c.memberInfos=this._convertGroupMemberInfoList(u),this._dispatchEvent("groupOperation",c)}catch(t){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:t,groupInfoJson:n,membersJson:i,operatorInfo:e}))}}}),Object.defineProperty(e.prototype,"_onGroupInfoChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){try{var a=JSON.parse(r),s=this._convertUpdateGroupInfoList(JSON.parse(i))[0];switch(e){case A.GROUP_INFO_CHANGE:this._dispatchEvent("groupInfoChanged",{operatorInfo:this._convertGroupMemberInfoList([a])[0],operationTime:o,groupInfo:s,changedGroupInfo:s,fullGroupInfo:n?this._convertUpdateGroupInfoList(JSON.parse(n))[0]:s});break;case A.GROUP_REMARK_DELETE:case A.GROUP_REMARK_SET:var u=e===A.GROUP_REMARK_SET?L.ADD:L.REMOVE;this._dispatchEvent("groupRemarkChangedSync",{groupId:t,operationType:u,operationTime:o,groupRemark:(null==s?void 0:s.remark)||""})}}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfoJson:i,operatorInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onGroupMemberInfoChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(t),o=JSON.parse(r),a={groupId:e,operatorInfo:this._convertGroupMemberInfoList([i])[0],memberInfo:this._convertGroupMemberInfoList([o])[0],operationTime:n};this._dispatchEvent("groupMemberInfoChanged",a)}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,operatorInfoJson:t,updateMemberInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onGroupRequestChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(r),o=i.groupId,a=i.joinUser,s=i.approverUser,u=i.inviterUser,c=i.type,l=i.status,_=i.direction,d=i.remark,f=Ue(Ue(Ue(Ue({groupId:o},a&&{joinMemberInfo:this._convertGroupMemberInfoList([a])[0]}),u&&u.userId&&{inviterInfo:this._convertGroupMemberInfoList([u])[0]}),s&&s.userId&&{operatorInfo:this._convertGroupMemberInfoList([s])[0]}),{status:l,direction:_,type:c,operationTime:n,reason:d});this._dispatchEvent("groupApplicationEvent",f)}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,groupInfo:t,requestInfoJson:r}))}}}),Object.defineProperty(e.prototype,"_onFavoriteMembersChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){try{var i=JSON.parse(r),o=[];i&&rr(i.list)&&(o=i.list.map((function(e){return e.value}))),this._dispatchEvent("groupFollowsChangedSync",{groupId:e,operationType:t,operationTime:n,userIds:o})}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,memberIds:r}))}}}),Object.defineProperty(e.prototype,"_setEntrustGroupListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){Yn.setEntrustGroupListener(this._onGroupOperationChanged.bind(this),this._onGroupInfoChanged.bind(this),this._onGroupMemberInfoChanged.bind(this),this._onGroupRequestChanged.bind(this),this._onFavoriteMembersChanged.bind(this))}}),Object.defineProperty(e.prototype,"_onFriendApplicationStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){this._dispatchEvent("friendApplicationStatusChanged",{userId:e,applicationType:t,applicationStatus:r,directionType:n,operationTime:i,extra:null!=o?o:""})}}),Object.defineProperty(e.prototype,"_onFriendAdd",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){this._dispatchEvent("friendAdd",{userId:t,name:r,portraitUri:n,directionType:e,operationTime:i})}}),Object.defineProperty(e.prototype,"_onFriendDelete",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n={directionType:e,operationTime:r,userIds:JSON.parse(t).list.map((function(e){return e.value}))};this._dispatchEvent("friendDelete",n)}}),Object.defineProperty(e.prototype,"_onFriendsClearedFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._dispatchEvent("friendCleared",e)}}),Object.defineProperty(e.prototype,"_onFriendInfoChangedSync",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){try{var n=JSON.parse(r);this._dispatchEvent("friendInfoChangedSync",{userId:e,remark:t,extProfile:n.list,operationTime:0})}catch(e){this.logger.error(yn.P_PARSE_JSON_E,JSON.stringify({error:e,profiles:r}))}}}),Object.defineProperty(e.prototype,"_setFriendEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){Yn.setFriendEventListener(this._onFriendApplicationStatusChanged.bind(this),this._onFriendAdd.bind(this),this._onFriendDelete.bind(this),this._onFriendsClearedFromServer.bind(this),this._onFriendInfoChangedSync.bind(this))}}),Object.defineProperty(e.prototype,"registerMessageType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=0,n=t.isCounted,i=t.isCustom,o=t.isPersited,a=t.isStatusMessage,s=t.searchProps;o&&(r|=1),n&&(r|=2),a&&(r=16),i&&(gn(e,t),this.logger.info(yn.P_REGTYP_O,JSON.stringify({type:e,opt:r,search:s}))),this._callCppProxy("registerMessageType",e,r,s||[])}}),Object.defineProperty(e.prototype,"connect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.tcpMgr.connect(e,t,r,n)}}),Object.defineProperty(e.prototype,"reconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=J.RC_SOCKET_DISCONNECTED;return this.tcpMgr.reconnect(e,t,r,n)}}),Object.defineProperty(e.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.stringify(Ue(Ue({},e),{"electron-main":"5.28.0-c-tmp.1"}));this.logger.info(yn.P_REPORT_VER_O,t),this._callCppProxy("uploadSDKVersion",t,"")}}),Object.defineProperty(e.prototype,"disconnect",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){return we(this,(function(r){return e=e||!0,this._chatroomCache.length=0,this.reporter.stop(),li(null,this.logger),[2,this.tcpMgr.disconnect(e,t)]}))}))}}),Object.defineProperty(e.prototype,"setUserStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){Yn.setOnReceiveStatusListener((function(e,r){t({userId:e,status:r})}));var r=e.userIds||[];r.length&&this.subscribeUserStatus(r)}}),Object.defineProperty(e.prototype,"subscribeUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("subscribeUserStatus",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"setUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("setUserStatus",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserStatus",e,(function(e){setTimeout((function(){r({code:J.SUCCESS,data:{status:e}})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"_handleDirectionalUserIdList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.messageType,n=e.content,i=e.directionalUserIdList,o=void 0===i?[]:i,a=t===Me.GROUP;if(r===mt&&n.receiptMessageDic&&a)for(var s in n.receiptMessageDic)o.push(s);return r===yt&&function(e){return[Me.GROUP,Me.DISCUSSION,Me.ULTRA_GROUP,Me.PUBLIC_SERVICE,Me.APP_PUBLIC_SERVICE].includes(e)}(t)&&(o=[this.getCurrentUserId()]),o}}),Object.defineProperty(e.prototype,"_handleMessage2Callback",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;switch(e.messageType){case It:this._msgExpansionHandler.setLocalFromExtMsg(this.logger,e);break;case Pt:this._enableReadReceiptStorage&&this._updateReadReceiptInfo(t.content.messageUId,{isReceiptRequestMessage:!0,readerList:[]});break;case mt:if(this._enableReadReceiptStorage){var n=t.content.receiptMessageDic;if(!n)return;for(var i in n)n[i].forEach((function(e){r._updateReadReceiptInfo(e,{isReceiptRequestMessage:!0,hasRespond:!0})}))}}}}),Object.defineProperty(e.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this;void 0===i&&(i=this.logger.createTraceId());var a=r.messageType,s=r.content,u=r.expansion,c=r.pushConfig,l=r.pushContent,_=void 0===l?"":l,d=r.pushData,f=void 0===d?"":d,p=r.directionalUserIdList,E=void 0===p?[]:p,b=r.disableNotification,R=void 0!==b&&b,h=r.canIncludeExpansion,g=void 0!==h&&h,v=r.isVoipPush,O=void 0!==v&&v,I=r.channelId,C=void 0===I?"":I,S=r.messageId,T=void 0===S?0:S,N=r.disableUpdateLastMessage,P=void 0!==N&&N,m=r.needReceipt,y=c||{},A=y.iOSConfig,L=y.androidConfig,M=y.harmonyOSConfig,U=y.templateId,D=void 0===U?"":U,w=y.pushTitle,j=void 0===w?"":w,V=y.pushContent,G=void 0===V?_:V,F=y.pushData,k=void 0===F?f:F,x=y.disablePushTitle,H=void 0!==x&&x,B=y.forceShowDetailContent,W=void 0!==B&&B,Y=dr(A,L,M);return new Promise((function(c){_=G,f=k;var l=(null==L?void 0:L.notificationId)||"";E=o._handleDirectionalUserIdList(r,e);var d={};for(var p in u)d[p]={v:u[p]};var b=D;o.logger.info(yn.P_SEND_MSG_T,JSON.stringify({messageType:a,conversationType:e,targetId:t,channelId:C}),i);var h=o._callCppProxy("sendMessage",(function(e,t){var n=o._buildMessage(e,!1);if(o.logger.info(yn.P_SEND_MSG_R,JSON.stringify({code:t,messageUId:n.messageUId}),i),t===J.SENSITIVE_REPLACE)return setImmediate((function(){c({code:t})}));o._handleMessage2Callback(n,r),setImmediate((function(){c({code:J.SUCCESS,data:n})}))}),(function(e,t){var r=o._buildMessage(e,!1);o.logger.warn(yn.P_SEND_MSG_R,JSON.stringify({code:t,messageId:r.messageId}),i),r.sentTime=Date.now()-Yn.getDeltaTime(),setImmediate((function(){c({code:t,data:r})}))}),e,t,a,JSON.stringify(s),E,R,H,W,_,f,l,j,Y,b,g,JSON.stringify(d),O,C,T,P,!!m),v=JSON.parse(h);null==n||n(v.messageId)}))}}),Object.defineProperty(e.prototype,"recallMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d,f,p,E,b,R,h,g,v,O=this;return we(this,(function(I){return n=e.channelId||"",i=e.targetId,o=e.conversationType,a=t.user,s=t.pushContent,u=t.extra,c=t.pushConfig,l=t.disableNotification,_=t.isDelete,d=t.directionalUserIdList,f=t.disableUpdateLastMessage,p=t.isAdmin,E=t.messageUId,b=t.sentTime,R={conversationType:o,targetId:i,messageUId:E,sentTime:b,user:a,extra:u,channelId:n,isDelete:_||!1,isAdmin:p},a&&(R.user=a),u&&(R.extra=u),h={conversationType:o,targetId:i,senderUserId:this.tcpMgr.getCurrentUserId(),content:R,objectName:St,messageUid:E,direction:ft.SEND,status:wt.UNREAD,sentTime:b,channelId:n},g=this._buildMessage(JSON.stringify(h),!1),[2,(v=xi.create(this.logger,"recallMessage")).asyncInvoke((function(e){return De(O,void 0,void 0,(function(){return we(this,(function(e){return Fe(this,Bi,"m",Qi).call(this,g),g.pushConfig=c,v.ok(g),[2]}))}))}),(function(e){return v.fail(e)}),St,JSON.stringify(R),l||!1,(null==c?void 0:c.disablePushTitle)||!1,(null==c?void 0:c.forceShowDetailContent)||!1,s||"",(null==c?void 0:c.pushData)||"",(null===(r=null==c?void 0:c.androidConfig)||void 0===r?void 0:r.notificationId)||"",(null==c?void 0:c.pushTitle)||"",dr(null==c?void 0:c.iOSConfig,null==c?void 0:c.androidConfig,null==c?void 0:c.harmonyOSConfig),(null==c?void 0:c.templateId)||"",n,d||[],E,null!=f&&f).result()]}))}))}}),Object.defineProperty(e.prototype,"getHistoryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a){var s=this;return new Promise((function(u){r=r||0;var c=0===i,l=n+1,_=s._callCppProxy("getHistoryMessages",e,t,r,l,a,c,o),d=JSON.parse(_).list,f=[];d.reverse();for(var p=0;p<d.length;p++){var E=s._buildMessage(d[p].obj);f[p]=E}u({code:J.SUCCESS,data:{list:l===f.length?f.slice(1,l):f,hasMore:n<f.length}})}))}}),Object.defineProperty(e.prototype,"getMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){var u=0===i,c=r,l=0!==r,_=n+1;l&&(c+=u?1:-1,_++);for(var d=a._callCppProxy("getMessages",e,t,c,_,u,o),f=JSON.parse(d).list,p=[],E=0;E<f.length;E++){var b=a._buildMessage(f[E].obj);p[E]=b}var R=a._computeRepairInfo(p,u,r,c,_),h=R.isNeedRepair,g=void 0!==h&&h,v=R.repairTime,O=void 0===v?0:v;if(!g)return l&&(p.shift(),_--),p.reverse(),void s({code:J.SUCCESS,data:{list:_===p.length?p.slice(1,_):p,hasMore:n<p.length}});a._processRepairHisMsg(e,t,r,n,i,o,O,s)}))}}),Object.defineProperty(e.prototype,"_computeRepairInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=!1,a=0,s=this.getNaviInfoFromCache()||{},u=s.repairHisMsg,c=void 0===u?0:u,l=s.historyMsg;if(1!==c||!l)return{isNeedRepair:o,repairTime:a};var _=e.findIndex((function(e){return e.hasMore||0===Object.keys(e.content).length}));return t&&_>=0?(o=!0,a=e[_].hasMore?e[_].sentTime:e[_].sentTime+1):!t&&_>=1?(o=!0,a=e[_-1].sentTime):e.length<i||0===r?(o=!0,a=r):e.length>0&&e[0].sentTime!==r&&(o=!0,a=n),{isNeedRepair:o,repairTime:a}}}),Object.defineProperty(e.prototype,"_processRepairHisMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o,a,s){var u=this,c=function(a){for(var c=0===i,l=n+1,_=u._callCppProxy("getMessages",e,t,r,l,c,o),d=JSON.parse(_).list,f=[],p=0;p<d.length;p++){var E=u._buildMessage(d[p].obj);f[p]=E}f.reverse(),s({code:a,data:{list:l<=f.length?f.slice(1,l):f,hasMore:n<f.length}})},l=n+10>100?100:n+10;this._callCppProxy("getRemoteHistoryMessages",e,t,a,l,(function(){return c(0)}),(function(e){c(e)}),i,!0,o,!1)}}),Object.defineProperty(e.prototype,"getContinuousMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){r=r||0;var u=0===i;a._callCppProxy("getContinuousMessages",e,t,r,n,(function(e,t,r){var n=JSON.parse(e).list,i=[];n.reverse();for(var o=0;o<n.length;o++){var u=a._buildMessage(n[o].obj);i[o]=u}setTimeout((function(){s({code:J.SUCCESS,data:{list:i,timestamp:t,hasMore:r}})}))}),(function(e){setTimeout((function(){s({code:e})}),0)}),u,o)}))}}),Object.defineProperty(e.prototype,"getRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return new Promise((function(s){r=r||0;a._callCppProxy("getRemoteHistoryMessages",e,t,r,n,(function(e,t){var r=JSON.parse(e).list,n=[];r.reverse();for(var i=0;i<r.length;i++){var o=a._buildMessage(r[i].obj);n[i]=o}setTimeout((function(){s({code:J.SUCCESS,data:{list:n,hasMore:!!t}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),i,!0,o,!0)}))}}),Object.defineProperty(e.prototype,"deleteRemoteMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.conversationType,n=e.targetId,i=e.channelId,o=JSON.stringify(t),a=this.logger.createTraceId(),s=xi.create(this.logger,"deleteRemoteHistoryMessages",a);return s.asyncInvoke(r,n,o,!1,i||"",(function(){return s.ok()}),(function(e){return s.fail(e)})).result()}}),Object.defineProperty(e.prototype,"deleteRemoteMessageByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.logger.createTraceId(),n=xi.create(this.logger,"clearRemoteHistoryMessages",r);return n.asyncInvoke(e.conversationType,e.targetId,t,(function(){return n.ok()}),(function(e){return n.fail(e)}),e.channelId||"").result()}}),Object.defineProperty(e.prototype,"clearMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("clearMessages",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"getConversationListByFilter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){return we(this,(function(t){switch(e.type){case In:return[2,Fe(this,Bi,"m",Zi).call(this,e.params)];case Sn:return[2,Ir(J.NOT_SUPPORT)];case Cn:return[2,Fe(this,Bi,"m",qi).call(this,e.params)];case Tn:return[2,Fe(this,Bi,"m",zi).call(this,e.params)];case Nn:return[2,Fe(this,Bi,"m",$i).call(this,e.params)];case Pn:return[2,Fe(this,Bi,"m",eo).call(this,e.params)]}return[2]}))}))}}),Object.defineProperty(e.prototype,"getUntaggedConversationListByPage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n;return we(this,(function(i){return n=ji(this.logger,!1,"getConversationsByPageWithoutTag",e,t,r),[2,Fe(this,Bi,"m",Yi).call(this,n).trans((function(e){return e.list}))]}))}))}}),Object.defineProperty(e.prototype,"getConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a,s,u,c,l,_,d;return we(this,(function(f){switch(f.label){case 0:return(n=ji(this.logger,!0,"getConversation",e,t,r))?[2,Or(this._buildConversation(n))]:[4,this.getHistoryMessage(e,t,0,1,0,r,"")];case 1:return i=f.sent(),o=i.data,a=(null==o?void 0:o.list[0])||null,s=JSON.parse(ji(this.logger,!1,"getConversationStatus",JSON.stringify([{conversation_type:e,target_id:t,channel_id:r,channel_id_valid:"string"==typeof r&&r.length>0}])))[0],u=!!(null==s?void 0:s.is_top),c=(null==s?void 0:s.translate_strategy)||Ln,[4,this.getConversationNotificationLevel({conversationType:e,targetId:t,channelId:r})];case 2:return l=f.sent(),_=l.data,d={conversationType:e,targetId:t,channelId:r,latestMessage:a,lastUnreadTime:0,isTop:u,notificationLevel:_,notificationStatus:Jt(_),translateStrategy:c},[2,Or(d)]}}))}))}}),Object.defineProperty(e.prototype,"batchDeleteConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.identifiers,r=e.deleteRemotely,n=e.deleteMessages,i=xi.create(this.logger,"batchDeleteConversations",this.logger.createTraceId());return i.invoke({conversationIdentifiers:t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId||""}})),deleteMessages:n,deleteRemotely:r},(function(){return i.ok()}),(function(e){return i.fail(e)})).result()}}),Object.defineProperty(e.prototype,"clearConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=[];i=rr(e)?e:Ze(Ye),r._callCppProxy("clearConversations",i,t||""),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"getTotalUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i;return we(this,(function(o){return n=t&&t.length>0?t:Ze(Ye),i=ji(this.logger,!0,"getTotalUnreadCount",n,r,e),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){var o=n._callCppProxy("getUnreadCount",e,t,r);i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"clearConversationUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return void 0===r&&(r=""),new Promise((function(i){n._callCppProxy("clearUnreadCount",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"clearAllUnreadCount",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t=this;return we(this,(function(r){switch(r.label){case 0:return[4,Fe(this,Bi,"m",zi).call(this)];case 1:return(e=r.sent()).isOk?(e.data.list.forEach((function(e){var r=e.conversationType,n=e.targetId,i=e.channelId;ji(t.logger,!1,"clearUnreadCount",r,n,i||"")})),[2,Or()]):[2,e.wipe()]}}))}))}}),Object.defineProperty(e.prototype,"_clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){ji(this.logger,!1,"clearUnreadCountByTimestamp",e,t,r,n)}}),Object.defineProperty(e.prototype,"clearUnreadCountByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){return we(this,(function(i){return this._clearUnreadCountByTimestamp(e,t,r,n),[2,J.SUCCESS]}))}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getTheFirstUnreadMessage",e,t,r),a=n._buildMessage(o);i({code:J.SUCCESS,data:-1!==a.messageId?a:null})}))}}),Object.defineProperty(e.prototype,"getFirstUnreadMessageInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i,o){var a=n._callCppProxy("getTheFirstUnreadMessage",e,t,r),s=n._buildMessage(a);i({code:J.SUCCESS,data:-1!==s.messageId?{messageUId:s.messageUId,sentTime:s.sentTime}:null})}))}}),Object.defineProperty(e.prototype,"batchSetConversationToTop",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return Fe(this,Bi,"m",to).call(this,e,-1,t?1:0,-1,r,n)}}),Object.defineProperty(e.prototype,"batchSetConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.logger.createTraceId(),n=xi.create(this.logger,"setBlockPushLevelInBatches",r),i=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,level:t}}));return n.asyncInvoke(JSON.stringify(i),(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"batchSetConversationTranslateStrategy",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Fe(this,Bi,"m",to).call(this,e,-1,-1,t,!1,!1)}}),Object.defineProperty(e.prototype,"setConversationTypeNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"setBlockPushLevelForType",this.logger.createTraceId());return r.asyncInvoke(e,t,(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getConversationTypeNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t;return we(this,(function(r){return t=ji(this.logger,!0,"getBlockPushLevelForType",e),[2,Or(t)]}))}))}}),Object.defineProperty(e.prototype,"searchConversationByContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a,s=this;return we(this,(function(u){switch(u.label){case 0:return i=this.logger.createTraceId(),[4,(o=xi.create(this.logger,"searchConversationByContent",i)).asyncInvoke(n,e,t,r,(function(e,t,r){e===J.SUCCESS?o.ok({result:t,matchedNumber:r}):o.fail(e)})).result()];case 1:return(a=u.sent()).isOk?[2,a.trans((function(e){return JSON.parse(e.result).map((function(e){return Fe(s,Bi,"m",Wi).call(s,e)}))}))]:[2,Or([])]}}))}))}}),Object.defineProperty(e.prototype,"searchConversationByContentWithAllChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o,a=this;return we(this,(function(s){switch(s.label){case 0:return r=r||[1,3,6,7],n=this.logger.createTraceId(),[4,(i=xi.create(this.logger,"searchConversationByContentWithAllChannel",n)).asyncInvoke(r,e,t,(function(e,t,r){e===J.SUCCESS?i.ok({result:t,matchedNumber:r}):i.fail(e)})).result()];case 1:return(o=s.sent()).isOk?[2,o.trans((function(e){return JSON.parse(e.result).map((function(e){return Fe(a,Bi,"m",Wi).call(a,e)}))}))]:[2,Or([])]}}))}))}}),Object.defineProperty(e.prototype,"searchMessagesWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n,i,o;return De(this,void 0,void 0,(function(){var a,s,u,c,l=this;return we(this,(function(_){switch(_.label){case 0:return a=this.logger.createTraceId(),s=Fe(this,Bi,"m",ro).call(this,e.conversationFilter),u={keyword:e.keyword,limit:e.limit,desc:!e.order,offset:null!==(t=e.offset)&&void 0!==t?t:0,needMatchCount:!0,startTime:null===(r=e.timeRange)||void 0===r?void 0:r.startTime,endTime:null===(n=e.timeRange)||void 0===n?void 0:n.endTime,objectNames:kr((null===(i=e.messageFilter)||void 0===i?void 0:i.objectNames)||[]),senderIds:kr((null===(o=e.messageFilter)||void 0===o?void 0:o.senderIds)||[])},[4,(c=xi.create(this.logger,"searchMessage",a)).invoke(s,u,(function(e,t,r,n){e===J.SUCCESS?c.ok({result:t,totalMatched:r,conditionsMatched:n}):c.fail(e)})).result()];case 1:return[2,_.sent().trans((function(e){var t=e.result,r=e.totalMatched,n=e.conditionsMatched;return{messages:JSON.parse(t).list.map((function(e){return JSON.parse(e.obj)})).map((function(e){return Fe(l,Bi,"m",Ji).call(l,e)})),totalMatched:r,conditionsMatched:n}}))]}}))}))}}),Object.defineProperty(e.prototype,"getUnreadMentionedMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){for(var n=JSON.parse(this._callCppProxy("getUnreadMentionedMessages",e,t,r)).list,i=0;i<n.length;i++)n[i]=this._buildMessage(n[i].obj);return n}}),Object.defineProperty(e.prototype,"addToBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("addToBlacklist",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"removeFromBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("removeFromBlacklist",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getBlacklist",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getBlacklist",(function(e){setTimeout((function(){t({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){t({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getBlacklistStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getBlacklistStatus",e,(function(e){setTimeout((function(){r({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"insertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=r.content,o=r.senderUserId,a=r.messageType,s=r.messageDirection,u=r.readStatus,c=r.sentStatus,l=r.sentTime,_=r.searchContent,d=r.isUnread,f=r.messageUId,p=r.disableNotification,E=r.canIncludeExpansion,b=r.expansionMsg,R=r.channelId,h=r.directedUserIds,g=r.disableUpdateLastMessage;i=JSON.stringify(i);var v={};if(l=l||0,b){var O=JSON.parse(b);for(var I in O)v[I]={v:"",ts:0},v[I].v=O[I],v[I].ts=l}return new Promise((function(r){var b=d?0:1,O=n._callCppProxy("insertMessage",e,t,o,a,i,(function(){}),(function(e){setTimeout((function(){r({code:e})}),0)}),s,u||0,c||10,l,_||"",b,f||"",!!p,!!E,JSON.stringify(v),R||"",h||[],g||!1),I=n._buildMessage(O,!1);I.messageUId=f,I.sentTime=l,r({code:-1===I.messageId?J.MSG_INSERT_ERROR:J.SUCCESS,data:I})}))}}),Object.defineProperty(e.prototype,"batchInsertMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return void 0===t&&(t=!1),new Promise((function(n){var i=e.map((function(e){var t=e.content,r=e.senderUserId,n=e.messageType,i=e.messageDirection,o=e.receivedStatus,a=void 0===o?0:o,s=e.sentStatus,u=e.sentTime,c=e.searchContent,l=e.isUnread,_=e.messageUId,d=e.disableNotification,f=e.canIncludeExpansion,p=e.expansion,E=e.channelId,b=e.conversationType,R=e.targetId,h=e.source,g=e.isMentioned,v=e.receivedStatusInfo,O=e.directedUserIds,I=e.disableUpdateLastMessage,C=a;v&&(C=function(e){var t=wt.UNREAD;return(null==e?void 0:e.isRead)&&(t|=wt.READ),(null==e?void 0:e.isListened)&&(t|=wt.LISTENED),(null==e?void 0:e.isDownload)&&(t|=wt.DOWNLOADED),(null==e?void 0:e.isRetrieved)&&(t|=wt.RETRIEVED),t}(v));var S={};if(u=u||0,p)for(var T in p)S[T]={v:"",ts:0},S[T].v=p[T],S[T].ts=u;return{conversationType:b,targetId:R,channelId:E||"",direction:i,senderUserId:r,status:s||10,sentTime:u,objectName:n,content:JSON.stringify(t),messageUid:_||"",noNotification:!!d,supportExt:!!f,extMsg:JSON.stringify(S),readStatus:C,searchContent:c||"",isUnread:!!l,source:h||"",isMention:g,directedUsers:O,disableUpdateLastMessage:I||!1}})),o=r._callCppProxy("insertMessages",JSON.stringify(i),t);n({code:o?J.SUCCESS:J.MSG_INSERT_ERROR,data:o||!1})}))}}),Object.defineProperty(e.prototype,"getMessageCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getMessageCount",e,t,r);i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"deleteMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("deleteMessages",e),r(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"deleteMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this;return new Promise((function(a){o._callCppProxy("deleteMessagesByTimestamp",e,t,r,n,i),a(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"batchClearMessagesByTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r,n){var i=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(i)),r(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"batchClearRemoteHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.map((function(e){return{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId||"",send_time:e.timestamp}})),n=xi.create(this.logger,"deleteRemoteMessageBySendTimeInBatches",this.logger.createTraceId());return n.asyncInvoke(JSON.stringify(r),!!t,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){return t=ji(this.logger,!0,"getMessage",e),(r=this._buildMessage(t,!1)).messageId<=0?[2,Ir(J.RC_DB_DATA_NOT_FOUND,"msg not found: ".concat(e))]:[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"setMessageContent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){t=JSON.stringify(t),n._callCppProxy("setMessageContent",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageSearchField",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("setMessageSearchField",e,t,r),i(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageSentStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setMessageSentStatus",e,t),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"setMessageReceivedStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setMessageReceivedStatus",e,t),n(J.SUCCESS)}))}}),Object.defineProperty(e.prototype,"saveConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return new Promise((function(o){i._callCppProxy("saveTextMessageDraft",e,t,r,n||"")&&o(J.SUCCESS),o(J.DRAFT_SAVE_ERROR)}))}}),Object.defineProperty(e.prototype,"getConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("getTextMessageDraft",e,t,r||"");i({code:J.SUCCESS,data:o})}))}}),Object.defineProperty(e.prototype,"clearConversationMessageDraft",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("clearTextMessageDraft",e,t,r||"")&&i(J.SUCCESS),i(J.DRAFT_REMOVE_ERROR)}))}}),Object.defineProperty(e.prototype,"getConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r,n,i;return we(this,(function(o){return t=e.conversationType,r=e.targetId,n=e.channelId,i=ji(this.logger,!0,"getBlockPushLevelForConversation",r,n||"",t),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"setConversationNotificationLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return void 0===n&&(n=""),new Promise((function(o){i._callCppProxy("setBlockPushLevelForConversation",t,n,e,r,(function(){setTimeout((function(){o(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){o(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getTotalUnreadCountByLevels",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(r){var n=this._callCppProxy("getUnreadMentionedCountByLevel",e,t);return Promise.resolve({code:J.SUCCESS,data:n})}var i=this._callCppProxy("getUnreadCountByLevel",e,t);return Promise.resolve({code:J.SUCCESS,data:i})}}),Object.defineProperty(e.prototype,"sendReadReceiptV2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o=this;return we(this,(function(a){switch(a.label){case 0:return[4,(n=xi.create(this.logger,"sendReadReceipt",this.logger.createTraceId())).asyncInvoke(e,r||"",t,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()];case 1:return(i=a.sent()).isOk&&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(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({messageUId:e,error:null==t?void 0:t.stack}))}})),[2,i]}}))}))}}),Object.defineProperty(e.prototype,"getMessageReader",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("getMessageReader",e,r,t,(function(e,r){var o=[],a={};(e=JSON.parse(e)).list.forEach((function(e){var t=JSON.parse(e.obj),r=t.id,n=t.time;o.push({userId:r,readTime:n}),a[r]=n}));var s={readerInfo:a,readCount:o.length,totalCount:r};n._updateReadReceiptInfo(t,s),setTimeout((function(){i({code:J.SUCCESS,data:{list:o,totalMemberCount:r}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"sendReadReceiptMessageV4",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=e.conversationType,a=e.targetId,s=e.channelId;n._callCppProxy("sendMessageReadReceipt",o,a,s||"",t,r,(function(){setTimeout((function(){i({code:J.SUCCESS})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getMessageReadReceiptV4",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=e.targetId,o=e.channelId;r._callCppProxy("getMessageReadReceipt",i,o||"",t,(function(e,i,o){var a=[],s=r._callCppProxy("getMessage",t),u=JSON.parse(s);try{JSON.parse(o).list.forEach((function(e){var t=JSON.parse(e.obj),r=t.id,n=t.time;a.push({userId:r,readTime:n})}))}catch(e){r.logger.error(yn.P_PARSE_JSON_E,"method: getMessageReadReceipt, info: ".concat(o,", error: ").concat(e))}var c=JSON.parse(u.readReceiptRequest||"{}"),l=c.readerList,_=void 0===l?[]:l,d=c.readCount,f=void 0===d?0:d,p=!1;_.length<a.length&&(_=a,p=!0),f<i&&(f=i,p=!0),p&&r._callCppProxy("updateReadReceiptRequestInfo",t,JSON.stringify({readerList:_,readCount:f,totalCount:e})),setTimeout((function(){n({code:J.SUCCESS,data:{list:a,totalCount:e,readCount:f}})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"updateConversationReadTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=e.conversationType,o=e.targetId,a=e.channelId;r._callCppProxy("updateConversationReadTime",i,o,a||"",t,(function(){setTimeout((function(){n({code:J.SUCCESS})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"_addChatroomCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){this._rmChatroomCache(e),this._chatroomCache.push({chatroomId:e,joinExist:r,count:t,extra:n})}}),Object.defineProperty(e.prototype,"_rmChatroomCache",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._chatroomCache=this._chatroomCache.filter((function(t){return t.chatroomId!==e}))}}),Object.defineProperty(e.prototype,"_try2RejoinChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(0!==this._chatroomCache.length){var t=this.logger.createTraceId();this._chatroomCache.forEach((function(r){return De(e,void 0,void 0,(function(){var e,n,i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return e=r.chatroomId,n=r.joinExist,i=r.count,o=r.extra,this.logger.info(ee,e,t),[4,this._joinChrm(e,i,n,!1,o)];case 1:return a=c.sent(),s=a.code,u=a.data,s===J.SUCCESS?(this.logger.info(te,e,t),this._sendChatroomStatus({rejoinedRoom:Ue({chatroomId:e,count:i},u)}),[2]):(s===J.RC_CHATROOM_USER_KICKED&&this._rmChatroomCache(e),this._sendChatroomStatus({rejoinedRoom:{chatroomId:e,errorCode:s}}),this.logger.warn(te,"chrmId: ".concat(e,", code: ").concat(s),t),[2])}}))}))}))}}}),Object.defineProperty(e.prototype,"_joinChrm",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=r?"joinExistChatRoom":"joinChatRoom";return new Promise((function(s){n&&o._callCppProxy("clearMessages",Me.CHATROOM,e,""),o._callCppProxy(a,e,t,(function(n,a,u,c,l,_,d){o._addChatroomCache(e,t,r,i||""),setTimeout((function(){s({code:J.SUCCESS,data:{createTime:Number(n),memberCount:a,isAllChatroomBanned:u,isCurrentUserBanned:c,isCurrentChatroomBanned:l,isCurrentChatroomInWhitelist:_,joinTime:d}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}),i||"")}))}}),Object.defineProperty(e.prototype,"joinChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){return we(this,(function(n){switch(n.label){case 0:return[4,this._joinChrm(e,t,!1,!0,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(e.prototype,"joinExistChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._joinChrm(e,t,!0,!0,r)}}),Object.defineProperty(e.prototype,"quitChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._rmChatroomCache(e),new Promise((function(r){t._callCppProxy("quitChatRoom",e,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"getChatroomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("getChatroomInfo",e,t,r,(function(e,t){var r=e?JSON.parse(e).list:[],n=[];if(r.length>0)for(var o=0;o<r.length;o++)n.push(JSON.parse(r[o].obj));setTimeout((function(){i({code:J.SUCCESS,data:{userInfos:n,userCount:t}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getChatroomHistoryMessages",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a=this;return we(this,(function(s){return i=this.logger.createTraceId(),[2,(o=xi.create(this.logger,"getChatroomHistoryMessage",i)).asyncInvoke(e,t,r,n,(function(e){var t;try{t=JSON.parse(e)}catch(e){t={list:[],hasMore:!1}}var r=t.list;if(r&&r.length)try{t.list=r.map((function(e){return a._buildMessage(e.obj)}))}catch(e){t.list=[]}o.ok(t)}),(function(e){return o.fail(e)}),"").result()]}))}))}}),Object.defineProperty(e.prototype,"setChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i='[{"key":"'.concat(t.key,'", "value":"').concat(t.value,'"}]');r._callCppProxy("setChatroomKV",e,i,!!t.isAutoDelete,!!t.isOverwrite,(function(){setTimeout((function(){n(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){n(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"setChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("setChatroomKV",e,JSON.stringify(t.entries),!!t.isAutoDelete,!!t.isOverwrite,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}))}))}}),Object.defineProperty(e.prototype,"forceSetChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.setChatroomEntry(e,t)}}),Object.defineProperty(e.prototype,"removeChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=[t.key];return new Promise((function(i){r._callCppProxy("deleteChatroomKV",e,n,!!t.isOverwrite,(function(){i(J.SUCCESS)}),(function(e){i(e)}))}))}}),Object.defineProperty(e.prototype,"forceRemoveChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return t.isOverwrite=!0,t.userId=t.userId||this.tcpMgr.getCurrentUserId(),this.removeChatroomEntry(e,t)}}),Object.defineProperty(e.prototype,"removeChatroomEntries",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=t.entries.map((function(e){return e.key}));r._callCppProxy("deleteChatroomKV",e,i,!!t.isOverwrite,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}))}))}}),Object.defineProperty(e.prototype,"getChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){switch(o.label){case 0:return[4,this.getAllChatroomEntry(e)];case 1:return r=o.sent(),n=r.code,i=r.data,n!==J.SUCCESS?[2,{code:n}]:i&&i[t]?[2,{code:n,data:i[t]}]:[2,{code:J.CHATROOM_KEY_NOT_EXIST}]}}))}))}}),Object.defineProperty(e.prototype,"getAllChatroomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){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(){r({code:J.SUCCESS,data:t})}),0)}),(function(e){setTimeout((function(){r({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"removeChatroomFromCatch",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._rmChatroomCache(e)}}),Object.defineProperty(e.prototype,"getFileToken",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=this;return r=r||"",n=n||"",i=i||"",new Promise((function(s){var u;u=n&&"uploads"!==n?t||"":_r(e,t);var c=a.getNaviInfoFromCache(),l={uploadDomain:br(c,a.logger),env:a._environment};o=o?Math.ceil(o):0,a._callCppProxy("getUploadToken",e,u,r,n,i,JSON.stringify(l),o,c.ipType||0,(function(e,t,r,n,i,o,a,c,l,_,d,f,p,E,b,R,h,g,v,O,I,C,S,T){setTimeout((function(){s({code:J.SUCCESS,data:{token:e,deadline:0,bosToken:t,bosDate:r,path:n,osskeyId:i,ossPolicy:o,ossSign:a,ossBucketName:c,fileName:u,s3Credential:l,s3Algorithm:_,s3Date:d,s3Policy:f,s3Signature:p,s3BucketName:E,stcAuthorization:b,stcContentSha256:R,stcDate:h,stcBucketName:g,minioAuthorization:v,minioContentSha256:O,minioDate:I,minioBucketName:C,downloadAuthInfo:S?JSON.parse(S):null}})}),0)}),(function(e){setTimeout((function(){s({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"getFileUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this.getNaviInfoFromCache(),o=br(i,this.logger),a=this.logger.createTraceId(),s=xi.create(this.logger,"getDownloadUrl",a);return s.asyncInvoke(e,r,n,t-1,JSON.stringify({url:o}),-1,i.ipType||0,(function(e){return s.ok({downloadUrl:e})}),(function(e){return s.fail(e)})).result()}}),Object.defineProperty(e.prototype,"clearLocalData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"clearData"),[2,Or(e)]}))}))}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._deviceId}}),Object.defineProperty(e.prototype,"getVoIPKey",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("getVoIPKey",e,t,"",(function(e){setTimeout((function(){n({code:J.SUCCESS,data:e})}),0)}),(function(e){setTimeout((function(){n({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"bindRTCRoomForChatroom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=e.chatRoomId,i=e.rtcRoomId;t._callCppProxy("bindRTCRoomForChatroom",n,i,(function(){setTimeout((function(){r(J.SUCCESS)}),0)}),(function(e){setTimeout((function(){r(e)}),0)}))}))}}),Object.defineProperty(e.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this;return new Promise((function(o){i._callCppProxy("rtcSignaling",e,t,r,n,(function(e){var t=Array.prototype.slice.call(e);o({code:J.SUCCESS,buffer:t})}),(function(e){o({code:e})}),30)}))}}),Object.defineProperty(e.prototype,"_setRTCHeartbeatListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Yn.setRTCHeartbeatListener((function(t,r){var n=e.rtcHeartbeatResolves[t];if(n){var i=n.find((function(e){return""===e.seqId}));i&&(i.seqId=r)}}),(function(t,r,n,i){var o=e.rtcHeartbeatResolves[t];if(o){var a=o.findIndex((function(e){return e.seqId===n}));-1!==a&&o.splice(a,1)[0].resolve({code:r,data:{version:Number(i)}})}}))}}),Object.defineProperty(e.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(t){var r={resolve:t,seqId:""},i=n.rtcHeartbeatResolves[e];i?i.push(r):n.rtcHeartbeatResolves[e]=[r],n._callCppProxy("sendRTCHeartbeat",[e],30)}))}}),Object.defineProperty(e.prototype,"createTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"addTag");return t.asyncInvoke(e.tagId,e.tagName,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"deleteTag");return t.asyncInvoke(e,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"updateTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"renameTag");return t.asyncInvoke(e.tagId,e.tagName,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTagList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e,t;return we(this,(function(r){return e=ji(this.logger,!1,"getTags"),t=this._convertResultList(e,(function(e){return{tagId:e.tagId,tagName:e.tagName,conversationCount:e.conversationCount,createdTime:e.tagTime}})),[2,Or(t)]}))}))}}),Object.defineProperty(e.prototype,"addTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"addConversationsForTag"),n=t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId}}));return r.asyncInvoke(e,JSON.stringify(n),(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTagForConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"removeConversationsForTag"),n=t.map((function(e){return{type:e.conversationType,targetId:e.targetId,channelId:e.channelId}}));return r.asyncInvoke(e,JSON.stringify(n),(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"removeTagsForConversation");return r.asyncInvoke(e.conversationType,e.targetId,e.channelId||"",t,(function(){return r.ok()}),(function(e){return r.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getConversationListByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o=this;return we(this,(function(a){return n=ji(this.logger,!1,"getConversationsForTagByPage",e,t,r,""),i=this._convertResultList(n,(function(e){return Ue(Ue({},o._buildConversation(JSON.stringify(e))),{isTopInTag:e.topForTag})})),[2,Or(i)]}))}))}}),Object.defineProperty(e.prototype,"getUnreadCountByTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){return r=ji(this.logger,!0,"getConversationUnreadCountForTag",e,t),[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"setConversationStatusInTag",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"setConversationToTopForTag");return n.asyncInvoke(e,t.conversationType,t.targetId,t.channelId||"",!!r.isTop,(function(){return n.ok()}),(function(e){return n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTagsForConversation",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){return t=ji(this.logger,!1,"getTagsForConversation",e.conversationType,e.targetId,e.channelId||""),r=this._convertResultList(t,(function(e){return{tagId:e.tagId,tagName:e.tagName,isTop:e.isTop,createdTime:e.tagTime}})),[2,Or(r)]}))}))}}),Object.defineProperty(e.prototype,"getAllUnreadMentionedCount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){var r=e._callCppProxy("getUnreadAndMentionCount",[Me.GROUP],"");t({code:J.SUCCESS,data:r})}))}}),Object.defineProperty(e.prototype,"getOSInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e={arch:r.arch(),platform:r.platform(),type:r.type(),version:r.version(),release:r.release(),uptime:r.uptime(),cpus:r.cpus(),freemem:r.freemem(),totalmem:r.totalmem(),networkInterfaces:r.networkInterfaces()},[2,{code:J.SUCCESS,data:e}]}))}))}}),Object.defineProperty(e.prototype,"getMainProcessInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,{code:J.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()}}]}))}))}}),Object.defineProperty(e.prototype,"setCallInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("callInfoSignaling",e,t,r,(function(e,t){setTimeout((function(){i({code:J.SUCCESS,data:{key:e,value:t}})}),0)}),(function(e){setTimeout((function(){i({code:e})}),0)}))}))}}),Object.defineProperty(e.prototype,"setProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.tcpMgr.getConnectionStatus()!==lt.DISCONNECTED?Promise.resolve({code:J.RC_CONN_PROXY_UNAVAILABLE}):Promise.resolve(li(e,this.logger))}}),Object.defineProperty(e.prototype,"getProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Promise.resolve(_i())}}),Object.defineProperty(e.prototype,"testProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return function(e,t,r){return new Promise((function(n){var i=/^https/.test(t)?si:ii;r.info(pe,JSON.stringify({msg:"test proxy",proxy:e,testHost:t}));var o=i(t,e,(function(e){var t=200===e.statusCode?0:e.statusCode;e.setEncoding("utf8");var r="";e.on("data",(function(e){r+=e})),e.once("end",(function(){n({status:t||0,data:r})}))}));o.once("timeout",(function(){return n({status:0})})),o.once("error",(function(e){return n({status:0,data:e.stack})})),o.end()}))}(e,t,this.logger)}}),Object.defineProperty(e.prototype,"checkDuplicateMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("checkDuplicateMessage",e);r({code:J.SUCCESS,data:n})}))}}),Object.defineProperty(e.prototype,"subscribeUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){n._callCppProxy("updateSubscribeStatus",t,ut.SUBSCRIBE,e,(function(){i({code:J.SUCCESS})}),(function(e,t){i({code:e,data:t})}),r)}))}}),Object.defineProperty(e.prototype,"unSubscribeUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){r._callCppProxy("updateSubscribeStatus",t,ut.UNSUBSCRIBE,e,(function(){n({code:J.SUCCESS})}),(function(e){n({code:e})}),0)}))}}),Object.defineProperty(e.prototype,"getSubscribeUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._callCppProxy("getSubscribeUserList",e,t,r),i=this._buildSubscribeEventData(n).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return r===st.ONLINE_STATUS&&(a.details=ar(o)),a}));return Promise.resolve({code:J.SUCCESS,data:i})}}),Object.defineProperty(e.prototype,"setDuplicateMessageConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callCppProxy("setDuplicateMessageConfig",[Me.CHATROOM],oo.cuid,e);return Promise.resolve({code:t})}}),Object.defineProperty(e.prototype,"getSubscribeUserStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callCppProxy("getSubscribeStatusByUserIds",e,t),n=this._buildSubscribeEventData(r).map((function(e){var t=e.userId,r=e.subscribeType,n=e.subscribeTime,i=e.expiry,o=e.details,a={userId:t,subscribeType:r,subscribeTime:n,expiry:i};return r===st.ONLINE_STATUS&&(a.details=ar(o)),a}));return Promise.resolve({code:J.SUCCESS,data:n})}}),Object.defineProperty(e.prototype,"updateMyUserProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[],r=[];Object.keys(e).forEach((function(n){var i;if("extraProfile"===n&&e.extraProfile){if(e.extraProfile){var o=e.extraProfile;Object.keys(o).forEach((function(e){r.push(JSON.stringify({key:e,value:o[e]||""}))}))}}else t.push(JSON.stringify({key:n,value:(null===(i=e[n])||void 0===i?void 0:i.toString())||""}))}));var n=xi.create(this.logger,"updateUserProfile");return n.invoke(t,r,(function(e,t){if(e===J.SUCCESS)n.ok();else{var r=kn(t);n.fail(e,{errorKey:r[0],errorKeys:r})}})).result()}}),Object.defineProperty(e.prototype,"getUserProfiles",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserProfiles",e,(function(e,n){r({code:e,data:t._string2UserProfileInfoList(n)})}))}))}}),Object.defineProperty(e.prototype,"getMyUserProfile",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getOwnUserProfile",(function(r,n){t({code:r,data:e._string2userProfileInfo(n)})}))}))}}),Object.defineProperty(e.prototype,"_string2userProfileInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;try{var r=JSON.parse(e),n=r.userProfile.reduce((function(e,t){var r=JSON.parse(t);return["gender","role","level"].includes(r.key)?e[r.key]=Number(r.value):e[r.key]=r.value,e}),{});return n.userId=r.userId,n.extraProfile=(null===(t=r.userExtProfile)||void 0===t?void 0:t.reduce((function(e,t){var r=JSON.parse(t);return e[r.key]=r.value,e}),{}))||{},n}catch(t){this.logger.error(yn.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return{}}}),Object.defineProperty(e.prototype,"_string2UserProfileInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;try{return JSON.parse(e).list.map((function(e){return t._string2userProfileInfo(e.obj)}))}catch(t){this.logger.error(yn.P_PARSE_JSON_USER_PROFILE_E,JSON.stringify({error:null==t?void 0:t.stack,str:e}))}return[]}}),Object.defineProperty(e.prototype,"updateMyUserProfileVisibility",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("updateUserProfilePermission",e,(function(){r({code:J.SUCCESS})}),(function(e){r({code:e})}))}))}}),Object.defineProperty(e.prototype,"getMyUserProfileVisibility",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){e._callCppProxy("getUserProfilePermission",(function(e,r){t({code:e,data:r})}))}))}}),Object.defineProperty(e.prototype,"searchUserProfileByUniqueId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){t._callCppProxy("getUserProfileByUniqueId",e,(function(e,n){r({code:e,data:t._string2userProfileInfo(n)})}))}))}}),Object.defineProperty(e.prototype,"getMatchedMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i,o=this._callCppProxy("getMatchedMessage",e.conversationType,e.targetId,t,r,n,e.channelId||""),a=[];try{i=JSON.parse(o).list;for(var s=0;s<i.length;s++){var u=this._buildMessage(i[s].obj);a.push(u)}}catch(e){return this.logger.error(yn.P_PARSE_JSON_MSGS_E,o),Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:a})}}),Object.defineProperty(e.prototype,"getConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this,n=e.map((function(e){var t=e.conversationType,r=e.targetId,n=e.channelId;return{targetId:r,channelId:void 0===n?"":n,type:t}})),i=this._callCppProxy("getConversations",JSON.stringify(n));try{t=JSON.parse(i).list.map((function(e){return r._buildConversation(e.obj)}))}catch(e){return this.logger.error(yn.P_PARSE_JSON_MSGS_E,i),Promise.resolve({code:J.MAIN_PROCESS_ERROR})}return Promise.resolve({code:J.SUCCESS,data:t})}}),Object.defineProperty(e.prototype,"handleErrorCode",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e!==J.SUCCESS&&setTimeout((function(){return t(Ir(e))}),0)}}),Object.defineProperty(e.prototype,"_convertGroupInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&0!==e.length?e.map((function(e){var t=e.groupId,r=e.baseInfo,n=e.createTime,i=e.createUserId,o=e.extraInfo,a=e.memberCount,s=e.ownerId,u=e.remark,c=e.joinTime,l=e.role,_=lr(r),d=lr(o);return{groupId:t,groupName:_.name||"",portraitUri:_.portraitUrl||"",introduction:_.introduction||"",notice:_.announcement||"",joinPermission:~~_.joinPerm,removeMemberPermission:~~_.removePerm,invitePermission:~~_.memInvitePerm,inviteHandlePermission:~~_.invitePerm,groupInfoEditPermission:~~_.profilePerm,memberInfoEditPermission:~~_.memProfilePerm,extProfile:d,creatorId:i||"",ownerId:s||"",createTime:n||0,membersCount:a||0,remark:u||"",joinedTime:c||0,role:l||m.UNDEF}})):[]}}),Object.defineProperty(e.prototype,"_convertUpdateGroupInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&0!==e.length?e.map((function(e){var t=e.groupId,r=e.baseInfo,n=e.createTime,i=e.createUserId,o=e.extraInfo,a=e.memberCount,s=e.ownerId,u=e.remark,c=e.joinTime,l=e.role,_=lr(r),d=lr(o);return JSON.parse(JSON.stringify(Ue(Ue(Ue(Ue(Ue(Ue(Ue(Ue(Ue({groupId:t},function(e){return JSON.parse(JSON.stringify({groupName:e.name,portraitUri:e.portraitUrl,introduction:e.introduction,notice:e.announcement,joinPermission:cr(e.joinPerm),removeMemberPermission:cr(e.removePerm),invitePermission:cr(e.memInvitePerm),inviteHandlePermission:cr(e.invitePerm),groupInfoEditPermission:cr(e.profilePerm),memberInfoEditPermission:cr(e.memProfilePerm)}))}(_)),o.length>0&&{extProfile:d}),i&&{creatorId:i}),s&&{ownerId:s}),n&&{createTime:n}),a&&{membersCount:a}),u&&{remark:u}),c&&{joinedTime:c}),l&&{role:l})))})):[]}}),Object.defineProperty(e.prototype,"_convertGroupMemberInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&0!==e.length?e.map((function(e){var t=e.userId,r=e.nickname,n=e.groupNickname,i=e.portraitUrl,o=e.joinTime;return{userId:t,name:r||"",portraitUri:i||"",nickname:n||"",role:e.role||0,joinedTime:o||0,extra:e.extra||""}})):[]}}),Object.defineProperty(e.prototype,"createGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){return i=Vn(t),o=Vn(r||{}),[2,(a=xi.create(this.logger,"createGroup")).invoke(e,n,JSON.stringify(i),JSON.stringify(o),(function(e,t,r,n){e===J.SUCCESS?a.ok():a.fail(e,{errorKeys:kn(n),processCode:t})})).result()]}))}))}}),Object.defineProperty(e.prototype,"updateGroupInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n,i,o;return we(this,(function(a){return n=Vn(t),i=Vn(null!=r?r:{}),[2,(o=xi.create(this.logger,"updateGroupInfo")).invoke(e,JSON.stringify(n),JSON.stringify(i),(function(e,t,r,n){e===J.SUCCESS?o.ok():o.fail(e,{errorKeys:kn(n)})})).result()]}))}))}}),Object.defineProperty(e.prototype,"getGroupsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupInfoByIds",e,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}setTimeout((function(){r({code:J.SUCCESS,data:t._convertGroupInfoList(a)})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"kickGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=Gn(r),a=n._callCppProxy("kickOutGroupMember",e,t,JSON.stringify(o),(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"quitGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=Gn(t),o=r._callCppProxy("quitGroup",e,JSON.stringify(i),(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"dismissGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("disbandGroup",e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"transferGroupOwner",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i=this;return we(this,(function(o){return[2,new Promise((function(o){var a=Gn(n),s=i._callCppProxy("transferGroup",e,t,r,JSON.stringify(a),(function(e,t){setTimeout((function(){o({code:e})}),0)}));i.handleErrorCode(s,o)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupManagers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=n._callCppProxy("updateGroupAdmins",t,r,e,(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupMembersByRole",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=t===m.UNDEF?[1,2,3]:[t],a=n._callCppProxy("getGroupMembers",e,o,r.pageToken||"",r.count,r.order?1:0,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:J.SUCCESS,data:{totalCount:null!=r?r:0,data:s,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("getGroupMembersByIds",e,t,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupMemberInfoList(a);setTimeout((function(){n({code:J.SUCCESS,data:s})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupMemberInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i;return we(this,(function(o){return[2,(i=xi.create(this.logger,"updateGroupMemberInfo")).invoke(e,t,r,n||"",(function(e,t,r,n){e===J.SUCCESS?i.ok():i.fail(e,{errorKeys:kn(n)})})).result()]}))}))}}),Object.defineProperty(e.prototype,"searchGroupMembers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=r.order?1:0,a=n._callCppProxy("getGroupMembersByNickname",e,t,r.pageToken||"",r.count,o,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=n._convertGroupMemberInfoList(a);setTimeout((function(){i({code:J.SUCCESS,data:{data:s,pageToken:t,totalCount:r}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"joinGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("joinGroup",e,(function(e,t,n){e===J.SUCCESS?setTimeout((function(){r({code:e,data:{processCode:t}})}),0):setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"inviteUsersToGroup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=r._callCppProxy("inviteUsersToGroup",e,t,(function(e,t,r){e===J.SUCCESS?setTimeout((function(){n({code:e,data:{processCode:t}})}),0):setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))]}))}))}}),Object.defineProperty(e.prototype,"memberInviteResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=e.groupId,i=e.inviterId,o=e.optType,a=e.optResult,s=e.joinUserId,u=e.reason,c=1===o?1:0,l=c&&s?s:"",_=t._callCppProxy("handleGroupInvite",n,l,i,a,c,null!=u?u:"",(function(e,t,n){e===J.SUCCESS?setTimeout((function(){r({code:e,data:{processCode:t}})}),0):setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(_,r)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupApplications",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===t&&(t=[]),void 0===r&&(r=[]),De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=e.order?1:0,a=n._callCppProxy("getGroupRequests",t,r,"",e.pageToken||"",e.count,o,(function(e,t,r,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var s=a.map((function(e){var t=e.groupId,r=e.joinUser,n=e.approverUser,i=e.inviterUser,o=e.type;return{groupId:t,joinMemberInfo:r,inviterInfo:i,operatorInfo:n,status:e.status,direction:e.direction,type:o,operationTime:e.operateTime,reason:e.remark}}));setTimeout((function(){i({code:e,data:{totalCount:r,data:s,pageToken:t}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(a,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getJoinedGroupsByRole",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t.order?1:0,o=e===m.UNDEF?[1,2,3]:[e],a=r._callCppProxy("getGroups",o,t.pageToken||"",t.count,i,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupInfoList(a);setTimeout((function(){n({code:e,data:{totalCount:i,data:s,pageToken:t}})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(a,n)}))]}))}))}}),Object.defineProperty(e.prototype,"searchJoinedGroups",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t.order?1:0,o=r._callCppProxy("getGroupsByGroupName",e,t.pageToken||"",t.count,i,(function(e,t,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){r.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){n({code:J.MAIN_PROCESS_ERROR})}),0)}var s=r._convertGroupInfoList(a);setTimeout((function(){n({code:e,data:{totalCount:i,data:s,pageToken:t}})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"getJoinedGroups",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupsByIds",e,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}var s=t._convertGroupInfoList(a);setTimeout((function(){r({code:e,data:s})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupRemark",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r=this;return we(this,(function(n){return[2,new Promise((function(n){var i=t?L.ADD:L.REMOVE,o=r._callCppProxy("updateGroupRemark",e,t||"",i,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(o,n)}))]}))}))}}),Object.defineProperty(e.prototype,"setGroupFollows",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return De(this,void 0,void 0,(function(){var n=this;return we(this,(function(i){return[2,new Promise((function(i){var o=n._callCppProxy("updateFavoriteMembers",t,r,e,(function(e,t){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))]}))}))}}),Object.defineProperty(e.prototype,"getGroupFollows",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t=this;return we(this,(function(r){return[2,new Promise((function(r){var n=t._callCppProxy("getGroupFavoriteMembers",e,"",1e3,0,(function(e,n,i,o){if(e===J.SUCCESS){var a=[];try{a=JSON.parse(o)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,o),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}var s=a.map((function(e){return{userId:e.userId,time:e.followTime}}));setTimeout((function(){r({code:J.SUCCESS,data:s})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))]}))}))}}),Object.defineProperty(e.prototype,"addFriend",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=n._callCppProxy("addFriend",e,t,r,(function(e,t,r){setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(o,i)}))}}),Object.defineProperty(e.prototype,"deleteFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("removeFriends",e,t,(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"acceptFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("acceptFriendRequest",e,"",(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"refuseFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("rejectFriendRequest",e,t||"",(function(e,t){setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"setFriendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"setFriendInfo"),i=Vn(null!=r?r:{});return n.invoke(e,t,JSON.stringify(i),(function(e,t,r,i){e===J.SUCCESS?n.ok():n.fail(e,{errorKeys:kn(i)})})).result()}}),Object.defineProperty(e.prototype,"checkFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return new Promise((function(n){var i=r._callCppProxy("checkFriendRelationship",e,t,(function(e,t){if(e===J.SUCCESS){var r=JSON.parse(t).map((function(e){return{userId:e.userId,relationType:e.status}}));setTimeout((function(){n({code:e,data:r})}),0)}else setTimeout((function(){n({code:e})}),0)}));r.handleErrorCode(i,n)}))}}),Object.defineProperty(e.prototype,"getFriends",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriends",e,0,(function(e,n){try{if(e===J.SUCCESS){var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:e,data:{data:o,pageToken:""}})}),0)}else setTimeout((function(){r({code:e})}),0)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"getFriendApplications",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;return new Promise((function(i){var o=e.order?1:0,a=3;t&&1===t.length&&(a=null==t?void 0:t[0]);var s=n._callCppProxy("getFriendRequestListByPage",a,r||[0,1,2,3],e.count,e.pageToken||"",o,(function(e,t,r){if(e===J.SUCCESS){var o=[];try{o=JSON.parse(r)}catch(e){n.logger.error(yn.P_PARSE_JSON_MSGS_E,r),setTimeout((function(){i({code:J.MAIN_PROCESS_ERROR})}),0)}var a=o.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:e,data:{data:a,pageToken:null!=t?t:""}})}),0)}else setTimeout((function(){i({code:e})}),0)}));n.handleErrorCode(s,i)}))}}),Object.defineProperty(e.prototype,"deleteFriendApplication",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return Promise.resolve({code:J.NOT_SUPPORT})}}),Object.defineProperty(e.prototype,"_convertFriendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.map((function(e){var t=e.userId,r=e.userName,n=e.remark;return{userId:t,name:r,portraitUri:e.portraitUrl,remark:n,directionType:e.friendType,extProfile:e.extProfiles,addTime:e.addTime,inBlackList:!!e.friendAttribute}}))}}),Object.defineProperty(e.prototype,"getFriendsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriendByIds",e,(function(e,n){if(e===J.SUCCESS){var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:e,data:o})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"searchFriendsInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("getFriendByNickname",e,(function(e,n){if(e===J.SUCCESS)try{var i=JSON.parse(n),o=t._convertFriendInfo(i);setTimeout((function(){r({code:J.SUCCESS,data:o})}),0)}catch(e){t.logger.error(yn.P_PARSE_JSON_MSGS_E,n),setTimeout((function(){r({code:J.MAIN_PROCESS_ERROR})}),0)}else setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"setFriendAddPermission",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return new Promise((function(r){var n=t._callCppProxy("setFriendAuthPermission",e,(function(e,t){setTimeout((function(){r({code:e})}),0)}));t.handleErrorCode(n,r)}))}}),Object.defineProperty(e.prototype,"getFriendAddPermission",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return new Promise((function(t){var r=e._callCppProxy("getFriendAuthPermission",(function(e,r){setTimeout((function(){t({code:e,data:r})}),0)}));e.handleErrorCode(r,t)}))}}),Object.defineProperty(e.prototype,"setNotificationQuietHoursWithSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.startTime,r=e.spanMinutes,n=e.level,i=e.timezone,o=xi.create(this.logger,"addPushSetting");return o.invoke(t,r,n,i||"",(function(){return o.ok()}),(function(e){return o.fail(e)})).result()}}),Object.defineProperty(e.prototype,"removeNotificationQuietHoursSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=xi.create(this.logger,"removePushSetting");return e.invoke((function(){return e.ok()}),(function(t){return e.fail(t)})).result()}}),Object.defineProperty(e.prototype,"getNotificationQuietHoursSetting",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=xi.create(this.logger,"queryPushSetting");return e.invoke((function(t,r,n,i){var o={startTime:t,spanMinutes:r,level:n,timezone:i};e.ok(o)}),(function(t){return e.fail(t)})).result()}}),Object.defineProperty(e.prototype,"setDataBaseLogConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callCppProxy("setDataBaseLogConfig",e)}}),Object.defineProperty(e.prototype,"getStatsUrlList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){return we(this,(function(e){return[2,Or(Qr.getStatsUrlList(this.getNaviInfoFromCache()))]}))}))}}),Object.defineProperty(e.prototype,"sendReadReceiptResponseV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=xi.create(this.logger,"sendReadReceiptByReadReceiptType");return r.invoke(e.conversationType,e.targetId,e.channelId||"",Mn,t,(function(e,t,n){e!==J.SUCCESS?r.fail(e):r.ok()})).result()}}),Object.defineProperty(e.prototype,"getMessageReadReceiptInfoV5ByIdentifiers",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return De(this,void 0,void 0,(function(){var t,r;return we(this,(function(n){switch(n.label){case 0:return t=e.map((function(e){var t=e.identifier,r=e.messageUId;return{conIdentifier:{type:t.conversationType,targetId:t.targetId,channelId:t.channelId||""},uid:r}})),[4,(r=xi.create(this.logger,"getReadReceiptCount")).invoke(JSON.stringify(t),(function(e,t){e!==J.SUCCESS?r.fail(e):r.ok(t)})).result()];case 1:return[2,n.sent().trans((function(e){return JSON.parse(e).map((function(e){return{identifier:{conversationType:e.conIdentifier.type,targetId:e.conIdentifier.targetId,channelId:e.conIdentifier.channelId},messageUId:e.msgUid,readCount:e.readCount,unreadCount:e.unreadCount,totalCount:e.totalCount}}))}))]}}))}))}}),Object.defineProperty(e.prototype,"getMessagesReadReceiptUsersByPageV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"getReadReceiptUsersByUid");return n.invoke(e.conversationType,e.targetId,e.channelId||"",t,r.pageToken||"",!r.readStatus,r.pageCount,0===r.order,(function(e,t,r,i){if(e===J.SUCCESS){var o={pageToken:t,totalCount:i,users:JSON.parse(r).map((function(e){return JSON.parse(e)})).map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}}))};n.ok(o)}else n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getMessagesReadReceiptByUsersV5",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=xi.create(this.logger,"getReadReceiptStatusForUsersInMessage");return n.invoke(e.conversationType,e.targetId,e.channelId||"",t,r,(function(e,t,r,i){if(e===J.SUCCESS){var o=JSON.parse(r).map((function(e){return JSON.parse(e)})).map((function(e){return{userId:e.userId,timestamp:e.receiptTime,isMentioned:!!e.mentioned}}));n.ok({pageToken:"",totalCount:0,users:o})}else n.fail(e)})).result()}}),Object.defineProperty(e.prototype,"requestSpeechToTextForMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=xi.create(this.logger,"speechToText");return r.invoke(e,(function(n,i){r.ok();var o=JSON.parse(i),a={status:o.status,text:o.text,isVisible:o.visible};setImmediate((function(){t._dispatchEvent("speechToTextResponse",{code:n,messageUId:e,sttInfo:a})}))})).result()}}),Object.defineProperty(e.prototype,"setMessageSpeechToTextVisible",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return De(this,void 0,void 0,(function(){var r;return we(this,(function(n){return[2,(r=ji(this.logger,!0,"updateSpeechToTextVisible",e,t))===J.SUCCESS?Or():Ir(r)]}))}))}}),Object.defineProperty(e.prototype,"setTranslationLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"setPushSetting");return t.invoke(Un,e,(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getTranslationLanguage",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"getPushSetting",Un),[2,Or(e)]}))}))}}),Object.defineProperty(e.prototype,"setAutoTranslateEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xi.create(this.logger,"setPushSetting");return t.invoke(Dn,e?"1":"0",(function(){return t.ok()}),(function(e){return t.fail(e)})).result()}}),Object.defineProperty(e.prototype,"getAutoTranslateEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return e=ji(this.logger,!0,"getPushSetting",Dn),[2,Or("1"===e)]}))}))}}),Object.defineProperty(e.prototype,"translateWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return De(this,void 0,void 0,(function(){var i,o,a;return we(this,(function(s){return i=ji(this.logger,!0,"getPushSetting",Un)||"zh",o=xi.create(this.logger,"translateMessages"),a=e.map((function(e){return{messageRecognitionIdentifier:{messageUid:e.identifier,customText:0===n?"":e.content,inputSource:n},sourceLanguage:e.sourceLanguage,targetLanguage:e.targetLanguage||i}})),[2,o.invoke(a,{forceRetranslate:r,translationServiceType:t},(function(e){e!==J.SUCCESS?o.fail(e):o.ok()})).result()]}))}))}}),Object.defineProperty(e.prototype,"modifyMessageWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=JSON.stringify(e.messageContent),r=xi.create(this.logger,"editMessage",this.logger.createTraceId());return r.asyncInvoke((function(){return r.ok()}),(function(e){return r.fail(e)}),e.messageUId,t).result()}}),Object.defineProperty(e.prototype,"refreshReferenceMessageWithParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this,o=xi.create(this.logger,"getQuotingMessageByUId");return o.asyncInvoke(t.conversationType,t.targetId,t.channelId||"",e,(function(e){o.fail(e)}),(function(e){o.ok(),setTimeout((function(){return Fe(i,Bi,"m",io).call(i,e,n)}),0)}),(function(e){o.ok(),setTimeout((function(){return Fe(i,Bi,"m",io).call(i,e,r)}),0)})).result()}}),Object.defineProperty(e.prototype,"syncRemoteConversations",{enumerable:!1,configurable:!0,writable:!0,value:function(){return De(this,void 0,void 0,(function(){var e;return we(this,(function(t){return[2,(e=ji(this.logger,!0,"getRemoteConversations"))===J.SUCCESS?Or():Ir(e)]}))}))}}),e}();Bi=new WeakSet,Ji=function(e,t){var r=e.channelId,n=e.conversationType,i=e.targetId,o=e.senderUserId,a=e.content,s=e.objectName,u=e.messageUid,c=e.direction,l=e.status,_=e.messageId,d=e.sentTime,f=e.readReceiptRequest,p=e.supportExt,E=e.pushContent,b=e.pushTitle,R=e.pushId,h=e.pushConfig,g=e.templateId,v=e.disableTitle,O=e.forcePushDetail,I=e.hasMore,C=e.directedUsers,S=e.noNotification,T=e.disableUpdateLastMessage,N=e.needReceipt,P=e.sendReceipt,m=e.contentRecognition,y=e.convertExt,A=e.editTime,L=e.editContent,M=e.editStatus,U=e.quotedMsgStatus,D=this._parseMessageJsonContent(a,_),w=!!D.mentionedInfo;if(y){var j=JSON.parse(y);if(j.trans){var V=j.trans,G={targetLanguage:V.targetLanguage,translatedText:V.translatedText,status:V.translateStatus};D.translateInfo=G}}if(s===gt||s===vt){var F=m?JSON.parse(m):{status:Kt,text:"",visible:!1},k={status:F.status,text:F.text,isVisible:F.visible};D.sttInfo=k}var x=vn(s),H=this._buildSupportExt(p,e),B=nr(t)?d<this.tcpMgr.getConnectedTime():t,J={};h&&(J=function(e,t){var r={},n={notificationId:t||""},i={};if(!e)return{iOSConfig:r,androidConfig:n,harmonyOSConfig:i};try{var o=JSON.parse(e);null==o||o.forEach((function(e){var t,o,a,s,u,c,l,_,d,f,p,E,b=Object.keys(e);if(0!==b.length){var R=b[0];switch(R){case"HW":return n.channelIdHW=null===(t=e[R])||void 0===t?void 0:t.channelId,n.importanceHW=null===(o=e[R])||void 0===o?void 0:o.importance,n.imageUrlHW=null===(a=e[R])||void 0===a?void 0:a.image,void(n.categoryHW=null===(s=e[R])||void 0===s?void 0:s.category);case"MI":return void(n.channelIdMi=null===(u=e[R])||void 0===u?void 0:u.channelId);case"OPPO":return void(n.channelIdOPPO=null===(c=e[R])||void 0===c?void 0:c.channelId);case"VIVO":return n.typeVivo=null===(l=e[R])||void 0===l?void 0:l.classification,void(n.categoryVivo=null===(_=e[R])||void 0===_?void 0:_.category);case"APNS":return r.threadId=e[R]["thread-id"],r.apnsCollapseId=e[R]["apns-collapse-id"],r.category=e[R].category,r.richMediaUri=e[R].richMediaUri,void(r.interruptionLevel=e[R]["interruption-level"]);case"FCM":return void(n.googleConfig={collapseKey:e[R].collapse_key||"",imageUrl:e[R].imageUrl||"",priority:e[R].priority||""});case"HONOR":return n.importanceHonor=null===(d=e[R])||void 0===d?void 0:d.importance,void(n.imageUrlHonor=null===(f=e[R])||void 0===f?void 0:f.image);case"OHOS":i.category=null===(p=e[R])||void 0===p?void 0:p.category,i.image=null===(E=e[R])||void 0===E?void 0:E.image}}}))}catch(e){}return{iOSConfig:r,androidConfig:n,harmonyOSConfig:i}}(h,R));var W=Ue(Ue({},J),{pushTitle:b,pushContent:E,pushData:E,disablePushTitle:v,forceShowDetailContent:O,templateId:g}),Y={channelId:r,conversationType:n,targetId:i,senderUserId:o,content:D||{},messageType:s,messageUId:u||"",messageDirection:c,isOffLineMessage:B,sentTime:d,receivedTime:0,isPersited:x.isPersited,isCounted:x.isCounted,isMentioned:w,disableNotification:S,isStatusMessage:vn(s).isStatusMessage||!1,canIncludeExpansion:p,expansion:p?H:null,receivedStatus:0,receivedStatusInfo:void 0,sentStatus:void 0,messageId:_,pushConfig:W,hasMore:I,directedUserIds:C||[],disableUpdateLastMessage:T,needReceipt:N,sendReceipt:P};if(c===ft.RECEIVE?(Y.receivedStatus=l,Y.receivedStatusInfo=function(e){return{isRead:(e&wt.READ)===wt.READ,isListened:(e&wt.LISTENED)===wt.LISTENED,isDownload:(e&wt.DOWNLOADED)===wt.DOWNLOADED,isRetrieved:(e&wt.RETRIEVED)===wt.RETRIEVED}}(l)):Y.sentStatus=l,f){var K=this._handleReadReceiptRequest(f);Y.readReceiptInfo=K}if(A||M)try{Y.modifyInfo={timestamp:A,content:L?JSON.parse(L):{},status:M}}catch(e){this.logger.error(yn.P_PARSE_JSON_MSGS_E,JSON.stringify({editContent:L,messageId:_}))}return s===Ct&&(Y.content.referMsgStatus=U),Y},Wi=function(e){var t=e.channelId,r=e.conversationType,n=e.targetId,i=e.unreadCount,o=e.lastestMsg,a=e.isTop,s=e.blockStatus,u=e.matchCount,c=e.hasUnreadMention,l=e.conversationTime,_=e.draft,d=e.translateStrategy;return{channelId:t,conversationType:r,targetId:n,unreadMessageCount:i,latestMessage:-1===JSON.parse(o).messageId?null:this._buildMessage(o),hasMentioned:c,notificationStatus:Jt(s),isTop:a,lastUnreadTime:0,matchCount:u,operationTime:l,notificationLevel:s,draft:_,translateStrategy:d}},Yi=function(e,t){var r=this;try{var n=JSON.parse(e).list.map((function(e){return r._buildConversation(e.obj)}));return Or({list:n,hasNext:t})}catch(e){return Ir(J.MAIN_PROCESS_ERROR,"parse conversation list result error")}},Ki=function(e){var t=JSON.parse(e),r=Fe(this,Bi,"m",Ji).call(this,t,!1),n=r.messageType,i=r.messageUId;if(this.logger.info(yn.L_RECV_S_MSG_S,JSON.stringify({messageUId:i,messageType:n})),this._lowPriorityMessageHandler.isLowPriorityMessage(n)){var o=this.tcpMgr.getCurrentUserId();return this._lowPriorityMessageHandler.push(r,o),void this._handleLowPriorityMessages(o,this.tcpMgr.getConnectedTime())}this._handleHighPriorityMessages([r],!1,!1)},Xi=function(e,t){var r=this,n=this.tcpMgr.getConnectedTime(),i=this.tcpMgr.getCurrentUserId(),o=[],a=[];JSON.parse(e).list.forEach((function(e){var t=JSON.parse(e.obj),s=t.sentTime<n,u=Fe(r,Bi,"m",Ji).call(r,t,s),c=u.messageType;r._lowPriorityMessageHandler.isLowPriorityMessage(c)?r._lowPriorityMessageHandler.push(u,i):s?o.push(u):a.push(u)})),o.length>0&&this._handleHighPriorityMessages(o,!!t,!0);var s=!1;(!t||a.length>0)&&!this._pullOfflineMessageFinished&&(s=this._pullOfflineMessageFinished=!0),a.length>0&&this._handleHighPriorityMessages(a,!!t,!1),(this._pullOfflineMessageFinished||this._lowPriorityMessageHandler.count>=1e4)&&this._handleLowPriorityMessages(i,n),s&&this._sendPullOfflineFinished()},Qi=function(e){var t=e.content,r=t.messageUId,n=t.sentTime;t.isAdmin;var i=t.isDelete;if("number"!=typeof n||"string"!=typeof r||!r.length)return this.logger.warn(yn.L_DISCARD_MSG_O,JSON.stringify({messageUId:e.messageUId,messageType:e.messageType})),!1;var o=this._callCppProxy("getMessage",r),a=this._buildMessage(o,!1),s=a.messageId>0;if(i)return s&&this._callCppProxy("deleteMessages",[a.messageId]),s;if(s&&a.messageType===Tt)return!1;var u={recallTime:Date.now(),admin:!!e.content.isAdmin,isDelete:!!e.content.isDelete,originalObjectName:a.messageType,originalMessageContent:a.content,recallActionTime:e.sentTime,operatorId:e.senderUserId};if(e.content.user&&(u.user=e.content.user),e.content.extra&&(u.extra=e.content.extra),a.messageType===ht&&(u.recallContent=a.content.content),!s){var c=e.conversationType,l=e.targetId,_=e.senderUserId,d=e.channelId,f=e.messageDirection;return this._callCppProxy("insertMessage",c,l,_,Tt,JSON.stringify(u),(function(){}),(function(){}),f,1,30,n,"",0,r,!1,!0,JSON.stringify({}),d||"",[],!1),!0}return a.receivedStatus||this.setMessageReceivedStatus(a.messageId,1),this._callCppProxy("setMessageContent",a.messageId,JSON.stringify(u),Tt),!0},Zi=function(e){return De(this,void 0,void 0,(function(){var t,r,n,i,o,a,s;return we(this,(function(u){return t=e.channelId,r=e.count,n=e.startTime,i=e.conversationTypes,o=e.topPriority,a=i&&i.length>0?i:Ze(Je),s=void 0===t?ji(this.logger,!1,"getConversationListWithAllChannel",a):ji(this.logger,!1,"getConversationListByPageWithTopPriority",a,n,r,!!o,t||""),[2,Fe(this,Bi,"m",Yi).call(this,s)]}))}))},qi=function(e){var t;return De(this,void 0,void 0,(function(){var r,n,i;return we(this,(function(o){return r=null==e?void 0:e.channelId,n=((null===(t=null==e?void 0:e.conversationTypes)||void 0===t?void 0:t.length)||0)>0?e.conversationTypes:Ze(Je),i=nr(r)?ji(this.logger,!1,"getTopConversations",n):ji(this.logger,!1,"getTopConversations",n,r),[2,Fe(this,Bi,"m",Yi).call(this,i,!1)]}))}))},zi=function(e){var t;return De(this,void 0,void 0,(function(){var r,n;return we(this,(function(i){return r=((null===(t=null==e?void 0:e.conversationTypes)||void 0===t?void 0:t.length)||0)>0?e.conversationTypes:Ze(Je),n=ji(this.logger,!1,"getUnreadConversationList",r),[2,Fe(this,Bi,"m",Yi).call(this,n,!1)]}))}))},$i=function(e){return De(this,void 0,void 0,(function(){var t,r,n;return we(this,(function(i){return t=null==e?void 0:e.channelId,r=Ze(Je),n=void 0===t?ji(this.logger,!1,"getConversationListWithAllChannel",r):ji(this.logger,!1,"getConversationList",r,t),[2,Fe(this,Bi,"m",Yi).call(this,n,!1)]}))}))},eo=function(e){return De(this,void 0,void 0,(function(){var t,r,n,i,o;return we(this,(function(a){return t=e.index,r=e.limit,n=e.conversationTypes,i=n&&n.length>0?n:Ze(Je),o=ji(this.logger,!1,"getConversationListWithAllChannelByPage",i,t,r),[2,Fe(this,Bi,"m",Yi).call(this,o)]}))}))},to=function(e,t,r,n,i,o){var a=this.logger.createTraceId(),s=xi.create(this.logger,"updateConversationStatus",a),u=JSON.stringify(e.map((function(e){return{conversation_query_param:{conversation_type:e.conversationType,target_id:e.targetId,channel_id:e.channelId,channel_id_valid:"string"==typeof e.channelId&&e.channelId.length>0},block_op:t,translate_strategy_op:n,top_op:r,create_conversation:!!o,update_time:!!i}})));return s.invoke(u,(function(){return s.ok()}),(function(e){return s.fail(e)})).result()},ro=function(e){if(!e)return[];var t=[],r=function(e){if(0!==t.length){var r=[];e.forEach((function(e){r.push.apply(r,Ge([],Ve(t.map((function(t){return Ue(Ue({},t),e)}))),!1))})),t=r}else t.push.apply(t,Ge([],Ve(e),!1))},n=e.conversationTypes,i=void 0===n?[]:n,o=e.targetIds,a=void 0===o?[]:o,s=e.channelIds,u=void 0===s?[]:s,c=kr(i).map((function(e){return{conversationType:e}})),l=kr(a).map((function(e){return{targetId:e}})),_=kr(u).length?u.map((function(e){return{channelId:e}})):[{channelIdValid:!1}];return r(c),r(l),r(_),t},no=function(e){var t=this,r=[];return e&&e.length>0&&(r=e.map((function(e){var r=JSON.parse(e.obj);return{messageUId:r.msg_uid,message:r.code===J.SUCCESS?t._buildMessage(r.msg):void 0,code:r.code}}))),r},io=function(e,t){try{var r=JSON.parse(e).list;t(Fe(this,Bi,"m",no).call(this,r))}catch(t){this.logger.error(yn.P_PARSE_JSON_MSGS_E,e)}};var po,Eo=function(){function e(e,t,r,n,i,o,a,s){Object.defineProperty(this,"sendCallback",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_cppService",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._cppService=new fo(e,t,i,n,r,a,s)}return Object.defineProperty(e.prototype,"call",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return De(this,void 0,void 0,(function(){var r,n,i,o,a=this;return we(this,(function(s){switch(s.label){case 0:return"sendMessage"===e&&(r=t[3],t[3]=function(e){a.sendCallback({reqId:r,data:e})}),"refreshReferenceMessageWithParams"===e&&(n=t[2],i=t[3],t[2]=function(e){a.sendCallback({reqId:n,data:e})},t[3]=function(e){a.sendCallback({reqId:i,data:e})}),[4,(o=this._cppService).callProxy.apply(o,Ge([e],Ve(t),!1))];case 1:return[2,{success:!0,data:s.sent()}]}}))}))}}),Object.defineProperty(e.prototype,"send",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];(t=this._cppService).sendProxy.apply(t,Ge([e],Ve(r),!1))}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._cppService.destroy()}}),e}(),bo=function(){function r(t,r,n,i,o,a){var s=this;void 0===o&&(o=!1),void 0===a&&(a=!1),Object.defineProperty(this,"_appkey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_dbpath",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_logOutputLevel",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_enableSyncEmptyTopConversation",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_disableLogReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_eventLoopBlockingCheck",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_cppServiceProcessProxy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_catch",{enumerable:!0,configurable:!0,writable:!0,value:{crtUserId:"",connectedTime:0,naviInfo:null,connectionStatus:2,deviceId:"",deltaTime:0}}),Object.defineProperty(this,"_rendererInitOptions",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_callbackCache",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._createServiceProxy(),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN_SYNC__",(function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return De(s,void 0,void 0,(function(){var n,i;return we(this,(function(o){switch(o.label){case 0:return[4,(i=this._cppServiceProcessProxy).call.apply(i,Ge([t],Ve(r),!1))];case 1:return n=o.sent(),e.returnValue=n.data,[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_CALL_MAIN__",(function(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return De(s,void 0,void 0,(function(){var i,o,a,s,u;return we(this,(function(c){switch(c.label){case 0:return"sendMessage"===r&&(i=n[3],this._callbackCache[i]=e.sender),"refreshReferenceMessageWithParams"===r&&(o=n[2],a=n[3],this._callbackCache[a]=e.sender,this._callbackCache[o]=e.sender),[4,(u=this._cppServiceProcessProxy).call.apply(u,Ge([r],Ve(n),!1))];case 1:if(!(s=c.sent()).success)throw new Error(s.data.msg);return this._send2Renderer(e.sender,"__RC_CHANNEL_RESULT_FROM_MAIN__",t,s.data),[2]}}))}))})),e.ipcMain.on("__RC_CHANNEL_SEND_2_MAIN__",(function(e,t){for(var r,n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];"registerMessageType"===t&&gn(n[0],n[1]),(r=s._cppServiceProcessProxy).send.apply(r,Ge([t],Ve(n),!1))})),e.ipcMain.on("__RC_INNER_COMMAND_INIT__",this._registerRenderers.bind(this)),e.app.on("before-quit",(function(){return s.destroy()})),e.app.on("window-all-closed",(function(){return s.destroy()}))}return Object.defineProperty(r.prototype,"_send2Renderer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];e.isDestroyed()?delete this._senders[e.id]:e.send.apply(e,Ge([t],Ve(r),!1))}}),Object.defineProperty(r.prototype,"_send2AllRenderer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];Object.keys(this._senders).forEach((function(n){var i=t._senders[n];t._send2Renderer.apply(t,Ge([i,"__RC_CHANNEL_NOTIFICATION_FROM_MAIN__",e],Ve(r),!1))}))}}),Object.defineProperty(r.prototype,"_registerRenderers",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,n=e.sender,i=n.id;this._rendererInitOptions||(this._rendererInitOptions=t),this._cppServiceProcessProxy.send("registerRenderers",t),this._senders[i]||(this._senders[i]=n,n.once("destroyed",(function(){delete r._senders[i]})))}}),Object.defineProperty(r.prototype,"getMainCache",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._catch}}),Object.defineProperty(r.prototype,"_callbackHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.reqId,r=e.data;this._callbackCache[t]&&this._send2Renderer(this._callbackCache[t],"__RC_CHANNEL_RESULT_FROM_MAIN__",t,r)}}),Object.defineProperty(r.prototype,"_createServiceProxy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r=this._dbpath||t.resolve(e.app.getPath("userData"));this._cppServiceProcessProxy=new Eo(this._appkey,r,this._logOutputLevel,this._enableSyncEmptyTopConversation,this._send2AllRenderer.bind(this),this._callbackHandler.bind(this),this._disableLogReport,this._eventLoopBlockingCheck)}}),Object.defineProperty(r.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._cppServiceProcessProxy.destroy()}}),Object.defineProperty(r.prototype,"setDataBaseLogConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._cppServiceProcessProxy.call("setDataBaseLogConfig",e)}}),r}(),Ro=function(){function e(e,t,r,n,i,o){Object.defineProperty(this,"_rcMain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rcMain=new bo(e,t,r,n,i,o)}return Object.defineProperty(e.prototype,"getCppProto",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return{destroy:function(){console.warn("`.getCppProto().destroy()` has being deprecated, use `.destroy()` instead."),e.destroy()}}}}),Object.defineProperty(e.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._rcMain.destroy()}}),Object.defineProperty(e.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rcMain.getMainCache().deviceId}}),Object.defineProperty(e.prototype,"getServerTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rcMain.getMainCache().connectedTime}}),Object.defineProperty(e.prototype,"setDatabaseOperationTimeThreshold",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._rcMain.setDataBaseLogConfig(e)}}),e}();module.exports=function(e){return function(e){if(po)return po;if(!e.appkey)throw new Error("Initializ failed, `appkey` is required!");return po=new Ro(e.appkey,(null==e?void 0:e.dbpath)||"",(null==e?void 0:e.logOutputLevel)||Kr.WARN,!!(null==e?void 0:e.enableSyncEmptyTopConversation),(null==e?void 0:e.disableLogReport)||!1,(null==e?void 0:e.eventLoopBlockingCheck)||!1)}(e)};
|