🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

rpc-websockets

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rpc-websockets - npm Package Compare versions

Comparing version
9.2.0
to
9.3.0
+2
-2
dist/index.browser-bundle.js

@@ -1,5 +0,5 @@

var RPCWebSocket=(function(exports){'use strict';var Tr=Object.create;var ht=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames,at=Object.getOwnPropertySymbols,Pr=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var It=(h,c,u)=>c in h?ht(h,c,{enumerable:true,configurable:true,writable:true,value:u}):h[c]=u,bt=(h,c)=>{for(var u in c||(c={}))_t.call(c,u)&&It(h,u,c[u]);if(at)for(var u of at(c))qt.call(c,u)&&It(h,u,c[u]);return h};var Dt=(h,c)=>{var u={};for(var l in h)_t.call(h,l)&&c.indexOf(l)<0&&(u[l]=h[l]);if(h!=null&&at)for(var l of at(h))c.indexOf(l)<0&&qt.call(h,l)&&(u[l]=h[l]);return u};var it=(h,c)=>()=>(h&&(c=h(h=0)),c);var Lr=(h,c)=>()=>(c||h((c={exports:{}}).exports,c),c.exports),Nr=(h,c)=>{for(var u in c)ht(h,u,{get:c[u],enumerable:true});},Mr=(h,c,u,l)=>{if(c&&typeof c=="object"||typeof c=="function")for(let p of Rr(c))!_t.call(h,p)&&p!==u&&ht(h,p,{get:()=>c[p],enumerable:!(l=Cr(c,p))||l.enumerable});return h};var Wr=(h,c,u)=>(u=h!=null?Tr(Pr(h)):{},Mr(ht(u,"default",{value:h,enumerable:true}),h));var R=(h,c,u)=>It(h,typeof c!="symbol"?c+"":c,u);var v=it(()=>{});var j={};Nr(j,{_debugEnd:()=>Te,_debugProcess:()=>Ue,_events:()=>He,_eventsCount:()=>Ke,_exiting:()=>he,_fatalExceptions:()=>xe,_getActiveHandles:()=>de,_getActiveRequests:()=>fe,_kill:()=>me,_linkedBinding:()=>ue,_maxListeners:()=>Ge,_preload_modules:()=>De,_rawDebug:()=>se,_startProfilerIdleNotifier:()=>Ce,_stopProfilerIdleNotifier:()=>Re,_tickCallback:()=>Se,abort:()=>Me,addListener:()=>Xe,allowedNodeEnvironmentFlags:()=>_e,arch:()=>Kt,argv:()=>Qt,argv0:()=>qe,assert:()=>be,binding:()=>ee,chdir:()=>ie,config:()=>pe,cpuUsage:()=>ft,cwd:()=>ne,debugPort:()=>Fe,default:()=>nr,dlopen:()=>le,domain:()=>ae,emit:()=>Ze,emitWarning:()=>te,env:()=>Jt,execArgv:()=>Vt,execPath:()=>$e,exit:()=>Be,features:()=>Ae,hasUncaughtExceptionCaptureCallback:()=>ve,hrtime:()=>lt,kill:()=>Ee,listeners:()=>rr,memoryUsage:()=>ge,moduleLoadList:()=>ce,nextTick:()=>Yt,off:()=>Qe,on:()=>X,once:()=>Je,openStdin:()=>Ie,pid:()=>We,platform:()=>Xt,ppid:()=>Oe,prependListener:()=>tr,prependOnceListener:()=>er,reallyExit:()=>ye,release:()=>oe,removeAllListeners:()=>ze,removeListener:()=>Ve,resourceUsage:()=>we,setSourceMapsEnabled:()=>je,setUncaughtExceptionCaptureCallback:()=>ke,stderr:()=>Le,stdin:()=>Ne,stdout:()=>Pe,title:()=>Ht,umask:()=>re,uptime:()=>Ye,version:()=>zt,versions:()=>Zt});function kt(h){throw new Error("Node.js process "+h+" is not supported by JSPM core outside of Node.js")}function Or(){!rt||!V||(rt=false,V.length?H=V.concat(H):pt=-1,H.length&&jt());}function jt(){if(!rt){var h=setTimeout(Or,0);rt=true;for(var c=H.length;c;){for(V=H,H=[];++pt<c;)V&&V[pt].run();pt=-1,c=H.length;}V=null,rt=false,clearTimeout(h);}}function Yt(h){var c=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)c[u-1]=arguments[u];H.push(new Gt(h,c)),H.length===1&&!rt&&setTimeout(jt,0);}function Gt(h,c){this.fun=h,this.array=c;}function N(){}function ue(h){kt("_linkedBinding");}function le(h){kt("dlopen");}function fe(){return []}function de(){return []}function be(h,c){if(!h)throw new Error(c||"assertion error")}function ve(){return false}function Ye(){return Q.now()/1e3}function lt(h){var c=Math.floor((Date.now()-Q.now())*.001),u=Q.now()*.001,l=Math.floor(u)+c,p=Math.floor(u%1*1e9);return h&&(l=l-h[0],p=p-h[1],p<0&&(l--,p+=xt)),[l,p]}function X(){return nr}function rr(h){return []}var H,rt,V,pt,Ht,Kt,Xt,Jt,Qt,Vt,zt,Zt,te,ee,re,ne,ie,oe,se,ce,ae,he,pe,ye,me,ft,we,ge,Ee,Be,Ie,_e,Ae,xe,ke,Se,Ue,Te,Ce,Re,Pe,Le,Ne,Me,We,Oe,$e,Fe,qe,De,je,Q,At,xt,Ge,He,Ke,Xe,Je,Qe,Ve,ze,Ze,tr,er,nr,ir=it(()=>{v();U();S();H=[],rt=false,pt=-1;Gt.prototype.run=function(){this.fun.apply(null,this.array);};Ht="browser",Kt="x64",Xt="browser",Jt={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Qt=["/usr/bin/node"],Vt=[],zt="v16.8.0",Zt={},te=function(h,c){console.warn((c?c+": ":"")+h);},ee=function(h){kt("binding");},re=function(h){return 0},ne=function(){return "/"},ie=function(h){},oe={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};se=N,ce=[];ae={},he=false,pe={};ye=N,me=N,ft=function(){return {}},we=ft,ge=ft,Ee=N,Be=N,Ie=N,_e={};Ae={inspector:false,debug:false,uv:false,ipv6:false,tls_alpn:false,tls_sni:false,tls_ocsp:false,tls:false,cached_builtins:true},xe=N,ke=N;Se=N,Ue=N,Te=N,Ce=N,Re=N,Pe=void 0,Le=void 0,Ne=void 0,Me=N,We=2,Oe=1,$e="/bin/usr/node",Fe=9229,qe="node",De=[],je=N,Q={now:typeof performance!="undefined"?performance.now.bind(performance):void 0,timing:typeof performance!="undefined"?performance.timing:void 0};Q.now===void 0&&(At=Date.now(),Q.timing&&Q.timing.navigationStart&&(At=Q.timing.navigationStart),Q.now=()=>Date.now()-At);xt=1e9;lt.bigint=function(h){var c=lt(h);return typeof BigInt=="undefined"?c[0]*xt+c[1]:BigInt(c[0]*xt)+BigInt(c[1])};Ge=10,He={},Ke=0;Xe=X,Je=X,Qe=X,Ve=X,ze=X,Ze=N,tr=X,er=X;nr={version:zt,versions:Zt,arch:Kt,platform:Xt,release:oe,_rawDebug:se,moduleLoadList:ce,binding:ee,_linkedBinding:ue,_events:He,_eventsCount:Ke,_maxListeners:Ge,on:X,addListener:Xe,once:Je,off:Qe,removeListener:Ve,removeAllListeners:ze,emit:Ze,prependListener:tr,prependOnceListener:er,listeners:rr,domain:ae,_exiting:he,config:pe,dlopen:le,uptime:Ye,_getActiveRequests:fe,_getActiveHandles:de,reallyExit:ye,_kill:me,cpuUsage:ft,resourceUsage:we,memoryUsage:ge,kill:Ee,exit:Be,openStdin:Ie,allowedNodeEnvironmentFlags:_e,assert:be,features:Ae,_fatalExceptions:xe,setUncaughtExceptionCaptureCallback:ke,hasUncaughtExceptionCaptureCallback:ve,emitWarning:te,nextTick:Yt,_tickCallback:Se,_debugProcess:Ue,_debugEnd:Te,_startProfilerIdleNotifier:Ce,_stopProfilerIdleNotifier:Re,stdout:Pe,stdin:Ne,stderr:Le,abort:Me,umask:re,chdir:ie,cwd:ne,env:Jt,title:Ht,argv:Qt,execArgv:Vt,pid:We,ppid:Oe,execPath:$e,debugPort:Fe,hrtime:lt,argv0:qe,_preload_modules:De,setSourceMapsEnabled:je};});var S=it(()=>{ir();});function $r(){if(or)return ot;or=true,ot.byteLength=E,ot.toByteArray=b,ot.fromByteArray=L;for(var h=[],c=[],u=typeof Uint8Array!="undefined"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=l.length;p<f;++p)h[p]=l[p],c[l.charCodeAt(p)]=p;c[45]=62,c[95]=63;function i(y){var g=y.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=y.indexOf("=");_===-1&&(_=g);var C=_===g?0:4-_%4;return [_,C]}function E(y){var g=i(y),_=g[0],C=g[1];return (_+C)*3/4-C}function d(y,g,_){return (g+_)*3/4-_}function b(y){var g,_=i(y),C=_[0],$=_[1],T=new u(d(y,C,$)),F=0,D=$>0?C-4:C,W;for(W=0;W<D;W+=4)g=c[y.charCodeAt(W)]<<18|c[y.charCodeAt(W+1)]<<12|c[y.charCodeAt(W+2)]<<6|c[y.charCodeAt(W+3)],T[F++]=g>>16&255,T[F++]=g>>8&255,T[F++]=g&255;return $===2&&(g=c[y.charCodeAt(W)]<<2|c[y.charCodeAt(W+1)]>>4,T[F++]=g&255),$===1&&(g=c[y.charCodeAt(W)]<<10|c[y.charCodeAt(W+1)]<<4|c[y.charCodeAt(W+2)]>>2,T[F++]=g>>8&255,T[F++]=g&255),T}function B(y){return h[y>>18&63]+h[y>>12&63]+h[y>>6&63]+h[y&63]}function m(y,g,_){for(var C,$=[],T=g;T<_;T+=3)C=(y[T]<<16&16711680)+(y[T+1]<<8&65280)+(y[T+2]&255),$.push(B(C));return $.join("")}function L(y){for(var g,_=y.length,C=_%3,$=[],T=16383,F=0,D=_-C;F<D;F+=T)$.push(m(y,F,F+T>D?D:F+T));return C===1?(g=y[_-1],$.push(h[g>>2]+h[g<<4&63]+"==")):C===2&&(g=(y[_-2]<<8)+y[_-1],$.push(h[g>>10]+h[g>>4&63]+h[g<<2&63]+"=")),$.join("")}return ot}function Fr(){if(sr)return dt;sr=true;return dt.read=function(h,c,u,l,p){var f,i,E=p*8-l-1,d=(1<<E)-1,b=d>>1,B=-7,m=u?p-1:0,L=u?-1:1,y=h[c+m];for(m+=L,f=y&(1<<-B)-1,y>>=-B,B+=E;B>0;f=f*256+h[c+m],m+=L,B-=8);for(i=f&(1<<-B)-1,f>>=-B,B+=l;B>0;i=i*256+h[c+m],m+=L,B-=8);if(f===0)f=1-b;else {if(f===d)return i?NaN:(y?-1:1)*(1/0);i=i+Math.pow(2,l),f=f-b;}return (y?-1:1)*i*Math.pow(2,f-l)},dt.write=function(h,c,u,l,p,f){var i,E,d,b=f*8-p-1,B=(1<<b)-1,m=B>>1,L=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=l?0:f-1,g=l?1:-1,_=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(E=isNaN(c)?1:0,i=B):(i=Math.floor(Math.log(c)/Math.LN2),c*(d=Math.pow(2,-i))<1&&(i--,d*=2),i+m>=1?c+=L/d:c+=L*Math.pow(2,1-m),c*d>=2&&(i++,d/=2),i+m>=B?(E=0,i=B):i+m>=1?(E=(c*d-1)*Math.pow(2,p),i=i+m):(E=c*Math.pow(2,m-1)*Math.pow(2,p),i=0));p>=8;h[u+y]=E&255,y+=g,E/=256,p-=8);for(i=i<<p|E,b+=p;b>0;h[u+y]=i&255,y+=g,i/=256,b-=8);h[u+y-g]|=_*128;},dt}function qr(){if(cr)return z;cr=true;let h=$r(),c=Fr(),u=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;z.Buffer=i,z.SlowBuffer=$,z.INSPECT_MAX_BYTES=50;let l=2147483647;z.kMaxLength=l,i.TYPED_ARRAY_SUPPORT=p(),!i.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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.");function p(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch(r){return false}}Object.defineProperty(i.prototype,"parent",{enumerable:true,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:true,get:function(){if(i.isBuffer(this))return this.byteOffset}});function f(r){if(r>l)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,i.prototype),t}function i(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(r)}return E(r,t,e)}i.poolSize=8192;function E(r,t,e){if(typeof r=="string")return m(r,t);if(ArrayBuffer.isView(r))return y(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(G(r,ArrayBuffer)||r&&G(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(G(r,SharedArrayBuffer)||r&&G(r.buffer,SharedArrayBuffer)))return g(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return i.from(n,t,e);let o=_(r);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return i.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}i.from=function(r,t,e){return E(r,t,e)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function d(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function b(r,t,e){return d(r),r<=0?f(r):t!==void 0?typeof e=="string"?f(r).fill(t,e):f(r).fill(t):f(r)}i.alloc=function(r,t,e){return b(r,t,e)};function B(r){return d(r),f(r<0?0:C(r)|0)}i.allocUnsafe=function(r){return B(r)},i.allocUnsafeSlow=function(r){return B(r)};function m(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!i.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=T(r,t)|0,n=f(e),o=n.write(r,t);return o!==e&&(n=n.slice(0,o)),n}function L(r){let t=r.length<0?0:C(r.length)|0,e=f(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function y(r){if(G(r,Uint8Array)){let t=new Uint8Array(r);return g(t.buffer,t.byteOffset,t.byteLength)}return L(r)}function g(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,i.prototype),n}function _(r){if(i.isBuffer(r)){let t=C(r.length)|0,e=f(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||Bt(r.length)?f(0):L(r);if(r.type==="Buffer"&&Array.isArray(r.data))return L(r.data)}function C(r){if(r>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return r|0}function $(r){return +r!=r&&(r=0),i.alloc(+r)}i.isBuffer=function(t){return t!=null&&t._isBuffer===true&&t!==i.prototype},i.compare=function(t,e){if(G(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),G(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,o=e.length;for(let s=0,a=Math.min(n,o);s<a;++s)if(t[s]!==e[s]){n=t[s],o=e[s];break}return n<o?-1:o<n?1:0},i.isEncoding=function(t){switch(String(t).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 true;default:return false}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return i.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let o=i.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let a=t[n];if(G(a,Uint8Array))s+a.length>o.length?(i.isBuffer(a)||(a=i.from(a)),a.copy(o,s)):Uint8Array.prototype.set.call(o,a,s);else if(i.isBuffer(a))a.copy(o,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length;}return o};function T(r,t){if(i.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||G(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===true;if(!n&&e===0)return 0;let o=false;for(;;)switch(t){case "ascii":case "latin1":case "binary":return e;case "utf8":case "utf-8":return Et(r).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return e*2;case "hex":return e>>>1;case "base64":return Ft(r).length;default:if(o)return n?-1:Et(r).length;t=(""+t).toLowerCase(),o=true;}}i.byteLength=T;function F(r,t,e){let n=false;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return "";for(r||(r="utf8");;)switch(r){case "hex":return Ir(this,t,e);case "utf8":case "utf-8":return Ct(this,t,e);case "ascii":return Er(this,t,e);case "latin1":case "binary":return Br(this,t,e);case "base64":return wr(this,t,e);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return _r(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=true;}}i.prototype._isBuffer=true;function D(r,t,e){let n=r[t];r[t]=r[e],r[e]=n;}i.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)D(this,e,e+1);return this},i.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},i.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},i.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Ct(this,0,t):F.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?true:i.compare(this,t)===0},i.prototype.inspect=function(){let t="",e=z.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},u&&(i.prototype[u]=i.prototype.inspect),i.prototype.compare=function(t,e,n,o,s){if(G(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),s===void 0&&(s=this.length),e<0||n>t.length||o<0||s>this.length)throw new RangeError("out of range index");if(o>=s&&e>=n)return 0;if(o>=s)return -1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,s>>>=0,this===t)return 0;let a=s-o,w=n-e,x=Math.min(a,w),A=this.slice(o,s),k=t.slice(e,n);for(let I=0;I<x;++I)if(A[I]!==k[I]){a=A[I],w=k[I];break}return a<w?-1:w<a?1:0};function W(r,t,e,n,o){if(r.length===0)return -1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,Bt(e)&&(e=o?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(o)return -1;e=r.length-1;}else if(e<0)if(o)e=0;else return -1;if(typeof t=="string"&&(t=i.from(t,n)),i.isBuffer(t))return t.length===0?-1:Tt(r,t,e,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Tt(r,[t],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Tt(r,t,e,n,o){let s=1,a=r.length,w=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return -1;s=2,a/=2,w/=2,e/=2;}function x(k,I){return s===1?k[I]:k.readUInt16BE(I*s)}let A;if(o){let k=-1;for(A=e;A<a;A++)if(x(r,A)===x(t,k===-1?0:A-k)){if(k===-1&&(k=A),A-k+1===w)return k*s}else k!==-1&&(A-=A-k),k=-1;}else for(e+w>a&&(e=a-w),A=e;A>=0;A--){let k=true;for(let I=0;I<w;I++)if(x(r,A+I)!==x(t,I)){k=false;break}if(k)return A}return -1}i.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},i.prototype.indexOf=function(t,e,n){return W(this,t,e,n,true)},i.prototype.lastIndexOf=function(t,e,n){return W(this,t,e,n,false)};function lr(r,t,e,n){e=Number(e)||0;let o=r.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;let s=t.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let w=parseInt(t.substr(a*2,2),16);if(Bt(w))return a;r[e+a]=w;}return a}function fr(r,t,e,n){return ut(Et(t,r.length-e),r,e,n)}function dr(r,t,e,n){return ut(kr(t),r,e,n)}function yr(r,t,e,n){return ut(Ft(t),r,e,n)}function mr(r,t,e,n){return ut(vr(t,r.length-e),r,e,n)}i.prototype.write=function(t,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let a=false;for(;;)switch(o){case "hex":return lr(this,t,e,n);case "utf8":case "utf-8":return fr(this,t,e,n);case "ascii":case "latin1":case "binary":return dr(this,t,e,n);case "base64":return yr(this,t,e,n);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return mr(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=true;}},i.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wr(r,t,e){return t===0&&e===r.length?h.fromByteArray(r):h.fromByteArray(r.slice(t,e))}function Ct(r,t,e){e=Math.min(r.length,e);let n=[],o=t;for(;o<e;){let s=r[o],a=null,w=s>239?4:s>223?3:s>191?2:1;if(o+w<=e){let x,A,k,I;switch(w){case 1:s<128&&(a=s);break;case 2:x=r[o+1],(x&192)===128&&(I=(s&31)<<6|x&63,I>127&&(a=I));break;case 3:x=r[o+1],A=r[o+2],(x&192)===128&&(A&192)===128&&(I=(s&15)<<12|(x&63)<<6|A&63,I>2047&&(I<55296||I>57343)&&(a=I));break;case 4:x=r[o+1],A=r[o+2],k=r[o+3],(x&192)===128&&(A&192)===128&&(k&192)===128&&(I=(s&15)<<18|(x&63)<<12|(A&63)<<6|k&63,I>65535&&I<1114112&&(a=I));}}a===null?(a=65533,w=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=w;}return gr(n)}let Rt=4096;function gr(r){let t=r.length;if(t<=Rt)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Rt));return e}function Er(r,t,e){let n="";e=Math.min(r.length,e);for(let o=t;o<e;++o)n+=String.fromCharCode(r[o]&127);return n}function Br(r,t,e){let n="";e=Math.min(r.length,e);for(let o=t;o<e;++o)n+=String.fromCharCode(r[o]);return n}function Ir(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let o="";for(let s=t;s<e;++s)o+=Sr[r[s]];return o}function _r(r,t,e){let n=r.slice(t,e),o="";for(let s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}i.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let o=this.subarray(t,e);return Object.setPrototypeOf(o,i.prototype),o};function P(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t],s=1,a=0;for(;++a<e&&(s*=256);)o+=this[t+a]*s;return o},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t+--e],s=1;for(;e>0&&(s*=256);)o+=this[t+--e]*s;return o},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t=t>>>0,e||P(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readBigUInt64LE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(s)<<BigInt(32))}),i.prototype.readBigUInt64BE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(s)}),i.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t],s=1,a=0;for(;++a<e&&(s*=256);)o+=this[t+a]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o},i.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=e,s=1,a=this[t+--o];for(;o>0&&(s*=256);)a+=this[t+--o]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t=t>>>0,e||P(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t=t>>>0,e||P(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},i.prototype.readInt16BE=function(t,e){t=t>>>0,e||P(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},i.prototype.readInt32LE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readBigInt64LE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)}),i.prototype.readBigInt64BE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return (BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)}),i.prototype.readFloatLE=function(t,e){return t=t>>>0,e||P(t,4,this.length),c.read(this,t,true,23,4)},i.prototype.readFloatBE=function(t,e){return t=t>>>0,e||P(t,4,this.length),c.read(this,t,false,23,4)},i.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||P(t,8,this.length),c.read(this,t,true,52,8)},i.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||P(t,8,this.length),c.read(this,t,false,52,8)};function q(r,t,e,n,o,s){if(!i.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let w=Math.pow(2,8*n)-1;q(this,t,e,n,w,0);}let s=1,a=0;for(this[e]=t&255;++a<n&&(s*=256);)this[e+a]=t/s&255;return e+n},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let w=Math.pow(2,8*n)-1;q(this,t,e,n,w,0);}let s=n-1,a=1;for(this[e+s]=t&255;--s>=0&&(a*=256);)this[e+s]=t/a&255;return e+n},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,255,0),this[e]=t&255,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function Pt(r,t,e,n,o){$t(t,n,o,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,e}function Lt(r,t,e,n,o){$t(t,n,o,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=a,a=a>>8,r[e+2]=a,a=a>>8,r[e+1]=a,a=a>>8,r[e]=a,e+8}i.prototype.writeBigUInt64LE=J(function(t,e=0){return Pt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=J(function(t,e=0){return Lt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let x=Math.pow(2,8*n-1);q(this,t,e,n,x-1,-x);}let s=0,a=1,w=0;for(this[e]=t&255;++s<n&&(a*=256);)t<0&&w===0&&this[e+s-1]!==0&&(w=1),this[e+s]=(t/a>>0)-w&255;return e+n},i.prototype.writeIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let x=Math.pow(2,8*n-1);q(this,t,e,n,x-1,-x);}let s=n-1,a=1,w=0;for(this[e+s]=t&255;--s>=0&&(a*=256);)t<0&&w===0&&this[e+s+1]!==0&&(w=1),this[e+s]=(t/a>>0)-w&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},i.prototype.writeBigInt64LE=J(function(t,e=0){return Pt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=J(function(t,e=0){return Lt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Nt(r,t,e,n,o,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Mt(r,t,e,n,o){return t=+t,e=e>>>0,o||Nt(r,t,e,4),c.write(r,t,e,n,23,4),e+4}i.prototype.writeFloatLE=function(t,e,n){return Mt(this,t,e,true,n)},i.prototype.writeFloatBE=function(t,e,n){return Mt(this,t,e,false,n)};function Wt(r,t,e,n,o){return t=+t,e=e>>>0,o||Nt(r,t,e,8),c.write(r,t,e,n,52,8),e+8}i.prototype.writeDoubleLE=function(t,e,n){return Wt(this,t,e,true,n)},i.prototype.writeDoubleBE=function(t,e,n){return Wt(this,t,e,false,n)},i.prototype.copy=function(t,e,n,o){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<n&&(o=n),o===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-n&&(o=t.length-e+n);let s=o-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,o):Uint8Array.prototype.set.call(t,this.subarray(n,o),e),s},i.prototype.fill=function(t,e,n,o){if(typeof t=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!i.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(t.length===1){let a=t.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(t=a);}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else {let a=i.isBuffer(t)?t:i.from(t,o),w=a.length;if(w===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%w];}return this};let tt={};function gt(r,t,e){tt[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${r}]`,this.stack,delete this.name;}get code(){return r}set code(o){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:o,writable:true});}toString(){return `${this.name} [${r}]: ${this.message}`}};}gt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),gt("ERR_INVALID_ARG_TYPE",function(r,t){return `The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError),gt("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,o=e;return Number.isInteger(e)&&Math.abs(e)>2**32?o=Ot(String(e)):typeof e=="bigint"&&(o=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(o=Ot(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function Ot(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return `${r.slice(0,e)}${t}`}function br(r,t,e){et(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&nt(t,r.length-(e+1));}function $t(r,t,e,n,o,s){if(r>e||r<t){let a=typeof t=="bigint"?"n":"",w;throw t===0||t===BigInt(0)?w=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:w=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`,new tt.ERR_OUT_OF_RANGE("value",w,r)}br(n,o,s);}function et(r,t){if(typeof r!="number")throw new tt.ERR_INVALID_ARG_TYPE(t,"number",r)}function nt(r,t,e){throw Math.floor(r)!==r?(et(r,e),new tt.ERR_OUT_OF_RANGE("offset","an integer",r)):t<0?new tt.ERR_BUFFER_OUT_OF_BOUNDS:new tt.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${t}`,r)}let Ar=/[^+/0-9A-Za-z-_]/g;function xr(r){if(r=r.split("=")[0],r=r.trim().replace(Ar,""),r.length<2)return "";for(;r.length%4!==0;)r=r+"=";return r}function Et(r,t){t=t||1/0;let e,n=r.length,o=null,s=[];for(let a=0;a<n;++a){if(e=r.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}o=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536;}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,e<128){if((t-=1)<0)break;s.push(e);}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128);}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128);}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128);}else throw new Error("Invalid code point")}return s}function kr(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function vr(r,t){let e,n,o,s=[];for(let a=0;a<r.length&&!((t-=2)<0);++a)e=r.charCodeAt(a),n=e>>8,o=e%256,s.push(o),s.push(n);return s}function Ft(r){return h.toByteArray(xr(r))}function ut(r,t,e,n){let o;for(o=0;o<n&&!(o+e>=t.length||o>=r.length);++o)t[o+e]=r[o];return o}function G(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function Bt(r){return r!==r}let Sr=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let o=0;o<16;++o)t[n+o]=r[e]+r[o];}return t}();function J(r){return typeof BigInt=="undefined"?Ur:r}function Ur(){throw new Error("BigInt not supported")}return z}var ot,or,dt,sr,z,cr,Z,Y,ur=it(()=>{v();U();S();ot={},or=false;dt={},sr=false;z={},cr=false;Z=qr();Z.Buffer;Z.SlowBuffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;Y=Z.Buffer,Z.INSPECT_MAX_BYTES,Z.kMaxLength;});var U=it(()=>{ur();});var hr=Lr((sn,vt)=>{v();U();S();var Dr=Object.prototype.hasOwnProperty,O="~";function st(){}Object.create&&(st.prototype=Object.create(null),new st().__proto__||(O=false));function jr(h,c,u){this.fn=h,this.context=c,this.once=u||false;}function ar(h,c,u,l,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new jr(u,l||h,p),i=O?O+c:c;return h._events[i]?h._events[i].fn?h._events[i]=[h._events[i],f]:h._events[i].push(f):(h._events[i]=f,h._eventsCount++),h}function yt(h,c){--h._eventsCount===0?h._events=new st:delete h._events[c];}function M(){this._events=new st,this._eventsCount=0;}M.prototype.eventNames=function(){var c=[],u,l;if(this._eventsCount===0)return c;for(l in u=this._events)Dr.call(u,l)&&c.push(O?l.slice(1):l);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c};M.prototype.listeners=function(c){var u=O?O+c:c,l=this._events[u];if(!l)return [];if(l.fn)return [l.fn];for(var p=0,f=l.length,i=new Array(f);p<f;p++)i[p]=l[p].fn;return i};M.prototype.listenerCount=function(c){var u=O?O+c:c,l=this._events[u];return l?l.fn?1:l.length:0};M.prototype.emit=function(c,u,l,p,f,i){var E=O?O+c:c;if(!this._events[E])return false;var d=this._events[E],b=arguments.length,B,m;if(d.fn){switch(d.once&&this.removeListener(c,d.fn,void 0,true),b){case 1:return d.fn.call(d.context),true;case 2:return d.fn.call(d.context,u),true;case 3:return d.fn.call(d.context,u,l),true;case 4:return d.fn.call(d.context,u,l,p),true;case 5:return d.fn.call(d.context,u,l,p,f),true;case 6:return d.fn.call(d.context,u,l,p,f,i),true}for(m=1,B=new Array(b-1);m<b;m++)B[m-1]=arguments[m];d.fn.apply(d.context,B);}else {var L=d.length,y;for(m=0;m<L;m++)switch(d[m].once&&this.removeListener(c,d[m].fn,void 0,true),b){case 1:d[m].fn.call(d[m].context);break;case 2:d[m].fn.call(d[m].context,u);break;case 3:d[m].fn.call(d[m].context,u,l);break;case 4:d[m].fn.call(d[m].context,u,l,p);break;default:if(!B)for(y=1,B=new Array(b-1);y<b;y++)B[y-1]=arguments[y];d[m].fn.apply(d[m].context,B);}}return true};M.prototype.on=function(c,u,l){return ar(this,c,u,l,false)};M.prototype.once=function(c,u,l){return ar(this,c,u,l,true)};M.prototype.removeListener=function(c,u,l,p){var f=O?O+c:c;if(!this._events[f])return this;if(!u)return yt(this,f),this;var i=this._events[f];if(i.fn)i.fn===u&&(!p||i.once)&&(!l||i.context===l)&&yt(this,f);else {for(var E=0,d=[],b=i.length;E<b;E++)(i[E].fn!==u||p&&!i[E].once||l&&i[E].context!==l)&&d.push(i[E]);d.length?this._events[f]=d.length===1?d[0]:d:yt(this,f);}return this};M.prototype.removeAllListeners=function(c){var u;return c?(u=O?O+c:c,this._events[u]&&yt(this,u)):(this._events=new st,this._eventsCount=0),this};M.prototype.off=M.prototype.removeListener;M.prototype.addListener=M.prototype.on;M.prefixed=O;M.EventEmitter=M;typeof vt!="undefined"&&(vt.exports=M);});v();U();S();v();U();S();v();U();S();v();U();S();var ct=Wr(hr());var St=class extends ct.default{constructor(u,l,p){super();R(this,"socket");this.socket=new window.WebSocket(u,p),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=f=>this.emit("message",f.data),this.socket.onerror=f=>this.emit("error",f),this.socket.onclose=f=>{this.emit("close",f.code,f.reason);};}send(u,l,p){let f=p||l;try{this.socket.send(u),f();}catch(i){f(i);}}close(u,l){this.socket.close(u,l);}addEventListener(u,l,p){this.socket.addEventListener(u,l,p);}};function pr(h,c){return new St(h,c)}v();U();S();v();U();S();var mt=class{encode(c){return JSON.stringify(c)}decode(c){return JSON.parse(c)}};var wt=class extends ct.default{constructor(u,l="ws://localhost:8080",m={},b,B){var L=m,{autoconnect:p=true,reconnect:f=true,reconnect_interval:i=1e3,max_reconnects:E=5}=L,d=Dt(L,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);super();R(this,"address");R(this,"rpc_id");R(this,"queue");R(this,"options");R(this,"autoconnect");R(this,"ready");R(this,"reconnect");R(this,"reconnect_timer_id");R(this,"reconnect_interval");R(this,"max_reconnects");R(this,"rest_options");R(this,"current_reconnects");R(this,"generate_request_id");R(this,"socket");R(this,"webSocketFactory");R(this,"dataPack");this.webSocketFactory=u,this.queue={},this.rpc_id=0,this.address=l,this.autoconnect=p,this.ready=false,this.reconnect=f,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=E,this.rest_options=d,this.current_reconnects=0,this.generate_request_id=b||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),B?this.dataPack=B:this.dataPack=new mt,this.autoconnect&&this._connect(this.address,bt({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options));}connect(){this.socket||this._connect(this.address,bt({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options));}call(u,l,p,f){return !f&&typeof p=="object"&&(f=p,p=null),new Promise((i,E)=>{if(!this.ready)return E(new Error("socket not ready"));let d=this.generate_request_id(u,l),b={jsonrpc:"2.0",method:u,params:l||void 0,id:d};this.socket.send(this.dataPack.encode(b),f,B=>{if(B)return E(B);this.queue[d]={promise:[i,E]},p&&(this.queue[d].timeout=setTimeout(()=>{delete this.queue[d],E(new Error("reply timeout"));},p));});})}async login(u){let l=await this.call("rpc.login",u);if(!l)throw new Error("authentication failed");return l}async listMethods(){return await this.call("__listMethods")}notify(u,l){return new Promise((p,f)=>{if(!this.ready)return f(new Error("socket not ready"));let i={jsonrpc:"2.0",method:u,params:l};this.socket.send(this.dataPack.encode(i),E=>{if(E)return f(E);p();});})}async subscribe(u){typeof u=="string"&&(u=[u]);let l=await this.call("rpc.on",u);if(typeof u=="string"&&l[u]!=="ok")throw new Error("Failed subscribing to an event '"+u+"' with: "+l[u]);return l}async unsubscribe(u){typeof u=="string"&&(u=[u]);let l=await this.call("rpc.off",u);if(typeof u=="string"&&l[u]!=="ok")throw new Error("Failed unsubscribing from an event with: "+l);return l}close(u,l){this.socket&&this.socket.close(u||1e3,l);}setAutoReconnect(u){this.reconnect=u;}setReconnectInterval(u){this.reconnect_interval=u;}setMaxReconnects(u){this.max_reconnects=u;}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(u,l){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(u,l),this.socket.addEventListener("open",()=>{this.ready=true,this.emit("open"),this.current_reconnects=0;}),this.socket.addEventListener("message",({data:p})=>{p instanceof ArrayBuffer&&(p=Y.from(p).toString());try{p=this.dataPack.decode(p);}catch(f){return}if(p.notification&&this.listeners(p.notification).length){if(!Object.keys(p.params).length)return this.emit(p.notification);let f=[p.notification];if(p.params.constructor===Object)f.push(p.params);else for(let i=0;i<p.params.length;i++)f.push(p.params[i]);return Promise.resolve().then(()=>{this.emit.apply(this,f);})}if(!this.queue[p.id])return p.method?Promise.resolve().then(()=>{this.emit(p.method,p==null?void 0:p.params);}):void 0;"error"in p=="result"in p&&this.queue[p.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[p.id].timeout&&clearTimeout(this.queue[p.id].timeout),p.error?this.queue[p.id].promise[1](p.error):this.queue[p.id].promise[0](p.result),delete this.queue[p.id];}),this.socket.addEventListener("error",p=>this.emit("error",p)),this.socket.addEventListener("close",({code:p,reason:f})=>{this.ready&&setTimeout(()=>this.emit("close",p,f),0),this.ready=false,this.socket=void 0,p!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(u,l),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",p,f),1));});}};v();U();S();var Ut=class extends wt{constructor(c="ws://localhost:8080",{autoconnect:u=true,reconnect:l=true,reconnect_interval:p=1e3,max_reconnects:f=5}={},i){super(pr,c,{autoconnect:u,reconnect:l,reconnect_interval:p,max_reconnects:f},i);}};/*! Bundled license information:
var RPCWebSocket=(function(exports){'use strict';var Tr=Object.create;var pt=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var Rr=Object.getOwnPropertyNames,ht=Object.getOwnPropertySymbols,Pr=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable;var bt=(h,c,u)=>c in h?pt(h,c,{enumerable:true,configurable:true,writable:true,value:u}):h[c]=u,it=(h,c)=>{for(var u in c||(c={}))At.call(c,u)&&bt(h,u,c[u]);if(ht)for(var u of ht(c))Dt.call(c,u)&&bt(h,u,c[u]);return h};var lt=(h,c)=>{var u={};for(var l in h)At.call(h,l)&&c.indexOf(l)<0&&(u[l]=h[l]);if(h!=null&&ht)for(var l of ht(h))c.indexOf(l)<0&&Dt.call(h,l)&&(u[l]=h[l]);return u};var ot=(h,c)=>()=>(h&&(c=h(h=0)),c);var Lr=(h,c)=>()=>(c||h((c={exports:{}}).exports,c),c.exports),Nr=(h,c)=>{for(var u in c)pt(h,u,{get:c[u],enumerable:true});},Wr=(h,c,u,l)=>{if(c&&typeof c=="object"||typeof c=="function")for(let p of Rr(c))!At.call(h,p)&&p!==u&&pt(h,p,{get:()=>c[p],enumerable:!(l=Cr(c,p))||l.enumerable});return h};var Mr=(h,c,u)=>(u=h!=null?Tr(Pr(h)):{},Wr(pt(u,"default",{value:h,enumerable:true}),h));var R=(h,c,u)=>bt(h,typeof c!="symbol"?c+"":c,u);var v=ot(()=>{});var j={};Nr(j,{_debugEnd:()=>Te,_debugProcess:()=>Ue,_events:()=>He,_eventsCount:()=>Ke,_exiting:()=>he,_fatalExceptions:()=>xe,_getActiveHandles:()=>de,_getActiveRequests:()=>fe,_kill:()=>me,_linkedBinding:()=>ue,_maxListeners:()=>Ge,_preload_modules:()=>De,_rawDebug:()=>se,_startProfilerIdleNotifier:()=>Ce,_stopProfilerIdleNotifier:()=>Re,_tickCallback:()=>Se,abort:()=>We,addListener:()=>Xe,allowedNodeEnvironmentFlags:()=>_e,arch:()=>Kt,argv:()=>Qt,argv0:()=>qe,assert:()=>be,binding:()=>ee,chdir:()=>ie,config:()=>pe,cpuUsage:()=>yt,cwd:()=>ne,debugPort:()=>Fe,default:()=>nr,dlopen:()=>le,domain:()=>ae,emit:()=>Ze,emitWarning:()=>te,env:()=>Jt,execArgv:()=>Vt,execPath:()=>$e,exit:()=>Be,features:()=>Ae,hasUncaughtExceptionCaptureCallback:()=>ve,hrtime:()=>dt,kill:()=>Ee,listeners:()=>rr,memoryUsage:()=>ge,moduleLoadList:()=>ce,nextTick:()=>Yt,off:()=>Qe,on:()=>X,once:()=>Je,openStdin:()=>Ie,pid:()=>Me,platform:()=>Xt,ppid:()=>Oe,prependListener:()=>tr,prependOnceListener:()=>er,reallyExit:()=>ye,release:()=>oe,removeAllListeners:()=>ze,removeListener:()=>Ve,resourceUsage:()=>we,setSourceMapsEnabled:()=>je,setUncaughtExceptionCaptureCallback:()=>ke,stderr:()=>Le,stdin:()=>Ne,stdout:()=>Pe,title:()=>Ht,umask:()=>re,uptime:()=>Ye,version:()=>zt,versions:()=>Zt});function vt(h){throw new Error("Node.js process "+h+" is not supported by JSPM core outside of Node.js")}function Or(){!rt||!V||(rt=false,V.length?H=V.concat(H):ft=-1,H.length&&jt());}function jt(){if(!rt){var h=setTimeout(Or,0);rt=true;for(var c=H.length;c;){for(V=H,H=[];++ft<c;)V&&V[ft].run();ft=-1,c=H.length;}V=null,rt=false,clearTimeout(h);}}function Yt(h){var c=new Array(arguments.length-1);if(arguments.length>1)for(var u=1;u<arguments.length;u++)c[u-1]=arguments[u];H.push(new Gt(h,c)),H.length===1&&!rt&&setTimeout(jt,0);}function Gt(h,c){this.fun=h,this.array=c;}function N(){}function ue(h){vt("_linkedBinding");}function le(h){vt("dlopen");}function fe(){return []}function de(){return []}function be(h,c){if(!h)throw new Error(c||"assertion error")}function ve(){return false}function Ye(){return Q.now()/1e3}function dt(h){var c=Math.floor((Date.now()-Q.now())*.001),u=Q.now()*.001,l=Math.floor(u)+c,p=Math.floor(u%1*1e9);return h&&(l=l-h[0],p=p-h[1],p<0&&(l--,p+=kt)),[l,p]}function X(){return nr}function rr(h){return []}var H,rt,V,ft,Ht,Kt,Xt,Jt,Qt,Vt,zt,Zt,te,ee,re,ne,ie,oe,se,ce,ae,he,pe,ye,me,yt,we,ge,Ee,Be,Ie,_e,Ae,xe,ke,Se,Ue,Te,Ce,Re,Pe,Le,Ne,We,Me,Oe,$e,Fe,qe,De,je,Q,xt,kt,Ge,He,Ke,Xe,Je,Qe,Ve,ze,Ze,tr,er,nr,ir=ot(()=>{v();U();S();H=[],rt=false,ft=-1;Gt.prototype.run=function(){this.fun.apply(null,this.array);};Ht="browser",Kt="x64",Xt="browser",Jt={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Qt=["/usr/bin/node"],Vt=[],zt="v16.8.0",Zt={},te=function(h,c){console.warn((c?c+": ":"")+h);},ee=function(h){vt("binding");},re=function(h){return 0},ne=function(){return "/"},ie=function(h){},oe={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};se=N,ce=[];ae={},he=false,pe={};ye=N,me=N,yt=function(){return {}},we=yt,ge=yt,Ee=N,Be=N,Ie=N,_e={};Ae={inspector:false,debug:false,uv:false,ipv6:false,tls_alpn:false,tls_sni:false,tls_ocsp:false,tls:false,cached_builtins:true},xe=N,ke=N;Se=N,Ue=N,Te=N,Ce=N,Re=N,Pe=void 0,Le=void 0,Ne=void 0,We=N,Me=2,Oe=1,$e="/bin/usr/node",Fe=9229,qe="node",De=[],je=N,Q={now:typeof performance!="undefined"?performance.now.bind(performance):void 0,timing:typeof performance!="undefined"?performance.timing:void 0};Q.now===void 0&&(xt=Date.now(),Q.timing&&Q.timing.navigationStart&&(xt=Q.timing.navigationStart),Q.now=()=>Date.now()-xt);kt=1e9;dt.bigint=function(h){var c=dt(h);return typeof BigInt=="undefined"?c[0]*kt+c[1]:BigInt(c[0]*kt)+BigInt(c[1])};Ge=10,He={},Ke=0;Xe=X,Je=X,Qe=X,Ve=X,ze=X,Ze=N,tr=X,er=X;nr={version:zt,versions:Zt,arch:Kt,platform:Xt,release:oe,_rawDebug:se,moduleLoadList:ce,binding:ee,_linkedBinding:ue,_events:He,_eventsCount:Ke,_maxListeners:Ge,on:X,addListener:Xe,once:Je,off:Qe,removeListener:Ve,removeAllListeners:ze,emit:Ze,prependListener:tr,prependOnceListener:er,listeners:rr,domain:ae,_exiting:he,config:pe,dlopen:le,uptime:Ye,_getActiveRequests:fe,_getActiveHandles:de,reallyExit:ye,_kill:me,cpuUsage:yt,resourceUsage:we,memoryUsage:ge,kill:Ee,exit:Be,openStdin:Ie,allowedNodeEnvironmentFlags:_e,assert:be,features:Ae,_fatalExceptions:xe,setUncaughtExceptionCaptureCallback:ke,hasUncaughtExceptionCaptureCallback:ve,emitWarning:te,nextTick:Yt,_tickCallback:Se,_debugProcess:Ue,_debugEnd:Te,_startProfilerIdleNotifier:Ce,_stopProfilerIdleNotifier:Re,stdout:Pe,stdin:Ne,stderr:Le,abort:We,umask:re,chdir:ie,cwd:ne,env:Jt,title:Ht,argv:Qt,execArgv:Vt,pid:Me,ppid:Oe,execPath:$e,debugPort:Fe,hrtime:dt,argv0:qe,_preload_modules:De,setSourceMapsEnabled:je};});var S=ot(()=>{ir();});function $r(){if(or)return st;or=true,st.byteLength=g,st.toByteArray=I,st.fromByteArray=L;for(var h=[],c=[],u=typeof Uint8Array!="undefined"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,f=l.length;p<f;++p)h[p]=l[p],c[l.charCodeAt(p)]=p;c[45]=62,c[95]=63;function i(y){var E=y.length;if(E%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var b=y.indexOf("=");b===-1&&(b=E);var C=b===E?0:4-b%4;return [b,C]}function g(y){var E=i(y),b=E[0],C=E[1];return (b+C)*3/4-C}function d(y,E,b){return (E+b)*3/4-b}function I(y){var E,b=i(y),C=b[0],$=b[1],T=new u(d(y,C,$)),F=0,D=$>0?C-4:C,M;for(M=0;M<D;M+=4)E=c[y.charCodeAt(M)]<<18|c[y.charCodeAt(M+1)]<<12|c[y.charCodeAt(M+2)]<<6|c[y.charCodeAt(M+3)],T[F++]=E>>16&255,T[F++]=E>>8&255,T[F++]=E&255;return $===2&&(E=c[y.charCodeAt(M)]<<2|c[y.charCodeAt(M+1)]>>4,T[F++]=E&255),$===1&&(E=c[y.charCodeAt(M)]<<10|c[y.charCodeAt(M+1)]<<4|c[y.charCodeAt(M+2)]>>2,T[F++]=E>>8&255,T[F++]=E&255),T}function B(y){return h[y>>18&63]+h[y>>12&63]+h[y>>6&63]+h[y&63]}function m(y,E,b){for(var C,$=[],T=E;T<b;T+=3)C=(y[T]<<16&16711680)+(y[T+1]<<8&65280)+(y[T+2]&255),$.push(B(C));return $.join("")}function L(y){for(var E,b=y.length,C=b%3,$=[],T=16383,F=0,D=b-C;F<D;F+=T)$.push(m(y,F,F+T>D?D:F+T));return C===1?(E=y[b-1],$.push(h[E>>2]+h[E<<4&63]+"==")):C===2&&(E=(y[b-2]<<8)+y[b-1],$.push(h[E>>10]+h[E>>4&63]+h[E<<2&63]+"=")),$.join("")}return st}function Fr(){if(sr)return mt;sr=true;return mt.read=function(h,c,u,l,p){var f,i,g=p*8-l-1,d=(1<<g)-1,I=d>>1,B=-7,m=u?p-1:0,L=u?-1:1,y=h[c+m];for(m+=L,f=y&(1<<-B)-1,y>>=-B,B+=g;B>0;f=f*256+h[c+m],m+=L,B-=8);for(i=f&(1<<-B)-1,f>>=-B,B+=l;B>0;i=i*256+h[c+m],m+=L,B-=8);if(f===0)f=1-I;else {if(f===d)return i?NaN:(y?-1:1)*(1/0);i=i+Math.pow(2,l),f=f-I;}return (y?-1:1)*i*Math.pow(2,f-l)},mt.write=function(h,c,u,l,p,f){var i,g,d,I=f*8-p-1,B=(1<<I)-1,m=B>>1,L=p===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=l?0:f-1,E=l?1:-1,b=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(g=isNaN(c)?1:0,i=B):(i=Math.floor(Math.log(c)/Math.LN2),c*(d=Math.pow(2,-i))<1&&(i--,d*=2),i+m>=1?c+=L/d:c+=L*Math.pow(2,1-m),c*d>=2&&(i++,d/=2),i+m>=B?(g=0,i=B):i+m>=1?(g=(c*d-1)*Math.pow(2,p),i=i+m):(g=c*Math.pow(2,m-1)*Math.pow(2,p),i=0));p>=8;h[u+y]=g&255,y+=E,g/=256,p-=8);for(i=i<<p|g,I+=p;I>0;h[u+y]=i&255,y+=E,i/=256,I-=8);h[u+y-E]|=b*128;},mt}function qr(){if(cr)return z;cr=true;let h=$r(),c=Fr(),u=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;z.Buffer=i,z.SlowBuffer=$,z.INSPECT_MAX_BYTES=50;let l=2147483647;z.kMaxLength=l,i.TYPED_ARRAY_SUPPORT=p(),!i.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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.");function p(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch(r){return false}}Object.defineProperty(i.prototype,"parent",{enumerable:true,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:true,get:function(){if(i.isBuffer(this))return this.byteOffset}});function f(r){if(r>l)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,i.prototype),t}function i(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(r)}return g(r,t,e)}i.poolSize=8192;function g(r,t,e){if(typeof r=="string")return m(r,t);if(ArrayBuffer.isView(r))return y(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(G(r,ArrayBuffer)||r&&G(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(G(r,SharedArrayBuffer)||r&&G(r.buffer,SharedArrayBuffer)))return E(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return i.from(n,t,e);let o=b(r);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return i.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}i.from=function(r,t,e){return g(r,t,e)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function d(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function I(r,t,e){return d(r),r<=0?f(r):t!==void 0?typeof e=="string"?f(r).fill(t,e):f(r).fill(t):f(r)}i.alloc=function(r,t,e){return I(r,t,e)};function B(r){return d(r),f(r<0?0:C(r)|0)}i.allocUnsafe=function(r){return B(r)},i.allocUnsafeSlow=function(r){return B(r)};function m(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!i.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=T(r,t)|0,n=f(e),o=n.write(r,t);return o!==e&&(n=n.slice(0,o)),n}function L(r){let t=r.length<0?0:C(r.length)|0,e=f(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}function y(r){if(G(r,Uint8Array)){let t=new Uint8Array(r);return E(t.buffer,t.byteOffset,t.byteLength)}return L(r)}function E(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,i.prototype),n}function b(r){if(i.isBuffer(r)){let t=C(r.length)|0,e=f(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||_t(r.length)?f(0):L(r);if(r.type==="Buffer"&&Array.isArray(r.data))return L(r.data)}function C(r){if(r>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return r|0}function $(r){return +r!=r&&(r=0),i.alloc(+r)}i.isBuffer=function(t){return t!=null&&t._isBuffer===true&&t!==i.prototype},i.compare=function(t,e){if(G(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),G(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,o=e.length;for(let s=0,a=Math.min(n,o);s<a;++s)if(t[s]!==e[s]){n=t[s],o=e[s];break}return n<o?-1:o<n?1:0},i.isEncoding=function(t){switch(String(t).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 true;default:return false}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return i.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let o=i.allocUnsafe(e),s=0;for(n=0;n<t.length;++n){let a=t[n];if(G(a,Uint8Array))s+a.length>o.length?(i.isBuffer(a)||(a=i.from(a)),a.copy(o,s)):Uint8Array.prototype.set.call(o,a,s);else if(i.isBuffer(a))a.copy(o,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length;}return o};function T(r,t){if(i.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||G(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===true;if(!n&&e===0)return 0;let o=false;for(;;)switch(t){case "ascii":case "latin1":case "binary":return e;case "utf8":case "utf-8":return It(r).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return e*2;case "hex":return e>>>1;case "base64":return qt(r).length;default:if(o)return n?-1:It(r).length;t=(""+t).toLowerCase(),o=true;}}i.byteLength=T;function F(r,t,e){let n=false;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return "";for(r||(r="utf8");;)switch(r){case "hex":return Ir(this,t,e);case "utf8":case "utf-8":return Rt(this,t,e);case "ascii":return Er(this,t,e);case "latin1":case "binary":return Br(this,t,e);case "base64":return wr(this,t,e);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return _r(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=true;}}i.prototype._isBuffer=true;function D(r,t,e){let n=r[t];r[t]=r[e],r[e]=n;}i.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)D(this,e,e+1);return this},i.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},i.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},i.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Rt(this,0,t):F.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?true:i.compare(this,t)===0},i.prototype.inspect=function(){let t="",e=z.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},u&&(i.prototype[u]=i.prototype.inspect),i.prototype.compare=function(t,e,n,o,s){if(G(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),o===void 0&&(o=0),s===void 0&&(s=this.length),e<0||n>t.length||o<0||s>this.length)throw new RangeError("out of range index");if(o>=s&&e>=n)return 0;if(o>=s)return -1;if(e>=n)return 1;if(e>>>=0,n>>>=0,o>>>=0,s>>>=0,this===t)return 0;let a=s-o,w=n-e,x=Math.min(a,w),A=this.slice(o,s),k=t.slice(e,n);for(let _=0;_<x;++_)if(A[_]!==k[_]){a=A[_],w=k[_];break}return a<w?-1:w<a?1:0};function M(r,t,e,n,o){if(r.length===0)return -1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,_t(e)&&(e=o?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(o)return -1;e=r.length-1;}else if(e<0)if(o)e=0;else return -1;if(typeof t=="string"&&(t=i.from(t,n)),i.isBuffer(t))return t.length===0?-1:Ct(r,t,e,n,o);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ct(r,[t],e,n,o);throw new TypeError("val must be string, number or Buffer")}function Ct(r,t,e,n,o){let s=1,a=r.length,w=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return -1;s=2,a/=2,w/=2,e/=2;}function x(k,_){return s===1?k[_]:k.readUInt16BE(_*s)}let A;if(o){let k=-1;for(A=e;A<a;A++)if(x(r,A)===x(t,k===-1?0:A-k)){if(k===-1&&(k=A),A-k+1===w)return k*s}else k!==-1&&(A-=A-k),k=-1;}else for(e+w>a&&(e=a-w),A=e;A>=0;A--){let k=true;for(let _=0;_<w;_++)if(x(r,A+_)!==x(t,_)){k=false;break}if(k)return A}return -1}i.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1},i.prototype.indexOf=function(t,e,n){return M(this,t,e,n,true)},i.prototype.lastIndexOf=function(t,e,n){return M(this,t,e,n,false)};function lr(r,t,e,n){e=Number(e)||0;let o=r.length-e;n?(n=Number(n),n>o&&(n=o)):n=o;let s=t.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let w=parseInt(t.substr(a*2,2),16);if(_t(w))return a;r[e+a]=w;}return a}function fr(r,t,e,n){return at(It(t,r.length-e),r,e,n)}function dr(r,t,e,n){return at(kr(t),r,e,n)}function yr(r,t,e,n){return at(qt(t),r,e,n)}function mr(r,t,e,n){return at(vr(t,r.length-e),r,e,n)}i.prototype.write=function(t,e,n,o){if(e===void 0)o="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")o=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let a=false;for(;;)switch(o){case "hex":return lr(this,t,e,n);case "utf8":case "utf-8":return fr(this,t,e,n);case "ascii":case "latin1":case "binary":return dr(this,t,e,n);case "base64":return yr(this,t,e,n);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return mr(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=true;}},i.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function wr(r,t,e){return t===0&&e===r.length?h.fromByteArray(r):h.fromByteArray(r.slice(t,e))}function Rt(r,t,e){e=Math.min(r.length,e);let n=[],o=t;for(;o<e;){let s=r[o],a=null,w=s>239?4:s>223?3:s>191?2:1;if(o+w<=e){let x,A,k,_;switch(w){case 1:s<128&&(a=s);break;case 2:x=r[o+1],(x&192)===128&&(_=(s&31)<<6|x&63,_>127&&(a=_));break;case 3:x=r[o+1],A=r[o+2],(x&192)===128&&(A&192)===128&&(_=(s&15)<<12|(x&63)<<6|A&63,_>2047&&(_<55296||_>57343)&&(a=_));break;case 4:x=r[o+1],A=r[o+2],k=r[o+3],(x&192)===128&&(A&192)===128&&(k&192)===128&&(_=(s&15)<<18|(x&63)<<12|(A&63)<<6|k&63,_>65535&&_<1114112&&(a=_));}}a===null?(a=65533,w=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=w;}return gr(n)}let Pt=4096;function gr(r){let t=r.length;if(t<=Pt)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Pt));return e}function Er(r,t,e){let n="";e=Math.min(r.length,e);for(let o=t;o<e;++o)n+=String.fromCharCode(r[o]&127);return n}function Br(r,t,e){let n="";e=Math.min(r.length,e);for(let o=t;o<e;++o)n+=String.fromCharCode(r[o]);return n}function Ir(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let o="";for(let s=t;s<e;++s)o+=Sr[r[s]];return o}function _r(r,t,e){let n=r.slice(t,e),o="";for(let s=0;s<n.length-1;s+=2)o+=String.fromCharCode(n[s]+n[s+1]*256);return o}i.prototype.slice=function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let o=this.subarray(t,e);return Object.setPrototypeOf(o,i.prototype),o};function P(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t],s=1,a=0;for(;++a<e&&(s*=256);)o+=this[t+a]*s;return o},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t+--e],s=1;for(;e>0&&(s*=256);)o+=this[t+--e]*s;return o},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t=t>>>0,e||P(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||P(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||P(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readBigUInt64LE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(o)+(BigInt(s)<<BigInt(32))}),i.prototype.readBigUInt64BE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(s)}),i.prototype.readIntLE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=this[t],s=1,a=0;for(;++a<e&&(s*=256);)o+=this[t+a]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o},i.prototype.readIntBE=function(t,e,n){t=t>>>0,e=e>>>0,n||P(t,e,this.length);let o=e,s=1,a=this[t+--o];for(;o>0&&(s*=256);)a+=this[t+--o]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t=t>>>0,e||P(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t=t>>>0,e||P(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},i.prototype.readInt16BE=function(t,e){t=t>>>0,e||P(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},i.prototype.readInt32LE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t=t>>>0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readBigInt64LE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)}),i.prototype.readBigInt64BE=J(function(t){t=t>>>0,et(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&nt(t,this.length-8);let o=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return (BigInt(o)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)}),i.prototype.readFloatLE=function(t,e){return t=t>>>0,e||P(t,4,this.length),c.read(this,t,true,23,4)},i.prototype.readFloatBE=function(t,e){return t=t>>>0,e||P(t,4,this.length),c.read(this,t,false,23,4)},i.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||P(t,8,this.length),c.read(this,t,true,52,8)},i.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||P(t,8,this.length),c.read(this,t,false,52,8)};function q(r,t,e,n,o,s){if(!i.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let w=Math.pow(2,8*n)-1;q(this,t,e,n,w,0);}let s=1,a=0;for(this[e]=t&255;++a<n&&(s*=256);)this[e+a]=t/s&255;return e+n},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,n=n>>>0,!o){let w=Math.pow(2,8*n)-1;q(this,t,e,n,w,0);}let s=n-1,a=1;for(this[e+s]=t&255;--s>=0&&(a*=256);)this[e+s]=t/a&255;return e+n},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,255,0),this[e]=t&255,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function Lt(r,t,e,n,o){Ft(t,n,o,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,a=a>>8,r[e++]=a,e}function Nt(r,t,e,n,o){Ft(t,n,o,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let a=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=a,a=a>>8,r[e+2]=a,a=a>>8,r[e+1]=a,a=a>>8,r[e]=a,e+8}i.prototype.writeBigUInt64LE=J(function(t,e=0){return Lt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=J(function(t,e=0){return Nt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let x=Math.pow(2,8*n-1);q(this,t,e,n,x-1,-x);}let s=0,a=1,w=0;for(this[e]=t&255;++s<n&&(a*=256);)t<0&&w===0&&this[e+s-1]!==0&&(w=1),this[e+s]=(t/a>>0)-w&255;return e+n},i.prototype.writeIntBE=function(t,e,n,o){if(t=+t,e=e>>>0,!o){let x=Math.pow(2,8*n-1);q(this,t,e,n,x-1,-x);}let s=n-1,a=1,w=0;for(this[e+s]=t&255;--s>=0&&(a*=256);)t<0&&w===0&&this[e+s+1]!==0&&(w=1),this[e+s]=(t/a>>0)-w&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e>>>0,n||q(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},i.prototype.writeBigInt64LE=J(function(t,e=0){return Lt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=J(function(t,e=0){return Nt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Wt(r,t,e,n,o,s){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Mt(r,t,e,n,o){return t=+t,e=e>>>0,o||Wt(r,t,e,4),c.write(r,t,e,n,23,4),e+4}i.prototype.writeFloatLE=function(t,e,n){return Mt(this,t,e,true,n)},i.prototype.writeFloatBE=function(t,e,n){return Mt(this,t,e,false,n)};function Ot(r,t,e,n,o){return t=+t,e=e>>>0,o||Wt(r,t,e,8),c.write(r,t,e,n,52,8),e+8}i.prototype.writeDoubleLE=function(t,e,n){return Ot(this,t,e,true,n)},i.prototype.writeDoubleBE=function(t,e,n){return Ot(this,t,e,false,n)},i.prototype.copy=function(t,e,n,o){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<n&&(o=n),o===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-n&&(o=t.length-e+n);let s=o-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,o):Uint8Array.prototype.set.call(t,this.subarray(n,o),e),s},i.prototype.fill=function(t,e,n,o){if(typeof t=="string"){if(typeof e=="string"?(o=e,e=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!i.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(t.length===1){let a=t.charCodeAt(0);(o==="utf8"&&a<128||o==="latin1")&&(t=a);}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else {let a=i.isBuffer(t)?t:i.from(t,o),w=a.length;if(w===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%w];}return this};let tt={};function Bt(r,t,e){tt[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${r}]`,this.stack,delete this.name;}get code(){return r}set code(o){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:o,writable:true});}toString(){return `${this.name} [${r}]: ${this.message}`}};}Bt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Bt("ERR_INVALID_ARG_TYPE",function(r,t){return `The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError),Bt("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,o=e;return Number.isInteger(e)&&Math.abs(e)>2**32?o=$t(String(e)):typeof e=="bigint"&&(o=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(o=$t(o)),o+="n"),n+=` It must be ${t}. Received ${o}`,n},RangeError);function $t(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return `${r.slice(0,e)}${t}`}function br(r,t,e){et(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&nt(t,r.length-(e+1));}function Ft(r,t,e,n,o,s){if(r>e||r<t){let a=typeof t=="bigint"?"n":"",w;throw t===0||t===BigInt(0)?w=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:w=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`,new tt.ERR_OUT_OF_RANGE("value",w,r)}br(n,o,s);}function et(r,t){if(typeof r!="number")throw new tt.ERR_INVALID_ARG_TYPE(t,"number",r)}function nt(r,t,e){throw Math.floor(r)!==r?(et(r,e),new tt.ERR_OUT_OF_RANGE("offset","an integer",r)):t<0?new tt.ERR_BUFFER_OUT_OF_BOUNDS:new tt.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${t}`,r)}let Ar=/[^+/0-9A-Za-z-_]/g;function xr(r){if(r=r.split("=")[0],r=r.trim().replace(Ar,""),r.length<2)return "";for(;r.length%4!==0;)r=r+"=";return r}function It(r,t){t=t||1/0;let e,n=r.length,o=null,s=[];for(let a=0;a<n;++a){if(e=r.charCodeAt(a),e>55295&&e<57344){if(!o){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}o=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),o=e;continue}e=(o-55296<<10|e-56320)+65536;}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=null,e<128){if((t-=1)<0)break;s.push(e);}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128);}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128);}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128);}else throw new Error("Invalid code point")}return s}function kr(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function vr(r,t){let e,n,o,s=[];for(let a=0;a<r.length&&!((t-=2)<0);++a)e=r.charCodeAt(a),n=e>>8,o=e%256,s.push(o),s.push(n);return s}function qt(r){return h.toByteArray(xr(r))}function at(r,t,e,n){let o;for(o=0;o<n&&!(o+e>=t.length||o>=r.length);++o)t[o+e]=r[o];return o}function G(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function _t(r){return r!==r}let Sr=function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let o=0;o<16;++o)t[n+o]=r[e]+r[o];}return t}();function J(r){return typeof BigInt=="undefined"?Ur:r}function Ur(){throw new Error("BigInt not supported")}return z}var st,or,mt,sr,z,cr,Z,Y,ur=ot(()=>{v();U();S();st={},or=false;mt={},sr=false;z={},cr=false;Z=qr();Z.Buffer;Z.SlowBuffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;Y=Z.Buffer,Z.INSPECT_MAX_BYTES,Z.kMaxLength;});var U=ot(()=>{ur();});var hr=Lr((sn,St)=>{v();U();S();var Dr=Object.prototype.hasOwnProperty,O="~";function ct(){}Object.create&&(ct.prototype=Object.create(null),new ct().__proto__||(O=false));function jr(h,c,u){this.fn=h,this.context=c,this.once=u||false;}function ar(h,c,u,l,p){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new jr(u,l||h,p),i=O?O+c:c;return h._events[i]?h._events[i].fn?h._events[i]=[h._events[i],f]:h._events[i].push(f):(h._events[i]=f,h._eventsCount++),h}function wt(h,c){--h._eventsCount===0?h._events=new ct:delete h._events[c];}function W(){this._events=new ct,this._eventsCount=0;}W.prototype.eventNames=function(){var c=[],u,l;if(this._eventsCount===0)return c;for(l in u=this._events)Dr.call(u,l)&&c.push(O?l.slice(1):l);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c};W.prototype.listeners=function(c){var u=O?O+c:c,l=this._events[u];if(!l)return [];if(l.fn)return [l.fn];for(var p=0,f=l.length,i=new Array(f);p<f;p++)i[p]=l[p].fn;return i};W.prototype.listenerCount=function(c){var u=O?O+c:c,l=this._events[u];return l?l.fn?1:l.length:0};W.prototype.emit=function(c,u,l,p,f,i){var g=O?O+c:c;if(!this._events[g])return false;var d=this._events[g],I=arguments.length,B,m;if(d.fn){switch(d.once&&this.removeListener(c,d.fn,void 0,true),I){case 1:return d.fn.call(d.context),true;case 2:return d.fn.call(d.context,u),true;case 3:return d.fn.call(d.context,u,l),true;case 4:return d.fn.call(d.context,u,l,p),true;case 5:return d.fn.call(d.context,u,l,p,f),true;case 6:return d.fn.call(d.context,u,l,p,f,i),true}for(m=1,B=new Array(I-1);m<I;m++)B[m-1]=arguments[m];d.fn.apply(d.context,B);}else {var L=d.length,y;for(m=0;m<L;m++)switch(d[m].once&&this.removeListener(c,d[m].fn,void 0,true),I){case 1:d[m].fn.call(d[m].context);break;case 2:d[m].fn.call(d[m].context,u);break;case 3:d[m].fn.call(d[m].context,u,l);break;case 4:d[m].fn.call(d[m].context,u,l,p);break;default:if(!B)for(y=1,B=new Array(I-1);y<I;y++)B[y-1]=arguments[y];d[m].fn.apply(d[m].context,B);}}return true};W.prototype.on=function(c,u,l){return ar(this,c,u,l,false)};W.prototype.once=function(c,u,l){return ar(this,c,u,l,true)};W.prototype.removeListener=function(c,u,l,p){var f=O?O+c:c;if(!this._events[f])return this;if(!u)return wt(this,f),this;var i=this._events[f];if(i.fn)i.fn===u&&(!p||i.once)&&(!l||i.context===l)&&wt(this,f);else {for(var g=0,d=[],I=i.length;g<I;g++)(i[g].fn!==u||p&&!i[g].once||l&&i[g].context!==l)&&d.push(i[g]);d.length?this._events[f]=d.length===1?d[0]:d:wt(this,f);}return this};W.prototype.removeAllListeners=function(c){var u;return c?(u=O?O+c:c,this._events[u]&&wt(this,u)):(this._events=new ct,this._eventsCount=0),this};W.prototype.off=W.prototype.removeListener;W.prototype.addListener=W.prototype.on;W.prefixed=O;W.EventEmitter=W;typeof St!="undefined"&&(St.exports=W);});v();U();S();v();U();S();v();U();S();v();U();S();var ut=Mr(hr());var Ut=class extends ut.default{constructor(u,l){super();R(this,"socket");this.socket=new window.WebSocket(u,l.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=p=>this.emit("message",p.data),this.socket.onerror=p=>this.emit("error",p),this.socket.onclose=p=>{this.emit("close",p.code,p.reason);};}send(u,l,p){let f=p||l;try{this.socket.send(u),f();}catch(i){f(i);}}close(u,l){this.socket.close(u,l);}addEventListener(u,l,p){this.socket.addEventListener(u,l,p);}};function pr(h,c){return new Ut(h,c)}v();U();S();v();U();S();var gt=class{encode(c){return JSON.stringify(c)}decode(c){return JSON.parse(c)}};var Et=class extends ut.default{constructor(u,l="ws://localhost:8080",m={},I,B){var L=m,{autoconnect:p=true,reconnect:f=true,reconnect_interval:i=1e3,max_reconnects:g=5}=L,d=lt(L,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);super();R(this,"address");R(this,"rpc_id");R(this,"queue");R(this,"options");R(this,"autoconnect");R(this,"ready");R(this,"reconnect");R(this,"reconnect_timer_id");R(this,"reconnect_interval");R(this,"max_reconnects");R(this,"rest_options");R(this,"current_reconnects");R(this,"generate_request_id");R(this,"socket");R(this,"webSocketFactory");R(this,"dataPack");this.webSocketFactory=u,this.queue={},this.rpc_id=0,this.address=l,this.autoconnect=p,this.ready=false,this.reconnect=f,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=g,this.rest_options=d,this.current_reconnects=0,this.generate_request_id=I||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),B?this.dataPack=B:this.dataPack=new gt,this.autoconnect&&this._connect(this.address,it({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options));}connect(){this.socket||this._connect(this.address,it({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options));}call(u,l,p,f){return !f&&typeof p=="object"&&(f=p,p=null),new Promise((i,g)=>{if(!this.ready)return g(new Error("socket not ready"));let d=this.generate_request_id(u,l),I={jsonrpc:"2.0",method:u,params:l||void 0,id:d};this.socket.send(this.dataPack.encode(I),f,B=>{if(B)return g(B);this.queue[d]={promise:[i,g]},p&&(this.queue[d].timeout=setTimeout(()=>{delete this.queue[d],g(new Error("reply timeout"));},p));});})}async login(u){let l=await this.call("rpc.login",u);if(!l)throw new Error("authentication failed");return l}async listMethods(){return await this.call("__listMethods")}notify(u,l){return new Promise((p,f)=>{if(!this.ready)return f(new Error("socket not ready"));let i={jsonrpc:"2.0",method:u,params:l};this.socket.send(this.dataPack.encode(i),g=>{if(g)return f(g);p();});})}async subscribe(u){typeof u=="string"&&(u=[u]);let l=await this.call("rpc.on",u);if(typeof u=="string"&&l[u]!=="ok")throw new Error("Failed subscribing to an event '"+u+"' with: "+l[u]);return l}async unsubscribe(u){typeof u=="string"&&(u=[u]);let l=await this.call("rpc.off",u);if(typeof u=="string"&&l[u]!=="ok")throw new Error("Failed unsubscribing from an event with: "+l);return l}close(u,l){this.socket&&this.socket.close(u||1e3,l);}setAutoReconnect(u){this.reconnect=u;}setReconnectInterval(u){this.reconnect_interval=u;}setMaxReconnects(u){this.max_reconnects=u;}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(u,l){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(u,l),this.socket.addEventListener("open",()=>{this.ready=true,this.emit("open"),this.current_reconnects=0;}),this.socket.addEventListener("message",({data:p})=>{p instanceof ArrayBuffer&&(p=Y.from(p).toString());try{p=this.dataPack.decode(p);}catch(f){return}if(p.notification&&this.listeners(p.notification).length){if(!Object.keys(p.params).length)return this.emit(p.notification);let f=[p.notification];if(p.params.constructor===Object)f.push(p.params);else for(let i=0;i<p.params.length;i++)f.push(p.params[i]);return Promise.resolve().then(()=>{this.emit.apply(this,f);})}if(!this.queue[p.id])return p.method?Promise.resolve().then(()=>{this.emit(p.method,p==null?void 0:p.params);}):void 0;"error"in p=="result"in p&&this.queue[p.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[p.id].timeout&&clearTimeout(this.queue[p.id].timeout),p.error?this.queue[p.id].promise[1](p.error):this.queue[p.id].promise[0](p.result),delete this.queue[p.id];}),this.socket.addEventListener("error",p=>this.emit("error",p)),this.socket.addEventListener("close",({code:p,reason:f})=>{this.ready&&setTimeout(()=>this.emit("close",p,f),0),this.ready=false,this.socket=void 0,p!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(u,l),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",p,f),1));});}};v();U();S();var Tt=class extends Et{constructor(c="ws://localhost:8080",d={},g){var I=d,{autoconnect:u=true,reconnect:l=true,reconnect_interval:p=1e3,max_reconnects:f=5}=I,i=lt(I,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);super(pr,c,it({autoconnect:u,reconnect:l,reconnect_interval:p,max_reconnects:f},i),g);}};/*! Bundled license information:
@jspm/core/nodelibs/browser/buffer.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
*/exports.Client=Ut;return exports;})({});
*/exports.Client=Tt;return exports;})({});

@@ -12,9 +12,8 @@ 'use strict';

* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @param {(String|Array)} protocols - a list of protocols
* @param {WebSocketBrowserOptions} options - websocket options
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address, options, protocols) {
constructor(address, options) {
super();
this.socket = new window.WebSocket(address, protocols);
this.socket = new window.WebSocket(address, options.protocols);
this.socket.onopen = () => this.emit("open");

@@ -404,3 +403,4 @@ this.socket.onmessage = (event) => this.emit("message", event.data);

reconnect_interval = 1e3,
max_reconnects = 5
max_reconnects = 5,
...rest_options
} = {}, generate_request_id) {

@@ -414,3 +414,4 @@ super(

reconnect_interval,
max_reconnects
max_reconnects,
...rest_options
},

@@ -417,0 +418,0 @@ generate_request_id

@@ -22,2 +22,52 @@ import { EventEmitter } from 'eventemitter3';

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
type WebSocketBrowserOptions = {
/**
* One or more protocols passed to the websocket constructor
* @link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
*/
protocols?: string | string[];
};
declare class WebSocketBrowserImpl extends EventEmitter {
socket: BrowserWebSocketType;
/** Instantiate a WebSocket class
* @constructor
* @param {String} address - url to a websocket server
* @param {WebSocketBrowserOptions} options - websocket options
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address: string, options: WebSocketBrowserOptions);
/**
* Sends data through a websocket connection
* @method
* @param {(String|Object)} data - data to be sent via websocket
* @param {Object} optionsOrCallback - ws options
* @param {Function} callback - a callback called once the data is sent
* @return {Undefined}
*/
send(data: Parameters<BrowserWebSocketType["send"]>[0], optionsOrCallback: (error?: Error) => void | Parameters<NodeWebSocketType["send"]>[1], callback?: () => void): void;
/**
* Closes an underlying socket
* @method
* @param {Number} code - status code explaining why the connection is being closed
* @param {String} reason - a description why the connection is closing
* @return {Undefined}
* @throws {Error}
*/
close(code?: number, reason?: string): void;
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
/**
* factory method for common WebSocket instance
* @method
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @return {Undefined}
*/
declare function WebSocket$1(address: string, options: IWSClientAdditionalOptions & WebSocketBrowserOptions): WebSocketBrowserImpl;
interface DataPack<T, R extends string | ArrayBufferLike | Blob | ArrayBufferView> {

@@ -202,50 +252,6 @@ encode(value: T): R;

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
declare class WebSocketBrowserImpl extends EventEmitter {
socket: BrowserWebSocketType;
/** Instantiate a WebSocket class
* @constructor
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @param {(String|Array)} protocols - a list of protocols
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address: string, options: {}, protocols?: string | string[]);
/**
* Sends data through a websocket connection
* @method
* @param {(String|Object)} data - data to be sent via websocket
* @param {Object} optionsOrCallback - ws options
* @param {Function} callback - a callback called once the data is sent
* @return {Undefined}
*/
send(data: Parameters<BrowserWebSocketType["send"]>[0], optionsOrCallback: (error?: Error) => void | Parameters<NodeWebSocketType["send"]>[1], callback?: () => void): void;
/**
* Closes an underlying socket
* @method
* @param {Number} code - status code explaining why the connection is being closed
* @param {String} reason - a description why the connection is closing
* @return {Undefined}
* @throws {Error}
*/
close(code?: number, reason?: string): void;
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
/**
* factory method for common WebSocket instance
* @method
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @return {Undefined}
*/
declare function WebSocket$1(address: string, options: IWSClientAdditionalOptions): WebSocketBrowserImpl;
declare class Client extends CommonClient {
constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, }?: IWSClientAdditionalOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);
constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, ...rest_options }?: IWSClientAdditionalOptions & WebSocketBrowserOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);
}
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, WebSocket$1 as WebSocket };
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, WebSocket$1 as WebSocket, type WebSocketBrowserOptions };

