@vitejs/devtools-rpc 0.0.0-alpha.3 → 0.0.0-alpha.30

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.
@@ -1,24 +1,26 @@
1
- import { defineRpcServerPreset } from "../../presets-CXNlz3L-.js";
1
+ import { defineRpcServerPreset } from "../index.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { parse, stringify } from "structured-clone-es";
4
4
 
5
- //#region rolldown:runtime
5
+ //#region \0rolldown/runtime.js
6
6
  var __create = Object.create;
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
9
  var __getOwnPropNames = Object.getOwnPropertyNames;
10
10
  var __getProtoOf = Object.getPrototypeOf;
11
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
12
- var __commonJS = (cb, mod) => function() {
13
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
- };
12
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
15
13
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
17
- key = keys[i];
18
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: ((k) => from[k]).bind(null, key),
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
16
+ key = keys[i];
17
+ if (!__hasOwnProp.call(to, key) && key !== except) {
18
+ __defProp(to, key, {
19
+ get: ((k) => from[k]).bind(null, key),
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ }
22
24
  }
23
25
  return to;
24
26
  };
@@ -29,33 +31,34 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
31
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
32
 
31
33
  //#endregion
32
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js
33
- var require_constants = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js": ((exports, module) => {
34
- const BINARY_TYPES$2 = [
34
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/constants.js
35
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36
+ const BINARY_TYPES = [
35
37
  "nodebuffer",
36
38
  "arraybuffer",
37
39
  "fragments"
38
40
  ];
39
- const hasBlob$1 = typeof Blob !== "undefined";
40
- if (hasBlob$1) BINARY_TYPES$2.push("blob");
41
+ const hasBlob = typeof Blob !== "undefined";
42
+ if (hasBlob) BINARY_TYPES.push("blob");
41
43
  module.exports = {
42
- BINARY_TYPES: BINARY_TYPES$2,
44
+ BINARY_TYPES,
45
+ CLOSE_TIMEOUT: 3e4,
43
46
  EMPTY_BUFFER: Buffer.alloc(0),
44
47
  GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
45
- hasBlob: hasBlob$1,
48
+ hasBlob,
46
49
  kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
47
50
  kListener: Symbol("kListener"),
48
51
  kStatusCode: Symbol("status-code"),
49
52
  kWebSocket: Symbol("websocket"),
50
53
  NOOP: () => {}
51
54
  };
52
- }) });
55
+ }));
53
56
 
54
57
  //#endregion
55
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js
56
- var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js": ((exports, module) => {
57
- const { EMPTY_BUFFER: EMPTY_BUFFER$3 } = require_constants();
58
- const FastBuffer$2 = Buffer[Symbol.species];
58
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/buffer-util.js
59
+ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60
+ const { EMPTY_BUFFER } = require_constants();
61
+ const FastBuffer = Buffer[Symbol.species];
59
62
  /**
60
63
  * Merges an array of buffers into a new buffer.
61
64
  *
@@ -64,8 +67,8 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
64
67
  * @return {Buffer} The resulting buffer
65
68
  * @public
66
69
  */
67
- function concat$1(list, totalLength) {
68
- if (list.length === 0) return EMPTY_BUFFER$3;
70
+ function concat(list, totalLength) {
71
+ if (list.length === 0) return EMPTY_BUFFER;
69
72
  if (list.length === 1) return list[0];
70
73
  const target = Buffer.allocUnsafe(totalLength);
71
74
  let offset = 0;
@@ -74,7 +77,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
74
77
  target.set(buf, offset);
75
78
  offset += buf.length;
76
79
  }
77
- if (offset < totalLength) return new FastBuffer$2(target.buffer, target.byteOffset, offset);
80
+ if (offset < totalLength) return new FastBuffer(target.buffer, target.byteOffset, offset);
78
81
  return target;
79
82
  }
80
83
  /**
@@ -107,7 +110,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
107
110
  * @return {ArrayBuffer} Converted buffer
108
111
  * @public
109
112
  */
110
- function toArrayBuffer$1(buf) {
113
+ function toArrayBuffer(buf) {
111
114
  if (buf.length === buf.buffer.byteLength) return buf.buffer;
112
115
  return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
113
116
  }
@@ -119,49 +122,49 @@ var require_buffer_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
119
122
  * @throws {TypeError}
120
123
  * @public
121
124
  */
122
- function toBuffer$2(data) {
123
- toBuffer$2.readOnly = true;
125
+ function toBuffer(data) {
126
+ toBuffer.readOnly = true;
124
127
  if (Buffer.isBuffer(data)) return data;
125
128
  let buf;
126
- if (data instanceof ArrayBuffer) buf = new FastBuffer$2(data);
127
- else if (ArrayBuffer.isView(data)) buf = new FastBuffer$2(data.buffer, data.byteOffset, data.byteLength);
129
+ if (data instanceof ArrayBuffer) buf = new FastBuffer(data);
130
+ else if (ArrayBuffer.isView(data)) buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
128
131
  else {
129
132
  buf = Buffer.from(data);
130
- toBuffer$2.readOnly = false;
133
+ toBuffer.readOnly = false;
131
134
  }
132
135
  return buf;
133
136
  }
134
137
  module.exports = {
135
- concat: concat$1,
138
+ concat,
136
139
  mask: _mask,
137
- toArrayBuffer: toArrayBuffer$1,
138
- toBuffer: toBuffer$2,
140
+ toArrayBuffer,
141
+ toBuffer,
139
142
  unmask: _unmask
140
143
  };
141
144
  /* istanbul ignore else */
142
145
  if (!process.env.WS_NO_BUFFER_UTIL) try {
143
- const bufferUtil$1 = __require("bufferutil");
146
+ const bufferUtil = __require("bufferutil");
144
147
  module.exports.mask = function(source, mask, output, offset, length) {
145
148
  if (length < 48) _mask(source, mask, output, offset, length);
146
- else bufferUtil$1.mask(source, mask, output, offset, length);
149
+ else bufferUtil.mask(source, mask, output, offset, length);
147
150
  };
148
151
  module.exports.unmask = function(buffer, mask) {
149
152
  if (buffer.length < 32) _unmask(buffer, mask);
150
- else bufferUtil$1.unmask(buffer, mask);
153
+ else bufferUtil.unmask(buffer, mask);
151
154
  };
152
155
  } catch (e) {}
153
- }) });
156
+ }));
154
157
 
155
158
  //#endregion
156
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js
157
- var require_limiter = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js": ((exports, module) => {
159
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/limiter.js
160
+ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
158
161
  const kDone = Symbol("kDone");
159
162
  const kRun = Symbol("kRun");
160
163
  /**
161
164
  * A very simple job queue with adjustable concurrency. Adapted from
162
165
  * https://github.com/STRML/async-limiter
163
166
  */
164
- var Limiter$1 = class {
167
+ var Limiter = class {
165
168
  /**
166
169
  * Creates a new `Limiter`.
167
170
  *
@@ -201,17 +204,17 @@ var require_limiter = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@
201
204
  }
202
205
  }
203
206
  };
204
- module.exports = Limiter$1;
205
- }) });
207
+ module.exports = Limiter;
208
+ }));
206
209
 
207
210
  //#endregion
208
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js
209
- var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js": ((exports, module) => {
211
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/permessage-deflate.js
212
+ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
210
213
  const zlib = __require("zlib");
211
214
  const bufferUtil = require_buffer_util();
212
215
  const Limiter = require_limiter();
213
- const { kStatusCode: kStatusCode$2 } = require_constants();
214
- const FastBuffer$1 = Buffer[Symbol.species];
216
+ const { kStatusCode } = require_constants();
217
+ const FastBuffer = Buffer[Symbol.species];
215
218
  const TRAILER = Buffer.from([
216
219
  0,
217
220
  0,
@@ -222,12 +225,12 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
222
225
  const kTotalLength = Symbol("total-length");
223
226
  const kCallback = Symbol("callback");
224
227
  const kBuffers = Symbol("buffers");
225
- const kError$1 = Symbol("error");
228
+ const kError = Symbol("error");
226
229
  let zlibLimiter;
227
230
  /**
228
231
  * permessage-deflate implementation.
229
232
  */
230
- var PerMessageDeflate$4 = class {
233
+ var PerMessageDeflate = class {
231
234
  /**
232
235
  * Creates a PerMessageDeflate instance.
233
236
  *
@@ -260,10 +263,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
260
263
  this._deflate = null;
261
264
  this._inflate = null;
262
265
  this.params = null;
263
- if (!zlibLimiter) {
264
- const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
265
- zlibLimiter = new Limiter(concurrency);
266
- }
266
+ if (!zlibLimiter) zlibLimiter = new Limiter(this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10);
267
267
  }
268
268
  /**
269
269
  * @type {String}
@@ -441,14 +441,14 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
441
441
  this._inflate.write(data);
442
442
  if (fin) this._inflate.write(TRAILER);
443
443
  this._inflate.flush(() => {
444
- const err = this._inflate[kError$1];
444
+ const err = this._inflate[kError];
445
445
  if (err) {
446
446
  this._inflate.close();
447
447
  this._inflate = null;
448
448
  callback(err);
449
449
  return;
450
450
  }
451
- const data$1 = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
451
+ const data = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
452
452
  if (this._inflate._readableState.endEmitted) {
453
453
  this._inflate.close();
454
454
  this._inflate = null;
@@ -457,7 +457,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
457
457
  this._inflate[kBuffers] = [];
458
458
  if (fin && this.params[`${endpoint}_no_context_takeover`]) this._inflate.reset();
459
459
  }
460
- callback(null, data$1);
460
+ callback(null, data);
461
461
  });
462
462
  }
463
463
  /**
@@ -485,17 +485,17 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
485
485
  this._deflate.write(data);
486
486
  this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
487
487
  if (!this._deflate) return;
488
- let data$1 = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
489
- if (fin) data$1 = new FastBuffer$1(data$1.buffer, data$1.byteOffset, data$1.length - 4);
488
+ let data = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
489
+ if (fin) data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
490
490
  this._deflate[kCallback] = null;
491
491
  this._deflate[kTotalLength] = 0;
492
492
  this._deflate[kBuffers] = [];
493
493
  if (fin && this.params[`${endpoint}_no_context_takeover`]) this._deflate.reset();
494
- callback(null, data$1);
494
+ callback(null, data);
495
495
  });
496
496
  }
497
497
  };
498
- module.exports = PerMessageDeflate$4;
498
+ module.exports = PerMessageDeflate;
499
499
  /**
500
500
  * The listener of the `zlib.DeflateRaw` stream `'data'` event.
501
501
  *
@@ -518,9 +518,9 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
518
518
  this[kBuffers].push(chunk);
519
519
  return;
520
520
  }
521
- this[kError$1] = /* @__PURE__ */ new RangeError("Max payload size exceeded");
522
- this[kError$1].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
523
- this[kError$1][kStatusCode$2] = 1009;
521
+ this[kError] = /* @__PURE__ */ new RangeError("Max payload size exceeded");
522
+ this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
523
+ this[kError][kStatusCode] = 1009;
524
524
  this.removeListener("data", inflateOnData);
525
525
  this.reset();
526
526
  }
@@ -532,21 +532,21 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJS({ "../../node_module
532
532
  */
533
533
  function inflateOnError(err) {
534
534
  this[kPerMessageDeflate]._inflate = null;
535
- if (this[kError$1]) {
536
- this[kCallback](this[kError$1]);
535
+ if (this[kError]) {
536
+ this[kCallback](this[kError]);
537
537
  return;
538
538
  }
539
- err[kStatusCode$2] = 1007;
539
+ err[kStatusCode] = 1007;
540
540
  this[kCallback](err);
541
541
  }
542
- }) });
542
+ }));
543
543
 
