@leofcoin/chain 1.10.16 → 1.10.18

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.
Files changed (31) hide show
  1. package/exports/beacon-envelope.js +6 -6
  2. package/exports/beacon-epoch.js +1 -1
  3. package/exports/beacon-lifecycle.js +1 -1
  4. package/exports/beacon-round.js +1 -1
  5. package/exports/beacon.js +15 -14
  6. package/exports/browser/_commonjsHelpers-B85MJLTf.js +5 -0
  7. package/exports/browser/beacon-envelope.js +61 -150
  8. package/exports/browser/beacon-epoch.js +2 -2
  9. package/exports/browser/beacon-lifecycle.js +3 -3
  10. package/exports/browser/beacon-round.js +2 -2
  11. package/exports/browser/beacon-wire.js +3 -3
  12. package/exports/browser/beacon.js +2483 -1228
  13. package/exports/browser/{browser-CCfR9KOM-CvhDZrGu.js → browser-CCfR9KOM-CpStHgTj.js} +4 -4
  14. package/exports/browser/{browser-crypto-CeE-yId5.js → browser-crypto-CH0ua22L.js} +1 -1
  15. package/exports/browser/chain.js +151 -81
  16. package/exports/browser/{client-CAC7RVMf-Dmz_2A_5.js → client-C_pBoi1g-_pfKzCvX.js} +256 -80
  17. package/exports/browser/{connection-monitor-Cmv00mwl.js → connection-monitor-D-krNiRH.js} +1 -1
  18. package/exports/browser/{hkdf-CnZvwpZ9.js → hkdf-BUHINPFj.js} +2 -94
  19. package/exports/browser/{index-BC-KRBgE.js → index-DmuI-29u.js} +1 -1
  20. package/exports/browser/{index-dTQVgkpf-CuHJWO2l.js → index-dTQVgkpf-BbdshWB0.js} +4 -4
  21. package/exports/browser/index.browser-CFfJpgKV.js +857 -0
  22. package/exports/browser/{messages-Dw86z0zq-DrPw_nlZ.js → messages-BGHaihSi-eHZVl0y9.js} +4 -4
  23. package/exports/browser/{node-browser-DWSdi-XP.js → node-browser-BNe-en1l.js} +5 -5
  24. package/exports/browser/node-browser.js +4 -4
  25. package/exports/browser/{sha2-piimb6xL.js → sha2-BKcEJzgd.js} +144 -3
  26. package/exports/browser/weierstrass-BVfhtHbl.js +3596 -0
  27. package/exports/browser/workers/machine-worker.js +61 -19
  28. package/exports/chain.js +146 -73
  29. package/exports/workers/machine-worker.js +61 -19
  30. package/package.json +14 -13
  31. package/exports/browser/weierstrass-Q0QND1ZT.js +0 -2156