@@ -22,2 +22,52 @@ import { EventEmitter } from 'eventemitter3';

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
type WebSocketBrowserOptions = {
/**
* One or more protocols passed to the websocket constructor
* @link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
*/
protocols?: string | string[];
};
declare class WebSocketBrowserImpl extends EventEmitter {
socket: BrowserWebSocketType;
/** Instantiate a WebSocket class
* @constructor
* @param {String} address - url to a websocket server
* @param {WebSocketBrowserOptions} options - websocket options
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address: string, options: WebSocketBrowserOptions);
/**
* Sends data through a websocket connection
* @method
* @param {(String|Object)} data - data to be sent via websocket
* @param {Object} optionsOrCallback - ws options
* @param {Function} callback - a callback called once the data is sent
* @return {Undefined}
*/
send(data: Parameters<BrowserWebSocketType["send"]>[0], optionsOrCallback: (error?: Error) => void | Parameters<NodeWebSocketType["send"]>[1], callback?: () => void): void;
/**
* Closes an underlying socket
* @method
* @param {Number} code - status code explaining why the connection is being closed
* @param {String} reason - a description why the connection is closing
* @return {Undefined}
* @throws {Error}
*/
close(code?: number, reason?: string): void;
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
/**
* factory method for common WebSocket instance
* @method
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @return {Undefined}
*/
declare function WebSocket$1(address: string, options: IWSClientAdditionalOptions & WebSocketBrowserOptions): WebSocketBrowserImpl;
interface DataPack<T, R extends string | ArrayBufferLike | Blob | ArrayBufferView> {

@@ -202,50 +252,6 @@ encode(value: T): R;

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
declare class WebSocketBrowserImpl extends EventEmitter {
socket: BrowserWebSocketType;
/** Instantiate a WebSocket class
* @constructor
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @param {(String|Array)} protocols - a list of protocols
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address: string, options: {}, protocols?: string | string[]);
/**
* Sends data through a websocket connection
* @method
* @param {(String|Object)} data - data to be sent via websocket
* @param {Object} optionsOrCallback - ws options
* @param {Function} callback - a callback called once the data is sent
* @return {Undefined}
*/
send(data: Parameters<BrowserWebSocketType["send"]>[0], optionsOrCallback: (error?: Error) => void | Parameters<NodeWebSocketType["send"]>[1], callback?: () => void): void;
/**
* Closes an underlying socket
* @method
* @param {Number} code - status code explaining why the connection is being closed
* @param {String} reason - a description why the connection is closing
* @return {Undefined}
* @throws {Error}
*/
close(code?: number, reason?: string): void;
addEventListener<K extends keyof WebSocketEventMap>(type: K, listener: (ev: WebSocketEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
/**
* factory method for common WebSocket instance
* @method
* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @return {Undefined}
*/
declare function WebSocket$1(address: string, options: IWSClientAdditionalOptions): WebSocketBrowserImpl;
declare class Client extends CommonClient {
constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, }?: IWSClientAdditionalOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);
constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, ...rest_options }?: IWSClientAdditionalOptions & WebSocketBrowserOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);
}
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, WebSocket$1 as WebSocket };
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, WebSocket$1 as WebSocket, type WebSocketBrowserOptions };

