@onyx-p/imlib-web 1.0.15 → 1.0.17

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/dist/index.umd.js CHANGED
@@ -1,10 +1,10 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ACIMLib={})}(this,(function(e){"use strict";var t,r;e.ConnectionStatus=void 0,(t=e.ConnectionStatus||(e.ConnectionStatus={}))[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",t[t.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",t[t.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",t[t.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",t[t.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",t[t.BLOCKED=9]="BLOCKED",t[t.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e.ErrorCode=void 0,(r=e.ErrorCode||(e.ErrorCode={}))[r.TIMEOUT=-1]="TIMEOUT",r[r.UNKNOWN=-2]="UNKNOWN",r[r.PARAMETER_ERROR=-3]="PARAMETER_ERROR",r[r.SUCCESS=0]="SUCCESS",r[r.NETWORK_ERROR=7]="NETWORK_ERROR",r[r.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",r[r.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",r[r.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",r[r.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",r[r.RECALL_MESSAGE=25101]="RECALL_MESSAGE",r[r.NOT_IN_GROUP=22406]="NOT_IN_GROUP",r[r.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",r[r.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",r[r.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",r[r.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",r[r.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",r[r.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",r[r.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",r[r.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",r[r.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",r[r.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",r[r.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",r[r.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",r[r.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",r[r.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",r[r.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",r[r.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",r[r.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",r[r.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",r[r.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",r[r.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",r[r.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",r[r.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",r[r.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",r[r.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",r[r.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",r[r.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",r[r.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",r[r.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",r[r.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",r[r.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",r[r.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",r[r.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",r[r.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",r[r.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",r[r.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",r[r.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",r[r.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",r[r.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",r[r.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",r[r.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",r[r.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",r[r.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",r[r.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",r[r.NOT_SUPPORT=39002]="NOT_SUPPORT";const n=t=>e.ErrorCode[t];var o,i,s,a,c,l,u,d;function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return Object.prototype.toString.call(e).slice(8,-1)}e.ConversationType=void 0,(o=e.ConversationType||(e.ConversationType={}))[o.PRIVATE=1]="PRIVATE",o[o.GROUP=3]="GROUP",o[o.ULTRA_GROUP=10]="ULTRA_GROUP",e.MentionedType=void 0,(i=e.MentionedType||(e.MentionedType={}))[i.ALL=1]="ALL",i[i.SINGAL=2]="SINGAL",e.NotificationStatus=void 0,(s=e.NotificationStatus||(e.NotificationStatus={}))[s.OPEN=1]="OPEN",s[s.CLOSE=2]="CLOSE",e.MessageDirection=void 0,(a=e.MessageDirection||(e.MessageDirection={}))[a.SEND=1]="SEND",a[a.RECEIVE=2]="RECEIVE",e.ReceivedStatus=void 0,(c=e.ReceivedStatus||(e.ReceivedStatus={}))[c.READ=1]="READ",c[c.LISTENED=2]="LISTENED",c[c.DOWNLOADED=4]="DOWNLOADED",c[c.RETRIEVED=8]="RETRIEVED",c[c.UNREAD=0]="UNREAD",e.NotificationLevel=void 0,(l=e.NotificationLevel||(e.NotificationLevel={}))[l.ALL_MESSAGE=-1]="ALL_MESSAGE",l[l.NOT_SET=0]="NOT_SET",l[l.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",l[l.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",l[l.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",l[l.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION",e.LogLevel=void 0,(u=e.LogLevel||(e.LogLevel={}))[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=1e3]="NONE",e.Events=void 0,(d=e.Events||(e.Events={})).CONNECTING="CONNECTING",d.CONNECTED="CONNECTED",d.DISCONNECT="DISCONNECT",d.SUSPEND="SUSPEND",d.MESSAGES="MESSAGES",d.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",d.CONVERSATION="CONVERSATION";const p=e=>null!=e,g=e=>"number"==typeof e&&!isNaN(e),y=e=>"boolean"==typeof e,v=e=>void 0===e||"Undefined"===f(e),m=e=>"function"==typeof e,b=e=>null!==e&&"object"==typeof e;function C(e){return"array"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function w(e){return"string"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function E(e){return w(e)&&e.length>0}function S(e){for(const t in e)return!0;return!1}const O=e=>b(e)&&m(e.then)&&m(e.catch);const _={[e.LogLevel.DEBUG]:console.debug.bind(console),[e.LogLevel.INFO]:console.info.bind(console),[e.LogLevel.WARN]:console.warn.bind(console),[e.LogLevel.ERROR]:console.error.bind(console),[e.LogLevel.FATAL]:console.log.bind(console),[e.LogLevel.NONE]:null},I=e=>w(e)||g(e)||v(e)||y(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e),T=new class{constructor(t){h(this,"debug",void 0),h(this,"info",void 0),h(this,"warn",void 0),h(this,"error",void 0),h(this,"fatal",void 0),h(this,"outLevel",e.LogLevel.WARN),h(this,"tag",void 0),h(this,"logStdout",void 0),this.tag=t,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}defaultStdout(e,t){const r=_[e];if(p(r)){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r(`${t}:`,...o)}}reqInfo(){this.info(...arguments)}setLogLevel(e){this.outLevel=e}setLogStdout(e){this.logStdout=e}log(t){if(t<this.outLevel)return;const r=`${(new Date).toISOString()}[${this.tag}][${e.LogLevel[t]}]`;for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];const s=`${r} - ${o.map(I).join(" ")}`;this.logStdout?this.logStdout(t,s):this.defaultStdout(t,r,...o)}}("ACLog"),R=E,k=g,N=y,A=C,L=t=>g(t)&&Object.prototype.hasOwnProperty.call(e.ConversationType,t),M=t=>{if(!b(t))return!1;const{conversationType:r,targetId:n,channelId:o}=t;return g(r)&&Object.prototype.hasOwnProperty.call(e.ConversationType,r)&&(g(n)||E(n))&&(!p(o)||w(o)&&!/_/g.test(o)&&o.length<=20)};class x extends Error{constructor(e){super(e),this.name="ACAssertError"}}const D=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!B(e,t,r,n))throw new x(`'${e}' is invalid: ${JSON.stringify(t)}`)},B=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=n&&!r(t)||!n&&p(t)&&!r(t);return o&&T.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};let U=class{constructor(){h(this,"events",{})}on(e,t,r){const n=this.events[e]||(this.events[e]=[]);n.some((e=>e.listener===t&&e.target===r))||n.push({listener:t,target:r})}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const o=this.events[e];null!=o&&o.length&&o.map((e=>{const{target:t,listener:n}=e;try{n.call(t,...r)}catch(e){}}))}off(e,t,r){var n;let o=this.events[e];null!==(n=o)&&void 0!==n&&n.length&&(o=o.filter((e=>e.listener!==t||e.target!==r)),o.length?this.events[e]=o:delete this.events[e])}once(e,t,r){var n=this;const o=function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];t.call(r,...s),n.off(e,o,r)};return this.on(e,o,r),this}};var j;!function(e){e[e.Auth=805404708]="Auth",e[e.Heartbean=268439553]="Heartbean",e[e.GetServerTime=268439558]="GetServerTime",e[e.GetDialogKey=1610682389]="GetDialogKey",e[e.SendPrivateChatMessage=1610682369]="SendPrivateChatMessage",e[e.SendGroupChatMessage=1610747905]="SendGroupChatMessage",e[e.GetNewMessage=1610682407]="GetNewMessage",e[e.RecallPrivateMessage=1610682402]="RecallPrivateMessage",e[e.RecallGroupMessage=1610747947]="RecallGroupMessage",e[e.GetRemoteMessages=1610682416]="GetRemoteMessages",e[e.GetSuperGroupRemoteMessages=1610776956]="GetSuperGroupRemoteMessages",e[e.DeleteChatMessages=1610682381]="DeleteChatMessages",e[e.ClearChatHistoryMessage=1610777164]="ClearChatHistoryMessage",e[e.GetDialogList=1610711090]="GetDialogList",e[e.GetBriefDialogList=1610682399]="GetBriefDialogList",e[e.UpdatePrivateChatMuteConfig=1610682379]="UpdatePrivateChatMuteConfig",e[e.UpdateGroupChatMuteConfig=1610747915]="UpdateGroupChatMuteConfig",e[e.UpdatePrivateChatStickyConfig=1610682378]="UpdatePrivateChatStickyConfig",e[e.UpdateGroupChatStickyConfig=1610747914]="UpdateGroupChatStickyConfig",e[e.DeletePrivateDialog=1610682372]="DeletePrivateDialog",e[e.DeleteGroupDialog=1610747908]="DeleteGroupDialog",e[e.GetDialogChangedStatus=1610711094]="GetDialogChangedStatus",e[e.NewMessagePush=1610711040]="NewMessagePush",e[e.DialogChangedPush=1610711096]="DialogChangedPush",e[e.SessionKilledPush=268468229]="SessionKilledPush",e[e.SignOutPish=268439559]="SignOutPish",e[e.SignOutPish2=268468231]="SignOutPish2",e[e.UserFrozenToLogin=805408766]="UserFrozenToLogin",e[e.UserFrozenToLogin2=805408767]="UserFrozenToLogin2"}(j||(j={}));var P=j;var F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function G(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var q={exports:{}};var H,z={exports:{}};function K(){return H||(H=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==F&&F.crypto&&(r=F.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),i={},s=i.lib={},a=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=s.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(var a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=i.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},h=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*l,i);if(l){for(var d=0;d<l;d+=s)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=f.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new p.HMAC.init(e,r).finalize(t)}}});var p=i.algo={};return i}(Math);return e}()}(z)),z.exports}var V,W={exports:{}};function $(){return V||(V=1,function(e,t){e.exports=function(e){return n=(r=e).lib,o=n.Base,i=n.WordArray,(s=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=o.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return i.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),e;var t,r,n,o,i,s}(K())}(W)),W.exports}var J,Z={exports:{}};function X(){return J||(J=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(K())}(Z)),Z.exports}var Y,Q={exports:{}};function ee(){return Y||(Y=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var i=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var s=o(t[i>>>2]>>>16-i%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(K())}(Q)),Q.exports}var te,re={exports:{}};function ne(){return te||(te=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<r.length;i++)o[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(K())}(re)),re.exports}var oe,ie={exports:{}};function se(){return oe||(oe=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64url={stringify:function(e,t=!0){var r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var i=[],s=0;s<n;s+=3)for(var a=(r[s>>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<n;c++)i.push(o.charAt(a>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(e,t=!0){var r=e.length,o=t?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<o.length;s++)i[o.charCodeAt(s)]=s}var a=o.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(r=c)}return n(e,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(K())}(ie)),ie.exports}var ae,ce={exports:{}};function le(){return ae||(ae=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],y=e[t+5],v=e[t+6],m=e[t+7],b=e[t+8],C=e[t+9],w=e[t+10],E=e[t+11],S=e[t+12],O=e[t+13],_=e[t+14],I=e[t+15],T=i[0],R=i[1],k=i[2],N=i[3];T=l(T,R,k,N,s,7,a[0]),N=l(N,T,R,k,c,12,a[1]),k=l(k,N,T,R,f,17,a[2]),R=l(R,k,N,T,p,22,a[3]),T=l(T,R,k,N,g,7,a[4]),N=l(N,T,R,k,y,12,a[5]),k=l(k,N,T,R,v,17,a[6]),R=l(R,k,N,T,m,22,a[7]),T=l(T,R,k,N,b,7,a[8]),N=l(N,T,R,k,C,12,a[9]),k=l(k,N,T,R,w,17,a[10]),R=l(R,k,N,T,E,22,a[11]),T=l(T,R,k,N,S,7,a[12]),N=l(N,T,R,k,O,12,a[13]),k=l(k,N,T,R,_,17,a[14]),T=u(T,R=l(R,k,N,T,I,22,a[15]),k,N,c,5,a[16]),N=u(N,T,R,k,v,9,a[17]),k=u(k,N,T,R,E,14,a[18]),R=u(R,k,N,T,s,20,a[19]),T=u(T,R,k,N,y,5,a[20]),N=u(N,T,R,k,w,9,a[21]),k=u(k,N,T,R,I,14,a[22]),R=u(R,k,N,T,g,20,a[23]),T=u(T,R,k,N,C,5,a[24]),N=u(N,T,R,k,_,9,a[25]),k=u(k,N,T,R,p,14,a[26]),R=u(R,k,N,T,b,20,a[27]),T=u(T,R,k,N,O,5,a[28]),N=u(N,T,R,k,f,9,a[29]),k=u(k,N,T,R,m,14,a[30]),T=d(T,R=u(R,k,N,T,S,20,a[31]),k,N,y,4,a[32]),N=d(N,T,R,k,b,11,a[33]),k=d(k,N,T,R,E,16,a[34]),R=d(R,k,N,T,_,23,a[35]),T=d(T,R,k,N,c,4,a[36]),N=d(N,T,R,k,g,11,a[37]),k=d(k,N,T,R,m,16,a[38]),R=d(R,k,N,T,w,23,a[39]),T=d(T,R,k,N,O,4,a[40]),N=d(N,T,R,k,s,11,a[41]),k=d(k,N,T,R,p,16,a[42]),R=d(R,k,N,T,v,23,a[43]),T=d(T,R,k,N,C,4,a[44]),N=d(N,T,R,k,S,11,a[45]),k=d(k,N,T,R,I,16,a[46]),T=h(T,R=d(R,k,N,T,f,23,a[47]),k,N,s,6,a[48]),N=h(N,T,R,k,m,10,a[49]),k=h(k,N,T,R,_,15,a[50]),R=h(R,k,N,T,y,21,a[51]),T=h(T,R,k,N,S,6,a[52]),N=h(N,T,R,k,p,10,a[53]),k=h(k,N,T,R,w,15,a[54]),R=h(R,k,N,T,c,21,a[55]),T=h(T,R,k,N,b,6,a[56]),N=h(N,T,R,k,I,10,a[57]),k=h(k,N,T,R,v,15,a[58]),R=h(R,k,N,T,O,21,a[59]),T=h(T,R,k,N,g,6,a[60]),N=h(N,T,R,k,E,10,a[61]),k=h(k,N,T,R,f,15,a[62]),R=h(R,k,N,T,C,21,a[63]),i[0]=i[0]+T|0,i[1]=i[1]+R|0,i[2]=i[2]+k|0,i[3]=i[3]+N|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;r[o>>>5]|=128<<24-o%32;var i=t.floor(n/4294967296),s=n;r[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),r[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,i,s){var a=e+(t&r|~t&n)+o+s;return(a<<i|a>>>32-i)+t}function u(e,t,r,n,o,i,s){var a=e+(t&n|r&~n)+o+s;return(a<<i|a>>>32-i)+t}function d(e,t,r,n,o,i,s){var a=e+(t^r^n)+o+s;return(a<<i|a>>>32-i)+t}function h(e,t,r,n,o,i,s){var a=e+(r^(t|~n))+o+s;return(a<<i|a>>>32-i)+t}r.MD5=i._createHelper(c),r.HmacMD5=i._createHmacHelper(c)}(Math),e.MD5}(K())}(ce)),ce.exports}var ue,de={exports:{}};function he(){return ue||(ue=1,function(e,t){e.exports=function(e){return r=(t=e).lib,n=r.WordArray,o=r.Hasher,i=t.algo,s=[],a=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(o&i|~o&a):l<40?1859775393+(o^i^a):l<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,c=a,a=i,i=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),e.SHA1;var t,r,n,o,i,s,a}(K())}(de)),de.exports}var fe,pe={exports:{}};function ge(){return fe||(fe=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var l=[],u=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],u=r[5],d=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=l[f-2],v=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;l[f]=g+l[f-7]+v+l[f-16]}var m=n&o^n&i^o&i,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&d)+c[f]+l[f];h=d,d=u,u=a,a=s+C|0,s=i,i=o,o=n,n=C+(b+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=i._createHelper(u),r.HmacSHA256=i._createHmacHelper(u)}(Math),e.SHA256}(K())}(pe)),pe.exports}var ye,ve={exports:{}};var me,be={exports:{}};function Ce(){return me||(me=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,o=n.Word,i=n.WordArray,s=t.algo;function a(){return o.create.apply(o,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var u=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],u=r[5],d=r[6],h=r[7],f=n.high,p=n.low,g=o.high,y=o.low,v=i.high,m=i.low,b=s.high,C=s.low,w=a.high,E=a.low,S=u.high,O=u.low,_=d.high,I=d.low,T=h.high,R=h.low,k=f,N=p,A=g,L=y,M=v,x=m,D=b,B=C,U=w,j=E,P=S,F=O,G=_,q=I,H=T,z=R,K=0;K<80;K++){var V,W,$=l[K];if(K<16)W=$.high=0|e[t+2*K],V=$.low=0|e[t+2*K+1];else{var J=l[K-15],Z=J.high,X=J.low,Y=(Z>>>1|X<<31)^(Z>>>8|X<<24)^Z>>>7,Q=(X>>>1|Z<<31)^(X>>>8|Z<<24)^(X>>>7|Z<<25),ee=l[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ie=l[K-7],se=ie.high,ae=ie.low,ce=l[K-16],le=ce.high,ue=ce.low;W=(W=(W=Y+se+((V=Q+ae)>>>0<Q>>>0?1:0))+ne+((V+=oe)>>>0<oe>>>0?1:0))+le+((V+=ue)>>>0<ue>>>0?1:0),$.high=W,$.low=V}var de,he=U&P^~U&G,fe=j&F^~j&q,pe=k&A^k&M^A&M,ge=N&L^N&x^L&x,ye=(k>>>28|N<<4)^(k<<30|N>>>2)^(k<<25|N>>>7),ve=(N>>>28|k<<4)^(N<<30|k>>>2)^(N<<25|k>>>7),me=(U>>>14|j<<18)^(U>>>18|j<<14)^(U<<23|j>>>9),be=(j>>>14|U<<18)^(j>>>18|U<<14)^(j<<23|U>>>9),Ce=c[K],we=Ce.high,Ee=Ce.low,Se=H+me+((de=z+be)>>>0<z>>>0?1:0),Oe=ve+ge;H=G,z=q,G=P,q=F,P=U,F=j,U=D+(Se=(Se=(Se=Se+he+((de+=fe)>>>0<fe>>>0?1:0))+we+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=V)>>>0<V>>>0?1:0))+((j=B+de|0)>>>0<B>>>0?1:0)|0,D=M,B=x,M=A,x=L,A=k,L=N,k=Se+(ye+pe+(Oe>>>0<ve>>>0?1:0))+((N=de+Oe|0)>>>0<de>>>0?1:0)|0}p=n.low=p+N,n.high=f+k+(p>>>0<N>>>0?1:0),y=o.low=y+L,o.high=g+A+(y>>>0<L>>>0?1:0),m=i.low=m+x,i.high=v+M+(m>>>0<x>>>0?1:0),C=s.low=C+B,s.high=b+D+(C>>>0<B>>>0?1:0),E=a.low=E+j,a.high=w+U+(E>>>0<j>>>0?1:0),O=u.low=O+F,u.high=S+P+(O>>>0<F>>>0?1:0),I=d.low=I+q,d.high=_+G+(I>>>0<q>>>0?1:0),R=h.low=R+z,h.high=T+H+(R>>>0<z>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(K(),$())}(be)),be.exports}var we,Ee={exports:{}};var Se,Oe={exports:{}};function _e(){return Se||(Se=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.x64.Word,a=r.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var a=0,d=0,h=0;h<7;h++){if(1&o){var f=(1<<h)-1;f<32?d^=1<<f:a^=1<<f-32}128&o?o=o<<1^113:o<<=1}u[i]=s.create(a,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=s.create()}();var h=a.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var i=e[t+2*o],s=e[t+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(R=r[o]).high^=s,R.low^=i}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,g=0;g<5;g++)f^=(R=r[h+5*g]).high,p^=R.low;var y=d[h];y.high=f,y.low=p}for(h=0;h<5;h++){var v=d[(h+4)%5],m=d[(h+1)%5],b=m.high,C=m.low;for(f=v.high^(b<<1|C>>>31),p=v.low^(C<<1|b>>>31),g=0;g<5;g++)(R=r[h+5*g]).high^=f,R.low^=p}for(var w=1;w<25;w++){var E=(R=r[w]).high,S=R.low,O=c[w];O<32?(f=E<<O|S>>>32-O,p=S<<O|E>>>32-O):(f=S<<O-32|E>>>64-O,p=E<<O-32|S>>>64-O);var _=d[l[w]];_.high=f,_.low=p}var I=d[0],T=r[0];for(I.high=T.high,I.low=T.low,h=0;h<5;h++)for(g=0;g<5;g++){var R=r[w=h+5*g],k=d[w],N=d[(h+1)%5+5*g],A=d[(h+2)%5+5*g];R.high=k.high^~N.high&A.high,R.low=k.low^~N.low&A.low}R=r[0];var L=u[a];R.high^=L.high,R.low^=L.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,i=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/i)*i>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,l=[],u=0;u<c;u++){var d=s[u],h=d.high,f=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new o.init(l,a)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=i._createHelper(h),r.HmacSHA3=i._createHmacHelper(h)}(Math),e.SHA3}(K(),$())}(Oe)),Oe.exports}var Ie,Te={exports:{}};var Re,ke={exports:{}};function Ne(){return Re||(Re=1,function(e,t){e.exports=function(e){var t,r,n;r=(t=e).lib.Base,n=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,o=4*r;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),a=i.words,c=s.words,l=0;l<r;l++)a[l]^=1549556828,c[l]^=909522486;i.sigBytes=s.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(K())}(ke)),ke.exports}var Ae,Le={exports:{}};var Me,xe={exports:{}};function De(){return Me||(Me=1,function(e,t){e.exports=function(e){return r=(t=e).lib,n=r.Base,o=r.WordArray,i=t.algo,s=i.MD5,a=i.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),s=o.create(),a=s.words,c=n.keySize,l=n.iterations;a.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var u=1;u<l;u++)r=i.finalize(r),i.reset();s.concat(r)}return s.sigBytes=4*c,s}}),t.EvpKDF=function(e,t,r){return a.create(r).compute(e,t)},e.EvpKDF;var t,r,n,o,i,s,a}(K(),he(),Ne())}(xe)),xe.exports}var Be,Ue={exports:{}};function je(){return Be||(Be=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,o=n.Base,i=n.WordArray,s=n.BufferedBlockAlgorithm,a=r.enc;a.Utf8;var c=a.Base64,l=r.algo.EvpKDF,u=n.Cipher=s.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:v}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()});n.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=d.CBC=function(){var e=h.extend();function r(e,r,n){var o,i=this._iv;i?(o=i,this._iv=t):o=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=o[s]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=i}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(o);var c=i.create(s,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var g=n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),g.create({ciphertext:r,salt:t})}},v=n.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),i=o.finalize(t),s=o.cfg;return g.create({ciphertext:i,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=i.random(8));var o=l.create({keySize:t+r}).compute(e,n),s=i.create(o.words.slice(t),4*r);return o.sigBytes=4*t,g.create({key:o,iv:s,salt:n})}},b=n.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:m}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=o.iv;var i=v.encrypt.call(this,e,t,o.key,n);return i.mixIn(o),i},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=o.iv,v.decrypt.call(this,e,t,o.key,n)}})}()}(K(),De())}(Ue)),Ue.exports}var Pe,Fe={exports:{}};function Ge(){return Pe||(Pe=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,n.encryptBlock(o,0);for(var s=0;s<r;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);r.call(this,e,t,o,n),this._prevBlock=i}}),t}(),e.mode.CFB}(K(),je())}(Fe)),Fe.exports}var qe,He={exports:{}};function ze(){return qe||(qe=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);r.encryptBlock(s,0),i[n-1]=i[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(K(),je())}(He)),He.exports}var Ke,Ve={exports:{}};function We(){return Ke||(Ke=1,function(e,t){e.exports=function(e){
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ACIMLib={})}(this,(function(e){"use strict";var t,r;e.ConnectionStatus=void 0,(t=e.ConnectionStatus||(e.ConnectionStatus={}))[t.CONNECTED=0]="CONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.DISCONNECTED=2]="DISCONNECTED",t[t.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",t[t.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",t[t.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",t[t.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",t[t.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",t[t.BLOCKED=9]="BLOCKED",t[t.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER",e.ErrorCode=void 0,(r=e.ErrorCode||(e.ErrorCode={}))[r.TIMEOUT=-1]="TIMEOUT",r[r.UNKNOWN=-2]="UNKNOWN",r[r.PARAMETER_ERROR=-3]="PARAMETER_ERROR",r[r.SUCCESS=0]="SUCCESS",r[r.NETWORK_ERROR=7]="NETWORK_ERROR",r[r.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",r[r.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",r[r.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",r[r.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",r[r.RECALL_MESSAGE=25101]="RECALL_MESSAGE",r[r.NOT_IN_GROUP=22406]="NOT_IN_GROUP",r[r.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",r[r.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",r[r.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",r[r.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",r[r.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",r[r.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",r[r.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",r[r.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",r[r.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",r[r.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",r[r.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",r[r.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",r[r.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",r[r.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",r[r.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",r[r.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",r[r.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",r[r.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",r[r.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",r[r.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",r[r.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",r[r.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",r[r.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",r[r.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",r[r.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",r[r.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",r[r.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",r[r.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",r[r.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",r[r.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",r[r.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",r[r.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",r[r.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",r[r.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",r[r.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",r[r.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",r[r.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",r[r.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",r[r.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",r[r.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",r[r.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",r[r.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",r[r.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",r[r.NOT_SUPPORT=39002]="NOT_SUPPORT";const n=t=>e.ErrorCode[t];var o,i,s,a,c,l,u,d;function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.ConversationType=void 0,(o=e.ConversationType||(e.ConversationType={}))[o.PRIVATE=1]="PRIVATE",o[o.GROUP=3]="GROUP",o[o.ULTRA_GROUP=10]="ULTRA_GROUP",e.MentionedType=void 0,(i=e.MentionedType||(e.MentionedType={}))[i.ALL=1]="ALL",i[i.SINGAL=2]="SINGAL",e.NotificationStatus=void 0,(s=e.NotificationStatus||(e.NotificationStatus={}))[s.OPEN=1]="OPEN",s[s.CLOSE=2]="CLOSE",e.MessageDirection=void 0,(a=e.MessageDirection||(e.MessageDirection={}))[a.SEND=1]="SEND",a[a.RECEIVE=2]="RECEIVE",e.ReceivedStatus=void 0,(c=e.ReceivedStatus||(e.ReceivedStatus={}))[c.READ=1]="READ",c[c.LISTENED=2]="LISTENED",c[c.DOWNLOADED=4]="DOWNLOADED",c[c.RETRIEVED=8]="RETRIEVED",c[c.UNREAD=0]="UNREAD",e.NotificationLevel=void 0,(l=e.NotificationLevel||(e.NotificationLevel={}))[l.ALL_MESSAGE=-1]="ALL_MESSAGE",l[l.NOT_SET=0]="NOT_SET",l[l.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",l[l.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",l[l.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",l[l.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION",e.LogLevel=void 0,(u=e.LogLevel||(e.LogLevel={}))[u.DEBUG=0]="DEBUG",u[u.INFO=1]="INFO",u[u.WARN=2]="WARN",u[u.ERROR=3]="ERROR",u[u.FATAL=4]="FATAL",u[u.NONE=1e3]="NONE",e.Events=void 0,(d=e.Events||(e.Events={})).CONNECTING="CONNECTING",d.CONNECTED="CONNECTED",d.DISCONNECT="DISCONNECT",d.SUSPEND="SUSPEND",d.MESSAGES="MESSAGES",d.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",d.CONVERSATION="CONVERSATION";var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};var y,v={exports:{}};function m(){return y||(y=1,function(e,t){e.exports=function(){var e=e||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==f&&f.crypto&&(r=f.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),i={},s=i.lib={},a=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=s.WordArray=a.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(var a=0;a<o;a+=4)t[n+a>>>2]=r[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(n());return new c.init(t,e)}}),l=i.enc={},u=l.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},h=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,o=n.words,i=n.sigBytes,s=this.blockSize,a=i/(4*s),l=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*l,i);if(l){for(var d=0;d<l;d+=s)this._doProcessBlock(o,d);r=o.splice(0,l),n.sigBytes-=u}return new c.init(r,u)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=p.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new g.HMAC.init(e,r).finalize(t)}}});var g=i.algo={};return i}(Math);return e}()}(v)),v.exports}var b,C={exports:{}};function w(){return b||(b=1,function(e,t){e.exports=function(e){return n=(r=e).lib,o=n.Base,i=n.WordArray,(s=r.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=o.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n<t;n++){var o=e[n];r.push(o.high),r.push(o.low)}return i.create(r,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),r=t.length,n=0;n<r;n++)t[n]=t[n].clone();return e}}),e;var t,r,n,o,i,s}(m())}(C)),C.exports}var E,S={exports:{}};function O(){return E||(E=1,function(e,t){e.exports=function(e){return function(){if("function"==typeof ArrayBuffer){var t=e.lib.WordArray,r=t.init,n=t.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var t=e.byteLength,n=[],o=0;o<t;o++)n[o>>>2]|=e[o]<<24-o%4*8;r.call(this,n,t)}else r.apply(this,arguments)};n.prototype=t}}(),e.lib.WordArray}(m())}(S)),S.exports}var _,I={exports:{}};function T(){return _||(_=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray,n=t.enc;function o(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o+=2){var i=t[o>>>2]>>>16-o%4*8&65535;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,n=[],o=0;o<t;o++)n[o>>>1]|=e.charCodeAt(o)<<16-o%2*16;return r.create(n,2*t)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i+=2){var s=o(t[i>>>2]>>>16-i%4*8&65535);n.push(String.fromCharCode(s))}return n.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>1]|=o(e.charCodeAt(i)<<16-i%2*16);return r.create(n,2*t)}}}(),e.enc.Utf16}(m())}(I)),I.exports}var R,k={exports:{}};function N(){return R||(R=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<r.length;i++)o[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return n(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),e.enc.Base64}(m())}(k)),k.exports}var A,L={exports:{}};function M(){return A||(A=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.WordArray;function n(e,t,n){for(var o=[],i=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2|n[e.charCodeAt(s)]>>>6-s%4*2;o[i>>>2]|=a<<24-i%4*8,i++}return r.create(o,i)}t.enc.Base64url={stringify:function(e,t=!0){var r=e.words,n=e.sigBytes,o=t?this._safe_map:this._map;e.clamp();for(var i=[],s=0;s<n;s+=3)for(var a=(r[s>>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<n;c++)i.push(o.charAt(a>>>6*(3-c)&63));var l=o.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(e,t=!0){var r=e.length,o=t?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<o.length;s++)i[o.charCodeAt(s)]=s}var a=o.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(r=c)}return n(e,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),e.enc.Base64url}(m())}(L)),L.exports}var D,x={exports:{}};function B(){return D||(D=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],y=e[t+5],v=e[t+6],m=e[t+7],b=e[t+8],C=e[t+9],w=e[t+10],E=e[t+11],S=e[t+12],O=e[t+13],_=e[t+14],I=e[t+15],T=i[0],R=i[1],k=i[2],N=i[3];T=l(T,R,k,N,s,7,a[0]),N=l(N,T,R,k,c,12,a[1]),k=l(k,N,T,R,f,17,a[2]),R=l(R,k,N,T,p,22,a[3]),T=l(T,R,k,N,g,7,a[4]),N=l(N,T,R,k,y,12,a[5]),k=l(k,N,T,R,v,17,a[6]),R=l(R,k,N,T,m,22,a[7]),T=l(T,R,k,N,b,7,a[8]),N=l(N,T,R,k,C,12,a[9]),k=l(k,N,T,R,w,17,a[10]),R=l(R,k,N,T,E,22,a[11]),T=l(T,R,k,N,S,7,a[12]),N=l(N,T,R,k,O,12,a[13]),k=l(k,N,T,R,_,17,a[14]),T=u(T,R=l(R,k,N,T,I,22,a[15]),k,N,c,5,a[16]),N=u(N,T,R,k,v,9,a[17]),k=u(k,N,T,R,E,14,a[18]),R=u(R,k,N,T,s,20,a[19]),T=u(T,R,k,N,y,5,a[20]),N=u(N,T,R,k,w,9,a[21]),k=u(k,N,T,R,I,14,a[22]),R=u(R,k,N,T,g,20,a[23]),T=u(T,R,k,N,C,5,a[24]),N=u(N,T,R,k,_,9,a[25]),k=u(k,N,T,R,p,14,a[26]),R=u(R,k,N,T,b,20,a[27]),T=u(T,R,k,N,O,5,a[28]),N=u(N,T,R,k,f,9,a[29]),k=u(k,N,T,R,m,14,a[30]),T=d(T,R=u(R,k,N,T,S,20,a[31]),k,N,y,4,a[32]),N=d(N,T,R,k,b,11,a[33]),k=d(k,N,T,R,E,16,a[34]),R=d(R,k,N,T,_,23,a[35]),T=d(T,R,k,N,c,4,a[36]),N=d(N,T,R,k,g,11,a[37]),k=d(k,N,T,R,m,16,a[38]),R=d(R,k,N,T,w,23,a[39]),T=d(T,R,k,N,O,4,a[40]),N=d(N,T,R,k,s,11,a[41]),k=d(k,N,T,R,p,16,a[42]),R=d(R,k,N,T,v,23,a[43]),T=d(T,R,k,N,C,4,a[44]),N=d(N,T,R,k,S,11,a[45]),k=d(k,N,T,R,I,16,a[46]),T=h(T,R=d(R,k,N,T,f,23,a[47]),k,N,s,6,a[48]),N=h(N,T,R,k,m,10,a[49]),k=h(k,N,T,R,_,15,a[50]),R=h(R,k,N,T,y,21,a[51]),T=h(T,R,k,N,S,6,a[52]),N=h(N,T,R,k,p,10,a[53]),k=h(k,N,T,R,w,15,a[54]),R=h(R,k,N,T,c,21,a[55]),T=h(T,R,k,N,b,6,a[56]),N=h(N,T,R,k,I,10,a[57]),k=h(k,N,T,R,v,15,a[58]),R=h(R,k,N,T,O,21,a[59]),T=h(T,R,k,N,g,6,a[60]),N=h(N,T,R,k,E,10,a[61]),k=h(k,N,T,R,f,15,a[62]),R=h(R,k,N,T,C,21,a[63]),i[0]=i[0]+T|0,i[1]=i[1]+R|0,i[2]=i[2]+k|0,i[3]=i[3]+N|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;r[o>>>5]|=128<<24-o%32;var i=t.floor(n/4294967296),s=n;r[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),r[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,c=a.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,n,o,i,s){var a=e+(t&r|~t&n)+o+s;return(a<<i|a>>>32-i)+t}function u(e,t,r,n,o,i,s){var a=e+(t&n|r&~n)+o+s;return(a<<i|a>>>32-i)+t}function d(e,t,r,n,o,i,s){var a=e+(t^r^n)+o+s;return(a<<i|a>>>32-i)+t}function h(e,t,r,n,o,i,s){var a=e+(r^(t|~n))+o+s;return(a<<i|a>>>32-i)+t}r.MD5=i._createHelper(c),r.HmacMD5=i._createHmacHelper(c)}(Math),e.MD5}(m())}(x)),x.exports}var U,j={exports:{}};function P(){return U||(U=1,function(e,t){e.exports=function(e){return r=(t=e).lib,n=r.WordArray,o=r.Hasher,i=t.algo,s=[],a=i.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],a=r[3],c=r[4],l=0;l<80;l++){if(l<16)s[l]=0|e[t+l];else{var u=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=u<<1|u>>>31}var d=(n<<5|n>>>27)+c+s[l];d+=l<20?1518500249+(o&i|~o&a):l<40?1859775393+(o^i^a):l<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,c=a,a=i,i=o<<30|o>>>2,o=n,n=d}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a),e.SHA1;var t,r,n,o,i,s,a}(m())}(j)),j.exports}var F,G={exports:{}};function q(){return F||(F=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=[],c=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)e(n)&&(o<8&&(a[o]=r(t.pow(n,.5))),c[o]=r(t.pow(n,1/3)),o++),n++}();var l=[],u=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],u=r[5],d=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,y=l[f-2],v=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;l[f]=g+l[f-7]+v+l[f-16]}var m=n&o^n&i^o&i,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),C=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&d)+c[f]+l[f];h=d,d=u,u=a,a=s+C|0,s=i,i=o,o=n,n=C+(b+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+d|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,o=8*e.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});r.SHA256=i._createHelper(u),r.HmacSHA256=i._createHmacHelper(u)}(Math),e.SHA256}(m())}(G)),G.exports}var H,z={exports:{}};var K,V={exports:{}};function W(){return K||(K=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.Hasher,n=t.x64,o=n.Word,i=n.WordArray,s=t.algo;function a(){return o.create.apply(o,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var u=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],u=r[5],d=r[6],h=r[7],f=n.high,p=n.low,g=o.high,y=o.low,v=i.high,m=i.low,b=s.high,C=s.low,w=a.high,E=a.low,S=u.high,O=u.low,_=d.high,I=d.low,T=h.high,R=h.low,k=f,N=p,A=g,L=y,M=v,D=m,x=b,B=C,U=w,j=E,P=S,F=O,G=_,q=I,H=T,z=R,K=0;K<80;K++){var V,W,$=l[K];if(K<16)W=$.high=0|e[t+2*K],V=$.low=0|e[t+2*K+1];else{var J=l[K-15],Z=J.high,X=J.low,Y=(Z>>>1|X<<31)^(Z>>>8|X<<24)^Z>>>7,Q=(X>>>1|Z<<31)^(X>>>8|Z<<24)^(X>>>7|Z<<25),ee=l[K-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,oe=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),ie=l[K-7],se=ie.high,ae=ie.low,ce=l[K-16],le=ce.high,ue=ce.low;W=(W=(W=Y+se+((V=Q+ae)>>>0<Q>>>0?1:0))+ne+((V+=oe)>>>0<oe>>>0?1:0))+le+((V+=ue)>>>0<ue>>>0?1:0),$.high=W,$.low=V}var de,he=U&P^~U&G,fe=j&F^~j&q,pe=k&A^k&M^A&M,ge=N&L^N&D^L&D,ye=(k>>>28|N<<4)^(k<<30|N>>>2)^(k<<25|N>>>7),ve=(N>>>28|k<<4)^(N<<30|k>>>2)^(N<<25|k>>>7),me=(U>>>14|j<<18)^(U>>>18|j<<14)^(U<<23|j>>>9),be=(j>>>14|U<<18)^(j>>>18|U<<14)^(j<<23|U>>>9),Ce=c[K],we=Ce.high,Ee=Ce.low,Se=H+me+((de=z+be)>>>0<z>>>0?1:0),Oe=ve+ge;H=G,z=q,G=P,q=F,P=U,F=j,U=x+(Se=(Se=(Se=Se+he+((de+=fe)>>>0<fe>>>0?1:0))+we+((de+=Ee)>>>0<Ee>>>0?1:0))+W+((de+=V)>>>0<V>>>0?1:0))+((j=B+de|0)>>>0<B>>>0?1:0)|0,x=M,B=D,M=A,D=L,A=k,L=N,k=Se+(ye+pe+(Oe>>>0<ve>>>0?1:0))+((N=de+Oe|0)>>>0<de>>>0?1:0)|0}p=n.low=p+N,n.high=f+k+(p>>>0<N>>>0?1:0),y=o.low=y+L,o.high=g+A+(y>>>0<L>>>0?1:0),m=i.low=m+D,i.high=v+M+(m>>>0<D>>>0?1:0),C=s.low=C+B,s.high=b+x+(C>>>0<B>>>0?1:0),E=a.low=E+j,a.high=w+U+(E>>>0<j>>>0?1:0),O=u.low=O+F,u.high=S+P+(O>>>0<F>>>0?1:0),I=d.low=I+q,d.high=_+G+(I>>>0<q>>>0?1:0),R=h.low=R+z,h.high=T+H+(R>>>0<z>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});t.SHA512=r._createHelper(u),t.HmacSHA512=r._createHmacHelper(u)}(),e.SHA512}(m(),w())}(V)),V.exports}var $,J={exports:{}};var Z,X={exports:{}};function Y(){return Z||(Z=1,function(e,t){e.exports=function(e){return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.x64.Word,a=r.algo,c=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var o=1,i=0;i<24;i++){for(var a=0,d=0,h=0;h<7;h++){if(1&o){var f=(1<<h)-1;f<32?d^=1<<f:a^=1<<f-32}128&o?o=o<<1^113:o<<=1}u[i]=s.create(a,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=s.create()}();var h=a.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,n=this.blockSize/2,o=0;o<n;o++){var i=e[t+2*o],s=e[t+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(R=r[o]).high^=s,R.low^=i}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,g=0;g<5;g++)f^=(R=r[h+5*g]).high,p^=R.low;var y=d[h];y.high=f,y.low=p}for(h=0;h<5;h++){var v=d[(h+4)%5],m=d[(h+1)%5],b=m.high,C=m.low;for(f=v.high^(b<<1|C>>>31),p=v.low^(C<<1|b>>>31),g=0;g<5;g++)(R=r[h+5*g]).high^=f,R.low^=p}for(var w=1;w<25;w++){var E=(R=r[w]).high,S=R.low,O=c[w];O<32?(f=E<<O|S>>>32-O,p=S<<O|E>>>32-O):(f=S<<O-32|E>>>64-O,p=E<<O-32|S>>>64-O);var _=d[l[w]];_.high=f,_.low=p}var I=d[0],T=r[0];for(I.high=T.high,I.low=T.low,h=0;h<5;h++)for(g=0;g<5;g++){var R=r[w=h+5*g],k=d[w],N=d[(h+1)%5+5*g],A=d[(h+2)%5+5*g];R.high=k.high^~N.high&A.high,R.low=k.low^~N.low&A.low}R=r[0];var L=u[a];R.high^=L.high,R.low^=L.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var n=8*e.sigBytes,i=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/i)*i>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,l=[],u=0;u<c;u++){var d=s[u],h=d.high,f=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new o.init(l,a)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});r.SHA3=i._createHelper(h),r.HmacSHA3=i._createHmacHelper(h)}(Math),e.SHA3}(m(),w())}(X)),X.exports}var Q,ee={exports:{}};var te,re={exports:{}};function ne(){return te||(te=1,function(e,t){e.exports=function(e){var t,r,n;r=(t=e).lib.Base,n=t.enc.Utf8,t.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,o=4*r;t.sigBytes>o&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),s=this._iKey=t.clone(),a=i.words,c=s.words,l=0;l<r;l++)a[l]^=1549556828,c[l]^=909522486;i.sigBytes=s.sigBytes=o,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})}(m())}(re)),re.exports}var oe,ie={exports:{}};var se,ae={exports:{}};function ce(){return se||(se=1,function(e,t){e.exports=function(e){return r=(t=e).lib,n=r.Base,o=r.WordArray,i=t.algo,s=i.MD5,a=i.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),s=o.create(),a=s.words,c=n.keySize,l=n.iterations;a.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var u=1;u<l;u++)r=i.finalize(r),i.reset();s.concat(r)}return s.sigBytes=4*c,s}}),t.EvpKDF=function(e,t,r){return a.create(r).compute(e,t)},e.EvpKDF;var t,r,n,o,i,s,a}(m(),P(),ne())}(ae)),ae.exports}var le,ue={exports:{}};function de(){return le||(le=1,function(e,t){e.exports=function(e){e.lib.Cipher||function(t){var r=e,n=r.lib,o=n.Base,i=n.WordArray,s=n.BufferedBlockAlgorithm,a=r.enc;a.Utf8;var c=a.Base64,l=r.algo.EvpKDF,u=n.Cipher=s.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:v}return function(t){return{encrypt:function(r,n,o){return e(n).encrypt(t,r,n,o)},decrypt:function(r,n,o){return e(n).decrypt(t,r,n,o)}}}}()});n.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var d=r.mode={},h=n.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),f=d.CBC=function(){var e=h.extend();function r(e,r,n){var o,i=this._iv;i?(o=i,this._iv=t):o=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=o[s]}return e.Encryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+o)}}),e.Decryptor=e.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);n.decryptBlock(e,t),r.call(this,e,t,o),this._prevBlock=i}}),e}(),p=(r.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,o=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(o);var c=i.create(s,n);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=u.extend({cfg:u.cfg.extend({mode:f,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var g=n.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?i.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=i.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),g.create({ciphertext:r,salt:t})}},v=n.SerializableCipher=o.extend({cfg:o.extend({format:y}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var o=e.createEncryptor(r,n),i=o.finalize(t),s=o.cfg;return g.create({ciphertext:i,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(r.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=i.random(8));var o=l.create({keySize:t+r}).compute(e,n),s=i.create(o.words.slice(t),4*r);return o.sigBytes=4*t,g.create({key:o,iv:s,salt:n})}},b=n.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:m}),encrypt:function(e,t,r,n){var o=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=o.iv;var i=v.encrypt.call(this,e,t,o.key,n);return i.mixIn(o),i},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var o=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=o.iv,v.decrypt.call(this,e,t,o.key,n)}})}()}(m(),ce())}(ue)),ue.exports}var he,fe={exports:{}};function pe(){return he||(he=1,function(e,t){e.exports=function(e){return e.mode.CFB=function(){var t=e.lib.BlockCipherMode.extend();function r(e,t,r,n){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,n.encryptBlock(o,0);for(var s=0;s<r;s++)e[t+s]^=o[s]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize;r.call(this,e,t,o,n),this._prevBlock=e.slice(t,t+o)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,o=n.blockSize,i=e.slice(t,t+o);r.call(this,e,t,o,n),this._prevBlock=i}}),t}(),e.mode.CFB}(m(),de())}(fe)),fe.exports}var ge,ye={exports:{}};function ve(){return ge||(ge=1,function(e,t){e.exports=function(e){return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var s=i.slice(0);r.encryptBlock(s,0),i[n-1]=i[n-1]+1|0;for(var a=0;a<n;a++)e[t+a]^=s[a]}}),t.Decryptor=r,t),e.mode.CTR;var t,r}(m(),de())}(ye)),ye.exports}var me,be={exports:{}};function Ce(){return me||(me=1,function(e,t){e.exports=function(e){
2
2
  /** @preserve
3
3
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
4
4
  * derived from CryptoJS.mode.CTR
5
5
  * Jan Hruby jhruby.web@gmail.com
6
6
  */
7
- return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=this._iv,s=this._counter;i&&(s=this._counter=i.slice(0),this._iv=void 0),n(s);var a=s.slice(0);r.encryptBlock(a,0);for(var c=0;c<o;c++)e[t+c]^=a[c]}});return t.Decryptor=o,t}(),e.mode.CTRGladman}(K(),je())}(Ve)),Ve.exports}var $e,Je={exports:{}};function Ze(){return $e||($e=1,function(e,t){e.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(i,0);for(var s=0;s<n;s++)e[t+s]^=i[s]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(K(),je())}(Je)),Je.exports}var Xe,Ye={exports:{}};var Qe,et={exports:{}};var tt,rt={exports:{}};var nt,ot={exports:{}};var it,st={exports:{}};var at,ct={exports:{}};var lt,ut={exports:{}};var dt,ht={exports:{}};var ft,pt={exports:{}};function gt(){return ft||(ft=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.BlockCipher,i=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var l=o[i]=[],u=c[i];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],i=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=l[c][((s^o[c])&u[c])>>>0];this._lBlock=s,this._rBlock=i^a}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=o._createHelper(d);var p=i.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(p)}(),e.TripleDES}(K(),ne(),le(),De(),je())}(pt)),pt.exports}var yt,vt={exports:{}};var mt,bt={exports:{}};var Ct,wt={exports:{}};!function(e,t){e.exports=function(e){return e}(K(),$(),X(),ee(),ne(),se(),le(),he(),ge(),ye||(ye=1,function(e,t){e.exports=function(e){return r=(t=e).lib.WordArray,n=t.algo,o=n.SHA256,i=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=o._createHelper(i),t.HmacSHA224=o._createHmacHelper(i),e.SHA224;var t,r,n,o,i}(K(),ge())}(ve)),Ce(),we||(we=1,function(e,t){e.exports=function(e){return r=(t=e).x64,n=r.Word,o=r.WordArray,i=t.algo,s=i.SHA512,a=i.SHA384=s.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a),e.SHA384;var t,r,n,o,i,s,a}(K(),$(),Ce())}(Ee)),_e(),Ie||(Ie=1,function(e,t){e.exports=function(e){
7
+ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();function r(e){if(255==(e>>24&255)){var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}else e+=1<<24;return e}function n(e){return 0===(e[0]=r(e[0]))&&(e[1]=r(e[1])),e}var o=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,o=r.blockSize,i=this._iv,s=this._counter;i&&(s=this._counter=i.slice(0),this._iv=void 0),n(s);var a=s.slice(0);r.encryptBlock(a,0);for(var c=0;c<o;c++)e[t+c]^=a[c]}});return t.Decryptor=o,t}(),e.mode.CTRGladman}(m(),de())}(be)),be.exports}var we,Ee={exports:{}};function Se(){return we||(we=1,function(e,t){e.exports=function(e){return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),r.encryptBlock(i,0);for(var s=0;s<n;s++)e[t+s]^=i[s]}}),t.Decryptor=r,t),e.mode.OFB;var t,r}(m(),de())}(Ee)),Ee.exports}var Oe,_e={exports:{}};var Ie,Te={exports:{}};var Re,ke={exports:{}};var Ne,Ae={exports:{}};var Le,Me={exports:{}};var De,xe={exports:{}};var Be,Ue={exports:{}};var je,Pe={exports:{}};var Fe,Ge={exports:{}};function qe(){return Fe||(Fe=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib,n=r.WordArray,o=r.BlockCipher,i=t.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=i.DES=o.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var n=s[r]-1;t[r]=e[n>>>5]>>>31-n%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var l=o[i]=[],u=c[i];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var d=this._invSubKeys=[];for(r=0;r<16;r++)d[r]=o[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var n=0;n<16;n++){for(var o=r[n],i=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=l[c][((s^o[c])&u[c])>>>0];this._lBlock=s,this._rBlock=i^a}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<<e}function f(e,t){var r=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<<e}t.DES=o._createHelper(d);var p=i.TripleDES=o.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),o=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(r)),this._des3=d.createEncryptor(n.create(o))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(p)}(),e.TripleDES}(m(),N(),B(),ce(),de())}(Ge)),Ge.exports}var He,ze={exports:{}};var Ke,Ve={exports:{}};var We,$e={exports:{}};!function(e,t){e.exports=function(e){return e}(m(),w(),O(),T(),N(),M(),B(),P(),q(),H||(H=1,function(e,t){e.exports=function(e){return r=(t=e).lib.WordArray,n=t.algo,o=n.SHA256,i=n.SHA224=o.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=o._createHelper(i),t.HmacSHA224=o._createHmacHelper(i),e.SHA224;var t,r,n,o,i}(m(),q())}(z)),W(),$||($=1,function(e,t){e.exports=function(e){return r=(t=e).x64,n=r.Word,o=r.WordArray,i=t.algo,s=i.SHA512,a=i.SHA384=s.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=s._createHelper(a),t.HmacSHA384=s._createHmacHelper(a),e.SHA384;var t,r,n,o,i,s,a}(m(),w(),W())}(J)),Y(),Q||(Q=1,function(e,t){e.exports=function(e){
8
8
  /** @preserve
9
9
  (c) 2012 by Cédric Mesnil. All rights reserved.
10
10
 
@@ -15,7 +15,7 @@ return e.mode.CTRGladman=function(){var t=e.lib.BlockCipherMode.extend();functio
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17
17
  */
18
- return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),h=o.create([1352829926,1548603684,1836072691,2053994217,0]),f=s.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,s,f,C,w,E,S,O,_,I,T,R=this._hash.words,k=d.words,N=h.words,A=a.words,L=c.words,M=l.words,x=u.words;for(E=i=R[0],S=s=R[1],O=f=R[2],_=C=R[3],I=w=R[4],r=0;r<80;r+=1)T=i+e[t+A[r]]|0,T+=r<16?p(s,f,C)+k[0]:r<32?g(s,f,C)+k[1]:r<48?y(s,f,C)+k[2]:r<64?v(s,f,C)+k[3]:m(s,f,C)+k[4],T=(T=b(T|=0,M[r]))+w|0,i=w,w=C,C=b(f,10),f=s,s=T,T=E+e[t+L[r]]|0,T+=r<16?m(S,O,_)+N[0]:r<32?v(S,O,_)+N[1]:r<48?y(S,O,_)+N[2]:r<64?g(S,O,_)+N[3]:p(S,O,_)+N[4],T=(T=b(T|=0,x[r]))+I|0,E=I,I=_,_=b(O,10),O=S,S=T;T=R[1]+f+_|0,R[1]=R[2]+C+I|0,R[2]=R[3]+w+E|0,R[3]=R[4]+i+S|0,R[4]=R[0]+s+O|0,R[0]=T},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function y(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}r.RIPEMD160=i._createHelper(f),r.HmacRIPEMD160=i._createHmacHelper(f)}(),e.RIPEMD160}(K())}(Te)),Ne(),Ae||(Ae=1,function(e,t){e.exports=function(e){return n=(r=(t=e).lib).Base,o=r.WordArray,s=(i=t.algo).SHA1,a=i.HMAC,c=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),i=o.create(),s=o.create([1]),c=i.words,l=s.words,u=r.keySize,d=r.iterations;c.length<u;){var h=n.update(t).finalize(s);n.reset();for(var f=h.words,p=f.length,g=h,y=1;y<d;y++){g=n.finalize(g),n.reset();for(var v=g.words,m=0;m<p;m++)f[m]^=v[m]}i.concat(h),l[0]++}return i.sigBytes=4*u,i}}),t.PBKDF2=function(e,t,r){return c.create(r).compute(e,t)},e.PBKDF2;var t,r,n,o,i,s,a,c}(K(),he(),Ne())}(Le)),De(),je(),Ge(),ze(),We(),Ze(),Xe||(Xe=1,function(e,t){e.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(K(),je())}(Ye)),Qe||(Qe=1,function(e,t){e.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,i=r+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(K(),je())}(et)),tt||(tt=1,function(e,t){e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(K(),je())}(rt)),nt||(nt=1,function(e,t){e.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(K(),je())}(ot)),it||(it=1,function(e,t){e.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(K(),je())}(st)),at||(at=1,function(e,t){e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(K(),je())}(ct)),lt||(lt=1,function(e,t){e.exports=function(e){return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,n}(K(),je())}(ut)),dt||(dt=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],u=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,o[r]=p,i[p]=r;var g=e[r],y=e[g],v=e[y],m=257*e[p]^16843008*p;s[r]=m<<24|m>>>8,a[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,l[r]=m,m=16843009*v^65537*y^257*g^16843008*r,u[p]=m<<24|m>>>8,d[p]=m<<16|m>>>16,h[p]=m<<8|m>>>24,f[p]=m,r?(r=g^e[e[e[v^g]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],s=0;s<n;s++)s<r?i[s]=t[s]:(l=i[s-1],s%r?r>6&&s%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=p[s/r|0]<<24),i[s]=i[s-r]^l);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(s=n-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^h[o[l>>>8&255]]^f[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,f,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,i,s,a){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p<c;p++){var g=n[l>>>24]^o[u>>>16&255]^i[d>>>8&255]^s[255&h]^r[f++],y=n[u>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&l]^r[f++],v=n[d>>>24]^o[h>>>16&255]^i[l>>>8&255]^s[255&u]^r[f++],m=n[h>>>24]^o[l>>>16&255]^i[u>>>8&255]^s[255&d]^r[f++];l=g,u=y,d=v,h=m}g=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^r[f++],y=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],v=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[f++],m=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^r[f++],e[t]=g,e[t+1]=y,e[t+2]=v,e[t+3]=m},keySize:8});t.AES=r._createHelper(g)}(),e.AES}(K(),ne(),le(),De(),je())}(ht)),gt(),yt||(yt=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var i=0;o<256;o++){var s=o%r,a=t[s>>>2]>>>24-s%4*8&255;i=(i+n[o]+a)%256;var c=n[o];n[o]=n[i],n[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}t.RC4=r._createHelper(o);var s=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=r._createHelper(s)}(),e.RC4}(K(),ne(),le(),De(),je())}(vt)),mt||(mt=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],s=[],a=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=h,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=h,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=r._createHelper(a)}(),e.Rabbit}(K(),ne(),le(),De(),je())}(bt)),Ct||(Ct=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],s=[],a=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=h,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=r._createHelper(a)}(),e.RabbitLegacy}(K(),ne(),le(),De(),je())}(wt)))}(q);var Et=q.exports;const St=e=>Object.keys(e),Ot=e=>{const t={};return Object.keys(e).forEach((r=>{const n=e[r];p(n)&&(t[r]=b(n)?Ot(n):n)})),t},_t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=null;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];r||(r=setTimeout((()=>{e.call(null,...o),r=null}),t))}},It=Et.enc.Utf8.parse("skdjhfgc9829kslf"),Tt=Et.enc.Utf8.parse("qwdkshjf9838jsdf"),Rt={get:function(e){let t=localStorage.getItem(e);if(!p(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){p(t)?localStorage.setItem(e,JSON.stringify(t)):this.remove(e)},remove:function(e){localStorage.removeItem(e)}},kt={get:function(e){let t=localStorage.getItem(e);if(p(t)){const e=Et.enc.Hex.parse(t),r=Et.enc.Base64.stringify(e);t=Et.AES.decrypt(r,It,{iv:Tt}).toString(Et.enc.Utf8)}if(!p(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){if(p(t)){const r=Et.AES.encrypt(JSON.stringify(t),It,{iv:Tt}).ciphertext.toString();localStorage.setItem(e,r)}else this.remove(e)},remove:function(e){localStorage.removeItem(e)}},Nt="ACIM-";class At{constructor(e){h(this,"cache",void 0),h(this,"storageKey",void 0),h(this,"saveFunc",void 0);const t=e?`ACIM-${e}`:Nt,r=Rt.get(t)||{};this.cache=r,this.storageKey=t,this.saveFunc=_t((()=>{Rt.set(this.storageKey,this.cache)}),10)}set(e,t){this.cache[e]=t,this.saveFunc()}remove(e){delete this.cache[e],this.saveFunc()}clear(){Rt.remove(this.storageKey),this.cache={}}get(e){return this.cache[e]}getCache(){return this.cache||{}}}var Lt={exports:{}},Mt={},xt={},Dt=function(e,t){var r=new Array(arguments.length-1),n=0,o=2,i=!0;for(;o<arguments.length;)r[n++]=arguments[o++];return new Promise((function(o,s){r[n]=function(e){if(i)if(i=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,s(e))}}))};var Bt={};!function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,i=null,s=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:s[a++]=r[l>>2],o=(3&l)<<4,c=1;break;case 1:s[a++]=r[o|l>>4],o=(15&l)<<2,c=2;break;case 2:s[a++]=r[o|l>>6],s[a++]=r[63&l],c=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[o],s[a++]=61,1===c&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var i="invalid encoding";t.decode=function(e,t,r){for(var o,s=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=n[l]))throw Error(i);switch(a){case 0:o=l,a=1;break;case 1:t[r++]=o<<2|(48&l)>>4,o=l,a=2;break;case 2:t[r++]=(15&o)<<4|(60&l)>>2,o=l,a=3;break;case 3:t[r++]=(3&o)<<6|l,a=0}}if(1===a)throw Error(i);return r-s},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(Bt);var Ut=jt;function jt(){this._listeners={}}jt.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},jt.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},jt.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this};var Pt=Ft(Ft);function Ft(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function r(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,s=8388607&n;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,Gt),e.writeFloatBE=t.bind(null,qt),e.readFloatLE=r.bind(null,Ht),e.readFloatBE=r.bind(null,zt)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,o,i){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,i+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,o,i+r)}}}function r(e,t,r,n,o){var i=e(n,o+t),s=e(n,o+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+i;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,Gt,0,4),e.writeDoubleBE=t.bind(null,qt,4,0),e.readDoubleLE=r.bind(null,Ht,0,4),e.readDoubleBE=r.bind(null,zt,4,0)}(),e}function Gt(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function qt(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function Ht(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function zt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var Kt=function(e){try{var t=void 0;t}catch(e){}return null};var Vt={};!function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],s=0;t<r;)(n=e[t++])<128?i[s++]=n:n>191&&n<224?i[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},t.write=function(e,t,r){for(var n,o,i=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&o),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}}(Vt);var Wt,$t,Jt,Zt=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){if(r<1||r>o)return e(r);s+r>n&&(i=e(n),s=0);var a=t.call(i,s,s+=r);return 7&s&&(s=1+(7|s)),a}};function Xt(){return Jt||(Jt=1,function(e){var t=e;function r(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}t.asPromise=Dt,t.base64=Bt,t.EventEmitter=Ut,t.float=Pt,t.inquire=Kt,t.utf8=Vt,t.pool=Zt,t.LongBits=function(){if($t)return Wt;$t=1,Wt=t;var e=Xt();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var o=e>>>0,i=(e-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new t(o,i)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var o=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},Wt}(),t.isNode=Boolean(void 0!==F&&F&&F.process&&F.process.versions&&F.process.versions.node),t.global=t.isNode&&F||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||F,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(xt)),xt}var Yt,Qt=ar,er=Xt(),tr=er.LongBits,rr=er.base64,nr=er.utf8;function or(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function ir(){}function sr(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function ar(){this.len=0,this.head=new or(ir,0,0),this.tail=this.head,this.states=null}var cr=function(){return er.Buffer?function(){return(ar.create=function(){return new Yt})()}:function(){return new ar}};function lr(e,t,r){t[r]=255&e}function ur(e,t){this.len=e,this.next=void 0,this.val=t}function dr(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function hr(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}ar.create=cr(),ar.alloc=function(e){return new er.Array(e)},er.Array!==Array&&(ar.alloc=er.pool(ar.alloc,er.Array.prototype.subarray)),ar.prototype._push=function(e,t,r){return this.tail=this.tail.next=new or(e,t,r),this.len+=t,this},ur.prototype=Object.create(or.prototype),ur.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},ar.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ur((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},ar.prototype.int32=function(e){return e<0?this._push(dr,10,tr.fromNumber(e)):this.uint32(e)},ar.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},ar.prototype.uint64=function(e){var t=tr.from(e);return this._push(dr,t.length(),t)},ar.prototype.int64=ar.prototype.uint64,ar.prototype.sint64=function(e){var t=tr.from(e).zzEncode();return this._push(dr,t.length(),t)},ar.prototype.bool=function(e){return this._push(lr,1,e?1:0)},ar.prototype.fixed32=function(e){return this._push(hr,4,e>>>0)},ar.prototype.sfixed32=ar.prototype.fixed32,ar.prototype.fixed64=function(e){var t=tr.from(e);return this._push(hr,4,t.lo)._push(hr,4,t.hi)},ar.prototype.sfixed64=ar.prototype.fixed64,ar.prototype.float=function(e){return this._push(er.float.writeFloatLE,4,e)},ar.prototype.double=function(e){return this._push(er.float.writeDoubleLE,8,e)};var fr=er.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};ar.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(lr,1,0);if(er.isString(e)){var r=ar.alloc(t=rr.length(e));rr.decode(e,r,0),e=r}return this.uint32(t)._push(fr,t,e)},ar.prototype.string=function(e){var t=nr.length(e);return t?this.uint32(t)._push(nr.write,t,e):this._push(lr,1,0)},ar.prototype.fork=function(){return this.states=new sr(this),this.head=this.tail=new or(ir,0,0),this.len=0,this},ar.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new or(ir,0,0),this.len=0),this},ar.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},ar.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},ar._configure=function(e){Yt=e,ar.create=cr(),Yt._configure()};var pr=vr,gr=Qt;(vr.prototype=Object.create(gr.prototype)).constructor=vr;var yr=Xt();function vr(){gr.call(this)}function mr(e,t,r){e.length<40?yr.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}vr._configure=function(){vr.alloc=yr._Buffer_allocUnsafe,vr.writeBytesBuffer=yr.Buffer&&yr.Buffer.prototype instanceof Uint8Array&&"set"===yr.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},vr.prototype.bytes=function(e){yr.isString(e)&&(e=yr._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(vr.writeBytesBuffer,t,e),this},vr.prototype.string=function(e){var t=yr.Buffer.byteLength(e);return this.uint32(t),t&&this._push(mr,t,e),this},vr._configure();var br,Cr=_r,wr=Xt(),Er=wr.LongBits,Sr=wr.utf8;function Or(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function _r(e){this.buf=e,this.pos=0,this.len=e.length}var Ir,Tr="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new _r(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new _r(e);throw Error("illegal buffer")},Rr=function(){return wr.Buffer?function(e){return(_r.create=function(e){return wr.Buffer.isBuffer(e)?new br(e):Tr(e)})(e)}:Tr};function kr(){var e=new Er(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw Or(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Or(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function Nr(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function Ar(){if(this.pos+8>this.len)throw Or(this,8);return new Er(Nr(this.buf,this.pos+=4),Nr(this.buf,this.pos+=4))}_r.create=Rr(),_r.prototype._slice=wr.Array.prototype.subarray||wr.Array.prototype.slice,_r.prototype.uint32=(Ir=4294967295,function(){if(Ir=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return Ir;if(Ir=(Ir|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return Ir;if(Ir=(Ir|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return Ir;if(Ir=(Ir|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return Ir;if(Ir=(Ir|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return Ir;if((this.pos+=5)>this.len)throw this.pos=this.len,Or(this,10);return Ir}),_r.prototype.int32=function(){return 0|this.uint32()},_r.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},_r.prototype.bool=function(){return 0!==this.uint32()},_r.prototype.fixed32=function(){if(this.pos+4>this.len)throw Or(this,4);return Nr(this.buf,this.pos+=4)},_r.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Or(this,4);return 0|Nr(this.buf,this.pos+=4)},_r.prototype.float=function(){if(this.pos+4>this.len)throw Or(this,4);var e=wr.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},_r.prototype.double=function(){if(this.pos+8>this.len)throw Or(this,4);var e=wr.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},_r.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw Or(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},_r.prototype.string=function(){var e=this.bytes();return Sr.read(e,0,e.length)},_r.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw Or(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw Or(this)}while(128&this.buf[this.pos++]);return this},_r.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},_r._configure=function(e){br=e,_r.create=Rr(),br._configure();var t=wr.Long?"toLong":"toNumber";wr.merge(_r.prototype,{int64:function(){return kr.call(this)[t](!1)},uint64:function(){return kr.call(this)[t](!0)},sint64:function(){return kr.call(this).zzDecode()[t](!1)},fixed64:function(){return Ar.call(this)[t](!0)},sfixed64:function(){return Ar.call(this)[t](!1)}})};var Lr=Dr,Mr=Cr;(Dr.prototype=Object.create(Mr.prototype)).constructor=Dr;var xr=Xt();function Dr(e){Mr.call(this,e)}Dr._configure=function(){xr.Buffer&&(Dr.prototype._slice=xr.Buffer.prototype.slice)},Dr.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},Dr._configure();var Br={},Ur=Pr,jr=Xt();function Pr(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");jr.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(Pr.prototype=Object.create(jr.EventEmitter.prototype)).constructor=Pr,Pr.prototype.rpcCall=function e(t,r,n,o,i){if(!o)throw TypeError("request must be specified");var s=this;if(!i)return jr.asPromise(e,s,t,r,n,o);if(s.rpcImpl)try{return s.rpcImpl(t,r[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return s.emit("error",e,t),i(e);if(null!==r){if(!(r instanceof n))try{r=n[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return s.emit("error",e,t),i(e)}return s.emit("data",r,t),i(null,r)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){i(e)}),0)}else setTimeout((function(){i(Error("already ended"))}),0)},Pr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(e){e.Service=Ur}(Br);var Fr={};!function(e){var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=Qt,t.BufferWriter=pr,t.Reader=Cr,t.BufferReader=Lr,t.util=Xt(),t.rpc=Br,t.roots=Fr,t.configure=r,r()}(Mt),function(e){e.exports=Mt}(Lt);const Gr=Lt.exports.Writer,qr=Lt.exports.util,Hr=Lt.exports.roots.default||(Lt.exports.roots.default={}),zr=Hr.NetworkRequest=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=qr.Long?qr.Long.fromBits(0,0,!1):0,e.prototype.deviceId=qr.Long?qr.Long.fromBits(0,0,!1):0,e.prototype.sessionId=qr.Long?qr.Long.fromBits(0,0,!1):0,e.prototype.uid=qr.Long?qr.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.destId="",e.prototype.body=qr.newBuffer([]),e.prototype.token="",e.encode=function(e,t){return t||(t=Gr.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(58).string(e.destId),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.token&&Object.hasOwnProperty.call(e,"token")&&t.uint32(74).string(e.token),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkRequest"},e})(),Kr=Hr.HeartbeatReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.pingId=qr.Long?qr.Long.fromBits(0,0,!1):0,e.prototype.disconnectDelay=qr.Long?qr.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Gr.create()),null!=e.pingId&&Object.hasOwnProperty.call(e,"pingId")&&t.uint32(8).int64(e.pingId),null!=e.disconnectDelay&&Object.hasOwnProperty.call(e,"disconnectDelay")&&t.uint32(16).int64(e.disconnectDelay),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/HeartbeatReq"},e})(),Vr=Hr.AuthSignIn2TokenReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.token="",e.prototype.deviceType=0,e.prototype.imei="",e.prototype.brand="",e.prototype.model="",e.prototype.apnsToken="",e.prototype.bandId="",e.encode=function(e,t){return t||(t=Gr.create()),null!=e.token&&Object.hasOwnProperty.call(e,"token")&&t.uint32(10).string(e.token),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(16).int32(e.deviceType),null!=e.imei&&Object.hasOwnProperty.call(e,"imei")&&t.uint32(26).string(e.imei),null!=e.brand&&Object.hasOwnProperty.call(e,"brand")&&t.uint32(34).string(e.brand),null!=e.model&&Object.hasOwnProperty.call(e,"model")&&t.uint32(42).string(e.model),null!=e.apnsToken&&Object.hasOwnProperty.call(e,"apnsToken")&&t.uint32(50).string(e.apnsToken),null!=e.bandId&&Object.hasOwnProperty.call(e,"bandId")&&t.uint32(58).string(e.bandId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2TokenReq"},e})();Hr.SystemCurrentTimeMillisReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.encode=function(e,t){return t||(t=Gr.create()),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisReq"},e})();var Wr=Lt.exports,$r=Wr.Reader,Jr=Wr.util,Zr=Wr.roots.default||(Wr.roots.default={});Zr.NetworkResponse=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.uid=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.body=Jr.newBuffer([]),e.prototype.code=0,e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.NetworkResponse;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 8:n.body=e.bytes();break;case 9:n.code=e.int32();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkResponse"},e}(),Zr.AuthSignIn2TokenResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.sessionId=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.bodyAes=null,e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.prototype.fileDomain="",e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.AuthSignIn2TokenResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 8:n.bodyAes=Zr.UserAesKeyAndIV.decode(e,e.uint32());break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Zr.User.decode(e,e.uint32());break;case 14:n.fileDomain=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2TokenResp"},e}(),Zr.UserAesKeyAndIV=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.UserAesKeyAndIV;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UserAesKeyAndIV"},e}(),Zr.User=function(){function e(e){if(this.aliasMobile=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.uid=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.prototype.nickName="",e.prototype.langCode="",e.prototype.phone="",e.prototype.numberInPhoneBook="",e.prototype.smallAvatarUrl="",e.prototype.originalAvatarUrl="",e.prototype.email="",e.prototype.qrcodeString="",e.prototype.gender=0,e.prototype.contactStatus=0,e.prototype.alias="",e.prototype.aliasMobile=Jr.emptyArray,e.prototype.aliasDesp="",e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.User;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.uid=e.int64();break;case 2:n.nickName=e.string();break;case 3:n.langCode=e.string();break;case 4:n.phone=e.string();break;case 5:n.numberInPhoneBook=e.string();break;case 6:n.smallAvatarUrl=e.string();break;case 7:n.originalAvatarUrl=e.string();break;case 8:n.email=e.string();break;case 9:n.qrcodeString=e.string();break;case 10:n.gender=e.int32();break;case 11:n.contactStatus=e.int32();break;case 12:n.alias=e.string();break;case 13:n.aliasMobile&&n.aliasMobile.length||(n.aliasMobile=[]),n.aliasMobile.push(e.string());break;case 14:n.aliasDesp=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/User"},e}(),Zr.SystemCurrentTimeMillisResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.currentTimeMillis=Jr.Long?Jr.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.SystemCurrentTimeMillisResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.currentTimeMillis=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisResp"},e}(),Zr.BaseResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.decode=function(e,t){e instanceof $r||(e=$r.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Zr.BaseResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BaseResp"},e}();var Xr=Zr;class Yr{constructor(){h(this,"pool",[])}writeIn8(e){this.pool.push(e)}writeInt16(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255)}writeInt32(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255),this.pool.push(e>>>16&255),this.pool.push(e>>>24&255)}writeArr(e){return this.pool.push(...e),e}getBytesArray(){return this.pool}}class Qr{constructor(e){h(this,"pool",void 0),h(this,"position",0),this.pool=e}check(){return this.position>=this.pool.length}readInt8(){const e=this.pool[this.position];return this.position+=1,e<<24>>24}readInt32(){const e=this.pool[this.position+0],t=this.pool[this.position+1],r=this.pool[this.position+2],n=this.pool[this.position+3];return this.position+=4,e<<0|t<<8|r<<16|n<<24}readArr(e){const t=this.pool.subarray(this.position,this.position+e);return this.position+=e,t}}const en=t=>{let r;switch(t){case 0:r=e.ErrorCode.SUCCESS;break;case 1610743809:r=e.ErrorCode.NOT_IN_GROUP;break;case 1610678275:r=e.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=e.ErrorCode.REJECTED_BY_BLACKLIST;break;case 3:r=e.ErrorCode.PARAMETER_ERROR;break;case 22408:r=e.ErrorCode.FORBIDDEN_IN_GROUP;break;default:r=e.ErrorCode.UNKNOWN}return r};
18
+ return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=o.create([0,1518500249,1859775393,2400959708,2840853838]),h=o.create([1352829926,1548603684,1836072691,2053994217,0]),f=s.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,o=e[n];e[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,s,f,C,w,E,S,O,_,I,T,R=this._hash.words,k=d.words,N=h.words,A=a.words,L=c.words,M=l.words,D=u.words;for(E=i=R[0],S=s=R[1],O=f=R[2],_=C=R[3],I=w=R[4],r=0;r<80;r+=1)T=i+e[t+A[r]]|0,T+=r<16?p(s,f,C)+k[0]:r<32?g(s,f,C)+k[1]:r<48?y(s,f,C)+k[2]:r<64?v(s,f,C)+k[3]:m(s,f,C)+k[4],T=(T=b(T|=0,M[r]))+w|0,i=w,w=C,C=b(f,10),f=s,s=T,T=E+e[t+L[r]]|0,T+=r<16?m(S,O,_)+N[0]:r<32?v(S,O,_)+N[1]:r<48?y(S,O,_)+N[2]:r<64?g(S,O,_)+N[3]:p(S,O,_)+N[4],T=(T=b(T|=0,D[r]))+I|0,E=I,I=_,_=b(O,10),O=S,S=T;T=R[1]+f+_|0,R[1]=R[2]+C+I|0,R[2]=R[3]+w+E|0,R[3]=R[4]+i+S|0,R[4]=R[0]+s+O|0,R[0]=T},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var o=this._hash,i=o.words,s=0;s<5;s++){var a=i[s];i[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return o},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function g(e,t,r){return e&t|~e&r}function y(e,t,r){return(e|~t)^r}function v(e,t,r){return e&r|t&~r}function m(e,t,r){return e^(t|~r)}function b(e,t){return e<<t|e>>>32-t}r.RIPEMD160=i._createHelper(f),r.HmacRIPEMD160=i._createHmacHelper(f)}(),e.RIPEMD160}(m())}(ee)),ne(),oe||(oe=1,function(e,t){e.exports=function(e){return n=(r=(t=e).lib).Base,o=r.WordArray,s=(i=t.algo).SHA1,a=i.HMAC,c=i.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=a.create(r.hasher,e),i=o.create(),s=o.create([1]),c=i.words,l=s.words,u=r.keySize,d=r.iterations;c.length<u;){var h=n.update(t).finalize(s);n.reset();for(var f=h.words,p=f.length,g=h,y=1;y<d;y++){g=n.finalize(g),n.reset();for(var v=g.words,m=0;m<p;m++)f[m]^=v[m]}i.concat(h),l[0]++}return i.sigBytes=4*u,i}}),t.PBKDF2=function(e,t,r){return c.create(r).compute(e,t)},e.PBKDF2;var t,r,n,o,i,s,a,c}(m(),P(),ne())}(ie)),ce(),de(),pe(),ve(),Ce(),Se(),Oe||(Oe=1,function(e,t){e.exports=function(e){return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB;var t}(m(),de())}(_e)),Ie||(Ie=1,function(e,t){e.exports=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,n=4*t,o=n-r%n,i=r+o-1;e.clamp(),e.words[i>>>2]|=o<<24-i%4*8,e.sigBytes+=o},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923}(m(),de())}(Te)),Re||(Re=1,function(e,t){e.exports=function(e){return e.pad.Iso10126={pad:function(t,r){var n=4*r,o=n-t.sigBytes%n;t.concat(e.lib.WordArray.random(o-1)).concat(e.lib.WordArray.create([o<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Iso10126}(m(),de())}(ke)),Ne||(Ne=1,function(e,t){e.exports=function(e){return e.pad.Iso97971={pad:function(t,r){t.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(t,r)},unpad:function(t){e.pad.ZeroPadding.unpad(t),t.sigBytes--}},e.pad.Iso97971}(m(),de())}(Ae)),Le||(Le=1,function(e,t){e.exports=function(e){return e.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding}(m(),de())}(Me)),De||(De=1,function(e,t){e.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(m(),de())}(xe)),Be||(Be=1,function(e,t){e.exports=function(e){return r=(t=e).lib.CipherParams,n=t.enc.Hex,t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return r.create({ciphertext:t})}},e.format.Hex;var t,r,n}(m(),de())}(Ue)),je||(je=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.BlockCipher,n=t.algo,o=[],i=[],s=[],a=[],c=[],l=[],u=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,o[r]=p,i[p]=r;var g=e[r],y=e[g],v=e[y],m=257*e[p]^16843008*p;s[r]=m<<24|m>>>8,a[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,l[r]=m,m=16843009*v^65537*y^257*g^16843008*r,u[p]=m<<24|m>>>8,d[p]=m<<16|m>>>16,h[p]=m<<8|m>>>24,f[p]=m,r?(r=g^e[e[e[v^g]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=n.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],s=0;s<n;s++)s<r?i[s]=t[s]:(l=i[s-1],s%r?r>6&&s%r==4&&(l=o[l>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l]):(l=o[(l=l<<8|l>>>24)>>>24]<<24|o[l>>>16&255]<<16|o[l>>>8&255]<<8|o[255&l],l^=p[s/r|0]<<24),i[s]=i[s-r]^l);for(var a=this._invKeySchedule=[],c=0;c<n;c++){if(s=n-c,c%4)var l=i[s];else l=i[s-4];a[c]=c<4||s<=4?l:u[o[l>>>24]]^d[o[l>>>16&255]]^h[o[l>>>8&255]]^f[o[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,l,o)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,d,h,f,i),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,o,i,s,a){for(var c=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],d=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p<c;p++){var g=n[l>>>24]^o[u>>>16&255]^i[d>>>8&255]^s[255&h]^r[f++],y=n[u>>>24]^o[d>>>16&255]^i[h>>>8&255]^s[255&l]^r[f++],v=n[d>>>24]^o[h>>>16&255]^i[l>>>8&255]^s[255&u]^r[f++],m=n[h>>>24]^o[l>>>16&255]^i[u>>>8&255]^s[255&d]^r[f++];l=g,u=y,d=v,h=m}g=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^r[f++],y=(a[u>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[f++],v=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[f++],m=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&d])^r[f++],e[t]=g,e[t+1]=y,e[t+2]=v,e[t+3]=m},keySize:8});t.AES=r._createHelper(g)}(),e.AES}(m(),N(),B(),ce(),de())}(Pe)),qe(),He||(He=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=n.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],o=0;o<256;o++)n[o]=o;o=0;for(var i=0;o<256;o++){var s=o%r,a=t[s>>>2]>>>24-s%4*8&255;i=(i+n[o]+a)%256;var c=n[o];n[o]=n[i],n[i]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var e=this._S,t=this._i,r=this._j,n=0,o=0;o<4;o++){r=(r+e[t=(t+1)%256])%256;var i=e[t];e[t]=e[r],e[r]=i,n|=e[(e[t]+e[r])%256]<<24-8*o}return this._i=t,this._j=r,n}t.RC4=r._createHelper(o);var s=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)i.call(this)}});t.RC4Drop=r._createHelper(s)}(),e.RC4}(m(),N(),B(),ce(),de())}(ze)),Ke||(Ke=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],s=[],a=n.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],o=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)o[r]^=n[r+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;for(o[0]^=l,o[1]^=d,o[2]^=u,o[3]^=h,o[4]^=l,o[5]^=d,o[6]^=u,o[7]^=h,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.Rabbit=r._createHelper(a)}(),e.Rabbit}(m(),N(),B(),ce(),de())}(Ve)),We||(We=1,function(e,t){e.exports=function(e){return function(){var t=e,r=t.lib.StreamCipher,n=t.algo,o=[],i=[],s=[],a=n.RabbitLegacy=r.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var o=0;o<4;o++)c.call(this);for(o=0;o<8;o++)n[o]^=r[o+4&7];if(t){var i=t.words,s=i[0],a=i[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=d,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=d,n[6]^=u,n[7]^=h,o=0;o<4;o++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),o[0]=r[0]^r[5]>>>16^r[3]<<16,o[1]=r[2]^r[7]>>>16^r[5]<<16,o[2]=r[4]^r[1]>>>16^r[7]<<16,o[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)o[n]=16711935&(o[n]<<8|o[n]>>>24)|4278255360&(o[n]<<24|o[n]>>>8),e[t+n]^=o[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)i[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<i[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<i[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<i[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<i[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<i[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<i[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<i[6]>>>0?1:0)|0,this._b=t[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],o=65535&n,a=n>>>16,c=((o*o>>>17)+o*a>>>15)+a*a,l=((4294901760&n)*n|0)+((65535&n)*n|0);s[r]=c^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}t.RabbitLegacy=r._createHelper(a)}(),e.RabbitLegacy}(m(),N(),B(),ce(),de())}($e)))}(g);var Je=g.exports;function Ze(e){return Object.prototype.toString.call(e).slice(8,-1)}const Xe=e=>null!=e,Ye=e=>"number"==typeof e&&!isNaN(e),Qe=e=>"boolean"==typeof e,et=e=>void 0===e||"Undefined"===Ze(e),tt=e=>"function"==typeof e,rt=e=>null!==e&&"object"==typeof e;function nt(e){return"array"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function ot(e){return"string"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function it(e){return ot(e)&&e.length>0}function st(e){for(const t in e)return!0;return!1}const at=e=>rt(e)&&tt(e.then)&&tt(e.catch);const ct=e=>Object.keys(e),lt=e=>{const t={};return Object.keys(e).forEach((r=>{const n=e[r];Xe(n)&&(t[r]=rt(n)?lt(n):n)})),t},ut=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,r=null;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];r||(r=setTimeout((()=>{e.call(null,...o),r=null}),t))}},dt=Je.enc.Utf8.parse("skdjhfgc9829kslf"),ht=Je.enc.Utf8.parse("qwdkshjf9838jsdf"),ft={get:function(e){let t=localStorage.getItem(e);if(!Xe(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){Xe(t)?localStorage.setItem(e,JSON.stringify(t)):this.remove(e)},remove:function(e){localStorage.removeItem(e)}},pt={get:function(e){let t=localStorage.getItem(e);if(Xe(t)){const e=Je.enc.Hex.parse(t),r=Je.enc.Base64.stringify(e);t=Je.AES.decrypt(r,dt,{iv:ht}).toString(Je.enc.Utf8)}if(!Xe(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){if(Xe(t)){const r=Je.AES.encrypt(JSON.stringify(t),dt,{iv:ht}).ciphertext.toString();localStorage.setItem(e,r)}else this.remove(e)},remove:function(e){localStorage.removeItem(e)}},gt="ACIM-";class yt{constructor(e){h(this,"cache",void 0),h(this,"storageKey",void 0),h(this,"saveFunc",void 0);const t=e?`ACIM-${e}`:gt,r=ft.get(t)||{};this.cache=r,this.storageKey=t,this.saveFunc=ut((()=>{ft.set(this.storageKey,this.cache)}),10)}set(e,t){this.cache[e]=t,this.saveFunc()}remove(e){delete this.cache[e],this.saveFunc()}clear(){ft.remove(this.storageKey),this.cache={}}get(e){return this.cache[e]}getCache(){return this.cache||{}}}const vt=pt.get("ACIM-slf")===(new Date).getDate();const mt={[e.LogLevel.DEBUG]:console.debug.bind(console),[e.LogLevel.INFO]:console.info.bind(console),[e.LogLevel.WARN]:console.warn.bind(console),[e.LogLevel.ERROR]:console.error.bind(console),[e.LogLevel.FATAL]:console.log.bind(console),[e.LogLevel.NONE]:null},bt=e=>ot(e)||Ye(e)||et(e)||Qe(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e),Ct=new class{constructor(t){h(this,"debug",void 0),h(this,"info",void 0),h(this,"warn",void 0),h(this,"error",void 0),h(this,"fatal",void 0),h(this,"outLevel",e.LogLevel.WARN),h(this,"tag",void 0),h(this,"logStdout",void 0),this.tag=t,this.debug=this.log.bind(this,e.LogLevel.DEBUG),this.info=this.log.bind(this,e.LogLevel.INFO),this.warn=this.log.bind(this,e.LogLevel.WARN),this.error=this.log.bind(this,e.LogLevel.ERROR),this.fatal=this.log.bind(this,e.LogLevel.FATAL)}defaultStdout(e,t){const r=mt[e];if(Xe(r)){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];r(`${t}:`,...o)}}reqInfo(){this.info(...arguments)}setLogLevel(e){this.outLevel=e}setLogStdout(e){this.logStdout=e}log(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];if(vt){const r=`${(new Date).toISOString()}[${this.tag}][${e.LogLevel[t]}]`;return void this.defaultStdout(t,r,...n)}if(t<this.outLevel)return;const i=`${(new Date).toISOString()}[${this.tag}][${e.LogLevel[t]}]`,s=`${i} - ${n.map(bt).join(" ")}`;this.logStdout?this.logStdout(t,s):this.defaultStdout(t,i,...n)}}("ACLog"),wt=it,Et=Ye,St=Qe,Ot=nt,_t=t=>Ye(t)&&Object.prototype.hasOwnProperty.call(e.ConversationType,t),It=t=>{if(!rt(t))return!1;const{conversationType:r,targetId:n,channelId:o}=t;return Ye(r)&&Object.prototype.hasOwnProperty.call(e.ConversationType,r)&&(Ye(n)||it(n))&&(!Xe(o)||ot(o)&&!/_/g.test(o)&&o.length<=20)};class Tt extends Error{constructor(e){super(e),this.name="ACAssertError"}}const Rt=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!kt(e,t,r,n))throw new Tt(`'${e}' is invalid: ${JSON.stringify(t)}`)},kt=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=n&&!r(t)||!n&&Xe(t)&&!r(t);return o&&Ct.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};let Nt=class{constructor(){h(this,"events",{})}on(e,t,r){const n=this.events[e]||(this.events[e]=[]);n.some((e=>e.listener===t&&e.target===r))||n.push({listener:t,target:r})}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];const o=this.events[e];null!=o&&o.length&&o.map((e=>{const{target:t,listener:n}=e;try{n.call(t,...r)}catch(e){}}))}off(e,t,r){var n;let o=this.events[e];null!==(n=o)&&void 0!==n&&n.length&&(o=o.filter((e=>e.listener!==t||e.target!==r)),o.length?this.events[e]=o:delete this.events[e])}once(e,t,r){var n=this;const o=function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];t.call(r,...s),n.off(e,o,r)};return this.on(e,o,r),this}};var At;!function(e){e[e.Auth=805404708]="Auth",e[e.Heartbean=268439553]="Heartbean",e[e.GetServerTime=268439558]="GetServerTime",e[e.GetDialogKey=1610682389]="GetDialogKey",e[e.SendPrivateChatMessage=1610682369]="SendPrivateChatMessage",e[e.SendGroupChatMessage=1610747905]="SendGroupChatMessage",e[e.GetNewMessage=1610682407]="GetNewMessage",e[e.RecallPrivateMessage=1610682402]="RecallPrivateMessage",e[e.RecallGroupMessage=1610747947]="RecallGroupMessage",e[e.GetRemoteMessages=1610682416]="GetRemoteMessages",e[e.GetSuperGroupRemoteMessages=1610776956]="GetSuperGroupRemoteMessages",e[e.DeleteChatMessages=1610682381]="DeleteChatMessages",e[e.ClearChatHistoryMessage=1610777164]="ClearChatHistoryMessage",e[e.GetDialogList=1610711090]="GetDialogList",e[e.GetBriefDialogList=1610682399]="GetBriefDialogList",e[e.UpdatePrivateChatMuteConfig=1610682379]="UpdatePrivateChatMuteConfig",e[e.UpdateGroupChatMuteConfig=1610747915]="UpdateGroupChatMuteConfig",e[e.UpdatePrivateChatStickyConfig=1610682378]="UpdatePrivateChatStickyConfig",e[e.UpdateGroupChatStickyConfig=1610747914]="UpdateGroupChatStickyConfig",e[e.DeletePrivateDialog=1610682372]="DeletePrivateDialog",e[e.DeleteGroupDialog=1610747908]="DeleteGroupDialog",e[e.GetDialogChangedStatus=1610711094]="GetDialogChangedStatus",e[e.NewMessagePush=1610711040]="NewMessagePush",e[e.DialogChangedPush=1610711096]="DialogChangedPush",e[e.SessionKilledPush=268468229]="SessionKilledPush",e[e.SignOutPish=268439559]="SignOutPish",e[e.SignOutPish2=268468231]="SignOutPish2",e[e.UserFrozenToLogin=805408766]="UserFrozenToLogin",e[e.UserFrozenToLogin2=805408767]="UserFrozenToLogin2"}(At||(At={}));var Lt=At;var Mt={exports:{}},Dt={},xt={},Bt=function(e,t){var r=new Array(arguments.length-1),n=0,o=2,i=!0;for(;o<arguments.length;)r[n++]=arguments[o++];return new Promise((function(o,s){r[n]=function(e){if(i)if(i=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];o.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,s(e))}}))};var Ut={};!function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),o=0;o<64;)n[r[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;t.encode=function(e,t,n){for(var o,i=null,s=[],a=0,c=0;t<n;){var l=e[t++];switch(c){case 0:s[a++]=r[l>>2],o=(3&l)<<4,c=1;break;case 1:s[a++]=r[o|l>>4],o=(15&l)<<2,c=2;break;case 2:s[a++]=r[o|l>>6],s[a++]=r[63&l],c=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=r[o],s[a++]=61,1===c&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var i="invalid encoding";t.decode=function(e,t,r){for(var o,s=r,a=0,c=0;c<e.length;){var l=e.charCodeAt(c++);if(61===l&&a>1)break;if(void 0===(l=n[l]))throw Error(i);switch(a){case 0:o=l,a=1;break;case 1:t[r++]=o<<2|(48&l)>>4,o=l,a=2;break;case 2:t[r++]=(15&o)<<4|(60&l)>>2,o=l,a=3;break;case 3:t[r++]=(3&o)<<6|l,a=0}}if(1===a)throw Error(i);return r-s},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(Ut);var jt=Pt;function Pt(){this._listeners={}}Pt.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},Pt.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},Pt.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this};var Ft=Gt(Gt);function Gt(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function r(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,s=8388607&n;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,qt),e.writeFloatBE=t.bind(null,Ht),e.readFloatLE=r.bind(null,zt),e.readFloatBE=r.bind(null,Kt)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,o,i){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,i+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,o,i+r)}}}function r(e,t,r,n,o){var i=e(n,o+t),s=e(n,o+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+i;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,qt,0,4),e.writeDoubleBE=t.bind(null,Ht,4,0),e.readDoubleLE=r.bind(null,zt,0,4),e.readDoubleBE=r.bind(null,Kt,4,0)}(),e}function qt(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Ht(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function zt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Kt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var Vt=function(e){try{var t=void 0;t}catch(e){}return null};var Wt={};!function(e){var t=e;t.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},t.read=function(e,t,r){if(r-t<1)return"";for(var n,o=null,i=[],s=0;t<r;)(n=e[t++])<128?i[s++]=n:n>191&&n<224?i[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},t.write=function(e,t,r){for(var n,o,i=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&o),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}}(Wt);var $t,Jt,Zt,Xt=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){if(r<1||r>o)return e(r);s+r>n&&(i=e(n),s=0);var a=t.call(i,s,s+=r);return 7&s&&(s=1+(7|s)),a}};function Yt(){return Zt||(Zt=1,function(e){var t=e;function r(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)void 0!==e[n[o]]&&r||(e[n[o]]=t[n[o]]);return e}function n(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&r(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}t.asPromise=Bt,t.base64=Ut,t.EventEmitter=jt,t.float=Ft,t.inquire=Vt,t.utf8=Wt,t.pool=Xt,t.LongBits=function(){if(Jt)return $t;Jt=1,$t=t;var e=Yt();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var r=t.zero=new t(0,0);r.toNumber=function(){return 0},r.zzEncode=r.zzDecode=function(){return this},r.length=function(){return 1};var n=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return r;var n=e<0;n&&(e=-e);var o=e>>>0,i=(e-o)/4294967296>>>0;return n&&(i=~i>>>0,o=~o>>>0,++o>4294967295&&(o=0,++i>4294967295&&(i=0))),new t(o,i)},t.from=function(n){if("number"==typeof n)return t.fromNumber(n);if(e.isString(n)){if(!e.Long)return t.fromNumber(parseInt(n,10));n=e.Long.fromString(n)}return n.low||n.high?new t(n.low>>>0,n.high>>>0):r},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var o=String.prototype.charCodeAt;return t.fromHash=function(e){return e===n?r:new t((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10},$t}(),t.isNode=Boolean(void 0!==f&&f&&f.process&&f.process.versions&&f.process.versions.node),t.global=t.isNode&&f||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||f,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=r,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=n,t.ProtocolError=n("ProtocolError"),t.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},t.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},t._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):t._Buffer_from=t._Buffer_allocUnsafe=null}}(xt)),xt}var Qt,er=cr,tr=Yt(),rr=tr.LongBits,nr=tr.base64,or=tr.utf8;function ir(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function sr(){}function ar(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function cr(){this.len=0,this.head=new ir(sr,0,0),this.tail=this.head,this.states=null}var lr=function(){return tr.Buffer?function(){return(cr.create=function(){return new Qt})()}:function(){return new cr}};function ur(e,t,r){t[r]=255&e}function dr(e,t){this.len=e,this.next=void 0,this.val=t}function hr(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function fr(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}cr.create=lr(),cr.alloc=function(e){return new tr.Array(e)},tr.Array!==Array&&(cr.alloc=tr.pool(cr.alloc,tr.Array.prototype.subarray)),cr.prototype._push=function(e,t,r){return this.tail=this.tail.next=new ir(e,t,r),this.len+=t,this},dr.prototype=Object.create(ir.prototype),dr.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},cr.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new dr((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},cr.prototype.int32=function(e){return e<0?this._push(hr,10,rr.fromNumber(e)):this.uint32(e)},cr.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},cr.prototype.uint64=function(e){var t=rr.from(e);return this._push(hr,t.length(),t)},cr.prototype.int64=cr.prototype.uint64,cr.prototype.sint64=function(e){var t=rr.from(e).zzEncode();return this._push(hr,t.length(),t)},cr.prototype.bool=function(e){return this._push(ur,1,e?1:0)},cr.prototype.fixed32=function(e){return this._push(fr,4,e>>>0)},cr.prototype.sfixed32=cr.prototype.fixed32,cr.prototype.fixed64=function(e){var t=rr.from(e);return this._push(fr,4,t.lo)._push(fr,4,t.hi)},cr.prototype.sfixed64=cr.prototype.fixed64,cr.prototype.float=function(e){return this._push(tr.float.writeFloatLE,4,e)},cr.prototype.double=function(e){return this._push(tr.float.writeDoubleLE,8,e)};var pr=tr.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};cr.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(ur,1,0);if(tr.isString(e)){var r=cr.alloc(t=nr.length(e));nr.decode(e,r,0),e=r}return this.uint32(t)._push(pr,t,e)},cr.prototype.string=function(e){var t=or.length(e);return t?this.uint32(t)._push(or.write,t,e):this._push(ur,1,0)},cr.prototype.fork=function(){return this.states=new ar(this),this.head=this.tail=new ir(sr,0,0),this.len=0,this},cr.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ir(sr,0,0),this.len=0),this},cr.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},cr.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},cr._configure=function(e){Qt=e,cr.create=lr(),Qt._configure()};var gr=mr,yr=er;(mr.prototype=Object.create(yr.prototype)).constructor=mr;var vr=Yt();function mr(){yr.call(this)}function br(e,t,r){e.length<40?vr.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}mr._configure=function(){mr.alloc=vr._Buffer_allocUnsafe,mr.writeBytesBuffer=vr.Buffer&&vr.Buffer.prototype instanceof Uint8Array&&"set"===vr.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},mr.prototype.bytes=function(e){vr.isString(e)&&(e=vr._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(mr.writeBytesBuffer,t,e),this},mr.prototype.string=function(e){var t=vr.Buffer.byteLength(e);return this.uint32(t),t&&this._push(br,t,e),this},mr._configure();var Cr,wr=Ir,Er=Yt(),Sr=Er.LongBits,Or=Er.utf8;function _r(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Ir(e){this.buf=e,this.pos=0,this.len=e.length}var Tr,Rr="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Ir(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Ir(e);throw Error("illegal buffer")},kr=function(){return Er.Buffer?function(e){return(Ir.create=function(e){return Er.Buffer.isBuffer(e)?new Cr(e):Rr(e)})(e)}:Rr};function Nr(){var e=new Sr(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw _r(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw _r(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function Ar(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function Lr(){if(this.pos+8>this.len)throw _r(this,8);return new Sr(Ar(this.buf,this.pos+=4),Ar(this.buf,this.pos+=4))}Ir.create=kr(),Ir.prototype._slice=Er.Array.prototype.subarray||Er.Array.prototype.slice,Ir.prototype.uint32=(Tr=4294967295,function(){if(Tr=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return Tr;if(Tr=(Tr|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return Tr;if(Tr=(Tr|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return Tr;if(Tr=(Tr|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return Tr;if(Tr=(Tr|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return Tr;if((this.pos+=5)>this.len)throw this.pos=this.len,_r(this,10);return Tr}),Ir.prototype.int32=function(){return 0|this.uint32()},Ir.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},Ir.prototype.bool=function(){return 0!==this.uint32()},Ir.prototype.fixed32=function(){if(this.pos+4>this.len)throw _r(this,4);return Ar(this.buf,this.pos+=4)},Ir.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _r(this,4);return 0|Ar(this.buf,this.pos+=4)},Ir.prototype.float=function(){if(this.pos+4>this.len)throw _r(this,4);var e=Er.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Ir.prototype.double=function(){if(this.pos+8>this.len)throw _r(this,4);var e=Er.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Ir.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw _r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},Ir.prototype.string=function(){var e=this.bytes();return Or.read(e,0,e.length)},Ir.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw _r(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw _r(this)}while(128&this.buf[this.pos++]);return this},Ir.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Ir._configure=function(e){Cr=e,Ir.create=kr(),Cr._configure();var t=Er.Long?"toLong":"toNumber";Er.merge(Ir.prototype,{int64:function(){return Nr.call(this)[t](!1)},uint64:function(){return Nr.call(this)[t](!0)},sint64:function(){return Nr.call(this).zzDecode()[t](!1)},fixed64:function(){return Lr.call(this)[t](!0)},sfixed64:function(){return Lr.call(this)[t](!1)}})};var Mr=Br,Dr=wr;(Br.prototype=Object.create(Dr.prototype)).constructor=Br;var xr=Yt();function Br(e){Dr.call(this,e)}Br._configure=function(){xr.Buffer&&(Br.prototype._slice=xr.Buffer.prototype.slice)},Br.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},Br._configure();var Ur={},jr=Fr,Pr=Yt();function Fr(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");Pr.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(Fr.prototype=Object.create(Pr.EventEmitter.prototype)).constructor=Fr,Fr.prototype.rpcCall=function e(t,r,n,o,i){if(!o)throw TypeError("request must be specified");var s=this;if(!i)return Pr.asPromise(e,s,t,r,n,o);if(s.rpcImpl)try{return s.rpcImpl(t,r[s.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return s.emit("error",e,t),i(e);if(null!==r){if(!(r instanceof n))try{r=n[s.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return s.emit("error",e,t),i(e)}return s.emit("data",r,t),i(null,r)}s.end(!0)}))}catch(e){return s.emit("error",e,t),void setTimeout((function(){i(e)}),0)}else setTimeout((function(){i(Error("already ended"))}),0)},Fr.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},function(e){e.Service=jr}(Ur);var Gr={};!function(e){var t=e;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=er,t.BufferWriter=gr,t.Reader=wr,t.BufferReader=Mr,t.util=Yt(),t.rpc=Ur,t.roots=Gr,t.configure=r,r()}(Dt),function(e){e.exports=Dt}(Mt);const qr=Mt.exports.Writer,Hr=Mt.exports.util,zr=Mt.exports.roots.default||(Mt.exports.roots.default={}),Kr=zr.NetworkRequest=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.prototype.sessionId=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.prototype.uid=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.destId="",e.prototype.body=Hr.newBuffer([]),e.prototype.token="",e.encode=function(e,t){return t||(t=qr.create()),null!=e.cmdId&&Object.hasOwnProperty.call(e,"cmdId")&&t.uint32(8).int32(e.cmdId),null!=e.messageSeq&&Object.hasOwnProperty.call(e,"messageSeq")&&t.uint32(16).int64(e.messageSeq),null!=e.deviceId&&Object.hasOwnProperty.call(e,"deviceId")&&t.uint32(24).int64(e.deviceId),null!=e.sessionId&&Object.hasOwnProperty.call(e,"sessionId")&&t.uint32(32).int64(e.sessionId),null!=e.uid&&Object.hasOwnProperty.call(e,"uid")&&t.uint32(40).int64(e.uid),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(48).int32(e.protocolVersion),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(58).string(e.destId),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&t.uint32(66).bytes(e.body),null!=e.token&&Object.hasOwnProperty.call(e,"token")&&t.uint32(74).string(e.token),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkRequest"},e})(),Vr=zr.HeartbeatReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.pingId=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.prototype.disconnectDelay=Hr.Long?Hr.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=qr.create()),null!=e.pingId&&Object.hasOwnProperty.call(e,"pingId")&&t.uint32(8).int64(e.pingId),null!=e.disconnectDelay&&Object.hasOwnProperty.call(e,"disconnectDelay")&&t.uint32(16).int64(e.disconnectDelay),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/HeartbeatReq"},e})(),Wr=zr.AuthSignIn2TokenReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.token="",e.prototype.deviceType=0,e.prototype.imei="",e.prototype.brand="",e.prototype.model="",e.prototype.apnsToken="",e.prototype.bandId="",e.encode=function(e,t){return t||(t=qr.create()),null!=e.token&&Object.hasOwnProperty.call(e,"token")&&t.uint32(10).string(e.token),null!=e.deviceType&&Object.hasOwnProperty.call(e,"deviceType")&&t.uint32(16).int32(e.deviceType),null!=e.imei&&Object.hasOwnProperty.call(e,"imei")&&t.uint32(26).string(e.imei),null!=e.brand&&Object.hasOwnProperty.call(e,"brand")&&t.uint32(34).string(e.brand),null!=e.model&&Object.hasOwnProperty.call(e,"model")&&t.uint32(42).string(e.model),null!=e.apnsToken&&Object.hasOwnProperty.call(e,"apnsToken")&&t.uint32(50).string(e.apnsToken),null!=e.bandId&&Object.hasOwnProperty.call(e,"bandId")&&t.uint32(58).string(e.bandId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2TokenReq"},e})();zr.SystemCurrentTimeMillisReq=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.encode=function(e,t){return t||(t=qr.create()),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisReq"},e})();var $r=Mt.exports,Jr=$r.Reader,Zr=$r.util,Xr=$r.roots.default||($r.roots.default={});Xr.NetworkResponse=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.cmdId=0,e.prototype.messageSeq=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.deviceId=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.uid=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.protocolVersion=0,e.prototype.body=Zr.newBuffer([]),e.prototype.code=0,e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.NetworkResponse;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.cmdId=e.int32();break;case 2:n.messageSeq=e.int64();break;case 3:n.deviceId=e.int64();break;case 5:n.uid=e.int64();break;case 6:n.protocolVersion=e.int32();break;case 8:n.body=e.bytes();break;case 9:n.code=e.int32();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NetworkResponse"},e}(),Xr.AuthSignIn2TokenResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.deviceId=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.sessionId=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.noNickName=!1,e.prototype.noEmail=!1,e.prototype.cert="",e.prototype.bodyAes=null,e.prototype.userFileDomain="",e.prototype.dialogFileDomain="",e.prototype.user=null,e.prototype.fileDomain="",e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.AuthSignIn2TokenResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.deviceId=e.int64();break;case 4:n.sessionId=e.int64();break;case 5:n.noNickName=e.bool();break;case 6:n.noEmail=e.bool();break;case 7:n.cert=e.string();break;case 8:n.bodyAes=Xr.UserAesKeyAndIV.decode(e,e.uint32());break;case 9:n.userFileDomain=e.string();break;case 10:n.dialogFileDomain=e.string();break;case 11:n.user=Xr.User.decode(e,e.uint32());break;case 14:n.fileDomain=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AuthSignIn2TokenResp"},e}(),Xr.UserAesKeyAndIV=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.UserAesKeyAndIV;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UserAesKeyAndIV"},e}(),Xr.User=function(){function e(e){if(this.aliasMobile=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.uid=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.prototype.nickName="",e.prototype.langCode="",e.prototype.phone="",e.prototype.numberInPhoneBook="",e.prototype.smallAvatarUrl="",e.prototype.originalAvatarUrl="",e.prototype.email="",e.prototype.qrcodeString="",e.prototype.gender=0,e.prototype.contactStatus=0,e.prototype.alias="",e.prototype.aliasMobile=Zr.emptyArray,e.prototype.aliasDesp="",e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.User;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.uid=e.int64();break;case 2:n.nickName=e.string();break;case 3:n.langCode=e.string();break;case 4:n.phone=e.string();break;case 5:n.numberInPhoneBook=e.string();break;case 6:n.smallAvatarUrl=e.string();break;case 7:n.originalAvatarUrl=e.string();break;case 8:n.email=e.string();break;case 9:n.qrcodeString=e.string();break;case 10:n.gender=e.int32();break;case 11:n.contactStatus=e.int32();break;case 12:n.alias=e.string();break;case 13:n.aliasMobile&&n.aliasMobile.length||(n.aliasMobile=[]),n.aliasMobile.push(e.string());break;case 14:n.aliasDesp=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/User"},e}(),Xr.SystemCurrentTimeMillisResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.currentTimeMillis=Zr.Long?Zr.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.SystemCurrentTimeMillisResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.currentTimeMillis=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SystemCurrentTimeMillisResp"},e}(),Xr.BaseResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.decode=function(e,t){e instanceof Jr||(e=Jr.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Xr.BaseResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BaseResp"},e}();var Yr=Xr;class Qr{constructor(){h(this,"pool",[])}writeIn8(e){this.pool.push(e)}writeInt16(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255)}writeInt32(e){this.pool.push(e>>>0&255),this.pool.push(e>>>8&255),this.pool.push(e>>>16&255),this.pool.push(e>>>24&255)}writeArr(e){return this.pool.push(...e),e}getBytesArray(){return this.pool}}class en{constructor(e){h(this,"pool",void 0),h(this,"position",0),this.pool=e}check(){return this.position>=this.pool.length}readInt8(){const e=this.pool[this.position];return this.position+=1,e<<24>>24}readInt32(){const e=this.pool[this.position+0],t=this.pool[this.position+1],r=this.pool[this.position+2],n=this.pool[this.position+3];return this.position+=4,e<<0|t<<8|r<<16|n<<24}readArr(e){const t=this.pool.subarray(this.position,this.position+e);return this.position+=e,t}}const tn=t=>{let r;switch(t){case 0:r=e.ErrorCode.SUCCESS;break;case 1610743809:r=e.ErrorCode.NOT_IN_GROUP;break;case 1610678275:r=e.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=e.ErrorCode.REJECTED_BY_BLACKLIST;break;case 3:r=e.ErrorCode.PARAMETER_ERROR;break;case 22408:r=e.ErrorCode.FORBIDDEN_IN_GROUP;break;default:r=e.ErrorCode.UNKNOWN}return r};
19
19
  /**
20
20
  * @license
21
21
  * Copyright 2009 The Closure Library Authors
@@ -34,4 +34,4 @@ return function(t){var r=e,n=r.lib,o=n.WordArray,i=n.Hasher,s=r.algo,a=o.create(
34
34
  * limitations under the License.
35
35
  *
36
36
  * SPDX-License-Identifier: Apache-2.0
37
- */var tn=null;try{tn=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function rn(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function nn(e){return!0===(e&&e.__isLong__)}function on(e){var t=Math.clz32(e&-e);return e?31-t:t}rn.prototype.__isLong__,Object.defineProperty(rn.prototype,"__isLong__",{value:!0}),rn.isLong=nn;var sn={},an={};function cn(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=an[e])?n:(r=un(e,0,!0),o&&(an[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=sn[e])?n:(r=un(e,e<0?-1:0,!1),o&&(sn[e]=r),r)}function ln(e,t){if(isNaN(e))return t?bn:mn;if(t){if(e<0)return bn;if(e>=gn)return On}else{if(e<=-yn)return _n;if(e+1>=yn)return Sn}return e<0?ln(-e,t).neg():un(e%pn|0,e/pn|0,t)}function un(e,t,r){return new rn(e,t,r)}rn.fromInt=cn,rn.fromNumber=ln,rn.fromBits=un;var dn=Math.pow;function hn(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?bn:mn;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return hn(e.substring(1),t,r).neg();for(var o=ln(dn(r,8)),i=mn,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var l=ln(dn(r,a));i=i.mul(l).add(ln(c))}else i=(i=i.mul(o)).add(ln(c))}return i.unsigned=t,i}function fn(e,t){return"number"==typeof e?ln(e,t):"string"==typeof e?hn(e,t):un(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}rn.fromString=hn,rn.fromValue=fn;var pn=4294967296,gn=pn*pn,yn=gn/2,vn=cn(1<<24),mn=cn(0);rn.ZERO=mn;var bn=cn(0,!0);rn.UZERO=bn;var Cn=cn(1);rn.ONE=Cn;var wn=cn(1,!0);rn.UONE=wn;var En=cn(-1);rn.NEG_ONE=En;var Sn=un(-1,2147483647,!1);rn.MAX_VALUE=Sn;var On=un(-1,-1,!0);rn.MAX_UNSIGNED_VALUE=On;var _n=un(0,-2147483648,!1);rn.MIN_VALUE=_n;var In=rn.prototype;In.toInt=function(){return this.unsigned?this.low>>>0:this.low},In.toNumber=function(){return this.unsigned?(this.high>>>0)*pn+(this.low>>>0):this.high*pn+(this.low>>>0)},In.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(_n)){var t=ln(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=ln(dn(e,6),this.unsigned),i=this,s="";;){var a=i.div(o),c=(i.sub(a.mul(o)).toInt()>>>0).toString(e);if((i=a).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},In.getHighBits=function(){return this.high},In.getHighBitsUnsigned=function(){return this.high>>>0},In.getLowBits=function(){return this.low},In.getLowBitsUnsigned=function(){return this.low>>>0},In.getNumBitsAbs=function(){if(this.isNegative())return this.eq(_n)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},In.isZero=function(){return 0===this.high&&0===this.low},In.eqz=In.isZero,In.isNegative=function(){return!this.unsigned&&this.high<0},In.isPositive=function(){return this.unsigned||this.high>=0},In.isOdd=function(){return 1==(1&this.low)},In.isEven=function(){return 0==(1&this.low)},In.equals=function(e){return nn(e)||(e=fn(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},In.eq=In.equals,In.notEquals=function(e){return!this.eq(e)},In.neq=In.notEquals,In.ne=In.notEquals,In.lessThan=function(e){return this.comp(e)<0},In.lt=In.lessThan,In.lessThanOrEqual=function(e){return this.comp(e)<=0},In.lte=In.lessThanOrEqual,In.le=In.lessThanOrEqual,In.greaterThan=function(e){return this.comp(e)>0},In.gt=In.greaterThan,In.greaterThanOrEqual=function(e){return this.comp(e)>=0},In.gte=In.greaterThanOrEqual,In.ge=In.greaterThanOrEqual,In.compare=function(e){if(nn(e)||(e=fn(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},In.comp=In.compare,In.negate=function(){return!this.unsigned&&this.eq(_n)?_n:this.not().add(Cn)},In.neg=In.negate,In.add=function(e){nn(e)||(e=fn(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=e.high>>>16,s=65535&e.high,a=e.low>>>16,c=0,l=0,u=0,d=0;return u+=(d+=o+(65535&e.low))>>>16,l+=(u+=n+a)>>>16,c+=(l+=r+s)>>>16,c+=t+i,un((u&=65535)<<16|(d&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},In.subtract=function(e){return nn(e)||(e=fn(e)),this.add(e.neg())},In.sub=In.subtract,In.multiply=function(e){if(this.isZero())return this;if(nn(e)||(e=fn(e)),tn)return un(tn.mul(this.low,this.high,e.low,e.high),tn.get_high(),this.unsigned);if(e.isZero())return this.unsigned?bn:mn;if(this.eq(_n))return e.isOdd()?_n:mn;if(e.eq(_n))return this.isOdd()?_n:mn;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(vn)&&e.lt(vn))return ln(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=e.high>>>16,s=65535&e.high,a=e.low>>>16,c=65535&e.low,l=0,u=0,d=0,h=0;return d+=(h+=o*c)>>>16,u+=(d+=n*c)>>>16,d&=65535,u+=(d+=o*a)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=n*a)>>>16,u&=65535,l+=(u+=o*s)>>>16,l+=t*c+r*a+n*s+o*i,un((d&=65535)<<16|(h&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},In.mul=In.multiply,In.divide=function(e){if(nn(e)||(e=fn(e)),e.isZero())throw Error("division by zero");var t,r,n;if(tn)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?un((this.unsigned?tn.div_u:tn.div_s)(this.low,this.high,e.low,e.high),tn.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?bn:mn;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return bn;if(e.gt(this.shru(1)))return wn;n=bn}else{if(this.eq(_n))return e.eq(Cn)||e.eq(En)?_n:e.eq(_n)?Cn:(t=this.shr(1).div(e).shl(1)).eq(mn)?e.isNegative()?Cn:En:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(_n))return this.unsigned?bn:mn;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=mn}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),i=o<=48?1:dn(2,o-48),s=ln(t),a=s.mul(e);a.isNegative()||a.gt(r);)a=(s=ln(t-=i,this.unsigned)).mul(e);s.isZero()&&(s=Cn),n=n.add(s),r=r.sub(a)}return n},In.div=In.divide,In.modulo=function(e){return nn(e)||(e=fn(e)),tn?un((this.unsigned?tn.rem_u:tn.rem_s)(this.low,this.high,e.low,e.high),tn.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},In.mod=In.modulo,In.rem=In.modulo,In.not=function(){return un(~this.low,~this.high,this.unsigned)},In.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},In.clz=In.countLeadingZeros,In.countTrailingZeros=function(){return this.low?on(this.low):on(this.high)+32},In.ctz=In.countTrailingZeros,In.and=function(e){return nn(e)||(e=fn(e)),un(this.low&e.low,this.high&e.high,this.unsigned)},In.or=function(e){return nn(e)||(e=fn(e)),un(this.low|e.low,this.high|e.high,this.unsigned)},In.xor=function(e){return nn(e)||(e=fn(e)),un(this.low^e.low,this.high^e.high,this.unsigned)},In.shiftLeft=function(e){return nn(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?un(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):un(0,this.low<<e-32,this.unsigned)},In.shl=In.shiftLeft,In.shiftRight=function(e){return nn(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?un(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):un(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},In.shr=In.shiftRight,In.shiftRightUnsigned=function(e){return nn(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?un(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):un(32===e?this.high:this.high>>>e-32,0,this.unsigned)},In.shru=In.shiftRightUnsigned,In.shr_u=In.shiftRightUnsigned,In.rotateLeft=function(e){var t;return nn(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?un(this.high,this.low,this.unsigned):e<32?(t=32-e,un(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),un(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},In.rotl=In.rotateLeft,In.rotateRight=function(e){var t;return nn(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?un(this.high,this.low,this.unsigned):e<32?(t=32-e,un(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),un(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},In.rotr=In.rotateRight,In.toSigned=function(){return this.unsigned?un(this.low,this.high,!1):this},In.toUnsigned=function(){return this.unsigned?this:un(this.low,this.high,!0)},In.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},In.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},In.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},rn.fromBytes=function(e,t,r){return r?rn.fromBytesLE(e,t):rn.fromBytesBE(e,t)},rn.fromBytesLE=function(e,t){return new rn(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},rn.fromBytesBE=function(e,t){return new rn(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Tn={webSocketTimeout:5e3,signalTimeout:3e4,pingInterval:15e3,pingTimeout:5e3,pingFailedTimes:2,reconnectIntervalMin:250,reconnectIntervalMax:64e3,reconnectRaisingBase:2};const Rn=t=>e.ConnectionStatus[t],kn=()=>{const e="ACDeviceId";let t="";const r=kt.get(e);return r?t=r:(t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),kt.set(e,t)),t},Nn=e=>{const t=new Yr;return t.writeIn8(67),t.writeIn8(255),t.writeInt32(e.length+7),t.writeArr(Array.from(e)),t.writeIn8(0),new Int8Array(t.getBytesArray()).buffer},An=e=>{const t=new Qr(new Uint8Array(e));t.readInt8(),t.readInt8();const r=t.readInt32(),n=t.readArr(r-7);if(t.readInt8(),e.byteLength!==r)throw new Error("packet resolve failed");return n};var Ln=new class{constructor(t){h(this,"url",""),h(this,"watcher",void 0),h(this,"provider",void 0),h(this,"options",void 0),h(this,"socket",void 0),h(this,"status",e.ConnectionStatus.DISCONNECTED),h(this,"autoReconnect",!1),h(this,"isAuthorized",!1),h(this,"profile",void 0),h(this,"responseCallbacks",new Map),h(this,"failedCount",0),h(this,"reconnectTimer",void 0),h(this,"token",""),h(this,"connectResolve",void 0),h(this,"idCount",0),this.options=Object.assign(Tn,t)}setServerInfo(e){this.url=e}setCallback(e,t){this.watcher=e,this.provider=t}async connect(t){return this.token=t,new Promise((t=>{this.connectResolve=t,this.open().then((t=>t===e.ErrorCode.SUCCESS?!p(this.provider)||this.provider.needReAuth()?this.auth():e.ErrorCode.SUCCESS:t)).then((r=>{var n;(t(r),r===e.ErrorCode.SUCCESS)?(this.isAuthorized=!0,this.profile=null===(n=this.provider)||void 0===n?void 0:n.profile(),this.autoReconnect=!0,this.onConnect()):this.onDisconnect(r===e.ErrorCode.TIMEOUT?e.ConnectionStatus.NETWORK_UNAVAILABLE:e.ConnectionStatus.WEBSOCKET_UNAVAILABLE)}))}))}async send(t,r,n){var o;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.signalTimeout;const{code:s,data:a}=await this.sendRawData(t,p(r)&&p(n.encoder)?n.encoder.encode(r).finish():new Uint8Array,i);if(0!==s)return{code:s,msg:"time out",data:null};if(!p(a)||!p(n.decoder))return{code:e.ErrorCode.SUCCESS,msg:""};const c=null===(o=n.decoder)||void 0===o?void 0:o.decode(a);return c.errorCode?{code:en(c.errorCode),msg:c.errorMessage,data:null}:{data:c,code:e.ErrorCode.SUCCESS,msg:""}}async sendRawData(t,r){var n,o,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.signalTimeout;if(!this.socket)return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};if(!this.isAuthorized&&!this.isAuthCommand(t))return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};const a=this.generateMessageSeq(),c={cmdId:t,messageSeq:rn.fromNumber(a),deviceId:(null===(n=this.profile)||void 0===n?void 0:n.deviceId)??rn.fromInt(7),sessionId:(null===(o=this.profile)||void 0===o?void 0:o.sessionId)??rn.ZERO,uid:(null===(i=this.profile)||void 0===i?void 0:i.uid)??rn.ZERO,protocolVersion:0,destId:"",body:r,token:this.token};T.reqInfo(`websocket send -> cmd: 0x${t.toString(16)}, messageSeq: ${a}`),this.socket.send(Nn(zr.encode(c).finish()));const l=await new Promise((e=>{this.responseCallbacks.set(a,e),setTimeout((()=>{this.responseCallbacks.get(a)&&this.responseCallbacks.delete(a),e(null)}),s)}));return l?{code:0,data:l}:(T.warn(`send timeout -> cmd: 0x${t.toString(16)}, messageSeq: ${a}, timeout: ${s}`),{code:e.ErrorCode.TIMEOUT})}close(){var t;this.autoReconnect=!1,this.doClose(),this.setStatus(e.ConnectionStatus.DISCONNECTED),null===(t=this.connectResolve)||void 0===t||t.call(this,e.ErrorCode.RC_SOCKET_DISCONNECTED)}async open(){const t=this.url;T.info(`conenct start -> ${t}`),this.setStatus(e.ConnectionStatus.CONNECTING);const r=function(e,t){const r=new WebSocket(e,t);return r.binaryType="arraybuffer",{onClose(e){r.onclose=t=>{const{code:r,reason:n}=t;null==e||e(r,n)}},onError(e){r.onerror=t=>{e(t)}},onMessage(e){r.onmessage=t=>{e(t.data)}},onOpen(e){r.onopen=e},send(e){r.send(e)},close(e,t){r.close(e,t)}}}(this.url);this.socket=r;return await new Promise((n=>{r.onMessage((e=>{"ArrayBuffer"===f(e)?this.onReceiveMessage(e):T.error("Socket received invalid data:",e)})),r.onClose(((t,r)=>{T.warn("websocket closed -> code:",t,"reason:",r),this.onDisconnect(e.ConnectionStatus.CONNECTION_CLOSED),n(e.ErrorCode.RC_SOCKET_DISCONNECTED)})),r.onError((t=>{T.error("websocket error -> ",t),this.onDisconnect(e.ConnectionStatus.WEBSOCKET_ERROR),n(e.ErrorCode.RC_SOCKET_NOT_CREATED)})),r.onOpen((()=>{T.info("websocket open -> ",t),n(e.ErrorCode.SUCCESS)})),setTimeout((()=>{n(e.ErrorCode.TIMEOUT)}),this.options.webSocketTimeout)}))}async auth(){var t,r,n,o;T.info(`start auth -> ${this.token}`);const i={token:this.token,deviceType:7,imei:kn(),brand:"",model:"",apnsToken:"",bandId:""},{code:s,msg:a,data:c}=await this.send(P.Auth,i,{encoder:Vr,decoder:Xr.AuthSignIn2TokenResp},8e3);return s===e.ErrorCode.SUCCESS||c?(T.info("auth success -> ",null===(t=c.user)||void 0===t||null===(r=t.uid)||void 0===r?void 0:r.toString()),null===(n=this.watcher)||void 0===n||null===(o=n.onAuth)||void 0===o||o.call(n,c),e.ErrorCode.SUCCESS):(T.warn("auth failed -> "+a),e.ErrorCode.RC_CONN_NOT_AUTHRORIZED)}async checkAlive(){if(!this.socket||!this.isAuthorized)return;T.debug("send ping ->");const t={pingId:rn.ZERO,disconnectDelay:rn.ZERO},{code:r}=await this.send(P.Heartbean,t,{encoder:Kr},this.options.pingTimeout);r===e.ErrorCode.SUCCESS?(T.debug("recv pong <-"),this.failedCount=0,setTimeout((()=>this.checkAlive()),this.options.pingInterval)):(this.failedCount+=1,T.warn(`ping failed count: ${this.failedCount}, code: ${r}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,T.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.ConnectionStatus.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=An(t);r=Xr.NetworkResponse.decode(e)}catch(t){return T.error("unpack payload error -> ",t),void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER)}if(r.code)return void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER);if(r.cmdId===P.SessionKilledPush)return void this.onDisconnect(e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===P.SignOutPish||r.cmdId===P.SignOutPish2)return void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER);if(r.cmdId===P.UserFrozenToLogin||r.cmdId===P.UserFrozenToLogin2)return void this.onDisconnect(e.ConnectionStatus.BLOCKED);const n=rn.isLong(r.messageSeq)?r.messageSeq.toNumber():0;T.reqInfo(`websocket recv ack -> messageSeq: ${n}`);const o=this.responseCallbacks.get(n);var i;p(o)?(o(r.body),this.responseCallbacks.delete(n)):(T.reqInfo(`websocket recv -> cmd: 0x${r.cmdId.toString(16)}, messageSeq: ${n}`),null===(i=this.watcher)||void 0===i||i.message(r.cmdId,r.body))}async try2Reconnect(){this.reconnectTimer=setTimeout((()=>{this.reconnectTimer=null,this.connect(this.token)}),5e3)}onConnect(){this.setStatus(e.ConnectionStatus.CONNECTED),this.checkAlive(),p(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}onDisconnect(e){p(this.socket)&&(this.doClose(),this.isConnectionAvailable()&&(this.setStatus(e),this.autoReconnect&&this.isConnectionAvailable()&&this.try2Reconnect()))}doClose(){if(p(this.socket)){const e=this.socket;this.socket=null,e.onClose(null),e.close()}p(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.isAuthorized=!1,this.profile=null;for(const e of this.responseCallbacks.values())e(null);this.responseCallbacks.clear()}isConnectionAvailable(){return this.status!==e.ConnectionStatus.DISCONNECTED&&this.status!==e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.ConnectionStatus.BLOCKED&&this.status!==e.ConnectionStatus.DISCONNECT_BY_SERVER}setStatus(e){var t;e!==this.status&&(T.info(`socketServer is changing status from ${Rn(this.status)} to ${Rn(e)}`),this.status=e,null===(t=this.watcher)||void 0===t||t.status(e))}isAuthCommand(e){return e===P.Auth}generateMessageSeq(){return++this.idCount}};var Mn=new class{constructor(){h(this,"_user",void 0),this._user=this.createDefaultUser()}get uid(){return this.user.uid.toString()}get user(){return this._user}setLogged(e,t){const r=e.user;p(r)&&(this._user={active:!0,uid:r.uid??rn.UZERO,deviceId:e.deviceId,sessionId:e.sessionId,token:t})}logOut(){this._user=this.createDefaultUser()}createDefaultUser(){return{active:!1,uid:rn.UZERO,deviceId:rn.UZERO,sessionId:rn.UZERO,token:""}}},xn=Lt.exports,Dn=xn.Reader,Bn=xn.util,Un=xn.roots.default||(xn.roots.default={});Un.NewMessageNotificationResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.seqno=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.NewMessageNotificationResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.seqno=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NewMessageNotificationResp"},e}(),Un.SendPrivateChatMessageResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.msgId=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.seqno=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.SendPrivateChatMessageResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageResp"},e}(),Un.GetNewMessageResp=function(){function e(e){if(this.msg={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.offset=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.seqno=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.msg=Bn.emptyObject,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Un.GetNewMessageResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.offset=e.int64();break;case 4:i.seqno=e.int64();break;case 5:i.msg===Bn.emptyObject&&(i.msg={});var a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=Un.DialogMessageList.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.msg[r]=n;break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageResp"},e}(),Un.DialogMessageList=function(){function e(e){if(this.dialogMessage=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogMessage=Bn.emptyArray,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.DialogMessageList;e.pos<r;){var o=e.uint32();if(o>>>3==1)n.dialogMessage&&n.dialogMessage.length||(n.dialogMessage=[]),n.dialogMessage.push(Un.DialogMessage.decode(e,e.uint32()));else e.skipType(7&o)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessageList"},e}(),Un.DialogMessage=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.localId=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.msgStatus=0,e.prototype.srcId=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.destId="",e.prototype.isOut=!1,e.prototype.senderCategory=0,e.prototype.msgCategory=0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.burnAfterReadingFlag=!1,e.prototype.atFlag=!1,e.prototype.replyFlag=!1,e.prototype.referenceFlag=!1,e.prototype.msgIdReferenced=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.uploadFlag=!1,e.prototype.burnAfterReadingTime=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.sharingGroupFlag=!1,e.prototype.seqno=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.extra="",e.prototype.msgContent=Bn.newBuffer([]),e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.DialogMessage;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.msgId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgStatus=e.int32();break;case 4:n.srcId=e.int64();break;case 5:n.destId=e.string();break;case 6:n.isOut=e.bool();break;case 7:n.senderCategory=e.int32();break;case 8:n.msgCategory=e.int32();break;case 9:n.msgPreContent=e.string();break;case 10:n.msgPostContent=e.string();break;case 11:n.mediaFlag=e.bool();break;case 12:n.mediaConstructor=e.int32();break;case 13:n.mediaAttribute=e.string();break;case 14:n.msgSendTime=e.int64();break;case 15:n.burnAfterReadingFlag=e.bool();break;case 16:n.atFlag=e.bool();break;case 17:n.replyFlag=e.bool();break;case 18:n.referenceFlag=e.bool();break;case 19:n.msgIdReferenced=e.int64();break;case 20:n.uploadFlag=e.bool();break;case 21:n.burnAfterReadingTime=e.int64();break;case 22:n.sharingGroupFlag=e.bool();break;case 23:n.seqno=e.int64();break;case 24:n.extra=e.string();break;case 25:n.msgContent=e.bytes();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessage"},e}(),Un.GetBriefDialogListResp=function(){function e(e){if(this.notExistDestId=[],this.briefDialog={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.notExistDestId=Bn.emptyArray,e.prototype.seqno=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.briefDialog=Bn.emptyObject,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Un.GetBriefDialogListResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:if(i.notExistDestId&&i.notExistDestId.length||(i.notExistDestId=[]),2==(7&s))for(var a=e.uint32()+e.pos;e.pos<a;)i.notExistDestId.push(e.int64());else i.notExistDestId.push(e.int64());break;case 4:i.seqno=e.int64();break;case 5:i.briefDialog===Bn.emptyObject&&(i.briefDialog={});a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=Un.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.briefDialog[r]=n;break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListResp"},e}(),Un.BriefDialog=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.dialogTitle="",e.prototype.smallAvatarUrl="",e.prototype.backgroundImage="",e.prototype.stickyFlag=!1,e.prototype.muteFlag=!1,e.prototype.blockFlag=!1,e.prototype.burnAfterReadingFlag=!1,e.prototype.takeScreenshotFlag=!1,e.prototype.groupFlag=!1,e.prototype.pushNotificationLevel=0,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.BriefDialog;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.destId=e.string();break;case 2:n.dialogTitle=e.string();break;case 3:n.smallAvatarUrl=e.string();break;case 4:n.backgroundImage=e.string();break;case 5:n.stickyFlag=e.bool();break;case 6:n.muteFlag=e.bool();break;case 7:n.blockFlag=e.bool();break;case 8:n.burnAfterReadingFlag=e.bool();break;case 9:n.takeScreenshotFlag=e.bool();break;case 10:n.groupFlag=e.bool();break;case 15:n.pushNotificationLevel=e.int32();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BriefDialog"},e}(),Un.GetDialogKeyResp=function(){function e(e){if(this.retryUid=[],this.entry={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.dialogKeyVersion=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.prototype.retryUid=Bn.emptyArray,e.prototype.entry=Bn.emptyObject,e.prototype.serverSign="",e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Un.GetDialogKeyResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.dialogKeyVersion=e.int64();break;case 4:if(i.retryUid&&i.retryUid.length||(i.retryUid=[]),2==(7&s))for(var a=e.uint32()+e.pos;e.pos<a;)i.retryUid.push(e.int64());else i.retryUid.push(e.int64());break;case 5:i.entry===Bn.emptyObject&&(i.entry={});a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=Un.AesKeyAndIV.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.entry[r]=n;break;case 6:i.serverSign=e.string();break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyResp"},e}(),Un.AesKeyAndIV=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.AesKeyAndIV;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AesKeyAndIV"},e}(),Un.GetHistoryMessageResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.msg=null,e.prototype.isEnd=!1,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.GetHistoryMessageResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.msg=Un.DialogMessageList.decode(e,e.uint32());break;case 4:n.isEnd=e.bool();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageResp"},e}(),Un.GetWebDialogListResp=function(){function e(e){if(this.fullDialog=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.fullDialog=Bn.emptyArray,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.GetWebDialogListResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.fullDialog&&n.fullDialog.length||(n.fullDialog=[]),n.fullDialog.push(Un.WebFullDialog.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListResp"},e}(),Un.WebFullDialog=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialog=null,e.prototype.msg=null,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Un.WebFullDialog;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.dialog=Un.BriefDialog.decode(e,e.uint32());break;case 2:n.msg=Un.DialogMessage.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebFullDialog"},e}(),Un.GetNewSettingDialogListResp=function(){function e(e){if(this.briefDialog={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.briefDialog=Bn.emptyObject,e.prototype.setTime=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Dn||(e=Dn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Un.GetNewSettingDialogListResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.briefDialog===Bn.emptyObject&&(i.briefDialog={});var a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=Un.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.briefDialog[r]=n;break;case 4:i.setTime=e.int64();break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListResp"},e}();var jn=Un;var Pn=new class{constructor(){h(this,"_token",""),h(this,"_uploadUrl",""),h(this,"_downloadUrl",""),h(this,"_cert","")}set imInitToken(e){this._token=e}get imInitToken(){return this._token}get fileUploadUrl(){return this._uploadUrl}get cert(){return this._cert}get fileDownloadUrl(){return this._downloadUrl}setFileServerInfo(e,t,r){this._uploadUrl=e,this._downloadUrl=t,this._cert=r}getFileAbsoluteUri(e){return E(e)?e.startsWith("http")?e:this.fileDownloadUrl+e:e}try2ExtractFileRelativeUri(e){return E(e)&&e.startsWith(this.fileDownloadUrl)?e.substring(this.fileDownloadUrl.length):e}};const Fn="SG",Gn="::",qn=t=>{if(!E(t.targetId+""))return"";switch(t.conversationType){case e.ConversationType.PRIVATE:return"P::"+t.targetId;case e.ConversationType.GROUP:return"G::"+t.targetId;case e.ConversationType.ULTRA_GROUP:return`SG::${t.targetId}_${t.channelId??""}`;default:return""}},Hn=t=>{if(!E(t))return null;const r=t.split(Gn);if(2!==r.length)return null;const n=r[0];if("G"===n)return{conversationType:e.ConversationType.GROUP,targetId:r[1]};if("P"===n)return{conversationType:e.ConversationType.PRIVATE,targetId:r[1]};if(n===Fn){const t=r[1].indexOf("_");if(t>0){const n=r[1].substring(0,t),o=r[1].substring(t+1);return{conversationType:e.ConversationType.ULTRA_GROUP,targetId:n,channelId:o}}return 0===t?null:{conversationType:e.ConversationType.ULTRA_GROUP,targetId:r[1]}}return null},zn=e=>e.startsWith(Fn)||e.startsWith("G");var Kn=Lt.exports,Vn=Kn.Writer,Wn=Kn.util,$n=Kn.roots.default||(Kn.roots.default={});$n.SendPrivateChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.localId=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.extra="",e.prototype.thumbnail="",e.prototype.msgContent=Wn.newBuffer([]),e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(66).string(e.extra),null!=e.thumbnail&&Object.hasOwnProperty.call(e,"thumbnail")&&t.uint32(74).string(e.thumbnail),null!=e.msgContent&&Object.hasOwnProperty.call(e,"msgContent")&&t.uint32(82).bytes(e.msgContent),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageReq"},e}(),$n.DeletePrivateChatDialogReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatDialogReq"},e}(),$n.GetNewMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.offset=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(16).int32(e.rows),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageReq"},e}(),$n.UpdatePrivateChatDialogStickyConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogStickyConfigReq"},e}(),$n.UpdatePrivateChatDialogMuteConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogMuteConfigReq"},e}(),$n.DeleteChatMessageReq=function(){function e(e){if(this.msgIdList=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=Wn.emptyArray,e.encode=function(e,t){if(t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(var r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}return t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteChatMessageReq"},e}(),$n.DeletePrivateChatHistoryReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatHistoryReq"},e}(),$n.CleanHistoryMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.type=0,e.prototype.msgTime=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(16).int32(e.type),null!=e.msgTime&&Object.hasOwnProperty.call(e,"msgTime")&&t.uint32(24).int64(e.msgTime),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/CleanHistoryMessageReq"},e}(),$n.GetBriefDialogListReq=function(){function e(e){if(this.destId=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=Wn.emptyArray,e.encode=function(e,t){if(t||(t=Vn.create()),null!=e.destId&&e.destId.length)for(var r=0;r<e.destId.length;++r)t.uint32(10).string(e.destId[r]);return t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListReq"},e}(),$n.GetDialogKeyReq=function(){function e(e){if(this.destId=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=Wn.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=Vn.create()),null!=e.destId&&e.destId.length)for(var r=0;r<e.destId.length;++r)t.uint32(10).string(e.destId[r]);return null!=e.clientSign&&Object.hasOwnProperty.call(e,"clientSign")&&t.uint32(18).string(e.clientSign),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyReq"},e}(),$n.RecallPrivateChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallPrivateChatMessageReq"},e}(),$n.GetHistoryMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogKeys="",e.prototype.offset=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.dialogKeys&&Object.hasOwnProperty.call(e,"dialogKeys")&&t.uint32(10).string(e.dialogKeys),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.oldOffset&&Object.hasOwnProperty.call(e,"oldOffset")&&t.uint32(24).int64(e.oldOffset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(32).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(40).bool(e.newToOld),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageReq"},e}(),$n.GetWebDialogListReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type=0,e.prototype.offset=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(24).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(32).bool(e.newToOld),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListReq"},e}(),$n.GetNewSettingDialogListReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.time=Wn.Long?Wn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Vn.create()),null!=e.time&&Object.hasOwnProperty.call(e,"time")&&t.uint32(8).int64(e.time),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListReq"},e}();var Jn=$n,Zn=Lt.exports,Xn=Zn.Writer,Yn=Zn.util,Qn=Zn.roots.default||(Zn.roots.default={});Qn.SendGroupChatMessageReq=function(){function e(e){if(this.at=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.localId=Yn.Long?Yn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=Yn.emptyArray,e.prototype.extra="",e.prototype.assign="",e.prototype.atAll=!1,e.prototype.msgContent=Yn.newBuffer([]),e.encode=function(e,t){if(t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(var r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(74).string(e.extra),null!=e.assign&&Object.hasOwnProperty.call(e,"assign")&&t.uint32(82).string(e.assign),null!=e.atAll&&Object.hasOwnProperty.call(e,"atAll")&&t.uint32(88).bool(e.atAll),null!=e.msgContent&&Object.hasOwnProperty.call(e,"msgContent")&&t.uint32(98).bytes(e.msgContent),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageReq"},e}(),Qn.DeleteGroupChatHistoryReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.encode=function(e,t){return t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatHistoryReq"},e}(),Qn.UpdateGroupChatDialogStickyConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogStickyConfigReq"},e}(),Qn.UpdateGroupChatDialogMuteConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogMuteConfigReq"},e}(),Qn.RecallGroupChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.msgId=Yn.Long?Yn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallGroupChatMessageReq"},e}(),Qn.DeleteGroupChatDialogReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.encode=function(e,t){return t||(t=Xn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatDialogReq"},e}();var eo=Qn;const to=Lt.exports.Reader,ro=Lt.exports.util,no=Lt.exports.roots.default||(Lt.exports.roots.default={}),oo=no.SendGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=ro.Long?ro.Long.fromBits(0,0,!1):0,e.prototype.msgId=ro.Long?ro.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=ro.Long?ro.Long.fromBits(0,0,!1):0,e.prototype.seqno=ro.Long?ro.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof to||(e=to.create(e));let r=void 0===t?e.len:e.pos+t,n=new no.SendGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageResp"},e})(),io=e=>{const t={dialogKeys:e.dialogId,newToOld:e.newToOld,rows:e.count};return e.newToOld?t.offset=rn.fromNumber(e.offset):t.oldOffset=rn.fromNumber(e.offset),Ln.send(e.dialogId.startsWith(Fn)?P.GetSuperGroupRemoteMessages:P.GetRemoteMessages,t,{encoder:Jn.GetHistoryMessageReq,decoder:jn.GetHistoryMessageResp})};let so=0;const ao=async()=>{const t=(new Date).getTime(),{code:r,data:n}=await Ln.send(P.GetServerTime,null,{decoder:Xr.SystemCurrentTimeMillisResp});if(r===e.ErrorCode.SUCCESS){const{currentTimeMillis:e}=n;so=e.toNumber()-t}},co=()=>(new Date).getTime()+so,lo=new Set;var uo={addMessage(e){lo.add(e)},remove(e){lo.delete(e)},has:e=>lo.has(e),reset(){lo.clear()}};const ho=new Set;var fo={addMessage(e){ho.add(e)},remove(e){ho.delete(e)},has:e=>ho.has(e),reset(){ho.clear()}};const po=new Map;function go(e){po.set(e.getObjectId(),e.decode.bind(e))}class yo{constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];h(this,"messageType",void 0),h(this,"content",void 0),h(this,"isPersited",void 0),h(this,"isCounted",void 0),h(this,"isStatusMessage",void 0),this.messageType=e,this.content=t,o?(this.isPersited=!1,this.isCounted=!1):(this.isPersited=r,this.isCounted=n),this.isStatusMessage=o}get objectId(){return this.constructor.getObjectId()}static getObjectId(){throw new Error("Method not implemented.")}static decode(e){throw new Error("Method not implemented.")}encode(){throw new Error("Method not implemented.")}}const vo=0,mo=268439552,bo=268439563,Co=268439562,wo=268439553,Eo=268439581,So=268439597,Oo=268439613,_o=268439629,Io=1610678301,To=268439645,Ro="RC:TxtMsg",ko="RC:HQVCMsg",No="RC:FileMsg",Ao="RC:ImgMsg",Lo="RC:GIFMsg",Mo="RC:RcNtf",xo="RC:CmdMsg";class Do extends yo{constructor(e){super(Ro,e)}static getObjectId(){return vo}static decode(e){const{user:t,extra:r,content:n}=e;return new Do({user:t,extra:r,content:n})}encode(){const{user:e,extra:t,content:r}=this.content;return{user:e,extra:t,content:r}}}class Bo extends yo{constructor(e){super(Ao,e)}static getObjectId(){return mo}static decode(e){const{user:t,extra:r,thumbnailObjectKey:n,originalObjectKey:o,width:i,height:s}=e;return new Bo({user:t,extra:r,content:n,imageUri:Pn.getFileAbsoluteUri(o),width:i,height:s})}encode(){const{user:e,extra:t,content:r,imageUri:n,width:o,height:i}=this.content;return{user:e,extra:t,thumbnailObjectKey:r,originalObjectKey:Pn.try2ExtractFileRelativeUri(n),width:o&&Math.floor(o),height:i&&Math.floor(i)}}}class Uo extends yo{constructor(e){super(Lo,e)}static getObjectId(){return bo}static decode(e){const{user:t,extra:r,size:n,originalObjectKey:o,width:i,height:s}=e;return new Uo({user:t,extra:r,gifDataSize:n,remoteUrl:Pn.getFileAbsoluteUri(o),width:i,height:s})}encode(){const{user:e,extra:t,gifDataSize:r,remoteUrl:n,width:o,height:i}=this.content;return{user:e,extra:t,size:r,originalObjectKey:Pn.try2ExtractFileRelativeUri(n),width:o&&Math.floor(o),height:i&&Math.floor(i),extension:"gif"}}}class jo extends yo{constructor(e){super(ko,e)}static getObjectId(){return wo}static decode(e){const{user:t,extra:r,length:n,audioObjectKey:o,extension:i}=e;return new jo({user:t,extra:r,remoteUrl:Pn.getFileAbsoluteUri(o),duration:n,type:i})}encode(){const{user:e,extra:t,remoteUrl:r,duration:n,type:o}=this.content;return{user:e,extra:t,length:n,audioObjectKey:Pn.try2ExtractFileRelativeUri(r),extension:o}}}class Po extends yo{constructor(e){super(No,e)}static getObjectId(){return Co}static decode(e){const{user:t,extra:r,title:n,extension:o,size:i,originalObjectKey:s}=e;return new Po({user:t,extra:r,name:n,size:i,type:o,fileUrl:Pn.getFileAbsoluteUri(s)})}encode(){const{user:e,extra:t,name:r,size:n,type:o,fileUrl:i}=this.content;return{user:e,extra:t,title:r,originalObjectKey:Pn.try2ExtractFileRelativeUri(i),extension:o,size:n}}}class Fo extends yo{constructor(e){super(Mo,e,!0,!1,!1)}static getObjectId(){return Io}static decode(e){return new Fo(e)}encode(){return this.content}}class Go extends yo{constructor(e){super(xo,e,!1,!1)}static getObjectId(){return To}static decode(e){return new Go(e)}encode(){return this.content}}class qo extends yo{static decode(e){const{messageType:t,fields:r,user:n,extra:o}=e;return new this(t,{...r,user:n,extra:o})}encode(){const{user:e,extra:t,mentionedInfo:r,...n}=this.content;return{messageType:this.messageType,fields:n,user:e,extra:t}}}class Ho extends qo{constructor(e,t){super(e,t,!1,!1)}static getObjectId(){return Eo}}class zo extends qo{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return So}}class Ko extends qo{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return Oo}}class Vo extends qo{constructor(e,t){super(e,t,!1,!1,!0)}static getObjectId(){return _o}}var Wo=new class{constructor(){h(this,"aesKeyRecord",new Map)}async getDialogAesKey(e){return E(e)?this.aesKeyRecord.has(e)?this.aesKeyRecord.get(e):new Promise((t=>{this.getDialogAesKeyListFromRemote([e]).then((r=>{t(r.get(e))})),setTimeout((()=>{t(null)}),8e3)})):null}getDialogAesKeyList(e){return new Promise((t=>{const r=new Map;this.getDialogAesKeyListInBatches(e,((n,o)=>{if(o.size)for(const[e,t]of o)r.set(e,t);(r.size===e.length||n)&&t(r)}))}))}getDialogAesKeyListInBatches(e,t){const r=new Map,n=[];e.forEach((e=>{if(!E(e))return;const t=this.getDialogAesKeyFromLocal(e);t?r.set(e,t):n.push(e)})),t(!1,r),n.length&&this.getDialogAesKeyListFromRemote(n).then((e=>{t(!0,e)}))}reset(){this.aesKeyRecord.clear()}async getDialogAesKeyListFromRemote(t){if(!t.length)return new Map;const{code:r,data:n}=await(o=t,Ln.send(P.GetDialogKey,{destId:o,clientSign:""},{encoder:Jn.GetDialogKeyReq,decoder:jn.GetDialogKeyResp}));var o;if(r===e.ErrorCode.SUCCESS){const e=new Map;for(const t in n.entry){var i,s;const r=n.entry[t];if(null!==(i=r.aesKey)&&void 0!==i&&i.length&&null!==(s=r.aesIV)&&void 0!==s&&s.length){const n={key:r.aesKey,iv:r.aesIV};e.set(t,n),this.aesKeyRecord.set(t,n)}}return e}return new Map}getDialogAesKeyFromLocal(e){return E(e)?this.aesKeyRecord.get(e):null}};const $o="time",Jo=(e,t)=>[e,t,$o].join("_");class Zo{constructor(e,t){h(this,"appkey",void 0),h(this,"userId",void 0),h(this,"inBoxOffset",rn.ZERO),this.appkey=e,this.userId=t}setInboxOffset(e){if(this.inBoxOffset>e)return;this.inBoxOffset=e;const t=Jo(this.appkey,this.userId);kt.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=Jo(this.appkey,this.userId);this.inBoxOffset=rn.fromString(kt.get(e)??"0")}return this.inBoxOffset}}const Xo=e=>{const t=[];let r,n,o;for(n=0;n<e.length;++n)for(r=e[n],o=3;o>=0;--o)t.push(r>>8*o&255);return new Uint8Array(t)};const Yo=(e,t,r)=>{const n={};return e.forEach((e=>{const o=Qo(e,t.get(e),r.get(e));o.length&&(n[e]=o)})),n},Qo=(t,r,n)=>{const o=Hn(t);if(!o)return[];const i=new Set;let s=[];return r.forEach((t=>{const r=t;let a=r.mediaConstructor,c=ei(r,n);if(!c)return;if(1610678290===a||1610743841===a){const{msgId:e,sendTime:t}=c,n={sentTime:t,messageUId:e,conversationType:o.conversationType,targetId:r.isOut?o.targetId:Mn.uid,channelId:o.channelId};a=Io,c=n,i.add(e)}const l=function(e,t){const r=po.get(e);return r?r(t):null}(a,c);if(p(l)){const t={...o,senderUserId:r.srcId.toString(),messageDirection:r.isOut?e.MessageDirection.SEND:e.MessageDirection.RECEIVE,isCounted:l.isCounted,isMentioned:r.atFlag,content:l.content,messageType:l.messageType,isOffLineMessage:!1,isPersited:l.isPersited,messageId:rn.isLong(r.localId)?r.localId.toNumber():void 0,messageUId:r.msgId.toString(),sentTime:r.seqno.toNumber(),receivedTime:co(),isStatusMessage:l.isStatusMessage,receivedStatus:e.ReceivedStatus.READ,disableNotification:!1};if(t.isStatusMessage&&co()-t.sentTime>6e3)return;s.push(t)}})),i.size&&(s=s.filter((e=>!i.has(e.messageUId)))),s},ei=(e,t)=>{try{var r,n;let o;o=null!==(r=e.msgContent)&&void 0!==r&&r.length?((e,t)=>{const r=window.btoa(String.fromCharCode(...e));return Et.AES.decrypt(r,Et.enc.Utf8.parse(t.key),{iv:p(t.iv)?Et.enc.Utf8.parse(t.iv):void 0}).toString(Et.enc.Utf8)})(e.msgContent,t):e.msgPreContent??"",1610678290!==e.mediaConstructor&&1610743841!==e.mediaConstructor||(o=ti(o));let i={};return null!==(n=o)&&void 0!==n&&n.length&&(i=JSON.parse(o)),i}catch(t){return T.error("decode message content fail -> uid:",e.msgId.toString()),null}},ti=e=>e.replace(/("msgId")\s*:\s*(\d+)/g,((e,t,r)=>`${t}:"${r}"`));var ri={parse:function(e,t){const r=new Map;if(Object.keys(e).forEach((t=>{var n;const o=null===(n=e[t].dialogMessage)||void 0===n?void 0:n.filter((e=>!e.sharingGroupFlag));null!=o&&o.length&&r.set(t,o)})),!r.size)return void t(!0,{});const n=new Set(r.keys());Wo.getDialogAesKeyListInBatches([...r.keys()],((e,o)=>{if(o.size){const e=[...o.keys()];for(const t of e)n.delete(t);t(!n.size,Yo(e,r,o))}n.size&&e&&t(!0,{})}))},parseSingleDialogMessages:Qo};function ni(e){if(!p(e))return e;if(Array.isArray(e))return e.map((e=>ni(e)));if(b(e)){const t={};return Object.keys(e).forEach((r=>{t[r]=ni(e[r])})),t}return e}const oi={unreadMessageCount:{keyName:"c",defaultVal:0},lastUnreadTime:{keyName:"t",defaultVal:0},notificationStatus:{keyName:"nc",defaultVal:2},notificationLevel:{keyName:"nl",defaultVal:0},isTop:{keyName:"it",defaultVal:!1},mentionedUIds:{keyName:"mu",defaultVal:null}};class ii{constructor(e,t){h(this,"localStore",void 0);const r=`con-${e}-${t}`;this.localStore=new At(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}getConOptionByKey(t){const r=(t=t||"").split("_");if(r.length>=2){const e=r.shift(),t=r.shift(),n=r.join("_");return{conversationType:Number(e),targetId:t,channelId:n}}return{conversationType:e.ConversationType.PRIVATE,targetId:"",channelId:""}}updateUnreadCount(t){const{conversationType:r,targetId:n,channelId:o,content:i,messageType:s,sentTime:a,isCounted:c,messageDirection:l}=t,u=l===e.MessageDirection.SEND,d=s===Mo,h=b(i),f={conversationType:r,targetId:n,channelId:o},p=this.get(f)||{},g=p.lastUnreadTime||0,y=p.unreadMessageCount||0;if(!(g>a)&&!u){if(c&&(p.unreadMessageCount=y+1,p.lastUnreadTime=a),d&&h){g>=i.sentTime&&y&&(p.unreadMessageCount=y-1)}this.set(f,p)}}updateMentionedData(t){const{conversationType:r,targetId:n,channelId:o,messageUId:i,messageType:s,isMentioned:a,messageDirection:c,content:l}=t;if(c===e.MessageDirection.SEND||!a&&s!==Mo)return;const u=this.getStoreKey({conversationType:r,targetId:n,channelId:o}),d=this.localStore.get(u)||{},h=oi.mentionedUIds.keyName,f=d[h]||[];if(a&&r===e.ConversationType.GROUP&&(f.includes(i)||f.push(i)),s===Mo&&r===e.ConversationType.GROUP){const e=l,t=f.indexOf(e.messageUId);t>=0&&f.splice(t,1)}f.length?d[h]=f:delete d[h],S(d)?this.localStore.set(u,d):this.localStore.remove(u)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of St(t)){const r=oi[e],o=t[e];if(v(null==r?void 0:r.keyName)||v(o))continue;o===r.defaultVal?delete n[r.keyName]:n[r.keyName]=o,n[oi.unreadMessageCount.keyName]||(delete n[oi.lastUnreadTime.keyName],delete n[oi.mentionedUIds.keyName])}S(n)?this.localStore.set(r,n):this.localStore.remove(r)}get(e){const t=this.getStoreKey(e),r=this.localStore.get(t)||{},n={};for(const e of St(oi)){const{keyName:t,defaultVal:i}=oi[e];var o;if("mentionedUIds"===e)n.unreadMentionedCount=(null===(o=r[t])||void 0===o?void 0:o.length)??0,n.hasMentioned=!!n.unreadMentionedCount;else n[e]=r[t]||ni(i)}return n}getAll(){const e=this.localStore.getCache()||{},t=[];for(const r in e){const n=this.getConOptionByKey(r),o=e[r];for(const e of St(oi)){const{keyName:t,defaultVal:r}=oi[e];"mentionedUIds"!==e&&(n[e]=o[t]||ni(r))}t.push(n)}return t}}const si=t=>{const r=t.destId??"",n=Hn(r);if(!n)return;return{...n,unreadMessageCount:0,notificationStatus:t.muteFlag?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE,notificationLevel:g(t.pushNotificationLevel)&&0!==t.pushNotificationLevel&&p(e.NotificationLevel[t.pushNotificationLevel])?t.pushNotificationLevel:t.muteFlag?e.NotificationLevel.AT_USER_NOTIFICATION:e.NotificationLevel.NOT_SET,isTop:!!t.stickyFlag,lastUnreadTime:0}},ai="STATUS_CHANGED";class ci{constructor(e,t){h(this,"storageKey",void 0),h(this,"eventEmitter",void 0),h(this,"isPulling",!1),this.storageKey=`con-s-${e}-${t}`,this.eventEmitter=new U}async pull(){if(this.isPulling)return;let t;this.isPulling=!0;const r=kt.get(this.storageKey);t=g(r)&&r>0?r:co()-1e4;let{code:n,data:o}=await(e=>Ln.send(P.GetDialogChangedStatus,{time:rn.fromNumber(e)},{encoder:Jn.GetNewSettingDialogListReq,decoder:jn.GetNewSettingDialogListResp}))(t);n===e.ErrorCode.SUCCESS&&(o.setTime.toNumber()>0&&kt.set(this.storageKey,o.setTime.toNumber()),o.briefDialog&&St(o.briefDialog).forEach((e=>{const t=o.briefDialog[e],r=si(t);r&&this.eventEmitter.emit(ai,r)}))),this.isPulling=!1}watch(e){this.eventEmitter.on(ai,(t=>{e(t)}))}}class li{constructor(e,t,r){h(this,"updatedConversationFunc",void 0),h(this,"store",void 0),h(this,"draftMap",new Map),h(this,"localConversationSet",new Set),h(this,"updatedConversations",[]),h(this,"notify",void 0),h(this,"statusManager",void 0),this.updatedConversationFunc=r,this.store=new ii(e,t),this.notify=_t(this.notifyConversationChanged.bind(this),0),this.statusManager=new ci(e,t),this.statusManager.watch((e=>{this.addStatus(e,!0)}))}getConversationKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}setUpdatedConversation(e){const t=this.updatedConversations.findIndex((t=>this.getConversationKey(e.conversation)===this.getConversationKey(t.conversation)));t>=0?(e={conversation:Object.assign(this.updatedConversations[t].conversation,e.conversation),updatedItems:Object.assign(this.updatedConversations[t].updatedItems,e.updatedItems)},this.updatedConversations[t]=e):this.updatedConversations.push(e),this.notify()}notifyConversationChanged(){var e;const t=this.updatedConversations.map((e=>({conversation:{...e.conversation,...this.store.get(e.conversation)},updatedItems:e.updatedItems})));this.updatedConversations=[],null===(e=this.updatedConversationFunc)||void 0===e||e.call(this,t)}syncConversationStatus(){this.statusManager.pull()}async loadConvsationsIfNotExist(t){if(null==t||!t.length)return;const r=t.filter((e=>!this.localConversationSet.has(this.getConversationKey(e))));if(!r.length)return;const n=r.map(qn).filter(E);if(!n.length)return;const{code:o,data:i}=await(e=>Ln.send(P.GetBriefDialogList,{destId:e},{encoder:Jn.GetBriefDialogListReq,decoder:jn.GetBriefDialogListResp}))(n);o===e.ErrorCode.SUCCESS&&St(i.briefDialog).forEach((e=>{const t=i.briefDialog[e],r=si(t);r&&(this.localConversationSet.add(this.getConversationKey(r)),this.addStatus(r,!0))}))}addLocalConversation(e){const{conversationType:t,targetId:r,channelId:n,isTop:o,notificationStatus:i,notificationLevel:s}=e;this.localConversationSet.add(this.getConversationKey(e)),this.addStatus({conversationType:t,targetId:r,channelId:n,isTop:o,notificationStatus:i,notificationLevel:s},!1)}addStatus(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{conversationType:r,targetId:n,notificationStatus:o,notificationLevel:i,isTop:s,channelId:a}=e,c={conversationType:r,targetId:n,channelId:a},l=co(),u=this.store.get(c),d={};p(i)&&u.notificationLevel!==i&&(d.notificationLevel={time:l,val:i}),p(o)&&u.notificationStatus!==o&&(d.notificationStatus={time:l,val:o}),p(s)&&u.isTop!==s&&(d.isTop={time:l,val:s}),this.store.set(c,{notificationStatus:o,isTop:s,notificationLevel:i}),Object.keys(d).length&&t&&this.setUpdatedConversation({conversation:c,updatedItems:d})}setConversationCacheByMessage(e){const{conversationType:t,isPersited:r,targetId:n,channelId:o}=e,i={conversationType:t,targetId:n,channelId:o},s={conversation:i,updatedItems:{}},a=ni(this.get(i));this.store.updateUnreadCount(e),this.store.updateMentionedData(e);const c=this.get(i);a.unreadMessageCount!==c.unreadMessageCount&&(s.updatedItems.unreadMessageCount={time:e.sentTime,val:c.unreadMessageCount}),a.hasMentioned!==c.hasMentioned&&(s.updatedItems.hasMentioned={time:e.sentTime,val:c.hasMentioned}),a.unreadMentionedCount!==c.unreadMentionedCount&&(s.updatedItems.unreadMentionedCount={time:e.sentTime,val:c.unreadMentionedCount}),r&&(s.conversation.latestMessage=e,s.updatedItems.latestMessage={time:e.sentTime,val:e}),Object.keys(s.updatedItems).length&&this.setUpdatedConversation(s)}get(e){return this.store.get(e)}getAllUnreadCount(t,r){const n=this.store.getAll();let o=0;return n.forEach((n=>{let{unreadMessageCount:i,notificationStatus:s,notificationLevel:a,conversationType:c}=n;i=i||0;const l=s===e.NotificationStatus.OPEN||a>0;!r&&l||(t.length>0?t.includes(+c)&&(o+=+i):o+=+i)})),o}getUnreadCount(e){return this.store.get(e).unreadMessageCount||0}clearUnreadCount(e){const t=this.store.get(e),{unreadMessageCount:r,unreadMentionedCount:n}=t;(r||n)&&(t.unreadMessageCount=0,t.hasMentioned=!1,t.unreadMentionedCount=0),this.store.set(e,t);const o={};r&&(o.unreadMessageCount={val:0,time:co()}),n&&(o.hasMentioned={val:!1,time:co()},o.unreadMentionedCount={val:0,time:co()}),Object.keys(o).length&&this.setUpdatedConversation({conversation:e,updatedItems:o})}clearAllUnreadCount(){this.store.getAll().forEach((e=>this.clearUnreadCount(e)))}getNotificationLevel(e){return this.store.get(e).notificationLevel}getNotificationStatus(e){return this.store.get(e).notificationStatus||2}setDraft(e,t){this.draftMap.set(this.getConversationKey(e),t)}getDraft(e){return this.draftMap.get(this.getConversationKey(e))??""}clearDraft(e){this.draftMap.delete(this.getConversationKey(e))}getBlockConversationList(){return this.store.getAll().filter((t=>t.notificationStatus===e.NotificationStatus.OPEN||t.notificationLevel>0)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId})))}getTopConversationList(){return(this.store.getAll()||{}).filter((e=>e.isTop)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId})))}getUnreadMentionedCount(e){return this.get(e).unreadMentionedCount||0}getAllUnreadMentionedCount(){const e=this.store.getAll();let t=0;return e.forEach((e=>{let{unreadMentionedCount:r}=e;r=r||0,t+=Number(r)})),t}getAllConversationState(){return this.store.getAll().map((e=>{let{conversationType:t,targetId:r,channelId:n,unreadMessageCount:o,unreadMentionedCount:i,notificationLevel:s,notificationStatus:a,isTop:c}=e;return{conversationType:t,targetId:r,channelId:n,unreadCount:o,unreadMentionedCount:i??0,notificationLevel:s,notificationStatus:a,isTop:c}}))}destroyed(){this.updatedConversationFunc=void 0}}const ui={addStatus:function(e,t){},setConversationCacheByMessage:function(e){},get:function(e){return null},getAllUnreadCount:function(e,t){return 0},getUnreadCount:function(e){return 0},clearUnreadCount:function(e){},clearAllUnreadCount(){},getNotificationLevel:function(t){return e.NotificationLevel.NOT_SET},getNotificationStatus:function(t){return e.NotificationStatus.CLOSE},setDraft:function(e,t){},getDraft:function(e){return""},clearDraft:function(e){},getBlockConversationList:function(){return[]},getTopConversationList:function(){return[]},getUnreadMentionedCount:function(e){return 0},getAllUnreadMentionedCount:function(){return 0},getAllConversationState:function(){return[]},addLocalConversation:function(e){},loadConvsationsIfNotExist:function(e){},destroyed(){},syncConversationStatus:function(){}};let di;var hi={create(e,t,r){di=new li(e,t,r)},get:()=>di??ui};class fi{constructor(e,t){h(this,"watcher",void 0),h(this,"pullingMsg",!1),h(this,"letterbox",void 0),h(this,"serverMsgSeqno",rn.ZERO),h(this,"pullOfflineFinished",!1),h(this,"intervalTimer",void 0),h(this,"retryTimer",void 0),h(this,"latestSyncTimestamp",0),h(this,"started",!1),this.watcher=e,this.letterbox=new Zo(t.appkey,Mn.uid)}start(){this.started=!0,this.pullOfflineFinished=!1,this.startPullInterval()}stop(){this.started=!1,this.stopPullInterval(),this.cancelRetryTask()}syncMsg(e){this.serverMsgSeqno=e,this.pullMsg()}startPullInterval(){this.stopPullInterval();this.intervalTimer=setInterval((()=>{Date.now()-this.latestSyncTimestamp>=18e4&&this.pullMsg()}),3e4),this.latestSyncTimestamp=Date.now(),this.pullMsg()}stopPullInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}try2RePullMsg(){this.retryTimer=setTimeout((()=>{this.retryTimer=null,this.pullMsg()}),1e3)}cancelRetryTask(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async pullMsg(){if(this.pullingMsg)return;if(!this.started)return;this.cancelRetryTask(),this.pullingMsg=!0;const t=this.letterbox.getInboxOffset();this.pullOfflineFinished||T.info(`pullMsg -> time: ${t}`),this.latestSyncTimestamp=Date.now();const{code:r,data:n}=await((e,t)=>Ln.send(P.GetNewMessage,{offset:e,rows:t},{encoder:Jn.GetNewMessageReq,decoder:jn.GetNewMessageResp}))(t,60);if(r!==e.ErrorCode.SUCCESS)return this.pullOfflineFinished||T.warn("pullMsg failed -> code:",r),this.pullingMsg=!1,void this.try2RePullMsg();const{offset:o,seqno:i,msg:s}=n,a=Object.keys(s).map(Hn).filter((e=>p(e)));hi.get().loadConvsationsIfNotExist(a),ri.parse(s,((t,r)=>{const n=[],s=[],a=!this.pullOfflineFinished;var c,l;(Object.keys(r).forEach((t=>{const o=r[t],i=[];if(o.forEach((t=>{t.messageDirection===e.MessageDirection.SEND&&t.messageId&&uo.has(t.messageId)?uo.remove(t.messageId):t.messageType===Mo&&fo.has(t.content.messageUId)?fo.remove(t.content.messageUId):(t.isOffLineMessage=a,hi.get().setConversationCacheByMessage(t),i.push(t))})),n.push(...i),this.isExistPersistedMessage(i)){const e=Hn(t);e&&s.push(e)}})),n.length)&&(null===(c=(l=this.watcher).batchMessage)||void 0===c||c.call(l,n));if(s.length&&hi.get().loadConvsationsIfNotExist(s),t){var u;i.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=i);const e=this.serverMsgSeqno.lessThanOrEqual(o);this.pullOfflineFinished||T.info(`pullMsg success -> syncTime: ${o}, finished: ${e}`),null===(u=this.letterbox)||void 0===u||u.setInboxOffset(o),this.pullingMsg=!1,e&&!this.pullOfflineFinished&&(this.pullOfflineFinished=!0,this.watcher.pullFinished&&this.watcher.pullFinished()),e||this.pullMsg()}}))}isExistPersistedMessage(e){return e.some((e=>e.isPersited))}}class pi{static init(e){return this._loader||(this._loader=new pi(e)),this._loader}static get loader(){return this._loader}constructor(t){h(this,"options",void 0),h(this,"connectionStatus",e.ConnectionStatus.DISCONNECTED),h(this,"isInternalConnected",!1),h(this,"watcher",void 0),h(this,"messageLoader",void 0),this.options=t,this.watcher={onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,pullFinished:void 0,batchMessage:void 0,conversationState:void 0},Ln.setServerInfo(this.getWebSocketUrl()),Ln.setCallback({status:this.connectionStatusListener.bind(this),message:this.messageListener.bind(this),onAuth:this.authListener.bind(this)},{needReAuth:this.needReAuthProvider.bind(this),profile:this.needProfileProvider.bind(this)}),this.registerMessage()}getWebSocketUrl(){var e;const t=null===(e=this.options)||void 0===e?void 0:e.serverInfo;return E(t)?w(r=t)&&/wss?:\/\//.test(r)?t:"ws://"+t:"wss://tt.mimelabs.xyz:8991";var r}registerMessage(){go(Do),go(Bo),go(Uo),go(jo),go(Ho),go(Ko),go(zo),go(Vo),go(Fo),go(Go),go(Po)}async connect(t){if(this.connectionStatus===e.ConnectionStatus.CONNECTED)return{code:e.ErrorCode.SUCCESS,userId:Mn.uid+""};if(this.connectionStatus===e.ConnectionStatus.CONNECTING)return{code:e.ErrorCode.BIZ_ERROR_CONNECTING};if("string"!=typeof t||0===t.length)return{code:e.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR};Pn.imInitToken=t;const r=await Ln.connect(t);var n;r===e.ErrorCode.SUCCESS&&(this.isInternalConnected=!0,hi.get().destroyed(),hi.create(this.options.appkey,Mn.uid,this.watcher.conversationState),null===(n=this.messageLoader)||void 0===n||n.stop(),this.messageLoader=new fi(this.watcher,this.options),ao(),uo.reset(),fo.reset(),Wo.reset());return{code:r,userId:Mn.uid+""}}reconnect(){return this.isInternalConnected?Promise.resolve({code:e.ErrorCode.CAN_NOT_RECONNECT}):this.connect(Pn.imInitToken)}disconnect(){return this.isInternalConnected=!1,Ln.close(),Promise.resolve()}getConnectionStatus(){return this.connectionStatus}assignWatcher(e){St(this.watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];this.watcher[t]=m(r)?r:void 0}}))}resetWatcher(){St(this.watcher).forEach((e=>{this.watcher[e]=void 0}))}async connectionStatusListener(t){this.connectionStatus=t,setTimeout((()=>{switch(t){case e.ConnectionStatus.BLOCKED:case e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.ConnectionStatus.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.ConnectionStatus.CONNECTING:this.handleConnecting();break;case e.ConnectionStatus.CONNECTED:this.handleConnected();break;case e.ConnectionStatus.DISCONNECTED:this.handleDisconnect()}}),0)}handleConnecting(){var e,t;null===(e=(t=this.watcher).onConnecting)||void 0===e||e.call(t)}handleConnected(){var t,r,n;null===(t=(r=this.watcher).onConnected)||void 0===t||t.call(r),null===(n=this.messageLoader)||void 0===n||n.start(),setTimeout((()=>{this.connectionStatus===e.ConnectionStatus.CONNECTED&&hi.get().syncConversationStatus()}),2e3)}handleDisconnect(){var e,t,r;null===(e=(t=this.watcher).onDisconnect)||void 0===e||e.call(t),null===(r=this.messageLoader)||void 0===r||r.stop()}handleSuspend(){var e,t;null===(e=(t=this.watcher).onSuspend)||void 0===e||e.call(t)}messageListener(e,t){if(e===P.NewMessagePush){var r;const e=jn.NewMessageNotificationResp.decode(t);null===(r=this.messageLoader)||void 0===r||r.syncMsg(e.seqno)}else e===P.DialogChangedPush&&hi.get().syncConversationStatus()}authListener(e){Pn.setFileServerInfo(e.fileDomain,e.dialogFileDomain,e.cert),Mn.setLogged(e,Pn.imInitToken)}needReAuthProvider(){return!Mn.user.active||Mn.user.token!==Pn.imInitToken}needProfileProvider(){if(!this.needReAuthProvider()){const{deviceId:e,sessionId:t,uid:r}=Mn.user;return{deviceId:e,sessionId:t,uid:r}}return null}}h(pi,"_loader",void 0);var gi,yi,vi,mi,bi={exports:{}},Ci={exports:{}},wi={exports:{}},Ei={exports:{}};var Si,Oi={};var _i,Ii,Ti,Ri,ki,Ni,Ai,Li,Mi,xi,Di,Bi,Ui,ji={};function Pi(){return _i||(_i=1,function(e){var t=e,r=ms(),n=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,o={};for(t|=0;r<e.length;)o[n[r+t]]=e[r++];return o}t.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),t.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),t.long=o([0,0,0,1,1],7),t.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),t.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])}(ji)),ji}function Fi(){if(Ti)return Ii;Ti=1,Ii=s;var e=bs();((s.prototype=Object.create(e.prototype)).constructor=s).className="Field";var t,r=Cs(),n=Pi(),o=ms(),i=/^required|optional|repeated$/;function s(t,r,s,a,c,l,u){if(o.isObject(a)?(u=c,l=a,a=c=void 0):o.isObject(c)&&(u=l,l=c,c=void 0),e.call(this,t,l),!o.isInteger(r)||r<0)throw TypeError("id must be a non-negative integer");if(!o.isString(s))throw TypeError("type must be a string");if(void 0!==a&&!i.test(a=a.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==c&&!o.isString(c))throw TypeError("extend must be a string");"proto3_optional"===a&&(a="optional"),this.rule=a&&"optional"!==a?a:void 0,this.type=s,this.id=r,this.extend=c||void 0,this.required="required"===a,this.optional=!this.required,this.repeated="repeated"===a,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!o.Long&&void 0!==n.long[s],this.bytes="bytes"===s,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}return s.fromJSON=function(e,t){return new s(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(s.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),s.prototype.setOption=function(t,r,n){return"packed"===t&&(this._packed=null),e.prototype.setOption.call(this,t,r,n)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=n.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof t?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof r&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof r)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=o.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var i;o.base64.test(this.typeDefault)?o.base64.decode(this.typeDefault,i=o.newBuffer(o.base64.length(this.typeDefault)),0):o.utf8.write(this.typeDefault,i=o.newBuffer(o.utf8.length(this.typeDefault)),0),this.typeDefault=i}return this.map?this.defaultValue=o.emptyObject:this.repeated?this.defaultValue=o.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof t&&(this.parent.ctor.prototype[this.name]=this.defaultValue),e.prototype.resolve.call(this)},s.d=function(e,t,r,n){return"function"==typeof t?t=o.decorateType(t).name:t&&"object"==typeof t&&(t=o.decorateEnum(t).name),function(i,a){o.decorateType(i.constructor).add(new s(a,e,t,r,{default:n}))}},s._configure=function(e){t=e},Ii}function Gi(){if(ki)return Ri;ki=1,Ri=n;var e=bs();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=Fi(),r=ms();function n(t,r,n,o){if(Array.isArray(r)||(n=r,r=void 0),e.call(this,t,n),void 0!==r&&!Array.isArray(r))throw TypeError("fieldNames must be an Array");this.oneof=r||[],this.fieldsArray=[],this.comment=o}function o(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}return n.fromJSON=function(e,t){return new n(e,t.oneof,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},n.prototype.add=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,o(this),this},n.prototype.remove=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),(r=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(r,1),e.partOf=null,this},n.prototype.onAdd=function(t){e.prototype.onAdd.call(this,t);for(var r=0;r<this.oneof.length;++r){var n=t.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}o(this)},n.prototype.onRemove=function(t){for(var r,n=0;n<this.fieldsArray.length;++n)(r=this.fieldsArray[n]).parent&&r.parent.remove(r);e.prototype.onRemove.call(this,t)},n.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,o){r.decorateType(t.constructor).add(new n(o,e)),Object.defineProperty(t,o,{get:r.oneOfGetter(e),set:r.oneOfSetter(e)})}},Ri}function qi(){if(Ai)return Ni;Ai=1,Ni=c;var e=bs();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=Fi(),i=ms(),s=Gi();function a(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function c(t,r){e.call(this,t,r),this.nested=void 0,this._nestedArray=null}function l(e){return e._nestedArray=null,e}return c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=a,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=i.toArray(this.nested))}}),c.prototype.toJSON=function(e){return i.toObject(["options",this.options,"nested",a(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var i,s=Object.keys(e),a=0;a<s.length;++a)i=e[s[a]],this.add((void 0!==i.fields?t.fromJSON:void 0!==i.values?n.fromJSON:void 0!==i.methods?r.fromJSON:void 0!==i.id?o.fromJSON:c.fromJSON)(s[a],i));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof t||e instanceof s||e instanceof n||e instanceof r||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var i=this.get(e.name);if(i){if(!(i instanceof c&&e instanceof c)||i instanceof t||i instanceof r)throw Error("duplicate name '"+e.name+"' in "+this);for(var a=i.nestedArray,u=0;u<a.length;++u)e.add(a[u]);this.remove(i),this.nested||(this.nested={}),e.setOptions(i.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),l(this)},c.prototype.remove=function(t){if(!(t instanceof e))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),l(this)},c.prototype.define=function(e,t){if(i.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(n))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),i.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof c&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof c&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var r=this.lookup(e,[t]);if(!r)throw Error("no such type: "+e);return r},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[t,n]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r},c.prototype.lookupService=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,o,i){t=e,r=o,n=i},Ni}function Hi(){if(Mi)return Li;Mi=1,Li=n;var e=Fi();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=Pi(),r=ms();function n(t,n,o,i,s,a){if(e.call(this,t,n,i,void 0,void 0,s,a),!r.isString(o))throw TypeError("keyType must be a string");this.keyType=o,this.resolvedKeyType=null,this.map=!0}return n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===t.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return e.prototype.resolve.call(this)},n.d=function(e,t,o){return"function"==typeof o?o=r.decorateType(o).name:o&&"object"==typeof o&&(o=r.decorateEnum(o).name),function(i,s){r.decorateType(i.constructor).add(new n(s,e,t,o))}},Li}function zi(){if(Di)return xi;Di=1,xi=r;var e=bs();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=ms();function r(r,n,o,i,s,a,c,l,u){if(t.isObject(s)?(c=s,s=a=void 0):t.isObject(a)&&(c=a,a=void 0),void 0!==n&&!t.isString(n))throw TypeError("type must be a string");if(!t.isString(o))throw TypeError("requestType must be a string");if(!t.isString(i))throw TypeError("responseType must be a string");e.call(this,r,c),this.type=n||"rpc",this.requestType=o,this.requestStream=!!s||void 0,this.responseType=i,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}return r.fromJSON=function(e,t){return new r(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},r.prototype.toJSON=function(e){var r=!!e&&Boolean(e.keepComments);return t.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])},r.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),e.prototype.resolve.call(this))},xi}function Ki(){if(Ui)return Bi;Ui=1,Bi=o;var e=qi();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=zi(),r=ms(),n=Br;function o(t,r){e.call(this,t,r),this.methods={},this._methodsArray=null}function i(e){return e._methodsArray=null,e}return o.fromJSON=function(e,r){var n=new o(e,r.options);if(r.methods)for(var i=Object.keys(r.methods),s=0;s<i.length;++s)n.add(t.fromJSON(i[s],r.methods[i[s]]));return r.nested&&n.addJSON(r.nested),n.comment=r.comment,n},o.prototype.toJSON=function(t){var n=e.prototype.toJSON.call(this,t),o=!!t&&Boolean(t.keepComments);return r.toObject(["options",n&&n.options||void 0,"methods",e.arrayToJSON(this.methodsArray,t)||{},"nested",n&&n.nested||void 0,"comment",o?this.comment:void 0])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=r.toArray(this.methods))}}),o.prototype.get=function(t){return this.methods[t]||e.prototype.get.call(this,t)},o.prototype.resolveAll=function(){for(var t=this.methodsArray,r=0;r<t.length;++r)t[r].resolve();return e.prototype.resolve.call(this)},o.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof t?(this.methods[r.name]=r,r.parent=this,i(this)):e.prototype.add.call(this,r)},o.prototype.remove=function(r){if(r instanceof t){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,i(this)}return e.prototype.remove.call(this,r)},o.prototype.create=function(e,t,o){for(var i,s=new n.Service(e,t,o),a=0;a<this.methodsArray.length;++a){var c=r.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");s[c]=r.codegen(["r","c"],r.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return s},Bi}var Vi,Wi,$i,Ji,Zi=Yi,Xi=Xt();function Yi(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}function Qi(){if(Wi)return Vi;Wi=1,Vi=function(o){var i=r.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&i("if((t&7)===4)")("break");i("switch(t>>>3){");for(var s=0;s<o.fieldsArray.length;++s){var a=o._fieldsArray[s].resolve(),c=a.resolvedType instanceof e?"int32":a.type,l="m"+r.safeProp(a.name);i("case %i: {",a.id),a.map?(i("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==t.defaults[a.keyType]?i("k=%j",t.defaults[a.keyType]):i("k=null"),void 0!==t.defaults[c]?i("value=%j",t.defaults[c]):i("value=null"),i("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===t.basic[c]?i("value=types[%i].decode(r,r.uint32())",s):i("value=r.%s()",c),i("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==t.long[a.keyType]?i('%s[typeof k==="object"?util.longToHash(k):k]=value',l):i("%s[k]=value",l)):a.repeated?(i("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==t.packed[c]&&i("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===t.basic[c]?i(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,s):i("%s.push(r.%s())",l,c)):void 0===t.basic[c]?i(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,s):i("%s=r.%s()",l,c),i("break")("}")}for(i("default:")("r.skipType(t&7)")("break")("}")("}"),s=0;s<o._fieldsArray.length;++s){var u=o._fieldsArray[s];u.required&&i("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",n(u))}return i("return m")};var e=Cs(),t=Pi(),r=ms();function n(e){return"missing required '"+e.name+"'"}return Vi}function es(){if(Ji)return $i;Ji=1,$i=function(e){var i=t.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),s=e.oneofsArray,a={};s.length&&i("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+t.safeProp(l.name);if(l.optional&&i("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)i("if(!util.isObject(%s))",u)("return%j",r(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),o(i,l,"k[i]"),n(i,l,c,u+"[k[i]]")("}");else if(l.repeated)i("if(!Array.isArray(%s))",u)("return%j",r(l,"array"))("for(var i=0;i<%s.length;++i){",u),n(i,l,c,u+"[i]")("}");else{if(l.partOf){var d=t.safeProp(l.partOf.name);1===a[l.partOf.name]&&i("if(p%s===1)",d)("return%j",l.partOf.name+": multiple values"),a[l.partOf.name]=1,i("p%s=1",d)}n(i,l,c,u)}l.optional&&i("}")}return i("return null")};var e=Cs(),t=ms();function r(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function n(t,n,o,i){if(n.resolvedType)if(n.resolvedType instanceof e){t("switch(%s){",i)("default:")("return%j",r(n,"enum value"));for(var s=Object.keys(n.resolvedType.values),a=0;a<s.length;++a)t("case %i:",n.resolvedType.values[s[a]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s);",o,i)("if(e)")("return%j+e",n.name+".")("}");else switch(n.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",i)("return%j",r(n,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",r(n,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',i)("return%j",r(n,"number"));break;case"bool":t('if(typeof %s!=="boolean")',i)("return%j",r(n,"boolean"));break;case"string":t("if(!util.isString(%s))",i)("return%j",r(n,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",r(n,"buffer"))}return t}function o(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",r(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",r(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",r(t,"boolean key"))}return e}return $i}Yi.create=function(e){return this.$type.create(e)},Yi.encode=function(e,t){return this.$type.encode(e,t)},Yi.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},Yi.decode=function(e){return this.$type.decode(e)},Yi.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},Yi.verify=function(e){return this.$type.verify(e)},Yi.fromObject=function(e){return this.$type.fromObject(e)},Yi.toObject=function(e,t){return this.$type.toObject(e,t)},Yi.prototype.toJSON=function(){return this.$type.toObject(this,Xi.toJSONOptions)};var ts,rs={};function ns(){return ts||(ts=1,function(e){var t=e,r=Cs(),n=ms();function o(e,t,n,o){var i=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",o);for(var s=t.resolvedType.values,a=Object.keys(s),c=0;c<a.length;++c)s[a[c]]!==t.typeDefault||i||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',o,o,o),t.repeated||e("break"),i=!0),e("case%j:",a[c])("case %i:",s[a[c]])("m%s=%j",o,s[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',o)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",o,n,o);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",o,o);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,l)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length >= 0)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function i(e,t,n,o){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",o,n,o,o,n,o,o):e("d%s=types[%i].toObject(m%s,o)",o,n,o);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,i?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,i=n.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return i("return new this.ctor");i("var m=new this.ctor");for(var s=0;s<t.length;++s){var a=t[s].resolve(),c=n.safeProp(a.name);a.map?(i("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(i,a,s,c+"[ks[i]]")("}")("}")):a.repeated?(i("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(i,a,s,c+"[i]")("}")("}")):(a.resolvedType instanceof r||i("if(d%s!=null){",c),o(i,a,s,c),a.resolvedType instanceof r||i("}"))}return i("return m")},t.toObject=function(e){var t=e.fieldsArray.slice().sort(n.compareFieldsById);if(!t.length)return n.codegen()("return {}");for(var o=n.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),s=[],a=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?s:t[l].map?a:c).push(t[l]);if(s.length){for(o("if(o.arrays||o.defaults){"),l=0;l<s.length;++l)o("d%s=[]",n.safeProp(s[l].name));o("}")}if(a.length){for(o("if(o.objects||o.defaults){"),l=0;l<a.length;++l)o("d%s={}",n.safeProp(a[l].name));o("}")}if(c.length){for(o("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],d=n.safeProp(u.name);if(u.resolvedType instanceof r)o("d%s=o.enums===String?%j:%j",d,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)o("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",d)("}else")("d%s=o.longs===String?%j:%i",d,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var h="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";o("if(o.bytes===String)d%s=%j",d,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",d,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",d,d)("}")}else o("d%s=%j",d,u.typeDefault)}o("}")}var f=!1;for(l=0;l<t.length;++l){u=t[l];var p=e._fieldsArray.indexOf(u);d=n.safeProp(u.name);u.map?(f||(f=!0,o("var ks2")),o("if(m%s&&(ks2=Object.keys(m%s)).length){",d,d)("d%s={}",d)("for(var j=0;j<ks2.length;++j){"),i(o,u,p,d+"[ks2[j]]")("}")):u.repeated?(o("if(m%s&&m%s.length){",d,d)("d%s=[]",d)("for(var j=0;j<m%s.length;++j){",d),i(o,u,p,d+"[j]")("}")):(o("if(m%s!=null&&m.hasOwnProperty(%j)){",d,u.name),i(o,u,p,d),u.partOf&&o("if(o.oneofs)")("d%s=%j",n.safeProp(u.partOf.name),u.name)),o("}")}return o("return d")}}(rs)),rs}var os,is,ss,as,cs,ls,us,ds,hs,fs,ps,gs={};function ys(){if(is)return os;is=1,os=g;var e=qi();((g.prototype=Object.create(e.prototype)).constructor=g).className="Type";var t=Cs(),r=Gi(),n=Fi(),o=Hi(),i=Ki(),s=Zi,a=Cr,c=Qt,l=ms(),u=ws(),d=Qi(),h=es(),f=ns(),p=gs;function g(t,r){e.call(this,t,r),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}return Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=l.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=l.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=g.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof s||((e.prototype=new s).constructor=e,l.merge(e.prototype,t)),e.$type=e.prototype.$type=this,l.merge(e,s,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:l.oneOfGetter(this._oneofsArray[r].oneof),set:l.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),g.generateConstructor=function(e){for(var t,r=l.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",l.safeProp(t.name)):t.repeated&&r("this%s=[]",l.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},g.fromJSON=function(s,a){var c=new g(s,a.options);c.extensions=a.extensions,c.reserved=a.reserved;for(var l=Object.keys(a.fields),u=0;u<l.length;++u)c.add((void 0!==a.fields[l[u]].keyType?o.fromJSON:n.fromJSON)(l[u],a.fields[l[u]]));if(a.oneofs)for(l=Object.keys(a.oneofs),u=0;u<l.length;++u)c.add(r.fromJSON(l[u],a.oneofs[l[u]]));if(a.nested)for(l=Object.keys(a.nested),u=0;u<l.length;++u){var d=a.nested[l[u]];c.add((void 0!==d.id?n.fromJSON:void 0!==d.fields?g.fromJSON:void 0!==d.values?t.fromJSON:void 0!==d.methods?i.fromJSON:e.fromJSON)(l[u],d))}return a.extensions&&a.extensions.length&&(c.extensions=a.extensions),a.reserved&&a.reserved.length&&(c.reserved=a.reserved),a.group&&(c.group=!0),a.comment&&(c.comment=a.comment),c},g.prototype.toJSON=function(t){var r=e.prototype.toJSON.call(this,t),n=!!t&&Boolean(t.keepComments);return l.toObject(["options",r&&r.options||void 0,"oneofs",e.arrayToJSON(this.oneofsArray,t),"fields",e.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),t)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])},g.prototype.resolveAll=function(){for(var t=this.fieldsArray,r=0;r<t.length;)t[r++].resolve();var n=this.oneofsArray;for(r=0;r<n.length;)n[r++].resolve();return e.prototype.resolveAll.call(this)},g.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},g.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof n&&void 0===t.extend){if(this._fieldsById?this._fieldsById[t.id]:this.fieldsById[t.id])throw Error("duplicate id "+t.id+" in "+this);if(this.isReservedId(t.id))throw Error("id "+t.id+" is reserved in "+this);if(this.isReservedName(t.name))throw Error("name '"+t.name+"' is reserved in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),y(this)}return t instanceof r?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),y(this)):e.prototype.add.call(this,t)},g.prototype.remove=function(t){if(t instanceof n&&void 0===t.extend){if(!this.fields||this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.parent=null,t.onRemove(this),y(this)}if(t instanceof r){if(!this.oneofs||this.oneofs[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.oneofs[t.name],t.parent=null,t.onRemove(this),y(this)}return e.prototype.remove.call(this,t)},g.prototype.isReservedId=function(t){return e.isReservedId(this.reserved,t)},g.prototype.isReservedName=function(t){return e.isReservedName(this.reserved,t)},g.prototype.create=function(e){return new this.ctor(e)},g.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=u(this)({Writer:c,types:t,util:l}),this.decode=d(this)({Reader:a,types:t,util:l}),this.verify=h(this)({types:t,util:l}),this.fromObject=f.fromObject(this)({types:t,util:l}),this.toObject=f.toObject(this)({types:t,util:l});var n=p[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},g.prototype.encode=function(e,t){return this.setup().encode(e,t)},g.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},g.prototype.decode=function(e,t){return this.setup().decode(e,t)},g.prototype.decodeDelimited=function(e){return e instanceof a||(e=a.create(e)),this.decode(e,e.uint32())},g.prototype.verify=function(e){return this.setup().verify(e)},g.prototype.fromObject=function(e){return this.setup().fromObject(e)},g.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},g.d=function(e){return function(t){l.decorateType(t,e)}},os}function vs(){if(as)return ss;as=1,ss=c;var e=qi();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=Fi(),i=Cs(),s=Gi(),a=ms();function c(t){e.call(this,"",t),this.deferred=[],this.files=[]}function l(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=a.path.resolve,c.prototype.fetch=a.fetch,c.prototype.load=function e(t,o,i){"function"==typeof o&&(i=o,o=void 0);var s=this;if(!i)return a.asPromise(e,s,t,o);var c=i===l;function u(e,t){if(i){var r=i;if(i=null,c)throw e;r(e,t)}}function d(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in n)return r}return null}function h(e,t){try{if(a.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),a.isString(t)){r.filename=e;var n,i=r(t,s,o),l=0;if(i.imports)for(;l<i.imports.length;++l)(n=d(i.imports[l])||s.resolvePath(e,i.imports[l]))&&f(n);if(i.weakImports)for(l=0;l<i.weakImports.length;++l)(n=d(i.weakImports[l])||s.resolvePath(e,i.weakImports[l]))&&f(n,!0)}else s.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}c||p||u(null,s)}function f(e,t){if(e=d(e)||e,!(s.files.indexOf(e)>-1))if(s.files.push(e),e in n)c?h(e,n[e]):(++p,setTimeout((function(){--p,h(e,n[e])})));else if(c){var r;try{r=a.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}h(e,r)}else++p,s.fetch(e,(function(r,n){--p,i&&(r?t?p||u(null,s):u(r):h(e,n))}))}var p=0;a.isString(t)&&(t=[t]);for(var g,y=0;y<t.length;++y)(g=s.resolvePath("",t[y]))&&f(g);if(c)return s;p||u(null,s)},c.prototype.loadSync=function(e,t){if(!a.isNode)throw Error("not supported");return this.load(e,t,l)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return e.prototype.resolveAll.call(this)};var u=/^[A-Z]/;function d(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new o(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}return c.prototype._handleAdd=function(e){if(e instanceof o)void 0===e.extend||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof i)u.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof s)){if(e instanceof t)for(var r=0;r<this.deferred.length;)d(0,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);u.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(t){if(t instanceof o){if(void 0!==t.extend)if(t.extensionField)t.extensionField.parent.remove(t.extensionField),t.extensionField=null;else{var r=this.deferred.indexOf(t);r>-1&&this.deferred.splice(r,1)}}else if(t instanceof i)u.test(t.name)&&delete t.parent[t.name];else if(t instanceof e){for(var n=0;n<t.nestedArray.length;++n)this._handleRemove(t._nestedArray[n]);u.test(t.name)&&delete t.parent[t.name]}},c._configure=function(e,o,i){t=e,r=o,n=i},ss}function ms(){return cs||(cs=1,function(e){var t,r,n=e.exports=Xt(),o=Fr;n.codegen=function(){if(yi)return gi;function e(t,r){"string"==typeof t&&(r=t,t=void 0);var n=[];function o(t){if("string"!=typeof t){var r=i();if(e.verbose&&console.log("codegen: "+r),r="return "+r,t){for(var s=Object.keys(t),a=new Array(s.length+1),c=new Array(s.length),l=0;l<s.length;)a[l]=s[l],c[l]=t[s[l++]];return a[l]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var u=new Array(arguments.length-1),d=0;d<u.length;)u[d]=arguments[++d];if(d=0,t=t.replace(/%([%dfijs])/g,(function(e,t){var r=u[d++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),d!==u.length)throw Error("parameter count mismatch");return n.push(t),o}function i(e){return"function "+(e||r||"")+"("+(t&&t.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return o.toString=i,o}return yi=1,gi=e,e.verbose=!1,gi}(),n.fetch=function(){if(mi)return vi;mi=1,vi=r;var e=Dt,t=Kt();function r(n,o,i){return"function"==typeof o?(i=o,o={}):o||(o={}),i?!o.xhr&&t&&t.readFile?t.readFile(n,(function(e,t){return e&&"undefined"!=typeof XMLHttpRequest?r.xhr(n,o,i):e?i(e):i(null,o.binary?t:t.toString("utf8"))})):r.xhr(n,o,i):e(r,this,n,o)}return r.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o<n.responseText.length;++o)e.push(255&n.responseText.charCodeAt(o))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()},vi}(),n.path=(Si||(Si=1,function(e){var t=e,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var i=0;i<t.length;)".."===t[i]?i>0&&".."!==t[i-1]?t.splice(--i,2):n?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}}(Oi)),Oi),n.fs=n.inquire("fs"),n.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},n.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t};var i=/\\/g,s=/"/g;n.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},n.safeProp=function(e){return!/^[$\w_]+$/.test(e)||n.isReserved(e)?'["'+e.replace(i,"\\\\").replace(s,'\\"')+'"]':"."+e},n.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var a=/_([a-z])/g;n.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(a,(function(e,t){return t.toUpperCase()}))},n.compareFieldsById=function(e,t){return e.id-t.id},n.decorateType=function(e,r){if(e.$type)return r&&e.$type.name!==r&&(n.decorateRoot.remove(e.$type),e.$type.name=r,n.decorateRoot.add(e.$type)),e.$type;t||(t=ys());var o=new t(r||e.name);return n.decorateRoot.add(o),o.ctor=e,Object.defineProperty(e,"$type",{value:o,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:o,enumerable:!1}),o};var c=0;n.decorateEnum=function(e){if(e.$type)return e.$type;r||(r=Cs());var t=new r("Enum"+c++,e);return n.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},n.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var o=r.shift();if("__proto__"===o)return t;if(r.length>0)t[o]=e(t[o]||{},r,n);else{var i=t[o];i&&(n=[].concat(i).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(n,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(vs()))}})}(Ei)),Ei.exports}function bs(){if(us)return ls;us=1,ls=r,r.className="ReflectionObject";var e,t=ms();function r(e,r){if(!t.isString(e))throw TypeError("name must be a string");if(r&&!t.isObject(r))throw TypeError("options must be an object");this.options=r,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(r.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),r.prototype.toJSON=function(){throw Error()},r.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;r instanceof e&&r._handleAdd(this)},r.prototype.onRemove=function(t){var r=t.root;r instanceof e&&r._handleRemove(this),this.parent=null,this.resolved=!1},r.prototype.resolve=function(){return this.resolved||this.root instanceof e&&(this.resolved=!0),this},r.prototype.getOption=function(e){if(this.options)return this.options[e]},r.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},r.prototype.setParsedOption=function(e,r,n){this.parsedOptions||(this.parsedOptions=[]);var o=this.parsedOptions;if(n){var i=o.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(i){var s=i[e];t.setProperty(s,n,r)}else(i={})[e]=t.setProperty({},n,r),o.push(i)}else{var a={};a[e]=r,o.push(a)}return this},r.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},r.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},r._configure=function(t){e=t},ls}function Cs(){if(hs)return ds;hs=1,ds=n;var e=bs();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=qi(),r=ms();function n(t,r,n,o,i,s){if(e.call(this,t,n),r&&"object"!=typeof r)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.valuesOptions=s,this.reserved=void 0,r)for(var a=Object.keys(r),c=0;c<a.length;++c)"number"==typeof r[a[c]]&&(this.valuesById[this.values[a[c]]=r[a[c]]]=a[c])}return n.fromJSON=function(e,t){var r=new n(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},n.prototype.add=function(e,t,n,o){if(!r.isString(e))throw TypeError("name must be a string");if(!r.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return o&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=o||null),this.comments[e]=n||null,this},n.prototype.remove=function(e){if(!r.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},n.prototype.isReservedId=function(e){return t.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return t.isReservedName(this.reserved,e)},ds}function ws(){if(ps)return fs;ps=1,fs=function(o){for(var i,s=r.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),a=o.fieldsArray.slice().sort(r.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=o._fieldsArray.indexOf(l),d=l.resolvedType instanceof e?"int32":l.type,h=t.basic[d];i="m"+r.safeProp(l.name),l.map?(s("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",i,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",i)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|t.mapKey[l.keyType],l.keyType),void 0===h?s("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,i):s(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,d,i),s("}")("}")):l.repeated?(s("if(%s!=null&&%s.length){",i,i),l.packed&&void 0!==t.packed[d]?s("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",d,i)("w.ldelim()"):(s("for(var i=0;i<%s.length;++i)",i),void 0===h?n(s,l,u,i+"[i]"):s("w.uint32(%i).%s(%s[i])",(l.id<<3|h)>>>0,d,i)),s("}")):(l.optional&&s("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,l.name),void 0===h?n(s,l,u,i):s("w.uint32(%i).%s(%s)",(l.id<<3|h)>>>0,d,i))}return s("return w")};var e=Cs(),t=Pi(),r=ms();function n(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}return fs}!function(e){var t=Zi;e[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,r){var n="",o="";if(r&&r.json&&e.type_url&&e.value){o=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var i=this.lookup(o);i&&(e=i.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof t){var s=e.$type.toObject(e,r);return""===n&&(n="type.googleapis.com/"),o=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=o,s}return this.toObject(e,r)}}}(gs),function(e){var t=e.exports=Mt;t.build="light",t.load=function(e,r,n){return"function"==typeof r?(n=r,r=new t.Root):r||(r=new t.Root),r.load(e,n)},t.loadSync=function(e,r){return r||(r=new t.Root),r.loadSync(e)},t.encoder=ws(),t.decoder=Qi(),t.verifier=es(),t.converter=ns(),t.ReflectionObject=bs(),t.Namespace=qi(),t.Root=vs(),t.Enum=Cs(),t.Type=ys(),t.Field=Fi(),t.OneOf=Gi(),t.MapField=Hi(),t.Service=Ki(),t.Method=zi(),t.Message=Zi,t.wrappers=gs,t.types=Pi(),t.util=ms(),t.ReflectionObject._configure(t.Root),t.Namespace._configure(t.Type,t.Service,t.Enum),t.Root._configure(t.Type),t.Field._configure(t.Type)}(wi);var Es=Ms,Ss=/[\s{}=;:[\],'"()<>]/g,Os=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,_s=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Is=/^ *[*/]+ */,Ts=/^\s*\*?\/*/,Rs=/\n/g,ks=/\s/,Ns=/\\(.?)/g,As={0:"\0",r:"\r",n:"\n",t:"\t"};function Ls(e){return e.replace(Ns,(function(e,t){switch(t){case"\\":case"":return t;default:return As[t]||""}}))}function Ms(e,t){e=e.toString();var r=0,n=e.length,o=1,i=0,s={},a=[],c=null;function l(e){return Error("illegal "+e+" (line "+o+")")}function u(t){return e.charAt(t)}function d(r,n,a){var c,l={type:e.charAt(r++),lineEmpty:!1,leading:a},u=r-(t?2:3);do{if(--u<0||"\n"===(c=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===c||"\t"===c);for(var d=e.substring(r,n).split(Rs),h=0;h<d.length;++h)d[h]=d[h].replace(t?Ts:Is,"").trim();l.text=d.join("\n").trim(),s[o]=l,i=o}function h(t){var r=f(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function f(e){for(var t=e;t<n&&"\n"!==u(t);)t++;return t}function p(){if(a.length>0)return a.shift();if(c)return function(){var t="'"===c?_s:Os;t.lastIndex=r-1;var n=t.exec(e);if(!n)throw l("string");return r=t.lastIndex,g(c),c=null,Ls(n[1])}();var i,s,p,y,v,m=0===r;do{if(r===n)return null;for(i=!1;ks.test(p=u(r));)if("\n"===p&&(m=!0,++o),++r===n)return null;if("/"===u(r)){if(++r===n)throw l("comment");if("/"===u(r))if(t){if(y=r,v=!1,h(r)){v=!0;do{if((r=f(r))===n)break;if(r++,!m)break}while(h(r))}else r=Math.min(n,f(r)+1);v&&(d(y,r,m),m=!0),o++,i=!0}else{for(v="/"===u(y=r+1);"\n"!==u(++r);)if(r===n)return null;++r,v&&(d(y,r-1,m),m=!0),++o,i=!0}else{if("*"!==(p=u(r)))return"/";y=r+1,v=t||"*"===u(y);do{if("\n"===p&&++o,++r===n)throw l("comment");s=p,p=u(r)}while("*"!==s||"/"!==p);++r,v&&(d(y,r-2,m),m=!0),i=!0}}}while(i);var b=r;if(Ss.lastIndex=0,!Ss.test(u(b++)))for(;b<n&&!Ss.test(u(b));)++b;var C=e.substring(r,r=b);return'"'!==C&&"'"!==C||(c=C),C}function g(e){a.push(e)}function y(){if(!a.length){var e=p();if(null===e)return null;g(e)}return a[0]}return Object.defineProperty({next:p,peek:y,push:g,skip:function(e,t){var r=y();if(r===e)return p(),!0;if(!t)throw l("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var r,n=null;return void 0===e?(r=s[o-1],delete s[o-1],r&&(t||"*"===r.type||r.lineEmpty)&&(n=r.leading?r.text:null)):(i<e&&y(),r=s[e],delete s[e],!r||r.lineEmpty||!t&&"/"!==r.type||(n=r.leading?null:r.text)),n}},"line",{get:function(){return o}})}Ms.unescape=Ls;var xs=ra;ra.filename=null,ra.defaults={keepCase:!1};var Ds=Es,Bs=vs(),Us=ys(),js=Fi(),Ps=Hi(),Fs=Gi(),Gs=Cs(),qs=Ki(),Hs=zi(),zs=Pi(),Ks=ms(),Vs=/^[1-9][0-9]*$/,Ws=/^-?[1-9][0-9]*$/,$s=/^0[x][0-9a-fA-F]+$/,Js=/^-?0[x][0-9a-fA-F]+$/,Zs=/^0[0-7]+$/,Xs=/^-?0[0-7]+$/,Ys=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,Qs=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ea=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,ta=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function ra(e,t,r){t instanceof Bs||(r=t,t=new Bs),r||(r=ra.defaults);var n,o,i,s,a,c=r.preferTrailingComment||!1,l=Ds(e,r.alternateCommentMode||!1),u=l.next,d=l.push,h=l.peek,f=l.skip,p=l.cmnt,g=!0,y=!1,v=t,m=r.keepCase?function(e){return e}:Ks.camelCase;function b(e,t,r){var n=ra.filename;return r||(ra.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+l.line+")")}function C(){var e,t=[];do{if('"'!==(e=u())&&"'"!==e)throw b(e);t.push(u()),f(e),e=h()}while('"'===e||"'"===e);return t.join("")}function w(e){var t=u();switch(t){case"'":case'"':return d(t),C();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(Vs.test(e))return r*parseInt(e,10);if($s.test(e))return r*parseInt(e,16);if(Zs.test(e))return r*parseInt(e,8);if(Ys.test(e))return r*parseFloat(e);throw b(e,"number",t)}(t,!0)}catch(r){if(e&&ea.test(t))return t;throw b(t,"value")}}function E(e,t){var r,n;do{!t||'"'!==(r=h())&&"'"!==r?e.push([n=S(u()),f("to",!0)?S(u()):n]):e.push(C())}while(f(",",!0));f(";")}function S(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw b(e,"id");if(Ws.test(e))return parseInt(e,10);if(Js.test(e))return parseInt(e,16);if(Xs.test(e))return parseInt(e,8);throw b(e,"id")}function O(){if(void 0!==n)throw b("package");if(n=u(),!ea.test(n))throw b(n,"name");v=v.define(n),f(";")}function _(){var e,t=h();switch(t){case"weak":e=i||(i=[]),u();break;case"public":u();default:e=o||(o=[])}t=C(),f(";"),e.push(t)}function I(){if(f("="),s=C(),!(y="proto3"===s)&&"proto2"!==s)throw b(s,"syntax");f(";")}function T(e,t){switch(t){case"option":return L(e,t),f(";"),!0;case"message":return k(e,t),!0;case"enum":return A(e,t),!0;case"service":return function(e,t){if(!Qs.test(t=u()))throw b(t,"service name");var r=new qs(t);R(r,(function(e){if(!T(r,e)){if("rpc"!==e)throw b(e);!function(e,t){var r=p(),n=t;if(!Qs.test(t=u()))throw b(t,"name");var o,i,s,a,c=t;f("("),f("stream",!0)&&(i=!0);if(!ea.test(t=u()))throw b(t);o=t,f(")"),f("returns"),f("("),f("stream",!0)&&(a=!0);if(!ea.test(t=u()))throw b(t);s=t,f(")");var l=new Hs(c,n,o,s,i,a);l.comment=r,R(l,(function(e){if("option"!==e)throw b(e);L(l,e),f(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!ea.test(t=u()))throw b(t,"reference");var r=t;R(null,(function(t){switch(t){case"required":case"repeated":N(e,t,r);break;case"optional":N(e,y?"proto3_optional":"optional",r);break;default:if(!y||!ea.test(t))throw b(t);d(t),N(e,"optional",r)}}))}(e,t),!0}return!1}function R(e,t,r){var n=l.line;if(e&&("string"!=typeof e.comment&&(e.comment=p()),e.filename=ra.filename),f("{",!0)){for(var o;"}"!==(o=u());)t(o);f(";",!0)}else r&&r(),f(";"),e&&("string"!=typeof e.comment||c)&&(e.comment=p(n)||e.comment)}function k(e,t){if(!Qs.test(t=u()))throw b(t,"type name");var r=new Us(t);R(r,(function(e){if(!T(r,e))switch(e){case"map":!function(e){f("<");var t=u();if(void 0===zs.mapKey[t])throw b(t,"type");f(",");var r=u();if(!ea.test(r))throw b(r,"type");f(">");var n=u();if(!Qs.test(n))throw b(n,"name");f("=");var o=new Ps(m(n),S(u()),t,r);R(o,(function(e){if("option"!==e)throw b(e);L(o,e),f(";")}),(function(){D(o)})),e.add(o)}(r);break;case"required":case"repeated":N(r,e);break;case"optional":N(r,y?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!Qs.test(t=u()))throw b(t,"name");var r=new Fs(m(t));R(r,(function(e){"option"===e?(L(r,e),f(";")):(d(e),N(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":E(r.extensions||(r.extensions=[]));break;case"reserved":E(r.reserved||(r.reserved=[]),!0);break;default:if(!y||!ea.test(e))throw b(e);d(e),N(r,"optional")}})),e.add(r)}function N(e,t,r){var n=u();if("group"!==n){if(!ea.test(n))throw b(n,"type");var o=u();if(!Qs.test(o))throw b(o,"name");o=m(o),f("=");var i=new js(o,S(u()),n,t,r);if(R(i,(function(e){if("option"!==e)throw b(e);L(i,e),f(";")}),(function(){D(i)})),"proto3_optional"===t){var s=new Fs("_"+o);i.setOption("proto3_optional",!0),s.add(i),e.add(s)}else e.add(i);y||!i.repeated||void 0===zs.packed[n]&&void 0!==zs.basic[n]||i.setOption("packed",!1,!0)}else!function(e,t){var r=u();if(!Qs.test(r))throw b(r,"name");var n=Ks.lcFirst(r);r===n&&(r=Ks.ucFirst(r));f("=");var o=S(u()),i=new Us(r);i.group=!0;var s=new js(n,o,r,t);s.filename=ra.filename,R(i,(function(e){switch(e){case"option":L(i,e),f(";");break;case"required":case"repeated":N(i,e);break;case"optional":N(i,y?"proto3_optional":"optional");break;case"message":k(i,e);break;case"enum":A(i,e);break;default:throw b(e)}})),e.add(i).add(s)}(e,t)}function A(e,t){if(!Qs.test(t=u()))throw b(t,"name");var r=new Gs(t);R(r,(function(e){switch(e){case"option":L(r,e),f(";");break;case"reserved":E(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!Qs.test(t))throw b(t,"name");f("=");var r=S(u(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};R(n,(function(e){if("option"!==e)throw b(e);L(n,e),f(";")}),(function(){D(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function L(e,t){var r=f("(",!0);if(!ea.test(t=u()))throw b(t,"name");var n,o=t,i=o;r&&(f(")"),i=o="("+o+")",t=h(),ta.test(t)&&(n=t.slice(1),o+=t,u())),f("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,i,M(e,o),n)}function M(e,t){if(f("{",!0)){for(var r={};!f("}",!0);){if(!Qs.test(a=u()))throw b(a,"name");var n,o=a;if(f(":",!0),"{"===h())n=M(e,t+"."+a);else if("["===h()){var i;if(n=[],f("[",!0)){do{i=w(!0),n.push(i)}while(f(",",!0));f("]"),void 0!==i&&x(e,t+"."+a,i)}}else n=w(!0),x(e,t+"."+a,n);var s=r[o];s&&(n=[].concat(s).concat(n)),r[o]=n,f(",",!0),f(";",!0)}return r}var c=w(!0);return x(e,t,c),c}function x(e,t,r){e.setOption&&e.setOption(t,r)}function D(e){if(f("[",!0)){do{L(e,"option")}while(f(",",!0));f("]")}return e}for(;null!==(a=u());)switch(a){case"package":if(!g)throw b(a);O();break;case"import":if(!g)throw b(a);_();break;case"syntax":if(!g)throw b(a);I();break;case"option":L(v,a),f(";");break;default:if(T(v,a)){g=!1;continue}throw b(a)}return ra.filename=null,{package:n,imports:o,weakImports:i,syntax:s,root:t}}var na,oa=sa,ia=/\/|\./;function sa(e,t){ia.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),sa[e]=t}sa("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),sa("duration",{Duration:na={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),sa("timestamp",{Timestamp:na}),sa("empty",{Empty:{fields:{}}}),sa("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),sa("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),sa("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),sa.get=function(e){return sa[e]||null},function(e){var t=e.exports=wi.exports;t.build="full",t.tokenize=Es,t.parse=xs,t.common=oa,t.Root._configure(t.Type,t.parse,t.common)}(Ci),function(e){e.exports=Ci.exports}(bi);var aa=G(bi.exports);const ca=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},la=e=>{const t=e.name;return E(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},ua=e=>{(window.URL||window.webkitURL).revokeObjectURL(e)},da=e=>{const t=e.match(/data:([^;]+)/)[1],r=e.replace(/^[^,]+,/,""),n=window.atob(r);let o=n.length;const i=new Uint8Array(n.length);for(;o--;)i[o]=n.charCodeAt(o);return new Blob([i],{type:t})};class ha{constructor(e){h(this,"options",void 0),h(this,"xhr",void 0),this.options=e}upload(e,t){const r=new XMLHttpRequest;r.open("POST",this.options.uploadUrl,!0),r.onreadystatechange=()=>{if(4===r.readyState){const o=r.responseText||"{}",i=JSON.parse(o);if(200===r.status&&200===i.code){var e;let r={url:i.url};this.options.transformer&&(r=this.options.transformer(r)),null===(e=t.onCompleted)||void 0===e||e.call(t,r)}else{var n;null===(n=t.onError)||void 0===n||n.call(t,"upload fail")}}},r.setRequestHeader("device","7"),r.setRequestHeader("cert",this.options.cert??"");const n=la(e),o=function(){let e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}()+(n.length?`.${n}`:""),i=new FormData;i.append("file",e),i.append("name","file"),i.append("fileName",o),i.append("token",this.options.token),r.send(i),this.xhr=r}cancel(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}const fa=1680,pa=160,ga=e=>new Promise(((t,r)=>{const n=e=>{0!==e.width||0!==e.height?t(e):r()},o=new Image;if(o.addEventListener("load",(e=>n(e.target))),o.addEventListener("error",r),o.src=e,o.complete)return void n(o);const i=setInterval((()=>{o.complete&&(n(o),clearInterval(i))}),40)}));class ya{constructor(e,t){h(this,"uploadInstance",void 0),h(this,"options",void 0),this.uploadInstance=e,this.options=t}async upload(e,t){try{const r=ca(e),n=await ga(r);ua(r);const{imageFile:o,compressWidth:i,compressHeight:s}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/jpeg";t=Math.min(1,t);const n=e.width,o=e.height;let i=n,s=o;if(t<1){const e=n<o,t=e?o/fa:n/fa;n>fa&&o>fa?e?(s=fa,i/=t):(i=fa,s/=t):n>fa&&o>pa?(i=fa,s/=t,s<pa&&(s=pa,i=n/(o/pa))):o>fa&&n>pa&&(s=fa,i/=t,i<pa&&(i=pa,s=o/(n/pa)))}i=Math.floor(i),s=Math.floor(s);const a=document.createElement("canvas");a.width=i,a.height=s;const c=a.getContext("2d");return c.fillStyle="#FFF",c.fillRect(0,0,i,s),c.drawImage(e,0,0,n,o,0,0,i,s),r&&"image/png"!=r||(r="image/jpeg"),{imageFile:da(a.toDataURL(r,Math.min(.92,t))),compressWidth:i,compressHeight:s}}(n,.85,e.type),a=((e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d"),o=function(e,t,r){const n=e<t;let o,i,s,a=0,c=0;const l=function(){return n?(o=e/100,i=100,s=t/o,c=(s-r.maxHeight)/2):(o=t/100,s=100,i=e/o,a=(i-r.maxWidth)/2),{w:i,h:s,x:-a,y:-c}},u=function(){return n?(o=t/r.maxHeight,s=r.maxHeight,i=e/o):(o=e/r.maxWidth,i=r.maxWidth,s=t/o),{w:i,h:s,x:-a,y:-c}};return(n?t/e:e/t)>r.scale?l():u()}(e.width,e.height,t);r.width=o.w>t.maxWidth?t.maxWidth:o.w,r.height=o.h>t.maxHeight?t.maxHeight:o.h,null==n||n.drawImage(e,o.x,o.y,o.w,o.h);try{let e=r.toDataURL("image/jpeg",t.quality);const n=new RegExp("^data:image/[^;]+;base64,");return e=e.replace(n,""),e}catch(e){throw new Error(e)}})(n,{maxHeight:160,maxWidth:160,quality:.6,scale:2.4});this.uploadInstance.upload(o,{...t,onCompleted:r=>{var n;null===(n=t.onCompleted)||void 0===n||n.call(t,{url:r.url,thumbnail:a,width:i,height:s,type:e.type})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}class va{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}async upload(e,t){if(e.size>2097152)t.onError&&t.onError("GIF_MSG_SIZE_LIMIT_EXCEED");else try{const r=ca(e),n=await ga(r);ua(r),this.uploadInstance.upload(e,{...t,onCompleted:r=>{var o;null===(o=t.onCompleted)||void 0===o||o.call(t,{url:r.url,size:e.size,width:n.width,height:n.height})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}let ma;class ba{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}upload(e,t){var r;(r=e,O(r.arrayBuffer)?r.arrayBuffer():new Promise(((e,t)=>{const n=new FileReader;n.addEventListener("load",(r=>{r.target?e(r.target.result):t("null")})),n.addEventListener("error",(e=>t(e))),n.readAsArrayBuffer(r)}))).then(this.getAudioInfo).then((r=>{this.uploadInstance.upload(e,{...t,onCompleted:n=>{var o;null===(o=t.onCompleted)||void 0===o||o.call(t,{url:n.url,type:la(e),...r})}})})).catch((()=>{var e;null===(e=t.onError)||void 0===e||e.call(t,"MEDIA_EXCEPTION")}))}cancel(){this.uploadInstance.cancel()}getAudioInfo(e){const t=ma||new AudioContext;return ma=t,new Promise(((r,n)=>{t.decodeAudioData(e,(function(e){r({duration:e.duration,length:e.length})}),n)}))}}class Ca{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}upload(e,t){if(e.size>104857600)t.onError&&t.onError("FILE_MSG_SIZE_LIMIT_EXCEED");else try{this.uploadInstance.upload(e,{...t,onCompleted:r=>{var n;null===(n=t.onCompleted)||void 0===n||n.call(t,{url:r.url,name:e.name,type:la(e),size:e.size})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}var wa;!function(e){e[e.IMAGE=1]="IMAGE",e[e.GIF=2]="GIF",e[e.AUDIO=3]="AUDIO",e[e.VIDEO=4]="VIDEO",e[e.FILE=5]="FILE",e[e.SIGHT=6]="SIGHT"}(wa||(wa={}));const Ea=(t,r,n,o,i,s)=>({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,senderUserId:r,messageDirection:e.MessageDirection.SEND,isCounted:n.isCounted,isMentioned:!1,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:n.isPersited,messageId:o,messageUId:i,sentTime:s,receivedTime:0,isStatusMessage:n.isStatusMessage,receivedStatus:e.ReceivedStatus.UNREAD,disableNotification:!1});let Sa=0;const Oa=[Ao,ko];async function _a(t,r,n){var o;if(!pi.loader||pi.loader.getConnectionStatus()!==e.ConnectionStatus.CONNECTED)return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};n=n||{};const i=JSON.stringify(Ot(r.encode()));if(function(e){let t=0;if("utf-16"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8"))for(let r=0,n=e.length;r<n;r++)t+=e.charCodeAt(r)<=65535?2:4;else for(let r=0,n=e.length;r<n;r++){const n=e.charCodeAt(r);t+=n<127?1:n<=2047?2:n<=65535?3:4}return t}(i)>81920)return{code:e.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT};const s=qn(t);let a;a=p(null===(o=n)||void 0===o?void 0:o.messageId)&&n.messageId>0?n.messageId:function(){Sa++;const e=co();return Sa<e&&(Sa=e),23e13+Sa}(),uo.addMessage(a);const c=Ea(t,Mn.uid,r,a,"",function(){Ma++;const e=co();Ma<e&&(Ma=e);return Ma}());n.onSendBefore&&n.onSendBefore(c),r.isPersited&&hi.get().loadConvsationsIfNotExist([t]);const l=await Wo.getDialogAesKey(s);if(!l)return{code:e.ErrorCode.MSG_ENCRYPT_ERROR,data:c};const u=((e,t)=>{if(!E(e))return new Uint8Array;const r=Et.AES.encrypt(e,Et.enc.Utf8.parse(t.key),{iv:p(t.iv)?Et.enc.Utf8.parse(t.iv):void 0});return Xo(r.ciphertext.words)})(i,l),d={localId:rn.fromNumber(a),mediaFlag:Oa.includes(r.messageType),mediaConstructor:r.objectId,mediaAttribute:"",msgPreContent:"",msgPostContent:"",msgContent:u};let h;if(t.conversationType===e.ConversationType.GROUP){var f,g;const t={...d,groupId:s};if(null!==(f=n)&&void 0!==f&&null!==(g=f.directionalUserIdList)&&void 0!==g&&g.length&&(t.assign=n.directionalUserIdList.join(",")),p(r.content.mentionedInfo)){var y;const n=r.content.mentionedInfo;n.type===e.MentionedType.ALL?t.atAll=!0:n.type===e.MentionedType.SINGAL&&null!==(y=n.userIdList)&&void 0!==y&&y.length&&(t.at=n.userIdList.map((e=>rn.fromString(e))))}h=await(v=t,Ln.send(P.SendGroupChatMessage,v,{encoder:eo.SendGroupChatMessageReq,decoder:oo}))}else{const e={...d,destId:s};h=await(e=>Ln.send(P.SendPrivateChatMessage,e,{encoder:Jn.SendPrivateChatMessageReq,decoder:jn.SendPrivateChatMessageResp}))(e)}var v;return h.code===e.ErrorCode.SUCCESS&&(c.sentTime=h.data.seqno.toNumber(),c.messageUId=h.data.msgId.toString(),hi.get().setConversationCacheByMessage(c)),{code:h.code,data:c}}const Ia=Aa(wa.IMAGE,((e,t)=>new Bo({content:e.thumbnail,imageUri:e.url,width:e.width,height:e.height,user:t.user,extra:t.extra}))),Ta=Aa(wa.GIF,((e,t)=>new Uo({gifDataSize:e.size,remoteUrl:e.url,width:e.width,height:e.height,user:t.user,extra:t.extra}))),Ra=Aa(wa.AUDIO,((e,t)=>new jo({remoteUrl:e.url,duration:e.duration,type:e.type,user:t.user,extra:t.extra}))),ka=Aa(wa.FILE,((e,t)=>new Po({fileUrl:e.url,name:e.name,type:e.type,size:e.size,user:t.user,extra:t.extra}))),Na=async(t,r)=>{const n=qn(t);fo.addMessage(r.messageUId);const o=await((e,t)=>{let r;return r=zn(e)?Ln.send(P.RecallGroupMessage,{groupId:e,msgId:rn.fromString(t)},{encoder:eo.RecallGroupChatMessageReq,decoder:Xr.BaseResp}):Ln.send(P.RecallPrivateMessage,{destId:e,msgId:rn.fromString(t)},{encoder:Jn.RecallPrivateChatMessageReq,decoder:Xr.BaseResp}),r})(n,r.messageUId);if(o.code!==e.ErrorCode.SUCCESS)return{code:o.code};const i=new Fo({sentTime:r.sentTime,messageUId:r.messageUId,...t}),s=Ea(t,Mn.uid,i,0,"",co());return hi.get().setConversationCacheByMessage(s),{code:e.ErrorCode.SUCCESS,data:s}};function Aa(t,r){return function(n,o,i,s){return new Promise((a=>{((e,t,r,n)=>{var o;const i=new ha({token:Pn.imInitToken,uploadUrl:Pn.fileUploadUrl,cert:Pn.cert,transformer:e=>({...e,url:Pn.getFileAbsoluteUri(e.url)})});let s;switch(t){case wa.IMAGE:s=new ya(i,r);break;case wa.GIF:s=new va(i);break;case wa.AUDIO:s=new ba(i);break;case wa.FILE:s=new Ca(i)}null===(o=s)||void 0===o||o.upload(e,{onProgress:(e,t)=>n.onProgress(Math.floor(e/t*100)),onError:()=>n.onFail(),onCompleted:n.onSuccess})})(o.file,t,s,{onProgress:e=>(null==i?void 0:i.onProgress)&&i.onProgress(e),onSuccess:e=>{const t=(null==i?void 0:i.onComplete)&&i.onComplete({url:Pn.getFileAbsoluteUri(e.url)})||r(e,o);_a(n,t,s).then(a)},onFail:()=>{a({code:e.ErrorCode.UPLOAD_FILE_FAILED})}})}))}}let La,Ma=1;class xa extends U{constructor(e){if(xa.imClient)return T.error("Please do not perform the init method repeatedly"),xa.imClient;super(),h(this,"options",void 0),h(this,"libLoader",void 0),h(this,"getServerTime",co),h(this,"sendMessage",_a),h(this,"sendImageMessage",Ia),h(this,"sendGIFMessage",Ta),h(this,"sendHQVoiceMessage",Ra),h(this,"sendFileMessage",ka),h(this,"recallMsg",Na),this.options=e,this.fixedProtobuf(),p(e.logLevel)&&T.setLogLevel(e.logLevel),p(e.logStdout)&&T.setLogStdout(e.logStdout),T.debug("IMClient.init -> ",e.appkey),this.libLoader=pi.init(e),this.watch(),xa.imClient=this}fixedProtobuf(){aa.util.Long=rn,aa.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(e.Events.CONNECTING)},onConnected:()=>{this.emit(e.Events.CONNECTED)},onDisconnect:()=>{this.emit(e.Events.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(e.Events.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:t=>{this.emit(e.Events.MESSAGES,{messages:t})},pullFinished:()=>{this.emit(e.Events.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:t=>{this.emit(e.Events.CONVERSATION,{conversations:t})}})}connect(e){return this.libLoader.connect(e)}disconnect(){return this.libLoader.disconnect()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}async getRemoteHistoryMessages(t,r){const o=qn(t);return io({dialogId:o,offset:r.timestamp??0,count:r.count??20,newToOld:0===r.order}).then((t=>{let{code:r,data:i}=t;return new Promise((t=>{r===e.ErrorCode.SUCCESS?ri.parse({[o]:i.msg??{}},((r,n)=>{const s=n[o]??[];s.sort(((e,t)=>e.sentTime-t.sentTime)),t({code:e.ErrorCode.SUCCESS,data:{list:s,hasMore:!i.isEnd}})})):t({code:r,msg:n(r)})}))}))}async deleteRemoteMessage(e,t){return(r=qn(e),n=t.map((e=>e.messageUId)),Ln.send(P.DeleteChatMessages,{destId:r,msgIdList:n.map((e=>rn.fromString(e)))},{encoder:Jn.DeleteChatMessageReq,decoder:Xr.BaseResp})).then((e=>e.code));var r,n}async deleteRemoteMessageByTimestamp(e,t){return((e,t)=>Ln.send(P.ClearChatHistoryMessage,{destId:e,type:zn(e)?1:0,msgTime:rn.fromNumber(t)},{encoder:Jn.CleanHistoryMessageReq,decoder:Xr.BaseResp}))(qn(e),0===t?Number.MAX_VALUE:t).then((e=>e.code))}async getConversationList(t,r,n,o){const i={rows:t,type:r??0,offset:rn.fromNumber(n),newToOld:0===o},{code:s,data:a}=await(e=>Ln.send(P.GetDialogList,e,{encoder:Jn.GetWebDialogListReq,decoder:jn.GetWebDialogListResp}))(i);if(s!==e.ErrorCode.SUCCESS)return{code:s};const c=a.fullDialog.map((e=>{var t;return null===(t=e.dialog)||void 0===t?void 0:t.destId})).filter(E);await Wo.getDialogAesKeyList(c);const l=[];for(const e of a.fullDialog){const t=this.formatConversation(e);if(t){const e={conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId};hi.get().addLocalConversation(t);const r=hi.get().get(e);Object.assign(t,r),l.push(t)}}return{code:e.ErrorCode.SUCCESS,data:l}}getBlockConversationList(){const t=hi.get().getBlockConversationList();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})}getTopConversationList(){const t=hi.get().getTopConversationList();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})}async getConversation(t){const r=hi.get().get(t);if(!r)return{code:e.ErrorCode.CONVER_GET_ERROR};const{code:n,data:o}=await this.getRemoteHistoryMessages(t,{count:1,order:0});if(n!==e.ErrorCode.SUCCESS)return{code:e.ErrorCode.CONVER_GET_ERROR};const i=null==o?void 0:o.list[0],s={...t,...r,latestMessage:i};return{code:e.ErrorCode.SUCCESS,data:s}}removeConversation(e){return(e=>{let t;return t=zn(e)?Ln.send(P.DeleteGroupDialog,{groupId:e},{encoder:eo.DeleteGroupChatDialogReq,decoder:Xr.BaseResp}):Ln.send(P.DeletePrivateDialog,{destId:e},{encoder:Jn.DeletePrivateChatDialogReq,decoder:Xr.BaseResp}),t})(qn(e)).then((e=>e.code))}getUnreadMentionedCount(e){return hi.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return hi.get().getAllUnreadMentionedCount()}getAllConversationState(){return hi.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return hi.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return hi.get().getUnreadCount(e)}clearConversationUnreadCount(e){hi.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){hi.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return hi.get().getNotificationLevel(e)}setConversationNotificationStatus(t,r){return((e,t)=>{let r;return r=zn(e)?Ln.send(P.UpdateGroupChatMuteConfig,{groupId:e,muteFlag:t},{encoder:eo.UpdateGroupChatDialogMuteConfigReq,decoder:Xr.BaseResp}):Ln.send(P.UpdatePrivateChatMuteConfig,{destId:e,muteFlag:t},{encoder:Jn.UpdatePrivateChatDialogMuteConfigReq,decoder:Xr.BaseResp}),r})(qn(t),r===e.NotificationStatus.OPEN).then((n=>(!n.code&&hi.get().addStatus({...t,notificationStatus:r,notificationLevel:r==e.NotificationStatus.OPEN?e.NotificationLevel.AT_USER_NOTIFICATION:e.NotificationLevel.NOT_SET},!0),n.code)))}getConversationNotificationStatus(e){return hi.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=zn(e)?Ln.send(P.UpdateGroupChatStickyConfig,{groupId:e,stickyFlag:t},{encoder:eo.UpdateGroupChatDialogStickyConfigReq,decoder:Xr.BaseResp}):Ln.send(P.UpdatePrivateChatStickyConfig,{destId:e,stickyFlag:t},{encoder:Jn.UpdatePrivateChatDialogStickyConfigReq,decoder:Xr.BaseResp}),r})(qn(e),t).then((r=>(!r.code&&hi.get().addStatus({...e,isTop:t},!0),r.code)))}saveConversationMessageDraft(e,t){hi.get().setDraft(e,t)}getConversationMessageDraft(e){return hi.get().getDraft(e)}clearConversationMessageDraft(e){hi.get().clearDraft(e)}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId??"",o=si(t);if(!o)return;const i=Wo.getDialogAesKeyFromLocal(n);if(!i)return;const s=ri.parseSingleDialogMessages(n,[r],i)[0];return s?(o.latestMessage=s,o):void 0}}h(xa,"imClient",void 0);const Da=async(t,r,n)=>{if(r instanceof yo==!1)return T.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:e.ErrorCode.PARAMETER_ERROR};D("conversation",t,M,!0),Ba(t);const o=await La.sendMessage(t,r,n);return Ua(t,o.code),o},Ba=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;T.debug("send message ->"+t)},Ua=(t,r)=>{if(r!==e.ErrorCode.SUCCESS){const e="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.warn("send message fail ->"+r+":"+n(r)+","+e)}};e.CommandMessage=Go,e.ErrorDesc=n,e.FileMessage=Po,e.GIFMessage=Uo,e.HQVoiceMessage=jo,e.ImageMessage=Bo,e.TextMessage=Do,e.addEventListener=(e,t,r)=>{La.on(e,t,r)},e.clearAllMessagesUnreadStatus=()=>(T.debug("clear allMessagesUnreadStatus"),La.clearAllConversationsUnreadCount(),Promise.resolve({code:e.ErrorCode.SUCCESS})),e.clearHistoryMessages=async(t,r)=>{D("timestamp",r,(e=>k(e)&&e>=0),!0),D("conversation",t,M);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("clear message ->"+o);const i=await La.deleteRemoteMessageByTimestamp(t,r);return i!==e.ErrorCode.SUCCESS?(T.warn("clear message ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:e.ErrorCode.SUCCESS}},e.clearMessagesUnreadStatus=t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return T.debug("clear unreadMsgNum ->"+r),La.clearConversationUnreadCount(t),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.clearTextMessageDraft=t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return T.debug("delete draft ->"+r),La.clearConversationMessageDraft(t),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.connect=async t=>{D("token",t,R,!0);const r=await La.connect(t);return r.code===e.ErrorCode.SUCCESS?{code:r.code,data:{userId:r.userId}}:{code:r.code,msg:n(r.code)}},e.deleteMessages=async(t,r)=>{D("messages",r,(e=>C(e)&&!!e.length),!0),r.forEach((e=>{D("messages.messageUId",e.messageUId,R,!0),D("messages.sentTime",e.sentTime,k,!1),D("messages.messageDirection",e.messageDirection,(e=>1===e||2===e),!1)})),D("conversation",t,M,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("delete messages ->"+o);const i=await La.deleteRemoteMessage(t,r);return i!==e.ErrorCode.SUCCESS?(T.warn("delete message fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:e.ErrorCode.SUCCESS}},e.disconnect=()=>La.disconnect(),e.getAllConversationState=()=>{T.debug("getAllConversationState");const t=La.getAllConversationState();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})},e.getAllUnreadMentionedCount=()=>{T.debug("getAllUnreadMentionedCount");const t=La.getAllUnreadMentionedCount();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})},e.getBlockedConversationList=()=>La.getBlockConversationList(),e.getConnectionStatus=()=>La.getConnectionStatus(),e.getConversation=async t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("get conversation ->"+r);const{code:o,data:i}=await La.getConversation(t);return o!==e.ErrorCode.SUCCESS?(T.warn("get conversation fail ->"+o+":"+n(o)+","+r),{code:o,msg:n(o)}):{code:o,data:i}},e.getConversationList=async t=>{T.debug("get conversation list ->");const{code:r,data:o}=await La.getConversationList((null==t?void 0:t.count)??20,null,(null==t?void 0:t.startTime)??0,(null==t?void 0:t.order)??0);return r!==e.ErrorCode.SUCCESS&&T.warn("get conversation list fail ->"+r+":"+n(r)),{code:r,msg:n(r),data:o}},e.getConversationNotificationLevel=t=>{D("options",t,M,!0),T.info("getConversationNotificationLevel ->targetId:"+t.targetId+",conversationType:"+t.conversationType);const r=La.getConversationNotificationLevel(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:r})},e.getConversationNotificationStatus=t=>{D("options",t,M,!0),T.info("getConversationNotificationStatus ->targetId:"+t.targetId+",conversationType:"+t.conversationType);const r=La.getConversationNotificationStatus(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:r})},e.getHistoryMessages=async(t,r)=>{D("options.timestamp",r.timestamp??0,k),D("options.count",r.count??0,k),D("options.order",r.order??0,(e=>0===e||1===e)),D("conversation",t,M,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("get history message ->"+o);const i=await La.getRemoteHistoryMessages(t,r);return i.code!==e.ErrorCode.SUCCESS&&T.warn("get history message fail ->"+i.code+":"+n(i.code)+","+o),i},e.getRemoteHistoryMessages=async(t,r)=>{D("options.timestamp",r.timestamp??0,k),D("options.count",r.count??0,k),D("options.order",r.order??0,(e=>0===e||1===e)),D("conversation",t,M,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("get remote history message ->"+o);const i=await La.getRemoteHistoryMessages(t,r);return i.code!==e.ErrorCode.SUCCESS&&T.warn("get remote history message fail ->"+i.code+":"+n(i.code)+","+o),i},e.getServerTime=()=>La.getServerTime(),e.getTextMessageDraft=t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("get draft ->"+r);const n=La.getConversationMessageDraft(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getTopConversationList=()=>La.getTopConversationList(),e.getTotalUnreadCount=(t,r)=>{if(T.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+t),D("includeMuted",t,N,!1),D("conversationTypes",r,A,!1),r)for(const e of r)D("conversationType",e,L,!0);const n=La.getAllConversationUnreadCount(r??[],t??!1);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getUnreadCount=t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("get unreadCount ->"+r);const n=La.getConversationUnreadCount(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getUnreadMentionedCount=t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return T.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:e.ErrorCode.SUCCESS,data:La.getUnreadMentionedCount(t)})},e.init=e=>{La=La||new xa(e)},e.onceEventListener=function(e,t,r){La.once(e,t,r)},e.recallMessage=async(t,r)=>{D("options.messageUId",r.messageUId,R,!0),D("options.sentTime",r.sentTime,k,!0),D("conversation",t,M,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId+",messageUId:"+r.messageUId;T.debug("recall message ->"+o);const i=await La.recallMsg(t,r);return i.code!==e.ErrorCode.SUCCESS&&T.warn("recall message fail ->"+i.code+":"+n(i.code)+","+o),i},e.registerMessageType=(e,t,r,n,o)=>function(n){return o?new Vo(e,n):r?new Ko(e,n):t?new zo(e,n):new Ho(e,n)},e.removeConversation=async t=>{D("options",t,M,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("remove conversation ->"+r);const o=await La.removeConversation(t);return o!==e.ErrorCode.SUCCESS?(T.warn("remove conversation fail ->"+o+":"+n(o)+","+r),{code:o,msg:n(o)}):{code:o}},e.removeEventListener=(e,t,r)=>{La.off(e,t,r)},e.saveTextMessageDraft=(t,r)=>{D("options",t,M,!0),D("draft",r,R,!0);const n="conversationType:"+t.conversationType+",targetId:"+t.targetId;return T.debug("set draft ->"+n),La.saveConversationMessageDraft(t,r),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.sendFileMessage=async(e,t,r,n)=>{D("conversation",e,M,!0),D("msgBody.file",t.file,(e=>e instanceof Blob),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;T.debug("send message ->"+o),Ba(e);const i=await La.sendFileMessage(e,t,r,n);return Ua(e,i.code),i},e.sendGIFMessage=async(e,t,r,n)=>{D("conversation",e,M,!0),D("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.endsWith("image/gif")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;T.debug("send message ->"+o),Ba(e);const i=await La.sendGIFMessage(e,t,r,n);return Ua(e,i.code),i},e.sendHQVoiceMessage=async(e,t,r,n)=>{D("conversation",e,M,!0),D("msgBody.file",t.file,(e=>e instanceof Blob),!0),Ba(e);const o=await La.sendHQVoiceMessage(e,t,r,n);return Ua(e,o.code),o},e.sendImageMessage=async(e,t,r,n)=>{D("conversation",e,M,!0),D("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.startsWith("image/")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;T.debug("send message ->"+o),Ba(e);const i=await La.sendImageMessage(e,t,r,n);return Ua(e,i.code),i},e.sendMessage=Da,e.sendTextMessage=(e,t,r)=>{const n=new Do(t);return Da(e,n,r)},e.setConversationNotificationStatus=async(t,r)=>{D("options",t,M,!0),D("notificationStatus",r,(e=>1===e||2===e),!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("set conversation status ->"+o);const i=await La.setConversationNotificationStatus(t,r);return i!==e.ErrorCode.SUCCESS?(T.warn("set conversation status fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:i}},e.setConversationToTop=async function(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];D("options",t,M,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;T.debug("set conversation status ->"+o);const i=await La.setConversationToTop(t,r);return i!==e.ErrorCode.SUCCESS?(T.warn("set conversation status fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:i}}}));
37
+ */var rn=null;try{rn=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function nn(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function on(e){return!0===(e&&e.__isLong__)}function sn(e){var t=Math.clz32(e&-e);return e?31-t:t}nn.prototype.__isLong__,Object.defineProperty(nn.prototype,"__isLong__",{value:!0}),nn.isLong=on;var an={},cn={};function ln(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=cn[e])?n:(r=dn(e,0,!0),o&&(cn[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=an[e])?n:(r=dn(e,e<0?-1:0,!1),o&&(an[e]=r),r)}function un(e,t){if(isNaN(e))return t?Cn:bn;if(t){if(e<0)return Cn;if(e>=yn)return _n}else{if(e<=-vn)return In;if(e+1>=vn)return On}return e<0?un(-e,t).neg():dn(e%gn|0,e/gn|0,t)}function dn(e,t,r){return new nn(e,t,r)}nn.fromInt=ln,nn.fromNumber=un,nn.fromBits=dn;var hn=Math.pow;function fn(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?Cn:bn;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return fn(e.substring(1),t,r).neg();for(var o=un(hn(r,8)),i=bn,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var l=un(hn(r,a));i=i.mul(l).add(un(c))}else i=(i=i.mul(o)).add(un(c))}return i.unsigned=t,i}function pn(e,t){return"number"==typeof e?un(e,t):"string"==typeof e?fn(e,t):dn(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}nn.fromString=fn,nn.fromValue=pn;var gn=4294967296,yn=gn*gn,vn=yn/2,mn=ln(1<<24),bn=ln(0);nn.ZERO=bn;var Cn=ln(0,!0);nn.UZERO=Cn;var wn=ln(1);nn.ONE=wn;var En=ln(1,!0);nn.UONE=En;var Sn=ln(-1);nn.NEG_ONE=Sn;var On=dn(-1,2147483647,!1);nn.MAX_VALUE=On;var _n=dn(-1,-1,!0);nn.MAX_UNSIGNED_VALUE=_n;var In=dn(0,-2147483648,!1);nn.MIN_VALUE=In;var Tn=nn.prototype;Tn.toInt=function(){return this.unsigned?this.low>>>0:this.low},Tn.toNumber=function(){return this.unsigned?(this.high>>>0)*gn+(this.low>>>0):this.high*gn+(this.low>>>0)},Tn.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(In)){var t=un(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=un(hn(e,6),this.unsigned),i=this,s="";;){var a=i.div(o),c=(i.sub(a.mul(o)).toInt()>>>0).toString(e);if((i=a).isZero())return c+s;for(;c.length<6;)c="0"+c;s=""+c+s}},Tn.getHighBits=function(){return this.high},Tn.getHighBitsUnsigned=function(){return this.high>>>0},Tn.getLowBits=function(){return this.low},Tn.getLowBitsUnsigned=function(){return this.low>>>0},Tn.getNumBitsAbs=function(){if(this.isNegative())return this.eq(In)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},Tn.isZero=function(){return 0===this.high&&0===this.low},Tn.eqz=Tn.isZero,Tn.isNegative=function(){return!this.unsigned&&this.high<0},Tn.isPositive=function(){return this.unsigned||this.high>=0},Tn.isOdd=function(){return 1==(1&this.low)},Tn.isEven=function(){return 0==(1&this.low)},Tn.equals=function(e){return on(e)||(e=pn(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},Tn.eq=Tn.equals,Tn.notEquals=function(e){return!this.eq(e)},Tn.neq=Tn.notEquals,Tn.ne=Tn.notEquals,Tn.lessThan=function(e){return this.comp(e)<0},Tn.lt=Tn.lessThan,Tn.lessThanOrEqual=function(e){return this.comp(e)<=0},Tn.lte=Tn.lessThanOrEqual,Tn.le=Tn.lessThanOrEqual,Tn.greaterThan=function(e){return this.comp(e)>0},Tn.gt=Tn.greaterThan,Tn.greaterThanOrEqual=function(e){return this.comp(e)>=0},Tn.gte=Tn.greaterThanOrEqual,Tn.ge=Tn.greaterThanOrEqual,Tn.compare=function(e){if(on(e)||(e=pn(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Tn.comp=Tn.compare,Tn.negate=function(){return!this.unsigned&&this.eq(In)?In:this.not().add(wn)},Tn.neg=Tn.negate,Tn.add=function(e){on(e)||(e=pn(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=e.high>>>16,s=65535&e.high,a=e.low>>>16,c=0,l=0,u=0,d=0;return u+=(d+=o+(65535&e.low))>>>16,l+=(u+=n+a)>>>16,c+=(l+=r+s)>>>16,c+=t+i,dn((u&=65535)<<16|(d&=65535),(c&=65535)<<16|(l&=65535),this.unsigned)},Tn.subtract=function(e){return on(e)||(e=pn(e)),this.add(e.neg())},Tn.sub=Tn.subtract,Tn.multiply=function(e){if(this.isZero())return this;if(on(e)||(e=pn(e)),rn)return dn(rn.mul(this.low,this.high,e.low,e.high),rn.get_high(),this.unsigned);if(e.isZero())return this.unsigned?Cn:bn;if(this.eq(In))return e.isOdd()?In:bn;if(e.eq(In))return this.isOdd()?In:bn;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(mn)&&e.lt(mn))return un(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,i=e.high>>>16,s=65535&e.high,a=e.low>>>16,c=65535&e.low,l=0,u=0,d=0,h=0;return d+=(h+=o*c)>>>16,u+=(d+=n*c)>>>16,d&=65535,u+=(d+=o*a)>>>16,l+=(u+=r*c)>>>16,u&=65535,l+=(u+=n*a)>>>16,u&=65535,l+=(u+=o*s)>>>16,l+=t*c+r*a+n*s+o*i,dn((d&=65535)<<16|(h&=65535),(l&=65535)<<16|(u&=65535),this.unsigned)},Tn.mul=Tn.multiply,Tn.divide=function(e){if(on(e)||(e=pn(e)),e.isZero())throw Error("division by zero");var t,r,n;if(rn)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?dn((this.unsigned?rn.div_u:rn.div_s)(this.low,this.high,e.low,e.high),rn.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Cn:bn;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Cn;if(e.gt(this.shru(1)))return En;n=Cn}else{if(this.eq(In))return e.eq(wn)||e.eq(Sn)?In:e.eq(In)?wn:(t=this.shr(1).div(e).shl(1)).eq(bn)?e.isNegative()?wn:Sn:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(In))return this.unsigned?Cn:bn;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=bn}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(t)/Math.LN2),i=o<=48?1:hn(2,o-48),s=un(t),a=s.mul(e);a.isNegative()||a.gt(r);)a=(s=un(t-=i,this.unsigned)).mul(e);s.isZero()&&(s=wn),n=n.add(s),r=r.sub(a)}return n},Tn.div=Tn.divide,Tn.modulo=function(e){return on(e)||(e=pn(e)),rn?dn((this.unsigned?rn.rem_u:rn.rem_s)(this.low,this.high,e.low,e.high),rn.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},Tn.mod=Tn.modulo,Tn.rem=Tn.modulo,Tn.not=function(){return dn(~this.low,~this.high,this.unsigned)},Tn.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},Tn.clz=Tn.countLeadingZeros,Tn.countTrailingZeros=function(){return this.low?sn(this.low):sn(this.high)+32},Tn.ctz=Tn.countTrailingZeros,Tn.and=function(e){return on(e)||(e=pn(e)),dn(this.low&e.low,this.high&e.high,this.unsigned)},Tn.or=function(e){return on(e)||(e=pn(e)),dn(this.low|e.low,this.high|e.high,this.unsigned)},Tn.xor=function(e){return on(e)||(e=pn(e)),dn(this.low^e.low,this.high^e.high,this.unsigned)},Tn.shiftLeft=function(e){return on(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?dn(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):dn(0,this.low<<e-32,this.unsigned)},Tn.shl=Tn.shiftLeft,Tn.shiftRight=function(e){return on(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?dn(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):dn(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Tn.shr=Tn.shiftRight,Tn.shiftRightUnsigned=function(e){return on(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?dn(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):dn(32===e?this.high:this.high>>>e-32,0,this.unsigned)},Tn.shru=Tn.shiftRightUnsigned,Tn.shr_u=Tn.shiftRightUnsigned,Tn.rotateLeft=function(e){var t;return on(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?dn(this.high,this.low,this.unsigned):e<32?(t=32-e,dn(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),dn(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},Tn.rotl=Tn.rotateLeft,Tn.rotateRight=function(e){var t;return on(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?dn(this.high,this.low,this.unsigned):e<32?(t=32-e,dn(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),dn(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},Tn.rotr=Tn.rotateRight,Tn.toSigned=function(){return this.unsigned?dn(this.low,this.high,!1):this},Tn.toUnsigned=function(){return this.unsigned?this:dn(this.low,this.high,!0)},Tn.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Tn.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},Tn.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},nn.fromBytes=function(e,t,r){return r?nn.fromBytesLE(e,t):nn.fromBytesBE(e,t)},nn.fromBytesLE=function(e,t){return new nn(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},nn.fromBytesBE=function(e,t){return new nn(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const Rn={webSocketTimeout:5e3,signalTimeout:3e4,pingInterval:15e3,pingTimeout:5e3,pingFailedTimes:2,reconnectIntervalMin:250,reconnectIntervalMax:64e3,reconnectRaisingBase:2};const kn=t=>e.ConnectionStatus[t],Nn=()=>{const e="ACDeviceId";let t="";const r=pt.get(e);return r?t=r:(t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),pt.set(e,t)),t},An=e=>{const t=new Qr;return t.writeIn8(67),t.writeIn8(255),t.writeInt32(e.length+7),t.writeArr(Array.from(e)),t.writeIn8(0),new Int8Array(t.getBytesArray()).buffer},Ln=e=>{const t=new en(new Uint8Array(e));t.readInt8(),t.readInt8();const r=t.readInt32(),n=t.readArr(r-7);if(t.readInt8(),e.byteLength!==r)throw new Error("packet resolve failed");return n};var Mn=new class{constructor(t){h(this,"url",""),h(this,"watcher",void 0),h(this,"provider",void 0),h(this,"options",void 0),h(this,"socket",void 0),h(this,"status",e.ConnectionStatus.DISCONNECTED),h(this,"autoReconnect",!1),h(this,"isAuthorized",!1),h(this,"profile",void 0),h(this,"responseCallbacks",new Map),h(this,"failedCount",0),h(this,"reconnectTimer",void 0),h(this,"token",""),h(this,"connectResolve",void 0),h(this,"idCount",0),this.options=Object.assign(Rn,t)}setServerInfo(e){this.url=e}setCallback(e,t){this.watcher=e,this.provider=t}async connect(t){return this.token=t,new Promise((t=>{this.connectResolve=t,this.open().then((t=>t===e.ErrorCode.SUCCESS?!Xe(this.provider)||this.provider.needReAuth()?this.auth():e.ErrorCode.SUCCESS:t)).then((r=>{var n;(t(r),r===e.ErrorCode.SUCCESS)?(this.isAuthorized=!0,this.profile=null===(n=this.provider)||void 0===n?void 0:n.profile(),this.autoReconnect=!0,this.onConnect()):this.onDisconnect(r===e.ErrorCode.TIMEOUT?e.ConnectionStatus.NETWORK_UNAVAILABLE:e.ConnectionStatus.WEBSOCKET_UNAVAILABLE)}))}))}async send(t,r,n){var o;let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.options.signalTimeout;const{code:s,data:a}=await this.sendRawData(t,Xe(r)&&Xe(n.encoder)?n.encoder.encode(r).finish():new Uint8Array,i);if(0!==s)return{code:s,msg:"time out",data:null};if(!Xe(a)||!Xe(n.decoder))return{code:e.ErrorCode.SUCCESS,msg:""};const c=null===(o=n.decoder)||void 0===o?void 0:o.decode(a);return c.errorCode?{code:tn(c.errorCode),msg:c.errorMessage,data:null}:{data:c,code:e.ErrorCode.SUCCESS,msg:""}}async sendRawData(t,r){var n,o,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.signalTimeout;if(!this.socket)return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};if(!this.isAuthorized&&!this.isAuthCommand(t))return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};const a=this.generateMessageSeq(),c={cmdId:t,messageSeq:nn.fromNumber(a),deviceId:(null===(n=this.profile)||void 0===n?void 0:n.deviceId)??nn.fromInt(7),sessionId:(null===(o=this.profile)||void 0===o?void 0:o.sessionId)??nn.ZERO,uid:(null===(i=this.profile)||void 0===i?void 0:i.uid)??nn.ZERO,protocolVersion:0,destId:"",body:r,token:this.token};Ct.reqInfo(`websocket send -> cmd: 0x${t.toString(16)}, messageSeq: ${a}`),this.socket.send(An(Kr.encode(c).finish()));const l=await new Promise((e=>{this.responseCallbacks.set(a,e),setTimeout((()=>{this.responseCallbacks.get(a)&&this.responseCallbacks.delete(a),e(null)}),s)}));return l?{code:0,data:l}:(Ct.warn(`send timeout -> cmd: 0x${t.toString(16)}, messageSeq: ${a}, timeout: ${s}`),{code:e.ErrorCode.TIMEOUT})}close(){var t;this.autoReconnect=!1,this.doClose(),this.setStatus(e.ConnectionStatus.DISCONNECTED),null===(t=this.connectResolve)||void 0===t||t.call(this,e.ErrorCode.RC_SOCKET_DISCONNECTED)}async open(){const t=this.url;Ct.info(`conenct start -> ${t}`),this.setStatus(e.ConnectionStatus.CONNECTING);const r=function(e,t){const r=new WebSocket(e,t);return r.binaryType="arraybuffer",{onClose(e){r.onclose=t=>{const{code:r,reason:n}=t;null==e||e(r,n)}},onError(e){r.onerror=t=>{e(t)}},onMessage(e){r.onmessage=t=>{e(t.data)}},onOpen(e){r.onopen=e},send(e){r.send(e)},close(e,t){r.close(e,t)}}}(this.url);this.socket=r;return await new Promise((n=>{r.onMessage((e=>{"ArrayBuffer"===Ze(e)?this.onReceiveMessage(e):Ct.error("Socket received invalid data:",e)})),r.onClose(((t,r)=>{Ct.warn("websocket closed -> code:",t,"reason:",r),this.onDisconnect(e.ConnectionStatus.CONNECTION_CLOSED),n(e.ErrorCode.RC_SOCKET_DISCONNECTED)})),r.onError((t=>{Ct.error("websocket error -> ",t),this.onDisconnect(e.ConnectionStatus.WEBSOCKET_ERROR),n(e.ErrorCode.RC_SOCKET_NOT_CREATED)})),r.onOpen((()=>{Ct.info("websocket open -> ",t),n(e.ErrorCode.SUCCESS)})),setTimeout((()=>{n(e.ErrorCode.TIMEOUT)}),this.options.webSocketTimeout)}))}async auth(){var t,r,n,o;Ct.info(`start auth -> ${this.token}`);const i={token:this.token,deviceType:7,imei:Nn(),brand:"",model:"",apnsToken:"",bandId:""},{code:s,msg:a,data:c}=await this.send(Lt.Auth,i,{encoder:Wr,decoder:Yr.AuthSignIn2TokenResp},8e3);return s===e.ErrorCode.SUCCESS||c?(Ct.info("auth success -> ",null===(t=c.user)||void 0===t||null===(r=t.uid)||void 0===r?void 0:r.toString()),null===(n=this.watcher)||void 0===n||null===(o=n.onAuth)||void 0===o||o.call(n,c),e.ErrorCode.SUCCESS):(Ct.warn("auth failed -> "+a),e.ErrorCode.RC_CONN_NOT_AUTHRORIZED)}async checkAlive(){if(!this.socket||!this.isAuthorized)return;Ct.debug("send ping ->");const t={pingId:nn.ZERO,disconnectDelay:nn.ZERO},{code:r}=await this.send(Lt.Heartbean,t,{encoder:Vr},this.options.pingTimeout);r===e.ErrorCode.SUCCESS?(Ct.debug("recv pong <-"),this.failedCount=0,setTimeout((()=>this.checkAlive()),this.options.pingInterval)):(this.failedCount+=1,Ct.warn(`ping failed count: ${this.failedCount}, code: ${r}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,Ct.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.ConnectionStatus.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=Ln(t);r=Yr.NetworkResponse.decode(e)}catch(t){return Ct.error("unpack payload error -> ",t),void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER)}if(r.code)return void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER);if(r.cmdId===Lt.SessionKilledPush)return void this.onDisconnect(e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===Lt.SignOutPish||r.cmdId===Lt.SignOutPish2)return void this.onDisconnect(e.ConnectionStatus.DISCONNECT_BY_SERVER);if(r.cmdId===Lt.UserFrozenToLogin||r.cmdId===Lt.UserFrozenToLogin2)return void this.onDisconnect(e.ConnectionStatus.BLOCKED);const n=nn.isLong(r.messageSeq)?r.messageSeq.toNumber():0;Ct.reqInfo(`websocket recv ack -> messageSeq: ${n}`);const o=this.responseCallbacks.get(n);var i;Xe(o)?(o(r.body),this.responseCallbacks.delete(n)):(Ct.reqInfo(`websocket recv -> cmd: 0x${r.cmdId.toString(16)}, messageSeq: ${n}`),null===(i=this.watcher)||void 0===i||i.message(r.cmdId,r.body))}async try2Reconnect(){this.reconnectTimer=setTimeout((()=>{this.reconnectTimer=null,this.connect(this.token)}),5e3)}onConnect(){this.setStatus(e.ConnectionStatus.CONNECTED),this.checkAlive(),Xe(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}onDisconnect(e){Xe(this.socket)&&(this.doClose(),this.isConnectionAvailable()&&(this.setStatus(e),this.autoReconnect&&this.isConnectionAvailable()&&this.try2Reconnect()))}doClose(){if(Xe(this.socket)){const e=this.socket;this.socket=null,e.onClose(null),e.close()}Xe(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.isAuthorized=!1,this.profile=null;for(const e of this.responseCallbacks.values())e(null);this.responseCallbacks.clear()}isConnectionAvailable(){return this.status!==e.ConnectionStatus.DISCONNECTED&&this.status!==e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.ConnectionStatus.BLOCKED&&this.status!==e.ConnectionStatus.DISCONNECT_BY_SERVER}setStatus(e){var t;e!==this.status&&(Ct.info(`socketServer is changing status from ${kn(this.status)} to ${kn(e)}`),this.status=e,null===(t=this.watcher)||void 0===t||t.status(e))}isAuthCommand(e){return e===Lt.Auth}generateMessageSeq(){return++this.idCount}};var Dn=new class{constructor(){h(this,"_user",void 0),this._user=this.createDefaultUser()}get uid(){return this.user.uid.toString()}get user(){return this._user}setLogged(e,t){const r=e.user;Xe(r)&&(this._user={active:!0,uid:r.uid??nn.UZERO,deviceId:e.deviceId,sessionId:e.sessionId,token:t})}logOut(){this._user=this.createDefaultUser()}createDefaultUser(){return{active:!1,uid:nn.UZERO,deviceId:nn.UZERO,sessionId:nn.UZERO,token:""}}},xn=Mt.exports,Bn=xn.Reader,Un=xn.util,jn=xn.roots.default||(xn.roots.default={});jn.NewMessageNotificationResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.seqno=Un.Long?Un.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.NewMessageNotificationResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.seqno=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/NewMessageNotificationResp"},e}(),jn.SendPrivateChatMessageResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.msgId=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.seqno=Un.Long?Un.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.SendPrivateChatMessageResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageResp"},e}(),jn.GetNewMessageResp=function(){function e(e){if(this.msg={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.offset=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.seqno=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.msg=Un.emptyObject,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new jn.GetNewMessageResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.offset=e.int64();break;case 4:i.seqno=e.int64();break;case 5:i.msg===Un.emptyObject&&(i.msg={});var a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=jn.DialogMessageList.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.msg[r]=n;break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageResp"},e}(),jn.DialogMessageList=function(){function e(e){if(this.dialogMessage=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogMessage=Un.emptyArray,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.DialogMessageList;e.pos<r;){var o=e.uint32();if(o>>>3==1)n.dialogMessage&&n.dialogMessage.length||(n.dialogMessage=[]),n.dialogMessage.push(jn.DialogMessage.decode(e,e.uint32()));else e.skipType(7&o)}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessageList"},e}(),jn.DialogMessage=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.msgId=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.localId=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.msgStatus=0,e.prototype.srcId=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.destId="",e.prototype.isOut=!1,e.prototype.senderCategory=0,e.prototype.msgCategory=0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.msgSendTime=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.burnAfterReadingFlag=!1,e.prototype.atFlag=!1,e.prototype.replyFlag=!1,e.prototype.referenceFlag=!1,e.prototype.msgIdReferenced=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.uploadFlag=!1,e.prototype.burnAfterReadingTime=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.sharingGroupFlag=!1,e.prototype.seqno=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.extra="",e.prototype.msgContent=Un.newBuffer([]),e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.DialogMessage;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.msgId=e.int64();break;case 2:n.localId=e.int64();break;case 3:n.msgStatus=e.int32();break;case 4:n.srcId=e.int64();break;case 5:n.destId=e.string();break;case 6:n.isOut=e.bool();break;case 7:n.senderCategory=e.int32();break;case 8:n.msgCategory=e.int32();break;case 9:n.msgPreContent=e.string();break;case 10:n.msgPostContent=e.string();break;case 11:n.mediaFlag=e.bool();break;case 12:n.mediaConstructor=e.int32();break;case 13:n.mediaAttribute=e.string();break;case 14:n.msgSendTime=e.int64();break;case 15:n.burnAfterReadingFlag=e.bool();break;case 16:n.atFlag=e.bool();break;case 17:n.replyFlag=e.bool();break;case 18:n.referenceFlag=e.bool();break;case 19:n.msgIdReferenced=e.int64();break;case 20:n.uploadFlag=e.bool();break;case 21:n.burnAfterReadingTime=e.int64();break;case 22:n.sharingGroupFlag=e.bool();break;case 23:n.seqno=e.int64();break;case 24:n.extra=e.string();break;case 25:n.msgContent=e.bytes();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DialogMessage"},e}(),jn.GetBriefDialogListResp=function(){function e(e){if(this.notExistDestId=[],this.briefDialog={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.notExistDestId=Un.emptyArray,e.prototype.seqno=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.briefDialog=Un.emptyObject,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new jn.GetBriefDialogListResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:if(i.notExistDestId&&i.notExistDestId.length||(i.notExistDestId=[]),2==(7&s))for(var a=e.uint32()+e.pos;e.pos<a;)i.notExistDestId.push(e.int64());else i.notExistDestId.push(e.int64());break;case 4:i.seqno=e.int64();break;case 5:i.briefDialog===Un.emptyObject&&(i.briefDialog={});a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=jn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.briefDialog[r]=n;break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListResp"},e}(),jn.BriefDialog=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.dialogTitle="",e.prototype.smallAvatarUrl="",e.prototype.backgroundImage="",e.prototype.stickyFlag=!1,e.prototype.muteFlag=!1,e.prototype.blockFlag=!1,e.prototype.burnAfterReadingFlag=!1,e.prototype.takeScreenshotFlag=!1,e.prototype.groupFlag=!1,e.prototype.pushNotificationLevel=0,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.BriefDialog;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.destId=e.string();break;case 2:n.dialogTitle=e.string();break;case 3:n.smallAvatarUrl=e.string();break;case 4:n.backgroundImage=e.string();break;case 5:n.stickyFlag=e.bool();break;case 6:n.muteFlag=e.bool();break;case 7:n.blockFlag=e.bool();break;case 8:n.burnAfterReadingFlag=e.bool();break;case 9:n.takeScreenshotFlag=e.bool();break;case 10:n.groupFlag=e.bool();break;case 15:n.pushNotificationLevel=e.int32();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/BriefDialog"},e}(),jn.GetDialogKeyResp=function(){function e(e){if(this.retryUid=[],this.entry={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.dialogKeyVersion=Un.Long?Un.Long.fromBits(0,0,!1):0,e.prototype.retryUid=Un.emptyArray,e.prototype.entry=Un.emptyObject,e.prototype.serverSign="",e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new jn.GetDialogKeyResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.dialogKeyVersion=e.int64();break;case 4:if(i.retryUid&&i.retryUid.length||(i.retryUid=[]),2==(7&s))for(var a=e.uint32()+e.pos;e.pos<a;)i.retryUid.push(e.int64());else i.retryUid.push(e.int64());break;case 5:i.entry===Un.emptyObject&&(i.entry={});a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=jn.AesKeyAndIV.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.entry[r]=n;break;case 6:i.serverSign=e.string();break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyResp"},e}(),jn.AesKeyAndIV=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.aesKey="",e.prototype.aesIV="",e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.AesKeyAndIV;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.aesKey=e.string();break;case 2:n.aesIV=e.string();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/AesKeyAndIV"},e}(),jn.GetHistoryMessageResp=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.msg=null,e.prototype.isEnd=!1,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.GetHistoryMessageResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.msg=jn.DialogMessageList.decode(e,e.uint32());break;case 4:n.isEnd=e.bool();break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageResp"},e}(),jn.GetWebDialogListResp=function(){function e(e){if(this.fullDialog=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.fullDialog=Un.emptyArray,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.GetWebDialogListResp;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.fullDialog&&n.fullDialog.length||(n.fullDialog=[]),n.fullDialog.push(jn.WebFullDialog.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListResp"},e}(),jn.WebFullDialog=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialog=null,e.prototype.msg=null,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new jn.WebFullDialog;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.dialog=jn.BriefDialog.decode(e,e.uint32());break;case 2:n.msg=jn.DialogMessage.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/WebFullDialog"},e}(),jn.GetNewSettingDialogListResp=function(){function e(e){if(this.briefDialog={},e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.briefDialog=Un.emptyObject,e.prototype.setTime=Un.Long?Un.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Bn||(e=Bn.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new jn.GetNewSettingDialogListResp;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.errorCode=e.int32();break;case 2:i.errorMessage=e.string();break;case 3:i.briefDialog===Un.emptyObject&&(i.briefDialog={});var a=e.uint32()+e.pos;for(r="",n=null;e.pos<a;){var c=e.uint32();switch(c>>>3){case 1:r=e.string();break;case 2:n=jn.BriefDialog.decode(e,e.uint32());break;default:e.skipType(7&c)}}i.briefDialog[r]=n;break;case 4:i.setTime=e.int64();break;default:e.skipType(7&s)}}return i},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListResp"},e}();var Pn=jn;var Fn=new class{constructor(){h(this,"_token",""),h(this,"_uploadUrl",""),h(this,"_downloadUrl",""),h(this,"_cert","")}set imInitToken(e){this._token=e}get imInitToken(){return this._token}get fileUploadUrl(){return this._uploadUrl}get cert(){return this._cert}get fileDownloadUrl(){return this._downloadUrl}setFileServerInfo(e,t,r){this._uploadUrl=e,this._downloadUrl=t,this._cert=r}getFileAbsoluteUri(e){return it(e)?e.startsWith("http")?e:this.fileDownloadUrl+e:e}try2ExtractFileRelativeUri(e){return it(e)&&e.startsWith(this.fileDownloadUrl)?e.substring(this.fileDownloadUrl.length):e}};const Gn="SG",qn="::",Hn=t=>{if(!it(t.targetId+""))return"";switch(t.conversationType){case e.ConversationType.PRIVATE:return"P::"+t.targetId;case e.ConversationType.GROUP:return"G::"+t.targetId;case e.ConversationType.ULTRA_GROUP:return`SG::${t.targetId}_${t.channelId??""}`;default:return""}},zn=t=>{if(!it(t))return null;const r=t.split(qn);if(2!==r.length)return null;const n=r[0];if("G"===n)return{conversationType:e.ConversationType.GROUP,targetId:r[1]};if("P"===n)return{conversationType:e.ConversationType.PRIVATE,targetId:r[1]};if(n===Gn){const t=r[1].indexOf("_");if(t>0){const n=r[1].substring(0,t),o=r[1].substring(t+1);return{conversationType:e.ConversationType.ULTRA_GROUP,targetId:n,channelId:o}}return 0===t?null:{conversationType:e.ConversationType.ULTRA_GROUP,targetId:r[1]}}return null},Kn=e=>e.startsWith(Gn)||e.startsWith("G");var Vn=Mt.exports,Wn=Vn.Writer,$n=Vn.util,Jn=Vn.roots.default||(Vn.roots.default={});Jn.SendPrivateChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.localId=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.extra="",e.prototype.thumbnail="",e.prototype.msgContent=$n.newBuffer([]),e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(66).string(e.extra),null!=e.thumbnail&&Object.hasOwnProperty.call(e,"thumbnail")&&t.uint32(74).string(e.thumbnail),null!=e.msgContent&&Object.hasOwnProperty.call(e,"msgContent")&&t.uint32(82).bytes(e.msgContent),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendPrivateChatMessageReq"},e}(),Jn.DeletePrivateChatDialogReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatDialogReq"},e}(),Jn.GetNewMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.offset=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(16).int32(e.rows),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewMessageReq"},e}(),Jn.UpdatePrivateChatDialogStickyConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogStickyConfigReq"},e}(),Jn.UpdatePrivateChatDialogMuteConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdatePrivateChatDialogMuteConfigReq"},e}(),Jn.DeleteChatMessageReq=function(){function e(e){if(this.msgIdList=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=$n.emptyArray,e.encode=function(e,t){if(t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),null!=e.msgIdList&&e.msgIdList.length){t.uint32(26).fork();for(var r=0;r<e.msgIdList.length;++r)t.int64(e.msgIdList[r]);t.ldelim()}return t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteChatMessageReq"},e}(),Jn.DeletePrivateChatHistoryReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=$n.Long?$n.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeletePrivateChatHistoryReq"},e}(),Jn.CleanHistoryMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.type=0,e.prototype.msgTime=$n.Long?$n.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(16).int32(e.type),null!=e.msgTime&&Object.hasOwnProperty.call(e,"msgTime")&&t.uint32(24).int64(e.msgTime),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/CleanHistoryMessageReq"},e}(),Jn.GetBriefDialogListReq=function(){function e(e){if(this.destId=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=$n.emptyArray,e.encode=function(e,t){if(t||(t=Wn.create()),null!=e.destId&&e.destId.length)for(var r=0;r<e.destId.length;++r)t.uint32(10).string(e.destId[r]);return t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetBriefDialogListReq"},e}(),Jn.GetDialogKeyReq=function(){function e(e){if(this.destId=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId=$n.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=Wn.create()),null!=e.destId&&e.destId.length)for(var r=0;r<e.destId.length;++r)t.uint32(10).string(e.destId[r]);return null!=e.clientSign&&Object.hasOwnProperty.call(e,"clientSign")&&t.uint32(18).string(e.clientSign),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetDialogKeyReq"},e}(),Jn.RecallPrivateChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.destId="",e.prototype.msgId=$n.Long?$n.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.destId&&Object.hasOwnProperty.call(e,"destId")&&t.uint32(10).string(e.destId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallPrivateChatMessageReq"},e}(),Jn.GetHistoryMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.dialogKeys="",e.prototype.offset=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.dialogKeys&&Object.hasOwnProperty.call(e,"dialogKeys")&&t.uint32(10).string(e.dialogKeys),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.oldOffset&&Object.hasOwnProperty.call(e,"oldOffset")&&t.uint32(24).int64(e.oldOffset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(32).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(40).bool(e.newToOld),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetHistoryMessageReq"},e}(),Jn.GetWebDialogListReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type=0,e.prototype.offset=$n.Long?$n.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(16).int64(e.offset),null!=e.rows&&Object.hasOwnProperty.call(e,"rows")&&t.uint32(24).int32(e.rows),null!=e.newToOld&&Object.hasOwnProperty.call(e,"newToOld")&&t.uint32(32).bool(e.newToOld),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetWebDialogListReq"},e}(),Jn.GetNewSettingDialogListReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.time=$n.Long?$n.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Wn.create()),null!=e.time&&Object.hasOwnProperty.call(e,"time")&&t.uint32(8).int64(e.time),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/GetNewSettingDialogListReq"},e}();var Zn=Jn,Xn=Mt.exports,Yn=Xn.Writer,Qn=Xn.util,eo=Xn.roots.default||(Xn.roots.default={});eo.SendGroupChatMessageReq=function(){function e(e){if(this.at=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.localId=Qn.Long?Qn.Long.fromBits(0,0,!1):0,e.prototype.msgPreContent="",e.prototype.msgPostContent="",e.prototype.mediaFlag=!1,e.prototype.mediaConstructor=0,e.prototype.mediaAttribute="",e.prototype.at=Qn.emptyArray,e.prototype.extra="",e.prototype.assign="",e.prototype.atAll=!1,e.prototype.msgContent=Qn.newBuffer([]),e.encode=function(e,t){if(t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.localId&&Object.hasOwnProperty.call(e,"localId")&&t.uint32(16).int64(e.localId),null!=e.msgPreContent&&Object.hasOwnProperty.call(e,"msgPreContent")&&t.uint32(26).string(e.msgPreContent),null!=e.msgPostContent&&Object.hasOwnProperty.call(e,"msgPostContent")&&t.uint32(34).string(e.msgPostContent),null!=e.mediaFlag&&Object.hasOwnProperty.call(e,"mediaFlag")&&t.uint32(40).bool(e.mediaFlag),null!=e.mediaConstructor&&Object.hasOwnProperty.call(e,"mediaConstructor")&&t.uint32(48).int32(e.mediaConstructor),null!=e.mediaAttribute&&Object.hasOwnProperty.call(e,"mediaAttribute")&&t.uint32(58).string(e.mediaAttribute),null!=e.at&&e.at.length){t.uint32(66).fork();for(var r=0;r<e.at.length;++r)t.int64(e.at[r]);t.ldelim()}return null!=e.extra&&Object.hasOwnProperty.call(e,"extra")&&t.uint32(74).string(e.extra),null!=e.assign&&Object.hasOwnProperty.call(e,"assign")&&t.uint32(82).string(e.assign),null!=e.atAll&&Object.hasOwnProperty.call(e,"atAll")&&t.uint32(88).bool(e.atAll),null!=e.msgContent&&Object.hasOwnProperty.call(e,"msgContent")&&t.uint32(98).bytes(e.msgContent),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageReq"},e}(),eo.DeleteGroupChatHistoryReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.encode=function(e,t){return t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatHistoryReq"},e}(),eo.UpdateGroupChatDialogStickyConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.stickyFlag=!1,e.encode=function(e,t){return t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.stickyFlag&&Object.hasOwnProperty.call(e,"stickyFlag")&&t.uint32(16).bool(e.stickyFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogStickyConfigReq"},e}(),eo.UpdateGroupChatDialogMuteConfigReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.muteFlag=!1,e.encode=function(e,t){return t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.muteFlag&&Object.hasOwnProperty.call(e,"muteFlag")&&t.uint32(16).bool(e.muteFlag),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/UpdateGroupChatDialogMuteConfigReq"},e}(),eo.RecallGroupChatMessageReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.prototype.msgId=Qn.Long?Qn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),null!=e.msgId&&Object.hasOwnProperty.call(e,"msgId")&&t.uint32(16).int64(e.msgId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/RecallGroupChatMessageReq"},e}(),eo.DeleteGroupChatDialogReq=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.groupId="",e.encode=function(e,t){return t||(t=Yn.create()),null!=e.groupId&&Object.hasOwnProperty.call(e,"groupId")&&t.uint32(10).string(e.groupId),t},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/DeleteGroupChatDialogReq"},e}();var to=eo;const ro=Mt.exports.Reader,no=Mt.exports.util,oo=Mt.exports.roots.default||(Mt.exports.roots.default={}),io=oo.SendGroupChatMessageResp=(()=>{function e(e){if(e)for(let t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.errorCode=0,e.prototype.errorMessage="",e.prototype.localId=no.Long?no.Long.fromBits(0,0,!1):0,e.prototype.msgId=no.Long?no.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=no.Long?no.Long.fromBits(0,0,!1):0,e.prototype.seqno=no.Long?no.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof ro||(e=ro.create(e));let r=void 0===t?e.len:e.pos+t,n=new oo.SendGroupChatMessageResp;for(;e.pos<r;){let t=e.uint32();switch(t>>>3){case 1:n.errorCode=e.int32();break;case 2:n.errorMessage=e.string();break;case 3:n.localId=e.int64();break;case 4:n.msgId=e.int64();break;case 5:n.msgSendTime=e.int64();break;case 6:n.seqno=e.int64();break;default:e.skipType(7&t)}}return n},e.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/SendGroupChatMessageResp"},e})(),so=e=>{const t={dialogKeys:e.dialogId,newToOld:e.newToOld,rows:e.count};return e.newToOld?t.offset=nn.fromNumber(e.offset):t.oldOffset=nn.fromNumber(e.offset),Mn.send(e.dialogId.startsWith(Gn)?Lt.GetSuperGroupRemoteMessages:Lt.GetRemoteMessages,t,{encoder:Zn.GetHistoryMessageReq,decoder:Pn.GetHistoryMessageResp})};let ao=0;const co=async()=>{const t=(new Date).getTime(),{code:r,data:n}=await Mn.send(Lt.GetServerTime,null,{decoder:Yr.SystemCurrentTimeMillisResp});if(r===e.ErrorCode.SUCCESS){const{currentTimeMillis:e}=n;ao=e.toNumber()-t}},lo=()=>(new Date).getTime()+ao,uo=new Set;var ho={addMessage(e){uo.add(e)},remove(e){uo.delete(e)},has:e=>uo.has(e),reset(){uo.clear()}};const fo=new Set;var po={addMessage(e){fo.add(e)},remove(e){fo.delete(e)},has:e=>fo.has(e),reset(){fo.clear()}};const go=new Map;function yo(e){go.set(e.getObjectId(),e.decode.bind(e))}class vo{constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];h(this,"messageType",void 0),h(this,"content",void 0),h(this,"isPersited",void 0),h(this,"isCounted",void 0),h(this,"isStatusMessage",void 0),this.messageType=e,this.content=t,o?(this.isPersited=!1,this.isCounted=!1):(this.isPersited=r,this.isCounted=n),this.isStatusMessage=o}get objectId(){return this.constructor.getObjectId()}static getObjectId(){throw new Error("Method not implemented.")}static decode(e){throw new Error("Method not implemented.")}encode(){throw new Error("Method not implemented.")}}const mo=0,bo=268439552,Co=268439563,wo=268439562,Eo=268439553,So=268439581,Oo=268439597,_o=268439613,Io=268439629,To=1610678301,Ro=268439645,ko="RC:TxtMsg",No="RC:HQVCMsg",Ao="RC:FileMsg",Lo="RC:ImgMsg",Mo="RC:GIFMsg",Do="RC:RcNtf",xo="RC:CmdMsg";class Bo extends vo{constructor(e){super(ko,e)}static getObjectId(){return mo}static decode(e){const{user:t,extra:r,content:n}=e;return new Bo({user:t,extra:r,content:n})}encode(){const{user:e,extra:t,content:r}=this.content;return{user:e,extra:t,content:r}}}class Uo extends vo{constructor(e){super(Lo,e)}static getObjectId(){return bo}static decode(e){const{user:t,extra:r,thumbnailObjectKey:n,originalObjectKey:o,width:i,height:s}=e;return new Uo({user:t,extra:r,content:n,imageUri:Fn.getFileAbsoluteUri(o),width:i,height:s})}encode(){const{user:e,extra:t,content:r,imageUri:n,width:o,height:i}=this.content;return{user:e,extra:t,thumbnailObjectKey:r,originalObjectKey:Fn.try2ExtractFileRelativeUri(n),width:o&&Math.floor(o),height:i&&Math.floor(i)}}}class jo extends vo{constructor(e){super(Mo,e)}static getObjectId(){return Co}static decode(e){const{user:t,extra:r,size:n,originalObjectKey:o,width:i,height:s}=e;return new jo({user:t,extra:r,gifDataSize:n,remoteUrl:Fn.getFileAbsoluteUri(o),width:i,height:s})}encode(){const{user:e,extra:t,gifDataSize:r,remoteUrl:n,width:o,height:i}=this.content;return{user:e,extra:t,size:r,originalObjectKey:Fn.try2ExtractFileRelativeUri(n),width:o&&Math.floor(o),height:i&&Math.floor(i),extension:"gif"}}}class Po extends vo{constructor(e){super(No,e)}static getObjectId(){return Eo}static decode(e){const{user:t,extra:r,length:n,audioObjectKey:o,extension:i}=e;return new Po({user:t,extra:r,remoteUrl:Fn.getFileAbsoluteUri(o),duration:n,type:i})}encode(){const{user:e,extra:t,remoteUrl:r,duration:n,type:o}=this.content;return{user:e,extra:t,length:n,audioObjectKey:Fn.try2ExtractFileRelativeUri(r),extension:o}}}class Fo extends vo{constructor(e){super(Ao,e)}static getObjectId(){return wo}static decode(e){const{user:t,extra:r,title:n,extension:o,size:i,originalObjectKey:s}=e;return new Fo({user:t,extra:r,name:n,size:i,type:o,fileUrl:Fn.getFileAbsoluteUri(s)})}encode(){const{user:e,extra:t,name:r,size:n,type:o,fileUrl:i}=this.content;return{user:e,extra:t,title:r,originalObjectKey:Fn.try2ExtractFileRelativeUri(i),extension:o,size:n}}}class Go extends vo{constructor(e){super(Do,e,!0,!1,!1)}static getObjectId(){return To}static decode(e){return new Go(e)}encode(){return this.content}}class qo extends vo{constructor(e){super(xo,e,!1,!1)}static getObjectId(){return Ro}static decode(e){return new qo(e)}encode(){return this.content}}class Ho extends vo{static decode(e){const{messageType:t,fields:r,user:n,extra:o}=e;return new this(t,{...r,user:n,extra:o})}encode(){const{user:e,extra:t,mentionedInfo:r,...n}=this.content;return{messageType:this.messageType,fields:n,user:e,extra:t}}}class zo extends Ho{constructor(e,t){super(e,t,!1,!1)}static getObjectId(){return So}}class Ko extends Ho{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return Oo}}class Vo extends Ho{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return _o}}class Wo extends Ho{constructor(e,t){super(e,t,!1,!1,!0)}static getObjectId(){return Io}}var $o=new class{constructor(){h(this,"aesKeyRecord",new Map)}async getDialogAesKey(e){return it(e)?this.aesKeyRecord.has(e)?this.aesKeyRecord.get(e):new Promise((t=>{this.getDialogAesKeyListFromRemote([e]).then((r=>{t(r.get(e))})),setTimeout((()=>{t(null)}),8e3)})):null}getDialogAesKeyList(e){return new Promise((t=>{const r=new Map;this.getDialogAesKeyListInBatches(e,((n,o)=>{if(o.size)for(const[e,t]of o)r.set(e,t);(r.size===e.length||n)&&t(r)}))}))}getDialogAesKeyListInBatches(e,t){const r=new Map,n=[];e.forEach((e=>{if(!it(e))return;const t=this.getDialogAesKeyFromLocal(e);t?r.set(e,t):n.push(e)})),t(!1,r),n.length&&this.getDialogAesKeyListFromRemote(n).then((e=>{t(!0,e)}))}reset(){this.aesKeyRecord.clear()}async getDialogAesKeyListFromRemote(t){if(!t.length)return new Map;const{code:r,data:n}=await(o=t,Mn.send(Lt.GetDialogKey,{destId:o,clientSign:""},{encoder:Zn.GetDialogKeyReq,decoder:Pn.GetDialogKeyResp}));var o;if(r===e.ErrorCode.SUCCESS){const e=new Map;for(const t in n.entry){var i,s;const r=n.entry[t];if(null!==(i=r.aesKey)&&void 0!==i&&i.length&&null!==(s=r.aesIV)&&void 0!==s&&s.length){const n={key:r.aesKey,iv:r.aesIV};e.set(t,n),this.aesKeyRecord.set(t,n)}}return e}return new Map}getDialogAesKeyFromLocal(e){return it(e)?this.aesKeyRecord.get(e):null}};const Jo="time",Zo=(e,t)=>[e,t,Jo].join("_");class Xo{constructor(e,t){h(this,"appkey",void 0),h(this,"userId",void 0),h(this,"inBoxOffset",nn.ZERO),this.appkey=e,this.userId=t}setInboxOffset(e){if(this.inBoxOffset>e)return;this.inBoxOffset=e;const t=Zo(this.appkey,this.userId);pt.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=Zo(this.appkey,this.userId);this.inBoxOffset=nn.fromString(pt.get(e)??"0")}return this.inBoxOffset}}const Yo=e=>{const t=[];let r,n,o;for(n=0;n<e.length;++n)for(r=e[n],o=3;o>=0;--o)t.push(r>>8*o&255);return new Uint8Array(t)};const Qo=(e,t,r)=>{const n={};return e.forEach((e=>{const o=ei(e,t.get(e),r.get(e));o.length&&(n[e]=o)})),n},ei=(t,r,n)=>{const o=zn(t);if(!o)return[];const i=new Set;let s=[];return r.forEach((t=>{const r=t;let a=r.mediaConstructor,c=ti(r,n);if(!c)return;if(1610678290===a||1610743841===a){const{msgId:e,sendTime:t}=c,n={sentTime:t,messageUId:e,conversationType:o.conversationType,targetId:r.isOut?o.targetId:Dn.uid,channelId:o.channelId};a=To,c=n,i.add(e)}const l=function(e,t){const r=go.get(e);return r?r(t):null}(a,c);if(Xe(l)){const t={...o,senderUserId:r.srcId.toString(),messageDirection:r.isOut?e.MessageDirection.SEND:e.MessageDirection.RECEIVE,isCounted:l.isCounted,isMentioned:r.atFlag,content:l.content,messageType:l.messageType,isOffLineMessage:!1,isPersited:l.isPersited,messageId:nn.isLong(r.localId)?r.localId.toNumber():void 0,messageUId:r.msgId.toString(),sentTime:r.seqno.toNumber(),receivedTime:lo(),isStatusMessage:l.isStatusMessage,receivedStatus:e.ReceivedStatus.READ,disableNotification:!1};if(t.isStatusMessage&&lo()-t.sentTime>6e3)return;s.push(t)}})),i.size&&(s=s.filter((e=>!i.has(e.messageUId)))),s},ti=(e,t)=>{try{var r,n;let o;o=null!==(r=e.msgContent)&&void 0!==r&&r.length?((e,t)=>{const r=window.btoa(String.fromCharCode(...e));return Je.AES.decrypt(r,Je.enc.Utf8.parse(t.key),{iv:Xe(t.iv)?Je.enc.Utf8.parse(t.iv):void 0}).toString(Je.enc.Utf8)})(e.msgContent,t):e.msgPreContent??"",1610678290!==e.mediaConstructor&&1610743841!==e.mediaConstructor||(o=ri(o));let i={};return null!==(n=o)&&void 0!==n&&n.length&&(i=JSON.parse(o)),i}catch(t){return Ct.error("decode message content fail -> uid:",e.msgId.toString()),null}},ri=e=>e.replace(/("msgId")\s*:\s*(\d+)/g,((e,t,r)=>`${t}:"${r}"`));var ni={parse:function(e,t){const r=new Map;if(Object.keys(e).forEach((t=>{var n;const o=null===(n=e[t].dialogMessage)||void 0===n?void 0:n.filter((e=>!e.sharingGroupFlag));null!=o&&o.length&&r.set(t,o)})),!r.size)return void t(!0,{});const n=new Set(r.keys());$o.getDialogAesKeyListInBatches([...r.keys()],((e,o)=>{if(o.size){const e=[...o.keys()];for(const t of e)n.delete(t);t(!n.size,Qo(e,r,o))}n.size&&e&&t(!0,{})}))},parseSingleDialogMessages:ei};function oi(e){if(!Xe(e))return e;if(Array.isArray(e))return e.map((e=>oi(e)));if(rt(e)){const t={};return Object.keys(e).forEach((r=>{t[r]=oi(e[r])})),t}return e}const ii={unreadMessageCount:{keyName:"c",defaultVal:0},lastUnreadTime:{keyName:"lt",defaultVal:0},notificationStatus:{keyName:"nc",defaultVal:2},notificationLevel:{keyName:"nl",defaultVal:0},isTop:{keyName:"it",defaultVal:!1},mentionedUIds:{keyName:"mu",defaultVal:null}};class si{constructor(e,t){h(this,"localStore",void 0);const r=`con-${e}-${t}`;this.localStore=new yt(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}getConOptionByKey(t){const r=(t=t||"").split("_");if(r.length>=2){const e=r.shift(),t=r.shift(),n=r.join("_");return{conversationType:Number(e),targetId:t,channelId:n}}return{conversationType:e.ConversationType.PRIVATE,targetId:"",channelId:""}}updateUnreadCount(t){const{conversationType:r,targetId:n,channelId:o,content:i,messageType:s,sentTime:a,isCounted:c,messageDirection:l}=t,u=l===e.MessageDirection.SEND,d=s===Do,h=rt(i),f={conversationType:r,targetId:n,channelId:o},p=this.get(f)||{},g=p.lastUnreadTime||0,y=p.unreadMessageCount||0;if(!(a<=g)&&!u){if(c&&(p.unreadMessageCount=y+1,g||(p.lastUnreadTime=a)),d&&h){i.sentTime>=g&&y&&(p.unreadMessageCount=y-1)}this.set(f,p)}}updateMentionedData(t){const{conversationType:r,targetId:n,channelId:o,messageUId:i,messageType:s,isMentioned:a,messageDirection:c,content:l}=t;if(c===e.MessageDirection.SEND||!a&&s!==Do)return;const u=this.getStoreKey({conversationType:r,targetId:n,channelId:o}),d=this.localStore.get(u)||{},h=ii.mentionedUIds.keyName,f=d[h]||[];if(a&&r===e.ConversationType.GROUP&&(f.includes(i)||f.push(i)),s===Do&&r===e.ConversationType.GROUP){const e=l,t=f.indexOf(e.messageUId);t>=0&&f.splice(t,1)}f.length?d[h]=f:delete d[h],st(d)?this.localStore.set(u,d):this.localStore.remove(u)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of ct(t)){const r=ii[e],o=t[e];if(et(null==r?void 0:r.keyName)||et(o))continue;o===r.defaultVal?delete n[r.keyName]:n[r.keyName]=o,n[ii.unreadMessageCount.keyName]||(delete n[ii.lastUnreadTime.keyName],delete n[ii.mentionedUIds.keyName])}st(n)?this.localStore.set(r,n):this.localStore.remove(r)}get(e){const t=this.getStoreKey(e),r=this.localStore.get(t)||{},n={};for(const e of ct(ii)){const{keyName:t,defaultVal:i}=ii[e];var o;if("mentionedUIds"===e)n.unreadMentionedCount=(null===(o=r[t])||void 0===o?void 0:o.length)??0,n.hasMentioned=!!n.unreadMentionedCount;else n[e]=r[t]||oi(i)}return n}getAll(){const e=this.localStore.getCache()||{},t=[];for(const r in e){const n=this.getConOptionByKey(r),o=e[r];for(const e of ct(ii)){const{keyName:t,defaultVal:r}=ii[e];"mentionedUIds"!==e&&(n[e]=o[t]||oi(r))}t.push(n)}return t}}const ai=t=>{const r=t.destId??"",n=zn(r);if(!n)return;return{...n,unreadMessageCount:0,notificationStatus:t.muteFlag?e.NotificationStatus.OPEN:e.NotificationStatus.CLOSE,notificationLevel:Ye(t.pushNotificationLevel)&&0!==t.pushNotificationLevel&&Xe(e.NotificationLevel[t.pushNotificationLevel])?t.pushNotificationLevel:t.muteFlag?e.NotificationLevel.AT_USER_NOTIFICATION:e.NotificationLevel.NOT_SET,isTop:!!t.stickyFlag,lastUnreadTime:0}},ci="STATUS_CHANGED";class li{constructor(e,t){h(this,"storageKey",void 0),h(this,"eventEmitter",void 0),h(this,"isPulling",!1),this.storageKey=`con-s-${e}-${t}`,this.eventEmitter=new Nt}async pull(){if(this.isPulling)return;let t;this.isPulling=!0;const r=pt.get(this.storageKey);t=Ye(r)&&r>0?r:lo()-1e4;let{code:n,data:o}=await(e=>Mn.send(Lt.GetDialogChangedStatus,{time:nn.fromNumber(e)},{encoder:Zn.GetNewSettingDialogListReq,decoder:Pn.GetNewSettingDialogListResp}))(t);n===e.ErrorCode.SUCCESS&&(o.setTime.toNumber()>0&&pt.set(this.storageKey,o.setTime.toNumber()),o.briefDialog&&ct(o.briefDialog).forEach((e=>{const t=o.briefDialog[e],r=ai(t);r&&this.eventEmitter.emit(ci,r)}))),this.isPulling=!1}watch(e){this.eventEmitter.on(ci,(t=>{e(t)}))}}class ui{constructor(e,t,r){h(this,"updatedConversationFunc",void 0),h(this,"store",void 0),h(this,"draftMap",new Map),h(this,"localConversationSet",new Set),h(this,"updatedConversations",[]),h(this,"notify",void 0),h(this,"statusManager",void 0),this.updatedConversationFunc=r,this.store=new si(e,t),this.notify=ut(this.notifyConversationChanged.bind(this),0),this.statusManager=new li(e,t),this.statusManager.watch((e=>{this.addStatus(e,!0)}))}getConversationKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}setUpdatedConversation(e){const t=this.updatedConversations.findIndex((t=>this.getConversationKey(e.conversation)===this.getConversationKey(t.conversation)));t>=0?(e={conversation:Object.assign(this.updatedConversations[t].conversation,e.conversation),updatedItems:Object.assign(this.updatedConversations[t].updatedItems,e.updatedItems)},this.updatedConversations[t]=e):this.updatedConversations.push(e),this.notify()}notifyConversationChanged(){var e;const t=this.updatedConversations.map((e=>({conversation:{...e.conversation,...this.store.get(e.conversation)},updatedItems:e.updatedItems})));this.updatedConversations=[],null===(e=this.updatedConversationFunc)||void 0===e||e.call(this,t)}syncConversationStatus(){this.statusManager.pull()}async loadConvsationsIfNotExist(t){if(null==t||!t.length)return;const r=t.filter((e=>!this.localConversationSet.has(this.getConversationKey(e))));if(!r.length)return;const n=r.map(Hn).filter(it);if(!n.length)return;const{code:o,data:i}=await(e=>Mn.send(Lt.GetBriefDialogList,{destId:e},{encoder:Zn.GetBriefDialogListReq,decoder:Pn.GetBriefDialogListResp}))(n);o===e.ErrorCode.SUCCESS&&ct(i.briefDialog).forEach((e=>{const t=i.briefDialog[e],r=ai(t);r&&(this.localConversationSet.add(this.getConversationKey(r)),this.addStatus(r,!0))}))}addLocalConversation(e){const{conversationType:t,targetId:r,channelId:n,isTop:o,notificationStatus:i,notificationLevel:s}=e;this.localConversationSet.add(this.getConversationKey(e)),this.addStatus({conversationType:t,targetId:r,channelId:n,isTop:o,notificationStatus:i,notificationLevel:s},!1)}addStatus(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{conversationType:r,targetId:n,notificationStatus:o,notificationLevel:i,isTop:s,channelId:a}=e,c={conversationType:r,targetId:n,channelId:a},l=lo(),u=this.store.get(c),d={};Xe(i)&&u.notificationLevel!==i&&(d.notificationLevel={time:l,val:i}),Xe(o)&&u.notificationStatus!==o&&(d.notificationStatus={time:l,val:o}),Xe(s)&&u.isTop!==s&&(d.isTop={time:l,val:s}),this.store.set(c,{notificationStatus:o,isTop:s,notificationLevel:i}),Object.keys(d).length&&t&&this.setUpdatedConversation({conversation:c,updatedItems:d})}setConversationCacheByMessage(e){const{conversationType:t,isPersited:r,targetId:n,channelId:o}=e,i={conversationType:t,targetId:n,channelId:o},s={conversation:i,updatedItems:{}},a=oi(this.get(i));this.store.updateUnreadCount(e),this.store.updateMentionedData(e);const c=this.get(i);a.unreadMessageCount!==c.unreadMessageCount&&(s.updatedItems.unreadMessageCount={time:e.sentTime,val:c.unreadMessageCount}),a.hasMentioned!==c.hasMentioned&&(s.updatedItems.hasMentioned={time:e.sentTime,val:c.hasMentioned}),a.unreadMentionedCount!==c.unreadMentionedCount&&(s.updatedItems.unreadMentionedCount={time:e.sentTime,val:c.unreadMentionedCount}),r&&(s.conversation.latestMessage=e,s.updatedItems.latestMessage={time:e.sentTime,val:e}),Object.keys(s.updatedItems).length&&this.setUpdatedConversation(s)}get(e){return this.store.get(e)}getAllUnreadCount(t,r){const n=this.store.getAll();let o=0;return n.forEach((n=>{let{unreadMessageCount:i,notificationStatus:s,notificationLevel:a,conversationType:c}=n;i=i||0;const l=s===e.NotificationStatus.OPEN||a>0;!r&&l||(t.length>0?t.includes(+c)&&(o+=+i):o+=+i)})),o}getUnreadCount(e){return this.store.get(e).unreadMessageCount||0}clearUnreadCount(e){const t=this.store.get(e),{unreadMessageCount:r,unreadMentionedCount:n}=t;(r||n)&&(t.unreadMessageCount=0,t.hasMentioned=!1,t.unreadMentionedCount=0),this.store.set(e,t);const o={};r&&(o.unreadMessageCount={val:0,time:lo()}),n&&(o.hasMentioned={val:!1,time:lo()},o.unreadMentionedCount={val:0,time:lo()}),Object.keys(o).length&&this.setUpdatedConversation({conversation:e,updatedItems:o})}clearAllUnreadCount(){this.store.getAll().forEach((e=>this.clearUnreadCount(e)))}getNotificationLevel(e){return this.store.get(e).notificationLevel}getNotificationStatus(e){return this.store.get(e).notificationStatus||2}setDraft(e,t){this.draftMap.set(this.getConversationKey(e),t)}getDraft(e){return this.draftMap.get(this.getConversationKey(e))??""}clearDraft(e){this.draftMap.delete(this.getConversationKey(e))}getBlockConversationList(){return this.store.getAll().filter((t=>t.notificationStatus===e.NotificationStatus.OPEN||t.notificationLevel>0)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId})))}getTopConversationList(){return(this.store.getAll()||{}).filter((e=>e.isTop)).map((e=>({conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId})))}getUnreadMentionedCount(e){return this.get(e).unreadMentionedCount||0}getAllUnreadMentionedCount(){const e=this.store.getAll();let t=0;return e.forEach((e=>{let{unreadMentionedCount:r}=e;r=r||0,t+=Number(r)})),t}getAllConversationState(){return this.store.getAll().map((e=>{let{conversationType:t,targetId:r,channelId:n,unreadMessageCount:o,unreadMentionedCount:i,notificationLevel:s,notificationStatus:a,isTop:c}=e;return{conversationType:t,targetId:r,channelId:n,unreadCount:o,unreadMentionedCount:i??0,notificationLevel:s,notificationStatus:a,isTop:c}}))}destroyed(){this.updatedConversationFunc=void 0}}const di={addStatus:function(e,t){},setConversationCacheByMessage:function(e){},get:function(e){return null},getAllUnreadCount:function(e,t){return 0},getUnreadCount:function(e){return 0},clearUnreadCount:function(e){},clearAllUnreadCount(){},getNotificationLevel:function(t){return e.NotificationLevel.NOT_SET},getNotificationStatus:function(t){return e.NotificationStatus.CLOSE},setDraft:function(e,t){},getDraft:function(e){return""},clearDraft:function(e){},getBlockConversationList:function(){return[]},getTopConversationList:function(){return[]},getUnreadMentionedCount:function(e){return 0},getAllUnreadMentionedCount:function(){return 0},getAllConversationState:function(){return[]},addLocalConversation:function(e){},loadConvsationsIfNotExist:function(e){},destroyed(){},syncConversationStatus:function(){}};let hi;var fi={create(e,t,r){hi=new ui(e,t,r)},get:()=>hi??di};class pi{constructor(e,t){h(this,"watcher",void 0),h(this,"pullingMsg",!1),h(this,"letterbox",void 0),h(this,"serverMsgSeqno",nn.ZERO),h(this,"pullOfflineFinished",!1),h(this,"intervalTimer",void 0),h(this,"retryTimer",void 0),h(this,"latestSyncTimestamp",0),h(this,"started",!1),this.watcher=e,this.letterbox=new Xo(t.appkey,Dn.uid)}start(){this.started=!0,this.pullOfflineFinished=!1,this.startPullInterval()}stop(){this.started=!1,this.stopPullInterval(),this.cancelRetryTask()}syncMsg(e){this.serverMsgSeqno=e,this.pullMsg()}startPullInterval(){this.stopPullInterval();this.intervalTimer=setInterval((()=>{Date.now()-this.latestSyncTimestamp>=18e4&&this.pullMsg()}),3e4),this.latestSyncTimestamp=Date.now(),this.pullMsg()}stopPullInterval(){this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null)}try2RePullMsg(){this.retryTimer=setTimeout((()=>{this.retryTimer=null,this.pullMsg()}),1e3)}cancelRetryTask(){this.retryTimer&&(clearTimeout(this.retryTimer),this.retryTimer=null)}async pullMsg(){if(this.pullingMsg)return;if(!this.started)return;this.cancelRetryTask(),this.pullingMsg=!0;const t=this.letterbox.getInboxOffset();this.pullOfflineFinished||Ct.info(`pullMsg -> time: ${t}`),this.latestSyncTimestamp=Date.now();const{code:r,data:n}=await((e,t)=>Mn.send(Lt.GetNewMessage,{offset:e,rows:t},{encoder:Zn.GetNewMessageReq,decoder:Pn.GetNewMessageResp}))(t,60);if(r!==e.ErrorCode.SUCCESS)return this.pullOfflineFinished||Ct.warn("pullMsg failed -> code:",r),this.pullingMsg=!1,void this.try2RePullMsg();const{offset:o,seqno:i,msg:s}=n,a=Object.keys(s).map(zn).filter((e=>Xe(e)));fi.get().loadConvsationsIfNotExist(a),ni.parse(s,((t,r)=>{const n=[],s=[],a=!this.pullOfflineFinished;var c,l;(Object.keys(r).forEach((t=>{const o=r[t],i=[];if(o.forEach((t=>{t.messageDirection===e.MessageDirection.SEND&&t.messageId&&ho.has(t.messageId)?ho.remove(t.messageId):t.messageType===Do&&po.has(t.content.messageUId)?po.remove(t.content.messageUId):(t.isOffLineMessage=a,fi.get().setConversationCacheByMessage(t),i.push(t))})),n.push(...i),this.isExistPersistedMessage(i)){const e=zn(t);e&&s.push(e)}})),n.length)&&(null===(c=(l=this.watcher).batchMessage)||void 0===c||c.call(l,n));if(s.length&&fi.get().loadConvsationsIfNotExist(s),t){var u;i.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=i);const e=this.serverMsgSeqno.lessThanOrEqual(o);this.pullOfflineFinished||Ct.info(`pullMsg success -> syncTime: ${o}, finished: ${e}`),null===(u=this.letterbox)||void 0===u||u.setInboxOffset(o),this.pullingMsg=!1,e&&!this.pullOfflineFinished&&(this.pullOfflineFinished=!0,this.watcher.pullFinished&&this.watcher.pullFinished()),e||this.pullMsg()}}))}isExistPersistedMessage(e){return e.some((e=>e.isPersited))}}class gi{static init(e){return this._loader||(this._loader=new gi(e)),this._loader}static get loader(){return this._loader}constructor(t){h(this,"options",void 0),h(this,"connectionStatus",e.ConnectionStatus.DISCONNECTED),h(this,"isInternalConnected",!1),h(this,"watcher",void 0),h(this,"messageLoader",void 0),this.options=t,this.watcher={onConnecting:void 0,onConnected:void 0,onDisconnect:void 0,onSuspend:void 0,pullFinished:void 0,batchMessage:void 0,conversationState:void 0},Mn.setServerInfo(this.getWebSocketUrl()),Mn.setCallback({status:this.connectionStatusListener.bind(this),message:this.messageListener.bind(this),onAuth:this.authListener.bind(this)},{needReAuth:this.needReAuthProvider.bind(this),profile:this.needProfileProvider.bind(this)}),this.registerMessage()}getWebSocketUrl(){var e;const t=null===(e=this.options)||void 0===e?void 0:e.serverInfo;return it(t)?ot(r=t)&&/wss?:\/\//.test(r)?t:"ws://"+t:"wss://tt.mimelabs.xyz:8991";var r}registerMessage(){yo(Bo),yo(Uo),yo(jo),yo(Po),yo(zo),yo(Vo),yo(Ko),yo(Wo),yo(Go),yo(qo),yo(Fo)}async connect(t){if(this.connectionStatus===e.ConnectionStatus.CONNECTED)return{code:e.ErrorCode.SUCCESS,userId:Dn.uid+""};if(this.connectionStatus===e.ConnectionStatus.CONNECTING)return{code:e.ErrorCode.BIZ_ERROR_CONNECTING};if("string"!=typeof t||0===t.length)return{code:e.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR};Fn.imInitToken=t;const r=await Mn.connect(t);var n;r===e.ErrorCode.SUCCESS&&(this.isInternalConnected=!0,fi.get().destroyed(),fi.create(this.options.appkey,Dn.uid,this.watcher.conversationState),null===(n=this.messageLoader)||void 0===n||n.stop(),this.messageLoader=new pi(this.watcher,this.options),co(),ho.reset(),po.reset(),$o.reset());return{code:r,userId:Dn.uid+""}}reconnect(){return this.isInternalConnected?Promise.resolve({code:e.ErrorCode.CAN_NOT_RECONNECT}):this.connect(Fn.imInitToken)}disconnect(){return this.isInternalConnected=!1,Mn.close(),Promise.resolve()}getConnectionStatus(){return this.connectionStatus}assignWatcher(e){ct(this.watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];this.watcher[t]=tt(r)?r:void 0}}))}resetWatcher(){ct(this.watcher).forEach((e=>{this.watcher[e]=void 0}))}async connectionStatusListener(t){this.connectionStatus=t,setTimeout((()=>{switch(t){case e.ConnectionStatus.BLOCKED:case e.ConnectionStatus.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.ConnectionStatus.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.ConnectionStatus.CONNECTING:this.handleConnecting();break;case e.ConnectionStatus.CONNECTED:this.handleConnected();break;case e.ConnectionStatus.DISCONNECTED:this.handleDisconnect()}}),0)}handleConnecting(){var e,t;null===(e=(t=this.watcher).onConnecting)||void 0===e||e.call(t)}handleConnected(){var t,r,n;null===(t=(r=this.watcher).onConnected)||void 0===t||t.call(r),null===(n=this.messageLoader)||void 0===n||n.start(),setTimeout((()=>{this.connectionStatus===e.ConnectionStatus.CONNECTED&&fi.get().syncConversationStatus()}),2e3)}handleDisconnect(){var e,t,r;null===(e=(t=this.watcher).onDisconnect)||void 0===e||e.call(t),null===(r=this.messageLoader)||void 0===r||r.stop()}handleSuspend(){var e,t;null===(e=(t=this.watcher).onSuspend)||void 0===e||e.call(t)}messageListener(e,t){if(e===Lt.NewMessagePush){var r;const e=Pn.NewMessageNotificationResp.decode(t);null===(r=this.messageLoader)||void 0===r||r.syncMsg(e.seqno)}else e===Lt.DialogChangedPush&&fi.get().syncConversationStatus()}authListener(e){Fn.setFileServerInfo(e.fileDomain,e.dialogFileDomain,e.cert),Dn.setLogged(e,Fn.imInitToken)}needReAuthProvider(){return!Dn.user.active||Dn.user.token!==Fn.imInitToken}needProfileProvider(){if(!this.needReAuthProvider()){const{deviceId:e,sessionId:t,uid:r}=Dn.user;return{deviceId:e,sessionId:t,uid:r}}return null}}h(gi,"_loader",void 0);var yi={exports:{}},vi={exports:{}},mi={exports:{}},bi={exports:{}},Ci=wi;function wi(e,t){"string"==typeof e&&(t=e,e=void 0);var r=[];function n(e){if("string"!=typeof e){var t=o();if(wi.verbose&&console.log("codegen: "+t),t="return "+t,e){for(var i=Object.keys(e),s=new Array(i.length+1),a=new Array(i.length),c=0;c<i.length;)s[c]=i[c],a[c]=e[i[c++]];return s[c]=t,Function.apply(null,s).apply(null,a)}return Function(t)()}for(var l=new Array(arguments.length-1),u=0;u<l.length;)l[u]=arguments[++u];if(u=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=l[u++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),u!==l.length)throw Error("parameter count mismatch");return r.push(e),n}function o(n){return"function "+(n||t||"")+"("+(e&&e.join(",")||"")+"){\n "+r.join("\n ")+"\n}"}return n.toString=o,n}wi.verbose=!1;var Ei=_i,Si=Bt,Oi=Vt();function _i(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&Oi&&Oi.readFile?Oi.readFile(e,(function(n,o){return n&&"undefined"!=typeof XMLHttpRequest?_i.xhr(e,t,r):n?r(n):r(null,t.binary?o:o.toString("utf8"))})):_i.xhr(e,t,r):Si(_i,this,e,t)}_i.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o<n.responseText.length;++o)e.push(255&n.responseText.charCodeAt(o))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()};var Ii={};!function(e){var t=e,r=t.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=t.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),n=r(e),o="";n&&(o=t.shift()+"/");for(var i=0;i<t.length;)".."===t[i]?i>0&&".."!==t[i-1]?t.splice(--i,2):n?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};t.resolve=function(e,t,o){return o||(t=n(t)),r(t)?t:(o||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}}(Ii);var Ti,Ri,ki,Ni,Ai,Li,Mi,Di,xi,Bi,Ui,ji,Pi,Fi={};function Gi(){return Ti||(Ti=1,function(e){var t=e,r=Cs(),n=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,o={};for(t|=0;r<e.length;)o[n[r+t]]=e[r++];return o}t.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),t.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",r.emptyArray,null]),t.long=o([0,0,0,1,1],7),t.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),t.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])}(Fi)),Fi}function qi(){if(ki)return Ri;ki=1,Ri=s;var e=ws();((s.prototype=Object.create(e.prototype)).constructor=s).className="Field";var t,r=Es(),n=Gi(),o=Cs(),i=/^required|optional|repeated$/;function s(t,r,s,a,c,l,u){if(o.isObject(a)?(u=c,l=a,a=c=void 0):o.isObject(c)&&(u=l,l=c,c=void 0),e.call(this,t,l),!o.isInteger(r)||r<0)throw TypeError("id must be a non-negative integer");if(!o.isString(s))throw TypeError("type must be a string");if(void 0!==a&&!i.test(a=a.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==c&&!o.isString(c))throw TypeError("extend must be a string");"proto3_optional"===a&&(a="optional"),this.rule=a&&"optional"!==a?a:void 0,this.type=s,this.id=r,this.extend=c||void 0,this.required="required"===a,this.optional=!this.required,this.repeated="repeated"===a,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!o.Long&&void 0!==n.long[s],this.bytes="bytes"===s,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}return s.fromJSON=function(e,t){return new s(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(s.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),s.prototype.setOption=function(t,r,n){return"packed"===t&&(this._packed=null),e.prototype.setOption.call(this,t,r,n)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=n.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof t?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof r&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof r)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=o.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var i;o.base64.test(this.typeDefault)?o.base64.decode(this.typeDefault,i=o.newBuffer(o.base64.length(this.typeDefault)),0):o.utf8.write(this.typeDefault,i=o.newBuffer(o.utf8.length(this.typeDefault)),0),this.typeDefault=i}return this.map?this.defaultValue=o.emptyObject:this.repeated?this.defaultValue=o.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof t&&(this.parent.ctor.prototype[this.name]=this.defaultValue),e.prototype.resolve.call(this)},s.d=function(e,t,r,n){return"function"==typeof t?t=o.decorateType(t).name:t&&"object"==typeof t&&(t=o.decorateEnum(t).name),function(i,a){o.decorateType(i.constructor).add(new s(a,e,t,r,{default:n}))}},s._configure=function(e){t=e},Ri}function Hi(){if(Ai)return Ni;Ai=1,Ni=n;var e=ws();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=qi(),r=Cs();function n(t,r,n,o){if(Array.isArray(r)||(n=r,r=void 0),e.call(this,t,n),void 0!==r&&!Array.isArray(r))throw TypeError("fieldNames must be an Array");this.oneof=r||[],this.fieldsArray=[],this.comment=o}function o(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}return n.fromJSON=function(e,t){return new n(e,t.oneof,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},n.prototype.add=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,o(this),this},n.prototype.remove=function(e){if(!(e instanceof t))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),(r=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(r,1),e.partOf=null,this},n.prototype.onAdd=function(t){e.prototype.onAdd.call(this,t);for(var r=0;r<this.oneof.length;++r){var n=t.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=this,this.fieldsArray.push(n))}o(this)},n.prototype.onRemove=function(t){for(var r,n=0;n<this.fieldsArray.length;++n)(r=this.fieldsArray[n]).parent&&r.parent.remove(r);e.prototype.onRemove.call(this,t)},n.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,o){r.decorateType(t.constructor).add(new n(o,e)),Object.defineProperty(t,o,{get:r.oneOfGetter(e),set:r.oneOfSetter(e)})}},Ni}function zi(){if(Mi)return Li;Mi=1,Li=c;var e=ws();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=qi(),i=Cs(),s=Hi();function a(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function c(t,r){e.call(this,t,r),this.nested=void 0,this._nestedArray=null}function l(e){return e._nestedArray=null,e}return c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=a,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=i.toArray(this.nested))}}),c.prototype.toJSON=function(e){return i.toObject(["options",this.options,"nested",a(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var i,s=Object.keys(e),a=0;a<s.length;++a)i=e[s[a]],this.add((void 0!==i.fields?t.fromJSON:void 0!==i.values?n.fromJSON:void 0!==i.methods?r.fromJSON:void 0!==i.id?o.fromJSON:c.fromJSON)(s[a],i));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof n)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof o&&void 0!==e.extend||e instanceof t||e instanceof s||e instanceof n||e instanceof r||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var i=this.get(e.name);if(i){if(!(i instanceof c&&e instanceof c)||i instanceof t||i instanceof r)throw Error("duplicate name '"+e.name+"' in "+this);for(var a=i.nestedArray,u=0;u<a.length;++u)e.add(a[u]);this.remove(i),this.nested||(this.nested={}),e.setOptions(i.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),l(this)},c.prototype.remove=function(t){if(!(t instanceof e))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),l(this)},c.prototype.define=function(e,t){if(i.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(n))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),i.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof c&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof c&&(n=this._nestedArray[o].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var r=this.lookup(e,[t]);if(!r)throw Error("no such type: "+e);return r},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[t,n]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r},c.prototype.lookupService=function(e){var t=this.lookup(e,[r]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,o,i){t=e,r=o,n=i},Li}function Ki(){if(xi)return Di;xi=1,Di=n;var e=qi();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=Gi(),r=Cs();function n(t,n,o,i,s,a){if(e.call(this,t,n,i,void 0,void 0,s,a),!r.isString(o))throw TypeError("keyType must be a string");this.keyType=o,this.resolvedKeyType=null,this.map=!0}return n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===t.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return e.prototype.resolve.call(this)},n.d=function(e,t,o){return"function"==typeof o?o=r.decorateType(o).name:o&&"object"==typeof o&&(o=r.decorateEnum(o).name),function(i,s){r.decorateType(i.constructor).add(new n(s,e,t,o))}},Di}function Vi(){if(Ui)return Bi;Ui=1,Bi=r;var e=ws();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=Cs();function r(r,n,o,i,s,a,c,l,u){if(t.isObject(s)?(c=s,s=a=void 0):t.isObject(a)&&(c=a,a=void 0),void 0!==n&&!t.isString(n))throw TypeError("type must be a string");if(!t.isString(o))throw TypeError("requestType must be a string");if(!t.isString(i))throw TypeError("responseType must be a string");e.call(this,r,c),this.type=n||"rpc",this.requestType=o,this.requestStream=!!s||void 0,this.responseType=i,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}return r.fromJSON=function(e,t){return new r(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},r.prototype.toJSON=function(e){var r=!!e&&Boolean(e.keepComments);return t.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])},r.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),e.prototype.resolve.call(this))},Bi}function Wi(){if(Pi)return ji;Pi=1,ji=o;var e=zi();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=Vi(),r=Cs(),n=Ur;function o(t,r){e.call(this,t,r),this.methods={},this._methodsArray=null}function i(e){return e._methodsArray=null,e}return o.fromJSON=function(e,r){var n=new o(e,r.options);if(r.methods)for(var i=Object.keys(r.methods),s=0;s<i.length;++s)n.add(t.fromJSON(i[s],r.methods[i[s]]));return r.nested&&n.addJSON(r.nested),n.comment=r.comment,n},o.prototype.toJSON=function(t){var n=e.prototype.toJSON.call(this,t),o=!!t&&Boolean(t.keepComments);return r.toObject(["options",n&&n.options||void 0,"methods",e.arrayToJSON(this.methodsArray,t)||{},"nested",n&&n.nested||void 0,"comment",o?this.comment:void 0])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=r.toArray(this.methods))}}),o.prototype.get=function(t){return this.methods[t]||e.prototype.get.call(this,t)},o.prototype.resolveAll=function(){for(var t=this.methodsArray,r=0;r<t.length;++r)t[r].resolve();return e.prototype.resolve.call(this)},o.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof t?(this.methods[r.name]=r,r.parent=this,i(this)):e.prototype.add.call(this,r)},o.prototype.remove=function(r){if(r instanceof t){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,i(this)}return e.prototype.remove.call(this,r)},o.prototype.create=function(e,t,o){for(var i,s=new n.Service(e,t,o),a=0;a<this.methodsArray.length;++a){var c=r.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");s[c]=r.codegen(["r","c"],r.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return s},ji}var $i,Ji,Zi,Xi,Yi=es,Qi=Yt();function es(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}function ts(){if(Ji)return $i;Ji=1,$i=function(o){var i=r.codegen(["r","l"],o.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(o.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");o.group&&i("if((t&7)===4)")("break");i("switch(t>>>3){");for(var s=0;s<o.fieldsArray.length;++s){var a=o._fieldsArray[s].resolve(),c=a.resolvedType instanceof e?"int32":a.type,l="m"+r.safeProp(a.name);i("case %i: {",a.id),a.map?(i("if(%s===util.emptyObject)",l)("%s={}",l)("var c2 = r.uint32()+r.pos"),void 0!==t.defaults[a.keyType]?i("k=%j",t.defaults[a.keyType]):i("k=null"),void 0!==t.defaults[c]?i("value=%j",t.defaults[c]):i("value=null"),i("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===t.basic[c]?i("value=types[%i].decode(r,r.uint32())",s):i("value=r.%s()",c),i("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==t.long[a.keyType]?i('%s[typeof k==="object"?util.longToHash(k):k]=value',l):i("%s[k]=value",l)):a.repeated?(i("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==t.packed[c]&&i("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",l,c)("}else"),void 0===t.basic[c]?i(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",l,s):i("%s.push(r.%s())",l,c)):void 0===t.basic[c]?i(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",l,s):i("%s=r.%s()",l,c),i("break")("}")}for(i("default:")("r.skipType(t&7)")("break")("}")("}"),s=0;s<o._fieldsArray.length;++s){var u=o._fieldsArray[s];u.required&&i("if(!m.hasOwnProperty(%j))",u.name)("throw util.ProtocolError(%j,{instance:m})",n(u))}return i("return m")};var e=Es(),t=Gi(),r=Cs();function n(e){return"missing required '"+e.name+"'"}return $i}function rs(){if(Xi)return Zi;Xi=1,Zi=function(e){var i=t.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),s=e.oneofsArray,a={};s.length&&i("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var l=e._fieldsArray[c].resolve(),u="m"+t.safeProp(l.name);if(l.optional&&i("if(%s!=null&&m.hasOwnProperty(%j)){",u,l.name),l.map)i("if(!util.isObject(%s))",u)("return%j",r(l,"object"))("var k=Object.keys(%s)",u)("for(var i=0;i<k.length;++i){"),o(i,l,"k[i]"),n(i,l,c,u+"[k[i]]")("}");else if(l.repeated)i("if(!Array.isArray(%s))",u)("return%j",r(l,"array"))("for(var i=0;i<%s.length;++i){",u),n(i,l,c,u+"[i]")("}");else{if(l.partOf){var d=t.safeProp(l.partOf.name);1===a[l.partOf.name]&&i("if(p%s===1)",d)("return%j",l.partOf.name+": multiple values"),a[l.partOf.name]=1,i("p%s=1",d)}n(i,l,c,u)}l.optional&&i("}")}return i("return null")};var e=Es(),t=Cs();function r(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function n(t,n,o,i){if(n.resolvedType)if(n.resolvedType instanceof e){t("switch(%s){",i)("default:")("return%j",r(n,"enum value"));for(var s=Object.keys(n.resolvedType.values),a=0;a<s.length;++a)t("case %i:",n.resolvedType.values[s[a]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s);",o,i)("if(e)")("return%j+e",n.name+".")("}");else switch(n.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",i)("return%j",r(n,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",r(n,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',i)("return%j",r(n,"number"));break;case"bool":t('if(typeof %s!=="boolean")',i)("return%j",r(n,"boolean"));break;case"string":t("if(!util.isString(%s))",i)("return%j",r(n,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",r(n,"buffer"))}return t}function o(e,t,n){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",n)("return%j",r(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",n)("return%j",r(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",n)("return%j",r(t,"boolean key"))}return e}return Zi}es.create=function(e){return this.$type.create(e)},es.encode=function(e,t){return this.$type.encode(e,t)},es.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},es.decode=function(e){return this.$type.decode(e)},es.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},es.verify=function(e){return this.$type.verify(e)},es.fromObject=function(e){return this.$type.fromObject(e)},es.toObject=function(e,t){return this.$type.toObject(e,t)},es.prototype.toJSON=function(){return this.$type.toObject(this,Qi.toJSONOptions)};var ns,os={};function is(){return ns||(ns=1,function(e){var t=e,r=Es(),n=Cs();function o(e,t,n,o){var i=!1;if(t.resolvedType)if(t.resolvedType instanceof r){e("switch(d%s){",o);for(var s=t.resolvedType.values,a=Object.keys(s),c=0;c<a.length;++c)s[a[c]]!==t.typeDefault||i||(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',o,o,o),t.repeated||e("break"),i=!0),e("case%j:",a[c])("case %i:",s[a[c]])("m%s=%j",o,s[a[c]])("break");e("}")}else e('if(typeof d%s!=="object")',o)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",o,n,o);else{var l=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",o,o);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",o,o);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",o,o);break;case"uint64":l=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,l)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,l?"true":"");break;case"bytes":e('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length >= 0)",o)("m%s=d%s",o,o);break;case"string":e("m%s=String(d%s)",o,o);break;case"bool":e("m%s=Boolean(d%s)",o,o)}}return e}function i(e,t,n,o){if(t.resolvedType)t.resolvedType instanceof r?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",o,n,o,o,n,o,o):e("d%s=types[%i].toObject(m%s,o)",o,n,o);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",o,o,o,o,i?"true":"",o);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",o,o,o,o,o);break;default:e("d%s=m%s",o,o)}}return e}t.fromObject=function(e){var t=e.fieldsArray,i=n.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return i("return new this.ctor");i("var m=new this.ctor");for(var s=0;s<t.length;++s){var a=t[s].resolve(),c=n.safeProp(a.name);a.map?(i("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(i,a,s,c+"[ks[i]]")("}")("}")):a.repeated?(i("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(i,a,s,c+"[i]")("}")("}")):(a.resolvedType instanceof r||i("if(d%s!=null){",c),o(i,a,s,c),a.resolvedType instanceof r||i("}"))}return i("return m")},t.toObject=function(e){var t=e.fieldsArray.slice().sort(n.compareFieldsById);if(!t.length)return n.codegen()("return {}");for(var o=n.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),s=[],a=[],c=[],l=0;l<t.length;++l)t[l].partOf||(t[l].resolve().repeated?s:t[l].map?a:c).push(t[l]);if(s.length){for(o("if(o.arrays||o.defaults){"),l=0;l<s.length;++l)o("d%s=[]",n.safeProp(s[l].name));o("}")}if(a.length){for(o("if(o.objects||o.defaults){"),l=0;l<a.length;++l)o("d%s={}",n.safeProp(a[l].name));o("}")}if(c.length){for(o("if(o.defaults){"),l=0;l<c.length;++l){var u=c[l],d=n.safeProp(u.name);if(u.resolvedType instanceof r)o("d%s=o.enums===String?%j:%j",d,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)o("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",d)("}else")("d%s=o.longs===String?%j:%i",d,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var h="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";o("if(o.bytes===String)d%s=%j",d,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",d,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",d,d)("}")}else o("d%s=%j",d,u.typeDefault)}o("}")}var f=!1;for(l=0;l<t.length;++l){u=t[l];var p=e._fieldsArray.indexOf(u);d=n.safeProp(u.name);u.map?(f||(f=!0,o("var ks2")),o("if(m%s&&(ks2=Object.keys(m%s)).length){",d,d)("d%s={}",d)("for(var j=0;j<ks2.length;++j){"),i(o,u,p,d+"[ks2[j]]")("}")):u.repeated?(o("if(m%s&&m%s.length){",d,d)("d%s=[]",d)("for(var j=0;j<m%s.length;++j){",d),i(o,u,p,d+"[j]")("}")):(o("if(m%s!=null&&m.hasOwnProperty(%j)){",d,u.name),i(o,u,p,d),u.partOf&&o("if(o.oneofs)")("d%s=%j",n.safeProp(u.partOf.name),u.name)),o("}")}return o("return d")}}(os)),os}var ss,as,cs,ls,us,ds,hs,fs,ps,gs,ys,vs={};function ms(){if(as)return ss;as=1,ss=g;var e=zi();((g.prototype=Object.create(e.prototype)).constructor=g).className="Type";var t=Es(),r=Hi(),n=qi(),o=Ki(),i=Wi(),s=Yi,a=wr,c=er,l=Cs(),u=Ss(),d=ts(),h=rs(),f=is(),p=vs;function g(t,r){e.call(this,t,r),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function y(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}return Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=l.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=l.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=g.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof s||((e.prototype=new s).constructor=e,l.merge(e.prototype,t)),e.$type=e.prototype.$type=this,l.merge(e,s,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:l.oneOfGetter(this._oneofsArray[r].oneof),set:l.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),g.generateConstructor=function(e){for(var t,r=l.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",l.safeProp(t.name)):t.repeated&&r("this%s=[]",l.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},g.fromJSON=function(s,a){var c=new g(s,a.options);c.extensions=a.extensions,c.reserved=a.reserved;for(var l=Object.keys(a.fields),u=0;u<l.length;++u)c.add((void 0!==a.fields[l[u]].keyType?o.fromJSON:n.fromJSON)(l[u],a.fields[l[u]]));if(a.oneofs)for(l=Object.keys(a.oneofs),u=0;u<l.length;++u)c.add(r.fromJSON(l[u],a.oneofs[l[u]]));if(a.nested)for(l=Object.keys(a.nested),u=0;u<l.length;++u){var d=a.nested[l[u]];c.add((void 0!==d.id?n.fromJSON:void 0!==d.fields?g.fromJSON:void 0!==d.values?t.fromJSON:void 0!==d.methods?i.fromJSON:e.fromJSON)(l[u],d))}return a.extensions&&a.extensions.length&&(c.extensions=a.extensions),a.reserved&&a.reserved.length&&(c.reserved=a.reserved),a.group&&(c.group=!0),a.comment&&(c.comment=a.comment),c},g.prototype.toJSON=function(t){var r=e.prototype.toJSON.call(this,t),n=!!t&&Boolean(t.keepComments);return l.toObject(["options",r&&r.options||void 0,"oneofs",e.arrayToJSON(this.oneofsArray,t),"fields",e.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),t)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])},g.prototype.resolveAll=function(){for(var t=this.fieldsArray,r=0;r<t.length;)t[r++].resolve();var n=this.oneofsArray;for(r=0;r<n.length;)n[r++].resolve();return e.prototype.resolveAll.call(this)},g.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},g.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);if(t instanceof n&&void 0===t.extend){if(this._fieldsById?this._fieldsById[t.id]:this.fieldsById[t.id])throw Error("duplicate id "+t.id+" in "+this);if(this.isReservedId(t.id))throw Error("id "+t.id+" is reserved in "+this);if(this.isReservedName(t.name))throw Error("name '"+t.name+"' is reserved in "+this);return t.parent&&t.parent.remove(t),this.fields[t.name]=t,t.message=this,t.onAdd(this),y(this)}return t instanceof r?(this.oneofs||(this.oneofs={}),this.oneofs[t.name]=t,t.onAdd(this),y(this)):e.prototype.add.call(this,t)},g.prototype.remove=function(t){if(t instanceof n&&void 0===t.extend){if(!this.fields||this.fields[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.fields[t.name],t.parent=null,t.onRemove(this),y(this)}if(t instanceof r){if(!this.oneofs||this.oneofs[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.oneofs[t.name],t.parent=null,t.onRemove(this),y(this)}return e.prototype.remove.call(this,t)},g.prototype.isReservedId=function(t){return e.isReservedId(this.reserved,t)},g.prototype.isReservedName=function(t){return e.isReservedName(this.reserved,t)},g.prototype.create=function(e){return new this.ctor(e)},g.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=u(this)({Writer:c,types:t,util:l}),this.decode=d(this)({Reader:a,types:t,util:l}),this.verify=h(this)({types:t,util:l}),this.fromObject=f.fromObject(this)({types:t,util:l}),this.toObject=f.toObject(this)({types:t,util:l});var n=p[e];if(n){var o=Object.create(this);o.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(o),o.toObject=this.toObject,this.toObject=n.toObject.bind(o)}return this},g.prototype.encode=function(e,t){return this.setup().encode(e,t)},g.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},g.prototype.decode=function(e,t){return this.setup().decode(e,t)},g.prototype.decodeDelimited=function(e){return e instanceof a||(e=a.create(e)),this.decode(e,e.uint32())},g.prototype.verify=function(e){return this.setup().verify(e)},g.prototype.fromObject=function(e){return this.setup().fromObject(e)},g.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},g.d=function(e){return function(t){l.decorateType(t,e)}},ss}function bs(){if(ls)return cs;ls=1,cs=c;var e=zi();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=qi(),i=Es(),s=Hi(),a=Cs();function c(t){e.call(this,"",t),this.deferred=[],this.files=[]}function l(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=a.path.resolve,c.prototype.fetch=a.fetch,c.prototype.load=function e(t,o,i){"function"==typeof o&&(i=o,o=void 0);var s=this;if(!i)return a.asPromise(e,s,t,o);var c=i===l;function u(e,t){if(i){var r=i;if(i=null,c)throw e;r(e,t)}}function d(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in n)return r}return null}function h(e,t){try{if(a.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),a.isString(t)){r.filename=e;var n,i=r(t,s,o),l=0;if(i.imports)for(;l<i.imports.length;++l)(n=d(i.imports[l])||s.resolvePath(e,i.imports[l]))&&f(n);if(i.weakImports)for(l=0;l<i.weakImports.length;++l)(n=d(i.weakImports[l])||s.resolvePath(e,i.weakImports[l]))&&f(n,!0)}else s.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}c||p||u(null,s)}function f(e,t){if(e=d(e)||e,!(s.files.indexOf(e)>-1))if(s.files.push(e),e in n)c?h(e,n[e]):(++p,setTimeout((function(){--p,h(e,n[e])})));else if(c){var r;try{r=a.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||u(e))}h(e,r)}else++p,s.fetch(e,(function(r,n){--p,i&&(r?t?p||u(null,s):u(r):h(e,n))}))}var p=0;a.isString(t)&&(t=[t]);for(var g,y=0;y<t.length;++y)(g=s.resolvePath("",t[y]))&&f(g);if(c)return s;p||u(null,s)},c.prototype.loadSync=function(e,t){if(!a.isNode)throw Error("not supported");return this.load(e,t,l)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return e.prototype.resolveAll.call(this)};var u=/^[A-Z]/;function d(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new o(t.fullName,t.id,t.type,t.rule,void 0,t.options);return r.get(n.name)||(n.declaringField=t,t.extensionField=n,r.add(n)),!0}return!1}return c.prototype._handleAdd=function(e){if(e instanceof o)void 0===e.extend||e.extensionField||d(0,e)||this.deferred.push(e);else if(e instanceof i)u.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof s)){if(e instanceof t)for(var r=0;r<this.deferred.length;)d(0,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);u.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(t){if(t instanceof o){if(void 0!==t.extend)if(t.extensionField)t.extensionField.parent.remove(t.extensionField),t.extensionField=null;else{var r=this.deferred.indexOf(t);r>-1&&this.deferred.splice(r,1)}}else if(t instanceof i)u.test(t.name)&&delete t.parent[t.name];else if(t instanceof e){for(var n=0;n<t.nestedArray.length;++n)this._handleRemove(t._nestedArray[n]);u.test(t.name)&&delete t.parent[t.name]}},c._configure=function(e,o,i){t=e,r=o,n=i},cs}function Cs(){return us||(us=1,function(e){var t,r,n=e.exports=Yt(),o=Gr;n.codegen=Ci,n.fetch=Ei,n.path=Ii,n.fs=n.inquire("fs"),n.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},n.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],o=e[r++];void 0!==o&&(t[n]=o)}return t};var i=/\\/g,s=/"/g;n.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},n.safeProp=function(e){return!/^[$\w_]+$/.test(e)||n.isReserved(e)?'["'+e.replace(i,"\\\\").replace(s,'\\"')+'"]':"."+e},n.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var a=/_([a-z])/g;n.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(a,(function(e,t){return t.toUpperCase()}))},n.compareFieldsById=function(e,t){return e.id-t.id},n.decorateType=function(e,r){if(e.$type)return r&&e.$type.name!==r&&(n.decorateRoot.remove(e.$type),e.$type.name=r,n.decorateRoot.add(e.$type)),e.$type;t||(t=ms());var o=new t(r||e.name);return n.decorateRoot.add(o),o.ctor=e,Object.defineProperty(e,"$type",{value:o,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:o,enumerable:!1}),o};var c=0;n.decorateEnum=function(e){if(e.$type)return e.$type;r||(r=Es());var t=new r("Enum"+c++,e);return n.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},n.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var o=r.shift();if("__proto__"===o)return t;if(r.length>0)t[o]=e(t[o]||{},r,n);else{var i=t[o];i&&(n=[].concat(i).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(n,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(bs()))}})}(bi)),bi.exports}function ws(){if(hs)return ds;hs=1,ds=r,r.className="ReflectionObject";var e,t=Cs();function r(e,r){if(!t.isString(e))throw TypeError("name must be a string");if(r&&!t.isObject(r))throw TypeError("options must be an object");this.options=r,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(r.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),r.prototype.toJSON=function(){throw Error()},r.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var r=t.root;r instanceof e&&r._handleAdd(this)},r.prototype.onRemove=function(t){var r=t.root;r instanceof e&&r._handleRemove(this),this.parent=null,this.resolved=!1},r.prototype.resolve=function(){return this.resolved||this.root instanceof e&&(this.resolved=!0),this},r.prototype.getOption=function(e){if(this.options)return this.options[e]},r.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},r.prototype.setParsedOption=function(e,r,n){this.parsedOptions||(this.parsedOptions=[]);var o=this.parsedOptions;if(n){var i=o.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(i){var s=i[e];t.setProperty(s,n,r)}else(i={})[e]=t.setProperty({},n,r),o.push(i)}else{var a={};a[e]=r,o.push(a)}return this},r.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},r.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},r._configure=function(t){e=t},ds}function Es(){if(ps)return fs;ps=1,fs=n;var e=ws();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=zi(),r=Cs();function n(t,r,n,o,i,s){if(e.call(this,t,n),r&&"object"!=typeof r)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.valuesOptions=s,this.reserved=void 0,r)for(var a=Object.keys(r),c=0;c<a.length;++c)"number"==typeof r[a[c]]&&(this.valuesById[this.values[a[c]]=r[a[c]]]=a[c])}return n.fromJSON=function(e,t){var r=new n(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return r.toObject(["options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},n.prototype.add=function(e,t,n,o){if(!r.isString(e))throw TypeError("name must be a string");if(!r.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return o&&(void 0===this.valuesOptions&&(this.valuesOptions={}),this.valuesOptions[e]=o||null),this.comments[e]=n||null,this},n.prototype.remove=function(e){if(!r.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this},n.prototype.isReservedId=function(e){return t.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return t.isReservedName(this.reserved,e)},fs}function Ss(){if(ys)return gs;ys=1,gs=function(o){for(var i,s=r.codegen(["m","w"],o.name+"$encode")("if(!w)")("w=Writer.create()"),a=o.fieldsArray.slice().sort(r.compareFieldsById),c=0;c<a.length;++c){var l=a[c].resolve(),u=o._fieldsArray.indexOf(l),d=l.resolvedType instanceof e?"int32":l.type,h=t.basic[d];i="m"+r.safeProp(l.name),l.map?(s("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",i,l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",i)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(l.id<<3|2)>>>0,8|t.mapKey[l.keyType],l.keyType),void 0===h?s("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,i):s(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,d,i),s("}")("}")):l.repeated?(s("if(%s!=null&&%s.length){",i,i),l.packed&&void 0!==t.packed[d]?s("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",d,i)("w.ldelim()"):(s("for(var i=0;i<%s.length;++i)",i),void 0===h?n(s,l,u,i+"[i]"):s("w.uint32(%i).%s(%s[i])",(l.id<<3|h)>>>0,d,i)),s("}")):(l.optional&&s("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,l.name),void 0===h?n(s,l,u,i):s("w.uint32(%i).%s(%s)",(l.id<<3|h)>>>0,d,i))}return s("return w")};var e=Es(),t=Gi(),r=Cs();function n(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}return gs}!function(e){var t=Yi;e[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,r){var n="",o="";if(r&&r.json&&e.type_url&&e.value){o=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var i=this.lookup(o);i&&(e=i.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof t){var s=e.$type.toObject(e,r);return""===n&&(n="type.googleapis.com/"),o=n+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=o,s}return this.toObject(e,r)}}}(vs),function(e){var t=e.exports=Dt;t.build="light",t.load=function(e,r,n){return"function"==typeof r?(n=r,r=new t.Root):r||(r=new t.Root),r.load(e,n)},t.loadSync=function(e,r){return r||(r=new t.Root),r.loadSync(e)},t.encoder=Ss(),t.decoder=ts(),t.verifier=rs(),t.converter=is(),t.ReflectionObject=ws(),t.Namespace=zi(),t.Root=bs(),t.Enum=Es(),t.Type=ms(),t.Field=qi(),t.OneOf=Hi(),t.MapField=Ki(),t.Service=Wi(),t.Method=Vi(),t.Message=Yi,t.wrappers=vs,t.types=Gi(),t.util=Cs(),t.ReflectionObject._configure(t.Root),t.Namespace._configure(t.Type,t.Service,t.Enum),t.Root._configure(t.Type),t.Field._configure(t.Type)}(mi);var Os=xs,_s=/[\s{}=;:[\],'"()<>]/g,Is=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,Ts=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Rs=/^ *[*/]+ */,ks=/^\s*\*?\/*/,Ns=/\n/g,As=/\s/,Ls=/\\(.?)/g,Ms={0:"\0",r:"\r",n:"\n",t:"\t"};function Ds(e){return e.replace(Ls,(function(e,t){switch(t){case"\\":case"":return t;default:return Ms[t]||""}}))}function xs(e,t){e=e.toString();var r=0,n=e.length,o=1,i=0,s={},a=[],c=null;function l(e){return Error("illegal "+e+" (line "+o+")")}function u(t){return e.charAt(t)}function d(r,n,a){var c,l={type:e.charAt(r++),lineEmpty:!1,leading:a},u=r-(t?2:3);do{if(--u<0||"\n"===(c=e.charAt(u))){l.lineEmpty=!0;break}}while(" "===c||"\t"===c);for(var d=e.substring(r,n).split(Ns),h=0;h<d.length;++h)d[h]=d[h].replace(t?ks:Rs,"").trim();l.text=d.join("\n").trim(),s[o]=l,i=o}function h(t){var r=f(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function f(e){for(var t=e;t<n&&"\n"!==u(t);)t++;return t}function p(){if(a.length>0)return a.shift();if(c)return function(){var t="'"===c?Ts:Is;t.lastIndex=r-1;var n=t.exec(e);if(!n)throw l("string");return r=t.lastIndex,g(c),c=null,Ds(n[1])}();var i,s,p,y,v,m=0===r;do{if(r===n)return null;for(i=!1;As.test(p=u(r));)if("\n"===p&&(m=!0,++o),++r===n)return null;if("/"===u(r)){if(++r===n)throw l("comment");if("/"===u(r))if(t){if(y=r,v=!1,h(r)){v=!0;do{if((r=f(r))===n)break;if(r++,!m)break}while(h(r))}else r=Math.min(n,f(r)+1);v&&(d(y,r,m),m=!0),o++,i=!0}else{for(v="/"===u(y=r+1);"\n"!==u(++r);)if(r===n)return null;++r,v&&(d(y,r-1,m),m=!0),++o,i=!0}else{if("*"!==(p=u(r)))return"/";y=r+1,v=t||"*"===u(y);do{if("\n"===p&&++o,++r===n)throw l("comment");s=p,p=u(r)}while("*"!==s||"/"!==p);++r,v&&(d(y,r-2,m),m=!0),i=!0}}}while(i);var b=r;if(_s.lastIndex=0,!_s.test(u(b++)))for(;b<n&&!_s.test(u(b));)++b;var C=e.substring(r,r=b);return'"'!==C&&"'"!==C||(c=C),C}function g(e){a.push(e)}function y(){if(!a.length){var e=p();if(null===e)return null;g(e)}return a[0]}return Object.defineProperty({next:p,peek:y,push:g,skip:function(e,t){var r=y();if(r===e)return p(),!0;if(!t)throw l("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var r,n=null;return void 0===e?(r=s[o-1],delete s[o-1],r&&(t||"*"===r.type||r.lineEmpty)&&(n=r.leading?r.text:null)):(i<e&&y(),r=s[e],delete s[e],!r||r.lineEmpty||!t&&"/"!==r.type||(n=r.leading?null:r.text)),n}},"line",{get:function(){return o}})}xs.unescape=Ds;var Bs=oa;oa.filename=null,oa.defaults={keepCase:!1};var Us=Os,js=bs(),Ps=ms(),Fs=qi(),Gs=Ki(),qs=Hi(),Hs=Es(),zs=Wi(),Ks=Vi(),Vs=Gi(),Ws=Cs(),$s=/^[1-9][0-9]*$/,Js=/^-?[1-9][0-9]*$/,Zs=/^0[x][0-9a-fA-F]+$/,Xs=/^-?0[x][0-9a-fA-F]+$/,Ys=/^0[0-7]+$/,Qs=/^-?0[0-7]+$/,ea=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,ta=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ra=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,na=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function oa(e,t,r){t instanceof js||(r=t,t=new js),r||(r=oa.defaults);var n,o,i,s,a,c=r.preferTrailingComment||!1,l=Us(e,r.alternateCommentMode||!1),u=l.next,d=l.push,h=l.peek,f=l.skip,p=l.cmnt,g=!0,y=!1,v=t,m=r.keepCase?function(e){return e}:Ws.camelCase;function b(e,t,r){var n=oa.filename;return r||(oa.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+l.line+")")}function C(){var e,t=[];do{if('"'!==(e=u())&&"'"!==e)throw b(e);t.push(u()),f(e),e=h()}while('"'===e||"'"===e);return t.join("")}function w(e){var t=u();switch(t){case"'":case'"':return d(t),C();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if($s.test(e))return r*parseInt(e,10);if(Zs.test(e))return r*parseInt(e,16);if(Ys.test(e))return r*parseInt(e,8);if(ea.test(e))return r*parseFloat(e);throw b(e,"number",t)}(t,!0)}catch(r){if(e&&ra.test(t))return t;throw b(t,"value")}}function E(e,t){var r,n;do{!t||'"'!==(r=h())&&"'"!==r?e.push([n=S(u()),f("to",!0)?S(u()):n]):e.push(C())}while(f(",",!0));f(";")}function S(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw b(e,"id");if(Js.test(e))return parseInt(e,10);if(Xs.test(e))return parseInt(e,16);if(Qs.test(e))return parseInt(e,8);throw b(e,"id")}function O(){if(void 0!==n)throw b("package");if(n=u(),!ra.test(n))throw b(n,"name");v=v.define(n),f(";")}function _(){var e,t=h();switch(t){case"weak":e=i||(i=[]),u();break;case"public":u();default:e=o||(o=[])}t=C(),f(";"),e.push(t)}function I(){if(f("="),s=C(),!(y="proto3"===s)&&"proto2"!==s)throw b(s,"syntax");f(";")}function T(e,t){switch(t){case"option":return L(e,t),f(";"),!0;case"message":return k(e,t),!0;case"enum":return A(e,t),!0;case"service":return function(e,t){if(!ta.test(t=u()))throw b(t,"service name");var r=new zs(t);R(r,(function(e){if(!T(r,e)){if("rpc"!==e)throw b(e);!function(e,t){var r=p(),n=t;if(!ta.test(t=u()))throw b(t,"name");var o,i,s,a,c=t;f("("),f("stream",!0)&&(i=!0);if(!ra.test(t=u()))throw b(t);o=t,f(")"),f("returns"),f("("),f("stream",!0)&&(a=!0);if(!ra.test(t=u()))throw b(t);s=t,f(")");var l=new Ks(c,n,o,s,i,a);l.comment=r,R(l,(function(e){if("option"!==e)throw b(e);L(l,e),f(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!ra.test(t=u()))throw b(t,"reference");var r=t;R(null,(function(t){switch(t){case"required":case"repeated":N(e,t,r);break;case"optional":N(e,y?"proto3_optional":"optional",r);break;default:if(!y||!ra.test(t))throw b(t);d(t),N(e,"optional",r)}}))}(e,t),!0}return!1}function R(e,t,r){var n=l.line;if(e&&("string"!=typeof e.comment&&(e.comment=p()),e.filename=oa.filename),f("{",!0)){for(var o;"}"!==(o=u());)t(o);f(";",!0)}else r&&r(),f(";"),e&&("string"!=typeof e.comment||c)&&(e.comment=p(n)||e.comment)}function k(e,t){if(!ta.test(t=u()))throw b(t,"type name");var r=new Ps(t);R(r,(function(e){if(!T(r,e))switch(e){case"map":!function(e){f("<");var t=u();if(void 0===Vs.mapKey[t])throw b(t,"type");f(",");var r=u();if(!ra.test(r))throw b(r,"type");f(">");var n=u();if(!ta.test(n))throw b(n,"name");f("=");var o=new Gs(m(n),S(u()),t,r);R(o,(function(e){if("option"!==e)throw b(e);L(o,e),f(";")}),(function(){x(o)})),e.add(o)}(r);break;case"required":case"repeated":N(r,e);break;case"optional":N(r,y?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!ta.test(t=u()))throw b(t,"name");var r=new qs(m(t));R(r,(function(e){"option"===e?(L(r,e),f(";")):(d(e),N(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":E(r.extensions||(r.extensions=[]));break;case"reserved":E(r.reserved||(r.reserved=[]),!0);break;default:if(!y||!ra.test(e))throw b(e);d(e),N(r,"optional")}})),e.add(r)}function N(e,t,r){var n=u();if("group"!==n){if(!ra.test(n))throw b(n,"type");var o=u();if(!ta.test(o))throw b(o,"name");o=m(o),f("=");var i=new Fs(o,S(u()),n,t,r);if(R(i,(function(e){if("option"!==e)throw b(e);L(i,e),f(";")}),(function(){x(i)})),"proto3_optional"===t){var s=new qs("_"+o);i.setOption("proto3_optional",!0),s.add(i),e.add(s)}else e.add(i);y||!i.repeated||void 0===Vs.packed[n]&&void 0!==Vs.basic[n]||i.setOption("packed",!1,!0)}else!function(e,t){var r=u();if(!ta.test(r))throw b(r,"name");var n=Ws.lcFirst(r);r===n&&(r=Ws.ucFirst(r));f("=");var o=S(u()),i=new Ps(r);i.group=!0;var s=new Fs(n,o,r,t);s.filename=oa.filename,R(i,(function(e){switch(e){case"option":L(i,e),f(";");break;case"required":case"repeated":N(i,e);break;case"optional":N(i,y?"proto3_optional":"optional");break;case"message":k(i,e);break;case"enum":A(i,e);break;default:throw b(e)}})),e.add(i).add(s)}(e,t)}function A(e,t){if(!ta.test(t=u()))throw b(t,"name");var r=new Hs(t);R(r,(function(e){switch(e){case"option":L(r,e),f(";");break;case"reserved":E(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!ta.test(t))throw b(t,"name");f("=");var r=S(u(),!0),n={options:void 0,setOption:function(e,t){void 0===this.options&&(this.options={}),this.options[e]=t}};R(n,(function(e){if("option"!==e)throw b(e);L(n,e),f(";")}),(function(){x(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function L(e,t){var r=f("(",!0);if(!ra.test(t=u()))throw b(t,"name");var n,o=t,i=o;r&&(f(")"),i=o="("+o+")",t=h(),na.test(t)&&(n=t.slice(1),o+=t,u())),f("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,i,M(e,o),n)}function M(e,t){if(f("{",!0)){for(var r={};!f("}",!0);){if(!ta.test(a=u()))throw b(a,"name");var n,o=a;if(f(":",!0),"{"===h())n=M(e,t+"."+a);else if("["===h()){var i;if(n=[],f("[",!0)){do{i=w(!0),n.push(i)}while(f(",",!0));f("]"),void 0!==i&&D(e,t+"."+a,i)}}else n=w(!0),D(e,t+"."+a,n);var s=r[o];s&&(n=[].concat(s).concat(n)),r[o]=n,f(",",!0),f(";",!0)}return r}var c=w(!0);return D(e,t,c),c}function D(e,t,r){e.setOption&&e.setOption(t,r)}function x(e){if(f("[",!0)){do{L(e,"option")}while(f(",",!0));f("]")}return e}for(;null!==(a=u());)switch(a){case"package":if(!g)throw b(a);O();break;case"import":if(!g)throw b(a);_();break;case"syntax":if(!g)throw b(a);I();break;case"option":L(v,a),f(";");break;default:if(T(v,a)){g=!1;continue}throw b(a)}return oa.filename=null,{package:n,imports:o,weakImports:i,syntax:s,root:t}}var ia,sa=ca,aa=/\/|\./;function ca(e,t){aa.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),ca[e]=t}ca("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),ca("duration",{Duration:ia={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),ca("timestamp",{Timestamp:ia}),ca("empty",{Empty:{fields:{}}}),ca("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),ca("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),ca("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),ca.get=function(e){return ca[e]||null},function(e){var t=e.exports=mi.exports;t.build="full",t.tokenize=Os,t.parse=Bs,t.common=sa,t.Root._configure(t.Type,t.parse,t.common)}(vi),function(e){e.exports=vi.exports}(yi);var la=p(yi.exports);const ua=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},da=e=>{const t=e.name;return it(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},ha=e=>{(window.URL||window.webkitURL).revokeObjectURL(e)},fa=e=>{const t=e.match(/data:([^;]+)/)[1],r=e.replace(/^[^,]+,/,""),n=window.atob(r);let o=n.length;const i=new Uint8Array(n.length);for(;o--;)i[o]=n.charCodeAt(o);return new Blob([i],{type:t})};class pa{constructor(e){h(this,"options",void 0),h(this,"xhr",void 0),this.options=e}upload(e,t){const r=new XMLHttpRequest;r.upload.onprogress=e=>{var r;null===(r=t.onProgress)||void 0===r||r.call(t,e.loaded,e.total)},r.onreadystatechange=()=>{if(4===r.readyState){const o=r.responseText||"{}",i=JSON.parse(o);if(200===r.status&&200===i.code){var e;let r={url:i.url};this.options.transformer&&(r=this.options.transformer(r)),null===(e=t.onCompleted)||void 0===e||e.call(t,r)}else{var n;null===(n=t.onError)||void 0===n||n.call(t,"upload fail")}}},r.open("POST",this.options.uploadUrl,!0),r.setRequestHeader("device","7"),r.setRequestHeader("cert",this.options.cert??"");const n=da(e),o=function(){let e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))}()+(n.length?`.${n}`:""),i=new FormData;i.append("file",e),i.append("name","file"),i.append("fileName",o),i.append("token",this.options.token),r.send(i),this.xhr=r}cancel(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}const ga=1680,ya=160,va=e=>new Promise(((t,r)=>{const n=e=>{0!==e.width||0!==e.height?t(e):r()},o=new Image;if(o.addEventListener("load",(e=>n(e.target))),o.addEventListener("error",r),o.src=e,o.complete)return void n(o);const i=setInterval((()=>{o.complete&&(n(o),clearInterval(i))}),40)}));class ma{constructor(e,t){h(this,"uploadInstance",void 0),h(this,"options",void 0),this.uploadInstance=e,this.options=t}async upload(e,t){try{const r=ua(e),n=await va(r);ha(r);const{imageFile:o,compressWidth:i,compressHeight:s}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"image/jpeg";t=Math.min(1,t);const n=e.width,o=e.height;let i=n,s=o;if(t<1){const e=n<o,t=e?o/ga:n/ga;n>ga&&o>ga?e?(s=ga,i/=t):(i=ga,s/=t):n>ga&&o>ya?(i=ga,s/=t,s<ya&&(s=ya,i=n/(o/ya))):o>ga&&n>ya&&(s=ga,i/=t,i<ya&&(i=ya,s=o/(n/ya)))}i=Math.floor(i),s=Math.floor(s);const a=document.createElement("canvas");a.width=i,a.height=s;const c=a.getContext("2d");return c.fillStyle="#FFF",c.fillRect(0,0,i,s),c.drawImage(e,0,0,n,o,0,0,i,s),r&&"image/png"!=r||(r="image/jpeg"),{imageFile:fa(a.toDataURL(r,Math.min(.92,t))),compressWidth:i,compressHeight:s}}(n,.85,e.type),a=((e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d"),o=function(e,t,r){const n=e<t;let o,i,s,a=0,c=0;const l=function(){return n?(o=e/100,i=100,s=t/o,c=(s-r.maxHeight)/2):(o=t/100,s=100,i=e/o,a=(i-r.maxWidth)/2),{w:i,h:s,x:-a,y:-c}},u=function(){return n?(o=t/r.maxHeight,s=r.maxHeight,i=e/o):(o=e/r.maxWidth,i=r.maxWidth,s=t/o),{w:i,h:s,x:-a,y:-c}};return(n?t/e:e/t)>r.scale?l():u()}(e.width,e.height,t);r.width=o.w>t.maxWidth?t.maxWidth:o.w,r.height=o.h>t.maxHeight?t.maxHeight:o.h,null==n||n.drawImage(e,o.x,o.y,o.w,o.h);try{let e=r.toDataURL("image/jpeg",t.quality);const n=new RegExp("^data:image/[^;]+;base64,");return e=e.replace(n,""),e}catch(e){throw new Error(e)}})(n,{maxHeight:160,maxWidth:160,quality:.6,scale:2.4});this.uploadInstance.upload(o,{...t,onCompleted:r=>{var n;null===(n=t.onCompleted)||void 0===n||n.call(t,{url:r.url,thumbnail:a,width:i,height:s,type:e.type})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}class ba{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}async upload(e,t){if(e.size>2097152)t.onError&&t.onError("GIF_MSG_SIZE_LIMIT_EXCEED");else try{const r=ua(e),n=await va(r);ha(r),this.uploadInstance.upload(e,{...t,onCompleted:r=>{var o;null===(o=t.onCompleted)||void 0===o||o.call(t,{url:r.url,size:e.size,width:n.width,height:n.height})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}let Ca;class wa{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}upload(e,t){var r;(r=e,at(r.arrayBuffer)?r.arrayBuffer():new Promise(((e,t)=>{const n=new FileReader;n.addEventListener("load",(r=>{r.target?e(r.target.result):t("null")})),n.addEventListener("error",(e=>t(e))),n.readAsArrayBuffer(r)}))).then(this.getAudioInfo).then((r=>{this.uploadInstance.upload(e,{...t,onCompleted:n=>{var o;null===(o=t.onCompleted)||void 0===o||o.call(t,{url:n.url,type:da(e),...r})}})})).catch((()=>{var e;null===(e=t.onError)||void 0===e||e.call(t,"MEDIA_EXCEPTION")}))}cancel(){this.uploadInstance.cancel()}getAudioInfo(e){const t=Ca||new AudioContext;return Ca=t,new Promise(((r,n)=>{t.decodeAudioData(e,(function(e){r({duration:e.duration,length:e.length})}),n)}))}}class Ea{constructor(e){h(this,"uploadInstance",void 0),this.uploadInstance=e}upload(e,t){if(e.size>104857600)t.onError&&t.onError("FILE_MSG_SIZE_LIMIT_EXCEED");else try{this.uploadInstance.upload(e,{...t,onCompleted:r=>{var n;null===(n=t.onCompleted)||void 0===n||n.call(t,{url:r.url,name:e.name,type:da(e),size:e.size})}})}catch(e){var r;null===(r=t.onError)||void 0===r||r.call(t,"MEDIA_EXCEPTION")}}cancel(){this.uploadInstance.cancel()}}var Sa;!function(e){e[e.IMAGE=1]="IMAGE",e[e.GIF=2]="GIF",e[e.AUDIO=3]="AUDIO",e[e.VIDEO=4]="VIDEO",e[e.FILE=5]="FILE",e[e.SIGHT=6]="SIGHT"}(Sa||(Sa={}));const Oa=(t,r,n,o,i,s)=>({conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId,senderUserId:r,messageDirection:e.MessageDirection.SEND,isCounted:n.isCounted,isMentioned:!1,content:n.content,messageType:n.messageType,isOffLineMessage:!1,isPersited:n.isPersited,messageId:o,messageUId:i,sentTime:s,receivedTime:0,isStatusMessage:n.isStatusMessage,receivedStatus:e.ReceivedStatus.UNREAD,disableNotification:!1});let _a=0;const Ia=[Lo,No];async function Ta(t,r,n){var o;if(!gi.loader||gi.loader.getConnectionStatus()!==e.ConnectionStatus.CONNECTED)return{code:e.ErrorCode.RC_NET_CHANNEL_INVALID};n=n||{};const i=JSON.stringify(lt(r.encode()));if(function(e){let t=0;if("utf-16"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf-8"))for(let r=0,n=e.length;r<n;r++)t+=e.charCodeAt(r)<=65535?2:4;else for(let r=0,n=e.length;r<n;r++){const n=e.charCodeAt(r);t+=n<127?1:n<=2047?2:n<=65535?3:4}return t}(i)>81920)return{code:e.ErrorCode.RC_MSG_CONTENT_EXCEED_LIMIT};const s=Hn(t);let a;a=Xe(null===(o=n)||void 0===o?void 0:o.messageId)&&n.messageId>0?n.messageId:function(){_a++;const e=lo();return _a<e&&(_a=e),23e13+_a}(),ho.addMessage(a);const c=Oa(t,Dn.uid,r,a,"",function(){xa++;const e=lo();xa<e&&(xa=e);return xa}());n.onSendBefore&&n.onSendBefore(c),r.isPersited&&fi.get().loadConvsationsIfNotExist([t]);const l=await $o.getDialogAesKey(s);if(!l)return{code:e.ErrorCode.MSG_ENCRYPT_ERROR,data:c};const u=((e,t)=>{if(!it(e))return new Uint8Array;const r=Je.AES.encrypt(e,Je.enc.Utf8.parse(t.key),{iv:Xe(t.iv)?Je.enc.Utf8.parse(t.iv):void 0});return Yo(r.ciphertext.words)})(i,l),d={localId:nn.fromNumber(a),mediaFlag:Ia.includes(r.messageType),mediaConstructor:r.objectId,mediaAttribute:"",msgPreContent:"",msgPostContent:"",msgContent:u};let h;if(t.conversationType===e.ConversationType.GROUP){var f,p;const t={...d,groupId:s};if(null!==(f=n)&&void 0!==f&&null!==(p=f.directionalUserIdList)&&void 0!==p&&p.length&&(t.assign=n.directionalUserIdList.join(",")),Xe(r.content.mentionedInfo)){var g;const n=r.content.mentionedInfo;n.type===e.MentionedType.ALL?t.atAll=!0:n.type===e.MentionedType.SINGAL&&null!==(g=n.userIdList)&&void 0!==g&&g.length&&(t.at=n.userIdList.map((e=>nn.fromString(e))))}h=await(y=t,Mn.send(Lt.SendGroupChatMessage,y,{encoder:to.SendGroupChatMessageReq,decoder:io}))}else{const e={...d,destId:s};h=await(e=>Mn.send(Lt.SendPrivateChatMessage,e,{encoder:Zn.SendPrivateChatMessageReq,decoder:Pn.SendPrivateChatMessageResp}))(e)}var y;return h.code===e.ErrorCode.SUCCESS&&(c.sentTime=h.data.seqno.toNumber(),c.messageUId=h.data.msgId.toString(),fi.get().setConversationCacheByMessage(c)),{code:h.code,data:c}}const Ra=Ma(Sa.IMAGE,((e,t)=>new Uo({content:e.thumbnail,imageUri:e.url,width:e.width,height:e.height,user:t.user,extra:t.extra}))),ka=Ma(Sa.GIF,((e,t)=>new jo({gifDataSize:e.size,remoteUrl:e.url,width:e.width,height:e.height,user:t.user,extra:t.extra}))),Na=Ma(Sa.AUDIO,((e,t)=>new Po({remoteUrl:e.url,duration:e.duration,type:e.type,user:t.user,extra:t.extra}))),Aa=Ma(Sa.FILE,((e,t)=>new Fo({fileUrl:e.url,name:e.name,type:e.type,size:e.size,user:t.user,extra:t.extra}))),La=async(t,r)=>{const n=Hn(t);po.addMessage(r.messageUId);const o=await((e,t)=>{let r;return r=Kn(e)?Mn.send(Lt.RecallGroupMessage,{groupId:e,msgId:nn.fromString(t)},{encoder:to.RecallGroupChatMessageReq,decoder:Yr.BaseResp}):Mn.send(Lt.RecallPrivateMessage,{destId:e,msgId:nn.fromString(t)},{encoder:Zn.RecallPrivateChatMessageReq,decoder:Yr.BaseResp}),r})(n,r.messageUId);if(o.code!==e.ErrorCode.SUCCESS)return{code:o.code};const i=new Go({sentTime:r.sentTime,messageUId:r.messageUId,...t}),s=Oa(t,Dn.uid,i,0,"",lo());return fi.get().setConversationCacheByMessage(s),{code:e.ErrorCode.SUCCESS,data:s}};function Ma(t,r){return function(n,o,i,s){return new Promise((a=>{((e,t,r,n)=>{var o;const i=new pa({token:Fn.imInitToken,uploadUrl:Fn.fileUploadUrl,cert:Fn.cert,transformer:e=>({...e,url:Fn.getFileAbsoluteUri(e.url)})});let s;switch(t){case Sa.IMAGE:s=new ma(i,r);break;case Sa.GIF:s=new ba(i);break;case Sa.AUDIO:s=new wa(i);break;case Sa.FILE:s=new Ea(i)}null===(o=s)||void 0===o||o.upload(e,{onProgress:(e,t)=>n.onProgress(Math.floor(e/t*100)),onError:()=>n.onFail(),onCompleted:n.onSuccess})})(o.file,t,s,{onProgress:e=>{(null==i?void 0:i.onProgress)&&i.onProgress(e)},onSuccess:e=>{const t=(null==i?void 0:i.onComplete)&&i.onComplete({url:Fn.getFileAbsoluteUri(e.url)})||r(e,o);Ta(n,t,s).then(a)},onFail:()=>{a({code:e.ErrorCode.UPLOAD_FILE_FAILED})}})}))}}let Da,xa=1;class Ba extends Nt{constructor(e){if(Ba.imClient)return Ct.error("Please do not perform the init method repeatedly"),Ba.imClient;super(),h(this,"options",void 0),h(this,"libLoader",void 0),h(this,"getServerTime",lo),h(this,"sendMessage",Ta),h(this,"sendImageMessage",Ra),h(this,"sendGIFMessage",ka),h(this,"sendHQVoiceMessage",Na),h(this,"sendFileMessage",Aa),h(this,"recallMsg",La),this.options=e,this.fixedProtobuf(),Xe(e.logLevel)&&Ct.setLogLevel(e.logLevel),Xe(e.logStdout)&&Ct.setLogStdout(e.logStdout),Ct.debug("IMClient.init -> ",e.appkey),this.libLoader=gi.init(e),this.watch(),Ba.imClient=this}fixedProtobuf(){la.util.Long=nn,la.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(e.Events.CONNECTING)},onConnected:()=>{this.emit(e.Events.CONNECTED)},onDisconnect:()=>{this.emit(e.Events.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(e.Events.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:t=>{this.emit(e.Events.MESSAGES,{messages:t})},pullFinished:()=>{this.emit(e.Events.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:t=>{this.emit(e.Events.CONVERSATION,{conversations:t})}})}connect(e){return this.libLoader.connect(e)}disconnect(){return this.libLoader.disconnect()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}async getRemoteHistoryMessages(t,r){const o=Hn(t);return so({dialogId:o,offset:r.timestamp??0,count:r.count??20,newToOld:0===r.order}).then((t=>{let{code:r,data:i}=t;return new Promise((t=>{r===e.ErrorCode.SUCCESS?ni.parse({[o]:i.msg??{}},((r,n)=>{const s=n[o]??[];s.sort(((e,t)=>e.sentTime-t.sentTime)),t({code:e.ErrorCode.SUCCESS,data:{list:s,hasMore:!i.isEnd}})})):t({code:r,msg:n(r)})}))}))}async deleteRemoteMessage(e,t){return(r=Hn(e),n=t.map((e=>e.messageUId)),Mn.send(Lt.DeleteChatMessages,{destId:r,msgIdList:n.map((e=>nn.fromString(e)))},{encoder:Zn.DeleteChatMessageReq,decoder:Yr.BaseResp})).then((e=>e.code));var r,n}async deleteRemoteMessageByTimestamp(e,t){return((e,t)=>Mn.send(Lt.ClearChatHistoryMessage,{destId:e,type:Kn(e)?1:0,msgTime:nn.fromNumber(t)},{encoder:Zn.CleanHistoryMessageReq,decoder:Yr.BaseResp}))(Hn(e),0===t?Number.MAX_VALUE:t).then((e=>e.code))}async getConversationList(t,r,n,o){const i={rows:t,type:r??0,offset:nn.fromNumber(n),newToOld:0===o},{code:s,data:a}=await(e=>Mn.send(Lt.GetDialogList,e,{encoder:Zn.GetWebDialogListReq,decoder:Pn.GetWebDialogListResp}))(i);if(s!==e.ErrorCode.SUCCESS)return{code:s};const c=a.fullDialog.map((e=>{var t;return null===(t=e.dialog)||void 0===t?void 0:t.destId})).filter(it);await $o.getDialogAesKeyList(c);const l=[];for(const e of a.fullDialog){const t=this.formatConversation(e);if(t){const e={conversationType:t.conversationType,targetId:t.targetId,channelId:t.channelId};fi.get().addLocalConversation(t);const r=fi.get().get(e);Object.assign(t,r),l.push(t)}}return{code:e.ErrorCode.SUCCESS,data:l}}getBlockConversationList(){const t=fi.get().getBlockConversationList();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})}getTopConversationList(){const t=fi.get().getTopConversationList();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})}async getConversation(t){const r=fi.get().get(t);if(!r)return{code:e.ErrorCode.CONVER_GET_ERROR};const{code:n,data:o}=await this.getRemoteHistoryMessages(t,{count:1,order:0});if(n!==e.ErrorCode.SUCCESS)return{code:e.ErrorCode.CONVER_GET_ERROR};const i=null==o?void 0:o.list[0],s={...t,...r,latestMessage:i};return{code:e.ErrorCode.SUCCESS,data:s}}removeConversation(e){return(e=>{let t;return t=Kn(e)?Mn.send(Lt.DeleteGroupDialog,{groupId:e},{encoder:to.DeleteGroupChatDialogReq,decoder:Yr.BaseResp}):Mn.send(Lt.DeletePrivateDialog,{destId:e},{encoder:Zn.DeletePrivateChatDialogReq,decoder:Yr.BaseResp}),t})(Hn(e)).then((e=>e.code))}getUnreadMentionedCount(e){return fi.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return fi.get().getAllUnreadMentionedCount()}getAllConversationState(){return fi.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return fi.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return fi.get().getUnreadCount(e)}clearConversationUnreadCount(e){fi.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){fi.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return fi.get().getNotificationLevel(e)}setConversationNotificationStatus(t,r){return((e,t)=>{let r;return r=Kn(e)?Mn.send(Lt.UpdateGroupChatMuteConfig,{groupId:e,muteFlag:t},{encoder:to.UpdateGroupChatDialogMuteConfigReq,decoder:Yr.BaseResp}):Mn.send(Lt.UpdatePrivateChatMuteConfig,{destId:e,muteFlag:t},{encoder:Zn.UpdatePrivateChatDialogMuteConfigReq,decoder:Yr.BaseResp}),r})(Hn(t),r===e.NotificationStatus.OPEN).then((n=>(!n.code&&fi.get().addStatus({...t,notificationStatus:r,notificationLevel:r==e.NotificationStatus.OPEN?e.NotificationLevel.AT_USER_NOTIFICATION:e.NotificationLevel.NOT_SET},!0),n.code)))}getConversationNotificationStatus(e){return fi.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=Kn(e)?Mn.send(Lt.UpdateGroupChatStickyConfig,{groupId:e,stickyFlag:t},{encoder:to.UpdateGroupChatDialogStickyConfigReq,decoder:Yr.BaseResp}):Mn.send(Lt.UpdatePrivateChatStickyConfig,{destId:e,stickyFlag:t},{encoder:Zn.UpdatePrivateChatDialogStickyConfigReq,decoder:Yr.BaseResp}),r})(Hn(e),t).then((r=>(!r.code&&fi.get().addStatus({...e,isTop:t},!0),r.code)))}saveConversationMessageDraft(e,t){fi.get().setDraft(e,t)}getConversationMessageDraft(e){return fi.get().getDraft(e)}clearConversationMessageDraft(e){fi.get().clearDraft(e)}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId??"",o=ai(t);if(!o)return;const i=$o.getDialogAesKeyFromLocal(n);if(!i)return;const s=ni.parseSingleDialogMessages(n,[r],i)[0];return s?(o.latestMessage=s,o):void 0}}h(Ba,"imClient",void 0);const Ua=async(t,r,n)=>{if(r instanceof vo==!1)return Ct.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:e.ErrorCode.PARAMETER_ERROR};Rt("conversation",t,It,!0),ja(t);const o=await Da.sendMessage(t,r,n);return Pa(t,o.code),o},ja=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;Ct.debug("send message ->"+t)},Pa=(t,r)=>{if(r!==e.ErrorCode.SUCCESS){const e="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.warn("send message fail ->"+r+":"+n(r)+","+e)}};e.CommandMessage=qo,e.ErrorDesc=n,e.FileMessage=Fo,e.GIFMessage=jo,e.HQVoiceMessage=Po,e.ImageMessage=Uo,e.TextMessage=Bo,e.addEventListener=(e,t,r)=>{Da.on(e,t,r)},e.clearAllMessagesUnreadStatus=()=>(Ct.debug("clear allMessagesUnreadStatus"),Da.clearAllConversationsUnreadCount(),Promise.resolve({code:e.ErrorCode.SUCCESS})),e.clearHistoryMessages=async(t,r)=>{Rt("timestamp",r,(e=>Et(e)&&e>=0),!0),Rt("conversation",t,It);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("clear message ->"+o);const i=await Da.deleteRemoteMessageByTimestamp(t,r);return i!==e.ErrorCode.SUCCESS?(Ct.warn("clear message ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:e.ErrorCode.SUCCESS}},e.clearMessagesUnreadStatus=t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return Ct.debug("clear unreadMsgNum ->"+r),Da.clearConversationUnreadCount(t),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.clearTextMessageDraft=t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return Ct.debug("delete draft ->"+r),Da.clearConversationMessageDraft(t),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.connect=async t=>{Rt("token",t,wt,!0);const r=await Da.connect(t);return r.code===e.ErrorCode.SUCCESS?{code:r.code,data:{userId:r.userId}}:{code:r.code,msg:n(r.code)}},e.deleteMessages=async(t,r)=>{Rt("messages",r,(e=>nt(e)&&!!e.length),!0),r.forEach((e=>{Rt("messages.messageUId",e.messageUId,wt,!0),Rt("messages.sentTime",e.sentTime,Et,!1),Rt("messages.messageDirection",e.messageDirection,(e=>1===e||2===e),!1)})),Rt("conversation",t,It,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("delete messages ->"+o);const i=await Da.deleteRemoteMessage(t,r);return i!==e.ErrorCode.SUCCESS?(Ct.warn("delete message fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:e.ErrorCode.SUCCESS}},e.disconnect=()=>Da.disconnect(),e.getAllConversationState=()=>{Ct.debug("getAllConversationState");const t=Da.getAllConversationState();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})},e.getAllUnreadMentionedCount=()=>{Ct.debug("getAllUnreadMentionedCount");const t=Da.getAllUnreadMentionedCount();return Promise.resolve({code:e.ErrorCode.SUCCESS,data:t})},e.getBlockedConversationList=()=>Da.getBlockConversationList(),e.getConnectionStatus=()=>Da.getConnectionStatus(),e.getConversation=async t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("get conversation ->"+r);const{code:o,data:i}=await Da.getConversation(t);return o!==e.ErrorCode.SUCCESS?(Ct.warn("get conversation fail ->"+o+":"+n(o)+","+r),{code:o,msg:n(o)}):{code:o,data:i}},e.getConversationList=async t=>{Ct.debug("get conversation list ->");const{code:r,data:o}=await Da.getConversationList((null==t?void 0:t.count)??20,null,(null==t?void 0:t.startTime)??0,(null==t?void 0:t.order)??0);return r!==e.ErrorCode.SUCCESS&&Ct.warn("get conversation list fail ->"+r+":"+n(r)),{code:r,msg:n(r),data:o}},e.getConversationNotificationLevel=t=>{Rt("options",t,It,!0),Ct.info("getConversationNotificationLevel ->targetId:"+t.targetId+",conversationType:"+t.conversationType);const r=Da.getConversationNotificationLevel(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:r})},e.getConversationNotificationStatus=t=>{Rt("options",t,It,!0),Ct.info("getConversationNotificationStatus ->targetId:"+t.targetId+",conversationType:"+t.conversationType);const r=Da.getConversationNotificationStatus(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:r})},e.getHistoryMessages=async(t,r)=>{Rt("options.timestamp",r.timestamp??0,Et),Rt("options.count",r.count??0,Et),Rt("options.order",r.order??0,(e=>0===e||1===e)),Rt("conversation",t,It,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("get history message ->"+o);const i=await Da.getRemoteHistoryMessages(t,r);return i.code!==e.ErrorCode.SUCCESS&&Ct.warn("get history message fail ->"+i.code+":"+n(i.code)+","+o),i},e.getRemoteHistoryMessages=async(t,r)=>{Rt("options.timestamp",r.timestamp??0,Et),Rt("options.count",r.count??0,Et),Rt("options.order",r.order??0,(e=>0===e||1===e)),Rt("conversation",t,It,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("get remote history message ->"+o);const i=await Da.getRemoteHistoryMessages(t,r);return i.code!==e.ErrorCode.SUCCESS&&Ct.warn("get remote history message fail ->"+i.code+":"+n(i.code)+","+o),i},e.getServerTime=()=>Da.getServerTime(),e.getTextMessageDraft=t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("get draft ->"+r);const n=Da.getConversationMessageDraft(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getTopConversationList=()=>Da.getTopConversationList(),e.getTotalUnreadCount=(t,r)=>{if(Ct.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+t),Rt("includeMuted",t,St,!1),Rt("conversationTypes",r,Ot,!1),r)for(const e of r)Rt("conversationType",e,_t,!0);const n=Da.getAllConversationUnreadCount(r??[],t??!1);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getUnreadCount=t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("get unreadCount ->"+r);const n=Da.getConversationUnreadCount(t);return Promise.resolve({code:e.ErrorCode.SUCCESS,data:n})},e.getUnreadMentionedCount=t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;return Ct.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:e.ErrorCode.SUCCESS,data:Da.getUnreadMentionedCount(t)})},e.init=e=>{Da=Da||new Ba(e)},e.onceEventListener=function(e,t,r){Da.once(e,t,r)},e.recallMessage=async(t,r)=>{Rt("options.messageUId",r.messageUId,wt,!0),Rt("options.sentTime",r.sentTime,Et,!0),Rt("conversation",t,It,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId+",messageUId:"+r.messageUId;Ct.debug("recall message ->"+o);const i=await Da.recallMsg(t,r);return i.code!==e.ErrorCode.SUCCESS&&Ct.warn("recall message fail ->"+i.code+":"+n(i.code)+","+o),i},e.registerMessageType=(e,t,r,n,o)=>function(n){return o?new Wo(e,n):r?new Vo(e,n):t?new Ko(e,n):new zo(e,n)},e.removeConversation=async t=>{Rt("options",t,It,!0);const r="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("remove conversation ->"+r);const o=await Da.removeConversation(t);return o!==e.ErrorCode.SUCCESS?(Ct.warn("remove conversation fail ->"+o+":"+n(o)+","+r),{code:o,msg:n(o)}):{code:o}},e.removeEventListener=(e,t,r)=>{Da.off(e,t,r)},e.saveTextMessageDraft=(t,r)=>{Rt("options",t,It,!0),Rt("draft",r,wt,!0);const n="conversationType:"+t.conversationType+",targetId:"+t.targetId;return Ct.debug("set draft ->"+n),Da.saveConversationMessageDraft(t,r),Promise.resolve({code:e.ErrorCode.SUCCESS})},e.sendFileMessage=async(e,t,r,n)=>{Rt("conversation",e,It,!0),Rt("msgBody.file",t.file,(e=>e instanceof Blob),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;Ct.debug("send message ->"+o),ja(e);const i=await Da.sendFileMessage(e,t,r,n);return Pa(e,i.code),i},e.sendGIFMessage=async(e,t,r,n)=>{Rt("conversation",e,It,!0),Rt("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.endsWith("image/gif")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;Ct.debug("send message ->"+o),ja(e);const i=await Da.sendGIFMessage(e,t,r,n);return Pa(e,i.code),i},e.sendHQVoiceMessage=async(e,t,r,n)=>{Rt("conversation",e,It,!0),Rt("msgBody.file",t.file,(e=>e instanceof Blob),!0),ja(e);const o=await Da.sendHQVoiceMessage(e,t,r,n);return Pa(e,o.code),o},e.sendImageMessage=async(e,t,r,n)=>{Rt("conversation",e,It,!0),Rt("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.startsWith("image/")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;Ct.debug("send message ->"+o),ja(e);const i=await Da.sendImageMessage(e,t,r,n);return Pa(e,i.code),i},e.sendMessage=Ua,e.sendTextMessage=(e,t,r)=>{const n=new Bo(t);return Ua(e,n,r)},e.setConversationNotificationStatus=async(t,r)=>{Rt("options",t,It,!0),Rt("notificationStatus",r,(e=>1===e||2===e),!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("set conversation status ->"+o);const i=await Da.setConversationNotificationStatus(t,r);return i!==e.ErrorCode.SUCCESS?(Ct.warn("set conversation status fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:i}},e.setConversationToTop=async function(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Rt("options",t,It,!0);const o="conversationType:"+t.conversationType+",targetId:"+t.targetId;Ct.debug("set conversation status ->"+o);const i=await Da.setConversationToTop(t,r);return i!==e.ErrorCode.SUCCESS?(Ct.warn("set conversation status fail ->"+i+":"+n(i)+","+o),{code:i,msg:n(i)}):{code:i}}}));