@cg-devcenter/rtc-fpnn-webjs-sdk 1.0.0-cg.10
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/README.md +113 -0
- package/dist/rtm.d.cts +3 -0
- package/dist/rtm.d.mts +59 -0
- package/dist/rtm.d.ts +639 -0
- package/dist/rtm.min.js +27 -0
- package/dist/rtm.mjs +18 -0
- package/dist/rtm.shared-worker.js +27 -0
- package/dist/rtm.vite-plugin.d.mts +8 -0
- package/dist/rtm.vite-plugin.mjs +23 -0
- package/dist/rtm.vite.d.ts +59 -0
- package/dist/rtm.vite.mjs +33 -0
- package/dist/rtm.webpack4-adapter.cjs +29 -0
- package/dist/rtm.webpack4-plugin.cjs +50 -0
- package/dist/rtm.webpack4-plugin.d.cts +5 -0
- package/docs/CAPABILITIES.md +129 -0
- package/docs/Chat.md +278 -0
- package/docs/Data.md +33 -0
- package/docs/EventProcess.md +126 -0
- package/docs/Files.md +52 -0
- package/docs/Friends.md +50 -0
- package/docs/Groups.md +64 -0
- package/docs/LEGACY_RTM_TLV_COMPATIBILITY.md +188 -0
- package/docs/Messages.md +183 -0
- package/docs/PROTOCOL_MIGRATION.md +148 -0
- package/docs/RTM_MIGRATION.md +206 -0
- package/docs/Rooms.md +67 -0
- package/docs/System.md +49 -0
- package/docs/TLV.md +62 -0
- package/docs/TLV_CONTRACT.md +180 -0
- package/docs/USAGE.md +624 -0
- package/docs/Users.md +48 -0
- package/docs/ValueAdded.md +82 -0
- package/package.json +93 -0
package/dist/rtm.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var is=Object.create;var Sr=Object.defineProperty;var ss=Object.getOwnPropertyDescriptor;var os=Object.getOwnPropertyNames;var as=Object.getPrototypeOf,us=Object.prototype.hasOwnProperty;var Ft=(E=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(E,{get:(g,m)=>(typeof require<"u"?require:g)[m]}):E)(function(E){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+E+'" is not supported')});var Ye=(E,g)=>()=>(g||E((g={exports:{}}).exports,g),g.exports);var fs=(E,g,m,R)=>{if(g&&typeof g=="object"||typeof g=="function")for(let C of os(g))!us.call(E,C)&&C!==m&&Sr(E,C,{get:()=>g[C],enumerable:!(R=ss(g,C))||R.enumerable});return E};var cs=(E,g,m)=>(m=E!=null?is(as(E)):{},fs(g||!E||!E.__esModule?Sr(m,"default",{value:E,enumerable:!0}):m,E));var Mr=Ye((Dt,In)=>{(function(E,g){typeof Dt=="object"&&typeof In=="object"?In.exports=g():typeof define=="function"&&define.amd?define([],g):typeof Dt=="object"?Dt.fpnn=g():E.fpnn=g()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:Dt,(function(){return(function(E){var g={};function m(R){if(g[R])return g[R].exports;var C=g[R]={i:R,l:!1,exports:{}};return E[R].call(C.exports,C,C.exports,m),C.l=!0,C.exports}return m.m=E,m.c=g,m.d=function(R,C,O){m.o(R,C)||Object.defineProperty(R,C,{enumerable:!0,get:O})},m.r=function(R){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(R,"__esModule",{value:!0})},m.t=function(R,C){if(1&C&&(R=m(R)),8&C||4&C&&typeof R=="object"&&R&&R.__esModule)return R;var O=Object.create(null);if(m.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:R}),2&C&&typeof R!="string")for(var P in R)m.d(O,P,function(T){return R[T]}.bind(null,P));return O},m.n=function(R){var C=R&&R.__esModule?function(){return R.default}:function(){return R};return m.d(C,"a",C),C},m.o=function(R,C){return Object.prototype.hasOwnProperty.call(R,C)},m.p="",m(m.s=8)})([function(E,g,m){"use strict";var R=(function(){function V(H,z){for(var Q=0;Q<z.length;Q++){var Z=z[Q];Z.enumerable=Z.enumerable||!1,Z.configurable=!0,"value"in Z&&(Z.writable=!0),Object.defineProperty(H,Z.key,Z)}}return function(H,z,Q){return z&&V(H.prototype,z),Q&&V(H,Q),H}})(),C=m(10).Buffer,O={FPNN_EC_OK:0,FPNN_EC_PROTO_UNKNOWN_ERROR:10001,FPNN_EC_PROTO_NOT_SUPPORTED:10002,FPNN_EC_PROTO_INVALID_PACKAGE:10003,FPNN_EC_PROTO_JSON_CONVERT:10004,FPNN_EC_PROTO_STRING_KEY:10005,FPNN_EC_PROTO_MAP_VALUE:10006,FPNN_EC_PROTO_METHOD_TYPE:10007,FPNN_EC_PROTO_PROTO_TYPE:10008,FPNN_EC_PROTO_KEY_NOT_FOUND:10009,FPNN_EC_PROTO_TYPE_CONVERT:10010,FPNN_EC_CORE_UNKNOWN_ERROR:20001,FPNN_EC_CORE_CONNECTION_CLOSED:20002,FPNN_EC_CORE_TIMEOUT:20003,FPNN_EC_CORE_UNKNOWN_METHOD:20004,FPNN_EC_CORE_ENCODING:20005,FPNN_EC_CORE_DECODING:20006,FPNN_EC_CORE_SEND_ERROR:20007,FPNN_EC_CORE_RECV_ERROR:20008,FPNN_EC_CORE_INVALID_PACKAGE:20009,FPNN_EC_CORE_HTTP_ERROR:20010,FPNN_EC_CORE_WORK_QUEUE_FULL:20011,FPNN_EC_CORE_INVALID_CONNECTION:20012,FPNN_EC_CORE_FORBIDDEN:20013,FPNN_EC_CORE_SERVER_STOPPING:20014},P=C.from([0,1]),T=C.from([64,128]),S=C.from([0,1,2]),I=C.from("FPNN"),N=C.from("POST"),B=["secp256k1","secp224r1"],L=["aes-128-cfb","aes-256-cfb"],j=(function(){function V(){(function(H,z){if(!(H instanceof z))throw new TypeError("Cannot call a class as a function")})(this,V)}return R(V,null,[{key:"SDK_VERSION",get:function(){return"2.0.0"}},{key:"BUFFER",get:function(){return C}},{key:"ERROR_CODE",get:function(){return O}},{key:"FP_FLAG",get:function(){return T}},{key:"FP_MESSAGE_TYPE",get:function(){return S}},{key:"TCP_MAGIC",get:function(){return I}},{key:"HTTP_MAGIC",get:function(){return N}},{key:"FPNN_VERSION",get:function(){return P}},{key:"READ_BUFFER_LEN",get:function(){return 1024}},{key:"CHECK_CBS_INTERVAL",get:function(){return 1e3}},{key:"SEND_TIMEOUT",get:function(){return 2e4}},{key:"CRYPTO_CURVES",get:function(){return B}},{key:"CRYPTO_ALGORITHM",get:function(){return L}}]),V})();E.exports=j},function(E,g,m){"use strict";var R=(function(){function O(P,T){for(var S=0;S<T.length;S++){var I=T[S];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(P,I.key,I)}}return function(P,T,S){return T&&O(P.prototype,T),S&&O(P,S),P}})(),C=(function(){function O(){(function(P,T){if(!(P instanceof T))throw new TypeError("Cannot call a class as a function")})(this,O)}return R(O,null,[{key:"assign",value:function(P){if(!P||P.hasOwnProperty("events"))throw new Error(P+" is null or hasOwnProperty [ events ]");if(P.hasOwnProperty("on")||P.hasOwnProperty("emit")||P.hasOwnProperty("removeEvent"))throw new Error(P+" hasOwnProperty [ on | emit | removeEvent | listenerCount]");P.events={},P.on=function(T,S){P.events.hasOwnProperty(T)||(P.events[T]=[]),P.events[T].indexOf(S)==-1&&P.events[T].push(S)},P.emit=function(){if(arguments.length!=0)for(var T=P.events[arguments[0]]||[],S=0;S<T.length;S++){var I=T[S];if(I){for(var N=[],B=1;B<arguments.length;B++)N[B-1]=arguments[B];I.apply(P,N)}}},P.removeEvent=function(){if(arguments.length!=0)if(arguments.length!=1){var T=arguments[0],S=P.events[T].indexOf(arguments[1]);S>-1&&P.events[T].splice(S,1)}else{var I=arguments[0];P.events.hasOwnProperty(I)&&delete P.events[I]}else P.events={}},P.listenerCount=function(T){return P.events.hasOwnProperty(T)?(P.events[T]||[]).length:0}}}]),O})();E.exports=C},function(E,g,m){"use strict";function R(C,O){this.code=C,this.name="FPError",this.message=O.message||"",this.stack=O.stack,this.error=O}R.prototype=Object.create(Error.prototype),R.prototype.toString=function(){return"code: "+this.code+" ex: "+this.message},E.exports=R},function(E,g,m){"use strict";var R=(function(){function L(j,V){for(var H=0;H<V.length;H++){var z=V[H];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(j,z.key,z)}}return function(j,V,H){return V&&L(j.prototype,V),H&&L(j,H),j}})();m(0);var C=m(1),O=m(4),P=(function(){function L(j){(function(H,z){if(!(H instanceof z))throw new TypeError("Cannot call a class as a function")})(this,L),C.assign(this),this._endpoint=j.endpoint||null,this._timeout=j.connectionTimeout||1e4,this._platform=j.platformImpl||new O,this._connectTimeout=0,this._queue=[];var V=this;C.assign(this._platform),this._platform.on("open",(function(){I.call(V)})),this._platform.on("message",(function(H){S.call(V,H)})),this._platform.on("close",(function(){N.call(V)})),this._platform.on("error",(function(H){B.call(V,H)}))}return R(L,[{key:"write",value:function(j){if(j)if(Object.prototype.toString.call(j)==="[object String]")this._queue.push(j);else{var V=j.buffer.slice(j.byteOffset,j.byteOffset+j.byteLength);this._queue.push(V)}T.call(this)}},{key:"close",value:function(j){j&&this.emit("error",j),this._platform.close()}},{key:"open",value:function(){if(this.isConnecting||this.isOpen||!this._endpoint)this.emit("error",new Error("has connected or worng endpoint!"));else{var j=this;this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),this._connectTimeout=setTimeout((function(){var V=new Error("connect timeout!");if(j.isOpen)j.close(V);else{if(j.isConnecting)return j.close(V),void N.call(j);B.call(j,V),N.call(j)}}),this._timeout),this._platform.open(this._endpoint)}}},{key:"destroy",value:function(){this.removeEvent(),this.close(),this._platform.removeEvent(),N.call(this)}},{key:"endpoint",get:function(){return this._endpoint}},{key:"isOpen",get:function(){return this._platform.isOpen}},{key:"isConnecting",get:function(){return this._platform.isConnecting}}]),L})();function T(){if(this.isOpen)for(;this._queue.length;)this._platform.send(this._queue.shift())}function S(L){this.emit("data",L)}function I(){this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),T.call(this),this.emit("connect")}function N(){this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),this._queue=[],this.emit("close")}function B(L){this.emit("error",L)}E.exports=P},function(E,g,m){"use strict";var R=(function(){function O(P,T){for(var S=0;S<T.length;S++){var I=T[S];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(P,I.key,I)}}return function(P,T,S){return T&&O(P.prototype,T),S&&O(P,S),P}})(),C=(function(){function O(){(function(P,T){if(!(P instanceof T))throw new TypeError("Cannot call a class as a function")})(this,O),this._socket=null}return R(O,[{key:"open",value:function(P){var T=this;try{this._socket=new WebSocket(P)}catch(S){return void this.emit("error",S)}this._socket.binaryType="arraybuffer",this._socket.onopen=function(S){T.emit("open")},this._socket.onmessage=function(S){T.emit("message",S.data)},this._socket.onclose=function(S){T.emit("close")},this._socket.onerror=function(S){T.emit("error",S)}}},{key:"send",value:function(P){try{this._socket.send(P)}catch(T){return void this.emit("error",T)}}},{key:"close",value:function(){this._socket&&this._socket.close()}},{key:"isOpen",get:function(){return!!this._socket&&this._socket.readyState==WebSocket.OPEN}},{key:"isConnecting",get:function(){return!!this._socket&&this._socket.readyState==WebSocket.CONNECTING}}]),O})();E.exports=C},function(E,g,m){"use strict";var R=(function(){function T(S,I){for(var N=0;N<I.length;N++){var B=I[N];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(S,B.key,B)}}return function(S,I,N){return I&&T(S.prototype,I),N&&T(S,N),S}})(),C=m(0),O=(function(){function T(){(function(S,I){if(!(S instanceof I))throw new TypeError("Cannot call a class as a function")})(this,T)}return R(T,[{key:"buildPkgData",value:function(S){var I={};return I.magic=S.magic||C.TCP_MAGIC,I.version=S.version||0,I.flag=S.flag||0,I.mtype=S.mtype||0,I.ss=S.ss||0,I.method=S.method||null,I.seq=S.seq||0,I.payload=S.payload||null,I.payload&&(I.psize=C.BUFFER.byteLength(I.payload)),I.method&&(I.ss=C.BUFFER.byteLength(I.method)),I.wpos=0,I}},{key:"cbKey",value:function(S){return S.magic+"_"+S.seq}},{key:"isHTTP",value:function(S){return C.HTTP_MAGIC.equals(S.magic)}},{key:"isTCP",value:function(S){return C.TCP_MAGIC.equals(S.magic)}},{key:"isMsgPack",value:function(S){return S.flag==1}},{key:"isJson",value:function(S){return S.flag==0}},{key:"isOneWay",value:function(S){return S.mtype==0}},{key:"isTwoWay",value:function(S){return S.mtype==1}},{key:"isQuest",value:function(S){return this.isTwoWay(S)||this.isOneWay(S)}},{key:"isAnswer",value:function(S){return S.mtype==2}},{key:"isSupportPack",value:function(S){return this.isMsgPack(S)!=this.isJson(S)}},{key:"enCode",value:function(S){return this.isOneWay(S)?this.enCodeOneway(S):this.isTwoWay(S)?this.enCodeTwoway(S):this.isAnswer(S)?this.enCodeAnswer(S):null}},{key:"enCodeOneway",value:function(S){var I=P.call(this,S,12+S.ss+S.psize);S.wpos=I.writeUInt8(S.ss,S.wpos),S.wpos=I.writeUInt32LE(S.psize,S.wpos);var N=C.BUFFER.from(S.method);if(S.wpos+=N.copy(I,S.wpos,0),this.isJson(S)){var B=C.BUFFER.from(S.payload);S.wpos+=B.copy(I,S.wpos,0)}return this.isMsgPack(S)&&(this.wpos+=this.payload.copy(I,this.wpos,0)),I}},{key:"enCodeTwoway",value:function(S){var I=P.call(this,S,16+S.ss+S.psize);S.wpos=I.writeUInt8(S.ss,S.wpos),S.wpos=I.writeUInt32LE(S.psize,S.wpos),S.wpos=I.writeUInt32LE(S.seq,S.wpos);var N=C.BUFFER.from(S.method);if(S.wpos+=N.copy(I,S.wpos,0),this.isJson(S)){var B=C.BUFFER.from(S.payload);S.wpos+=B.copy(I,S.wpos,0)}return this.isMsgPack(S)&&(S.wpos+=S.payload.copy(I,S.wpos,0)),I}},{key:"enCodeAnswer",value:function(S){var I=P.call(this,S,16+S.psize);if(S.wpos=I.writeUInt8(S.ss,S.wpos),S.wpos=I.writeUInt32LE(S.psize,S.wpos),S.wpos=I.writeUInt32LE(S.seq,S.wpos),this.isJson(S)){var N=C.BUFFER.from(S.payload);S.wpos+=N.copy(I,S.wpos,0)}return this.isMsgPack(S)&&(S.wpos+=S.payload.copy(I,S.wpos,0)),I}},{key:"peekHead",value:function(S){var I={},N=0,B=C.BUFFER.allocUnsafe(4);return N+=S.copy(B,0,N,N+4),I.magic=B,B=C.BUFFER.allocUnsafe(1),N+=S.copy(B,0,N,N+1),I.version=C.FPNN_VERSION.indexOf(B),N+=S.copy(B,0,N,N+1),I.flag=C.FP_FLAG.indexOf(B),N+=S.copy(B,0,N,N+1),I.mtype=C.FP_MESSAGE_TYPE.indexOf(B),N+=S.copy(B,0,N,N+1),I.ss=B.readUInt8(0),I.psize=S.readUInt32LE(N),I.wpos=N+4,I}},{key:"deCode",value:function(S){var I=this.peekHead(S);return this.isOneWay(I)&&this.deCodeOneWay(S,I),this.isTwoWay(I)&&this.deCodeTwoWay(S,I),this.isAnswer(I)&&this.deCodeAnswer(S,I),I}},{key:"deCodeOneWay",value:function(S,I){if(S.length==12+I.ss+I.psize){var N=C.BUFFER.allocUnsafe(I.ss);I.wpos+=S.copy(N,0,I.wpos,I.wpos+I.ss),I.method=N.toString();var B=C.BUFFER.allocUnsafe(I.psize);I.wpos+=S.copy(B,0,I.wpos),this.isJson(I)&&(I.payload=B.toString()),this.isMsgPack(I)&&(I.payload=B)}else I=null}},{key:"deCodeTwoWay",value:function(S,I){if(S.length==16+I.ss+I.psize){I.seq=S.readUInt32LE(I.wpos),I.wpos+=4;var N=C.BUFFER.allocUnsafe(I.ss);I.wpos+=S.copy(N,0,I.wpos,I.wpos+I.ss),I.method=N.toString();var B=C.BUFFER.allocUnsafe(I.psize);I.wpos+=S.copy(B,0,I.wpos),this.isJson(I)&&(I.payload=B.toString()),this.isMsgPack(I)&&(I.payload=B)}else I=null}},{key:"deCodeAnswer",value:function(S,I){if(S.length==16+I.psize){I.seq=S.readUInt32LE(I.wpos),I.wpos+=4;var N=C.BUFFER.allocUnsafe(I.psize);I.wpos+=S.copy(N,0,I.wpos),this.isJson(I)&&(I.payload=N.toString()),this.isMsgPack(I)&&(I.payload=N)}else I=null}}]),T})();function P(T,S){var I=C.BUFFER.allocUnsafe(S);return this.isHTTP(T)&&(T.wpos+=C.HTTP_MAGIC.copy(I,T.wpos,0)),this.isTCP(T)&&(T.wpos+=C.TCP_MAGIC.copy(I,T.wpos,0)),T.wpos+=C.FPNN_VERSION.copy(I,T.wpos,T.version,T.version+1),this.isJson(T)&&(T.wpos+=C.FP_FLAG.copy(I,T.wpos,T.flag,T.flag+1)),this.isMsgPack(T)&&(T.wpos+=C.FP_FLAG.copy(I,T.wpos,T.flag,T.flag+1)),T.wpos+=C.FP_MESSAGE_TYPE.copy(I,T.wpos,T.mtype,T.mtype+1),I}E.exports=O},function(E,g,m){"use strict";var R=(function(){function L(j,V){for(var H=0;H<V.length;H++){var z=V[H];z.enumerable=z.enumerable||!1,z.configurable=!0,"value"in z&&(z.writable=!0),Object.defineProperty(j,z.key,z)}}return function(j,V,H){return V&&L(j.prototype,V),H&&L(j,H),j}})(),C=m(0),O=m(2),P=(function(){function L(){(function(j,V){if(!(j instanceof V))throw new TypeError("Cannot call a class as a function")})(this,L),this._cbMap={},this._exMap={},T.call(this)}return R(L,[{key:"addCb",value:function(j,V,H){this._cbMap.hasOwnProperty(j)||(this._cbMap[j]=V),H||(H=C.SEND_TIMEOUT),this._exMap[j]=H+Date.now()}},{key:"removeCb",value:function(j){if(j)N.call(this,j);else for(var V in this._cbMap)S.call(this,V,new O(C.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,new Error("Connection Closed")))}},{key:"execCb",value:function(j,V){S.call(this,j,V)}}]),L})();function T(){var L=this;setInterval((function(){for(var j in L._exMap)L._exMap[j]>Date.now()||S.call(L,j,new O(C.ERROR_CODE.FPNN_EC_CORE_TIMEOUT,Error("Timeout")))}),C.CHECK_CBS_INTERVAL)}function S(L,j){var V=this;setTimeout((function(){I.call(V,L,j)}),0)}function I(L,j){if(this._cbMap.hasOwnProperty(L)){var V=this._cbMap[L];B.call(this,L),V&&V(j)}}function N(L){var j=this;setTimeout((function(){B.call(j,L)}),0)}function B(L){this._cbMap.hasOwnProperty(L)&&delete this._cbMap[L],this._exMap.hasOwnProperty(L)&&delete this._exMap[L]}E.exports=P},function(E,g,m){"use strict";var R=(function(){function P(T,S){for(var I=0;I<S.length;I++){var N=S[I];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(T,N.key,N)}}return function(T,S,I){return S&&P(T.prototype,S),I&&P(T,I),T}})(),C=m(1),O=(function(){function P(){(function(T,S){if(!(T instanceof S))throw new TypeError("Cannot call a class as a function")})(this,P),C.assign(this)}return R(P,[{key:"service",value:function(T,S){this.emit(T.method,T.payload,S)}},{key:"destroy",value:function(){}}]),P})();E.exports=O},function(E,g,m){"use strict";var R=m(9),C=m(0),O=m(1),P=m(3),T=m(5),S=m(6),I=m(7),N=m(2),B=m(4),L=m(13);E.exports={FPClient:R,FPConfig:C,FPEvent:O,FPSocket:P,FPPackage:T,FPCallback:S,FPProcessor:I,FPError:N,BrowserImpl:B,WechatImpl:L}},function(E,g,m){"use strict";var R=(function(){function X(ee,le){for(var $=0;$<le.length;$++){var he=le[$];he.enumerable=he.enumerable||!1,he.configurable=!0,"value"in he&&(he.writable=!0),Object.defineProperty(ee,he.key,he)}}return function(ee,le,$){return le&&X(ee.prototype,le),$&&X(ee,$),ee}})(),C=m(0),O=m(1),P=m(3),T=m(5),S=m(6),I=m(7),N=m(2),B=(function(){function X(ee){(function($,he){if(!($ instanceof he))throw new TypeError("Cannot call a class as a function")})(this,X),O.assign(this),this._autoReconnect=ee.autoReconnect||!1,this._conn=new P(ee);var le=this;this._conn.on("connect",(function(){j.call(le)})),this._conn.on("close",(function(){V.call(le)})),this._conn.on("data",(function($){z.call(le,$)})),this._conn.on("error",(function($){L.call(le,new N(C.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR,$))})),this._pkg=new T,this._cbs=new S,this._psr=new I,this._seq=0,this._wpos=0,this._peekData=null,this._readID=0,this._reconnectID=0,this._buffer=C.BUFFER.allocUnsafe(C.READ_BUFFER_LEN)}return R(X,[{key:"connect",value:function(){this.hasConnect||this._conn.open()}},{key:"sendQuest",value:function(ee,le,$){if(this._conn.isOpen){var he={};he.magic=ee.magic||C.TCP_MAGIC,he.version=ee.version||1,he.flag=ee.flag||0,he.mtype=ee.hasOwnProperty("mtype")?ee.mtype:1,he.method=ee.method,he.seq=ee.hasOwnProperty("seq")?ee.seq:++this._seq,he.payload=ee.payload,he=this._pkg.buildPkgData(he),le&&this._cbs.addCb(this._pkg.cbKey(he),le,$);var De=this._pkg.enCode(he);this._conn.write(De)}else le&&le(new N(C.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,new Error("Connection Closed")))}},{key:"sendNotify",value:function(ee){var le={};le.magic=ee.magic||C.TCP_MAGIC,le.version=ee.version||1,le.flag=ee.flag||0,le.mtype=ee.mtype||0,le.method=ee.method,le.payload=ee.payload,le=this._pkg.buildPkgData(le);var $=this._pkg.enCode(le);this._conn.write($)}},{key:"close",value:function(ee){ee&&L.call(this,ee),this._conn.close()}},{key:"destroy",value:function(){this._autoReconnect=!1,this.removeEvent(),this._psr.destroy(),this._conn.destroy(),V.call(this)}},{key:"processor",get:function(){return this._psr},set:function(ee){return this._psr=ee}},{key:"isOpen",get:function(){return this._conn.isOpen}},{key:"hasConnect",get:function(){return this._conn.isOpen||this._conn.isConnecting}}]),X})();function L(X){this.emit("error",X)}function j(){this._reconnectID&&(clearTimeout(this._reconnectID),this._reconnectID=0),this.emit("connect")}function V(){this._readID&&(clearInterval(this._readID),this._readID=0),this._reconnectID&&(clearTimeout(this._reconnectID),this._reconnectID=0),this._seq=0,this._wpos=0,this._peekData=null,this._cbs.removeCb(),this._buffer=C.BUFFER.allocUnsafe(C.READ_BUFFER_LEN),this.emit("close"),this._autoReconnect&&H.call(this)}function H(){if(!this._reconnectID){var X=this;this._reconnectID=setTimeout((function(){X.connect()}),100)}}function z(X){X=C.BUFFER.from(X);var ee=this._wpos+X.length;if(ee>this._buffer.length&&Q.call(this,ee,2*C.READ_BUFFER_LEN),this._wpos+=X.copy(this._buffer,this._wpos,0),!this._readID){var le=this;this._readID=setInterval((function(){Z.call(le)}),0)}}function Q(X,ee){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,$=Math.max(X,ee),he=C.BUFFER.allocUnsafe($);this._wpos=this._buffer.copy(he,0,le,this._wpos),this._buffer=he}function Z(){if(!(this._wpos<12))if(this._peekData||(this._peekData=oe.call(this,this._buffer),this._peekData)){var X=this._wpos-this._peekData.pkgLen;if(!(X<0)){this._buffer.copy(this._peekData.buffer,0,0,this._peekData.pkgLen);var ee=this._pkg.deCode(this._peekData.buffer);if(Q.call(this,2*X,C.READ_BUFFER_LEN,this._peekData.pkgLen),delete this._peekData,this._peekData=null,this._pkg.isAnswer(ee)){var le=this._pkg.cbKey(ee);this._cbs.execCb(le,ee)}if(this._pkg.isQuest(ee)){var $=this;this._psr.service(ee,(function(he,De){ie.call($,ee.flag,ee.seq,he,De)}))}}}else this.conn.close(new N(C.ERROR_CODE.FPNN_EC_PROTO_INVALID_PACKAGE,new Error("Invalid Protocol Package")))}function ie(X,ee,le,$){var he={flag:X,mtype:2,seq:ee,ss:($=$||!1)?1:0,payload:le};this.sendQuest(he)}function oe(X){var ee=null;if(X.length>=12){if(ee=this._pkg.peekHead(X),!ue.call(this,ee))return null;this._pkg.isOneWay(ee)&&(ee.pkgLen=12+ee.ss+ee.psize),this._pkg.isTwoWay(ee)&&(ee.pkgLen=16+ee.ss+ee.psize),this._pkg.isAnswer(ee)&&(ee.pkgLen=16+ee.psize),ee.pkgLen>0&&(ee.buffer=C.BUFFER.allocUnsafe(ee.pkgLen))}return ee}function ue(X){return!(!C.TCP_MAGIC.equals(X.magic)&&!C.HTTP_MAGIC.equals(X.magic))&&!(X.version<0||X.version>=C.FPNN_VERSION.length)&&!(X.flag<0||X.flag>=C.FP_FLAG.length)&&!(X.mtype<0||X.mtype>=C.FP_MESSAGE_TYPE.length)}E.exports=B},function(E,g,m){"use strict";var R=m(11),C=m(12);g.Buffer=P,g.SlowBuffer=function(k){return+k!=k&&(k=0),P.alloc(+k)},g.INSPECT_MAX_BYTES=50;function O(k){if(k>2147483647)throw new RangeError('The value "'+k+'" is invalid for option "size"');var U=new Uint8Array(k);return U.__proto__=P.prototype,U}function P(k,U,F){if(typeof k=="number"){if(typeof U=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return I(k)}return T(k,U,F)}function T(k,U,F){if(typeof k=="string")return(function(K,ae){if(typeof ae=="string"&&ae!==""||(ae="utf8"),!P.isEncoding(ae))throw new TypeError("Unknown encoding: "+ae);var ve=0|L(K,ae),Oe=O(ve),xe=Oe.write(K,ae);return xe!==ve&&(Oe=Oe.slice(0,xe)),Oe})(k,U);if(ArrayBuffer.isView(k))return N(k);if(k==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(qe(k,ArrayBuffer)||k&&qe(k.buffer,ArrayBuffer))return(function(K,ae,ve){if(ae<0||K.byteLength<ae)throw new RangeError('"offset" is outside of buffer bounds');if(K.byteLength<ae+(ve||0))throw new RangeError('"length" is outside of buffer bounds');var Oe;return Oe=ae===void 0&&ve===void 0?new Uint8Array(K):ve===void 0?new Uint8Array(K,ae):new Uint8Array(K,ae,ve),Oe.__proto__=P.prototype,Oe})(k,U,F);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var q=k.valueOf&&k.valueOf();if(q!=null&&q!==k)return P.from(q,U,F);var W=(function(K){if(P.isBuffer(K)){var ae=0|B(K.length),ve=O(ae);return ve.length===0||K.copy(ve,0,0,ae),ve}if(K.length!==void 0)return typeof K.length!="number"||Be(K.length)?O(0):N(K);if(K.type==="Buffer"&&Array.isArray(K.data))return N(K.data)})(k);if(W)return W;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return P.from(k[Symbol.toPrimitive]("string"),U,F);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}function S(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function I(k){return S(k),O(k<0?0:0|B(k))}function N(k){for(var U=k.length<0?0:0|B(k.length),F=O(U),q=0;q<U;q+=1)F[q]=255&k[q];return F}function B(k){if(k>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|k}function L(k,U){if(P.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||qe(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);var F=k.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&F===0)return 0;for(var W=!1;;)switch(U){case"ascii":case"latin1":case"binary":return F;case"utf8":case"utf-8":return ce(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*F;case"hex":return F>>>1;case"base64":return ye(k).length;default:if(W)return q?-1:ce(k).length;U=(""+U).toLowerCase(),W=!0}}function j(k,U,F){var q=!1;if((U===void 0||U<0)&&(U=0),U>this.length||((F===void 0||F>this.length)&&(F=this.length),F<=0)||(F>>>=0)<=(U>>>=0))return"";for(k||(k="utf8");;)switch(k){case"hex":return De(this,U,F);case"utf8":case"utf-8":return le(this,U,F);case"ascii":return $(this,U,F);case"latin1":case"binary":return he(this,U,F);case"base64":return ee(this,U,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,U,F);default:if(q)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),q=!0}}function V(k,U,F){var q=k[U];k[U]=k[F],k[F]=q}function H(k,U,F,q,W){if(k.length===0)return-1;if(typeof F=="string"?(q=F,F=0):F>2147483647?F=2147483647:F<-2147483648&&(F=-2147483648),Be(F=+F)&&(F=W?0:k.length-1),F<0&&(F=k.length+F),F>=k.length){if(W)return-1;F=k.length-1}else if(F<0){if(!W)return-1;F=0}if(typeof U=="string"&&(U=P.from(U,q)),P.isBuffer(U))return U.length===0?-1:z(k,U,F,q,W);if(typeof U=="number")return U&=255,typeof Uint8Array.prototype.indexOf=="function"?W?Uint8Array.prototype.indexOf.call(k,U,F):Uint8Array.prototype.lastIndexOf.call(k,U,F):z(k,[U],F,q,W);throw new TypeError("val must be string, number or Buffer")}function z(k,U,F,q,W){var K,ae=1,ve=k.length,Oe=U.length;if(q!==void 0&&((q=String(q).toLowerCase())==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(k.length<2||U.length<2)return-1;ae=2,ve/=2,Oe/=2,F/=2}function xe(Se,ke){return ae===1?Se[ke]:Se.readUInt16BE(ke*ae)}if(W){var Ae=-1;for(K=F;K<ve;K++)if(xe(k,K)===xe(U,Ae===-1?0:K-Ae)){if(Ae===-1&&(Ae=K),K-Ae+1===Oe)return Ae*ae}else Ae!==-1&&(K-=K-Ae),Ae=-1}else for(F+Oe>ve&&(F=ve-Oe),K=F;K>=0;K--){for(var Re=!0,we=0;we<Oe;we++)if(xe(k,K+we)!==xe(U,we)){Re=!1;break}if(Re)return K}return-1}function Q(k,U,F,q){F=Number(F)||0;var W=k.length-F;q?(q=Number(q))>W&&(q=W):q=W;var K=U.length;q>K/2&&(q=K/2);for(var ae=0;ae<q;++ae){var ve=parseInt(U.substr(2*ae,2),16);if(Be(ve))return ae;k[F+ae]=ve}return ae}function Z(k,U,F,q){return Me(ce(U,k.length-F),k,F,q)}function ie(k,U,F,q){return Me((function(W){for(var K=[],ae=0;ae<W.length;++ae)K.push(255&W.charCodeAt(ae));return K})(U),k,F,q)}function oe(k,U,F,q){return ie(k,U,F,q)}function ue(k,U,F,q){return Me(ye(U),k,F,q)}function X(k,U,F,q){return Me((function(W,K){for(var ae,ve,Oe,xe=[],Ae=0;Ae<W.length&&!((K-=2)<0);++Ae)ae=W.charCodeAt(Ae),ve=ae>>8,Oe=ae%256,xe.push(Oe),xe.push(ve);return xe})(U,k.length-F),k,F,q)}function ee(k,U,F){return U===0&&F===k.length?R.fromByteArray(k):R.fromByteArray(k.slice(U,F))}function le(k,U,F){F=Math.min(k.length,F);for(var q=[],W=U;W<F;){var K,ae,ve,Oe,xe=k[W],Ae=null,Re=xe>239?4:xe>223?3:xe>191?2:1;if(W+Re<=F)switch(Re){case 1:xe<128&&(Ae=xe);break;case 2:(192&(K=k[W+1]))==128&&(Oe=(31&xe)<<6|63&K)>127&&(Ae=Oe);break;case 3:K=k[W+1],ae=k[W+2],(192&K)==128&&(192&ae)==128&&(Oe=(15&xe)<<12|(63&K)<<6|63&ae)>2047&&(Oe<55296||Oe>57343)&&(Ae=Oe);break;case 4:K=k[W+1],ae=k[W+2],ve=k[W+3],(192&K)==128&&(192&ae)==128&&(192&ve)==128&&(Oe=(15&xe)<<18|(63&K)<<12|(63&ae)<<6|63&ve)>65535&&Oe<1114112&&(Ae=Oe)}Ae===null?(Ae=65533,Re=1):Ae>65535&&(Ae-=65536,q.push(Ae>>>10&1023|55296),Ae=56320|1023&Ae),q.push(Ae),W+=Re}return(function(we){var Se=we.length;if(Se<=4096)return String.fromCharCode.apply(String,we);for(var ke="",We=0;We<Se;)ke+=String.fromCharCode.apply(String,we.slice(We,We+=4096));return ke})(q)}g.kMaxLength=2147483647,P.TYPED_ARRAY_SUPPORT=(function(){try{var k=new Uint8Array(1);return k.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},k.foo()===42}catch{return!1}})(),P.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(P.prototype,"parent",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.buffer}}),Object.defineProperty(P.prototype,"offset",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&P[Symbol.species]===P&&Object.defineProperty(P,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),P.poolSize=8192,P.from=function(k,U,F){return T(k,U,F)},P.prototype.__proto__=Uint8Array.prototype,P.__proto__=Uint8Array,P.alloc=function(k,U,F){return(function(q,W,K){return S(q),q<=0?O(q):W!==void 0?typeof K=="string"?O(q).fill(W,K):O(q).fill(W):O(q)})(k,U,F)},P.allocUnsafe=function(k){return I(k)},P.allocUnsafeSlow=function(k){return I(k)},P.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==P.prototype},P.compare=function(k,U){if(qe(k,Uint8Array)&&(k=P.from(k,k.offset,k.byteLength)),qe(U,Uint8Array)&&(U=P.from(U,U.offset,U.byteLength)),!P.isBuffer(k)||!P.isBuffer(U))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===U)return 0;for(var F=k.length,q=U.length,W=0,K=Math.min(F,q);W<K;++W)if(k[W]!==U[W]){F=k[W],q=U[W];break}return F<q?-1:q<F?1:0},P.isEncoding=function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},P.concat=function(k,U){if(!Array.isArray(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return P.alloc(0);var F;if(U===void 0)for(U=0,F=0;F<k.length;++F)U+=k[F].length;var q=P.allocUnsafe(U),W=0;for(F=0;F<k.length;++F){var K=k[F];if(qe(K,Uint8Array)&&(K=P.from(K)),!P.isBuffer(K))throw new TypeError('"list" argument must be an Array of Buffers');K.copy(q,W),W+=K.length}return q},P.byteLength=L,P.prototype._isBuffer=!0,P.prototype.swap16=function(){var k=this.length;if(k%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var U=0;U<k;U+=2)V(this,U,U+1);return this},P.prototype.swap32=function(){var k=this.length;if(k%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var U=0;U<k;U+=4)V(this,U,U+3),V(this,U+1,U+2);return this},P.prototype.swap64=function(){var k=this.length;if(k%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var U=0;U<k;U+=8)V(this,U,U+7),V(this,U+1,U+6),V(this,U+2,U+5),V(this,U+3,U+4);return this},P.prototype.toString=function(){var k=this.length;return k===0?"":arguments.length===0?le(this,0,k):j.apply(this,arguments)},P.prototype.toLocaleString=P.prototype.toString,P.prototype.equals=function(k){if(!P.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k||P.compare(this,k)===0},P.prototype.inspect=function(){var k="",U=g.INSPECT_MAX_BYTES;return k=this.toString("hex",0,U).replace(/(.{2})/g,"$1 ").trim(),this.length>U&&(k+=" ... "),"<Buffer "+k+">"},P.prototype.compare=function(k,U,F,q,W){if(qe(k,Uint8Array)&&(k=P.from(k,k.offset,k.byteLength)),!P.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(U===void 0&&(U=0),F===void 0&&(F=k?k.length:0),q===void 0&&(q=0),W===void 0&&(W=this.length),U<0||F>k.length||q<0||W>this.length)throw new RangeError("out of range index");if(q>=W&&U>=F)return 0;if(q>=W)return-1;if(U>=F)return 1;if(this===k)return 0;for(var K=(W>>>=0)-(q>>>=0),ae=(F>>>=0)-(U>>>=0),ve=Math.min(K,ae),Oe=this.slice(q,W),xe=k.slice(U,F),Ae=0;Ae<ve;++Ae)if(Oe[Ae]!==xe[Ae]){K=Oe[Ae],ae=xe[Ae];break}return K<ae?-1:ae<K?1:0},P.prototype.includes=function(k,U,F){return this.indexOf(k,U,F)!==-1},P.prototype.indexOf=function(k,U,F){return H(this,k,U,F,!0)},P.prototype.lastIndexOf=function(k,U,F){return H(this,k,U,F,!1)},P.prototype.write=function(k,U,F,q){if(U===void 0)q="utf8",F=this.length,U=0;else if(F===void 0&&typeof U=="string")q=U,F=this.length,U=0;else{if(!isFinite(U))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");U>>>=0,isFinite(F)?(F>>>=0,q===void 0&&(q="utf8")):(q=F,F=void 0)}var W=this.length-U;if((F===void 0||F>W)&&(F=W),k.length>0&&(F<0||U<0)||U>this.length)throw new RangeError("Attempt to write outside buffer bounds");q||(q="utf8");for(var K=!1;;)switch(q){case"hex":return Q(this,k,U,F);case"utf8":case"utf-8":return Z(this,k,U,F);case"ascii":return ie(this,k,U,F);case"latin1":case"binary":return oe(this,k,U,F);case"base64":return ue(this,k,U,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,k,U,F);default:if(K)throw new TypeError("Unknown encoding: "+q);q=(""+q).toLowerCase(),K=!0}},P.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $(k,U,F){var q="";F=Math.min(k.length,F);for(var W=U;W<F;++W)q+=String.fromCharCode(127&k[W]);return q}function he(k,U,F){var q="";F=Math.min(k.length,F);for(var W=U;W<F;++W)q+=String.fromCharCode(k[W]);return q}function De(k,U,F){var q=k.length;(!U||U<0)&&(U=0),(!F||F<0||F>q)&&(F=q);for(var W="",K=U;K<F;++K)W+=de(k[K]);return W}function Ie(k,U,F){for(var q=k.slice(U,F),W="",K=0;K<q.length;K+=2)W+=String.fromCharCode(q[K]+256*q[K+1]);return W}function Ce(k,U,F){if(k%1!=0||k<0)throw new RangeError("offset is not uint");if(k+U>F)throw new RangeError("Trying to access beyond buffer length")}function Pe(k,U,F,q,W,K){if(!P.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(U>W||U<K)throw new RangeError('"value" argument is out of bounds');if(F+q>k.length)throw new RangeError("Index out of range")}function be(k,U,F,q,W,K){if(F+q>k.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("Index out of range")}function te(k,U,F,q,W){return U=+U,F>>>=0,W||be(k,0,F,4),C.write(k,U,F,q,23,4),F+4}function se(k,U,F,q,W){return U=+U,F>>>=0,W||be(k,0,F,8),C.write(k,U,F,q,52,8),F+8}P.prototype.slice=function(k,U){var F=this.length;(k=~~k)<0?(k+=F)<0&&(k=0):k>F&&(k=F),(U=U===void 0?F:~~U)<0?(U+=F)<0&&(U=0):U>F&&(U=F),U<k&&(U=k);var q=this.subarray(k,U);return q.__proto__=P.prototype,q},P.prototype.readUIntLE=function(k,U,F){k>>>=0,U>>>=0,F||Ce(k,U,this.length);for(var q=this[k],W=1,K=0;++K<U&&(W*=256);)q+=this[k+K]*W;return q},P.prototype.readUIntBE=function(k,U,F){k>>>=0,U>>>=0,F||Ce(k,U,this.length);for(var q=this[k+--U],W=1;U>0&&(W*=256);)q+=this[k+--U]*W;return q},P.prototype.readUInt8=function(k,U){return k>>>=0,U||Ce(k,1,this.length),this[k]},P.prototype.readUInt16LE=function(k,U){return k>>>=0,U||Ce(k,2,this.length),this[k]|this[k+1]<<8},P.prototype.readUInt16BE=function(k,U){return k>>>=0,U||Ce(k,2,this.length),this[k]<<8|this[k+1]},P.prototype.readUInt32LE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},P.prototype.readUInt32BE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},P.prototype.readIntLE=function(k,U,F){k>>>=0,U>>>=0,F||Ce(k,U,this.length);for(var q=this[k],W=1,K=0;++K<U&&(W*=256);)q+=this[k+K]*W;return q>=(W*=128)&&(q-=Math.pow(2,8*U)),q},P.prototype.readIntBE=function(k,U,F){k>>>=0,U>>>=0,F||Ce(k,U,this.length);for(var q=U,W=1,K=this[k+--q];q>0&&(W*=256);)K+=this[k+--q]*W;return K>=(W*=128)&&(K-=Math.pow(2,8*U)),K},P.prototype.readInt8=function(k,U){return k>>>=0,U||Ce(k,1,this.length),128&this[k]?-1*(255-this[k]+1):this[k]},P.prototype.readInt16LE=function(k,U){k>>>=0,U||Ce(k,2,this.length);var F=this[k]|this[k+1]<<8;return 32768&F?4294901760|F:F},P.prototype.readInt16BE=function(k,U){k>>>=0,U||Ce(k,2,this.length);var F=this[k+1]|this[k]<<8;return 32768&F?4294901760|F:F},P.prototype.readInt32LE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},P.prototype.readInt32BE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},P.prototype.readFloatLE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),C.read(this,k,!0,23,4)},P.prototype.readFloatBE=function(k,U){return k>>>=0,U||Ce(k,4,this.length),C.read(this,k,!1,23,4)},P.prototype.readDoubleLE=function(k,U){return k>>>=0,U||Ce(k,8,this.length),C.read(this,k,!0,52,8)},P.prototype.readDoubleBE=function(k,U){return k>>>=0,U||Ce(k,8,this.length),C.read(this,k,!1,52,8)},P.prototype.writeUIntLE=function(k,U,F,q){k=+k,U>>>=0,F>>>=0,q||Pe(this,k,U,F,Math.pow(2,8*F)-1,0);var W=1,K=0;for(this[U]=255&k;++K<F&&(W*=256);)this[U+K]=k/W&255;return U+F},P.prototype.writeUIntBE=function(k,U,F,q){k=+k,U>>>=0,F>>>=0,q||Pe(this,k,U,F,Math.pow(2,8*F)-1,0);var W=F-1,K=1;for(this[U+W]=255&k;--W>=0&&(K*=256);)this[U+W]=k/K&255;return U+F},P.prototype.writeUInt8=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,1,255,0),this[U]=255&k,U+1},P.prototype.writeUInt16LE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,2,65535,0),this[U]=255&k,this[U+1]=k>>>8,U+2},P.prototype.writeUInt16BE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,2,65535,0),this[U]=k>>>8,this[U+1]=255&k,U+2},P.prototype.writeUInt32LE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,4,4294967295,0),this[U+3]=k>>>24,this[U+2]=k>>>16,this[U+1]=k>>>8,this[U]=255&k,U+4},P.prototype.writeUInt32BE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,4,4294967295,0),this[U]=k>>>24,this[U+1]=k>>>16,this[U+2]=k>>>8,this[U+3]=255&k,U+4},P.prototype.writeIntLE=function(k,U,F,q){if(k=+k,U>>>=0,!q){var W=Math.pow(2,8*F-1);Pe(this,k,U,F,W-1,-W)}var K=0,ae=1,ve=0;for(this[U]=255&k;++K<F&&(ae*=256);)k<0&&ve===0&&this[U+K-1]!==0&&(ve=1),this[U+K]=(k/ae>>0)-ve&255;return U+F},P.prototype.writeIntBE=function(k,U,F,q){if(k=+k,U>>>=0,!q){var W=Math.pow(2,8*F-1);Pe(this,k,U,F,W-1,-W)}var K=F-1,ae=1,ve=0;for(this[U+K]=255&k;--K>=0&&(ae*=256);)k<0&&ve===0&&this[U+K+1]!==0&&(ve=1),this[U+K]=(k/ae>>0)-ve&255;return U+F},P.prototype.writeInt8=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,1,127,-128),k<0&&(k=255+k+1),this[U]=255&k,U+1},P.prototype.writeInt16LE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,2,32767,-32768),this[U]=255&k,this[U+1]=k>>>8,U+2},P.prototype.writeInt16BE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,2,32767,-32768),this[U]=k>>>8,this[U+1]=255&k,U+2},P.prototype.writeInt32LE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,4,2147483647,-2147483648),this[U]=255&k,this[U+1]=k>>>8,this[U+2]=k>>>16,this[U+3]=k>>>24,U+4},P.prototype.writeInt32BE=function(k,U,F){return k=+k,U>>>=0,F||Pe(this,k,U,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[U]=k>>>24,this[U+1]=k>>>16,this[U+2]=k>>>8,this[U+3]=255&k,U+4},P.prototype.writeFloatLE=function(k,U,F){return te(this,k,U,!0,F)},P.prototype.writeFloatBE=function(k,U,F){return te(this,k,U,!1,F)},P.prototype.writeDoubleLE=function(k,U,F){return se(this,k,U,!0,F)},P.prototype.writeDoubleBE=function(k,U,F){return se(this,k,U,!1,F)},P.prototype.copy=function(k,U,F,q){if(!P.isBuffer(k))throw new TypeError("argument should be a Buffer");if(F||(F=0),q||q===0||(q=this.length),U>=k.length&&(U=k.length),U||(U=0),q>0&&q<F&&(q=F),q===F||k.length===0||this.length===0)return 0;if(U<0)throw new RangeError("targetStart out of bounds");if(F<0||F>=this.length)throw new RangeError("Index out of range");if(q<0)throw new RangeError("sourceEnd out of bounds");q>this.length&&(q=this.length),k.length-U<q-F&&(q=k.length-U+F);var W=q-F;if(this===k&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(U,F,q);else if(this===k&&F<U&&U<q)for(var K=W-1;K>=0;--K)k[K+U]=this[K+F];else Uint8Array.prototype.set.call(k,this.subarray(F,q),U);return W},P.prototype.fill=function(k,U,F,q){if(typeof k=="string"){if(typeof U=="string"?(q=U,U=0,F=this.length):typeof F=="string"&&(q=F,F=this.length),q!==void 0&&typeof q!="string")throw new TypeError("encoding must be a string");if(typeof q=="string"&&!P.isEncoding(q))throw new TypeError("Unknown encoding: "+q);if(k.length===1){var W=k.charCodeAt(0);(q==="utf8"&&W<128||q==="latin1")&&(k=W)}}else typeof k=="number"&&(k&=255);if(U<0||this.length<U||this.length<F)throw new RangeError("Out of range index");if(F<=U)return this;var K;if(U>>>=0,F=F===void 0?this.length:F>>>0,k||(k=0),typeof k=="number")for(K=U;K<F;++K)this[K]=k;else{var ae=P.isBuffer(k)?k:P.from(k,q),ve=ae.length;if(ve===0)throw new TypeError('The value "'+k+'" is invalid for argument "value"');for(K=0;K<F-U;++K)this[K+U]=ae[K%ve]}return this};var re=/[^+/0-9A-Za-z-_]/g;function de(k){return k<16?"0"+k.toString(16):k.toString(16)}function ce(k,U){var F;U=U||1/0;for(var q=k.length,W=null,K=[],ae=0;ae<q;++ae){if((F=k.charCodeAt(ae))>55295&&F<57344){if(!W){if(F>56319){(U-=3)>-1&&K.push(239,191,189);continue}if(ae+1===q){(U-=3)>-1&&K.push(239,191,189);continue}W=F;continue}if(F<56320){(U-=3)>-1&&K.push(239,191,189),W=F;continue}F=65536+(W-55296<<10|F-56320)}else W&&(U-=3)>-1&&K.push(239,191,189);if(W=null,F<128){if((U-=1)<0)break;K.push(F)}else if(F<2048){if((U-=2)<0)break;K.push(F>>6|192,63&F|128)}else if(F<65536){if((U-=3)<0)break;K.push(F>>12|224,F>>6&63|128,63&F|128)}else{if(!(F<1114112))throw new Error("Invalid code point");if((U-=4)<0)break;K.push(F>>18|240,F>>12&63|128,F>>6&63|128,63&F|128)}}return K}function ye(k){return R.toByteArray((function(U){if((U=(U=U.split("=")[0]).trim().replace(re,"")).length<2)return"";for(;U.length%4!=0;)U+="=";return U})(k))}function Me(k,U,F,q){for(var W=0;W<q&&!(W+F>=U.length||W>=k.length);++W)U[W+F]=k[W];return W}function qe(k,U){return k instanceof U||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===U.name}function Be(k){return k!=k}},function(E,g,m){"use strict";g.byteLength=function(B){var L=I(B),j=L[0],V=L[1];return 3*(j+V)/4-V},g.toByteArray=function(B){var L,j,V=I(B),H=V[0],z=V[1],Q=new O((function(oe,ue,X){return 3*(ue+X)/4-X})(0,H,z)),Z=0,ie=z>0?H-4:H;for(j=0;j<ie;j+=4)L=C[B.charCodeAt(j)]<<18|C[B.charCodeAt(j+1)]<<12|C[B.charCodeAt(j+2)]<<6|C[B.charCodeAt(j+3)],Q[Z++]=L>>16&255,Q[Z++]=L>>8&255,Q[Z++]=255&L;return z===2&&(L=C[B.charCodeAt(j)]<<2|C[B.charCodeAt(j+1)]>>4,Q[Z++]=255&L),z===1&&(L=C[B.charCodeAt(j)]<<10|C[B.charCodeAt(j+1)]<<4|C[B.charCodeAt(j+2)]>>2,Q[Z++]=L>>8&255,Q[Z++]=255&L),Q},g.fromByteArray=function(B){for(var L,j=B.length,V=j%3,H=[],z=0,Q=j-V;z<Q;z+=16383)H.push(N(B,z,z+16383>Q?Q:z+16383));return V===1?(L=B[j-1],H.push(R[L>>2]+R[L<<4&63]+"==")):V===2&&(L=(B[j-2]<<8)+B[j-1],H.push(R[L>>10]+R[L>>4&63]+R[L<<2&63]+"=")),H.join("")};for(var R=[],C=[],O=typeof Uint8Array<"u"?Uint8Array:Array,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",T=0,S=P.length;T<S;++T)R[T]=P[T],C[P.charCodeAt(T)]=T;function I(B){var L=B.length;if(L%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var j=B.indexOf("=");return j===-1&&(j=L),[j,j===L?0:4-j%4]}function N(B,L,j){for(var V,H,z=[],Q=L;Q<j;Q+=3)V=(B[Q]<<16&16711680)+(B[Q+1]<<8&65280)+(255&B[Q+2]),z.push(R[(H=V)>>18&63]+R[H>>12&63]+R[H>>6&63]+R[63&H]);return z.join("")}C[45]=62,C[95]=63},function(E,g){g.read=function(m,R,C,O,P){var T,S,I=8*P-O-1,N=(1<<I)-1,B=N>>1,L=-7,j=C?P-1:0,V=C?-1:1,H=m[R+j];for(j+=V,T=H&(1<<-L)-1,H>>=-L,L+=I;L>0;T=256*T+m[R+j],j+=V,L-=8);for(S=T&(1<<-L)-1,T>>=-L,L+=O;L>0;S=256*S+m[R+j],j+=V,L-=8);if(T===0)T=1-B;else{if(T===N)return S?NaN:1/0*(H?-1:1);S+=Math.pow(2,O),T-=B}return(H?-1:1)*S*Math.pow(2,T-O)},g.write=function(m,R,C,O,P,T){var S,I,N,B=8*T-P-1,L=(1<<B)-1,j=L>>1,V=P===23?Math.pow(2,-24)-Math.pow(2,-77):0,H=O?0:T-1,z=O?1:-1,Q=R<0||R===0&&1/R<0?1:0;for(R=Math.abs(R),isNaN(R)||R===1/0?(I=isNaN(R)?1:0,S=L):(S=Math.floor(Math.log(R)/Math.LN2),R*(N=Math.pow(2,-S))<1&&(S--,N*=2),(R+=S+j>=1?V/N:V*Math.pow(2,1-j))*N>=2&&(S++,N/=2),S+j>=L?(I=0,S=L):S+j>=1?(I=(R*N-1)*Math.pow(2,P),S+=j):(I=R*Math.pow(2,j-1)*Math.pow(2,P),S=0));P>=8;m[C+H]=255&I,H+=z,I/=256,P-=8);for(S=S<<P|I,B+=P;B>0;m[C+H]=255&S,H+=z,S/=256,B-=8);m[C+H-z]|=128*Q}},function(E,g,m){"use strict";var R=(function(){function O(P,T){for(var S=0;S<T.length;S++){var I=T[S];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(P,I.key,I)}}return function(P,T,S){return T&&O(P.prototype,T),S&&O(P,S),P}})(),C=(function(){function O(){(function(P,T){if(!(P instanceof T))throw new TypeError("Cannot call a class as a function")})(this,O),this._socket=null}return R(O,[{key:"open",value:function(P){var T=this;wx&&wx.connectSocket?(this._socket=wx.connectSocket({url:P,protocols:"arraybuffer"}),this._socket.onOpen((function(S){T.emit("open")})),this._socket.onMessage((function(S){T.emit("message",S.data)})),this._socket.onClose((function(){T.emit("close")})),this._socket.onError((function(S){T.emit("error",S)}))):this.emit("error",new Error("Not support `wx` or `wx.connectSocket` undefined"))}},{key:"send",value:function(P){this._socket&&this._socket.send({data:P})}},{key:"close",value:function(){this._socket&&this._socket.close({})}},{key:"isOpen",get:function(){return!!this._socket&&this._socket.readyState==1}},{key:"isConnecting",get:function(){return!!this._socket&&this._socket.readyState==0}}]),O})();E.exports=C}])}))});var Ir=Ye((kr,xn)=>{(function(E){if(typeof kr=="object"&&typeof xn<"u")xn.exports=E();else if(typeof define=="function"&&define.amd)define([],E);else{var g;g=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this,g.msgpack=E()}})(function(){return(function E(g,m,R){function C(T,S){if(!m[T]){if(!g[T]){var I=typeof Ft=="function"&&Ft;if(!S&&I)return I(T,!0);if(O)return O(T,!0);var N=new Error("Cannot find module '"+T+"'");throw N.code="MODULE_NOT_FOUND",N}var B=m[T]={exports:{}};g[T][0].call(B.exports,function(L){var j=g[T][1][L];return C(j||L)},B,B.exports,E,g,m,R)}return m[T].exports}for(var O=typeof Ft=="function"&&Ft,P=0;P<R.length;P++)C(R[P]);return C})({1:[function(E,g,m){m.encode=E("./encode").encode,m.decode=E("./decode").decode,m.Encoder=E("./encoder").Encoder,m.Decoder=E("./decoder").Decoder,m.createCodec=E("./ext").createCodec,m.codec=E("./codec").codec},{"./codec":10,"./decode":12,"./decoder":13,"./encode":15,"./encoder":16,"./ext":20}],2:[function(E,g,m){(function(R){function C(O){return O&&O.isBuffer&&O}g.exports=C(typeof R<"u"&&R)||C(this.Buffer)||C(typeof window<"u"&&window.Buffer)||this.Buffer}).call(this,E("buffer").Buffer)},{buffer:29}],3:[function(E,g,m){function R(P,T){for(var S=this,I=T||(T|=0),N=P.length,B=0,L=0;L<N;)B=P.charCodeAt(L++),B<128?S[I++]=B:B<2048?(S[I++]=192|B>>>6,S[I++]=128|63&B):B<55296||B>57343?(S[I++]=224|B>>>12,S[I++]=128|B>>>6&63,S[I++]=128|63&B):(B=(B-55296<<10|P.charCodeAt(L++)-56320)+65536,S[I++]=240|B>>>18,S[I++]=128|B>>>12&63,S[I++]=128|B>>>6&63,S[I++]=128|63&B);return I-T}function C(P,T,S){var I=this,N=0|T;S||(S=I.length);for(var B="",L=0;N<S;)L=I[N++],L<128?B+=String.fromCharCode(L):((224&L)===192?L=(31&L)<<6|63&I[N++]:(240&L)===224?L=(15&L)<<12|(63&I[N++])<<6|63&I[N++]:(248&L)===240&&(L=(7&L)<<18|(63&I[N++])<<12|(63&I[N++])<<6|63&I[N++]),L>=65536?(L-=65536,B+=String.fromCharCode((L>>>10)+55296,(1023&L)+56320)):B+=String.fromCharCode(L));return B}function O(P,T,S,I){var N;S||(S=0),I||I===0||(I=this.length),T||(T=0);var B=I-S;if(P===this&&S<T&&T<I)for(N=B-1;N>=0;N--)P[N+T]=this[N+S];else for(N=0;N<B;N++)P[N+T]=this[N+S];return B}m.copy=O,m.toString=C,m.write=R},{}],4:[function(E,g,P){function R(T){return new Array(T)}function C(T){if(!O.isBuffer(T)&&O.isView(T))T=O.Uint8Array.from(T);else if(O.isArrayBuffer(T))T=new Uint8Array(T);else{if(typeof T=="string")return O.from.call(P,T);if(typeof T=="number")throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(T)}var O=E("./bufferish"),P=g.exports=R(0);P.alloc=R,P.concat=O.concat,P.from=C},{"./bufferish":8}],5:[function(E,g,T){function R(S){return new P(S)}function C(S){if(!O.isBuffer(S)&&O.isView(S))S=O.Uint8Array.from(S);else if(O.isArrayBuffer(S))S=new Uint8Array(S);else{if(typeof S=="string")return O.from.call(T,S);if(typeof S=="number")throw new TypeError('"value" argument must not be a number')}return P.from&&P.from.length!==1?P.from(S):new P(S)}var O=E("./bufferish"),P=O.global,T=g.exports=O.hasBuffer?R(0):[];T.alloc=O.hasBuffer&&P.alloc||R,T.concat=O.concat,T.from=C},{"./bufferish":8}],6:[function(E,g,m){function R(L,j,V,H){var z=S.isBuffer(this),Q=S.isBuffer(L);if(z&&Q)return this.copy(L,j,V,H);if(B||z||Q||!S.isView(this)||!S.isView(L))return T.copy.call(this,L,j,V,H);var Z=V||H!=null?C.call(this,V,H):this;return L.set(Z,j),Z.length}function C(L,j){var V=this.slice||!B&&this.subarray;if(V)return V.call(this,L,j);var H=S.alloc.call(this,j-L);return R.call(this,H,0,L,j),H}function O(L,j,V){var H=!N&&S.isBuffer(this)?this.toString:T.toString;return H.apply(this,arguments)}function P(L){function j(){var V=this[L]||T[L];return V.apply(this,arguments)}return j}var T=E("./buffer-lite");m.copy=R,m.slice=C,m.toString=O,m.write=P("write");var S=E("./bufferish"),I=S.global,N=S.hasBuffer&&"TYPED_ARRAY_SUPPORT"in I,B=N&&!I.TYPED_ARRAY_SUPPORT},{"./buffer-lite":3,"./bufferish":8}],7:[function(E,g,P){function R(T){return new Uint8Array(T)}function C(T){if(O.isView(T)){var S=T.byteOffset,I=T.byteLength;T=T.buffer,T.byteLength!==I&&(T.slice?T=T.slice(S,S+I):(T=new Uint8Array(T),T.byteLength!==I&&(T=Array.prototype.slice.call(T,S,S+I))))}else{if(typeof T=="string")return O.from.call(P,T);if(typeof T=="number")throw new TypeError('"value" argument must not be a number')}return new Uint8Array(T)}var O=E("./bufferish"),P=g.exports=O.hasArrayBuffer?R(0):[];P.alloc=R,P.concat=O.concat,P.from=C},{"./bufferish":8}],8:[function(E,g,m){function R(X){return typeof X=="string"?T.call(this,X):S(this).from(X)}function C(X){return S(this).alloc(X)}function O(X,ee){function le(Ce){ee+=Ce.length}function $(Ce){Ie+=oe.copy.call(Ce,De,Ie)}ee||(ee=0,Array.prototype.forEach.call(X,le));var he=this!==m&&this||X[0],De=C.call(he,ee),Ie=0;return Array.prototype.forEach.call(X,$),De}function P(X){return X instanceof ArrayBuffer||ue(X)}function T(X){var ee=3*X.length,le=C.call(this,ee),$=oe.write.call(le,X);return ee!==$&&(le=oe.slice.call(le,0,$)),le}function S(X){return H(X)?Z:z(X)?ie:V(X)?Q:L?Z:j?ie:Q}function I(){return!1}function N(X,ee){return X="[object "+X+"]",function(le){return le!=null&&{}.toString.call(ee?le[ee]:le)===X}}var B=m.global=E("./buffer-global"),L=m.hasBuffer=B&&!!B.isBuffer,j=m.hasArrayBuffer=typeof ArrayBuffer<"u",V=m.isArray=E("isarray");m.isArrayBuffer=j?P:I;var H=m.isBuffer=L?B.isBuffer:I,z=m.isView=j?ArrayBuffer.isView||N("ArrayBuffer","buffer"):I;m.alloc=C,m.concat=O,m.from=R;var Q=m.Array=E("./bufferish-array"),Z=m.Buffer=E("./bufferish-buffer"),ie=m.Uint8Array=E("./bufferish-uint8array"),oe=m.prototype=E("./bufferish-proto"),ue=N("ArrayBuffer")},{"./buffer-global":2,"./bufferish-array":4,"./bufferish-buffer":5,"./bufferish-proto":6,"./bufferish-uint8array":7,isarray:34}],9:[function(E,g,m){function R(B){return this instanceof R?(this.options=B,void this.init()):new R(B)}function C(B){for(var L in B)R.prototype[L]=O(R.prototype[L],B[L])}function O(B,L){function j(){return B.apply(this,arguments),L.apply(this,arguments)}return B&&L?j:B||L}function P(B){function L(j,V){return V(j)}return B=B.slice(),function(j){return B.reduce(L,j)}}function T(B){return I(B)?P(B):B}function S(B){return new R(B)}var I=E("isarray");m.createCodec=S,m.install=C,m.filter=T;var N=E("./bufferish");R.prototype.init=function(){var B=this.options;return B&&B.uint8array&&(this.bufferish=N.Uint8Array),this},m.preset=S({preset:!0})},{"./bufferish":8,isarray:34}],10:[function(E,g,m){E("./read-core"),E("./write-core"),m.codec={preset:E("./codec-base").preset}},{"./codec-base":9,"./read-core":22,"./write-core":25}],11:[function(E,g,m){function R(P){if(!(this instanceof R))return new R(P);if(P&&(this.options=P,P.codec)){var T=this.codec=P.codec;T.bufferish&&(this.bufferish=T.bufferish)}}m.DecodeBuffer=R;var C=E("./read-core").preset,O=E("./flex-buffer").FlexDecoder;O.mixin(R.prototype),R.prototype.codec=C,R.prototype.fetch=function(){return this.codec.decode(this)}},{"./flex-buffer":21,"./read-core":22}],12:[function(E,g,m){function R(O,P){var T=new C(P);return T.write(O),T.read()}m.decode=R;var C=E("./decode-buffer").DecodeBuffer},{"./decode-buffer":11}],13:[function(E,g,m){function R(P){return this instanceof R?void O.call(this,P):new R(P)}m.Decoder=R;var C=E("event-lite"),O=E("./decode-buffer").DecodeBuffer;R.prototype=new O,C.mixin(R.prototype),R.prototype.decode=function(P){arguments.length&&this.write(P),this.flush()},R.prototype.push=function(P){this.emit("data",P)},R.prototype.end=function(P){this.decode(P),this.emit("end")}},{"./decode-buffer":11,"event-lite":31}],14:[function(E,g,m){function R(P){if(!(this instanceof R))return new R(P);if(P&&(this.options=P,P.codec)){var T=this.codec=P.codec;T.bufferish&&(this.bufferish=T.bufferish)}}m.EncodeBuffer=R;var C=E("./write-core").preset,O=E("./flex-buffer").FlexEncoder;O.mixin(R.prototype),R.prototype.codec=C,R.prototype.write=function(P){this.codec.encode(this,P)}},{"./flex-buffer":21,"./write-core":25}],15:[function(E,g,m){function R(O,P){var T=new C(P);return T.write(O),T.read()}m.encode=R;var C=E("./encode-buffer").EncodeBuffer},{"./encode-buffer":14}],16:[function(E,g,m){function R(P){return this instanceof R?void O.call(this,P):new R(P)}m.Encoder=R;var C=E("event-lite"),O=E("./encode-buffer").EncodeBuffer;R.prototype=new O,C.mixin(R.prototype),R.prototype.encode=function(P){this.write(P),this.emit("data",this.read())},R.prototype.end=function(P){arguments.length&&this.encode(P),this.flush(),this.emit("end")}},{"./encode-buffer":14,"event-lite":31}],17:[function(E,g,m){function R(O,P){return this instanceof R?(this.buffer=C.from(O),void(this.type=P)):new R(O,P)}m.ExtBuffer=R;var C=E("./bufferish")},{"./bufferish":8}],18:[function(E,g,m){function R(j){j.addExtPacker(14,Error,[T,C]),j.addExtPacker(1,EvalError,[T,C]),j.addExtPacker(2,RangeError,[T,C]),j.addExtPacker(3,ReferenceError,[T,C]),j.addExtPacker(4,SyntaxError,[T,C]),j.addExtPacker(5,TypeError,[T,C]),j.addExtPacker(6,URIError,[T,C]),j.addExtPacker(10,RegExp,[P,C]),j.addExtPacker(11,Boolean,[O,C]),j.addExtPacker(12,String,[O,C]),j.addExtPacker(13,Date,[Number,C]),j.addExtPacker(15,Number,[O,C]),typeof Uint8Array<"u"&&(j.addExtPacker(17,Int8Array,B),j.addExtPacker(18,Uint8Array,B),j.addExtPacker(19,Int16Array,B),j.addExtPacker(20,Uint16Array,B),j.addExtPacker(21,Int32Array,B),j.addExtPacker(22,Uint32Array,B),j.addExtPacker(23,Float32Array,B),typeof Float64Array<"u"&&j.addExtPacker(24,Float64Array,B),typeof Uint8ClampedArray<"u"&&j.addExtPacker(25,Uint8ClampedArray,B),j.addExtPacker(26,ArrayBuffer,B),j.addExtPacker(29,DataView,B)),I.hasBuffer&&j.addExtPacker(27,N,I.from)}function C(j){return S||(S=E("./encode").encode),S(j)}function O(j){return j.valueOf()}function P(j){j=RegExp.prototype.toString.call(j).split("/"),j.shift();var V=[j.pop()];return V.unshift(j.join("/")),V}function T(j){var V={};for(var H in L)V[H]=j[H];return V}m.setExtPackers=R;var S,I=E("./bufferish"),N=I.global,B=I.Uint8Array.from,L={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./encode":15}],19:[function(E,g,m){function R(j){j.addExtUnpacker(14,[C,P(Error)]),j.addExtUnpacker(1,[C,P(EvalError)]),j.addExtUnpacker(2,[C,P(RangeError)]),j.addExtUnpacker(3,[C,P(ReferenceError)]),j.addExtUnpacker(4,[C,P(SyntaxError)]),j.addExtUnpacker(5,[C,P(TypeError)]),j.addExtUnpacker(6,[C,P(URIError)]),j.addExtUnpacker(10,[C,O]),j.addExtUnpacker(11,[C,T(Boolean)]),j.addExtUnpacker(12,[C,T(String)]),j.addExtUnpacker(13,[C,T(Date)]),j.addExtUnpacker(15,[C,T(Number)]),typeof Uint8Array<"u"&&(j.addExtUnpacker(17,T(Int8Array)),j.addExtUnpacker(18,T(Uint8Array)),j.addExtUnpacker(19,[S,T(Int16Array)]),j.addExtUnpacker(20,[S,T(Uint16Array)]),j.addExtUnpacker(21,[S,T(Int32Array)]),j.addExtUnpacker(22,[S,T(Uint32Array)]),j.addExtUnpacker(23,[S,T(Float32Array)]),typeof Float64Array<"u"&&j.addExtUnpacker(24,[S,T(Float64Array)]),typeof Uint8ClampedArray<"u"&&j.addExtUnpacker(25,T(Uint8ClampedArray)),j.addExtUnpacker(26,S),j.addExtUnpacker(29,[S,T(DataView)])),N.hasBuffer&&j.addExtUnpacker(27,T(B))}function C(j){return I||(I=E("./decode").decode),I(j)}function O(j){return RegExp.apply(null,j)}function P(j){return function(V){var H=new j;for(var z in L)H[z]=V[z];return H}}function T(j){return function(V){return new j(V)}}function S(j){return new Uint8Array(j).buffer}m.setExtUnpackers=R;var I,N=E("./bufferish"),B=N.global,L={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./decode":12}],20:[function(E,g,m){E("./read-core"),E("./write-core"),m.createCodec=E("./codec-base").createCodec},{"./codec-base":9,"./read-core":22,"./write-core":25}],21:[function(E,g,m){function R(){if(!(this instanceof R))return new R}function C(){if(!(this instanceof C))return new C}function O(){function Q(oe){var ue=this.offset?j.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=ue?oe?this.bufferish.concat([ue,oe]):ue:oe,this.offset=0}function Z(){for(;this.offset<this.buffer.length;){var oe,ue=this.offset;try{oe=this.fetch()}catch(X){if(X&&X.message!=z)throw X;this.offset=ue;break}this.push(oe)}}function ie(oe){var ue=this.offset,X=ue+oe;if(X>this.buffer.length)throw new Error(z);return this.offset=X,ue}return{bufferish:j,write:Q,fetch:S,flush:Z,push:N,pull:B,read:I,reserve:ie,offset:0}}function P(){function Q(){var X=this.start;if(X<this.offset){var ee=this.start=this.offset;return j.prototype.slice.call(this.buffer,X,ee)}}function Z(){for(;this.start<this.offset;){var X=this.fetch();X&&this.push(X)}}function ie(){var X=this.buffers||(this.buffers=[]),ee=X.length>1?this.bufferish.concat(X):X[0];return X.length=0,ee}function oe(X){var ee=0|X;if(this.buffer){var le=this.buffer.length,$=0|this.offset,he=$+ee;if(he<le)return this.offset=he,$;this.flush(),X=Math.max(X,Math.min(2*le,this.maxBufferSize))}return X=Math.max(X,this.minBufferSize),this.buffer=this.bufferish.alloc(X),this.start=0,this.offset=ee,0}function ue(X){var ee=X.length;if(ee>this.minBufferSize)this.flush(),this.push(X);else{var le=this.reserve(ee);j.prototype.copy.call(X,this.buffer,le)}}return{bufferish:j,write:T,fetch:Q,flush:Z,push:N,pull:ie,read:I,reserve:oe,send:ue,maxBufferSize:H,minBufferSize:V,offset:0,start:0}}function T(){throw new Error("method not implemented: write()")}function S(){throw new Error("method not implemented: fetch()")}function I(){var Q=this.buffers&&this.buffers.length;return Q?(this.flush(),this.pull()):this.fetch()}function N(Q){var Z=this.buffers||(this.buffers=[]);Z.push(Q)}function B(){var Q=this.buffers||(this.buffers=[]);return Q.shift()}function L(Q){function Z(ie){for(var oe in Q)ie[oe]=Q[oe];return ie}return Z}m.FlexDecoder=R,m.FlexEncoder=C;var j=E("./bufferish"),V=2048,H=65536,z="BUFFER_SHORTAGE";R.mixin=L(O()),R.mixin(R.prototype),C.mixin=L(P()),C.mixin(C.prototype)},{"./bufferish":8}],22:[function(E,g,m){function R(L){function j(H){var z=I(H),Q=V[z];if(!Q)throw new Error("Invalid type: "+(z&&"0x"+z.toString(16)));return Q(H)}var V=N.getReadToken(L);return j}function C(){var L=this.options;return this.decode=R(L),L&&L.preset&&S.setExtUnpackers(this),this}function O(L,j){var V=this.extUnpackers||(this.extUnpackers=[]);V[L]=B.filter(j)}function P(L){function j(H){return new T(H,L)}var V=this.extUnpackers||(this.extUnpackers=[]);return V[L]||j}var T=E("./ext-buffer").ExtBuffer,S=E("./ext-unpacker"),I=E("./read-format").readUint8,N=E("./read-token"),B=E("./codec-base");B.install({addExtUnpacker:O,getExtUnpacker:P,init:C}),m.preset=C.call(B.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-unpacker":19,"./read-format":23,"./read-token":24}],23:[function(E,g,m){function R(te){var se=Ie.hasArrayBuffer&&te&&te.binarraybuffer,re=te&&te.int64,de=Pe&&te&&te.usemap,ce={map:de?O:C,array:P,str:T,bin:se?I:S,ext:N,uint8:B,uint16:j,uint32:H,uint64:Q(8,re?oe:Z),int8:L,int16:V,int32:z,int64:Q(8,re?ue:ie),float32:Q(4,X),float64:Q(8,ee)};return ce}function C(te,se){var re,de={},ce=new Array(se),ye=new Array(se),Me=te.codec.decode;for(re=0;re<se;re++)ce[re]=Me(te),ye[re]=Me(te);for(re=0;re<se;re++)de[ce[re]]=ye[re];return de}function O(te,se){var re,de=new Map,ce=new Array(se),ye=new Array(se),Me=te.codec.decode;for(re=0;re<se;re++)ce[re]=Me(te),ye[re]=Me(te);for(re=0;re<se;re++)de.set(ce[re],ye[re]);return de}function P(te,se){for(var re=new Array(se),de=te.codec.decode,ce=0;ce<se;ce++)re[ce]=de(te);return re}function T(te,se){var re=te.reserve(se),de=re+se;return Ce.toString.call(te.buffer,"utf-8",re,de)}function S(te,se){var re=te.reserve(se),de=re+se,ce=Ce.slice.call(te.buffer,re,de);return Ie.from(ce)}function I(te,se){var re=te.reserve(se),de=re+se,ce=Ce.slice.call(te.buffer,re,de);return Ie.Uint8Array.from(ce).buffer}function N(te,se){var re=te.reserve(se+1),de=te.buffer[re++],ce=re+se,ye=te.codec.getExtUnpacker(de);if(!ye)throw new Error("Invalid ext type: "+(de&&"0x"+de.toString(16)));var Me=Ce.slice.call(te.buffer,re,ce);return ye(Me)}function B(te){var se=te.reserve(1);return te.buffer[se]}function L(te){var se=te.reserve(1),re=te.buffer[se];return 128&re?re-256:re}function j(te){var se=te.reserve(2),re=te.buffer;return re[se++]<<8|re[se]}function V(te){var se=te.reserve(2),re=te.buffer,de=re[se++]<<8|re[se];return 32768&de?de-65536:de}function H(te){var se=te.reserve(4),re=te.buffer;return 16777216*re[se++]+(re[se++]<<16)+(re[se++]<<8)+re[se]}function z(te){var se=te.reserve(4),re=te.buffer;return re[se++]<<24|re[se++]<<16|re[se++]<<8|re[se]}function Q(te,se){return function(re){var de=re.reserve(te);return se.call(re.buffer,de,be)}}function Z(te){return new he(this,te).toNumber()}function ie(te){return new De(this,te).toNumber()}function oe(te){return new he(this,te)}function ue(te){return new De(this,te)}function X(te){return le.read(this,te,!1,23,4)}function ee(te){return le.read(this,te,!1,52,8)}var le=E("ieee754"),$=E("int64-buffer"),he=$.Uint64BE,De=$.Int64BE;m.getReadFormat=R,m.readUint8=B;var Ie=E("./bufferish"),Ce=E("./bufferish-proto"),Pe=typeof Map<"u",be=!0},{"./bufferish":8,"./bufferish-proto":6,ieee754:32,"int64-buffer":33}],24:[function(E,g,m){function R(N){var B=I.getReadFormat(N);return N&&N.useraw?O(B):C(B)}function C(N){var B,L=new Array(256);for(B=0;B<=127;B++)L[B]=P(B);for(B=128;B<=143;B++)L[B]=S(B-128,N.map);for(B=144;B<=159;B++)L[B]=S(B-144,N.array);for(B=160;B<=191;B++)L[B]=S(B-160,N.str);for(L[192]=P(null),L[193]=null,L[194]=P(!1),L[195]=P(!0),L[196]=T(N.uint8,N.bin),L[197]=T(N.uint16,N.bin),L[198]=T(N.uint32,N.bin),L[199]=T(N.uint8,N.ext),L[200]=T(N.uint16,N.ext),L[201]=T(N.uint32,N.ext),L[202]=N.float32,L[203]=N.float64,L[204]=N.uint8,L[205]=N.uint16,L[206]=N.uint32,L[207]=N.uint64,L[208]=N.int8,L[209]=N.int16,L[210]=N.int32,L[211]=N.int64,L[212]=S(1,N.ext),L[213]=S(2,N.ext),L[214]=S(4,N.ext),L[215]=S(8,N.ext),L[216]=S(16,N.ext),L[217]=T(N.uint8,N.str),L[218]=T(N.uint16,N.str),L[219]=T(N.uint32,N.str),L[220]=T(N.uint16,N.array),L[221]=T(N.uint32,N.array),L[222]=T(N.uint16,N.map),L[223]=T(N.uint32,N.map),B=224;B<=255;B++)L[B]=P(B-256);return L}function O(N){var B,L=C(N).slice();for(L[217]=L[196],L[218]=L[197],L[219]=L[198],B=160;B<=191;B++)L[B]=S(B-160,N.bin);return L}function P(N){return function(){return N}}function T(N,B){return function(L){var j=N(L);return B(L,j)}}function S(N,B){return function(L){return B(L,N)}}var I=E("./read-format");m.getReadToken=R},{"./read-format":23}],25:[function(E,g,m){function R(B){function L(V,H){var z=j[typeof H];if(!z)throw new Error('Unsupported type "'+typeof H+'": '+H);z(V,H)}var j=I.getWriteType(B);return L}function C(){var B=this.options;return this.encode=R(B),B&&B.preset&&S.setExtPackers(this),this}function O(B,L,j){function V(Z){return j&&(Z=j(Z)),new T(Z,B)}j=N.filter(j);var H=L.name;if(H&&H!=="Object"){var z=this.extPackers||(this.extPackers={});z[H]=V}else{var Q=this.extEncoderList||(this.extEncoderList=[]);Q.unshift([L,V])}}function P(B){var L=this.extPackers||(this.extPackers={}),j=B.constructor,V=j&&j.name&&L[j.name];if(V)return V;for(var H=this.extEncoderList||(this.extEncoderList=[]),z=H.length,Q=0;Q<z;Q++){var Z=H[Q];if(j===Z[0])return Z[1]}}var T=E("./ext-buffer").ExtBuffer,S=E("./ext-packer"),I=E("./write-type"),N=E("./codec-base");N.install({addExtPacker:O,getExtPacker:P,init:C}),m.preset=C.call(N.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-packer":18,"./write-type":27}],26:[function(E,g,m){function R($){return $&&$.uint8array?C():ee||oe.hasBuffer&&$&&$.safe?P():O()}function C(){var $=O();return $[202]=N(202,4,j),$[203]=N(203,8,V),$}function O(){var $=ie.slice();return $[196]=T(196),$[197]=S(197),$[198]=I(198),$[199]=T(199),$[200]=S(200),$[201]=I(201),$[202]=N(202,4,le.writeFloatBE||j,!0),$[203]=N(203,8,le.writeDoubleBE||V,!0),$[204]=T(204),$[205]=S(205),$[206]=I(206),$[207]=N(207,8,B),$[208]=T(208),$[209]=S(209),$[210]=I(210),$[211]=N(211,8,L),$[217]=T(217),$[218]=S(218),$[219]=I(219),$[220]=S(220),$[221]=I(221),$[222]=S(222),$[223]=I(223),$}function P(){var $=ie.slice();return $[196]=N(196,1,ue.prototype.writeUInt8),$[197]=N(197,2,ue.prototype.writeUInt16BE),$[198]=N(198,4,ue.prototype.writeUInt32BE),$[199]=N(199,1,ue.prototype.writeUInt8),$[200]=N(200,2,ue.prototype.writeUInt16BE),$[201]=N(201,4,ue.prototype.writeUInt32BE),$[202]=N(202,4,ue.prototype.writeFloatBE),$[203]=N(203,8,ue.prototype.writeDoubleBE),$[204]=N(204,1,ue.prototype.writeUInt8),$[205]=N(205,2,ue.prototype.writeUInt16BE),$[206]=N(206,4,ue.prototype.writeUInt32BE),$[207]=N(207,8,B),$[208]=N(208,1,ue.prototype.writeInt8),$[209]=N(209,2,ue.prototype.writeInt16BE),$[210]=N(210,4,ue.prototype.writeInt32BE),$[211]=N(211,8,L),$[217]=N(217,1,ue.prototype.writeUInt8),$[218]=N(218,2,ue.prototype.writeUInt16BE),$[219]=N(219,4,ue.prototype.writeUInt32BE),$[220]=N(220,2,ue.prototype.writeUInt16BE),$[221]=N(221,4,ue.prototype.writeUInt32BE),$[222]=N(222,2,ue.prototype.writeUInt16BE),$[223]=N(223,4,ue.prototype.writeUInt32BE),$}function T($){return function(he,De){var Ie=he.reserve(2),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie]=De}}function S($){return function(he,De){var Ie=he.reserve(3),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie++]=De>>>8,Ce[Ie]=De}}function I($){return function(he,De){var Ie=he.reserve(5),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie++]=De>>>24,Ce[Ie++]=De>>>16,Ce[Ie++]=De>>>8,Ce[Ie]=De}}function N($,he,De,Ie){return function(Ce,Pe){var be=Ce.reserve(he+1);Ce.buffer[be++]=$,De.call(Ce.buffer,Pe,be,Ie)}}function B($,he){new Q(this,he,$)}function L($,he){new Z(this,he,$)}function j($,he){H.write(this,$,he,!1,23,4)}function V($,he){H.write(this,$,he,!1,52,8)}var H=E("ieee754"),z=E("int64-buffer"),Q=z.Uint64BE,Z=z.Int64BE,ie=E("./write-uint8").uint8,oe=E("./bufferish"),ue=oe.global,X=oe.hasBuffer&&"TYPED_ARRAY_SUPPORT"in ue,ee=X&&!ue.TYPED_ARRAY_SUPPORT,le=oe.hasBuffer&&ue.prototype||{};m.getWriteToken=R},{"./bufferish":8,"./write-uint8":28,ieee754:32,"int64-buffer":33}],27:[function(E,g,m){function R(z){function Q(U,F){var q=F?195:194;re[q](U,F)}function Z(U,F){var q,W=0|F;return F!==W?(q=203,void re[q](U,F)):(q=-32<=W&&W<=127?255&W:0<=W?W<=255?204:W<=65535?205:206:-128<=W?208:-32768<=W?209:210,void re[q](U,W))}function ie(U,F){var q=207;re[q](U,F.toArray())}function oe(U,F){var q=211;re[q](U,F.toArray())}function ue(U){return U<32?1:U<=255?2:U<=65535?3:5}function X(U){return U<32?1:U<=65535?3:5}function ee(U){function F(q,W){var K=W.length,ae=5+3*K;q.offset=q.reserve(ae);var ve=q.buffer,Oe=U(K),xe=q.offset+Oe;K=I.write.call(ve,W,xe);var Ae=U(K);if(Oe!==Ae){var Re=xe+Ae-Oe,we=xe+K;I.copy.call(ve,ve,Re,xe,we)}var Se=Ae===1?160+K:Ae<=3?215+Ae:219;re[Se](q,K),q.offset+=K}return F}function le(U,F){if(F===null)return he(U,F);if(ye(F))return Me(U,F);if(C(F))return De(U,F);if(P.isUint64BE(F))return ie(U,F);if(T.isInt64BE(F))return oe(U,F);var q=U.codec.getExtPacker(F);return q&&(F=q(F)),F instanceof L?Pe(U,F):void Be(U,F)}function $(U,F){return ye(F)?se(U,F):void le(U,F)}function he(U,F){var q=192;re[q](U,F)}function De(U,F){var q=F.length,W=q<16?144+q:q<=65535?220:221;re[W](U,q);for(var K=U.codec.encode,ae=0;ae<q;ae++)K(U,F[ae])}function Ie(U,F){var q=F.length,W=q<255?196:q<=65535?197:198;re[W](U,q),U.send(F)}function Ce(U,F){Ie(U,new Uint8Array(F))}function Pe(U,F){var q=F.buffer,W=q.length,K=H[W]||(W<255?199:W<=65535?200:201);re[K](U,W),B[F.type](U),U.send(q)}function be(U,F){var q=Object.keys(F),W=q.length,K=W<16?128+W:W<=65535?222:223;re[K](U,W);var ae=U.codec.encode;q.forEach(function(ve){ae(U,ve),ae(U,F[ve])})}function te(U,F){if(!(F instanceof Map))return be(U,F);var q=F.size,W=q<16?128+q:q<=65535?222:223;re[W](U,q);var K=U.codec.encode;F.forEach(function(ae,ve,Oe){K(U,ve),K(U,ae)})}function se(U,F){var q=F.length,W=q<32?160+q:q<=65535?218:219;re[W](U,q),U.send(F)}var re=N.getWriteToken(z),de=z&&z.useraw,ce=j&&z&&z.binarraybuffer,ye=ce?S.isArrayBuffer:S.isBuffer,Me=ce?Ce:Ie,qe=V&&z&&z.usemap,Be=qe?te:be,k={boolean:Q,function:he,number:Z,object:de?$:le,string:ee(de?X:ue),symbol:he,undefined:he};return k}var C=E("isarray"),O=E("int64-buffer"),P=O.Uint64BE,T=O.Int64BE,S=E("./bufferish"),I=E("./bufferish-proto"),N=E("./write-token"),B=E("./write-uint8").uint8,L=E("./ext-buffer").ExtBuffer,j=typeof Uint8Array<"u",V=typeof Map<"u",H=[];H[1]=212,H[2]=213,H[4]=214,H[8]=215,H[16]=216,m.getWriteType=R},{"./bufferish":8,"./bufferish-proto":6,"./ext-buffer":17,"./write-token":26,"./write-uint8":28,"int64-buffer":33,isarray:34}],28:[function(E,g,m){function R(P){return function(T){var S=T.reserve(1);T.buffer[S]=P}}for(var C=m.uint8=new Array(256),O=0;O<=255;O++)C[O]=R(O)},{}],29:[function(E,g,m){(function(R){"use strict";function C(){try{var M=new Uint8Array(1);return M.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},M.foo()===42&&typeof M.subarray=="function"&&M.subarray(1,1).byteLength===0}catch{return!1}}function O(){return T.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function P(M,x){if(O()<x)throw new RangeError("Invalid typed array length");return T.TYPED_ARRAY_SUPPORT?(M=new Uint8Array(x),M.__proto__=T.prototype):(M===null&&(M=new T(x)),M.length=x),M}function T(M,x,D){if(!(T.TYPED_ARRAY_SUPPORT||this instanceof T))return new T(M,x,D);if(typeof M=="number"){if(typeof x=="string")throw new Error("If encoding is specified then the first argument must be a string");return B(this,M)}return S(this,M,x,D)}function S(M,x,D,G){if(typeof x=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&x instanceof ArrayBuffer?V(M,x,D,G):typeof x=="string"?L(M,x,D):H(M,x)}function I(M){if(typeof M!="number")throw new TypeError('"size" argument must be a number');if(M<0)throw new RangeError('"size" argument must not be negative')}function N(M,x,D,G){return I(x),x<=0?P(M,x):D!==void 0?typeof G=="string"?P(M,x).fill(D,G):P(M,x).fill(D):P(M,x)}function B(M,x){if(I(x),M=P(M,x<0?0:0|z(x)),!T.TYPED_ARRAY_SUPPORT)for(var D=0;D<x;++D)M[D]=0;return M}function L(M,x,D){if(typeof D=="string"&&D!==""||(D="utf8"),!T.isEncoding(D))throw new TypeError('"encoding" must be a valid string encoding');var G=0|Z(x,D);M=P(M,G);var J=M.write(x,D);return J!==G&&(M=M.slice(0,J)),M}function j(M,x){var D=x.length<0?0:0|z(x.length);M=P(M,D);for(var G=0;G<D;G+=1)M[G]=255&x[G];return M}function V(M,x,D,G){if(x.byteLength,D<0||x.byteLength<D)throw new RangeError("'offset' is out of bounds");if(x.byteLength<D+(G||0))throw new RangeError("'length' is out of bounds");return x=D===void 0&&G===void 0?new Uint8Array(x):G===void 0?new Uint8Array(x,D):new Uint8Array(x,D,G),T.TYPED_ARRAY_SUPPORT?(M=x,M.__proto__=T.prototype):M=j(M,x),M}function H(M,x){if(T.isBuffer(x)){var D=0|z(x.length);return M=P(M,D),M.length===0||x.copy(M,0,0,D),M}if(x){if(typeof ArrayBuffer<"u"&&x.buffer instanceof ArrayBuffer||"length"in x)return typeof x.length!="number"||Ae(x.length)?P(M,0):j(M,x);if(x.type==="Buffer"&&Se(x.data))return j(M,x.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function z(M){if(M>=O())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O().toString(16)+" bytes");return 0|M}function Q(M){return+M!=M&&(M=0),T.alloc(+M)}function Z(M,x){if(T.isBuffer(M))return M.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(M)||M instanceof ArrayBuffer))return M.byteLength;typeof M!="string"&&(M=""+M);var D=M.length;if(D===0)return 0;for(var G=!1;;)switch(x){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":case void 0:return K(M).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*D;case"hex":return D>>>1;case"base64":return Oe(M).length;default:if(G)return K(M).length;x=(""+x).toLowerCase(),G=!0}}function ie(M,x,D){var G=!1;if((x===void 0||x<0)&&(x=0),x>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,x>>>=0,D<=x))return"";for(M||(M="utf8");;)switch(M){case"hex":return re(this,x,D);case"utf8":case"utf-8":return Pe(this,x,D);case"ascii":return te(this,x,D);case"latin1":case"binary":return se(this,x,D);case"base64":return Ce(this,x,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,x,D);default:if(G)throw new TypeError("Unknown encoding: "+M);M=(M+"").toLowerCase(),G=!0}}function oe(M,x,D){var G=M[x];M[x]=M[D],M[D]=G}function ue(M,x,D,G,J){if(M.length===0)return-1;if(typeof D=="string"?(G=D,D=0):D>2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,isNaN(D)&&(D=J?0:M.length-1),D<0&&(D=M.length+D),D>=M.length){if(J)return-1;D=M.length-1}else if(D<0){if(!J)return-1;D=0}if(typeof x=="string"&&(x=T.from(x,G)),T.isBuffer(x))return x.length===0?-1:X(M,x,D,G,J);if(typeof x=="number")return x=255&x,T.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(M,x,D):Uint8Array.prototype.lastIndexOf.call(M,x,D):X(M,[x],D,G,J);throw new TypeError("val must be string, number or Buffer")}function X(M,x,D,G,J){function ne(Tr,Ar){return Te===1?Tr[Ar]:Tr.readUInt16BE(Ar*Te)}var Te=1,He=M.length,Xe=x.length;if(G!==void 0&&(G=String(G).toLowerCase(),G==="ucs2"||G==="ucs-2"||G==="utf16le"||G==="utf-16le")){if(M.length<2||x.length<2)return-1;Te=2,He/=2,Xe/=2,D/=2}var Ge;if(J){var Qe=-1;for(Ge=D;Ge<He;Ge++)if(ne(M,Ge)===ne(x,Qe===-1?0:Ge-Qe)){if(Qe===-1&&(Qe=Ge),Ge-Qe+1===Xe)return Qe*Te}else Qe!==-1&&(Ge-=Ge-Qe),Qe=-1}else for(D+Xe>He&&(D=He-Xe),Ge=D;Ge>=0;Ge--){for(var tt=!0,Qt=0;Qt<Xe;Qt++)if(ne(M,Ge+Qt)!==ne(x,Qt)){tt=!1;break}if(tt)return Ge}return-1}function ee(M,x,D,G){D=Number(D)||0;var J=M.length-D;G?(G=Number(G),G>J&&(G=J)):G=J;var ne=x.length;if(ne%2!==0)throw new TypeError("Invalid hex string");G>ne/2&&(G=ne/2);for(var Te=0;Te<G;++Te){var He=parseInt(x.substr(2*Te,2),16);if(isNaN(He))return Te;M[D+Te]=He}return Te}function le(M,x,D,G){return xe(K(x,M.length-D),M,D,G)}function $(M,x,D,G){return xe(ae(x),M,D,G)}function he(M,x,D,G){return $(M,x,D,G)}function De(M,x,D,G){return xe(Oe(x),M,D,G)}function Ie(M,x,D,G){return xe(ve(x,M.length-D),M,D,G)}function Ce(M,x,D){return x===0&&D===M.length?Re.fromByteArray(M):Re.fromByteArray(M.slice(x,D))}function Pe(M,x,D){D=Math.min(M.length,D);for(var G=[],J=x;J<D;){var ne=M[J],Te=null,He=ne>239?4:ne>223?3:ne>191?2:1;if(J+He<=D){var Xe,Ge,Qe,tt;switch(He){case 1:ne<128&&(Te=ne);break;case 2:Xe=M[J+1],(192&Xe)===128&&(tt=(31&ne)<<6|63&Xe,tt>127&&(Te=tt));break;case 3:Xe=M[J+1],Ge=M[J+2],(192&Xe)===128&&(192&Ge)===128&&(tt=(15&ne)<<12|(63&Xe)<<6|63&Ge,tt>2047&&(tt<55296||tt>57343)&&(Te=tt));break;case 4:Xe=M[J+1],Ge=M[J+2],Qe=M[J+3],(192&Xe)===128&&(192&Ge)===128&&(192&Qe)===128&&(tt=(15&ne)<<18|(63&Xe)<<12|(63&Ge)<<6|63&Qe,tt>65535&&tt<1114112&&(Te=tt))}}Te===null?(Te=65533,He=1):Te>65535&&(Te-=65536,G.push(Te>>>10&1023|55296),Te=56320|1023&Te),G.push(Te),J+=He}return be(G)}function be(M){var x=M.length;if(x<=ke)return String.fromCharCode.apply(String,M);for(var D="",G=0;G<x;)D+=String.fromCharCode.apply(String,M.slice(G,G+=ke));return D}function te(M,x,D){var G="";D=Math.min(M.length,D);for(var J=x;J<D;++J)G+=String.fromCharCode(127&M[J]);return G}function se(M,x,D){var G="";D=Math.min(M.length,D);for(var J=x;J<D;++J)G+=String.fromCharCode(M[J]);return G}function re(M,x,D){var G=M.length;(!x||x<0)&&(x=0),(!D||D<0||D>G)&&(D=G);for(var J="",ne=x;ne<D;++ne)J+=W(M[ne]);return J}function de(M,x,D){for(var G=M.slice(x,D),J="",ne=0;ne<G.length;ne+=2)J+=String.fromCharCode(G[ne]+256*G[ne+1]);return J}function ce(M,x,D){if(M%1!==0||M<0)throw new RangeError("offset is not uint");if(M+x>D)throw new RangeError("Trying to access beyond buffer length")}function ye(M,x,D,G,J,ne){if(!T.isBuffer(M))throw new TypeError('"buffer" argument must be a Buffer instance');if(x>J||x<ne)throw new RangeError('"value" argument is out of bounds');if(D+G>M.length)throw new RangeError("Index out of range")}function Me(M,x,D,G){x<0&&(x=65535+x+1);for(var J=0,ne=Math.min(M.length-D,2);J<ne;++J)M[D+J]=(x&255<<8*(G?J:1-J))>>>8*(G?J:1-J)}function qe(M,x,D,G){x<0&&(x=4294967295+x+1);for(var J=0,ne=Math.min(M.length-D,4);J<ne;++J)M[D+J]=x>>>8*(G?J:3-J)&255}function Be(M,x,D,G,J,ne){if(D+G>M.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function k(M,x,D,G,J){return J||Be(M,x,D,4,34028234663852886e22,-34028234663852886e22),we.write(M,x,D,G,23,4),D+4}function U(M,x,D,G,J){return J||Be(M,x,D,8,17976931348623157e292,-17976931348623157e292),we.write(M,x,D,G,52,8),D+8}function F(M){if(M=q(M).replace(We,""),M.length<2)return"";for(;M.length%4!==0;)M+="=";return M}function q(M){return M.trim?M.trim():M.replace(/^\s+|\s+$/g,"")}function W(M){return M<16?"0"+M.toString(16):M.toString(16)}function K(M,x){x=x||1/0;for(var D,G=M.length,J=null,ne=[],Te=0;Te<G;++Te){if(D=M.charCodeAt(Te),D>55295&&D<57344){if(!J){if(D>56319){(x-=3)>-1&&ne.push(239,191,189);continue}if(Te+1===G){(x-=3)>-1&&ne.push(239,191,189);continue}J=D;continue}if(D<56320){(x-=3)>-1&&ne.push(239,191,189),J=D;continue}D=(J-55296<<10|D-56320)+65536}else J&&(x-=3)>-1&&ne.push(239,191,189);if(J=null,D<128){if((x-=1)<0)break;ne.push(D)}else if(D<2048){if((x-=2)<0)break;ne.push(D>>6|192,63&D|128)}else if(D<65536){if((x-=3)<0)break;ne.push(D>>12|224,D>>6&63|128,63&D|128)}else{if(!(D<1114112))throw new Error("Invalid code point");if((x-=4)<0)break;ne.push(D>>18|240,D>>12&63|128,D>>6&63|128,63&D|128)}}return ne}function ae(M){for(var x=[],D=0;D<M.length;++D)x.push(255&M.charCodeAt(D));return x}function ve(M,x){for(var D,G,J,ne=[],Te=0;Te<M.length&&!((x-=2)<0);++Te)D=M.charCodeAt(Te),G=D>>8,J=D%256,ne.push(J),ne.push(G);return ne}function Oe(M){return Re.toByteArray(F(M))}function xe(M,x,D,G){for(var J=0;J<G&&!(J+D>=x.length||J>=M.length);++J)x[J+D]=M[J];return J}function Ae(M){return M!==M}var Re=E("base64-js"),we=E("ieee754"),Se=E("isarray");m.Buffer=T,m.SlowBuffer=Q,m.INSPECT_MAX_BYTES=50,T.TYPED_ARRAY_SUPPORT=R.TYPED_ARRAY_SUPPORT!==void 0?R.TYPED_ARRAY_SUPPORT:C(),m.kMaxLength=O(),T.poolSize=8192,T._augment=function(M){return M.__proto__=T.prototype,M},T.from=function(M,x,D){return S(null,M,x,D)},T.TYPED_ARRAY_SUPPORT&&(T.prototype.__proto__=Uint8Array.prototype,T.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&T[Symbol.species]===T&&Object.defineProperty(T,Symbol.species,{value:null,configurable:!0})),T.alloc=function(M,x,D){return N(null,M,x,D)},T.allocUnsafe=function(M){return B(null,M)},T.allocUnsafeSlow=function(M){return B(null,M)},T.isBuffer=function(M){return!(M==null||!M._isBuffer)},T.compare=function(M,x){if(!T.isBuffer(M)||!T.isBuffer(x))throw new TypeError("Arguments must be Buffers");if(M===x)return 0;for(var D=M.length,G=x.length,J=0,ne=Math.min(D,G);J<ne;++J)if(M[J]!==x[J]){D=M[J],G=x[J];break}return D<G?-1:G<D?1:0},T.isEncoding=function(M){switch(String(M).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},T.concat=function(M,x){if(!Se(M))throw new TypeError('"list" argument must be an Array of Buffers');if(M.length===0)return T.alloc(0);var D;if(x===void 0)for(x=0,D=0;D<M.length;++D)x+=M[D].length;var G=T.allocUnsafe(x),J=0;for(D=0;D<M.length;++D){var ne=M[D];if(!T.isBuffer(ne))throw new TypeError('"list" argument must be an Array of Buffers');ne.copy(G,J),J+=ne.length}return G},T.byteLength=Z,T.prototype._isBuffer=!0,T.prototype.swap16=function(){var M=this.length;if(M%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var x=0;x<M;x+=2)oe(this,x,x+1);return this},T.prototype.swap32=function(){var M=this.length;if(M%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var x=0;x<M;x+=4)oe(this,x,x+3),oe(this,x+1,x+2);return this},T.prototype.swap64=function(){var M=this.length;if(M%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var x=0;x<M;x+=8)oe(this,x,x+7),oe(this,x+1,x+6),oe(this,x+2,x+5),oe(this,x+3,x+4);return this},T.prototype.toString=function(){var M=0|this.length;return M===0?"":arguments.length===0?Pe(this,0,M):ie.apply(this,arguments)},T.prototype.equals=function(M){if(!T.isBuffer(M))throw new TypeError("Argument must be a Buffer");return this===M||T.compare(this,M)===0},T.prototype.inspect=function(){var M="",x=m.INSPECT_MAX_BYTES;return this.length>0&&(M=this.toString("hex",0,x).match(/.{2}/g).join(" "),this.length>x&&(M+=" ... ")),"<Buffer "+M+">"},T.prototype.compare=function(M,x,D,G,J){if(!T.isBuffer(M))throw new TypeError("Argument must be a Buffer");if(x===void 0&&(x=0),D===void 0&&(D=M?M.length:0),G===void 0&&(G=0),J===void 0&&(J=this.length),x<0||D>M.length||G<0||J>this.length)throw new RangeError("out of range index");if(G>=J&&x>=D)return 0;if(G>=J)return-1;if(x>=D)return 1;if(x>>>=0,D>>>=0,G>>>=0,J>>>=0,this===M)return 0;for(var ne=J-G,Te=D-x,He=Math.min(ne,Te),Xe=this.slice(G,J),Ge=M.slice(x,D),Qe=0;Qe<He;++Qe)if(Xe[Qe]!==Ge[Qe]){ne=Xe[Qe],Te=Ge[Qe];break}return ne<Te?-1:Te<ne?1:0},T.prototype.includes=function(M,x,D){return this.indexOf(M,x,D)!==-1},T.prototype.indexOf=function(M,x,D){return ue(this,M,x,D,!0)},T.prototype.lastIndexOf=function(M,x,D){return ue(this,M,x,D,!1)},T.prototype.write=function(M,x,D,G){if(x===void 0)G="utf8",D=this.length,x=0;else if(D===void 0&&typeof x=="string")G=x,D=this.length,x=0;else{if(!isFinite(x))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");x=0|x,isFinite(D)?(D=0|D,G===void 0&&(G="utf8")):(G=D,D=void 0)}var J=this.length-x;if((D===void 0||D>J)&&(D=J),M.length>0&&(D<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");G||(G="utf8");for(var ne=!1;;)switch(G){case"hex":return ee(this,M,x,D);case"utf8":case"utf-8":return le(this,M,x,D);case"ascii":return $(this,M,x,D);case"latin1":case"binary":return he(this,M,x,D);case"base64":return De(this,M,x,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,M,x,D);default:if(ne)throw new TypeError("Unknown encoding: "+G);G=(""+G).toLowerCase(),ne=!0}},T.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ke=4096;T.prototype.slice=function(M,x){var D=this.length;M=~~M,x=x===void 0?D:~~x,M<0?(M+=D,M<0&&(M=0)):M>D&&(M=D),x<0?(x+=D,x<0&&(x=0)):x>D&&(x=D),x<M&&(x=M);var G;if(T.TYPED_ARRAY_SUPPORT)G=this.subarray(M,x),G.__proto__=T.prototype;else{var J=x-M;G=new T(J,void 0);for(var ne=0;ne<J;++ne)G[ne]=this[ne+M]}return G},T.prototype.readUIntLE=function(M,x,D){M=0|M,x=0|x,D||ce(M,x,this.length);for(var G=this[M],J=1,ne=0;++ne<x&&(J*=256);)G+=this[M+ne]*J;return G},T.prototype.readUIntBE=function(M,x,D){M=0|M,x=0|x,D||ce(M,x,this.length);for(var G=this[M+--x],J=1;x>0&&(J*=256);)G+=this[M+--x]*J;return G},T.prototype.readUInt8=function(M,x){return x||ce(M,1,this.length),this[M]},T.prototype.readUInt16LE=function(M,x){return x||ce(M,2,this.length),this[M]|this[M+1]<<8},T.prototype.readUInt16BE=function(M,x){return x||ce(M,2,this.length),this[M]<<8|this[M+1]},T.prototype.readUInt32LE=function(M,x){return x||ce(M,4,this.length),(this[M]|this[M+1]<<8|this[M+2]<<16)+16777216*this[M+3]},T.prototype.readUInt32BE=function(M,x){return x||ce(M,4,this.length),16777216*this[M]+(this[M+1]<<16|this[M+2]<<8|this[M+3])},T.prototype.readIntLE=function(M,x,D){M=0|M,x=0|x,D||ce(M,x,this.length);for(var G=this[M],J=1,ne=0;++ne<x&&(J*=256);)G+=this[M+ne]*J;return J*=128,G>=J&&(G-=Math.pow(2,8*x)),G},T.prototype.readIntBE=function(M,x,D){M=0|M,x=0|x,D||ce(M,x,this.length);for(var G=x,J=1,ne=this[M+--G];G>0&&(J*=256);)ne+=this[M+--G]*J;return J*=128,ne>=J&&(ne-=Math.pow(2,8*x)),ne},T.prototype.readInt8=function(M,x){return x||ce(M,1,this.length),128&this[M]?(255-this[M]+1)*-1:this[M]},T.prototype.readInt16LE=function(M,x){x||ce(M,2,this.length);var D=this[M]|this[M+1]<<8;return 32768&D?4294901760|D:D},T.prototype.readInt16BE=function(M,x){x||ce(M,2,this.length);var D=this[M+1]|this[M]<<8;return 32768&D?4294901760|D:D},T.prototype.readInt32LE=function(M,x){return x||ce(M,4,this.length),this[M]|this[M+1]<<8|this[M+2]<<16|this[M+3]<<24},T.prototype.readInt32BE=function(M,x){return x||ce(M,4,this.length),this[M]<<24|this[M+1]<<16|this[M+2]<<8|this[M+3]},T.prototype.readFloatLE=function(M,x){return x||ce(M,4,this.length),we.read(this,M,!0,23,4)},T.prototype.readFloatBE=function(M,x){return x||ce(M,4,this.length),we.read(this,M,!1,23,4)},T.prototype.readDoubleLE=function(M,x){return x||ce(M,8,this.length),we.read(this,M,!0,52,8)},T.prototype.readDoubleBE=function(M,x){return x||ce(M,8,this.length),we.read(this,M,!1,52,8)},T.prototype.writeUIntLE=function(M,x,D,G){if(M=+M,x=0|x,D=0|D,!G){var J=Math.pow(2,8*D)-1;ye(this,M,x,D,J,0)}var ne=1,Te=0;for(this[x]=255&M;++Te<D&&(ne*=256);)this[x+Te]=M/ne&255;return x+D},T.prototype.writeUIntBE=function(M,x,D,G){if(M=+M,x=0|x,D=0|D,!G){var J=Math.pow(2,8*D)-1;ye(this,M,x,D,J,0)}var ne=D-1,Te=1;for(this[x+ne]=255&M;--ne>=0&&(Te*=256);)this[x+ne]=M/Te&255;return x+D},T.prototype.writeUInt8=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,1,255,0),T.TYPED_ARRAY_SUPPORT||(M=Math.floor(M)),this[x]=255&M,x+1},T.prototype.writeUInt16LE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[x]=255&M,this[x+1]=M>>>8):Me(this,M,x,!0),x+2},T.prototype.writeUInt16BE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,2,65535,0),T.TYPED_ARRAY_SUPPORT?(this[x]=M>>>8,this[x+1]=255&M):Me(this,M,x,!1),x+2},T.prototype.writeUInt32LE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,4,4294967295,0),T.TYPED_ARRAY_SUPPORT?(this[x+3]=M>>>24,this[x+2]=M>>>16,this[x+1]=M>>>8,this[x]=255&M):qe(this,M,x,!0),x+4},T.prototype.writeUInt32BE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,4,4294967295,0),T.TYPED_ARRAY_SUPPORT?(this[x]=M>>>24,this[x+1]=M>>>16,this[x+2]=M>>>8,this[x+3]=255&M):qe(this,M,x,!1),x+4},T.prototype.writeIntLE=function(M,x,D,G){if(M=+M,x=0|x,!G){var J=Math.pow(2,8*D-1);ye(this,M,x,D,J-1,-J)}var ne=0,Te=1,He=0;for(this[x]=255&M;++ne<D&&(Te*=256);)M<0&&He===0&&this[x+ne-1]!==0&&(He=1),this[x+ne]=(M/Te>>0)-He&255;return x+D},T.prototype.writeIntBE=function(M,x,D,G){if(M=+M,x=0|x,!G){var J=Math.pow(2,8*D-1);ye(this,M,x,D,J-1,-J)}var ne=D-1,Te=1,He=0;for(this[x+ne]=255&M;--ne>=0&&(Te*=256);)M<0&&He===0&&this[x+ne+1]!==0&&(He=1),this[x+ne]=(M/Te>>0)-He&255;return x+D},T.prototype.writeInt8=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,1,127,-128),T.TYPED_ARRAY_SUPPORT||(M=Math.floor(M)),M<0&&(M=255+M+1),this[x]=255&M,x+1},T.prototype.writeInt16LE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[x]=255&M,this[x+1]=M>>>8):Me(this,M,x,!0),x+2},T.prototype.writeInt16BE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,2,32767,-32768),T.TYPED_ARRAY_SUPPORT?(this[x]=M>>>8,this[x+1]=255&M):Me(this,M,x,!1),x+2},T.prototype.writeInt32LE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,4,2147483647,-2147483648),T.TYPED_ARRAY_SUPPORT?(this[x]=255&M,this[x+1]=M>>>8,this[x+2]=M>>>16,this[x+3]=M>>>24):qe(this,M,x,!0),x+4},T.prototype.writeInt32BE=function(M,x,D){return M=+M,x=0|x,D||ye(this,M,x,4,2147483647,-2147483648),M<0&&(M=4294967295+M+1),T.TYPED_ARRAY_SUPPORT?(this[x]=M>>>24,this[x+1]=M>>>16,this[x+2]=M>>>8,this[x+3]=255&M):qe(this,M,x,!1),x+4},T.prototype.writeFloatLE=function(M,x,D){return k(this,M,x,!0,D)},T.prototype.writeFloatBE=function(M,x,D){return k(this,M,x,!1,D)},T.prototype.writeDoubleLE=function(M,x,D){return U(this,M,x,!0,D)},T.prototype.writeDoubleBE=function(M,x,D){return U(this,M,x,!1,D)},T.prototype.copy=function(M,x,D,G){if(D||(D=0),G||G===0||(G=this.length),x>=M.length&&(x=M.length),x||(x=0),G>0&&G<D&&(G=D),G===D||M.length===0||this.length===0)return 0;if(x<0)throw new RangeError("targetStart out of bounds");if(D<0||D>=this.length)throw new RangeError("sourceStart out of bounds");if(G<0)throw new RangeError("sourceEnd out of bounds");G>this.length&&(G=this.length),M.length-x<G-D&&(G=M.length-x+D);var J,ne=G-D;if(this===M&&D<x&&x<G)for(J=ne-1;J>=0;--J)M[J+x]=this[J+D];else if(ne<1e3||!T.TYPED_ARRAY_SUPPORT)for(J=0;J<ne;++J)M[J+x]=this[J+D];else Uint8Array.prototype.set.call(M,this.subarray(D,D+ne),x);return ne},T.prototype.fill=function(M,x,D,G){if(typeof M=="string"){if(typeof x=="string"?(G=x,x=0,D=this.length):typeof D=="string"&&(G=D,D=this.length),M.length===1){var J=M.charCodeAt(0);J<256&&(M=J)}if(G!==void 0&&typeof G!="string")throw new TypeError("encoding must be a string");if(typeof G=="string"&&!T.isEncoding(G))throw new TypeError("Unknown encoding: "+G)}else typeof M=="number"&&(M=255&M);if(x<0||this.length<x||this.length<D)throw new RangeError("Out of range index");if(D<=x)return this;x>>>=0,D=D===void 0?this.length:D>>>0,M||(M=0);var ne;if(typeof M=="number")for(ne=x;ne<D;++ne)this[ne]=M;else{var Te=T.isBuffer(M)?M:K(new T(M,G).toString()),He=Te.length;for(ne=0;ne<D-x;++ne)this[ne+x]=Te[ne%He]}return this};var We=/[^+\/0-9A-Za-z-_]/g}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"base64-js":30,ieee754:32,isarray:34}],30:[function(E,g,m){"use strict";function R(H){var z=H.length;if(z%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return H[z-2]==="="?2:H[z-1]==="="?1:0}function C(H){return 3*H.length/4-R(H)}function O(H){var z,Q,Z,ie,oe,ue,X=H.length;oe=R(H),ue=new B(3*X/4-oe),Z=oe>0?X-4:X;var ee=0;for(z=0,Q=0;z<Z;z+=4,Q+=3)ie=N[H.charCodeAt(z)]<<18|N[H.charCodeAt(z+1)]<<12|N[H.charCodeAt(z+2)]<<6|N[H.charCodeAt(z+3)],ue[ee++]=ie>>16&255,ue[ee++]=ie>>8&255,ue[ee++]=255&ie;return oe===2?(ie=N[H.charCodeAt(z)]<<2|N[H.charCodeAt(z+1)]>>4,ue[ee++]=255&ie):oe===1&&(ie=N[H.charCodeAt(z)]<<10|N[H.charCodeAt(z+1)]<<4|N[H.charCodeAt(z+2)]>>2,ue[ee++]=ie>>8&255,ue[ee++]=255&ie),ue}function P(H){return I[H>>18&63]+I[H>>12&63]+I[H>>6&63]+I[63&H]}function T(H,z,Q){for(var Z,ie=[],oe=z;oe<Q;oe+=3)Z=(H[oe]<<16)+(H[oe+1]<<8)+H[oe+2],ie.push(P(Z));return ie.join("")}function S(H){for(var z,Q=H.length,Z=Q%3,ie="",oe=[],ue=16383,X=0,ee=Q-Z;X<ee;X+=ue)oe.push(T(H,X,X+ue>ee?ee:X+ue));return Z===1?(z=H[Q-1],ie+=I[z>>2],ie+=I[z<<4&63],ie+="=="):Z===2&&(z=(H[Q-2]<<8)+H[Q-1],ie+=I[z>>10],ie+=I[z>>4&63],ie+=I[z<<2&63],ie+="="),oe.push(ie),oe.join("")}m.byteLength=C,m.toByteArray=O,m.fromByteArray=S;for(var I=[],N=[],B=typeof Uint8Array<"u"?Uint8Array:Array,L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=0,V=L.length;j<V;++j)I[j]=L[j],N[L.charCodeAt(j)]=j;N[45]=62,N[95]=63},{}],31:[function(E,g,m){function R(){if(!(this instanceof R))return new R}(function(C){function O(j){for(var V in L)j[V]=L[V];return j}function P(j,V){return N(this,j).push(V),this}function T(j,V){function H(){S.call(z,j,H),V.apply(this,arguments)}var z=this;return H.originalListener=V,N(z,j).push(H),z}function S(j,V){function H(Z){return Z!==V&&Z.originalListener!==V}var z,Q=this;if(arguments.length){if(V){if(z=N(Q,j,!0)){if(z=z.filter(H),!z.length)return S.call(Q,j);Q[B][j]=z}}else if(z=Q[B],z&&(delete z[j],!Object.keys(z).length))return S.call(Q)}else delete Q[B];return Q}function I(j,V){function H(X){X.call(Z)}function z(X){X.call(Z,V)}function Q(X){X.apply(Z,ue)}var Z=this,ie=N(Z,j,!0);if(!ie)return!1;var oe=arguments.length;if(oe===1)ie.forEach(H);else if(oe===2)ie.forEach(z);else{var ue=Array.prototype.slice.call(arguments,1);ie.forEach(Q)}return!!ie.length}function N(j,V,H){if(!H||j[B]){var z=j[B]||(j[B]={});return z[V]||(z[V]=[])}}typeof g<"u"&&(g.exports=C);var B="listeners",L={on:P,once:T,off:S,emit:I};O(C.prototype),C.mixin=O})(R)},{}],32:[function(E,g,m){m.read=function(R,C,O,P,T){var S,I,N=8*T-P-1,B=(1<<N)-1,L=B>>1,j=-7,V=O?T-1:0,H=O?-1:1,z=R[C+V];for(V+=H,S=z&(1<<-j)-1,z>>=-j,j+=N;j>0;S=256*S+R[C+V],V+=H,j-=8);for(I=S&(1<<-j)-1,S>>=-j,j+=P;j>0;I=256*I+R[C+V],V+=H,j-=8);if(S===0)S=1-L;else{if(S===B)return I?NaN:(z?-1:1)*(1/0);I+=Math.pow(2,P),S-=L}return(z?-1:1)*I*Math.pow(2,S-P)},m.write=function(R,C,O,P,T,S){var I,N,B,L=8*S-T-1,j=(1<<L)-1,V=j>>1,H=T===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=P?0:S-1,Q=P?1:-1,Z=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(N=isNaN(C)?1:0,I=j):(I=Math.floor(Math.log(C)/Math.LN2),C*(B=Math.pow(2,-I))<1&&(I--,B*=2),C+=I+V>=1?H/B:H*Math.pow(2,1-V),C*B>=2&&(I++,B/=2),I+V>=j?(N=0,I=j):I+V>=1?(N=(C*B-1)*Math.pow(2,T),I+=V):(N=C*Math.pow(2,V-1)*Math.pow(2,T),I=0));T>=8;R[O+z]=255&N,z+=Q,N/=256,T-=8);for(I=I<<T|N,L+=T;L>0;R[O+z]=255&I,z+=Q,I/=256,L-=8);R[O+z-Q]|=128*Z}},{}],33:[function(E,g,m){(function(R){var C,O,P,T;(function(S){function I(Pe,be,te){function se(Re,we,Se,ke){return this instanceof se?de(this,Re,we,Se,ke):new se(Re,we,Se,ke)}function re(Re){return!(!Re||!Re[Ae])}function de(Re,we,Se,ke,We){if(le&&$&&(we instanceof $&&(we=new le(we)),ke instanceof $&&(ke=new le(ke))),!(we||Se||ke||ue))return void(Re.buffer=H(he,0));if(!j(we,Se)){var M=ue||Array;We=Se,ke=we,Se=0,we=new M(8)}Re.buffer=we,Re.offset=Se|=0,X!==typeof ke&&(typeof ke=="string"?ce(we,Se,ke,We||10):j(ke,We)?V(we,Se,ke,We):typeof We=="number"?(qe(we,Se+k,ke),qe(we,Se+U,We)):ke>0?ae(we,Se,ke):ke<0?ve(we,Se,ke):V(we,Se,he,0))}function ce(Re,we,Se,ke){var We=0,M=Se.length,x=0,D=0;Se[0]==="-"&&We++;for(var G=We;We<M;){var J=parseInt(Se[We++],ke);if(!(J>=0))break;D=D*ke+J,x=x*ke+Math.floor(D/Ie),D%=Ie}G&&(x=~x,D?D=Ie-D:x++),qe(Re,we+k,x),qe(Re,we+U,D)}function ye(){var Re=this.buffer,we=this.offset,Se=Be(Re,we+k),ke=Be(Re,we+U);return te||(Se|=0),Se?Se*Ie+ke:ke}function Me(Re){var we=this.buffer,Se=this.offset,ke=Be(we,Se+k),We=Be(we,Se+U),M="",x=!te&&2147483648&ke;for(x&&(ke=~ke,We=Ie-We),Re=Re||10;;){var D=ke%Re*Ie+We;if(ke=Math.floor(ke/Re),We=Math.floor(D/Re),M=(D%Re).toString(Re)+M,!ke&&!We)break}return x&&(M="-"+M),M}function qe(Re,we,Se){Re[we+K]=255&Se,Se>>=8,Re[we+W]=255&Se,Se>>=8,Re[we+q]=255&Se,Se>>=8,Re[we+F]=255&Se}function Be(Re,we){return Re[we+F]*Ce+(Re[we+q]<<16)+(Re[we+W]<<8)+Re[we+K]}var k=be?0:4,U=be?4:0,F=be?0:3,q=be?1:2,W=be?2:1,K=be?3:0,ae=be?z:Z,ve=be?Q:ie,Oe=se.prototype,xe="is"+Pe,Ae="_"+xe;return Oe.buffer=void 0,Oe.offset=0,Oe[Ae]=!0,Oe.toNumber=ye,Oe.toString=Me,Oe.toJSON=ye,Oe.toArray=N,ee&&(Oe.toBuffer=B),le&&(Oe.toArrayBuffer=L),se[xe]=re,S[Pe]=se,se}function N(Pe){var be=this.buffer,te=this.offset;return ue=null,Pe!==!1&&te===0&&be.length===8&&De(be)?be:H(be,te)}function B(Pe){var be=this.buffer,te=this.offset;if(ue=ee,Pe!==!1&&te===0&&be.length===8&&R.isBuffer(be))return be;var se=new ee(8);return V(se,0,be,te),se}function L(Pe){var be=this.buffer,te=this.offset,se=be.buffer;if(ue=le,Pe!==!1&&te===0&&se instanceof $&&se.byteLength===8)return se;var re=new le(8);return V(re,0,be,te),re.buffer}function j(Pe,be){var te=Pe&&Pe.length;return be|=0,te&&be+8<=te&&typeof Pe[be]!="string"}function V(Pe,be,te,se){be|=0,se|=0;for(var re=0;re<8;re++)Pe[be++]=255&te[se++]}function H(Pe,be){return Array.prototype.slice.call(Pe,be,be+8)}function z(Pe,be,te){for(var se=be+8;se>be;)Pe[--se]=255&te,te/=256}function Q(Pe,be,te){var se=be+8;for(te++;se>be;)Pe[--se]=255&-te^255,te/=256}function Z(Pe,be,te){for(var se=be+8;be<se;)Pe[be++]=255&te,te/=256}function ie(Pe,be,te){var se=be+8;for(te++;be<se;)Pe[be++]=255&-te^255,te/=256}function oe(Pe){return!!Pe&&Object.prototype.toString.call(Pe)=="[object Array]"}var ue,X="undefined",ee=X!==typeof R&&R,le=X!==typeof Uint8Array&&Uint8Array,$=X!==typeof ArrayBuffer&&ArrayBuffer,he=[0,0,0,0,0,0,0,0],De=Array.isArray||oe,Ie=4294967296,Ce=16777216;C=I("Uint64BE",!0,!0),O=I("Int64BE",!0,!1),P=I("Uint64LE",!1,!0),T=I("Int64LE",!1,!1)})(typeof m=="object"&&typeof m.nodeName!="string"?m:this||{})}).call(this,E("buffer").Buffer)},{buffer:29}],34:[function(E,g,m){var R={}.toString;g.exports=Array.isArray||function(C){return R.call(C)=="[object Array]"}},{}]},{},[1])(1)})});var xr=Ye((exports,module)=>{(function(){"use strict";function t(E){if(E)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var g=new ArrayBuffer(68);this.buffer8=new Uint8Array(g),this.blocks=new Uint32Array(g)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e=typeof window=="object",i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&typeof self=="object",h=!i.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&void 0;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&typeof module=="object"&&module.exports,o=typeof define=="function"&&define.amd,a=!i.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});var b=function(E){return function(g){return new t(!0).update(g)[E]()}},v=function(){var E=b("hex");h&&(E=w(E)),E.create=function(){return new t},E.update=function(R){return E.create().update(R)};for(var g=0;g<c.length;++g){var m=c[g];E[m]=b(m)}return E},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(E){if(typeof E=="string")return e.createHash("md5").update(E,"utf8").digest("hex");if(E==null)throw r;return E.constructor===ArrayBuffer&&(E=new Uint8Array(E)),Array.isArray(E)||ArrayBuffer.isView(E)||E.constructor===i?e.createHash("md5").update(new i(E)).digest("hex"):t(E)};return s};t.prototype.update=function(E){if(!this.finalized){var g,m=typeof E;if(m!=="string"){if(m!=="object"||E===null)throw r;if(a&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!(Array.isArray(E)||a&&ArrayBuffer.isView(E)))throw r;g=!0}for(var R,C,O=0,P=E.length,T=this.blocks,S=this.buffer8;O<P;){if(this.hashed&&(this.hashed=!1,T[0]=T[16],T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0),g)if(a)for(C=this.start;O<P&&C<64;++O)S[C++]=E[O];else for(C=this.start;O<P&&C<64;++O)T[C>>2]|=E[O]<<y[3&C++];else if(a)for(C=this.start;O<P&&C<64;++O)(R=E.charCodeAt(O))<128?S[C++]=R:R<2048?(S[C++]=192|R>>6,S[C++]=128|63&R):R<55296||R>=57344?(S[C++]=224|R>>12,S[C++]=128|R>>6&63,S[C++]=128|63&R):(R=65536+((1023&R)<<10|1023&E.charCodeAt(++O)),S[C++]=240|R>>18,S[C++]=128|R>>12&63,S[C++]=128|R>>6&63,S[C++]=128|63&R);else for(C=this.start;O<P&&C<64;++O)(R=E.charCodeAt(O))<128?T[C>>2]|=R<<y[3&C++]:R<2048?(T[C>>2]|=(192|R>>6)<<y[3&C++],T[C>>2]|=(128|63&R)<<y[3&C++]):R<55296||R>=57344?(T[C>>2]|=(224|R>>12)<<y[3&C++],T[C>>2]|=(128|R>>6&63)<<y[3&C++],T[C>>2]|=(128|63&R)<<y[3&C++]):(R=65536+((1023&R)<<10|1023&E.charCodeAt(++O)),T[C>>2]|=(240|R>>18)<<y[3&C++],T[C>>2]|=(128|R>>12&63)<<y[3&C++],T[C>>2]|=(128|R>>6&63)<<y[3&C++],T[C>>2]|=(128|63&R)<<y[3&C++]);this.lastByteIndex=C,this.bytes+=C-this.start,C>=64?(this.start=C-64,this.hash(),this.hashed=!0):this.start=C}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,g=this.lastByteIndex;E[g>>2]|=u[3&g],g>=56&&(this.hashed||this.hash(),E[0]=E[16],E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0),E[14]=this.bytes<<3,E[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var E,g,m,R,C,O,P=this.blocks;this.first?g=((g=((E=((E=P[0]-680876937)<<7|E>>>25)-271733879<<0)^(m=((m=(-271733879^(R=((R=(-1732584194^2004318071&E)+P[1]-117830708)<<12|R>>>20)+E<<0)&(-271733879^E))+P[2]-1126478375)<<17|m>>>15)+R<<0)&(R^E))+P[3]-1316259209)<<22|g>>>10)+m<<0:(E=this.h0,g=this.h1,m=this.h2,g=((g+=((E=((E+=((R=this.h3)^g&(m^R))+P[0]-680876936)<<7|E>>>25)+g<<0)^(m=((m+=(g^(R=((R+=(m^E&(g^m))+P[1]-389564586)<<12|R>>>20)+E<<0)&(E^g))+P[2]+606105819)<<17|m>>>15)+R<<0)&(R^E))+P[3]-1044525330)<<22|g>>>10)+m<<0),g=((g+=((E=((E+=(R^g&(m^R))+P[4]-176418897)<<7|E>>>25)+g<<0)^(m=((m+=(g^(R=((R+=(m^E&(g^m))+P[5]+1200080426)<<12|R>>>20)+E<<0)&(E^g))+P[6]-1473231341)<<17|m>>>15)+R<<0)&(R^E))+P[7]-45705983)<<22|g>>>10)+m<<0,g=((g+=((E=((E+=(R^g&(m^R))+P[8]+1770035416)<<7|E>>>25)+g<<0)^(m=((m+=(g^(R=((R+=(m^E&(g^m))+P[9]-1958414417)<<12|R>>>20)+E<<0)&(E^g))+P[10]-42063)<<17|m>>>15)+R<<0)&(R^E))+P[11]-1990404162)<<22|g>>>10)+m<<0,g=((g+=((E=((E+=(R^g&(m^R))+P[12]+1804603682)<<7|E>>>25)+g<<0)^(m=((m+=(g^(R=((R+=(m^E&(g^m))+P[13]-40341101)<<12|R>>>20)+E<<0)&(E^g))+P[14]-1502002290)<<17|m>>>15)+R<<0)&(R^E))+P[15]+1236535329)<<22|g>>>10)+m<<0,g=((g+=((R=((R+=(g^m&((E=((E+=(m^R&(g^m))+P[1]-165796510)<<5|E>>>27)+g<<0)^g))+P[6]-1069501632)<<9|R>>>23)+E<<0)^E&((m=((m+=(E^g&(R^E))+P[11]+643717713)<<14|m>>>18)+R<<0)^R))+P[0]-373897302)<<20|g>>>12)+m<<0,g=((g+=((R=((R+=(g^m&((E=((E+=(m^R&(g^m))+P[5]-701558691)<<5|E>>>27)+g<<0)^g))+P[10]+38016083)<<9|R>>>23)+E<<0)^E&((m=((m+=(E^g&(R^E))+P[15]-660478335)<<14|m>>>18)+R<<0)^R))+P[4]-405537848)<<20|g>>>12)+m<<0,g=((g+=((R=((R+=(g^m&((E=((E+=(m^R&(g^m))+P[9]+568446438)<<5|E>>>27)+g<<0)^g))+P[14]-1019803690)<<9|R>>>23)+E<<0)^E&((m=((m+=(E^g&(R^E))+P[3]-187363961)<<14|m>>>18)+R<<0)^R))+P[8]+1163531501)<<20|g>>>12)+m<<0,g=((g+=((R=((R+=(g^m&((E=((E+=(m^R&(g^m))+P[13]-1444681467)<<5|E>>>27)+g<<0)^g))+P[2]-51403784)<<9|R>>>23)+E<<0)^E&((m=((m+=(E^g&(R^E))+P[7]+1735328473)<<14|m>>>18)+R<<0)^R))+P[12]-1926607734)<<20|g>>>12)+m<<0,g=((g+=((O=(R=((R+=((C=g^m)^(E=((E+=(C^R)+P[5]-378558)<<4|E>>>28)+g<<0))+P[8]-2022574463)<<11|R>>>21)+E<<0)^E)^(m=((m+=(O^g)+P[11]+1839030562)<<16|m>>>16)+R<<0))+P[14]-35309556)<<23|g>>>9)+m<<0,g=((g+=((O=(R=((R+=((C=g^m)^(E=((E+=(C^R)+P[1]-1530992060)<<4|E>>>28)+g<<0))+P[4]+1272893353)<<11|R>>>21)+E<<0)^E)^(m=((m+=(O^g)+P[7]-155497632)<<16|m>>>16)+R<<0))+P[10]-1094730640)<<23|g>>>9)+m<<0,g=((g+=((O=(R=((R+=((C=g^m)^(E=((E+=(C^R)+P[13]+681279174)<<4|E>>>28)+g<<0))+P[0]-358537222)<<11|R>>>21)+E<<0)^E)^(m=((m+=(O^g)+P[3]-722521979)<<16|m>>>16)+R<<0))+P[6]+76029189)<<23|g>>>9)+m<<0,g=((g+=((O=(R=((R+=((C=g^m)^(E=((E+=(C^R)+P[9]-640364487)<<4|E>>>28)+g<<0))+P[12]-421815835)<<11|R>>>21)+E<<0)^E)^(m=((m+=(O^g)+P[15]+530742520)<<16|m>>>16)+R<<0))+P[2]-995338651)<<23|g>>>9)+m<<0,g=((g+=((R=((R+=(g^((E=((E+=(m^(g|~R))+P[0]-198630844)<<6|E>>>26)+g<<0)|~m))+P[7]+1126891415)<<10|R>>>22)+E<<0)^((m=((m+=(E^(R|~g))+P[14]-1416354905)<<15|m>>>17)+R<<0)|~E))+P[5]-57434055)<<21|g>>>11)+m<<0,g=((g+=((R=((R+=(g^((E=((E+=(m^(g|~R))+P[12]+1700485571)<<6|E>>>26)+g<<0)|~m))+P[3]-1894986606)<<10|R>>>22)+E<<0)^((m=((m+=(E^(R|~g))+P[10]-1051523)<<15|m>>>17)+R<<0)|~E))+P[1]-2054922799)<<21|g>>>11)+m<<0,g=((g+=((R=((R+=(g^((E=((E+=(m^(g|~R))+P[8]+1873313359)<<6|E>>>26)+g<<0)|~m))+P[15]-30611744)<<10|R>>>22)+E<<0)^((m=((m+=(E^(R|~g))+P[6]-1560198380)<<15|m>>>17)+R<<0)|~E))+P[13]+1309151649)<<21|g>>>11)+m<<0,g=((g+=((R=((R+=(g^((E=((E+=(m^(g|~R))+P[4]-145523070)<<6|E>>>26)+g<<0)|~m))+P[11]-1120210379)<<10|R>>>22)+E<<0)^((m=((m+=(E^(R|~g))+P[2]+718787259)<<15|m>>>17)+R<<0)|~E))+P[9]-343485551)<<21|g>>>11)+m<<0,this.first?(this.h0=E+1732584193<<0,this.h1=g-271733879<<0,this.h2=m-1732584194<<0,this.h3=R+271733878<<0,this.first=!1):(this.h0=this.h0+E<<0,this.h1=this.h1+g<<0,this.h2=this.h2+m<<0,this.h3=this.h3+R<<0)},t.prototype.hex=function(){this.finalize();var E=this.h0,g=this.h1,m=this.h2,R=this.h3;return n[E>>4&15]+n[15&E]+n[E>>12&15]+n[E>>8&15]+n[E>>20&15]+n[E>>16&15]+n[E>>28&15]+n[E>>24&15]+n[g>>4&15]+n[15&g]+n[g>>12&15]+n[g>>8&15]+n[g>>20&15]+n[g>>16&15]+n[g>>28&15]+n[g>>24&15]+n[m>>4&15]+n[15&m]+n[m>>12&15]+n[m>>8&15]+n[m>>20&15]+n[m>>16&15]+n[m>>28&15]+n[m>>24&15]+n[R>>4&15]+n[15&R]+n[R>>12&15]+n[R>>8&15]+n[R>>20&15]+n[R>>16&15]+n[R>>28&15]+n[R>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var E=this.h0,g=this.h1,m=this.h2,R=this.h3;return[255&E,E>>8&255,E>>16&255,E>>24&255,255&g,g>>8&255,g>>16&255,g>>24&255,255&m,m>>8&255,m>>16&255,m>>24&255,255&R,R>>8&255,R>>16&255,R>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var E=new ArrayBuffer(16),g=new Uint32Array(E);return g[0]=this.h0,g[1]=this.h1,g[2]=this.h2,g[3]=this.h3,E},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var E,g,m,R="",C=this.array(),O=0;O<15;)E=C[O++],g=C[O++],m=C[O++],R+=p[E>>>2]+p[63&(E<<4|g>>>4)]+p[63&(g<<2|m>>>6)]+p[63&m];return E=C[O],R+=p[E>>>2]+p[E<<4&63]+"=="};var _=v();f?module.exports=_:(i.md5=_,o&&define(function(){return _}))})()});var Ur=Ye(Lt=>{var ls,hs,ds,ps;(function(E){function g(Q,Z,ie){function oe(de,ce,ye,Me){return this instanceof oe?(function(qe,Be,k,U,F){if(B&&L&&(Be instanceof L&&(Be=new B(Be)),U instanceof L&&(U=new B(U))),!(Be||k||U||S))return void(qe.buffer=T(j,0));if(!O(Be,k)){var q=S||Array;F=k,U=Be,k=0,Be=new q(8)}qe.buffer=Be,qe.offset=k|=0,I!==typeof U&&(typeof U=="string"?(function(W,K,ae,ve){var Oe=0,xe=ae.length,Ae=0,Re=0;ae[0]==="-"&&Oe++;for(var we=Oe;Oe<xe;){var Se=parseInt(ae[Oe++],ve);if(!(Se>=0))break;Re=Re*ve+Se,Ae=Ae*ve+Math.floor(Re/H),Re%=H}we&&(Ae=~Ae,Re?Re=H-Re:Ae++),X(W,K+le,Ae),X(W,K+$,Re)})(Be,k,U,F||10):O(U,F)?P(Be,k,U,F):typeof F=="number"?(X(Be,k+le,U),X(Be,k+$,F)):U>0?Pe(Be,k,U):U<0?be(Be,k,U):P(Be,k,j,0))})(this,de,ce,ye,Me):new oe(de,ce,ye,Me)}function ue(){var de=this.buffer,ce=this.offset,ye=ee(de,ce+le),Me=ee(de,ce+$);return ie||(ye|=0),ye?ye*H+Me:Me}function X(de,ce,ye){de[ce+Ce]=255&ye,ye>>=8,de[ce+Ie]=255&ye,ye>>=8,de[ce+De]=255&ye,ye>>=8,de[ce+he]=255&ye}function ee(de,ce){return de[ce+he]*z+(de[ce+De]<<16)+(de[ce+Ie]<<8)+de[ce+Ce]}var le=Z?0:4,$=Z?4:0,he=Z?0:3,De=Z?1:2,Ie=Z?2:1,Ce=Z?3:0,Pe=Z?function(de,ce,ye){for(var Me=ce+8;Me>ce;)de[--Me]=255&ye,ye/=256}:function(de,ce,ye){for(var Me=ce+8;ce<Me;)de[ce++]=255&ye,ye/=256},be=Z?function(de,ce,ye){var Me=ce+8;for(ye++;Me>ce;)de[--Me]=255&-ye^255,ye/=256}:function(de,ce,ye){var Me=ce+8;for(ye++;ce<Me;)de[ce++]=255&-ye^255,ye/=256},te=oe.prototype,se="is"+Q,re="_"+se;return te.buffer=void 0,te.offset=0,te[re]=!0,te.toNumber=ue,te.toString=function(de){var ce=this.buffer,ye=this.offset,Me=ee(ce,ye+le),qe=ee(ce,ye+$),Be="",k=!ie&&2147483648&Me;for(k&&(Me=~Me,qe=H-qe),de=de||10;;){var U=Me%de*H+qe;if(Me=Math.floor(Me/de),qe=Math.floor(U/de),Be=(U%de).toString(de)+Be,!Me&&!qe)break}return k&&(Be="-"+Be),Be},te.toJSON=ue,te.toArray=m,N&&(te.toBuffer=R),B&&(te.toArrayBuffer=C),oe[se]=function(de){return!(!de||!de[re])},E[Q]=oe,oe}function m(Q){var Z=this.buffer,ie=this.offset;return S=null,Q!==!1&&ie===0&&Z.length===8&&V(Z)?Z:T(Z,ie)}function R(Q){var Z=this.buffer,ie=this.offset;if(S=N,Q!==!1&&ie===0&&Z.length===8&&Buffer.isBuffer(Z))return Z;var oe=new N(8);return P(oe,0,Z,ie),oe}function C(Q){var Z=this.buffer,ie=this.offset,oe=Z.buffer;if(S=B,Q!==!1&&ie===0&&oe instanceof L&&oe.byteLength===8)return oe;var ue=new B(8);return P(ue,0,Z,ie),ue.buffer}function O(Q,Z){var ie=Q&&Q.length;return Z|=0,ie&&Z+8<=ie&&typeof Q[Z]!="string"}function P(Q,Z,ie,oe){Z|=0,oe|=0;for(var ue=0;ue<8;ue++)Q[Z++]=255&ie[oe++]}function T(Q,Z){return Array.prototype.slice.call(Q,Z,Z+8)}var S,I="undefined",N=I!==typeof Buffer&&Buffer,B=I!==typeof Uint8Array&&Uint8Array,L=I!==typeof ArrayBuffer&&ArrayBuffer,j=[0,0,0,0,0,0,0,0],V=Array.isArray||function(Q){return!!Q&&Object.prototype.toString.call(Q)=="[object Array]"},H=4294967296,z=16777216;ls=g("Uint64BE",!0,!0),hs=g("Int64BE",!0,!1),ds=g("Uint64LE",!1,!0),ps=g("Int64LE",!1,!1)})(typeof Lt=="object"&&typeof Lt.nodeName!="string"?Lt:Lt||{})});var St=Ye((gu,Br)=>{"use strict";var dt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};function gs(){if(dt.fpnn)return dt.fpnn;let E=typeof self<"u"&&typeof self.importScripts=="function"&&typeof self.WebSocket=="function";return typeof window>"u"&&!E?_s():Mr()}function _s(){let E={FPNN_EC_OK:0,FPNN_EC_CORE_UNKNOWN_ERROR:20001,FPNN_EC_CORE_CONNECTION_CLOSED:20002,FPNN_EC_CORE_INVALID_CONNECTION:20012};class g extends Error{constructor(C,O){let P=O instanceof Error?O:new Error(String(O||"FPNN error"));super(P.message),this.code=C,this.name="FPError",this.stack=P.stack||this.stack,this.error=P}toString(){return"code: "+this.code+" ex: "+this.message}}class m{constructor(){throw new Error('protocol: "fpnn" requires the browser FPNN runtime; use protocol: "tlv-v1" with WebSocket or webSocketFactory')}}return{FPClient:m,FPConfig:{ERROR_CODE:E},FPError:g,FPEvent:{assign:function(R){if(!R||Object.prototype.hasOwnProperty.call(R,"events"))throw new Error(R+" is null or hasOwnProperty [ events ]");if(Object.prototype.hasOwnProperty.call(R,"on")||Object.prototype.hasOwnProperty.call(R,"emit")||Object.prototype.hasOwnProperty.call(R,"removeEvent"))throw new Error(R+" hasOwnProperty [ on | emit | removeEvent | listenerCount]");R.events={},R.on=function(C,O){Object.prototype.hasOwnProperty.call(R.events,C)||(R.events[C]=[]),R.events[C].indexOf(O)===-1&&R.events[C].push(O)},R.emit=function(C){let O=Array.prototype.slice.call(arguments,1);(R.events[C]||[]).slice().forEach(function(P){P&&P.apply(R,O)})},R.removeEvent=function(C,O){if(arguments.length===0)R.events={};else if(arguments.length===1)Object.prototype.hasOwnProperty.call(R.events,C)&&delete R.events[C];else if(R.events[C]){let P=R.events[C].indexOf(O);P!==-1&&R.events[C].splice(P,1)}},R.listenerCount=function(C){return Object.prototype.hasOwnProperty.call(R.events,C)?R.events[C].length:0}}}}}function ms(){return dt.msgpack||Ir()}function ys(){return dt.md5||xr()}function Es(){return dt.Int64BE&&dt.Uint64BE?{Int64BE:dt.Int64BE,Uint64BE:dt.Uint64BE}:Ur()}var bs=gs(),ws=ms(),vs=ys(),Nr=Es();Br.exports={fpnn:bs,msgpack:ws,md5:vs,Int64BE:Nr.Int64BE,Uint64BE:Nr.Uint64BE}});var lt=Ye((_u,Fr)=>{"use strict";var{msgpack:Rs,Int64BE:Cs,Uint64BE:Ps}=St(),Os="2.7.3",Ts="2.7.6",As={RTM_EC_UNKNOWN_METHOD:20004,RTM_EC_INVALID_PROJECT_ID_OR_USER_ID:200001,RTM_EC_INVALID_PROJECT_ID_OR_SIGN:200002,RTM_EC_INVALID_FILE_OR_SIGN_OR_TOKEN:200003,RTM_EC_ATTRS_WITHOUT_SIGN_OR_EXT:200004,RTM_EC_API_FREQUENCY_LIMITED:200010,RTM_EC_MESSAGE_FREQUENCY_LIMITED:200011,RTM_EC_FORBIDDEN_METHOD:200020,RTM_EC_PERMISSION_DENIED:200021,RTM_EC_UNAUTHORIZED:200022,RTM_EC_DUPLCATED_AUTH:200023,RTM_EC_AUTH_DENIED:200024,RTM_EC_ADMIN_LOGIN:200025,RTM_EC_ADMIN_ONLY:200026,RTM_EC_INVALID_AUTH_TOEKN:200027,RTM_EC_LARGE_MESSAGE_OR_ATTRS:200030,RTM_EC_LARGE_FILE_OR_ATTRS:200031,RTM_EC_TOO_MANY_ITEMS_IN_PARAMETERS:200032,RTM_EC_EMPTY_PARAMETER:200033,RTM_EC_INVALID_PARAMETER:200034,RTM_EC_NOT_IN_ROOM:200040,RTM_EC_NOT_GROUP_MEMBER:200041,RTM_EC_MAX_GROUP_MEMBER_COUNT:200042,RTM_EC_NOT_FRIEND:200043,RTM_EC_BANNED_IN_GROUP:200044,RTM_EC_BANNED_IN_ROOM:200045,RTM_EC_EMPTY_GROUP:200046,RTM_EC_ENTER_TOO_MANY_ROOMS:200047,RTM_EC_UNSUPPORTED_LANGUAGE:200050,RTM_EC_EMPTY_TRANSLATION:200051,RTM_EC_SEND_TO_SELF:200052,RTM_EC_DUPLCATED_MID:200053,RTM_EC_SENSITIVE_WORDS:200054,RTM_EC_UNKNOWN_ERROR:200999},Ss={image:40,audio:41,video:42,file:50},Ms={text:30,audio:31,cmd:32},ks=60,Is={kickOut:"kickout",kickOutRoom:"kickoutroom",recvMessage:"pushmsg",recvGroupMessage:"pushgroupmsg",recvRoomMessage:"pushroommsg",recvBroadcastMessage:"pushbroadcastmsg",recvFile:"pushfile",recvGroupFile:"pushgroupfile",recvRoomFile:"pushroomfile",recvBroadcastFile:"pushbroadcastfile",recvPing:"ping",recvChat:"pushchat",recvAudio:"pushaudio",recvCmd:"pushcmd",recvGroupChat:"pushgroupchat",recvGroupAudio:"pushgroupaudio",recvGroupCmd:"pushgroupcmd",recvRoomChat:"pushroomchat",recvRoomAudio:"pushroomaudio",recvRoomCmd:"pushroomcmd",recvBroadcastChat:"pushbroadcastchat",recvBroadcastAudio:"pushbroadcastaudio",recvBroadcastCmd:"pushbroadcastcmd"},xs={kickOut:"event.kicked",kickOutRoom:"event.room_removed",recvBroadcastMessage:"event.broadcast",recvGroupMessage:"event.group",recvMessage:"event.direct",recvRoomMessage:"event.room"},jt=class{static get ERROR_CODE(){return As}static get MsgPack(){return Rs}static get FILE_TYPE(){return Ss}static get CHAT_TYPE(){return Ms}static get SERVER_PUSH(){return Is}static get TLV_SERVER_PUSH(){return xs}static get MID_TTL(){return 5*1e3}static get API_VERSION(){return Os}static get SDK_VERSION(){return Ts}static get MAX_PING_SECONDS(){return ks}};jt.Int64=function(E){return new Cs(""+E)};jt.Uint64=function(E){return new Ps(""+E)};Fr.exports=jt});var Nn=Ye((yu,Dr)=>{"use strict";var{fpnn:Us}=St(),pe=lt(),mu=qt(),Un=class{constructor(g){Us.FPEvent.assign(this),this._map={},this._client=g,this.uid=0,this._expireTimerID=0,this._msgOptions={codec:pe.MsgPack.createCodec({int64:!0})},this._binaryOptions={codec:pe.MsgPack.createCodec({int64:!0,useraw:!0})},this._binaryMessageMethodList=[pe.SERVER_PUSH.recvMessage,pe.SERVER_PUSH.recvGroupMessage,pe.SERVER_PUSH.recvRoomMessage,pe.SERVER_PUSH.recvBroadcastMessage,pe.SERVER_PUSH.recvFile,pe.SERVER_PUSH.recvGroupFile,pe.SERVER_PUSH.recvRoomFile,pe.SERVER_PUSH.recvBroadcastFile],Bs.call(this)}service(g,m){if(g&&Object.prototype.hasOwnProperty.call(g,"_tlvPayload")&&Ns(g.method)){this._serviceTLVPush(g);return}let R=!0;pe.SERVER_PUSH.kickOut==g.method&&(R=!1),pe.SERVER_PUSH.kickOutRoom==g.method&&(R=!1),R&&m&&(g.flag==0&&m(JSON.stringify({}),!1),g.flag==1&&m(pe.MsgPack.encode({},this._msgOptions),!1));let C=null;if(g&&Object.prototype.hasOwnProperty.call(g,"_tlvPayload")&&(C=g._tlvPayload,g._tlvBinaryPayload&&(C.binary=C.msg)),!C&&g.flag==0&&(C=JSON.parse(g.payload)),!C&&g.flag==1)if(this._binaryMessageMethodList.indexOf(g.method)!==-1)if(C=pe.MsgPack.decode(g.payload,this._binaryOptions),C.mtype==pe.CHAT_TYPE.text)C=pe.MsgPack.decode(g.payload,this._msgOptions);else{C.binary=C.msg;try{C.msg=new TextDecoder("utf-8",{fatal:!0}).decode(C.msg)}catch{C.msg=void 0}try{C.attrs=new TextDecoder("utf-8",{fatal:!0}).decode(C.attrs)}catch{}}else C=pe.MsgPack.decode(g.payload,this._msgOptions);if(C){if(C.attrs!==void 0)try{let O=JSON.parse(C.attrs);if(O&&O.excludedUids!==void 0&&Array.isArray(O.excludedUids)&&O.excludedUids.includes(this.uid.toString()))return}catch{}typeof this[g.method]=="function"&&this[g.method].call(this,C)}}_serviceTLVPush(g){let m=g._tlvPayload;if(m&&m.extra!==void 0)try{let R=JSON.parse(m.extra);if(R&&R.excludedUids!==void 0&&Array.isArray(R.excludedUids)&&R.excludedUids.includes(this.uid.toString()))return}catch{}this.emit(g.method,m)}destroy(){this._map={},this._expireTimerID&&(clearInterval(this._expireTimerID),this._expireTimerID=0)}kickout(g){this.emit(pe.SERVER_PUSH.kickOut,g)}kickoutroom(g){g.rid&&(g.rid=new pe.Int64(g.rid)),this.emit(pe.SERVER_PUSH.kickOutRoom,g)}pushmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Xt.call(this,1,g.mid,g.from)))){if(g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvMessage,g)}}pushgroupmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Xt.call(this,2,g.mid,g.from,g.gid)))){if(g.gid&&(g.gid=new pe.Int64(g.gid)),g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvGroupFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvGroupChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvGroupFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvGroupCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvGroupMessage,g)}}pushroommsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Xt.call(this,3,g.mid,g.from,g.rid)))){if(g.rid&&(g.rid=new pe.Int64(g.rid)),g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvRoomFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvRoomChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvRoomFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvRoomCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvRoomMessage,g)}}pushbroadcastmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Xt.call(this,4,g.mid,g.from)))){if(g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvBroadcastFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvBroadcastChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvBroadcastFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvBroadcastCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvBroadcastMessage,g)}}ping(g){this._client._lastPingTime=parseInt(Date.now()/1e3),this.emit(pe.SERVER_PUSH.recvPing,g)}};function Xt(E,g,m,R){let C=[];C.push(E),C.push(g),C.push(m),R!=null&&C.push(R);let O=C.join("_");if(this._map.hasOwnProperty(O)){if(this._map[O]>Date.now())return!1;delete this._map[O]}return this._map[O]=pe.MID_TTL+Date.now(),!0}function Ns(E){let g=pe.TLV_SERVER_PUSH;return E===g.recvMessage||E===g.recvGroupMessage||E===g.recvRoomMessage||E===g.recvBroadcastMessage||E===g.kickOut||E===g.kickOutRoom}function Bs(){let E=this;this._expireTimerID=setInterval(function(){for(let g in E._map)E._map[g]>Date.now()||Fs.call(E,g)},pe.MID_TTL+1e3)}function Fs(E){let g=this;setTimeout(function(){delete g._map[E]},0)}Dr.exports=Un});var nn=Ye((Eu,Wr)=>{"use strict";var Ne=class extends Error{constructor(g){super(g),this.name="TLVMsgPackError"}},pt=class{constructor(g,m,R){this.high=g>>>0,this.low=m>>>0,this.signed=!!R}isNegative(){return this.signed&&(this.high&2147483648)!==0}toString(){if(!this.isNegative())return Lr(this.high,this.low);let g=$t(this.high,this.low);return"-"+Lr(g.high,g.low)}valueOf(){return Number(this.toString())}};function $t(E,g){let m=~g+1>>>0,R=~E>>>0;return m===0&&(R=R+1>>>0),{high:R,low:m}}function Lr(E,g){let m=[E>>>0];jr(m,65536),jr(m,65536),Ds(m,g>>>0);let R=String(m[m.length-1]);for(let C=m.length-2;C>=0;C-=1)R+=String(m[C]).padStart(7,"0");return R}function jr(E,g){let m=0;for(let R=0;R<E.length;R+=1){let C=E[R]*g+m;E[R]=C%1e7,m=Math.floor(C/1e7)}for(;m>0;)E.push(m%1e7),m=Math.floor(m/1e7)}function Ds(E,g){let m=g,R=0;for(;m>0;){R===E.length&&E.push(0);let C=E[R]+m;E[R]=C%1e7,m=Math.floor(C/1e7),R+=1}}function Ls(E){if(!/^[0-9]+$/.test(E))throw new Ne("invalid integer text");let g=0,m=0;for(let R=0;R<E.length;R+=1){let C=E.charCodeAt(R)-48,O=m*10+C;m=O%4294967296;let P=Math.floor(O/4294967296),T=g*10+P;if(T>=4294967296)throw new Ne("integer exceeds uint64");g=T}return{high:g>>>0,low:m>>>0}}function qr(E){return Number.isSafeInteger?Number.isSafeInteger(E):typeof E=="number"&&isFinite(E)&&Math.floor(E)===E&&Math.abs(E)<=9007199254740991}function Zt(E){if(!E||typeof E!="object"||Array.isArray(E))return!1;let g=Object.getPrototypeOf(E);return g===Object.prototype||g===null}function Ln(E){if(E instanceof Uint8Array)return E;if(typeof ArrayBuffer<"u"&&E instanceof ArrayBuffer)return new Uint8Array(E);if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView&&ArrayBuffer.isView(E))return new Uint8Array(E.buffer,E.byteOffset,E.byteLength);if(typeof ArrayBuffer<"u"&&E&&Object.prototype.toString.call(E)==="[object ArrayBuffer]")try{return new Uint8Array(ArrayBuffer.prototype.slice.call(E,0))}catch{}return null}function en(E){let g=Ln(E);if(!g)throw new Ne("expected binary data");return g}function js(E){if(!E||typeof E!="object"||E instanceof pt||typeof E.offset!="number"||typeof E.toString!="function"||!E.buffer)return!1;let g=E.buffer,m=typeof g.length=="number"?g.length:g.byteLength;return typeof m=="number"&&E.offset>=0&&E.offset+8<=m}function qs(E){let g=E.buffer,m=E.offset,R=function(C){return g[m+C]&255};return{high:R(0)*16777216+R(1)*65536+R(2)*256+R(3)>>>0,low:R(4)*16777216+R(5)*65536+R(6)*256+R(7)>>>0,signed:String(E).charAt(0)==="-"}}function Vs(E){for(let g=0;g<E.length;g+=1){let m=E.charCodeAt(g);if(m>=55296&&m<=56319){let R=E.charCodeAt(g+1);if(R<56320||R>57343)throw new Ne("string contains an unpaired surrogate");g+=1}else if(m>=56320&&m<=57343)throw new Ne("string contains an unpaired surrogate")}}function Vr(E){if(typeof E!="string")throw new Ne("expected UTF-8 string");if(Vs(E),typeof TextEncoder<"u")return new TextEncoder().encode(E);let g=[];for(let m=0;m<E.length;m+=1){let R=E.charCodeAt(m);if(R>=55296&&R<=56319){let C=E.charCodeAt(m+1);R=65536+(R-55296<<10)+(C-56320),m+=1}R<=127?g.push(R):R<=2047?g.push(192|R>>6,128|R&63):R<=65535?g.push(224|R>>12,128|R>>6&63,128|R&63):g.push(240|R>>18,128|R>>12&63,128|R>>6&63,128|R&63)}return new Uint8Array(g)}function Hr(E){let g=en(E);if(typeof TextDecoder<"u")try{return new TextDecoder("utf-8",{fatal:!0}).decode(g)}catch{throw new Ne("invalid UTF-8 string")}let m="";for(let R=0;R<g.length;R+=1){let C=g[R],O;if(C<=127)O=C;else if(C>=194&&C<=223){let P=Mt(g,R+1);O=(C&31)<<6|P&63,R+=1}else if(C>=224&&C<=239){let P=Mt(g,R+1),T=Mt(g,R+2);if(C===224&&P<160||C===237&&P>159)throw new Ne("invalid UTF-8 string");O=(C&15)<<12|(P&63)<<6|T&63,R+=2}else if(C>=240&&C<=244){let P=Mt(g,R+1),T=Mt(g,R+2),S=Mt(g,R+3);if(C===240&&P<144||C===244&&P>143)throw new Ne("invalid UTF-8 string");O=(C&7)<<18|(P&63)<<12|(T&63)<<6|S&63,R+=3}else throw new Ne("invalid UTF-8 string");if(O<=65535)m+=String.fromCharCode(O);else{let P=O-65536;m+=String.fromCharCode(55296|P>>10,56320|P&1023)}}return m}function Mt(E,g){if(g>=E.length||(E[g]&192)!==128)throw new Ne("invalid UTF-8 string");return E[g]}var Bn=class{constructor(){this.chunks=[],this.length=0}byte(g){this.chunks.push(new Uint8Array([g&255])),this.length+=1}bytes(g){let m=en(g);this.chunks.push(m),this.length+=m.length}uint16(g){this.byte(g>>>8),this.byte(g)}uint32(g){let m=g>>>0;this.byte(m>>>24),this.byte(m>>>16),this.byte(m>>>8),this.byte(m)}uint64(g,m){this.uint32(g),this.uint32(m)}finish(){let g=new Uint8Array(this.length),m=0;return this.chunks.forEach(function(R){g.set(R,m),m+=R.length}),g}};function Hs(E){if(!Zt(E))throw new Ne("TLV payload must be a map");let g=new Bn;return jn(E,g,0),g.finish()}function jn(E,g,m){if(m>128)throw new Ne("MessagePack nesting is too deep");if(E==null)throw new Ne("nil and undefined are not allowed in TLV payloads");let R=typeof E;if(R==="boolean"){g.byte(E?195:194);return}if(R==="string"){Gr(E,g);return}if(R==="number"){zs(E,g);return}if(R==="bigint"){Js(E.toString(),g);return}if(R!=="object")throw new Ne("unsupported MessagePack value type: "+R);if(E instanceof pt){Qs(E,g);return}let C=Ln(E);if(C){Gs(C,g);return}if(js(E)){Xs(E,g);return}if(Array.isArray(E)){Ws(E,g,m+1);return}if(Zt(E)){Ys(E,g,m+1);return}throw new Ne("unsupported MessagePack object")}function Gr(E,g){let m=Vr(E);m.length<=31?g.byte(160|m.length):m.length<=255?(g.byte(217),g.byte(m.length)):m.length<=65535?(g.byte(218),g.uint16(m.length)):(g.byte(219),g.uint32(m.length)),g.bytes(m)}function Gs(E,g){E.length<=255?(g.byte(196),g.byte(E.length)):E.length<=65535?(g.byte(197),g.uint16(E.length)):(g.byte(198),g.uint32(E.length)),g.bytes(E)}function Ws(E,g,m){E.length<=15?g.byte(144|E.length):E.length<=65535?(g.byte(220),g.uint16(E.length)):(g.byte(221),g.uint32(E.length)),E.forEach(function(R){jn(R,g,m)})}function Ys(E,g,m){let R=Object.keys(E);R.length<=15?g.byte(128|R.length):R.length<=65535?(g.byte(222),g.uint16(R.length)):(g.byte(223),g.uint32(R.length)),R.forEach(function(C){Gr(C,g),jn(E[C],g,m)})}function zs(E,g){if(!isFinite(E))throw new Ne("non-finite numbers are not allowed");if(!qr(E))throw new Ne("floating-point and unsafe integer numbers are not allowed");tn(E,g)}function tn(E,g){if(E>=0){if(E<=127)g.byte(E);else if(E<=255)g.byte(204),g.byte(E);else if(E<=65535)g.byte(205),g.uint16(E);else if(E<=4294967295)g.byte(206),g.uint32(E);else{let m=Fn(E);g.byte(207),g.uint64(m.high,m.low)}return}if(E>=-32)g.byte(256+E);else if(E>=-128)g.byte(208),g.byte(E);else if(E>=-32768)g.byte(209),g.uint16(E);else if(E>=-2147483648)g.byte(210),g.uint32(E);else{let m=Ks(E);g.byte(211),g.uint64(m.high,m.low)}}function Fn(E){let g=Math.floor(E/4294967296),m=E-g*4294967296;return{high:g>>>0,low:m>>>0}}function Ks(E){if(E>=0)return Fn(E);let g=Fn(-E);return $t(g.high,g.low)}function Js(E,g){let m=E.charAt(0)==="-",R=m?E.slice(1):E,C=Ls(R);if(m){if(C.high>2147483648||C.high===2147483648&&C.low!==0)throw new Ne("integer is below int64 minimum");let O=$t(C.high,C.low);g.byte(211),g.uint64(O.high,O.low);return}if(qn(C),C.high===0){tn(C.low,g);return}g.byte(207),g.uint64(C.high,C.low)}function Qs(E,g){if(E.isNegative()){g.byte(211),g.uint64(E.high,E.low);return}if(qn(E),E.high===0){tn(E.low,g);return}g.byte(207),g.uint64(E.high,E.low)}function Xs(E,g){let m=qs(E);if(m.signed){g.byte(211),g.uint64(m.high,m.low);return}if(qn(m),m.high===0){tn(m.low,g);return}g.byte(207),g.uint64(m.high,m.low)}function qn(E){if(E.high>=2147483648)throw new Ne("unsigned integer exceeds the supported int64 range")}var Dn=class{constructor(g,m){this.bytes=en(g),this.offset=0,this.allowIntegerMapKeyAtPath=m&&Array.isArray(m.allowIntegerMapKeyAtPath)?m.allowIntegerMapKeyAtPath.slice():null}ensure(g){if(g<0||this.offset+g>this.bytes.length)throw new Ne("truncated MessagePack value")}byte(){this.ensure(1);let g=this.bytes[this.offset];return this.offset+=1,g}uint16(){this.ensure(2);let g=this.bytes[this.offset]*256+this.bytes[this.offset+1];return this.offset+=2,g}uint32(){this.ensure(4);let g=this.bytes[this.offset]*16777216+this.bytes[this.offset+1]*65536+this.bytes[this.offset+2]*256+this.bytes[this.offset+3];return this.offset+=4,g>>>0}uint64(g){let m=this.uint32(),R=this.uint32();if(g&&(m&2147483648)!==0){let C=$t(m,R);return C.high<2097152?-(C.high*4294967296+C.low):new pt(m,R,!0)}if(m>=2147483648)throw new Ne("unsigned integer exceeds the supported int64 range");return m<2097152?m*4294967296+R:new pt(m,R,!!g)}int8(){let g=this.byte();return g&128?g-256:g}int16(){let g=this.uint16();return g&32768?g-65536:g}int32(){let g=this.uint32();return g>2147483647?g-4294967296:g}float32(){this.ensure(4);let g=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getFloat32(0,!1);if(this.offset+=4,!isFinite(g))throw new Ne("non-finite float is not allowed");return g}float64(){this.ensure(8);let g=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,8).getFloat64(0,!1);if(this.offset+=8,!isFinite(g))throw new Ne("non-finite float is not allowed");return g}binary(g){this.ensure(g);let m=new Uint8Array(g);return m.set(this.bytes.subarray(this.offset,this.offset+g)),this.offset+=g,m}string(g){this.ensure(g);let m=Hr(this.bytes.subarray(this.offset,this.offset+g));return this.offset+=g,m}array(g,m,R){if(g>this.bytes.length-this.offset)throw new Ne("truncated MessagePack array");let C=new Array(g);for(let O=0;O<g;O+=1)C[O]=this.value(m+1,R.concat(String(O)));return C}map(g,m,R){if(g>Math.floor((this.bytes.length-this.offset)/2))throw new Ne("truncated MessagePack map");let C={};for(let O=0;O<g;O+=1){let T=this.value(m+1,R);if(typeof T!="string")if(this._allowsIntegerMapKey(R)&&$s(T))T=String(T);else throw new Ne("MessagePack map key must be a string");if(Object.prototype.hasOwnProperty.call(C,T))throw new Ne("duplicate MessagePack map key: "+T);Object.defineProperty(C,T,{configurable:!0,enumerable:!0,value:this.value(m+1,R.concat(T)),writable:!0})}return C}_allowsIntegerMapKey(g){if(!this.allowIntegerMapKeyAtPath||g.length!==this.allowIntegerMapKeyAtPath.length)return!1;for(let m=0;m<g.length;m+=1)if(g[m]!==this.allowIntegerMapKeyAtPath[m])return!1;return!0}value(g,m){if(g>128)throw new Ne("MessagePack nesting is too deep");let R=this.byte();if(R<=127)return R;if(R>=224)return R-256;if(R>=160&&R<=191)return this.string(R&31);if(R>=144&&R<=159)return this.array(R&15,g,m);if(R>=128&&R<=143)return this.map(R&15,g,m);switch(R){case 192:throw new Ne("nil is not allowed in TLV payloads");case 194:return!1;case 195:return!0;case 196:return this.binary(this.byte());case 197:return this.binary(this.uint16());case 198:return this.binary(this.uint32());case 202:return this.float32();case 203:return this.float64();case 204:return this.byte();case 205:return this.uint16();case 206:return this.uint32();case 207:return this.uint64(!1);case 208:return this.int8();case 209:return this.int16();case 210:return this.int32();case 211:return this.uint64(!0);case 217:return this.string(this.byte());case 218:return this.string(this.uint16());case 219:return this.string(this.uint32());case 220:return this.array(this.uint16(),g,m);case 221:return this.array(this.uint32(),g,m);case 222:return this.map(this.uint16(),g,m);case 223:return this.map(this.uint32(),g,m);default:throw new Ne("MessagePack extension and reserved values are not allowed")}}};function $s(E){return qr(E)||E instanceof pt}function Zs(E,g){let m=new Dn(E,g),R=m.value(0,[]);if(!Zt(R))throw new Ne("TLV payload must be a map");if(m.offset!==m.bytes.length)throw new Ne("MessagePack payload has trailing bytes or values");return R}Wr.exports={Int64Value:pt,MsgPackError:Ne,decodeMap:Zs,encodeMap:Hs,getByteView:Ln,isPlainMap:Zt,toUint8Array:en,utf8Decode:Hr,utf8Encode:Vr}});var Qn=Ye((bu,Jr)=>{"use strict";var Vt=nn(),Wn=204,Yn=1,zn=4,Yr=0,Kn=7,rn=64*1024*1024,Jn=rn+128*1024,zr=2147483647,Gn=new Uint8Array([2,0,109,116,1,0]),Ke=class extends Error{constructor(g){super(g),this.name="TLVCodecError"}};function Kr(E){if(typeof E!="number"||!isFinite(E)||Math.floor(E)!==E||E<1||E>zr)throw new Ke("sequence must be an integer in 1..2147483647")}function eo(E){if(E!=="0"&&E!=="1"&&E!=="2")throw new Ke('metadata mt must be "0", "1", or "2"')}function to(E){if(typeof E!="string"||E.length===0)throw new Ke("URI must be a non-empty UTF-8 string");let g=Vt.utf8Encode(E);if(g.length===0||g.length>255)throw new Ke("URI UTF-8 length must be in 1..255");return g}function no(E,g,m){E[g]=m&255,E[g+1]=m>>>8&255}function Vn(E,g,m){let R=m>>>0;E[g]=R&255,E[g+1]=R>>>8&255,E[g+2]=R>>>16&255,E[g+3]=R>>>24&255}function ro(E,g){return E[g]+E[g+1]*256}function Hn(E,g){return E[g]+E[g+1]*256+E[g+2]*65536+E[g+3]*16777216>>>0}function io(E,g,m,R){Kr(E),eo(g);let C=to(m),O=Vt.encodeMap(R===void 0?{}:R);if(O.length===0||O.length>rn)throw new Ke("MsgPack payload length is outside the TLV v1 limit");let P=1+C.length+1+4+O.length,T=21+P;if(T>Jn)throw new Ke("TLV frame exceeds the maximum frame length");let S=new Uint8Array(T);S[0]=Wn,S[1]=Yn,S[2]=zn,S[3]=Yr,Vn(S,4,E),no(S,8,Kn),S.set(Gn,10),S[16]=g.charCodeAt(0),Vn(S,17,P);let I=21;return S[I]=C.length,I+=1,S.set(C,I),I+=C.length,S[I]=0,I+=1,Vn(S,I,O.length),I+=4,S.set(O,I),S}function so(E){let g=Vt.toUint8Array(E);if(g.length===0||g.length>Jn)throw new Ke("TLV frame length is outside the allowed limit");if(g.length<27)throw new Ke("TLV frame is too short");if(g[0]!==Wn||g[1]!==Yn||g[2]!==zn||g[3]!==Yr)throw new Ke("invalid TLV v1 header");let m=Hn(g,4);if(Kr(m),ro(g,8)!==Kn)throw new Ke("TLV v1 metadata length must be exactly 7");for(let L=0;L<Gn.length;L+=1)if(g[10+L]!==Gn[L])throw new Ke("TLV v1 metadata must contain only key mt");let R=g[16];if(R!==48&&R!==49&&R!==50)throw new Ke("TLV v1 metadata mt is invalid");let C=String.fromCharCode(R);if(Hn(g,17)!==g.length-21)throw new Ke("message queue length does not match the frame boundary");let P=21,T=g[P];if(P+=1,T===0||P+T+1+4>g.length)throw new Ke("invalid URI length in message queue");let S=Vt.utf8Decode(g.subarray(P,P+T));if(P+=T,g[P]!==0)throw new Ke("TLV v1 passThrough must be empty");P+=1;let I=Hn(g,P);if(P+=4,I===0||I>rn||P+I!==g.length)throw new Ke("invalid MsgPack payload length or trailing bytes");let N=g.subarray(P,P+I),B;try{B=Vt.decodeMap(N,{allowIntegerMapKeyAtPath:S==="room.last_messages"?["last_by_room"]:null})}catch(L){throw L instanceof Ke?L:new Ke("invalid MsgPack payload: "+L.message)}return{mt:C,payload:B,payloadBytes:new Uint8Array(N),sequence:m,uri:S}}Jr.exports={FLAGS:zn,MAGIC:Wn,MAX_FRAME_LENGTH:Jn,MAX_PAYLOAD_LENGTH:rn,MAX_SEQUENCE:zr,METADATA_LENGTH:Kn,TLVCodecError:Ke,VERSION:Yn,decodeFrame:so,encodeFrame:io}});var ir=Ye((wu,oi)=>{"use strict";var Et=nn(),$e=class extends Error{constructor(g,m){super(m),this.name="TLVContractError",this.status=g}};function _e(E,g,m,R){let C=R||{};return{defaults:C.defaults||{},pass:C.pass||[],request:g||{},required:C.required||[],response:m||{},uri:E}}var sn={cursor:0,end_ms:0,limit:20,reverse:!1,start_ms:0},on={end_ms:0,limit:20,reverse:!1,start_ms:0},an={end_ms:0,start_ms:0},un={begin:"start_ms",desc:"reverse",end:"end_ms",lastid:"cursor",mtypes:"kinds",num:"limit"},fn={begin:"start_ms",desc:"reverse",end:"end_ms",mid:"anchor",mtypes:"kinds",num:"limit"},cn={begin:"start_ms",end:"end_ms",mtypes:"kinds"},gt={begin:"first_ms",end:"last_ms",lastid:"next",msgs:"items",num:"size"},yn={auth:_e("auth.login",{attrs:"props",authv:"auth_ver",lang:"locale",pid:"project",token:"credential",ts:"auth_sec",uid:"user",version:"client_ver"},{ok:"accepted"},{required:["project","user","credential","client_ver"]}),bye:_e("connection.close"),getservertime:_e("system.time",null,{mts:"server_ms"}),addattrs:_e("connection.set_props",{attrs:"props"},null,{required:["props"]}),getattrs:_e("connection.get_props",null,{attrs:"props"}),adddebuglog:_e("system.debug",{attrs:"context",msg:"entry"},null,{required:["entry","context"]}),getonlineusers:_e("presence.online",{uids:"users"},{uids:"online_users"},{required:["users"]}),setuserinfo:_e("user.set_profile",{oinfo:"public_data",pinfo:"private_data"}),getuserinfo:_e("user.get_profile",null,{oinfo:"public_data",pinfo:"private_data"}),getuseropeninfo:_e("user.get_public",{uids:"users"},{info:"profiles"},{required:["users"]}),setlang:_e("user.set_locale",{lang:"locale"},{ok:"updated"},{required:["locale"]}),dataget:_e("storage.get",{key:"slot"},{val:"value"},{required:["slot"]}),dataset:_e("storage.set",{key:"slot",val:"value"},null,{required:["slot","value"]}),datadel:_e("storage.delete",{key:"slot"},null,{required:["slot"]}),addblacks:_e("blacklist.add",{blacks:"blocked_users"},null,{required:["blocked_users"]}),delblacks:_e("blacklist.remove",{blacks:"blocked_users"},null,{required:["blocked_users"]}),getblacks:_e("blacklist.list",null,{uids:"blocked_users"}),addgroupmembers:_e("group.add",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),delgroupmembers:_e("group.remove",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),getgroupmembers:_e("group.members",{gid:"group_ref",online:"with_online"},{onlines:"active_members",uids:"members"},{required:["group_ref"]}),getgroupcount:_e("group.count",{gid:"group_ref",online:"with_online"},{cn:"total",online:"active_total"},{required:["group_ref"]}),getusergroups:_e("group.joined",null,{gids:"group_refs"}),setgroupinfo:_e("group.set_profile",{gid:"group_ref",oinfo:"public_data",pinfo:"private_data"},null,{required:["group_ref"]}),getgroupinfo:_e("group.get_profile",{gid:"group_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["group_ref"]}),getgroupopeninfo:_e("group.get_public",{gid:"group_ref"},{oinfo:"public_data"},{required:["group_ref"]}),getgroupsopeninfo:_e("group.get_public_batch",{gids:"group_refs"},{info:"profiles"},{required:["group_refs"]}),enterroom:_e("room.join",{rid:"room_ref"},null,{required:["room_ref"]}),leaveroom:_e("room.leave",{rid:"room_ref"},null,{required:["room_ref"]}),enterrooms:_e("room.join_batch",{rids:"room_refs"},null,{required:["room_refs"]}),getuserrooms:_e("room.joined",null,{rooms:"room_refs"}),getroommembers:_e("room.members",{rid:"room_ref"},{uids:"members"},{required:["room_ref"]}),getroomcount:_e("room.counts",{rids:"room_refs"},{cn:"totals"},{required:["room_refs"]}),setroominfo:_e("room.set_profile",{icon:"avatar",name:"label",oinfo:"public_data",pinfo:"private_data",rid:"room_ref"},null,{required:["room_ref"]}),getroominfo:_e("room.get_profile",{rid:"room_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["room_ref"]}),getroomopeninfo:_e("room.get_public",{rid:"room_ref"},{oinfo:"public_data"},{required:["room_ref"]}),getroomsopeninfo:_e("room.get_public_batch",{rids:"room_refs"},{info:"profiles"},{required:["room_refs"]}),getuserroomsandlastmsg:_e("room.last_messages",{mtypes:"kinds"},{rooms:"last_by_room"}),sendmsg:_e("message.send",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",to:"recipient"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["recipient","message_ref","kind","payload","extra"]}),sendmsgs:_e("message.send_batch",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",tos:"recipients"},{mid:"message_ref",mtime:"time_ms"},{required:["recipients","message_ref","kind","payload","extra"]}),sendgroupmsg:_e("message.send_group",{attrs:"extra",gid:"group_ref",mid:"message_ref",msg:"payload",mtype:"kind"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["group_ref","message_ref","kind","payload","extra"]}),sendroommsg:_e("message.send_room",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",rid:"room_ref"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["room_ref","message_ref","kind","payload","extra"]}),tcheck:_e("moderation.check",{region:"zone",text:"payload"},{language:"detected_locale",result:"decision",text:"filtered",wlist:"matches"},{pass:["checkParams","strategyId"],required:["payload"]}),translate:_e("translation.run",{dst:"to_locale",profanity:"filter_mode",src:"from_locale",text:"input",type:"format"},{dtext:"output",dst:"to_locale",source:"detected_locale",sourceText:"original",src:"from_locale",stext:"input",target:"resolved_locale",targetText:"translated"},{defaults:{filter_mode:"off",format:"chat"},required:["input","to_locale","format","filter_mode"]}),getp2pmsg:_e("history.direct",Object.assign({ouid:"peer"},un),gt,{defaults:sn,required:["peer","reverse","limit","start_ms","end_ms","cursor"]}),getgroupmsg:_e("history.group",Object.assign({gid:"group_ref"},un),gt,{defaults:sn,required:["group_ref","reverse","limit","start_ms","end_ms","cursor"]}),getroommsg:_e("history.room",Object.assign({rid:"room_ref"},un),gt,{defaults:sn,required:["room_ref","reverse","limit","start_ms","end_ms","cursor"]}),getbroadcastmsg:_e("history.broadcast",un,gt,{defaults:sn,required:["reverse","limit","start_ms","end_ms","cursor"]}),getp2pmsgbymessageid:_e("history.direct_anchor",Object.assign({ouid:"peer"},fn),gt,{defaults:on,required:["peer","anchor","reverse","limit","start_ms","end_ms"]}),getgroupmsgbymessageid:_e("history.group_anchor",Object.assign({gid:"group_ref"},fn),gt,{defaults:on,required:["group_ref","anchor","reverse","limit","start_ms","end_ms"]}),getroommsgbymessageid:_e("history.room_anchor",Object.assign({rid:"room_ref"},fn),gt,{defaults:on,required:["room_ref","anchor","reverse","limit","start_ms","end_ms"]}),getbroadcastmsgbymessageid:_e("history.broadcast_anchor",fn,gt,{defaults:on,required:["anchor","reverse","limit","start_ms","end_ms"]}),getp2pmsgcount:_e("history.direct_count",Object.assign({ouid:"peer"},cn),{count:"total"},{defaults:an,required:["peer","start_ms","end_ms"]}),getgroupmsgcount:_e("history.group_count",Object.assign({gid:"group_ref"},cn),{count:"total"},{defaults:an,required:["group_ref","start_ms","end_ms"]}),getroommsgcount:_e("history.room_count",Object.assign({rid:"room_ref"},cn),{count:"total"},{defaults:an,required:["room_ref","start_ms","end_ms"]}),getbroadcastmsgcount:_e("history.broadcast_count",cn,{count:"total"},{defaults:an,required:["start_ms","end_ms"]}),getmsg:_e("message.get",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},{attrs:"extra",from:"sender",id:"sequence",mid:"message_ref",msg:"payload",mtime:"time_ms",mtype:"kind"},{required:["sender","message_ref","target_ref","channel"]}),delmsg:_e("message.revoke",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},null,{required:["sender","message_ref","target_ref","channel"]}),getunread:_e("unread.summary",{clear:"mark_read",gettime:"with_logout"},{group:"group_refs",logouttime:"logout_sec",p2p:"peers"},{defaults:{mark_read:!1},required:["mark_read"]}),getsession:_e("session.list",null,{group:"group_refs",p2p:"peers"}),cleanunread:_e("unread.clear"),setsessionread:_e("session.read",{category:"channel",read_seq:"through",xid:"target_ref"},null,{required:["channel","target_ref","through"]}),getp2punread:_e("unread.direct",{mtime:"since_ms",mtypes:"kinds",uids:"peers"},{ltime:"times",p2p:"counts"},{required:["peers"]}),getgroupunread:_e("unread.group",{gids:"group_refs",mtime:"since_ms",mtypes:"kinds"},{group:"counts",ltime:"times"},{required:["group_refs"]}),removesession:_e("session.remove",{oneway:"local_only",to:"peer"},null,{defaults:{local_only:!1},required:["peer","local_only"]}),getp2pconversationlist:_e("conversation.direct",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getp2punreadconversationlist:_e("conversation.direct_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getgroupconversationlist:_e("conversation.group",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getgroupunreadconversationlist:_e("conversation.group_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getunreadconversationlist:_e("conversation.unread",{clear:"mark_read",mtime:"since_ms",mtypes:"kinds"},{groupConversations:"group_refs",groupMsgs:"group_last",groupUnreads:"group_badges",p2pConversations:"peers",p2pMsgs:"peer_last",p2pUnreads:"peer_badges"},{defaults:{mark_read:!1},required:["mark_read"]})},$r=new Set(["acheck","adddevice","addfriends","addoption","addprojectban","adminCommand","broadcastfile","closeRTCRoom","delfriends","filetoken","getfriends","getoption","getRTCRoomList","getRTCRoomMemberCount","getRTCRoomMembers","icheck","inviteUserIntoRTCRoom","isfriend","isfriends","isprojectban","kickoutFromRTCRoom","profanity","pullIntoRTCRoom","removedevice","removeoption","removeprojectban","sendfile","sendfiles","sendgroupfile","sendroomfile","setRTCRoomMicStatus","speech2text","speechtranslation","uploadfile","vcheck"]),Zr={"event.broadcast":!0,"event.direct":!0,"event.group":!0,"event.room":!0},oo={"event.kicked":!0,"event.room_removed":!0},ei="-9223372036854775808",tr="9223372036854775807",ao="-2147483648",uo="2147483647";function nt(E,g,m){return Object.assign({required:!!g,type:E},m||{})}function Je(E,g){return nt("integer",E,Object.assign({min:ei,max:tr},g||{}))}function yt(E,g){return nt("integer",E,Object.assign({min:ao,max:uo},g||{}))}function Ue(E,g){return Je(E,Object.assign({min:"1"},g||{}))}function ze(E,g){return Je(E,Object.assign({min:"0"},g||{}))}function ft(E,g){return yt(E,Object.assign({min:"0"},g||{}))}function Ee(E,g){return nt("string",E,g)}function ot(E){return nt("boolean",E)}function at(E,g,m){return nt("array",E,Object.assign({element:g},m||{}))}function Ht(E,g,m,R){return nt("map",E,Object.assign({key:g,value:m},R||{}))}function me(E){return Object.assign({sent_ms:Je(!1),trace:Ee(!1)},E||{})}function ge(E,g){return{allowEmpty:!!(g&&g.allowEmpty),fields:E||{}}}var ti=Je(!1),fo=yt(!1),co=ft(!1),ln=Je(!1),lo=ze(!1),ho=Ue(!1),En=Ee(!1),po=nt("string_or_bin",!1),mt=nt("tuple8",!1);function je(E,g){return at(E,ho,g)}function it(E,g){return at(E,ti,g)}function kt(E,g){return at(E,fo,g)}function go(E,g){return at(E,En,g)}function er(E){return Ht(E,"string",En)}function Xn(E){return Ht(E,"positive_decimal_int64",En)}function $n(E){return Ht(E,"positive_decimal_int64",co)}function Qr(E){return Ht(E,"positive_decimal_int64",lo)}function _o(E){return Ht(E,"positive_decimal_int64",mt)}function mo(E){return Je(E,{messageKind:!0})}function ni(E){return Je(E,{max:"255",min:"0"})}var hn={extra:Ee(!0,{maxBytes:65535}),kind:mo(!0),message_ref:ze(!0),payload:nt("string_or_bin",!0,{maxBytes:65535})},dn={cursor:Je(!0),end_ms:ze(!0),kinds:it(!1),limit:ft(!0),reverse:ot(!0),start_ms:ze(!0)},pn={anchor:Ue(!0),end_ms:ze(!0),kinds:it(!1),limit:ft(!0),reverse:ot(!0),start_ms:ze(!0)},gn={end_ms:ze(!0),kinds:it(!1),start_ms:ze(!0)},nr={"auth.login":me({auth_sec:ze(!1),auth_ver:yt(!1,{enum:["2"]}),client_ver:Ee(!0,{nonEmpty:!0}),credential:Ee(!0,{nonEmpty:!0}),locale:Ee(!1),project:Je(!0,{max:"4294967295",min:"1"}),props:er(!1),user:Ue(!0)}),"connection.close":me(),"system.time":me(),"connection.set_props":me({props:er(!0)}),"connection.get_props":me(),"system.debug":me({context:Ee(!0),entry:Ee(!0,{nonEmpty:!0})}),"presence.online":me({users:je(!0,{minItems:1})}),"user.set_profile":me({private_data:Ee(!1),public_data:Ee(!1)}),"user.get_profile":me(),"user.get_public":me({users:je(!0,{minItems:1})}),"user.set_locale":me({locale:Ee(!0)}),"storage.get":me({slot:Ee(!0)}),"storage.set":me({slot:Ee(!0),value:Ee(!0)}),"storage.delete":me({slot:Ee(!0)}),"blacklist.add":me({blocked_users:je(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.remove":me({blocked_users:je(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.list":me(),"group.add":me({group_ref:Ue(!0),members:je(!0,{minItems:1})}),"group.remove":me({group_ref:Ue(!0),members:je(!0,{minItems:1})}),"group.members":me({group_ref:Ue(!0),with_online:ot(!1)}),"group.count":me({group_ref:Ue(!0),with_online:ot(!1)}),"group.joined":me(),"group.set_profile":me({group_ref:Ue(!0),private_data:Ee(!1),public_data:Ee(!1)}),"group.get_profile":me({group_ref:Ue(!0)}),"group.get_public":me({group_ref:Ue(!0)}),"group.get_public_batch":me({group_refs:je(!0,{minItems:1})}),"room.join":me({room_ref:Ue(!0)}),"room.leave":me({room_ref:Ue(!0)}),"room.join_batch":me({room_refs:je(!0,{maxItems:100,minItems:1})}),"room.joined":me(),"room.members":me({room_ref:Ue(!0)}),"room.counts":me({room_refs:je(!0,{minItems:1})}),"room.set_profile":me({avatar:Ee(!1),label:Ee(!1),private_data:Ee(!1),public_data:Ee(!1),room_ref:Ue(!0)}),"room.get_profile":me({room_ref:Ue(!0)}),"room.get_public":me({room_ref:Ue(!0)}),"room.get_public_batch":me({room_refs:je(!0,{minItems:1})}),"room.last_messages":me({kinds:it(!1)}),"message.send":me(Object.assign({recipient:Ue(!0)},hn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"message.send_batch":me(Object.assign({recipients:je(!0,{maxItems:100,minItems:1})},hn)),"message.send_group":me(Object.assign({group_ref:Ue(!0)},hn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"message.send_room":me(Object.assign({room_ref:Ue(!0)},hn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"moderation.check":me({checkParams:Ee(!1),payload:Ee(!0,{nonEmpty:!0}),strategyId:Ee(!1),zone:Ee(!1)}),"translation.run":me({filter_mode:Ee(!0,{enum:["off","stop","censor"]}),format:Ee(!0,{nonEmpty:!0}),from_locale:Ee(!1),input:Ee(!0,{nonEmpty:!0}),to_locale:Ee(!0)}),"history.direct":me(Object.assign({peer:Ue(!0)},dn)),"history.group":me(Object.assign({group_ref:Ue(!0)},dn)),"history.room":me(Object.assign({room_ref:Ue(!0)},dn)),"history.broadcast":me(dn),"history.direct_anchor":me(Object.assign({peer:Ue(!0)},pn)),"history.group_anchor":me(Object.assign({group_ref:Ue(!0)},pn)),"history.room_anchor":me(Object.assign({room_ref:Ue(!0)},pn)),"history.broadcast_anchor":me(pn),"history.direct_count":me(Object.assign({peer:Ue(!0)},gn)),"history.group_count":me(Object.assign({group_ref:Ue(!0)},gn)),"history.room_count":me(Object.assign({room_ref:Ue(!0)},gn)),"history.broadcast_count":me(gn),"message.get":me({channel:yt(!0,{enum:["1","2","3","4"]}),message_ref:Je(!0),sender:Ue(!0),target_ref:ze(!0)}),"message.revoke":me({channel:yt(!0,{enum:["1","2","3","4"]}),message_ref:Je(!0),sender:Ue(!0),target_ref:ze(!0)}),"unread.summary":me({mark_read:ot(!0),with_logout:ot(!1)}),"session.list":me(),"unread.clear":me(),"session.read":me({channel:yt(!0,{enum:["1","2","3","4","5"]}),target_ref:ze(!0),through:Ue(!0)}),"unread.direct":me({kinds:it(!1),peers:je(!0,{minItems:1}),since_ms:ze(!1)}),"unread.group":me({group_refs:je(!0,{minItems:1}),kinds:it(!1),since_ms:ze(!1)}),"session.remove":me({local_only:ot(!0),peer:Ue(!0)}),"conversation.direct":me({kinds:it(!1),since_ms:ze(!1)}),"conversation.direct_unread":me({kinds:it(!1),since_ms:ze(!1)}),"conversation.group":me({kinds:it(!1),since_ms:ze(!1)}),"conversation.group_unread":me({kinds:it(!1),since_ms:ze(!1)}),"conversation.unread":me({kinds:it(!1),mark_read:ot(!0),since_ms:ze(!1)})},_t={first_ms:ze(!0),items:at(!0,mt),last_ms:ze(!0),next:Je(!0),size:ft(!0)},_n={message_ref:Je(!0),time_ms:Je(!0)},yo={extra:Ee(!0),kind:ni(!0),message_ref:Je(!0),payload:nt("string_or_bin",!0),sender:Ue(!0),sequence:Je(!0),time_ms:Je(!0)},ri={"auth.login":ge({accepted:ot(!0),telemetry_on:ot(!1)}),"connection.close":ge(),"system.time":ge({server_ms:Je(!0)}),"connection.set_props":ge(),"connection.get_props":ge({props:er(!0)}),"system.debug":ge(),"presence.online":ge({online_users:je(!0)}),"user.set_profile":ge(),"user.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"user.get_public":ge({profiles:Xn(!0)}),"user.set_locale":ge({updated:ot(!0)}),"storage.get":ge({value:Ee(!0)}),"storage.set":ge(),"storage.delete":ge(),"blacklist.add":ge(),"blacklist.remove":ge(),"blacklist.list":ge({blocked_users:je(!0)}),"group.add":ge(),"group.remove":ge(),"group.members":ge({active_members:je(!1),members:je(!0)}),"group.count":ge({active_total:ft(!1),total:ft(!0)}),"group.joined":ge({group_refs:je(!0)}),"group.set_profile":ge(),"group.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"group.get_public":ge({public_data:Ee(!0)}),"group.get_public_batch":ge({profiles:Xn(!0)}),"room.join":ge(),"room.leave":ge(),"room.join_batch":ge(),"room.joined":ge({room_refs:je(!0)}),"room.members":ge({members:je(!0)}),"room.counts":ge({totals:$n(!0)}),"room.set_profile":ge(),"room.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"room.get_public":ge({public_data:Ee(!0)}),"room.get_public_batch":ge({profiles:Xn(!0)}),"room.last_messages":ge({last_by_room:_o(!0)}),"message.send":ge(_n),"message.send_batch":ge(_n),"message.send_group":ge(_n),"message.send_room":ge(_n),"moderation.check":ge({decision:yt(!0),detected_locale:Ee(!0),filtered:Ee(!0),matches:go(!1)}),"translation.run":ge({detected_locale:Ee(!0),from_locale:Ee(!0),input:Ee(!0),original:Ee(!0),output:Ee(!0),resolved_locale:Ee(!0),to_locale:Ee(!0),translated:Ee(!0)}),"history.direct":ge(_t),"history.group":ge(_t),"history.room":ge(_t),"history.broadcast":ge(_t),"history.direct_anchor":ge(_t),"history.group_anchor":ge(_t),"history.room_anchor":ge(_t),"history.broadcast_anchor":ge(_t),"history.direct_count":ge({total:ft(!0)}),"history.group_count":ge({total:ft(!0)}),"history.room_count":ge({total:ft(!0)}),"history.broadcast_count":ge({total:ft(!0)}),"message.get":ge(yo,{allowEmpty:!0}),"message.revoke":ge(),"unread.summary":ge({group_refs:je(!0),logout_sec:ze(!1),peers:je(!0)}),"session.list":ge({group_refs:je(!0),peers:je(!0)}),"unread.clear":ge(),"session.read":ge(),"unread.direct":ge({counts:$n(!0),times:Qr(!0)}),"unread.group":ge({counts:$n(!0),times:Qr(!0)}),"session.remove":ge(),"conversation.direct":ge({badges:kt(!0),last_items:at(!0,mt),peers:je(!0)}),"conversation.direct_unread":ge({badges:kt(!0),last_items:at(!0,mt),peers:je(!0)}),"conversation.group":ge({badges:kt(!0),group_refs:je(!0),last_items:at(!0,mt)}),"conversation.group_unread":ge({badges:kt(!0),group_refs:je(!0),last_items:at(!0,mt)}),"conversation.unread":ge({group_badges:kt(!0),group_last:at(!0,mt),group_refs:je(!0),peer_badges:kt(!0),peer_last:at(!0,mt),peers:je(!0)}),"control.ping":ge({ts:Je(!1)})},Eo={from_locale:Ee(!0),original:Ee(!0),to_locale:Ee(!0),translated:Ee(!0)},mn={extra:Ee(!0,{maxBytes:65535}),kind:ni(!0),message_ref:Je(!0),payload:nt("push_payload",!0),sender:Ue(!0),time_ms:Je(!0)},bo={"event.direct":Object.assign({recipient:Ue(!0)},mn),"event.group":Object.assign({group_ref:Ue(!0)},mn),"event.room":Object.assign({room_ref:Ue(!0)},mn),"event.broadcast":mn,"event.kicked":{},"event.room_removed":{room_ref:Ue(!0)}};function ii(E){return yn[E]||null}function wo(E){let g=Object.keys(yn);for(let m=0;m<g.length;m+=1){let R=yn[g[m]];if(R.uri===E)return{method:g[m],route:R}}return null}function Rt(E){let g=String(E);if(!/^-?[0-9]+$/.test(g))return null;let m=g.charAt(0)==="-",R=(m?g.slice(1):g).replace(/^0+/,"")||"0";return m&&R!=="0"?"-"+R:R}function rr(E){return typeof E=="number"?vo(E)?Rt(E):null:typeof E=="bigint"||E instanceof Et.Int64Value||E&&typeof E=="object"&&typeof E.offset=="number"&&E.buffer&&typeof E.toString=="function"?Rt(E.toString()):null}function vo(E){return Number.isSafeInteger?Number.isSafeInteger(E):typeof E=="number"&&isFinite(E)&&Math.floor(E)===E&&Math.abs(E)<=9007199254740991}function ht(E,g){let m=Rt(E),R=Rt(g);if(m===null||R===null)throw new Error("integer comparison requires decimal integers");if(m===R)return 0;let C=m.charAt(0)==="-",O=R.charAt(0)==="-";if(C!==O)return C?-1:1;let P=C?m.slice(1):m,T=O?R.slice(1):R,S;return P.length!==T.length?S=P.length<T.length?-1:1:S=P<T?-1:1,C?-S:S}function Xr(E){let g=0;for(let m=0;m<E.length;m+=1){let R=E.charCodeAt(m);if(R>=55296&&R<=56319){let C=E.charCodeAt(m+1);if(C<56320||C>57343)throw new $e(200034,"string contains an unpaired surrogate");g+=4,m+=1}else{if(R>=56320&&R<=57343)throw new $e(200034,"string contains an unpaired surrogate");R<=127?g+=1:R<=2047?g+=2:g+=3}}return g}function Ve(E,g){throw new $e(200034,E+" "+g)}function Ro(E,g,m){let R=rr(E);(R===null||ht(R,ei)<0||ht(R,tr)>0)&&Ve(m,"must be a signed int64 integer"),g.min!==void 0&&ht(R,g.min)<0&&Ve(m,"is below the allowed range"),g.max!==void 0&&ht(R,g.max)>0&&Ve(m,"is above the allowed range"),g.enum&&g.enum.indexOf(R)===-1&&Ve(m,"is not an allowed value"),g.messageKind&&!(ht(R,"1")>=0&&ht(R,"39")<=0||ht(R,"51")>=0&&ht(R,"127")<=0)&&Ve(m,"must be in kind ranges [1,39] or [51,127]")}function Co(E,g,m){if(g!=="string"){if(g==="positive_decimal_int64"){let R=Rt(E);(R===null||R.charAt(0)==="-"||R==="0"||ht(R,tr)>0)&&Ve(m,"must be a positive decimal int64 map key");return}Ve(m,"uses an unsupported map-key contract")}}function Po(E,g){(!Array.isArray(E)||E.length!==8)&&Ve(g,"must be an 8-item message tuple"),st(E[0],ln,g+"[0]"),st(E[1],ln,g+"[1]"),st(E[2],ti,g+"[2]"),st(E[3],ln,g+"[3]"),st(E[4],nt("boolean",!1),g+"[4]"),st(E[5],po,g+"[5]"),st(E[6],En,g+"[6]"),st(E[7],ln,g+"[7]")}function st(E,g,m){if(E==null&&Ve(m,"must not be nil"),g.type==="integer"){Ro(E,g,m);return}if(g.type==="boolean"){typeof E!="boolean"&&Ve(m,"must be boolean");return}if(g.type==="string"){typeof E!="string"&&Ve(m,"must be a UTF-8 string"),g.nonEmpty&&E.length===0&&Ve(m,"must not be empty"),g.enum&&g.enum.indexOf(E)===-1&&Ve(m,"is not an allowed value"),g.maxBytes!==void 0&&Xr(E)>g.maxBytes&&Ve(m,"exceeds "+g.maxBytes+" UTF-8 bytes");return}if(g.type==="string_or_bin"){if(typeof E=="string"){g.maxBytes!==void 0&&Xr(E)>g.maxBytes&&Ve(m,"exceeds "+g.maxBytes+" UTF-8 bytes");return}let R=Et.getByteView(E);R||Ve(m,"must be a string or MsgPack bin value"),g.maxBytes!==void 0&&R.byteLength>g.maxBytes&&Ve(m,"exceeds "+g.maxBytes+" bytes");return}if(g.type==="array"){if(Array.isArray(E)||Ve(m,"must be an array"),g.minItems!==void 0&&E.length<g.minItems&&Ve(m,"must not be empty"),g.maxItems!==void 0&&E.length>g.maxItems&&Ve(m,"contains too many items"),E.forEach(function(R,C){st(R,g.element,m+"["+C+"]")}),g.uniqueInt64Max!==void 0){let R={};E.forEach(function(C){R[rr(C)]=!0}),Object.keys(R).length>g.uniqueInt64Max&&Ve(m,"contains too many distinct int64 items")}return}if(g.type==="map"){Et.isPlainMap(E)||Ve(m,"must be a map"),Object.keys(E).forEach(function(R){Co(R,g.key,m+"."+R),st(E[R],g.value,m+"."+R)});return}if(g.type==="tuple8"){Po(E,m);return}if(g.type==="push_payload"){if(typeof E=="string"||Et.getByteView(E))return;Gt("Chat payload",E,Eo);return}Ve(m,"uses an unsupported value contract")}function Gt(E,g,m){Et.isPlainMap(g)||Ve(E,"body must be a map"),Object.keys(g).forEach(function(R){Object.prototype.hasOwnProperty.call(m,R)||Ve(E+"."+R,"is not defined by this contract")}),Object.keys(m).forEach(function(R){let C=m[R];if(!Object.prototype.hasOwnProperty.call(g,R)){C.required&&Ve(E+"."+R,"is required");return}st(g[R],C,E+"."+R)})}function Oo(E,g){if(g==="trace"||g==="sent_ms"||Object.prototype.hasOwnProperty.call(E.defaults,g))return!0;let m=nr[E.uri];return!!(m&&m[g]&&!m[g].required)}function To(E,g){let m=ri[E];if(!m)throw new $e(200034,"unsupported Answer URI: "+E);m.allowEmpty&&Et.isPlainMap(g)&&Object.keys(g).length===0||(Gt(E+" Answer",g,m.fields),Ao(E,g))}function Ao(E,g){let m;if(E==="conversation.direct"||E==="conversation.direct_unread")m=["peers","badges","last_items"];else if(E==="conversation.group"||E==="conversation.group_unread")m=["group_refs","badges","last_items"];else if(E==="conversation.unread"){Zn(E,g,["group_refs","group_badges","group_last"]),Zn(E,g,["peers","peer_badges","peer_last"]);return}m&&Zn(E,g,m)}function Zn(E,g,m){let R=g[m[0]].length;for(let C=1;C<m.length;C+=1)g[m[C]].length!==R&&Ve(E+" Answer",m.join(", ")+" must have matching lengths")}function So(E,g){let m=bo[E];if(!m)throw new $e(200034,"unsupported Push URI: "+E);Gt(E+" Push",g,m)}function Mo(E){Gt("control.error Answer",E,{reason:Ee(!0),status:yt(!0)})}function ko(E,g,m,R){let C=ii(E);if(!C)throw si(E)?new $e(200020,E+" is reserved and unavailable on the TLV Client port"):new $e(20004,"unknown or unsupported TLV Client wire: "+E);if(!Et.isPlainMap(g))throw new $e(200034,E+" request body must be a map");let O={};return Object.keys(g).forEach(function(P){let T;if(!(P==="trace_id"||P==="send_ts")){if(P==="trace"||P==="sent_ms")T=P;else if(Object.prototype.hasOwnProperty.call(C.request,P))T=C.request[P];else if(C.pass.indexOf(P)!==-1)T=P;else throw new $e(200034,C.uri+" does not accept field "+P);if(Object.prototype.hasOwnProperty.call(O,T))throw new $e(200034,C.uri+" received duplicate field mapping for "+T);R&&R.omitLegacyNil&&(g[P]===void 0||g[P]===null)&&Oo(C,T)||(O[T]=g[P])}}),Object.keys(C.defaults).forEach(function(P){Object.prototype.hasOwnProperty.call(O,P)||(O[P]=C.defaults[P])}),Io(O,m,C.uri),xo(C,O),{payload:O,uri:C.uri}}function si(E){return $r.has(E)||typeof E=="string"&&E.indexOf("imclient_")===0}function Io(E,g,m){if(!g)return;let R=typeof g=="function"?g():g;if(R){if(!Et.isPlainMap(R))throw new $e(200034,m+" request metadata must be a map");["trace","sent_ms"].forEach(function(C){if(R[C]!==void 0){if(Object.prototype.hasOwnProperty.call(E,C)&&E[C]!==R[C])throw new $e(200034,m+" has conflicting "+C+" values");E[C]=R[C]}})}}function xo(E,g){let m=nr[E.uri];if(!m)throw new $e(200034,"missing request schema for "+E.uri);if(Gt(E.uri+" request",g,m),E.uri==="auth.login"){let R=Object.prototype.hasOwnProperty.call(g,"auth_sec"),C=Object.prototype.hasOwnProperty.call(g,"auth_ver");if(R!==C)throw new $e(200034,"auth.login requires auth_sec and auth_ver together");if(C&&rr(g.auth_ver)!=="2")throw new $e(200034,"auth.login auth_ver must be 2")}}function Uo(E){return Object.prototype.hasOwnProperty.call(Zr,E)}function No(E){return Object.prototype.hasOwnProperty.call(oo,E)}oi.exports={RELIABLE_PUSHES:Zr,REQUEST_SCHEMAS:nr,RESPONSE_SCHEMAS:ri,RESERVED_WIRES:$r,ROUTES:yn,TLVContractError:$e,getRoute:ii,getRouteByUri:wo,isOneWayPush:No,isReliablePush:Uo,isReservedWire:si,toWireRequest:ko,validateControlError:Mo,validatePush:So,validateResponse:To}});var or=Ye((vu,fi)=>{"use strict";var bn=Qn(),bt=ir(),vt=nn(),ui=lt(),Bo=20*1e3,Fo=30*1e3,Do=30*1e3,Lo=10*1e3,jo=30*1e3,sr=class{constructor(g){let m=g||{};if(typeof m.endpoint!="string"||!/^wss?:\/\//i.test(m.endpoint))throw new Error("tlv-v1 requires an explicit ws:// or wss:// endpoint URL");this._endpoint=m.endpoint,this._webSocketFactory=m.webSocketFactory||qo,this._legacyMsgPack=m.legacyMsgPack||ui.MsgPack,this._legacyMsgOptions=m.legacyMsgOptions,this._requestMetadata=m.requestMetadata,this._connectionTimeout=m.connectionTimeout||Fo,this._requestTimeout=m.requestTimeout||Bo,this._heartbeatIdleMs=m.heartbeatIdleMs||Do,this._heartbeatTimeoutMs=m.heartbeatTimeoutMs||Lo,this._dedupTtlMs=Math.max(m.pushDedupTtlMs||jo,20*1e3),this._listeners={},this._pending=new Map,this._receivedMessages=new Map,this._nextSequence=1,this._socket=null,this._connectionGeneration=0,this._state="idle",this._authenticated=!1,this._connectionTimer=0,this._heartbeatTimer=0,this._heartbeatPending=!1,this._lastActivity=0,this._incomingQueue=Promise.resolve(),this._protocolClosing=!1,this._destroyed=!1,this.processor=null}on(g,m){return typeof m!="function"?this:(this._listeners[g]||(this._listeners[g]=[]),this._listeners[g].push(m),this)}off(g,m){let R=this._listeners[g];return R?(this._listeners[g]=R.filter(function(C){return C!==m}),this):this}emit(g){let m=this._listeners[g]||[],R=Array.prototype.slice.call(arguments,1),C=this;m.slice().forEach(function(O){O.apply(C,R)})}connect(){if(this._destroyed||this._state==="connecting"||this._state==="open"||this._state==="closing")return;let g=this._connectionGeneration+1;this._connectionGeneration=g,this._nextSequence=1,this._receivedMessages.clear(),this._incomingQueue=Promise.resolve(),this._state="connecting",this._protocolClosing=!1;let m;try{m=this._webSocketFactory(this._endpoint)}catch(R){this._state="closed",this.emit("error",wt("cannot create WebSocket: "+R.message)),this.emit("close");return}if(!m||typeof m.send!="function"||typeof m.close!="function"){this._state="closed",this.emit("error",wt("webSocketFactory returned an invalid socket")),this.emit("close");return}this._socket=m;try{m.binaryType="arraybuffer"}catch{}m.onopen=this._onOpen.bind(this,m,g),m.onmessage=this._onMessage.bind(this,m,g),m.onerror=this._onError.bind(this,m,g),m.onclose=this._onClose.bind(this,m,g),this._connectionTimer=setTimeout(this._onConnectionTimeout.bind(this,m,g),this._connectionTimeout)}close(){this._clearConnectionTimeout(),this._stopHeartbeat(),this._authenticated=!1,(this._state==="open"||this._state==="connecting")&&(this._state="closing");let g=this._socket;if(!g){this._finalizeClose();return}try{g.close()}catch{this._finalizeClose()}}destroy(){if(this._destroyed)return;this._destroyed=!0,this._clearConnectionTimeout(),this._stopHeartbeat(),this._authenticated=!1;let g=this._socket;if(g)try{g.close()}catch{}this._finalizeClose(),this._listeners={},this._receivedMessages.clear()}markAuthenticated(){this._destroyed||this._state!=="open"||(this._authenticated=!0,this._lastActivity=Date.now(),this._startHeartbeat())}sendQuest(g,m,R){try{let C=this._decodeLegacyPayload(g&&g.payload),O=bt.toWireRequest(g&&g.method,C.payload,this._requestMetadata,{omitLegacyNil:C.legacyEncoded});this._request(O.uri,O.payload,R,{onError:function(P){m&&m(ai(P))},onSuccess:function(P){m&&m({_tlvPayload:Wt(P),mtype:2,ss:0})}})}catch(C){m&&m(ai(C))}}_decodeLegacyPayload(g){if(g==null)return{legacyEncoded:!1,payload:{}};if(vt.isPlainMap(g))return{legacyEncoded:!1,payload:g};try{let m=this._legacyMsgPack.decode(g,this._legacyMsgOptions);if(!vt.isPlainMap(m))throw new Error("legacy request payload is not a map");return{legacyEncoded:!0,payload:m}}catch(m){throw new bt.TLVContractError(200034,"cannot decode local request payload: "+m.message)}}_onOpen(g,m){g!==this._socket||m!==this._connectionGeneration||this._state!=="connecting"||this._destroyed||(this._clearConnectionTimeout(),this._state="open",this._lastActivity=Date.now(),this.emit("connect"))}_onMessage(g,m,R){if(g!==this._socket||m!==this._connectionGeneration||this._state!=="open"||this._destroyed)return;let O=R&&(typeof R=="object"||typeof R=="function")&&"data"in R?R.data:R;this._incomingQueue=this._incomingQueue.then(function(){return Vo(O)}).then(this._handleIncomingBytes.bind(this,g,m)).catch(this._handleIncomingFailure.bind(this,g,m))}_onError(g,m,R){if(g!==this._socket||m!==this._connectionGeneration||this._destroyed)return;let C=R&&R.message?R.message:"WebSocket transport error";this.emit("error",wt(C))}_onClose(g,m){g!==this._socket||m!==this._connectionGeneration||this._finalizeClose()}_onConnectionTimeout(g,m){if(this._connectionTimer=0,g!==this._socket||m!==this._connectionGeneration||this._state!=="connecting"||this._destroyed)return;let R=wt("WebSocket connection timed out after "+this._connectionTimeout+" ms");try{this.emit("error",R)}finally{if(g===this._socket&&m===this._connectionGeneration&&!this._destroyed&&this._state!=="closed"){this._state="closing";try{g.close()}catch{}g===this._socket&&m===this._connectionGeneration&&this._state!=="closed"&&this._finalizeClose()}}}_clearConnectionTimeout(){this._connectionTimer&&(clearTimeout(this._connectionTimer),this._connectionTimer=0)}_handleIncomingBytes(g,m,R){if(g!==this._socket||m!==this._connectionGeneration||this._state!=="open"||this._destroyed)return;this._lastActivity=Date.now();let C=bn.decodeFrame(R);if(C.mt==="2"){this._handleAnswer(C);return}if(C.mt==="1"){this._handleReliablePush(C);return}this._handleOneWayPush(C)}_handleIncomingFailure(g,m,R){g!==this._socket||m!==this._connectionGeneration||this._destroyed||this._protocolFailure(R)}_handleAnswer(g){if(g.uri==="control.ack")throw new Error("Gate must not send control.ack to a Client");let m=this._pending.get(g.sequence);if(m){if(g.uri==="control.error"){bt.validateControlError(g.payload),this._completePending(g.sequence,!1,{reason:g.payload.reason,status:Number(g.payload.status)});return}if(g.uri!==m.uri)throw new Error("Answer URI does not match pending request URI");bt.validateResponse(g.uri,g.payload),this._completePending(g.sequence,!0,g.payload)}}_handleReliablePush(g){if(!bt.isReliablePush(g.uri))throw new Error('Gate sent an unsupported mt="1" Quest URI: '+g.uri);bt.validatePush(g.uri,g.payload);let m=String(g.payload.message_ref),R=this._isDuplicateMessage(m);if(this._sendFrame(g.sequence,"2","control.ack",{}),R)return;let C={method:g.uri,payload:Wt(g.payload)};this._rememberMessage(m),this._dispatchPush(C)}_handleOneWayPush(g){if(!bt.isOneWayPush(g.uri))throw new Error('Gate sent an unsupported mt="0" URI: '+g.uri);bt.validatePush(g.uri,g.payload);let m={method:g.uri,payload:Wt(g.payload)};g.uri==="event.kicked"&&(this._authenticated=!1,this._stopHeartbeat()),this._dispatchPush(m)}_dispatchPush(g){if(!this.processor||typeof this.processor.service!="function")return;let m=vt.getByteView(g.payload.payload);this.processor.service({_tlvBinaryPayload:!!m,_tlvPayload:g.payload,flag:1,method:g.method})}_request(g,m,R,C){if(this._destroyed||this._state!=="open"||!this._socket){C.onError(wt("invalid WebSocket connection"));return}if(!this._authenticated&&g!=="auth.login"&&g!=="control.ping"){C.onError({status:200022,reason:"authentication is required before "+g});return}if(this._authenticated&&g==="auth.login"){C.onError({status:200023,reason:"auth.login cannot be sent twice on one connection"});return}let O=this._allocateSequence(),P=typeof R=="number"&&R>0?R:this._requestTimeout,T={handlers:C,timer:setTimeout(this._onRequestTimeout.bind(this,O),P),uri:g};this._pending.set(O,T);try{this._sendFrame(O,"1",g,m)}catch(S){this._pending.delete(O),clearTimeout(T.timer),C.onError(wn(S))}}_onRequestTimeout(g){let m=this._pending.get(g);m&&(this._pending.delete(g),m.handlers.onError({status:200999,reason:"request timeout"}))}_completePending(g,m,R){let C=this._pending.get(g);C&&(this._pending.delete(g),clearTimeout(C.timer),m?C.handlers.onSuccess(R):C.handlers.onError(R))}_allocateSequence(){for(let g=0;g<bn.MAX_SEQUENCE;g+=1){let m=this._nextSequence;if(this._nextSequence=m===bn.MAX_SEQUENCE?1:m+1,!this._pending.has(m))return m}throw new Error("all TLV request sequences are pending")}_sendFrame(g,m,R,C){if(this._destroyed||this._state!=="open"||!this._socket)throw wt("invalid WebSocket connection");let O=bn.encodeFrame(g,m,R,C),P=O.buffer.slice(O.byteOffset,O.byteOffset+O.byteLength);this._socket.send(P),this._lastActivity=Date.now()}_startHeartbeat(){this._stopHeartbeat(),this._heartbeatTimer=setInterval(this._heartbeatTick.bind(this),1e3)}_stopHeartbeat(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=0),this._heartbeatPending=!1}_heartbeatTick(){!this._authenticated||this._heartbeatPending||this._state!=="open"||Date.now()-this._lastActivity<this._heartbeatIdleMs||(this._heartbeatPending=!0,this._request("control.ping",{},this._heartbeatTimeoutMs,{onError:this._onHeartbeatError.bind(this),onSuccess:this._onHeartbeatAnswer.bind(this)}))}_onHeartbeatAnswer(g){this._heartbeatPending=!1,vt.isPlainMap(g)||this._protocolFailure(new Error("control.ping Answer body must be a map"))}_onHeartbeatError(g){this._heartbeatPending=!1,this._protocolFailure(new Error("control.ping failed: "+wn(g).reason))}_isDuplicateMessage(g){this._expireReceivedMessages();let m=this._receivedMessages.get(g);return m!==void 0&&m>Date.now()}_rememberMessage(g){this._receivedMessages.set(g,Date.now()+this._dedupTtlMs)}_expireReceivedMessages(){let g=Date.now();this._receivedMessages.forEach(function(m,R){m<=g&&this._receivedMessages.delete(R)},this)}_protocolFailure(g){if(this._protocolClosing||this._state==="closed")return;this._protocolClosing=!0;let m=wn(g);this.emit("error",wt("TLV protocol error: "+m.reason));let R=this._socket;if(!R){this._finalizeClose();return}this._state="closing";try{R.close(1002,"TLV protocol error")}catch{this._finalizeClose()}}_finalizeClose(){if(this._state==="closed")return;this._state="closed",this._clearConnectionTimeout(),this._socket=null,this._authenticated=!1,this._stopHeartbeat();let g=Array.from(this._pending.values());this._pending.clear(),g.forEach(function(m){clearTimeout(m.timer),m.handlers.onError(wt("WebSocket connection closed"))}),this.emit("close")}};function qo(E){let g=typeof WebSocket<"u"?WebSocket:typeof globalThis<"u"?globalThis.WebSocket:void 0;if(typeof g!="function")throw new Error("WebSocket is unavailable; provide options.webSocketFactory");return new g(E)}function Vo(E){if(typeof E=="string")return Promise.reject(new Error("WebSocket text messages are forbidden by TLV v1"));let g=vt.getByteView(E);if(g)return Promise.resolve(g);if(E&&typeof E.arrayBuffer=="function"){let m;try{m=E.arrayBuffer()}catch(R){return Promise.reject(R)}return Promise.resolve(m).then(function(R){let C=vt.getByteView(R);if(!C)throw new Error("WebSocket Blob did not resolve to binary data");return C})}return Promise.reject(new Error("WebSocket message is not binary data"))}function wn(E){return E&&typeof E.status=="number"?{reason:typeof E.reason=="string"?E.reason:E.message||String(E.status),status:E.status}:{reason:E&&E.message?E.message:String(E||"unknown error"),status:200999}}function wt(E){return{reason:E,status:200999}}function ai(E){let g=wn(E);return{_tlvPayload:{reason:g.reason,status:g.status},mtype:2,ss:1}}function Wt(E){if(E instanceof vt.Int64Value)return new ui.Int64(E.toString());if(Array.isArray(E))return E.map(Wt);if(vt.isPlainMap(E)){let g={};return Object.keys(E).forEach(function(m){g[m]=Wt(E[m])}),g}return E}fi.exports=sr});var vn=Ye((Ru,li)=>{"use strict";var Ho={close:!0,constructor:!0,destroy:!0,emit:!0,listenerCount:!0,off:!0,on:!0,removeEvent:!0,startAutoReconnect:!0};function Go(E,g){let m={};return Object.getOwnPropertyNames(g).forEach(function(R){if(Ho[R]||R.charAt(0)==="_")return;let C=g[R];if(typeof C!="function")return;let O=R==="login"?2:C.length-1;O<0||Object.defineProperty(m,R,{configurable:!1,enumerable:!0,writable:!1,value:function(){let P=Array.prototype.slice.call(arguments);if(R==="login"){if(P.length>3)return Promise.reject(new TypeError("promises.login(uid, credential, timeout?)"));let S=P.length>2?P[2]:void 0;return P.length=2,new Promise(function(I,N){P.push(function(B,L){if(B instanceof Error)N(B);else if(B)I({accepted:!0,errorCode:L||0});else{let j=new Error("RTM login rejected ("+String(L)+")");j.code=L,j.status=L,N(j)}},S),ci(E,R,P,N)})}if(P.length>O)return Promise.reject(new TypeError("Do not pass a callback to promises."+R+"()"));let T=R==="textCheck"&&P.length===2&&typeof P[1]=="number"?2:O;for(;P.length<T;)P.push(void 0);return new Promise(function(S,I){P.push(function(N,B){N?I(N):S(B)}),ci(E,R,P,I)})}})}),Object.freeze(m)}function ci(E,g,m,R){try{E[g].apply(E,m)}catch(C){R(C)}}li.exports=Go});var Rn=Ye((Cu,pi)=>{"use strict";function Wo(E){if(typeof E!="string"||E.length===0||E!==E.trim()||/[\s\\/?#@%]/.test(E))return!1;let g,m;if(E.charAt(0)==="["){let R=E.indexOf("]");if(R<0)return!1;g=E.slice(0,R+1);let C=E.slice(R+1);if(C){if(!/^:\d+$/.test(C))return!1;m=C.slice(1)}if(!/^\[[0-9a-f:.]+\]$/i.test(g))return!1}else{let R=E.indexOf(":");if(R>=0){if(E.indexOf(":",R+1)>=0||(g=E.slice(0,R),m=E.slice(R+1),!/^\d+$/.test(m)))return!1}else g=E}if(!g||m!==void 0&&(Number(m)<1||Number(m)>65535))return!1;if(typeof URL!="function")return Yo(g);try{let R=new URL("ws://"+E);if(R.protocol!=="ws:"||R.username||R.password||R.pathname!=="/"||R.search||R.hash||!R.hostname)return!1;if(g.charAt(0)==="[")return R.hostname.charAt(0)==="[";let C=R.hostname.replace(/\.$/,"");return!C||C.length>253?!1:C.split(".").every(function(O){return O.length>0&&O.length<=63&&/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(O)})}catch{return!1}}function Yo(E){if(E.charAt(0)==="[")return zo(E.slice(1,-1));let g=E.replace(/\.$/,"");return!g||g.length>253?!1:/^[0-9.]+$/.test(g)?di(g):g.split(".").every(function(m){return m.length>0&&m.length<=63&&/^[a-z0-9\u0080-\uFFFF](?:[a-z0-9\u0080-\uFFFF-]*[a-z0-9\u0080-\uFFFF])?$/i.test(m)})}function di(E){let g=E.split(".");return g.length===4&&g.every(function(m){return/^\d{1,3}$/.test(m)&&Number(m)<=255})}function zo(E){if(!E||E.indexOf(":")<0||E.indexOf(":::")>=0)return!1;if(E.indexOf(".")>=0){let R=E.lastIndexOf(":");if(R<0||!di(E.slice(R+1)))return!1;E=E.slice(0,R)+":0:0"}let g=E.indexOf("::");if(g>=0){if(E.indexOf("::",g+2)>=0)return!1;let R=E.slice(0,g).split(":").filter(Boolean),C=E.slice(g+2).split(":").filter(Boolean);return R.length+C.length<8&&R.concat(C).every(hi)}let m=E.split(":");return m.length===8&&m.every(hi)}function hi(E){return/^[0-9a-f]{1,4}$/i.test(E)}function Ko(E){if(typeof E!="string")return E;let g=/^(\[[^\]]+\]|[^:]+):13325$/.exec(E);return g?g[1]+":13321":E}pi.exports={isValidFpnnEndpoint:Wo,normalizeFpnnEndpoint:Ko}});var ar=Ye((Pu,gi)=>{"use strict";var{isValidFpnnEndpoint:Jo,normalizeFpnnEndpoint:Qo}=Rn();function Xo(E){let g=Object.assign({},E||{});if(g.protocol===void 0&&(g.protocol="fpnn"),g.protocol!=="fpnn"&&g.protocol!=="tlv-v1")throw new Error('options.protocol must be "fpnn" or "tlv-v1"');if(g.protocol==="fpnn"){let m=g.ssl_endpoint!==void 0,R=m?g.ssl_endpoint:Qo(g.endpoint);if(!Jo(R))throw new Error("FPNN requires options.endpoint or options.ssl_endpoint as host[:port], without a URL scheme or path");m||(g.endpoint=R)}else{let m=g.tlvEndpoint||g.tlv_endpoint;if(!m&&typeof g.endpoint=="string"&&/^wss?:\/\//i.test(g.endpoint)&&(m=g.endpoint),!m&&typeof g.ssl_endpoint=="string"&&/^wss?:\/\//i.test(g.ssl_endpoint)&&(m=g.ssl_endpoint),typeof m!="string"||!/^wss?:\/\//i.test(m))throw new Error("tlv-v1 requires options.tlvEndpoint as the deployment-provided ws:// or wss:// URL");g.tlvEndpoint=m}return g}gi.exports={normalizeClientOptions:Xo}});var qt=Ye((Ou,Ci)=>{"use strict";var Y=lt(),$o=Nn(),Zo=or(),ea=vn(),{fpnn:Le,md5:ta}=St(),{normalizeFpnnEndpoint:na}=Rn(),{normalizeClientOptions:ra}=ar();function ia(E){let g="ws://";return this._ssl&&(g="wss://"),g+E+"/service/websocket"}function yi(E){let g=Le.FPConfig.ERROR_CODE;return E===g.FPNN_EC_CORE_INVALID_CONNECTION||E===g.FPNN_EC_CORE_CONNECTION_CLOSED||E===g.FPNN_EC_CORE_UNKNOWN_ERROR||E===Y.ERROR_CODE.RTM_EC_API_FREQUENCY_LIMITED||E===Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR}function Ei(E,g){return!E&&!yi(g)}function sa(E,g){if(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this._baseClient!=null){let I=this._baseClient;this._baseClient=null,I.destroy()}this._protocol==="tlv-v1"?this._baseClient=new Zo({endpoint:this._tlvEndpoint,heartbeatIdleMs:this._tlvHeartbeatIdleMs,heartbeatTimeoutMs:this._tlvHeartbeatTimeoutMs,connectionTimeout:this._connectionTimeout,legacyMsgOptions:this._msgOptions,pushDedupTtlMs:this._pushDedupTtlMs,requestMetadata:this._requestMetadata,requestTimeout:this._requestTimeout,webSocketFactory:this._webSocketFactory}):this._baseClient=new Le.FPClient({endpoint:ia.call(this,this._endpoint),autoReconnect:!1,connectionTimeout:this._connectionTimeout,platformImpl:this._platformImpl});let m=this._baseClient,R=this,C=!1,O=!1,P=!1,T=!1;this._protocol==="tlv-v1"&&(this._canReconnect=this._autoReconnect);function S(I,N){P||(P=!0,E&&E(I,N))}m.on("close",function(){m===R._baseClient&&!O&&!T&&(T=!0,S(!1,Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION),R._protocol==="tlv-v1"&&bi.call(R))}),m.on("error",function(I){m===R._baseClient&&(O||rt.call(R,I),C||S(!1,Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION))}),m.on("connect",function(){m===R._baseClient&&(C||(C=!0,R._requireClose=!1,oa.call(R,function(I,N){if(I)O=!0;else if(R._protocol==="tlv-v1"&&Ei(I,N))R._canReconnect=!1;else if(R._protocol==="tlv-v1"&&!T&&m===R._baseClient){S(I,N),m.close();return}S(I,N)},g)))}),m.processor=this._processor,m.connect()}function oa(E,g){let m=this._baseClient;if(!m){E&&E(!1,Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION);return}let R={pid:this._pid,uid:this._uid,token:this._token,version:this._clientVersion||"WebSocket_"+Y.SDK_VERSION};this._attrs&&(R.attrs=this._attrs),this._protocol==="tlv-v1"&&(this._authSec!==void 0&&(R.ts=this._authSec),this._authVer!==void 0&&(R.authv=this._authVer),this._locale!==void 0&&(R.lang=this._locale));let C={flag:1,method:"auth",payload:Y.MsgPack.encode(R,this._msgOptions)},O=this;fe.call(this,m,C,function(P,T){if(m!==O._baseClient)return;let S=T&&(O._protocol==="tlv-v1"?T.accepted:T.ok);if(S){O._reconnectTimeout&&(clearTimeout(O._reconnectTimeout),O._reconnectTimeout=0),O._reconnectCount=0,O._reconnectInterval=0,O._canReconnect=!0,m.on("close",function(){m===O._baseClient&&bi.call(O)}),m.on("error",function(N){m===O._baseClient&&rt.call(O,N)}),O._protocol==="tlv-v1"?m.markAuthenticated():(O._lastPingTime=parseInt(Date.now()/1e3),O._checkLastPingTimerID=setInterval(function(){parseInt(Date.now()/1e3)-O._lastPingTime>=O._maxPingIntervalSeconds&&(rt.call(O,new Le.FPError(Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,Error("Close connection for no ping, start reconnect"))),O.startAutoReconnect())},O._maxPingIntervalSeconds*1e3/2)),E&&E(!0,Le.FPConfig.ERROR_CODE.FPNN_EC_OK);return}let I=!1;if(T&&!S){let N=O._protocol==="tlv-v1"?Y.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN:Le.FPConfig.ERROR_CODE.FPNN_EC_OK;E&&E(!1,N),O._protocol==="tlv-v1"&&rt.call(O,new Le.FPError(N,new Error("Gate rejected auth.login (accepted=false)")))}P&&(E&&E(!1,P.code),rt.call(O,P),I=O._protocol==="tlv-v1"?yi(P.code):!!O._reconnectTimeout),I||(O._reconnectTimeout&&(clearTimeout(O._reconnectTimeout),O._reconnectTimeout=0),O._reconnectCount=0,O._reconnectInterval=0)},g)}function bi(){if(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this._requireClose){this.emit("SessionClosed",Le.FPConfig.ERROR_CODE.FPNN_EC_OK),this._reconnectCount=0,this._reconnectInterval=0,this._canReconnect=!1;return}if(!this._autoReconnect){this.emit("SessionClosed",Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR),this._reconnectCount=0,this._reconnectInterval=0,this._canReconnect=!1;return}rt.call(this,new Le.FPError(Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR,new Error("connection closed, requireClose: "+this._requireClose))),wi.call(this)}function wi(){if(this._requireClose||!this._canReconnect||this._reconnectTimeout)return;let E=0;this._reconnectCount>=this._regressiveStrategy.startConnectFailedCount&&(E=this._reconnectInterval+this._regressiveStrategy.maxIntervalSeconds*1e3/this._regressiveStrategy.linearRegressiveCount,E>this._regressiveStrategy.maxIntervalSeconds*1e3&&(E=this._regressiveStrategy.maxIntervalSeconds*1e3),this._reconnectInterval=E),this._reconnectCount+=1;let g=this._reconnectCount,m=this;this._reconnectTimeout=setTimeout(function(){m._reconnectTimeout=0;let R=m._protocol==="tlv-v1"?void 0:E;m.login(m._uid,m._token,function(C,O){O==Le.FPConfig.ERROR_CODE.FPNN_EC_OK?C?(m.emit("ReloginCompleted",!0,!1,Le.FPConfig.ERROR_CODE.FPNN_EC_OK,g),rt.call(m,new Le.FPError(Le.FPConfig.ERROR_CODE.FPNN_EC_OK,new Error("relogin successfully, reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0):(m.emit("ReloginCompleted",!1,!1,Y.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN,g),m.emit("SessionClosed",Y.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN),rt.call(m,new Le.FPError(Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("relogin fail, token error, reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0,m._canReconnect=!1):m._protocol==="tlv-v1"&&Ei(C,O)?(m.emit("ReloginCompleted",!1,!1,O,g),m.emit("SessionClosed",O),rt.call(m,new Le.FPError(O,new Error("relogin terminal auth failure, errorCode: "+O+", reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0,m._canReconnect=!1):(m.emit("ReloginCompleted",!1,!0,O,g),m._protocol!=="tlv-v1"&&wi.call(m),rt.call(m,new Le.FPError(Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("relogin fail, errorCode: "+O+", reconnectCount: "+g))))},R)},E)}function rt(E){this.emit("ErrorRecorder",E)}function _i(E){return this._md5?this._md5(E).toUpperCase():ta(E).toUpperCase()}function ur(E,g,m,R,C){let O=this;(!m||m.toString()=="0")&&(m=Ri.call(this)),vi.call(O,E,function(P,T){if(P){R&&R({mid:m,error:P},null);return}let S=T.token,I=T.endpoint,N=null;if(g!=null&&g.name!==void 0){let L=g.name.lastIndexOf(".");L!=-1&&(N=g.name.slice(L+1))}if(!S||!I){R&&R({mid:m,error:new Le.FPError(Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error(JSON.stringify(T)))},null);return}let B=new FileReader;B.onload=function(L){let j=Buffer.from(L.target.result);if(console.log("content:"),console.log(j.length),!j){R&&R({mid:m,error:new Le.FPError(Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("no file content!"))},null);return}let V=_i.call(O,j).toLowerCase(),H=_i.call(O,V+":"+S).toLowerCase(),z=O._endpoint.split(":");var Q="ws://fileproxy-"+z[0]+":13461/service/websocket";O._ssl&&(Q="wss://fileproxy-"+z[0]+":13462/service/websocket");let Z=new Le.FPClient({endpoint:Q,autoReconnect:!1,connectionTimeout:C,platformImpl:O._platformImpl});Z.on("close",function(){}),Z.on("error",function(ie){let oe=Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;ie.code!==void 0&&(oe=ie.code),rt.call(O,new Le.FPError(oe,ie))}),Z.on("connect",function(){let ie={token:S,sign:H,ext:N,file:j,endpoint:I};for(let oe in E)ie[oe]=E[oe];aa.call(O,Z,ie,m,R,C)}),Z.connect()},B.readAsArrayBuffer(g)})}function vi(E,g,m){let R={};for(let O in E)O!="mtype"&&(R[O]=E[O]);let C={flag:1,method:"filetoken",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,g,m)}function aa(E,g,m,R,C){let O={pid:this._pid,from:this._uid,mid:m,endpoint:g.endpoint};for(let T in g){if(T=="sign"){O.attrs=JSON.stringify({rtm:{sign:g.sign,ext:g.ext}});continue}T!="ext"&&T!="cmd"&&(O[T]=g[T])}let P={flag:1,method:g.cmd,payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,E,P,function(T,S){if(E.destroy(),T){R&&R({mid:O.mid,error:T},null);return}S.mtime!==void 0&&(S.mtime=new Y.Int64(""+S.mtime)),R&&R(null,{mid:O.mid,payload:S})},C)}function Ri(){++this._midSeq>=999&&(this._midSeq=0);let E=this._midSeq.toString();return this._midSeq<100&&(E="0"+E),this._midSeq<10&&(E="0"+E),new Y.Int64(Date.now().toString()+E)}function Cn(E){return this._protocol==="tlv-v1"?E??0:!E||E.toString()=="0"?Ri.call(this):E}function mi(E,g,m){let R=typeof E=="boolean";return R?typeof g=="function"&&m===void 0&&(m=g,g=void 0):typeof g=="function"&&m===void 0?(m=g,g=E):g===void 0&&(typeof E=="function"&&m===void 0?m=E:E!==void 0&&(g=E)),{value:R?E:void 0,provided:R,timeout:g,callback:m}}function fr(E,g){if(!g)return new Le.FPError(Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,Error("data is null"));if(g instanceof Error){let m=Y.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;return g.code!==void 0&&(m=g.code),new Le.FPError(m,g)}if(E){if(g.hasOwnProperty("code")&&g.hasOwnProperty("ex"))return new Le.FPError(g.code,new Error(g.ex));if(g.hasOwnProperty("status")&&g.hasOwnProperty("reason")){let m=new Le.FPError(g.status,new Error(g.reason));return m.status=g.status,m.reason=g.reason,m}}return null}function fe(E,g,m,R,C=!1){let O=this;if(!E){m&&m(new Le.FPError(Le.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION,Error("invalid connection")),null);return}E.sendQuest(g,function(P){if(!m)return;let T=null,S=!1;if(P&&Object.prototype.hasOwnProperty.call(P,"_tlvPayload")){if(P.mtype==2&&(S=P.ss!=0),T=fr.call(O,S,P._tlvPayload),T){m&&m(T,null);return}m&&m(null,P._tlvPayload);return}if(P&&P.payload){let I=null;if(C?I=Y.MsgPack.decode(P.payload,O._binaryOptions):I=Y.MsgPack.decode(P.payload,O._msgOptions),P.mtype==2&&(S=P.ss!=0),T=fr.call(O,S,I),T){m&&m(T,null);return}m&&m(null,I);return}if(T=fr.call(O,S,P),T){m&&m(T,null);return}m&&m(null,P)},R)}function ct(E){if(typeof E=="string")return E;try{return new TextDecoder("utf-8",{fatal:!0}).decode(E)}catch{return}}function ua(E,g){let m=E&&E.msgs;return m&&m.forEach(function(R,C){let O={id:new Y.Int64(""+R[0]),mtype:Number(R[2]),mid:new Y.Int64(""+R[3]),deleted:R[4],msg:ct(R[5]),binary:R[5],attrs:ct(R[6]),mtime:new Y.Int64(""+R[7])};g?O.direction=Number(R[1]):O.from=new Y.Int64(""+R[1]),m[C]=O}),E}var cr=class E{constructor(g){if(g=ra(g),Le.FPEvent.assign(this),this._protocol=g.protocol,this._endpoint=g.endpoint,this._pid=g.pid,this._attrs=g.attrs,this._autoReconnect=g.autoReconnect!==void 0?g.autoReconnect:!0,this._connectionTimeout=g.connectionTimeout||30*1e3,this._maxPingIntervalSeconds=Y.MAX_PING_SECONDS,this._platformImpl=void 0,this._requestMetadata=g.requestMetadata||g.requestMetadataProvider,this._requestTimeout=g.requestTimeout||20*1e3,this._tlvHeartbeatIdleMs=g.tlvHeartbeatIdleMs||30*1e3,this._tlvHeartbeatTimeoutMs=g.tlvHeartbeatTimeoutMs||10*1e3,this._pushDedupTtlMs=g.pushDedupTtlMs||30*1e3,this._webSocketFactory=g.webSocketFactory,this._authSec=g.authSec,this._authVer=g.authVer,this._locale=g.locale,this._clientVersion=g.clientVersion,g.maxPingIntervalSeconds!==void 0&&(this._maxPingIntervalSeconds=g.maxPingIntervalSeconds),this._lastPingTime=0,this._checkLastPingTimerID=0,this._regressiveStrategy={startConnectFailedCount:3,maxIntervalSeconds:8,linearRegressiveCount:4},g.regressiveStrategy!==void 0&&g.regressiveStrategy.startConnectFailedCount!==void 0&&g.regressiveStrategy.maxIntervalSeconds!==void 0&&g.regressiveStrategy.linearRegressiveCount!==void 0&&(this._regressiveStrategy.startConnectFailedCount=g.regressiveStrategy.startConnectFailedCount,this._regressiveStrategy.maxIntervalSeconds=g.regressiveStrategy.maxIntervalSeconds,this._regressiveStrategy.linearRegressiveCount=g.regressiveStrategy.linearRegressiveCount),this._canReconnect=!1,this._reconnectCount=0,this._reconnectInterval=0,this._ssl=!1,this._protocol==="tlv-v1")this._tlvEndpoint=g.tlvEndpoint;else{let C=g.ssl_endpoint!==void 0,O=C?g.ssl_endpoint:g.endpoint;this._endpoint=C?O:na(O),this._ssl=C}g.platformImpl!==void 0&&(this._platformImpl=g.platformImpl),this._md5=g.md5||null,this._midSeq=0,this._saltSeq=0,this._baseClient=null,this._reconnectTimeout=0,this._requireClose=!1,this._msgOptions={codec:Y.MsgPack.createCodec({int64:!0})},this._binaryOptions={codec:Y.MsgPack.createCodec({int64:!0,useraw:!0})};let m=this;this._processor=new $o(this);let R=function(){m._requireClose=!0,m._canReconnect=!1,m._protocol!=="tlv-v1"&&m._baseClient&&m._baseClient.close()};this._processor.on(Y.SERVER_PUSH.kickOut,R),this._processor.on(Y.TLV_SERVER_PUSH.kickOut,R),this.promises=ea(this,E.prototype)}get processor(){return this._processor}login(g,m,R,C){this._uid=g,this._token=m,this._processor&&(this._processor.uid=this._uid),sa.call(this,R,C)}bye(g,m){typeof g=="function"&&(m=g,g=void 0);let R={},C={flag:1,method:"bye",payload:Y.MsgPack.encode(R,this._msgOptions)},O=this;this._requireClose=!0,fe.call(this,this._baseClient,C,function(P,T){O._protocol==="tlv-v1"?P&&(rt.call(O,P),O._baseClient&&O._baseClient.close()):O._baseClient&&O._baseClient.close(),m&&m(P||null,T)},g)}getServerTime(g,m){let R={flag:1,method:"getservertime",payload:Y.MsgPack.encode({},this._msgOptions)};fe.call(this,this._baseClient,R,function(C,O){if(C){m&&m(C,null);return}O&&O.mts!==void 0&&(O.mts=new Y.Int64(""+O.mts)),m&&m(null,O)},g)}close(){this._requireClose=!0,this._baseClient&&this._baseClient.close()}startAutoReconnect(){this._requireClose=!1,this._baseClient&&this._baseClient.close()}destroy(){this.close(),this._midSeq=0,this._saltSeq=0,this._processor&&(this._processor.destroy(),this._processor=null),this._baseClient&&(this._baseClient.destroy(),this._baseClient=null),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this.removeEvent()}sendMessage(g,m,R,C,O,P,T){O=Cn.call(this,O);let S={to:g,mid:O,mtype:m,msg:R,attrs:C},I={flag:1,method:"sendmsg",payload:this._protocol==="tlv-v1"?S:Y.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,I,function(B,L){if(B){T&&T(N?{message_ref:S.mid,error:B}:{mid:S.mid,error:B},null);return}!N&&L.mtime!==void 0&&(L.mtime=new Y.Int64(L.mtime)),T&&T(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},P)}sendMessages(g,m,R,C,O,P,T){O=Cn.call(this,O);let S={tos:g,mid:O,mtype:m,msg:R,attrs:C},I={flag:1,method:"sendmsgs",payload:this._protocol==="tlv-v1"?S:Y.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,I,function(B,L){if(B){T&&T(N?{message_ref:S.mid,error:B}:{mid:S.mid,error:B},null);return}!N&&L.mtime!==void 0&&(L.mtime=new Y.Int64(L.mtime)),T&&T(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},P)}sendGroupMessage(g,m,R,C,O,P,T){O=Cn.call(this,O);let S={gid:g,mid:O,mtype:m,msg:R,attrs:C},I={flag:1,method:"sendgroupmsg",payload:this._protocol==="tlv-v1"?S:Y.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,I,function(B,L){if(B){T&&T(N?{message_ref:S.mid,error:B}:{mid:S.mid,error:B},null);return}!N&&L.mtime!==void 0&&(L.mtime=new Y.Int64(L.mtime)),T&&T(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},P)}sendRoomMessage(g,m,R,C,O,P,T){O=Cn.call(this,O);let S={rid:g,mid:O,mtype:m,msg:R,attrs:C},I={flag:1,method:"sendroommsg",payload:this._protocol==="tlv-v1"?S:Y.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,I,function(B,L){if(B){T&&T(N?{message_ref:S.mid,error:B}:{mid:S.mid,error:B},null);return}!N&&L.mtime!==void 0&&(L.mtime=new Y.Int64(L.mtime)),T&&T(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},P)}getUnreadMessage(g,m,R,C){let O=mi(m,R,C);m=O.value,R=O.timeout,C=O.callback;let P={clear:g===void 0?!1:g};m!==void 0&&(P.gettime=m);let T={flag:1,method:"getunread",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,function(S,I){if(S){C&&C(S,null);return}let N=I.p2p;if(N){let L=[];N.forEach(function(j,V){L[V]=new Y.Int64(""+j)}),I.p2p=L}let B=I.group;if(B){let L=[];B.forEach(function(j,V){L[V]=new Y.Int64(""+j)}),I.group=L}C&&C(null,I)},R)}getP2PUnreadMessageNum(g,m,R,C,O){let P={uids:g};m!==void 0&&(P.mtime=m),R!==void 0&&(P.mtypes=R);let T={flag:1,method:"getp2punread",payload:Y.MsgPack.encode(P,this._msgOptions)},S=this._protocol==="tlv-v1";fe.call(this,this._baseClient,T,function(I,N){if(I){O&&O(I,null);return}if(S){O&&O(null,N);return}let B={};B.p2p={},B.ltime={};let L=N.p2p;if(L)for(var j in L)B.p2p[new Y.Int64(""+j)]=L[j];let V=N.ltime;if(V)for(var j in V)B.ltime[new Y.Int64(""+j)]=new Y.Int64(""+V[j]);O&&O(null,B)},C)}getGroupUnreadMessageNum(g,m,R,C,O){let P={gids:g};m!==void 0&&(P.mtime=m),R!==void 0&&(P.mtypes=R);let T={flag:1,method:"getgroupunread",payload:Y.MsgPack.encode(P,this._msgOptions)},S=this._protocol==="tlv-v1";fe.call(this,this._baseClient,T,function(I,N){if(I){O&&O(I,null);return}if(S){O&&O(null,N);return}let B={};B.group={},B.ltime={};let L=N.group;if(L)for(var j in L)B.group[new Y.Int64(""+j)]=L[j];let V=N.ltime;if(V)for(var j in V)B.ltime[new Y.Int64(""+j)]=new Y.Int64(""+V[j]);O&&O(null,B)},C)}cleanUnreadMessage(g,m){let R={},C={flag:1,method:"cleanunread",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}setSessionRead(g,m,R,C,O){let P={category:g,xid:m,read_seq:R},T={flag:1,method:"setsessionread",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}getSession(g,m){let R={},C={flag:1,method:"getsession",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,function(O,P){if(O){m&&m(O,null);return}let T=P.p2p;if(T){let I=[];T.forEach(function(N,B){I[B]=new Y.Int64(""+N)}),P.p2p=I}let S=P.group;if(S){let I=[];S.forEach(function(N,B){I[B]=new Y.Int64(""+N)}),P.group=I}m&&m(null,P)},g)}getGroupMessage(g,m,R,C,O,P,T,S,I){let N={gid:g,desc:m,num:R};C!==void 0&&(N.begin=C),O!==void 0&&(N.end=O),P!==void 0&&(N.lastid=P),T!==void 0&&(N.mtypes=T);let B={flag:1,method:"getgroupmsg",payload:Y.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,B,function(L,j){if(L){I&&I(L,null);return}let V=j.msgs;V&&V.forEach(function(H,z){let Q=H[5],Z=ct(H[5]),ie=ct(H[6]);V[z]={id:new Y.Int64(""+H[0]),from:new Y.Int64(""+H[1]),mtype:Number(H[2]),mid:new Y.Int64(""+H[3]),deleted:H[4],msg:Z,binary:Q,attrs:ie,mtime:new Y.Int64(""+H[7])}}),I&&I(null,j)},S,!0)}getRoomMessage(g,m,R,C,O,P,T,S,I){let N={rid:g,desc:m,num:R};C!==void 0&&(N.begin=C),O!==void 0&&(N.end=O),P!==void 0&&(N.lastid=P),T!==void 0&&(N.mtypes=T);let B={flag:1,method:"getroommsg",payload:Y.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,B,function(L,j){if(L){I&&I(L,null);return}let V=j.msgs;V&&V.forEach(function(H,z){let Q=H[5],Z=ct(H[5]),ie=ct(H[6]);V[z]={id:new Y.Int64(""+H[0]),from:new Y.Int64(""+H[1]),mtype:Number(H[2]),mid:new Y.Int64(""+H[3]),deleted:H[4],msg:Z,binary:Q,attrs:ie,mtime:new Y.Int64(""+H[7])}}),I&&I(null,j)},S,!0)}getBroadcastMessage(g,m,R,C,O,P,T,S){let I={desc:g,num:m};R!==void 0&&(I.begin=R),C!==void 0&&(I.end=C),O!==void 0&&(I.lastid=O),P!==void 0&&(I.mtypes=P);let N={flag:1,method:"getbroadcastmsg",payload:Y.MsgPack.encode(I,this._msgOptions)};fe.call(this,this._baseClient,N,function(B,L){if(B){S&&S(B,null);return}let j=L.msgs;j&&j.forEach(function(V,H){let z=V[5],Q=ct(V[5]),Z=ct(V[6]);j[H]={id:new Y.Int64(""+V[0]),from:new Y.Int64(""+V[1]),mtype:Number(V[2]),mid:new Y.Int64(""+V[3]),deleted:V[4],msg:Q,binary:z,attrs:Z,mtime:new Y.Int64(""+V[7])}}),S&&S(null,L)},T,!0)}getP2PMessage(g,m,R,C,O,P,T,S,I){let N={ouid:g,desc:m,num:R};C!==void 0&&(N.begin=C),O!==void 0&&(N.end=O),P!==void 0&&(N.lastid=P),T!==void 0&&(N.mtypes=T);let B={flag:1,method:"getp2pmsg",payload:Y.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,B,function(L,j){if(L){I&&I(L,null);return}let V=j.msgs;V&&V.forEach(function(H,z){let Q=H[5],Z=ct(H[5]),ie=ct(H[6]);V[z]={id:new Y.Int64(""+H[0]),direction:Number(H[1]),mtype:Number(H[2]),mid:new Y.Int64(""+H[3]),deleted:H[4],msg:Z,binary:Q,attrs:ie,mtime:new Y.Int64(""+H[7])}}),I&&I(null,j)},S,!0)}getP2PMessageByMessageId(g,m,R,C,O,P,T,S,I){let N={ouid:g,mid:m,desc:R,num:C};O!==void 0&&(N.begin=O),P!==void 0&&(N.end=P),T!==void 0&&(N.mtypes=T),this._getMessageByAnchor("getp2pmsgbymessageid",N,!0,S,I)}getGroupMessageByMessageId(g,m,R,C,O,P,T,S,I){let N={gid:g,mid:m,desc:R,num:C};O!==void 0&&(N.begin=O),P!==void 0&&(N.end=P),T!==void 0&&(N.mtypes=T),this._getMessageByAnchor("getgroupmsgbymessageid",N,!1,S,I)}getRoomMessageByMessageId(g,m,R,C,O,P,T,S,I){let N={rid:g,mid:m,desc:R,num:C};O!==void 0&&(N.begin=O),P!==void 0&&(N.end=P),T!==void 0&&(N.mtypes=T),this._getMessageByAnchor("getroommsgbymessageid",N,!1,S,I)}getBroadcastMessageByMessageId(g,m,R,C,O,P,T,S){let I={mid:g,desc:m,num:R};C!==void 0&&(I.begin=C),O!==void 0&&(I.end=O),P!==void 0&&(I.mtypes=P),this._getMessageByAnchor("getbroadcastmsgbymessageid",I,!1,T,S)}_getMessageByAnchor(g,m,R,C,O){let P={flag:1,method:g,payload:Y.MsgPack.encode(m,this._msgOptions)};fe.call(this,this._baseClient,P,function(T,S){if(T){O&&O(T,null);return}O&&O(null,ua(S,R))},C,!0)}getP2PMessageCount(g,m,R,C,O,P){this._getMessageCount("getp2pmsgcount",{ouid:g,begin:m,end:R,mtypes:C},O,P)}getGroupMessageCount(g,m,R,C,O,P){this._getMessageCount("getgroupmsgcount",{gid:g,begin:m,end:R,mtypes:C},O,P)}getRoomMessageCount(g,m,R,C,O,P){this._getMessageCount("getroommsgcount",{rid:g,begin:m,end:R,mtypes:C},O,P)}getBroadcastMessageCount(g,m,R,C,O){this._getMessageCount("getbroadcastmsgcount",{begin:g,end:m,mtypes:R},C,O)}_getMessageCount(g,m,R,C){let O={};Object.keys(m).forEach(function(T){m[T]!==void 0&&(O[T]=m[T])});let P={flag:1,method:g,payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}fileToken(g,m,R,C,O,P,T){let S={cmd:g};m!==void 0&&(S.tos=m),R!==void 0&&(S.to=R),C!==void 0&&(S.rid=C),O!==void 0&&(S.gid=O),vi.call(this,S,T,P)}addAttrs(g,m,R){let C={attrs:g},O={flag:1,method:"addattrs",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getAttrs(g,m){let R={},C={flag:1,method:"getattrs",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}addDebugLog(g,m,R,C){let O={msg:g,attrs:m},P={flag:1,method:"adddebuglog",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}addDevice(g,m,R,C){let O={apptype:g,devicetoken:m},P={flag:1,method:"adddevice",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}removeDevice(g,m,R){let C={devicetoken:g},O={flag:1,method:"removedevice",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}setTranslationLanguage(g,m,R){let C={lang:g},O={flag:1,method:"setlang",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}translate(g,m,R,C,O,P,T){let S={text:g,dst:R};m!==void 0&&(S.src=m),C!==void 0&&(S.type=C),O!==void 0&&(S.profanity=O);let I={flag:1,method:"translate",payload:Y.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,I,T,P)}profanity(g,m,R,C){let O={text:g};m!==void 0&&(O.classify=m);let P={flag:1,method:"profanity",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}textCheck(g,m,R,C){typeof m=="function"?(C=m,m=void 0,R=void 0):arguments.length<4&&typeof m=="number"&&(R===void 0||typeof R=="function")&&(C=typeof R=="function"?R:C,R=m,m=void 0);let O={text:g};m!==void 0&&(O.strategyId=m);let P={flag:1,method:"tcheck",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}imageCheck(g,m,R,C,O){let P={image:g,type:m};R!==void 0&&(P.strategyId=R);let T={flag:1,method:"icheck",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}audioCheck(g,m,R,C,O,P,T,S){let I={audio:g,type:m,lang:R};C!==void 0&&(I.codec=C),O!==void 0&&(I.srate=O),P!==void 0&&(I.strategyId=P);let N={flag:1,method:"acheck",payload:Y.MsgPack.encode(I,this._msgOptions)};fe.call(this,this._baseClient,N,S,T)}videoCheck(g,m,R,C,O,P){let T={video:g,type:m,videoName:R};C!==void 0&&(T.strategyId=C);let S={flag:1,method:"vcheck",payload:Y.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,S,P,O)}speech2Text(g,m,R,C,O,P,T){let S={audio:g,type:m,lang:R};C!==void 0&&(S.codec=C),O!==void 0&&(S.srate=O);let I={flag:1,method:"speech2text",payload:Y.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,I,T,P)}getGroupsOpenInfo(g,m,R){let C={gids:g},O={flag:1,method:"getgroupsopeninfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getRoomsOpenInfo(g,m,R){let C={rids:g},O={flag:1,method:"getroomsopeninfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getRoomMembers(g,m,R){let C={rid:g},O={flag:1,method:"getroommembers",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getRoomCount(g,m,R){let C={rids:g},O={flag:1,method:"getroomcount",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}addDevicePushOption(g,m,R,C,O){let P={type:g,xid:m};R!==void 0&&(P.mtypes=R);let T={flag:1,method:"addoption",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}removeDevicePushOption(g,m,R,C,O){let P={type:g,xid:m};R!==void 0&&(P.mtypes=R);let T={flag:1,method:"removeoption",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}getDevicePushOption(g,m){let R={},C={flag:1,method:"getoption",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}addFriends(g,m,R){let C={friends:g},O={flag:1,method:"addfriends",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}deleteFriends(g,m,R){let C={friends:g},O={flag:1,method:"delfriends",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getFriends(g,m){let R={},C={flag:1,method:"getfriends",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,function(O,P){if(O){m&&m(O,null);return}let T=P.uids;if(T){let S=[];T.forEach(function(I,N){S[N]=new Y.Int64(I)}),m&&m(null,S);return}m&&m(null,P)},g)}addGroupMembers(g,m,R,C){let O={gid:g,uids:m},P={flag:1,method:"addgroupmembers",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}deleteGroupMembers(g,m,R,C){let O={gid:g,uids:m},P={flag:1,method:"delgroupmembers",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getGroupMembers(g,m,R,C){let O={gid:g};m!==void 0&&(O.online=m);let P={flag:1,method:"getgroupmembers",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,function(T,S){if(T){C&&C(T,null);return}let I=S.uids;if(I){let B=[];I.forEach(function(L,j){B[j]=new Y.Int64(L)}),S.uids=B}let N=S.onlines;if(N){let B=[];N.forEach(function(L,j){B[j]=new Y.Int64(L)}),S.onlines=B}C&&C(null,S)},R)}getGroupCount(g,m,R,C){let O={gid:g};m!==void 0&&(O.online=m);let P={flag:1,method:"getgroupcount",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,function(T,S){if(T){C&&C(T,null);return}C&&C(null,S)},R)}getUserGroups(g,m){let R={},C={flag:1,method:"getusergroups",payload:Y.MsgPack.encode(R,this._msgOptions)},O=this._protocol==="tlv-v1"?"group_refs":"gids";fe.call(this,this._baseClient,C,function(P,T){if(P){m&&m(P,null);return}let S=T[O];if(S){let I=[];S.forEach(function(N,B){I[B]=new Y.Int64(N)}),m&&m(null,I);return}m&&m(null,T)},g)}enterRoom(g,m,R){let C={rid:g},O={flag:1,method:"enterroom",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}enterRooms(g,m,R){let C={rids:g},O={flag:1,method:"enterrooms",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}leaveRoom(g,m,R){let C={rid:g},O={flag:1,method:"leaveroom",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getUserRooms(g,m){let R={},C={flag:1,method:"getuserrooms",payload:Y.MsgPack.encode(R,this._msgOptions)},O=this._protocol==="tlv-v1"?"room_refs":"rooms";fe.call(this,this._baseClient,C,function(P,T){if(P){m&&m(P,null);return}let S=T[O];if(S){let I=[];S.forEach(function(N,B){I[B]=new Y.Int64(N)}),m&&m(null,I);return}m&&m(null,T)},g)}getUserRoomsAndLastMessage(g,m,R){let C={};g!==void 0&&(C.mtypes=g);let O={flag:1,method:"getuserroomsandlastmsg",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getOnlineUsers(g,m,R){let C={uids:g},O={flag:1,method:"getonlineusers",payload:Y.MsgPack.encode(C,this._msgOptions)},P=this._protocol==="tlv-v1"?"online_users":"uids";fe.call(this,this._baseClient,O,function(T,S){if(T){R&&R(T,null);return}let I=S[P];if(I){let N=[];I.forEach(function(B,L){N[L]=new Y.Int64(B)}),R&&R(null,N);return}R&&R(null,S)},m)}deleteMessage(g,m,R,C,O,P){let T={from:g,mid:m,xid:R,type:C},S={flag:1,method:"delmsg",payload:Y.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,S,P,O)}getMessage(g,m,R,C,O,P){let T={from:g,mid:m,xid:R,type:C},S={flag:1,method:"getmsg",payload:Y.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,S,function(I,N){if(I){P&&P(I,null);return}N.id!==void 0&&(N.id=new Y.Int64(""+N.id)),N.mtime!==void 0&&(N.mtime=new Y.Int64(""+N.mtime)),P&&P(null,N)},O,!0)}sendChat(g,m,R,C,O,P){this.sendMessage.call(this,g,Y.CHAT_TYPE.text,m,R,C,O,P)}sendAudio(g,m,R,C,O,P){this.sendMessage.call(this,g,Y.CHAT_TYPE.audio,m,R,C,O,P)}sendCmd(g,m,R,C,O,P){this.sendMessage.call(this,g,Y.CHAT_TYPE.cmd,m,R,C,O,P)}sendGroupChat(g,m,R,C,O,P){this.sendGroupMessage.call(this,g,Y.CHAT_TYPE.text,m,R,C,O,P)}sendGroupAudio(g,m,R,C,O,P){this.sendGroupMessage.call(this,g,Y.CHAT_TYPE.audio,m,R,C,O,P)}sendGroupCmd(g,m,R,C,O,P){this.sendGroupMessage.call(this,g,Y.CHAT_TYPE.cmd,m,R,C,O,P)}sendRoomChat(g,m,R,C,O,P){this.sendRoomMessage.call(this,g,Y.CHAT_TYPE.text,m,R,C,O,P)}sendRoomAudio(g,m,R,C,O,P){this.sendRoomMessage.call(this,g,Y.CHAT_TYPE.audio,m,R,C,O,P)}sendRoomCmd(g,m,R,C,O,P){this.sendRoomMessage.call(this,g,Y.CHAT_TYPE.cmd,m,R,C,O,P)}getGroupChat(g,m,R,C,O,P,T,S){this.getGroupMessage.call(this,g,m,R,C,O,P,[Y.CHAT_TYPE.text,Y.CHAT_TYPE.audio,Y.CHAT_TYPE.cmd],T,S)}getRoomChat(g,m,R,C,O,P,T,S){this.getRoomMessage.call(this,g,m,R,C,O,P,[Y.CHAT_TYPE.text,Y.CHAT_TYPE.audio,Y.CHAT_TYPE.cmd],T,S)}getP2PChat(g,m,R,C,O,P,T,S){this.getP2PMessage.call(this,g,m,R,C,O,P,[Y.CHAT_TYPE.text,Y.CHAT_TYPE.audio,Y.CHAT_TYPE.cmd],T,S)}getBroadcastChat(g,m,R,C,O,P,T){this.getBroadcastMessage.call(this,g,m,R,C,O,[Y.CHAT_TYPE.text,Y.CHAT_TYPE.audio,Y.CHAT_TYPE.cmd],P,T)}deleteChat(g,m,R,C,O,P){this.deleteMessage(g,m,R,C,O,P)}getChat(g,m,R,C,O,P){this.getMessage(g,m,R,C,O,P)}setUserInfo(g,m,R,C){let O={};g!==void 0&&(O.oinfo=g),m!==void 0&&(O.pinfo=m);let P={flag:1,method:"setuserinfo",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getUserInfo(g,m){let R={},C={flag:1,method:"getuserinfo",payload:Y.MsgPack.encode(R,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}getUserOpenInfo(g,m,R){let C={uids:g},O={flag:1,method:"getuseropeninfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}setGroupInfo(g,m,R,C,O){let P={gid:g};m!==void 0&&(P.oinfo=m),R!==void 0&&(P.pinfo=R);let T={flag:1,method:"setgroupinfo",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}getGroupInfo(g,m,R){let C={gid:g},O={flag:1,method:"getgroupinfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getGroupOpenInfo(g,m,R){let C={gid:g},O={flag:1,method:"getgroupopeninfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}setRoomInfo(g,m,R,C,O){let P={rid:g};m!==void 0&&(P.oinfo=m),R!==void 0&&(P.pinfo=R);let T={flag:1,method:"setroominfo",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}setRoomProfile(g,m,R,C,O,P,T){let S={rid:g};m!==void 0&&(S.oinfo=m),R!==void 0&&(S.pinfo=R),C!==void 0&&(S.name=C),O!==void 0&&(S.icon=O);let I={flag:1,method:"setroominfo",payload:Y.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,I,T,P)}getRoomInfo(g,m,R){let C={rid:g},O={flag:1,method:"getroominfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getRoomOpenInfo(g,m,R){let C={rid:g},O={flag:1,method:"getroomopeninfo",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}dataSet(g,m,R,C){let O={key:g,val:m},P={flag:1,method:"dataset",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}dataGet(g,m,R){let C={key:g},O={flag:1,method:"dataget",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}dataDelete(g,m,R){let C={key:g},O={flag:1,method:"datadel",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}addBlacks(g,m,R){let C={blacks:g},O={flag:1,method:"addblacks",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}deleteBlacks(g,m,R){let C={blacks:g},O={flag:1,method:"delblacks",payload:Y.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,O,R,m)}getBlacks(g,m){let R={},C={flag:1,method:"getblacks",payload:Y.MsgPack.encode(R,this._msgOptions)},O=this._protocol==="tlv-v1"?"blocked_users":"uids";fe.call(this,this._baseClient,C,function(P,T){if(P){m&&m(P,null);return}let S=T[O];if(S){let I=[];S.forEach(function(N,B){I[B]=new Y.Int64(""+N)}),m&&m(null,I);return}m&&m(null,T)},g)}sendFile(g,m,R,C,O,P){let T={to:m,mtype:g,cmd:"sendfile"};ur.call(this,T,R,C,P,O)}sendGroupFile(g,m,R,C,O,P){let T={gid:m,mtype:g,cmd:"sendgroupfile"};ur.call(this,T,R,C,P,O)}sendRoomFile(g,m,R,C,O,P){let T={rid:m,mtype:g,cmd:"sendroomfile"};ur.call(this,T,R,C,P,O)}getP2PConversationList(g,m,R,C){let O={};g!==void 0&&(O.mtime=g),m!==void 0&&(O.mtypes=m);let P={flag:1,method:"getp2pconversationlist",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getP2PUnreadConversationList(g,m,R,C){let O={};g!==void 0&&(O.mtime=g),m!==void 0&&(O.mtypes=m);let P={flag:1,method:"getp2punreadconversationlist",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getGroupConversationList(g,m,R,C){let O={};g!==void 0&&(O.mtime=g),m!==void 0&&(O.mtypes=m);let P={flag:1,method:"getgroupconversationlist",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getGroupUnreadConversationList(g,m,R,C){let O={};g!==void 0&&(O.mtime=g),m!==void 0&&(O.mtypes=m);let P={flag:1,method:"getgroupunreadconversationlist",payload:Y.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,C,R)}getUnreadConversationList(g,m,R,C,O){let P={};g!==void 0&&(P.clear=g),m!==void 0&&(P.mtime=m),R!==void 0&&(P.mtypes=R);let T={flag:1,method:"getunreadconversationlist",payload:Y.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,T,O,C)}removeSession(g,m,R,C){let O=mi(m,R,C),P=O.provided;m=P?O.value:!1,R=O.timeout,C=O.callback;let T={to:g};(this._protocol==="tlv-v1"||P)&&(T.oneway=m);let S={flag:1,method:"removesession",payload:Y.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,S,C,R)}};Ci.exports=cr});var lr=Ye((Tu,Pi)=>{"use strict";var{normalizeClientOptions:fa}=ar(),{normalizeFpnnEndpoint:ca}=Rn();function la(E){return E.protocol==="tlv-v1"?E.tlvEndpoint||E.tlv_endpoint||E.endpoint||E.ssl_endpoint:E.ssl_endpoint!==void 0?"wss://"+E.ssl_endpoint+"/service/websocket":"ws://"+ca(E.endpoint)+"/service/websocket"}Pi.exports={normalizeClientOptions:fa,sharedEndpoint:la}});var hr=Ye((Au,Oi)=>{"use strict";function ha(E){let g=new Set;function m(R,C){if(typeof R=="function")return C+" is a function; SharedWorker cannot preserve page-side function behavior";if(typeof R=="symbol")return C+" is a symbol and cannot be transferred to SharedWorker";if(typeof R=="bigint")return C+" is a bigint that cannot be compared safely between shared pages";if(typeof R=="number"&&!isFinite(R))return C+" is not a finite number and cannot be compared safely between shared pages";if(R==null||typeof R!="object")return null;if(g.has(R))return C+" contains a circular reference that cannot be compared safely between shared pages";let O,P;try{O=Array.isArray(R),P=Object.getPrototypeOf(R)}catch{return C+" cannot be inspected for SharedWorker transfer"}if(O?P!==Array.prototype:P!==Object.prototype&&P!==null)return C+" uses a custom object prototype; SharedWorker cannot preserve its behavior";let T;try{T=Object.getOwnPropertySymbols(R)}catch{return C+" cannot be inspected for SharedWorker transfer"}if(T.length)return C+" contains symbol-keyed data that cannot be transferred reliably";g.add(R);let S;try{S=Object.keys(R)}catch{return g.delete(R),C+" cannot be inspected for SharedWorker transfer"}for(let I=0;I<S.length;I+=1){let N=S[I],B;try{B=Object.getOwnPropertyDescriptor(R,N)}catch{return g.delete(R),C+"."+N+" cannot be inspected for SharedWorker transfer"}if(!B||B.get||B.set)return g.delete(R),C+"."+N+" uses an accessor that cannot be preserved in SharedWorker";let L=O?C+"["+N+"]":C+"."+N,j;try{j=R[N]}catch{return g.delete(R),L+" cannot be inspected for SharedWorker transfer"}let V=m(j,L);if(V)return g.delete(R),V}return g.delete(R),null}return m(E,"options")}Oi.exports={getSharedWorkerConfigFallbackReason:ha}});var dr=Ye((Su,Ti)=>{"use strict";var{Int64BE:da,Uint64BE:pa}=St();function ga(E){if(E==null)return null;if(!ma(E)||["direct","group","room"].indexOf(E.type)===-1)throw new Error('conversation.type must be "direct", "group", or "room"');let g=E.id,m;if(typeof g=="string")m=g;else if(typeof g=="number"&&_a(g))m=String(g);else if(typeof g=="bigint"||g&&(da.isInt64BE(g)||pa.isUint64BE(g)))m=g.toString();else throw new Error("conversation.id must be a positive int64 string, safe integer, or RTMConfig.Int64");if(!/^\d+$/.test(m)||/^0+$/.test(m))throw new Error("conversation.id must be a positive int64");if(m=m.replace(/^0+(?=\d)/,""),m.length>19||m.length===19&&m>"9223372036854775807")throw new Error("conversation.id exceeds the positive int64 range");return{type:E.type,id:m}}function _a(E){return Number.isSafeInteger?Number.isSafeInteger(E):isFinite(E)&&Math.floor(E)===E&&Math.abs(E)<=9007199254740991}function ma(E){if(E===null||typeof E!="object")return!1;let g=Object.getPrototypeOf(E);return g===Object.prototype||g===null}Ti.exports=ga});var pr=Ye((Mu,Mi)=>{"use strict";var Ai=lt(),Si={"tlv-v1":{},fpnn:{}};function It(E,g,m,R){g.forEach(function(C){Si[E][C]={type:m,field:R}})}var Pn=Ai.TLV_SERVER_PUSH;It("tlv-v1",[Pn.recvMessage],"direct","sender");It("tlv-v1",[Pn.recvGroupMessage],"group","group_ref");It("tlv-v1",[Pn.recvRoomMessage,Pn.kickOutRoom],"room","room_ref");var et=Ai.SERVER_PUSH;It("fpnn",[et.recvMessage,et.recvChat,et.recvAudio,et.recvCmd,et.recvFile],"direct","from");It("fpnn",[et.recvGroupMessage,et.recvGroupChat,et.recvGroupAudio,et.recvGroupCmd,et.recvGroupFile],"group","gid");It("fpnn",[et.recvRoomMessage,et.recvRoomChat,et.recvRoomAudio,et.recvRoomCmd,et.recvRoomFile,et.kickOutRoom],"room","rid");function ya(E,g,m,R){if(!E)return!0;let C=Si[g],O=C&&Object.prototype.hasOwnProperty.call(C,m)?C[m]:null;if(!O)return!0;let P=R&&R[O.field];return E.type===O.type&&String(P)===E.id}Mi.exports=ya});var mr=Ye((ku,Fi)=>{"use strict";var _r=qt(),xt=lt(),Ea=vn(),{Int64BE:ba,Uint64BE:wa}=St(),{normalizeClientOptions:va,sharedEndpoint:Ra}=lr(),{getSharedWorkerConfigFallbackReason:Ca}=hr(),ki=dr(),Pa=pr(),Yt="__rtmSharedWorkerType__",Oa="__rtmSharedWorkerCallback__",Ii=Aa(),Ta=5e3,Nt=class{constructor(g){let m=g||{};if(typeof SharedWorker>"u")throw new Error("RTMSharedWorkerClient requires browser SharedWorker support");let R=Sa(m.workerUrl),C=va(m.clientOptions);this._protocol=C.protocol;let O=Ca(C);if(O)throw new Error("RTMSharedWorkerClient cannot use "+O.replace(/^options/,"clientOptions")+"; use createClient() to run this configuration on the current page");let P=ki(m.conversation),T=m.workerName||(m.uid!==void 0&&m.uid!==null?Ni({pid:C.pid,uid:m.uid,protocol:C.protocol,endpoint:Ra(C),namespace:m.workerNamespace}):C.protocol==="fpnn"?"rtm-shared-worker:fpnn":"rtm-shared-worker"),S=m.idleShutdownTimeout===void 0?Ta:m.idleShutdownTimeout;if(!ka(S))throw new Error("RTMSharedWorkerClient idleShutdownTimeout must be a non-negative number");if(this._listeners=Object.create(null),this._processorListeners=Object.create(null),this._callbackSeq=0,this._callbacks=new Map,this._destroyed=!1,this._destroying=!1,this._failedError=null,this._conversation=P,this.promises=Ea(this,_r.prototype),this._pageWindow=typeof window<"u"&&window.addEventListener?window:null,this._pageHideListener=B=>{B&&B.persisted||this.destroy()},this._session={status:"idle",uid:null},this._readySettled=!1,this._readyPromise=new Promise((B,L)=>{this._resolveReady=B,this._rejectReady=L}),this._readyPromise.catch(function(){}),this._worker=new SharedWorker(R,T),this._worker.onerror=this._onWorkerError.bind(this),this._port=this._worker.port,this._pageWindow&&this._pageWindow.addEventListener("pagehide",this._pageHideListener),this._port.onmessage=this._onMessage.bind(this),this._port.onmessageerror=this._onMessageError.bind(this),typeof this._port.start=="function"&&this._port.start(),!this._post({type:"init",options:C,idleShutdownTimeout:S}))this._settleReady(new Error("Failed to initialize the RTM SharedWorker client")),this.destroy();else{let B=Ma(m.readyTimeout)?m.readyTimeout:1e4;this._readyTimer=setTimeout(()=>{let L=gr("Timed out waiting for the RTM SharedWorker to initialize","RTM_SHARED_WORKER_READY_TIMEOUT");this._failedError=L;let j=this._failPendingCallbacks(L);this._settleReady(L);try{this._emit(this._listeners,"SharedWorkerError",[L])}finally{this.destroy()}if(j)throw j.error},B)}let N=this;this.processor={on:function(B,L){return N._addListener(N._processorListeners,B,L),this},off:function(B,L){return N._removeListener(N._processorListeners,B,L),this},removeEvent:function(B,L){return arguments.length===0?N._processorListeners=Object.create(null):N._removeListener(N._processorListeners,B,L),this},emit:function(B){N._emit(N._processorListeners,B,Array.prototype.slice.call(arguments,1))},listenerCount:function(B){return(N._processorListeners[B]||[]).length}}}on(g,m){return this._addListener(this._listeners,g,m),this}off(g,m){return this._removeListener(this._listeners,g,m),this}emit(g){this._emit(this._listeners,g,Array.prototype.slice.call(arguments,1))}listenerCount(g){return(this._listeners[g]||[]).length}removeEvent(g,m){return arguments.length===0?this._listeners=Object.create(null):this._removeListener(this._listeners,g,m),this}whenReady(){return this._readyPromise.then(On)}getSharedSession(){return On(this._session)}loginIfNeeded(g,m,R){let C=this;return this.whenReady().then(function(){if(C._destroyed||C._destroying)throw new Error("RTMSharedWorkerClient has been destroyed");return new Promise(function(O,P){let T=++C._callbackSeq,S=function(B){B instanceof Error?P(B):O(B)};S.rejectOnDestroy=!0,C._callbacks.set(T,S);let I=Tn(g,C._callbacks,C);C._post({type:"login-if-needed",uid:I,credential:m,timeout:R,requestId:T})||(C._callbacks.delete(T),P(new Error("Failed to request shared RTM login")))})})}setConversation(g,m){let R=ki(g);if(this._destroyed||this._destroying){let C=new Error("RTMSharedWorkerClient has been destroyed");return typeof m=="function"&&m(C),this._emit(this._listeners,"SharedWorkerError",[C]),this}return this._conversation=R,typeof m=="function"&&m(null),this}destroy(){if(this._destroyed||this._destroying)return;this._destroying=!0;let g=null,m=null;try{this._settleReady(new Error("RTMSharedWorkerClient was destroyed before it became ready"));let R=new Error("RTMSharedWorkerClient was destroyed before the shared login completed");g=this._failPendingCallbacks(R)}finally{try{this._post({type:"detach"},!0)}catch(R){m=R}if(this._destroyed=!0,this._destroying=!1,this._callbacks.clear(),this._listeners=Object.create(null),this._processorListeners=Object.create(null),this._pageWindow&&this._pageHideListener)try{this._pageWindow.removeEventListener("pagehide",this._pageHideListener)}catch(R){m=m||R}this._pageWindow=null,this._pageHideListener=null,this._worker.onerror=null,this._port.onmessage=null,this._port.onmessageerror=null;try{this._port.close()}catch(R){m=m||R}}if(m)throw m;if(g)throw g.error}_addListener(g,m,R){typeof R=="function"&&(g[m]||(g[m]=[]),g[m].indexOf(R)===-1&&g[m].push(R))}_removeListener(g,m,R){if(g[m]){if(R===void 0){delete g[m];return}g[m]=g[m].filter(function(C){return C!==R}),g[m].length===0&&delete g[m]}}_emit(g,m,R){(g[m]||[]).slice().forEach(function(O){O.apply(null,R)})}_onMessage(g){let m=g&&g.data;if(!(!m||this._destroyed)){if(m.type==="callback"){let R=this._callbacks.get(m.callbackId);R&&(this._callbacks.delete(m.callbackId),R.apply(null,Ut(m.args,xt)));return}if(m.type==="event"){let R=Ut(m.args,xt);if(m.channel==="processor"&&!Pa(this._conversation,this._protocol,m.name,R[0]))return;this._emit(m.channel==="processor"?this._processorListeners:this._listeners,m.name,R);return}if(m.type==="login-result"){let R=this._callbacks.get(m.requestId);R&&(this._callbacks.delete(m.requestId),R(m.error?Ut(m.error,xt):m.result));return}if(m.type==="error"){let R=Ut(m.error,xt),C=null;if(m.requestId!==void 0){let O=this._callbacks.get(m.requestId);O&&(this._callbacks.delete(m.requestId),O(R))}else this._failedError=R,C=this._failPendingCallbacks(R);try{this._settleReady(R),this._emit(this._listeners,"SharedWorkerError",[R])}finally{m.fatal===!0&&this.destroy()}if(C)throw C.error;return}if(m.type==="ready"){let R=xi(m.session);this._session=R,this._settleReady(null,R),this._emit(this._listeners,"SharedWorkerReady",[R]);return}m.type==="session-state"&&(this._session=xi(m.session),this._emit(this._listeners,"SharedSessionState",[On(this._session)]))}}_onMessageError(g){let m=new Error("Failed to read a SharedWorker message");m.code="RTM_SHARED_WORKER_MESSAGE_ERROR",m.event=g,this._failedError=m;let R=this._failPendingCallbacks(m);this._settleReady(m);try{this._emit(this._listeners,"SharedWorkerError",[m])}finally{this.destroy()}if(R)throw R.error}_onWorkerError(g){let m=new Error(g&&g.message?"RTM SharedWorker failed to load: "+g.message:"RTM SharedWorker failed to load");m.code="RTM_SHARED_WORKER_LOAD_ERROR",g&&g.filename&&(m.filename=g.filename),g&&g.lineno&&(m.lineno=g.lineno),this._failedError=m;let R=this._failPendingCallbacks(m);this._settleReady(m);try{this._emit(this._listeners,"SharedWorkerError",[m])}finally{this.destroy()}if(R)throw R.error}_failPendingCallbacks(g){let m=this,R=null;return this._callbacks.forEach(function(C,O){if(!(typeof C.fail!="function"&&!C.rejectOnDestroy)){m._callbacks.delete(O);try{typeof C.fail=="function"?C.fail(g):C(g)}catch(P){R||(R={error:P})}}}),R}_invoke(g,m){if(this._destroyed||this._destroying){let O=gr("RTMSharedWorkerClient has been destroyed","RTM_SHARED_CLIENT_DESTROYED");Ui(g,m,O),this._emit(this._listeners,"SharedWorkerError",[O]);return}if(this._failedError){Ui(g,m,this._failedError);return}let R=this._callbackSeq;this._post({type:"invoke",method:g,args:Tn(m,this._callbacks,this,g)})||this._failCallbacksSince(R,this._failedError||gr("Failed to send request to RTM SharedWorker","RTM_SHARED_WORKER_POST_MESSAGE_ERROR"))}_failCallbacksSince(g,m){let R=this;this._callbacks.forEach(function(C,O){O<=g||(R._callbacks.delete(O),typeof C.fail=="function"&&C.fail(m))})}_post(g,m){let R=m&&g&&g.type==="detach";if((this._destroyed||this._destroying)&&!R||this._failedError&&!R)return!1;try{return this._port.postMessage(g),!0}catch(C){return this._emit(this._listeners,"SharedWorkerError",[C]),!1}}_settleReady(g,m){this._readySettled||(this._readySettled=!0,this._readyTimer!==void 0&&(clearTimeout(this._readyTimer),this._readyTimer=void 0),g?this._rejectReady(g):this._resolveReady(On(m)))}};function Ni(E){if(!E||typeof E!="object")throw new Error("createSharedWorkerName requires { pid, uid }");let g=E.pid===void 0||E.pid===null?"":String(E.pid).trim(),m=E.uid===void 0||E.uid===null?"":String(E.uid).trim();if(!g||!m)throw new Error("createSharedWorkerName requires non-empty pid and uid");let R=E.protocol===void 0?"fpnn":E.protocol;if(R!=="tlv-v1"&&R!=="fpnn")throw new Error('createSharedWorkerName protocol must be "tlv-v1" or "fpnn"');let C=[String(E.namespace===void 0||E.namespace===null?"":E.namespace),g,m,String(E.endpoint===void 0||E.endpoint===null?"":E.endpoint)];return R==="fpnn"&&C.unshift(R),"rtm-shared:"+C.map(function(P){let T=encodeURIComponent(P);return T.length+":"+T}).join("|")}Nt.createWorkerName=Ni;function xi(E){if(!E||typeof E!="object")return{status:"idle",uid:null};let g=["idle","connecting","authenticated"].indexOf(E.status)>=0?E.status:"idle";return{status:g,uid:g==="idle"||E.uid===void 0||E.uid===null?null:String(E.uid)}}function On(E){return{status:E.status,uid:E.uid}}Object.getOwnPropertyNames(_r.prototype).forEach(function(E){E==="constructor"||E==="destroy"||E.charAt(0)==="_"||Object.prototype.hasOwnProperty.call(Nt.prototype,E)||typeof Object.getOwnPropertyDescriptor(_r.prototype,E).value!="function"||Object.defineProperty(Nt.prototype,E,{configurable:!0,enumerable:!1,writable:!0,value:function(){return this._invoke(E,Array.prototype.slice.call(arguments))}})});function Aa(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.src)return document.currentScript.src;if(typeof document.getElementsByTagName=="function"){let E=document.getElementsByTagName("script");for(let g=0;g<E.length;g++){let m=E[g];if(m&&m.src&&/\/rtm(?:\.min)?\.js(?:[?#]|$)/i.test(m.src))return m.src}}return null}function Sa(E){if(E!=null&&E!==""){if(typeof E!="string")throw new Error("RTMSharedWorkerClient workerUrl must be a string");return E}if(!Ii)throw new Error("RTMSharedWorkerClient could not infer workerUrl; serve rtm.shared-worker.js next to the SDK script or provide workerUrl");let g;try{g=new URL("rtm.shared-worker.js",Ii)}catch{throw new Error("RTMSharedWorkerClient could not resolve rtm.shared-worker.js beside the SDK script; provide workerUrl")}if(typeof window<"u"&&window.location&&g.origin!==window.location.origin)throw new Error("RTMSharedWorkerClient default worker URL is cross-origin; serve rtm.shared-worker.js from this page origin or provide a same-origin workerUrl");return g.href}function Ma(E){return typeof E=="number"&&isFinite(E)&&E>0}function ka(E){return typeof E=="number"&&isFinite(E)&&E>=0}function Tn(E,g,m,R){if(typeof E=="function"){let C=++m._callbackSeq,O=function(){return E.apply(null,arguments)};return O.fail=function(P){R==="login"?E(!1,P.status||xt.ERROR_CODE.RTM_EC_UNKNOWN_ERROR):E(P,null)},g.set(C,O),{[Oa]:C}}if(E&&typeof E=="object"){if(ba.isInt64BE(E))return{[Yt]:"int64",value:E.toString()};if(wa.isUint64BE(E))return{[Yt]:"uint64",value:E.toString()};if(Array.isArray(E))return E.map(function(C){return Tn(C,g,m,R)});if(Bi(E)){let C={};return Object.keys(E).forEach(function(O){C[O]=Tn(E[O],g,m,R)}),C}}return E}function Ui(E,g,m){(g||[]).forEach(function(R){typeof R=="function"&&(E==="login"?R(!1,m.status||xt.ERROR_CODE.RTM_EC_UNKNOWN_ERROR):R(m,null))})}function gr(E,g){let m=new Error(E);return m.code=g,m}function Ut(E,g){if(Array.isArray(E))return E.map(function(R){return Ut(R,g)});if(!Bi(E))return E;if(E[Yt]==="int64")return g.Int64(E.value);if(E[Yt]==="uint64")return g.Uint64(E.value);if(E[Yt]==="error"){let R=new Error(E.message||"SharedWorker error");return R.name=E.name||"Error",E.code!==void 0&&(R.code=E.code),E.status!==void 0&&(R.status=E.status),E.reason!==void 0&&(R.reason=E.reason),E.stack&&(R.stack=E.stack),R}let m={};return Object.keys(E).forEach(function(R){m[R]=Ut(E[R],g)}),m}function Bi(E){if(E===null||typeof E!="object")return!1;let g=Object.getPrototypeOf(E);return g===Object.prototype||g===null}Fi.exports=Nt});var zi=Ye((Iu,Yi)=>{"use strict";var Fe=lt(),Ia=ir(),wr={login:"auth",bye:"bye",getServerTime:"getservertime",addAttrs:"addattrs",getAttrs:"getattrs",addDebugLog:"adddebuglog",getOnlineUsers:"getonlineusers",setUserInfo:"setuserinfo",getUserInfo:"getuserinfo",getUserOpenInfo:"getuseropeninfo",setTranslationLanguage:"setlang",dataSet:"dataset",dataGet:"dataget",dataDelete:"datadel",addBlacks:"addblacks",deleteBlacks:"delblacks",getBlacks:"getblacks",addGroupMembers:"addgroupmembers",deleteGroupMembers:"delgroupmembers",getGroupMembers:"getgroupmembers",getGroupCount:"getgroupcount",getUserGroups:"getusergroups",enterRoom:"enterroom",enterRooms:"enterrooms",leaveRoom:"leaveroom",getUserRooms:"getuserrooms",getRoomMembers:"getroommembers",getRoomCount:"getroomcount",setGroupInfo:"setgroupinfo",getGroupInfo:"getgroupinfo",getGroupOpenInfo:"getgroupopeninfo",getGroupsOpenInfo:"getgroupsopeninfo",setRoomInfo:"setroominfo",setRoomProfile:"setroominfo",getRoomInfo:"getroominfo",getRoomOpenInfo:"getroomopeninfo",getRoomsOpenInfo:"getroomsopeninfo",getUserRoomsAndLastMessage:"getuserroomsandlastmsg",sendMessage:"sendmsg",sendMessages:"sendmsgs",sendGroupMessage:"sendgroupmsg",sendRoomMessage:"sendroommsg",sendChat:"sendmsg",sendAudio:"sendmsg",sendCmd:"sendmsg",sendGroupChat:"sendgroupmsg",sendGroupAudio:"sendgroupmsg",sendGroupCmd:"sendgroupmsg",sendRoomChat:"sendroommsg",sendRoomAudio:"sendroommsg",sendRoomCmd:"sendroommsg",getUnreadMessage:"getunread",getP2PUnreadMessageNum:"getp2punread",getGroupUnreadMessageNum:"getgroupunread",cleanUnreadMessage:"cleanunread",setSessionRead:"setsessionread",getSession:"getsession",getGroupMessage:"getgroupmsg",getRoomMessage:"getroommsg",getBroadcastMessage:"getbroadcastmsg",getP2PMessage:"getp2pmsg",getGroupChat:"getgroupmsg",getRoomChat:"getroommsg",getBroadcastChat:"getbroadcastmsg",getP2PChat:"getp2pmsg",getP2PMessageByMessageId:"getp2pmsgbymessageid",getGroupMessageByMessageId:"getgroupmsgbymessageid",getRoomMessageByMessageId:"getroommsgbymessageid",getBroadcastMessageByMessageId:"getbroadcastmsgbymessageid",getP2PMessageCount:"getp2pmsgcount",getGroupMessageCount:"getgroupmsgcount",getRoomMessageCount:"getroommsgcount",getBroadcastMessageCount:"getbroadcastmsgcount",getMessage:"getmsg",getChat:"getmsg",deleteMessage:"delmsg",deleteChat:"delmsg",translate:"translate",textCheck:"tcheck",getP2PConversationList:"getp2pconversationlist",getP2PUnreadConversationList:"getp2punreadconversationlist",getGroupConversationList:"getgroupconversationlist",getGroupUnreadConversationList:"getgroupunreadconversationlist",getUnreadConversationList:"getunreadconversationlist",removeSession:"removesession"},Sn={sendMessage:4,sendMessages:4,sendGroupMessage:4,sendRoomMessage:4,sendChat:3,sendAudio:3,sendCmd:3,sendGroupChat:3,sendGroupAudio:3,sendGroupCmd:3,sendRoomChat:3,sendRoomAudio:3,sendRoomCmd:3,sendFile:3,sendGroupFile:3,sendRoomFile:3},qi=new Set(Object.keys(Sn)),xa={sendMessage:{values:[0,4]},sendMessages:{values:[4],arrays:[0]},sendGroupMessage:{values:[0,4]},sendRoomMessage:{values:[0,4]},getP2PUnreadMessageNum:{arrays:[0],values:[1]},getGroupUnreadMessageNum:{arrays:[0],values:[1]},setSessionRead:{values:[1,2]},getGroupMessage:{values:[0,3,4,5]},getRoomMessage:{values:[0,3,4,5]},getBroadcastMessage:{values:[2,3,4]},getP2PMessage:{values:[0,3,4,5]},getP2PMessageByMessageId:{values:[0,1,4,5]},getGroupMessageByMessageId:{values:[0,1,4,5]},getRoomMessageByMessageId:{values:[0,1,4,5]},getBroadcastMessageByMessageId:{values:[0,3,4]},getP2PMessageCount:{values:[0,1,2]},getGroupMessageCount:{values:[0,1,2]},getRoomMessageCount:{values:[0,1,2]},getBroadcastMessageCount:{values:[0,1]},getGroupsOpenInfo:{arrays:[0]},getRoomsOpenInfo:{arrays:[0]},getRoomMembers:{values:[0]},getRoomCount:{arrays:[0]},getGroupMembers:{values:[0]},getGroupCount:{values:[0]},addGroupMembers:{values:[0],arrays:[1]},deleteGroupMembers:{values:[0],arrays:[1]},enterRoom:{values:[0]},enterRooms:{arrays:[0]},leaveRoom:{values:[0]},getOnlineUsers:{arrays:[0]},getUserOpenInfo:{arrays:[0]},deleteMessage:{values:[0,1,2]},getMessage:{values:[0,1,2]},deleteChat:{values:[0,1,2]},getChat:{values:[0,1,2]},setGroupInfo:{values:[0]},getGroupInfo:{values:[0]},getGroupOpenInfo:{values:[0]},setRoomInfo:{values:[0]},setRoomProfile:{values:[0]},getRoomInfo:{values:[0]},getRoomOpenInfo:{values:[0]},addBlacks:{arrays:[0]},deleteBlacks:{arrays:[0]},sendChat:{values:[0,3]},sendAudio:{values:[0,3]},sendCmd:{values:[0,3]},sendGroupChat:{values:[0,3]},sendGroupAudio:{values:[0,3]},sendGroupCmd:{values:[0,3]},sendRoomChat:{values:[0,3]},sendRoomAudio:{values:[0,3]},sendRoomCmd:{values:[0,3]},getGroupChat:{values:[0,3,4,5]},getRoomChat:{values:[0,3,4,5]},getP2PChat:{values:[0,3,4,5]},getBroadcastChat:{values:[2,3,4]},getP2PConversationList:{values:[0]},getP2PUnreadConversationList:{values:[0]},getGroupConversationList:{values:[0]},getGroupUnreadConversationList:{values:[0]},getUnreadConversationList:{values:[1]},removeSession:{values:[0]}},Ua=new Set(["getGroupMessage","getRoomMessage","getBroadcastMessage","getP2PMessage","getGroupChat","getRoomChat","getBroadcastChat","getP2PChat","getP2PMessageByMessageId","getGroupMessageByMessageId","getRoomMessageByMessageId","getBroadcastMessageByMessageId"]),Na={getP2PMessage:"direct",getP2PChat:"direct",getP2PMessageByMessageId:"direct",getGroupMessage:"group",getGroupChat:"group",getGroupMessageByMessageId:"group",getRoomMessage:"room",getRoomChat:"room",getRoomMessageByMessageId:"room",getBroadcastMessage:"broadcast",getBroadcastChat:"broadcast",getBroadcastMessageByMessageId:"broadcast"},An={"event.direct":{category:"direct",id:"recipient",events:{message:Fe.SERVER_PUSH.recvMessage,file:Fe.SERVER_PUSH.recvFile,chat:Fe.SERVER_PUSH.recvChat,cmd:Fe.SERVER_PUSH.recvCmd}},"event.group":{category:"group",id:"group_ref",events:{message:Fe.SERVER_PUSH.recvGroupMessage,file:Fe.SERVER_PUSH.recvGroupFile,chat:Fe.SERVER_PUSH.recvGroupChat,cmd:Fe.SERVER_PUSH.recvGroupCmd}},"event.room":{category:"room",id:"room_ref",events:{message:Fe.SERVER_PUSH.recvRoomMessage,file:Fe.SERVER_PUSH.recvRoomFile,chat:Fe.SERVER_PUSH.recvRoomChat,cmd:Fe.SERVER_PUSH.recvRoomCmd}},"event.broadcast":{category:"broadcast",id:null,events:{message:Fe.SERVER_PUSH.recvBroadcastMessage,file:Fe.SERVER_PUSH.recvBroadcastFile,chat:Fe.SERVER_PUSH.recvBroadcastChat,cmd:Fe.SERVER_PUSH.recvBroadcastCmd}},"event.kicked":{category:"kicked",id:null,events:{message:Fe.SERVER_PUSH.kickOut}},"event.room_removed":{category:"room_removed",id:"room_ref",events:{message:Fe.SERVER_PUSH.kickOutRoom}}},Ba=new Set(Object.keys(An)),Fa=new Set([Fe.SERVER_PUSH.recvAudio,Fe.SERVER_PUSH.recvGroupAudio,Fe.SERVER_PUSH.recvRoomAudio,Fe.SERVER_PUSH.recvBroadcastAudio]),Ze=class extends Error{constructor(g,m){super(g),this.name="RTMCompatibilityError",this.code=m&&m.code||"RTM_COMPATIBILITY_MAPPING_FAILED",this.method=m&&m.method,this.protocol=m&&m.protocol,this.compatibility="legacy-rtm",m&&m.cause!==void 0&&(this.cause=m.cause)}};function Da(E){if(E===void 0)return"native";if(E==="native"||E==="legacy-rtm")return E;throw new TypeError('compatibility must be "native" or "legacy-rtm"')}function La(E,g){return E==="legacy-rtm"&&g==="tlv-v1"}function ja(E,g,m,R,C,O){let P=g.slice(),T=Va(P,C),S=T>=0?P[T]:null,I=Sn[E],N,B=!1,L;function j(){try{return S.apply(null,arguments)}catch(V){throw L=V,V}}if(!wr[E]){let V=new Ze('No TLV v1 equivalent for legacy RTM method "'+E+'".',{method:E,protocol:R,code:"RTM_COMPATIBILITY_UNSUPPORTED"});return yr(V,S,O)}qa(E,P);try{I!==void 0&&(N=Hi(P[I],E),P[I]=N)}catch(V){return yr(br(V,E,R),S,O)}S&&(P[T]=function(V,H){if(B)return;if(B=!0,V){j(Ha(E,V,N),null);return}let z;try{z=Vi(E,H,P,R)}catch(Q){let Z=br(Q,E,R);Ct(O,Z),j(Z,null);return}j(null,z)});try{return m[E].apply(m,P)}catch(V){if(L===V)throw V;if(S){if(B)return;if(B=!0,V instanceof Ze)return yr(V,S,O);S(V,null);return}throw V instanceof Ze&&typeof O=="function"&&O(V),V}}function qa(E,g){let m=xa[E];m&&((m.values||[]).forEach(R=>{R<g.length&&(g[R]=Di(g[R],E))}),(m.arrays||[]).forEach(R=>{R<g.length&&Array.isArray(g[R])&&(g[R]=g[R].map(C=>Di(C,E)))}))}function Di(E){if(typeof E!="string"||!/^-?\d+$/.test(E))return E;let g=E.charAt(0)==="-",m=(g?E.slice(1):E).replace(/^0+/,"")||"0",R=g?"9223372036854775808":"9223372036854775807";return m.length>R.length||m.length===R.length&&m>R?E:Fe.Int64(E)}function Va(E,g){if(g>=0&&typeof E[g]=="function")return g;for(let m=E.length-1;m>=0;m-=1)if(typeof E[m]=="function")return m;return-1}function yr(E,g,m){if(Ct(m,E),g){g(E,null);return}throw E}function Ha(E,g,m){if(!qi.has(E)||!g||typeof g!="object"||!Object.prototype.hasOwnProperty.call(g,"error"))return g;let R=Object.assign({},g);return delete R.message_ref,R.mid=m!==void 0?m:g.mid,R}function Vi(E,g,m,R){if(g==null)return g;if(qi.has(E))return Wa(E,g,m);let C=wr[E],O=C&&Ia.ROUTES[C],P=O&&O.response&&Pt(g)?Ga(E,g,O.response,R):g;if(!Pt(P))return P;if(P=Object.assign({},P),Ua.has(E)&&Array.isArray(P.msgs)){let T=Na[E];P.msgs=P.msgs.map(S=>Bt(S,T,E,R))}if((E==="getMessage"||E==="getChat")&&(P=Ja(P,E,R)),E==="getUserRoomsAndLastMessage"&&Pt(P.rooms)){let T={};Object.keys(P.rooms).forEach(S=>{T[S]=Bt(P.rooms[S],"room",E,R)}),P.rooms=T}if(E==="getP2PConversationList"||E==="getP2PUnreadConversationList"||E==="getGroupConversationList"||E==="getGroupUnreadConversationList"){let T=E.startsWith("getGroup")?"group":"direct";Array.isArray(P.msgs)&&(P.msgs=P.msgs.map(S=>Bt(S,T,E,R)))}return E==="getUnreadConversationList"&&(Array.isArray(P.p2pMsgs)&&(P.p2pMsgs=P.p2pMsgs.map(T=>Bt(T,"direct",E,R))),Array.isArray(P.groupMsgs)&&(P.groupMsgs=P.groupMsgs.map(T=>Bt(T,"group",E,R)))),P}function Ga(E,g,m,R){let C=Object.assign({},g);return Object.keys(m).forEach(O=>{let P=m[O];if(!(O===P||!Object.prototype.hasOwnProperty.call(C,P))){if(Object.prototype.hasOwnProperty.call(C,O))throw new Ze("Cannot map "+E+' response: both "'+O+'" and "'+P+'" are present.',{method:E,protocol:R});C[O]=C[P],delete C[P]}}),C}function Wa(E,g,m){let R=Hi(m[Sn[E]],E);if(g&&Object.prototype.hasOwnProperty.call(g,"error"))return{mid:R,error:g.error};if(!Pt(g))throw new Ze("Cannot map "+E+" result to the legacy RTM response shape.",{method:E,protocol:"tlv-v1"});let C=Pt(g.payload)?Object.assign({},g.payload):Object.assign({},g),O=g.message_ref!==void 0?g.message_ref:C.message_ref,P=C.time_ms;return delete C.message_ref,delete C.time_ms,P!==void 0&&(C.mtime=P),{mid:R||O,payload:C}}function Hi(E,g){return E!=null&&String(E)!==""&&!/^[+-]?0+$/.test(String(E))?E:Gi(g)}function Gi(E){let g=typeof globalThis<"u"?globalThis.crypto:null;if(!g||typeof g.getRandomValues!="function")throw new Ze("crypto.getRandomValues() is required to generate legacy RTM message IDs.",{method:E,protocol:"tlv-v1",code:"RTM_COMPATIBILITY_UNSUPPORTED"});let m=new Uint32Array(2);return g.getRandomValues(m),m[0]=m[0]&2147483647,m[0]===0&&m[1]===0&&(m[1]=1),Fe.Int64(Ya(m[0],m[1]))}function Ya(E,g){let m=[E>>>16,E&65535,g>>>16,g&65535],R="";for(;m.some(Boolean);){let C=0;for(let O=0;O<m.length;O+=1){let P=C*65536+m[O];m[O]=Math.floor(P/10),C=P%10}R=String(C)+R}return R||"0"}function za(E){return{validate:function(g){if(Ba.has(g)){let m=new Ze('legacy Push names only; use compatibility "native" to observe raw TLV Push names.',{method:"processor.on",protocol:"tlv-v1",code:"RTM_COMPATIBILITY_UNSUPPORTED"});throw Ct(E,m),m}if(g===Fe.SERVER_PUSH.recvPing){let m=new Ze("TLV has no server ping Push; the SDK heartbeat is internal.",{method:"processor.on",protocol:"tlv-v1",code:"RTM_COMPATIBILITY_UNSUPPORTED"});throw Ct(E,m),m}if(Fa.has(g)){let m=new Ze("Legacy RTM does not emit a dedicated audio event; subscribe to pushfile.",{method:"processor.on",protocol:"tlv-v1",code:"RTM_COMPATIBILITY_UNSUPPORTED"});throw Ct(E,m),m}if(g!=="CompatibilityError"&&!Li(g)){let m=new Ze('Unsupported legacy RTM Processor event "'+String(g)+'".',{method:"processor.on",protocol:"tlv-v1",code:"RTM_COMPATIBILITY_UNSUPPORTED"});throw Ct(E,m),m}},bind:function(g,m){if(g==="CompatibilityError")return{local:!0};let R=Li(g);return R?{type:R,callback:function(C){let O;try{O=Ka(R,C,g)}catch(P){Ct(E,br(P,"processor."+g,"tlv-v1"));return}O&&m(O)}}:null}}}function Ct(E,g){if(typeof E=="function")try{E(g)}catch{}}function Li(E){if(E===Fe.SERVER_PUSH.kickOut)return"event.kicked";if(E===Fe.SERVER_PUSH.kickOutRoom)return"event.room_removed";let g=Object.keys(An);for(let m=0;m<g.length;m+=1){let R=g[m],C=An[R];if(C&&C.events&&Object.keys(C.events).some(O=>C.events[O]===E))return R}return null}function Ka(E,g,m){let R=An[E];if(!R)return null;let C=Pt(g)?g:{};if(E==="event.kicked"||E==="event.room_removed"){let B={};return R.id&&C[R.id]!==void 0&&(B.rid=C[R.id]),m===Fe.SERVER_PUSH.kickOutRoom&&B.rid===void 0?null:B}let O=Number(zt(C.kind,"kind",m)),P="message";if(O===Fe.CHAT_TYPE.text?P="chat":O===Fe.CHAT_TYPE.cmd?P="cmd":(O===Fe.CHAT_TYPE.audio||O>=40&&O<=50)&&(P="file"),R.events[P]!==m)return null;let T=Ot(C.payload),S=vr(C.payload),I=O!==Fe.CHAT_TYPE.text,N={from:ut(C.sender,"sender",m),mtype:O,mid:ut(C.message_ref,"message_ref",m),msg:I?ji(C.payload):T,attrs:ji(C.extra),mtime:ut(C.time_ms,"time_ms",m)};return I&&S?N.binary=Wi(S):I&&C.binary!==void 0&&(N.binary=Ot(C.binary)),R.id&&C[R.id]!==void 0&&(N[R.category==="group"?"gid":R.category==="room"?"rid":"to"]=C[R.id]),N}function Bt(E,g,m,R){if(!Array.isArray(E)){if(!Pt(E))throw new Ze("Cannot map "+m+" history row: expected a tuple or message object.",{method:m,protocol:R});return Object.assign({},E)}if(E.length!==8)throw new Ze("Cannot map "+m+" history row: expected an 8-field tuple.",{method:m,protocol:R});let C={id:ut(E[0],"history.id",m,R),mtype:Number(zt(E[2],"history.kind",m,R)),mid:ut(E[3],"history.message_ref",m,R),deleted:E[4],msg:Er(E[5],Number(zt(E[2],"history.kind",m,R))),binary:Qa(E[5]),attrs:Er(E[6],0),mtime:ut(E[7],"history.time_ms",m,R)};return g==="direct"?C.direction=Number(zt(E[1],"history.direction",m,R)):C.from=ut(E[1],"history.sender",m,R),C}function Ja(E,g,m){let R=Object.assign({},E);return R.id!==void 0&&(R.id=ut(R.id,"id",g,m)),R.mid!==void 0&&(R.mid=ut(R.mid,"mid",g,m)),R.mtime!==void 0&&(R.mtime=ut(R.mtime,"mtime",g,m)),R.from!==void 0&&(R.from=ut(R.from,"from",g,m)),R.msg!==void 0&&(R.msg=Ot(R.msg)),R}function Er(E,g){if(typeof E=="string")return E;let m=vr(E);if(m)try{return typeof TextDecoder!="function"?void 0:new TextDecoder("utf-8",{fatal:!0}).decode(m)}catch{return}}function ji(E){if(typeof E=="string"||E===void 0||E===null)return E;let g=Er(E,0);return g===void 0?Ot(E):g}function Qa(E){return Ot(E)}function Ot(E,g){let m=vr(E);if(m)return Wi(m);if(E instanceof ArrayBuffer)return E.slice(0);if(!E||typeof E!="object"||E.buffer&&typeof E.offset=="number"&&typeof E.toString=="function")return E;let R=g||new Map;if(R.has(E))return R.get(E);if(Array.isArray(E)){let O=[];return R.set(E,O),E.forEach(P=>O.push(Ot(P,R))),O}let C=Object.create(Object.getPrototypeOf(E)===null?null:Object.prototype);return R.set(E,C),Object.keys(E).forEach(O=>{C[O]=Ot(E[O],R)}),C}function vr(E){return E instanceof ArrayBuffer?new Uint8Array(E):ArrayBuffer.isView(E)?new Uint8Array(E.buffer,E.byteOffset,E.byteLength):null}function Wi(E){return new Uint8Array(E)}function ut(E,g,m,R){let C=zt(E,g,m,R);return Fe.Int64(C)}function zt(E,g,m,R){if(E&&typeof E.toString=="function"){let C=E.toString();if(/^-?\d+$/.test(C))return C}if(typeof E=="number"&&Number.isSafeInteger(E))return String(E);throw new Ze("Cannot map "+m+": "+g+" is not an exact integer.",{method:m,protocol:R||"tlv-v1"})}function br(E,g,m){if(E instanceof Ze)return E;let R=new Ze("Failed to adapt legacy RTM "+g+" contract: "+(E&&E.message?E.message:String(E)),{method:g,protocol:m,cause:E,code:"RTM_COMPATIBILITY_MAPPING_FAILED"});return E&&E.stack&&(R.stack=E.stack+`
|
|
2
|
+
Caused by: `+R.stack),R}function Pt(E){if(!E||typeof E!="object"||Array.isArray(E))return!1;let g=Object.getPrototypeOf(E);return g===Object.prototype||g===null}Yi.exports={METHOD_ROUTES:wr,RTMCompatibilityError:Ze,SEND_MID_INDEX:Sn,adaptResult:Vi,createPushAdapter:za,generateMessageId:Gi,isEnabled:La,invoke:ja,toLegacyHistoryMessage:Bt,validateCompatibility:Da}});var Zi=Ye((xu,$i)=>{"use strict";var Mn=qt(),Ki=mr(),Rr=lt(),Xa=vn(),{normalizeClientOptions:Qi,sharedEndpoint:$a}=lr(),{getSharedWorkerConfigFallbackReason:Za}=hr(),Ji=dr(),eu=pr(),Kt=zi(),tu=["sharing","uid","conversation","workerName","workerUrl","workerNamespace","readyTimeout","idleShutdownTimeout","compatibility"],Jt=class{constructor(g,m){this._connectionInfo=Object.freeze(Object.assign({},m)),this._usesSharedWorker=this._connectionInfo.mode==="shared",this._config=Object.assign({},g),this._compatibility=Kt.validateCompatibility(g.compatibility),this._legacyTlv=Kt.isEnabled(this._compatibility,g.protocol),this._options=Qi(Xi(g)),this._config.conversation=Ji(g.conversation),this._delegate=null,this._delegateType=null,this._uid=null,this._session={status:"idle",uid:null},this._directLoginPromise=null,this._destroyed=!1,this._events=new kn,this.processor=new kn(this._legacyTlv?Kt.createPushAdapter(R=>this.processor.emit("CompatibilityError",R)):null),this.promises=nu(this),g.uid!==void 0&&g.uid!==null&&this._attach(g.uid)}_attach(g){if(this._assertActive(),typeof g=="number"&&(!isFinite(g)||Math.floor(g)!==g||Math.abs(g)>9007199254740991))throw Tt("Use a decimal string for a UID outside the safe integer range","RTM_SHARED_UID_INVALID");let m=g==null?"":String(g).trim().replace(/^0+(?=\d)/,"");if(!/^\d+$/.test(m)||/^0+$/.test(m))throw Tt("Provide a positive UID in login() or createClient({ uid }) before attaching","RTM_SHARED_UID_REQUIRED");if(m.length>20||m.length===20&&m>"18446744073709551615")throw Tt("UID exceeds the uint64 range","RTM_SHARED_UID_INVALID");if(this._uid!==null&&this._uid!==m)throw Tt("This client is bound to UID "+this._uid+"; create another client for UID "+m,"RTM_SHARED_UID_MISMATCH");if(!this._delegate){let R=this._config,C=this._usesSharedWorker?new Ki({workerName:R.workerName||Ki.createWorkerName({pid:this._options.pid,protocol:this._options.protocol,uid:m,endpoint:$a(this._options),namespace:R.workerNamespace}),workerUrl:R.workerUrl,conversation:R.conversation,readyTimeout:R.readyTimeout,idleShutdownTimeout:R.idleShutdownTimeout,clientOptions:this._options}):new Mn(this._options);this._uid=m,this._delegate=C,this._delegateType=this._usesSharedWorker?"shared":"direct",this._delegateType==="direct"&&C.on("SessionClosed",()=>{this._session={status:"idle",uid:null}}),this._events.bind(C);let O=this._delegateType==="direct"?(P,T)=>eu(this._config.conversation,this._options.protocol,P,T[0]):null;this.processor.bind(C.processor,O)}return this._delegate}_assertActive(){if(this._destroyed)throw Tt("RTM client has been destroyed","RTM_CLIENT_DESTROYED")}login(g,m,R,C){this.loginIfNeeded(g,m,C).then(function(P){typeof R=="function"&&R(P.accepted,P.errorCode)},P=>{let T=typeof P.status=="number"?P.status:typeof P.code=="number"?P.code:Rr.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;try{typeof R=="function"&&R(!1,T)}finally{this._usesSharedWorker&&this._events.emit("SharedWorkerError",P)}})}loginIfNeeded(g,m,R){try{let C=this._attach(g),P=this._uid.length>19||this._uid.length===19&&this._uid>"9223372036854775807"?Rr.Uint64(this._uid):Rr.Int64(this._uid);return this._usesSharedWorker?C.loginIfNeeded(P,m,R):this._loginDirect(C,P,m,R)}catch(C){return Promise.reject(C)}}_loginDirect(g,m,R,C){if(this._session.status==="authenticated")return Promise.resolve({accepted:!0,errorCode:0,reused:!0,uid:this._uid});if(this._session.status==="connecting"&&this._directLoginPromise)return this._directLoginPromise;if(typeof R!="string"||R.length===0)return Promise.reject(Tt("This RTM UID is not logged in yet; provide its server-issued credential first.","RTM_SHARED_CREDENTIAL_REQUIRED"));this._session={status:"connecting",uid:this._uid};let O=new Promise((P,T)=>{let S=!1;try{g.login(m,R,(I,N)=>{S||(S=!0,this._session=I?{status:"authenticated",uid:this._uid}:{status:"idle",uid:null},P({accepted:!!I,errorCode:N||0,reused:!1,uid:I?this._uid:null}))},C)}catch(I){this._session={status:"idle",uid:null},T(I)}});return this._directLoginPromise=O.then(P=>(this._directLoginPromise=null,P),P=>{throw this._directLoginPromise=null,P}),this._directLoginPromise}whenReady(g){try{let m=this._attach(g===void 0?this._uid:g);return this._usesSharedWorker?m.whenReady():Promise.resolve({status:this._session.status,uid:this._session.uid})}catch(m){return Promise.reject(m)}}getSharedSession(){return this._delegateType==="shared"?this._delegate.getSharedSession():{status:this._session.status,uid:this._session.uid}}getConnectionInfo(){return{mode:this._connectionInfo.mode,fallbackReason:this._connectionInfo.fallbackReason}}setConversation(g,m){return this._assertActive(),g=Ji(g),this._delegateType==="shared"?this._delegate.setConversation(g,m):(this._config.conversation=g,typeof m=="function"&&m(null)),this}on(g,m){return this._events.on(g,m),this}off(g,m){return this._events.off(g,m),this}removeEvent(){return this._events.removeEvent.apply(this._events,arguments),this}emit(){this._events.emit.apply(this._events,arguments)}listenerCount(g){return this._events.listenerCount(g)}close(){this._assertActive(),this._delegate&&this._delegate.close()}startAutoReconnect(){this._assertActive(),this._delegate&&this._delegate.startAutoReconnect()}destroy(){if(!this._destroyed){this._destroyed=!0;try{this._delegate&&this._delegate.destroy()}finally{this._events.clear(),this.processor.clear()}}}_invoke(g,m){try{if(this._assertActive(),!this._delegate)throw Tt("Call login() before "+g+"()","RTM_SHARED_UID_REQUIRED")}catch(R){let C=m.slice().reverse().find(O=>typeof O=="function");if(C){C(R,null);return}throw R}return this._legacyTlv?Kt.invoke(g,m,this._delegate,this._options.protocol,-1,R=>this.processor.emit("CompatibilityError",R)):this._delegate[g].apply(this._delegate,m)}},kn=class{constructor(g){this._listeners=Object.create(null),this._bindings=Object.create(null),this._target=null,this._filter=null,this._eventAdapter=g||null}bind(g,m){this._target=g,this._filter=typeof m=="function"?m:null,Object.keys(this._listeners).forEach(R=>{this._listeners[R].forEach(C=>this._bind(R,C))})}_bind(g,m){let R=this._eventAdapter&&this._eventAdapter.bind(g,m);if(R&&R.local){(this._bindings[g]||(this._bindings[g]=[])).push({callback:m,local:!0});return}let C=R?R.type:g,O=R?R.callback:m,P=this._filter?(...S)=>{this._filter(C,S)&&O.apply(null,S)}:O;(this._bindings[g]||(this._bindings[g]=[])).push({callback:m,sourceType:C,wrapped:P}),this._target.on(C,P)}_unbind(g,m){let R=this._bindings[g]||[];R.slice().forEach(C=>{if(!(m!==void 0&&m!==C.callback)){if(C.local){R.splice(R.indexOf(C),1);return}(typeof this._target.listenerCount!="function"||this._target.listenerCount(C.sourceType)>0)&&this._target.removeEvent(C.sourceType,C.wrapped),R.splice(R.indexOf(C),1)}}),R.length||delete this._bindings[g]}on(g,m){if(typeof m!="function")return this;this._eventAdapter&&typeof this._eventAdapter.validate=="function"&&this._eventAdapter.validate(g);let R=this._listeners[g]||(this._listeners[g]=[]);return R.indexOf(m)===-1&&(R.push(m),this._target&&this._bind(g,m)),this}off(g,m){let R=this._listeners[g]||[];return R.slice().forEach(C=>{m!==void 0&&C!==m||(this._target&&this._unbind(g,C),R.splice(R.indexOf(C),1))}),R.length||delete this._listeners[g],this}removeEvent(g,m){return arguments.length?this.off(g,m):(Object.keys(this._listeners).forEach(R=>this.off(R)),this)}emit(g){let m=Array.prototype.slice.call(arguments,1);(this._listeners[g]||[]).slice().forEach(R=>R.apply(null,m))}listenerCount(g){return(this._listeners[g]||[]).length}clear(){this._target&&Object.keys(this._bindings).forEach(g=>this._unbind(g)),this._target=null,this._filter=null,this._listeners=Object.create(null),this._bindings=Object.create(null)}};Object.getOwnPropertyNames(Mn.prototype).forEach(function(E){E==="constructor"||E.charAt(0)==="_"||Object.prototype.hasOwnProperty.call(Jt.prototype,E)||typeof Object.getOwnPropertyDescriptor(Mn.prototype,E).value!="function"||(Jt.prototype[E]=function(){return this._invoke(E,Array.prototype.slice.call(arguments))})});function Xi(E){let g=Object.assign({},E);return tu.forEach(m=>{delete g[m]}),g}function nu(E){let g=Object.assign({},Xa(E,Mn.prototype));return g.login=function(m,R,C){return arguments.length>3?Promise.reject(new TypeError("promises.login(uid, credential, timeout?)")):E.loginIfNeeded(m,R,C).then(function(O){if(O.accepted)return{accepted:!0,errorCode:O.errorCode||0};let P=new Error("RTM login rejected ("+String(O.errorCode)+")");throw P.code=O.errorCode,P.status=O.errorCode,P})},Object.freeze(g)}function Tt(E,g){let m=new Error(E);return m.code=g,m}function ru(E){let g=Object.assign({},E||{});if(g.compatibility=Kt.validateCompatibility(g.compatibility),g.protocol===void 0&&(g.protocol="fpnn"),g.sharing!==void 0&&typeof g.sharing!="boolean")throw new TypeError("sharing must be a boolean");let m=Qi(Xi(g)),R="shared",C=null;return g.sharing===!1?R="direct":typeof SharedWorker!="function"?(R="direct",C="SharedWorker is unavailable in this runtime"):(C=Za(m),C&&(R="direct")),new Jt(g,{mode:R,fallbackReason:C})}$i.exports=ru});var ns=Ye((Uu,ts)=>{"use strict";var iu=qt(),es=mr(),su=Zi(),ou=es.createWorkerName,au=lt(),uu=Nn(),fu=Qn(),cu=or();ts.exports={RTMClient:iu,createClient:su,RTMSharedWorkerClient:es,createSharedWorkerName:ou,RTMConfig:au,RTMProcessor:uu,TLVCodec:fu,TLVWebSocketClient:cu}});var Cr=cs(ns(),1),Or=Cr.default.default||Cr.default,rs=new URL("../dist/rtm.shared-worker.js",import.meta.url).href,Pr=class extends Or.RTMSharedWorkerClient{constructor(g){let m=g||{};super(Object.assign({},m,{workerUrl:m.workerUrl||rs}))}};function lu(E){let g=E||{};return Or.createClient(Object.assign({},g,{workerUrl:g.workerUrl||rs}))}var At=Object.assign({},Or,{RTMSharedWorkerClient:Pr,createClient:lu}),Nu=At.RTMClient;var Bu=At.RTMConfig,Fu=At.RTMProcessor,Du=At.TLVCodec,Lu=At.TLVWebSocketClient,ju=At.createSharedWorkerName,qu=At;export{Nu as RTMClient,Bu as RTMConfig,Fu as RTMProcessor,Pr as RTMSharedWorkerClient,Du as TLVCodec,Lu as TLVWebSocketClient,lu as createClient,ju as createSharedWorkerName,qu as default};
|
|
3
|
+
/*!
|
|
4
|
+
* The buffer module from node.js, for the browser.
|
|
5
|
+
*
|
|
6
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/
|
|
9
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
+
/**
|
|
11
|
+
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
12
|
+
*
|
|
13
|
+
* @namespace md5
|
|
14
|
+
* @version 0.7.3
|
|
15
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
16
|
+
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
17
|
+
* @license MIT
|
|
18
|
+
*/
|