@@ -10,9 +10,8 @@ import { Buffer } from 'buffer';

* @param {String} address - url to a websocket server
* @param {(Object)} options - websocket options
* @param {(String|Array)} protocols - a list of protocols
* @param {WebSocketBrowserOptions} options - websocket options
* @return {WebSocketBrowserImpl} - returns a WebSocket instance
*/
constructor(address, options, protocols) {
constructor(address, options) {
super();
this.socket = new window.WebSocket(address, protocols);
this.socket = new window.WebSocket(address, options.protocols);
this.socket.onopen = () => this.emit("open");

@@ -402,3 +401,4 @@ this.socket.onmessage = (event) => this.emit("message", event.data);

reconnect_interval = 1e3,
max_reconnects = 5
max_reconnects = 5,
...rest_options
} = {}, generate_request_id) {

@@ -412,3 +412,4 @@ super(

reconnect_interval,
max_reconnects
max_reconnects,
...rest_options
},

@@ -415,0 +416,0 @@ generate_request_id

@@ -435,2 +435,15 @@ import { EventEmitter } from 'eventemitter3';

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
type WebSocketBrowserOptions = {
/**
* One or more protocols passed to the websocket constructor
* @link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
*/
protocols?: string | string[];
};
declare class Client extends CommonClient {

@@ -440,2 +453,2 @@ constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, ...rest_options }?: IWSClientAdditionalOptions & NodeWebSocketTypeOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);