544
544
  //#endregion
545
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js
546
- var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js": ((exports, module) => {
545
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/validation.js
546
+ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
547
547
  const { isUtf8 } = __require("buffer");
548
548
  const { hasBlob } = require_constants();
549
- const tokenChars$2 = [
549
+ const tokenChars = [
550
550
  0,
551
551
  0,
552
552
  0,
@@ -683,7 +683,7 @@ var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
683
683
  * @return {Boolean} `true` if the status code is valid, else `false`
684
684
  * @public
685
685
  */
686
- function isValidStatusCode$2(code) {
686
+ function isValidStatusCode(code) {
687
687
  return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
688
688
  }
689
689
  /**
@@ -718,34 +718,34 @@ var require_validation = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
718
718
  * @return {Boolean} `true` if `value` is a `Blob`, else `false`
719
719
  * @private
720
720
  */
721
- function isBlob$2(value) {
721
+ function isBlob(value) {
722
722
  return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
723
723
  }
724
724
  module.exports = {
725
- isBlob: isBlob$2,
726
- isValidStatusCode: isValidStatusCode$2,
725
+ isBlob,
726
+ isValidStatusCode,
727
727
  isValidUTF8: _isValidUTF8,
728
- tokenChars: tokenChars$2
728
+ tokenChars
729
729
  };
730
730
  if (isUtf8) module.exports.isValidUTF8 = function(buf) {
731
731
  return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
732
732
  };
733
733
  else if (!process.env.WS_NO_UTF_8_VALIDATE) try {
734
- const isValidUTF8$1 = __require("utf-8-validate");
734
+ const isValidUTF8 = __require("utf-8-validate");
735
735
  module.exports.isValidUTF8 = function(buf) {
736
- return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8$1(buf);
736
+ return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
737
737
  };
738
738
  } catch (e) {}
739
- }) });
739
+ }));
740
740
 
741
741
  //#endregion
742
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js
743
- var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js": ((exports, module) => {
742
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/receiver.js
743
+ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
744
744
  const { Writable } = __require("stream");
745
- const PerMessageDeflate$3 = require_permessage_deflate();
746
- const { BINARY_TYPES: BINARY_TYPES$1, EMPTY_BUFFER: EMPTY_BUFFER$2, kStatusCode: kStatusCode$1, kWebSocket: kWebSocket$3 } = require_constants();
745
+ const PerMessageDeflate = require_permessage_deflate();
746
+ const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = require_constants();
747
747
  const { concat, toArrayBuffer, unmask } = require_buffer_util();
748
- const { isValidStatusCode: isValidStatusCode$1, isValidUTF8 } = require_validation();
748
+ const { isValidStatusCode, isValidUTF8 } = require_validation();
749
749
  const FastBuffer = Buffer[Symbol.species];
750
750
  const GET_INFO = 0;
751
751
  const GET_PAYLOAD_LENGTH_16 = 1;
@@ -759,7 +759,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
759
759
  *
760
760
  * @extends Writable
761
761
  */
