iosignal 4.8.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/io.d.ts +3 -1
- package/dist/io.js +3 -3
- package/dist/io.js.map +1 -1
- package/dist/io.min.js +4 -4
- package/dist/io.min.js.map +1 -1
- package/dist/iosignal.js +120 -524
- package/dist/types/client/IOCore.d.ts +1 -0
- package/dist/types/client/browser/IOWebSocket.d.ts +1 -1
- package/dist/types/common/constants.d.ts +7 -6
- package/package.json +2 -2
- package/src/auth/BohoAuth.js +36 -41
- package/src/client/IOCore.js +27 -26
- package/src/common/constants.js +10 -17
- package/src/server/Manager.js +7 -7
- package/src/server/Metrics.js +155 -0
- package/src/server/RemoteCore.js +6 -19
- package/src/server/Server.js +15 -15
- package/src/server/serverOption.js +1 -2
- package/src/services/sudoService.js +5 -5
package/dist/iosignal.js
CHANGED
|
@@ -2,18 +2,18 @@ import require$$0$2, { Transform } from 'stream';
|
|
|
2
2
|
import net from 'net';
|
|
3
3
|
import require$$0$3 from 'events';
|
|
4
4
|
import require$$1$1 from 'https';
|
|
5
|
-
import require$$2
|
|
5
|
+
import require$$2 from 'http';
|
|
6
6
|
import require$$4 from 'tls';
|
|
7
7
|
import require$$1 from 'crypto';
|
|
8
8
|
import require$$7 from 'url';
|
|
9
9
|
import require$$0 from 'zlib';
|
|
10
|
-
import fs, { readFileSync } from 'fs';
|
|
11
|
-
import path from 'path';
|
|
12
|
-
import require$$2, { networkInterfaces } from 'os';
|
|
13
10
|
import require$$0$1 from 'buffer';
|
|
11
|
+
import { networkInterfaces } from 'os';
|
|
12
|
+
import fs, { readFileSync } from 'fs';
|
|
14
13
|
import { memoryUsage } from 'process';
|
|
14
|
+
import path from 'path';
|
|
15
15
|
|
|
16
|
-
var version$1 = "
|
|
16
|
+
var version$1 = "5.0.0";
|
|
17
17
|
var pkg = {
|
|
18
18
|
version: version$1};
|
|
19
19
|
|
|
@@ -385,11 +385,13 @@ var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
|
385
385
|
* @property {number} CONNECTING
|
|
386
386
|
* @property {number} OPEN
|
|
387
387
|
* @property {number} SERVER_READY
|
|
388
|
-
* @property {number}
|
|
389
|
-
* @property {number}
|
|
390
|
-
* @property {number} READY
|
|
388
|
+
* @property {number} AUTH_REQ
|
|
389
|
+
* @property {number} AUTH_RES
|
|
391
390
|
* @property {number} AUTH_FAIL
|
|
392
391
|
* @property {number} AUTH_CLEAR
|
|
392
|
+
* @property {number} CID_REQ
|
|
393
|
+
* @property {number} CID_RES
|
|
394
|
+
* @property {number} READY
|
|
393
395
|
* @property {number} CLOSING
|
|
394
396
|
* @property {number} CLOSED
|
|
395
397
|
* @property {number} STOP
|
|
@@ -401,11 +403,10 @@ const STATE = {
|
|
|
401
403
|
OPEN: 1,
|
|
402
404
|
SERVER_READY: 10,
|
|
403
405
|
AUTH_REQ: 11,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
AUTH_CLEAR: 16,
|
|
406
|
+
AUTH_RES: 12,
|
|
407
|
+
AUTH_FAIL: 13,
|
|
408
|
+
AUTH_CLEAR: 14,
|
|
409
|
+
|
|
409
410
|
CID_REQ: 17,
|
|
410
411
|
CID_RES: 18,
|
|
411
412
|
READY: 19,
|
|
@@ -520,15 +521,7 @@ let IOMsg = {
|
|
|
520
521
|
|
|
521
522
|
// DO NOT USE: 0xB0~ 0xBF
|
|
522
523
|
// Boho module using this numbers.
|
|
523
|
-
|
|
524
|
-
// AUTH_NONCE: 0xB1,
|
|
525
|
-
// AUTH_HMAC: 0xB2,
|
|
526
|
-
// AUTH_ACK: 0xB3,
|
|
527
|
-
// AUTH_FAIL: 0xB4,
|
|
528
|
-
// AUTH_EXT: 0xB5,
|
|
529
|
-
// ENC_PACK : 0xB6,
|
|
530
|
-
// ENC_E2E : 0xB7,
|
|
531
|
-
// ENC_488 : 0xB8
|
|
524
|
+
|
|
532
525
|
// reserved ~0xBF
|
|
533
526
|
|
|
534
527
|
// C. IO status contorl.
|
|
@@ -753,14 +746,14 @@ const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1
|
|
|
753
746
|
*
|
|
754
747
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
755
748
|
* @license MIT
|
|
756
|
-
*/var l=(s||(s=1,function(t){const e=function(){if(o)return h;o=1,h.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},h.toByteArray=function(t){var n,i,o=f(t),s=o[0],u=o[1],h=new r(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),a=0,c=u>0?s-4:s;for(i=0;i<c;i+=4)n=e[t.charCodeAt(i)]<<18|e[t.charCodeAt(i+1)]<<12|e[t.charCodeAt(i+2)]<<6|e[t.charCodeAt(i+3)],h[a++]=n>>16&255,h[a++]=n>>8&255,h[a++]=255&n;return 2===u&&(n=e[t.charCodeAt(i)]<<2|e[t.charCodeAt(i+1)]>>4,h[a++]=255&n),1===u&&(n=e[t.charCodeAt(i)]<<10|e[t.charCodeAt(i+1)]<<4|e[t.charCodeAt(i+2)]>>2,h[a++]=n>>8&255,h[a++]=255&n),h},h.fromByteArray=function(e){for(var r,n=e.length,i=n%3,o=[],f=16383,u=0,h=n-i;u<h;u+=f)o.push(s(e,u,u+f>h?h:u+f));return 1===i?(r=e[n-1],o.push(t[r>>2]+t[r<<4&63]+"==")):2===i&&(r=(e[n-2]<<8)+e[n-1],o.push(t[r>>10]+t[r>>4&63]+t[r<<2&63]+"=")),o.join("")};for(var t=[],e=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return -1===r&&(r=e),[r,r===e?0:4-r%4]}function s(e,r,n){for(var i,o,f=[],s=r;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),f.push(t[(o=i)>>18&63]+t[o>>12&63]+t[o>>6&63]+t[63&o]);return f.join("")}return e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63,h}(),r=c(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return +t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function f(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|d(t,e);let n=f(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Q(t,Uint8Array)){const e=new Uint8Array(t);return y(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return y(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Q(t,SharedArrayBuffer)||t&&Q(t.buffer,SharedArrayBuffer)))return y(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|g(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||X(t.length)?f(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return a(t),f(t<0?0:0|g(t))}function p(t){const e=t.length<0?0:0|g(t.length),r=f(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function y(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function g(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&true===arguments[2];if(!n&&0===r)return 0;let i=false;for(;;)switch(e){case "ascii":case "latin1":case "binary":return r;case "utf8":case "utf-8":return G(t).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*r;case "hex":return r>>>1;case "base64":return V(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=true;}}function b(t,e,r){let n=false;if((void 0===e||e<0)&&(e=0),e>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(e>>>=0))return "";for(t||(t="utf8");;)switch(t){case "hex":return O(this,e,r);case "utf8":case "utf-8":return v(this,e,r);case "ascii":return S(this,e,r);case "latin1":case "binary":return R(this,e,r);case "base64":return L(this,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return M(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=true;}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function B(t,e,r,n,i){if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,s/=2,u/=2,r/=2;}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else -1!==n&&(o-=o-n),n=-1;}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=true;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=false;break}if(r)return o}return -1}function E(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(X(n))return f;t[r+f]=n;}return f}function A(t,e,r,n){return J(G(e,t.length-r),t,r,n)}function _(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function U(t,e,r,n){return J(V(e),t,r,n)}function I(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function L(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function v(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u));}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f;}return function(t){const e=t.length;if(e<=T)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=T));return r}(n)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return false}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:true,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:true,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return a(t),t<=0?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)}(t,e,r)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&true===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Q(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else {if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i);}i+=e.length;}return n},s.byteLength=d,s.prototype._isBuffer=true,s.prototype.swap16=function(){const 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)w(this,e,e+1);return this},s.prototype.swap32=function(){const 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)w(this,e,e+3),w(this,e+1,e+2);return this},s.prototype.swap64=function(){const 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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?v(this,0,t):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0);const u=Math.min(o,f),h=this.slice(n,i),a=t.slice(e,r);for(let t=0;t<u;++t)if(h[t]!==a[t]){o=h[t],f=a[t];break}return o<f?-1:f<o?1:0},s.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return B(this,t,e,r,true)},s.prototype.lastIndexOf=function(t,e,r){return B(this,t,e,r,false)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else {if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=false;for(;;)switch(n){case "hex":return E(this,t,e,r);case "utf8":case "utf-8":return A(this,t,e,r);case "ascii":case "latin1":case "binary":return _(this,t,e,r);case "base64":return U(this,t,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=true;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function S(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=W[t[n]];return i}function M(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function C(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n,i){D(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function k(t,e,r,n,i){D(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,n,i,o){return e=+e,n>>>=0,o||P(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function H(t,e,n,i,o){return e=+e,n>>>=0,o||P(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Z((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Z((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return (BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||C(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Z((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return (BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Z((function(t){Y(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||K(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return (BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),r.read(this,t,true,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),r.read(this,t,false,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),r.read(this,t,true,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),r.read(this,t,false,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Z((function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(t,e=0){return k(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n);}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n);}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(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]=255&t,e+4},s.prototype.writeBigInt64LE=Z((function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(t,e=0){return k(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,true,r)},s.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,false,r)},s.prototype.writeDoubleLE=function(t,e,r){return H(this,t,e,true,r)},s.prototype.writeDoubleBE=function(t,e,r){return H(this,t,e,false,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e);}}else "number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else {const o=s.isBuffer(t)?t:s.from(t,n),f=o.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%f];}return this};const F={};function j(t,e,r){F[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${t}]`,this.stack,delete this.name;}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:t,writable:true});}toString(){return `${this.name} [${t}]: ${this.message}`}};}function z(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return `${t.slice(0,r)}${e}`}function D(t,e,r,n,i,o){if(t>r||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new F.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){Y(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||K(e,t.length-(r+1));}(n,i,o);}function Y(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function K(t,e,r){if(Math.floor(t)!==t)throw Y(t,r),new F.ERR_OUT_OF_RANGE("offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,t)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(t,e){return `The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=z(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r);}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function V(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}const W=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i];}return e}();function Z(t){return "undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}}(u)),u);const p=new TextEncoder,y=new TextDecoder,g=d;function d(t,e=0){let r;if(void 0===t||"string"!=typeof t||"number"!=typeof e)throw TypeError("invlaid init variablie type name. ");return (t=t.toUpperCase()).includes("8")?(r=l.Buffer.alloc(1),t.includes("I")?r.writeInt8(e):r.writeUint8(e)):t.includes("16")?(r=l.Buffer.alloc(2),t.includes("I")?t.includes("L")?r.writeInt16LE(e):r.writeInt16BE(e):t.includes("L")?r.writeUint16LE(e):r.writeUint16BE(e)):t.includes("32")?(r=l.Buffer.alloc(4),t.includes("I")?t.includes("L")?r.writeInt32LE(e):r.writeInt32BE(e):t.includes("L")?r.writeUint32LE(e):r.writeUint32BE(e)):t.includes("F")?(r=l.Buffer.alloc(4),t.includes("L")?r.writeFloatLE(e):r.writeFloatBE(e)):t.includes("N")?r=l.Buffer.from(String(e)):console.log(`invalid type: ${t} or initvalue: ${e}`),r}const b=w;function w(t,e,r){let n,i="B";if("number"==typeof e)"number"==typeof r?(n=l.Buffer.alloc(e),0!==r&&n.fill(r),i="B"):(n=l.Buffer.from(String(e)),i="N");else if("string"==typeof e&&"number"==typeof r)i=e.toUpperCase(),n=d(e,r);else if("string"==typeof e&&void 0===r)n=l.Buffer.from(e),i="S";else if(e instanceof Uint8Array&&void 0===r)n=e instanceof l.Buffer?e:l.Buffer.from(e);else if(e instanceof ArrayBuffer&&void 0===r)n=l.Buffer.from(e);else if(ArrayBuffer.isView(e))n=l.Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if("object"==typeof e&&void 0===r)n=l.Buffer.from(JSON.stringify(e)),i="O";else {if("boolean"!=typeof e||void 0!==r)throw TypeError("invalid meta buffer type");{const t=e?1:0;n=l.Buffer.from([t]),i="!";}}return "string"==typeof t&&t.includes("#")&&(t=""),[t,i,n]}const B=m;function m(...t){let e=0;return t.map((t=>{const r=e++;return "number"==typeof t?b(r,"N",t):b(r,t)}))}function E(t){if((t=t.toUpperCase()).includes("8"))return t.includes("I")?"int8":"uint8";if(t.includes("16"))return t.includes("I")?t.includes("L")?"int16_le":"int16_be":t.includes("L")?"uint16_le":"uint16_be";if(t.includes("32"))return t.includes("I")?t.includes("L")?"int32_le":"int32_be":t.includes("L")?"uint32_le":"uint32_be";if(t.includes("F"))return t.includes("L")?"float_le":"float_be";if("B"===t)return "buffer";if("S"===t)return "string";if("N"===t)return "number";if("O"===t)return "object";if("!"===t)return "boolean";throw TypeError("invalid data type")}function A(t,e,r,n){try{const i=E(t);if("int8"==i)return e.readInt8(r);if("uint8"===i)return e.readUint8(r);if("int16_le"===i)return e.readInt16LE(r);if("int16_be"===i)return e.readInt16BE(r);if("uint16_le"===i)return e.readUint16LE(r);if("uint16_be"===i)return e.readUint16BE(r);if("int32_le"===i)return e.readInt32LE(r);if("int32_be"===i)return e.readInt32BE(r);if("uint32_le"===i)return e.readUint32LE(r);if("uint32_be"===i)return e.readUint32BE(r);if("float_le"===i)return e.readFloatLE(r);if("float_be"===i)return e.readFloatBE(r);if("buffer"===i)return e.subarray(r,r+n);if("string"===i){const t=e.subarray(r,r+n);return y.decode(t)}if("number"===i){const t=e.subarray(r,r+n);return Number(y.decode(t))}if("object"===i){const t=e.subarray(r,r+n);return JSON.parse(y.decode(t))}return "boolean"===i?1===e.readInt8(r):void 0}catch(t){}}function _(...t){const e=function(t){let e=[];return t.filter((t=>{if(!Array.isArray(t[0]))return t;e=e.concat(t);})).concat(e)}(t);let r=0;const n=[];let i,o,f=0;if(e.forEach((t=>{const[e,i,o]=t;r+=o.byteLength,("number"==typeof e||e.length>0)&&n.push([e,i,f,o.byteLength]),f=r;})),n.length>0){let t=JSON.stringify(n);i=p.encode(t),o=i.byteLength,r=r+o+2;}const s=l.Buffer.alloc(r);if(f=0,e.forEach((t=>{const e=t[2];s.set(e,f),f+=e.byteLength;})),n.length>0){s.set(i,f);const t=g("16",o);return s.set(t,f+o),s}return s}const U=I;function I(t,e=false){if(void 0===t)throw TypeError("Invalid data type: Undefined");if("string"==typeof t)return p.encode(t);if("number"==typeof t)return Uint8Array.from([t]);if(t instanceof ArrayBuffer){if(e)return new Uint8Array(t);{const e=new Uint8Array(t),r=new Uint8Array(t.byteLength);return r.set(e),r}}if(ArrayBuffer.isView(t)){if(e)return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);{const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=new Uint8Array(t.byteLength);return r.set(e),r}}return p.encode(JSON.stringify(t))}const L=v;function v(t,e=false){const r=I(t,e);return e?l.Buffer.from(r.buffer,r.byteOffset,r.byteLength):l.Buffer.from(r)}const T=S;function S(...t){const e=t.map((t=>v(t)));return l.Buffer.concat(e)}const R=O;function O(...t){try{let e=0,r=0;const n=t.map((t=>I(t)));n.forEach((t=>{e+=t.byteLength;}));const i=new Uint8Array(e);return n.forEach((t=>{i.set(t,r),r+=t.byteLength;})),i}catch(t){console.log(t);}}function M(t){return 0===k(t)?t.byteLength:t.byteLength-k(t)-N}function C(t,e){try{const r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r.byteLength-e-2,i=r.subarray(n,r.byteLength-2),o=y.decode(i),f=JSON.parse(o);if(!Array.isArray(f)||!Array.isArray(f[0]))return;let s=f[0];if(!s)return;if(s.length<3)return;const[u,h,a]=s;if("string"!=typeof h||"number"!=typeof a)return;return f}catch(t){}}const N=2;function x(t){return t instanceof ArrayBuffer&&(t=l.Buffer.from(t)),t instanceof Uint8Array?t.byteLength<=N?0:new DataView(t.buffer,t.byteOffset,t.byteLength).getUint16(t.byteLength-N):0}function k(t){if(t instanceof ArrayBuffer&&(t=l.Buffer.from(t)),t instanceof Uint8Array){const e=t.byteLength;if(e<=N)return 0;const r=x(t);return 0===r||r>e?0:C(t,r)?r:0}return 0}function P(t){const e=M(t);return t.subarray(0,e)}function $(t,e=false){t instanceof ArrayBuffer&&(t=l.Buffer.from(t));const r=x(t);if(0===r)return;let n=C(t,r);return n?e?(n.forEach((t=>{null==t[3]&&(t[1].includes("8")?t[3]=1:t[1].includes("16")?t[3]=2:t[1].includes("32")||t[1].includes("F")?t[3]=4:t[1].includes("!")&&(t[3]=1)),t[4]=E(t[1]);})),n):n:void 0}var H=Object.freeze({__proto__:null,B8:L,B8pack:T,Buffer:l.Buffer,MB:b,MBA:B,NB:g,TAIL_LEN:N,U8:U,U8pack:R,equal:function(t,e){if(t.byteLength!==e.byteLength)return false;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return false;return true},getBuffer:P,getBufferSize:M,getMeta:$,getMetaDetail:function(t){return $(t,true)},getMetaSize:k,hex:function(t){return Array.prototype.map.call(new Uint8Array(t),(t=>("00"+t.toString(16)).slice(-2))).join("")},meta:function(...t){return $(_(...t))},metaBuffer:w,metaBufferArguments:m,metaDetail:function(...t){return $(_(...t),true)},numberBuffer:d,pack:_,parseBuffer:v,parseBufferThenConcat:S,parseMetaInfo:C,parseTypeName:E,parseUint8Array:I,parseUint8ThenConcat:O,rawPack:function(...t){return P(_(...t))},readTail:x,readTypedBuffer:A,unpack:function(t,e){const r=e||$(t);if(!r)return;const n=l.Buffer.from(t),i={};let o=0;if(r.forEach((t=>{const[e,r,f,s]=t;let u=A(r,n,f,s);null!=u&&(i[e]=u,s&&(o+=s));})),e&&n.byteLength!==o){let t=n.byteLength-o,e=A("b",n,o,t);if(null==e)return;i.$OTHERS=e;}let f=0,s=[];for(;i[f];)s.push(i[f++]);return s.length>0&&(i.args=s,i.$=i.args),i}});const F={hash:function(t){return i(H.U8(t))},hex:function(t){return H.B8(i(H.U8(t))).toString("hex")},base64:function(t){return H.B8(i(H.U8(t))).toString("base64")}};F.hmac=function(t,e){return function(t,e){const r=new n(t).update(e),i=r.digest();return r.clean(),i}(H.U8(t),H.U8(e))};var j,z={},D={};var Y,K,q={};
|
|
757
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function G(){return
|
|
749
|
+
*/var l=(s||(s=1,function(t){const e=function(){if(o)return h;o=1,h.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},h.toByteArray=function(t){var n,i,o=f(t),s=o[0],u=o[1],h=new r(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),a=0,c=u>0?s-4:s;for(i=0;i<c;i+=4)n=e[t.charCodeAt(i)]<<18|e[t.charCodeAt(i+1)]<<12|e[t.charCodeAt(i+2)]<<6|e[t.charCodeAt(i+3)],h[a++]=n>>16&255,h[a++]=n>>8&255,h[a++]=255&n;return 2===u&&(n=e[t.charCodeAt(i)]<<2|e[t.charCodeAt(i+1)]>>4,h[a++]=255&n),1===u&&(n=e[t.charCodeAt(i)]<<10|e[t.charCodeAt(i+1)]<<4|e[t.charCodeAt(i+2)]>>2,h[a++]=n>>8&255,h[a++]=255&n),h},h.fromByteArray=function(e){for(var r,n=e.length,i=n%3,o=[],f=16383,u=0,h=n-i;u<h;u+=f)o.push(s(e,u,u+f>h?h:u+f));return 1===i?(r=e[n-1],o.push(t[r>>2]+t[r<<4&63]+"==")):2===i&&(r=(e[n-2]<<8)+e[n-1],o.push(t[r>>10]+t[r>>4&63]+t[r<<2&63]+"=")),o.join("")};for(var t=[],e=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return -1===r&&(r=e),[r,r===e?0:4-r%4]}function s(e,r,n){for(var i,o,f=[],s=r;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),f.push(t[(o=i)>>18&63]+t[o>>12&63]+t[o>>6&63]+t[63&o]);return f.join("")}return e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63,h}(),r=c(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=s,t.SlowBuffer=function(t){return +t!=t&&(t=0),s.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function f(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|d(t,e);let n=f(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Q(t,Uint8Array)){const e=new Uint8Array(t);return y(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return y(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Q(t,SharedArrayBuffer)||t&&Q(t.buffer,SharedArrayBuffer)))return y(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return s.from(n,e,r);const i=function(t){if(s.isBuffer(t)){const e=0|g(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||W(t.length)?f(0):p(t):"Buffer"===t.type&&Array.isArray(t.data)?p(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return a(t),f(t<0?0:0|g(t))}function p(t){const e=t.length<0?0:0|g(t.length),r=f(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function y(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function g(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&true===arguments[2];if(!n&&0===r)return 0;let i=false;for(;;)switch(e){case "ascii":case "latin1":case "binary":return r;case "utf8":case "utf-8":return G(t).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*r;case "hex":return r>>>1;case "base64":return K(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=true;}}function b(t,e,r){let n=false;if((void 0===e||e<0)&&(e=0),e>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(e>>>=0))return "";for(t||(t="utf8");;)switch(t){case "hex":return O(this,e,r);case "utf8":case "utf-8":return v(this,e,r);case "ascii":return T(this,e,r);case "latin1":case "binary":return S(this,e,r);case "base64":return L(this,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=true;}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function B(t,e,r,n,i){if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),W(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,s/=2,u/=2,r/=2;}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else -1!==n&&(o-=o-n),n=-1;}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=true;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=false;break}if(r)return o}return -1}function m(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(W(n))return f;t[r+f]=n;}return f}function A(t,e,r,n){return J(G(e,t.length-r),t,r,n)}function _(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function U(t,e,r,n){return J(K(e),t,r,n)}function I(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function L(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function v(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u));}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f;}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}t.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return false}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:true,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:true,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return function(t,e,r){return a(t),t<=0?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)}(t,e,r)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)},s.isBuffer=function(t){return null!=t&&true===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},s.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}},s.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=s.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Q(e,Uint8Array))i+e.length>n.length?(s.isBuffer(e)||(e=s.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else {if(!s.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i);}i+=e.length;}return n},s.byteLength=d,s.prototype._isBuffer=true,s.prototype.swap16=function(){const 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)w(this,e,e+1);return this},s.prototype.swap32=function(){const 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)w(this,e,e+3),w(this,e+1,e+2);return this},s.prototype.swap64=function(){const 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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},s.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?v(this,0,t):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,i){if(Q(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0);const u=Math.min(o,f),h=this.slice(n,i),a=t.slice(e,r);for(let t=0;t<u;++t)if(h[t]!==a[t]){o=h[t],f=a[t];break}return o<f?-1:f<o?1:0},s.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return B(this,t,e,r,true)},s.prototype.lastIndexOf=function(t,e,r){return B(this,t,e,r,false)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else {if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=false;for(;;)switch(n){case "hex":return m(this,t,e,r);case "utf8":case "utf-8":return A(this,t,e,r);case "ascii":case "latin1":case "binary":return _(this,t,e,r);case "base64":return U(this,t,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=true;}},s.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function S(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=X[t[n]];return i}function N(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function M(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n,i){D(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function k(t,e,r,n,i){D(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,n,i,o){return e=+e,n>>>=0,o||P(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function F(t,e,n,i,o){return e=+e,n>>>=0,o||P(t,0,n,8),r.write(t,e,n,i,52,8),n+8}s.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUintLE=s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},s.prototype.readUintBE=s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUint8=s.prototype.readUInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),this[t]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||M(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readBigUInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),s.prototype.readBigUInt64BE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return (BigInt(n)<<BigInt(32))+BigInt(i)})),s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||M(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||M(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||M(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readBigInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return (BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),s.prototype.readBigInt64BE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return (BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),s.prototype.readFloatLE=function(t,e){return t>>>=0,e||M(t,4,this.length),r.read(this,t,true,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||M(t,4,this.length),r.read(this,t,false,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||M(t,8,this.length),r.read(this,t,true,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||M(t,8,this.length),r.read(this,t,false,52,8)},s.prototype.writeUintLE=s.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||C(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||C(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUint8=s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeBigUInt64LE=Z((function(t,e=0){return x(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeBigUInt64BE=Z((function(t,e=0){return k(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);C(this,t,e,r,n-1,-n);}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);C(this,t,e,r,n-1,-n);}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||C(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||C(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]=255&t,e+4},s.prototype.writeBigInt64LE=Z((function(t,e=0){return x(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeBigInt64BE=Z((function(t,e=0){return k(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),s.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,true,r)},s.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,false,r)},s.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,true,r)},s.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,false,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e);}}else "number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else {const o=s.isBuffer(t)?t:s.from(t,n),f=o.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%f];}return this};const j={};function z(t,e,r){j[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${t}]`,this.stack,delete this.name;}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:t,writable:true});}toString(){return `${this.name} [${t}]: ${this.message}`}};}function H(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return `${t.slice(0,r)}${e}`}function D(t,e,r,n,i,o){if(t>r||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new j.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1));}(n,i,o);}function V(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new j.ERR_OUT_OF_RANGE("offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return `The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const Y=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r);}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function K(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Y,"")).length<2)return "";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function W(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i];}return e}();function Z(t){return "undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}}(u)),u);const p=new TextEncoder,y=new TextDecoder,g=d;function d(t,e=0){let r;if(void 0===t||"string"!=typeof t||"number"!=typeof e)throw TypeError("invlaid init variablie type name. ");return (t=t.toUpperCase()).includes("8")?(r=l.Buffer.alloc(1),t.includes("I")?r.writeInt8(e):r.writeUint8(e)):t.includes("16")?(r=l.Buffer.alloc(2),t.includes("I")?t.includes("L")?r.writeInt16LE(e):r.writeInt16BE(e):t.includes("L")?r.writeUint16LE(e):r.writeUint16BE(e)):t.includes("32")?(r=l.Buffer.alloc(4),t.includes("I")?t.includes("L")?r.writeInt32LE(e):r.writeInt32BE(e):t.includes("L")?r.writeUint32LE(e):r.writeUint32BE(e)):t.includes("F")?(r=l.Buffer.alloc(4),t.includes("L")?r.writeFloatLE(e):r.writeFloatBE(e)):t.includes("N")?r=l.Buffer.from(String(e)):console.log(`invalid type: ${t} or initvalue: ${e}`),r}const b=w;function w(t,e,r){let n,i="B";if("number"==typeof e)"number"==typeof r?(n=l.Buffer.alloc(e),0!==r&&n.fill(r),i="B"):(n=l.Buffer.from(String(e)),i="N");else if("string"==typeof e&&"number"==typeof r)i=e.toUpperCase(),n=d(e,r);else if("string"==typeof e&&void 0===r)n=l.Buffer.from(e),i="S";else if(e instanceof Uint8Array&&void 0===r)n=e instanceof l.Buffer?e:l.Buffer.from(e);else if(e instanceof ArrayBuffer&&void 0===r)n=l.Buffer.from(e);else if(ArrayBuffer.isView(e))n=l.Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if("object"==typeof e&&void 0===r)n=l.Buffer.from(JSON.stringify(e)),i="O";else {if("boolean"!=typeof e||void 0!==r)throw TypeError("invalid meta buffer type");{const t=e?1:0;n=l.Buffer.from([t]),i="!";}}return "string"==typeof t&&t.includes("#")&&(t=""),[t,i,n]}const B=E;function E(...t){let e=0;return t.map((t=>{const r=e++;return "number"==typeof t?b(r,"N",t):b(r,t)}))}function m(t){if((t=t.toUpperCase()).includes("8"))return t.includes("I")?"int8":"uint8";if(t.includes("16"))return t.includes("I")?t.includes("L")?"int16_le":"int16_be":t.includes("L")?"uint16_le":"uint16_be";if(t.includes("32"))return t.includes("I")?t.includes("L")?"int32_le":"int32_be":t.includes("L")?"uint32_le":"uint32_be";if(t.includes("F"))return t.includes("L")?"float_le":"float_be";if("B"===t)return "buffer";if("S"===t)return "string";if("N"===t)return "number";if("O"===t)return "object";if("!"===t)return "boolean";throw TypeError("invalid data type")}function A(t,e,r,n){try{const i=m(t);if("int8"==i)return e.readInt8(r);if("uint8"===i)return e.readUint8(r);if("int16_le"===i)return e.readInt16LE(r);if("int16_be"===i)return e.readInt16BE(r);if("uint16_le"===i)return e.readUint16LE(r);if("uint16_be"===i)return e.readUint16BE(r);if("int32_le"===i)return e.readInt32LE(r);if("int32_be"===i)return e.readInt32BE(r);if("uint32_le"===i)return e.readUint32LE(r);if("uint32_be"===i)return e.readUint32BE(r);if("float_le"===i)return e.readFloatLE(r);if("float_be"===i)return e.readFloatBE(r);if("buffer"===i)return e.subarray(r,r+n);if("string"===i){const t=e.subarray(r,r+n);return y.decode(t)}if("number"===i){const t=e.subarray(r,r+n);return Number(y.decode(t))}if("object"===i){const t=e.subarray(r,r+n);return JSON.parse(y.decode(t))}return "boolean"===i?1===e.readInt8(r):void 0}catch(t){}}function _(...t){const e=function(t){let e=[];return t.filter((t=>{if(!Array.isArray(t[0]))return t;e=e.concat(t);})).concat(e)}(t);let r=0;const n=[];let i,o,f=0;if(e.forEach((t=>{const[e,i,o]=t;r+=o.byteLength,("number"==typeof e||e.length>0)&&n.push([e,i,f,o.byteLength]),f=r;})),n.length>0){let t=JSON.stringify(n);i=p.encode(t),o=i.byteLength,r=r+o+2;}const s=l.Buffer.alloc(r);if(f=0,e.forEach((t=>{const e=t[2];s.set(e,f),f+=e.byteLength;})),n.length>0){s.set(i,f);const t=g("16",o);return s.set(t,f+o),s}return s}const U=I;function I(t,e=false){if(void 0===t)throw TypeError("Invalid data type: Undefined");if("string"==typeof t)return p.encode(t);if("number"==typeof t)return Uint8Array.from([t]);if(t instanceof ArrayBuffer){if(e)return new Uint8Array(t);{const e=new Uint8Array(t),r=new Uint8Array(t.byteLength);return r.set(e),r}}if(ArrayBuffer.isView(t)){if(e)return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);{const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),r=new Uint8Array(t.byteLength);return r.set(e),r}}return p.encode(JSON.stringify(t))}const L=v;function v(t,e=false){const r=I(t,e);return e?l.Buffer.from(r.buffer,r.byteOffset,r.byteLength):l.Buffer.from(r)}const R=T;function T(...t){const e=t.map((t=>v(t)));return l.Buffer.concat(e)}const S=O;function O(...t){try{let e=0,r=0;const n=t.map((t=>I(t)));n.forEach((t=>{e+=t.byteLength;}));const i=new Uint8Array(e);return n.forEach((t=>{i.set(t,r),r+=t.byteLength;})),i}catch(t){console.log(t);}}function N(t){return 0===k(t)?t.byteLength:t.byteLength-k(t)-C}function M(t,e){try{const r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r.byteLength-e-2,i=r.subarray(n,r.byteLength-2),o=y.decode(i),f=JSON.parse(o);if(!Array.isArray(f)||!Array.isArray(f[0]))return;let s=f[0];if(!s)return;if(s.length<3)return;const[u,h,a]=s;if("string"!=typeof h||"number"!=typeof a)return;return f}catch(t){}}const C=2;function x(t){return t instanceof ArrayBuffer&&(t=l.Buffer.from(t)),t instanceof Uint8Array?t.byteLength<=C?0:new DataView(t.buffer,t.byteOffset,t.byteLength).getUint16(t.byteLength-C):0}function k(t){if(t instanceof ArrayBuffer&&(t=l.Buffer.from(t)),t instanceof Uint8Array){const e=t.byteLength;if(e<=C)return 0;const r=x(t);return 0===r||r>e?0:M(t,r)?r:0}return 0}function P(t){const e=N(t);return t.subarray(0,e)}function $(t,e=false){t instanceof ArrayBuffer&&(t=l.Buffer.from(t));const r=x(t);if(0===r)return;let n=M(t,r);return n?e?(n.forEach((t=>{null==t[3]&&(t[1].includes("8")?t[3]=1:t[1].includes("16")?t[3]=2:t[1].includes("32")||t[1].includes("F")?t[3]=4:t[1].includes("!")&&(t[3]=1)),t[4]=m(t[1]);})),n):n:void 0}var F=Object.freeze({__proto__:null,B8:L,B8pack:R,Buffer:l.Buffer,MB:b,MBA:B,NB:g,TAIL_LEN:C,U8:U,U8pack:S,equal:function(t,e){if(t.byteLength!==e.byteLength)return false;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return false;return true},getBuffer:P,getBufferSize:N,getMeta:$,getMetaDetail:function(t){return $(t,true)},getMetaSize:k,hex:function(t){return Array.prototype.map.call(new Uint8Array(t),(t=>("00"+t.toString(16)).slice(-2))).join("")},meta:function(...t){return $(_(...t))},metaBuffer:w,metaBufferArguments:E,metaDetail:function(...t){return $(_(...t),true)},numberBuffer:d,pack:_,parseBuffer:v,parseBufferThenConcat:T,parseMetaInfo:M,parseTypeName:m,parseUint8Array:I,parseUint8ThenConcat:O,rawPack:function(...t){return P(_(...t))},readTail:x,readTypedBuffer:A,unpack:function(t,e){const r=e||$(t);if(!r)return;const n=l.Buffer.from(t),i={};let o=0;if(r.forEach((t=>{const[e,r,f,s]=t;let u=A(r,n,f,s);null!=u&&(i[e]=u,s&&(o+=s));})),e&&n.byteLength!==o){let t=n.byteLength-o,e=A("b",n,o,t);if(null==e)return;i.$OTHERS=e;}let f=0,s=[];for(;i[f];)s.push(i[f++]);return s.length>0&&(i.args=s,i.$=i.args),i}});const j={hash:function(t){return i(F.U8(t))},hex:function(t){return F.B8(i(F.U8(t))).toString("hex")},base64:function(t){return F.B8(i(F.U8(t))).toString("base64")}};j.hmac=function(t,e){return function(t,e){const r=new n(t).update(e),i=r.digest();return r.clean(),i}(F.U8(t),F.U8(e))};var z,H={},D={};var V,q,Y={};
|
|
750
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */function G(){return V||(V=1,Y.read=function(t,e,r,n,i){var o,f,s=8*i-n-1,u=(1<<s)-1,h=u>>1,a=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-a)-1,p>>=-a,a+=s;a>0;o=256*o+t[e+c],c+=l,a-=8);for(f=o&(1<<-a)-1,o>>=-a,a+=n;a>0;f=256*f+t[e+c],c+=l,a-=8);if(0===o)o=1-h;else {if(o===u)return f?NaN:1/0*(p?-1:1);f+=Math.pow(2,n),o-=h;}return (p?-1:1)*f*Math.pow(2,o-n)},Y.write=function(t,e,r,n,i,o){var f,s,u,h=8*o-i-1,a=(1<<h)-1,c=a>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,f=a):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=a?(s=0,f=a):f+c>=1?(s=(e*u-1)*Math.pow(2,i),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[r+p]=255&s,p+=y,s/=256,i-=8);for(f=f<<i|s,h+=i;h>0;t[r+p]=255&f,p+=y,f/=256,h-=8);t[r+p-y]|=128*g;}),Y}
|
|
758
751
|
/*!
|
|
759
752
|
* The buffer module from node.js, for the browser.
|
|
760
753
|
*
|
|
761
754
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
762
755
|
* @license MIT
|
|
763
|
-
*/var V=(K||(K=1,function(t){const e=function(){if(j)return D;j=1,D.byteLength=function(t){var e=o(t),r=e[0],n=e[1];return 3*(r+n)/4-n},D.toByteArray=function(t){var n,i,f=o(t),s=f[0],u=f[1],h=new r(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),a=0,c=u>0?s-4:s;for(i=0;i<c;i+=4)n=e[t.charCodeAt(i)]<<18|e[t.charCodeAt(i+1)]<<12|e[t.charCodeAt(i+2)]<<6|e[t.charCodeAt(i+3)],h[a++]=n>>16&255,h[a++]=n>>8&255,h[a++]=255&n;return 2===u&&(n=e[t.charCodeAt(i)]<<2|e[t.charCodeAt(i+1)]>>4,h[a++]=255&n),1===u&&(n=e[t.charCodeAt(i)]<<10|e[t.charCodeAt(i+1)]<<4|e[t.charCodeAt(i+2)]>>2,h[a++]=n>>8&255,h[a++]=255&n),h},D.fromByteArray=function(e){for(var r,n=e.length,i=n%3,o=[],s=16383,u=0,h=n-i;u<h;u+=s)o.push(f(e,u,u+s>h?h:u+s));return 1===i?(r=e[n-1],o.push(t[r>>2]+t[r<<4&63]+"==")):2===i&&(r=(e[n-2]<<8)+e[n-1],o.push(t[r>>10]+t[r>>4&63]+t[r<<2&63]+"=")),o.join("")};for(var t=[],e=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;function o(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return -1===r&&(r=e),[r,r===e?0:4-r%4]}function f(e,r,n){for(var i,o,f=[],s=r;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),f.push(t[(o=i)>>18&63]+t[o>>12&63]+t[o>>6&63]+t[63&o]);return f.join("")}return e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63,D}(),r=G(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=f,t.SlowBuffer=function(t){return +t!=t&&(t=0),f.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Q(t,Uint8Array)){const e=new Uint8Array(t);return c(e.buffer,e.byteOffset,e.byteLength)}return a(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return c(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Q(t,SharedArrayBuffer)||t&&Q(t.buffer,SharedArrayBuffer)))return c(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return f.from(n,e,r);const i=function(t){if(f.isBuffer(t)){const e=0|l(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||X(t.length)?o(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return f.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),o(t<0?0:0|l(t))}function a(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function c(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,f.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(f.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&true===arguments[2];if(!n&&0===r)return 0;let i=false;for(;;)switch(e){case "ascii":case "latin1":case "binary":return r;case "utf8":case "utf-8":return q(t).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*r;case "hex":return r>>>1;case "base64":return V(t).length;default:if(i)return n?-1:q(t).length;e=(""+e).toLowerCase(),i=true;}}function y(t,e,r){let n=false;if((void 0===e||e<0)&&(e=0),e>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(e>>>=0))return "";for(t||(t="utf8");;)switch(t){case "hex":return T(this,e,r);case "utf8":case "utf-8":return U(this,e,r);case "ascii":return L(this,e,r);case "latin1":case "binary":return v(this,e,r);case "base64":return _(this,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=true;}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function d(t,e,r,n,i){if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,s/=2,u/=2,r/=2;}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else -1!==n&&(o-=o-n),n=-1;}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=true;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=false;break}if(r)return o}return -1}function w(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(X(n))return f;t[r+f]=n;}return f}function B(t,e,r,n){return J(q(e,t.length-r),t,r,n)}function m(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return J(V(e),t,r,n)}function A(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function U(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u));}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f;}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}t.kMaxLength=i,f.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return false}}(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:true,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:true,get:function(){if(f.isBuffer(this))return this.byteOffset}}),f.poolSize=8192,f.from=function(t,e,r){return s(t,e,r)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array),f.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},f.allocUnsafe=function(t){return h(t)},f.allocUnsafeSlow=function(t){return h(t)},f.isBuffer=function(t){return null!=t&&true===t._isBuffer&&t!==f.prototype},f.compare=function(t,e){if(Q(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},f.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}},f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=f.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Q(e,Uint8Array))i+e.length>n.length?(f.isBuffer(e)||(e=f.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else {if(!f.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i);}i+=e.length;}return n},f.byteLength=p,f.prototype._isBuffer=true,f.prototype.swap16=function(){const 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)g(this,e,e+1);return this},f.prototype.swap32=function(){const 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)g(this,e,e+3),g(this,e+1,e+2);return this},f.prototype.swap64=function(){const 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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},f.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?U(this,0,t):y.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(f.prototype[n]=f.prototype.inspect),f.prototype.compare=function(t,e,r,n,i){if(Q(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const u=Math.min(o,s),h=this.slice(n,i),a=t.slice(e,r);for(let t=0;t<u;++t)if(h[t]!==a[t]){o=h[t],s=a[t];break}return o<s?-1:s<o?1:0},f.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return d(this,t,e,r,true)},f.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,false)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else {if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=false;for(;;)switch(n){case "hex":return w(this,t,e,r);case "utf8":case "utf-8":return B(this,t,e,r);case "ascii":case "latin1":case "binary":return m(this,t,e,r);case "base64":return E(this,t,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=true;}},f.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function L(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function v(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=W[t[n]];return i}function S(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function R(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function C(t,e,r,n,i){F(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function N(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function k(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}f.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,f.prototype),n},f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readBigUInt64LE=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),f.prototype.readBigUInt64BE=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return (BigInt(n)<<BigInt(32))+BigInt(i)})),f.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readBigInt64LE=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return (BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),f.prototype.readBigInt64BE=Z((function(t){z(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return (BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),f.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),r.read(this,t,true,23,4)},f.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),r.read(this,t,false,23,4)},f.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),r.read(this,t,true,52,8)},f.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),r.read(this,t,false,52,8)},f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigUInt64LE=Z((function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeBigUInt64BE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n);}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n);}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(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]=255&t,e+4},f.prototype.writeBigInt64LE=Z((function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeBigInt64BE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeFloatLE=function(t,e,r){return x(this,t,e,true,r)},f.prototype.writeFloatBE=function(t,e,r){return x(this,t,e,false,r)},f.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,true,r)},f.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,false,r)},f.prototype.copy=function(t,e,r,n){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e);}}else "number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else {const o=f.isBuffer(t)?t:f.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s];}return this};const P={};function $(t,e,r){P[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${t}]`,this.stack,delete this.name;}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:t,writable:true});}toString(){return `${this.name} [${t}]: ${this.message}`}};}function H(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return `${t.slice(0,r)}${e}`}function F(t,e,r,n,i,o){if(t>r||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new P.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||Y(e,t.length-(r+1));}(n,i,o);}function z(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,r){if(Math.floor(t)!==t)throw z(t,r),new P.ERR_OUT_OF_RANGE("offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,t)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(t,e){return `The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),$("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function q(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r);}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function V(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return "";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}const W=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i];}return e}();function Z(t){return "undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}}(z)),z);let J={AUTH_REQ:176,AUTH_NONCE:177,AUTH_HMAC:178,AUTH_ACK:179,AUTH_FAIL:180,AUTH_EXT:181,ENC_PACK:182,ENC_E2E:183,ENC_488:184};for(let t in J)J[J[t]]=t;const Q={AUTH_REQ:H.meta(H.MB("header","8",0),H.MB("reserved","8",0)),AUTH_NONCE:H.meta(H.MB("header","8",0),H.MB("unixTime","32L",0),H.MB("milTime","32L",0),H.MB("nonce",V.Buffer.alloc(4))),AUTH_HMAC:H.meta(H.MB("header","8",0),H.MB("id8",V.Buffer.alloc(8)),H.MB("nonce",V.Buffer.alloc(4)),H.MB("hmac32",V.Buffer.alloc(32))),AUTH_ACK:H.meta(H.MB("header","8",0),H.MB("hmac32",V.Buffer.alloc(32))),ENC_PACK:H.meta(H.MB("type","8",0),H.MB("len","32L",0),H.MB("salt12",V.Buffer.alloc(12)),H.MB("hmac",8,0)),ENC_488:H.meta(H.MB("type","8",0),H.MB("len","32L",0),H.MB("otpSrc8",V.Buffer.alloc(8)),H.MB("hmac8",V.Buffer.alloc(8)))};function X(t){let e=t[t.length-1];return e[2]+e[3]}const W={AUTH_REQ:X(Q.AUTH_REQ),AUTH_NONCE:X(Q.AUTH_NONCE),AUTH_HMAC:X(Q.AUTH_HMAC),AUTH_ACK:X(Q.AUTH_ACK),ENC_PACK:X(Q.ENC_PACK),ENC_488:X(Q.ENC_488)};function Z(t){return globalThis.crypto.getRandomValues(V.Buffer.alloc(t))}class tt{constructor(){this._id8=V.Buffer.alloc(8),this._otpSrc44=V.Buffer.alloc(44),this._otp36=V.Buffer.alloc(36),this._hmac=V.Buffer.alloc(32),this.auth_salt12=V.Buffer.alloc(12),this.localNonce=V.Buffer.alloc(4),this.remoteNonce=V.Buffer.alloc(4),this.isAuthorized=false;}clearAuth(){this._id8.fill(0),this._otpSrc44.fill(0),this._otp36.fill(0),this._hmac.fill(0),this.auth_salt12.fill(0),this.localNonce.fill(0),this.remoteNonce.fill(0),this.isAuthorized=false;}set_hash_id8(t){H.B8(F.hash(t)).copy(this._id8,0,0,8);}set_id8(t){let e=H.B8(t);this._id8.fill(0),e.copy(this._id8,0,0,8);}set_key(t){H.B8(F.hash(t)).copy(this._otpSrc44,0,0,32);}set_id_key(t){let e=t.indexOf(".");if(-1==e)return;let r=t.substring(0,e),n=t.substring(e+1);this.set_id8(r),this.set_key(n);}copy_id8(t){t.copy(this._id8,0,0,8);}copy_key(t){t.copy(this._otpSrc44,0,0,32);}sha256_n(t,e){let r=F.hash(t);for(let t=0;t<e;t++)r=F.hash(r);return r}set_clock_rand(){let t=Date.now(),e=parseInt(t/1e3);t%=4294967295;V.Buffer.concat([H.NB("32L",e),H.NB("32L",t),Z(4)]).copy(this._otpSrc44,32);}set_clock_nonce(t){let e=Date.now(),r=parseInt(e/1e3);e%=4294967295;V.Buffer.concat([H.NB("32L",r),H.NB("32L",e),t]).copy(this._otpSrc44,32);}set_salt12(t){t.copy(this._otpSrc44,32);}resetOTP(){H.B8(F.hash(this._otpSrc44)).copy(this._otp36,0,0,32);}getIndexOTP(t){return this._otp36.writeUInt32LE(t,32),F.hash(this._otp36)}generateHMAC(t){let e=V.Buffer.concat([this._otpSrc44,t]);this._hmac=H.B8(F.hash(e));}getHMAC8(t){let e=V.Buffer.concat([this._otpSrc44,t]);return this._hmac=H.B8(F.hash(e)),this._hmac.subarray(0,8)}xotp(t,e=0,r=false){let n=(t=H.B8(t,r)).byteLength,i=e,o=0,f=0;for(;n>0;){f=n<32?n:32;let e=this.getIndexOTP(++i);for(let r=0;r<f;r++)t[o++]^=e[r];n-=32;}return t}auth_req(){return H.pack(H.MB("#type","8",J.AUTH_REQ),H.MB("#reserved","8",0))}auth_nonce(){let t=Date.now(),e=Math.floor(t/1e3),r=t%1e3;return this.localNonce=Z(4),this.auth_salt12=V.Buffer.concat([H.NB("32L",e),H.NB("32L",r),this.localNonce]),V.Buffer.concat([H.NB("8",J.AUTH_NONCE),this.auth_salt12])}auth_hmac(t){let e=H.unpack(t,Q.AUTH_NONCE);if(e){let t=V.Buffer.concat([H.NB("32L",e.unixTime),H.NB("32L",e.milTime),e.nonce]);return this.set_salt12(t),this.localNonce=Z(4),this.generateHMAC(this.localNonce),this.remoteNonce=e.nonce,H.pack(H.MB("#header","8",J.AUTH_HMAC),H.MB("#id8",this._id8),H.MB("#nonce",this.localNonce),H.MB("#hmac32",this._hmac))}return false}check_auth_hmac(t){let e;if(t instanceof Uint8Array){if(e=H.unpack(t,Q.AUTH_HMAC),!e)return}else e=t;this.set_salt12(this.auth_salt12),this.generateHMAC(e.nonce);let r=this._hmac;if(H.equal(e.hmac32,r)){this.remoteNonce=e.nonce;let t=V.Buffer.concat([this.localNonce,this.remoteNonce,this.localNonce]);this.set_salt12(t),this.generateHMAC(e.nonce);let r=this._hmac,n=H.rawPack(H.MB("header","8",J.AUTH_ACK),H.MB("hmac32",r));return this.isAuthorized=true,n}return false}check_auth_ack_hmac(t){let e=H.unpack(t,Q.AUTH_ACK);if(e){let t=V.Buffer.concat([this.remoteNonce,this.localNonce,this.remoteNonce]);this.set_salt12(t),this.generateHMAC(this.localNonce);let r=this._hmac;if(H.equal(r,e.hmac32))return this.isAuthorized=true,true}}encrypt_488(t){if(!this.isAuthorized)return;t=H.B8(t),this.set_clock_nonce(this.remoteNonce),this.resetOTP();let e=this.getHMAC8(t),r=this.xotp(t);return H.pack(H.MB("#type","8",J.ENC_488),H.MB("#len","32L",t.byteLength),H.MB("#otpSrc8",this._otpSrc44.subarray(32,40)),H.MB("#hmac8",e),H.MB("#xdata",r))}decrypt_488(t){t=H.B8(t);let e=H.unpack(t,Q.ENC_488);if(e){let t=V.Buffer.concat([e.otpSrc8,this.localNonce]);this.set_salt12(t),this.resetOTP();let r=e.$OTHERS.subarray(0,e.len),n=this.xotp(r),i=this.getHMAC8(n);if(H.equal(i,e.hmac8))return n}}encryptPack(t){t=H.B8(t),this.set_clock_rand(),this.resetOTP();let e=this.getHMAC8(t),r=this.xotp(t);return H.pack(H.MB("#type","8",J.ENC_PACK),H.MB("#len","32L",t.byteLength),H.MB("#salt12",this._otpSrc44.subarray(32)),H.MB("#hmac8",e),H.MB("#xdata",r))}decryptPack(t){if(t[0]!==J.ENC_PACK)return;if(t.readUint32LE(1)==t.byteLength-W.ENC_PACK)try{let e=H.unpack(t,Q.ENC_PACK);if(!e)return;this.set_salt12(e.salt12),this.resetOTP();let r=e.$OTHERS,n=this.xotp(r),i=this.getHMAC8(n);if(H.equal(e.hmac,i))return e.data=n,e}catch(t){}}encrypt_e2e(t,e){let r=V.Buffer.alloc(32);r.set(this._otpSrc44.subarray(0,32)),this.set_key(e);let n=this.encryptPack(t);return this._otpSrc44.set(r),n}decrypt_e2e(t,e){let r=V.Buffer.alloc(32);r.set(this._otpSrc44.subarray(0,32)),this.set_key(e);let n=this.decryptPack(t);return this._otpSrc44.set(r),n}}tt.RAND=Z,tt.BohoMsg=J,tt.Meta=Q,tt.MetaSize=W,tt.sha256=F,tt.MBP=H,tt.Buffer=V.Buffer;
|
|
756
|
+
*/var K=(q||(q=1,function(t){const e=function(){if(z)return D;z=1,D.byteLength=function(t){var e=o(t),r=e[0],n=e[1];return 3*(r+n)/4-n},D.toByteArray=function(t){var n,i,f=o(t),s=f[0],u=f[1],h=new r(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),a=0,c=u>0?s-4:s;for(i=0;i<c;i+=4)n=e[t.charCodeAt(i)]<<18|e[t.charCodeAt(i+1)]<<12|e[t.charCodeAt(i+2)]<<6|e[t.charCodeAt(i+3)],h[a++]=n>>16&255,h[a++]=n>>8&255,h[a++]=255&n;return 2===u&&(n=e[t.charCodeAt(i)]<<2|e[t.charCodeAt(i+1)]>>4,h[a++]=255&n),1===u&&(n=e[t.charCodeAt(i)]<<10|e[t.charCodeAt(i+1)]<<4|e[t.charCodeAt(i+2)]>>2,h[a++]=n>>8&255,h[a++]=255&n),h},D.fromByteArray=function(e){for(var r,n=e.length,i=n%3,o=[],s=16383,u=0,h=n-i;u<h;u+=s)o.push(f(e,u,u+s>h?h:u+s));return 1===i?(r=e[n-1],o.push(t[r>>2]+t[r<<4&63]+"==")):2===i&&(r=(e[n-2]<<8)+e[n-1],o.push(t[r>>10]+t[r>>4&63]+t[r<<2&63]+"=")),o.join("")};for(var t=[],e=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;function o(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return -1===r&&(r=e),[r,r===e?0:4-r%4]}function f(e,r,n){for(var i,o,f=[],s=r;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),f.push(t[(o=i)>>18&63]+t[o>>12&63]+t[o>>6&63]+t[63&o]);return f.join("")}return e["-".charCodeAt(0)]=62,e["_".charCodeAt(0)]=63,D}(),r=G(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=f,t.SlowBuffer=function(t){return +t!=t&&(t=0),f.alloc(+t)},t.INSPECT_MAX_BYTES=50;const i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|p(t,e);let n=o(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Q(t,Uint8Array)){const e=new Uint8Array(t);return c(e.buffer,e.byteOffset,e.byteLength)}return a(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Q(t,ArrayBuffer)||t&&Q(t.buffer,ArrayBuffer))return c(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Q(t,SharedArrayBuffer)||t&&Q(t.buffer,SharedArrayBuffer)))return c(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return f.from(n,e,r);const i=function(t){if(f.isBuffer(t)){const e=0|l(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||W(t.length)?o(0):a(t):"Buffer"===t.type&&Array.isArray(t.data)?a(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return f.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return u(t),o(t<0?0:0|l(t))}function a(t){const e=t.length<0?0:0|l(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function c(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,f.prototype),n}function l(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function p(t,e){if(f.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Q(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&true===arguments[2];if(!n&&0===r)return 0;let i=false;for(;;)switch(e){case "ascii":case "latin1":case "binary":return r;case "utf8":case "utf-8":return Y(t).length;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return 2*r;case "hex":return r>>>1;case "base64":return K(t).length;default:if(i)return n?-1:Y(t).length;e=(""+e).toLowerCase(),i=true;}}function y(t,e,r){let n=false;if((void 0===e||e<0)&&(e=0),e>this.length)return "";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return "";if((r>>>=0)<=(e>>>=0))return "";for(t||(t="utf8");;)switch(t){case "hex":return R(this,e,r);case "utf8":case "utf-8":return U(this,e,r);case "ascii":return L(this,e,r);case "latin1":case "binary":return v(this,e,r);case "base64":return _(this,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=true;}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function d(t,e,r,n,i){if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),W(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return -1;r=t.length-1;}else if(r<0){if(!i)return -1;r=0;}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,f=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;f=2,s/=2,u/=2,r/=2;}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else -1!==n&&(o-=o-n),n=-1;}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=true;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=false;break}if(r)return o}return -1}function w(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(W(n))return f;t[r+f]=n;}return f}function B(t,e,r,n){return J(Y(e,t.length-r),t,r,n)}function E(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function m(t,e,r,n){return J(K(e),t,r,n)}function A(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function _(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function U(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u));}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f;}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}t.kMaxLength=i,f.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return false}}(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:true,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:true,get:function(){if(f.isBuffer(this))return this.byteOffset}}),f.poolSize=8192,f.from=function(t,e,r){return s(t,e,r)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array),f.alloc=function(t,e,r){return function(t,e,r){return u(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},f.allocUnsafe=function(t){return h(t)},f.allocUnsafeSlow=function(t){return h(t)},f.isBuffer=function(t){return null!=t&&true===t._isBuffer&&t!==f.prototype},f.compare=function(t,e){if(Q(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),Q(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},f.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}},f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=f.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Q(e,Uint8Array))i+e.length>n.length?(f.isBuffer(e)||(e=f.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else {if(!f.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i);}i+=e.length;}return n},f.byteLength=p,f.prototype._isBuffer=true,f.prototype.swap16=function(){const 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)g(this,e,e+1);return this},f.prototype.swap32=function(){const 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)g(this,e,e+3),g(this,e+1,e+2);return this},f.prototype.swap64=function(){const 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)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},f.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?U(this,0,t):y.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(f.prototype[n]=f.prototype.inspect),f.prototype.compare=function(t,e,r,n,i){if(Q(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return -1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const u=Math.min(o,s),h=this.slice(n,i),a=t.slice(e,r);for(let t=0;t<u;++t)if(h[t]!==a[t]){o=h[t],s=a[t];break}return o<s?-1:s<o?1:0},f.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return d(this,t,e,r,true)},f.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,false)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else {if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=false;for(;;)switch(n){case "hex":return w(this,t,e,r);case "utf8":case "utf-8":return B(this,t,e,r);case "ascii":case "latin1":case "binary":return E(this,t,e,r);case "base64":return m(this,t,e,r);case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=true;}},f.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function L(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function v(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=X[t[n]];return i}function T(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function N(t,e,r,n,i){j(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function M(t,e,r,n,i){j(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function C(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(t,e,n,i,o){return e=+e,n>>>=0,o||C(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function k(t,e,n,i,o){return e=+e,n>>>=0,o||C(t,0,n,8),r.write(t,e,n,i,52,8),n+8}f.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,f.prototype),n},f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readBigUInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),f.prototype.readBigUInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return (BigInt(n)<<BigInt(32))+BigInt(i)})),f.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readBigInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return (BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),f.prototype.readBigInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||V(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return (BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),f.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),r.read(this,t,true,23,4)},f.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),r.read(this,t,false,23,4)},f.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),r.read(this,t,true,52,8)},f.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),r.read(this,t,false,52,8)},f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||O(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,255,0),this[e]=255&t,e+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigUInt64LE=Z((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeBigUInt64BE=Z((function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n);}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);O(this,t,e,r,n-1,-n);}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||O(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]=255&t,e+4},f.prototype.writeBigInt64LE=Z((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeBigInt64BE=Z((function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeFloatLE=function(t,e,r){return x(this,t,e,true,r)},f.prototype.writeFloatBE=function(t,e,r){return x(this,t,e,false,r)},f.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,true,r)},f.prototype.writeDoubleBE=function(t,e,r){return k(this,t,e,false,r)},f.prototype.copy=function(t,e,r,n){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e);}}else "number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else {const o=f.isBuffer(t)?t:f.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s];}return this};const P={};function $(t,e,r){P[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:true,configurable:true}),this.name=`${this.name} [${t}]`,this.stack,delete this.name;}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:true,enumerable:true,value:t,writable:true});}toString(){return `${this.name} [${t}]: ${this.message}`}};}function F(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return `${t.slice(0,r)}${e}`}function j(t,e,r,n,i,o){if(t>r||t<e){const r="bigint"==typeof e?"n":"";let n;throw n=0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`,new P.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||V(e,t.length-(r+1));}(n,i,o);}function H(t,e){if("number"!=typeof t)throw new P.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,r){if(Math.floor(t)!==t)throw H(t,r),new P.ERR_OUT_OF_RANGE("offset","an integer",t);if(e<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${e}`,t)}$("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),$("ERR_INVALID_ARG_TYPE",(function(t,e){return `The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),$("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function Y(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320);}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r);}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128);}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128);}else {if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128);}}return o}function K(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return "";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Q(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function W(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i];}return e}();function Z(t){return "undefined"==typeof BigInt?tt:t}function tt(){throw new Error("BigInt not supported")}}(H)),H);let J={SERVER_TIME_NONCE:176,AUTH_REQ:177,AUTH_RES:178,AUTH_FAIL:179,ENC_PACK:182,ENC_E2E:183,ENC_488:184};for(let t in J)J[J[t]]=t;const Q={SERVER_TIME_NONCE:F.meta(F.MB("header","8",0),F.MB("unixTime","32L",0),F.MB("milTime","16L",0),F.MB("counter","16L",0),F.MB("nonce",K.Buffer.alloc(4))),AUTH_REQ:F.meta(F.MB("header","8",0),F.MB("id8",K.Buffer.alloc(8)),F.MB("nonce",K.Buffer.alloc(4)),F.MB("hmac32",K.Buffer.alloc(32))),AUTH_RES:F.meta(F.MB("header","8",0),F.MB("hmac32",K.Buffer.alloc(32))),ENC_PACK:F.meta(F.MB("type","8",0),F.MB("len","32L",0),F.MB("salt12",K.Buffer.alloc(12)),F.MB("hmac",8,0)),ENC_488:F.meta(F.MB("type","8",0),F.MB("len","32L",0),F.MB("otpSrc8",K.Buffer.alloc(8)),F.MB("hmac8",K.Buffer.alloc(8)))};function W(t){let e=t[t.length-1];return e[2]+e[3]}const X={SERVER_TIME_NONCE:W(Q.SERVER_TIME_NONCE),AUTH_REQ:W(Q.AUTH_REQ),AUTH_RES:W(Q.AUTH_RES),ENC_PACK:W(Q.ENC_PACK),ENC_488:W(Q.ENC_488)};function Z(t){return globalThis.crypto.getRandomValues(K.Buffer.alloc(t))}class tt{constructor(){this._id8=K.Buffer.alloc(8),this._otpSrc44=K.Buffer.alloc(44),this._otp36=K.Buffer.alloc(36),this._hmac=K.Buffer.alloc(32),this.auth_salt12=K.Buffer.alloc(12),this.localNonce=K.Buffer.alloc(4),this.remoteNonce=K.Buffer.alloc(4),this.isAuthorized=false,this.counter=0;}clearAuth(){this._id8.fill(0),this._otpSrc44.fill(0),this._otp36.fill(0),this._hmac.fill(0),this.auth_salt12.fill(0),this.localNonce.fill(0),this.remoteNonce.fill(0),this.isAuthorized=false,this.counter=0;}set_hash_id8(t){F.B8(j.hash(t)).copy(this._id8,0,0,8);}set_id8(t){let e=F.B8(t);this._id8.fill(0),e.copy(this._id8,0,0,8);}set_key(t){F.B8(j.hash(t)).copy(this._otpSrc44,0,0,32);}set_id_key(t){let e=t.indexOf(".");if(-1==e)return;let r=t.substring(0,e),n=t.substring(e+1);this.set_id8(r),this.set_key(n);}copy_id8(t){t.copy(this._id8,0,0,8);}copy_key(t){t.copy(this._otpSrc44,0,0,32);}sha256_n(t,e){let r=j.hash(t);for(let t=0;t<e;t++)r=j.hash(r);return r}set_clock_rand(){const t=Date.now(),e=parseInt(t/1e3),r=t%1e3;K.Buffer.concat([F.NB("32L",e),F.NB("16L",r),F.NB("16L",++this.counter),Z(4)]).copy(this._otpSrc44,32);}set_clock_nonce(t){const e=Date.now(),r=parseInt(e/1e3),n=e%1e3;K.Buffer.concat([F.NB("32L",r),F.NB("16L",n),F.NB("16L",++this.counter),t]).copy(this._otpSrc44,32);}set_salt12(t,e){if(12!=t.byteLength)throw TypeError("set_salt12: Invalid salt12 byteLength.");t.copy(this._otpSrc44,32);}resetOTP(){F.B8(j.hash(this._otpSrc44)).copy(this._otp36,0,0,32);}getIndexOTP(t){return this._otp36.writeUInt32LE(t,32),j.hash(this._otp36)}generateHMAC(t){let e=K.Buffer.concat([this._otpSrc44,t]);this._hmac=F.B8(j.hash(e));}getHMAC8(t){let e=K.Buffer.concat([this._otpSrc44,t]);return this._hmac=F.B8(j.hash(e)),this._hmac.subarray(0,8)}xotp(t,e=0,r=false){let n=(t=F.B8(t,r)).byteLength,i=e,o=0,f=0;for(;n>0;){f=n<32?n:32;let e=this.getIndexOTP(++i);for(let r=0;r<f;r++)t[o++]^=e[r];n-=32;}return t}server_time_nonce(){const t=Date.now(),e=Math.floor(t/1e3),r=t%1e3;return this.localNonce=Z(4),this.auth_salt12=K.Buffer.concat([F.NB("32L",e),F.NB("16L",r),Z(2),this.localNonce]),K.Buffer.concat([F.NB("8",J.SERVER_TIME_NONCE),this.auth_salt12])}auth_req(t){let e=F.unpack(t,Q.SERVER_TIME_NONCE);if(e){let t=K.Buffer.concat([F.NB("32L",e.unixTime),F.NB("16L",e.milTime),F.NB("16L",e.counter),e.nonce]);return this.set_salt12(t,"auth_req"),this.localNonce=Z(4),this.generateHMAC(this.localNonce),this.remoteNonce=e.nonce,F.pack(F.MB("#header","8",J.AUTH_REQ),F.MB("#id8",this._id8),F.MB("#nonce",this.localNonce),F.MB("#hmac32",this._hmac))}return false}verify_auth_req(t){let e;if(t instanceof Uint8Array){if(e=F.unpack(t,Q.AUTH_REQ),!e)return}else e=t;this.set_salt12(this.auth_salt12,"verify_auth_req 1/2"),this.generateHMAC(e.nonce);let r=this._hmac;if(F.equal(e.hmac32,r)){this.remoteNonce=e.nonce;let t=K.Buffer.concat([this.localNonce,this.remoteNonce,this.localNonce]);this.set_salt12(t,"verify_auth_req 2/2"),this.generateHMAC(e.nonce);let r=this._hmac,n=F.rawPack(F.MB("header","8",J.AUTH_RES),F.MB("hmac32",r));return this.isAuthorized=true,n}return false}verify_auth_res(t){let e=F.unpack(t,Q.AUTH_RES);if(e){let t=K.Buffer.concat([this.remoteNonce,this.localNonce,this.remoteNonce]);this.set_salt12(t,"verify_auth_res"),this.generateHMAC(this.localNonce);let r=this._hmac;if(F.equal(r,e.hmac32))return this.isAuthorized=true,true}}encrypt_488(t){if(!this.isAuthorized)return;t=F.B8(t),this.set_clock_nonce(this.remoteNonce),this.resetOTP();let e=this.getHMAC8(t),r=this.xotp(t);return F.pack(F.MB("#type","8",J.ENC_488),F.MB("#len","32L",t.byteLength),F.MB("#otpSrc8",this._otpSrc44.subarray(32,40)),F.MB("#hmac8",e),F.MB("#xdata",r))}decrypt_488(t){t=F.B8(t);let e=F.unpack(t,Q.ENC_488);if(e){let t=K.Buffer.concat([e.otpSrc8,this.localNonce]);this.set_salt12(t,"decrypt_488"),this.resetOTP();let r=e.$OTHERS.subarray(0,e.len),n=this.xotp(r),i=this.getHMAC8(n);if(F.equal(i,e.hmac8))return n}}encryptPack(t){t=F.B8(t),this.set_clock_rand(),this.resetOTP();let e=this.getHMAC8(t),r=this.xotp(t);return F.pack(F.MB("#type","8",J.ENC_PACK),F.MB("#len","32L",t.byteLength),F.MB("#salt12",this._otpSrc44.subarray(32)),F.MB("#hmac8",e),F.MB("#xdata",r))}decryptPack(t){if(t[0]!==J.ENC_PACK)return;if(t.readUint32LE(1)==t.byteLength-X.ENC_PACK)try{let e=F.unpack(t,Q.ENC_PACK);if(!e)return;this.set_salt12(e.salt12,"decryptPack"),this.resetOTP();let r=e.$OTHERS,n=this.xotp(r),i=this.getHMAC8(n);if(F.equal(e.hmac,i))return e.data=n,e}catch(t){}}encrypt_e2e(t,e){let r=K.Buffer.alloc(32);r.set(this._otpSrc44.subarray(0,32)),this.set_key(e);let n=this.encryptPack(t);return this._otpSrc44.set(r),n}decrypt_e2e(t,e){let r=K.Buffer.alloc(32);r.set(this._otpSrc44.subarray(0,32)),this.set_key(e);let n=this.decryptPack(t);return this._otpSrc44.set(r),n}}tt.RAND=Z,tt.BohoMsg=J,tt.Meta=Q,tt.MetaSize=X,tt.sha256=j,tt.MBP=F,tt.Buffer=K.Buffer;
|
|
764
757
|
|
|
765
758
|
/**
|
|
766
759
|
* @typedef {import('meta-buffer-pack').MBP} MBP
|
|
@@ -871,6 +864,8 @@ class IOCore extends EventEmitter {
|
|
|
871
864
|
* @type {Boho}
|
|
872
865
|
*/
|
|
873
866
|
this.boho = new tt();
|
|
867
|
+
|
|
868
|
+
this.serverTimeNonce = Buffer$1.alloc( tt.MetaSize.SERVER_TIME_NONCE );
|
|
874
869
|
/**
|
|
875
870
|
* Indicates if the connection is TLS (wss).
|
|
876
871
|
* @type {boolean}
|
|
@@ -1003,6 +998,7 @@ class IOCore extends EventEmitter {
|
|
|
1003
998
|
stop() {
|
|
1004
999
|
this.autoReconnect = false;
|
|
1005
1000
|
this.close();
|
|
1001
|
+
this.cid = '';
|
|
1006
1002
|
this.stateChange('stop','stop');
|
|
1007
1003
|
}
|
|
1008
1004
|
|
|
@@ -1101,10 +1097,13 @@ class IOCore extends EventEmitter {
|
|
|
1101
1097
|
* @returns {this}
|
|
1102
1098
|
*/
|
|
1103
1099
|
login(id, key) {
|
|
1104
|
-
this.
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1100
|
+
if( this.serverTimeNonce ){
|
|
1101
|
+
console.log('iosignal.login serverTimeNonce', this.serverTimeNonce);
|
|
1102
|
+
this.auth(id, key);
|
|
1103
|
+
this.useAuth = true;
|
|
1104
|
+
let auth_pack = this.boho.auth_req(this.serverTimeNonce );
|
|
1105
|
+
this.send(auth_pack);
|
|
1106
|
+
}
|
|
1108
1107
|
return this
|
|
1109
1108
|
}
|
|
1110
1109
|
|
|
@@ -1248,12 +1247,15 @@ class IOCore extends EventEmitter {
|
|
|
1248
1247
|
this.redirect(url);
|
|
1249
1248
|
break;
|
|
1250
1249
|
|
|
1251
|
-
case
|
|
1250
|
+
case tt.BohoMsg.SERVER_TIME_NONCE: // SERVER_READY
|
|
1252
1251
|
this.stateChange('server_ready', 'server_ready');
|
|
1253
1252
|
if (this.useAuth) {
|
|
1254
|
-
this.send(this.boho.auth_req());
|
|
1255
|
-
|
|
1253
|
+
this.send(this.boho.auth_req(buffer));
|
|
1254
|
+
this.stateChange('auth_req','auth_req');
|
|
1255
|
+
// CID_REQ will be called, after auth_res.
|
|
1256
1256
|
} else {
|
|
1257
|
+
// keep server_time_nonce for manual login()
|
|
1258
|
+
buffer.copy( this.serverTimeNonce);
|
|
1257
1259
|
// CID_REQ here, if not using auth.
|
|
1258
1260
|
this.send(Buffer$1.from([IOMsg.CID_REQ]));
|
|
1259
1261
|
}
|
|
@@ -1300,6 +1302,7 @@ class IOCore extends EventEmitter {
|
|
|
1300
1302
|
> cid_sub message: tag includes cid and @ both : 'cid@*'
|
|
1301
1303
|
> ch_sub message: else.
|
|
1302
1304
|
*/
|
|
1305
|
+
// console.log('payloadType', payloadType )
|
|
1303
1306
|
switch (payloadType) {
|
|
1304
1307
|
|
|
1305
1308
|
case PAYLOAD_TYPE.EMPTY:
|
|
@@ -1319,7 +1322,7 @@ class IOCore extends EventEmitter {
|
|
|
1319
1322
|
}
|
|
1320
1323
|
let oneString = decoder$4.decode(payloadStringWithoutNull);
|
|
1321
1324
|
if (tag.indexOf('@') === 0) this.emit('@', tag, oneString);
|
|
1322
|
-
|
|
1325
|
+
else {
|
|
1323
1326
|
this.emit(tag, tag, oneString);
|
|
1324
1327
|
this.emit('message', tag, oneString);
|
|
1325
1328
|
}
|
|
@@ -1327,7 +1330,7 @@ class IOCore extends EventEmitter {
|
|
|
1327
1330
|
|
|
1328
1331
|
case PAYLOAD_TYPE.BINARY:
|
|
1329
1332
|
if (tag.indexOf('@') === 0) this.emit('@', tag, payloadBuffer);
|
|
1330
|
-
|
|
1333
|
+
else {
|
|
1331
1334
|
this.emit(tag, tag, payloadBuffer);
|
|
1332
1335
|
this.emit('message', tag, payloadBuffer);
|
|
1333
1336
|
}
|
|
@@ -1337,7 +1340,7 @@ class IOCore extends EventEmitter {
|
|
|
1337
1340
|
let oneObjectBuffer = decoder$4.decode(payloadBuffer);
|
|
1338
1341
|
let oneJSONObject = JSON.parse(oneObjectBuffer);
|
|
1339
1342
|
if (tag.indexOf('@') === 0) this.emit('@', tag, oneJSONObject);
|
|
1340
|
-
|
|
1343
|
+
else {
|
|
1341
1344
|
this.emit(tag, tag, oneJSONObject);
|
|
1342
1345
|
this.emit('message', tag, oneJSONObject);
|
|
1343
1346
|
}
|
|
@@ -1347,7 +1350,7 @@ class IOCore extends EventEmitter {
|
|
|
1347
1350
|
let mjsonBuffer = decoder$4.decode(payloadBuffer);
|
|
1348
1351
|
let mjson = JSON.parse(mjsonBuffer);
|
|
1349
1352
|
if (tag.indexOf('@') === 0) this.emit('@', tag, ...mjson);
|
|
1350
|
-
|
|
1353
|
+
else {
|
|
1351
1354
|
this.emit(tag, tag, ...mjson);
|
|
1352
1355
|
this.emit('message', tag, ...mjson);
|
|
1353
1356
|
}
|
|
@@ -1356,7 +1359,7 @@ class IOCore extends EventEmitter {
|
|
|
1356
1359
|
case PAYLOAD_TYPE.MBA:
|
|
1357
1360
|
let mbaObject = M$1.unpack(payloadBuffer);
|
|
1358
1361
|
if (tag.indexOf('@') === 0) this.emit('@', tag, ...mbaObject.args);
|
|
1359
|
-
|
|
1362
|
+
else {
|
|
1360
1363
|
this.emit(tag, tag, ...mbaObject.args);
|
|
1361
1364
|
this.emit('message', tag, ...mbaObject.args);
|
|
1362
1365
|
}
|
|
@@ -1376,26 +1379,16 @@ class IOCore extends EventEmitter {
|
|
|
1376
1379
|
this.testPromise(buffer);
|
|
1377
1380
|
break;
|
|
1378
1381
|
|
|
1379
|
-
case tt.BohoMsg.AUTH_NONCE:
|
|
1380
|
-
this.stateChange('auth_nonce','server sent auth_nonce.');
|
|
1381
|
-
let auth_hmac = this.boho.auth_hmac(buffer);
|
|
1382
|
-
if (auth_hmac) {
|
|
1383
|
-
this.send(auth_hmac);
|
|
1384
|
-
} else {
|
|
1385
|
-
this.stateChange('auth_fail', 'boho.auth_hmac() invalid auth_nonce.');
|
|
1386
|
-
}
|
|
1387
|
-
break;
|
|
1388
|
-
|
|
1389
1382
|
case tt.BohoMsg.AUTH_FAIL:
|
|
1390
1383
|
this.stateChange('auth_fail', 'auth_fail from server.');
|
|
1391
1384
|
break;
|
|
1392
1385
|
|
|
1393
|
-
case tt.BohoMsg.
|
|
1394
|
-
if (this.boho.
|
|
1395
|
-
this.stateChange('
|
|
1386
|
+
case tt.BohoMsg.AUTH_RES:
|
|
1387
|
+
if (this.boho.verify_auth_res(buffer)) {
|
|
1388
|
+
this.stateChange('auth_res', 'server sent auth_res');
|
|
1396
1389
|
this.send(Buffer$1.from([IOMsg.CID_REQ]));
|
|
1397
1390
|
} else {
|
|
1398
|
-
this.stateChange('auth_fail', '
|
|
1391
|
+
this.stateChange('auth_fail', 'verify_auth_res() invalid server_hmac');
|
|
1399
1392
|
}
|
|
1400
1393
|
break;
|
|
1401
1394
|
|
|
@@ -1623,6 +1616,7 @@ class IOCore extends EventEmitter {
|
|
|
1623
1616
|
*/
|
|
1624
1617
|
signal_e2e(tag, data, key) {
|
|
1625
1618
|
|
|
1619
|
+
if( !this.boho.isAuthorized ) return;
|
|
1626
1620
|
if (typeof tag !== 'string') throw TypeError('tag should be string.')
|
|
1627
1621
|
let tagEncoded = encoder$1.encode(tag);
|
|
1628
1622
|
let dataPack = M$1.B8(data);
|
|
@@ -2198,300 +2192,6 @@ function requireConstants () {
|
|
|
2198
2192
|
return constants;
|
|
2199
2193
|
}
|
|
2200
2194
|
|
|
2201
|
-
var bufferutil = {exports: {}};
|
|
2202
|
-
|
|
2203
|
-
function commonjsRequire(path) {
|
|
2204
|
-
throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
var nodeGypBuild$1 = {exports: {}};
|
|
2208
|
-
|
|
2209
|
-
var nodeGypBuild;
|
|
2210
|
-
var hasRequiredNodeGypBuild$1;
|
|
2211
|
-
|
|
2212
|
-
function requireNodeGypBuild$1 () {
|
|
2213
|
-
if (hasRequiredNodeGypBuild$1) return nodeGypBuild;
|
|
2214
|
-
hasRequiredNodeGypBuild$1 = 1;
|
|
2215
|
-
var fs$1 = fs;
|
|
2216
|
-
var path$1 = path;
|
|
2217
|
-
var os = require$$2;
|
|
2218
|
-
|
|
2219
|
-
// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression'
|
|
2220
|
-
var runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : commonjsRequire; // eslint-disable-line
|
|
2221
|
-
|
|
2222
|
-
var vars = (process.config && process.config.variables) || {};
|
|
2223
|
-
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
2224
|
-
var abi = process.versions.modules; // TODO: support old node where this is undef
|
|
2225
|
-
var runtime = isElectron() ? 'electron' : (isNwjs() ? 'node-webkit' : 'node');
|
|
2226
|
-
|
|
2227
|
-
var arch = process.env.npm_config_arch || os.arch();
|
|
2228
|
-
var platform = process.env.npm_config_platform || os.platform();
|
|
2229
|
-
var libc = process.env.LIBC || (isAlpine(platform) ? 'musl' : 'glibc');
|
|
2230
|
-
var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || '';
|
|
2231
|
-
var uv = (process.versions.uv || '').split('.')[0];
|
|
2232
|
-
|
|
2233
|
-
nodeGypBuild = load;
|
|
2234
|
-
|
|
2235
|
-
function load (dir) {
|
|
2236
|
-
return runtimeRequire(load.resolve(dir))
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
load.resolve = load.path = function (dir) {
|
|
2240
|
-
dir = path$1.resolve(dir || '.');
|
|
2241
|
-
|
|
2242
|
-
try {
|
|
2243
|
-
var name = runtimeRequire(path$1.join(dir, 'package.json')).name.toUpperCase().replace(/-/g, '_');
|
|
2244
|
-
if (process.env[name + '_PREBUILD']) dir = process.env[name + '_PREBUILD'];
|
|
2245
|
-
} catch (err) {}
|
|
2246
|
-
|
|
2247
|
-
if (!prebuildsOnly) {
|
|
2248
|
-
var release = getFirst(path$1.join(dir, 'build/Release'), matchBuild);
|
|
2249
|
-
if (release) return release
|
|
2250
|
-
|
|
2251
|
-
var debug = getFirst(path$1.join(dir, 'build/Debug'), matchBuild);
|
|
2252
|
-
if (debug) return debug
|
|
2253
|
-
}
|
|
2254
|
-
|
|
2255
|
-
var prebuild = resolve(dir);
|
|
2256
|
-
if (prebuild) return prebuild
|
|
2257
|
-
|
|
2258
|
-
var nearby = resolve(path$1.dirname(process.execPath));
|
|
2259
|
-
if (nearby) return nearby
|
|
2260
|
-
|
|
2261
|
-
var target = [
|
|
2262
|
-
'platform=' + platform,
|
|
2263
|
-
'arch=' + arch,
|
|
2264
|
-
'runtime=' + runtime,
|
|
2265
|
-
'abi=' + abi,
|
|
2266
|
-
'uv=' + uv,
|
|
2267
|
-
armv ? 'armv=' + armv : '',
|
|
2268
|
-
'libc=' + libc,
|
|
2269
|
-
'node=' + process.versions.node,
|
|
2270
|
-
process.versions.electron ? 'electron=' + process.versions.electron : '',
|
|
2271
|
-
typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line
|
|
2272
|
-
].filter(Boolean).join(' ');
|
|
2273
|
-
|
|
2274
|
-
throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n')
|
|
2275
|
-
|
|
2276
|
-
function resolve (dir) {
|
|
2277
|
-
// Find matching "prebuilds/<platform>-<arch>" directory
|
|
2278
|
-
var tuples = readdirSync(path$1.join(dir, 'prebuilds')).map(parseTuple);
|
|
2279
|
-
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
2280
|
-
if (!tuple) return
|
|
2281
|
-
|
|
2282
|
-
// Find most specific flavor first
|
|
2283
|
-
var prebuilds = path$1.join(dir, 'prebuilds', tuple.name);
|
|
2284
|
-
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
2285
|
-
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
2286
|
-
var winner = candidates.sort(compareTags(runtime))[0];
|
|
2287
|
-
if (winner) return path$1.join(prebuilds, winner.file)
|
|
2288
|
-
}
|
|
2289
|
-
};
|
|
2290
|
-
|
|
2291
|
-
function readdirSync (dir) {
|
|
2292
|
-
try {
|
|
2293
|
-
return fs$1.readdirSync(dir)
|
|
2294
|
-
} catch (err) {
|
|
2295
|
-
return []
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
|
|
2299
|
-
function getFirst (dir, filter) {
|
|
2300
|
-
var files = readdirSync(dir).filter(filter);
|
|
2301
|
-
return files[0] && path$1.join(dir, files[0])
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
function matchBuild (name) {
|
|
2305
|
-
return /\.node$/.test(name)
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
function parseTuple (name) {
|
|
2309
|
-
// Example: darwin-x64+arm64
|
|
2310
|
-
var arr = name.split('-');
|
|
2311
|
-
if (arr.length !== 2) return
|
|
2312
|
-
|
|
2313
|
-
var platform = arr[0];
|
|
2314
|
-
var architectures = arr[1].split('+');
|
|
2315
|
-
|
|
2316
|
-
if (!platform) return
|
|
2317
|
-
if (!architectures.length) return
|
|
2318
|
-
if (!architectures.every(Boolean)) return
|
|
2319
|
-
|
|
2320
|
-
return { name, platform, architectures }
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
function matchTuple (platform, arch) {
|
|
2324
|
-
return function (tuple) {
|
|
2325
|
-
if (tuple == null) return false
|
|
2326
|
-
if (tuple.platform !== platform) return false
|
|
2327
|
-
return tuple.architectures.includes(arch)
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
function compareTuples (a, b) {
|
|
2332
|
-
// Prefer single-arch prebuilds over multi-arch
|
|
2333
|
-
return a.architectures.length - b.architectures.length
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
function parseTags (file) {
|
|
2337
|
-
var arr = file.split('.');
|
|
2338
|
-
var extension = arr.pop();
|
|
2339
|
-
var tags = { file: file, specificity: 0 };
|
|
2340
|
-
|
|
2341
|
-
if (extension !== 'node') return
|
|
2342
|
-
|
|
2343
|
-
for (var i = 0; i < arr.length; i++) {
|
|
2344
|
-
var tag = arr[i];
|
|
2345
|
-
|
|
2346
|
-
if (tag === 'node' || tag === 'electron' || tag === 'node-webkit') {
|
|
2347
|
-
tags.runtime = tag;
|
|
2348
|
-
} else if (tag === 'napi') {
|
|
2349
|
-
tags.napi = true;
|
|
2350
|
-
} else if (tag.slice(0, 3) === 'abi') {
|
|
2351
|
-
tags.abi = tag.slice(3);
|
|
2352
|
-
} else if (tag.slice(0, 2) === 'uv') {
|
|
2353
|
-
tags.uv = tag.slice(2);
|
|
2354
|
-
} else if (tag.slice(0, 4) === 'armv') {
|
|
2355
|
-
tags.armv = tag.slice(4);
|
|
2356
|
-
} else if (tag === 'glibc' || tag === 'musl') {
|
|
2357
|
-
tags.libc = tag;
|
|
2358
|
-
} else {
|
|
2359
|
-
continue
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
tags.specificity++;
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
return tags
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
function matchTags (runtime, abi) {
|
|
2369
|
-
return function (tags) {
|
|
2370
|
-
if (tags == null) return false
|
|
2371
|
-
if (tags.runtime && tags.runtime !== runtime && !runtimeAgnostic(tags)) return false
|
|
2372
|
-
if (tags.abi && tags.abi !== abi && !tags.napi) return false
|
|
2373
|
-
if (tags.uv && tags.uv !== uv) return false
|
|
2374
|
-
if (tags.armv && tags.armv !== armv) return false
|
|
2375
|
-
if (tags.libc && tags.libc !== libc) return false
|
|
2376
|
-
|
|
2377
|
-
return true
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
function runtimeAgnostic (tags) {
|
|
2382
|
-
return tags.runtime === 'node' && tags.napi
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
function compareTags (runtime) {
|
|
2386
|
-
// Precedence: non-agnostic runtime, abi over napi, then by specificity.
|
|
2387
|
-
return function (a, b) {
|
|
2388
|
-
if (a.runtime !== b.runtime) {
|
|
2389
|
-
return a.runtime === runtime ? -1 : 1
|
|
2390
|
-
} else if (a.abi !== b.abi) {
|
|
2391
|
-
return a.abi ? -1 : 1
|
|
2392
|
-
} else if (a.specificity !== b.specificity) {
|
|
2393
|
-
return a.specificity > b.specificity ? -1 : 1
|
|
2394
|
-
} else {
|
|
2395
|
-
return 0
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
function isNwjs () {
|
|
2401
|
-
return !!(process.versions && process.versions.nw)
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
function isElectron () {
|
|
2405
|
-
if (process.versions && process.versions.electron) return true
|
|
2406
|
-
if (process.env.ELECTRON_RUN_AS_NODE) return true
|
|
2407
|
-
return typeof window !== 'undefined' && window.process && window.process.type === 'renderer'
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
function isAlpine (platform) {
|
|
2411
|
-
return platform === 'linux' && fs$1.existsSync('/etc/alpine-release')
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
// Exposed for unit tests
|
|
2415
|
-
// TODO: move to lib
|
|
2416
|
-
load.parseTags = parseTags;
|
|
2417
|
-
load.matchTags = matchTags;
|
|
2418
|
-
load.compareTags = compareTags;
|
|
2419
|
-
load.parseTuple = parseTuple;
|
|
2420
|
-
load.matchTuple = matchTuple;
|
|
2421
|
-
load.compareTuples = compareTuples;
|
|
2422
|
-
return nodeGypBuild;
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
var hasRequiredNodeGypBuild;
|
|
2426
|
-
|
|
2427
|
-
function requireNodeGypBuild () {
|
|
2428
|
-
if (hasRequiredNodeGypBuild) return nodeGypBuild$1.exports;
|
|
2429
|
-
hasRequiredNodeGypBuild = 1;
|
|
2430
|
-
const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : commonjsRequire; // eslint-disable-line
|
|
2431
|
-
if (typeof runtimeRequire.addon === 'function') { // if the platform supports native resolving prefer that
|
|
2432
|
-
nodeGypBuild$1.exports = runtimeRequire.addon.bind(runtimeRequire);
|
|
2433
|
-
} else { // else use the runtime version here
|
|
2434
|
-
nodeGypBuild$1.exports = requireNodeGypBuild$1();
|
|
2435
|
-
}
|
|
2436
|
-
return nodeGypBuild$1.exports;
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
var fallback$1;
|
|
2440
|
-
var hasRequiredFallback$1;
|
|
2441
|
-
|
|
2442
|
-
function requireFallback$1 () {
|
|
2443
|
-
if (hasRequiredFallback$1) return fallback$1;
|
|
2444
|
-
hasRequiredFallback$1 = 1;
|
|
2445
|
-
|
|
2446
|
-
/**
|
|
2447
|
-
* Masks a buffer using the given mask.
|
|
2448
|
-
*
|
|
2449
|
-
* @param {Buffer} source The buffer to mask
|
|
2450
|
-
* @param {Buffer} mask The mask to use
|
|
2451
|
-
* @param {Buffer} output The buffer where to store the result
|
|
2452
|
-
* @param {Number} offset The offset at which to start writing
|
|
2453
|
-
* @param {Number} length The number of bytes to mask.
|
|
2454
|
-
* @public
|
|
2455
|
-
*/
|
|
2456
|
-
const mask = (source, mask, output, offset, length) => {
|
|
2457
|
-
for (var i = 0; i < length; i++) {
|
|
2458
|
-
output[offset + i] = source[i] ^ mask[i & 3];
|
|
2459
|
-
}
|
|
2460
|
-
};
|
|
2461
|
-
|
|
2462
|
-
/**
|
|
2463
|
-
* Unmasks a buffer using the given mask.
|
|
2464
|
-
*
|
|
2465
|
-
* @param {Buffer} buffer The buffer to unmask
|
|
2466
|
-
* @param {Buffer} mask The mask to use
|
|
2467
|
-
* @public
|
|
2468
|
-
*/
|
|
2469
|
-
const unmask = (buffer, mask) => {
|
|
2470
|
-
// Required until https://github.com/nodejs/node/issues/9006 is resolved.
|
|
2471
|
-
const length = buffer.length;
|
|
2472
|
-
for (var i = 0; i < length; i++) {
|
|
2473
|
-
buffer[i] ^= mask[i & 3];
|
|
2474
|
-
}
|
|
2475
|
-
};
|
|
2476
|
-
|
|
2477
|
-
fallback$1 = { mask, unmask };
|
|
2478
|
-
return fallback$1;
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
var hasRequiredBufferutil;
|
|
2482
|
-
|
|
2483
|
-
function requireBufferutil () {
|
|
2484
|
-
if (hasRequiredBufferutil) return bufferutil.exports;
|
|
2485
|
-
hasRequiredBufferutil = 1;
|
|
2486
|
-
|
|
2487
|
-
try {
|
|
2488
|
-
bufferutil.exports = requireNodeGypBuild()(__dirname);
|
|
2489
|
-
} catch (e) {
|
|
2490
|
-
bufferutil.exports = requireFallback$1();
|
|
2491
|
-
}
|
|
2492
|
-
return bufferutil.exports;
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
2195
|
var hasRequiredBufferUtil;
|
|
2496
2196
|
|
|
2497
2197
|
function requireBufferUtil () {
|
|
@@ -2612,7 +2312,7 @@ function requireBufferUtil () {
|
|
|
2612
2312
|
/* istanbul ignore else */
|
|
2613
2313
|
if (!process.env.WS_NO_BUFFER_UTIL) {
|
|
2614
2314
|
try {
|
|
2615
|
-
const bufferUtil$1 =
|
|
2315
|
+
const bufferUtil$1 = require('bufferutil');
|
|
2616
2316
|
|
|
2617
2317
|
bufferUtil.exports.mask = function (source, mask, output, offset, length) {
|
|
2618
2318
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
@@ -3231,92 +2931,6 @@ function requirePermessageDeflate () {
|
|
|
3231
2931
|
|
|
3232
2932
|
var validation = {exports: {}};
|
|
3233
2933
|
|
|
3234
|
-
var utf8Validate = {exports: {}};
|
|
3235
|
-
|
|
3236
|
-
var fallback;
|
|
3237
|
-
var hasRequiredFallback;
|
|
3238
|
-
|
|
3239
|
-
function requireFallback () {
|
|
3240
|
-
if (hasRequiredFallback) return fallback;
|
|
3241
|
-
hasRequiredFallback = 1;
|
|
3242
|
-
|
|
3243
|
-
/**
|
|
3244
|
-
* Checks if a given buffer contains only correct UTF-8.
|
|
3245
|
-
* Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
|
|
3246
|
-
* Markus Kuhn.
|
|
3247
|
-
*
|
|
3248
|
-
* @param {Buffer} buf The buffer to check
|
|
3249
|
-
* @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
|
|
3250
|
-
* @public
|
|
3251
|
-
*/
|
|
3252
|
-
function isValidUTF8(buf) {
|
|
3253
|
-
const len = buf.length;
|
|
3254
|
-
let i = 0;
|
|
3255
|
-
|
|
3256
|
-
while (i < len) {
|
|
3257
|
-
if ((buf[i] & 0x80) === 0x00) { // 0xxxxxxx
|
|
3258
|
-
i++;
|
|
3259
|
-
} else if ((buf[i] & 0xe0) === 0xc0) { // 110xxxxx 10xxxxxx
|
|
3260
|
-
if (
|
|
3261
|
-
i + 1 === len ||
|
|
3262
|
-
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3263
|
-
(buf[i] & 0xfe) === 0xc0 // overlong
|
|
3264
|
-
) {
|
|
3265
|
-
return false;
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3268
|
-
i += 2;
|
|
3269
|
-
} else if ((buf[i] & 0xf0) === 0xe0) { // 1110xxxx 10xxxxxx 10xxxxxx
|
|
3270
|
-
if (
|
|
3271
|
-
i + 2 >= len ||
|
|
3272
|
-
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3273
|
-
(buf[i + 2] & 0xc0) !== 0x80 ||
|
|
3274
|
-
buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80 || // overlong
|
|
3275
|
-
buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)
|
|
3276
|
-
) {
|
|
3277
|
-
return false;
|
|
3278
|
-
}
|
|
3279
|
-
|
|
3280
|
-
i += 3;
|
|
3281
|
-
} else if ((buf[i] & 0xf8) === 0xf0) { // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
|
3282
|
-
if (
|
|
3283
|
-
i + 3 >= len ||
|
|
3284
|
-
(buf[i + 1] & 0xc0) !== 0x80 ||
|
|
3285
|
-
(buf[i + 2] & 0xc0) !== 0x80 ||
|
|
3286
|
-
(buf[i + 3] & 0xc0) !== 0x80 ||
|
|
3287
|
-
buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80 || // overlong
|
|
3288
|
-
buf[i] === 0xf4 && buf[i + 1] > 0x8f || buf[i] > 0xf4 // > U+10FFFF
|
|
3289
|
-
) {
|
|
3290
|
-
return false;
|
|
3291
|
-
}
|
|
3292
|
-
|
|
3293
|
-
i += 4;
|
|
3294
|
-
} else {
|
|
3295
|
-
return false;
|
|
3296
|
-
}
|
|
3297
|
-
}
|
|
3298
|
-
|
|
3299
|
-
return true;
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
fallback = isValidUTF8;
|
|
3303
|
-
return fallback;
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
var hasRequiredUtf8Validate;
|
|
3307
|
-
|
|
3308
|
-
function requireUtf8Validate () {
|
|
3309
|
-
if (hasRequiredUtf8Validate) return utf8Validate.exports;
|
|
3310
|
-
hasRequiredUtf8Validate = 1;
|
|
3311
|
-
|
|
3312
|
-
try {
|
|
3313
|
-
utf8Validate.exports = requireNodeGypBuild()(__dirname);
|
|
3314
|
-
} catch (e) {
|
|
3315
|
-
utf8Validate.exports = requireFallback();
|
|
3316
|
-
}
|
|
3317
|
-
return utf8Validate.exports;
|
|
3318
|
-
}
|
|
3319
|
-
|
|
3320
2934
|
var hasRequiredValidation;
|
|
3321
2935
|
|
|
3322
2936
|
function requireValidation () {
|
|
@@ -3464,7 +3078,7 @@ function requireValidation () {
|
|
|
3464
3078
|
};
|
|
3465
3079
|
} /* istanbul ignore else */ else if (!process.env.WS_NO_UTF_8_VALIDATE) {
|
|
3466
3080
|
try {
|
|
3467
|
-
const isValidUTF8 =
|
|
3081
|
+
const isValidUTF8 = require('utf-8-validate');
|
|
3468
3082
|
|
|
3469
3083
|
validation.exports.isValidUTF8 = function (buf) {
|
|
3470
3084
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
@@ -5322,7 +4936,7 @@ function requireWebsocket () {
|
|
|
5322
4936
|
|
|
5323
4937
|
const EventEmitter = require$$0$3;
|
|
5324
4938
|
const https = require$$1$1;
|
|
5325
|
-
const http = require$$2
|
|
4939
|
+
const http = require$$2;
|
|
5326
4940
|
const net$1 = net;
|
|
5327
4941
|
const tls = require$$4;
|
|
5328
4942
|
const { randomBytes, createHash } = require$$1;
|
|
@@ -6966,7 +6580,7 @@ function requireWebsocketServer () {
|
|
|
6966
6580
|
hasRequiredWebsocketServer = 1;
|
|
6967
6581
|
|
|
6968
6582
|
const EventEmitter = require$$0$3;
|
|
6969
|
-
const http = require$$2
|
|
6583
|
+
const http = require$$2;
|
|
6970
6584
|
const { Duplex } = require$$0$2;
|
|
6971
6585
|
const { createHash } = require$$1;
|
|
6972
6586
|
|
|
@@ -7635,9 +7249,8 @@ let serverOption = {
|
|
|
7635
7249
|
},
|
|
7636
7250
|
|
|
7637
7251
|
auth: {
|
|
7638
|
-
delay_auth_fail: 600
|
|
7252
|
+
delay_auth_fail: 600
|
|
7639
7253
|
},
|
|
7640
|
-
|
|
7641
7254
|
membersOnly: false
|
|
7642
7255
|
|
|
7643
7256
|
};
|
|
@@ -7665,7 +7278,7 @@ class RemoteCore {
|
|
|
7665
7278
|
this.ssid = RemoteCore.ssid++; // ordered index number
|
|
7666
7279
|
this.manager = manager;
|
|
7667
7280
|
|
|
7668
|
-
this.cid = ''; //
|
|
7281
|
+
this.cid = ''; // Client Id
|
|
7669
7282
|
this.did = ''; // Device Id
|
|
7670
7283
|
this.uid = ''; // User Id
|
|
7671
7284
|
this.nick = '';
|
|
@@ -7688,7 +7301,7 @@ class RemoteCore {
|
|
|
7688
7301
|
this.state = state;
|
|
7689
7302
|
if (serverOption.debug.showAuthInfo) {
|
|
7690
7303
|
this.stateLog.push( state + ":" + STATE[ state] );
|
|
7691
|
-
if( state == STATE.
|
|
7304
|
+
if( state == STATE.AUTH_RES){
|
|
7692
7305
|
console.log('[auth success]', this.cid, this.stateLog.join('>'));
|
|
7693
7306
|
}else if( state == STATE.AUTH_FAIL){
|
|
7694
7307
|
console.log('[auth_fail]',this.stateLog.join('>'));
|
|
@@ -7927,29 +7540,16 @@ class RemoteCore {
|
|
|
7927
7540
|
break;
|
|
7928
7541
|
|
|
7929
7542
|
|
|
7930
|
-
//
|
|
7543
|
+
// client's auth requst
|
|
7931
7544
|
case tt.BohoMsg.AUTH_REQ:
|
|
7932
7545
|
if (!this.manager.authManager) return
|
|
7933
7546
|
if (this.state < STATE.SERVER_READY) {
|
|
7934
|
-
console.log('protocol error. auth_req
|
|
7547
|
+
console.log('protocol error. must called auth_req after server_ready');
|
|
7935
7548
|
this.close();
|
|
7936
7549
|
}
|
|
7937
7550
|
this.setState(STATE.AUTH_REQ);
|
|
7938
|
-
let auth_nonce_pack = this.boho.auth_nonce();
|
|
7939
|
-
// console.log('## auth_nonce_pack', auth_nonce_pack )
|
|
7940
|
-
this.send(auth_nonce_pack);
|
|
7941
|
-
this.setState(STATE.AUTH_NONCE);
|
|
7942
|
-
break;
|
|
7943
|
-
|
|
7944
|
-
case tt.BohoMsg.AUTH_HMAC:
|
|
7945
|
-
if (!this.manager.authManager) return
|
|
7946
|
-
if (this.state < STATE.AUTH_NONCE) {
|
|
7947
|
-
console.log('protocol error. auth_hmac before server_nonce');
|
|
7948
|
-
this.close();
|
|
7949
|
-
}
|
|
7950
|
-
this.setState(STATE.AUTH_HMAC);
|
|
7951
7551
|
//async
|
|
7952
|
-
this.manager.authManager.
|
|
7552
|
+
this.manager.authManager.verify_auth_req(message, this)
|
|
7953
7553
|
.then(authInfo => {
|
|
7954
7554
|
if (authInfo?.name) {
|
|
7955
7555
|
this.manager.deligateSignal(this, '@$name', authInfo.name);
|
|
@@ -7957,7 +7557,7 @@ class RemoteCore {
|
|
|
7957
7557
|
// this.manager.sender('@$name', authInfo.name )
|
|
7958
7558
|
}
|
|
7959
7559
|
|
|
7960
|
-
// console.log('[VERIFY
|
|
7560
|
+
// console.log('[VERIFY AUTH_REQ] SubClass of BohoAuth return authInfo:', authInfo )
|
|
7961
7561
|
})
|
|
7962
7562
|
.catch(e => {
|
|
7963
7563
|
console.log('authInfo return fail.', e );
|
|
@@ -8366,7 +7966,7 @@ class FileLogger {
|
|
|
8366
7966
|
const MAX = 10;
|
|
8367
7967
|
let period = 10000;
|
|
8368
7968
|
|
|
8369
|
-
class
|
|
7969
|
+
class Metrics {
|
|
8370
7970
|
constructor(manager) {
|
|
8371
7971
|
this.manager = manager;
|
|
8372
7972
|
|
|
@@ -8469,6 +8069,7 @@ class Metric {
|
|
|
8469
8069
|
id: remote.cid,
|
|
8470
8070
|
ssid: remote.ssid,
|
|
8471
8071
|
cid: remote.cid,
|
|
8072
|
+
uid: remote.uid,
|
|
8472
8073
|
uptime: Math.trunc((Date.now() - remote.socket.openTime) / 1000),
|
|
8473
8074
|
tx: remote.socket.txCounter,
|
|
8474
8075
|
rx: remote.socket.rxCounter,
|
|
@@ -8544,7 +8145,7 @@ class Manager {
|
|
|
8544
8145
|
this.channel_map = new Map(); // key: channelName -> value: < remote : Set >
|
|
8545
8146
|
this.CHANNEL_PREFIX = 'CH:';
|
|
8546
8147
|
this.CID_PREFIX = 'CID:';
|
|
8547
|
-
this.
|
|
8148
|
+
this.metrics = new Metrics(this);
|
|
8548
8149
|
this.lastSSID = 0;
|
|
8549
8150
|
|
|
8550
8151
|
this.pingIntervalID = setInterval(e => {
|
|
@@ -8580,7 +8181,7 @@ class Manager {
|
|
|
8580
8181
|
socket.isAlive = true;
|
|
8581
8182
|
let remote = new Remote(socket, req, this);
|
|
8582
8183
|
this.remotes.add(remote);
|
|
8583
|
-
remote.send(
|
|
8184
|
+
remote.send( remote.boho.server_time_nonce() );
|
|
8584
8185
|
remote.setState(STATE.SERVER_READY);
|
|
8585
8186
|
this.lastSSID = remote.ssid;
|
|
8586
8187
|
let connectionInfo = `+ IP:${remote.ip} #${remote.ssid} ${socket.socketType === 'websocket' ? "WS" : "CS"} `;
|
|
@@ -8897,18 +8498,18 @@ class Manager {
|
|
|
8897
8498
|
}
|
|
8898
8499
|
|
|
8899
8500
|
if (serverOption.showChannel > 0) {
|
|
8900
|
-
this.
|
|
8501
|
+
this.metrics.channels(serverOption.showChannel);
|
|
8901
8502
|
}
|
|
8902
8503
|
let mode = parseInt(serverOption.showMetric);
|
|
8903
8504
|
switch (mode) {
|
|
8904
8505
|
case 1:
|
|
8905
|
-
this.
|
|
8506
|
+
this.metrics.oneline(true);
|
|
8906
8507
|
break;
|
|
8907
8508
|
case 2:
|
|
8908
|
-
this.
|
|
8509
|
+
this.metrics.getRemotes(true);
|
|
8909
8510
|
break;
|
|
8910
8511
|
case 3:
|
|
8911
|
-
this.
|
|
8512
|
+
this.metrics.getChannelList(true);
|
|
8912
8513
|
break;
|
|
8913
8514
|
}
|
|
8914
8515
|
|
|
@@ -9075,25 +8676,25 @@ class Server extends require$$0$3 {
|
|
|
9075
8676
|
|
|
9076
8677
|
/**
|
|
9077
8678
|
* RPC service register.
|
|
9078
|
-
*
|
|
9079
|
-
*
|
|
8679
|
+
* service: service_name <string>
|
|
8680
|
+
* service_module <function module|class instance>
|
|
9080
8681
|
* return this
|
|
9081
8682
|
*/
|
|
9082
|
-
attach(
|
|
8683
|
+
attach(service, service_module) {
|
|
9083
8684
|
|
|
9084
|
-
if( typeof
|
|
9085
|
-
throw new Error(`
|
|
8685
|
+
if( typeof service !== 'string'){
|
|
8686
|
+
throw new Error(`attach service name is not a string.`)
|
|
9086
8687
|
}
|
|
9087
8688
|
if (!service_module.checkPermission || typeof service_module.checkPermission != 'function') {
|
|
9088
|
-
throw new Error(`Service ${
|
|
8689
|
+
throw new Error(`Service ${service} : no checkPermission or not a function.`)
|
|
9089
8690
|
}
|
|
9090
8691
|
if(!service_module.commands || !Array.isArray(service_module.commands) ){
|
|
9091
|
-
throw new Error(`Service ${
|
|
8692
|
+
throw new Error(`Service ${service} : no commands or !Array.`)
|
|
9092
8693
|
}
|
|
9093
8694
|
|
|
9094
8695
|
// Service TYPE 1. single call() function.
|
|
9095
8696
|
if ( service_module.call && typeof service_module.call == 'function' ) {
|
|
9096
|
-
this.on(
|
|
8697
|
+
this.on(service, (remote, req) => {
|
|
9097
8698
|
try {
|
|
9098
8699
|
if (!service_module.checkPermission(remote, req)) {
|
|
9099
8700
|
remote.response(req.mid, STATUS.ERROR, "NO_PERMISSION.");
|
|
@@ -9101,36 +8702,36 @@ class Server extends require$$0$3 {
|
|
|
9101
8702
|
}
|
|
9102
8703
|
if( service_module.commands.includes( req.topic )){
|
|
9103
8704
|
// console.log('server service_module req', req )
|
|
9104
|
-
|
|
8705
|
+
service_module.call(remote, req);
|
|
9105
8706
|
}else {
|
|
9106
8707
|
remote.response(req.mid, STATUS.ERROR, "UNKNOWN_COMMAND");
|
|
9107
8708
|
}
|
|
9108
8709
|
} catch (error) {
|
|
9109
|
-
console.error(`Unhandled Service Error in
|
|
8710
|
+
console.error(`Unhandled Service Error in service [${service}]:`, error);
|
|
9110
8711
|
remote.response(req.mid, STATUS.ERROR, "INTERNAL_SERVER_ERROR");
|
|
9111
8712
|
}
|
|
9112
8713
|
});
|
|
9113
8714
|
} else {
|
|
9114
8715
|
// Service TYPE 2. multiple functions.
|
|
9115
|
-
this.on(
|
|
8716
|
+
this.on(service, (remote, req) => {
|
|
9116
8717
|
try {
|
|
9117
8718
|
if (!service_module.checkPermission(remote, req)) {
|
|
9118
8719
|
remote.response(req.mid, STATUS.ERROR, "NO_PERMISSION.");
|
|
9119
8720
|
return
|
|
9120
8721
|
}
|
|
9121
8722
|
if( service_module.commands.includes( req.topic )){
|
|
9122
|
-
|
|
8723
|
+
service_module[req.topic](remote, req);
|
|
9123
8724
|
}else {
|
|
9124
8725
|
remote.response(req.mid, STATUS.ERROR, "UNKNOWN_COMMAND");
|
|
9125
8726
|
}
|
|
9126
8727
|
} catch (error) {
|
|
9127
|
-
console.error(`Unhandled Service Error in
|
|
8728
|
+
console.error(`Unhandled Service Error in service [${service}]:`, error);
|
|
9128
8729
|
remote.response(req.mid, STATUS.ERROR, "INTERNAL_SERVER_ERROR");
|
|
9129
8730
|
}
|
|
9130
8731
|
});
|
|
9131
8732
|
}
|
|
9132
|
-
this.serviceNames.add(
|
|
9133
|
-
// console.log(`[Service attached: ${
|
|
8733
|
+
this.serviceNames.add(service);
|
|
8734
|
+
// console.log(`[Service attached: ${service} ] accept commands: ${service_module.commands}`)
|
|
9134
8735
|
return this
|
|
9135
8736
|
}
|
|
9136
8737
|
|
|
@@ -9186,7 +8787,7 @@ class BohoAuth {
|
|
|
9186
8787
|
throw new Error('BohoAuth must be initialized with a keyProvider.');
|
|
9187
8788
|
}
|
|
9188
8789
|
this.keyProvider = keyProvider;
|
|
9189
|
-
|
|
8790
|
+
this.keepOldConnection = true;
|
|
9190
8791
|
this.authLogger;
|
|
9191
8792
|
if (serverOption.fileLogger.auth.use) {
|
|
9192
8793
|
this.authLogger = new FileLogger(serverOption.fileLogger.auth.path);
|
|
@@ -9201,42 +8802,40 @@ class BohoAuth {
|
|
|
9201
8802
|
}
|
|
9202
8803
|
// console.log('##### AUTH_FAIL reason: ', reason)
|
|
9203
8804
|
peer.setState(STATE.AUTH_FAIL);
|
|
9204
|
-
peer.send(Buffer.from([tt.BohoMsg.AUTH_FAIL]));
|
|
9205
8805
|
// add some delay time.
|
|
9206
|
-
|
|
9207
|
-
|
|
8806
|
+
setTimeout(e => {
|
|
8807
|
+
peer.send(Buffer.from([tt.BohoMsg.AUTH_FAIL]));
|
|
8808
|
+
}, serverOption.auth.delay_auth_fail);
|
|
9208
8809
|
}
|
|
9209
8810
|
|
|
9210
|
-
|
|
8811
|
+
|
|
8812
|
+
async verify_auth_req(auth_req, peer) {
|
|
9211
8813
|
try {
|
|
9212
8814
|
//1. unpack
|
|
9213
|
-
let infoPack = M$1.unpack(
|
|
9214
|
-
|
|
8815
|
+
let infoPack = M$1.unpack(auth_req, tt.Meta.AUTH_REQ);
|
|
9215
8816
|
if (!infoPack) {
|
|
9216
8817
|
this.send_auth_fail(peer, 'unpack auth_pack fail');
|
|
9217
8818
|
return
|
|
9218
8819
|
}
|
|
9219
|
-
|
|
8820
|
+
|
|
9220
8821
|
let id = "";
|
|
9221
8822
|
if (infoPack.id8.includes(0)) {
|
|
9222
8823
|
id = decoder.decode(infoPack.id8.subarray(0, infoPack.id8.indexOf(0)));
|
|
9223
8824
|
} else {
|
|
9224
8825
|
id = decoder.decode(infoPack.id8);
|
|
9225
8826
|
}
|
|
9226
|
-
|
|
8827
|
+
|
|
9227
8828
|
//2. get key of id from DB
|
|
9228
8829
|
let authInfo = await this.keyProvider.getAuth(id);
|
|
9229
|
-
|
|
9230
8830
|
if (!authInfo) {
|
|
9231
8831
|
this.send_auth_fail(peer, 'NO ID:' + id);
|
|
9232
8832
|
return
|
|
9233
8833
|
}
|
|
9234
8834
|
|
|
9235
8835
|
if (serverOption.debug.showAuthInfo) {
|
|
9236
|
-
console.log('[debug]showAuthInfo',authInfo
|
|
8836
|
+
console.log('[debug]showAuthInfo', authInfo);
|
|
9237
8837
|
}
|
|
9238
8838
|
|
|
9239
|
-
// console.log('db authInfo.key: ', authInfo.key)
|
|
9240
8839
|
peer.boho.copy_id8(infoPack.id8);
|
|
9241
8840
|
// type of key
|
|
9242
8841
|
let authKey;
|
|
@@ -9251,46 +8850,47 @@ class BohoAuth {
|
|
|
9251
8850
|
}
|
|
9252
8851
|
|
|
9253
8852
|
//3. check hmac
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
// console.log('auth_ack', auth_ack )
|
|
9258
|
-
if (!auth_ack) {
|
|
8853
|
+
let auth_res = peer.boho.verify_auth_req(infoPack);
|
|
8854
|
+
if (!auth_res) {
|
|
9259
8855
|
this.send_auth_fail(peer, 'hmac dismatched');
|
|
9260
8856
|
return
|
|
9261
8857
|
}
|
|
9262
8858
|
|
|
9263
8859
|
//4. get info
|
|
9264
|
-
// console.log('#### auth success' )
|
|
9265
8860
|
|
|
9266
8861
|
//5. check duplicate login.
|
|
9267
|
-
// current policy. Deny duplicate login
|
|
9268
|
-
|
|
9269
|
-
// duplicate login policy.
|
|
9270
|
-
// 1. send clear_auth signal to the old connection.
|
|
9271
|
-
// 2. close old connection.
|
|
9272
|
-
// 3. close new connection. retry from begining.
|
|
9273
8862
|
if (peer.manager.cid2remote.has(authInfo.cid)) {
|
|
9274
8863
|
let old = peer.manager.cid2remote.get(authInfo.cid);
|
|
8864
|
+
console.log('[WARN]DUPLICATE_LOGIN detected.', old.cid);
|
|
8865
|
+
old.ping(); // check the connection.
|
|
9275
8866
|
if (old == peer) {
|
|
9276
|
-
console.log('## trying RELOGIN
|
|
8867
|
+
console.log('## trying to RELOGIN after login.');
|
|
9277
8868
|
return
|
|
9278
8869
|
}
|
|
9279
|
-
|
|
9280
|
-
let
|
|
8870
|
+
|
|
8871
|
+
let authClearSignal = M$1.pack(
|
|
9281
8872
|
M$1.MB('#MsgType', '8', IOMsg.AUTH_CLEAR),
|
|
9282
8873
|
M$1.MB('#reason', 'duplicate login.')
|
|
9283
8874
|
);
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
8875
|
+
if (this.keepOldConnection) { // default true
|
|
8876
|
+
// keep old connection. reject new connection by sending auth_fail signal.
|
|
8877
|
+
// peer.send(authClearSignal)
|
|
8878
|
+
if( peer.socketType == 'websocket'){
|
|
8879
|
+
this.send_auth_fail(peer, 'duplicate login');
|
|
8880
|
+
}else {
|
|
8881
|
+
peer.close(); //arduino
|
|
8882
|
+
}
|
|
8883
|
+
} else {
|
|
8884
|
+
// accept new connection. stop the old connection by sending auth_clear signal.
|
|
8885
|
+
old.send(authClearSignal);
|
|
8886
|
+
peer.close();
|
|
8887
|
+
}
|
|
9287
8888
|
return
|
|
9288
8889
|
}
|
|
9289
8890
|
|
|
9290
|
-
|
|
9291
|
-
//6. delete current (temp rand)cid if exist.
|
|
8891
|
+
//6. delete current (or anonymouse)cid if exist.
|
|
9292
8892
|
if (peer.cid) {
|
|
9293
|
-
console.log('
|
|
8893
|
+
// console.log('if peer has cid', peer.cid)
|
|
9294
8894
|
peer.manager.cid2remote.delete(peer.cid);
|
|
9295
8895
|
}
|
|
9296
8896
|
|
|
@@ -9298,7 +8898,7 @@ class BohoAuth {
|
|
|
9298
8898
|
peer.did = id;
|
|
9299
8899
|
peer.cid = authInfo.cid;
|
|
9300
8900
|
peer.nick = authInfo.cid; // temporary: nick as cid
|
|
9301
|
-
if(
|
|
8901
|
+
if (authInfo.uid) peer.uid = authInfo.uid;
|
|
9302
8902
|
|
|
9303
8903
|
//8. setting quota level.
|
|
9304
8904
|
let quotaLevel = serverOption.defaultQuotaIndex;
|
|
@@ -9307,7 +8907,6 @@ class BohoAuth {
|
|
|
9307
8907
|
let newQuota = quotaTable[quotaLevel];
|
|
9308
8908
|
if (!newQuota) {
|
|
9309
8909
|
let err = 'no index quotaTable for auth.level: ' + quotaLevel;
|
|
9310
|
-
console.log('##AUTH:DATA ERROR##', err);
|
|
9311
8910
|
this.send_auth_fail(peer, err);
|
|
9312
8911
|
return
|
|
9313
8912
|
} else {
|
|
@@ -9319,17 +8918,14 @@ class BohoAuth {
|
|
|
9319
8918
|
console.log('## LOGIN ADMIN CID:', peer.cid);
|
|
9320
8919
|
peer.isAdmin = true;
|
|
9321
8920
|
}
|
|
9322
|
-
// console.log('auth: peer.quota', peer.quota )
|
|
9323
8921
|
// send quota.level
|
|
9324
8922
|
peer.send(Buffer.from([IOMsg.QUOTA_LEVEL, quotaLevel]));
|
|
9325
8923
|
|
|
9326
8924
|
//9. set cid2remote
|
|
9327
8925
|
peer.manager.cid2remote.set(peer.cid, peer);
|
|
9328
|
-
// console.log( 'done: cid2remote:', peer.manager.cid2remote.keys() )
|
|
9329
|
-
// console.log("LOGIN: ", `id: ${ peer.did}(${peer.cid})` )
|
|
9330
8926
|
//10. send ack.
|
|
9331
|
-
peer.send(
|
|
9332
|
-
peer.setState(STATE.
|
|
8927
|
+
peer.send(auth_res);
|
|
8928
|
+
peer.setState(STATE.AUTH_RES);
|
|
9333
8929
|
if (this.authLogger) {
|
|
9334
8930
|
let peerInfo = `OK #${peer.ssid} cid: ${peer.cid} did:${peer.did}`;
|
|
9335
8931
|
if (peer.isAdmin) peerInfo = "#ADMIN# " + peerInfo;
|
|
@@ -9337,9 +8933,9 @@ class BohoAuth {
|
|
|
9337
8933
|
}
|
|
9338
8934
|
return authInfo
|
|
9339
8935
|
} catch (error) {
|
|
8936
|
+
console.log('verify_auth_req error', error);
|
|
9340
8937
|
this.send_auth_fail(peer, '[BohoAuth]caught: unknown error:' + error);
|
|
9341
8938
|
}
|
|
9342
|
-
|
|
9343
8939
|
}
|
|
9344
8940
|
|
|
9345
8941
|
async getAuth(id) {
|
|
@@ -9592,18 +9188,18 @@ async function call(remote, req) {
|
|
|
9592
9188
|
let cmd = req.topic;
|
|
9593
9189
|
cmd = cmd.toLowerCase();
|
|
9594
9190
|
if (cmd == 'cid') {
|
|
9595
|
-
result = remote.manager.
|
|
9191
|
+
result = remote.manager.metrics.getCIdList();
|
|
9596
9192
|
} else if (cmd == 'remotes' || cmd == 'clients') {
|
|
9597
|
-
result = remote.manager.
|
|
9193
|
+
result = remote.manager.metrics.getRemotes();
|
|
9598
9194
|
} else if (cmd == 'channels') {
|
|
9599
|
-
result = remote.manager.
|
|
9195
|
+
result = remote.manager.metrics.getChannelList();
|
|
9600
9196
|
} else if (cmd == 'subscribers') {
|
|
9601
9197
|
let ch = req.$[0];
|
|
9602
|
-
if (ch) result = remote.manager.
|
|
9198
|
+
if (ch) result = remote.manager.metrics.getSubscribers(ch);
|
|
9603
9199
|
} else if (cmd == 'remote' || cmd == 'client') {
|
|
9604
9200
|
let cid = req.$[0];
|
|
9605
9201
|
let mode = req.$[1];
|
|
9606
|
-
if (cid) result = remote.manager.
|
|
9202
|
+
if (cid) result = remote.manager.metrics.getRemoteByCId(cid, mode);
|
|
9607
9203
|
|
|
9608
9204
|
} else if (cmd == 'close') {
|
|
9609
9205
|
if (req.$[0]) result = remote.manager.closeRemoteByCId(req.$[0]);
|