@@ -0,0 +1,857 @@
1
+ import 'node:stream/web';
2
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-B85MJLTf.js';
3
+
4
+ var browser = {exports: {}};
5
+
6
+ /**
7
+ * Helpers.
8
+ */
9
+
10
+ var ms;
11
+ var hasRequiredMs;
12
+
13
+ function requireMs () {
14
+ if (hasRequiredMs) return ms;
15
+ hasRequiredMs = 1;
16
+ var s = 1000;
17
+ var m = s * 60;
18
+ var h = m * 60;
19
+ var d = h * 24;
20
+ var w = d * 7;
21
+ var y = d * 365.25;
22
+
23
+ /**
24
+ * Parse or format the given `val`.
25
+ *
26
+ * Options:
27
+ *
28
+ * - `long` verbose formatting [false]
29
+ *
30
+ * @param {String|Number} val
31
+ * @param {Object} [options]
32
+ * @throws {Error} throw an error if val is not a non-empty string or a number
33
+ * @return {String|Number}
34
+ * @api public
35
+ */
36
+
37
+ ms = function (val, options) {
38
+ options = options || {};
39
+ var type = typeof val;
40
+ if (type === 'string' && val.length > 0) {
41
+ return parse(val);
42
+ } else if (type === 'number' && isFinite(val)) {
43
+ return options.long ? fmtLong(val) : fmtShort(val);
44
+ }
45
+ throw new Error(
46
+ 'val is not a non-empty string or a valid number. val=' +
47
+ JSON.stringify(val)
48
+ );
49
+ };
50
+
51
+ /**
52
+ * Parse the given `str` and return milliseconds.
53
+ *
54
+ * @param {String} str
55
+ * @return {Number}
56
+ * @api private
57
+ */
58
+
59
+ function parse(str) {
60
+ str = String(str);
61
+ if (str.length > 100) {
62
+ return;
63
+ }
64
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
65
+ str
66
+ );
67
+ if (!match) {
68
+ return;
69
+ }
70
+ var n = parseFloat(match[1]);
71
+ var type = (match[2] || 'ms').toLowerCase();
72
+ switch (type) {
73
+ case 'years':
74
+ case 'year':
75
+ case 'yrs':
76
+ case 'yr':
77
+ case 'y':
78
+ return n * y;
79
+ case 'weeks':
80
+ case 'week':
81
+ case 'w':
82
+ return n * w;
83
+ case 'days':
84
+ case 'day':
85
+ case 'd':
86
+ return n * d;
87
+ case 'hours':
88
+ case 'hour':
89
+ case 'hrs':
90
+ case 'hr':
91
+ case 'h':
92
+ return n * h;
93
+ case 'minutes':
94
+ case 'minute':
95
+ case 'mins':
96
+ case 'min':
97
+ case 'm':
98
+ return n * m;
99
+ case 'seconds':
100
+ case 'second':
101
+ case 'secs':
102
+ case 'sec':
103
+ case 's':
104
+ return n * s;
105
+ case 'milliseconds':
106
+ case 'millisecond':
107
+ case 'msecs':
108
+ case 'msec':
109
+ case 'ms':
110
+ return n;
111
+ default:
112
+ return undefined;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Short format for `ms`.
118
+ *
119
+ * @param {Number} ms
120
+ * @return {String}
121
+ * @api private
122
+ */
123
+
124
+ function fmtShort(ms) {
125
+ var msAbs = Math.abs(ms);
126
+ if (msAbs >= d) {
127
+ return Math.round(ms / d) + 'd';
128
+ }
129
+ if (msAbs >= h) {
130
+ return Math.round(ms / h) + 'h';
131
+ }
132
+ if (msAbs >= m) {
133
+ return Math.round(ms / m) + 'm';
134
+ }
135
+ if (msAbs >= s) {
136
+ return Math.round(ms / s) + 's';
137
+ }
138
+ return ms + 'ms';
139
+ }
140
+
141
+ /**
142
+ * Long format for `ms`.
143
+ *
144
+ * @param {Number} ms
145
+ * @return {String}
146
+ * @api private
147
+ */
148
+
149
+ function fmtLong(ms) {
150
+ var msAbs = Math.abs(ms);
151
+ if (msAbs >= d) {
152
+ return plural(ms, msAbs, d, 'day');
153
+ }
154
+ if (msAbs >= h) {
155
+ return plural(ms, msAbs, h, 'hour');
156
+ }
157
+ if (msAbs >= m) {
158
+ return plural(ms, msAbs, m, 'minute');
159
+ }
160
+ if (msAbs >= s) {
161
+ return plural(ms, msAbs, s, 'second');
162
+ }
163
+ return ms + ' ms';
164
+ }
165
+
166
+ /**
167
+ * Pluralization helper.
168
+ */
169
+
170
+ function plural(ms, msAbs, n, name) {
171
+ var isPlural = msAbs >= n * 1.5;
172
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
173
+ }
174
+ return ms;
175
+ }
176
+
177
+ var common;
178
+ var hasRequiredCommon;
179
+
180
+ function requireCommon () {
181
+ if (hasRequiredCommon) return common;
182
+ hasRequiredCommon = 1;
183
+ /**
184
+ * This is the common logic for both the Node.js and web browser
185
+ * implementations of `debug()`.
186
+ */
187
+
188
+ function setup(env) {
189
+ createDebug.debug = createDebug;
190
+ createDebug.default = createDebug;
191
+ createDebug.coerce = coerce;
192
+ createDebug.disable = disable;
193
+ createDebug.enable = enable;
194
+ createDebug.enabled = enabled;
195
+ createDebug.humanize = requireMs();
196
+ createDebug.destroy = destroy;
197
+
198
+ Object.keys(env).forEach(key => {
199
+ createDebug[key] = env[key];
200
+ });
201
+
202
+ /**
203
+ * The currently active debug mode names, and names to skip.
204
+ */
205
+
206
+ createDebug.names = [];
207
+ createDebug.skips = [];
208
+
209
+ /**
210
+ * Map of special "%n" handling functions, for the debug "format" argument.
211
+ *
212
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
213
+ */
214
+ createDebug.formatters = {};
215
+
216
+ /**
217
+ * Selects a color for a debug namespace
218
+ * @param {String} namespace The namespace string for the debug instance to be colored
219
+ * @return {Number|String} An ANSI color code for the given namespace
220
+ * @api private
221
+ */
222
+ function selectColor(namespace) {
223
+ let hash = 0;
224
+
225
+ for (let i = 0; i < namespace.length; i++) {
226
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
227
+ hash |= 0; // Convert to 32bit integer
228
+ }
229
+
230
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
231
+ }
232
+ createDebug.selectColor = selectColor;
233
+
234
+ /**
235
+ * Create a debugger with the given `namespace`.
236
+ *
237
+ * @param {String} namespace
238
+ * @return {Function}
239
+ * @api public
240
+ */
241
+ function createDebug(namespace) {
242
+ let prevTime;
243
+ let enableOverride = null;
244
+ let namespacesCache;
245
+ let enabledCache;
246
+
247
+ function debug(...args) {
248
+ // Disabled?
249
+ if (!debug.enabled) {
250
+ return;
251
+ }
252
+
253
+ const self = debug;
254
+
255
+ // Set `diff` timestamp
256
+ const curr = Number(new Date());
257
+ const ms = curr - (prevTime || curr);
258
+ self.diff = ms;
259
+ self.prev = prevTime;
260
+ self.curr = curr;
261
+ prevTime = curr;
262
+
263
+ args[0] = createDebug.coerce(args[0]);
264
+
265
+ if (typeof args[0] !== 'string') {
266
+ // Anything else let's inspect with %O
267
+ args.unshift('%O');
268
+ }
269
+
270
+ // Apply any `formatters` transformations
271
+ let index = 0;
272
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
273
+ // If we encounter an escaped % then don't increase the array index
274
+ if (match === '%%') {
275
+ return '%';
276
+ }
277
+ index++;
278
+ const formatter = createDebug.formatters[format];
279
+ if (typeof formatter === 'function') {
280
+ const val = args[index];
281
+ match = formatter.call(self, val);
282
+
283
+ // Now we need to remove `args[index]` since it's inlined in the `format`
284
+ args.splice(index, 1);
285
+ index--;
286
+ }
287
+ return match;
288
+ });
289
+
290
+ // Apply env-specific formatting (colors, etc.)
291
+ createDebug.formatArgs.call(self, args);
292
+
293
+ const logFn = self.log || createDebug.log;
294
+ logFn.apply(self, args);
295
+ }
296
+
297
+ debug.namespace = namespace;
298
+ debug.useColors = createDebug.useColors();
299
+ debug.color = createDebug.selectColor(namespace);
300
+ debug.extend = extend;
301
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
302
+
303
+ Object.defineProperty(debug, 'enabled', {
304
+ enumerable: true,
305
+ configurable: false,
306
+ get: () => {
307
+ if (enableOverride !== null) {
308
+ return enableOverride;
309
+ }
310
+ if (namespacesCache !== createDebug.namespaces) {
311
+ namespacesCache = createDebug.namespaces;
312
+ enabledCache = createDebug.enabled(namespace);
313
+ }
314
+
315
+ return enabledCache;
316
+ },
317
+ set: v => {
318
+ enableOverride = v;
319
+ }
320
+ });
321
+
322
+ // Env-specific initialization logic for debug instances
323
+ if (typeof createDebug.init === 'function') {
324
+ createDebug.init(debug);
325
+ }
326
+
327
+ return debug;
328
+ }
329
+
330
+ function extend(namespace, delimiter) {
331
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
332
+ newDebug.log = this.log;
333
+ return newDebug;
334
+ }
335
+
336
+ /**
337
+ * Enables a debug mode by namespaces. This can include modes
338
+ * separated by a colon and wildcards.
339
+ *
340
+ * @param {String} namespaces
341
+ * @api public
342
+ */
343
+ function enable(namespaces) {
344
+ createDebug.save(namespaces);
345
+ createDebug.namespaces = namespaces;
346
+
347
+ createDebug.names = [];
348
+ createDebug.skips = [];
349
+
350
+ const split = (typeof namespaces === 'string' ? namespaces : '')
351
+ .trim()
352
+ .replace(/\s+/g, ',')
353
+ .split(',')
354
+ .filter(Boolean);
355
+
356
+ for (const ns of split) {
357
+ if (ns[0] === '-') {
358
+ createDebug.skips.push(ns.slice(1));
359
+ } else {
360
+ createDebug.names.push(ns);
361
+ }
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Checks if the given string matches a namespace template, honoring
367
+ * asterisks as wildcards.
368
+ *
369
+ * @param {String} search
370
+ * @param {String} template
371
+ * @return {Boolean}
372
+ */
373
+ function matchesTemplate(search, template) {
374
+ let searchIndex = 0;
375
+ let templateIndex = 0;
376
+ let starIndex = -1;
377
+ let matchIndex = 0;
378
+
379
+ while (searchIndex < search.length) {
380
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
381
+ // Match character or proceed with wildcard
382
+ if (template[templateIndex] === '*') {
383
+ starIndex = templateIndex;
384
+ matchIndex = searchIndex;
385
+ templateIndex++; // Skip the '*'
386
+ } else {
387
+ searchIndex++;
388
+ templateIndex++;
389
+ }
390
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
391
+ // Backtrack to the last '*' and try to match more characters
392
+ templateIndex = starIndex + 1;
393
+ matchIndex++;
394
+ searchIndex = matchIndex;
395
+ } else {
396
+ return false; // No match
397
+ }
398
+ }
399
+
400
+ // Handle trailing '*' in template
401
+ while (templateIndex < template.length && template[templateIndex] === '*') {
402
+ templateIndex++;
403
+ }
404
+
405
+ return templateIndex === template.length;
406
+ }
407
+
408
+ /**
409
+ * Disable debug output.
410
+ *
411
+ * @return {String} namespaces
412
+ * @api public
413
+ */
414
+ function disable() {
415
+ const namespaces = [
416
+ ...createDebug.names,
417
+ ...createDebug.skips.map(namespace => '-' + namespace)
418
+ ].join(',');
419
+ createDebug.enable('');
420
+ return namespaces;
421
+ }
422
+
423
+ /**
424
+ * Returns true if the given mode name is enabled, false otherwise.
425
+ *
426
+ * @param {String} name
427
+ * @return {Boolean}
428
+ * @api public
429
+ */
430
+ function enabled(name) {
431
+ for (const skip of createDebug.skips) {
432
+ if (matchesTemplate(name, skip)) {
433
+ return false;
434
+ }
435
+ }
436
+
437
+ for (const ns of createDebug.names) {
438
+ if (matchesTemplate(name, ns)) {
439
+ return true;
440
+ }
441
+ }
442
+
443
+ return false;
444
+ }
445
+
446
+ /**
447
+ * Coerce `val`.
448
+ *
449
+ * @param {Mixed} val
450
+ * @return {Mixed}
451
+ * @api private
452
+ */
453
+ function coerce(val) {
454
+ if (val instanceof Error) {
455
+ return val.stack || val.message;
456
+ }
457
+ return val;
458
+ }
459
+
460
+ /**
461
+ * XXX DO NOT USE. This is a temporary stub function.
462
+ * XXX It WILL be removed in the next major release.
463
+ */
464
+ function destroy() {
465
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
466
+ }
467
+
468
+ createDebug.enable(createDebug.load());
469
+
470
+ return createDebug;
471
+ }
472
+
473
+ common = setup;
474
+ return common;
475
+ }
476
+
477
+ /* eslint-env browser */
478
+
479
+ var hasRequiredBrowser;
480
+
481
+ function requireBrowser () {
482
+ if (hasRequiredBrowser) return browser.exports;
483
+ hasRequiredBrowser = 1;
484
+ (function (module, exports) {
485
+ /**
486
+ * This is the web browser implementation of `debug()`.
487
+ */
488
+
489
+ exports.formatArgs = formatArgs;
490
+ exports.save = save;
491
+ exports.load = load;
492
+ exports.useColors = useColors;
493
+ exports.storage = localstorage();
494
+ exports.destroy = (() => {
495
+ let warned = false;
496
+
497
+ return () => {
498
+ if (!warned) {
499
+ warned = true;
500
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
501
+ }
502
+ };
503
+ })();
504
+
505
+ /**
506
+ * Colors.
507
+ */
508
+
509
+ exports.colors = [
510
+ '#0000CC',
511
+ '#0000FF',
512
+ '#0033CC',
513
+ '#0033FF',
514
+ '#0066CC',
515
+ '#0066FF',
516
+ '#0099CC',
517
+ '#0099FF',
518
+ '#00CC00',
519
+ '#00CC33',
520
+ '#00CC66',
521
+ '#00CC99',
522
+ '#00CCCC',
523
+ '#00CCFF',
524
+ '#3300CC',
525
+ '#3300FF',
526
+ '#3333CC',
527
+ '#3333FF',
528
+ '#3366CC',
529
+ '#3366FF',
530
+ '#3399CC',
531
+ '#3399FF',
532
+ '#33CC00',
533
+ '#33CC33',
534
+ '#33CC66',
535
+ '#33CC99',
536
+ '#33CCCC',
537
+ '#33CCFF',
538
+ '#6600CC',
539
+ '#6600FF',
540
+ '#6633CC',
541
+ '#6633FF',
542
+ '#66CC00',
543
+ '#66CC33',
544
+ '#9900CC',
545
+ '#9900FF',
546
+ '#9933CC',
547
+ '#9933FF',
548
+ '#99CC00',
549
+ '#99CC33',
550
+ '#CC0000',
551
+ '#CC0033',
552
+ '#CC0066',
553
+ '#CC0099',
554
+ '#CC00CC',
555
+ '#CC00FF',
556
+ '#CC3300',
557
+ '#CC3333',
558
+ '#CC3366',
559
+ '#CC3399',
560
+ '#CC33CC',
561
+ '#CC33FF',
562
+ '#CC6600',
563
+ '#CC6633',
564
+ '#CC9900',
565
+ '#CC9933',
566
+ '#CCCC00',
567
+ '#CCCC33',
568
+ '#FF0000',
569
+ '#FF0033',
570
+ '#FF0066',
571
+ '#FF0099',
572
+ '#FF00CC',
573
+ '#FF00FF',
574
+ '#FF3300',
575
+ '#FF3333',
576
+ '#FF3366',
577
+ '#FF3399',
578
+ '#FF33CC',
579
+ '#FF33FF',
580
+ '#FF6600',
581
+ '#FF6633',
582
+ '#FF9900',
583
+ '#FF9933',
584
+ '#FFCC00',
585
+ '#FFCC33'
586
+ ];
587
+
588
+ /**
589
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
590
+ * and the Firebug extension (any Firefox version) are known
591
+ * to support "%c" CSS customizations.
592
+ *
593
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
594
+ */
595
+
596
+ // eslint-disable-next-line complexity
597
+ function useColors() {
598
+ // NB: In an Electron preload script, document will be defined but not fully
599
+ // initialized. Since we know we're in Chrome, we'll just detect this case
600
+ // explicitly
601
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
602
+ return true;
603
+ }
604
+
605
+ // Internet Explorer and Edge do not support colors.
606
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
607
+ return false;
608
+ }
609
+
610
+ let m;
611
+
612
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
613
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
614
+ // eslint-disable-next-line no-return-assign
615
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
616
+ // Is firebug? http://stackoverflow.com/a/398120/376773
617
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
618
+ // Is firefox >= v31?
619
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
620
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
621
+ // Double check webkit in userAgent just in case we are in a worker
622
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
623
+ }
624
+
625
+ /**
626
+ * Colorize log arguments if enabled.
627
+ *
628
+ * @api public
629
+ */
630
+
631
+ function formatArgs(args) {
632
+ args[0] = (this.useColors ? '%c' : '') +
633
+ this.namespace +
634
+ (this.useColors ? ' %c' : ' ') +
635
+ args[0] +
636
+ (this.useColors ? '%c ' : ' ') +
637
+ '+' + module.exports.humanize(this.diff);
638
+
639
+ if (!this.useColors) {
640
+ return;
641
+ }
642
+
643
+ const c = 'color: ' + this.color;
644
+ args.splice(1, 0, c, 'color: inherit');
645
+
646
+ // The final "%c" is somewhat tricky, because there could be other
647
+ // arguments passed either before or after the %c, so we need to
648
+ // figure out the correct index to insert the CSS into
649
+ let index = 0;
650
+ let lastC = 0;
651
+ args[0].replace(/%[a-zA-Z%]/g, match => {
652
+ if (match === '%%') {
653
+ return;
654
+ }
655
+ index++;
656
+ if (match === '%c') {
657
+ // We only are interested in the *last* %c
658
+ // (the user may have provided their own)
659
+ lastC = index;
660
+ }
661
+ });
662
+
663
+ args.splice(lastC, 0, c);
664
+ }
665
+
666
+ /**
667
+ * Invokes `console.debug()` when available.
668
+ * No-op when `console.debug` is not a "function".
669
+ * If `console.debug` is not available, falls back
670
+ * to `console.log`.
671
+ *
672
+ * @api public
673
+ */
674
+ exports.log = console.debug || console.log || (() => {});
675
+
676
+ /**
677
+ * Save `namespaces`.
678
+ *
679
+ * @param {String} namespaces
680
+ * @api private
681
+ */
682
+ function save(namespaces) {
683
+ try {
684
+ if (namespaces) {
685
+ exports.storage.setItem('debug', namespaces);
686
+ } else {
687
+ exports.storage.removeItem('debug');
688
+ }
689
+ } catch (error) {
690
+ // Swallow
691
+ // XXX (@Qix-) should we be logging these?
692
+ }
693
+ }
694
+
695
+ /**
696
+ * Load `namespaces`.
697
+ *
698
+ * @return {String} returns the previously persisted debug modes
699
+ * @api private
700
+ */
701
+ function load() {
702
+ let r;
703
+ try {
704
+ r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
705
+ } catch (error) {
706
+ // Swallow
707
+ // XXX (@Qix-) should we be logging these?
708
+ }
709
+
710
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
711
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
712
+ r = process.env.DEBUG;
713
+ }
714
+
715
+ return r;
716
+ }
717
+
718
+ /**
719
+ * Localstorage attempts to return the localstorage.
720
+ *
721
+ * This is necessary because safari throws
722
+ * when a user disables cookies/localstorage
723
+ * and you attempt to access it.
724
+ *
725
+ * @return {LocalStorage}
726
+ * @api private
727
+ */
728
+
729
+ function localstorage() {
730
+ try {
731
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
732
+ // The Browser also has localStorage in the global context.
733
+ return localStorage;
734
+ } catch (error) {
735
+ // Swallow
736
+ // XXX (@Qix-) should we be logging these?
737
+ }
738
+ }
739
+
740
+ module.exports = requireCommon()(exports);
741
+
742
+ const {formatters} = module.exports;
743
+
744
+ /**
745
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
746
+ */
747
+
748
+ formatters.j = function (v) {
749
+ try {
750
+ return JSON.stringify(v);
751
+ } catch (error) {
752
+ return '[UnexpectedJSONParseError]: ' + error.message;
753
+ }
754
+ };
755
+ } (browser, browser.exports));
756
+ return browser.exports;
757
+ }
758
+
759
+ var browserExports = requireBrowser();
760
+ var debug = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
761
+
762
+ /**
763
+ * @param {string} name
764
+ * @returns {import('./types').Logger}
765
+ */
766
+ function logger(name) {
767
+ const dtrace = !!(typeof process === 'undefined' || process.env.DEBUG_TRACE);
768
+ return Object.assign(debug(name), {
769
+ error: debug(`${name}:error`),
770
+ trace: dtrace ? debug(`${name}:trace`) : () => {}
771
+ })
772
+ }
773
+
774
+ try {
775
+ // @ts-ignore
776
+ // eslint-disable-next-line no-unused-vars
777
+ const teststream = new ReadableStream({
778
+ // @ts-ignore
779
+ start: (
780
+ // eslint-disable-next-line no-unused-vars
781
+ /** @type {import("stream/web").ReadableByteStreamController} */ controller
782
+ ) => {},
783
+ type: 'bytes'
784
+ });
785
+ // eslint-disable-next-line no-unused-vars
786
+ } catch (error) {
787
+ }
788
+
789
+ const pid$7 = typeof process !== 'undefined' ? process.pid : 0;
790
+ logger(`webtransport:http3wtstream(${pid$7})`);
791
+
792
+ const pid$6 = typeof process !== 'undefined' ? process.pid : 0;
793
+ logger(`webtransport:httpwtsession(${pid$6})`);
794
+
795
+ const pid$5 = typeof process !== 'undefined' ? process.pid : 0;
796
+ logger(`webtransport:httpclient(${pid$5})`);
797
+
798
+ /**
799
+ * @typedef {import('../types').FlowControlable} FlowControlable
800
+ */
801
+
802
+ const pid$4 = typeof process !== 'undefined' ? process.pid : 0;
803
+ logger(`webtransport:flowcontroller(${pid$4})`);
804
+
805
+ const pid$3 = typeof process !== 'undefined' ? process.pid : 0;
806
+ logger(`webtransport:http2webtransportstream(${pid$3})`);
807
+ // @ts-ignore
808
+ if (typeof process !== 'undefined') process.nextTick;
809
+
810
+ const pid$2 = typeof process !== 'undefined' ? process.pid : 0;
811
+ logger(`webtransport:parserbase(${pid$2})`);
812
+
813
+ const pid$1 = typeof process !== 'undefined' ? process.pid : 0;
814
+ logger(`webtransport:streamidmanager(${pid$1})`);
815
+
816
+ /**
817
+ * @typedef {import('http2').Http2Stream} Http2Stream
818
+ * @typedef {import('../dom.js').WebTransportSendGroup} WebTransportSendGroup
819
+ * @typedef {import('../dom.js').WebTransportSendStreamOptions} WebTransportSendStreamOptions
820
+ */
821
+
822
+ const pid = typeof process !== 'undefined' ? process.pid : 0;
823
+ logger(`webtransport:http2webtransportsession(${pid})`);
824
+ // @ts-ignore
825
+ if (typeof process !== 'undefined') process.nextTick;
826
+
827
+ logger(`webtransport:http2:browserparser`);
828
+
829
+ logger(`webtransport:http2:browser`);
830
+
831
+ const log = logger(`webtransport:browser()`);
832
+
833
+ // @ts-ignore
834
+ if (globalThis.WebTransport) {
835
+ try {
836
+ // @ts-ignore
837
+ // eslint-disable-next-line no-undef
838
+ const transport = new WebTransport('https://example.com:23333/test', {
839
+ serverCertificateHashes: []
840
+ });
841
+ transport.ready
842
+ .then(() => {
843
+ try {
844
+ transport.close();
845
+ // eslint-disable-next-line no-empty, no-unused-vars
846
+ } catch (error) {}
847
+ })
848
+ .catch(() => {});
849
+ } catch (error) {
850
+ // @ts-ignore
851
+ if (error?.name === 'NotSupportedError') {
852
+ // note: we also do not support this, but http2 is a different transport
853
+ // so we assume that the UDP and TCP part have different capabilities
854
+ log('serverCertificateHashesNotSupported');
855
+ }
856
+ }
857
+ }