@onyx-p/imlib-web 1.0.20 → 1.0.21

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.esm.js CHANGED
@@ -1,10 +1,10 @@
1
- var e,t;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER"}(e||(e={})),function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT"}(t||(t={}));const r=e=>t[e];var n,o,i,s,a,c,l,u;function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=3]="GROUP",e[e.ULTRA_GROUP=10]="ULTRA_GROUP"}(n||(n={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(o||(o={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(i||(i={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(s||(s={})),function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(a||(a={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(c||(c={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(l||(l={})),function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.CONVERSATION="CONVERSATION"}(u||(u={}));var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p={exports:{}};var g,y={exports:{}};function v(){return g?y.exports:(g=1,y.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!==h&&h.crypto&&(r=h.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)}},f=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=f.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}())}var m,b={exports:{}};function w(){return m?b.exports:(m=1,b.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}(v()))}var O,C={exports:{}};function S(){return O?C.exports:(O=1,C.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}(v()))}var _,I={exports:{}};function E(){return _?I.exports:(_=1,I.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}(v()))}var T,R={exports:{}};function k(){return T?R.exports:(T=1,R.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}(v()))}var A,N={exports:{}};function D(){return A?N.exports:(A=1,N.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}(v()))}var x,M={exports:{}};function L(){return x?M.exports:(x=1,M.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],w=e[t+9],O=e[t+10],C=e[t+11],S=e[t+12],_=e[t+13],I=e[t+14],E=e[t+15],T=i[0],R=i[1],k=i[2],A=i[3];T=l(T,R,k,A,s,7,a[0]),A=l(A,T,R,k,c,12,a[1]),k=l(k,A,T,R,f,17,a[2]),R=l(R,k,A,T,p,22,a[3]),T=l(T,R,k,A,g,7,a[4]),A=l(A,T,R,k,y,12,a[5]),k=l(k,A,T,R,v,17,a[6]),R=l(R,k,A,T,m,22,a[7]),T=l(T,R,k,A,b,7,a[8]),A=l(A,T,R,k,w,12,a[9]),k=l(k,A,T,R,O,17,a[10]),R=l(R,k,A,T,C,22,a[11]),T=l(T,R,k,A,S,7,a[12]),A=l(A,T,R,k,_,12,a[13]),k=l(k,A,T,R,I,17,a[14]),T=u(T,R=l(R,k,A,T,E,22,a[15]),k,A,c,5,a[16]),A=u(A,T,R,k,v,9,a[17]),k=u(k,A,T,R,C,14,a[18]),R=u(R,k,A,T,s,20,a[19]),T=u(T,R,k,A,y,5,a[20]),A=u(A,T,R,k,O,9,a[21]),k=u(k,A,T,R,E,14,a[22]),R=u(R,k,A,T,g,20,a[23]),T=u(T,R,k,A,w,5,a[24]),A=u(A,T,R,k,I,9,a[25]),k=u(k,A,T,R,p,14,a[26]),R=u(R,k,A,T,b,20,a[27]),T=u(T,R,k,A,_,5,a[28]),A=u(A,T,R,k,f,9,a[29]),k=u(k,A,T,R,m,14,a[30]),T=d(T,R=u(R,k,A,T,S,20,a[31]),k,A,y,4,a[32]),A=d(A,T,R,k,b,11,a[33]),k=d(k,A,T,R,C,16,a[34]),R=d(R,k,A,T,I,23,a[35]),T=d(T,R,k,A,c,4,a[36]),A=d(A,T,R,k,g,11,a[37]),k=d(k,A,T,R,m,16,a[38]),R=d(R,k,A,T,O,23,a[39]),T=d(T,R,k,A,_,4,a[40]),A=d(A,T,R,k,s,11,a[41]),k=d(k,A,T,R,p,16,a[42]),R=d(R,k,A,T,v,23,a[43]),T=d(T,R,k,A,w,4,a[44]),A=d(A,T,R,k,S,11,a[45]),k=d(k,A,T,R,E,16,a[46]),T=h(T,R=d(R,k,A,T,f,23,a[47]),k,A,s,6,a[48]),A=h(A,T,R,k,m,10,a[49]),k=h(k,A,T,R,I,15,a[50]),R=h(R,k,A,T,y,21,a[51]),T=h(T,R,k,A,S,6,a[52]),A=h(A,T,R,k,p,10,a[53]),k=h(k,A,T,R,O,15,a[54]),R=h(R,k,A,T,c,21,a[55]),T=h(T,R,k,A,b,6,a[56]),A=h(A,T,R,k,E,10,a[57]),k=h(k,A,T,R,v,15,a[58]),R=h(R,k,A,T,_,21,a[59]),T=h(T,R,k,A,g,6,a[60]),A=h(A,T,R,k,C,10,a[61]),k=h(k,A,T,R,f,15,a[62]),R=h(R,k,A,T,w,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]+A|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}(v()))}var U,B={exports:{}};function j(){return U?B.exports:(U=1,B.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}(v()))}var P,F={exports:{}};function G(){return P?F.exports:(P=1,F.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),w=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+w|0,s=i,i=o,o=n,n=w+(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}(v()))}var q,H={exports:{}};var K,z={exports:{}};function V(){return K?z.exports:(K=1,z.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,w=s.low,O=a.high,C=a.low,S=u.high,_=u.low,I=d.high,E=d.low,T=h.high,R=h.low,k=f,A=p,N=g,D=y,x=v,M=m,L=b,U=w,B=O,j=C,P=S,F=_,G=I,q=E,H=T,K=R,z=0;z<80;z++){var V,W,$=l[z];if(z<16)W=$.high=0|e[t+2*z],V=$.low=0|e[t+2*z+1];else{var J=l[z-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[z-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[z-7],se=ie.high,ae=ie.low,ce=l[z-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=B&P^~B&G,fe=j&F^~j&q,pe=k&N^k&x^N&x,ge=A&D^A&M^D&M,ye=(k>>>28|A<<4)^(k<<30|A>>>2)^(k<<25|A>>>7),ve=(A>>>28|k<<4)^(A<<30|k>>>2)^(A<<25|k>>>7),me=(B>>>14|j<<18)^(B>>>18|j<<14)^(B<<23|j>>>9),be=(j>>>14|B<<18)^(j>>>18|B<<14)^(j<<23|B>>>9),we=c[z],Oe=we.high,Ce=we.low,Se=H+me+((de=K+be)>>>0<K>>>0?1:0),_e=ve+ge;H=G,K=q,G=P,q=F,P=B,F=j,B=L+(Se=(Se=(Se=Se+he+((de+=fe)>>>0<fe>>>0?1:0))+Oe+((de+=Ce)>>>0<Ce>>>0?1:0))+W+((de+=V)>>>0<V>>>0?1:0))+((j=U+de|0)>>>0<U>>>0?1:0)|0,L=x,U=M,x=N,M=D,N=k,D=A,k=Se+(ye+pe+(_e>>>0<ve>>>0?1:0))+((A=de+_e|0)>>>0<de>>>0?1:0)|0}p=n.low=p+A,n.high=f+k+(p>>>0<A>>>0?1:0),y=o.low=y+D,o.high=g+N+(y>>>0<D>>>0?1:0),m=i.low=m+M,i.high=v+x+(m>>>0<M>>>0?1:0),w=s.low=w+U,s.high=b+L+(w>>>0<U>>>0?1:0),C=a.low=C+j,a.high=O+B+(C>>>0<j>>>0?1:0),_=u.low=_+F,u.high=S+P+(_>>>0<F>>>0?1:0),E=d.low=E+q,d.high=I+G+(E>>>0<q>>>0?1:0),R=h.low=R+K,h.high=T+H+(R>>>0<K>>>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}(v(),w()))}var W,$={exports:{}};var J,Z={exports:{}};function X(){return J?Z.exports:(J=1,Z.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,w=m.low;for(f=v.high^(b<<1|w>>>31),p=v.low^(w<<1|b>>>31),g=0;g<5;g++)(R=r[h+5*g]).high^=f,R.low^=p}for(var O=1;O<25;O++){var C=(R=r[O]).high,S=R.low,_=c[O];_<32?(f=C<<_|S>>>32-_,p=S<<_|C>>>32-_):(f=S<<_-32|C>>>64-_,p=C<<_-32|S>>>64-_);var I=d[l[O]];I.high=f,I.low=p}var E=d[0],T=r[0];for(E.high=T.high,E.low=T.low,h=0;h<5;h++)for(g=0;g<5;g++){var R=r[O=h+5*g],k=d[O],A=d[(h+1)%5+5*g],N=d[(h+2)%5+5*g];R.high=k.high^~A.high&N.high,R.low=k.low^~A.low&N.low}R=r[0];var D=u[a];R.high^=D.high,R.low^=D.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}(v(),w()))}var Y,Q={exports:{}};var ee,te={exports:{}};function re(){return ee?te.exports:(ee=1,te.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))}})}(v()))}var ne,oe={exports:{}};var ie,se={exports:{}};function ae(){return ie?se.exports:(ie=1,se.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}(v(),j(),re()))}var ce,le={exports:{}};function ue(){return ce?le.exports:(ce=1,le.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)}})}()}(v(),ae()))}var de,he={exports:{}};function fe(){return de?he.exports:(de=1,he.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}(v(),ue()))}var pe,ge={exports:{}};function ye(){return pe?ge.exports:(pe=1,ge.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}(v(),ue()))}var ve,me={exports:{}};function be(){return ve?me.exports:(ve=1,me.exports=function(e){
1
+ var e,t;!function(e){e[e.CONNECTED=0]="CONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.DISCONNECTED=2]="DISCONNECTED",e[e.NETWORK_UNAVAILABLE=3]="NETWORK_UNAVAILABLE",e[e.CONNECTION_CLOSED=4]="CONNECTION_CLOSED",e[e.KICKED_OFFLINE_BY_OTHER_CLIENT=6]="KICKED_OFFLINE_BY_OTHER_CLIENT",e[e.WEBSOCKET_UNAVAILABLE=7]="WEBSOCKET_UNAVAILABLE",e[e.WEBSOCKET_ERROR=8]="WEBSOCKET_ERROR",e[e.BLOCKED=9]="BLOCKED",e[e.DISCONNECT_BY_SERVER=13]="DISCONNECT_BY_SERVER"}(e||(e={})),function(e){e[e.TIMEOUT=-1]="TIMEOUT",e[e.UNKNOWN=-2]="UNKNOWN",e[e.PARAMETER_ERROR=-3]="PARAMETER_ERROR",e[e.SUCCESS=0]="SUCCESS",e[e.NETWORK_ERROR=7]="NETWORK_ERROR",e[e.MSG_ENCRYPT_ERROR=6001]="MSG_ENCRYPT_ERROR",e[e.RC_DISCUSSION_GROUP_ID_INVALID=20407]="RC_DISCUSSION_GROUP_ID_INVALID",e[e.SEND_FREQUENCY_TOO_FAST=20604]="SEND_FREQUENCY_TOO_FAST",e[e.FORBIDDEN_IN_GROUP=22408]="FORBIDDEN_IN_GROUP",e[e.RECALL_MESSAGE=25101]="RECALL_MESSAGE",e[e.NOT_IN_GROUP=22406]="NOT_IN_GROUP",e[e.SENSITIVE_SHIELD=21501]="SENSITIVE_SHIELD",e[e.GET_USERINFO_ERROR=23407]="GET_USERINFO_ERROR",e[e.REJECTED_BY_BLACKLIST=405]="REJECTED_BY_BLACKLIST",e[e.RC_NET_CHANNEL_INVALID=30001]="RC_NET_CHANNEL_INVALID",e[e.RC_NET_UNAVAILABLE=30002]="RC_NET_UNAVAILABLE",e[e.RC_MSG_RESP_TIMEOUT=30003]="RC_MSG_RESP_TIMEOUT",e[e.RC_SOCKET_NOT_CREATED=30010]="RC_SOCKET_NOT_CREATED",e[e.RC_SOCKET_DISCONNECTED=30011]="RC_SOCKET_DISCONNECTED",e[e.RC_PONG_RECV_FAIL=30013]="RC_PONG_RECV_FAIL",e[e.RC_MSG_SEND_FAIL=30014]="RC_MSG_SEND_FAIL",e[e.RC_MSG_CONTENT_EXCEED_LIMIT=30016]="RC_MSG_CONTENT_EXCEED_LIMIT",e[e.RC_CONN_ACK_TIMEOUT=31e3]="RC_CONN_ACK_TIMEOUT",e[e.RC_CONN_ID_REJECT=31002]="RC_CONN_ID_REJECT",e[e.RC_CONN_SERVER_UNAVAILABLE=31003]="RC_CONN_SERVER_UNAVAILABLE",e[e.RC_CONN_USER_OR_PASSWD_ERROR=31004]="RC_CONN_USER_OR_PASSWD_ERROR",e[e.RC_CONN_NOT_AUTHRORIZED=31005]="RC_CONN_NOT_AUTHRORIZED",e[e.RC_DISCONN_KICK=31010]="RC_DISCONN_KICK",e[e.RC_DISCONN_SAME_CLIENT_ON_LINE=31023]="RC_DISCONN_SAME_CLIENT_ON_LINE",e[e.BIZ_ERROR_CLIENT_NOT_INIT=33001]="BIZ_ERROR_CLIENT_NOT_INIT",e[e.BIZ_ERROR_INVALID_PARAMETER=33003]="BIZ_ERROR_INVALID_PARAMETER",e[e.BIZ_ERROR_RECONNECT_SUCCESS=33005]="BIZ_ERROR_RECONNECT_SUCCESS",e[e.BIZ_ERROR_CONNECTING=33006]="BIZ_ERROR_CONNECTING",e[e.MSG_INSERT_ERROR=33008]="MSG_INSERT_ERROR",e[e.MSG_DEL_ERROR=33009]="MSG_DEL_ERROR",e[e.CONVER_REMOVE_ERROR=34001]="CONVER_REMOVE_ERROR",e[e.CONVER_GETLIST_ERROR=34002]="CONVER_GETLIST_ERROR",e[e.CONVER_SETOP_ERROR=34003]="CONVER_SETOP_ERROR",e[e.CONVER_TOTAL_UNREAD_ERROR=34004]="CONVER_TOTAL_UNREAD_ERROR",e[e.CONVER_TYPE_UNREAD_ERROR=34005]="CONVER_TYPE_UNREAD_ERROR",e[e.CONVER_ID_TYPE_UNREAD_ERROR=34006]="CONVER_ID_TYPE_UNREAD_ERROR",e[e.CONVER_OUT_LIMIT_ERROR=34013]="CONVER_OUT_LIMIT_ERROR",e[e.MEDIA_EXCEPTION=34018]="MEDIA_EXCEPTION",e[e.CONVER_GET_ERROR=35021]="CONVER_GET_ERROR",e[e.GROUP_SYNC_ERROR=35001]="GROUP_SYNC_ERROR",e[e.CAN_NOT_RECONNECT=35007]="CAN_NOT_RECONNECT",e[e.HAS_OHTER_SAME_CLIENT_ON_LINE=35010]="HAS_OHTER_SAME_CLIENT_ON_LINE",e[e.METHOD_NOT_AVAILABLE=35011]="METHOD_NOT_AVAILABLE",e[e.METHOD_NOT_SUPPORT=35012]="METHOD_NOT_SUPPORT",e[e.MSG_LIMIT_ERROR=35013]="MSG_LIMIT_ERROR",e[e.METHOD_ONLY_SUPPORT_ULTRA_GROUP=35014]="METHOD_ONLY_SUPPORT_ULTRA_GROUP",e[e.UPLOAD_FILE_FAILED=35020]="UPLOAD_FILE_FAILED",e[e.DRAF_GET_ERROR=38001]="DRAF_GET_ERROR",e[e.DRAF_SAVE_ERROR=38002]="DRAF_SAVE_ERROR",e[e.DRAF_REMOVE_ERROR=38003]="DRAF_REMOVE_ERROR",e[e.NOT_SUPPORT=39002]="NOT_SUPPORT"}(t||(t={}));const r=e=>t[e];var n,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(e){e[e.PRIVATE=1]="PRIVATE",e[e.GROUP=3]="GROUP",e[e.ULTRA_GROUP=10]="ULTRA_GROUP"}(n||(n={})),function(e){e[e.ALL=1]="ALL",e[e.SINGAL=2]="SINGAL"}(o||(o={})),function(e){e[e.OPEN=1]="OPEN",e[e.CLOSE=2]="CLOSE"}(i||(i={})),function(e){e[e.SEND=1]="SEND",e[e.RECEIVE=2]="RECEIVE"}(s||(s={})),function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT"}(a||(a={})),function(e){e[e.READ=1]="READ",e[e.LISTENED=2]="LISTENED",e[e.DOWNLOADED=4]="DOWNLOADED",e[e.RETRIEVED=8]="RETRIEVED",e[e.UNREAD=0]="UNREAD"}(c||(c={})),function(e){e[e.ALL_MESSAGE=-1]="ALL_MESSAGE",e[e.NOT_SET=0]="NOT_SET",e[e.AT_MESSAGE_NOTIFICATION=1]="AT_MESSAGE_NOTIFICATION",e[e.AT_USER_NOTIFICATION=2]="AT_USER_NOTIFICATION",e[e.AT_GROUP_ALL_USER_NOTIFICATION=4]="AT_GROUP_ALL_USER_NOTIFICATION",e[e.NOT_MESSAGE_NOTIFICATION=5]="NOT_MESSAGE_NOTIFICATION"}(l||(l={})),function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=1e3]="NONE"}(u||(u={})),function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.CONVERSATION="CONVERSATION"}(d||(d={}));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?v.exports:(y=1,v.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}())}var b,w={exports:{}};function O(){return b?w.exports:(b=1,w.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()))}var C,S={exports:{}};function _(){return C?S.exports:(C=1,S.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()))}var I,E={exports:{}};function T(){return I?E.exports:(I=1,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()))}var R,k={exports:{}};function N(){return R?k.exports:(R=1,k.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()))}var A,D={exports:{}};function x(){return A?D.exports:(A=1,D.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()))}var M,L={exports:{}};function U(){return M?L.exports:(M=1,L.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],w=e[t+9],O=e[t+10],C=e[t+11],S=e[t+12],_=e[t+13],I=e[t+14],E=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,w,12,a[9]),k=l(k,N,T,R,O,17,a[10]),R=l(R,k,N,T,C,22,a[11]),T=l(T,R,k,N,S,7,a[12]),N=l(N,T,R,k,_,12,a[13]),k=l(k,N,T,R,I,17,a[14]),T=u(T,R=l(R,k,N,T,E,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,C,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,O,9,a[21]),k=u(k,N,T,R,E,14,a[22]),R=u(R,k,N,T,g,20,a[23]),T=u(T,R,k,N,w,5,a[24]),N=u(N,T,R,k,I,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,_,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,C,16,a[34]),R=d(R,k,N,T,I,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,O,23,a[39]),T=d(T,R,k,N,_,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,w,4,a[44]),N=d(N,T,R,k,S,11,a[45]),k=d(k,N,T,R,E,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,I,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,O,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,E,10,a[57]),k=h(k,N,T,R,v,15,a[58]),R=h(R,k,N,T,_,21,a[59]),T=h(T,R,k,N,g,6,a[60]),N=h(N,T,R,k,C,10,a[61]),k=h(k,N,T,R,f,15,a[62]),R=h(R,k,N,T,w,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()))}var B,j={exports:{}};function P(){return B?j.exports:(B=1,j.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()))}var F,G={exports:{}};function q(){return F?G.exports:(F=1,G.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),w=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+w|0,s=i,i=o,o=n,n=w+(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()))}var H,K={exports:{}};var z,V={exports:{}};function W(){return z?V.exports:(z=1,V.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,w=s.low,O=a.high,C=a.low,S=u.high,_=u.low,I=d.high,E=d.low,T=h.high,R=h.low,k=f,N=p,A=g,D=y,x=v,M=m,L=b,U=w,B=O,j=C,P=S,F=_,G=I,q=E,H=T,K=R,z=0;z<80;z++){var V,W,$=l[z];if(z<16)W=$.high=0|e[t+2*z],V=$.low=0|e[t+2*z+1];else{var J=l[z-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[z-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[z-7],se=ie.high,ae=ie.low,ce=l[z-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=B&P^~B&G,fe=j&F^~j&q,pe=k&A^k&x^A&x,ge=N&D^N&M^D&M,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=(B>>>14|j<<18)^(B>>>18|j<<14)^(B<<23|j>>>9),be=(j>>>14|B<<18)^(j>>>18|B<<14)^(j<<23|B>>>9),we=c[z],Oe=we.high,Ce=we.low,Se=H+me+((de=K+be)>>>0<K>>>0?1:0),_e=ve+ge;H=G,K=q,G=P,q=F,P=B,F=j,B=L+(Se=(Se=(Se=Se+he+((de+=fe)>>>0<fe>>>0?1:0))+Oe+((de+=Ce)>>>0<Ce>>>0?1:0))+W+((de+=V)>>>0<V>>>0?1:0))+((j=U+de|0)>>>0<U>>>0?1:0)|0,L=x,U=M,x=A,M=D,A=k,D=N,k=Se+(ye+pe+(_e>>>0<ve>>>0?1:0))+((N=de+_e|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+D,o.high=g+A+(y>>>0<D>>>0?1:0),m=i.low=m+M,i.high=v+x+(m>>>0<M>>>0?1:0),w=s.low=w+U,s.high=b+L+(w>>>0<U>>>0?1:0),C=a.low=C+j,a.high=O+B+(C>>>0<j>>>0?1:0),_=u.low=_+F,u.high=S+P+(_>>>0<F>>>0?1:0),E=d.low=E+q,d.high=I+G+(E>>>0<q>>>0?1:0),R=h.low=R+K,h.high=T+H+(R>>>0<K>>>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(),O()))}var $,J={exports:{}};var Z,X={exports:{}};function Y(){return Z?X.exports:(Z=1,X.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,w=m.low;for(f=v.high^(b<<1|w>>>31),p=v.low^(w<<1|b>>>31),g=0;g<5;g++)(R=r[h+5*g]).high^=f,R.low^=p}for(var O=1;O<25;O++){var C=(R=r[O]).high,S=R.low,_=c[O];_<32?(f=C<<_|S>>>32-_,p=S<<_|C>>>32-_):(f=S<<_-32|C>>>64-_,p=C<<_-32|S>>>64-_);var I=d[l[O]];I.high=f,I.low=p}var E=d[0],T=r[0];for(E.high=T.high,E.low=T.low,h=0;h<5;h++)for(g=0;g<5;g++){var R=r[O=h+5*g],k=d[O],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 D=u[a];R.high^=D.high,R.low^=D.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(),O()))}var Q,ee={exports:{}};var te,re={exports:{}};function ne(){return te?re.exports:(te=1,re.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()))}var oe,ie={exports:{}};var se,ae={exports:{}};function ce(){return se?ae.exports:(se=1,ae.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()))}var le,ue={exports:{}};function de(){return le?ue.exports:(le=1,ue.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()))}var he,fe={exports:{}};function pe(){return he?fe.exports:(he=1,fe.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()))}var ge,ye={exports:{}};function ve(){return ge?ye.exports:(ge=1,ye.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()))}var me,be={exports:{}};function we(){return me?be.exports:(me=1,be.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}(v(),ue()))}var we,Oe={exports:{}};function Ce(){return we?Oe.exports:(we=1,Oe.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}(v(),ue()))}var Se,_e={exports:{}};var Ie,Ee={exports:{}};var Te,Re={exports:{}};var ke,Ae={exports:{}};var Ne,De={exports:{}};var xe,Me={exports:{}};var Le,Ue={exports:{}};var Be,je={exports:{}};var Pe,Fe={exports:{}};function Ge(){return Pe?Fe.exports:(Pe=1,Fe.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}(v(),k(),L(),ae(),ue()))}var qe,He={exports:{}};var Ke,ze={exports:{}};var Ve,We={exports:{}};var $e=p.exports=function(e){return e}(v(),w(),S(),E(),k(),D(),L(),j(),G(),q||(q=1,H.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}(v(),G())),V(),W||(W=1,$.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}(v(),w(),V())),X(),Y||(Y=1,Q.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()))}var Oe,Ce={exports:{}};function Se(){return Oe?Ce.exports:(Oe=1,Ce.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()))}var _e,Ie={exports:{}};var Ee,Te={exports:{}};var Re,ke={exports:{}};var Ne,Ae={exports:{}};var De,xe={exports:{}};var Me,Le={exports:{}};var Ue,Be={exports:{}};var je,Pe={exports:{}};var Fe,Ge={exports:{}};function qe(){return Fe?Ge.exports:(Fe=1,Ge.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(),U(),ce(),de()))}var He,Ke={exports:{}};var ze,Ve={exports:{}};var We,$e={exports:{}};var Je=g.exports=function(e){return e}(m(),O(),_(),T(),N(),x(),U(),P(),q(),H||(H=1,K.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())),W(),$||($=1,J.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(),O(),W())),Y(),Q||(Q=1,ee.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,w,O,C,S,_,I,E,T,R=this._hash.words,k=d.words,A=h.words,N=a.words,D=c.words,x=l.words,M=u.words;for(C=i=R[0],S=s=R[1],_=f=R[2],I=w=R[3],E=O=R[4],r=0;r<80;r+=1)T=i+e[t+N[r]]|0,T+=r<16?p(s,f,w)+k[0]:r<32?g(s,f,w)+k[1]:r<48?y(s,f,w)+k[2]:r<64?v(s,f,w)+k[3]:m(s,f,w)+k[4],T=(T=b(T|=0,x[r]))+O|0,i=O,O=w,w=b(f,10),f=s,s=T,T=C+e[t+D[r]]|0,T+=r<16?m(S,_,I)+A[0]:r<32?v(S,_,I)+A[1]:r<48?y(S,_,I)+A[2]:r<64?g(S,_,I)+A[3]:p(S,_,I)+A[4],T=(T=b(T|=0,M[r]))+E|0,C=E,E=I,I=b(_,10),_=S,S=T;T=R[1]+f+I|0,R[1]=R[2]+w+E|0,R[2]=R[3]+O+C|0,R[3]=R[4]+i+S|0,R[4]=R[0]+s+_|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}(v())),re(),ne||(ne=1,oe.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}(v(),j(),re())),ae(),ue(),fe(),ye(),be(),Ce(),Se||(Se=1,_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}(v(),ue())),Ie||(Ie=1,Ee.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}(v(),ue())),Te||(Te=1,Re.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}(v(),ue())),ke||(ke=1,Ae.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}(v(),ue())),Ne||(Ne=1,De.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}(v(),ue())),xe||(xe=1,Me.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(v(),ue())),Le||(Le=1,Ue.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}(v(),ue())),Be||(Be=1,je.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}(v(),k(),L(),ae(),ue())),Ge(),qe||(qe=1,He.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}(v(),k(),L(),ae(),ue())),Ke||(Ke=1,ze.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}(v(),k(),L(),ae(),ue())),Ve||(Ve=1,We.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}(v(),k(),L(),ae(),ue())));function Je(e){return Object.prototype.toString.call(e).slice(8,-1)}const Ze=e=>null!=e,Xe=e=>"number"==typeof e&&!isNaN(e),Ye=e=>"boolean"==typeof e,Qe=e=>void 0===e||"Undefined"===Je(e),et=e=>"function"==typeof e,tt=e=>null!==e&&"object"==typeof e;function rt(e){return"array"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function nt(e){return"string"===Object.prototype.toString.call(e).slice(8,-1).toLocaleLowerCase()}function ot(e){return nt(e)&&e.length>0}function it(e){for(const t in e)return!0;return!1}const st=e=>tt(e)&&et(e.then)&&et(e.catch);const at=e=>Object.keys(e),ct=e=>{const t={};return Object.keys(e).forEach((r=>{const n=e[r];Ze(n)&&(t[r]=tt(n)?ct(n):n)})),t},lt=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))}},ut=$e.enc.Utf8.parse("skdjhfgc9829kslf"),dt=$e.enc.Utf8.parse("qwdkshjf9838jsdf"),ht={get:function(e){let t=localStorage.getItem(e);if(!Ze(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){Ze(t)?localStorage.setItem(e,JSON.stringify(t)):this.remove(e)},remove:function(e){localStorage.removeItem(e)}},ft={get:function(e){let t=localStorage.getItem(e);if(Ze(t)){const e=$e.enc.Hex.parse(t),r=$e.enc.Base64.stringify(e);t=$e.AES.decrypt(r,ut,{iv:dt}).toString($e.enc.Utf8)}if(!Ze(t))return t;try{return t=JSON.parse(t),t}catch{return t}},set:function(e,t){if(Ze(t)){const r=$e.AES.encrypt(JSON.stringify(t),ut,{iv:dt}).ciphertext.toString();localStorage.setItem(e,r)}else this.remove(e)},remove:function(e){localStorage.removeItem(e)}};class pt{constructor(e){d(this,"cache",void 0),d(this,"storageKey",void 0),d(this,"saveFunc",void 0);const t=e?`ACIM-${e}`:"ACIM-",r=ht.get(t)||{};this.cache=r,this.storageKey=t,this.saveFunc=lt((()=>{ht.set(this.storageKey,this.cache)}),10)}set(e,t){this.cache[e]=t,this.saveFunc()}remove(e){delete this.cache[e],this.saveFunc()}clear(){ht.remove(this.storageKey),this.cache={}}get(e){return this.cache[e]}getCache(){return this.cache||{}}}const gt=ft.get("ACIM-slf")===(new Date).getDate();const yt={[l.DEBUG]:console.debug.bind(console),[l.INFO]:console.info.bind(console),[l.WARN]:console.warn.bind(console),[l.ERROR]:console.error.bind(console),[l.FATAL]:console.log.bind(console),[l.NONE]:null},vt=e=>nt(e)||Xe(e)||Qe(e)||Ye(e)?e:e instanceof Error?JSON.stringify({name:e.name,message:e.message,stack:e.stack}):JSON.stringify(e),mt=new class{constructor(e){d(this,"debug",void 0),d(this,"info",void 0),d(this,"warn",void 0),d(this,"error",void 0),d(this,"fatal",void 0),d(this,"outLevel",l.WARN),d(this,"tag",void 0),d(this,"logStdout",void 0),this.tag=e,this.debug=this.log.bind(this,l.DEBUG),this.info=this.log.bind(this,l.INFO),this.warn=this.log.bind(this,l.WARN),this.error=this.log.bind(this,l.ERROR),this.fatal=this.log.bind(this,l.FATAL)}defaultStdout(e,t){const r=yt[e];if(Ze(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(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(gt){const t=`${(new Date).toISOString()}[${this.tag}][${l[e]}]`;return void this.defaultStdout(e,t,...r)}if(e<this.outLevel)return;const o=`${(new Date).toISOString()}[${this.tag}][${l[e]}]`,i=`${o} - ${r.map(vt).join(" ")}`;this.logStdout?this.logStdout(e,i):this.defaultStdout(e,o,...r)}}("ACLog"),bt=ot,wt=Xe,Ot=Ye,Ct=rt,St=e=>Xe(e)&&Object.prototype.hasOwnProperty.call(n,e),_t=e=>{if(!tt(e))return!1;const{conversationType:t,targetId:r,channelId:o}=e;return Xe(t)&&Object.prototype.hasOwnProperty.call(n,t)&&(Xe(r)||ot(r))&&(!Ze(o)||nt(o)&&!/_/g.test(o)&&o.length<=20)};class It extends Error{constructor(e){super(e),this.name="ACAssertError"}}const Et=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!Tt(e,t,r,n))throw new It(`'${e}' is invalid: ${JSON.stringify(t)}`)},Tt=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=n&&!r(t)||!n&&Ze(t)&&!r(t);return o&&mt.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};let Rt=class{constructor(){d(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 kt;!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"}(kt||(kt={}));var At=kt;var Nt={exports:{}},Dt={},xt={},Mt=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 Lt={};!function(e){var t=Lt;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)}}();var Ut=Bt;function Bt(){this._listeners={}}Bt.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},Bt.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},Bt.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 jt=Pt(Pt);function Pt(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,Ft),e.writeFloatBE=t.bind(null,Gt),e.readFloatLE=r.bind(null,qt),e.readFloatBE=r.bind(null,Ht)}(),"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,Ft,0,4),e.writeDoubleBE=t.bind(null,Gt,4,0),e.readDoubleLE=r.bind(null,qt,0,4),e.readDoubleBE=r.bind(null,Ht,4,0)}(),e}function Ft(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 Gt(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 qt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Ht(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 zt={};!function(e){var t=zt;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}}();var Vt,Wt,$t,Jt=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 Zt(){return $t||($t=1,function(e){var t=xt;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=Mt,t.base64=Lt,t.EventEmitter=Ut,t.float=jt,t.inquire=Kt,t.utf8=zt,t.pool=Jt,t.LongBits=function(){if(Wt)return Vt;Wt=1,Vt=t;var e=Zt();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},Vt}(),t.isNode=Boolean(void 0!==h&&h&&h.process&&h.process.versions&&h.process.versions.node),t.global=t.isNode&&h||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||h,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}var Xt,Yt=sr,Qt=Zt(),er=Qt.LongBits,tr=Qt.base64,rr=Qt.utf8;function nr(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function or(){}function ir(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function sr(){this.len=0,this.head=new nr(or,0,0),this.tail=this.head,this.states=null}var ar=function(){return Qt.Buffer?function(){return(sr.create=function(){return new Xt})()}:function(){return new sr}};function cr(e,t,r){t[r]=255&e}function lr(e,t){this.len=e,this.next=void 0,this.val=t}function ur(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 dr(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}sr.create=ar(),sr.alloc=function(e){return new Qt.Array(e)},Qt.Array!==Array&&(sr.alloc=Qt.pool(sr.alloc,Qt.Array.prototype.subarray)),sr.prototype._push=function(e,t,r){return this.tail=this.tail.next=new nr(e,t,r),this.len+=t,this},lr.prototype=Object.create(nr.prototype),lr.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},sr.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new lr((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},sr.prototype.int32=function(e){return e<0?this._push(ur,10,er.fromNumber(e)):this.uint32(e)},sr.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},sr.prototype.uint64=function(e){var t=er.from(e);return this._push(ur,t.length(),t)},sr.prototype.int64=sr.prototype.uint64,sr.prototype.sint64=function(e){var t=er.from(e).zzEncode();return this._push(ur,t.length(),t)},sr.prototype.bool=function(e){return this._push(cr,1,e?1:0)},sr.prototype.fixed32=function(e){return this._push(dr,4,e>>>0)},sr.prototype.sfixed32=sr.prototype.fixed32,sr.prototype.fixed64=function(e){var t=er.from(e);return this._push(dr,4,t.lo)._push(dr,4,t.hi)},sr.prototype.sfixed64=sr.prototype.fixed64,sr.prototype.float=function(e){return this._push(Qt.float.writeFloatLE,4,e)},sr.prototype.double=function(e){return this._push(Qt.float.writeDoubleLE,8,e)};var hr=Qt.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]};sr.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(cr,1,0);if(Qt.isString(e)){var r=sr.alloc(t=tr.length(e));tr.decode(e,r,0),e=r}return this.uint32(t)._push(hr,t,e)},sr.prototype.string=function(e){var t=rr.length(e);return t?this.uint32(t)._push(rr.write,t,e):this._push(cr,1,0)},sr.prototype.fork=function(){return this.states=new ir(this),this.head=this.tail=new nr(or,0,0),this.len=0,this},sr.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 nr(or,0,0),this.len=0),this},sr.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},sr.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},sr._configure=function(e){Xt=e,sr.create=ar(),Xt._configure()};var fr=yr,pr=Yt;(yr.prototype=Object.create(pr.prototype)).constructor=yr;var gr=Zt();function yr(){pr.call(this)}function vr(e,t,r){e.length<40?gr.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}yr._configure=function(){yr.alloc=gr._Buffer_allocUnsafe,yr.writeBytesBuffer=gr.Buffer&&gr.Buffer.prototype instanceof Uint8Array&&"set"===gr.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++]}},yr.prototype.bytes=function(e){gr.isString(e)&&(e=gr._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(yr.writeBytesBuffer,t,e),this},yr.prototype.string=function(e){var t=gr.Buffer.byteLength(e);return this.uint32(t),t&&this._push(vr,t,e),this},yr._configure();var mr,br=_r,wr=Zt(),Or=wr.LongBits,Cr=wr.utf8;function Sr(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,Er="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")},Tr=function(){return wr.Buffer?function(e){return(_r.create=function(e){return wr.Buffer.isBuffer(e)?new mr(e):Er(e)})(e)}:Er};function Rr(){var e=new Or(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw Sr(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 Sr(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 kr(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 Sr(this,8);return new Or(kr(this.buf,this.pos+=4),kr(this.buf,this.pos+=4))}_r.create=Tr(),_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,Sr(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 Sr(this,4);return kr(this.buf,this.pos+=4)},_r.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Sr(this,4);return 0|kr(this.buf,this.pos+=4)},_r.prototype.float=function(){if(this.pos+4>this.len)throw Sr(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 Sr(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 Sr(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 Cr.read(e,0,e.length)},_r.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw Sr(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw Sr(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){mr=e,_r.create=Tr(),mr._configure();var t=wr.Long?"toLong":"toNumber";wr.merge(_r.prototype,{int64:function(){return Rr.call(this)[t](!1)},uint64:function(){return Rr.call(this)[t](!0)},sint64:function(){return Rr.call(this).zzDecode()[t](!1)},fixed64:function(){return Ar.call(this)[t](!0)},sfixed64:function(){return Ar.call(this)[t](!1)}})};var Nr=Mr,Dr=br;(Mr.prototype=Object.create(Dr.prototype)).constructor=Mr;var xr=Zt();function Mr(e){Dr.call(this,e)}Mr._configure=function(){xr.Buffer&&(Mr.prototype._slice=xr.Buffer.prototype.slice)},Mr.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))},Mr._configure();var Lr,Ur={},Br=Pr,jr=Zt();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},Lr=Ur,Lr.Service=Br;var Fr={};!function(e){var t=Dt;function r(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=Yt,t.BufferWriter=fr,t.Reader=br,t.BufferReader=Nr,t.util=Zt(),t.rpc=Ur,t.roots=Fr,t.configure=r,r()}(),Nt.exports=Dt;const Gr=Nt.exports.Writer,qr=Nt.exports.util,Hr=Nt.exports.roots.default||(Nt.exports.roots.default={}),Kr=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})(),zr=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=Nt.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(){d(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){d(this,"pool",void 0),d(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=e=>{let r;switch(e){case 0:r=t.SUCCESS;break;case 1610743809:r=t.NOT_IN_GROUP;break;case 1610678275:r=t.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=t.REJECTED_BY_BLACKLIST;break;case 3:r=t.PARAMETER_ERROR;break;case 22408:r=t.FORBIDDEN_IN_GROUP;break;default:r=t.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,w,O,C,S,_,I,E,T,R=this._hash.words,k=d.words,N=h.words,A=a.words,D=c.words,x=l.words,M=u.words;for(C=i=R[0],S=s=R[1],_=f=R[2],I=w=R[3],E=O=R[4],r=0;r<80;r+=1)T=i+e[t+A[r]]|0,T+=r<16?p(s,f,w)+k[0]:r<32?g(s,f,w)+k[1]:r<48?y(s,f,w)+k[2]:r<64?v(s,f,w)+k[3]:m(s,f,w)+k[4],T=(T=b(T|=0,x[r]))+O|0,i=O,O=w,w=b(f,10),f=s,s=T,T=C+e[t+D[r]]|0,T+=r<16?m(S,_,I)+N[0]:r<32?v(S,_,I)+N[1]:r<48?y(S,_,I)+N[2]:r<64?g(S,_,I)+N[3]:p(S,_,I)+N[4],T=(T=b(T|=0,M[r]))+E|0,C=E,E=I,I=b(_,10),_=S,S=T;T=R[1]+f+I|0,R[1]=R[2]+w+E|0,R[2]=R[3]+O+C|0,R[3]=R[4]+i+S|0,R[4]=R[0]+s+_|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())),ne(),oe||(oe=1,ie.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())),ce(),de(),pe(),ve(),we(),Se(),_e||(_e=1,Ie.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())),Ee||(Ee=1,Te.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())),Re||(Re=1,ke.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())),Ne||(Ne=1,Ae.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())),De||(De=1,xe.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||(Me=1,Le.exports=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding}(m(),de())),Ue||(Ue=1,Be.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())),je||(je=1,Pe.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(),U(),ce(),de())),qe(),He||(He=1,Ke.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(),U(),ce(),de())),ze||(ze=1,Ve.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(),U(),ce(),de())),We||(We=1,$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(),U(),ce(),de())));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)}};class gt{constructor(e){h(this,"cache",void 0),h(this,"storageKey",void 0),h(this,"saveFunc",void 0);const t=e?`ACIM-${e}`:"ACIM-",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 yt=pt.get("ACIM-slf")===(new Date).getDate();const vt={[u.DEBUG]:console.debug.bind(console),[u.INFO]:console.info.bind(console),[u.WARN]:console.warn.bind(console),[u.ERROR]:console.error.bind(console),[u.FATAL]:console.log.bind(console),[u.NONE]:null},mt=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),bt=new class{constructor(e){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",u.WARN),h(this,"tag",void 0),h(this,"logStdout",void 0),this.tag=e,this.debug=this.log.bind(this,u.DEBUG),this.info=this.log.bind(this,u.INFO),this.warn=this.log.bind(this,u.WARN),this.error=this.log.bind(this,u.ERROR),this.fatal=this.log.bind(this,u.FATAL)}defaultStdout(e,t){const r=vt[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(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(yt){const t=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`;return void this.defaultStdout(e,t,...r)}if(e<this.outLevel)return;const o=`${(new Date).toISOString()}[${this.tag}][${u[e]}]`,i=`${o} - ${r.map(mt).join(" ")}`;this.logStdout?this.logStdout(e,i):this.defaultStdout(e,o,...r)}}("ACLog"),wt=it,Ot=Ye,Ct=Qe,St=nt,_t=e=>Ye(e)&&Object.prototype.hasOwnProperty.call(n,e),It=e=>{if(!rt(e))return!1;const{conversationType:t,targetId:r,channelId:o}=e;return Ye(t)&&Object.prototype.hasOwnProperty.call(n,t)&&(Ye(r)||it(r))&&(!Xe(o)||ot(o)&&!/_/g.test(o)&&o.length<=20)};class Et extends Error{constructor(e){super(e),this.name="ACAssertError"}}const Tt=function(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!Rt(e,t,r,n))throw new Et(`'${e}' is invalid: ${JSON.stringify(t)}`)},Rt=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&&bt.error(`'${e}' is invalid: ${JSON.stringify(t)}`),!o};let kt=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 Nt;!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"}(Nt||(Nt={}));var At=Nt;var Dt={exports:{}},xt={},Mt={},Lt=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=Ut;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)}}();var Bt=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,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,Gt,0,4),e.writeDoubleBE=t.bind(null,qt,4,0),e.readDoubleLE=r.bind(null,Ht,0,4),e.readDoubleBE=r.bind(null,Kt,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 Kt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var zt=function(e){try{var t=void 0;t}catch(e){}return null};var Vt={};!function(e){var t=Vt;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}}();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=Mt;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=Lt,t.base64=Ut,t.EventEmitter=Bt,t.float=Pt,t.inquire=zt,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}}()),Mt}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,wr=Ir,Or=Xt(),Cr=Or.LongBits,Sr=Or.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 Er,Tr="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")},Rr=function(){return Or.Buffer?function(e){return(Ir.create=function(e){return Or.Buffer.isBuffer(e)?new br(e):Tr(e)})(e)}:Tr};function kr(){var e=new Cr(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 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 _r(this,8);return new Cr(Nr(this.buf,this.pos+=4),Nr(this.buf,this.pos+=4))}Ir.create=Rr(),Ir.prototype._slice=Or.Array.prototype.subarray||Or.Array.prototype.slice,Ir.prototype.uint32=(Er=4294967295,function(){if(Er=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return Er;if(Er=(Er|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return Er;if(Er=(Er|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return Er;if(Er=(Er|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return Er;if(Er=(Er|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return Er;if((this.pos+=5)>this.len)throw this.pos=this.len,_r(this,10);return Er}),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 Nr(this.buf,this.pos+=4)},Ir.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _r(this,4);return 0|Nr(this.buf,this.pos+=4)},Ir.prototype.float=function(){if(this.pos+4>this.len)throw _r(this,4);var e=Or.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=Or.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 Sr.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){br=e,Ir.create=Rr(),br._configure();var t=Or.Long?"toLong":"toNumber";Or.merge(Ir.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 Dr=Lr,xr=wr;(Lr.prototype=Object.create(xr.prototype)).constructor=Lr;var Mr=Xt();function Lr(e){xr.call(this,e)}Lr._configure=function(){Mr.Buffer&&(Lr.prototype._slice=Mr.Buffer.prototype.slice)},Lr.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))},Lr._configure();var Ur,Br={},jr=Fr,Pr=Xt();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},Ur=Br,Ur.Service=jr;var Gr={};!function(e){var t=xt;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=wr,t.BufferReader=Dr,t.util=Xt(),t.rpc=Br,t.roots=Gr,t.configure=r,r()}(),Dt.exports=xt;const qr=Dt.exports.Writer,Hr=Dt.exports.util,Kr=Dt.exports.roots.default||(Dt.exports.roots.default={}),zr=Kr.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=Kr.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=Kr.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})();Kr.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=Dt.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=e=>{let r;switch(e){case 0:r=t.SUCCESS;break;case 1610743809:r=t.NOT_IN_GROUP;break;case 1610678275:r=t.RC_MSG_CONTENT_EXCEED_LIMIT;break;case 1610678276:r=t.REJECTED_BY_BLACKLIST;break;case 3:r=t.PARAMETER_ERROR;break;case 22408:r=t.FORBIDDEN_IN_GROUP;break;default:r=t.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 _n}else{if(e<=-yn)return In;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 wn=cn(1);rn.ONE=wn;var On=cn(1,!0);rn.UONE=On;var Cn=cn(-1);rn.NEG_ONE=Cn;var Sn=un(-1,2147483647,!1);rn.MAX_VALUE=Sn;var _n=un(-1,-1,!0);rn.MAX_UNSIGNED_VALUE=_n;var In=un(0,-2147483648,!1);rn.MIN_VALUE=In;var En=rn.prototype;En.toInt=function(){return this.unsigned?this.low>>>0:this.low},En.toNumber=function(){return this.unsigned?(this.high>>>0)*pn+(this.low>>>0):this.high*pn+(this.low>>>0)},En.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=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}},En.getHighBits=function(){return this.high},En.getHighBitsUnsigned=function(){return this.high>>>0},En.getLowBits=function(){return this.low},En.getLowBitsUnsigned=function(){return this.low>>>0},En.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},En.isZero=function(){return 0===this.high&&0===this.low},En.eqz=En.isZero,En.isNegative=function(){return!this.unsigned&&this.high<0},En.isPositive=function(){return this.unsigned||this.high>=0},En.isOdd=function(){return 1==(1&this.low)},En.isEven=function(){return 0==(1&this.low)},En.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)},En.eq=En.equals,En.notEquals=function(e){return!this.eq(e)},En.neq=En.notEquals,En.ne=En.notEquals,En.lessThan=function(e){return this.comp(e)<0},En.lt=En.lessThan,En.lessThanOrEqual=function(e){return this.comp(e)<=0},En.lte=En.lessThanOrEqual,En.le=En.lessThanOrEqual,En.greaterThan=function(e){return this.comp(e)>0},En.gt=En.greaterThan,En.greaterThanOrEqual=function(e){return this.comp(e)>=0},En.gte=En.greaterThanOrEqual,En.ge=En.greaterThanOrEqual,En.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},En.comp=En.compare,En.negate=function(){return!this.unsigned&&this.eq(In)?In:this.not().add(wn)},En.neg=En.negate,En.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)},En.subtract=function(e){return nn(e)||(e=fn(e)),this.add(e.neg())},En.sub=En.subtract,En.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(In))return e.isOdd()?In:mn;if(e.eq(In))return this.isOdd()?In: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)},En.mul=En.multiply,En.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 On;n=bn}else{if(this.eq(In))return e.eq(wn)||e.eq(Cn)?In:e.eq(In)?wn:(t=this.shr(1).div(e).shl(1)).eq(mn)?e.isNegative()?wn:Cn:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(In))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=wn),n=n.add(s),r=r.sub(a)}return n},En.div=En.divide,En.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))},En.mod=En.modulo,En.rem=En.modulo,En.not=function(){return un(~this.low,~this.high,this.unsigned)},En.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},En.clz=En.countLeadingZeros,En.countTrailingZeros=function(){return this.low?on(this.low):on(this.high)+32},En.ctz=En.countTrailingZeros,En.and=function(e){return nn(e)||(e=fn(e)),un(this.low&e.low,this.high&e.high,this.unsigned)},En.or=function(e){return nn(e)||(e=fn(e)),un(this.low|e.low,this.high|e.high,this.unsigned)},En.xor=function(e){return nn(e)||(e=fn(e)),un(this.low^e.low,this.high^e.high,this.unsigned)},En.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)},En.shl=En.shiftLeft,En.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)},En.shr=En.shiftRight,En.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)},En.shru=En.shiftRightUnsigned,En.shr_u=En.shiftRightUnsigned,En.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))},En.rotl=En.rotateLeft,En.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))},En.rotr=En.rotateRight,En.toSigned=function(){return this.unsigned?un(this.low,this.high,!1):this},En.toUnsigned=function(){return this.unsigned?this:un(this.low,this.high,!0)},En.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},En.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]},En.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[t],kn=()=>{const e="ACDeviceId";let t="";const r=ft.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)})),ft.set(e,t)),t},An=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},Nn=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 Dn=new class{constructor(t){d(this,"url",""),d(this,"watcher",void 0),d(this,"provider",void 0),d(this,"options",void 0),d(this,"socket",void 0),d(this,"status",e.DISCONNECTED),d(this,"autoReconnect",!1),d(this,"isAuthorized",!1),d(this,"profile",void 0),d(this,"responseCallbacks",new Map),d(this,"failedCount",0),d(this,"reconnectTimer",void 0),d(this,"token",""),d(this,"connectResolve",void 0),d(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(r){return this.token=r,new Promise((r=>{this.connectResolve=r,this.open().then((e=>e===t.SUCCESS?!Ze(this.provider)||this.provider.needReAuth()?this.auth():t.SUCCESS:e)).then((n=>{var o;(r(n),n===t.SUCCESS)?(this.isAuthorized=!0,this.profile=null===(o=this.provider)||void 0===o?void 0:o.profile(),this.autoReconnect=!0,this.onConnect()):this.onDisconnect(n===t.TIMEOUT?e.NETWORK_UNAVAILABLE:e.WEBSOCKET_UNAVAILABLE)}))}))}async send(e,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(e,Ze(r)&&Ze(n.encoder)?n.encoder.encode(r).finish():new Uint8Array,i);if(0!==s)return{code:s,msg:"time out",data:null};if(!Ze(a)||!Ze(n.decoder))return{code:t.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:t.SUCCESS,msg:""}}async sendRawData(e,r){var n,o,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.signalTimeout;if(!this.socket)return{code:t.RC_NET_CHANNEL_INVALID};if(!this.isAuthorized&&!this.isAuthCommand(e))return{code:t.RC_NET_CHANNEL_INVALID};const a=this.generateMessageSeq(),c={cmdId:e,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};mt.reqInfo(`websocket send -> cmd: 0x${e.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}:(mt.warn(`send timeout -> cmd: 0x${e.toString(16)}, messageSeq: ${a}, timeout: ${s}`),{code:t.TIMEOUT})}close(){var r;this.autoReconnect=!1,this.doClose(),this.setStatus(e.DISCONNECTED),null===(r=this.connectResolve)||void 0===r||r.call(this,t.RC_SOCKET_DISCONNECTED)}async open(){const r=this.url;mt.info(`conenct start -> ${r}`),this.setStatus(e.CONNECTING);const n=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=n;return await new Promise((o=>{n.onMessage((e=>{"ArrayBuffer"===Je(e)?this.onReceiveMessage(e):mt.error("Socket received invalid data:",e)})),n.onClose(((r,n)=>{mt.warn("websocket closed -> code:",r,"reason:",n),this.onDisconnect(e.CONNECTION_CLOSED),o(t.RC_SOCKET_DISCONNECTED)})),n.onError((r=>{mt.error("websocket error -> ",r),this.onDisconnect(e.WEBSOCKET_ERROR),o(t.RC_SOCKET_NOT_CREATED)})),n.onOpen((()=>{mt.info("websocket open -> ",r),o(t.SUCCESS)})),setTimeout((()=>{o(t.TIMEOUT)}),this.options.webSocketTimeout)}))}async auth(){var e,r,n,o;mt.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(At.Auth,i,{encoder:Vr,decoder:Xr.AuthSignIn2TokenResp},8e3);return s===t.SUCCESS||c?(mt.info("auth success -> ",null===(e=c.user)||void 0===e||null===(r=e.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),t.SUCCESS):(mt.warn("auth failed -> "+a),t.RC_CONN_NOT_AUTHRORIZED)}async checkAlive(){if(!this.socket||!this.isAuthorized)return;mt.debug("send ping ->");const r={pingId:rn.ZERO,disconnectDelay:rn.ZERO},{code:n}=await this.send(At.Heartbean,r,{encoder:zr},this.options.pingTimeout);n===t.SUCCESS?(mt.debug("recv pong <-"),this.failedCount=0,setTimeout((()=>this.checkAlive()),this.options.pingInterval)):(this.failedCount+=1,mt.warn(`ping failed count: ${this.failedCount}, code: ${n}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,mt.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=Nn(t);r=Xr.NetworkResponse.decode(e)}catch(t){return mt.error("unpack payload error -> ",t),void this.onDisconnect(e.DISCONNECT_BY_SERVER)}if(r.code)return void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===At.SessionKilledPush)return void this.onDisconnect(e.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===At.SignOutPish||r.cmdId===At.SignOutPish2)return void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===At.UserFrozenToLogin||r.cmdId===At.UserFrozenToLogin2)return void this.onDisconnect(e.BLOCKED);const n=rn.isLong(r.messageSeq)?r.messageSeq.toNumber():0;mt.reqInfo(`websocket recv ack -> messageSeq: ${n}`);const o=this.responseCallbacks.get(n);var i;Ze(o)?(o(r.body),this.responseCallbacks.delete(n)):(mt.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.CONNECTED),this.checkAlive(),Ze(this.reconnectTimer)&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}onDisconnect(e){Ze(this.socket)&&(this.doClose(),this.isConnectionAvailable()&&(this.setStatus(e),this.autoReconnect&&this.isConnectionAvailable()&&this.try2Reconnect()))}doClose(){if(Ze(this.socket)){const e=this.socket;this.socket=null,e.onClose(null),e.close()}Ze(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.DISCONNECTED&&this.status!==e.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.BLOCKED&&this.status!==e.DISCONNECT_BY_SERVER}setStatus(e){var t;e!==this.status&&(mt.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===At.Auth}generateMessageSeq(){return++this.idCount}};var xn=new class{constructor(){d(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;Ze(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:""}}},Mn=Nt.exports,Ln=Mn.Reader,Un=Mn.util,Bn=Mn.roots.default||(Mn.roots.default={});Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Bn.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=Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.DialogMessageList;e.pos<r;){var o=e.uint32();if(o>>>3==1)n.dialogMessage&&n.dialogMessage.length||(n.dialogMessage=[]),n.dialogMessage.push(Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Bn.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=Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Bn.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=Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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=Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.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(Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new Bn.WebFullDialog;e.pos<r;){var o=e.uint32();switch(o>>>3){case 1:n.dialog=Bn.BriefDialog.decode(e,e.uint32());break;case 2:n.msg=Bn.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}(),Bn.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 Ln||(e=Ln.create(e));for(var r,n,o=void 0===t?e.len:e.pos+t,i=new Bn.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=Bn.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=Bn;var Pn=new class{constructor(){d(this,"_token",""),d(this,"_uploadUrl",""),d(this,"_downloadUrl",""),d(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 ot(e)?e.startsWith("http")?e:this.fileDownloadUrl+e:e}try2ExtractFileRelativeUri(e){return ot(e)&&e.startsWith(this.fileDownloadUrl)?e.substring(this.fileDownloadUrl.length):e}};const Fn=e=>{if(!ot(e.targetId+""))return"";switch(e.conversationType){case n.PRIVATE:return"P::"+e.targetId;case n.GROUP:return"G::"+e.targetId;case n.ULTRA_GROUP:return`SG::${e.targetId}_${e.channelId??""}`;default:return""}},Gn=e=>{if(!ot(e))return null;const t=e.split("::");if(2!==t.length)return null;const r=t[0];if("G"===r)return{conversationType:n.GROUP,targetId:t[1]};if("P"===r)return{conversationType:n.PRIVATE,targetId:t[1]};if("SG"===r){const e=t[1].indexOf("_");if(e>0){const r=t[1].substring(0,e),o=t[1].substring(e+1);return{conversationType:n.ULTRA_GROUP,targetId:r,channelId:o}}return 0===e?null:{conversationType:n.ULTRA_GROUP,targetId:t[1]}}return null},qn=e=>e.startsWith("SG")||e.startsWith("G");var Hn=Nt.exports,Kn=Hn.Writer,zn=Hn.util,Vn=Hn.roots.default||(Hn.roots.default={});Vn.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=zn.Long?zn.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=zn.newBuffer([]),e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=Kn.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}(),Vn.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=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=zn.emptyArray,e.encode=function(e,t){if(t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=zn.emptyArray,e.encode=function(e,t){if(t||(t=Kn.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}(),Vn.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=zn.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=zn.Long?zn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=Kn.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}(),Vn.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=zn.Long?zn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Kn.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 Wn=Vn,$n=Nt.exports,Jn=$n.Writer,Zn=$n.util,Xn=$n.roots.default||($n.roots.default={});Xn.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=Zn.Long?Zn.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=Zn.emptyArray,e.prototype.extra="",e.prototype.assign="",e.prototype.atAll=!1,e.prototype.msgContent=Zn.newBuffer([]),e.encode=function(e,t){if(t||(t=Jn.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}(),Xn.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=Jn.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}(),Xn.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=Jn.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}(),Xn.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=Jn.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}(),Xn.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=Zn.Long?Zn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Jn.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}(),Xn.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=Jn.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 Yn=Xn;const Qn=Nt.exports.Reader,eo=Nt.exports.util,to=Nt.exports.roots.default||(Nt.exports.roots.default={}),ro=to.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=eo.Long?eo.Long.fromBits(0,0,!1):0,e.prototype.msgId=eo.Long?eo.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=eo.Long?eo.Long.fromBits(0,0,!1):0,e.prototype.seqno=eo.Long?eo.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Qn||(e=Qn.create(e));let r=void 0===t?e.len:e.pos+t,n=new to.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})();let no=0;const oo=async()=>{const e=(new Date).getTime(),{code:r,data:n}=await Dn.send(At.GetServerTime,null,{decoder:Xr.SystemCurrentTimeMillisResp});if(r===t.SUCCESS){const{currentTimeMillis:t}=n;no=t.toNumber()-e}},io=()=>(new Date).getTime()+no,so=new Set;var ao={addMessage(e){so.add(e)},remove(e){so.delete(e)},has:e=>so.has(e),reset(){so.clear()}};const co=new Set;var lo={addMessage(e){co.add(e)},remove(e){co.delete(e)},has:e=>co.has(e),reset(){co.clear()}};const uo=new Map;function ho(e){uo.set(e.getObjectId(),e.decode.bind(e))}class fo{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];d(this,"messageType",void 0),d(this,"content",void 0),d(this,"isPersited",void 0),d(this,"isCounted",void 0),d(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 po=0,go=268439552,yo=268439563,vo=268439562,mo=268439553,bo=268439581,wo=268439597,Oo=268439613,Co=268439629,So=1610678301,_o=268439645,Io="RC:TxtMsg",Eo="RC:HQVCMsg",To="RC:FileMsg",Ro="RC:ImgMsg",ko="RC:GIFMsg",Ao="RC:RcNtf",No="RC:CmdMsg";class Do extends fo{constructor(e){super(Io,e)}static getObjectId(){return po}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 xo extends fo{constructor(e){super(Ro,e)}static getObjectId(){return go}static decode(e){const{user:t,extra:r,thumbnailObjectKey:n,originalObjectKey:o,width:i,height:s}=e;return new xo({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 Mo extends fo{constructor(e){super(ko,e)}static getObjectId(){return yo}static decode(e){const{user:t,extra:r,size:n,originalObjectKey:o,width:i,height:s}=e;return new Mo({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 Lo extends fo{constructor(e){super(Eo,e)}static getObjectId(){return mo}static decode(e){const{user:t,extra:r,length:n,audioObjectKey:o,extension:i}=e;return new Lo({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 Uo extends fo{constructor(e){super(To,e)}static getObjectId(){return vo}static decode(e){const{user:t,extra:r,title:n,extension:o,size:i,originalObjectKey:s}=e;return new Uo({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 Bo extends fo{constructor(e){super(Ao,e,!0,!1,!1)}static getObjectId(){return So}static decode(e){return new Bo(e)}encode(){return this.content}}class jo extends fo{constructor(e){super(No,e,!1,!1)}static getObjectId(){return _o}static decode(e){return new jo(e)}encode(){return this.content}}class Po extends fo{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 Fo extends Po{constructor(e,t){super(e,t,!1,!1)}static getObjectId(){return bo}}class Go extends Po{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return wo}}class qo extends Po{constructor(e,t){super(e,t,!0,!0)}static getObjectId(){return Oo}}class Ho extends Po{constructor(e,t){super(e,t,!1,!1,!0)}static getObjectId(){return Co}}var Ko=new class{constructor(){d(this,"aesKeyRecord",new Map)}async getDialogAesKey(e){return ot(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(!ot(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(e){if(!e.length)return new Map;const{code:r,data:n}=await(o=e,Dn.send(At.GetDialogKey,{destId:o,clientSign:""},{encoder:Wn.GetDialogKeyReq,decoder:jn.GetDialogKeyResp}));var o;if(r===t.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 ot(e)?this.aesKeyRecord.get(e):null}};const zo="time",Vo=(e,t)=>[e,t,zo].join("_");class Wo{constructor(e,t){d(this,"appkey",void 0),d(this,"userId",void 0),d(this,"inBoxOffset",rn.ZERO),this.appkey=e,this.userId=t}setInboxOffset(e){if(this.inBoxOffset>e)return;this.inBoxOffset=e;const t=Vo(this.appkey,this.userId);ft.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=Vo(this.appkey,this.userId);this.inBoxOffset=rn.fromString(ft.get(e)??"0")}return this.inBoxOffset}}const $o=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 Jo=(e,t,r)=>{const n={};return e.forEach((e=>{const o=Zo(e,t.get(e),r.get(e));o.length&&(n[e]=o)})),n},Zo=(e,t,r)=>{const n=Gn(e);if(!n)return[];const o=new Set;let i=[];return t.forEach((e=>{const t=e;let c=t.mediaConstructor,l=Xo(t,r);if(!l)return;if(1610678290===c||1610743841===c){const{msgId:e,sendTime:r}=l,i={sentTime:r,messageUId:e,conversationType:n.conversationType,targetId:t.isOut?n.targetId:xn.uid,channelId:n.channelId};c=So,l=i,o.add(e)}const u=function(e,t){const r=uo.get(e);return r?r(t):null}(c,l);if(Ze(u)){const e={...n,senderUserId:t.srcId.toString(),messageDirection:t.isOut?s.SEND:s.RECEIVE,isCounted:u.isCounted,isMentioned:t.atFlag,content:u.content,messageType:u.messageType,isOffLineMessage:!1,isPersited:u.isPersited,messageId:rn.isLong(t.localId)?t.localId.toNumber():void 0,messageUId:t.msgId.toString(),sentTime:t.seqno.toNumber(),receivedTime:io(),isStatusMessage:u.isStatusMessage,receivedStatus:a.READ,disableNotification:!1};if(e.isStatusMessage&&io()-e.sentTime>6e3)return;i.push(e)}})),o.size&&(i=i.filter((e=>!o.has(e.messageUId)))),i},Xo=(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 $e.AES.decrypt(r,$e.enc.Utf8.parse(t.key),{iv:Ze(t.iv)?$e.enc.Utf8.parse(t.iv):void 0}).toString($e.enc.Utf8)})(e.msgContent,t):e.msgPreContent??"",1610678290!==e.mediaConstructor&&1610743841!==e.mediaConstructor||(o=Yo(o));let i={};return null!==(n=o)&&void 0!==n&&n.length&&(i=JSON.parse(o)),i}catch(t){return mt.error("decode message content fail -> uid:",e.msgId.toString()),null}},Yo=e=>e.replace(/("msgId")\s*:\s*(\d+)/g,((e,t,r)=>`${t}:"${r}"`));var Qo={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());Ko.getDialogAesKeyListInBatches([...r.keys()],((e,o)=>{if(o.size){const e=[...o.keys()];for(const t of e)n.delete(t);t(!n.size,Jo(e,r,o))}n.size&&e&&t(!0,{})}))},parseSingleDialogMessages:Zo};function ei(e){if(!Ze(e))return e;if(Array.isArray(e))return e.map((e=>ei(e)));if(tt(e)){const t={};return Object.keys(e).forEach((r=>{t[r]=ei(e[r])})),t}return e}const ti={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 ri{constructor(e,t){d(this,"localStore",void 0);const r=`con-${e}-${t}`;this.localStore=new pt(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}getConOptionByKey(e){const t=(e=e||"").split("_");if(t.length>=2){const e=t.shift(),r=t.shift(),n=t.join("_");return{conversationType:Number(e),targetId:r,channelId:n}}return{conversationType:n.PRIVATE,targetId:"",channelId:""}}updateUnreadCount(e){const{conversationType:t,targetId:r,channelId:n,content:o,messageType:i,sentTime:a,isCounted:c,messageDirection:l}=e,u=l===s.SEND,d=i===Ao,h=tt(o),f={conversationType:t,targetId:r,channelId:n},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){o.sentTime>=g&&y&&(p.unreadMessageCount=y-1)}this.set(f,p)}}updateMentionedData(e){const{conversationType:t,targetId:r,channelId:o,messageUId:i,messageType:a,isMentioned:c,messageDirection:l,content:u}=e;if(l===s.SEND||!c&&a!==Ao)return;const d=this.getStoreKey({conversationType:t,targetId:r,channelId:o}),h=this.localStore.get(d)||{},f=ti.mentionedUIds.keyName,p=h[f]||[];if(c&&t===n.GROUP&&(p.includes(i)||p.push(i)),a===Ao&&t===n.GROUP){const e=u,t=p.indexOf(e.messageUId);t>=0&&p.splice(t,1)}p.length?h[f]=p:delete h[f],it(h)?this.localStore.set(d,h):this.localStore.remove(d)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of at(t)){const r=ti[e],o=t[e];if(Qe(null==r?void 0:r.keyName)||Qe(o))continue;o===r.defaultVal?delete n[r.keyName]:n[r.keyName]=o,n[ti.unreadMessageCount.keyName]||(delete n[ti.lastUnreadTime.keyName],delete n[ti.mentionedUIds.keyName])}it(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 at(ti)){const{keyName:t,defaultVal:i}=ti[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]||ei(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 at(ti)){const{keyName:t,defaultVal:r}=ti[e];"mentionedUIds"!==e&&(n[e]=o[t]||ei(r))}t.push(n)}return t}}const ni=e=>{const t=e.destId??"",r=Gn(t);if(!r)return;return{...r,unreadMessageCount:0,notificationStatus:e.muteFlag?i.OPEN:i.CLOSE,notificationLevel:Xe(e.pushNotificationLevel)&&0!==e.pushNotificationLevel&&Ze(c[e.pushNotificationLevel])?e.pushNotificationLevel:e.muteFlag?c.AT_USER_NOTIFICATION:c.NOT_SET,isTop:!!e.stickyFlag,lastUnreadTime:0}};class oi{constructor(e,t){d(this,"storageKey",void 0),d(this,"eventEmitter",void 0),d(this,"isPulling",!1),this.storageKey=`con-s-${e}-${t}`,this.eventEmitter=new Rt}async pull(){if(this.isPulling)return;let e;this.isPulling=!0;const r=ft.get(this.storageKey);e=Xe(r)&&r>0?r:io()-1e4;let{code:n,data:o}=await(e=>Dn.send(At.GetDialogChangedStatus,{time:rn.fromNumber(e)},{encoder:Wn.GetNewSettingDialogListReq,decoder:jn.GetNewSettingDialogListResp}))(e);n===t.SUCCESS&&(o.setTime.toNumber()>0&&ft.set(this.storageKey,o.setTime.toNumber()),o.briefDialog&&at(o.briefDialog).forEach((e=>{const t=o.briefDialog[e],r=ni(t);r&&this.eventEmitter.emit("STATUS_CHANGED",r)}))),this.isPulling=!1}watch(e){this.eventEmitter.on("STATUS_CHANGED",(t=>{e(t)}))}}class ii{constructor(e,t,r){d(this,"updatedConversationFunc",void 0),d(this,"store",void 0),d(this,"draftMap",new Map),d(this,"localConversationSet",new Set),d(this,"updatedConversations",[]),d(this,"notify",void 0),d(this,"statusManager",void 0),this.updatedConversationFunc=r,this.store=new ri(e,t),this.notify=lt(this.notifyConversationChanged.bind(this),0),this.statusManager=new oi(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(e){if(null==e||!e.length)return;const r=e.filter((e=>!this.localConversationSet.has(this.getConversationKey(e))));if(!r.length)return;const n=r.map(Fn).filter(ot);if(!n.length)return;const{code:o,data:i}=await(e=>Dn.send(At.GetBriefDialogList,{destId:e},{encoder:Wn.GetBriefDialogListReq,decoder:jn.GetBriefDialogListResp}))(n);o===t.SUCCESS&&at(i.briefDialog).forEach((e=>{const t=i.briefDialog[e],r=ni(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=io(),u=this.store.get(c),d={};Ze(i)&&u.notificationLevel!==i&&(d.notificationLevel={time:l,val:i}),Ze(o)&&u.notificationStatus!==o&&(d.notificationStatus={time:l,val:o}),Ze(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=ei(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(e,t){const r=this.store.getAll();let n=0;return r.forEach((r=>{let{unreadMessageCount:o,notificationStatus:s,notificationLevel:a,conversationType:c}=r;o=o||0;const l=s===i.OPEN||a>0;!t&&l||(e.length>0?e.includes(+c)&&(n+=+o):n+=+o)})),n}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:io()}),n&&(o.hasMentioned={val:!1,time:io()},o.unreadMentionedCount={val:0,time:io()}),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((e=>e.notificationStatus===i.OPEN||e.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 si={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(e){return c.NOT_SET},getNotificationStatus:function(e){return i.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 ai;var ci={create(e,t,r){ai=new ii(e,t,r)},get:()=>ai??si};class li{constructor(e,t){d(this,"watcher",void 0),d(this,"pullingMsg",!1),d(this,"letterbox",void 0),d(this,"serverMsgSeqno",rn.ZERO),d(this,"pullOfflineFinished",!1),d(this,"intervalTimer",void 0),d(this,"retryTimer",void 0),d(this,"latestSyncTimestamp",0),d(this,"started",!1),this.watcher=e,this.letterbox=new Wo(t.appkey,xn.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 e=this.letterbox.getInboxOffset();this.pullOfflineFinished||mt.info(`pullMsg -> time: ${e}`),this.latestSyncTimestamp=Date.now();const{code:r,data:n}=await((e,t)=>Dn.send(At.GetNewMessage,{offset:e,rows:t},{encoder:Wn.GetNewMessageReq,decoder:jn.GetNewMessageResp}))(e,60);if(r!==t.SUCCESS)return this.pullOfflineFinished||mt.warn("pullMsg failed -> code:",r),this.pullingMsg=!1,void this.try2RePullMsg();const{offset:o,seqno:i,msg:a}=n,c=Object.keys(a).map(Gn).filter((e=>Ze(e)));ci.get().loadConvsationsIfNotExist(c),Qo.parse(a,((e,t)=>{const r=[],n=[],a=!this.pullOfflineFinished;var c,l;(Object.keys(t).forEach((e=>{const o=t[e],i=[];if(o.forEach((e=>{e.messageDirection===s.SEND&&e.messageId&&ao.has(e.messageId)?ao.remove(e.messageId):e.messageType===Ao&&lo.has(e.content.messageUId)?lo.remove(e.content.messageUId):(e.isOffLineMessage=a,ci.get().setConversationCacheByMessage(e),i.push(e))})),r.push(...i),this.isExistPersistedMessage(i)){const t=Gn(e);t&&n.push(t)}})),r.length)&&(null===(c=(l=this.watcher).batchMessage)||void 0===c||c.call(l,r));if(n.length&&ci.get().loadConvsationsIfNotExist(n),e){var u;i.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=i);const e=this.serverMsgSeqno.lessThanOrEqual(o);this.pullOfflineFinished||mt.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 ui{static init(e){return this._loader||(this._loader=new ui(e)),this._loader}static get loader(){return this._loader}constructor(t){d(this,"options",void 0),d(this,"connectionStatus",e.DISCONNECTED),d(this,"isInternalConnected",!1),d(this,"watcher",void 0),d(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},Dn.setServerInfo(this.getWebSocketUrl()),Dn.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 ot(t)?nt(r=t)&&/wss?:\/\//.test(r)?t:"ws://"+t:"wss://tt.mimelabs.xyz:8991";var r}registerMessage(){ho(Do),ho(xo),ho(Mo),ho(Lo),ho(Fo),ho(qo),ho(Go),ho(Ho),ho(Bo),ho(jo),ho(Uo)}async connect(r){if(this.connectionStatus===e.CONNECTED)return{code:t.SUCCESS,userId:xn.uid+""};if(this.connectionStatus===e.CONNECTING)return{code:t.BIZ_ERROR_CONNECTING};if("string"!=typeof r||0===r.length)return{code:t.RC_CONN_USER_OR_PASSWD_ERROR};Pn.imInitToken=r;const n=await Dn.connect(r);var o;n===t.SUCCESS&&(this.isInternalConnected=!0,ci.get().destroyed(),ci.create(this.options.appkey,xn.uid,this.watcher.conversationState),null===(o=this.messageLoader)||void 0===o||o.stop(),this.messageLoader=new li(this.watcher,this.options),oo(),ao.reset(),lo.reset(),Ko.reset());return{code:n,userId:xn.uid+""}}reconnect(){return this.isInternalConnected?Promise.resolve({code:t.CAN_NOT_RECONNECT}):this.connect(Pn.imInitToken)}disconnect(){return this.isInternalConnected=!1,Dn.close(),Promise.resolve()}getConnectionStatus(){return this.connectionStatus}assignWatcher(e){at(this.watcher).forEach((t=>{if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t];this.watcher[t]=et(r)?r:void 0}}))}resetWatcher(){at(this.watcher).forEach((e=>{this.watcher[e]=void 0}))}async connectionStatusListener(t){this.connectionStatus=t,setTimeout((()=>{switch(t){case e.BLOCKED:case e.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.CONNECTING:this.handleConnecting();break;case e.CONNECTED:this.handleConnected();break;case e.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.CONNECTED&&ci.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===At.NewMessagePush){var r;const e=jn.NewMessageNotificationResp.decode(t);null===(r=this.messageLoader)||void 0===r||r.syncMsg(e.seqno)}else e===At.DialogChangedPush&&ci.get().syncConversationStatus()}authListener(e){Pn.setFileServerInfo(e.fileDomain,e.dialogFileDomain,e.cert),xn.setLogged(e,Pn.imInitToken)}needReAuthProvider(){return!xn.user.active||xn.user.token!==Pn.imInitToken}needProfileProvider(){if(!this.needReAuthProvider()){const{deviceId:e,sessionId:t,uid:r}=xn.user;return{deviceId:e,sessionId:t,uid:r}}return null}}d(ui,"_loader",void 0);var di,hi,fi,pi,gi={exports:{}},yi={exports:{}},vi={exports:{}},mi={exports:{}};var bi,wi={};var Oi,Ci,Si,_i,Ii,Ei,Ti,Ri,ki,Ai,Ni,Di,xi,Mi={};function Li(){return Oi||(Oi=1,function(e){var t=Mi,r=ps(),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])}()),Mi}function Ui(){if(Si)return Ci;Si=1,Ci=s;var e=gs();((s.prototype=Object.create(e.prototype)).constructor=s).className="Field";var t,r=ys(),n=Li(),o=ps(),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},Ci}function Bi(){if(Ii)return _i;Ii=1,_i=n;var e=gs();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=Ui(),r=ps();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)})}},_i}function ji(){if(Ti)return Ei;Ti=1,Ei=c;var e=gs();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=Ui(),i=ps(),s=Bi();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},Ei}function Pi(){if(ki)return Ri;ki=1,Ri=n;var e=Ui();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=Li(),r=ps();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))}},Ri}function Fi(){if(Ni)return Ai;Ni=1,Ai=r;var e=gs();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=ps();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))},Ai}function Gi(){if(xi)return Di;xi=1,Di=o;var e=ji();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=Fi(),r=ps(),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},Di}var qi,Hi,Ki,zi,Vi=$i,Wi=Zt();function $i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}function Ji(){if(Hi)return qi;Hi=1,qi=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=ys(),t=Li(),r=ps();function n(e){return"missing required '"+e.name+"'"}return qi}function Zi(){if(zi)return Ki;zi=1,Ki=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=ys(),t=ps();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 Ki}$i.create=function(e){return this.$type.create(e)},$i.encode=function(e,t){return this.$type.encode(e,t)},$i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},$i.decode=function(e){return this.$type.decode(e)},$i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},$i.verify=function(e){return this.$type.verify(e)},$i.fromObject=function(e){return this.$type.fromObject(e)},$i.toObject=function(e,t){return this.$type.toObject(e,t)},$i.prototype.toJSON=function(){return this.$type.toObject(this,Wi.toJSONOptions)};var Xi,Yi={};function Qi(){return Xi||(Xi=1,function(e){var t=e,r=ys(),n=ps();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")}}(Yi)),Yi}var es,ts,rs,ns,os,is,ss,as,cs,ls,us,ds={};function hs(){if(ts)return es;ts=1,es=g;var e=ji();((g.prototype=Object.create(e.prototype)).constructor=g).className="Type";var t=ys(),r=Bi(),n=Ui(),o=Pi(),i=Gi(),s=Vi,a=br,c=Yt,l=ps(),u=vs(),d=Ji(),h=Zi(),f=Qi(),p=ds;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)}},es}function fs(){if(ns)return rs;ns=1,rs=c;var e=ji();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=Ui(),i=ys(),s=Bi(),a=ps();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},rs}function ps(){return os||(os=1,function(e){var t,r,n=mi.exports=Zt(),o=Fr;n.codegen=function(){if(hi)return di;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 hi=1,di=e,e.verbose=!1,di}(),n.fetch=function(){if(pi)return fi;pi=1,fi=r;var e=Mt,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()},fi}(),n.path=(bi||(bi=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)}}(wi)),wi),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=hs());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=ys());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(fs()))}})}()),mi.exports}function gs(){if(ss)return is;ss=1,is=r,r.className="ReflectionObject";var e,t=ps();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},is}function ys(){if(cs)return as;cs=1,as=n;var e=gs();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=ji(),r=ps();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)},as}function vs(){if(us)return ls;us=1,ls=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=ys(),t=Li(),r=ps();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 ls}!function(e){var t=Vi;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)}}}(ds),function(e){var t=vi.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=vs(),t.decoder=Ji(),t.verifier=Zi(),t.converter=Qi(),t.ReflectionObject=gs(),t.Namespace=ji(),t.Root=fs(),t.Enum=ys(),t.Type=hs(),t.Field=Ui(),t.OneOf=Bi(),t.MapField=Pi(),t.Service=Gi(),t.Method=Fi(),t.Message=Vi,t.wrappers=ds,t.types=Li(),t.util=ps(),t.ReflectionObject._configure(t.Root),t.Namespace._configure(t.Type,t.Service,t.Enum),t.Root._configure(t.Type),t.Field._configure(t.Type)}();var ms=ks,bs=/[\s{}=;:[\],'"()<>]/g,ws=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,Os=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Cs=/^ *[*/]+ */,Ss=/^\s*\*?\/*/,_s=/\n/g,Is=/\s/,Es=/\\(.?)/g,Ts={0:"\0",r:"\r",n:"\n",t:"\t"};function Rs(e){return e.replace(Es,(function(e,t){switch(t){case"\\":case"":return t;default:return Ts[t]||""}}))}function ks(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(_s),h=0;h<d.length;++h)d[h]=d[h].replace(t?Ss:Cs,"").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?Os:ws;t.lastIndex=r-1;var n=t.exec(e);if(!n)throw l("string");return r=t.lastIndex,g(c),c=null,Rs(n[1])}();var i,s,p,y,v,m=0===r;do{if(r===n)return null;for(i=!1;Is.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(bs.lastIndex=0,!bs.test(u(b++)))for(;b<n&&!bs.test(u(b));)++b;var w=e.substring(r,r=b);return'"'!==w&&"'"!==w||(c=w),w}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}})}ks.unescape=Rs;var As=Ys;Ys.filename=null,Ys.defaults={keepCase:!1};var Ns=ms,Ds=fs(),xs=hs(),Ms=Ui(),Ls=Pi(),Us=Bi(),Bs=ys(),js=Gi(),Ps=Fi(),Fs=Li(),Gs=ps(),qs=/^[1-9][0-9]*$/,Hs=/^-?[1-9][0-9]*$/,Ks=/^0[x][0-9a-fA-F]+$/,zs=/^-?0[x][0-9a-fA-F]+$/,Vs=/^0[0-7]+$/,Ws=/^-?0[0-7]+$/,$s=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,Js=/^[a-zA-Z_][a-zA-Z_0-9]*$/,Zs=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,Xs=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function Ys(e,t,r){t instanceof Ds||(r=t,t=new Ds),r||(r=Ys.defaults);var n,o,i,s,a,c=r.preferTrailingComment||!1,l=Ns(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}:Gs.camelCase;function b(e,t,r){var n=Ys.filename;return r||(Ys.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+l.line+")")}function w(){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 O(e){var t=u();switch(t){case"'":case'"':return d(t),w();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(qs.test(e))return r*parseInt(e,10);if(Ks.test(e))return r*parseInt(e,16);if(Vs.test(e))return r*parseInt(e,8);if($s.test(e))return r*parseFloat(e);throw b(e,"number",t)}(t,!0)}catch(r){if(e&&Zs.test(t))return t;throw b(t,"value")}}function C(e,t){var r,n;do{!t||'"'!==(r=h())&&"'"!==r?e.push([n=S(u()),f("to",!0)?S(u()):n]):e.push(w())}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(Hs.test(e))return parseInt(e,10);if(zs.test(e))return parseInt(e,16);if(Ws.test(e))return parseInt(e,8);throw b(e,"id")}function _(){if(void 0!==n)throw b("package");if(n=u(),!Zs.test(n))throw b(n,"name");v=v.define(n),f(";")}function I(){var e,t=h();switch(t){case"weak":e=i||(i=[]),u();break;case"public":u();default:e=o||(o=[])}t=w(),f(";"),e.push(t)}function E(){if(f("="),s=w(),!(y="proto3"===s)&&"proto2"!==s)throw b(s,"syntax");f(";")}function T(e,t){switch(t){case"option":return D(e,t),f(";"),!0;case"message":return k(e,t),!0;case"enum":return N(e,t),!0;case"service":return function(e,t){if(!Js.test(t=u()))throw b(t,"service name");var r=new js(t);R(r,(function(e){if(!T(r,e)){if("rpc"!==e)throw b(e);!function(e,t){var r=p(),n=t;if(!Js.test(t=u()))throw b(t,"name");var o,i,s,a,c=t;f("("),f("stream",!0)&&(i=!0);if(!Zs.test(t=u()))throw b(t);o=t,f(")"),f("returns"),f("("),f("stream",!0)&&(a=!0);if(!Zs.test(t=u()))throw b(t);s=t,f(")");var l=new Ps(c,n,o,s,i,a);l.comment=r,R(l,(function(e){if("option"!==e)throw b(e);D(l,e),f(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!Zs.test(t=u()))throw b(t,"reference");var r=t;R(null,(function(t){switch(t){case"required":case"repeated":A(e,t,r);break;case"optional":A(e,y?"proto3_optional":"optional",r);break;default:if(!y||!Zs.test(t))throw b(t);d(t),A(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=Ys.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(!Js.test(t=u()))throw b(t,"type name");var r=new xs(t);R(r,(function(e){if(!T(r,e))switch(e){case"map":!function(e){f("<");var t=u();if(void 0===Fs.mapKey[t])throw b(t,"type");f(",");var r=u();if(!Zs.test(r))throw b(r,"type");f(">");var n=u();if(!Js.test(n))throw b(n,"name");f("=");var o=new Ls(m(n),S(u()),t,r);R(o,(function(e){if("option"!==e)throw b(e);D(o,e),f(";")}),(function(){L(o)})),e.add(o)}(r);break;case"required":case"repeated":A(r,e);break;case"optional":A(r,y?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!Js.test(t=u()))throw b(t,"name");var r=new Us(m(t));R(r,(function(e){"option"===e?(D(r,e),f(";")):(d(e),A(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":C(r.extensions||(r.extensions=[]));break;case"reserved":C(r.reserved||(r.reserved=[]),!0);break;default:if(!y||!Zs.test(e))throw b(e);d(e),A(r,"optional")}})),e.add(r)}function A(e,t,r){var n=u();if("group"!==n){if(!Zs.test(n))throw b(n,"type");var o=u();if(!Js.test(o))throw b(o,"name");o=m(o),f("=");var i=new Ms(o,S(u()),n,t,r);if(R(i,(function(e){if("option"!==e)throw b(e);D(i,e),f(";")}),(function(){L(i)})),"proto3_optional"===t){var s=new Us("_"+o);i.setOption("proto3_optional",!0),s.add(i),e.add(s)}else e.add(i);y||!i.repeated||void 0===Fs.packed[n]&&void 0!==Fs.basic[n]||i.setOption("packed",!1,!0)}else!function(e,t){var r=u();if(!Js.test(r))throw b(r,"name");var n=Gs.lcFirst(r);r===n&&(r=Gs.ucFirst(r));f("=");var o=S(u()),i=new xs(r);i.group=!0;var s=new Ms(n,o,r,t);s.filename=Ys.filename,R(i,(function(e){switch(e){case"option":D(i,e),f(";");break;case"required":case"repeated":A(i,e);break;case"optional":A(i,y?"proto3_optional":"optional");break;case"message":k(i,e);break;case"enum":N(i,e);break;default:throw b(e)}})),e.add(i).add(s)}(e,t)}function N(e,t){if(!Js.test(t=u()))throw b(t,"name");var r=new Bs(t);R(r,(function(e){switch(e){case"option":D(r,e),f(";");break;case"reserved":C(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!Js.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);D(n,e),f(";")}),(function(){L(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function D(e,t){var r=f("(",!0);if(!Zs.test(t=u()))throw b(t,"name");var n,o=t,i=o;r&&(f(")"),i=o="("+o+")",t=h(),Xs.test(t)&&(n=t.slice(1),o+=t,u())),f("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,i,x(e,o),n)}function x(e,t){if(f("{",!0)){for(var r={};!f("}",!0);){if(!Js.test(a=u()))throw b(a,"name");var n,o=a;if(f(":",!0),"{"===h())n=x(e,t+"."+a);else if("["===h()){var i;if(n=[],f("[",!0)){do{i=O(!0),n.push(i)}while(f(",",!0));f("]"),void 0!==i&&M(e,t+"."+a,i)}}else n=O(!0),M(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=O(!0);return M(e,t,c),c}function M(e,t,r){e.setOption&&e.setOption(t,r)}function L(e){if(f("[",!0)){do{D(e,"option")}while(f(",",!0));f("]")}return e}for(;null!==(a=u());)switch(a){case"package":if(!g)throw b(a);_();break;case"import":if(!g)throw b(a);I();break;case"syntax":if(!g)throw b(a);E();break;case"option":D(v,a),f(";");break;default:if(T(v,a)){g=!1;continue}throw b(a)}return Ys.filename=null,{package:n,imports:o,weakImports:i,syntax:s,root:t}}var Qs,ea=ra,ta=/\/|\./;function ra(e,t){ta.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),ra[e]=t}ra("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),ra("duration",{Duration:Qs={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),ra("timestamp",{Timestamp:Qs}),ra("empty",{Empty:{fields:{}}}),ra("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}}}}),ra("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}}}}),ra("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),ra.get=function(e){return ra[e]||null},function(e){var t=yi.exports=vi.exports;t.build="full",t.tokenize=ms,t.parse=As,t.common=ea,t.Root._configure(t.Type,t.parse,t.common)}();var na=f(gi.exports=yi.exports);const oa=(e,t)=>({conversationType:t.conversation.conversationType,targetId:t.conversation.targetId,channelId:t.conversation.channelId,senderUserId:t.senderUserId,messageDirection:s.SEND,isCounted:e.isCounted,isMentioned:!1,content:e.content,messageType:e.messageType,isOffLineMessage:!1,isPersited:e.isPersited,messageId:t.messageId,messageUId:"",sentTime:t.sentTime,receivedTime:0,isStatusMessage:e.isStatusMessage,receivedStatus:a.UNREAD,disableNotification:!1});let ia=0;function sa(){ia++;const e=io();return ia<e&&(ia=e),23e13+ia}const aa=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},ca=e=>{const t=e.name;return ot(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},la=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})},ua=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 da{async create(e){try{const r=aa(e),n=await ua(r);t=r,(window.URL||window.webkitURL).revokeObjectURL(t);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/1680:n/1680;n>1680&&o>1680?e?(s=1680,i/=t):(i=1680,s/=t):n>1680&&o>160?(i=1680,s/=t,s<160&&(s=160,i=n/(o/160))):o>1680&&n>160&&(s=1680,i/=t,i<160&&(i=160,s=o/(n/160)))}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:la(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});return{success:!0,message:new xo({content:a,imageUri:aa(o),width:i,height:s}),file:o}}catch(e){return{success:!1}}var t}updateMessageRemoteUrlProperty(e,t){e.content.imageUri=t}}class ha{async create(e){if(e.size>2097152)return{success:!1};try{const t=aa(e),r=await ua(t);return{success:!0,message:new Mo({gifDataSize:e.size,remoteUrl:t,width:r.width,height:r.height}),file:e}}catch{return{success:!1}}}updateMessageRemoteUrlProperty(e,t){e.content.remoteUrl=t}}let fa;class pa{create(e){return(t=e,st(t.arrayBuffer)?t.arrayBuffer():new Promise(((e,r)=>{const n=new FileReader;n.addEventListener("load",(t=>{t.target?e(t.target.result):r("null")})),n.addEventListener("error",(e=>r(e))),n.readAsArrayBuffer(t)}))).then(this.getAudioInfo).then((t=>({success:!0,message:new Lo({remoteUrl:"",duration:t.duration,type:ca(e)}),file:e}))).catch((()=>({success:!1})));var t}updateMessageRemoteUrlProperty(e,t){e.content.remoteUrl=t}getAudioInfo(e){const t=fa||new AudioContext;return fa=t,new Promise(((r,n)=>{t.decodeAudioData(e,(function(e){r({duration:e.duration,length:e.length})}),n)}))}}class ga{async create(e){return e.size>104857600?{success:!1}:{success:!0,message:new Uo({fileUrl:"",name:e.name,type:ca(e),size:e.size}),file:e}}updateMessageRemoteUrlProperty(e,t){e.content.fileUrl=t}}var ya;!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"}(ya||(ya={}));class va{constructor(e){d(this,"options",void 0),d(this,"xhr",void 0),this.options=e}upload(e,t){const r=new XMLHttpRequest;r.timeout=1e3*(30+e.size/1024/512),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=ca(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 ma=[Ro,Eo,ko,To];async function ba(e,t,r){return Ea(e,t,r)}const wa=Ia.bind(null,ya.IMAGE),Oa=Ia.bind(null,ya.GIF),Ca=Ia.bind(null,ya.AUDIO),Sa=Ia.bind(null,ya.FILE),_a=async(e,r)=>{const n=Fn(e);lo.addMessage(r.messageUId);const o=await((e,t)=>{let r;return r=qn(e)?Dn.send(At.RecallGroupMessage,{groupId:e,msgId:rn.fromString(t)},{encoder:Yn.RecallGroupChatMessageReq,decoder:Xr.BaseResp}):Dn.send(At.RecallPrivateMessage,{destId:e,msgId:rn.fromString(t)},{encoder:Wn.RecallPrivateChatMessageReq,decoder:Xr.BaseResp}),r})(n,r.messageUId);if(o.code!==t.SUCCESS)return{code:o.code};const i=new Bo({sentTime:r.sentTime,messageUId:r.messageUId,...e}),s={conversation:e,senderUserId:xn.uid,messageId:0,sentTime:io()},a=oa(i,s);return ci.get().setConversationCacheByMessage(a),{code:t.SUCCESS,data:a}};async function Ia(e,r,n,o,i){const s=(e=>{let t;switch(e){case ya.IMAGE:t=new da;break;case ya.AUDIO:t=new pa;break;case ya.GIF:t=new ha;break;case ya.FILE:t=new ga}return t})(e);if(!s)return{code:t.NOT_SUPPORT};const{success:a,message:c,file:l}=await s.create(n.file);return a&&c&&l?(c.content.user=n.user,c.content.extra=n.extra,Ea(r,c,i,{file:l,task:(e,t)=>new Promise((r=>{new va({token:Pn.imInitToken,uploadUrl:Pn.fileUploadUrl,cert:Pn.cert,transformer:e=>({...e,url:Pn.getFileAbsoluteUri(e.url)})}).upload(t,{onProgress:(e,t)=>{var r;return null==o||null===(r=o.onProgress)||void 0===r?void 0:r.call(o,Math.floor(e/t*100))},onError:()=>{r({finished:!1,message:e})},onCompleted:t=>{var n;s.updateMessageRemoteUrlProperty(e,t.url),r({finished:!0,message:(null==o||null===(n=o.onComplete)||void 0===n?void 0:n.call(o,{url:t.url}))??e})}})}))})):{code:t.MEDIA_EXCEPTION}}async function Ea(r,i,s,a){const c=function(r,n,o){if(!ui.loader||ui.loader.getConnectionStatus()!==e.CONNECTED)return{code:t.RC_NET_CHANNEL_INVALID};const i=JSON.stringify(ct(n.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:t.RC_MSG_CONTENT_EXCEED_LIMIT};const s={conversation:r,senderUserId:xn.uid,messageId:(null==o?void 0:o.messageId)??sa(),sentTime:ka(),directionalUserIdList:null==o?void 0:o.directionalUserIdList};if(null!=o&&o.onSendBefore){const e=oa(n,s);o.onSendBefore(e)}return{code:t.SUCCESS,message:n,sentArgs:s}}(r,i,s);if(c.code!==t.SUCCESS||!c.message||!c.sentArgs)return{code:c.code};let{message:l,sentArgs:u}=c;if(Ze(a)){const e=await a.task(l,a.file);if(l=e.message,!e.finished)return{code:t.UPLOAD_FILE_FAILED,data:oa(l,u)}}return async function(e,r){const i=Fn(r.conversation),s=oa(e,r);e.isPersited&&ci.get().loadConvsationsIfNotExist([r.conversation]);const a=await Ko.getDialogAesKey(i);if(!a)return{code:t.MSG_ENCRYPT_ERROR,data:s};const c=JSON.stringify(ct(e.encode())),l=((e,t)=>{if(!ot(e))return new Uint8Array;const r=$e.AES.encrypt(e,$e.enc.Utf8.parse(t.key),{iv:Ze(t.iv)?$e.enc.Utf8.parse(t.iv):void 0});return $o(r.ciphertext.words)})(c,a);ao.addMessage(r.messageId);const u={localId:rn.fromNumber(r.messageId),mediaFlag:ma.includes(e.messageType),mediaConstructor:e.objectId,mediaAttribute:"",msgPreContent:"",msgPostContent:"",msgContent:l};let d;if(r.conversation.conversationType===n.GROUP){var h;const t={...u,groupId:i};if(null!=r&&null!==(h=r.directionalUserIdList)&&void 0!==h&&h.length&&(t.assign=r.directionalUserIdList.join(",")),Ze(e.content.mentionedInfo)){var f;const r=e.content.mentionedInfo;r.type===o.ALL?t.atAll=!0:r.type===o.SINGAL&&null!==(f=r.userIdList)&&void 0!==f&&f.length&&(t.at=r.userIdList.map((e=>rn.fromString(e))))}d=await(p=t,Dn.send(At.SendGroupChatMessage,p,{encoder:Yn.SendGroupChatMessageReq,decoder:ro}))}else{const e={...u,destId:i};d=await(e=>Dn.send(At.SendPrivateChatMessage,e,{encoder:Wn.SendPrivateChatMessageReq,decoder:jn.SendPrivateChatMessageResp}))(e)}var p;d.code===t.SUCCESS&&(s.sentTime=d.data.seqno.toNumber(),s.messageUId=d.data.msgId.toString(),ci.get().setConversationCacheByMessage(s));return{code:d.code,data:s}}(l,u)}let Ta,Ra=1;function ka(){Ra++;const e=io();return Ra<e&&(Ra=e),Ra}class Aa extends Rt{constructor(e){if(Aa.imClient)return mt.error("Please do not perform the init method repeatedly"),Aa.imClient;super(),d(this,"options",void 0),d(this,"libLoader",void 0),d(this,"getServerTime",io),d(this,"sendMessage",ba),d(this,"sendImageMessage",wa),d(this,"sendGIFMessage",Oa),d(this,"sendHQVoiceMessage",Ca),d(this,"sendFileMessage",Sa),d(this,"recallMsg",_a),this.options=e,this.fixedProtobuf(),Ze(e.logLevel)&&mt.setLogLevel(e.logLevel),Ze(e.logStdout)&&mt.setLogStdout(e.logStdout),mt.debug("IMClient.init -> ",e.appkey),this.libLoader=ui.init(e),this.watch(),Aa.imClient=this}fixedProtobuf(){na.util.Long=rn,na.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(u.CONNECTING)},onConnected:()=>{this.emit(u.CONNECTED)},onDisconnect:()=>{this.emit(u.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(u.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:e=>{this.emit(u.MESSAGES,{messages:e})},pullFinished:()=>{this.emit(u.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:e=>{this.emit(u.CONVERSATION,{conversations:e})}})}connect(e){return this.libLoader.connect(e)}disconnect(){return this.libLoader.disconnect()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}async getRemoteHistoryMessages(e,n){const o=Fn(e);return(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),Dn.send(e.dialogId.startsWith("SG")?At.GetSuperGroupRemoteMessages:At.GetRemoteMessages,t,{encoder:Wn.GetHistoryMessageReq,decoder:jn.GetHistoryMessageResp})})({dialogId:o,offset:n.timestamp??0,count:n.count??20,newToOld:0===n.order}).then((e=>{let{code:n,data:i}=e;return new Promise((e=>{n===t.SUCCESS?Qo.parse({[o]:i.msg??{}},((r,n)=>{const s=n[o]??[];s.sort(((e,t)=>e.sentTime-t.sentTime)),e({code:t.SUCCESS,data:{list:s,hasMore:!i.isEnd}})})):e({code:n,msg:r(n)})}))}))}async deleteRemoteMessage(e,t){return(r=Fn(e),n=t.map((e=>e.messageUId)),Dn.send(At.DeleteChatMessages,{destId:r,msgIdList:n.map((e=>rn.fromString(e)))},{encoder:Wn.DeleteChatMessageReq,decoder:Xr.BaseResp})).then((e=>e.code));var r,n}async deleteRemoteMessageByTimestamp(e,t){return((e,t)=>Dn.send(At.ClearChatHistoryMessage,{destId:e,type:qn(e)?1:0,msgTime:rn.fromNumber(t)},{encoder:Wn.CleanHistoryMessageReq,decoder:Xr.BaseResp}))(Fn(e),0===t?Number.MAX_VALUE:t).then((e=>e.code))}async getConversationList(e,r,n,o){const i={rows:e,type:r??0,offset:rn.fromNumber(n),newToOld:0===o},{code:s,data:a}=await(e=>Dn.send(At.GetDialogList,e,{encoder:Wn.GetWebDialogListReq,decoder:jn.GetWebDialogListResp}))(i);if(s!==t.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(ot);await Ko.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};ci.get().addLocalConversation(t);const r=ci.get().get(e);Object.assign(t,r),l.push(t)}}return{code:t.SUCCESS,data:l}}getBlockConversationList(){const e=ci.get().getBlockConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}getTopConversationList(){const e=ci.get().getTopConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}async getConversation(e){const r=ci.get().get(e);if(!r)return{code:t.CONVER_GET_ERROR};const{code:n,data:o}=await this.getRemoteHistoryMessages(e,{count:1,order:0});if(n!==t.SUCCESS)return{code:t.CONVER_GET_ERROR};const i=null==o?void 0:o.list[0],s={...e,...r,latestMessage:i};return{code:t.SUCCESS,data:s}}removeConversation(e){return(e=>{let t;return t=qn(e)?Dn.send(At.DeleteGroupDialog,{groupId:e},{encoder:Yn.DeleteGroupChatDialogReq,decoder:Xr.BaseResp}):Dn.send(At.DeletePrivateDialog,{destId:e},{encoder:Wn.DeletePrivateChatDialogReq,decoder:Xr.BaseResp}),t})(Fn(e)).then((e=>e.code))}getUnreadMentionedCount(e){return ci.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return ci.get().getAllUnreadMentionedCount()}getAllConversationState(){return ci.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return ci.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return ci.get().getUnreadCount(e)}clearConversationUnreadCount(e){ci.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){ci.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return ci.get().getNotificationLevel(e)}setConversationNotificationStatus(e,t){return((e,t)=>{let r;return r=qn(e)?Dn.send(At.UpdateGroupChatMuteConfig,{groupId:e,muteFlag:t},{encoder:Yn.UpdateGroupChatDialogMuteConfigReq,decoder:Xr.BaseResp}):Dn.send(At.UpdatePrivateChatMuteConfig,{destId:e,muteFlag:t},{encoder:Wn.UpdatePrivateChatDialogMuteConfigReq,decoder:Xr.BaseResp}),r})(Fn(e),t===i.OPEN).then((r=>(!r.code&&ci.get().addStatus({...e,notificationStatus:t,notificationLevel:t==i.OPEN?c.AT_USER_NOTIFICATION:c.NOT_SET},!0),r.code)))}getConversationNotificationStatus(e){return ci.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=qn(e)?Dn.send(At.UpdateGroupChatStickyConfig,{groupId:e,stickyFlag:t},{encoder:Yn.UpdateGroupChatDialogStickyConfigReq,decoder:Xr.BaseResp}):Dn.send(At.UpdatePrivateChatStickyConfig,{destId:e,stickyFlag:t},{encoder:Wn.UpdatePrivateChatDialogStickyConfigReq,decoder:Xr.BaseResp}),r})(Fn(e),t).then((r=>(!r.code&&ci.get().addStatus({...e,isTop:t},!0),r.code)))}saveConversationMessageDraft(e,t){ci.get().setDraft(e,t)}getConversationMessageDraft(e){return ci.get().getDraft(e)}clearConversationMessageDraft(e){ci.get().clearDraft(e)}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId??"",o=ni(t);if(!o)return;const i=Ko.getDialogAesKeyFromLocal(n);if(!i)return;const s=Qo.parseSingleDialogMessages(n,[r],i)[0];return s?(o.latestMessage=s,o):void 0}}d(Aa,"imClient",void 0);const Na=e=>{Ta=Ta||new Aa(e)},Da=async e=>{Et("token",e,bt,!0);const n=await Ta.connect(e);return n.code===t.SUCCESS?{code:n.code,data:{userId:n.userId}}:{code:n.code,msg:r(n.code)}},xa=()=>Ta.disconnect(),Ma=()=>Ta.getConnectionStatus(),La=()=>Ta.getServerTime(),Ua=(e,t,r)=>{Ta.on(e,t,r)};function Ba(e,t,r){Ta.once(e,t,r)}const ja=(e,t,r)=>{Ta.off(e,t,r)},Pa=async e=>{mt.debug("get conversation list ->");const{code:n,data:o}=await Ta.getConversationList((null==e?void 0:e.count)??20,null,(null==e?void 0:e.startTime)??0,(null==e?void 0:e.order)??0);return n!==t.SUCCESS&&mt.warn("get conversation list fail ->"+n+":"+r(n)),{code:n,msg:r(n),data:o}},Fa=async e=>{Et("options",e,_t,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("get conversation ->"+n);const{code:o,data:i}=await Ta.getConversation(e);return o!==t.SUCCESS?(mt.warn("get conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o,data:i}},Ga=async e=>{Et("options",e,_t,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("remove conversation ->"+n);const o=await Ta.removeConversation(e);return o!==t.SUCCESS?(mt.warn("remove conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o}},qa=e=>{Et("options",e,_t,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("get draft ->"+r);const n=Ta.getConversationMessageDraft(e);return Promise.resolve({code:t.SUCCESS,data:n})},Ha=(e,r)=>{Et("options",e,_t,!0),Et("draft",r,bt,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;return mt.debug("set draft ->"+n),Ta.saveConversationMessageDraft(e,r),Promise.resolve({code:t.SUCCESS})},Ka=e=>{Et("options",e,_t,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return mt.debug("delete draft ->"+r),Ta.clearConversationMessageDraft(e),Promise.resolve({code:t.SUCCESS})},za=e=>{Et("options",e,_t,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return mt.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:t.SUCCESS,data:Ta.getUnreadMentionedCount(e)})},Va=()=>{mt.debug("getAllUnreadMentionedCount");const e=Ta.getAllUnreadMentionedCount();return Promise.resolve({code:t.SUCCESS,data:e})},Wa=()=>{mt.debug("getAllConversationState");const e=Ta.getAllConversationState();return Promise.resolve({code:t.SUCCESS,data:e})},$a=(e,r)=>{if(mt.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+e),Et("includeMuted",e,Ot,!1),Et("conversationTypes",r,Ct,!1),r)for(const e of r)Et("conversationType",e,St,!0);const n=Ta.getAllConversationUnreadCount(r??[],e??!1);return Promise.resolve({code:t.SUCCESS,data:n})},Ja=e=>{Et("options",e,_t,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("get unreadCount ->"+r);const n=Ta.getConversationUnreadCount(e);return Promise.resolve({code:t.SUCCESS,data:n})},Za=e=>{Et("options",e,_t,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return mt.debug("clear unreadMsgNum ->"+r),Ta.clearConversationUnreadCount(e),Promise.resolve({code:t.SUCCESS})},Xa=()=>(mt.debug("clear allMessagesUnreadStatus"),Ta.clearAllConversationsUnreadCount(),Promise.resolve({code:t.SUCCESS})),Ya=e=>{Et("options",e,_t,!0),mt.info("getConversationNotificationLevel ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Ta.getConversationNotificationLevel(e);return Promise.resolve({code:t.SUCCESS,data:r})},Qa=async(e,n)=>{Et("options",e,_t,!0),Et("notificationStatus",n,(e=>1===e||2===e),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("set conversation status ->"+o);const i=await Ta.setConversationNotificationStatus(e,n);return i!==t.SUCCESS?(mt.warn("set conversation status fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:i}},ec=e=>{Et("options",e,_t,!0),mt.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Ta.getConversationNotificationStatus(e);return Promise.resolve({code:t.SUCCESS,data:r})},tc=()=>Ta.getBlockConversationList(),rc=async function(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Et("options",e,_t,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("set conversation status ->"+o);const i=await Ta.setConversationToTop(e,n);return i!==t.SUCCESS?(mt.warn("set conversation status fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:i}},nc=()=>Ta.getTopConversationList(),oc=(e,t,r,n,o)=>function(n){return o?new Ho(e,n):r?new qo(e,n):t?new Go(e,n):new Fo(e,n)},ic=async(e,r,n)=>{if(r instanceof fo==!1)return mt.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:t.PARAMETER_ERROR};Et("conversation",e,_t,!0),yc(e);const o=await Ta.sendMessage(e,r,n);return vc(e,o.code),o},sc=(e,t,r)=>{const n=new Do(t);return ic(e,n,r)},ac=async(e,t,r,n)=>{Et("conversation",e,_t,!0),Et("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.startsWith("image/")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("send message ->"+o),yc(e);const i=await Ta.sendImageMessage(e,t,r,n);return vc(e,i.code),i},cc=async(e,t,r,n)=>{Et("conversation",e,_t,!0),Et("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.endsWith("image/gif")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("send message ->"+o),yc(e);const i=await Ta.sendGIFMessage(e,t,r,n);return vc(e,i.code),i},lc=async(e,t,r,n)=>{Et("conversation",e,_t,!0),Et("msgBody.file",t.file,(e=>e instanceof Blob),!0),yc(e);const o=await Ta.sendHQVoiceMessage(e,t,r,n);return vc(e,o.code),o},uc=async(e,t,r,n)=>{Et("conversation",e,_t,!0),Et("msgBody.file",t.file,(e=>e instanceof Blob),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("send message ->"+o),yc(e);const i=await Ta.sendFileMessage(e,t,r,n);return vc(e,i.code),i},dc=async(e,n)=>{Et("options.messageUId",n.messageUId,bt,!0),Et("options.sentTime",n.sentTime,wt,!0),Et("conversation",e,_t,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+n.messageUId;mt.debug("recall message ->"+o);const i=await Ta.recallMsg(e,n);return i.code!==t.SUCCESS&&mt.warn("recall message fail ->"+i.code+":"+r(i.code)+","+o),i},hc=async(e,n)=>{Et("options.timestamp",n.timestamp??0,wt),Et("options.count",n.count??0,wt),Et("options.order",n.order??0,(e=>0===e||1===e)),Et("conversation",e,_t,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("get history message ->"+o);const i=await Ta.getRemoteHistoryMessages(e,n);return i.code!==t.SUCCESS&&mt.warn("get history message fail ->"+i.code+":"+r(i.code)+","+o),i},fc=async(e,n)=>{Et("options.timestamp",n.timestamp??0,wt),Et("options.count",n.count??0,wt),Et("options.order",n.order??0,(e=>0===e||1===e)),Et("conversation",e,_t,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("get remote history message ->"+o);const i=await Ta.getRemoteHistoryMessages(e,n);return i.code!==t.SUCCESS&&mt.warn("get remote history message fail ->"+i.code+":"+r(i.code)+","+o),i},pc=async(e,n)=>{Et("messages",n,(e=>rt(e)&&!!e.length),!0),n.forEach((e=>{Et("messages.messageUId",e.messageUId,bt,!0),Et("messages.sentTime",e.sentTime,wt,!1),Et("messages.messageDirection",e.messageDirection,(e=>1===e||2===e),!1)})),Et("conversation",e,_t,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("delete messages ->"+o);const i=await Ta.deleteRemoteMessage(e,n);return i!==t.SUCCESS?(mt.warn("delete message fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:t.SUCCESS}},gc=async(e,n)=>{Et("timestamp",n,(e=>wt(e)&&e>=0),!0),Et("conversation",e,_t);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("clear message ->"+o);const i=await Ta.deleteRemoteMessageByTimestamp(e,n);return i!==t.SUCCESS?(mt.warn("clear message ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:t.SUCCESS}},yc=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.debug("send message ->"+t)},vc=(e,n)=>{if(n!==t.SUCCESS){const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;mt.warn("send message fail ->"+n+":"+r(n)+","+t)}};export{jo as CommandMessage,e as ConnectionStatus,n as ConversationType,t as ErrorCode,r as ErrorDesc,u as Events,Uo as FileMessage,Mo as GIFMessage,Lo as HQVoiceMessage,xo as ImageMessage,l as LogLevel,o as MentionedType,s as MessageDirection,c as NotificationLevel,i as NotificationStatus,a as ReceivedStatus,Do as TextMessage,Ua as addEventListener,Xa as clearAllMessagesUnreadStatus,gc as clearHistoryMessages,Za as clearMessagesUnreadStatus,Ka as clearTextMessageDraft,Da as connect,pc as deleteMessages,xa as disconnect,Wa as getAllConversationState,Va as getAllUnreadMentionedCount,tc as getBlockedConversationList,Ma as getConnectionStatus,Fa as getConversation,Pa as getConversationList,Ya as getConversationNotificationLevel,ec as getConversationNotificationStatus,hc as getHistoryMessages,fc as getRemoteHistoryMessages,La as getServerTime,qa as getTextMessageDraft,nc as getTopConversationList,$a as getTotalUnreadCount,Ja as getUnreadCount,za as getUnreadMentionedCount,Na as init,Ba as onceEventListener,dc as recallMessage,oc as registerMessageType,Ga as removeConversation,ja as removeEventListener,Ha as saveTextMessageDraft,uc as sendFileMessage,cc as sendGIFMessage,lc as sendHQVoiceMessage,ac as sendImageMessage,ic as sendMessage,sc as sendTextMessage,Qa as setConversationNotificationStatus,rc as setConversationToTop};
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?wn:bn;if(t){if(e<0)return wn;if(e>=yn)return In}else{if(e<=-vn)return En;if(e+1>=vn)return _n}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?wn: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 wn=ln(0,!0);nn.UZERO=wn;var On=ln(1);nn.ONE=On;var Cn=ln(1,!0);nn.UONE=Cn;var Sn=ln(-1);nn.NEG_ONE=Sn;var _n=dn(-1,2147483647,!1);nn.MAX_VALUE=_n;var In=dn(-1,-1,!0);nn.MAX_UNSIGNED_VALUE=In;var En=dn(0,-2147483648,!1);nn.MIN_VALUE=En;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(En)){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(En)?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(En)?En:this.not().add(On)},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?wn:bn;if(this.eq(En))return e.isOdd()?En:bn;if(e.eq(En))return this.isOdd()?En: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?wn:bn;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return wn;if(e.gt(this.shru(1)))return Cn;n=wn}else{if(this.eq(En))return e.eq(On)||e.eq(Sn)?En:e.eq(En)?On:(t=this.shr(1).div(e).shl(1)).eq(bn)?e.isNegative()?On:Sn:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(En))return this.unsigned?wn: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=On),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[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},Dn=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 xn=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.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(r){return this.token=r,new Promise((r=>{this.connectResolve=r,this.open().then((e=>e===t.SUCCESS?!Xe(this.provider)||this.provider.needReAuth()?this.auth():t.SUCCESS:e)).then((n=>{var o;(r(n),n===t.SUCCESS)?(this.isAuthorized=!0,this.profile=null===(o=this.provider)||void 0===o?void 0:o.profile(),this.autoReconnect=!0,this.onConnect()):this.onDisconnect(n===t.TIMEOUT?e.NETWORK_UNAVAILABLE:e.WEBSOCKET_UNAVAILABLE)}))}))}async send(e,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(e,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:t.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:t.SUCCESS,msg:""}}async sendRawData(e,r){var n,o,i;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.options.signalTimeout;if(!this.socket)return{code:t.RC_NET_CHANNEL_INVALID};if(!this.isAuthorized&&!this.isAuthCommand(e))return{code:t.RC_NET_CHANNEL_INVALID};const a=this.generateMessageSeq(),c={cmdId:e,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};bt.reqInfo(`websocket send -> cmd: 0x${e.toString(16)}, messageSeq: ${a}`),this.socket.send(An(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}:(bt.warn(`send timeout -> cmd: 0x${e.toString(16)}, messageSeq: ${a}, timeout: ${s}`),{code:t.TIMEOUT})}close(){var r;this.autoReconnect=!1,this.doClose(),this.setStatus(e.DISCONNECTED),null===(r=this.connectResolve)||void 0===r||r.call(this,t.RC_SOCKET_DISCONNECTED)}async open(){const r=this.url;bt.info(`conenct start -> ${r}`),this.setStatus(e.CONNECTING);const n=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=n;return await new Promise((o=>{n.onMessage((e=>{"ArrayBuffer"===Ze(e)?this.onReceiveMessage(e):bt.error("Socket received invalid data:",e)})),n.onClose(((r,n)=>{bt.warn("websocket closed -> code:",r,"reason:",n),this.onDisconnect(e.CONNECTION_CLOSED),o(t.RC_SOCKET_DISCONNECTED)})),n.onError((r=>{bt.error("websocket error -> ",r),this.onDisconnect(e.WEBSOCKET_ERROR),o(t.RC_SOCKET_NOT_CREATED)})),n.onOpen((()=>{bt.info("websocket open -> ",r),o(t.SUCCESS)})),setTimeout((()=>{o(t.TIMEOUT)}),this.options.webSocketTimeout)}))}async auth(){var e,r,n,o;bt.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(At.Auth,i,{encoder:Wr,decoder:Yr.AuthSignIn2TokenResp},8e3);return s===t.SUCCESS||c?(bt.info("auth success -> ",null===(e=c.user)||void 0===e||null===(r=e.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),t.SUCCESS):(bt.warn("auth failed -> "+a),t.RC_CONN_NOT_AUTHRORIZED)}async checkAlive(){if(!this.socket||!this.isAuthorized)return;bt.debug("send ping ->");const r={pingId:nn.ZERO,disconnectDelay:nn.ZERO},{code:n}=await this.send(At.Heartbean,r,{encoder:Vr},this.options.pingTimeout);n===t.SUCCESS?(bt.debug("recv pong <-"),this.failedCount=0,setTimeout((()=>this.checkAlive()),this.options.pingInterval)):(this.failedCount+=1,bt.warn(`ping failed count: ${this.failedCount}, code: ${n}`),this.failedCount>=this.options.pingFailedTimes?(this.failedCount=0,bt.warn("ping timeout, close current websocket to reconnect!"),this.onDisconnect(e.NETWORK_UNAVAILABLE)):this.checkAlive())}onReceiveMessage(t){let r;try{const e=Dn(t);r=Yr.NetworkResponse.decode(e)}catch(t){return bt.error("unpack payload error -> ",t),void this.onDisconnect(e.DISCONNECT_BY_SERVER)}if(r.code)return void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===At.SessionKilledPush)return void this.onDisconnect(e.KICKED_OFFLINE_BY_OTHER_CLIENT);if(r.cmdId===At.SignOutPish||r.cmdId===At.SignOutPish2)return void this.onDisconnect(e.DISCONNECT_BY_SERVER);if(r.cmdId===At.UserFrozenToLogin||r.cmdId===At.UserFrozenToLogin2)return void this.onDisconnect(e.BLOCKED);const n=nn.isLong(r.messageSeq)?r.messageSeq.toNumber():0;bt.reqInfo(`websocket recv ack -> messageSeq: ${n}`);const o=this.responseCallbacks.get(n);var i;Xe(o)?(o(r.body),this.responseCallbacks.delete(n)):(bt.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.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.DISCONNECTED&&this.status!==e.KICKED_OFFLINE_BY_OTHER_CLIENT&&this.status!==e.BLOCKED&&this.status!==e.DISCONNECT_BY_SERVER}setStatus(e){var t;e!==this.status&&(bt.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===At.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;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:""}}},Ln=Dt.exports,Un=Ln.Reader,Bn=Ln.util,jn=Ln.roots.default||(Ln.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=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Un||(e=Un.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=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 Un||(e=Un.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=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 Un||(e=Un.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===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=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=Bn.emptyArray,e.decode=function(e,t){e instanceof Un||(e=Un.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=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 Un||(e=Un.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=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 Un||(e=Un.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===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=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 Un||(e=Un.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=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 Un||(e=Un.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===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=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 Un||(e=Un.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 Un||(e=Un.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=Bn.emptyArray,e.decode=function(e,t){e instanceof Un||(e=Un.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 Un||(e=Un.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=Bn.emptyObject,e.prototype.setTime=Bn.Long?Bn.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof Un||(e=Un.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===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=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=e=>{if(!it(e.targetId+""))return"";switch(e.conversationType){case n.PRIVATE:return"P::"+e.targetId;case n.GROUP:return"G::"+e.targetId;case n.ULTRA_GROUP:return`SG::${e.targetId}_${e.channelId??""}`;default:return""}},qn=e=>{if(!it(e))return null;const t=e.split("::");if(2!==t.length)return null;const r=t[0];if("G"===r)return{conversationType:n.GROUP,targetId:t[1]};if("P"===r)return{conversationType:n.PRIVATE,targetId:t[1]};if("SG"===r){const e=t[1].indexOf("_");if(e>0){const r=t[1].substring(0,e),o=t[1].substring(e+1);return{conversationType:n.ULTRA_GROUP,targetId:r,channelId:o}}return 0===e?null:{conversationType:n.ULTRA_GROUP,targetId:t[1]}}return null},Hn=e=>e.startsWith("SG")||e.startsWith("G");var Kn=Dt.exports,zn=Kn.Writer,Vn=Kn.util,Wn=Kn.roots.default||(Kn.roots.default={});Wn.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=Vn.Long?Vn.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=Vn.newBuffer([]),e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=zn.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}(),Wn.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=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.prototype.msgIdList=Vn.emptyArray,e.encode=function(e,t){if(t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=Vn.emptyArray,e.encode=function(e,t){if(t||(t=zn.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}(),Wn.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=Vn.emptyArray,e.prototype.clientSign="",e.encode=function(e,t){if(t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.prototype.oldOffset=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.prototype.rows=0,e.prototype.newToOld=!1,e.encode=function(e,t){return t||(t=zn.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}(),Wn.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=Vn.Long?Vn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=zn.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 $n=Wn,Jn=Dt.exports,Zn=Jn.Writer,Xn=Jn.util,Yn=Jn.roots.default||(Jn.roots.default={});Yn.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=Xn.Long?Xn.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=Xn.emptyArray,e.prototype.extra="",e.prototype.assign="",e.prototype.atAll=!1,e.prototype.msgContent=Xn.newBuffer([]),e.encode=function(e,t){if(t||(t=Zn.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}(),Yn.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=Zn.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}(),Yn.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=Zn.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}(),Yn.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=Zn.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}(),Yn.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=Xn.Long?Xn.Long.fromBits(0,0,!1):0,e.encode=function(e,t){return t||(t=Zn.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}(),Yn.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=Zn.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 Qn=Yn;const eo=Dt.exports.Reader,to=Dt.exports.util,ro=Dt.exports.roots.default||(Dt.exports.roots.default={}),no=ro.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=to.Long?to.Long.fromBits(0,0,!1):0,e.prototype.msgId=to.Long?to.Long.fromBits(0,0,!1):0,e.prototype.msgSendTime=to.Long?to.Long.fromBits(0,0,!1):0,e.prototype.seqno=to.Long?to.Long.fromBits(0,0,!1):0,e.decode=function(e,t){e instanceof eo||(e=eo.create(e));let r=void 0===t?e.len:e.pos+t,n=new ro.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})();let oo=0;const io=async()=>{const e=(new Date).getTime(),{code:r,data:n}=await xn.send(At.GetServerTime,null,{decoder:Yr.SystemCurrentTimeMillisResp});if(r===t.SUCCESS){const{currentTimeMillis:t}=n;oo=t.toNumber()-e}},so=()=>(new Date).getTime()+oo,ao=new Set;var co={addMessage(e){ao.add(e)},remove(e){ao.delete(e)},has:e=>ao.has(e),reset(){ao.clear()}};const 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 Map;function fo(e){ho.set(e.getObjectId(),e.decode.bind(e))}class po{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 go=0,yo=268439552,vo=268439563,mo=268439562,bo=268439553,wo=268439581,Oo=268439597,Co=268439613,So=268439629,_o=1610678301,Io=268439645,Eo="RC:TxtMsg",To="RC:HQVCMsg",Ro="RC:FileMsg",ko="RC:ImgMsg",No="RC:GIFMsg",Ao="RC:RcNtf",Do="RC:CmdMsg";class xo extends po{constructor(e){super(Eo,e)}static getObjectId(){return go}static decode(e){const{user:t,extra:r,content:n}=e;return new xo({user:t,extra:r,content:n})}encode(){const{user:e,extra:t,content:r}=this.content;return{user:e,extra:t,content:r}}}class Mo extends po{constructor(e){super(ko,e)}static getObjectId(){return yo}static decode(e){const{user:t,extra:r,thumbnailObjectKey:n,originalObjectKey:o,width:i,height:s}=e;return new Mo({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 Lo extends po{constructor(e){super(No,e)}static getObjectId(){return vo}static decode(e){const{user:t,extra:r,size:n,originalObjectKey:o,width:i,height:s}=e;return new Lo({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 Uo extends po{constructor(e){super(To,e)}static getObjectId(){return bo}static decode(e){const{user:t,extra:r,length:n,audioObjectKey:o,extension:i}=e;return new Uo({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 Bo extends po{constructor(e){super(Ro,e)}static getObjectId(){return mo}static decode(e){const{user:t,extra:r,title:n,extension:o,size:i,originalObjectKey:s}=e;return new Bo({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 jo extends po{constructor(e){super(Ao,e,!0,!1,!1)}static getObjectId(){return _o}static decode(e){return new jo(e)}encode(){return this.content}}class Po extends po{constructor(e){super(Do,e,!1,!1)}static getObjectId(){return Io}static decode(e){return new Po(e)}encode(){return this.content}}class Fo extends po{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 Go extends Fo{constructor(e,t){super(e,t,!1,!1)}static getObjectId(){return wo}}class qo extends Fo{constructor(e,t){super(e,t,!0,!1)}static getObjectId(){return Oo}}class Ho extends Fo{constructor(e,t){super(e,t,!0,!0)}static getObjectId(){return Co}}class Ko extends Fo{constructor(e,t){super(e,t,!1,!1,!0)}static getObjectId(){return So}}var zo=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(e){if(!e.length)return new Map;const{code:r,data:n}=await(o=e,xn.send(At.GetDialogKey,{destId:o,clientSign:""},{encoder:$n.GetDialogKeyReq,decoder:Pn.GetDialogKeyResp}));var o;if(r===t.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 Vo="time",Wo=(e,t)=>[e,t,Vo].join("_");class $o{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=Wo(this.appkey,this.userId);pt.set(t,e.toString())}getInboxOffset(){if(this.inBoxOffset.isZero()){const e=Wo(this.appkey,this.userId);this.inBoxOffset=nn.fromString(pt.get(e)??"0")}return this.inBoxOffset}}const Jo=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 Zo=(e,t,r)=>{const n={};return e.forEach((e=>{const o=Xo(e,t.get(e),r.get(e));o.length&&(n[e]=o)})),n},Xo=(e,t,r)=>{const n=qn(e);if(!n)return[];const o=new Set;let i=[];return t.forEach((e=>{const t=e;let l=t.mediaConstructor,u=Yo(t,r);if(!u)return;if(1610678290===l||1610743841===l){const{msgId:e,sendTime:r}=u,i={sentTime:r,messageUId:e,conversationType:n.conversationType,targetId:t.isOut?n.targetId:Mn.uid,channelId:n.channelId};l=_o,u=i,o.add(e)}const d=function(e,t){const r=ho.get(e);return r?r(t):null}(l,u);if(Xe(d)){const e={...n,senderUserId:t.srcId.toString(),messageDirection:t.isOut?s.SEND:s.RECEIVE,isCounted:d.isCounted,isMentioned:t.atFlag,content:d.content,messageType:d.messageType,isOffLineMessage:!1,isPersited:d.isPersited,messageId:nn.isLong(t.localId)?t.localId.toNumber():void 0,messageUId:t.msgId.toString(),sentTime:t.seqno.toNumber(),sentStatus:a.SENT,receivedTime:so(),isStatusMessage:d.isStatusMessage,receivedStatus:c.READ,disableNotification:!1};if(e.isStatusMessage&&so()-e.sentTime>6e3)return;i.push(e)}})),o.size&&(i=i.filter((e=>!o.has(e.messageUId)))),i},Yo=(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=Qo(o));let i={};return null!==(n=o)&&void 0!==n&&n.length&&(i=JSON.parse(o)),i}catch(t){return bt.error("decode message content fail -> uid:",e.msgId.toString()),null}},Qo=e=>e.replace(/("msgId")\s*:\s*(\d+)/g,((e,t,r)=>`${t}:"${r}"`));var ei={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());zo.getDialogAesKeyListInBatches([...r.keys()],((e,o)=>{if(o.size){const e=[...o.keys()];for(const t of e)n.delete(t);t(!n.size,Zo(e,r,o))}n.size&&e&&t(!0,{})}))},parseSingleDialogMessages:Xo};function ti(e){if(!Xe(e))return e;if(Array.isArray(e))return e.map((e=>ti(e)));if(rt(e)){const t={};return Object.keys(e).forEach((r=>{t[r]=ti(e[r])})),t}return e}const ri={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 ni{constructor(e,t){h(this,"localStore",void 0);const r=`con-${e}-${t}`;this.localStore=new gt(r)}getStoreKey(e){return`${e.conversationType}_${e.targetId}_${e.channelId??""}`}getConOptionByKey(e){const t=(e=e||"").split("_");if(t.length>=2){const e=t.shift(),r=t.shift(),n=t.join("_");return{conversationType:Number(e),targetId:r,channelId:n}}return{conversationType:n.PRIVATE,targetId:"",channelId:""}}updateUnreadCount(e){const{conversationType:t,targetId:r,channelId:n,content:o,messageType:i,sentTime:a,isCounted:c,messageDirection:l}=e,u=l===s.SEND,d=i===Ao,h=rt(o),f={conversationType:t,targetId:r,channelId:n},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){o.sentTime>=g&&y&&(p.unreadMessageCount=y-1)}this.set(f,p)}}updateMentionedData(e){const{conversationType:t,targetId:r,channelId:o,messageUId:i,messageType:a,isMentioned:c,messageDirection:l,content:u}=e;if(l===s.SEND||!c&&a!==Ao)return;const d=this.getStoreKey({conversationType:t,targetId:r,channelId:o}),h=this.localStore.get(d)||{},f=ri.mentionedUIds.keyName,p=h[f]||[];if(c&&t===n.GROUP&&(p.includes(i)||p.push(i)),a===Ao&&t===n.GROUP){const e=u,t=p.indexOf(e.messageUId);t>=0&&p.splice(t,1)}p.length?h[f]=p:delete h[f],st(h)?this.localStore.set(d,h):this.localStore.remove(d)}set(e,t){const r=this.getStoreKey(e),n=this.localStore.get(r)||{};for(const e of ct(t)){const r=ri[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[ri.unreadMessageCount.keyName]||(delete n[ri.lastUnreadTime.keyName],delete n[ri.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(ri)){const{keyName:t,defaultVal:i}=ri[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]||ti(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(ri)){const{keyName:t,defaultVal:r}=ri[e];"mentionedUIds"!==e&&(n[e]=o[t]||ti(r))}t.push(n)}return t}}const oi=e=>{const t=e.destId??"",r=qn(t);if(!r)return;return{...r,unreadMessageCount:0,notificationStatus:e.muteFlag?i.OPEN:i.CLOSE,notificationLevel:Ye(e.pushNotificationLevel)&&0!==e.pushNotificationLevel&&Xe(l[e.pushNotificationLevel])?e.pushNotificationLevel:e.muteFlag?l.AT_USER_NOTIFICATION:l.NOT_SET,isTop:!!e.stickyFlag,lastUnreadTime:0}};class ii{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 kt}async pull(){if(this.isPulling)return;let e;this.isPulling=!0;const r=pt.get(this.storageKey);e=Ye(r)&&r>0?r:so()-1e4;let{code:n,data:o}=await(e=>xn.send(At.GetDialogChangedStatus,{time:nn.fromNumber(e)},{encoder:$n.GetNewSettingDialogListReq,decoder:Pn.GetNewSettingDialogListResp}))(e);n===t.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=oi(t);r&&this.eventEmitter.emit("STATUS_CHANGED",r)}))),this.isPulling=!1}watch(e){this.eventEmitter.on("STATUS_CHANGED",(t=>{e(t)}))}}class si{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 ni(e,t),this.notify=ut(this.notifyConversationChanged.bind(this),0),this.statusManager=new ii(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(e){if(null==e||!e.length)return;const r=e.filter((e=>!this.localConversationSet.has(this.getConversationKey(e))));if(!r.length)return;const n=r.map(Gn).filter(it);if(!n.length)return;const{code:o,data:i}=await(e=>xn.send(At.GetBriefDialogList,{destId:e},{encoder:$n.GetBriefDialogListReq,decoder:Pn.GetBriefDialogListResp}))(n);o===t.SUCCESS&&ct(i.briefDialog).forEach((e=>{const t=i.briefDialog[e],r=oi(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=so(),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=ti(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(e,t){const r=this.store.getAll();let n=0;return r.forEach((r=>{let{unreadMessageCount:o,notificationStatus:s,notificationLevel:a,conversationType:c}=r;o=o||0;const l=s===i.OPEN||a>0;!t&&l||(e.length>0?e.includes(+c)&&(n+=+o):n+=+o)})),n}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:so()}),n&&(o.hasMentioned={val:!1,time:so()},o.unreadMentionedCount={val:0,time:so()}),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((e=>e.notificationStatus===i.OPEN||e.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 ai={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(e){return l.NOT_SET},getNotificationStatus:function(e){return i.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 ci;var li={create(e,t,r){ci=new si(e,t,r)},get:()=>ci??ai};class ui{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 $o(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 e=this.letterbox.getInboxOffset();this.pullOfflineFinished||bt.info(`pullMsg -> time: ${e}`),this.latestSyncTimestamp=Date.now();const{code:r,data:n}=await((e,t)=>xn.send(At.GetNewMessage,{offset:e,rows:t},{encoder:$n.GetNewMessageReq,decoder:Pn.GetNewMessageResp}))(e,60);if(r!==t.SUCCESS)return this.pullOfflineFinished||bt.warn("pullMsg failed -> code:",r),this.pullingMsg=!1,void this.try2RePullMsg();const{offset:o,seqno:i,msg:a}=n,c=Object.keys(a).map(qn).filter((e=>Xe(e)));li.get().loadConvsationsIfNotExist(c),ei.parse(a,((e,t)=>{const r=[],n=[],a=!this.pullOfflineFinished;var c,l;(Object.keys(t).forEach((e=>{const o=t[e],i=[];if(o.forEach((e=>{e.messageDirection===s.SEND&&e.messageId&&co.has(e.messageId)?co.remove(e.messageId):e.messageType===Ao&&uo.has(e.content.messageUId)?uo.remove(e.content.messageUId):(e.isOffLineMessage=a,li.get().setConversationCacheByMessage(e),i.push(e))})),r.push(...i),this.isExistPersistedMessage(i)){const t=qn(e);t&&n.push(t)}})),r.length)&&(null===(c=(l=this.watcher).batchMessage)||void 0===c||c.call(l,r));if(n.length&&li.get().loadConvsationsIfNotExist(n),e){var u;i.ge(this.serverMsgSeqno)&&(this.serverMsgSeqno=i);const e=this.serverMsgSeqno.lessThanOrEqual(o);this.pullOfflineFinished||bt.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 di{static init(e){return this._loader||(this._loader=new di(e)),this._loader}static get loader(){return this._loader}constructor(t){h(this,"options",void 0),h(this,"connectionStatus",e.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},xn.setServerInfo(this.getWebSocketUrl()),xn.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(){fo(xo),fo(Mo),fo(Lo),fo(Uo),fo(Go),fo(Ho),fo(qo),fo(Ko),fo(jo),fo(Po),fo(Bo)}async connect(r){if(this.connectionStatus===e.CONNECTED)return{code:t.SUCCESS,userId:Mn.uid+""};if(this.connectionStatus===e.CONNECTING)return{code:t.BIZ_ERROR_CONNECTING};if("string"!=typeof r||0===r.length)return{code:t.RC_CONN_USER_OR_PASSWD_ERROR};Fn.imInitToken=r;const n=await xn.connect(r);var o;n===t.SUCCESS&&(this.isInternalConnected=!0,li.get().destroyed(),li.create(this.options.appkey,Mn.uid,this.watcher.conversationState),null===(o=this.messageLoader)||void 0===o||o.stop(),this.messageLoader=new ui(this.watcher,this.options),io(),co.reset(),uo.reset(),zo.reset());return{code:n,userId:Mn.uid+""}}reconnect(){return this.isInternalConnected?Promise.resolve({code:t.CAN_NOT_RECONNECT}):this.connect(Fn.imInitToken)}disconnect(){return this.isInternalConnected=!1,xn.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.BLOCKED:case e.KICKED_OFFLINE_BY_OTHER_CLIENT:case e.DISCONNECT_BY_SERVER:this.handleDisconnect();break;case e.CONNECTING:this.handleConnecting();break;case e.CONNECTED:this.handleConnected();break;case e.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.CONNECTED&&li.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===At.NewMessagePush){var r;const e=Pn.NewMessageNotificationResp.decode(t);null===(r=this.messageLoader)||void 0===r||r.syncMsg(e.seqno)}else e===At.DialogChangedPush&&li.get().syncConversationStatus()}authListener(e){Fn.setFileServerInfo(e.fileDomain,e.dialogFileDomain,e.cert),Mn.setLogged(e,Fn.imInitToken)}needReAuthProvider(){return!Mn.user.active||Mn.user.token!==Fn.imInitToken}needProfileProvider(){if(!this.needReAuthProvider()){const{deviceId:e,sessionId:t,uid:r}=Mn.user;return{deviceId:e,sessionId:t,uid:r}}return null}}h(di,"_loader",void 0);var hi,fi,pi,gi,yi={exports:{}},vi={exports:{}},mi={exports:{}},bi={exports:{}};var wi,Oi={};var Ci,Si,_i,Ii,Ei,Ti,Ri,ki,Ni,Ai,Di,xi,Mi,Li={};function Ui(){return Ci||(Ci=1,function(e){var t=Li,r=gs(),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])}()),Li}function Bi(){if(_i)return Si;_i=1,Si=s;var e=ys();((s.prototype=Object.create(e.prototype)).constructor=s).className="Field";var t,r=vs(),n=Ui(),o=gs(),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},Si}function ji(){if(Ei)return Ii;Ei=1,Ii=n;var e=ys();((n.prototype=Object.create(e.prototype)).constructor=n).className="OneOf";var t=Bi(),r=gs();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)})}},Ii}function Pi(){if(Ri)return Ti;Ri=1,Ti=c;var e=ys();((c.prototype=Object.create(e.prototype)).constructor=c).className="Namespace";var t,r,n,o=Bi(),i=gs(),s=ji();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},Ti}function Fi(){if(Ni)return ki;Ni=1,ki=n;var e=Bi();((n.prototype=Object.create(e.prototype)).constructor=n).className="MapField";var t=Ui(),r=gs();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))}},ki}function Gi(){if(Di)return Ai;Di=1,Ai=r;var e=ys();((r.prototype=Object.create(e.prototype)).constructor=r).className="Method";var t=gs();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))},Ai}function qi(){if(Mi)return xi;Mi=1,xi=o;var e=Pi();((o.prototype=Object.create(e.prototype)).constructor=o).className="Service";var t=Gi(),r=gs(),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},xi}var Hi,Ki,zi,Vi,Wi=Ji,$i=Xt();function Ji(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}function Zi(){if(Ki)return Hi;Ki=1,Hi=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=vs(),t=Ui(),r=gs();function n(e){return"missing required '"+e.name+"'"}return Hi}function Xi(){if(Vi)return zi;Vi=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=vs(),t=gs();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}Ji.create=function(e){return this.$type.create(e)},Ji.encode=function(e,t){return this.$type.encode(e,t)},Ji.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},Ji.decode=function(e){return this.$type.decode(e)},Ji.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},Ji.verify=function(e){return this.$type.verify(e)},Ji.fromObject=function(e){return this.$type.fromObject(e)},Ji.toObject=function(e,t){return this.$type.toObject(e,t)},Ji.prototype.toJSON=function(){return this.$type.toObject(this,$i.toJSONOptions)};var Yi,Qi={};function es(){return Yi||(Yi=1,function(e){var t=e,r=vs(),n=gs();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")}}(Qi)),Qi}var ts,rs,ns,os,is,ss,as,cs,ls,us,ds,hs={};function fs(){if(rs)return ts;rs=1,ts=g;var e=Pi();((g.prototype=Object.create(e.prototype)).constructor=g).className="Type";var t=vs(),r=ji(),n=Bi(),o=Fi(),i=qi(),s=Wi,a=wr,c=Qt,l=gs(),u=ms(),d=Zi(),h=Xi(),f=es(),p=hs;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)}},ts}function ps(){if(os)return ns;os=1,ns=c;var e=Pi();((c.prototype=Object.create(e.prototype)).constructor=c).className="Root";var t,r,n,o=Bi(),i=vs(),s=ji(),a=gs();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},ns}function gs(){return is||(is=1,function(e){var t,r,n=bi.exports=Xt(),o=Gr;n.codegen=function(){if(fi)return hi;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 fi=1,hi=e,e.verbose=!1,hi}(),n.fetch=function(){if(gi)return pi;gi=1,pi=r;var e=Lt,t=zt();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()},pi}(),n.path=(wi||(wi=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=fs());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=vs());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(ps()))}})}()),bi.exports}function ys(){if(as)return ss;as=1,ss=r,r.className="ReflectionObject";var e,t=gs();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},ss}function vs(){if(ls)return cs;ls=1,cs=n;var e=ys();((n.prototype=Object.create(e.prototype)).constructor=n).className="Enum";var t=Pi(),r=gs();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)},cs}function ms(){if(ds)return us;ds=1,us=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=vs(),t=Ui(),r=gs();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 us}!function(e){var t=Wi;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)}}}(hs),function(e){var t=mi.exports=xt;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=ms(),t.decoder=Zi(),t.verifier=Xi(),t.converter=es(),t.ReflectionObject=ys(),t.Namespace=Pi(),t.Root=ps(),t.Enum=vs(),t.Type=fs(),t.Field=Bi(),t.OneOf=ji(),t.MapField=Fi(),t.Service=qi(),t.Method=Gi(),t.Message=Wi,t.wrappers=hs,t.types=Ui(),t.util=gs(),t.ReflectionObject._configure(t.Root),t.Namespace._configure(t.Type,t.Service,t.Enum),t.Root._configure(t.Type),t.Field._configure(t.Type)}();var bs=Ns,ws=/[\s{}=;:[\],'"()<>]/g,Os=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,Cs=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,Ss=/^ *[*/]+ */,_s=/^\s*\*?\/*/,Is=/\n/g,Es=/\s/,Ts=/\\(.?)/g,Rs={0:"\0",r:"\r",n:"\n",t:"\t"};function ks(e){return e.replace(Ts,(function(e,t){switch(t){case"\\":case"":return t;default:return Rs[t]||""}}))}function Ns(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(Is),h=0;h<d.length;++h)d[h]=d[h].replace(t?_s:Ss,"").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?Cs:Os;t.lastIndex=r-1;var n=t.exec(e);if(!n)throw l("string");return r=t.lastIndex,g(c),c=null,ks(n[1])}();var i,s,p,y,v,m=0===r;do{if(r===n)return null;for(i=!1;Es.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(ws.lastIndex=0,!ws.test(u(b++)))for(;b<n&&!ws.test(u(b));)++b;var w=e.substring(r,r=b);return'"'!==w&&"'"!==w||(c=w),w}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}})}Ns.unescape=ks;var As=Qs;Qs.filename=null,Qs.defaults={keepCase:!1};var Ds=bs,xs=ps(),Ms=fs(),Ls=Bi(),Us=Fi(),Bs=ji(),js=vs(),Ps=qi(),Fs=Gi(),Gs=Ui(),qs=gs(),Hs=/^[1-9][0-9]*$/,Ks=/^-?[1-9][0-9]*$/,zs=/^0[x][0-9a-fA-F]+$/,Vs=/^-?0[x][0-9a-fA-F]+$/,Ws=/^0[0-7]+$/,$s=/^-?0[0-7]+$/,Js=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,Zs=/^[a-zA-Z_][a-zA-Z_0-9]*$/,Xs=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,Ys=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function Qs(e,t,r){t instanceof xs||(r=t,t=new xs),r||(r=Qs.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}:qs.camelCase;function b(e,t,r){var n=Qs.filename;return r||(Qs.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+l.line+")")}function w(){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 O(e){var t=u();switch(t){case"'":case'"':return d(t),w();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(Hs.test(e))return r*parseInt(e,10);if(zs.test(e))return r*parseInt(e,16);if(Ws.test(e))return r*parseInt(e,8);if(Js.test(e))return r*parseFloat(e);throw b(e,"number",t)}(t,!0)}catch(r){if(e&&Xs.test(t))return t;throw b(t,"value")}}function C(e,t){var r,n;do{!t||'"'!==(r=h())&&"'"!==r?e.push([n=S(u()),f("to",!0)?S(u()):n]):e.push(w())}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(Ks.test(e))return parseInt(e,10);if(Vs.test(e))return parseInt(e,16);if($s.test(e))return parseInt(e,8);throw b(e,"id")}function _(){if(void 0!==n)throw b("package");if(n=u(),!Xs.test(n))throw b(n,"name");v=v.define(n),f(";")}function I(){var e,t=h();switch(t){case"weak":e=i||(i=[]),u();break;case"public":u();default:e=o||(o=[])}t=w(),f(";"),e.push(t)}function E(){if(f("="),s=w(),!(y="proto3"===s)&&"proto2"!==s)throw b(s,"syntax");f(";")}function T(e,t){switch(t){case"option":return D(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(!Zs.test(t=u()))throw b(t,"service name");var r=new Ps(t);R(r,(function(e){if(!T(r,e)){if("rpc"!==e)throw b(e);!function(e,t){var r=p(),n=t;if(!Zs.test(t=u()))throw b(t,"name");var o,i,s,a,c=t;f("("),f("stream",!0)&&(i=!0);if(!Xs.test(t=u()))throw b(t);o=t,f(")"),f("returns"),f("("),f("stream",!0)&&(a=!0);if(!Xs.test(t=u()))throw b(t);s=t,f(")");var l=new Fs(c,n,o,s,i,a);l.comment=r,R(l,(function(e){if("option"!==e)throw b(e);D(l,e),f(";")})),e.add(l)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!Xs.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||!Xs.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=Qs.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(!Zs.test(t=u()))throw b(t,"type name");var r=new Ms(t);R(r,(function(e){if(!T(r,e))switch(e){case"map":!function(e){f("<");var t=u();if(void 0===Gs.mapKey[t])throw b(t,"type");f(",");var r=u();if(!Xs.test(r))throw b(r,"type");f(">");var n=u();if(!Zs.test(n))throw b(n,"name");f("=");var o=new Us(m(n),S(u()),t,r);R(o,(function(e){if("option"!==e)throw b(e);D(o,e),f(";")}),(function(){L(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(!Zs.test(t=u()))throw b(t,"name");var r=new Bs(m(t));R(r,(function(e){"option"===e?(D(r,e),f(";")):(d(e),N(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":C(r.extensions||(r.extensions=[]));break;case"reserved":C(r.reserved||(r.reserved=[]),!0);break;default:if(!y||!Xs.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(!Xs.test(n))throw b(n,"type");var o=u();if(!Zs.test(o))throw b(o,"name");o=m(o),f("=");var i=new Ls(o,S(u()),n,t,r);if(R(i,(function(e){if("option"!==e)throw b(e);D(i,e),f(";")}),(function(){L(i)})),"proto3_optional"===t){var s=new Bs("_"+o);i.setOption("proto3_optional",!0),s.add(i),e.add(s)}else e.add(i);y||!i.repeated||void 0===Gs.packed[n]&&void 0!==Gs.basic[n]||i.setOption("packed",!1,!0)}else!function(e,t){var r=u();if(!Zs.test(r))throw b(r,"name");var n=qs.lcFirst(r);r===n&&(r=qs.ucFirst(r));f("=");var o=S(u()),i=new Ms(r);i.group=!0;var s=new Ls(n,o,r,t);s.filename=Qs.filename,R(i,(function(e){switch(e){case"option":D(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(!Zs.test(t=u()))throw b(t,"name");var r=new js(t);R(r,(function(e){switch(e){case"option":D(r,e),f(";");break;case"reserved":C(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!Zs.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);D(n,e),f(";")}),(function(){L(n)})),e.add(t,r,n.comment,n.options)}(r,e)}})),e.add(r)}function D(e,t){var r=f("(",!0);if(!Xs.test(t=u()))throw b(t,"name");var n,o=t,i=o;r&&(f(")"),i=o="("+o+")",t=h(),Ys.test(t)&&(n=t.slice(1),o+=t,u())),f("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,i,x(e,o),n)}function x(e,t){if(f("{",!0)){for(var r={};!f("}",!0);){if(!Zs.test(a=u()))throw b(a,"name");var n,o=a;if(f(":",!0),"{"===h())n=x(e,t+"."+a);else if("["===h()){var i;if(n=[],f("[",!0)){do{i=O(!0),n.push(i)}while(f(",",!0));f("]"),void 0!==i&&M(e,t+"."+a,i)}}else n=O(!0),M(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=O(!0);return M(e,t,c),c}function M(e,t,r){e.setOption&&e.setOption(t,r)}function L(e){if(f("[",!0)){do{D(e,"option")}while(f(",",!0));f("]")}return e}for(;null!==(a=u());)switch(a){case"package":if(!g)throw b(a);_();break;case"import":if(!g)throw b(a);I();break;case"syntax":if(!g)throw b(a);E();break;case"option":D(v,a),f(";");break;default:if(T(v,a)){g=!1;continue}throw b(a)}return Qs.filename=null,{package:n,imports:o,weakImports:i,syntax:s,root:t}}var ea,ta=na,ra=/\/|\./;function na(e,t){ra.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),na[e]=t}na("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),na("duration",{Duration:ea={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),na("timestamp",{Timestamp:ea}),na("empty",{Empty:{fields:{}}}),na("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}}}}),na("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}}}}),na("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),na.get=function(e){return na[e]||null},function(e){var t=vi.exports=mi.exports;t.build="full",t.tokenize=bs,t.parse=As,t.common=ta,t.Root._configure(t.Type,t.parse,t.common)}();var oa=p(yi.exports=vi.exports);const ia=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a.SENDING;return{conversationType:t.conversation.conversationType,targetId:t.conversation.targetId,channelId:t.conversation.channelId,senderUserId:t.senderUserId,messageDirection:s.SEND,isCounted:e.isCounted,isMentioned:!1,content:e.content,messageType:e.messageType,isOffLineMessage:!1,isPersited:e.isPersited,messageId:t.messageId,messageUId:"",sentTime:t.sentTime,sentStatus:r,receivedTime:0,isStatusMessage:e.isStatusMessage,receivedStatus:c.UNREAD,disableNotification:!1}};let sa=0;function aa(){sa++;const e=so();return sa<e&&(sa=e),23e13+sa}const ca=e=>{const t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""},la=e=>{const t=e.name;return it(t)?t.substring(t.lastIndexOf(".")+1):e.type.indexOf("/")>0?e.type.substring(e.type.lastIndexOf("/")+1):""},ua=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})},da=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 ha{async create(e){try{const r=ca(e),n=await da(r);t=r,(window.URL||window.webkitURL).revokeObjectURL(t);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/1680:n/1680;n>1680&&o>1680?e?(s=1680,i/=t):(i=1680,s/=t):n>1680&&o>160?(i=1680,s/=t,s<160&&(s=160,i=n/(o/160))):o>1680&&n>160&&(s=1680,i/=t,i<160&&(i=160,s=o/(n/160)))}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:ua(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});return{success:!0,message:new Mo({content:a,imageUri:ca(o),width:i,height:s}),file:o}}catch(e){return{success:!1}}var t}updateMessageRemoteUrlProperty(e,t){e.content.imageUri=t}}class fa{async create(e){if(e.size>2097152)return{success:!1};try{const t=ca(e),r=await da(t);return{success:!0,message:new Lo({gifDataSize:e.size,remoteUrl:t,width:r.width,height:r.height}),file:e}}catch{return{success:!1}}}updateMessageRemoteUrlProperty(e,t){e.content.remoteUrl=t}}let pa;class ga{create(e){return(t=e,at(t.arrayBuffer)?t.arrayBuffer():new Promise(((e,r)=>{const n=new FileReader;n.addEventListener("load",(t=>{t.target?e(t.target.result):r("null")})),n.addEventListener("error",(e=>r(e))),n.readAsArrayBuffer(t)}))).then(this.getAudioInfo).then((t=>({success:!0,message:new Uo({remoteUrl:"",duration:t.duration,type:la(e)}),file:e}))).catch((()=>({success:!1})));var t}updateMessageRemoteUrlProperty(e,t){e.content.remoteUrl=t}getAudioInfo(e){const t=pa||new AudioContext;return pa=t,new Promise(((r,n)=>{t.decodeAudioData(e,(function(e){r({duration:e.duration,length:e.length})}),n)}))}}class ya{async create(e){return e.size>104857600?{success:!1}:{success:!0,message:new Bo({fileUrl:"",name:e.name,type:la(e),size:e.size}),file:e}}updateMessageRemoteUrlProperty(e,t){e.content.fileUrl=t}}var va;!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"}(va||(va={}));class ma{constructor(e){h(this,"options",void 0),h(this,"xhr",void 0),this.options=e}upload(e,t){const r=new XMLHttpRequest;r.timeout=1e3*(30+e.size/1024/512),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=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 ba=[ko,To,No,Ro];async function wa(e,t,r){return Ta(e,t,r)}const Oa=Ea.bind(null,va.IMAGE),Ca=Ea.bind(null,va.GIF),Sa=Ea.bind(null,va.AUDIO),_a=Ea.bind(null,va.FILE),Ia=async(e,r)=>{const n=Gn(e);uo.addMessage(r.messageUId);const o=await((e,t)=>{let r;return r=Hn(e)?xn.send(At.RecallGroupMessage,{groupId:e,msgId:nn.fromString(t)},{encoder:Qn.RecallGroupChatMessageReq,decoder:Yr.BaseResp}):xn.send(At.RecallPrivateMessage,{destId:e,msgId:nn.fromString(t)},{encoder:$n.RecallPrivateChatMessageReq,decoder:Yr.BaseResp}),r})(n,r.messageUId);if(o.code!==t.SUCCESS)return{code:o.code};const i=new jo({sentTime:r.sentTime,messageUId:r.messageUId,...e}),s={conversation:e,senderUserId:Mn.uid,messageId:0,sentTime:so()},c=ia(i,s,a.SENT);return li.get().setConversationCacheByMessage(c),{code:t.SUCCESS,data:c}};async function Ea(e,r,n,o,i){const s=(e=>{let t;switch(e){case va.IMAGE:t=new ha;break;case va.AUDIO:t=new ga;break;case va.GIF:t=new fa;break;case va.FILE:t=new ya}return t})(e);if(!s)return{code:t.NOT_SUPPORT};const{success:a,message:c,file:l}=await s.create(n.file);return a&&c&&l?(c.content.user=n.user,c.content.extra=n.extra,Ta(r,c,i,{file:l,task:(e,t)=>new Promise((r=>{new ma({token:Fn.imInitToken,uploadUrl:Fn.fileUploadUrl,cert:Fn.cert,transformer:e=>({...e,url:Fn.getFileAbsoluteUri(e.url)})}).upload(t,{onProgress:(e,t)=>{var r;return null==o||null===(r=o.onProgress)||void 0===r?void 0:r.call(o,Math.floor(e/t*100))},onError:()=>{r({finished:!1,message:e})},onCompleted:t=>{var n;s.updateMessageRemoteUrlProperty(e,t.url),r({finished:!0,message:(null==o||null===(n=o.onComplete)||void 0===n?void 0:n.call(o,{url:t.url}))??e})}})}))})):{code:t.MEDIA_EXCEPTION}}async function Ta(r,i,s,c){const l=function(r,n,o){if(!di.loader||di.loader.getConnectionStatus()!==e.CONNECTED)return{code:t.RC_NET_CHANNEL_INVALID};const i=JSON.stringify(lt(n.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:t.RC_MSG_CONTENT_EXCEED_LIMIT};const s={conversation:r,senderUserId:Mn.uid,messageId:(null==o?void 0:o.messageId)??aa(),sentTime:Na(),directionalUserIdList:null==o?void 0:o.directionalUserIdList};if(null!=o&&o.onSendBefore){const e=ia(n,s);o.onSendBefore(e)}return{code:t.SUCCESS,message:n,sentArgs:s}}(r,i,s);if(l.code!==t.SUCCESS||!l.message||!l.sentArgs)return{code:l.code};let{message:u,sentArgs:d}=l;if(Xe(c)){const e=await c.task(u,c.file);if(u=e.message,!e.finished)return{code:t.UPLOAD_FILE_FAILED,data:ia(u,d,a.FAILED)}}return async function(e,r){const i=Gn(r.conversation),s=ia(e,r);e.isPersited&&li.get().loadConvsationsIfNotExist([r.conversation]);const c=await zo.getDialogAesKey(i);if(!c)return s.sentStatus=a.FAILED,{code:t.MSG_ENCRYPT_ERROR,data:s};const l=JSON.stringify(lt(e.encode())),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 Jo(r.ciphertext.words)})(l,c);co.addMessage(r.messageId);const d={localId:nn.fromNumber(r.messageId),mediaFlag:ba.includes(e.messageType),mediaConstructor:e.objectId,mediaAttribute:"",msgPreContent:"",msgPostContent:"",msgContent:u};let h;if(r.conversation.conversationType===n.GROUP){var f;const t={...d,groupId:i};if(null!=r&&null!==(f=r.directionalUserIdList)&&void 0!==f&&f.length&&(t.assign=r.directionalUserIdList.join(",")),Xe(e.content.mentionedInfo)){var p;const r=e.content.mentionedInfo;r.type===o.ALL?t.atAll=!0:r.type===o.SINGAL&&null!==(p=r.userIdList)&&void 0!==p&&p.length&&(t.at=r.userIdList.map((e=>nn.fromString(e))))}h=await(g=t,xn.send(At.SendGroupChatMessage,g,{encoder:Qn.SendGroupChatMessageReq,decoder:no}))}else{const e={...d,destId:i};h=await(e=>xn.send(At.SendPrivateChatMessage,e,{encoder:$n.SendPrivateChatMessageReq,decoder:Pn.SendPrivateChatMessageResp}))(e)}var g;h.code===t.SUCCESS?(s.sentTime=h.data.seqno.toNumber(),s.messageUId=h.data.msgId.toString(),s.sentStatus=a.SENT,li.get().setConversationCacheByMessage(s)):s.sentStatus=a.FAILED;return{code:h.code,data:s}}(u,d)}let Ra,ka=1;function Na(){ka++;const e=so();return ka<e&&(ka=e),ka}class Aa extends kt{constructor(e){if(Aa.imClient)return bt.error("Please do not perform the init method repeatedly"),Aa.imClient;super(),h(this,"options",void 0),h(this,"libLoader",void 0),h(this,"getServerTime",so),h(this,"sendMessage",wa),h(this,"sendImageMessage",Oa),h(this,"sendGIFMessage",Ca),h(this,"sendHQVoiceMessage",Sa),h(this,"sendFileMessage",_a),h(this,"recallMsg",Ia),this.options=e,this.fixedProtobuf(),Xe(e.logLevel)&&bt.setLogLevel(e.logLevel),Xe(e.logStdout)&&bt.setLogStdout(e.logStdout),bt.debug("IMClient.init -> ",e.appkey),this.libLoader=di.init(e),this.watch(),Aa.imClient=this}fixedProtobuf(){oa.util.Long=nn,oa.configure()}watch(){this.libLoader.assignWatcher({onConnecting:()=>{this.emit(d.CONNECTING)},onConnected:()=>{this.emit(d.CONNECTED)},onDisconnect:()=>{this.emit(d.DISCONNECT,this.libLoader.getConnectionStatus())},onSuspend:()=>{this.emit(d.SUSPEND,this.libLoader.getConnectionStatus())},batchMessage:e=>{this.emit(d.MESSAGES,{messages:e})},pullFinished:()=>{this.emit(d.PULL_OFFLINE_MESSAGE_FINISHED)},conversationState:e=>{this.emit(d.CONVERSATION,{conversations:e})}})}connect(e){return this.libLoader.connect(e)}disconnect(){return this.libLoader.disconnect()}getConnectionStatus(){return this.libLoader.getConnectionStatus()}async getRemoteHistoryMessages(e,n){const o=Gn(e);return(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),xn.send(e.dialogId.startsWith("SG")?At.GetSuperGroupRemoteMessages:At.GetRemoteMessages,t,{encoder:$n.GetHistoryMessageReq,decoder:Pn.GetHistoryMessageResp})})({dialogId:o,offset:n.timestamp??0,count:n.count??20,newToOld:0===n.order}).then((e=>{let{code:n,data:i}=e;return new Promise((e=>{n===t.SUCCESS?ei.parse({[o]:i.msg??{}},((r,n)=>{const s=n[o]??[];s.sort(((e,t)=>e.sentTime-t.sentTime)),e({code:t.SUCCESS,data:{list:s,hasMore:!i.isEnd}})})):e({code:n,msg:r(n)})}))}))}async deleteRemoteMessage(e,t){return(r=Gn(e),n=t.map((e=>e.messageUId)),xn.send(At.DeleteChatMessages,{destId:r,msgIdList:n.map((e=>nn.fromString(e)))},{encoder:$n.DeleteChatMessageReq,decoder:Yr.BaseResp})).then((e=>e.code));var r,n}async deleteRemoteMessageByTimestamp(e,t){return((e,t)=>xn.send(At.ClearChatHistoryMessage,{destId:e,type:Hn(e)?1:0,msgTime:nn.fromNumber(t)},{encoder:$n.CleanHistoryMessageReq,decoder:Yr.BaseResp}))(Gn(e),0===t?Number.MAX_VALUE:t).then((e=>e.code))}async getConversationList(e,r,n,o){const i={rows:e,type:r??0,offset:nn.fromNumber(n),newToOld:0===o},{code:s,data:a}=await(e=>xn.send(At.GetDialogList,e,{encoder:$n.GetWebDialogListReq,decoder:Pn.GetWebDialogListResp}))(i);if(s!==t.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 zo.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};li.get().addLocalConversation(t);const r=li.get().get(e);Object.assign(t,r),l.push(t)}}return{code:t.SUCCESS,data:l}}getBlockConversationList(){const e=li.get().getBlockConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}getTopConversationList(){const e=li.get().getTopConversationList();return Promise.resolve({code:t.SUCCESS,data:e})}async getConversation(e){const r=li.get().get(e);if(!r)return{code:t.CONVER_GET_ERROR};const{code:n,data:o}=await this.getRemoteHistoryMessages(e,{count:1,order:0});if(n!==t.SUCCESS)return{code:t.CONVER_GET_ERROR};const i=null==o?void 0:o.list[0],s={...e,...r,latestMessage:i};return{code:t.SUCCESS,data:s}}removeConversation(e){return(e=>{let t;return t=Hn(e)?xn.send(At.DeleteGroupDialog,{groupId:e},{encoder:Qn.DeleteGroupChatDialogReq,decoder:Yr.BaseResp}):xn.send(At.DeletePrivateDialog,{destId:e},{encoder:$n.DeletePrivateChatDialogReq,decoder:Yr.BaseResp}),t})(Gn(e)).then((e=>e.code))}getUnreadMentionedCount(e){return li.get().getUnreadMentionedCount(e)}getAllUnreadMentionedCount(){return li.get().getAllUnreadMentionedCount()}getAllConversationState(){return li.get().getAllConversationState()}getAllConversationUnreadCount(e,t){return li.get().getAllUnreadCount(e,t)}getConversationUnreadCount(e){return li.get().getUnreadCount(e)}clearConversationUnreadCount(e){li.get().clearUnreadCount(e)}clearAllConversationsUnreadCount(){li.get().clearAllUnreadCount()}getConversationNotificationLevel(e){return li.get().getNotificationLevel(e)}setConversationNotificationStatus(e,t){return((e,t)=>{let r;return r=Hn(e)?xn.send(At.UpdateGroupChatMuteConfig,{groupId:e,muteFlag:t},{encoder:Qn.UpdateGroupChatDialogMuteConfigReq,decoder:Yr.BaseResp}):xn.send(At.UpdatePrivateChatMuteConfig,{destId:e,muteFlag:t},{encoder:$n.UpdatePrivateChatDialogMuteConfigReq,decoder:Yr.BaseResp}),r})(Gn(e),t===i.OPEN).then((r=>(!r.code&&li.get().addStatus({...e,notificationStatus:t,notificationLevel:t==i.OPEN?l.AT_USER_NOTIFICATION:l.NOT_SET},!0),r.code)))}getConversationNotificationStatus(e){return li.get().getNotificationStatus(e)}setConversationToTop(e,t){return((e,t)=>{let r;return r=Hn(e)?xn.send(At.UpdateGroupChatStickyConfig,{groupId:e,stickyFlag:t},{encoder:Qn.UpdateGroupChatDialogStickyConfigReq,decoder:Yr.BaseResp}):xn.send(At.UpdatePrivateChatStickyConfig,{destId:e,stickyFlag:t},{encoder:$n.UpdatePrivateChatDialogStickyConfigReq,decoder:Yr.BaseResp}),r})(Gn(e),t).then((r=>(!r.code&&li.get().addStatus({...e,isTop:t},!0),r.code)))}saveConversationMessageDraft(e,t){li.get().setDraft(e,t)}getConversationMessageDraft(e){return li.get().getDraft(e)}clearConversationMessageDraft(e){li.get().clearDraft(e)}formatConversation(e){const{dialog:t,msg:r}=e,n=t.destId??"",o=oi(t);if(!o)return;const i=zo.getDialogAesKeyFromLocal(n);if(!i)return;const s=ei.parseSingleDialogMessages(n,[r],i)[0];return s?(o.latestMessage=s,o):void 0}}h(Aa,"imClient",void 0);const Da=e=>{Ra=Ra||new Aa(e)},xa=async e=>{Tt("token",e,wt,!0);const n=await Ra.connect(e);return n.code===t.SUCCESS?{code:n.code,data:{userId:n.userId}}:{code:n.code,msg:r(n.code)}},Ma=()=>Ra.disconnect(),La=()=>Ra.getConnectionStatus(),Ua=()=>Ra.getServerTime(),Ba=(e,t,r)=>{Ra.on(e,t,r)};function ja(e,t,r){Ra.once(e,t,r)}const Pa=(e,t,r)=>{Ra.off(e,t,r)},Fa=async e=>{bt.debug("get conversation list ->");const{code:n,data:o}=await Ra.getConversationList((null==e?void 0:e.count)??20,null,(null==e?void 0:e.startTime)??0,(null==e?void 0:e.order)??0);return n!==t.SUCCESS&&bt.warn("get conversation list fail ->"+n+":"+r(n)),{code:n,msg:r(n),data:o}},Ga=async e=>{Tt("options",e,It,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("get conversation ->"+n);const{code:o,data:i}=await Ra.getConversation(e);return o!==t.SUCCESS?(bt.warn("get conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o,data:i}},qa=async e=>{Tt("options",e,It,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("remove conversation ->"+n);const o=await Ra.removeConversation(e);return o!==t.SUCCESS?(bt.warn("remove conversation fail ->"+o+":"+r(o)+","+n),{code:o,msg:r(o)}):{code:o}},Ha=e=>{Tt("options",e,It,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("get draft ->"+r);const n=Ra.getConversationMessageDraft(e);return Promise.resolve({code:t.SUCCESS,data:n})},Ka=(e,r)=>{Tt("options",e,It,!0),Tt("draft",r,wt,!0);const n="conversationType:"+e.conversationType+",targetId:"+e.targetId;return bt.debug("set draft ->"+n),Ra.saveConversationMessageDraft(e,r),Promise.resolve({code:t.SUCCESS})},za=e=>{Tt("options",e,It,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return bt.debug("delete draft ->"+r),Ra.clearConversationMessageDraft(e),Promise.resolve({code:t.SUCCESS})},Va=e=>{Tt("options",e,It,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return bt.debug("get unreadMentionedCount ->"+r),Promise.resolve({code:t.SUCCESS,data:Ra.getUnreadMentionedCount(e)})},Wa=()=>{bt.debug("getAllUnreadMentionedCount");const e=Ra.getAllUnreadMentionedCount();return Promise.resolve({code:t.SUCCESS,data:e})},$a=()=>{bt.debug("getAllConversationState");const e=Ra.getAllConversationState();return Promise.resolve({code:t.SUCCESS,data:e})},Ja=(e,r)=>{if(bt.debug("get total unread count -> ConversationType:"+JSON.stringify(r)+" includeMuted:"+e),Tt("includeMuted",e,Ct,!1),Tt("conversationTypes",r,St,!1),r)for(const e of r)Tt("conversationType",e,_t,!0);const n=Ra.getAllConversationUnreadCount(r??[],e??!1);return Promise.resolve({code:t.SUCCESS,data:n})},Za=e=>{Tt("options",e,It,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("get unreadCount ->"+r);const n=Ra.getConversationUnreadCount(e);return Promise.resolve({code:t.SUCCESS,data:n})},Xa=e=>{Tt("options",e,It,!0);const r="conversationType:"+e.conversationType+",targetId:"+e.targetId;return bt.debug("clear unreadMsgNum ->"+r),Ra.clearConversationUnreadCount(e),Promise.resolve({code:t.SUCCESS})},Ya=()=>(bt.debug("clear allMessagesUnreadStatus"),Ra.clearAllConversationsUnreadCount(),Promise.resolve({code:t.SUCCESS})),Qa=e=>{Tt("options",e,It,!0),bt.info("getConversationNotificationLevel ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Ra.getConversationNotificationLevel(e);return Promise.resolve({code:t.SUCCESS,data:r})},ec=async(e,n)=>{Tt("options",e,It,!0),Tt("notificationStatus",n,(e=>1===e||2===e),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("set conversation status ->"+o);const i=await Ra.setConversationNotificationStatus(e,n);return i!==t.SUCCESS?(bt.warn("set conversation status fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:i}},tc=e=>{Tt("options",e,It,!0),bt.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType);const r=Ra.getConversationNotificationStatus(e);return Promise.resolve({code:t.SUCCESS,data:r})},rc=()=>Ra.getBlockConversationList(),nc=async function(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Tt("options",e,It,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("set conversation status ->"+o);const i=await Ra.setConversationToTop(e,n);return i!==t.SUCCESS?(bt.warn("set conversation status fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:i}},oc=()=>Ra.getTopConversationList(),ic=(e,t,r,n,o)=>function(n){return o?new Ko(e,n):r?new Ho(e,n):t?new qo(e,n):new Go(e,n)},sc=async(e,r,n)=>{if(r instanceof po==!1)return bt.warn("send message fail -> message parameter is not an instance of BaseMessage"),{code:t.PARAMETER_ERROR};Tt("conversation",e,It,!0),vc(e);const o=await Ra.sendMessage(e,r,n);return mc(e,o.code),o},ac=(e,t,r)=>{const n=new xo(t);return sc(e,n,r)},cc=async(e,t,r,n)=>{Tt("conversation",e,It,!0),Tt("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.startsWith("image/")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("send message ->"+o),vc(e);const i=await Ra.sendImageMessage(e,t,r,n);return mc(e,i.code),i},lc=async(e,t,r,n)=>{Tt("conversation",e,It,!0),Tt("msgBody.file",t.file,(e=>e instanceof Blob&&e.type.endsWith("image/gif")),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("send message ->"+o),vc(e);const i=await Ra.sendGIFMessage(e,t,r,n);return mc(e,i.code),i},uc=async(e,t,r,n)=>{Tt("conversation",e,It,!0),Tt("msgBody.file",t.file,(e=>e instanceof Blob),!0),vc(e);const o=await Ra.sendHQVoiceMessage(e,t,r,n);return mc(e,o.code),o},dc=async(e,t,r,n)=>{Tt("conversation",e,It,!0),Tt("msgBody.file",t.file,(e=>e instanceof Blob),!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("send message ->"+o),vc(e);const i=await Ra.sendFileMessage(e,t,r,n);return mc(e,i.code),i},hc=async(e,n)=>{Tt("options.messageUId",n.messageUId,wt,!0),Tt("options.sentTime",n.sentTime,Ot,!0),Tt("conversation",e,It,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+n.messageUId;bt.debug("recall message ->"+o);const i=await Ra.recallMsg(e,n);return i.code!==t.SUCCESS&&bt.warn("recall message fail ->"+i.code+":"+r(i.code)+","+o),i},fc=async(e,n)=>{Tt("options.timestamp",n.timestamp??0,Ot),Tt("options.count",n.count??0,Ot),Tt("options.order",n.order??0,(e=>0===e||1===e)),Tt("conversation",e,It,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("get history message ->"+o);const i=await Ra.getRemoteHistoryMessages(e,n);return i.code!==t.SUCCESS&&bt.warn("get history message fail ->"+i.code+":"+r(i.code)+","+o),i},pc=async(e,n)=>{Tt("options.timestamp",n.timestamp??0,Ot),Tt("options.count",n.count??0,Ot),Tt("options.order",n.order??0,(e=>0===e||1===e)),Tt("conversation",e,It,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("get remote history message ->"+o);const i=await Ra.getRemoteHistoryMessages(e,n);return i.code!==t.SUCCESS&&bt.warn("get remote history message fail ->"+i.code+":"+r(i.code)+","+o),i},gc=async(e,n)=>{Tt("messages",n,(e=>nt(e)&&!!e.length),!0),n.forEach((e=>{Tt("messages.messageUId",e.messageUId,wt,!0),Tt("messages.sentTime",e.sentTime,Ot,!1),Tt("messages.messageDirection",e.messageDirection,(e=>1===e||2===e),!1)})),Tt("conversation",e,It,!0);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("delete messages ->"+o);const i=await Ra.deleteRemoteMessage(e,n);return i!==t.SUCCESS?(bt.warn("delete message fail ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:t.SUCCESS}},yc=async(e,n)=>{Tt("timestamp",n,(e=>Ot(e)&&e>=0),!0),Tt("conversation",e,It);const o="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("clear message ->"+o);const i=await Ra.deleteRemoteMessageByTimestamp(e,n);return i!==t.SUCCESS?(bt.warn("clear message ->"+i+":"+r(i)+","+o),{code:i,msg:r(i)}):{code:t.SUCCESS}},vc=e=>{const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.debug("send message ->"+t)},mc=(e,n)=>{if(n!==t.SUCCESS){const t="conversationType:"+e.conversationType+",targetId:"+e.targetId;bt.warn("send message fail ->"+n+":"+r(n)+","+t)}};export{Po as CommandMessage,e as ConnectionStatus,n as ConversationType,t as ErrorCode,r as ErrorDesc,d as Events,Bo as FileMessage,Lo as GIFMessage,Uo as HQVoiceMessage,Mo as ImageMessage,u as LogLevel,o as MentionedType,s as MessageDirection,l as NotificationLevel,i as NotificationStatus,c as ReceivedStatus,a as SentStatus,xo as TextMessage,Ba as addEventListener,Ya as clearAllMessagesUnreadStatus,yc as clearHistoryMessages,Xa as clearMessagesUnreadStatus,za as clearTextMessageDraft,xa as connect,gc as deleteMessages,Ma as disconnect,$a as getAllConversationState,Wa as getAllUnreadMentionedCount,rc as getBlockedConversationList,La as getConnectionStatus,Ga as getConversation,Fa as getConversationList,Qa as getConversationNotificationLevel,tc as getConversationNotificationStatus,fc as getHistoryMessages,pc as getRemoteHistoryMessages,Ua as getServerTime,Ha as getTextMessageDraft,oc as getTopConversationList,Ja as getTotalUnreadCount,Za as getUnreadCount,Va as getUnreadMentionedCount,Da as init,ja as onceEventListener,hc as recallMessage,ic as registerMessageType,qa as removeConversation,Pa as removeEventListener,Ka as saveTextMessageDraft,dc as sendFileMessage,lc as sendGIFMessage,uc as sendHQVoiceMessage,cc as sendImageMessage,sc as sendMessage,ac as sendTextMessage,ec as setConversationNotificationStatus,nc as setConversationToTop};