@rsbuild/core 2.2.7 → 2.2.9
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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/htmlLoader.js +8 -17
- package/compiled/html-rspack-plugin/index.d.ts +8 -4
- package/compiled/html-rspack-plugin/index.js +61 -69
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/ws/index.d.ts +445 -0
- package/compiled/ws/license +21 -0
- package/compiled/ws/package.json +1 -0
- package/dist/chokidar.js +1 -1
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/cssUrlLoader.mjs +1 -1
- package/dist/helpers/cachedImport.d.ts +2 -0
- package/dist/http-proxy-middleware.js +4 -4
- package/dist/ignoreCssLoader.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/{626.js → m.js} +121 -160
- package/dist/manifest-plugin.js +1 -1
- package/dist/memfs.js +1 -1
- package/dist/open.js +2 -2
- package/dist/r.js +7 -0
- package/dist/remapping.js +8 -3
- package/dist/rslib-runtime.js +1 -1
- package/dist/server/assets-middleware/memoryFileSystem.d.ts +2 -0
- package/dist/server/buildManager.d.ts +3 -2
- package/dist/server/devServer.d.ts +5 -0
- package/dist/server/runner/asModule.d.ts +1 -1
- package/dist/server/runner/basic.d.ts +5 -4
- package/dist/server/runner/type.d.ts +1 -1
- package/dist/server/socketServer.d.ts +7 -4
- package/dist/sirv.js +1 -1
- package/dist/tinyglobby.js +1 -1
- package/dist/trace-mapping.js +220 -8
- package/dist/transformLoader.mjs +3 -2
- package/dist/types/config.d.ts +6 -2
- package/dist/ws.js +2 -2
- package/package.json +7 -6
- /package/dist/{252.js → c.js} +0 -0
- /package/dist/client/{307~0.js → f~0.js} +0 -0
- /package/dist/{626.js.LICENSE.txt → m.js.LICENSE.txt} +0 -0
package/dist/trace-mapping.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { definePropertyGetters, makeNamespaceObject } from "./rslib-runtime.js";
|
|
2
|
+
var trace_mapping_namespaceObject = {};
|
|
3
|
+
makeNamespaceObject(trace_mapping_namespaceObject), definePropertyGetters(trace_mapping_namespaceObject, {
|
|
4
|
+
AnyMap: ()=>FlattenMap,
|
|
5
|
+
FlattenMap: ()=>FlattenMap,
|
|
6
|
+
GREATEST_LOWER_BOUND: ()=>GREATEST_LOWER_BOUND,
|
|
7
|
+
LEAST_UPPER_BOUND: ()=>LEAST_UPPER_BOUND,
|
|
8
|
+
TraceMap: ()=>TraceMap,
|
|
9
|
+
allGeneratedPositionsFor: ()=>allGeneratedPositionsFor,
|
|
10
|
+
decodedMap: ()=>decodedMap,
|
|
11
|
+
decodedMappings: ()=>decodedMappings,
|
|
12
|
+
eachMapping: ()=>eachMapping,
|
|
13
|
+
encodedMap: ()=>encodedMap,
|
|
14
|
+
encodedMappings: ()=>encodedMappings,
|
|
15
|
+
generatedPositionFor: ()=>generatedPositionFor,
|
|
16
|
+
isIgnored: ()=>isIgnored,
|
|
17
|
+
originalPositionFor: ()=>originalPositionFor,
|
|
18
|
+
presortedDecodedMap: ()=>presortedDecodedMap,
|
|
19
|
+
sourceContentFor: ()=>sourceContentFor,
|
|
20
|
+
traceSegment: ()=>traceSegment
|
|
21
|
+
});
|
|
1
22
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
|
|
2
23
|
for(let i = 0; i < chars.length; i++){
|
|
3
24
|
let c = chars.charCodeAt(i);
|
|
@@ -88,7 +109,7 @@ function sort(line) {
|
|
|
88
109
|
function sortComparator(a, b) {
|
|
89
110
|
return a[0] - b[0];
|
|
90
111
|
}
|
|
91
|
-
function
|
|
112
|
+
function encode(decoded) {
|
|
92
113
|
let writer = new StringWriter(), sourcesIndex = 0, sourceLine = 0, sourceColumn = 0, namesIndex = 0;
|
|
93
114
|
for(let i = 0; i < decoded.length; i++){
|
|
94
115
|
let line = decoded[i];
|
|
@@ -248,6 +269,30 @@ function sortSegments(line, owned) {
|
|
|
248
269
|
function trace_mapping_sortComparator(a, b) {
|
|
249
270
|
return a[0] - b[0];
|
|
250
271
|
}
|
|
272
|
+
function buildBySources(decoded, memos) {
|
|
273
|
+
let sources = memos.map(()=>[]);
|
|
274
|
+
for(let i = 0; i < decoded.length; i++){
|
|
275
|
+
let line = decoded[i];
|
|
276
|
+
for(let j = 0; j < line.length; j++){
|
|
277
|
+
let seg = line[j];
|
|
278
|
+
if (1 === seg.length) continue;
|
|
279
|
+
let sourceIndex2 = seg[1], sourceLine = seg[2], sourceColumn = seg[3], source = sources[sourceIndex2];
|
|
280
|
+
(source[sourceLine] || (source[sourceLine] = [])).push([
|
|
281
|
+
sourceColumn,
|
|
282
|
+
i,
|
|
283
|
+
seg[0]
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
for(let i = 0; i < sources.length; i++){
|
|
288
|
+
let source = sources[i];
|
|
289
|
+
for(let j = 0; j < source.length; j++){
|
|
290
|
+
let line = source[j];
|
|
291
|
+
line && line.sort(trace_mapping_sortComparator);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return sources;
|
|
295
|
+
}
|
|
251
296
|
var found = !1;
|
|
252
297
|
function binarySearch(haystack, needle, low, high) {
|
|
253
298
|
for(; low <= high;){
|
|
@@ -283,7 +328,75 @@ function memoizedBinarySearch(haystack, needle, state, key) {
|
|
|
283
328
|
function parse(map) {
|
|
284
329
|
return "string" == typeof map ? JSON.parse(map) : map;
|
|
285
330
|
}
|
|
286
|
-
var
|
|
331
|
+
var FlattenMap = function(map, mapUrl) {
|
|
332
|
+
let parsed = parse(map);
|
|
333
|
+
if (!("sections" in parsed)) return new TraceMap(parsed, mapUrl);
|
|
334
|
+
let mappings = [], sources = [], sourcesContent = [], names = [], ignoreList = [];
|
|
335
|
+
return recurse(parsed, mapUrl, mappings, sources, sourcesContent, names, ignoreList, 0, 0, 1 / 0, 1 / 0), presortedDecodedMap({
|
|
336
|
+
version: 3,
|
|
337
|
+
file: parsed.file,
|
|
338
|
+
names,
|
|
339
|
+
sources,
|
|
340
|
+
sourcesContent,
|
|
341
|
+
mappings,
|
|
342
|
+
ignoreList
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
|
|
346
|
+
let { sections } = input;
|
|
347
|
+
for(let i = 0; i < sections.length; i++){
|
|
348
|
+
let { map, offset } = sections[i], sl = stopLine, sc = stopColumn;
|
|
349
|
+
if (i + 1 < sections.length) {
|
|
350
|
+
let nextOffset = sections[i + 1].offset;
|
|
351
|
+
(sl = Math.min(stopLine, lineOffset + nextOffset.line)) === stopLine ? sc = Math.min(stopColumn, columnOffset + nextOffset.column) : sl < stopLine && (sc = columnOffset + nextOffset.column);
|
|
352
|
+
}
|
|
353
|
+
addSection(map, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset + offset.line, columnOffset + offset.column, sl, sc);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
|
|
357
|
+
let parsed = parse(input);
|
|
358
|
+
if ("sections" in parsed) return recurse(...arguments);
|
|
359
|
+
let map = new TraceMap(parsed, mapUrl), sourcesOffset = sources.length, namesOffset = names.length, decoded = decodedMappings(map), { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;
|
|
360
|
+
if (append(sources, resolvedSources), append(names, map.names), contents) append(sourcesContent, contents);
|
|
361
|
+
else for(let i = 0; i < resolvedSources.length; i++)sourcesContent.push(null);
|
|
362
|
+
if (ignores) for(let i = 0; i < ignores.length; i++)ignoreList.push(ignores[i] + sourcesOffset);
|
|
363
|
+
for(let i = 0; i < decoded.length; i++){
|
|
364
|
+
let lineI = lineOffset + i;
|
|
365
|
+
if (lineI > stopLine) return;
|
|
366
|
+
let out = getLine(mappings, lineI), cOffset = 0 === i ? columnOffset : 0, line = decoded[i];
|
|
367
|
+
for(let j = 0; j < line.length; j++){
|
|
368
|
+
let seg = line[j], column = cOffset + seg[0];
|
|
369
|
+
if (lineI === stopLine && column >= stopColumn) return;
|
|
370
|
+
if (1 === seg.length) {
|
|
371
|
+
out.push([
|
|
372
|
+
column
|
|
373
|
+
]);
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
let sourcesIndex = sourcesOffset + seg[1], sourceLine = seg[2], sourceColumn = seg[3];
|
|
377
|
+
out.push(4 === seg.length ? [
|
|
378
|
+
column,
|
|
379
|
+
sourcesIndex,
|
|
380
|
+
sourceLine,
|
|
381
|
+
sourceColumn
|
|
382
|
+
] : [
|
|
383
|
+
column,
|
|
384
|
+
sourcesIndex,
|
|
385
|
+
sourceLine,
|
|
386
|
+
sourceColumn,
|
|
387
|
+
namesOffset + seg[4]
|
|
388
|
+
]);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function append(arr, other) {
|
|
393
|
+
for(let i = 0; i < other.length; i++)arr.push(other[i]);
|
|
394
|
+
}
|
|
395
|
+
function getLine(arr, index) {
|
|
396
|
+
for(let i = arr.length; i <= index; i++)arr[i] = [];
|
|
397
|
+
return arr[index];
|
|
398
|
+
}
|
|
399
|
+
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1, TraceMap = class {
|
|
287
400
|
constructor(map, mapUrl){
|
|
288
401
|
let isString = "string" == typeof map;
|
|
289
402
|
if (!isString && map._decodedMemo) return map;
|
|
@@ -299,28 +412,95 @@ var TraceMap = class {
|
|
|
299
412
|
this._decodedMemo = memoizedState(), this._bySources = void 0, this._bySourceMemos = void 0;
|
|
300
413
|
}
|
|
301
414
|
};
|
|
415
|
+
function encodedMappings(map) {
|
|
416
|
+
var _b;
|
|
417
|
+
return null != (_b = map._encoded) ? _b : map._encoded = encode(map._decoded);
|
|
418
|
+
}
|
|
302
419
|
function decodedMappings(map) {
|
|
303
420
|
return map._decoded || (map._decoded = decode(map._encoded));
|
|
304
421
|
}
|
|
305
422
|
function traceSegment(map, line, column) {
|
|
306
423
|
let decoded = decodedMappings(map);
|
|
307
424
|
if (line >= decoded.length) return null;
|
|
308
|
-
let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column,
|
|
425
|
+
let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, GREATEST_LOWER_BOUND);
|
|
309
426
|
return -1 === index ? null : segments[index];
|
|
310
427
|
}
|
|
311
428
|
function originalPositionFor(map, needle) {
|
|
312
429
|
let { line, column, bias } = needle;
|
|
313
|
-
if (--line < 0) throw Error(
|
|
314
|
-
if (column < 0) throw Error(
|
|
430
|
+
if (--line < 0) throw Error(LINE_GTR_ZERO);
|
|
431
|
+
if (column < 0) throw Error(COL_GTR_EQ_ZERO);
|
|
315
432
|
let decoded = decodedMappings(map);
|
|
316
433
|
if (line >= decoded.length) return OMapping(null, null, null, null);
|
|
317
|
-
let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias ||
|
|
434
|
+
let segments = decoded[line], index = traceSegmentInternal(segments, map._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
|
318
435
|
if (-1 === index) return OMapping(null, null, null, null);
|
|
319
436
|
let segment = segments[index];
|
|
320
437
|
if (1 === segment.length) return OMapping(null, null, null, null);
|
|
321
438
|
let { names, resolvedSources } = map;
|
|
322
439
|
return OMapping(resolvedSources[segment[1]], segment[2] + 1, segment[3], 5 === segment.length ? names[segment[4]] : null);
|
|
323
440
|
}
|
|
441
|
+
function generatedPositionFor(map, needle) {
|
|
442
|
+
let { source, line, column, bias } = needle;
|
|
443
|
+
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, !1);
|
|
444
|
+
}
|
|
445
|
+
function allGeneratedPositionsFor(map, needle) {
|
|
446
|
+
let { source, line, column, bias } = needle;
|
|
447
|
+
return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, !0);
|
|
448
|
+
}
|
|
449
|
+
function eachMapping(map, cb) {
|
|
450
|
+
let decoded = decodedMappings(map), { names, resolvedSources } = map;
|
|
451
|
+
for(let i = 0; i < decoded.length; i++){
|
|
452
|
+
let line = decoded[i];
|
|
453
|
+
for(let j = 0; j < line.length; j++){
|
|
454
|
+
let seg = line[j], generatedLine = i + 1, generatedColumn = seg[0], source = null, originalLine = null, originalColumn = null, name = null;
|
|
455
|
+
1 !== seg.length && (source = resolvedSources[seg[1]], originalLine = seg[2] + 1, originalColumn = seg[3]), 5 === seg.length && (name = names[seg[4]]), cb({
|
|
456
|
+
generatedLine,
|
|
457
|
+
generatedColumn,
|
|
458
|
+
source,
|
|
459
|
+
originalLine,
|
|
460
|
+
originalColumn,
|
|
461
|
+
name
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function sourceIndex(map, source) {
|
|
467
|
+
let { sources, resolvedSources } = map, index = sources.indexOf(source);
|
|
468
|
+
return -1 === index && (index = resolvedSources.indexOf(source)), index;
|
|
469
|
+
}
|
|
470
|
+
function sourceContentFor(map, source) {
|
|
471
|
+
let { sourcesContent } = map;
|
|
472
|
+
if (null == sourcesContent) return null;
|
|
473
|
+
let index = sourceIndex(map, source);
|
|
474
|
+
return -1 === index ? null : sourcesContent[index];
|
|
475
|
+
}
|
|
476
|
+
function isIgnored(map, source) {
|
|
477
|
+
let { ignoreList } = map;
|
|
478
|
+
if (null == ignoreList) return !1;
|
|
479
|
+
let index = sourceIndex(map, source);
|
|
480
|
+
return -1 !== index && ignoreList.includes(index);
|
|
481
|
+
}
|
|
482
|
+
function presortedDecodedMap(map, mapUrl) {
|
|
483
|
+
let tracer = new TraceMap(clone(map, []), mapUrl);
|
|
484
|
+
return tracer._decoded = map.mappings, tracer;
|
|
485
|
+
}
|
|
486
|
+
function decodedMap(map) {
|
|
487
|
+
return clone(map, decodedMappings(map));
|
|
488
|
+
}
|
|
489
|
+
function encodedMap(map) {
|
|
490
|
+
return clone(map, encodedMappings(map));
|
|
491
|
+
}
|
|
492
|
+
function clone(map, mappings) {
|
|
493
|
+
return {
|
|
494
|
+
version: map.version,
|
|
495
|
+
file: map.file,
|
|
496
|
+
names: map.names,
|
|
497
|
+
sourceRoot: map.sourceRoot,
|
|
498
|
+
sources: map.sources,
|
|
499
|
+
sourcesContent: map.sourcesContent,
|
|
500
|
+
mappings,
|
|
501
|
+
ignoreList: map.ignoreList || map.x_google_ignoreList
|
|
502
|
+
};
|
|
503
|
+
}
|
|
324
504
|
function OMapping(source, line, column, name) {
|
|
325
505
|
return {
|
|
326
506
|
source,
|
|
@@ -329,8 +509,40 @@ function OMapping(source, line, column, name) {
|
|
|
329
509
|
name
|
|
330
510
|
};
|
|
331
511
|
}
|
|
512
|
+
function GMapping(line, column) {
|
|
513
|
+
return {
|
|
514
|
+
line,
|
|
515
|
+
column
|
|
516
|
+
};
|
|
517
|
+
}
|
|
332
518
|
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
333
519
|
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
334
|
-
return (found ? index = (
|
|
520
|
+
return (found ? index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index) : bias === LEAST_UPPER_BOUND && index++, -1 === index || index === segments.length) ? -1 : index;
|
|
521
|
+
}
|
|
522
|
+
function sliceGeneratedPositions(segments, memo, line, column, bias) {
|
|
523
|
+
let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
|
|
524
|
+
if (!found && bias === LEAST_UPPER_BOUND && min++, -1 === min || min === segments.length) return [];
|
|
525
|
+
let matchedColumn = found ? column : segments[min][0];
|
|
526
|
+
found || (min = lowerBound(segments, matchedColumn, min));
|
|
527
|
+
let max = upperBound(segments, matchedColumn, min), result = [];
|
|
528
|
+
for(; min <= max; min++){
|
|
529
|
+
let segment = segments[min];
|
|
530
|
+
result.push(GMapping(segment[1] + 1, segment[2]));
|
|
531
|
+
}
|
|
532
|
+
return result;
|
|
533
|
+
}
|
|
534
|
+
function generatedPosition(map, source, line, column, bias, all) {
|
|
535
|
+
if (--line < 0) throw Error(LINE_GTR_ZERO);
|
|
536
|
+
if (column < 0) throw Error(COL_GTR_EQ_ZERO);
|
|
537
|
+
let { sources, resolvedSources } = map, sourceIndex2 = sources.indexOf(source);
|
|
538
|
+
if (-1 === sourceIndex2 && (sourceIndex2 = resolvedSources.indexOf(source)), -1 === sourceIndex2) return all ? [] : GMapping(null, null);
|
|
539
|
+
let bySourceMemos = map._bySourceMemos || (map._bySourceMemos = sources.map(memoizedState)), segments = (map._bySources || (map._bySources = buildBySources(decodedMappings(map), bySourceMemos)))[sourceIndex2][line];
|
|
540
|
+
if (null == segments) return all ? [] : GMapping(null, null);
|
|
541
|
+
let memo = bySourceMemos[sourceIndex2];
|
|
542
|
+
if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
|
|
543
|
+
let index = traceSegmentInternal(segments, memo, line, column, bias);
|
|
544
|
+
if (-1 === index) return GMapping(null, null);
|
|
545
|
+
let segment = segments[index];
|
|
546
|
+
return GMapping(segment[1] + 1, segment[2]);
|
|
335
547
|
}
|
|
336
|
-
export { TraceMap, decodedMappings,
|
|
548
|
+
export { TraceMap, decodedMappings, encode, traceSegment, trace_mapping_namespaceObject };
|
package/dist/transformLoader.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { cachedImport } from "./r.js";
|
|
2
|
+
let getRemapping = cachedImport(()=>import("./remapping.js").then((m)=>m.remapping_namespaceObject)), mergeSourceMap = async (originalSourceMap, generatedSourceMap)=>{
|
|
3
|
+
let { default: remapping } = await getRemapping();
|
|
3
4
|
return remapping([
|
|
4
5
|
generatedSourceMap,
|
|
5
6
|
originalSourceMap
|
package/dist/types/config.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type Cors from '../../compiled/cors/index.js';
|
|
|
8
8
|
import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../compiled/http-proxy-middleware/index.js';
|
|
9
9
|
import type { RspackChain } from '../../compiled/rspack-chain/types/index.js';
|
|
10
10
|
import type { FileDescriptor } from '../../compiled/rspack-manifest-plugin/index.js';
|
|
11
|
-
import type { HotSend, RsbuildDevServer } from '../server/devServer.js';
|
|
11
|
+
import type { HotOnConnect, HotSend, RsbuildDevServer } from '../server/devServer.js';
|
|
12
12
|
import type { RsbuildPreviewServer } from '../server/previewServer.js';
|
|
13
13
|
import type { Logger } from '../logger.js';
|
|
14
14
|
import type { EnvironmentContext, ModifyBundlerChainUtils, ModifyChainUtils, ReadonlyRoutes, WatchFileEvent } from './hooks.js';
|
|
@@ -1444,9 +1444,13 @@ export type EnvironmentAPI = Record<string, {
|
|
|
1444
1444
|
* Get the compiled HTML template.
|
|
1445
1445
|
*/ getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1446
1446
|
/**
|
|
1447
|
-
*
|
|
1447
|
+
* HMR communication for the current environment.
|
|
1448
1448
|
*/ hot: {
|
|
1449
1449
|
send: HotSend;
|
|
1450
|
+
/**
|
|
1451
|
+
* Listen for accepted HMR connections in this environment.
|
|
1452
|
+
* Returns a function that removes the listener.
|
|
1453
|
+
*/ onConnect: HotOnConnect;
|
|
1450
1454
|
};
|
|
1451
1455
|
/**
|
|
1452
1456
|
* Provides some context information about the current environment
|
package/dist/ws.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{rspackRequire as e,moduleFactories as t}from"./rslib-runtime.js";import"./626.js";t.add({"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"(t){let{EMPTY_BUFFER:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),i=Buffer[Symbol.species];function r(e){let t;return(r.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),r.readOnly=!1),t)}t.exports={concat:function(e,t){if(0===e.length)return s;if(1===e.length)return e[0];let r=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let s=e[t];r.set(s,o),o+=s.length}return o<t?new i(r.buffer,r.byteOffset,o):r},mask:function(e,t,s,i,r){for(let o=0;o<r;o++)s[i+o]=e[o]^t[3&o]},toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:r,unmask:function(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"(e){let t=["nodebuffer","arraybuffer","fragments"],s="u">typeof Blob;s&&t.push("blob"),e.exports={BINARY_TYPES:t,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/event-target.js"(t){let{kForOnEventAttribute:s,kListener:i}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),r=Symbol("kCode"),o=Symbol("kData"),n=Symbol("kError"),a=Symbol("kMessage"),l=Symbol("kReason"),d=Symbol("kTarget"),h=Symbol("kType"),c=Symbol("kWasClean");class u{constructor(e){this[d]=null,this[h]=e}get target(){return this[d]}get type(){return this[h]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class b extends u{constructor(e,t={}){super(e),this[r]=void 0===t.code?0:t.code,this[l]=void 0===t.reason?"":t.reason,this[c]=void 0!==t.wasClean&&t.wasClean}get code(){return this[r]}get reason(){return this[l]}get wasClean(){return this[c]}}Object.defineProperty(b.prototype,"code",{enumerable:!0}),Object.defineProperty(b.prototype,"reason",{enumerable:!0}),Object.defineProperty(b.prototype,"wasClean",{enumerable:!0});class _ extends u{constructor(e,t={}){super(e),this[n]=void 0===t.error?null:t.error,this[a]=void 0===t.message?"":t.message}get error(){return this[n]}get message(){return this[a]}}Object.defineProperty(_.prototype,"error",{enumerable:!0}),Object.defineProperty(_.prototype,"message",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.data?null:t.data}get data(){return this[o]}}function p(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}Object.defineProperty(f.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:b,ErrorEvent:_,Event:u,EventTarget:{addEventListener(e,t,r={}){let o;for(let o of this.listeners(e))if(!r[s]&&o[i]===t&&!o[s])return;if("message"===e)o=function(e,s){let i=new f("message",{data:s?e:e.toString()});i[d]=this,p(t,this,i)};else if("close"===e)o=function(e,s){let i=new b("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});i[d]=this,p(t,this,i)};else if("error"===e)o=function(e){let s=new _("error",{error:e,message:e.message});s[d]=this,p(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[d]=this,p(t,this,e)}}o[s]=!!r[s],o[i]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[i]===t&&!r[s]){this.removeListener(e,r);break}}},MessageEvent:f}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"(t){let{tokenChars:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js");function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}t.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,r,o=Object.create(null),n=Object.create(null),a=!1,l=!1,d=!1,h=-1,c=-1,u=-1,b=0;for(;b<e.length;b++)if(c=e.charCodeAt(b),void 0===t)if(-1===u&&1===s[c])-1===h&&(h=b);else if(0!==b&&(32===c||9===c))-1===u&&-1!==h&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b);let s=e.slice(h,u);44===c?(i(o,s,n),n=Object.create(null)):t=s,h=u=-1}else throw SyntaxError(`Unexpected character at index ${b}`);else if(void 0===r)if(-1===u&&1===s[c])-1===h&&(h=b);else if(32===c||9===c)-1===u&&-1!==h&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b),i(n,e.slice(h,u),!0),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),h=u=-1}else if(61===c&&-1!==h&&-1===u)r=e.slice(h,b),h=u=-1;else throw SyntaxError(`Unexpected character at index ${b}`);else if(l){if(1!==s[c])throw SyntaxError(`Unexpected character at index ${b}`);-1===h?h=b:a||(a=!0),l=!1}else if(d)if(1===s[c])-1===h&&(h=b);else if(34===c&&-1!==h)d=!1,u=b;else if(92===c)l=!0;else throw SyntaxError(`Unexpected character at index ${b}`);else if(34===c&&61===e.charCodeAt(b-1))d=!0;else if(-1===u&&1===s[c])-1===h&&(h=b);else if(-1!==h&&(32===c||9===c))-1===u&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b);let s=e.slice(h,u);a&&(s=s.replace(/\\/g,""),a=!1),i(n,r,s),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),r=void 0,h=u=-1}else throw SyntaxError(`Unexpected character at index ${b}`);if(-1===h||d||32===c||9===c)throw SyntaxError("Unexpected end of input");-1===u&&(u=b);let _=e.slice(h,u);return void 0===t?i(o,_,n):(void 0===r?i(n,_,!0):a?i(n,r,_.replace(/\\/g,"")):i(n,r,_),i(o,t,n)),o}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/limiter.js"(e){let t=Symbol("kDone"),s=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[s]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[s]()}[s](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[t])}}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"(t){let s,i=e("zlib"),r=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),o=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/limiter.js"),{kStatusCode:n}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),a=Buffer[Symbol.species],l=Buffer.from([0,0,255,255]),d=Symbol("permessage-deflate"),h=Symbol("total-length"),c=Symbol("callback"),u=Symbol("buffers"),b=Symbol("error");function _(e){this[u].push(e),this[h]+=e.length}function f(e){(this[h]+=e.length,this[d]._maxPayload<1||this[h]<=this[d]._maxPayload)?this[u].push(e):(this[b]=RangeError("Max payload size exceeded"),this[b].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[b][n]=1009,this.removeListener("data",f),this.reset())}function p(e){(this[d]._inflate=null,this[b])?this[c](this[b]):(e[n]=1007,this[c](e))}t.exports=class{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,s||(s=new o(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[c];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||("number"==typeof e.client_max_window_bits?!(t.clientMaxWindowBits>e.client_max_window_bits):!!e.client_max_window_bits)));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,i){s.add(s=>{this._decompress(e,t,(e,t)=>{s(),i(e,t)})})}compress(e,t,i){s.add(s=>{this._compress(e,t,(e,t)=>{s(),i(e,t)})})}_decompress(e,t,s){let o=this._isServer?"client":"server";if(!this._inflate){let e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=i.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[d]=this,this._inflate[h]=0,this._inflate[u]=[],this._inflate.on("error",p),this._inflate.on("data",f)}this._inflate[c]=s,this._inflate.write(e),t&&this._inflate.write(l),this._inflate.flush(()=>{let e=this._inflate[b];if(e){this._inflate.close(),this._inflate=null,s(e);return}let i=r.concat(this._inflate[u],this._inflate[h]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[h]=0,this._inflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),s(null,i)})}_compress(e,t,s){let o=this._isServer?"server":"client";if(!this._deflate){let e=`${o}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=i.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[h]=0,this._deflate[u]=[],this._deflate.on("data",_)}this._deflate[c]=s,this._deflate.write(e),this._deflate.flush(i.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[u],this._deflate[h]);t&&(e=new a(e.buffer,e.byteOffset,e.length-4)),this._deflate[c]=null,this._deflate[h]=0,this._deflate[u]=[],t&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"(t){let{Writable:s}=e("stream"),i=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),{BINARY_TYPES:r,EMPTY_BUFFER:o,kStatusCode:n,kWebSocket:a}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{concat:l,toArrayBuffer:d,unmask:h}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),{isValidStatusCode:c,isValidUTF8:u}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),b=Buffer[Symbol.species];t.exports=class extends s{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||r[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[a]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,s){return 8===this._opcode&&0==this._state?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new b(t.buffer,t.byteOffset+e,t.length-e),new b(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],i=t.length-e;e>=s.length?t.set(this._buffers.shift(),i):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),i),this._buffers[0]=new b(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[i.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&h(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._maxFragments>0&&++this._numFragments>this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],2===this._opcode){let i;i="nodebuffer"===this._binaryType?l(s,t):"arraybuffer"===this._binaryType?d(l(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",i,!0),this._state=0,this.startLoop(e)}))}else{let i=l(s,t);if(!this._skipUTF8Validation&&!u(i))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",i,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,o),this.end();else{let s=e.readUInt16BE(0);if(!c(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let i=new b(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!u(i))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,i),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)}))}createError(e,t,s,i,r){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=r,o[n]=i,o}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"(t){let s,{Duplex:i}=e("stream"),{randomFillSync:r}=e("crypto"),{types:{isUint8Array:o}}=e("util"),n=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),{EMPTY_BUFFER:a,kWebSocket:l,NOOP:d}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{isBlob:h,isValidStatusCode:c}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),{mask:u,toBuffer:b}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),_=Symbol("kByteLength"),f=Buffer.alloc(4),p=8192;function m(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let i=e._queue[s],r=i[i.length-1];"function"==typeof r&&r(t)}}function v(e,t,s){m(e,t,s),e.onerror(t)}t.exports=class e{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=d,this[l]=void 0}static frame(e,t){let i,o,n=!1,a=2,l=!1;t.mask&&(i=t.maskBuffer||f,t.generateMask?t.generateMask(i):(8192===p&&(void 0===s&&(s=Buffer.alloc(8192)),r(s,0,8192),p=0),i[0]=s[p++],i[1]=s[p++],i[2]=s[p++],i[3]=s[p++]),l=(i[0]|i[1]|i[2]|i[3])==0,a=6),"string"==typeof e?o=(!t.mask||l)&&void 0!==t[_]?t[_]:(e=Buffer.from(e)).length:(o=e.length,n=t.mask&&t.readOnly&&!l);let d=o;o>=65536?(a+=8,d=127):o>125&&(a+=2,d=126);let h=Buffer.allocUnsafe(n?o+a:a);return(h[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(h[0]|=64),h[1]=d,126===d?h.writeUInt16BE(o,2):127===d&&(h[2]=h[3]=0,h.writeUIntBE(o,4,6)),t.mask)?(h[1]|=128,h[a-4]=i[0],h[a-3]=i[1],h[a-2]=i[2],h[a-1]=i[3],l)?[h,e]:n?(u(e,i,h,a,o),[h]):(u(e,i,e,0,o),[h,e]):[h,e]}close(t,s,i,r){let n;if(void 0===t)n=a;else if("number"==typeof t&&c(t))if(void 0!==s&&s.length){let e=Buffer.byteLength(s);if(e>123)throw RangeError("The message must not be greater than 123 bytes");if((n=Buffer.allocUnsafe(2+e)).writeUInt16BE(t,0),"string"==typeof s)n.write(s,2);else if(o(s))n.set(s,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(n=Buffer.allocUnsafe(2)).writeUInt16BE(t,0);else throw TypeError("First argument must be a valid error code number");let l={[_]:n.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,n,!1,l,r]):this.sendFrame(e.frame(n,l),r)}ping(t,s,i){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):h(t)?(r=t.size,o=!1):(r=(t=b(t)).length,o=b.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[_]:r,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};h(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,i]):this.getBlobData(t,!1,n,i):0!==this._state?this.enqueue([this.dispatch,t,!1,n,i]):this.sendFrame(e.frame(t,n),i)}pong(t,s,i){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):h(t)?(r=t.size,o=!1):(r=(t=b(t)).length,o=b.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[_]:r,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};h(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,i]):this.getBlobData(t,!1,n,i):0!==this._state?this.enqueue([this.dispatch,t,!1,n,i]):this.sendFrame(e.frame(t,n),i)}send(e,t,s){let i,r,o=this._extensions[n.extensionName],a=t.binary?2:1,l=t.compress;"string"==typeof e?(i=Buffer.byteLength(e),r=!1):h(e)?(i=e.size,r=!1):(i=(e=b(e)).length,r=b.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=i>=o._threshold),this._compress=l):(l=!1,a=0),t.fin&&(this._firstFragment=!0);let d={[_]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:r,rsv1:l};h(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,d,s]):this.getBlobData(e,this._compress,d,s):0!==this._state?this.enqueue([this.dispatch,e,this._compress,d,s]):this.dispatch(e,this._compress,d,s)}getBlobData(t,s,i,r){this._bufferedBytes+=i[_],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(m,this,e,r);return}this._bufferedBytes-=i[_];let o=b(t);s?this.dispatch(o,s,i,r):(this._state=0,this.sendFrame(e.frame(o,i),r),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,r)})}dispatch(t,s,i,r){if(!s)return void this.sendFrame(e.frame(t,i),r);let o=this._extensions[n.extensionName];this._bufferedBytes+=i[_],this._state=1,o.compress(t,i.fin,(t,s)=>{this._socket.destroyed?m(this,Error("The socket was closed while data was being compressed"),r):(this._bufferedBytes-=i[_],this._state=0,i.readOnly=!1,this.sendFrame(e.frame(s,i),r),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][_],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][_],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/stream.js"(t){e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js");let{Duplex:s}=e("stream");function i(e){e.emit("close")}function r(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener("error",o),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}t.exports=function(e,t){let n=!0,a=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let i=!s&&a._readableState.objectMode?t.toString():t;a.push(i)||e.pause()}),e.once("error",function(e){a.destroyed||(n=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,s){if(e.readyState===e.CLOSED){s(t),process.nextTick(i,a);return}let r=!1;e.once("error",function(e){r=!0,s(e)}),e.once("close",function(){r||s(t),process.nextTick(i,a)}),n&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,i){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,i)}):e.send(t,i)},a.on("end",r),a.on("error",o),a}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"(t){let{tokenChars:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js");t.exports={parse:function(e){let t=new Set,i=-1,r=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===r&&1===s[n])-1===i&&(i=o);else if(0!==o&&(32===n||9===n))-1===r&&-1!==i&&(r=o);else if(44===n){if(-1===i)throw SyntaxError(`Unexpected character at index ${o}`);-1===r&&(r=o);let s=e.slice(i,r);if(t.has(s))throw SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),i=r=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===i||-1!==r)throw SyntaxError("Unexpected end of input");let n=e.slice(i,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"(t){let{isUtf8:s}=e("buffer"),{hasBlob:i}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js");function r(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}t.exports={isBlob:function(e){return i&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:r,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},s&&(t.exports.isValidUTF8=function(e){return e.length<24?r(e):s(e)})},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket-server.js"(t){let s=e("events"),i=e("http"),{Duplex:r}=e("stream"),{createHash:o}=e("crypto"),n=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),a=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),l=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"),d=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js"),{CLOSE_TIMEOUT:h,GUID:c,kWebSocket:u}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),b=/^[+/0-9A-Za-z]{22}==$/;function _(e){e._state=2,e.emit("close")}function f(){this.destroy()}function p(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r
|
|
2
|
-
`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+s)}function m(e,t,s,i,r,o){if(e.listenerCount("wsClientError")){let i=Error(r);Error.captureStackTrace(i,m),e.emit("wsClientError",i,s,t)}else p(s,i,r,o)}t.exports=class extends s{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:h,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer((e,t)=>{let s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,i)=>{this.handleUpgrade(t,s,i,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(_,this);return}if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(_,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{_(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,i){t.on("error",f);let r=e.headers["sec-websocket-key"],o=e.headers.upgrade,d=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void m(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void m(this,e,t,400,"Invalid Upgrade header");if(void 0===r||!b.test(r))return void m(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==d&&8!==d)return void m(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void p(t,400);let h=e.headers["sec-websocket-protocol"],c=new Set;if(void 0!==h)try{c=l.parse(h)}catch(s){m(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&void 0!==u){let s=new a({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=n.parse(u);e[a.extensionName]&&(s.accept(e[a.extensionName]),_[a.extensionName]=s)}catch(s){m(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===d?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return p(t,n||401,a,l);this.completeUpgrade(_,r,c,e,t,s,i)});if(!this.options.verifyClient(o))return p(t,401)}this.completeUpgrade(_,r,c,e,t,s,i)}completeUpgrade(e,t,s,i,r,l,d){if(!r.readable||!r.writable)return r.destroy();if(r[u])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return p(r,503);let h=o("sha1").update(t+c).digest("base64"),b=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${h}`],m=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,i):s.values().next().value;e&&(b.push(`Sec-WebSocket-Protocol: ${e}`),m._protocol=e)}if(e[a.extensionName]){let t=e[a.extensionName].params,s=n.format({[a.extensionName]:[t]});b.push(`Sec-WebSocket-Extensions: ${s}`),m._extensions=e}this.emit("headers",b,i),r.write(b.concat("\r\n").join("\r\n")),r.removeListener("error",f),m.setSocket(r,l,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(m),m.on("close",()=>{this.clients.delete(m),this._shouldEmitClose&&!this.clients.size&&process.nextTick(_,this)})),d(m,i)}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js"(t){let s=e("events"),i=e("https"),r=e("http"),o=e("net"),n=e("tls"),{randomBytes:a,createHash:l}=e("crypto"),{Duplex:d,Readable:h}=e("stream"),{URL:c}=e("url?5f07"),u=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),b=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"),_=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"),{isBlob:f}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),{BINARY_TYPES:p,CLOSE_TIMEOUT:m,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:g,kListener:w,kStatusCode:S,kWebSocket:k,NOOP:E}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{EventTarget:{addEventListener:x,removeEventListener:T}}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/event-target.js"),{format:C,parse:O}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),{toBuffer:N}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),L=Symbol("kAborted"),P=[8,13],B=["CONNECTING","OPEN","CLOSING","CLOSED"],R=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class j extends s{constructor(e,t,s){super(),this._binaryType=p[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=j.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),function e(t,s,o,n){let d,h,b,_,f={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:m,protocolVersion:P[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=f.autoPong,t._closeTimeout=f.closeTimeout,!P.includes(f.protocolVersion))throw RangeError(`Unsupported protocol version: ${f.protocolVersion} (supported versions: ${P.join(", ")})`);if(s instanceof c)d=s;else try{d=new c(s)}catch{throw SyntaxError(`Invalid URL: ${s}`)}"http:"===d.protocol?d.protocol="ws:":"https:"===d.protocol&&(d.protocol="wss:"),t._url=d.href;let p="wss:"===d.protocol,v="ws+unix:"===d.protocol;if("ws:"===d.protocol||p||v?v&&!d.pathname?h="The URL's pathname is empty":d.hash&&(h="The URL contains a fragment identifier"):h='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',h){let e=SyntaxError(h);if(0!==t._redirects)return void U(t,e);throw e}let g=p?443:80,w=a(16).toString("base64"),S=p?i.request:r.request,k=new Set;if(f.createConnection=f.createConnection||(p?M:I),f.defaultPort=f.defaultPort||g,f.port=d.port||g,f.host=d.hostname.startsWith("[")?d.hostname.slice(1,-1):d.hostname,f.headers={...f.headers,"Sec-WebSocket-Version":f.protocolVersion,"Sec-WebSocket-Key":w,Connection:"Upgrade",Upgrade:"websocket"},f.path=d.pathname+d.search,f.timeout=f.handshakeTimeout,f.perMessageDeflate&&(b=new u({...f.perMessageDeflate,isServer:!1,maxPayload:f.maxPayload}),f.headers["Sec-WebSocket-Extensions"]=C({[u.extensionName]:b.offer()})),o.length){for(let e of o){if("string"!=typeof e||!R.test(e)||k.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");k.add(e)}f.headers["Sec-WebSocket-Protocol"]=o.join(",")}if(f.origin&&(f.protocolVersion<13?f.headers["Sec-WebSocket-Origin"]=f.origin:f.headers.Origin=f.origin),(d.username||d.password)&&(f.auth=`${d.username}:${d.password}`),v){let e=f.path.split(":");f.socketPath=e[0],f.path=e[1]}if(f.followRedirects){if(0===t._redirects){t._originalIpc=v,t._originalSecure=p,t._originalHostOrSocketPath=v?f.socketPath:d.host;let e=n&&n.headers;if(n={...n,headers:{}},e)for(let[t,s]of Object.entries(e))n.headers[t.toLowerCase()]=s}else if(0===t.listenerCount("redirect")){let e=v?!!t._originalIpc&&f.socketPath===t._originalHostOrSocketPath:!t._originalIpc&&d.host===t._originalHostOrSocketPath;e&&(!t._originalSecure||p)||(delete f.headers.authorization,delete f.headers.cookie,e||delete f.headers.host,f.auth=void 0)}f.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(f.auth).toString("base64")),_=t._req=S(f),t._redirects&&t.emit("redirect",t.url,_)}else _=t._req=S(f);f.timeout&&_.on("timeout",()=>{D(t,_,"Opening handshake has timed out")}),_.on("error",e=>{null===_||_[L]||(_=t._req=null,U(t,e))}),_.on("response",i=>{let r=i.headers.location,a=i.statusCode;if(r&&f.followRedirects&&a>=300&&a<400){let i;if(++t._redirects>f.maxRedirects)return void D(t,_,"Maximum redirects exceeded");_.abort();try{i=new c(r,s)}catch(e){U(t,SyntaxError(`Invalid URL: ${r}`));return}e(t,i,o,n)}else t.emit("unexpected-response",_,i)||D(t,_,`Unexpected server response: ${i.statusCode}`)}),_.on("upgrade",(e,s,i)=>{let r;if(t.emit("upgrade",e),t.readyState!==j.CONNECTING)return;_=t._req=null;let o=e.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void D(t,s,"Invalid Upgrade header");let n=l("sha1").update(w+y).digest("base64");if(e.headers["sec-websocket-accept"]!==n)return void D(t,s,"Invalid Sec-WebSocket-Accept header");let a=e.headers["sec-websocket-protocol"];if(void 0!==a?k.size?k.has(a)||(r="Server sent an invalid subprotocol"):r="Server sent a subprotocol but none was requested":k.size&&(r="Server sent no subprotocol"),r)return void D(t,s,r);a&&(t._protocol=a);let d=e.headers["sec-websocket-extensions"];if(void 0!==d){let e;if(!b)return void D(t,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{e=O(d)}catch(e){D(t,s,"Invalid Sec-WebSocket-Extensions header");return}let i=Object.keys(e);if(1!==i.length||i[0]!==u.extensionName)return void D(t,s,"Server indicated an extension that was not requested");try{b.accept(e[u.extensionName])}catch(e){D(t,s,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[u.extensionName]=b}t.setSocket(s,i,{allowSynchronousEvents:f.allowSynchronousEvents,generateMask:f.generateMask,maxBufferedChunks:f.maxBufferedChunks,maxFragments:f.maxFragments,maxPayload:f.maxPayload,skipUTF8Validation:f.skipUTF8Validation})}),f.finishRequest?f.finishRequest(_,t):_.end()}(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){p.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){let i=new b({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),r=new _(e,this._extensions,s.generateMask);this._receiver=i,this._sender=r,this._socket=e,i[k]=this,r[k]=this,e[k]=this,i.on("conclude",F),i.on("drain",A),i.on("error",$),i.on("message",V),i.on("ping",q),i.on("pong",z),r.onerror=K,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Y),e.on("data",Z),e.on("end",J),e.on("error",Q),this._readyState=j.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=j.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=j.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==j.CLOSED){if(this.readyState===j.CONNECTING)return void D(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===j.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=j.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),X(this)}}pause(){this.readyState!==j.CONNECTING&&this.readyState!==j.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==j.OPEN)?W(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||v,t,s))}pong(e,t,s){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==j.OPEN)?W(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||v,t,s))}resume(){this.readyState!==j.CONNECTING&&this.readyState!==j.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==j.OPEN)return void W(this,e,s);let i={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(i.compress=!1),this._sender.send(e||v,i,s)}terminate(){if(this.readyState!==j.CLOSED){if(this.readyState===j.CONNECTING)return void D(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=j.CLOSING,this._socket.destroy())}}}function U(e,t){e._readyState=j.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function I(e){return e.path=e.socketPath,o.connect(e)}function M(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=o.isIP(e.host)?"":e.host),n.connect(e)}function D(e,t,s){e._readyState=j.CLOSING;let i=Error(s);Error.captureStackTrace(i,D),t.setHeader?(t[L]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(U,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function W(e,t,s){if(t){let s=f(t)?t.size:N(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${B[e.readyState]})`);process.nextTick(s,t)}}function F(e,t){let s=this[k];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[k]&&(s._socket.removeListener("data",Z),process.nextTick(H,s._socket),1005===e?s.close():s.close(e,t))}function A(){let e=this[k];e.isPaused||e._socket.resume()}function $(e){let t=this[k];void 0!==t._socket[k]&&(t._socket.removeListener("data",Z),process.nextTick(H,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function G(){this[k].emitClose()}function V(e,t){this[k].emit("message",e,t)}function q(e){let t=this[k];t._autoPong&&t.pong(e,!this._isServer,E),t.emit("ping",e)}function z(e){this[k].emit("pong",e)}function H(e){e.resume()}function K(e){let t=this[k];t.readyState!==j.CLOSED&&(t.readyState===j.OPEN&&(t._readyState=j.CLOSING,X(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function X(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Y(){let e=this[k];if(this.removeListener("close",Y),this.removeListener("data",Z),this.removeListener("end",J),e._readyState=j.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[k]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",G),e._receiver.on("finish",G))}function Z(e){this[k]._receiver.write(e)||this.pause()}function J(){let e=this[k];e._readyState=j.CLOSING,e._receiver.end(),this.end()}function Q(){let e=this[k];this.removeListener("error",Q),this.on("error",E),e&&(e._readyState=j.CLOSING,this.destroy())}Object.defineProperty(j,"CONNECTING",{enumerable:!0,value:B.indexOf("CONNECTING")}),Object.defineProperty(j.prototype,"CONNECTING",{enumerable:!0,value:B.indexOf("CONNECTING")}),Object.defineProperty(j,"OPEN",{enumerable:!0,value:B.indexOf("OPEN")}),Object.defineProperty(j.prototype,"OPEN",{enumerable:!0,value:B.indexOf("OPEN")}),Object.defineProperty(j,"CLOSING",{enumerable:!0,value:B.indexOf("CLOSING")}),Object.defineProperty(j.prototype,"CLOSING",{enumerable:!0,value:B.indexOf("CLOSING")}),Object.defineProperty(j,"CLOSED",{enumerable:!0,value:B.indexOf("CLOSED")}),Object.defineProperty(j.prototype,"CLOSED",{enumerable:!0,value:B.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(j.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(j.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[g])return t[w];return null},set(t){for(let t of this.listeners(e))if(t[g]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[g]:!0})}})}),j.prototype.addEventListener=x,j.prototype.removeEventListener=T,t.exports=j}});let s=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket-server.js");e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/stream.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js");export{s as WebSocketServer};
|
|
1
|
+
import{rspackRequire as e,moduleFactories as t}from"./rslib-runtime.js";import{createRequire as s}from"node:module";let i=s(import.meta.url);t.add({"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"(t){let{EMPTY_BUFFER:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),i=Buffer[Symbol.species];function r(e){let t;return(r.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),r.readOnly=!1),t)}t.exports={concat:function(e,t){if(0===e.length)return s;if(1===e.length)return e[0];let r=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let s=e[t];r.set(s,o),o+=s.length}return o<t?new i(r.buffer,r.byteOffset,o):r},mask:function(e,t,s,i,r){for(let o=0;o<r;o++)s[i+o]=e[o]^t[3&o]},toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:r,unmask:function(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"(e){let t=["nodebuffer","arraybuffer","fragments"],s="u">typeof Blob;s&&t.push("blob"),e.exports={BINARY_TYPES:t,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:s,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/event-target.js"(t){let{kForOnEventAttribute:s,kListener:i}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),r=Symbol("kCode"),o=Symbol("kData"),n=Symbol("kError"),a=Symbol("kMessage"),l=Symbol("kReason"),d=Symbol("kTarget"),h=Symbol("kType"),c=Symbol("kWasClean");class u{constructor(e){this[d]=null,this[h]=e}get target(){return this[d]}get type(){return this[h]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class b extends u{constructor(e,t={}){super(e),this[r]=void 0===t.code?0:t.code,this[l]=void 0===t.reason?"":t.reason,this[c]=void 0!==t.wasClean&&t.wasClean}get code(){return this[r]}get reason(){return this[l]}get wasClean(){return this[c]}}Object.defineProperty(b.prototype,"code",{enumerable:!0}),Object.defineProperty(b.prototype,"reason",{enumerable:!0}),Object.defineProperty(b.prototype,"wasClean",{enumerable:!0});class _ extends u{constructor(e,t={}){super(e),this[n]=void 0===t.error?null:t.error,this[a]=void 0===t.message?"":t.message}get error(){return this[n]}get message(){return this[a]}}Object.defineProperty(_.prototype,"error",{enumerable:!0}),Object.defineProperty(_.prototype,"message",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.data?null:t.data}get data(){return this[o]}}function p(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}Object.defineProperty(f.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:b,ErrorEvent:_,Event:u,EventTarget:{addEventListener(e,t,r={}){let o;for(let o of this.listeners(e))if(!r[s]&&o[i]===t&&!o[s])return;if("message"===e)o=function(e,s){let i=new f("message",{data:s?e:e.toString()});i[d]=this,p(t,this,i)};else if("close"===e)o=function(e,s){let i=new b("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});i[d]=this,p(t,this,i)};else if("error"===e)o=function(e){let s=new _("error",{error:e,message:e.message});s[d]=this,p(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[d]=this,p(t,this,e)}}o[s]=!!r[s],o[i]=t,r.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[i]===t&&!r[s]){this.removeListener(e,r);break}}},MessageEvent:f}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"(t){let{tokenChars:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js");function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}t.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,r,o=Object.create(null),n=Object.create(null),a=!1,l=!1,d=!1,h=-1,c=-1,u=-1,b=0;for(;b<e.length;b++)if(c=e.charCodeAt(b),void 0===t)if(-1===u&&1===s[c])-1===h&&(h=b);else if(0!==b&&(32===c||9===c))-1===u&&-1!==h&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b);let s=e.slice(h,u);44===c?(i(o,s,n),n=Object.create(null)):t=s,h=u=-1}else throw SyntaxError(`Unexpected character at index ${b}`);else if(void 0===r)if(-1===u&&1===s[c])-1===h&&(h=b);else if(32===c||9===c)-1===u&&-1!==h&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b),i(n,e.slice(h,u),!0),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),h=u=-1}else if(61===c&&-1!==h&&-1===u)r=e.slice(h,b),h=u=-1;else throw SyntaxError(`Unexpected character at index ${b}`);else if(l){if(1!==s[c])throw SyntaxError(`Unexpected character at index ${b}`);-1===h?h=b:a||(a=!0),l=!1}else if(d)if(1===s[c])-1===h&&(h=b);else if(34===c&&-1!==h)d=!1,u=b;else if(92===c)l=!0;else throw SyntaxError(`Unexpected character at index ${b}`);else if(34===c&&61===e.charCodeAt(b-1))d=!0;else if(-1===u&&1===s[c])-1===h&&(h=b);else if(-1!==h&&(32===c||9===c))-1===u&&(u=b);else if(59===c||44===c){if(-1===h)throw SyntaxError(`Unexpected character at index ${b}`);-1===u&&(u=b);let s=e.slice(h,u);a&&(s=s.replace(/\\/g,""),a=!1),i(n,r,s),44===c&&(i(o,t,n),n=Object.create(null),t=void 0),r=void 0,h=u=-1}else throw SyntaxError(`Unexpected character at index ${b}`);if(-1===h||d||32===c||9===c)throw SyntaxError("Unexpected end of input");-1===u&&(u=b);let _=e.slice(h,u);return void 0===t?i(o,_,n):(void 0===r?i(n,_,!0):a?i(n,r,_.replace(/\\/g,"")):i(n,r,_),i(o,t,n)),o}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/limiter.js"(e){let t=Symbol("kDone"),s=Symbol("kRun");e.exports=class{constructor(e){this[t]=()=>{this.pending--,this[s]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[s]()}[s](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[t])}}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"(t){let s,r=i("zlib"),o=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),n=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/limiter.js"),{kStatusCode:a}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),l=Buffer[Symbol.species],d=Buffer.from([0,0,255,255]),h=Symbol("permessage-deflate"),c=Symbol("total-length"),u=Symbol("callback"),b=Symbol("buffers"),_=Symbol("error");function f(e){this[b].push(e),this[c]+=e.length}function p(e){(this[c]+=e.length,this[h]._maxPayload<1||this[c]<=this[h]._maxPayload)?this[b].push(e):(this[_]=RangeError("Max payload size exceeded"),this[_].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_][a]=1009,this.removeListener("data",p),this.reset())}function m(e){(this[h]._inflate=null,this[_])?this[u](this[_]):(e[a]=1007,this[u](e))}t.exports=class{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,s||(s=new n(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||("number"==typeof e.client_max_window_bits?!(t.clientMaxWindowBits>e.client_max_window_bits):!!e.client_max_window_bits)));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,i){s.add(s=>{this._decompress(e,t,(e,t)=>{s(),i(e,t)})})}compress(e,t,i){s.add(s=>{this._compress(e,t,(e,t)=>{s(),i(e,t)})})}_decompress(e,t,s){let i=this._isServer?"client":"server";if(!this._inflate){let e=`${i}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[h]=this,this._inflate[c]=0,this._inflate[b]=[],this._inflate.on("error",m),this._inflate.on("data",p)}this._inflate[u]=s,this._inflate.write(e),t&&this._inflate.write(d),this._inflate.flush(()=>{let e=this._inflate[_];if(e){this._inflate.close(),this._inflate=null,s(e);return}let r=o.concat(this._inflate[b],this._inflate[c]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[c]=0,this._inflate[b]=[],t&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),s(null,r)})}_compress(e,t,s){let i=this._isServer?"server":"client";if(!this._deflate){let e=`${i}_max_window_bits`,t="number"!=typeof this.params[e]?r.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[c]=0,this._deflate[b]=[],this._deflate.on("data",f)}this._deflate[u]=s,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=o.concat(this._deflate[b],this._deflate[c]);t&&(e=new l(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[c]=0,this._deflate[b]=[],t&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"(t){let{Writable:s}=i("stream"),r=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:l}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{concat:d,toArrayBuffer:h,unmask:c}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),{isValidStatusCode:u,isValidUTF8:b}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),_=Buffer[Symbol.species];t.exports=class extends s{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[l]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,s){return 8===this._opcode&&0==this._state?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new _(t.buffer,t.byteOffset+e,t.length-e),new _(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],i=t.length-e;e>=s.length?t.set(this._buffers.shift(),i):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),i),this._buffers[0]=new _(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[r.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=1:127===this._payloadLength?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&c(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._maxFragments>0&&++this._numFragments>this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(s)}this.dataMessage(t),0===this._state&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],2===this._opcode){let i;i="nodebuffer"===this._binaryType?d(s,t):"arraybuffer"===this._binaryType?h(d(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",i,!0),this._state=0,this.startLoop(e)}))}else{let i=d(s,t);if(!this._skipUTF8Validation&&!b(i))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));5===this._state||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit("message",i,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{let s=e.readUInt16BE(0);if(!u(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let i=new _(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!b(i))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,i),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=0,this.startLoop(t)}))}createError(e,t,s,i,r){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=r,o[a]=i,o}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"(t){let s,{Duplex:r}=i("stream"),{randomFillSync:o}=i("crypto"),{types:{isUint8Array:n}}=i("util"),a=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),{EMPTY_BUFFER:l,kWebSocket:d,NOOP:h}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{isBlob:c,isValidStatusCode:u}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),{mask:b,toBuffer:_}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),f=Symbol("kByteLength"),p=Buffer.alloc(4),m=8192;function v(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let i=e._queue[s],r=i[i.length-1];"function"==typeof r&&r(t)}}function y(e,t,s){v(e,t,s),e.onerror(t)}t.exports=class e{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=h,this[d]=void 0}static frame(e,t){let i,r,n=!1,a=2,l=!1;t.mask&&(i=t.maskBuffer||p,t.generateMask?t.generateMask(i):(8192===m&&(void 0===s&&(s=Buffer.alloc(8192)),o(s,0,8192),m=0),i[0]=s[m++],i[1]=s[m++],i[2]=s[m++],i[3]=s[m++]),l=(i[0]|i[1]|i[2]|i[3])==0,a=6),"string"==typeof e?r=(!t.mask||l)&&void 0!==t[f]?t[f]:(e=Buffer.from(e)).length:(r=e.length,n=t.mask&&t.readOnly&&!l);let d=r;r>=65536?(a+=8,d=127):r>125&&(a+=2,d=126);let h=Buffer.allocUnsafe(n?r+a:a);return(h[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(h[0]|=64),h[1]=d,126===d?h.writeUInt16BE(r,2):127===d&&(h[2]=h[3]=0,h.writeUIntBE(r,4,6)),t.mask)?(h[1]|=128,h[a-4]=i[0],h[a-3]=i[1],h[a-2]=i[2],h[a-1]=i[3],l)?[h,e]:n?(b(e,i,h,a,r),[h]):(b(e,i,e,0,r),[h,e]):[h,e]}close(t,s,i,r){let o;if(void 0===t)o=l;else if("number"==typeof t&&u(t))if(void 0!==s&&s.length){let e=Buffer.byteLength(s);if(e>123)throw RangeError("The message must not be greater than 123 bytes");if((o=Buffer.allocUnsafe(2+e)).writeUInt16BE(t,0),"string"==typeof s)o.write(s,2);else if(n(s))o.set(s,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(o=Buffer.allocUnsafe(2)).writeUInt16BE(t,0);else throw TypeError("First argument must be a valid error code number");let a={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};0!==this._state?this.enqueue([this.dispatch,o,!1,a,r]):this.sendFrame(e.frame(o,a),r)}ping(t,s,i){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):c(t)?(r=t.size,o=!1):(r=(t=_(t)).length,o=_.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[f]:r,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,i]):this.getBlobData(t,!1,n,i):0!==this._state?this.enqueue([this.dispatch,t,!1,n,i]):this.sendFrame(e.frame(t,n),i)}pong(t,s,i){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):c(t)?(r=t.size,o=!1):(r=(t=_(t)).length,o=_.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let n={[f]:r,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};c(t)?0!==this._state?this.enqueue([this.getBlobData,t,!1,n,i]):this.getBlobData(t,!1,n,i):0!==this._state?this.enqueue([this.dispatch,t,!1,n,i]):this.sendFrame(e.frame(t,n),i)}send(e,t,s){let i,r,o=this._extensions[a.extensionName],n=t.binary?2:1,l=t.compress;"string"==typeof e?(i=Buffer.byteLength(e),r=!1):c(e)?(i=e.size,r=!1):(i=(e=_(e)).length,r=_.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=i>=o._threshold),this._compress=l):(l=!1,n=0),t.fin&&(this._firstFragment=!0);let d={[f]:i,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:r,rsv1:l};c(e)?0!==this._state?this.enqueue([this.getBlobData,e,this._compress,d,s]):this.getBlobData(e,this._compress,d,s):0!==this._state?this.enqueue([this.dispatch,e,this._compress,d,s]):this.dispatch(e,this._compress,d,s)}getBlobData(t,s,i,r){this._bufferedBytes+=i[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(v,this,e,r);return}this._bufferedBytes-=i[f];let o=_(t);s?this.dispatch(o,s,i,r):(this._state=0,this.sendFrame(e.frame(o,i),r),this.dequeue())}).catch(e=>{process.nextTick(y,this,e,r)})}dispatch(t,s,i,r){if(!s)return void this.sendFrame(e.frame(t,i),r);let o=this._extensions[a.extensionName];this._bufferedBytes+=i[f],this._state=1,o.compress(t,i.fin,(t,s)=>{this._socket.destroyed?v(this,Error("The socket was closed while data was being compressed"),r):(this._bufferedBytes-=i[f],this._state=0,i.readOnly=!1,this.sendFrame(e.frame(s,i),r),this.dequeue())})}dequeue(){for(;0===this._state&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/stream.js"(t){e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js");let{Duplex:s}=i("stream");function r(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}t.exports=function(e,t){let i=!0,a=new s({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let i=!s&&a._readableState.objectMode?t.toString():t;a.push(i)||e.pause()}),e.once("error",function(e){a.destroyed||(i=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,s){if(e.readyState===e.CLOSED){s(t),process.nextTick(r,a);return}let o=!1;e.once("error",function(e){o=!0,s(e)}),e.once("close",function(){o||s(t),process.nextTick(r,a)}),i&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,i){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,i)}):e.send(t,i)},a.on("end",o),a.on("error",n),a}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"(t){let{tokenChars:s}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js");t.exports={parse:function(e){let t=new Set,i=-1,r=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===r&&1===s[n])-1===i&&(i=o);else if(0!==o&&(32===n||9===n))-1===r&&-1!==i&&(r=o);else if(44===n){if(-1===i)throw SyntaxError(`Unexpected character at index ${o}`);-1===r&&(r=o);let s=e.slice(i,r);if(t.has(s))throw SyntaxError(`The "${s}" subprotocol is duplicated`);t.add(s),i=r=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===i||-1!==r)throw SyntaxError("Unexpected end of input");let n=e.slice(i,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"(t){let{isUtf8:s}=i("buffer"),{hasBlob:r}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js");function o(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}t.exports={isBlob:function(e){return r&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:o,tokenChars:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0]},s&&(t.exports.isValidUTF8=function(e){return e.length<24?o(e):s(e)})},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket-server.js"(t){let s=i("node:events"),r=i("http"),{Duplex:o}=i("stream"),{createHash:n}=i("crypto"),a=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),l=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),d=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"),h=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js"),{CLOSE_TIMEOUT:c,GUID:u,kWebSocket:b}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),_=/^[+/0-9A-Za-z]{22}==$/;function f(e){e._state=2,e.emit("close")}function p(){this.destroy()}function m(e,t,s,i){s=s||r.STATUS_CODES[t],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...i},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r
|
|
2
|
+
`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join("\r\n")+"\r\n\r\n"+s)}function v(e,t,s,i,r,o){if(e.listenerCount("wsClientError")){let i=Error(r);Error.captureStackTrace(i,v),e.emit("wsClientError",i,s,t)}else m(s,i,r,o)}t.exports=class extends s{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:c,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:h,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=r.createServer((e,t)=>{let s=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let e=this.emit.bind(this,"connection");this._removeListeners=function(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,i)=>{this.handleUpgrade(t,s,i,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(2===this._state){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(f,this);return}if(e&&this.once("close",e),1!==this._state)if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(f,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{f(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,i){t.on("error",p);let r=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void v(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void v(this,e,t,400,"Invalid Upgrade header");if(void 0===r||!_.test(r))return void v(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==n&&8!==n)return void v(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void m(t,400);let h=e.headers["sec-websocket-protocol"],c=new Set;if(void 0!==h)try{c=d.parse(h)}catch(s){v(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],b={};if(this.options.perMessageDeflate&&void 0!==u){let s=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=a.parse(u);e[l.extensionName]&&(s.accept(e[l.extensionName]),b[l.extensionName]=s)}catch(s){v(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===n?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return m(t,n||401,a,l);this.completeUpgrade(b,r,c,e,t,s,i)});if(!this.options.verifyClient(o))return m(t,401)}this.completeUpgrade(b,r,c,e,t,s,i)}completeUpgrade(e,t,s,i,r,o,d){if(!r.readable||!r.writable)return r.destroy();if(r[b])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return m(r,503);let h=n("sha1").update(t+u).digest("base64"),c=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${h}`],_=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,i):s.values().next().value;e&&(c.push(`Sec-WebSocket-Protocol: ${e}`),_._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,s=a.format({[l.extensionName]:[t]});c.push(`Sec-WebSocket-Extensions: ${s}`),_._extensions=e}this.emit("headers",c,i),r.write(c.concat("\r\n").join("\r\n")),r.removeListener("error",p),_.setSocket(r,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(_),_.on("close",()=>{this.clients.delete(_),this._shouldEmitClose&&!this.clients.size&&process.nextTick(f,this)})),d(_,i)}}},"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js"(t){let s=i("node:events"),r=i("https"),o=i("http"),n=i("net"),a=i("tls"),{randomBytes:l,createHash:d}=i("crypto"),{Duplex:h,Readable:c}=i("stream"),{URL:u}=i("url"),b=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),_=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"),f=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"),{isBlob:p}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/validation.js"),{BINARY_TYPES:m,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:g,kForOnEventAttribute:w,kListener:S,kStatusCode:k,kWebSocket:E,NOOP:x}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/constants.js"),{EventTarget:{addEventListener:T,removeEventListener:C}}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/event-target.js"),{format:O,parse:N}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),{toBuffer:L}=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/buffer-util.js"),P=Symbol("kAborted"),B=[8,13],R=["CONNECTING","OPEN","CLOSING","CLOSED"],j=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class U extends s{constructor(e,t,s){super(),this._binaryType=m[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=U.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),function e(t,s,i,n){let a,h,c,_,f={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:B[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=f.autoPong,t._closeTimeout=f.closeTimeout,!B.includes(f.protocolVersion))throw RangeError(`Unsupported protocol version: ${f.protocolVersion} (supported versions: ${B.join(", ")})`);if(s instanceof u)a=s;else try{a=new u(s)}catch{throw SyntaxError(`Invalid URL: ${s}`)}"http:"===a.protocol?a.protocol="ws:":"https:"===a.protocol&&(a.protocol="wss:"),t._url=a.href;let p="wss:"===a.protocol,m="ws+unix:"===a.protocol;if("ws:"===a.protocol||p||m?m&&!a.pathname?h="The URL's pathname is empty":a.hash&&(h="The URL contains a fragment identifier"):h='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',h){let e=SyntaxError(h);if(0!==t._redirects)return void I(t,e);throw e}let y=p?443:80,w=l(16).toString("base64"),S=p?r.request:o.request,k=new Set;if(f.createConnection=f.createConnection||(p?M:D),f.defaultPort=f.defaultPort||y,f.port=a.port||y,f.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,f.headers={...f.headers,"Sec-WebSocket-Version":f.protocolVersion,"Sec-WebSocket-Key":w,Connection:"Upgrade",Upgrade:"websocket"},f.path=a.pathname+a.search,f.timeout=f.handshakeTimeout,f.perMessageDeflate&&(c=new b({...f.perMessageDeflate,isServer:!1,maxPayload:f.maxPayload}),f.headers["Sec-WebSocket-Extensions"]=O({[b.extensionName]:c.offer()})),i.length){for(let e of i){if("string"!=typeof e||!j.test(e)||k.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");k.add(e)}f.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(f.origin&&(f.protocolVersion<13?f.headers["Sec-WebSocket-Origin"]=f.origin:f.headers.Origin=f.origin),(a.username||a.password)&&(f.auth=`${a.username}:${a.password}`),m){let e=f.path.split(":");f.socketPath=e[0],f.path=e[1]}if(f.followRedirects){if(0===t._redirects){t._originalIpc=m,t._originalSecure=p,t._originalHostOrSocketPath=m?f.socketPath:a.host;let e=n&&n.headers;if(n={...n,headers:{}},e)for(let[t,s]of Object.entries(e))n.headers[t.toLowerCase()]=s}else if(0===t.listenerCount("redirect")){let e=m?!!t._originalIpc&&f.socketPath===t._originalHostOrSocketPath:!t._originalIpc&&a.host===t._originalHostOrSocketPath;e&&(!t._originalSecure||p)||(delete f.headers.authorization,delete f.headers.cookie,e||delete f.headers.host,f.auth=void 0)}f.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(f.auth).toString("base64")),_=t._req=S(f),t._redirects&&t.emit("redirect",t.url,_)}else _=t._req=S(f);f.timeout&&_.on("timeout",()=>{W(t,_,"Opening handshake has timed out")}),_.on("error",e=>{null===_||_[P]||(_=t._req=null,I(t,e))}),_.on("response",r=>{let o=r.headers.location,a=r.statusCode;if(o&&f.followRedirects&&a>=300&&a<400){let r;if(++t._redirects>f.maxRedirects)return void W(t,_,"Maximum redirects exceeded");_.abort();try{r=new u(o,s)}catch(e){I(t,SyntaxError(`Invalid URL: ${o}`));return}e(t,r,i,n)}else t.emit("unexpected-response",_,r)||W(t,_,`Unexpected server response: ${r.statusCode}`)}),_.on("upgrade",(e,s,i)=>{let r;if(t.emit("upgrade",e),t.readyState!==U.CONNECTING)return;_=t._req=null;let o=e.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void W(t,s,"Invalid Upgrade header");let n=d("sha1").update(w+g).digest("base64");if(e.headers["sec-websocket-accept"]!==n)return void W(t,s,"Invalid Sec-WebSocket-Accept header");let a=e.headers["sec-websocket-protocol"];if(void 0!==a?k.size?k.has(a)||(r="Server sent an invalid subprotocol"):r="Server sent a subprotocol but none was requested":k.size&&(r="Server sent no subprotocol"),r)return void W(t,s,r);a&&(t._protocol=a);let l=e.headers["sec-websocket-extensions"];if(void 0!==l){let e;if(!c)return void W(t,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{e=N(l)}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}let i=Object.keys(e);if(1!==i.length||i[0]!==b.extensionName)return void W(t,s,"Server indicated an extension that was not requested");try{c.accept(e[b.extensionName])}catch(e){W(t,s,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[b.extensionName]=c}t.setSocket(s,i,{allowSynchronousEvents:f.allowSynchronousEvents,generateMask:f.generateMask,maxBufferedChunks:f.maxBufferedChunks,maxFragments:f.maxFragments,maxPayload:f.maxPayload,skipUTF8Validation:f.skipUTF8Validation})}),f.finishRequest?f.finishRequest(_,t):_.end()}(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){m.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,s){let i=new _({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),r=new f(e,this._extensions,s.generateMask);this._receiver=i,this._sender=r,this._socket=e,i[E]=this,r[E]=this,e[E]=this,i.on("conclude",A),i.on("drain",$),i.on("error",G),i.on("message",q),i.on("ping",z),i.on("pong",H),r.onerror=X,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Z),e.on("data",J),e.on("end",Q),e.on("error",ee),this._readyState=U.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[b.extensionName]&&this._extensions[b.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=U.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===U.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=U.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Y(this)}}pause(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||y,t,s))}pong(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)?F(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||y,t,s))}resume(){this.readyState!==U.CONNECTING&&this.readyState!==U.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===U.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==U.OPEN)return void F(this,e,s);let i={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[b.extensionName]||(i.compress=!1),this._sender.send(e||y,i,s)}terminate(){if(this.readyState!==U.CLOSED){if(this.readyState===U.CONNECTING)return void W(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=U.CLOSING,this._socket.destroy())}}}function I(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function D(e){return e.path=e.socketPath,n.connect(e)}function M(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function W(e,t,s){e._readyState=U.CLOSING;let i=Error(s);Error.captureStackTrace(i,W),t.setHeader?(t[P]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(I,e,i)):(t.destroy(i),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function F(e,t,s){if(t){let s=p(t)?t.size:L(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${R[e.readyState]})`);process.nextTick(s,t)}}function A(e,t){let s=this[E];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[E]&&(s._socket.removeListener("data",J),process.nextTick(K,s._socket),1005===e?s.close():s.close(e,t))}function $(){let e=this[E];e.isPaused||e._socket.resume()}function G(e){let t=this[E];void 0!==t._socket[E]&&(t._socket.removeListener("data",J),process.nextTick(K,t._socket),t.close(e[k])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function V(){this[E].emitClose()}function q(e,t){this[E].emit("message",e,t)}function z(e){let t=this[E];t._autoPong&&t.pong(e,!this._isServer,x),t.emit("ping",e)}function H(e){this[E].emit("pong",e)}function K(e){e.resume()}function X(e){let t=this[E];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Y(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function Y(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Z(){let e=this[E];if(this.removeListener("close",Z),this.removeListener("data",J),this.removeListener("end",Q),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[E]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",V),e._receiver.on("finish",V))}function J(e){this[E]._receiver.write(e)||this.pause()}function Q(){let e=this[E];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function ee(){let e=this[E];this.removeListener("error",ee),this.on("error",x),e&&(e._readyState=U.CLOSING,this.destroy())}Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:R.indexOf("CONNECTING")}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:R.indexOf("OPEN")}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:R.indexOf("CLOSING")}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:R.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[w])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[w]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[w]:!0})}})}),U.prototype.addEventListener=T,U.prototype.removeEventListener=C,t.exports=U}});let r=e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket-server.js");e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/stream.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/extension.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/permessage-deflate.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/receiver.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/sender.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/subprotocol.js"),e("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ws/8.21.3/58834c6b3a7abd5672feb797b5d01c0189b316301b54597109333a06c20bee72/node_modules/ws/lib/websocket.js");export{r as WebSocketServer};
|