export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, Server, WebSocket$1 as WebSocket, createError };
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, Server, WebSocket$1 as WebSocket, type WebSocketBrowserOptions, createError };

@@ -435,2 +435,15 @@ import { EventEmitter } from 'eventemitter3';

/**
* WebSocket implements a browser-side WebSocket specification.
* @module Client
*/
type WebSocketBrowserOptions = {
/**
* One or more protocols passed to the websocket constructor
* @link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
*/
protocols?: string | string[];
};
declare class Client extends CommonClient {

@@ -440,2 +453,2 @@ constructor(address?: string, { autoconnect, reconnect, reconnect_interval, max_reconnects, ...rest_options }?: IWSClientAdditionalOptions & NodeWebSocketTypeOptions, generate_request_id?: (method: string, params: object | Array<any>) => number | string);

export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, Server, WebSocket$1 as WebSocket, createError };
export { type BrowserWebSocketType, Client, CommonClient, type DataPack, DefaultDataPack, type ICommonWebSocket, type ICommonWebSocketFactory, type IQueue, type IWSClientAdditionalOptions, type IWSRequestParams, type NodeWebSocketType, type NodeWebSocketTypeOptions, Server, WebSocket$1 as WebSocket, type WebSocketBrowserOptions, createError };
{
"name": "rpc-websockets",
"version": "9.2.0",
"version": "9.3.0",
"description": "JSON-RPC 2.0 implementation over WebSockets for Node.js",

@@ -8,11 +8,8 @@ "exports": {

"import": "./dist/index.browser.mjs",
"require": "./dist/index.browser.cjs",
"types": "./dist/index.browser.d.ts"
"require": "./dist/index.browser.cjs"
},
"node": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"types": "./dist/index.d.ts"
"require": "./dist/index.cjs"
}
},

@@ -19,0 +16,0 @@ "browser": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display