762
- var Receiver$2 = class extends Writable {
762
+ var Receiver = class extends Writable {
763
763
  /**
764
764
  * Creates a Receiver instance.
765
765
  *
@@ -779,12 +779,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
779
779
  constructor(options = {}) {
780
780
  super();
781
781
  this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
782
- this._binaryType = options.binaryType || BINARY_TYPES$1[0];
782
+ this._binaryType = options.binaryType || BINARY_TYPES[0];
783
783
  this._extensions = options.extensions || {};
784
784
  this._isServer = !!options.isServer;
785
785
  this._maxPayload = options.maxPayload | 0;
786
786
  this._skipUTF8Validation = !!options.skipUTF8Validation;
787
- this[kWebSocket$3] = void 0;
787
+ this[kWebSocket] = void 0;
788
788
  this._bufferedBytes = 0;
789
789
  this._buffers = [];
790
790
  this._compressed = false;
@@ -889,14 +889,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
889
889
  }
890
890
  const buf = this.consume(2);
891
891
  if ((buf[0] & 48) !== 0) {
892
- const error = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
893
- cb(error);
892
+ cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
894
893
  return;
895
894
  }
896
895
  const compressed = (buf[0] & 64) === 64;
897
- if (compressed && !this._extensions[PerMessageDeflate$3.extensionName]) {
898
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
899
- cb(error);
896
+ if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
897
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
900
898
  return;
901
899
  }
902
900
  this._fin = (buf[0] & 128) === 128;
@@ -904,55 +902,46 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
904
902
  this._payloadLength = buf[1] & 127;
905
903
  if (this._opcode === 0) {
906
904
  if (compressed) {
907
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
908
- cb(error);
905
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
909
906
  return;
910
907
  }
911
908
  if (!this._fragmented) {
912
- const error = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
913
- cb(error);
909
+ cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
914
910
  return;
915
911
  }
916
912
  this._opcode = this._fragmented;
917
913
  } else if (this._opcode === 1 || this._opcode === 2) {
918
914
  if (this._fragmented) {
919
- const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
920
- cb(error);
915
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
921
916
  return;
922
917
  }
923
918
  this._compressed = compressed;
924
919
  } else if (this._opcode > 7 && this._opcode < 11) {
925
920
  if (!this._fin) {
926
- const error = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
927
- cb(error);
921
+ cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
928
922
  return;
929
923
  }
930
924
  if (compressed) {
931
- const error = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
932
- cb(error);
925
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
933
926
  return;
934
927
  }
935
928
  if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
936
- const error = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
937
- cb(error);
929
+ cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
938
930
  return;
939
931
  }
940
932
  } else {
941
- const error = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
942
- cb(error);
933
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
943
934
  return;
944
935
  }
945
936
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
946
937
  this._masked = (buf[1] & 128) === 128;
947
938
  if (this._isServer) {
948
939
  if (!this._masked) {
949
- const error = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
950
- cb(error);
940
+ cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
951
941
  return;
952
942
  }
953
943
  } else if (this._masked) {
954
- const error = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
955
- cb(error);
944
+ cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
956
945
  return;
957
946
  }
958
947
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
@@ -987,8 +976,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
987
976
  const buf = this.consume(8);
988
977
  const num = buf.readUInt32BE(0);
989
978
  if (num > Math.pow(2, 21) - 1) {
990
- const error = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
991
- cb(error);
979
+ cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
992
980
  return;
993
981
  }
994
982
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
@@ -1004,8 +992,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1004
992
  if (this._payloadLength && this._opcode < 8) {
1005
993
  this._totalPayloadLength += this._payloadLength;
1006
994
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
1007
- const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
1008
- cb(error);
995
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
1009
996
  return;
1010
997
  }
1011
998
  }
@@ -1032,7 +1019,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1032
1019
  * @private
1033
1020
  */
1034
1021
  getData(cb) {
1035
- let data = EMPTY_BUFFER$2;
1022
+ let data = EMPTY_BUFFER;
1036
1023
  if (this._payloadLength) {
1037
1024
  if (this._bufferedBytes < this._payloadLength) {
1038
1025
  this._loop = false;
@@ -1064,13 +1051,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1064
1051
  * @private
1065
1052
  */
1066
1053
  decompress(data, cb) {
1067
- this._extensions[PerMessageDeflate$3.extensionName].decompress(data, this._fin, (err, buf) => {
1054
+ this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
1068
1055
  if (err) return cb(err);
1069
1056
  if (buf.length) {
1070
1057
  this._messageLength += buf.length;
1071
1058
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
1072
- const error = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
1073
- cb(error);
1059
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
1074
1060
  return;
1075
1061
  }
1076
1062
  this._fragments.push(buf);
@@ -1116,8 +1102,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1116
1102
  } else {
1117
1103
  const buf = concat(fragments, messageLength);
1118
1104
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1119
- const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
1120
- cb(error);
1105
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
1121
1106
  return;
1122
1107
  }
1123
1108
  if (this._state === INFLATING || this._allowSynchronousEvents) {
@@ -1144,19 +1129,17 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1144
1129
  if (this._opcode === 8) {
1145
1130
  if (data.length === 0) {
1146
1131
  this._loop = false;
1147
- this.emit("conclude", 1005, EMPTY_BUFFER$2);
1132
+ this.emit("conclude", 1005, EMPTY_BUFFER);
1148
1133
  this.end();
1149
1134
  } else {
1150
1135
  const code = data.readUInt16BE(0);
1151
- if (!isValidStatusCode$1(code)) {
1152
- const error = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
1153
- cb(error);
1136
+ if (!isValidStatusCode(code)) {
1137
+ cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
1154
1138
  return;
1155
1139
  }
1156
1140
  const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
1157
1141
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1158
- const error = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
1159
- cb(error);
1142
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
1160
1143
  return;
1161
1144
  }
1162
1145
  this._loop = false;
@@ -1196,22 +1179,22 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
1196
1179
  const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
1197
1180
  Error.captureStackTrace(err, this.createError);
1198
1181
  err.code = errorCode;
1199
- err[kStatusCode$1] = statusCode;
1182
+ err[kStatusCode] = statusCode;
1200
1183
  return err;
1201
1184
  }
1202
1185
  };
1203
- module.exports = Receiver$2;
1204
- }) });
1186
+ module.exports = Receiver;
1187
+ }));
1205
1188
 
1206
1189
  //#endregion
1207
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js
1208
- var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js": ((exports, module) => {
1190
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/sender.js
1191
+ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1209
1192
  const { Duplex: Duplex$3 } = __require("stream");
1210
1193
  const { randomFillSync } = __require("crypto");
1211
- const PerMessageDeflate$2 = require_permessage_deflate();
1212
- const { EMPTY_BUFFER: EMPTY_BUFFER$1, kWebSocket: kWebSocket$2, NOOP: NOOP$2 } = require_constants();
1213
- const { isBlob: isBlob$1, isValidStatusCode } = require_validation();
1214
- const { mask: applyMask, toBuffer: toBuffer$1 } = require_buffer_util();
1194
+ const PerMessageDeflate = require_permessage_deflate();
1195
+ const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
1196
+ const { isBlob, isValidStatusCode } = require_validation();
1197
+ const { mask: applyMask, toBuffer } = require_buffer_util();
1215
1198
  const kByteLength = Symbol("kByteLength");
1216
1199
  const maskBuffer = Buffer.alloc(4);
1217
1200
  const RANDOM_POOL_SIZE = 8 * 1024;
@@ -1223,7 +1206,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1223
1206
  /**
1224
1207
  * HyBi Sender implementation.
1225
1208
  */
1226
- var Sender$2 = class Sender$2 {
1209
+ var Sender = class Sender {
1227
1210
  /**
1228
1211
  * Creates a Sender instance.
1229
1212
  *
@@ -1244,8 +1227,8 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1244
1227
  this._bufferedBytes = 0;
1245
1228
  this._queue = [];
1246
1229
  this._state = DEFAULT;
1247
- this.onerror = NOOP$2;
1248
- this[kWebSocket$2] = void 0;
1230
+ this.onerror = NOOP;
1231
+ this[kWebSocket] = void 0;
1249
1232
  }
1250
1233
  /**
1251
1234
  * Frames a piece of data according to the HyBi WebSocket protocol.
@@ -1343,7 +1326,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1343
1326
  */
1344
1327
  close(code, data, mask, cb) {
1345
1328
  let buf;
1346
- if (code === void 0) buf = EMPTY_BUFFER$1;
1329
+ if (code === void 0) buf = EMPTY_BUFFER;
1347
1330
  else if (typeof code !== "number" || !isValidStatusCode(code)) throw new TypeError("First argument must be a valid error code number");
1348
1331
  else if (data === void 0 || !data.length) {
1349
1332
  buf = Buffer.allocUnsafe(2);
@@ -1373,7 +1356,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1373
1356
  options,
1374
1357
  cb
1375
1358
  ]);
1376
- else this.sendFrame(Sender$2.frame(buf, options), cb);
1359
+ else this.sendFrame(Sender.frame(buf, options), cb);
1377
1360
  }
1378
1361
  /**
1379
1362
  * Sends a ping message to the other peer.
@@ -1389,13 +1372,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1389
1372
  if (typeof data === "string") {
1390
1373
  byteLength = Buffer.byteLength(data);
1391
1374
  readOnly = false;
1392
- } else if (isBlob$1(data)) {
1375
+ } else if (isBlob(data)) {
1393
1376
  byteLength = data.size;
1394
1377
  readOnly = false;
1395
1378
  } else {
1396
- data = toBuffer$1(data);
1379
+ data = toBuffer(data);
1397
1380
  byteLength = data.length;
1398
- readOnly = toBuffer$1.readOnly;
1381
+ readOnly = toBuffer.readOnly;
1399
1382
  }
1400
1383
  if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
1401
1384
  const options = {
@@ -1408,7 +1391,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1408
1391
  readOnly,
1409
1392
  rsv1: false
1410
1393
  };
1411
- if (isBlob$1(data)) if (this._state !== DEFAULT) this.enqueue([
1394
+ if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1412
1395
  this.getBlobData,
1413
1396
  data,
1414
1397
  false,
@@ -1423,7 +1406,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1423
1406
  options,
1424
1407
  cb
1425
1408
  ]);
1426
- else this.sendFrame(Sender$2.frame(data, options), cb);
1409
+ else this.sendFrame(Sender.frame(data, options), cb);
1427
1410
  }
1428
1411
  /**
1429
1412
  * Sends a pong message to the other peer.
@@ -1439,13 +1422,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1439
1422
  if (typeof data === "string") {
1440
1423
  byteLength = Buffer.byteLength(data);
1441
1424
  readOnly = false;
1442
- } else if (isBlob$1(data)) {
1425
+ } else if (isBlob(data)) {
1443
1426
  byteLength = data.size;
1444
1427
  readOnly = false;
1445
1428
  } else {
1446
- data = toBuffer$1(data);
1429
+ data = toBuffer(data);
1447
1430
  byteLength = data.length;
1448
- readOnly = toBuffer$1.readOnly;
1431
+ readOnly = toBuffer.readOnly;
1449
1432
  }
1450
1433
  if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
1451
1434
  const options = {
@@ -1458,7 +1441,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1458
1441
  readOnly,
1459
1442
  rsv1: false
1460
1443
  };
1461
- if (isBlob$1(data)) if (this._state !== DEFAULT) this.enqueue([
1444
+ if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1462
1445
  this.getBlobData,
1463
1446
  data,
1464
1447
  false,
@@ -1473,7 +1456,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1473
1456
  options,
1474
1457
  cb
1475
1458
  ]);
1476
- else this.sendFrame(Sender$2.frame(data, options), cb);
1459
+ else this.sendFrame(Sender.frame(data, options), cb);
1477
1460
  }
1478
1461
  /**
1479
1462
  * Sends a data message to the other peer.
@@ -1492,7 +1475,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1492
1475
  * @public
1493
1476
  */
1494
1477
  send(data, options, cb) {
1495
- const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
1478
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
1496
1479
  let opcode = options.binary ? 2 : 1;
1497
1480
  let rsv1 = options.compress;
1498
1481
  let byteLength;
@@ -1500,13 +1483,13 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1500
1483
  if (typeof data === "string") {
1501
1484
  byteLength = Buffer.byteLength(data);
1502
1485
  readOnly = false;
1503
- } else if (isBlob$1(data)) {
1486
+ } else if (isBlob(data)) {
1504
1487
  byteLength = data.size;
1505
1488
  readOnly = false;
1506
1489
  } else {
1507
- data = toBuffer$1(data);
1490
+ data = toBuffer(data);
1508
1491
  byteLength = data.length;
1509
- readOnly = toBuffer$1.readOnly;
1492
+ readOnly = toBuffer.readOnly;
1510
1493
  }
1511
1494
  if (this._firstFragment) {
1512
1495
  this._firstFragment = false;
@@ -1527,7 +1510,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1527
1510
  readOnly,
1528
1511
  rsv1
1529
1512
  };
1530
- if (isBlob$1(data)) if (this._state !== DEFAULT) this.enqueue([
1513
+ if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1531
1514
  this.getBlobData,
1532
1515
  data,
1533
1516
  this._compress,
@@ -1577,10 +1560,10 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1577
1560
  return;
1578
1561
  }
1579
1562
  this._bufferedBytes -= options[kByteLength];
1580
- const data = toBuffer$1(arrayBuffer);
1563
+ const data = toBuffer(arrayBuffer);
1581
1564
  if (!compress) {
1582
1565
  this._state = DEFAULT;
1583
- this.sendFrame(Sender$2.frame(data, options), cb);
1566
+ this.sendFrame(Sender.frame(data, options), cb);
1584
1567
  this.dequeue();
1585
1568
  } else this.dispatch(data, compress, options, cb);
1586
1569
  }).catch((err) => {
@@ -1612,10 +1595,10 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1612
1595
  */
1613
1596
  dispatch(data, compress, options, cb) {
1614
1597
  if (!compress) {
1615
- this.sendFrame(Sender$2.frame(data, options), cb);
1598
+ this.sendFrame(Sender.frame(data, options), cb);
1616
1599
  return;
1617
1600
  }
1618
- const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
1601
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
1619
1602
  this._bufferedBytes += options[kByteLength];
1620
1603
  this._state = DEFLATING;
1621
1604
  perMessageDeflate.compress(data, options.fin, (_, buf) => {
@@ -1626,7 +1609,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1626
1609
  this._bufferedBytes -= options[kByteLength];
1627
1610
  this._state = DEFAULT;
1628
1611
  options.readOnly = false;
1629
- this.sendFrame(Sender$2.frame(buf, options), cb);
1612
+ this.sendFrame(Sender.frame(buf, options), cb);
1630
1613
  this.dequeue();
1631
1614
  });
1632
1615
  }
@@ -1668,7 +1651,7 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1668
1651
  } else this._socket.write(list[0], cb);
1669
1652
  }
1670
1653
  };
1671
- module.exports = Sender$2;
1654
+ module.exports = Sender;
1672
1655
  /**
1673
1656
  * Calls queued callbacks with an error.
1674
1657
  *
@@ -1697,12 +1680,12 @@ var require_sender = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
1697
1680
  callCallbacks(sender, err, cb);
1698
1681
  sender.onerror(err);
1699
1682
  }
1700
- }) });
1683
+ }));
1701
1684
 
1702
1685
  //#endregion
1703
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js
1704
- var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js": ((exports, module) => {
1705
- const { kForOnEventAttribute: kForOnEventAttribute$1, kListener: kListener$1 } = require_constants();
1686
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/event-target.js
1687
+ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1688
+ const { kForOnEventAttribute, kListener } = require_constants();
1706
1689
  const kCode = Symbol("kCode");
1707
1690
  const kData = Symbol("kData");
1708
1691
  const kError = Symbol("kError");
@@ -1856,7 +1839,7 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
1856
1839
  */
1857
1840
  const EventTarget = {
1858
1841
  addEventListener(type, handler, options = {}) {
1859
- for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute$1] && listener[kListener$1] === handler && !listener[kForOnEventAttribute$1]) return;
1842
+ for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
1860
1843
  let wrapper;
1861
1844
  if (type === "message") wrapper = function onMessage(data, isBinary) {
1862
1845
  const event = new MessageEvent("message", { data: isBinary ? data : data.toString() });
@@ -1872,7 +1855,7 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
1872
1855
  event[kTarget] = this;
1873
1856
  callListener(handler, this, event);
1874
1857
  };
1875
- else if (type === "error") wrapper = function onError$1(error) {
1858
+ else if (type === "error") wrapper = function onError(error) {
1876
1859
  const event = new ErrorEvent("error", {
1877
1860
  error,
1878
1861
  message: error.message
@@ -1886,13 +1869,13 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
1886
1869
  callListener(handler, this, event);
1887
1870
  };
1888
1871
  else return;
1889
- wrapper[kForOnEventAttribute$1] = !!options[kForOnEventAttribute$1];
1890
- wrapper[kListener$1] = handler;
1872
+ wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
1873
+ wrapper[kListener] = handler;
1891
1874
  if (options.once) this.once(type, wrapper);
1892
1875
  else this.on(type, wrapper);
1893
1876
  },
1894
1877
  removeEventListener(type, handler) {
1895
- for (const listener of this.listeners(type)) if (listener[kListener$1] === handler && !listener[kForOnEventAttribute$1]) {
1878
+ for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
1896
1879
  this.removeListener(type, listener);
1897
1880
  break;
1898
1881
  }
@@ -1917,12 +1900,12 @@ var require_event_target = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
1917
1900
  if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
1918
1901
  else listener.call(thisArg, event);
1919
1902
  }
1920
- }) });
1903
+ }));
1921
1904
 
