zen-code 2.1.0 → 2.3.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/MultiSelect-DZAUJ6V8.mjs +651 -0
- package/dist/app-C0lXPfzi.mjs +10027 -0
- package/dist/{checkpoint-1sAx_j1E-DbNzRw_n.mjs → checkpoint-1sAx_j1E-CeuO6wLL.mjs} +2 -1
- package/dist/{checkpoint-DxiUsHMy-BVWm3y9_.mjs → checkpoint-DxiUsHMy-D5StF4Dg.mjs} +4 -3
- package/dist/cli.mjs +33 -0
- package/dist/{devtools-BxIzBVXg.mjs → devtools-DpL9Fl6d.mjs} +658 -649
- package/dist/{app-CdJSgzzZ.mjs → graph-aTwGGPhX.mjs} +26957 -35867
- package/dist/{id-Bh5iJfyi.mjs → id-D-r9rdKn.mjs} +1 -1
- package/dist/{index-tkCYsAxh.mjs → index-DgogF6Ub.mjs} +5 -4
- package/dist/index-DpsJ-2by.mjs +23 -0
- package/dist/nonInteractive.mjs +45 -0
- package/dist/{queue-BSCnCent-DK-siJDC.mjs → queue-D6tEGCGs-CEAj3iiS.mjs} +21 -15
- package/dist/{shallow-Buk4Nzc4.mjs → shallow-Cg7nKycD.mjs} +5 -4
- package/dist/{use-input-CQELhJxU.mjs → use-input-1eSjZocJ.mjs} +751 -748
- package/dist/zen-code.mjs +2 -2
- package/dist/zen-init.mjs +5 -4
- package/dist/zen-keyboard.mjs +1 -1
- package/package.json +15 -17
- package/cli.js +0 -10
- package/dist/MultiSelect-C_hSPGpl.mjs +0 -655
- package/dist/index-DXn61qXM.mjs +0 -767
- package/dist/memory-BmHqUV4v.mjs +0 -93
|
@@ -11,12 +11,13 @@ import { a as et, g as yt } from "./_commonjsHelpers-ByX85dGu.mjs";
|
|
|
11
11
|
import Et from "node:buffer";
|
|
12
12
|
import tt from "react-devtools-core";
|
|
13
13
|
var te = { exports: {} }, _e, $e;
|
|
14
|
-
function
|
|
14
|
+
function q() {
|
|
15
15
|
if ($e) return _e;
|
|
16
16
|
$e = 1;
|
|
17
17
|
const P = ["nodebuffer", "arraybuffer", "fragments"], T = typeof Blob < "u";
|
|
18
18
|
return T && P.push("blob"), _e = {
|
|
19
19
|
BINARY_TYPES: P,
|
|
20
|
+
CLOSE_TIMEOUT: 3e4,
|
|
20
21
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
21
22
|
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
22
23
|
hasBlob: T,
|
|
@@ -28,55 +29,55 @@ function j() {
|
|
|
28
29
|
}
|
|
29
30
|
}, _e;
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
+
const St = {}, xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
32
33
|
__proto__: null,
|
|
33
|
-
default:
|
|
34
|
-
}, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ et(
|
|
34
|
+
default: St
|
|
35
|
+
}, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ et(xt);
|
|
35
36
|
var Fe;
|
|
36
|
-
function
|
|
37
|
+
function ae() {
|
|
37
38
|
if (Fe) return te.exports;
|
|
38
39
|
Fe = 1;
|
|
39
|
-
const { EMPTY_BUFFER: P } =
|
|
40
|
-
function M(
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
40
|
+
const { EMPTY_BUFFER: P } = q(), T = Buffer[Symbol.species];
|
|
41
|
+
function M(l, a) {
|
|
42
|
+
if (l.length === 0) return P;
|
|
43
|
+
if (l.length === 1) return l[0];
|
|
43
44
|
const _ = Buffer.allocUnsafe(a);
|
|
44
45
|
let h = 0;
|
|
45
|
-
for (let
|
|
46
|
-
const c =
|
|
46
|
+
for (let L = 0; L < l.length; L++) {
|
|
47
|
+
const c = l[L];
|
|
47
48
|
_.set(c, h), h += c.length;
|
|
48
49
|
}
|
|
49
50
|
return h < a ? new T(_.buffer, _.byteOffset, h) : _;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
for (let c = 0; c <
|
|
53
|
-
_[h + c] =
|
|
52
|
+
function D(l, a, _, h, L) {
|
|
53
|
+
for (let c = 0; c < L; c++)
|
|
54
|
+
_[h + c] = l[c] ^ a[c & 3];
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
for (let _ = 0; _ <
|
|
57
|
-
|
|
56
|
+
function x(l, a) {
|
|
57
|
+
for (let _ = 0; _ < l.length; _++)
|
|
58
|
+
l[_] ^= a[_ & 3];
|
|
58
59
|
}
|
|
59
|
-
function d(
|
|
60
|
-
return
|
|
60
|
+
function d(l) {
|
|
61
|
+
return l.length === l.buffer.byteLength ? l.buffer : l.buffer.slice(l.byteOffset, l.byteOffset + l.length);
|
|
61
62
|
}
|
|
62
|
-
function n(
|
|
63
|
-
if (n.readOnly = !0, Buffer.isBuffer(
|
|
63
|
+
function n(l) {
|
|
64
|
+
if (n.readOnly = !0, Buffer.isBuffer(l)) return l;
|
|
64
65
|
let a;
|
|
65
|
-
return
|
|
66
|
+
return l instanceof ArrayBuffer ? a = new T(l) : ArrayBuffer.isView(l) ? a = new T(l.buffer, l.byteOffset, l.byteLength) : (a = Buffer.from(l), n.readOnly = !1), a;
|
|
66
67
|
}
|
|
67
68
|
if (te.exports = {
|
|
68
69
|
concat: M,
|
|
69
|
-
mask:
|
|
70
|
+
mask: D,
|
|
70
71
|
toArrayBuffer: d,
|
|
71
72
|
toBuffer: n,
|
|
72
|
-
unmask:
|
|
73
|
+
unmask: x
|
|
73
74
|
}, !process.env.WS_NO_BUFFER_UTIL)
|
|
74
75
|
try {
|
|
75
|
-
const
|
|
76
|
-
te.exports.mask = function(a, _, h,
|
|
77
|
-
c < 48 ?
|
|
76
|
+
const l = vt;
|
|
77
|
+
te.exports.mask = function(a, _, h, L, c) {
|
|
78
|
+
c < 48 ? D(a, _, h, L, c) : l.mask(a, _, h, L, c);
|
|
78
79
|
}, te.exports.unmask = function(a, _) {
|
|
79
|
-
a.length < 32 ?
|
|
80
|
+
a.length < 32 ? x(a, _) : l.unmask(a, _);
|
|
80
81
|
};
|
|
81
82
|
} catch {
|
|
82
83
|
}
|
|
@@ -94,10 +95,10 @@ function bt() {
|
|
|
94
95
|
* @param {Number} [concurrency=Infinity] The maximum number of jobs allowed
|
|
95
96
|
* to run concurrently
|
|
96
97
|
*/
|
|
97
|
-
constructor(
|
|
98
|
+
constructor(x) {
|
|
98
99
|
this[P] = () => {
|
|
99
100
|
this.pending--, this[T]();
|
|
100
|
-
}, this.concurrency =
|
|
101
|
+
}, this.concurrency = x || 1 / 0, this.jobs = [], this.pending = 0;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* Adds a job to the queue.
|
|
@@ -105,8 +106,8 @@ function bt() {
|
|
|
105
106
|
* @param {Function} job The job to run
|
|
106
107
|
* @public
|
|
107
108
|
*/
|
|
108
|
-
add(
|
|
109
|
-
this.jobs.push(
|
|
109
|
+
add(x) {
|
|
110
|
+
this.jobs.push(x), this[T]();
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
113
|
* Removes a job from the queue and runs it if possible.
|
|
@@ -115,19 +116,19 @@ function bt() {
|
|
|
115
116
|
*/
|
|
116
117
|
[T]() {
|
|
117
118
|
if (this.pending !== this.concurrency && this.jobs.length) {
|
|
118
|
-
const
|
|
119
|
-
this.pending++,
|
|
119
|
+
const x = this.jobs.shift();
|
|
120
|
+
this.pending++, x(this[P]);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
return pe = M, pe;
|
|
124
125
|
}
|
|
125
126
|
var me, Ve;
|
|
126
|
-
function
|
|
127
|
+
function le() {
|
|
127
128
|
if (Ve) return me;
|
|
128
129
|
Ve = 1;
|
|
129
|
-
const P = gt, T =
|
|
130
|
-
let
|
|
130
|
+
const P = gt, T = ae(), M = bt(), { kStatusCode: D } = q(), x = Buffer[Symbol.species], d = Buffer.from([0, 0, 255, 255]), n = /* @__PURE__ */ Symbol("permessage-deflate"), l = /* @__PURE__ */ Symbol("total-length"), a = /* @__PURE__ */ Symbol("callback"), _ = /* @__PURE__ */ Symbol("buffers"), h = /* @__PURE__ */ Symbol("error");
|
|
131
|
+
let L;
|
|
131
132
|
class c {
|
|
132
133
|
/**
|
|
133
134
|
* Creates a PerMessageDeflate instance.
|
|
@@ -153,10 +154,10 @@ function ae() {
|
|
|
153
154
|
* client mode
|
|
154
155
|
* @param {Number} [maxPayload=0] The maximum allowed message length
|
|
155
156
|
*/
|
|
156
|
-
constructor(p,
|
|
157
|
-
if (this._maxPayload = E | 0, this._options = p || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!
|
|
158
|
-
const
|
|
159
|
-
|
|
157
|
+
constructor(p, f, E) {
|
|
158
|
+
if (this._maxPayload = E | 0, this._options = p || {}, this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024, this._isServer = !!f, this._deflate = null, this._inflate = null, this.params = null, !L) {
|
|
159
|
+
const w = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
|
|
160
|
+
L = new M(w);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
@@ -208,10 +209,10 @@ function ae() {
|
|
|
208
209
|
* @private
|
|
209
210
|
*/
|
|
210
211
|
acceptAsServer(p) {
|
|
211
|
-
const
|
|
212
|
+
const f = this._options, E = p.find((w) => !(f.serverNoContextTakeover === !1 && w.server_no_context_takeover || w.server_max_window_bits && (f.serverMaxWindowBits === !1 || typeof f.serverMaxWindowBits == "number" && f.serverMaxWindowBits > w.server_max_window_bits) || typeof f.clientMaxWindowBits == "number" && !w.client_max_window_bits));
|
|
212
213
|
if (!E)
|
|
213
214
|
throw new Error("None of the extension offers can be accepted");
|
|
214
|
-
return
|
|
215
|
+
return f.serverNoContextTakeover && (E.server_no_context_takeover = !0), f.clientNoContextTakeover && (E.client_no_context_takeover = !0), typeof f.serverMaxWindowBits == "number" && (E.server_max_window_bits = f.serverMaxWindowBits), typeof f.clientMaxWindowBits == "number" ? E.client_max_window_bits = f.clientMaxWindowBits : (E.client_max_window_bits === !0 || f.clientMaxWindowBits === !1) && delete E.client_max_window_bits, E;
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
217
218
|
* Accept the extension negotiation response.
|
|
@@ -221,16 +222,16 @@ function ae() {
|
|
|
221
222
|
* @private
|
|
222
223
|
*/
|
|
223
224
|
acceptAsClient(p) {
|
|
224
|
-
const
|
|
225
|
-
if (this._options.clientNoContextTakeover === !1 &&
|
|
225
|
+
const f = p[0];
|
|
226
|
+
if (this._options.clientNoContextTakeover === !1 && f.client_no_context_takeover)
|
|
226
227
|
throw new Error('Unexpected parameter "client_no_context_takeover"');
|
|
227
|
-
if (!
|
|
228
|
-
typeof this._options.clientMaxWindowBits == "number" && (
|
|
229
|
-
else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" &&
|
|
228
|
+
if (!f.client_max_window_bits)
|
|
229
|
+
typeof this._options.clientMaxWindowBits == "number" && (f.client_max_window_bits = this._options.clientMaxWindowBits);
|
|
230
|
+
else if (this._options.clientMaxWindowBits === !1 || typeof this._options.clientMaxWindowBits == "number" && f.client_max_window_bits > this._options.clientMaxWindowBits)
|
|
230
231
|
throw new Error(
|
|
231
232
|
'Unexpected or invalid parameter "client_max_window_bits"'
|
|
232
233
|
);
|
|
233
|
-
return
|
|
234
|
+
return f;
|
|
234
235
|
}
|
|
235
236
|
/**
|
|
236
237
|
* Normalize parameters.
|
|
@@ -240,38 +241,38 @@ function ae() {
|
|
|
240
241
|
* @private
|
|
241
242
|
*/
|
|
242
243
|
normalizeParams(p) {
|
|
243
|
-
return p.forEach((
|
|
244
|
-
Object.keys(
|
|
245
|
-
let
|
|
246
|
-
if (
|
|
244
|
+
return p.forEach((f) => {
|
|
245
|
+
Object.keys(f).forEach((E) => {
|
|
246
|
+
let w = f[E];
|
|
247
|
+
if (w.length > 1)
|
|
247
248
|
throw new Error(`Parameter "${E}" must have only a single value`);
|
|
248
|
-
if (
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
if (!Number.isInteger(
|
|
249
|
+
if (w = w[0], E === "client_max_window_bits") {
|
|
250
|
+
if (w !== !0) {
|
|
251
|
+
const t = +w;
|
|
252
|
+
if (!Number.isInteger(t) || t < 8 || t > 15)
|
|
252
253
|
throw new TypeError(
|
|
253
|
-
`Invalid value for parameter "${E}": ${
|
|
254
|
+
`Invalid value for parameter "${E}": ${w}`
|
|
254
255
|
);
|
|
255
|
-
|
|
256
|
+
w = t;
|
|
256
257
|
} else if (!this._isServer)
|
|
257
258
|
throw new TypeError(
|
|
258
|
-
`Invalid value for parameter "${E}": ${
|
|
259
|
+
`Invalid value for parameter "${E}": ${w}`
|
|
259
260
|
);
|
|
260
261
|
} else if (E === "server_max_window_bits") {
|
|
261
|
-
const
|
|
262
|
-
if (!Number.isInteger(
|
|
262
|
+
const t = +w;
|
|
263
|
+
if (!Number.isInteger(t) || t < 8 || t > 15)
|
|
263
264
|
throw new TypeError(
|
|
264
|
-
`Invalid value for parameter "${E}": ${
|
|
265
|
+
`Invalid value for parameter "${E}": ${w}`
|
|
265
266
|
);
|
|
266
|
-
|
|
267
|
+
w = t;
|
|
267
268
|
} else if (E === "client_no_context_takeover" || E === "server_no_context_takeover") {
|
|
268
|
-
if (
|
|
269
|
+
if (w !== !0)
|
|
269
270
|
throw new TypeError(
|
|
270
|
-
`Invalid value for parameter "${E}": ${
|
|
271
|
+
`Invalid value for parameter "${E}": ${w}`
|
|
271
272
|
);
|
|
272
273
|
} else
|
|
273
274
|
throw new Error(`Unknown parameter "${E}"`);
|
|
274
|
-
|
|
275
|
+
f[E] = w;
|
|
275
276
|
});
|
|
276
277
|
}), p;
|
|
277
278
|
}
|
|
@@ -283,10 +284,10 @@ function ae() {
|
|
|
283
284
|
* @param {Function} callback Callback
|
|
284
285
|
* @public
|
|
285
286
|
*/
|
|
286
|
-
decompress(p,
|
|
287
|
-
|
|
288
|
-
this._decompress(p,
|
|
289
|
-
|
|
287
|
+
decompress(p, f, E) {
|
|
288
|
+
L.add((w) => {
|
|
289
|
+
this._decompress(p, f, (t, e) => {
|
|
290
|
+
w(), E(t, e);
|
|
290
291
|
});
|
|
291
292
|
});
|
|
292
293
|
}
|
|
@@ -298,10 +299,10 @@ function ae() {
|
|
|
298
299
|
* @param {Function} callback Callback
|
|
299
300
|
* @public
|
|
300
301
|
*/
|
|
301
|
-
compress(p,
|
|
302
|
-
|
|
303
|
-
this._compress(p,
|
|
304
|
-
|
|
302
|
+
compress(p, f, E) {
|
|
303
|
+
L.add((w) => {
|
|
304
|
+
this._compress(p, f, (t, e) => {
|
|
305
|
+
w(), E(t, e);
|
|
305
306
|
});
|
|
306
307
|
});
|
|
307
308
|
}
|
|
@@ -313,26 +314,26 @@ function ae() {
|
|
|
313
314
|
* @param {Function} callback Callback
|
|
314
315
|
* @private
|
|
315
316
|
*/
|
|
316
|
-
_decompress(p,
|
|
317
|
-
const
|
|
317
|
+
_decompress(p, f, E) {
|
|
318
|
+
const w = this._isServer ? "client" : "server";
|
|
318
319
|
if (!this._inflate) {
|
|
319
|
-
const
|
|
320
|
+
const t = `${w}_max_window_bits`, e = typeof this.params[t] != "number" ? P.Z_DEFAULT_WINDOWBITS : this.params[t];
|
|
320
321
|
this._inflate = P.createInflateRaw({
|
|
321
322
|
...this._options.zlibInflateOptions,
|
|
322
|
-
windowBits:
|
|
323
|
-
}), this._inflate[n] = this, this._inflate[
|
|
323
|
+
windowBits: e
|
|
324
|
+
}), this._inflate[n] = this, this._inflate[l] = 0, this._inflate[_] = [], this._inflate.on("error", v), this._inflate.on("data", C);
|
|
324
325
|
}
|
|
325
|
-
this._inflate[a] = E, this._inflate.write(p),
|
|
326
|
-
const
|
|
327
|
-
if (
|
|
328
|
-
this._inflate.close(), this._inflate = null, E(
|
|
326
|
+
this._inflate[a] = E, this._inflate.write(p), f && this._inflate.write(d), this._inflate.flush(() => {
|
|
327
|
+
const t = this._inflate[h];
|
|
328
|
+
if (t) {
|
|
329
|
+
this._inflate.close(), this._inflate = null, E(t);
|
|
329
330
|
return;
|
|
330
331
|
}
|
|
331
|
-
const
|
|
332
|
+
const e = T.concat(
|
|
332
333
|
this._inflate[_],
|
|
333
|
-
this._inflate[
|
|
334
|
+
this._inflate[l]
|
|
334
335
|
);
|
|
335
|
-
this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[
|
|
336
|
+
this._inflate._readableState.endEmitted ? (this._inflate.close(), this._inflate = null) : (this._inflate[l] = 0, this._inflate[_] = [], f && this.params[`${w}_no_context_takeover`] && this._inflate.reset()), E(null, e);
|
|
336
337
|
});
|
|
337
338
|
}
|
|
338
339
|
/**
|
|
@@ -343,43 +344,43 @@ function ae() {
|
|
|
343
344
|
* @param {Function} callback Callback
|
|
344
345
|
* @private
|
|
345
346
|
*/
|
|
346
|
-
_compress(p,
|
|
347
|
-
const
|
|
347
|
+
_compress(p, f, E) {
|
|
348
|
+
const w = this._isServer ? "server" : "client";
|
|
348
349
|
if (!this._deflate) {
|
|
349
|
-
const
|
|
350
|
+
const t = `${w}_max_window_bits`, e = typeof this.params[t] != "number" ? P.Z_DEFAULT_WINDOWBITS : this.params[t];
|
|
350
351
|
this._deflate = P.createDeflateRaw({
|
|
351
352
|
...this._options.zlibDeflateOptions,
|
|
352
|
-
windowBits:
|
|
353
|
-
}), this._deflate[
|
|
353
|
+
windowBits: e
|
|
354
|
+
}), this._deflate[l] = 0, this._deflate[_] = [], this._deflate.on("data", b);
|
|
354
355
|
}
|
|
355
356
|
this._deflate[a] = E, this._deflate.write(p), this._deflate.flush(P.Z_SYNC_FLUSH, () => {
|
|
356
357
|
if (!this._deflate)
|
|
357
358
|
return;
|
|
358
|
-
let
|
|
359
|
+
let t = T.concat(
|
|
359
360
|
this._deflate[_],
|
|
360
|
-
this._deflate[
|
|
361
|
+
this._deflate[l]
|
|
361
362
|
);
|
|
362
|
-
|
|
363
|
+
f && (t = new x(t.buffer, t.byteOffset, t.length - 4)), this._deflate[a] = null, this._deflate[l] = 0, this._deflate[_] = [], f && this.params[`${w}_no_context_takeover`] && this._deflate.reset(), E(null, t);
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
366
|
}
|
|
366
367
|
me = c;
|
|
367
|
-
function
|
|
368
|
-
this[_].push(O), this[
|
|
368
|
+
function b(O) {
|
|
369
|
+
this[_].push(O), this[l] += O.length;
|
|
369
370
|
}
|
|
370
|
-
function
|
|
371
|
-
if (this[
|
|
371
|
+
function C(O) {
|
|
372
|
+
if (this[l] += O.length, this[n]._maxPayload < 1 || this[l] <= this[n]._maxPayload) {
|
|
372
373
|
this[_].push(O);
|
|
373
374
|
return;
|
|
374
375
|
}
|
|
375
|
-
this[h] = new RangeError("Max payload size exceeded"), this[h].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[h][
|
|
376
|
+
this[h] = new RangeError("Max payload size exceeded"), this[h].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH", this[h][D] = 1009, this.removeListener("data", C), this.reset();
|
|
376
377
|
}
|
|
377
378
|
function v(O) {
|
|
378
379
|
if (this[n]._inflate = null, this[h]) {
|
|
379
380
|
this[a](this[h]);
|
|
380
381
|
return;
|
|
381
382
|
}
|
|
382
|
-
O[
|
|
383
|
+
O[D] = 1007, this[a](O);
|
|
383
384
|
}
|
|
384
385
|
return me;
|
|
385
386
|
}
|
|
@@ -392,7 +393,7 @@ var Ge;
|
|
|
392
393
|
function ie() {
|
|
393
394
|
if (Ge) return re.exports;
|
|
394
395
|
Ge = 1;
|
|
395
|
-
const { isUtf8: P } = Et, { hasBlob: T } =
|
|
396
|
+
const { isUtf8: P } = Et, { hasBlob: T } = q(), M = [
|
|
396
397
|
0,
|
|
397
398
|
0,
|
|
398
399
|
0,
|
|
@@ -530,26 +531,26 @@ function ie() {
|
|
|
530
531
|
0
|
|
531
532
|
// 112 - 127
|
|
532
533
|
];
|
|
533
|
-
function
|
|
534
|
+
function D(n) {
|
|
534
535
|
return n >= 1e3 && n <= 1014 && n !== 1004 && n !== 1005 && n !== 1006 || n >= 3e3 && n <= 4999;
|
|
535
536
|
}
|
|
536
|
-
function
|
|
537
|
-
const
|
|
537
|
+
function x(n) {
|
|
538
|
+
const l = n.length;
|
|
538
539
|
let a = 0;
|
|
539
|
-
for (; a <
|
|
540
|
+
for (; a < l; )
|
|
540
541
|
if ((n[a] & 128) === 0)
|
|
541
542
|
a++;
|
|
542
543
|
else if ((n[a] & 224) === 192) {
|
|
543
|
-
if (a + 1 ===
|
|
544
|
+
if (a + 1 === l || (n[a + 1] & 192) !== 128 || (n[a] & 254) === 192)
|
|
544
545
|
return !1;
|
|
545
546
|
a += 2;
|
|
546
547
|
} else if ((n[a] & 240) === 224) {
|
|
547
|
-
if (a + 2 >=
|
|
548
|
+
if (a + 2 >= l || (n[a + 1] & 192) !== 128 || (n[a + 2] & 192) !== 128 || n[a] === 224 && (n[a + 1] & 224) === 128 || // Overlong
|
|
548
549
|
n[a] === 237 && (n[a + 1] & 224) === 160)
|
|
549
550
|
return !1;
|
|
550
551
|
a += 3;
|
|
551
552
|
} else if ((n[a] & 248) === 240) {
|
|
552
|
-
if (a + 3 >=
|
|
553
|
+
if (a + 3 >= l || (n[a + 1] & 192) !== 128 || (n[a + 2] & 192) !== 128 || (n[a + 3] & 192) !== 128 || n[a] === 240 && (n[a + 1] & 240) === 128 || // Overlong
|
|
553
554
|
n[a] === 244 && n[a + 1] > 143 || n[a] > 244)
|
|
554
555
|
return !1;
|
|
555
556
|
a += 4;
|
|
@@ -562,18 +563,18 @@ function ie() {
|
|
|
562
563
|
}
|
|
563
564
|
if (re.exports = {
|
|
564
565
|
isBlob: d,
|
|
565
|
-
isValidStatusCode:
|
|
566
|
-
isValidUTF8:
|
|
566
|
+
isValidStatusCode: D,
|
|
567
|
+
isValidUTF8: x,
|
|
567
568
|
tokenChars: M
|
|
568
569
|
}, P)
|
|
569
570
|
re.exports.isValidUTF8 = function(n) {
|
|
570
|
-
return n.length < 24 ?
|
|
571
|
+
return n.length < 24 ? x(n) : P(n);
|
|
571
572
|
};
|
|
572
573
|
else if (!process.env.WS_NO_UTF_8_VALIDATE)
|
|
573
574
|
try {
|
|
574
575
|
const n = Tt;
|
|
575
|
-
re.exports.isValidUTF8 = function(
|
|
576
|
-
return
|
|
576
|
+
re.exports.isValidUTF8 = function(l) {
|
|
577
|
+
return l.length < 32 ? x(l) : n(l);
|
|
577
578
|
};
|
|
578
579
|
} catch {
|
|
579
580
|
}
|
|
@@ -583,12 +584,12 @@ var ge, je;
|
|
|
583
584
|
function rt() {
|
|
584
585
|
if (je) return ge;
|
|
585
586
|
je = 1;
|
|
586
|
-
const { Writable: P } = se, T =
|
|
587
|
+
const { Writable: P } = se, T = le(), {
|
|
587
588
|
BINARY_TYPES: M,
|
|
588
|
-
EMPTY_BUFFER:
|
|
589
|
-
kStatusCode:
|
|
589
|
+
EMPTY_BUFFER: D,
|
|
590
|
+
kStatusCode: x,
|
|
590
591
|
kWebSocket: d
|
|
591
|
-
} =
|
|
592
|
+
} = q(), { concat: n, toArrayBuffer: l, unmask: a } = ae(), { isValidStatusCode: _, isValidUTF8: h } = ie(), L = Buffer[Symbol.species], c = 0, b = 1, C = 2, v = 3, O = 4, p = 5, f = 6;
|
|
592
593
|
class E extends P {
|
|
593
594
|
/**
|
|
594
595
|
* Creates a Receiver instance.
|
|
@@ -606,8 +607,8 @@ function rt() {
|
|
|
606
607
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
607
608
|
* not to skip UTF-8 validation for text and close messages
|
|
608
609
|
*/
|
|
609
|
-
constructor(
|
|
610
|
-
super(), this._allowSynchronousEvents =
|
|
610
|
+
constructor(t = {}) {
|
|
611
|
+
super(), this._allowSynchronousEvents = t.allowSynchronousEvents !== void 0 ? t.allowSynchronousEvents : !0, this._binaryType = t.binaryType || M[0], this._extensions = t.extensions || {}, this._isServer = !!t.isServer, this._maxPayload = t.maxPayload | 0, this._skipUTF8Validation = !!t.skipUTF8Validation, this[d] = void 0, this._bufferedBytes = 0, this._buffers = [], this._compressed = !1, this._payloadLength = 0, this._mask = void 0, this._fragmented = 0, this._masked = !1, this._fin = !1, this._opcode = 0, this._totalPayloadLength = 0, this._messageLength = 0, this._fragments = [], this._errored = !1, this._loop = !1, this._state = c;
|
|
611
612
|
}
|
|
612
613
|
/**
|
|
613
614
|
* Implements `Writable.prototype._write()`.
|
|
@@ -617,9 +618,9 @@ function rt() {
|
|
|
617
618
|
* @param {Function} cb Callback
|
|
618
619
|
* @private
|
|
619
620
|
*/
|
|
620
|
-
_write(
|
|
621
|
-
if (this._opcode === 8 && this._state == c) return
|
|
622
|
-
this._bufferedBytes +=
|
|
621
|
+
_write(t, e, s) {
|
|
622
|
+
if (this._opcode === 8 && this._state == c) return s();
|
|
623
|
+
this._bufferedBytes += t.length, this._buffers.push(t), this.startLoop(s);
|
|
623
624
|
}
|
|
624
625
|
/**
|
|
625
626
|
* Consumes `n` bytes from the buffered data.
|
|
@@ -628,26 +629,26 @@ function rt() {
|
|
|
628
629
|
* @return {Buffer} The consumed bytes
|
|
629
630
|
* @private
|
|
630
631
|
*/
|
|
631
|
-
consume(
|
|
632
|
-
if (this._bufferedBytes -=
|
|
633
|
-
if (
|
|
634
|
-
const
|
|
635
|
-
return this._buffers[0] = new
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
), new
|
|
632
|
+
consume(t) {
|
|
633
|
+
if (this._bufferedBytes -= t, t === this._buffers[0].length) return this._buffers.shift();
|
|
634
|
+
if (t < this._buffers[0].length) {
|
|
635
|
+
const s = this._buffers[0];
|
|
636
|
+
return this._buffers[0] = new L(
|
|
637
|
+
s.buffer,
|
|
638
|
+
s.byteOffset + t,
|
|
639
|
+
s.length - t
|
|
640
|
+
), new L(s.buffer, s.byteOffset, t);
|
|
640
641
|
}
|
|
641
|
-
const
|
|
642
|
+
const e = Buffer.allocUnsafe(t);
|
|
642
643
|
do {
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
)),
|
|
649
|
-
} while (
|
|
650
|
-
return
|
|
644
|
+
const s = this._buffers[0], i = e.length - t;
|
|
645
|
+
t >= s.length ? e.set(this._buffers.shift(), i) : (e.set(new Uint8Array(s.buffer, s.byteOffset, t), i), this._buffers[0] = new L(
|
|
646
|
+
s.buffer,
|
|
647
|
+
s.byteOffset + t,
|
|
648
|
+
s.length - t
|
|
649
|
+
)), t -= s.length;
|
|
650
|
+
} while (t > 0);
|
|
651
|
+
return e;
|
|
651
652
|
}
|
|
652
653
|
/**
|
|
653
654
|
* Starts the parsing loop.
|
|
@@ -655,32 +656,32 @@ function rt() {
|
|
|
655
656
|
* @param {Function} cb Callback
|
|
656
657
|
* @private
|
|
657
658
|
*/
|
|
658
|
-
startLoop(
|
|
659
|
+
startLoop(t) {
|
|
659
660
|
this._loop = !0;
|
|
660
661
|
do
|
|
661
662
|
switch (this._state) {
|
|
662
663
|
case c:
|
|
663
|
-
this.getInfo(
|
|
664
|
+
this.getInfo(t);
|
|
664
665
|
break;
|
|
665
|
-
case
|
|
666
|
-
this.getPayloadLength16(
|
|
666
|
+
case b:
|
|
667
|
+
this.getPayloadLength16(t);
|
|
667
668
|
break;
|
|
668
|
-
case
|
|
669
|
-
this.getPayloadLength64(
|
|
669
|
+
case C:
|
|
670
|
+
this.getPayloadLength64(t);
|
|
670
671
|
break;
|
|
671
672
|
case v:
|
|
672
673
|
this.getMask();
|
|
673
674
|
break;
|
|
674
675
|
case O:
|
|
675
|
-
this.getData(
|
|
676
|
+
this.getData(t);
|
|
676
677
|
break;
|
|
677
678
|
case p:
|
|
678
|
-
case
|
|
679
|
+
case f:
|
|
679
680
|
this._loop = !1;
|
|
680
681
|
return;
|
|
681
682
|
}
|
|
682
683
|
while (this._loop);
|
|
683
|
-
this._errored ||
|
|
684
|
+
this._errored || t();
|
|
684
685
|
}
|
|
685
686
|
/**
|
|
686
687
|
* Reads the first two bytes of a frame.
|
|
@@ -688,141 +689,141 @@ function rt() {
|
|
|
688
689
|
* @param {Function} cb Callback
|
|
689
690
|
* @private
|
|
690
691
|
*/
|
|
691
|
-
getInfo(
|
|
692
|
+
getInfo(t) {
|
|
692
693
|
if (this._bufferedBytes < 2) {
|
|
693
694
|
this._loop = !1;
|
|
694
695
|
return;
|
|
695
696
|
}
|
|
696
|
-
const
|
|
697
|
-
if ((
|
|
698
|
-
const
|
|
697
|
+
const e = this.consume(2);
|
|
698
|
+
if ((e[0] & 48) !== 0) {
|
|
699
|
+
const i = this.createError(
|
|
699
700
|
RangeError,
|
|
700
701
|
"RSV2 and RSV3 must be clear",
|
|
701
702
|
!0,
|
|
702
703
|
1002,
|
|
703
704
|
"WS_ERR_UNEXPECTED_RSV_2_3"
|
|
704
705
|
);
|
|
705
|
-
|
|
706
|
+
t(i);
|
|
706
707
|
return;
|
|
707
708
|
}
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
710
|
-
const
|
|
709
|
+
const s = (e[0] & 64) === 64;
|
|
710
|
+
if (s && !this._extensions[T.extensionName]) {
|
|
711
|
+
const i = this.createError(
|
|
711
712
|
RangeError,
|
|
712
713
|
"RSV1 must be clear",
|
|
713
714
|
!0,
|
|
714
715
|
1002,
|
|
715
716
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
716
717
|
);
|
|
717
|
-
|
|
718
|
+
t(i);
|
|
718
719
|
return;
|
|
719
720
|
}
|
|
720
|
-
if (this._fin = (
|
|
721
|
-
if (
|
|
722
|
-
const
|
|
721
|
+
if (this._fin = (e[0] & 128) === 128, this._opcode = e[0] & 15, this._payloadLength = e[1] & 127, this._opcode === 0) {
|
|
722
|
+
if (s) {
|
|
723
|
+
const i = this.createError(
|
|
723
724
|
RangeError,
|
|
724
725
|
"RSV1 must be clear",
|
|
725
726
|
!0,
|
|
726
727
|
1002,
|
|
727
728
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
728
729
|
);
|
|
729
|
-
|
|
730
|
+
t(i);
|
|
730
731
|
return;
|
|
731
732
|
}
|
|
732
733
|
if (!this._fragmented) {
|
|
733
|
-
const
|
|
734
|
+
const i = this.createError(
|
|
734
735
|
RangeError,
|
|
735
736
|
"invalid opcode 0",
|
|
736
737
|
!0,
|
|
737
738
|
1002,
|
|
738
739
|
"WS_ERR_INVALID_OPCODE"
|
|
739
740
|
);
|
|
740
|
-
|
|
741
|
+
t(i);
|
|
741
742
|
return;
|
|
742
743
|
}
|
|
743
744
|
this._opcode = this._fragmented;
|
|
744
745
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
745
746
|
if (this._fragmented) {
|
|
746
|
-
const
|
|
747
|
+
const i = this.createError(
|
|
747
748
|
RangeError,
|
|
748
749
|
`invalid opcode ${this._opcode}`,
|
|
749
750
|
!0,
|
|
750
751
|
1002,
|
|
751
752
|
"WS_ERR_INVALID_OPCODE"
|
|
752
753
|
);
|
|
753
|
-
|
|
754
|
+
t(i);
|
|
754
755
|
return;
|
|
755
756
|
}
|
|
756
|
-
this._compressed =
|
|
757
|
+
this._compressed = s;
|
|
757
758
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
758
759
|
if (!this._fin) {
|
|
759
|
-
const
|
|
760
|
+
const i = this.createError(
|
|
760
761
|
RangeError,
|
|
761
762
|
"FIN must be set",
|
|
762
763
|
!0,
|
|
763
764
|
1002,
|
|
764
765
|
"WS_ERR_EXPECTED_FIN"
|
|
765
766
|
);
|
|
766
|
-
|
|
767
|
+
t(i);
|
|
767
768
|
return;
|
|
768
769
|
}
|
|
769
|
-
if (
|
|
770
|
-
const
|
|
770
|
+
if (s) {
|
|
771
|
+
const i = this.createError(
|
|
771
772
|
RangeError,
|
|
772
773
|
"RSV1 must be clear",
|
|
773
774
|
!0,
|
|
774
775
|
1002,
|
|
775
776
|
"WS_ERR_UNEXPECTED_RSV_1"
|
|
776
777
|
);
|
|
777
|
-
|
|
778
|
+
t(i);
|
|
778
779
|
return;
|
|
779
780
|
}
|
|
780
781
|
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
781
|
-
const
|
|
782
|
+
const i = this.createError(
|
|
782
783
|
RangeError,
|
|
783
784
|
`invalid payload length ${this._payloadLength}`,
|
|
784
785
|
!0,
|
|
785
786
|
1002,
|
|
786
787
|
"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
|
|
787
788
|
);
|
|
788
|
-
|
|
789
|
+
t(i);
|
|
789
790
|
return;
|
|
790
791
|
}
|
|
791
792
|
} else {
|
|
792
|
-
const
|
|
793
|
+
const i = this.createError(
|
|
793
794
|
RangeError,
|
|
794
795
|
`invalid opcode ${this._opcode}`,
|
|
795
796
|
!0,
|
|
796
797
|
1002,
|
|
797
798
|
"WS_ERR_INVALID_OPCODE"
|
|
798
799
|
);
|
|
799
|
-
|
|
800
|
+
t(i);
|
|
800
801
|
return;
|
|
801
802
|
}
|
|
802
|
-
if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (
|
|
803
|
+
if (!this._fin && !this._fragmented && (this._fragmented = this._opcode), this._masked = (e[1] & 128) === 128, this._isServer) {
|
|
803
804
|
if (!this._masked) {
|
|
804
|
-
const
|
|
805
|
+
const i = this.createError(
|
|
805
806
|
RangeError,
|
|
806
807
|
"MASK must be set",
|
|
807
808
|
!0,
|
|
808
809
|
1002,
|
|
809
810
|
"WS_ERR_EXPECTED_MASK"
|
|
810
811
|
);
|
|
811
|
-
|
|
812
|
+
t(i);
|
|
812
813
|
return;
|
|
813
814
|
}
|
|
814
815
|
} else if (this._masked) {
|
|
815
|
-
const
|
|
816
|
+
const i = this.createError(
|
|
816
817
|
RangeError,
|
|
817
818
|
"MASK must be clear",
|
|
818
819
|
!0,
|
|
819
820
|
1002,
|
|
820
821
|
"WS_ERR_UNEXPECTED_MASK"
|
|
821
822
|
);
|
|
822
|
-
|
|
823
|
+
t(i);
|
|
823
824
|
return;
|
|
824
825
|
}
|
|
825
|
-
this._payloadLength === 126 ? this._state =
|
|
826
|
+
this._payloadLength === 126 ? this._state = b : this._payloadLength === 127 ? this._state = C : this.haveLength(t);
|
|
826
827
|
}
|
|
827
828
|
/**
|
|
828
829
|
* Gets extended payload length (7+16).
|
|
@@ -830,12 +831,12 @@ function rt() {
|
|
|
830
831
|
* @param {Function} cb Callback
|
|
831
832
|
* @private
|
|
832
833
|
*/
|
|
833
|
-
getPayloadLength16(
|
|
834
|
+
getPayloadLength16(t) {
|
|
834
835
|
if (this._bufferedBytes < 2) {
|
|
835
836
|
this._loop = !1;
|
|
836
837
|
return;
|
|
837
838
|
}
|
|
838
|
-
this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(
|
|
839
|
+
this._payloadLength = this.consume(2).readUInt16BE(0), this.haveLength(t);
|
|
839
840
|
}
|
|
840
841
|
/**
|
|
841
842
|
* Gets extended payload length (7+64).
|
|
@@ -843,24 +844,24 @@ function rt() {
|
|
|
843
844
|
* @param {Function} cb Callback
|
|
844
845
|
* @private
|
|
845
846
|
*/
|
|
846
|
-
getPayloadLength64(
|
|
847
|
+
getPayloadLength64(t) {
|
|
847
848
|
if (this._bufferedBytes < 8) {
|
|
848
849
|
this._loop = !1;
|
|
849
850
|
return;
|
|
850
851
|
}
|
|
851
|
-
const
|
|
852
|
-
if (
|
|
853
|
-
const
|
|
852
|
+
const e = this.consume(8), s = e.readUInt32BE(0);
|
|
853
|
+
if (s > Math.pow(2, 21) - 1) {
|
|
854
|
+
const i = this.createError(
|
|
854
855
|
RangeError,
|
|
855
856
|
"Unsupported WebSocket frame: payload length > 2^53 - 1",
|
|
856
857
|
!1,
|
|
857
858
|
1009,
|
|
858
859
|
"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
|
|
859
860
|
);
|
|
860
|
-
|
|
861
|
+
t(i);
|
|
861
862
|
return;
|
|
862
863
|
}
|
|
863
|
-
this._payloadLength =
|
|
864
|
+
this._payloadLength = s * Math.pow(2, 32) + e.readUInt32BE(4), this.haveLength(t);
|
|
864
865
|
}
|
|
865
866
|
/**
|
|
866
867
|
* Payload length has been read.
|
|
@@ -868,16 +869,16 @@ function rt() {
|
|
|
868
869
|
* @param {Function} cb Callback
|
|
869
870
|
* @private
|
|
870
871
|
*/
|
|
871
|
-
haveLength(
|
|
872
|
+
haveLength(t) {
|
|
872
873
|
if (this._payloadLength && this._opcode < 8 && (this._totalPayloadLength += this._payloadLength, this._totalPayloadLength > this._maxPayload && this._maxPayload > 0)) {
|
|
873
|
-
const
|
|
874
|
+
const e = this.createError(
|
|
874
875
|
RangeError,
|
|
875
876
|
"Max payload size exceeded",
|
|
876
877
|
!1,
|
|
877
878
|
1009,
|
|
878
879
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
879
880
|
);
|
|
880
|
-
e
|
|
881
|
+
t(e);
|
|
881
882
|
return;
|
|
882
883
|
}
|
|
883
884
|
this._masked ? this._state = v : this._state = O;
|
|
@@ -900,24 +901,24 @@ function rt() {
|
|
|
900
901
|
* @param {Function} cb Callback
|
|
901
902
|
* @private
|
|
902
903
|
*/
|
|
903
|
-
getData(
|
|
904
|
-
let
|
|
904
|
+
getData(t) {
|
|
905
|
+
let e = D;
|
|
905
906
|
if (this._payloadLength) {
|
|
906
907
|
if (this._bufferedBytes < this._payloadLength) {
|
|
907
908
|
this._loop = !1;
|
|
908
909
|
return;
|
|
909
910
|
}
|
|
910
|
-
|
|
911
|
+
e = this.consume(this._payloadLength), this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0 && a(e, this._mask);
|
|
911
912
|
}
|
|
912
913
|
if (this._opcode > 7) {
|
|
913
|
-
this.controlMessage(
|
|
914
|
+
this.controlMessage(e, t);
|
|
914
915
|
return;
|
|
915
916
|
}
|
|
916
917
|
if (this._compressed) {
|
|
917
|
-
this._state = p, this.decompress(
|
|
918
|
+
this._state = p, this.decompress(e, t);
|
|
918
919
|
return;
|
|
919
920
|
}
|
|
920
|
-
|
|
921
|
+
e.length && (this._messageLength = this._totalPayloadLength, this._fragments.push(e)), this.dataMessage(t);
|
|
921
922
|
}
|
|
922
923
|
/**
|
|
923
924
|
* Decompresses data.
|
|
@@ -926,24 +927,24 @@ function rt() {
|
|
|
926
927
|
* @param {Function} cb Callback
|
|
927
928
|
* @private
|
|
928
929
|
*/
|
|
929
|
-
decompress(
|
|
930
|
-
this._extensions[T.extensionName].decompress(
|
|
931
|
-
if (
|
|
930
|
+
decompress(t, e) {
|
|
931
|
+
this._extensions[T.extensionName].decompress(t, this._fin, (i, m) => {
|
|
932
|
+
if (i) return e(i);
|
|
932
933
|
if (m.length) {
|
|
933
934
|
if (this._messageLength += m.length, this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
934
|
-
const
|
|
935
|
+
const u = this.createError(
|
|
935
936
|
RangeError,
|
|
936
937
|
"Max payload size exceeded",
|
|
937
938
|
!1,
|
|
938
939
|
1009,
|
|
939
940
|
"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
|
|
940
941
|
);
|
|
941
|
-
|
|
942
|
+
e(u);
|
|
942
943
|
return;
|
|
943
944
|
}
|
|
944
945
|
this._fragments.push(m);
|
|
945
946
|
}
|
|
946
|
-
this.dataMessage(
|
|
947
|
+
this.dataMessage(e), this._state === c && this.startLoop(e);
|
|
947
948
|
});
|
|
948
949
|
}
|
|
949
950
|
/**
|
|
@@ -952,20 +953,20 @@ function rt() {
|
|
|
952
953
|
* @param {Function} cb Callback
|
|
953
954
|
* @private
|
|
954
955
|
*/
|
|
955
|
-
dataMessage(
|
|
956
|
+
dataMessage(t) {
|
|
956
957
|
if (!this._fin) {
|
|
957
958
|
this._state = c;
|
|
958
959
|
return;
|
|
959
960
|
}
|
|
960
|
-
const
|
|
961
|
+
const e = this._messageLength, s = this._fragments;
|
|
961
962
|
if (this._totalPayloadLength = 0, this._messageLength = 0, this._fragmented = 0, this._fragments = [], this._opcode === 2) {
|
|
962
|
-
let
|
|
963
|
-
this._binaryType === "nodebuffer" ?
|
|
964
|
-
this.emit("message",
|
|
963
|
+
let i;
|
|
964
|
+
this._binaryType === "nodebuffer" ? i = n(s, e) : this._binaryType === "arraybuffer" ? i = l(n(s, e)) : this._binaryType === "blob" ? i = new Blob(s) : i = s, this._allowSynchronousEvents ? (this.emit("message", i, !0), this._state = c) : (this._state = f, setImmediate(() => {
|
|
965
|
+
this.emit("message", i, !0), this._state = c, this.startLoop(t);
|
|
965
966
|
}));
|
|
966
967
|
} else {
|
|
967
|
-
const
|
|
968
|
-
if (!this._skipUTF8Validation && !h(
|
|
968
|
+
const i = n(s, e);
|
|
969
|
+
if (!this._skipUTF8Validation && !h(i)) {
|
|
969
970
|
const m = this.createError(
|
|
970
971
|
Error,
|
|
971
972
|
"invalid UTF-8 sequence",
|
|
@@ -973,11 +974,11 @@ function rt() {
|
|
|
973
974
|
1007,
|
|
974
975
|
"WS_ERR_INVALID_UTF8"
|
|
975
976
|
);
|
|
976
|
-
|
|
977
|
+
t(m);
|
|
977
978
|
return;
|
|
978
979
|
}
|
|
979
|
-
this._state === p || this._allowSynchronousEvents ? (this.emit("message",
|
|
980
|
-
this.emit("message",
|
|
980
|
+
this._state === p || this._allowSynchronousEvents ? (this.emit("message", i, !1), this._state = c) : (this._state = f, setImmediate(() => {
|
|
981
|
+
this.emit("message", i, !1), this._state = c, this.startLoop(t);
|
|
981
982
|
}));
|
|
982
983
|
}
|
|
983
984
|
}
|
|
@@ -988,29 +989,29 @@ function rt() {
|
|
|
988
989
|
* @return {(Error|RangeError|undefined)} A possible error
|
|
989
990
|
* @private
|
|
990
991
|
*/
|
|
991
|
-
controlMessage(
|
|
992
|
+
controlMessage(t, e) {
|
|
992
993
|
if (this._opcode === 8) {
|
|
993
|
-
if (
|
|
994
|
-
this._loop = !1, this.emit("conclude", 1005,
|
|
994
|
+
if (t.length === 0)
|
|
995
|
+
this._loop = !1, this.emit("conclude", 1005, D), this.end();
|
|
995
996
|
else {
|
|
996
|
-
const
|
|
997
|
-
if (!_(
|
|
997
|
+
const s = t.readUInt16BE(0);
|
|
998
|
+
if (!_(s)) {
|
|
998
999
|
const m = this.createError(
|
|
999
1000
|
RangeError,
|
|
1000
|
-
`invalid status code ${
|
|
1001
|
+
`invalid status code ${s}`,
|
|
1001
1002
|
!0,
|
|
1002
1003
|
1002,
|
|
1003
1004
|
"WS_ERR_INVALID_CLOSE_CODE"
|
|
1004
1005
|
);
|
|
1005
|
-
|
|
1006
|
+
e(m);
|
|
1006
1007
|
return;
|
|
1007
1008
|
}
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1009
|
+
const i = new L(
|
|
1010
|
+
t.buffer,
|
|
1011
|
+
t.byteOffset + 2,
|
|
1012
|
+
t.length - 2
|
|
1012
1013
|
);
|
|
1013
|
-
if (!this._skipUTF8Validation && !h(
|
|
1014
|
+
if (!this._skipUTF8Validation && !h(i)) {
|
|
1014
1015
|
const m = this.createError(
|
|
1015
1016
|
Error,
|
|
1016
1017
|
"invalid UTF-8 sequence",
|
|
@@ -1018,16 +1019,16 @@ function rt() {
|
|
|
1018
1019
|
1007,
|
|
1019
1020
|
"WS_ERR_INVALID_UTF8"
|
|
1020
1021
|
);
|
|
1021
|
-
|
|
1022
|
+
e(m);
|
|
1022
1023
|
return;
|
|
1023
1024
|
}
|
|
1024
|
-
this._loop = !1, this.emit("conclude",
|
|
1025
|
+
this._loop = !1, this.emit("conclude", s, i), this.end();
|
|
1025
1026
|
}
|
|
1026
1027
|
this._state = c;
|
|
1027
1028
|
return;
|
|
1028
1029
|
}
|
|
1029
|
-
this._allowSynchronousEvents ? (this.emit(this._opcode === 9 ? "ping" : "pong",
|
|
1030
|
-
this.emit(this._opcode === 9 ? "ping" : "pong",
|
|
1030
|
+
this._allowSynchronousEvents ? (this.emit(this._opcode === 9 ? "ping" : "pong", t), this._state = c) : (this._state = f, setImmediate(() => {
|
|
1031
|
+
this.emit(this._opcode === 9 ? "ping" : "pong", t), this._state = c, this.startLoop(e);
|
|
1031
1032
|
}));
|
|
1032
1033
|
}
|
|
1033
1034
|
/**
|
|
@@ -1042,12 +1043,12 @@ function rt() {
|
|
|
1042
1043
|
* @return {(Error|RangeError)} The error
|
|
1043
1044
|
* @private
|
|
1044
1045
|
*/
|
|
1045
|
-
createError(e,
|
|
1046
|
+
createError(t, e, s, i, m) {
|
|
1046
1047
|
this._loop = !1, this._errored = !0;
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1048
|
+
const u = new t(
|
|
1049
|
+
s ? `Invalid WebSocket frame: ${e}` : e
|
|
1049
1050
|
);
|
|
1050
|
-
return Error.captureStackTrace(
|
|
1051
|
+
return Error.captureStackTrace(u, this.createError), u.code = m, u[x] = i, u;
|
|
1051
1052
|
}
|
|
1052
1053
|
}
|
|
1053
1054
|
return ge = E, ge;
|
|
@@ -1056,10 +1057,10 @@ var ye, qe;
|
|
|
1056
1057
|
function st() {
|
|
1057
1058
|
if (qe) return ye;
|
|
1058
1059
|
qe = 1;
|
|
1059
|
-
const { Duplex: P } = se, { randomFillSync: T } = Oe, M =
|
|
1060
|
-
let
|
|
1060
|
+
const { Duplex: P } = se, { randomFillSync: T } = Oe, M = le(), { EMPTY_BUFFER: D, kWebSocket: x, NOOP: d } = q(), { isBlob: n, isValidStatusCode: l } = ie(), { mask: a, toBuffer: _ } = ae(), h = /* @__PURE__ */ Symbol("kByteLength"), L = Buffer.alloc(4), c = 8 * 1024;
|
|
1061
|
+
let b, C = c;
|
|
1061
1062
|
const v = 0, O = 1, p = 2;
|
|
1062
|
-
class
|
|
1063
|
+
class f {
|
|
1063
1064
|
/**
|
|
1064
1065
|
* Creates a Sender instance.
|
|
1065
1066
|
*
|
|
@@ -1068,8 +1069,8 @@ function st() {
|
|
|
1068
1069
|
* @param {Function} [generateMask] The function used to generate the masking
|
|
1069
1070
|
* key
|
|
1070
1071
|
*/
|
|
1071
|
-
constructor(
|
|
1072
|
-
this._extensions =
|
|
1072
|
+
constructor(e, s, i) {
|
|
1073
|
+
this._extensions = s || {}, i && (this._generateMask = i, this._maskBuffer = Buffer.alloc(4)), this._socket = e, this._firstFragment = !0, this._compress = !1, this._bufferedBytes = 0, this._queue = [], this._state = v, this.onerror = d, this[x] = void 0;
|
|
1073
1074
|
}
|
|
1074
1075
|
/**
|
|
1075
1076
|
* Frames a piece of data according to the HyBi WebSocket protocol.
|
|
@@ -1092,15 +1093,15 @@ function st() {
|
|
|
1092
1093
|
* @return {(Buffer|String)[]} The framed data
|
|
1093
1094
|
* @public
|
|
1094
1095
|
*/
|
|
1095
|
-
static frame(
|
|
1096
|
-
let
|
|
1097
|
-
|
|
1098
|
-
let
|
|
1099
|
-
typeof
|
|
1100
|
-
let A =
|
|
1101
|
-
|
|
1102
|
-
const N = Buffer.allocUnsafe(m ?
|
|
1103
|
-
return N[0] =
|
|
1096
|
+
static frame(e, s) {
|
|
1097
|
+
let i, m = !1, u = 2, R = !1;
|
|
1098
|
+
s.mask && (i = s.maskBuffer || L, s.generateMask ? s.generateMask(i) : (C === c && (b === void 0 && (b = Buffer.alloc(c)), T(b, 0, c), C = 0), i[0] = b[C++], i[1] = b[C++], i[2] = b[C++], i[3] = b[C++]), R = (i[0] | i[1] | i[2] | i[3]) === 0, u = 6);
|
|
1099
|
+
let B;
|
|
1100
|
+
typeof e == "string" ? (!s.mask || R) && s[h] !== void 0 ? B = s[h] : (e = Buffer.from(e), B = e.length) : (B = e.length, m = s.mask && s.readOnly && !R);
|
|
1101
|
+
let A = B;
|
|
1102
|
+
B >= 65536 ? (u += 8, A = 127) : B > 125 && (u += 2, A = 126);
|
|
1103
|
+
const N = Buffer.allocUnsafe(m ? B + u : u);
|
|
1104
|
+
return N[0] = s.fin ? s.opcode | 128 : s.opcode, s.rsv1 && (N[0] |= 64), N[1] = A, A === 126 ? N.writeUInt16BE(B, 2) : A === 127 && (N[2] = N[3] = 0, N.writeUIntBE(B, 4, 6)), s.mask ? (N[1] |= 128, N[u - 4] = i[0], N[u - 3] = i[1], N[u - 2] = i[2], N[u - 1] = i[3], R ? [N, e] : m ? (a(e, i, N, u, B), [N]) : (a(e, i, e, 0, B), [N, e])) : [N, e];
|
|
1104
1105
|
}
|
|
1105
1106
|
/**
|
|
1106
1107
|
* Sends a close message to the other peer.
|
|
@@ -1111,33 +1112,33 @@ function st() {
|
|
|
1111
1112
|
* @param {Function} [cb] Callback
|
|
1112
1113
|
* @public
|
|
1113
1114
|
*/
|
|
1114
|
-
close(
|
|
1115
|
-
let
|
|
1116
|
-
if (
|
|
1117
|
-
|
|
1115
|
+
close(e, s, i, m) {
|
|
1116
|
+
let u;
|
|
1117
|
+
if (e === void 0)
|
|
1118
|
+
u = D;
|
|
1118
1119
|
else {
|
|
1119
|
-
if (typeof
|
|
1120
|
+
if (typeof e != "number" || !l(e))
|
|
1120
1121
|
throw new TypeError("First argument must be a valid error code number");
|
|
1121
|
-
if (
|
|
1122
|
-
|
|
1122
|
+
if (s === void 0 || !s.length)
|
|
1123
|
+
u = Buffer.allocUnsafe(2), u.writeUInt16BE(e, 0);
|
|
1123
1124
|
else {
|
|
1124
|
-
const
|
|
1125
|
-
if (
|
|
1125
|
+
const B = Buffer.byteLength(s);
|
|
1126
|
+
if (B > 123)
|
|
1126
1127
|
throw new RangeError("The message must not be greater than 123 bytes");
|
|
1127
|
-
|
|
1128
|
+
u = Buffer.allocUnsafe(2 + B), u.writeUInt16BE(e, 0), typeof s == "string" ? u.write(s, 2) : u.set(s, 2);
|
|
1128
1129
|
}
|
|
1129
1130
|
}
|
|
1130
1131
|
const R = {
|
|
1131
|
-
[h]:
|
|
1132
|
+
[h]: u.length,
|
|
1132
1133
|
fin: !0,
|
|
1133
1134
|
generateMask: this._generateMask,
|
|
1134
|
-
mask:
|
|
1135
|
+
mask: i,
|
|
1135
1136
|
maskBuffer: this._maskBuffer,
|
|
1136
1137
|
opcode: 8,
|
|
1137
1138
|
readOnly: !1,
|
|
1138
1139
|
rsv1: !1
|
|
1139
1140
|
};
|
|
1140
|
-
this._state !== v ? this.enqueue([this.dispatch,
|
|
1141
|
+
this._state !== v ? this.enqueue([this.dispatch, u, !1, R, m]) : this.sendFrame(f.frame(u, R), m);
|
|
1141
1142
|
}
|
|
1142
1143
|
/**
|
|
1143
1144
|
* Sends a ping message to the other peer.
|
|
@@ -1147,21 +1148,21 @@ function st() {
|
|
|
1147
1148
|
* @param {Function} [cb] Callback
|
|
1148
1149
|
* @public
|
|
1149
1150
|
*/
|
|
1150
|
-
ping(
|
|
1151
|
-
let m,
|
|
1152
|
-
if (typeof
|
|
1151
|
+
ping(e, s, i) {
|
|
1152
|
+
let m, u;
|
|
1153
|
+
if (typeof e == "string" ? (m = Buffer.byteLength(e), u = !1) : n(e) ? (m = e.size, u = !1) : (e = _(e), m = e.length, u = _.readOnly), m > 125)
|
|
1153
1154
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1154
1155
|
const R = {
|
|
1155
1156
|
[h]: m,
|
|
1156
1157
|
fin: !0,
|
|
1157
1158
|
generateMask: this._generateMask,
|
|
1158
|
-
mask:
|
|
1159
|
+
mask: s,
|
|
1159
1160
|
maskBuffer: this._maskBuffer,
|
|
1160
1161
|
opcode: 9,
|
|
1161
|
-
readOnly:
|
|
1162
|
+
readOnly: u,
|
|
1162
1163
|
rsv1: !1
|
|
1163
1164
|
};
|
|
1164
|
-
n(
|
|
1165
|
+
n(e) ? this._state !== v ? this.enqueue([this.getBlobData, e, !1, R, i]) : this.getBlobData(e, !1, R, i) : this._state !== v ? this.enqueue([this.dispatch, e, !1, R, i]) : this.sendFrame(f.frame(e, R), i);
|
|
1165
1166
|
}
|
|
1166
1167
|
/**
|
|
1167
1168
|
* Sends a pong message to the other peer.
|
|
@@ -1171,21 +1172,21 @@ function st() {
|
|
|
1171
1172
|
* @param {Function} [cb] Callback
|
|
1172
1173
|
* @public
|
|
1173
1174
|
*/
|
|
1174
|
-
pong(
|
|
1175
|
-
let m,
|
|
1176
|
-
if (typeof
|
|
1175
|
+
pong(e, s, i) {
|
|
1176
|
+
let m, u;
|
|
1177
|
+
if (typeof e == "string" ? (m = Buffer.byteLength(e), u = !1) : n(e) ? (m = e.size, u = !1) : (e = _(e), m = e.length, u = _.readOnly), m > 125)
|
|
1177
1178
|
throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1178
1179
|
const R = {
|
|
1179
1180
|
[h]: m,
|
|
1180
1181
|
fin: !0,
|
|
1181
1182
|
generateMask: this._generateMask,
|
|
1182
|
-
mask:
|
|
1183
|
+
mask: s,
|
|
1183
1184
|
maskBuffer: this._maskBuffer,
|
|
1184
1185
|
opcode: 10,
|
|
1185
|
-
readOnly:
|
|
1186
|
+
readOnly: u,
|
|
1186
1187
|
rsv1: !1
|
|
1187
1188
|
};
|
|
1188
|
-
n(
|
|
1189
|
+
n(e) ? this._state !== v ? this.enqueue([this.getBlobData, e, !1, R, i]) : this.getBlobData(e, !1, R, i) : this._state !== v ? this.enqueue([this.dispatch, e, !1, R, i]) : this.sendFrame(f.frame(e, R), i);
|
|
1189
1190
|
}
|
|
1190
1191
|
/**
|
|
1191
1192
|
* Sends a data message to the other peer.
|
|
@@ -1203,21 +1204,21 @@ function st() {
|
|
|
1203
1204
|
* @param {Function} [cb] Callback
|
|
1204
1205
|
* @public
|
|
1205
1206
|
*/
|
|
1206
|
-
send(
|
|
1207
|
+
send(e, s, i) {
|
|
1207
1208
|
const m = this._extensions[M.extensionName];
|
|
1208
|
-
let
|
|
1209
|
-
typeof
|
|
1209
|
+
let u = s.binary ? 2 : 1, R = s.compress, B, A;
|
|
1210
|
+
typeof e == "string" ? (B = Buffer.byteLength(e), A = !1) : n(e) ? (B = e.size, A = !1) : (e = _(e), B = e.length, A = _.readOnly), this._firstFragment ? (this._firstFragment = !1, R && m && m.params[m._isServer ? "server_no_context_takeover" : "client_no_context_takeover"] && (R = B >= m._threshold), this._compress = R) : (R = !1, u = 0), s.fin && (this._firstFragment = !0);
|
|
1210
1211
|
const N = {
|
|
1211
|
-
[h]:
|
|
1212
|
-
fin:
|
|
1212
|
+
[h]: B,
|
|
1213
|
+
fin: s.fin,
|
|
1213
1214
|
generateMask: this._generateMask,
|
|
1214
|
-
mask:
|
|
1215
|
+
mask: s.mask,
|
|
1215
1216
|
maskBuffer: this._maskBuffer,
|
|
1216
|
-
opcode:
|
|
1217
|
+
opcode: u,
|
|
1217
1218
|
readOnly: A,
|
|
1218
1219
|
rsv1: R
|
|
1219
1220
|
};
|
|
1220
|
-
n(
|
|
1221
|
+
n(e) ? this._state !== v ? this.enqueue([this.getBlobData, e, this._compress, N, i]) : this.getBlobData(e, this._compress, N, i) : this._state !== v ? this.enqueue([this.dispatch, e, this._compress, N, i]) : this.dispatch(e, this._compress, N, i);
|
|
1221
1222
|
}
|
|
1222
1223
|
/**
|
|
1223
1224
|
* Gets the contents of a blob as binary data.
|
|
@@ -1242,20 +1243,20 @@ function st() {
|
|
|
1242
1243
|
* @param {Function} [cb] Callback
|
|
1243
1244
|
* @private
|
|
1244
1245
|
*/
|
|
1245
|
-
getBlobData(
|
|
1246
|
-
this._bufferedBytes +=
|
|
1246
|
+
getBlobData(e, s, i, m) {
|
|
1247
|
+
this._bufferedBytes += i[h], this._state = p, e.arrayBuffer().then((u) => {
|
|
1247
1248
|
if (this._socket.destroyed) {
|
|
1248
|
-
const
|
|
1249
|
+
const B = new Error(
|
|
1249
1250
|
"The socket was closed while the blob was being read"
|
|
1250
1251
|
);
|
|
1251
|
-
process.nextTick(E, this,
|
|
1252
|
+
process.nextTick(E, this, B, m);
|
|
1252
1253
|
return;
|
|
1253
1254
|
}
|
|
1254
|
-
this._bufferedBytes -=
|
|
1255
|
-
const R = _(
|
|
1256
|
-
|
|
1257
|
-
}).catch((
|
|
1258
|
-
process.nextTick(
|
|
1255
|
+
this._bufferedBytes -= i[h];
|
|
1256
|
+
const R = _(u);
|
|
1257
|
+
s ? this.dispatch(R, s, i, m) : (this._state = v, this.sendFrame(f.frame(R, i), m), this.dequeue());
|
|
1258
|
+
}).catch((u) => {
|
|
1259
|
+
process.nextTick(w, this, u, m);
|
|
1259
1260
|
});
|
|
1260
1261
|
}
|
|
1261
1262
|
/**
|
|
@@ -1281,13 +1282,13 @@ function st() {
|
|
|
1281
1282
|
* @param {Function} [cb] Callback
|
|
1282
1283
|
* @private
|
|
1283
1284
|
*/
|
|
1284
|
-
dispatch(
|
|
1285
|
-
if (!
|
|
1286
|
-
this.sendFrame(
|
|
1285
|
+
dispatch(e, s, i, m) {
|
|
1286
|
+
if (!s) {
|
|
1287
|
+
this.sendFrame(f.frame(e, i), m);
|
|
1287
1288
|
return;
|
|
1288
1289
|
}
|
|
1289
|
-
const
|
|
1290
|
-
this._bufferedBytes +=
|
|
1290
|
+
const u = this._extensions[M.extensionName];
|
|
1291
|
+
this._bufferedBytes += i[h], this._state = O, u.compress(e, i.fin, (R, B) => {
|
|
1291
1292
|
if (this._socket.destroyed) {
|
|
1292
1293
|
const A = new Error(
|
|
1293
1294
|
"The socket was closed while data was being compressed"
|
|
@@ -1295,7 +1296,7 @@ function st() {
|
|
|
1295
1296
|
E(this, A, m);
|
|
1296
1297
|
return;
|
|
1297
1298
|
}
|
|
1298
|
-
this._bufferedBytes -=
|
|
1299
|
+
this._bufferedBytes -= i[h], this._state = v, i.readOnly = !1, this.sendFrame(f.frame(B, i), m), this.dequeue();
|
|
1299
1300
|
});
|
|
1300
1301
|
}
|
|
1301
1302
|
/**
|
|
@@ -1305,8 +1306,8 @@ function st() {
|
|
|
1305
1306
|
*/
|
|
1306
1307
|
dequeue() {
|
|
1307
1308
|
for (; this._state === v && this._queue.length; ) {
|
|
1308
|
-
const
|
|
1309
|
-
this._bufferedBytes -=
|
|
1309
|
+
const e = this._queue.shift();
|
|
1310
|
+
this._bufferedBytes -= e[3][h], Reflect.apply(e[0], this, e.slice(1));
|
|
1310
1311
|
}
|
|
1311
1312
|
}
|
|
1312
1313
|
/**
|
|
@@ -1315,8 +1316,8 @@ function st() {
|
|
|
1315
1316
|
* @param {Array} params Send operation parameters.
|
|
1316
1317
|
* @private
|
|
1317
1318
|
*/
|
|
1318
|
-
enqueue(
|
|
1319
|
-
this._bufferedBytes +=
|
|
1319
|
+
enqueue(e) {
|
|
1320
|
+
this._bufferedBytes += e[3][h], this._queue.push(e);
|
|
1320
1321
|
}
|
|
1321
1322
|
/**
|
|
1322
1323
|
* Sends a frame.
|
|
@@ -1325,20 +1326,20 @@ function st() {
|
|
|
1325
1326
|
* @param {Function} [cb] Callback
|
|
1326
1327
|
* @private
|
|
1327
1328
|
*/
|
|
1328
|
-
sendFrame(
|
|
1329
|
-
|
|
1329
|
+
sendFrame(e, s) {
|
|
1330
|
+
e.length === 2 ? (this._socket.cork(), this._socket.write(e[0]), this._socket.write(e[1], s), this._socket.uncork()) : this._socket.write(e[0], s);
|
|
1330
1331
|
}
|
|
1331
1332
|
}
|
|
1332
|
-
ye =
|
|
1333
|
-
function E(
|
|
1334
|
-
typeof
|
|
1335
|
-
for (let
|
|
1336
|
-
const m =
|
|
1337
|
-
typeof
|
|
1333
|
+
ye = f;
|
|
1334
|
+
function E(t, e, s) {
|
|
1335
|
+
typeof s == "function" && s(e);
|
|
1336
|
+
for (let i = 0; i < t._queue.length; i++) {
|
|
1337
|
+
const m = t._queue[i], u = m[m.length - 1];
|
|
1338
|
+
typeof u == "function" && u(e);
|
|
1338
1339
|
}
|
|
1339
1340
|
}
|
|
1340
|
-
function
|
|
1341
|
-
E(
|
|
1341
|
+
function w(t, e, s) {
|
|
1342
|
+
E(t, e, s), t.onerror(e);
|
|
1342
1343
|
}
|
|
1343
1344
|
return ye;
|
|
1344
1345
|
}
|
|
@@ -1346,7 +1347,7 @@ var Ee, ze;
|
|
|
1346
1347
|
function Ct() {
|
|
1347
1348
|
if (ze) return Ee;
|
|
1348
1349
|
ze = 1;
|
|
1349
|
-
const { kForOnEventAttribute: P, kListener: T } =
|
|
1350
|
+
const { kForOnEventAttribute: P, kListener: T } = q(), M = /* @__PURE__ */ Symbol("kCode"), D = /* @__PURE__ */ Symbol("kData"), x = /* @__PURE__ */ Symbol("kError"), d = /* @__PURE__ */ Symbol("kMessage"), n = /* @__PURE__ */ Symbol("kReason"), l = /* @__PURE__ */ Symbol("kTarget"), a = /* @__PURE__ */ Symbol("kType"), _ = /* @__PURE__ */ Symbol("kWasClean");
|
|
1350
1351
|
class h {
|
|
1351
1352
|
/**
|
|
1352
1353
|
* Create a new `Event`.
|
|
@@ -1355,13 +1356,13 @@ function Ct() {
|
|
|
1355
1356
|
* @throws {TypeError} If the `type` argument is not specified
|
|
1356
1357
|
*/
|
|
1357
1358
|
constructor(p) {
|
|
1358
|
-
this[
|
|
1359
|
+
this[l] = null, this[a] = p;
|
|
1359
1360
|
}
|
|
1360
1361
|
/**
|
|
1361
1362
|
* @type {*}
|
|
1362
1363
|
*/
|
|
1363
1364
|
get target() {
|
|
1364
|
-
return this[
|
|
1365
|
+
return this[l];
|
|
1365
1366
|
}
|
|
1366
1367
|
/**
|
|
1367
1368
|
* @type {String}
|
|
@@ -1371,7 +1372,7 @@ function Ct() {
|
|
|
1371
1372
|
}
|
|
1372
1373
|
}
|
|
1373
1374
|
Object.defineProperty(h.prototype, "target", { enumerable: !0 }), Object.defineProperty(h.prototype, "type", { enumerable: !0 });
|
|
1374
|
-
class
|
|
1375
|
+
class L extends h {
|
|
1375
1376
|
/**
|
|
1376
1377
|
* Create a new `CloseEvent`.
|
|
1377
1378
|
*
|
|
@@ -1385,8 +1386,8 @@ function Ct() {
|
|
|
1385
1386
|
* @param {Boolean} [options.wasClean=false] Indicates whether or not the
|
|
1386
1387
|
* connection was cleanly closed
|
|
1387
1388
|
*/
|
|
1388
|
-
constructor(p,
|
|
1389
|
-
super(p), this[M] =
|
|
1389
|
+
constructor(p, f = {}) {
|
|
1390
|
+
super(p), this[M] = f.code === void 0 ? 0 : f.code, this[n] = f.reason === void 0 ? "" : f.reason, this[_] = f.wasClean === void 0 ? !1 : f.wasClean;
|
|
1390
1391
|
}
|
|
1391
1392
|
/**
|
|
1392
1393
|
* @type {Number}
|
|
@@ -1407,7 +1408,7 @@ function Ct() {
|
|
|
1407
1408
|
return this[_];
|
|
1408
1409
|
}
|
|
1409
1410
|
}
|
|
1410
|
-
Object.defineProperty(
|
|
1411
|
+
Object.defineProperty(L.prototype, "code", { enumerable: !0 }), Object.defineProperty(L.prototype, "reason", { enumerable: !0 }), Object.defineProperty(L.prototype, "wasClean", { enumerable: !0 });
|
|
1411
1412
|
class c extends h {
|
|
1412
1413
|
/**
|
|
1413
1414
|
* Create a new `ErrorEvent`.
|
|
@@ -1418,14 +1419,14 @@ function Ct() {
|
|
|
1418
1419
|
* @param {*} [options.error=null] The error that generated this event
|
|
1419
1420
|
* @param {String} [options.message=''] The error message
|
|
1420
1421
|
*/
|
|
1421
|
-
constructor(p,
|
|
1422
|
-
super(p), this[
|
|
1422
|
+
constructor(p, f = {}) {
|
|
1423
|
+
super(p), this[x] = f.error === void 0 ? null : f.error, this[d] = f.message === void 0 ? "" : f.message;
|
|
1423
1424
|
}
|
|
1424
1425
|
/**
|
|
1425
1426
|
* @type {*}
|
|
1426
1427
|
*/
|
|
1427
1428
|
get error() {
|
|
1428
|
-
return this[
|
|
1429
|
+
return this[x];
|
|
1429
1430
|
}
|
|
1430
1431
|
/**
|
|
1431
1432
|
* @type {String}
|
|
@@ -1435,7 +1436,7 @@ function Ct() {
|
|
|
1435
1436
|
}
|
|
1436
1437
|
}
|
|
1437
1438
|
Object.defineProperty(c.prototype, "error", { enumerable: !0 }), Object.defineProperty(c.prototype, "message", { enumerable: !0 });
|
|
1438
|
-
class
|
|
1439
|
+
class b extends h {
|
|
1439
1440
|
/**
|
|
1440
1441
|
* Create a new `MessageEvent`.
|
|
1441
1442
|
*
|
|
@@ -1444,18 +1445,18 @@ function Ct() {
|
|
|
1444
1445
|
* attributes via object members of the same name
|
|
1445
1446
|
* @param {*} [options.data=null] The message content
|
|
1446
1447
|
*/
|
|
1447
|
-
constructor(p,
|
|
1448
|
-
super(p), this[
|
|
1448
|
+
constructor(p, f = {}) {
|
|
1449
|
+
super(p), this[D] = f.data === void 0 ? null : f.data;
|
|
1449
1450
|
}
|
|
1450
1451
|
/**
|
|
1451
1452
|
* @type {*}
|
|
1452
1453
|
*/
|
|
1453
1454
|
get data() {
|
|
1454
|
-
return this[
|
|
1455
|
+
return this[D];
|
|
1455
1456
|
}
|
|
1456
1457
|
}
|
|
1457
|
-
Object.defineProperty(
|
|
1458
|
-
CloseEvent:
|
|
1458
|
+
Object.defineProperty(b.prototype, "data", { enumerable: !0 }), Ee = {
|
|
1459
|
+
CloseEvent: L,
|
|
1459
1460
|
ErrorEvent: c,
|
|
1460
1461
|
Event: h,
|
|
1461
1462
|
EventTarget: {
|
|
@@ -1471,43 +1472,43 @@ function Ct() {
|
|
|
1471
1472
|
* the listener would be automatically removed when invoked.
|
|
1472
1473
|
* @public
|
|
1473
1474
|
*/
|
|
1474
|
-
addEventListener(O, p,
|
|
1475
|
-
for (const
|
|
1476
|
-
if (!
|
|
1475
|
+
addEventListener(O, p, f = {}) {
|
|
1476
|
+
for (const w of this.listeners(O))
|
|
1477
|
+
if (!f[P] && w[T] === p && !w[P])
|
|
1477
1478
|
return;
|
|
1478
1479
|
let E;
|
|
1479
1480
|
if (O === "message")
|
|
1480
|
-
E = function(
|
|
1481
|
-
const
|
|
1482
|
-
data:
|
|
1481
|
+
E = function(t, e) {
|
|
1482
|
+
const s = new b("message", {
|
|
1483
|
+
data: e ? t : t.toString()
|
|
1483
1484
|
});
|
|
1484
|
-
|
|
1485
|
+
s[l] = this, v(p, this, s);
|
|
1485
1486
|
};
|
|
1486
1487
|
else if (O === "close")
|
|
1487
|
-
E = function(
|
|
1488
|
-
const
|
|
1489
|
-
code:
|
|
1490
|
-
reason:
|
|
1488
|
+
E = function(t, e) {
|
|
1489
|
+
const s = new L("close", {
|
|
1490
|
+
code: t,
|
|
1491
|
+
reason: e.toString(),
|
|
1491
1492
|
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
1492
1493
|
});
|
|
1493
|
-
|
|
1494
|
+
s[l] = this, v(p, this, s);
|
|
1494
1495
|
};
|
|
1495
1496
|
else if (O === "error")
|
|
1496
|
-
E = function(
|
|
1497
|
-
const
|
|
1498
|
-
error:
|
|
1499
|
-
message:
|
|
1497
|
+
E = function(t) {
|
|
1498
|
+
const e = new c("error", {
|
|
1499
|
+
error: t,
|
|
1500
|
+
message: t.message
|
|
1500
1501
|
});
|
|
1501
|
-
|
|
1502
|
+
e[l] = this, v(p, this, e);
|
|
1502
1503
|
};
|
|
1503
1504
|
else if (O === "open")
|
|
1504
1505
|
E = function() {
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1506
|
+
const t = new h("open");
|
|
1507
|
+
t[l] = this, v(p, this, t);
|
|
1507
1508
|
};
|
|
1508
1509
|
else
|
|
1509
1510
|
return;
|
|
1510
|
-
E[P] = !!
|
|
1511
|
+
E[P] = !!f[P], E[T] = p, f.once ? this.once(O, E) : this.on(O, E);
|
|
1511
1512
|
},
|
|
1512
1513
|
/**
|
|
1513
1514
|
* Remove an event listener.
|
|
@@ -1517,120 +1518,121 @@ function Ct() {
|
|
|
1517
1518
|
* @public
|
|
1518
1519
|
*/
|
|
1519
1520
|
removeEventListener(O, p) {
|
|
1520
|
-
for (const
|
|
1521
|
-
if (
|
|
1522
|
-
this.removeListener(O,
|
|
1521
|
+
for (const f of this.listeners(O))
|
|
1522
|
+
if (f[T] === p && !f[P]) {
|
|
1523
|
+
this.removeListener(O, f);
|
|
1523
1524
|
break;
|
|
1524
1525
|
}
|
|
1525
1526
|
}
|
|
1526
1527
|
},
|
|
1527
|
-
MessageEvent:
|
|
1528
|
+
MessageEvent: b
|
|
1528
1529
|
};
|
|
1529
|
-
function v(O, p,
|
|
1530
|
-
typeof O == "object" && O.handleEvent ? O.handleEvent.call(O,
|
|
1530
|
+
function v(O, p, f) {
|
|
1531
|
+
typeof O == "object" && O.handleEvent ? O.handleEvent.call(O, f) : O.call(p, f);
|
|
1531
1532
|
}
|
|
1532
1533
|
return Ee;
|
|
1533
1534
|
}
|
|
1534
|
-
var
|
|
1535
|
+
var Se, He;
|
|
1535
1536
|
function it() {
|
|
1536
|
-
if (He) return
|
|
1537
|
+
if (He) return Se;
|
|
1537
1538
|
He = 1;
|
|
1538
1539
|
const { tokenChars: P } = ie();
|
|
1539
|
-
function T(
|
|
1540
|
-
|
|
1540
|
+
function T(x, d, n) {
|
|
1541
|
+
x[d] === void 0 ? x[d] = [n] : x[d].push(n);
|
|
1541
1542
|
}
|
|
1542
|
-
function M(
|
|
1543
|
+
function M(x) {
|
|
1543
1544
|
const d = /* @__PURE__ */ Object.create(null);
|
|
1544
|
-
let n = /* @__PURE__ */ Object.create(null),
|
|
1545
|
-
for (; v <
|
|
1546
|
-
if (
|
|
1547
|
-
if (
|
|
1545
|
+
let n = /* @__PURE__ */ Object.create(null), l = !1, a = !1, _ = !1, h, L, c = -1, b = -1, C = -1, v = 0;
|
|
1546
|
+
for (; v < x.length; v++)
|
|
1547
|
+
if (b = x.charCodeAt(v), h === void 0)
|
|
1548
|
+
if (C === -1 && P[b] === 1)
|
|
1548
1549
|
c === -1 && (c = v);
|
|
1549
|
-
else if (v !== 0 && (
|
|
1550
|
-
|
|
1551
|
-
else if (
|
|
1550
|
+
else if (v !== 0 && (b === 32 || b === 9))
|
|
1551
|
+
C === -1 && c !== -1 && (C = v);
|
|
1552
|
+
else if (b === 59 || b === 44) {
|
|
1552
1553
|
if (c === -1)
|
|
1553
1554
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1554
|
-
|
|
1555
|
-
const p =
|
|
1556
|
-
|
|
1555
|
+
C === -1 && (C = v);
|
|
1556
|
+
const p = x.slice(c, C);
|
|
1557
|
+
b === 44 ? (T(d, p, n), n = /* @__PURE__ */ Object.create(null)) : h = p, c = C = -1;
|
|
1557
1558
|
} else
|
|
1558
1559
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1559
|
-
else if (
|
|
1560
|
-
if (
|
|
1560
|
+
else if (L === void 0)
|
|
1561
|
+
if (C === -1 && P[b] === 1)
|
|
1561
1562
|
c === -1 && (c = v);
|
|
1562
|
-
else if (
|
|
1563
|
-
|
|
1564
|
-
else if (
|
|
1563
|
+
else if (b === 32 || b === 9)
|
|
1564
|
+
C === -1 && c !== -1 && (C = v);
|
|
1565
|
+
else if (b === 59 || b === 44) {
|
|
1565
1566
|
if (c === -1)
|
|
1566
1567
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1567
|
-
|
|
1568
|
-
} else if (
|
|
1569
|
-
|
|
1568
|
+
C === -1 && (C = v), T(n, x.slice(c, C), !0), b === 44 && (T(d, h, n), n = /* @__PURE__ */ Object.create(null), h = void 0), c = C = -1;
|
|
1569
|
+
} else if (b === 61 && c !== -1 && C === -1)
|
|
1570
|
+
L = x.slice(c, v), c = C = -1;
|
|
1570
1571
|
else
|
|
1571
1572
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1572
1573
|
else if (a) {
|
|
1573
|
-
if (P[
|
|
1574
|
+
if (P[b] !== 1)
|
|
1574
1575
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1575
|
-
c === -1 ? c = v :
|
|
1576
|
+
c === -1 ? c = v : l || (l = !0), a = !1;
|
|
1576
1577
|
} else if (_)
|
|
1577
|
-
if (P[
|
|
1578
|
+
if (P[b] === 1)
|
|
1578
1579
|
c === -1 && (c = v);
|
|
1579
|
-
else if (
|
|
1580
|
-
_ = !1,
|
|
1581
|
-
else if (
|
|
1580
|
+
else if (b === 34 && c !== -1)
|
|
1581
|
+
_ = !1, C = v;
|
|
1582
|
+
else if (b === 92)
|
|
1582
1583
|
a = !0;
|
|
1583
1584
|
else
|
|
1584
1585
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1585
|
-
else if (
|
|
1586
|
+
else if (b === 34 && x.charCodeAt(v - 1) === 61)
|
|
1586
1587
|
_ = !0;
|
|
1587
|
-
else if (
|
|
1588
|
+
else if (C === -1 && P[b] === 1)
|
|
1588
1589
|
c === -1 && (c = v);
|
|
1589
|
-
else if (c !== -1 && (
|
|
1590
|
-
|
|
1591
|
-
else if (
|
|
1590
|
+
else if (c !== -1 && (b === 32 || b === 9))
|
|
1591
|
+
C === -1 && (C = v);
|
|
1592
|
+
else if (b === 59 || b === 44) {
|
|
1592
1593
|
if (c === -1)
|
|
1593
1594
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1594
|
-
|
|
1595
|
-
let p =
|
|
1596
|
-
|
|
1595
|
+
C === -1 && (C = v);
|
|
1596
|
+
let p = x.slice(c, C);
|
|
1597
|
+
l && (p = p.replace(/\\/g, ""), l = !1), T(n, L, p), b === 44 && (T(d, h, n), n = /* @__PURE__ */ Object.create(null), h = void 0), L = void 0, c = C = -1;
|
|
1597
1598
|
} else
|
|
1598
1599
|
throw new SyntaxError(`Unexpected character at index ${v}`);
|
|
1599
|
-
if (c === -1 || _ ||
|
|
1600
|
+
if (c === -1 || _ || b === 32 || b === 9)
|
|
1600
1601
|
throw new SyntaxError("Unexpected end of input");
|
|
1601
|
-
|
|
1602
|
-
const O =
|
|
1603
|
-
return h === void 0 ? T(d, O, n) : (
|
|
1602
|
+
C === -1 && (C = v);
|
|
1603
|
+
const O = x.slice(c, C);
|
|
1604
|
+
return h === void 0 ? T(d, O, n) : (L === void 0 ? T(n, O, !0) : l ? T(n, L, O.replace(/\\/g, "")) : T(n, L, O), T(d, h, n)), d;
|
|
1604
1605
|
}
|
|
1605
|
-
function
|
|
1606
|
-
return Object.keys(
|
|
1607
|
-
let n =
|
|
1608
|
-
return Array.isArray(n) || (n = [n]), n.map((
|
|
1609
|
-
Object.keys(
|
|
1610
|
-
let _ =
|
|
1606
|
+
function D(x) {
|
|
1607
|
+
return Object.keys(x).map((d) => {
|
|
1608
|
+
let n = x[d];
|
|
1609
|
+
return Array.isArray(n) || (n = [n]), n.map((l) => [d].concat(
|
|
1610
|
+
Object.keys(l).map((a) => {
|
|
1611
|
+
let _ = l[a];
|
|
1611
1612
|
return Array.isArray(_) || (_ = [_]), _.map((h) => h === !0 ? a : `${a}=${h}`).join("; ");
|
|
1612
1613
|
})
|
|
1613
1614
|
).join("; ")).join(", ");
|
|
1614
1615
|
}).join(", ");
|
|
1615
1616
|
}
|
|
1616
|
-
return
|
|
1617
|
+
return Se = { format: D, parse: M }, Se;
|
|
1617
1618
|
}
|
|
1618
|
-
var
|
|
1619
|
+
var xe, Ye;
|
|
1619
1620
|
function Te() {
|
|
1620
|
-
if (Ye) return
|
|
1621
|
+
if (Ye) return xe;
|
|
1621
1622
|
Ye = 1;
|
|
1622
|
-
const P = Qe, T = dt, M = Je,
|
|
1623
|
-
BINARY_TYPES:
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1623
|
+
const P = Qe, T = dt, M = Je, D = _t, x = pt, { randomBytes: d, createHash: n } = Oe, { Duplex: l, Readable: a } = se, { URL: _ } = mt, h = le(), L = rt(), c = st(), { isBlob: b } = ie(), {
|
|
1624
|
+
BINARY_TYPES: C,
|
|
1625
|
+
CLOSE_TIMEOUT: v,
|
|
1626
|
+
EMPTY_BUFFER: O,
|
|
1627
|
+
GUID: p,
|
|
1628
|
+
kForOnEventAttribute: f,
|
|
1629
|
+
kListener: E,
|
|
1630
|
+
kStatusCode: w,
|
|
1631
|
+
kWebSocket: t,
|
|
1630
1632
|
NOOP: e
|
|
1631
|
-
} =
|
|
1632
|
-
EventTarget: { addEventListener:
|
|
1633
|
-
} = Ct(), { format:
|
|
1633
|
+
} = q(), {
|
|
1634
|
+
EventTarget: { addEventListener: s, removeEventListener: i }
|
|
1635
|
+
} = Ct(), { format: m, parse: u } = it(), { toBuffer: R } = ae(), B = /* @__PURE__ */ Symbol("kAborted"), A = [8, 13], N = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"], G = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
1634
1636
|
class S extends P {
|
|
1635
1637
|
/**
|
|
1636
1638
|
* Create a new `WebSocket`.
|
|
@@ -1639,8 +1641,8 @@ function Te() {
|
|
|
1639
1641
|
* @param {(String|String[])} [protocols] The subprotocols
|
|
1640
1642
|
* @param {Object} [options] Connection options
|
|
1641
1643
|
*/
|
|
1642
|
-
constructor(o,
|
|
1643
|
-
super(), this._binaryType =
|
|
1644
|
+
constructor(o, y, k) {
|
|
1645
|
+
super(), this._binaryType = C[0], this._closeCode = 1006, this._closeFrameReceived = !1, this._closeFrameSent = !1, this._closeMessage = O, this._closeTimer = null, this._errorEmitted = !1, this._extensions = {}, this._paused = !1, this._protocol = "", this._readyState = S.CONNECTING, this._receiver = null, this._sender = null, this._socket = null, o !== null ? (this._bufferedAmount = 0, this._isServer = !1, this._redirects = 0, y === void 0 ? y = [] : Array.isArray(y) || (typeof y == "object" && y !== null ? (k = y, y = []) : y = [y]), F(this, o, y, k)) : (this._autoPong = k.autoPong, this._closeTimeout = k.closeTimeout, this._isServer = !0);
|
|
1644
1646
|
}
|
|
1645
1647
|
/**
|
|
1646
1648
|
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
@@ -1652,7 +1654,7 @@ function Te() {
|
|
|
1652
1654
|
return this._binaryType;
|
|
1653
1655
|
}
|
|
1654
1656
|
set binaryType(o) {
|
|
1655
|
-
|
|
1657
|
+
C.includes(o) && (this._binaryType = o, this._receiver && (this._receiver._binaryType = o));
|
|
1656
1658
|
}
|
|
1657
1659
|
/**
|
|
1658
1660
|
* @type {Number}
|
|
@@ -1734,16 +1736,16 @@ function Te() {
|
|
|
1734
1736
|
* not to skip UTF-8 validation for text and close messages
|
|
1735
1737
|
* @private
|
|
1736
1738
|
*/
|
|
1737
|
-
setSocket(o,
|
|
1738
|
-
const g = new
|
|
1739
|
-
allowSynchronousEvents:
|
|
1739
|
+
setSocket(o, y, k) {
|
|
1740
|
+
const g = new L({
|
|
1741
|
+
allowSynchronousEvents: k.allowSynchronousEvents,
|
|
1740
1742
|
binaryType: this.binaryType,
|
|
1741
1743
|
extensions: this._extensions,
|
|
1742
1744
|
isServer: this._isServer,
|
|
1743
|
-
maxPayload:
|
|
1744
|
-
skipUTF8Validation:
|
|
1745
|
-
}), U = new c(o, this._extensions,
|
|
1746
|
-
this._receiver = g, this._sender = U, this._socket = o, g[
|
|
1745
|
+
maxPayload: k.maxPayload,
|
|
1746
|
+
skipUTF8Validation: k.skipUTF8Validation
|
|
1747
|
+
}), U = new c(o, this._extensions, k.generateMask);
|
|
1748
|
+
this._receiver = g, this._sender = U, this._socket = o, g[t] = this, U[t] = this, o[t] = this, g.on("conclude", nt), g.on("drain", ot), g.on("error", at), g.on("message", lt), g.on("ping", ft), g.on("pong", ht), U.onerror = ct, o.setTimeout && o.setTimeout(0), o.setNoDelay && o.setNoDelay(), y.length > 0 && o.unshift(y), o.on("close", Ne), o.on("data", oe), o.on("end", Pe), o.on("error", Re), this._readyState = S.OPEN, this.emit("open");
|
|
1747
1749
|
}
|
|
1748
1750
|
/**
|
|
1749
1751
|
* Emit the `'close'` event.
|
|
@@ -1777,7 +1779,7 @@ function Te() {
|
|
|
1777
1779
|
* closing
|
|
1778
1780
|
* @public
|
|
1779
1781
|
*/
|
|
1780
|
-
close(o,
|
|
1782
|
+
close(o, y) {
|
|
1781
1783
|
if (this.readyState !== S.CLOSED) {
|
|
1782
1784
|
if (this.readyState === S.CONNECTING) {
|
|
1783
1785
|
W(this, this._req, "WebSocket was closed before the connection was established");
|
|
@@ -1787,9 +1789,9 @@ function Te() {
|
|
|
1787
1789
|
this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end();
|
|
1788
1790
|
return;
|
|
1789
1791
|
}
|
|
1790
|
-
this._readyState = S.CLOSING, this._sender.close(o,
|
|
1791
|
-
|
|
1792
|
-
}),
|
|
1792
|
+
this._readyState = S.CLOSING, this._sender.close(o, y, !this._isServer, (k) => {
|
|
1793
|
+
k || (this._closeFrameSent = !0, (this._closeFrameReceived || this._receiver._writableState.errorEmitted) && this._socket.end());
|
|
1794
|
+
}), ke(this);
|
|
1793
1795
|
}
|
|
1794
1796
|
}
|
|
1795
1797
|
/**
|
|
@@ -1808,14 +1810,14 @@ function Te() {
|
|
|
1808
1810
|
* @param {Function} [cb] Callback which is executed when the ping is sent
|
|
1809
1811
|
* @public
|
|
1810
1812
|
*/
|
|
1811
|
-
ping(o,
|
|
1813
|
+
ping(o, y, k) {
|
|
1812
1814
|
if (this.readyState === S.CONNECTING)
|
|
1813
1815
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1814
|
-
if (typeof o == "function" ? (
|
|
1815
|
-
ce(this, o,
|
|
1816
|
+
if (typeof o == "function" ? (k = o, o = y = void 0) : typeof y == "function" && (k = y, y = void 0), typeof o == "number" && (o = o.toString()), this.readyState !== S.OPEN) {
|
|
1817
|
+
ce(this, o, k);
|
|
1816
1818
|
return;
|
|
1817
1819
|
}
|
|
1818
|
-
|
|
1820
|
+
y === void 0 && (y = !this._isServer), this._sender.ping(o || O, y, k);
|
|
1819
1821
|
}
|
|
1820
1822
|
/**
|
|
1821
1823
|
* Send a pong.
|
|
@@ -1825,14 +1827,14 @@ function Te() {
|
|
|
1825
1827
|
* @param {Function} [cb] Callback which is executed when the pong is sent
|
|
1826
1828
|
* @public
|
|
1827
1829
|
*/
|
|
1828
|
-
pong(o,
|
|
1830
|
+
pong(o, y, k) {
|
|
1829
1831
|
if (this.readyState === S.CONNECTING)
|
|
1830
1832
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1831
|
-
if (typeof o == "function" ? (
|
|
1832
|
-
ce(this, o,
|
|
1833
|
+
if (typeof o == "function" ? (k = o, o = y = void 0) : typeof y == "function" && (k = y, y = void 0), typeof o == "number" && (o = o.toString()), this.readyState !== S.OPEN) {
|
|
1834
|
+
ce(this, o, k);
|
|
1833
1835
|
return;
|
|
1834
1836
|
}
|
|
1835
|
-
|
|
1837
|
+
y === void 0 && (y = !this._isServer), this._sender.pong(o || O, y, k);
|
|
1836
1838
|
}
|
|
1837
1839
|
/**
|
|
1838
1840
|
* Resume the socket.
|
|
@@ -1857,11 +1859,11 @@ function Te() {
|
|
|
1857
1859
|
* @param {Function} [cb] Callback which is executed when data is written out
|
|
1858
1860
|
* @public
|
|
1859
1861
|
*/
|
|
1860
|
-
send(o,
|
|
1862
|
+
send(o, y, k) {
|
|
1861
1863
|
if (this.readyState === S.CONNECTING)
|
|
1862
1864
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1863
|
-
if (typeof
|
|
1864
|
-
ce(this, o,
|
|
1865
|
+
if (typeof y == "function" && (k = y, y = {}), typeof o == "number" && (o = o.toString()), this.readyState !== S.OPEN) {
|
|
1866
|
+
ce(this, o, k);
|
|
1865
1867
|
return;
|
|
1866
1868
|
}
|
|
1867
1869
|
const g = {
|
|
@@ -1869,9 +1871,9 @@ function Te() {
|
|
|
1869
1871
|
mask: !this._isServer,
|
|
1870
1872
|
compress: !0,
|
|
1871
1873
|
fin: !0,
|
|
1872
|
-
...
|
|
1874
|
+
...y
|
|
1873
1875
|
};
|
|
1874
|
-
this._extensions[h.extensionName] || (g.compress = !1), this._sender.send(o ||
|
|
1876
|
+
this._extensions[h.extensionName] || (g.compress = !1), this._sender.send(o || O, g, k);
|
|
1875
1877
|
}
|
|
1876
1878
|
/**
|
|
1877
1879
|
* Forcibly close the connection.
|
|
@@ -1927,32 +1929,33 @@ function Te() {
|
|
|
1927
1929
|
enumerable: !0,
|
|
1928
1930
|
get() {
|
|
1929
1931
|
for (const o of this.listeners(r))
|
|
1930
|
-
if (o[
|
|
1932
|
+
if (o[f]) return o[E];
|
|
1931
1933
|
return null;
|
|
1932
1934
|
},
|
|
1933
1935
|
set(o) {
|
|
1934
|
-
for (const
|
|
1935
|
-
if (
|
|
1936
|
-
this.removeListener(r,
|
|
1936
|
+
for (const y of this.listeners(r))
|
|
1937
|
+
if (y[f]) {
|
|
1938
|
+
this.removeListener(r, y);
|
|
1937
1939
|
break;
|
|
1938
1940
|
}
|
|
1939
1941
|
typeof o == "function" && this.addEventListener(r, o, {
|
|
1940
|
-
[
|
|
1942
|
+
[f]: !0
|
|
1941
1943
|
});
|
|
1942
1944
|
}
|
|
1943
1945
|
});
|
|
1944
|
-
}), S.prototype.addEventListener =
|
|
1945
|
-
function
|
|
1946
|
+
}), S.prototype.addEventListener = s, S.prototype.removeEventListener = i, xe = S;
|
|
1947
|
+
function F(r, o, y, k) {
|
|
1946
1948
|
const g = {
|
|
1947
1949
|
allowSynchronousEvents: !0,
|
|
1948
1950
|
autoPong: !0,
|
|
1951
|
+
closeTimeout: v,
|
|
1949
1952
|
protocolVersion: A[1],
|
|
1950
1953
|
maxPayload: 104857600,
|
|
1951
1954
|
skipUTF8Validation: !1,
|
|
1952
1955
|
perMessageDeflate: !0,
|
|
1953
1956
|
followRedirects: !1,
|
|
1954
1957
|
maxRedirects: 10,
|
|
1955
|
-
...
|
|
1958
|
+
...k,
|
|
1956
1959
|
socketPath: void 0,
|
|
1957
1960
|
hostname: void 0,
|
|
1958
1961
|
protocol: void 0,
|
|
@@ -1962,7 +1965,7 @@ function Te() {
|
|
|
1962
1965
|
path: void 0,
|
|
1963
1966
|
port: void 0
|
|
1964
1967
|
};
|
|
1965
|
-
if (r._autoPong = g.autoPong, !A.includes(g.protocolVersion))
|
|
1968
|
+
if (r._autoPong = g.autoPong, r._closeTimeout = g.closeTimeout, !A.includes(g.protocolVersion))
|
|
1966
1969
|
throw new RangeError(
|
|
1967
1970
|
`Unsupported protocol version: ${g.protocolVersion} (supported versions: ${A.join(", ")})`
|
|
1968
1971
|
);
|
|
@@ -1982,12 +1985,12 @@ function Te() {
|
|
|
1982
1985
|
const I = new SyntaxError(X);
|
|
1983
1986
|
if (r._redirects === 0)
|
|
1984
1987
|
throw I;
|
|
1985
|
-
|
|
1988
|
+
j(r, I);
|
|
1986
1989
|
return;
|
|
1987
1990
|
}
|
|
1988
1991
|
const Be = z ? 443 : 80, De = d(16).toString("base64"), Ie = z ? T.request : M.request, Z = /* @__PURE__ */ new Set();
|
|
1989
1992
|
let Q;
|
|
1990
|
-
if (g.createConnection = g.createConnection || (z ? he :
|
|
1993
|
+
if (g.createConnection = g.createConnection || (z ? he : ne), g.defaultPort = g.defaultPort || Be, g.port = U.port || Be, g.host = U.hostname.startsWith("[") ? U.hostname.slice(1, -1) : U.hostname, g.headers = {
|
|
1991
1994
|
...g.headers,
|
|
1992
1995
|
"Sec-WebSocket-Version": g.protocolVersion,
|
|
1993
1996
|
"Sec-WebSocket-Key": De,
|
|
@@ -1997,17 +2000,17 @@ function Te() {
|
|
|
1997
2000
|
g.perMessageDeflate !== !0 ? g.perMessageDeflate : {},
|
|
1998
2001
|
!1,
|
|
1999
2002
|
g.maxPayload
|
|
2000
|
-
), g.headers["Sec-WebSocket-Extensions"] =
|
|
2003
|
+
), g.headers["Sec-WebSocket-Extensions"] = m({
|
|
2001
2004
|
[h.extensionName]: Q.offer()
|
|
2002
|
-
})),
|
|
2003
|
-
for (const I of
|
|
2004
|
-
if (typeof I != "string" || !
|
|
2005
|
+
})), y.length) {
|
|
2006
|
+
for (const I of y) {
|
|
2007
|
+
if (typeof I != "string" || !G.test(I) || Z.has(I))
|
|
2005
2008
|
throw new SyntaxError(
|
|
2006
2009
|
"An invalid or duplicated subprotocol was specified"
|
|
2007
2010
|
);
|
|
2008
2011
|
Z.add(I);
|
|
2009
2012
|
}
|
|
2010
|
-
g.headers["Sec-WebSocket-Protocol"] =
|
|
2013
|
+
g.headers["Sec-WebSocket-Protocol"] = y.join(",");
|
|
2011
2014
|
}
|
|
2012
2015
|
if (g.origin && (g.protocolVersion < 13 ? g.headers["Sec-WebSocket-Origin"] = g.origin : g.headers.Origin = g.origin), (U.username || U.password) && (g.auth = `${U.username}:${U.password}`), H) {
|
|
2013
2016
|
const I = g.path.split(":");
|
|
@@ -2017,24 +2020,24 @@ function Te() {
|
|
|
2017
2020
|
if (g.followRedirects) {
|
|
2018
2021
|
if (r._redirects === 0) {
|
|
2019
2022
|
r._originalIpc = H, r._originalSecure = z, r._originalHostOrSocketPath = H ? g.socketPath : U.host;
|
|
2020
|
-
const I =
|
|
2021
|
-
if (
|
|
2022
|
-
for (const [
|
|
2023
|
-
|
|
2023
|
+
const I = k && k.headers;
|
|
2024
|
+
if (k = { ...k, headers: {} }, I)
|
|
2025
|
+
for (const [V, Y] of Object.entries(I))
|
|
2026
|
+
k.headers[V.toLowerCase()] = Y;
|
|
2024
2027
|
} else if (r.listenerCount("redirect") === 0) {
|
|
2025
2028
|
const I = H ? r._originalIpc ? g.socketPath === r._originalHostOrSocketPath : !1 : r._originalIpc ? !1 : U.host === r._originalHostOrSocketPath;
|
|
2026
2029
|
(!I || r._originalSecure && !z) && (delete g.headers.authorization, delete g.headers.cookie, I || delete g.headers.host, g.auth = void 0);
|
|
2027
2030
|
}
|
|
2028
|
-
g.auth && !
|
|
2031
|
+
g.auth && !k.headers.authorization && (k.headers.authorization = "Basic " + Buffer.from(g.auth).toString("base64")), $ = r._req = Ie(g), r._redirects && r.emit("redirect", r.url, $);
|
|
2029
2032
|
} else
|
|
2030
2033
|
$ = r._req = Ie(g);
|
|
2031
2034
|
g.timeout && $.on("timeout", () => {
|
|
2032
2035
|
W(r, $, "Opening handshake has timed out");
|
|
2033
2036
|
}), $.on("error", (I) => {
|
|
2034
|
-
$ === null || $[
|
|
2037
|
+
$ === null || $[B] || ($ = r._req = null, j(r, I));
|
|
2035
2038
|
}), $.on("response", (I) => {
|
|
2036
|
-
const
|
|
2037
|
-
if (
|
|
2039
|
+
const V = I.headers.location, Y = I.statusCode;
|
|
2040
|
+
if (V && g.followRedirects && Y >= 300 && Y < 400) {
|
|
2038
2041
|
if (++r._redirects > g.maxRedirects) {
|
|
2039
2042
|
W(r, $, "Maximum redirects exceeded");
|
|
2040
2043
|
return;
|
|
@@ -2042,65 +2045,65 @@ function Te() {
|
|
|
2042
2045
|
$.abort();
|
|
2043
2046
|
let J;
|
|
2044
2047
|
try {
|
|
2045
|
-
J = new _(
|
|
2048
|
+
J = new _(V, o);
|
|
2046
2049
|
} catch {
|
|
2047
|
-
const K = new SyntaxError(`Invalid URL: ${
|
|
2048
|
-
|
|
2050
|
+
const K = new SyntaxError(`Invalid URL: ${V}`);
|
|
2051
|
+
j(r, K);
|
|
2049
2052
|
return;
|
|
2050
2053
|
}
|
|
2051
|
-
|
|
2054
|
+
F(r, J, y, k);
|
|
2052
2055
|
} else r.emit("unexpected-response", $, I) || W(
|
|
2053
2056
|
r,
|
|
2054
2057
|
$,
|
|
2055
2058
|
`Unexpected server response: ${I.statusCode}`
|
|
2056
2059
|
);
|
|
2057
|
-
}), $.on("upgrade", (I,
|
|
2060
|
+
}), $.on("upgrade", (I, V, Y) => {
|
|
2058
2061
|
if (r.emit("upgrade", I), r.readyState !== S.CONNECTING) return;
|
|
2059
2062
|
$ = r._req = null;
|
|
2060
2063
|
const J = I.headers.upgrade;
|
|
2061
2064
|
if (J === void 0 || J.toLowerCase() !== "websocket") {
|
|
2062
|
-
W(r,
|
|
2065
|
+
W(r, V, "Invalid Upgrade header");
|
|
2063
2066
|
return;
|
|
2064
2067
|
}
|
|
2065
|
-
const Ue = n("sha1").update(De +
|
|
2068
|
+
const Ue = n("sha1").update(De + p).digest("base64");
|
|
2066
2069
|
if (I.headers["sec-websocket-accept"] !== Ue) {
|
|
2067
|
-
W(r,
|
|
2070
|
+
W(r, V, "Invalid Sec-WebSocket-Accept header");
|
|
2068
2071
|
return;
|
|
2069
2072
|
}
|
|
2070
2073
|
const K = I.headers["sec-websocket-protocol"];
|
|
2071
2074
|
let ee;
|
|
2072
2075
|
if (K !== void 0 ? Z.size ? Z.has(K) || (ee = "Server sent an invalid subprotocol") : ee = "Server sent a subprotocol but none was requested" : Z.size && (ee = "Server sent no subprotocol"), ee) {
|
|
2073
|
-
W(r,
|
|
2076
|
+
W(r, V, ee);
|
|
2074
2077
|
return;
|
|
2075
2078
|
}
|
|
2076
2079
|
K && (r._protocol = K);
|
|
2077
2080
|
const Me = I.headers["sec-websocket-extensions"];
|
|
2078
2081
|
if (Me !== void 0) {
|
|
2079
2082
|
if (!Q) {
|
|
2080
|
-
W(r,
|
|
2083
|
+
W(r, V, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
|
|
2081
2084
|
return;
|
|
2082
2085
|
}
|
|
2083
2086
|
let ue;
|
|
2084
2087
|
try {
|
|
2085
|
-
ue =
|
|
2088
|
+
ue = u(Me);
|
|
2086
2089
|
} catch {
|
|
2087
|
-
W(r,
|
|
2090
|
+
W(r, V, "Invalid Sec-WebSocket-Extensions header");
|
|
2088
2091
|
return;
|
|
2089
2092
|
}
|
|
2090
2093
|
const Ae = Object.keys(ue);
|
|
2091
2094
|
if (Ae.length !== 1 || Ae[0] !== h.extensionName) {
|
|
2092
|
-
W(r,
|
|
2095
|
+
W(r, V, "Server indicated an extension that was not requested");
|
|
2093
2096
|
return;
|
|
2094
2097
|
}
|
|
2095
2098
|
try {
|
|
2096
2099
|
Q.accept(ue[h.extensionName]);
|
|
2097
2100
|
} catch {
|
|
2098
|
-
W(r,
|
|
2101
|
+
W(r, V, "Invalid Sec-WebSocket-Extensions header");
|
|
2099
2102
|
return;
|
|
2100
2103
|
}
|
|
2101
2104
|
r._extensions[h.extensionName] = Q;
|
|
2102
2105
|
}
|
|
2103
|
-
r.setSocket(
|
|
2106
|
+
r.setSocket(V, Y, {
|
|
2104
2107
|
allowSynchronousEvents: g.allowSynchronousEvents,
|
|
2105
2108
|
generateMask: g.generateMask,
|
|
2106
2109
|
maxPayload: g.maxPayload,
|
|
@@ -2108,91 +2111,93 @@ function Te() {
|
|
|
2108
2111
|
});
|
|
2109
2112
|
}), g.finishRequest ? g.finishRequest($, r) : $.end();
|
|
2110
2113
|
}
|
|
2111
|
-
function
|
|
2114
|
+
function j(r, o) {
|
|
2112
2115
|
r._readyState = S.CLOSING, r._errorEmitted = !0, r.emit("error", o), r.emitClose();
|
|
2113
2116
|
}
|
|
2114
|
-
function
|
|
2115
|
-
return r.path = r.socketPath,
|
|
2117
|
+
function ne(r) {
|
|
2118
|
+
return r.path = r.socketPath, D.connect(r);
|
|
2116
2119
|
}
|
|
2117
2120
|
function he(r) {
|
|
2118
|
-
return r.path = void 0, !r.servername && r.servername !== "" && (r.servername =
|
|
2121
|
+
return r.path = void 0, !r.servername && r.servername !== "" && (r.servername = D.isIP(r.host) ? "" : r.host), x.connect(r);
|
|
2119
2122
|
}
|
|
2120
|
-
function W(r, o,
|
|
2123
|
+
function W(r, o, y) {
|
|
2121
2124
|
r._readyState = S.CLOSING;
|
|
2122
|
-
const
|
|
2123
|
-
Error.captureStackTrace(
|
|
2125
|
+
const k = new Error(y);
|
|
2126
|
+
Error.captureStackTrace(k, W), o.setHeader ? (o[B] = !0, o.abort(), o.socket && !o.socket.destroyed && o.socket.destroy(), process.nextTick(j, r, k)) : (o.destroy(k), o.once("error", r.emit.bind(r, "error")), o.once("close", r.emitClose.bind(r)));
|
|
2124
2127
|
}
|
|
2125
|
-
function ce(r, o,
|
|
2128
|
+
function ce(r, o, y) {
|
|
2126
2129
|
if (o) {
|
|
2127
|
-
const
|
|
2128
|
-
r._socket ? r._sender._bufferedBytes +=
|
|
2130
|
+
const k = b(o) ? o.size : R(o).length;
|
|
2131
|
+
r._socket ? r._sender._bufferedBytes += k : r._bufferedAmount += k;
|
|
2129
2132
|
}
|
|
2130
|
-
if (
|
|
2131
|
-
const
|
|
2133
|
+
if (y) {
|
|
2134
|
+
const k = new Error(
|
|
2132
2135
|
`WebSocket is not open: readyState ${r.readyState} (${N[r.readyState]})`
|
|
2133
2136
|
);
|
|
2134
|
-
process.nextTick(
|
|
2137
|
+
process.nextTick(y, k);
|
|
2135
2138
|
}
|
|
2136
2139
|
}
|
|
2137
2140
|
function nt(r, o) {
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2141
|
+
const y = this[t];
|
|
2142
|
+
y._closeFrameReceived = !0, y._closeMessage = o, y._closeCode = r, y._socket[t] !== void 0 && (y._socket.removeListener("data", oe), process.nextTick(Le, y._socket), r === 1005 ? y.close() : y.close(r, o));
|
|
2140
2143
|
}
|
|
2141
2144
|
function ot() {
|
|
2142
|
-
const r = this[
|
|
2145
|
+
const r = this[t];
|
|
2143
2146
|
r.isPaused || r._socket.resume();
|
|
2144
2147
|
}
|
|
2145
2148
|
function at(r) {
|
|
2146
|
-
const o = this[
|
|
2147
|
-
o._socket[
|
|
2149
|
+
const o = this[t];
|
|
2150
|
+
o._socket[t] !== void 0 && (o._socket.removeListener("data", oe), process.nextTick(Le, o._socket), o.close(r[w])), o._errorEmitted || (o._errorEmitted = !0, o.emit("error", r));
|
|
2148
2151
|
}
|
|
2149
2152
|
function Ce() {
|
|
2150
|
-
this[
|
|
2153
|
+
this[t].emitClose();
|
|
2151
2154
|
}
|
|
2152
2155
|
function lt(r, o) {
|
|
2153
|
-
this[
|
|
2156
|
+
this[t].emit("message", r, o);
|
|
2154
2157
|
}
|
|
2155
2158
|
function ft(r) {
|
|
2156
|
-
const o = this[
|
|
2159
|
+
const o = this[t];
|
|
2157
2160
|
o._autoPong && o.pong(r, !this._isServer, e), o.emit("ping", r);
|
|
2158
2161
|
}
|
|
2159
2162
|
function ht(r) {
|
|
2160
|
-
this[
|
|
2163
|
+
this[t].emit("pong", r);
|
|
2161
2164
|
}
|
|
2162
|
-
function
|
|
2165
|
+
function Le(r) {
|
|
2163
2166
|
r.resume();
|
|
2164
2167
|
}
|
|
2165
2168
|
function ct(r) {
|
|
2166
|
-
const o = this[
|
|
2167
|
-
o.readyState !== S.CLOSED && (o.readyState === S.OPEN && (o._readyState = S.CLOSING,
|
|
2169
|
+
const o = this[t];
|
|
2170
|
+
o.readyState !== S.CLOSED && (o.readyState === S.OPEN && (o._readyState = S.CLOSING, ke(o)), this._socket.end(), o._errorEmitted || (o._errorEmitted = !0, o.emit("error", r)));
|
|
2168
2171
|
}
|
|
2169
|
-
function
|
|
2172
|
+
function ke(r) {
|
|
2170
2173
|
r._closeTimer = setTimeout(
|
|
2171
2174
|
r._socket.destroy.bind(r._socket),
|
|
2172
|
-
|
|
2175
|
+
r._closeTimeout
|
|
2173
2176
|
);
|
|
2174
2177
|
}
|
|
2175
2178
|
function Ne() {
|
|
2176
|
-
const r = this[
|
|
2177
|
-
this.removeListener("close", Ne), this.removeListener("data",
|
|
2178
|
-
|
|
2179
|
-
|
|
2179
|
+
const r = this[t];
|
|
2180
|
+
if (this.removeListener("close", Ne), this.removeListener("data", oe), this.removeListener("end", Pe), r._readyState = S.CLOSING, !this._readableState.endEmitted && !r._closeFrameReceived && !r._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
2181
|
+
const o = this.read(this._readableState.length);
|
|
2182
|
+
r._receiver.write(o);
|
|
2183
|
+
}
|
|
2184
|
+
r._receiver.end(), this[t] = void 0, clearTimeout(r._closeTimer), r._receiver._writableState.finished || r._receiver._writableState.errorEmitted ? r.emitClose() : (r._receiver.on("error", Ce), r._receiver.on("finish", Ce));
|
|
2180
2185
|
}
|
|
2181
|
-
function
|
|
2182
|
-
this[
|
|
2186
|
+
function oe(r) {
|
|
2187
|
+
this[t]._receiver.write(r) || this.pause();
|
|
2183
2188
|
}
|
|
2184
2189
|
function Pe() {
|
|
2185
|
-
const r = this[
|
|
2190
|
+
const r = this[t];
|
|
2186
2191
|
r._readyState = S.CLOSING, r._receiver.end(), this.end();
|
|
2187
2192
|
}
|
|
2188
2193
|
function Re() {
|
|
2189
|
-
const r = this[
|
|
2194
|
+
const r = this[t];
|
|
2190
2195
|
this.removeListener("error", Re), this.on("error", e), r && (r._readyState = S.CLOSING, this.destroy());
|
|
2191
2196
|
}
|
|
2192
|
-
return
|
|
2197
|
+
return xe;
|
|
2193
2198
|
}
|
|
2194
2199
|
var ve, Ke;
|
|
2195
|
-
function
|
|
2200
|
+
function Lt() {
|
|
2196
2201
|
if (Ke) return ve;
|
|
2197
2202
|
Ke = 1, Te();
|
|
2198
2203
|
const { Duplex: P } = se;
|
|
@@ -2202,11 +2207,11 @@ function kt() {
|
|
|
2202
2207
|
function M() {
|
|
2203
2208
|
!this.destroyed && this._writableState.finished && this.destroy();
|
|
2204
2209
|
}
|
|
2205
|
-
function
|
|
2206
|
-
this.removeListener("error",
|
|
2210
|
+
function D(d) {
|
|
2211
|
+
this.removeListener("error", D), this.destroy(), this.listenerCount("error") === 0 && this.emit("error", d);
|
|
2207
2212
|
}
|
|
2208
|
-
function
|
|
2209
|
-
let
|
|
2213
|
+
function x(d, n) {
|
|
2214
|
+
let l = !0;
|
|
2210
2215
|
const a = new P({
|
|
2211
2216
|
...n,
|
|
2212
2217
|
autoDestroy: !1,
|
|
@@ -2214,11 +2219,11 @@ function kt() {
|
|
|
2214
2219
|
objectMode: !1,
|
|
2215
2220
|
writableObjectMode: !1
|
|
2216
2221
|
});
|
|
2217
|
-
return d.on("message", function(h,
|
|
2218
|
-
const c = !
|
|
2222
|
+
return d.on("message", function(h, L) {
|
|
2223
|
+
const c = !L && a._readableState.objectMode ? h.toString() : h;
|
|
2219
2224
|
a.push(c) || d.pause();
|
|
2220
2225
|
}), d.once("error", function(h) {
|
|
2221
|
-
a.destroyed || (
|
|
2226
|
+
a.destroyed || (l = !1, a.destroy(h));
|
|
2222
2227
|
}), d.once("close", function() {
|
|
2223
2228
|
a.destroyed || a.push(null);
|
|
2224
2229
|
}), a._destroy = function(_, h) {
|
|
@@ -2226,12 +2231,12 @@ function kt() {
|
|
|
2226
2231
|
h(_), process.nextTick(T, a);
|
|
2227
2232
|
return;
|
|
2228
2233
|
}
|
|
2229
|
-
let
|
|
2230
|
-
d.once("error", function(
|
|
2231
|
-
|
|
2234
|
+
let L = !1;
|
|
2235
|
+
d.once("error", function(b) {
|
|
2236
|
+
L = !0, h(b);
|
|
2232
2237
|
}), d.once("close", function() {
|
|
2233
|
-
|
|
2234
|
-
}),
|
|
2238
|
+
L || h(_), process.nextTick(T, a);
|
|
2239
|
+
}), l && d.terminate();
|
|
2235
2240
|
}, a._final = function(_) {
|
|
2236
2241
|
if (d.readyState === d.CONNECTING) {
|
|
2237
2242
|
d.once("open", function() {
|
|
@@ -2244,54 +2249,54 @@ function kt() {
|
|
|
2244
2249
|
}), d.close()));
|
|
2245
2250
|
}, a._read = function() {
|
|
2246
2251
|
d.isPaused && d.resume();
|
|
2247
|
-
}, a._write = function(_, h,
|
|
2252
|
+
}, a._write = function(_, h, L) {
|
|
2248
2253
|
if (d.readyState === d.CONNECTING) {
|
|
2249
2254
|
d.once("open", function() {
|
|
2250
|
-
a._write(_, h,
|
|
2255
|
+
a._write(_, h, L);
|
|
2251
2256
|
});
|
|
2252
2257
|
return;
|
|
2253
2258
|
}
|
|
2254
|
-
d.send(_,
|
|
2255
|
-
}, a.on("end", M), a.on("error",
|
|
2259
|
+
d.send(_, L);
|
|
2260
|
+
}, a.on("end", M), a.on("error", D), a;
|
|
2256
2261
|
}
|
|
2257
|
-
return ve =
|
|
2262
|
+
return ve = x, ve;
|
|
2258
2263
|
}
|
|
2259
|
-
|
|
2264
|
+
Lt();
|
|
2260
2265
|
rt();
|
|
2261
2266
|
st();
|
|
2262
|
-
var
|
|
2263
|
-
const Nt = /* @__PURE__ */ yt(
|
|
2267
|
+
var kt = Te();
|
|
2268
|
+
const Nt = /* @__PURE__ */ yt(kt);
|
|
2264
2269
|
var be, Xe;
|
|
2265
2270
|
function Pt() {
|
|
2266
2271
|
if (Xe) return be;
|
|
2267
2272
|
Xe = 1;
|
|
2268
2273
|
const { tokenChars: P } = ie();
|
|
2269
2274
|
function T(M) {
|
|
2270
|
-
const
|
|
2271
|
-
let
|
|
2275
|
+
const D = /* @__PURE__ */ new Set();
|
|
2276
|
+
let x = -1, d = -1, n = 0;
|
|
2272
2277
|
for (n; n < M.length; n++) {
|
|
2273
2278
|
const a = M.charCodeAt(n);
|
|
2274
2279
|
if (d === -1 && P[a] === 1)
|
|
2275
|
-
|
|
2280
|
+
x === -1 && (x = n);
|
|
2276
2281
|
else if (n !== 0 && (a === 32 || a === 9))
|
|
2277
|
-
d === -1 &&
|
|
2282
|
+
d === -1 && x !== -1 && (d = n);
|
|
2278
2283
|
else if (a === 44) {
|
|
2279
|
-
if (
|
|
2284
|
+
if (x === -1)
|
|
2280
2285
|
throw new SyntaxError(`Unexpected character at index ${n}`);
|
|
2281
2286
|
d === -1 && (d = n);
|
|
2282
|
-
const _ = M.slice(
|
|
2283
|
-
if (
|
|
2287
|
+
const _ = M.slice(x, d);
|
|
2288
|
+
if (D.has(_))
|
|
2284
2289
|
throw new SyntaxError(`The "${_}" subprotocol is duplicated`);
|
|
2285
|
-
|
|
2290
|
+
D.add(_), x = d = -1;
|
|
2286
2291
|
} else
|
|
2287
2292
|
throw new SyntaxError(`Unexpected character at index ${n}`);
|
|
2288
2293
|
}
|
|
2289
|
-
if (
|
|
2294
|
+
if (x === -1 || d !== -1)
|
|
2290
2295
|
throw new SyntaxError("Unexpected end of input");
|
|
2291
|
-
const
|
|
2292
|
-
if (
|
|
2293
|
-
throw new SyntaxError(`The "${
|
|
2294
|
-
return
|
|
2296
|
+
const l = M.slice(x, n);
|
|
2297
|
+
if (D.has(l))
|
|
2298
|
+
throw new SyntaxError(`The "${l}" subprotocol is duplicated`);
|
|
2299
|
+
return D.add(l), D;
|
|
2295
2300
|
}
|
|
2296
2301
|
return be = { parse: T }, be;
|
|
2297
2302
|
}
|
|
@@ -2299,8 +2304,8 @@ var we, Ze;
|
|
|
2299
2304
|
function Rt() {
|
|
2300
2305
|
if (Ze) return we;
|
|
2301
2306
|
Ze = 1;
|
|
2302
|
-
const P = Qe, T = Je, { Duplex: M } = se, { createHash:
|
|
2303
|
-
class
|
|
2307
|
+
const P = Qe, T = Je, { Duplex: M } = se, { createHash: D } = Oe, x = it(), d = le(), n = Pt(), l = Te(), { CLOSE_TIMEOUT: a, GUID: _, kWebSocket: h } = q(), L = /^[+/0-9A-Za-z]{22}==$/, c = 0, b = 1, C = 2;
|
|
2308
|
+
class v extends P {
|
|
2304
2309
|
/**
|
|
2305
2310
|
* Create a `WebSocketServer` instance.
|
|
2306
2311
|
*
|
|
@@ -2314,6 +2319,9 @@ function Rt() {
|
|
|
2314
2319
|
* pending connections
|
|
2315
2320
|
* @param {Boolean} [options.clientTracking=true] Specifies whether or not to
|
|
2316
2321
|
* track clients
|
|
2322
|
+
* @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
|
|
2323
|
+
* wait for the closing handshake to finish after `websocket.close()` is
|
|
2324
|
+
* called
|
|
2317
2325
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
2318
2326
|
* @param {String} [options.host] The hostname where to bind the server
|
|
2319
2327
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
@@ -2332,7 +2340,7 @@ function Rt() {
|
|
|
2332
2340
|
* class to use. It must be the `WebSocket` class or class that extends it
|
|
2333
2341
|
* @param {Function} [callback] A listener for the `listening` event
|
|
2334
2342
|
*/
|
|
2335
|
-
constructor(e,
|
|
2343
|
+
constructor(e, s) {
|
|
2336
2344
|
if (super(), e = {
|
|
2337
2345
|
allowSynchronousEvents: !0,
|
|
2338
2346
|
autoPong: !0,
|
|
@@ -2341,6 +2349,7 @@ function Rt() {
|
|
|
2341
2349
|
perMessageDeflate: !1,
|
|
2342
2350
|
handleProtocols: null,
|
|
2343
2351
|
clientTracking: !0,
|
|
2352
|
+
closeTimeout: a,
|
|
2344
2353
|
verifyClient: null,
|
|
2345
2354
|
noServer: !1,
|
|
2346
2355
|
backlog: null,
|
|
@@ -2349,34 +2358,34 @@ function Rt() {
|
|
|
2349
2358
|
host: null,
|
|
2350
2359
|
path: null,
|
|
2351
2360
|
port: null,
|
|
2352
|
-
WebSocket:
|
|
2361
|
+
WebSocket: l,
|
|
2353
2362
|
...e
|
|
2354
2363
|
}, e.port == null && !e.server && !e.noServer || e.port != null && (e.server || e.noServer) || e.server && e.noServer)
|
|
2355
2364
|
throw new TypeError(
|
|
2356
2365
|
'One and only one of the "port", "server", or "noServer" options must be specified'
|
|
2357
2366
|
);
|
|
2358
|
-
if (e.port != null ? (this._server = T.createServer((i,
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
"Content-Length":
|
|
2367
|
+
if (e.port != null ? (this._server = T.createServer((i, m) => {
|
|
2368
|
+
const u = T.STATUS_CODES[426];
|
|
2369
|
+
m.writeHead(426, {
|
|
2370
|
+
"Content-Length": u.length,
|
|
2362
2371
|
"Content-Type": "text/plain"
|
|
2363
|
-
}),
|
|
2372
|
+
}), m.end(u);
|
|
2364
2373
|
}), this._server.listen(
|
|
2365
2374
|
e.port,
|
|
2366
2375
|
e.host,
|
|
2367
2376
|
e.backlog,
|
|
2368
|
-
|
|
2377
|
+
s
|
|
2369
2378
|
)) : e.server && (this._server = e.server), this._server) {
|
|
2370
2379
|
const i = this.emit.bind(this, "connection");
|
|
2371
|
-
this._removeListeners =
|
|
2380
|
+
this._removeListeners = O(this._server, {
|
|
2372
2381
|
listening: this.emit.bind(this, "listening"),
|
|
2373
2382
|
error: this.emit.bind(this, "error"),
|
|
2374
|
-
upgrade: (
|
|
2375
|
-
this.handleUpgrade(
|
|
2383
|
+
upgrade: (m, u, R) => {
|
|
2384
|
+
this.handleUpgrade(m, u, R, i);
|
|
2376
2385
|
}
|
|
2377
2386
|
});
|
|
2378
2387
|
}
|
|
2379
|
-
e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state =
|
|
2388
|
+
e.perMessageDeflate === !0 && (e.perMessageDeflate = {}), e.clientTracking && (this.clients = /* @__PURE__ */ new Set(), this._shouldEmitClose = !1), this.options = e, this._state = c;
|
|
2380
2389
|
}
|
|
2381
2390
|
/**
|
|
2382
2391
|
* Returns the bound address, the address family name, and port of the server
|
|
@@ -2400,19 +2409,19 @@ function Rt() {
|
|
|
2400
2409
|
* @public
|
|
2401
2410
|
*/
|
|
2402
2411
|
close(e) {
|
|
2403
|
-
if (this._state ===
|
|
2412
|
+
if (this._state === C) {
|
|
2404
2413
|
e && this.once("close", () => {
|
|
2405
2414
|
e(new Error("The server is not running"));
|
|
2406
|
-
}), process.nextTick(
|
|
2415
|
+
}), process.nextTick(p, this);
|
|
2407
2416
|
return;
|
|
2408
2417
|
}
|
|
2409
|
-
if (e && this.once("close", e), this._state !==
|
|
2410
|
-
if (this._state =
|
|
2411
|
-
this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients ? this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(
|
|
2418
|
+
if (e && this.once("close", e), this._state !== b)
|
|
2419
|
+
if (this._state = b, this.options.noServer || this.options.server)
|
|
2420
|
+
this._server && (this._removeListeners(), this._removeListeners = this._server = null), this.clients ? this.clients.size ? this._shouldEmitClose = !0 : process.nextTick(p, this) : process.nextTick(p, this);
|
|
2412
2421
|
else {
|
|
2413
|
-
const
|
|
2414
|
-
this._removeListeners(), this._removeListeners = this._server = null,
|
|
2415
|
-
|
|
2422
|
+
const s = this._server;
|
|
2423
|
+
this._removeListeners(), this._removeListeners = this._server = null, s.close(() => {
|
|
2424
|
+
p(this);
|
|
2416
2425
|
});
|
|
2417
2426
|
}
|
|
2418
2427
|
}
|
|
@@ -2425,8 +2434,8 @@ function Rt() {
|
|
|
2425
2434
|
*/
|
|
2426
2435
|
shouldHandle(e) {
|
|
2427
2436
|
if (this.options.path) {
|
|
2428
|
-
const
|
|
2429
|
-
if ((
|
|
2437
|
+
const s = e.url.indexOf("?");
|
|
2438
|
+
if ((s !== -1 ? e.url.slice(0, s) : e.url) !== this.options.path) return !1;
|
|
2430
2439
|
}
|
|
2431
2440
|
return !0;
|
|
2432
2441
|
}
|
|
@@ -2439,80 +2448,80 @@ function Rt() {
|
|
|
2439
2448
|
* @param {Function} cb Callback
|
|
2440
2449
|
* @public
|
|
2441
2450
|
*/
|
|
2442
|
-
handleUpgrade(e,
|
|
2443
|
-
|
|
2444
|
-
const
|
|
2451
|
+
handleUpgrade(e, s, i, m) {
|
|
2452
|
+
s.on("error", f);
|
|
2453
|
+
const u = e.headers["sec-websocket-key"], R = e.headers.upgrade, B = +e.headers["sec-websocket-version"];
|
|
2445
2454
|
if (e.method !== "GET") {
|
|
2446
|
-
|
|
2455
|
+
w(this, e, s, 405, "Invalid HTTP method");
|
|
2447
2456
|
return;
|
|
2448
2457
|
}
|
|
2449
|
-
if (
|
|
2450
|
-
|
|
2458
|
+
if (R === void 0 || R.toLowerCase() !== "websocket") {
|
|
2459
|
+
w(this, e, s, 400, "Invalid Upgrade header");
|
|
2451
2460
|
return;
|
|
2452
2461
|
}
|
|
2453
|
-
if (
|
|
2454
|
-
|
|
2462
|
+
if (u === void 0 || !L.test(u)) {
|
|
2463
|
+
w(this, e, s, 400, "Missing or invalid Sec-WebSocket-Key header");
|
|
2455
2464
|
return;
|
|
2456
2465
|
}
|
|
2457
|
-
if (
|
|
2458
|
-
|
|
2466
|
+
if (B !== 13 && B !== 8) {
|
|
2467
|
+
w(this, e, s, 400, "Missing or invalid Sec-WebSocket-Version header", {
|
|
2459
2468
|
"Sec-WebSocket-Version": "13, 8"
|
|
2460
2469
|
});
|
|
2461
2470
|
return;
|
|
2462
2471
|
}
|
|
2463
2472
|
if (!this.shouldHandle(e)) {
|
|
2464
|
-
|
|
2473
|
+
E(s, 400);
|
|
2465
2474
|
return;
|
|
2466
2475
|
}
|
|
2467
|
-
const
|
|
2468
|
-
let
|
|
2469
|
-
if (
|
|
2476
|
+
const A = e.headers["sec-websocket-protocol"];
|
|
2477
|
+
let N = /* @__PURE__ */ new Set();
|
|
2478
|
+
if (A !== void 0)
|
|
2470
2479
|
try {
|
|
2471
|
-
|
|
2480
|
+
N = n.parse(A);
|
|
2472
2481
|
} catch {
|
|
2473
|
-
|
|
2482
|
+
w(this, e, s, 400, "Invalid Sec-WebSocket-Protocol header");
|
|
2474
2483
|
return;
|
|
2475
2484
|
}
|
|
2476
|
-
const
|
|
2477
|
-
if (this.options.perMessageDeflate &&
|
|
2478
|
-
const
|
|
2485
|
+
const G = e.headers["sec-websocket-extensions"], S = {};
|
|
2486
|
+
if (this.options.perMessageDeflate && G !== void 0) {
|
|
2487
|
+
const F = new d(
|
|
2479
2488
|
this.options.perMessageDeflate,
|
|
2480
2489
|
!0,
|
|
2481
2490
|
this.options.maxPayload
|
|
2482
2491
|
);
|
|
2483
2492
|
try {
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2493
|
+
const j = x.parse(G);
|
|
2494
|
+
j[d.extensionName] && (F.accept(j[d.extensionName]), S[d.extensionName] = F);
|
|
2486
2495
|
} catch {
|
|
2487
|
-
|
|
2496
|
+
w(this, e, s, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
|
|
2488
2497
|
return;
|
|
2489
2498
|
}
|
|
2490
2499
|
}
|
|
2491
2500
|
if (this.options.verifyClient) {
|
|
2492
|
-
const
|
|
2493
|
-
origin: e.headers[`${
|
|
2501
|
+
const F = {
|
|
2502
|
+
origin: e.headers[`${B === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
2494
2503
|
secure: !!(e.socket.authorized || e.socket.encrypted),
|
|
2495
2504
|
req: e
|
|
2496
2505
|
};
|
|
2497
2506
|
if (this.options.verifyClient.length === 2) {
|
|
2498
|
-
this.options.verifyClient(
|
|
2499
|
-
if (!
|
|
2500
|
-
return
|
|
2507
|
+
this.options.verifyClient(F, (j, ne, he, W) => {
|
|
2508
|
+
if (!j)
|
|
2509
|
+
return E(s, ne || 401, he, W);
|
|
2501
2510
|
this.completeUpgrade(
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2511
|
+
S,
|
|
2512
|
+
u,
|
|
2513
|
+
N,
|
|
2505
2514
|
e,
|
|
2506
|
-
|
|
2515
|
+
s,
|
|
2507
2516
|
i,
|
|
2508
|
-
|
|
2517
|
+
m
|
|
2509
2518
|
);
|
|
2510
2519
|
});
|
|
2511
2520
|
return;
|
|
2512
2521
|
}
|
|
2513
|
-
if (!this.options.verifyClient(
|
|
2522
|
+
if (!this.options.verifyClient(F)) return E(s, 401);
|
|
2514
2523
|
}
|
|
2515
|
-
this.completeUpgrade(
|
|
2524
|
+
this.completeUpgrade(S, u, N, e, s, i, m);
|
|
2516
2525
|
}
|
|
2517
2526
|
/**
|
|
2518
2527
|
* Upgrade the connection to WebSocket.
|
|
@@ -2527,83 +2536,83 @@ function Rt() {
|
|
|
2527
2536
|
* @throws {Error} If called more than once with the same socket
|
|
2528
2537
|
* @private
|
|
2529
2538
|
*/
|
|
2530
|
-
completeUpgrade(e,
|
|
2531
|
-
if (!
|
|
2532
|
-
if (
|
|
2539
|
+
completeUpgrade(e, s, i, m, u, R, B) {
|
|
2540
|
+
if (!u.readable || !u.writable) return u.destroy();
|
|
2541
|
+
if (u[h])
|
|
2533
2542
|
throw new Error(
|
|
2534
2543
|
"server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration"
|
|
2535
2544
|
);
|
|
2536
|
-
if (this._state >
|
|
2537
|
-
const
|
|
2545
|
+
if (this._state > c) return E(u, 503);
|
|
2546
|
+
const N = [
|
|
2538
2547
|
"HTTP/1.1 101 Switching Protocols",
|
|
2539
2548
|
"Upgrade: websocket",
|
|
2540
2549
|
"Connection: Upgrade",
|
|
2541
|
-
`Sec-WebSocket-Accept: ${
|
|
2542
|
-
],
|
|
2550
|
+
`Sec-WebSocket-Accept: ${D("sha1").update(s + _).digest("base64")}`
|
|
2551
|
+
], G = new this.options.WebSocket(null, void 0, this.options);
|
|
2543
2552
|
if (i.size) {
|
|
2544
|
-
const
|
|
2545
|
-
|
|
2553
|
+
const S = this.options.handleProtocols ? this.options.handleProtocols(i, m) : i.values().next().value;
|
|
2554
|
+
S && (N.push(`Sec-WebSocket-Protocol: ${S}`), G._protocol = S);
|
|
2546
2555
|
}
|
|
2547
2556
|
if (e[d.extensionName]) {
|
|
2548
|
-
const
|
|
2549
|
-
[d.extensionName]: [
|
|
2557
|
+
const S = e[d.extensionName].params, F = x.format({
|
|
2558
|
+
[d.extensionName]: [S]
|
|
2550
2559
|
});
|
|
2551
|
-
|
|
2560
|
+
N.push(`Sec-WebSocket-Extensions: ${F}`), G._extensions = e;
|
|
2552
2561
|
}
|
|
2553
|
-
this.emit("headers",
|
|
2562
|
+
this.emit("headers", N, m), u.write(N.concat(`\r
|
|
2554
2563
|
`).join(`\r
|
|
2555
|
-
`)),
|
|
2564
|
+
`)), u.removeListener("error", f), G.setSocket(u, R, {
|
|
2556
2565
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
2557
2566
|
maxPayload: this.options.maxPayload,
|
|
2558
2567
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
2559
|
-
}), this.clients && (this.clients.add(
|
|
2560
|
-
this.clients.delete(
|
|
2561
|
-
})),
|
|
2568
|
+
}), this.clients && (this.clients.add(G), G.on("close", () => {
|
|
2569
|
+
this.clients.delete(G), this._shouldEmitClose && !this.clients.size && process.nextTick(p, this);
|
|
2570
|
+
})), B(G, m);
|
|
2562
2571
|
}
|
|
2563
2572
|
}
|
|
2564
|
-
we =
|
|
2565
|
-
function
|
|
2566
|
-
for (const
|
|
2573
|
+
we = v;
|
|
2574
|
+
function O(t, e) {
|
|
2575
|
+
for (const s of Object.keys(e)) t.on(s, e[s]);
|
|
2567
2576
|
return function() {
|
|
2568
2577
|
for (const i of Object.keys(e))
|
|
2569
|
-
|
|
2578
|
+
t.removeListener(i, e[i]);
|
|
2570
2579
|
};
|
|
2571
2580
|
}
|
|
2572
|
-
function
|
|
2573
|
-
|
|
2581
|
+
function p(t) {
|
|
2582
|
+
t._state = C, t.emit("close");
|
|
2574
2583
|
}
|
|
2575
|
-
function
|
|
2584
|
+
function f() {
|
|
2576
2585
|
this.destroy();
|
|
2577
2586
|
}
|
|
2578
|
-
function
|
|
2579
|
-
|
|
2587
|
+
function E(t, e, s, i) {
|
|
2588
|
+
s = s || T.STATUS_CODES[e], i = {
|
|
2580
2589
|
Connection: "close",
|
|
2581
2590
|
"Content-Type": "text/html",
|
|
2582
|
-
"Content-Length": Buffer.byteLength(
|
|
2591
|
+
"Content-Length": Buffer.byteLength(s),
|
|
2583
2592
|
...i
|
|
2584
|
-
},
|
|
2593
|
+
}, t.once("finish", t.destroy), t.end(
|
|
2585
2594
|
`HTTP/1.1 ${e} ${T.STATUS_CODES[e]}\r
|
|
2586
|
-
` + Object.keys(i).map((
|
|
2595
|
+
` + Object.keys(i).map((m) => `${m}: ${i[m]}`).join(`\r
|
|
2587
2596
|
`) + `\r
|
|
2588
2597
|
\r
|
|
2589
|
-
` +
|
|
2598
|
+
` + s
|
|
2590
2599
|
);
|
|
2591
2600
|
}
|
|
2592
|
-
function
|
|
2593
|
-
if (
|
|
2594
|
-
const
|
|
2595
|
-
Error.captureStackTrace(
|
|
2601
|
+
function w(t, e, s, i, m, u) {
|
|
2602
|
+
if (t.listenerCount("wsClientError")) {
|
|
2603
|
+
const R = new Error(m);
|
|
2604
|
+
Error.captureStackTrace(R, w), t.emit("wsClientError", R, s, e);
|
|
2596
2605
|
} else
|
|
2597
|
-
|
|
2606
|
+
E(s, i, m, u);
|
|
2598
2607
|
}
|
|
2599
2608
|
return we;
|
|
2600
2609
|
}
|
|
2601
2610
|
Rt();
|
|
2602
|
-
const
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2611
|
+
const fe = global;
|
|
2612
|
+
fe.WebSocket ||= Nt;
|
|
2613
|
+
fe.window ||= global;
|
|
2614
|
+
fe.self ||= global;
|
|
2615
|
+
fe.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [
|
|
2607
2616
|
{
|
|
2608
2617
|
// ComponentFilterElementType
|
|
2609
2618
|
type: 1,
|