1922
1905
  //#endregion
1923
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js
1924
- var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js": ((exports, module) => {
1925
- const { tokenChars: tokenChars$1 } = require_validation();
1906
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/extension.js
1907
+ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1908
+ const { tokenChars } = require_validation();
1926
1909
  /**
1927
1910
  * Adds an offer to the map of extension offers or a parameter to the map of
1928
1911
  * parameters.
@@ -1944,7 +1927,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
1944
1927
  * @return {Object} The parsed object
1945
1928
  * @public
1946
1929
  */
1947
- function parse$3(header) {
1930
+ function parse(header) {
1948
1931
  const offers = Object.create(null);
1949
1932
  let params = Object.create(null);
1950
1933
  let mustUnescape = false;
@@ -1958,7 +1941,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
1958
1941
  let i = 0;
1959
1942
  for (; i < header.length; i++) {
1960
1943
  code = header.charCodeAt(i);
1961
- if (extensionName === void 0) if (end === -1 && tokenChars$1[code] === 1) {
1944
+ if (extensionName === void 0) if (end === -1 && tokenChars[code] === 1) {
1962
1945
  if (start === -1) start = i;
1963
1946
  } else if (i !== 0 && (code === 32 || code === 9)) {
1964
1947
  if (end === -1 && start !== -1) end = i;
@@ -1972,7 +1955,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
1972
1955
  } else extensionName = name;
1973
1956
  start = end = -1;
1974
1957
  } else throw new SyntaxError(`Unexpected character at index ${i}`);
1975
- else if (paramName === void 0) if (end === -1 && tokenChars$1[code] === 1) {
1958
+ else if (paramName === void 0) if (end === -1 && tokenChars[code] === 1) {
1976
1959
  if (start === -1) start = i;
1977
1960
  } else if (code === 32 || code === 9) {
1978
1961
  if (end === -1 && start !== -1) end = i;
@@ -1991,11 +1974,11 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
1991
1974
  start = end = -1;
1992
1975
  } else throw new SyntaxError(`Unexpected character at index ${i}`);
1993
1976
  else if (isEscaping) {
1994
- if (tokenChars$1[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
1977
+ if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
1995
1978
  if (start === -1) start = i;
1996
1979
  else if (!mustUnescape) mustUnescape = true;
1997
1980
  isEscaping = false;
1998
- } else if (inQuotes) if (tokenChars$1[code] === 1) {
1981
+ } else if (inQuotes) if (tokenChars[code] === 1) {
1999
1982
  if (start === -1) start = i;
2000
1983
  } else if (code === 34 && start !== -1) {
2001
1984
  inQuotes = false;
@@ -2003,7 +1986,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2003
1986
  } else if (code === 92) isEscaping = true;
2004
1987
  else throw new SyntaxError(`Unexpected character at index ${i}`);
2005
1988
  else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
2006
- else if (end === -1 && tokenChars$1[code] === 1) {
1989
+ else if (end === -1 && tokenChars[code] === 1) {
2007
1990
  if (start === -1) start = i;
2008
1991
  } else if (start !== -1 && (code === 32 || code === 9)) {
2009
1992
  if (end === -1) end = i;
@@ -2044,12 +2027,12 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2044
2027
  * @return {String} A string representing the given object
2045
2028
  * @public
2046
2029
  */
2047
- function format$1(extensions) {
2048
- return Object.keys(extensions).map((extension$1) => {
2049
- let configurations = extensions[extension$1];
2030
+ function format(extensions) {
2031
+ return Object.keys(extensions).map((extension) => {
2032
+ let configurations = extensions[extension];
2050
2033
  if (!Array.isArray(configurations)) configurations = [configurations];
2051
2034
  return configurations.map((params) => {
2052
- return [extension$1].concat(Object.keys(params).map((k) => {
2035
+ return [extension].concat(Object.keys(params).map((k) => {
2053
2036
  let values = params[k];
2054
2037
  if (!Array.isArray(values)) values = [values];
2055
2038
  return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
@@ -2058,14 +2041,14 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2058
2041
  }).join(", ");
2059
2042
  }
2060
2043
  module.exports = {
2061
- format: format$1,
2062
- parse: parse$3
2044
+ format,
2045
+ parse
2063
2046
  };
2064
- }) });
2047
+ }));
2065
2048
 
2066
2049
  //#endregion
2067
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
2068
- var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js": ((exports, module) => {
2050
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket.js
2051
+ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2069
2052
  const EventEmitter$1 = __require("events");
2070
2053
  const https = __require("https");
2071
2054
  const http$1 = __require("http");
@@ -2074,15 +2057,14 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2074
2057
  const { randomBytes, createHash: createHash$1 } = __require("crypto");
2075
2058
  const { Duplex: Duplex$2, Readable } = __require("stream");
2076
2059
  const { URL } = __require("url");
2077
- const PerMessageDeflate$1 = require_permessage_deflate();
2078
- const Receiver$1 = require_receiver();
2079
- const Sender$1 = require_sender();
2060
+ const PerMessageDeflate = require_permessage_deflate();
2061
+ const Receiver = require_receiver();
2062
+ const Sender = require_sender();
2080
2063
  const { isBlob } = require_validation();
2081
- const { BINARY_TYPES, EMPTY_BUFFER, GUID: GUID$1, kForOnEventAttribute, kListener, kStatusCode, kWebSocket: kWebSocket$1, NOOP: NOOP$1 } = require_constants();
2064
+ const { BINARY_TYPES, CLOSE_TIMEOUT, EMPTY_BUFFER, GUID, kForOnEventAttribute, kListener, kStatusCode, kWebSocket, NOOP } = require_constants();
2082
2065
  const { EventTarget: { addEventListener, removeEventListener } } = require_event_target();
2083
- const { format, parse: parse$2 } = require_extension();
2066
+ const { format, parse } = require_extension();
2084
2067
  const { toBuffer } = require_buffer_util();
2085
- const closeTimeout = 30 * 1e3;
2086
2068
  const kAborted = Symbol("kAborted");
2087
2069
  const protocolVersions = [8, 13];
2088
2070
  const readyStates = [
@@ -2097,7 +2079,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2097
2079
  *
2098
2080
  * @extends EventEmitter
2099
2081
  */
2100
- var WebSocket$2 = class WebSocket$2 extends EventEmitter$1 {
2082
+ var WebSocket = class WebSocket extends EventEmitter$1 {
2101
2083
  /**
2102
2084
  * Create a new `WebSocket`.
2103
2085
  *
@@ -2117,7 +2099,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2117
2099
  this._extensions = {};
2118
2100
  this._paused = false;
2119
2101
  this._protocol = "";
2120
- this._readyState = WebSocket$2.CONNECTING;
2102
+ this._readyState = WebSocket.CONNECTING;
2121
2103
  this._receiver = null;
2122
2104
  this._sender = null;
2123
2105
  this._socket = null;
@@ -2133,6 +2115,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2133
2115
  initAsClient(this, address, protocols, options);
2134
2116
  } else {
2135
2117
  this._autoPong = options.autoPong;
2118
+ this._closeTimeout = options.closeTimeout;
2136
2119
  this._isServer = true;
2137
2120
  }
2138
2121
  }
@@ -2232,7 +2215,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2232
2215
  * @private
2233
2216
  */
2234
2217
  setSocket(socket, head, options) {
2235
- const receiver = new Receiver$1({
2218
+ const receiver = new Receiver({
2236
2219
  allowSynchronousEvents: options.allowSynchronousEvents,
2237
2220
  binaryType: this.binaryType,
2238
2221
  extensions: this._extensions,
@@ -2240,13 +2223,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2240
2223
  maxPayload: options.maxPayload,
2241
2224
  skipUTF8Validation: options.skipUTF8Validation
2242
2225
  });
2243
- const sender = new Sender$1(socket, this._extensions, options.generateMask);
2226
+ const sender = new Sender(socket, this._extensions, options.generateMask);
2244
2227
  this._receiver = receiver;
2245
2228
  this._sender = sender;
2246
2229
  this._socket = socket;
2247
- receiver[kWebSocket$1] = this;
2248
- sender[kWebSocket$1] = this;
2249
- socket[kWebSocket$1] = this;
2230
+ receiver[kWebSocket] = this;
2231
+ sender[kWebSocket] = this;
2232
+ socket[kWebSocket] = this;
2250
2233
  receiver.on("conclude", receiverOnConclude);
2251
2234
  receiver.on("drain", receiverOnDrain);
2252
2235
  receiver.on("error", receiverOnError);
@@ -2260,8 +2243,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2260
2243
  socket.on("close", socketOnClose);
2261
2244
  socket.on("data", socketOnData);
2262
2245
  socket.on("end", socketOnEnd);
2263
- socket.on("error", socketOnError$1);
2264
- this._readyState = WebSocket$2.OPEN;
2246
+ socket.on("error", socketOnError);
2247
+ this._readyState = WebSocket.OPEN;
2265
2248
  this.emit("open");
2266
2249
  }
2267
2250
  /**
@@ -2271,13 +2254,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2271
2254
  */
2272
2255
  emitClose() {
2273
2256
  if (!this._socket) {
2274
- this._readyState = WebSocket$2.CLOSED;
2257
+ this._readyState = WebSocket.CLOSED;
2275
2258
  this.emit("close", this._closeCode, this._closeMessage);
2276
2259
  return;
2277
2260
  }
2278
- if (this._extensions[PerMessageDeflate$1.extensionName]) this._extensions[PerMessageDeflate$1.extensionName].cleanup();
2261
+ if (this._extensions[PerMessageDeflate.extensionName]) this._extensions[PerMessageDeflate.extensionName].cleanup();
2279
2262
  this._receiver.removeAllListeners();
2280
- this._readyState = WebSocket$2.CLOSED;
2263
+ this._readyState = WebSocket.CLOSED;
2281
2264
  this.emit("close", this._closeCode, this._closeMessage);
2282
2265
  }
2283
2266
  /**
@@ -2301,16 +2284,16 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2301
2284
  * @public
2302
2285
  */
2303
2286
  close(code, data) {
2304
- if (this.readyState === WebSocket$2.CLOSED) return;
2305
- if (this.readyState === WebSocket$2.CONNECTING) {
2306
- abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
2287
+ if (this.readyState === WebSocket.CLOSED) return;
2288
+ if (this.readyState === WebSocket.CONNECTING) {
2289
+ abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
2307
2290
  return;
2308
2291
  }
2309
- if (this.readyState === WebSocket$2.CLOSING) {
2292
+ if (this.readyState === WebSocket.CLOSING) {
2310
2293
  if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
2311
2294
  return;
2312
2295
  }
2313
- this._readyState = WebSocket$2.CLOSING;
2296
+ this._readyState = WebSocket.CLOSING;
2314
2297
  this._sender.close(code, data, !this._isServer, (err) => {
2315
2298
  if (err) return;
2316
2299
  this._closeFrameSent = true;
@@ -2324,7 +2307,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2324
2307
  * @public
2325
2308
  */
2326
2309
  pause() {
2327
- if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
2310
+ if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
2328
2311
  this._paused = true;
2329
2312
  this._socket.pause();
2330
2313
  }
@@ -2337,7 +2320,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2337
2320
  * @public
2338
2321
  */
2339
2322
  ping(data, mask, cb) {
2340
- if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2323
+ if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2341
2324
  if (typeof data === "function") {
2342
2325
  cb = data;
2343
2326
  data = mask = void 0;
@@ -2346,7 +2329,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2346
2329
  mask = void 0;
2347
2330
  }
2348
2331
  if (typeof data === "number") data = data.toString();
2349
- if (this.readyState !== WebSocket$2.OPEN) {
2332
+ if (this.readyState !== WebSocket.OPEN) {
2350
2333
  sendAfterClose(this, data, cb);
2351
2334
  return;
2352
2335
  }
@@ -2362,7 +2345,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2362
2345
  * @public
2363
2346
  */
2364
2347
  pong(data, mask, cb) {
2365
- if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2348
+ if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2366
2349
  if (typeof data === "function") {
2367
2350
  cb = data;
2368
2351
  data = mask = void 0;
@@ -2371,7 +2354,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2371
2354
  mask = void 0;
2372
2355
  }
2373
2356
  if (typeof data === "number") data = data.toString();
2374
- if (this.readyState !== WebSocket$2.OPEN) {
2357
+ if (this.readyState !== WebSocket.OPEN) {
2375
2358
  sendAfterClose(this, data, cb);
2376
2359
  return;
2377
2360
  }
@@ -2384,7 +2367,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2384
2367
  * @public
2385
2368
  */
2386
2369
  resume() {
2387
- if (this.readyState === WebSocket$2.CONNECTING || this.readyState === WebSocket$2.CLOSED) return;
2370
+ if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
2388
2371
  this._paused = false;
2389
2372
  if (!this._receiver._writableState.needDrain) this._socket.resume();
2390
2373
  }
@@ -2404,13 +2387,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2404
2387
  * @public
2405
2388
  */
2406
2389
  send(data, options, cb) {
2407
- if (this.readyState === WebSocket$2.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2390
+ if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2408
2391
  if (typeof options === "function") {
2409
2392
  cb = options;
2410
2393
  options = {};
2411
2394
  }
2412
2395
  if (typeof data === "number") data = data.toString();
2413
- if (this.readyState !== WebSocket$2.OPEN) {
2396
+ if (this.readyState !== WebSocket.OPEN) {
2414
2397
  sendAfterClose(this, data, cb);
2415
2398
  return;
2416
2399
  }
@@ -2421,7 +2404,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2421
2404
  fin: true,
2422
2405
  ...options
2423
2406
  };
2424
- if (!this._extensions[PerMessageDeflate$1.extensionName]) opts.compress = false;
2407
+ if (!this._extensions[PerMessageDeflate.extensionName]) opts.compress = false;
2425
2408
  this._sender.send(data || EMPTY_BUFFER, opts, cb);
2426
2409
  }
2427
2410
  /**
@@ -2430,13 +2413,13 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2430
2413
  * @public
2431
2414
  */
2432
2415
  terminate() {
2433
- if (this.readyState === WebSocket$2.CLOSED) return;
2434
- if (this.readyState === WebSocket$2.CONNECTING) {
2435
- abortHandshake$1(this, this._req, "WebSocket was closed before the connection was established");
2416
+ if (this.readyState === WebSocket.CLOSED) return;
2417
+ if (this.readyState === WebSocket.CONNECTING) {
2418
+ abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
2436
2419
  return;
2437
2420
  }
2438
2421
  if (this._socket) {
2439
- this._readyState = WebSocket$2.CLOSING;
2422
+ this._readyState = WebSocket.CLOSING;
2440
2423
  this._socket.destroy();
2441
2424
  }
2442
2425
  }
@@ -2445,7 +2428,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2445
2428
  * @constant {Number} CONNECTING
2446
2429
  * @memberof WebSocket
2447
2430
  */
2448
- Object.defineProperty(WebSocket$2, "CONNECTING", {
2431
+ Object.defineProperty(WebSocket, "CONNECTING", {
2449
2432
  enumerable: true,
2450
2433
  value: readyStates.indexOf("CONNECTING")
2451
2434
  });
@@ -2453,7 +2436,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2453
2436
  * @constant {Number} CONNECTING
2454
2437
  * @memberof WebSocket.prototype
2455
2438
  */
2456
- Object.defineProperty(WebSocket$2.prototype, "CONNECTING", {
2439
+ Object.defineProperty(WebSocket.prototype, "CONNECTING", {
2457
2440
  enumerable: true,
2458
2441
  value: readyStates.indexOf("CONNECTING")
2459
2442
  });
@@ -2461,7 +2444,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2461
2444
  * @constant {Number} OPEN
2462
2445
  * @memberof WebSocket
2463
2446
  */
2464
- Object.defineProperty(WebSocket$2, "OPEN", {
2447
+ Object.defineProperty(WebSocket, "OPEN", {
2465
2448
  enumerable: true,
2466
2449
  value: readyStates.indexOf("OPEN")
2467
2450
  });
@@ -2469,7 +2452,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2469
2452
  * @constant {Number} OPEN
2470
2453
  * @memberof WebSocket.prototype
2471
2454
  */
2472
- Object.defineProperty(WebSocket$2.prototype, "OPEN", {
2455
+ Object.defineProperty(WebSocket.prototype, "OPEN", {
2473
2456
  enumerable: true,
2474
2457
  value: readyStates.indexOf("OPEN")
2475
2458
  });
@@ -2477,7 +2460,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2477
2460
  * @constant {Number} CLOSING
2478
2461
  * @memberof WebSocket
2479
2462
  */
2480
- Object.defineProperty(WebSocket$2, "CLOSING", {
2463
+ Object.defineProperty(WebSocket, "CLOSING", {
2481
2464
  enumerable: true,
2482
2465
  value: readyStates.indexOf("CLOSING")
2483
2466
  });
@@ -2485,7 +2468,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2485
2468
  * @constant {Number} CLOSING
2486
2469
  * @memberof WebSocket.prototype
2487
2470
  */
2488
- Object.defineProperty(WebSocket$2.prototype, "CLOSING", {
2471
+ Object.defineProperty(WebSocket.prototype, "CLOSING", {
2489
2472
  enumerable: true,
2490
2473
  value: readyStates.indexOf("CLOSING")
2491
2474
  });
@@ -2493,7 +2476,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2493
2476
  * @constant {Number} CLOSED
2494
2477
  * @memberof WebSocket
2495
2478
  */
2496
- Object.defineProperty(WebSocket$2, "CLOSED", {
2479
+ Object.defineProperty(WebSocket, "CLOSED", {
2497
2480
  enumerable: true,
2498
2481
  value: readyStates.indexOf("CLOSED")
2499
2482
  });
@@ -2501,7 +2484,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2501
2484
  * @constant {Number} CLOSED
2502
2485
  * @memberof WebSocket.prototype
2503
2486
  */
2504
- Object.defineProperty(WebSocket$2.prototype, "CLOSED", {
2487
+ Object.defineProperty(WebSocket.prototype, "CLOSED", {
2505
2488
  enumerable: true,
2506
2489
  value: readyStates.indexOf("CLOSED")
2507
2490
  });
@@ -2514,7 +2497,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2514
2497
  "readyState",
2515
2498
  "url"
2516
2499
  ].forEach((property) => {
2517
- Object.defineProperty(WebSocket$2.prototype, property, { enumerable: true });
2500
+ Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
2518
2501
  });
2519
2502
  [
2520
2503
  "open",
@@ -2522,7 +2505,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2522
2505
  "close",
2523
2506
  "message"
2524
2507
  ].forEach((method) => {
2525
- Object.defineProperty(WebSocket$2.prototype, `on${method}`, {
2508
+ Object.defineProperty(WebSocket.prototype, `on${method}`, {
2526
2509
  enumerable: true,
2527
2510
  get() {
2528
2511
  for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
@@ -2538,9 +2521,9 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2538
2521
  }
2539
2522
  });
2540
2523
  });
2541
- WebSocket$2.prototype.addEventListener = addEventListener;
2542
- WebSocket$2.prototype.removeEventListener = removeEventListener;
2543
- module.exports = WebSocket$2;
2524
+ WebSocket.prototype.addEventListener = addEventListener;
2525
+ WebSocket.prototype.removeEventListener = removeEventListener;
2526
+ module.exports = WebSocket;
2544
2527
  /**
2545
2528
  * Initialize a WebSocket client.
2546
2529
  *
@@ -2553,6 +2536,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2553
2536
  * times in the same tick
2554
2537
  * @param {Boolean} [options.autoPong=true] Specifies whether or not to
2555
2538
  * automatically send a pong in response to a ping
2539
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
2540
+ * for the closing handshake to finish after `websocket.close()` is called
2556
2541
  * @param {Function} [options.finishRequest] A function which can be used to
2557
2542
  * customize the headers of each http request before it is sent
2558
2543
  * @param {Boolean} [options.followRedirects=false] Whether or not to follow
@@ -2579,6 +2564,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2579
2564
  const opts = {
2580
2565
  allowSynchronousEvents: true,
2581
2566
  autoPong: true,
2567
+ closeTimeout: CLOSE_TIMEOUT,
2582
2568
  protocolVersion: protocolVersions[1],
2583
2569
  maxPayload: 100 * 1024 * 1024,
2584
2570
  skipUTF8Validation: false,
@@ -2596,6 +2582,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2596
2582
  port: void 0
2597
2583
  };
2598
2584
  websocket._autoPong = opts.autoPong;
2585
+ websocket._closeTimeout = opts.closeTimeout;
2599
2586
  if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
2600
2587
  let parsedUrl;
2601
2588
  if (address instanceof URL) parsedUrl = address;
@@ -2640,8 +2627,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2640
2627
  opts.path = parsedUrl.pathname + parsedUrl.search;
2641
2628
  opts.timeout = opts.handshakeTimeout;
2642
2629
  if (opts.perMessageDeflate) {
2643
- perMessageDeflate = new PerMessageDeflate$1(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
2644
- opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate$1.extensionName]: perMessageDeflate.offer() });
2630
+ perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
2631
+ opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate.extensionName]: perMessageDeflate.offer() });
2645
2632
  }
2646
2633
  if (protocols.length) {
2647
2634
  for (const protocol of protocols) {
@@ -2669,7 +2656,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2669
2656
  ...options,
2670
2657
  headers: {}
2671
2658
  };
2672
- if (headers) for (const [key$1, value] of Object.entries(headers)) options.headers[key$1.toLowerCase()] = value;
2659
+ if (headers) for (const [key, value] of Object.entries(headers)) options.headers[key.toLowerCase()] = value;
2673
2660
  } else if (websocket.listenerCount("redirect") === 0) {
2674
2661
  const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
2675
2662
  if (!isSameHost || websocket._originalSecure && !isSecure) {
@@ -2684,7 +2671,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2684
2671
  if (websocket._redirects) websocket.emit("redirect", websocket.url, req);
2685
2672
  } else req = websocket._req = request(opts);
2686
2673
  if (opts.timeout) req.on("timeout", () => {
2687
- abortHandshake$1(websocket, req, "Opening handshake has timed out");
2674
+ abortHandshake(websocket, req, "Opening handshake has timed out");
2688
2675
  });
2689
2676
  req.on("error", (err) => {
2690
2677
  if (req === null || req[kAborted]) return;
@@ -2696,7 +2683,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2696
2683
  const statusCode = res.statusCode;
2697
2684
  if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
2698
2685
  if (++websocket._redirects > opts.maxRedirects) {
2699
- abortHandshake$1(websocket, req, "Maximum redirects exceeded");
2686
+ abortHandshake(websocket, req, "Maximum redirects exceeded");
2700
2687
  return;
2701
2688
  }
2702
2689
  req.abort();
@@ -2704,25 +2691,24 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2704
2691
  try {
2705
2692
  addr = new URL(location, address);
2706
2693
  } catch (e) {
2707
- const err = /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`);
2708
- emitErrorAndClose(websocket, err);
2694
+ emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`));
2709
2695
  return;
2710
2696
  }
2711
2697
  initAsClient(websocket, addr, protocols, options);
2712
- } else if (!websocket.emit("unexpected-response", req, res)) abortHandshake$1(websocket, req, `Unexpected server response: ${res.statusCode}`);
2698
+ } else if (!websocket.emit("unexpected-response", req, res)) abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
2713
2699
  });
2714
2700
  req.on("upgrade", (res, socket, head) => {
2715
2701
  websocket.emit("upgrade", res);
2716
- if (websocket.readyState !== WebSocket$2.CONNECTING) return;
2702
+ if (websocket.readyState !== WebSocket.CONNECTING) return;
2717
2703
  req = websocket._req = null;
2718
2704
  const upgrade = res.headers.upgrade;
2719
2705
  if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
2720
- abortHandshake$1(websocket, socket, "Invalid Upgrade header");
2706
+ abortHandshake(websocket, socket, "Invalid Upgrade header");
2721
2707
  return;
2722
2708
  }
2723
- const digest = createHash$1("sha1").update(key + GUID$1).digest("base64");
2709
+ const digest = createHash$1("sha1").update(key + GUID).digest("base64");
2724
2710
  if (res.headers["sec-websocket-accept"] !== digest) {
2725
- abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Accept header");
2711
+ abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
2726
2712
  return;
2727
2713
  }
2728
2714
  const serverProt = res.headers["sec-websocket-protocol"];
@@ -2732,35 +2718,35 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2732
2718
  else if (!protocolSet.has(serverProt)) protError = "Server sent an invalid subprotocol";
2733
2719
  } else if (protocolSet.size) protError = "Server sent no subprotocol";
2734
2720
  if (protError) {
2735
- abortHandshake$1(websocket, socket, protError);
2721
+ abortHandshake(websocket, socket, protError);
2736
2722
  return;
2737
2723
  }
2738
2724
  if (serverProt) websocket._protocol = serverProt;
2739
2725
  const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
2740
2726
  if (secWebSocketExtensions !== void 0) {
2741
2727
  if (!perMessageDeflate) {
2742
- abortHandshake$1(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
2728
+ abortHandshake(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
2743
2729
  return;
2744
2730
  }
2745
2731
  let extensions;
2746
2732
  try {
2747
- extensions = parse$2(secWebSocketExtensions);
2733
+ extensions = parse(secWebSocketExtensions);
2748
2734
  } catch (err) {
2749
- abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
2735
+ abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
2750
2736
  return;
2751
2737
  }
2752
2738
  const extensionNames = Object.keys(extensions);
2753
- if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate$1.extensionName) {
2754
- abortHandshake$1(websocket, socket, "Server indicated an extension that was not requested");
2739
+ if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
2740
+ abortHandshake(websocket, socket, "Server indicated an extension that was not requested");
2755
2741
  return;
2756
2742
  }
2757
2743
  try {
2758
- perMessageDeflate.accept(extensions[PerMessageDeflate$1.extensionName]);
2744
+ perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
2759
2745
  } catch (err) {
2760
- abortHandshake$1(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
2746
+ abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
2761
2747
  return;
2762
2748
  }
2763
- websocket._extensions[PerMessageDeflate$1.extensionName] = perMessageDeflate;
2749
+ websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
2764
2750
  }
2765
2751
  websocket.setSocket(socket, head, {
2766
2752
  allowSynchronousEvents: opts.allowSynchronousEvents,
@@ -2780,7 +2766,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2780
2766
  * @private
2781
2767
  */
2782
2768
  function emitErrorAndClose(websocket, err) {
2783
- websocket._readyState = WebSocket$2.CLOSING;
2769
+ websocket._readyState = WebSocket.CLOSING;
2784
2770
  websocket._errorEmitted = true;
2785
2771
  websocket.emit("error", err);
2786
2772
  websocket.emitClose();
@@ -2817,10 +2803,10 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2817
2803
  * @param {String} message The error message
2818
2804
  * @private
2819
2805
  */
2820
- function abortHandshake$1(websocket, stream, message) {
2821
- websocket._readyState = WebSocket$2.CLOSING;
2806
+ function abortHandshake(websocket, stream, message) {
2807
+ websocket._readyState = WebSocket.CLOSING;
2822
2808
  const err = new Error(message);
2823
- Error.captureStackTrace(err, abortHandshake$1);
2809
+ Error.captureStackTrace(err, abortHandshake);
2824
2810
  if (stream.setHeader) {
2825
2811
  stream[kAborted] = true;
2826
2812
  stream.abort();
@@ -2860,11 +2846,11 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2860
2846
  * @private
2861
2847
  */
2862
2848
  function receiverOnConclude(code, reason) {
2863
- const websocket = this[kWebSocket$1];
2849
+ const websocket = this[kWebSocket];
2864
2850
  websocket._closeFrameReceived = true;
2865
2851
  websocket._closeMessage = reason;
2866
2852
  websocket._closeCode = code;
2867
- if (websocket._socket[kWebSocket$1] === void 0) return;
2853
+ if (websocket._socket[kWebSocket] === void 0) return;
2868
2854
  websocket._socket.removeListener("data", socketOnData);
2869
2855
  process.nextTick(resume, websocket._socket);
2870
2856
  if (code === 1005) websocket.close();
@@ -2876,7 +2862,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2876
2862
  * @private
2877
2863
  */
2878
2864
  function receiverOnDrain() {
2879
- const websocket = this[kWebSocket$1];
2865
+ const websocket = this[kWebSocket];
2880
2866
  if (!websocket.isPaused) websocket._socket.resume();
2881
2867
  }
2882
2868
  /**
@@ -2886,8 +2872,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2886
2872
  * @private
2887
2873
  */
2888
2874
  function receiverOnError(err) {
2889
- const websocket = this[kWebSocket$1];
2890
- if (websocket._socket[kWebSocket$1] !== void 0) {
2875
+ const websocket = this[kWebSocket];
2876
+ if (websocket._socket[kWebSocket] !== void 0) {
2891
2877
  websocket._socket.removeListener("data", socketOnData);
2892
2878
  process.nextTick(resume, websocket._socket);
2893
2879
  websocket.close(err[kStatusCode]);
@@ -2903,7 +2889,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2903
2889
  * @private
2904
2890
  */
2905
2891
  function receiverOnFinish() {
2906
- this[kWebSocket$1].emitClose();
2892
+ this[kWebSocket].emitClose();
2907
2893
  }
2908
2894
  /**
2909
2895
  * The listener of the `Receiver` `'message'` event.
@@ -2913,7 +2899,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2913
2899
  * @private
2914
2900
  */
2915
2901
  function receiverOnMessage(data, isBinary) {
2916
- this[kWebSocket$1].emit("message", data, isBinary);
2902
+ this[kWebSocket].emit("message", data, isBinary);
2917
2903
  }
2918
2904
  /**
2919
2905
  * The listener of the `Receiver` `'ping'` event.
@@ -2922,8 +2908,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2922
2908
  * @private
2923
2909
  */
2924
2910
  function receiverOnPing(data) {
2925
- const websocket = this[kWebSocket$1];
2926
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP$1);
2911
+ const websocket = this[kWebSocket];
2912
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
2927
2913
  websocket.emit("ping", data);
2928
2914
  }
2929
2915
  /**
@@ -2933,7 +2919,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2933
2919
  * @private
2934
2920
  */
2935
2921
  function receiverOnPong(data) {
2936
- this[kWebSocket$1].emit("pong", data);
2922
+ this[kWebSocket].emit("pong", data);
2937
2923
  }
2938
2924
  /**
2939
2925
  * Resume a readable stream
@@ -2951,10 +2937,10 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2951
2937
  * @private
2952
2938
  */
2953
2939
  function senderOnError(err) {
2954
- const websocket = this[kWebSocket$1];
2955
- if (websocket.readyState === WebSocket$2.CLOSED) return;
2956
- if (websocket.readyState === WebSocket$2.OPEN) {
2957
- websocket._readyState = WebSocket$2.CLOSING;
2940
+ const websocket = this[kWebSocket];
2941
+ if (websocket.readyState === WebSocket.CLOSED) return;
2942
+ if (websocket.readyState === WebSocket.OPEN) {
2943
+ websocket._readyState = WebSocket.CLOSING;
2958
2944
  setCloseTimer(websocket);
2959
2945
  }
2960
2946
  this._socket.end();
@@ -2970,7 +2956,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2970
2956
  * @private
2971
2957
  */
2972
2958
  function setCloseTimer(websocket) {
2973
- websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), closeTimeout);
2959
+ websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
2974
2960
  }
2975
2961
  /**
2976
2962
  * The listener of the socket `'close'` event.
@@ -2978,15 +2964,17 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
2978
2964
  * @private
2979
2965
  */
2980
2966
  function socketOnClose() {
2981
- const websocket = this[kWebSocket$1];
2967
+ const websocket = this[kWebSocket];
2982
2968
  this.removeListener("close", socketOnClose);
2983
2969
  this.removeListener("data", socketOnData);
2984
2970
  this.removeListener("end", socketOnEnd);
2985
- websocket._readyState = WebSocket$2.CLOSING;
2986
- let chunk;
2987
- if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && (chunk = websocket._socket.read()) !== null) websocket._receiver.write(chunk);
2971
+ websocket._readyState = WebSocket.CLOSING;
2972
+ if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
2973
+ const chunk = this.read(this._readableState.length);
2974
+ websocket._receiver.write(chunk);
2975
+ }
2988
2976
  websocket._receiver.end();
2989
- this[kWebSocket$1] = void 0;
2977
+ this[kWebSocket] = void 0;
2990
2978
  clearTimeout(websocket._closeTimer);
2991
2979
  if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) websocket.emitClose();
2992
2980
  else {
@@ -3001,7 +2989,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
3001
2989
  * @private
3002
2990
  */
3003
2991
  function socketOnData(chunk) {
3004
- if (!this[kWebSocket$1]._receiver.write(chunk)) this.pause();
2992
+ if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
3005
2993
  }
3006
2994
  /**
3007
2995
  * The listener of the socket `'end'` event.
@@ -3009,8 +2997,8 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
3009
2997
  * @private
3010
2998
  */
3011
2999
  function socketOnEnd() {
3012
- const websocket = this[kWebSocket$1];
3013
- websocket._readyState = WebSocket$2.CLOSING;
3000
+ const websocket = this[kWebSocket];
3001
+ websocket._readyState = WebSocket.CLOSING;
3014
3002
  websocket._receiver.end();
3015
3003
  this.end();
3016
3004
  }
@@ -3019,20 +3007,20 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
3019
3007
  *
3020
3008
  * @private
3021
3009
  */
3022
- function socketOnError$1() {
3023
- const websocket = this[kWebSocket$1];
3024
- this.removeListener("error", socketOnError$1);
3025
- this.on("error", NOOP$1);
3010
+ function socketOnError() {
3011
+ const websocket = this[kWebSocket];
3012
+ this.removeListener("error", socketOnError);
3013
+ this.on("error", NOOP);
3026
3014
  if (websocket) {
3027
- websocket._readyState = WebSocket$2.CLOSING;
3015
+ websocket._readyState = WebSocket.CLOSING;
3028
3016
  this.destroy();
3029
3017
  }
3030
3018
  }
3031
- }) });
3019
+ }));
3032
3020
 
3033
3021
  //#endregion
3034
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js
3035
- var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js": ((exports, module) => {
3022
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/stream.js
3023
+ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3036
3024
  require_websocket();
3037
3025
  const { Duplex: Duplex$1 } = __require("stream");
3038
3026
  /**
@@ -3041,7 +3029,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
3041
3029
  * @param {Duplex} stream The stream.
3042
3030
  * @private
3043
3031
  */
3044
- function emitClose$1(stream) {
3032
+ function emitClose(stream) {
3045
3033
  stream.emit("close");
3046
3034
  }
3047
3035
  /**
@@ -3071,7 +3059,7 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
3071
3059
  * @return {Duplex} The duplex stream
3072
3060
  * @public
3073
3061
  */
3074
- function createWebSocketStream$1(ws, options) {
3062
+ function createWebSocketStream(ws, options) {
3075
3063
  let terminateOnDestroy = true;
3076
3064
  const duplex = new Duplex$1({
3077
3065
  ...options,
@@ -3096,17 +3084,17 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
3096
3084
  duplex._destroy = function(err, callback) {
3097
3085
  if (ws.readyState === ws.CLOSED) {
3098
3086
  callback(err);
3099
- process.nextTick(emitClose$1, duplex);
3087
+ process.nextTick(emitClose, duplex);
3100
3088
  return;
3101
3089
  }
3102
3090
  let called = false;
3103
- ws.once("error", function error(err$1) {
3091
+ ws.once("error", function error(err) {
3104
3092
  called = true;
3105
- callback(err$1);
3093
+ callback(err);
3106
3094
  });
3107
3095
  ws.once("close", function close() {
3108
3096
  if (!called) callback(err);
3109
- process.nextTick(emitClose$1, duplex);
3097
+ process.nextTick(emitClose, duplex);
3110
3098
  });
3111
3099
  if (terminateOnDestroy) ws.terminate();
3112
3100
  };
@@ -3144,12 +3132,12 @@ var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8
3144
3132
  duplex.on("error", duplexOnError);
3145
3133
  return duplex;
3146
3134
  }
3147
- module.exports = createWebSocketStream$1;
3148
- }) });
3135
+ module.exports = createWebSocketStream;
3136
+ }));
3149
3137
 
3150
3138
  //#endregion
3151
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js
3152
- var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js": ((exports, module) => {
3139
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/subprotocol.js
3140
+ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3153
3141
  const { tokenChars } = require_validation();
3154
3142
  /**
3155
3143
  * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
@@ -3158,7 +3146,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
3158
3146
  * @return {Set} The subprotocol names
3159
3147
  * @public
3160
3148
  */
3161
- function parse$1(header) {
3149
+ function parse(header) {
3162
3150
  const protocols = /* @__PURE__ */ new Set();
3163
3151
  let start = -1;
3164
3152
  let end = -1;
@@ -3172,9 +3160,9 @@ var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
3172
3160
  } else if (code === 44) {
3173
3161
  if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
3174
3162
  if (end === -1) end = i;
3175
- const protocol$1 = header.slice(start, end);
3176
- if (protocols.has(protocol$1)) throw new SyntaxError(`The "${protocol$1}" subprotocol is duplicated`);
3177
- protocols.add(protocol$1);
3163
+ const protocol = header.slice(start, end);
3164
+ if (protocols.has(protocol)) throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
3165
+ protocols.add(protocol);
3178
3166
  start = end = -1;
3179
3167
  } else throw new SyntaxError(`Unexpected character at index ${i}`);
3180
3168
  }
@@ -3184,12 +3172,12 @@ var require_subprotocol = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
3184
3172
  protocols.add(protocol);
3185
3173
  return protocols;
3186
3174
  }
3187
- module.exports = { parse: parse$1 };
3188
- }) });
3175
+ module.exports = { parse };
3176
+ }));
3189
3177
 
3190
3178
  //#endregion
3191
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js
3192
- var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js": ((exports, module) => {
3179
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket-server.js
3180
+ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3193
3181
  const EventEmitter = __require("events");
3194
3182
  const http = __require("http");
3195
3183
  const { Duplex } = __require("stream");
@@ -3197,8 +3185,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3197
3185
  const extension = require_extension();
3198
3186
  const PerMessageDeflate = require_permessage_deflate();
3199
3187
  const subprotocol = require_subprotocol();
3200
- const WebSocket$1 = require_websocket();
3201
- const { GUID, kWebSocket } = require_constants();
3188
+ const WebSocket = require_websocket();
3189
+ const { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
3202
3190
  const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
3203
3191
  const RUNNING = 0;
3204
3192
  const CLOSING = 1;
@@ -3208,7 +3196,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3208
3196
  *
3209
3197
  * @extends EventEmitter
3210
3198
  */
3211
- var WebSocketServer$2 = class extends EventEmitter {
3199
+ var WebSocketServer = class extends EventEmitter {
3212
3200
  /**
3213
3201
  * Create a `WebSocketServer` instance.
3214
3202
  *
@@ -3222,6 +3210,9 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3222
3210
  * pending connections
3223
3211
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
3224
3212
  * track clients
3213
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
3214
+ * wait for the closing handshake to finish after `websocket.close()` is
3215
+ * called
3225
3216
  * @param {Function} [options.handleProtocols] A hook to handle protocols
3226
3217
  * @param {String} [options.host] The hostname where to bind the server
3227
3218
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
@@ -3250,6 +3241,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3250
3241
  perMessageDeflate: false,
3251
3242
  handleProtocols: null,
3252
3243
  clientTracking: true,
3244
+ closeTimeout: CLOSE_TIMEOUT,
3253
3245
  verifyClient: null,
3254
3246
  noServer: false,
3255
3247
  backlog: null,
@@ -3257,7 +3249,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3257
3249
  host: null,
3258
3250
  path: null,
3259
3251
  port: null,
3260
- WebSocket: WebSocket$1,
3252
+ WebSocket,
3261
3253
  ...options
3262
3254
  };
3263
3255
  if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) throw new TypeError("One and only one of the \"port\", \"server\", or \"noServer\" options must be specified");
@@ -3482,7 +3474,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3482
3474
  cb(ws, req);
3483
3475
  }
3484
3476
  };
3485
- module.exports = WebSocketServer$2;
3477
+ module.exports = WebSocketServer;
3486
3478
  /**
3487
3479
  * Add event listeners on an `EventEmitter` using a map of <event, listener>
3488
3480
  * pairs.
@@ -3556,10 +3548,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJS({ "../../node_modules/
3556
3548
  server.emit("wsClientError", err, socket, req);
3557
3549
  } else abortHandshake(socket, code, message, headers);
3558
3550
  }
3559
- }) });
3551
+ }));
3560
3552
 
3561
3553
  //#endregion
3562
- //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/wrapper.mjs
3554
+ //#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/wrapper.mjs
3563
3555
  var import_stream = /* @__PURE__ */ __toESM(require_stream(), 1);
3564
3556
  var import_receiver = /* @__PURE__ */ __toESM(require_receiver(), 1);
3565
3557
  var import_sender = /* @__PURE__ */ __toESM(require_sender(), 1);
@@ -3568,13 +3560,22 @@ var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server()
3568
3560
 
3569
3561
  //#endregion
3570
3562
  //#region src/presets/ws/server.ts
3563
+ let id = 0;
3571
3564
  function NOOP() {}
3572
3565
  const createWsRpcPreset = defineRpcServerPreset((options) => {
3573
- const { port, onConnected = NOOP, onDisconnected = NOOP } = options;
3574
- const wss = new import_websocket_server.default({ port });
3575
- return (rpc, options$1) => {
3576
- const { serialize = stringify, deserialize = parse } = options$1 ?? {};
3577
- wss.on("connection", (ws) => {
3566
+ const { port, host = "localhost", onConnected = NOOP, onDisconnected = NOOP } = options;
3567
+ const wss = new import_websocket_server.default({
3568
+ port,
3569
+ host
3570
+ });
3571
+ return (rpcGroup, options) => {
3572
+ const { serialize = stringify, deserialize = parse } = options ?? {};
3573
+ wss.on("connection", (ws, req) => {
3574
+ const meta = {
3575
+ id: id++,
3576
+ ws,
3577
+ subscribedStates: /* @__PURE__ */ new Set()
3578
+ };
3578
3579
  const channel = {
3579
3580
  post: (data) => {
3580
3581
  ws.send(data);
@@ -3585,19 +3586,20 @@ const createWsRpcPreset = defineRpcServerPreset((options) => {
3585
3586
  });
3586
3587
  },
3587
3588
  serialize,
3588
- deserialize
3589
+ deserialize,
3590
+ meta
3589
3591
  };
3590
- rpc.updateChannels((channels) => {
3592
+ rpcGroup.updateChannels((channels) => {
3591
3593
  channels.push(channel);
3592
3594
  });
3593
3595
  ws.on("close", () => {
3594
- rpc.updateChannels((channels) => {
3596
+ rpcGroup.updateChannels((channels) => {
3595
3597
  const index = channels.indexOf(channel);
3596
3598
  if (index >= 0) channels.splice(index, 1);
3597
3599
  });
3598
- onDisconnected(ws);
3600
+ onDisconnected(ws, meta);
3599
3601
  });
3600
- onConnected(ws);
3602
+ onConnected(ws, req, meta);
3601
3603
  });
3602
3604
  };
3603
3605
  });