@byloth/core 2.1.6 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.esm.js CHANGED
@@ -1,38 +1,5 @@
1
- var Ke = Object.defineProperty;
2
- var Qe = (i, n, e) => n in i ? Ke(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var a = (i, n, e) => Qe(i, typeof n != "symbol" ? n + "" : n, e);
4
- const Ye = typeof window < "u" && typeof window.document < "u";
5
- var A;
6
- const ot = typeof process < "u" && !!((A = process.versions) != null && A.node);
7
- var N;
8
- const at = typeof self == "object" && ((N = self.constructor) == null ? void 0 : N.name) === "DedicatedWorkerGlobalScope";
9
- var O, q;
10
- class c extends (q = Error, O = Symbol.toStringTag, q) {
11
- /**
12
- * Initializes a new instance of the {@link Exception} class.
13
- *
14
- * ---
15
- *
16
- * @example
17
- * ```ts
18
- * throw new Exception("An error occurred while processing the request.");
19
- * ```
20
- *
21
- * ---
22
- *
23
- * @param message The message that describes the error.
24
- * @param cause The previous caught error that caused this one, if any.
25
- * @param name The name of the exception. Default is `"Exception"`.
26
- */
27
- constructor(e, t, s = "Exception") {
28
- super(e);
29
- a(this, O, "Exception");
30
- this.cause = t, this.name = s, t && (t instanceof Error ? this.stack += `
31
-
32
- Caused by ${t.stack}` : this.stack += `
33
-
34
- Caused by ${t}`);
35
- }
1
+ const T = typeof window < "u" && typeof window.document < "u", A = typeof process < "u" && !!process.versions?.node, B = typeof self == "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
2
+ class c extends Error {
36
3
  /**
37
4
  * A static method to convert a generic caught error, ensuring it's an instance of the {@link Exception} class.
38
5
  *
@@ -64,9 +31,32 @@ Caused by ${t}`);
64
31
  }
65
32
  return new c(`${e}`);
66
33
  }
34
+ /**
35
+ * Initializes a new instance of the {@link Exception} class.
36
+ *
37
+ * ---
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * throw new Exception("An error occurred while processing the request.");
42
+ * ```
43
+ *
44
+ * ---
45
+ *
46
+ * @param message The message that describes the error.
47
+ * @param cause The previous caught error that caused this one, if any.
48
+ * @param name The name of the exception. Default is `"Exception"`.
49
+ */
50
+ constructor(e, t, n = "Exception") {
51
+ super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
52
+
53
+ Caused by ${t.stack}` : this.stack += `
54
+
55
+ Caused by ${t}`);
56
+ }
57
+ [Symbol.toStringTag] = "Exception";
67
58
  }
68
- var $, z;
69
- class g extends (z = c, $ = Symbol.toStringTag, z) {
59
+ class x extends c {
70
60
  /**
71
61
  * Initializes a new instance of the {@link FatalErrorException} class.
72
62
  *
@@ -83,14 +73,12 @@ class g extends (z = c, $ = Symbol.toStringTag, z) {
83
73
  * @param cause The previous caught error that caused this one, if any.
84
74
  * @param name The name of the exception. Default is `"FatalErrorException"`.
85
75
  */
86
- constructor(e, t, s = "FatalErrorException") {
87
- e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");
88
- super(e, t, s);
89
- a(this, $, "FatalErrorException");
76
+ constructor(e, t, n = "FatalErrorException") {
77
+ e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team."), super(e, t, n);
90
78
  }
79
+ [Symbol.toStringTag] = "FatalErrorException";
91
80
  }
92
- var D, B;
93
- class He extends (B = g, D = Symbol.toStringTag, B) {
81
+ class P extends x {
94
82
  /**
95
83
  * Initializes a new instance of the {@link NotImplementedException} class.
96
84
  *
@@ -107,14 +95,12 @@ class He extends (B = g, D = Symbol.toStringTag, B) {
107
95
  * @param cause The previous caught error that caused this one, if any.
108
96
  * @param name The name of the exception. Default is `"NotImplementedException"`.
109
97
  */
110
- constructor(e, t, s = "NotImplementedException") {
111
- e === void 0 && (e = "This feature isn't implemented yet. Please, try again later.");
112
- super(e, t, s);
113
- a(this, D, "NotImplementedException");
98
+ constructor(e, t, n = "NotImplementedException") {
99
+ e === void 0 && (e = "This feature isn't implemented yet. Please, try again later."), super(e, t, n);
114
100
  }
101
+ [Symbol.toStringTag] = "NotImplementedException";
115
102
  }
116
- var J, Y;
117
- class Le extends (Y = c, J = Symbol.toStringTag, Y) {
103
+ class E extends c {
118
104
  /**
119
105
  * Initializes a new instance of the {@link FileException} class.
120
106
  *
@@ -131,13 +117,12 @@ class Le extends (Y = c, J = Symbol.toStringTag, Y) {
131
117
  * @param cause The previous caught error that caused this one, if any.
132
118
  * @param name The name of the exception. Default is `"FileException"`.
133
119
  */
134
- constructor(e, t, s = "FileException") {
135
- super(e, t, s);
136
- a(this, J, "FileException");
120
+ constructor(e, t, n = "FileException") {
121
+ super(e, t, n);
137
122
  }
123
+ [Symbol.toStringTag] = "FileException";
138
124
  }
139
- var L, V;
140
- class lt extends (V = Le, L = Symbol.toStringTag, V) {
125
+ class J extends E {
141
126
  /**
142
127
  * Initializes a new instance of the {@link FileExistsException} class.
143
128
  *
@@ -154,13 +139,12 @@ class lt extends (V = Le, L = Symbol.toStringTag, V) {
154
139
  * @param cause The previous caught error that caused this one, if any.
155
140
  * @param name The name of the exception. Default is `"FileExistsException"`.
156
141
  */
157
- constructor(e, t, s = "FileExistsException") {
158
- super(e, t, s);
159
- a(this, L, "FileExistsException");
142
+ constructor(e, t, n = "FileExistsException") {
143
+ super(e, t, n);
160
144
  }
145
+ [Symbol.toStringTag] = "FileExistsException";
161
146
  }
162
- var G, K;
163
- class ut extends (K = Le, G = Symbol.toStringTag, K) {
147
+ class Y extends E {
164
148
  /**
165
149
  * Initializes a new instance of the {@link FileNotFoundException} class.
166
150
  *
@@ -177,13 +161,12 @@ class ut extends (K = Le, G = Symbol.toStringTag, K) {
177
161
  * @param cause The previous caught error that caused this one, if any.
178
162
  * @param name The name of the exception. Default is `"FileNotFoundException"`.
179
163
  */
180
- constructor(e, t, s = "FileNotFoundException") {
181
- super(e, t, s);
182
- a(this, G, "FileNotFoundException");
164
+ constructor(e, t, n = "FileNotFoundException") {
165
+ super(e, t, n);
183
166
  }
167
+ [Symbol.toStringTag] = "FileNotFoundException";
184
168
  }
185
- var Q, H;
186
- class _ extends (H = c, Q = Symbol.toStringTag, H) {
169
+ class _ extends c {
187
170
  /**
188
171
  * Initializes a new instance of the {@link KeyException} class.
189
172
  *
@@ -200,13 +183,12 @@ class _ extends (H = c, Q = Symbol.toStringTag, H) {
200
183
  * @param cause The previous caught error that caused this one, if any.
201
184
  * @param name The name of the exception. Default is `"KeyException"`.
202
185
  */
203
- constructor(e, t, s = "KeyException") {
204
- super(e, t, s);
205
- a(this, Q, "KeyException");
186
+ constructor(e, t, n = "KeyException") {
187
+ super(e, t, n);
206
188
  }
189
+ [Symbol.toStringTag] = "KeyException";
207
190
  }
208
- var X, Z;
209
- class ct extends (Z = c, X = Symbol.toStringTag, Z) {
191
+ class L extends c {
210
192
  /**
211
193
  * Initializes a new instance of the {@link NetworkException} class.
212
194
  *
@@ -223,13 +205,12 @@ class ct extends (Z = c, X = Symbol.toStringTag, Z) {
223
205
  * @param cause The previous caught error that caused this one, if any.
224
206
  * @param name The name of the exception. Default is `"NetworkException"`.
225
207
  */
226
- constructor(e, t, s = "NetworkException") {
227
- super(e, t, s);
228
- a(this, X, "NetworkException");
208
+ constructor(e, t, n = "NetworkException") {
209
+ super(e, t, n);
229
210
  }
211
+ [Symbol.toStringTag] = "NetworkException";
230
212
  }
231
- var W, U;
232
- class ht extends (U = c, W = Symbol.toStringTag, U) {
213
+ class V extends c {
233
214
  /**
234
215
  * Initializes a new instance of the {@link PermissionException} class.
235
216
  *
@@ -246,13 +227,12 @@ class ht extends (U = c, W = Symbol.toStringTag, U) {
246
227
  * @param cause The previous caught error that caused this one, if any.
247
228
  * @param name The name of the exception. Default is `"PermissionException"`.
248
229
  */
249
- constructor(e, t, s = "PermissionException") {
250
- super(e, t, s);
251
- a(this, W, "PermissionException");
230
+ constructor(e, t, n = "PermissionException") {
231
+ super(e, t, n);
252
232
  }
233
+ [Symbol.toStringTag] = "PermissionException";
253
234
  }
254
- var ee, te;
255
- class E extends (te = c, ee = Symbol.toStringTag, te) {
235
+ class S extends c {
256
236
  /**
257
237
  * Initializes a new instance of the {@link ReferenceException} class.
258
238
  *
@@ -269,13 +249,12 @@ class E extends (te = c, ee = Symbol.toStringTag, te) {
269
249
  * @param cause The previous caught error that caused this one, if any.
270
250
  * @param name The name of the exception. Default is `"ReferenceException"`.
271
251
  */
272
- constructor(e, t, s = "ReferenceException") {
273
- super(e, t, s);
274
- a(this, ee, "ReferenceException");
252
+ constructor(e, t, n = "ReferenceException") {
253
+ super(e, t, n);
275
254
  }
255
+ [Symbol.toStringTag] = "ReferenceException";
276
256
  }
277
- var ne, se;
278
- class p extends (se = c, ne = Symbol.toStringTag, se) {
257
+ class p extends c {
279
258
  /**
280
259
  * Initializes a new instance of the {@link RuntimeException} class.
281
260
  *
@@ -292,13 +271,12 @@ class p extends (se = c, ne = Symbol.toStringTag, se) {
292
271
  * @param cause The previous caught error that caused this one, if any.
293
272
  * @param name The name of the exception. Default is `"RuntimeException"`.
294
273
  */
295
- constructor(e, t, s = "RuntimeException") {
296
- super(e, t, s);
297
- a(this, ne, "RuntimeException");
274
+ constructor(e, t, n = "RuntimeException") {
275
+ super(e, t, n);
298
276
  }
277
+ [Symbol.toStringTag] = "RuntimeException";
299
278
  }
300
- var re, ie;
301
- class Xe extends (ie = p, re = Symbol.toStringTag, ie) {
279
+ class j extends p {
302
280
  /**
303
281
  * Initializes a new instance of the {@link EnvironmentException} class.
304
282
  *
@@ -315,13 +293,12 @@ class Xe extends (ie = p, re = Symbol.toStringTag, ie) {
315
293
  * @param cause The previous caught error that caused this one, if any.
316
294
  * @param name The name of the exception. Default is `"EnvironmentException"`.
317
295
  */
318
- constructor(e, t, s = "EnvironmentException") {
319
- super(e, t, s);
320
- a(this, re, "EnvironmentException");
296
+ constructor(e, t, n = "EnvironmentException") {
297
+ super(e, t, n);
321
298
  }
299
+ [Symbol.toStringTag] = "EnvironmentException";
322
300
  }
323
- var oe, ae;
324
- class Ze extends (ae = c, oe = Symbol.toStringTag, ae) {
301
+ class C extends c {
325
302
  /**
326
303
  * Initializes a new instance of the {@link TimeoutException} class.
327
304
  *
@@ -338,13 +315,12 @@ class Ze extends (ae = c, oe = Symbol.toStringTag, ae) {
338
315
  * @param cause The previous caught error that caused this one, if any.
339
316
  * @param name The name of the exception. Default is `"TimeoutException"`.
340
317
  */
341
- constructor(e, t, s = "TimeoutException") {
342
- super(e, t, s);
343
- a(this, oe, "TimeoutException");
318
+ constructor(e, t, n = "TimeoutException") {
319
+ super(e, t, n);
344
320
  }
321
+ [Symbol.toStringTag] = "TimeoutException";
345
322
  }
346
- var le, ue;
347
- class ft extends (ue = c, le = Symbol.toStringTag, ue) {
323
+ class G extends c {
348
324
  /**
349
325
  * Initializes a new instance of the {@link TypeException} class.
350
326
  *
@@ -361,13 +337,12 @@ class ft extends (ue = c, le = Symbol.toStringTag, ue) {
361
337
  * @param cause The previous caught error that caused this one, if any.
362
338
  * @param name The name of the exception. Default is `"TypeException"`.
363
339
  */
364
- constructor(e, t, s = "TypeException") {
365
- super(e, t, s);
366
- a(this, le, "TypeException");
340
+ constructor(e, t, n = "TypeException") {
341
+ super(e, t, n);
367
342
  }
343
+ [Symbol.toStringTag] = "TypeException";
368
344
  }
369
- var ce, he;
370
- class f extends (he = c, ce = Symbol.toStringTag, he) {
345
+ class f extends c {
371
346
  /**
372
347
  * Initializes a new instance of the {@link ValueException} class.
373
348
  *
@@ -384,13 +359,12 @@ class f extends (he = c, ce = Symbol.toStringTag, he) {
384
359
  * @param cause The previous caught error that caused this one, if any.
385
360
  * @param name The name of the exception. Default is `"ValueException"`.
386
361
  */
387
- constructor(e, t, s = "ValueException") {
388
- super(e, t, s);
389
- a(this, ce, "ValueException");
362
+ constructor(e, t, n = "ValueException") {
363
+ super(e, t, n);
390
364
  }
365
+ [Symbol.toStringTag] = "ValueException";
391
366
  }
392
- var fe, de;
393
- class b extends (de = f, fe = Symbol.toStringTag, de) {
367
+ class b extends f {
394
368
  /**
395
369
  * Initializes a new instance of the {@link RangeException} class.
396
370
  *
@@ -407,20 +381,18 @@ class b extends (de = f, fe = Symbol.toStringTag, de) {
407
381
  * @param cause The previous caught error that caused this one, if any.
408
382
  * @param name The name of the exception. Default is `"RangeException"`.
409
383
  */
410
- constructor(e, t, s = "RangeException") {
411
- super(e, t, s);
412
- a(this, fe, "RangeException");
384
+ constructor(e, t, n = "RangeException") {
385
+ super(e, t, n);
413
386
  }
387
+ [Symbol.toStringTag] = "RangeException";
414
388
  }
415
- var we;
416
- class u {
417
- constructor(n) {
418
- /**
419
- * The native {@link Iterator} object that is being wrapped by this instance.
420
- */
421
- a(this, "_iterator");
422
- a(this, we, "SmartIterator");
423
- n instanceof Function ? this._iterator = n() : Symbol.iterator in n ? this._iterator = n[Symbol.iterator]() : this._iterator = n;
389
+ class l {
390
+ /**
391
+ * The native {@link Iterator} object that is being wrapped by this instance.
392
+ */
393
+ _iterator;
394
+ constructor(e) {
395
+ e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e;
424
396
  }
425
397
  /**
426
398
  * Determines whether all elements of the iterator satisfy a given condition.
@@ -451,15 +423,15 @@ class u {
451
423
  *
452
424
  * @returns `true` if all elements satisfy the condition, `false` otherwise.
453
425
  */
454
- every(n) {
455
- let e = 0;
426
+ every(e) {
427
+ let t = 0;
456
428
  for (; ; ) {
457
- const t = this._iterator.next();
458
- if (t.done)
429
+ const n = this._iterator.next();
430
+ if (n.done)
459
431
  return !0;
460
- if (!n(t.value, e))
432
+ if (!e(n.value, t))
461
433
  return !1;
462
- e += 1;
434
+ t += 1;
463
435
  }
464
436
  }
465
437
  /**
@@ -491,26 +463,26 @@ class u {
491
463
  *
492
464
  * @returns `true` if any element satisfies the condition, `false` otherwise.
493
465
  */
494
- some(n) {
495
- let e = 0;
466
+ some(e) {
467
+ let t = 0;
496
468
  for (; ; ) {
497
- const t = this._iterator.next();
498
- if (t.done)
469
+ const n = this._iterator.next();
470
+ if (n.done)
499
471
  return !1;
500
- if (n(t.value, e))
472
+ if (e(n.value, t))
501
473
  return !0;
502
- e += 1;
474
+ t += 1;
503
475
  }
504
476
  }
505
- filter(n) {
506
- const e = this._iterator;
507
- return new u(function* () {
508
- let t = 0;
477
+ filter(e) {
478
+ const t = this._iterator;
479
+ return new l(function* () {
480
+ let n = 0;
509
481
  for (; ; ) {
510
- const s = e.next();
482
+ const s = t.next();
511
483
  if (s.done)
512
484
  return s.value;
513
- n(s.value, t) && (yield s.value), t += 1;
485
+ e(s.value, n) && (yield s.value), n += 1;
514
486
  }
515
487
  });
516
488
  }
@@ -545,31 +517,31 @@ class u {
545
517
  *
546
518
  * @returns A new {@link SmartIterator} containing the transformed elements.
547
519
  */
548
- map(n) {
549
- const e = this._iterator;
550
- return new u(function* () {
551
- let t = 0;
520
+ map(e) {
521
+ const t = this._iterator;
522
+ return new l(function* () {
523
+ let n = 0;
552
524
  for (; ; ) {
553
- const s = e.next();
525
+ const s = t.next();
554
526
  if (s.done)
555
527
  return s.value;
556
- yield n(s.value, t), t += 1;
528
+ yield e(s.value, n), n += 1;
557
529
  }
558
530
  });
559
531
  }
560
- reduce(n, e) {
561
- let t = 0, s = e;
532
+ reduce(e, t) {
533
+ let n = 0, s = t;
562
534
  if (s === void 0) {
563
- const r = this._iterator.next();
564
- if (r.done)
535
+ const i = this._iterator.next();
536
+ if (i.done)
565
537
  throw new f("Cannot reduce an empty iterator without an initial value.");
566
- s = r.value, t += 1;
538
+ s = i.value, n += 1;
567
539
  }
568
540
  for (; ; ) {
569
- const r = this._iterator.next();
570
- if (r.done)
541
+ const i = this._iterator.next();
542
+ if (i.done)
571
543
  return s;
572
- s = n(s, r.value, t), t += 1;
544
+ s = e(s, i.value, n), n += 1;
573
545
  }
574
546
  }
575
547
  /**
@@ -603,21 +575,21 @@ class u {
603
575
  *
604
576
  * @returns A new {@link SmartIterator} containing the flattened elements.
605
577
  */
606
- flatMap(n) {
607
- const e = this._iterator;
608
- return new u(function* () {
609
- let t = 0;
578
+ flatMap(e) {
579
+ const t = this._iterator;
580
+ return new l(function* () {
581
+ let n = 0;
610
582
  for (; ; ) {
611
- const s = e.next();
583
+ const s = t.next();
612
584
  if (s.done)
613
585
  return s.value;
614
- const r = n(s.value, t);
615
- if (r instanceof Array)
616
- for (const o of r)
586
+ const i = e(s.value, n);
587
+ if (i instanceof Array)
588
+ for (const o of i)
617
589
  yield o;
618
590
  else
619
- yield r;
620
- t += 1;
591
+ yield i;
592
+ n += 1;
621
593
  }
622
594
  });
623
595
  }
@@ -652,17 +624,17 @@ class u {
652
624
  *
653
625
  * @returns A new {@link SmartIterator} containing the remaining elements.
654
626
  */
655
- drop(n) {
656
- const e = this._iterator;
657
- return new u(function* () {
658
- let t = 0;
659
- for (; t < n; ) {
660
- if (e.next().done)
627
+ drop(e) {
628
+ const t = this._iterator;
629
+ return new l(function* () {
630
+ let n = 0;
631
+ for (; n < e; ) {
632
+ if (t.next().done)
661
633
  return;
662
- t += 1;
634
+ n += 1;
663
635
  }
664
636
  for (; ; ) {
665
- const s = e.next();
637
+ const s = t.next();
666
638
  if (s.done)
667
639
  return s.value;
668
640
  yield s.value;
@@ -701,27 +673,27 @@ class u {
701
673
  *
702
674
  * @returns A new {@link SmartIterator} containing the taken elements.
703
675
  */
704
- take(n) {
705
- const e = this._iterator;
706
- return new u(function* () {
707
- let t = 0;
708
- for (; t < n; ) {
709
- const s = e.next();
676
+ take(e) {
677
+ const t = this._iterator;
678
+ return new l(function* () {
679
+ let n = 0;
680
+ for (; n < e; ) {
681
+ const s = t.next();
710
682
  if (s.done)
711
683
  return s.value;
712
- yield s.value, t += 1;
684
+ yield s.value, n += 1;
713
685
  }
714
686
  });
715
687
  }
716
- find(n) {
717
- let e = 0;
688
+ find(e) {
689
+ let t = 0;
718
690
  for (; ; ) {
719
- const t = this._iterator.next();
720
- if (t.done)
691
+ const n = this._iterator.next();
692
+ if (n.done)
721
693
  return;
722
- if (n(t.value, e))
723
- return t.value;
724
- e += 1;
694
+ if (e(n.value, t))
695
+ return n.value;
696
+ t += 1;
725
697
  }
726
698
  }
727
699
  /**
@@ -750,7 +722,7 @@ class u {
750
722
  * @returns A new {@link SmartIterator} containing the enumerated elements.
751
723
  */
752
724
  enumerate() {
753
- return this.map((n, e) => [e, n]);
725
+ return this.map((e, t) => [t, e]);
754
726
  }
755
727
  /**
756
728
  * Removes all duplicate elements from the iterator.
@@ -778,14 +750,14 @@ class u {
778
750
  * @returns A new {@link SmartIterator} containing only the unique elements.
779
751
  */
780
752
  unique() {
781
- const n = this._iterator;
782
- return new u(function* () {
783
- const e = /* @__PURE__ */ new Set();
753
+ const e = this._iterator;
754
+ return new l(function* () {
755
+ const t = /* @__PURE__ */ new Set();
784
756
  for (; ; ) {
785
- const t = n.next();
786
- if (t.done)
787
- return t.value;
788
- e.has(t.value) || (e.add(t.value), yield t.value);
757
+ const n = e.next();
758
+ if (n.done)
759
+ return n.value;
760
+ t.has(n.value) || (t.add(n.value), yield n.value);
789
761
  }
790
762
  });
791
763
  }
@@ -810,11 +782,11 @@ class u {
810
782
  * @returns The number of elements in the iterator.
811
783
  */
812
784
  count() {
813
- let n = 0;
785
+ let e = 0;
814
786
  for (; ; ) {
815
787
  if (this._iterator.next().done)
816
- return n;
817
- n += 1;
788
+ return e;
789
+ e += 1;
818
790
  }
819
791
  }
820
792
  /**
@@ -839,13 +811,13 @@ class u {
839
811
  *
840
812
  * @param iteratee The function to apply to each element of the iterator.
841
813
  */
842
- forEach(n) {
843
- let e = 0;
814
+ forEach(e) {
815
+ let t = 0;
844
816
  for (; ; ) {
845
- const t = this._iterator.next();
846
- if (t.done)
817
+ const n = this._iterator.next();
818
+ if (n.done)
847
819
  return;
848
- n(t.value, e), e += 1;
820
+ e(n.value, t), t += 1;
849
821
  }
850
822
  }
851
823
  /**
@@ -877,8 +849,8 @@ class u {
877
849
  *
878
850
  * @returns The result of the iteration, containing the value of the operation.
879
851
  */
880
- next(...n) {
881
- return this._iterator.next(...n);
852
+ next(...e) {
853
+ return this._iterator.next(...e);
882
854
  }
883
855
  /**
884
856
  * An utility method that may be used to close the iterator gracefully,
@@ -912,8 +884,8 @@ class u {
912
884
  *
913
885
  * @returns The result of the iterator.
914
886
  */
915
- return(n) {
916
- return this._iterator.return ? this._iterator.return(n) : { done: !0, value: n };
887
+ return(e) {
888
+ return this._iterator.return ? this._iterator.return(e) : { done: !0, value: e };
917
889
  }
918
890
  /**
919
891
  * An utility method that may be used to close the iterator due to an error,
@@ -956,10 +928,10 @@ class u {
956
928
  *
957
929
  * @returns The final result of the iterator.
958
930
  */
959
- throw(n) {
931
+ throw(e) {
960
932
  if (this._iterator.throw)
961
- return this._iterator.throw(n);
962
- throw n;
933
+ return this._iterator.throw(e);
934
+ throw e;
963
935
  }
964
936
  /**
965
937
  * An utility method that aggregates the elements of the iterator using a given key function.
@@ -991,8 +963,8 @@ class u {
991
963
  *
992
964
  * @returns A new instance of the {@link AggregatedIterator} class containing the grouped elements.
993
965
  */
994
- groupBy(n) {
995
- return new x(this.map((e, t) => [n(e, t), e]));
966
+ groupBy(e) {
967
+ return new h(this.map((t, n) => [e(t, n), t]));
996
968
  }
997
969
  /**
998
970
  * Materializes the iterator into an array.
@@ -1020,20 +992,18 @@ class u {
1020
992
  toArray() {
1021
993
  return Array.from(this);
1022
994
  }
1023
- [(we = Symbol.toStringTag, Symbol.iterator)]() {
995
+ [Symbol.toStringTag] = "SmartIterator";
996
+ [Symbol.iterator]() {
1024
997
  return this;
1025
998
  }
1026
999
  }
1027
- var me;
1028
- me = Symbol.toStringTag;
1029
- const y = class y {
1030
- constructor(n) {
1031
- /**
1032
- * The internal {@link SmartIterator} object that holds the reduced elements.
1033
- */
1034
- a(this, "_elements");
1035
- a(this, me, "ReducedIterator");
1036
- this._elements = new u(n);
1000
+ class u {
1001
+ /**
1002
+ * The internal {@link SmartIterator} object that holds the reduced elements.
1003
+ */
1004
+ _elements;
1005
+ constructor(e) {
1006
+ this._elements = new l(e);
1037
1007
  }
1038
1008
  /**
1039
1009
  * Determines whether all elements of the reduced iterator satisfy the given condition.
@@ -1066,9 +1036,9 @@ const y = class y {
1066
1036
  *
1067
1037
  * @returns `true` if all elements satisfy the condition, `false` otherwise.
1068
1038
  */
1069
- every(n) {
1070
- for (const [e, [t, s]] of this._elements.enumerate())
1071
- if (!n(t, s, e))
1039
+ every(e) {
1040
+ for (const [t, [n, s]] of this._elements.enumerate())
1041
+ if (!e(n, s, t))
1072
1042
  return !1;
1073
1043
  return !0;
1074
1044
  }
@@ -1103,17 +1073,17 @@ const y = class y {
1103
1073
  *
1104
1074
  * @returns `true` if any element satisfies the condition, `false` otherwise.
1105
1075
  */
1106
- some(n) {
1107
- for (const [e, [t, s]] of this._elements.enumerate())
1108
- if (n(t, s, e))
1076
+ some(e) {
1077
+ for (const [t, [n, s]] of this._elements.enumerate())
1078
+ if (e(n, s, t))
1109
1079
  return !0;
1110
1080
  return !1;
1111
1081
  }
1112
- filter(n) {
1113
- const e = this._elements.enumerate();
1114
- return new y(function* () {
1115
- for (const [t, [s, r]] of e)
1116
- n(s, r, t) && (yield [s, r]);
1082
+ filter(e) {
1083
+ const t = this._elements.enumerate();
1084
+ return new u(function* () {
1085
+ for (const [n, [s, i]] of t)
1086
+ e(s, i, n) && (yield [s, i]);
1117
1087
  });
1118
1088
  }
1119
1089
  /**
@@ -1149,23 +1119,23 @@ const y = class y {
1149
1119
  *
1150
1120
  * @returns A new {@link ReducedIterator} containing the transformed elements.
1151
1121
  */
1152
- map(n) {
1153
- const e = this._elements.enumerate();
1154
- return new y(function* () {
1155
- for (const [t, [s, r]] of e)
1156
- yield [s, n(s, r, t)];
1122
+ map(e) {
1123
+ const t = this._elements.enumerate();
1124
+ return new u(function* () {
1125
+ for (const [n, [s, i]] of t)
1126
+ yield [s, e(s, i, n)];
1157
1127
  });
1158
1128
  }
1159
- reduce(n, e) {
1160
- let t = 0, s = e;
1129
+ reduce(e, t) {
1130
+ let n = 0, s = t;
1161
1131
  if (s === void 0) {
1162
- const r = this._elements.next();
1163
- if (r.done)
1132
+ const i = this._elements.next();
1133
+ if (i.done)
1164
1134
  throw new f("Cannot reduce an empty iterator without an initial value.");
1165
- s = r.value[1], t += 1;
1135
+ s = i.value[1], n += 1;
1166
1136
  }
1167
- for (const [r, o] of this._elements)
1168
- s = n(r, s, o, t), t += 1;
1137
+ for (const [i, o] of this._elements)
1138
+ s = e(i, s, o, n), n += 1;
1169
1139
  return s;
1170
1140
  }
1171
1141
  /**
@@ -1201,14 +1171,14 @@ const y = class y {
1201
1171
  *
1202
1172
  * @returns A new {@link AggregatedIterator} containing the flattened elements.
1203
1173
  */
1204
- flatMap(n) {
1205
- const e = this._elements.enumerate();
1206
- return new x(function* () {
1207
- for (const [t, [s, r]] of e) {
1208
- const o = n(s, r, t);
1174
+ flatMap(e) {
1175
+ const t = this._elements.enumerate();
1176
+ return new h(function* () {
1177
+ for (const [n, [s, i]] of t) {
1178
+ const o = e(s, i, n);
1209
1179
  if (o instanceof Array)
1210
- for (const l of o)
1211
- yield [s, l];
1180
+ for (const a of o)
1181
+ yield [s, a];
1212
1182
  else
1213
1183
  yield [s, o];
1214
1184
  }
@@ -1247,11 +1217,11 @@ const y = class y {
1247
1217
  *
1248
1218
  * @returns A new {@link ReducedIterator} containing the remaining elements.
1249
1219
  */
1250
- drop(n) {
1251
- const e = this._elements.enumerate();
1252
- return new y(function* () {
1253
- for (const [t, [s, r]] of e)
1254
- t >= n && (yield [s, r]);
1220
+ drop(e) {
1221
+ const t = this._elements.enumerate();
1222
+ return new u(function* () {
1223
+ for (const [n, [s, i]] of t)
1224
+ n >= e && (yield [s, i]);
1255
1225
  });
1256
1226
  }
1257
1227
  /**
@@ -1289,19 +1259,19 @@ const y = class y {
1289
1259
  *
1290
1260
  * @returns A new {@link ReducedIterator} containing the taken elements.
1291
1261
  */
1292
- take(n) {
1293
- const e = this._elements.enumerate();
1294
- return new y(function* () {
1295
- for (const [t, [s, r]] of e) {
1296
- if (t >= n)
1262
+ take(e) {
1263
+ const t = this._elements.enumerate();
1264
+ return new u(function* () {
1265
+ for (const [n, [s, i]] of t) {
1266
+ if (n >= e)
1297
1267
  break;
1298
- yield [s, r];
1268
+ yield [s, i];
1299
1269
  }
1300
1270
  });
1301
1271
  }
1302
- find(n) {
1303
- for (const [e, [t, s]] of this._elements.enumerate())
1304
- if (n(t, s, e))
1272
+ find(e) {
1273
+ for (const [t, [n, s]] of this._elements.enumerate())
1274
+ if (e(n, s, t))
1305
1275
  return s;
1306
1276
  }
1307
1277
  /**
@@ -1332,7 +1302,7 @@ const y = class y {
1332
1302
  * @returns A new {@link ReducedIterator} object containing the enumerated elements.
1333
1303
  */
1334
1304
  enumerate() {
1335
- return this.map((n, e, t) => [t, e]);
1305
+ return this.map((e, t, n) => [n, t]);
1336
1306
  }
1337
1307
  /**
1338
1308
  * Removes all duplicate elements from the reduced iterator.
@@ -1360,11 +1330,11 @@ const y = class y {
1360
1330
  * @returns A new {@link ReducedIterator} containing only the unique elements.
1361
1331
  */
1362
1332
  unique() {
1363
- const n = this._elements;
1364
- return new y(function* () {
1365
- const e = /* @__PURE__ */ new Set();
1366
- for (const [t, s] of n)
1367
- e.has(s) || (e.add(s), yield [t, s]);
1333
+ const e = this._elements;
1334
+ return new u(function* () {
1335
+ const t = /* @__PURE__ */ new Set();
1336
+ for (const [n, s] of e)
1337
+ t.has(s) || (t.add(s), yield [n, s]);
1368
1338
  });
1369
1339
  }
1370
1340
  /**
@@ -1390,10 +1360,10 @@ const y = class y {
1390
1360
  * @returns The number of elements in the iterator.
1391
1361
  */
1392
1362
  count() {
1393
- let n = 0;
1394
- for (const e of this._elements)
1395
- n += 1;
1396
- return n;
1363
+ let e = 0;
1364
+ for (const t of this._elements)
1365
+ e += 1;
1366
+ return e;
1397
1367
  }
1398
1368
  /**
1399
1369
  * Iterates over all elements of the reduced iterator.
@@ -1420,9 +1390,9 @@ const y = class y {
1420
1390
  *
1421
1391
  * @param iteratee The function to apply to each element of the reduced iterator.
1422
1392
  */
1423
- forEach(n) {
1424
- for (const [e, [t, s]] of this._elements.enumerate())
1425
- n(t, s, e);
1393
+ forEach(e) {
1394
+ for (const [t, [n, s]] of this._elements.enumerate())
1395
+ e(n, s, t);
1426
1396
  }
1427
1397
  /**
1428
1398
  * Reaggregates the elements of the reduced iterator.
@@ -1455,11 +1425,11 @@ const y = class y {
1455
1425
  *
1456
1426
  * @returns A new {@link AggregatedIterator} containing the elements reorganized by the new keys.
1457
1427
  */
1458
- reorganizeBy(n) {
1459
- const e = this._elements.enumerate();
1460
- return new x(function* () {
1461
- for (const [t, [s, r]] of e)
1462
- yield [n(s, r, t), r];
1428
+ reorganizeBy(e) {
1429
+ const t = this._elements.enumerate();
1430
+ return new h(function* () {
1431
+ for (const [n, [s, i]] of t)
1432
+ yield [e(s, i, n), i];
1463
1433
  });
1464
1434
  }
1465
1435
  /**
@@ -1490,10 +1460,10 @@ const y = class y {
1490
1460
  * @returns A new {@link SmartIterator} containing all the keys of the iterator.
1491
1461
  */
1492
1462
  keys() {
1493
- const n = this._elements;
1494
- return new u(function* () {
1495
- for (const [e] of n)
1496
- yield e;
1463
+ const e = this._elements;
1464
+ return new l(function* () {
1465
+ for (const [t] of e)
1466
+ yield t;
1497
1467
  });
1498
1468
  }
1499
1469
  /**
@@ -1555,10 +1525,10 @@ const y = class y {
1555
1525
  * @returns A new {@link SmartIterator} containing all the values of the iterator.
1556
1526
  */
1557
1527
  values() {
1558
- const n = this._elements;
1559
- return new u(function* () {
1560
- for (const [e, t] of n)
1561
- yield t;
1528
+ const e = this._elements;
1529
+ return new l(function* () {
1530
+ for (const [t, n] of e)
1531
+ yield n;
1562
1532
  });
1563
1533
  }
1564
1534
  /**
@@ -1633,18 +1603,15 @@ const y = class y {
1633
1603
  toObject() {
1634
1604
  return Object.fromEntries(this.entries());
1635
1605
  }
1636
- };
1637
- let h = y;
1638
- var pe;
1639
- pe = Symbol.toStringTag;
1640
- const w = class w {
1641
- constructor(n) {
1642
- /**
1643
- * The internal {@link SmartAsyncIterator} object that holds the elements to aggregate.
1644
- */
1645
- a(this, "_elements");
1646
- a(this, pe, "AggregatedAsyncIterator");
1647
- this._elements = new d(n);
1606
+ [Symbol.toStringTag] = "ReducedIterator";
1607
+ }
1608
+ class m {
1609
+ /**
1610
+ * The internal {@link SmartAsyncIterator} object that holds the elements to aggregate.
1611
+ */
1612
+ _elements;
1613
+ constructor(e) {
1614
+ this._elements = new d(e);
1648
1615
  }
1649
1616
  /**
1650
1617
  * Determines whether all elements of each group of the iterator satisfy a given condition.
@@ -1677,15 +1644,15 @@ const w = class w {
1677
1644
  * @returns
1678
1645
  * A {@link Promise} resolving to a new {@link ReducedIterator} containing the boolean results for each group.
1679
1646
  */
1680
- async every(n) {
1681
- const e = /* @__PURE__ */ new Map();
1682
- for await (const [t, s] of this._elements) {
1683
- const [r, o] = e.get(t) ?? [0, !0];
1684
- o && e.set(t, [r + 1, await n(t, s, r)]);
1647
+ async every(e) {
1648
+ const t = /* @__PURE__ */ new Map();
1649
+ for await (const [n, s] of this._elements) {
1650
+ const [i, o] = t.get(n) ?? [0, !0];
1651
+ o && t.set(n, [i + 1, await e(n, s, i)]);
1685
1652
  }
1686
- return new h(function* () {
1687
- for (const [t, [s, r]] of e)
1688
- yield [t, r];
1653
+ return new u(function* () {
1654
+ for (const [n, [s, i]] of t)
1655
+ yield [n, i];
1689
1656
  });
1690
1657
  }
1691
1658
  /**
@@ -1719,24 +1686,24 @@ const w = class w {
1719
1686
  * @returns
1720
1687
  * A {@link Promise} resolving to a new {@link ReducedIterator} containing the boolean results for each group.
1721
1688
  */
1722
- async some(n) {
1723
- const e = /* @__PURE__ */ new Map();
1724
- for await (const [t, s] of this._elements) {
1725
- const [r, o] = e.get(t) ?? [0, !1];
1726
- o || e.set(t, [r + 1, await n(t, s, r)]);
1689
+ async some(e) {
1690
+ const t = /* @__PURE__ */ new Map();
1691
+ for await (const [n, s] of this._elements) {
1692
+ const [i, o] = t.get(n) ?? [0, !1];
1693
+ o || t.set(n, [i + 1, await e(n, s, i)]);
1727
1694
  }
1728
- return new h(function* () {
1729
- for (const [t, [s, r]] of e)
1730
- yield [t, r];
1695
+ return new u(function* () {
1696
+ for (const [n, [s, i]] of t)
1697
+ yield [n, i];
1731
1698
  });
1732
1699
  }
1733
- filter(n) {
1734
- const e = this._elements;
1735
- return new w(async function* () {
1736
- const t = /* @__PURE__ */ new Map();
1737
- for await (const [s, r] of e) {
1738
- const o = t.get(s) ?? 0;
1739
- await n(s, r, o) && (yield [s, r]), t.set(s, o + 1);
1700
+ filter(e) {
1701
+ const t = this._elements;
1702
+ return new m(async function* () {
1703
+ const n = /* @__PURE__ */ new Map();
1704
+ for await (const [s, i] of t) {
1705
+ const o = n.get(s) ?? 0;
1706
+ await e(s, i, o) && (yield [s, i]), n.set(s, o + 1);
1740
1707
  }
1741
1708
  });
1742
1709
  }
@@ -1772,32 +1739,32 @@ const w = class w {
1772
1739
  *
1773
1740
  * @returns A new {@link AggregatedAsyncIterator} containing the transformed elements.
1774
1741
  */
1775
- map(n) {
1776
- const e = this._elements;
1777
- return new w(async function* () {
1778
- const t = /* @__PURE__ */ new Map();
1779
- for await (const [s, r] of e) {
1780
- const o = t.get(s) ?? 0;
1781
- yield [s, await n(s, r, o)], t.set(s, o + 1);
1742
+ map(e) {
1743
+ const t = this._elements;
1744
+ return new m(async function* () {
1745
+ const n = /* @__PURE__ */ new Map();
1746
+ for await (const [s, i] of t) {
1747
+ const o = n.get(s) ?? 0;
1748
+ yield [s, await e(s, i, o)], n.set(s, o + 1);
1782
1749
  }
1783
1750
  });
1784
1751
  }
1785
- async reduce(n, e) {
1786
- const t = /* @__PURE__ */ new Map();
1787
- for await (const [s, r] of this._elements) {
1788
- let o, l;
1789
- if (t.has(s))
1790
- [o, l] = t.get(s);
1791
- else if (e !== void 0)
1792
- o = 0, e instanceof Function ? l = await e(s) : l = await e;
1752
+ async reduce(e, t) {
1753
+ const n = /* @__PURE__ */ new Map();
1754
+ for await (const [s, i] of this._elements) {
1755
+ let o, a;
1756
+ if (n.has(s))
1757
+ [o, a] = n.get(s);
1758
+ else if (t !== void 0)
1759
+ o = 0, t instanceof Function ? a = await t(s) : a = await t;
1793
1760
  else {
1794
- t.set(s, [0, r]);
1761
+ n.set(s, [0, i]);
1795
1762
  continue;
1796
1763
  }
1797
- t.set(s, [o + 1, await n(s, l, r, o)]);
1764
+ n.set(s, [o + 1, await e(s, a, i, o)]);
1798
1765
  }
1799
- return new h(function* () {
1800
- for (const [s, [r, o]] of t)
1766
+ return new u(function* () {
1767
+ for (const [s, [i, o]] of n)
1801
1768
  yield [s, o];
1802
1769
  });
1803
1770
  }
@@ -1837,18 +1804,18 @@ const w = class w {
1837
1804
  *
1838
1805
  * @returns A new {@link AggregatedAsyncIterator} containing the transformed elements.
1839
1806
  */
1840
- flatMap(n) {
1841
- const e = this._elements;
1842
- return new w(async function* () {
1843
- const t = /* @__PURE__ */ new Map();
1844
- for await (const [s, r] of e) {
1845
- const o = t.get(s) ?? 0, l = await n(s, r, o);
1846
- if (l instanceof Array)
1847
- for (const k of l)
1848
- yield [s, k];
1807
+ flatMap(e) {
1808
+ const t = this._elements;
1809
+ return new m(async function* () {
1810
+ const n = /* @__PURE__ */ new Map();
1811
+ for await (const [s, i] of t) {
1812
+ const o = n.get(s) ?? 0, a = await e(s, i, o);
1813
+ if (a instanceof Array)
1814
+ for (const y of a)
1815
+ yield [s, y];
1849
1816
  else
1850
- yield [s, l];
1851
- t.set(s, o + 1);
1817
+ yield [s, a];
1818
+ n.set(s, o + 1);
1852
1819
  }
1853
1820
  });
1854
1821
  }
@@ -1881,17 +1848,17 @@ const w = class w {
1881
1848
  *
1882
1849
  * @returns A new {@link AggregatedAsyncIterator} containing the remaining elements.
1883
1850
  */
1884
- drop(n) {
1885
- const e = this._elements;
1886
- return new w(async function* () {
1887
- const t = /* @__PURE__ */ new Map();
1888
- for await (const [s, r] of e) {
1889
- const o = t.get(s) ?? 0;
1890
- if (o < n) {
1891
- t.set(s, o + 1);
1851
+ drop(e) {
1852
+ const t = this._elements;
1853
+ return new m(async function* () {
1854
+ const n = /* @__PURE__ */ new Map();
1855
+ for await (const [s, i] of t) {
1856
+ const o = n.get(s) ?? 0;
1857
+ if (o < e) {
1858
+ n.set(s, o + 1);
1892
1859
  continue;
1893
1860
  }
1894
- yield [s, r];
1861
+ yield [s, i];
1895
1862
  }
1896
1863
  });
1897
1864
  }
@@ -1924,25 +1891,25 @@ const w = class w {
1924
1891
  *
1925
1892
  * @returns A new {@link AggregatedAsyncIterator} containing the taken elements.
1926
1893
  */
1927
- take(n) {
1928
- const e = this._elements;
1929
- return new w(async function* () {
1930
- const t = /* @__PURE__ */ new Map();
1931
- for await (const [s, r] of e) {
1932
- const o = t.get(s) ?? 0;
1933
- o >= n || (yield [s, r], t.set(s, o + 1));
1894
+ take(e) {
1895
+ const t = this._elements;
1896
+ return new m(async function* () {
1897
+ const n = /* @__PURE__ */ new Map();
1898
+ for await (const [s, i] of t) {
1899
+ const o = n.get(s) ?? 0;
1900
+ o >= e || (yield [s, i], n.set(s, o + 1));
1934
1901
  }
1935
1902
  });
1936
1903
  }
1937
- async find(n) {
1938
- const e = /* @__PURE__ */ new Map();
1939
- for await (const [t, s] of this._elements) {
1940
- let [r, o] = e.get(t) ?? [0, void 0];
1941
- o === void 0 && (await n(t, s, r) && (o = s), e.set(t, [r + 1, o]));
1904
+ async find(e) {
1905
+ const t = /* @__PURE__ */ new Map();
1906
+ for await (const [n, s] of this._elements) {
1907
+ let [i, o] = t.get(n) ?? [0, void 0];
1908
+ o === void 0 && (await e(n, s, i) && (o = s), t.set(n, [i + 1, o]));
1942
1909
  }
1943
- return new h(function* () {
1944
- for (const [t, [s, r]] of e)
1945
- yield [t, r];
1910
+ return new u(function* () {
1911
+ for (const [n, [s, i]] of t)
1912
+ yield [n, i];
1946
1913
  });
1947
1914
  }
1948
1915
  /**
@@ -1972,7 +1939,7 @@ const w = class w {
1972
1939
  * @returns A new {@link AggregatedAsyncIterator} containing the enumerated elements.
1973
1940
  */
1974
1941
  enumerate() {
1975
- return this.map((n, e, t) => [t, e]);
1942
+ return this.map((e, t, n) => [n, t]);
1976
1943
  }
1977
1944
  /**
1978
1945
  * Removes all duplicate elements from within each group of the iterator.
@@ -2001,12 +1968,12 @@ const w = class w {
2001
1968
  * @returns A new {@link AggregatedAsyncIterator} containing only the unique elements.
2002
1969
  */
2003
1970
  unique() {
2004
- const n = this._elements;
2005
- return new w(async function* () {
2006
- const e = /* @__PURE__ */ new Map();
2007
- for await (const [t, s] of n) {
2008
- const r = e.get(t) ?? /* @__PURE__ */ new Set();
2009
- r.has(s) || (r.add(s), e.set(t, r), yield [t, s]);
1971
+ const e = this._elements;
1972
+ return new m(async function* () {
1973
+ const t = /* @__PURE__ */ new Map();
1974
+ for await (const [n, s] of e) {
1975
+ const i = t.get(n) ?? /* @__PURE__ */ new Set();
1976
+ i.has(s) || (i.add(s), t.set(n, i), yield [n, s]);
2010
1977
  }
2011
1978
  });
2012
1979
  }
@@ -2033,14 +2000,14 @@ const w = class w {
2033
2000
  * A {@link Promise} resolving to a new {@link ReducedIterator} containing the number of elements for each group.
2034
2001
  */
2035
2002
  async count() {
2036
- const n = /* @__PURE__ */ new Map();
2037
- for await (const [e] of this._elements) {
2038
- const t = n.get(e) ?? 0;
2039
- n.set(e, t + 1);
2003
+ const e = /* @__PURE__ */ new Map();
2004
+ for await (const [t] of this._elements) {
2005
+ const n = e.get(t) ?? 0;
2006
+ e.set(t, n + 1);
2040
2007
  }
2041
- return new h(function* () {
2042
- for (const [e, t] of n)
2043
- yield [e, t];
2008
+ return new u(function* () {
2009
+ for (const [t, n] of e)
2010
+ yield [t, n];
2044
2011
  });
2045
2012
  }
2046
2013
  /**
@@ -2069,11 +2036,11 @@ const w = class w {
2069
2036
  *
2070
2037
  * @returns A {@link Promise} that will resolve once the iteration is complete.
2071
2038
  */
2072
- async forEach(n) {
2073
- const e = /* @__PURE__ */ new Map();
2074
- for await (const [t, s] of this._elements) {
2075
- const r = e.get(t) ?? 0;
2076
- await n(t, s, r), e.set(t, r + 1);
2039
+ async forEach(e) {
2040
+ const t = /* @__PURE__ */ new Map();
2041
+ for await (const [n, s] of this._elements) {
2042
+ const i = t.get(n) ?? 0;
2043
+ await e(n, s, i), t.set(n, i + 1);
2077
2044
  }
2078
2045
  }
2079
2046
  /**
@@ -2107,13 +2074,13 @@ const w = class w {
2107
2074
  *
2108
2075
  * @returns A new {@link AggregatedAsyncIterator} containing the elements reorganized by the new keys.
2109
2076
  */
2110
- reorganizeBy(n) {
2111
- const e = this._elements;
2112
- return new w(async function* () {
2113
- const t = /* @__PURE__ */ new Map();
2114
- for await (const [s, r] of e) {
2115
- const o = t.get(s) ?? 0;
2116
- yield [await n(s, r, o), r], t.set(s, o + 1);
2077
+ reorganizeBy(e) {
2078
+ const t = this._elements;
2079
+ return new m(async function* () {
2080
+ const n = /* @__PURE__ */ new Map();
2081
+ for await (const [s, i] of t) {
2082
+ const o = n.get(s) ?? 0;
2083
+ yield [await e(s, i, o), i], n.set(s, o + 1);
2117
2084
  }
2118
2085
  });
2119
2086
  }
@@ -2144,11 +2111,11 @@ const w = class w {
2144
2111
  * @returns A new {@link SmartAsyncIterator} containing all the keys of the iterator.
2145
2112
  */
2146
2113
  keys() {
2147
- const n = this._elements;
2114
+ const e = this._elements;
2148
2115
  return new d(async function* () {
2149
- const e = /* @__PURE__ */ new Set();
2150
- for await (const [t] of n)
2151
- e.has(t) || (e.add(t), yield t);
2116
+ const t = /* @__PURE__ */ new Set();
2117
+ for await (const [n] of e)
2118
+ t.has(n) || (t.add(n), yield n);
2152
2119
  });
2153
2120
  }
2154
2121
  /**
@@ -2208,10 +2175,10 @@ const w = class w {
2208
2175
  * @returns A new {@link SmartAsyncIterator} containing all the values of the iterator.
2209
2176
  */
2210
2177
  values() {
2211
- const n = this._elements;
2178
+ const e = this._elements;
2212
2179
  return new d(async function* () {
2213
- for await (const [e, t] of n)
2214
- yield t;
2180
+ for await (const [t, n] of e)
2181
+ yield n;
2215
2182
  });
2216
2183
  }
2217
2184
  /**
@@ -2235,8 +2202,8 @@ const w = class w {
2235
2202
  * @returns A {@link Promise} resolving to an {@link Array} containing all the values of the iterator.
2236
2203
  */
2237
2204
  async toArray() {
2238
- const n = await this.toMap();
2239
- return Array.from(n.values());
2205
+ const e = await this.toMap();
2206
+ return Array.from(e.values());
2240
2207
  }
2241
2208
  /**
2242
2209
  * Materializes the iterator into a map.
@@ -2259,12 +2226,12 @@ const w = class w {
2259
2226
  * @returns A {@link Promise} resolving to a {@link Map} containing all the entries of the iterator.
2260
2227
  */
2261
2228
  async toMap() {
2262
- const n = /* @__PURE__ */ new Map();
2263
- for await (const [e, t] of this._elements) {
2264
- const s = n.get(e) ?? [];
2265
- s.push(t), n.set(e, s);
2229
+ const e = /* @__PURE__ */ new Map();
2230
+ for await (const [t, n] of this._elements) {
2231
+ const s = e.get(t) ?? [];
2232
+ s.push(n), e.set(t, s);
2266
2233
  }
2267
- return n;
2234
+ return e;
2268
2235
  }
2269
2236
  /**
2270
2237
  * Materializes the iterator into an object.
@@ -2287,56 +2254,54 @@ const w = class w {
2287
2254
  * @returns A {@link Promise} resolving to an object containing all the entries of the iterator.
2288
2255
  */
2289
2256
  async toObject() {
2290
- const n = {};
2291
- for await (const [e, t] of this._elements) {
2292
- const s = n[e] ?? [];
2293
- s.push(t), n[e] = s;
2257
+ const e = {};
2258
+ for await (const [t, n] of this._elements) {
2259
+ const s = e[t] ?? [];
2260
+ s.push(n), e[t] = s;
2294
2261
  }
2295
- return n;
2262
+ return e;
2296
2263
  }
2297
- };
2298
- let M = w;
2299
- var _e;
2264
+ [Symbol.toStringTag] = "AggregatedAsyncIterator";
2265
+ }
2300
2266
  class d {
2301
- constructor(n) {
2302
- /**
2303
- * The native {@link AsyncIterator} object that is being wrapped by this instance.
2304
- */
2305
- a(this, "_iterator");
2306
- a(this, _e, "SmartAsyncIterator");
2307
- if (n instanceof Function) {
2308
- const e = n();
2309
- Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
2310
- let t = [];
2267
+ /**
2268
+ * The native {@link AsyncIterator} object that is being wrapped by this instance.
2269
+ */
2270
+ _iterator;
2271
+ constructor(e) {
2272
+ if (e instanceof Function) {
2273
+ const t = e();
2274
+ Symbol.asyncIterator in t ? this._iterator = t : this._iterator = (async function* () {
2275
+ let n = [];
2311
2276
  for (; ; ) {
2312
- const s = e.next(...t);
2277
+ const s = t.next(...n);
2313
2278
  if (s.done)
2314
2279
  return s.value;
2315
- t = [yield s.value];
2280
+ n = [yield s.value];
2316
2281
  }
2317
- }();
2318
- } else if (Symbol.asyncIterator in n)
2319
- this._iterator = n[Symbol.asyncIterator]();
2320
- else if (Symbol.iterator in n) {
2321
- const e = n[Symbol.iterator]();
2322
- this._iterator = async function* () {
2282
+ })();
2283
+ } else if (Symbol.asyncIterator in e)
2284
+ this._iterator = e[Symbol.asyncIterator]();
2285
+ else if (Symbol.iterator in e) {
2286
+ const t = e[Symbol.iterator]();
2287
+ this._iterator = (async function* () {
2323
2288
  for (; ; ) {
2324
- const t = e.next();
2325
- if (t.done)
2326
- return t.value;
2327
- yield t.value;
2289
+ const n = t.next();
2290
+ if (n.done)
2291
+ return n.value;
2292
+ yield n.value;
2328
2293
  }
2329
- }();
2294
+ })();
2330
2295
  } else
2331
- this._iterator = async function* () {
2332
- let e = [];
2296
+ this._iterator = (async function* () {
2297
+ let t = [];
2333
2298
  for (; ; ) {
2334
- const t = await n.next(...e);
2335
- if (t.done)
2336
- return t.value;
2337
- e = [yield t.value];
2299
+ const n = await e.next(...t);
2300
+ if (n.done)
2301
+ return n.value;
2302
+ t = [yield n.value];
2338
2303
  }
2339
- }();
2304
+ })();
2340
2305
  }
2341
2306
  /**
2342
2307
  * Determines whether all elements of the iterator satisfy a given condition.
@@ -2368,15 +2333,15 @@ class d {
2368
2333
  * @returns
2369
2334
  * A {@link Promise} that will resolve to `true` if all elements satisfy the condition, `false` otherwise.
2370
2335
  */
2371
- async every(n) {
2372
- let e = 0;
2336
+ async every(e) {
2337
+ let t = 0;
2373
2338
  for (; ; ) {
2374
- const t = await this._iterator.next();
2375
- if (t.done)
2339
+ const n = await this._iterator.next();
2340
+ if (n.done)
2376
2341
  return !0;
2377
- if (!await n(t.value, e))
2342
+ if (!await e(n.value, t))
2378
2343
  return !1;
2379
- e += 1;
2344
+ t += 1;
2380
2345
  }
2381
2346
  }
2382
2347
  /**
@@ -2409,26 +2374,26 @@ class d {
2409
2374
  * @returns
2410
2375
  * A {@link Promise} that will resolve to `true` if any element satisfies the condition, `false` otherwise.
2411
2376
  */
2412
- async some(n) {
2413
- let e = 0;
2377
+ async some(e) {
2378
+ let t = 0;
2414
2379
  for (; ; ) {
2415
- const t = await this._iterator.next();
2416
- if (t.done)
2380
+ const n = await this._iterator.next();
2381
+ if (n.done)
2417
2382
  return !1;
2418
- if (await n(t.value, e))
2383
+ if (await e(n.value, t))
2419
2384
  return !0;
2420
- e += 1;
2385
+ t += 1;
2421
2386
  }
2422
2387
  }
2423
- filter(n) {
2424
- const e = this._iterator;
2388
+ filter(e) {
2389
+ const t = this._iterator;
2425
2390
  return new d(async function* () {
2426
- let t = 0;
2391
+ let n = 0;
2427
2392
  for (; ; ) {
2428
- const s = await e.next();
2393
+ const s = await t.next();
2429
2394
  if (s.done)
2430
2395
  return s.value;
2431
- await n(s.value, t) && (yield s.value), t += 1;
2396
+ await e(s.value, n) && (yield s.value), n += 1;
2432
2397
  }
2433
2398
  });
2434
2399
  }
@@ -2463,31 +2428,31 @@ class d {
2463
2428
  *
2464
2429
  * @returns A new {@link SmartAsyncIterator} containing the transformed elements.
2465
2430
  */
2466
- map(n) {
2467
- const e = this._iterator;
2431
+ map(e) {
2432
+ const t = this._iterator;
2468
2433
  return new d(async function* () {
2469
- let t = 0;
2434
+ let n = 0;
2470
2435
  for (; ; ) {
2471
- const s = await e.next();
2436
+ const s = await t.next();
2472
2437
  if (s.done)
2473
2438
  return s.value;
2474
- yield await n(s.value, t), t += 1;
2439
+ yield await e(s.value, n), n += 1;
2475
2440
  }
2476
2441
  });
2477
2442
  }
2478
- async reduce(n, e) {
2479
- let t = 0, s = e;
2443
+ async reduce(e, t) {
2444
+ let n = 0, s = t;
2480
2445
  if (s === void 0) {
2481
- const r = await this._iterator.next();
2482
- if (r.done)
2446
+ const i = await this._iterator.next();
2447
+ if (i.done)
2483
2448
  throw new f("Cannot reduce an empty iterator without an initial value.");
2484
- s = r.value, t += 1;
2449
+ s = i.value, n += 1;
2485
2450
  }
2486
2451
  for (; ; ) {
2487
- const r = await this._iterator.next();
2488
- if (r.done)
2452
+ const i = await this._iterator.next();
2453
+ if (i.done)
2489
2454
  return s;
2490
- s = await n(s, r.value, t), t += 1;
2455
+ s = await e(s, i.value, n), n += 1;
2491
2456
  }
2492
2457
  }
2493
2458
  /**
@@ -2521,21 +2486,21 @@ class d {
2521
2486
  *
2522
2487
  * @returns A new {@link SmartAsyncIterator} containing the flattened elements.
2523
2488
  */
2524
- flatMap(n) {
2525
- const e = this._iterator;
2489
+ flatMap(e) {
2490
+ const t = this._iterator;
2526
2491
  return new d(async function* () {
2527
- let t = 0;
2492
+ let n = 0;
2528
2493
  for (; ; ) {
2529
- const s = await e.next();
2494
+ const s = await t.next();
2530
2495
  if (s.done)
2531
2496
  return s.value;
2532
- const r = await n(s.value, t);
2533
- if (r instanceof Array)
2534
- for (const o of r)
2497
+ const i = await e(s.value, n);
2498
+ if (i instanceof Array)
2499
+ for (const o of i)
2535
2500
  yield o;
2536
2501
  else
2537
- yield r;
2538
- t += 1;
2502
+ yield i;
2503
+ n += 1;
2539
2504
  }
2540
2505
  });
2541
2506
  }
@@ -2570,17 +2535,17 @@ class d {
2570
2535
  *
2571
2536
  * @returns A new {@link SmartAsyncIterator} containing the remaining elements.
2572
2537
  */
2573
- drop(n) {
2574
- const e = this._iterator;
2538
+ drop(e) {
2539
+ const t = this._iterator;
2575
2540
  return new d(async function* () {
2576
- let t = 0;
2577
- for (; t < n; ) {
2578
- if ((await e.next()).done)
2541
+ let n = 0;
2542
+ for (; n < e; ) {
2543
+ if ((await t.next()).done)
2579
2544
  return;
2580
- t += 1;
2545
+ n += 1;
2581
2546
  }
2582
2547
  for (; ; ) {
2583
- const s = await e.next();
2548
+ const s = await t.next();
2584
2549
  if (s.done)
2585
2550
  return s.value;
2586
2551
  yield s.value;
@@ -2619,27 +2584,27 @@ class d {
2619
2584
  *
2620
2585
  * @returns A new {@link SmartAsyncIterator} containing the taken elements.
2621
2586
  */
2622
- take(n) {
2623
- const e = this._iterator;
2587
+ take(e) {
2588
+ const t = this._iterator;
2624
2589
  return new d(async function* () {
2625
- let t = 0;
2626
- for (; t < n; ) {
2627
- const s = await e.next();
2590
+ let n = 0;
2591
+ for (; n < e; ) {
2592
+ const s = await t.next();
2628
2593
  if (s.done)
2629
2594
  return s.value;
2630
- yield s.value, t += 1;
2595
+ yield s.value, n += 1;
2631
2596
  }
2632
2597
  });
2633
2598
  }
2634
- async find(n) {
2635
- let e = 0;
2599
+ async find(e) {
2600
+ let t = 0;
2636
2601
  for (; ; ) {
2637
- const t = await this._iterator.next();
2638
- if (t.done)
2602
+ const n = await this._iterator.next();
2603
+ if (n.done)
2639
2604
  return;
2640
- if (await n(t.value, e))
2641
- return t.value;
2642
- e += 1;
2605
+ if (await e(n.value, t))
2606
+ return n.value;
2607
+ t += 1;
2643
2608
  }
2644
2609
  }
2645
2610
  /**
@@ -2671,7 +2636,7 @@ class d {
2671
2636
  * @returns A new {@link SmartAsyncIterator} containing the enumerated elements.
2672
2637
  */
2673
2638
  enumerate() {
2674
- return this.map((n, e) => [e, n]);
2639
+ return this.map((e, t) => [t, e]);
2675
2640
  }
2676
2641
  /**
2677
2642
  * Removes all duplicate elements from the iterator.
@@ -2699,14 +2664,14 @@ class d {
2699
2664
  * @returns A new {@link SmartAsyncIterator} containing only the unique elements.
2700
2665
  */
2701
2666
  unique() {
2702
- const n = this._iterator;
2667
+ const e = this._iterator;
2703
2668
  return new d(async function* () {
2704
- const e = /* @__PURE__ */ new Set();
2669
+ const t = /* @__PURE__ */ new Set();
2705
2670
  for (; ; ) {
2706
- const t = await n.next();
2707
- if (t.done)
2708
- return t.value;
2709
- e.has(t.value) || (e.add(t.value), yield t.value);
2671
+ const n = await e.next();
2672
+ if (n.done)
2673
+ return n.value;
2674
+ t.has(n.value) || (t.add(n.value), yield n.value);
2710
2675
  }
2711
2676
  });
2712
2677
  }
@@ -2731,11 +2696,11 @@ class d {
2731
2696
  * @returns A {@link Promise} that will resolve to the number of elements in the iterator.
2732
2697
  */
2733
2698
  async count() {
2734
- let n = 0;
2699
+ let e = 0;
2735
2700
  for (; ; ) {
2736
2701
  if ((await this._iterator.next()).done)
2737
- return n;
2738
- n += 1;
2702
+ return e;
2703
+ e += 1;
2739
2704
  }
2740
2705
  }
2741
2706
  /**
@@ -2762,13 +2727,13 @@ class d {
2762
2727
  *
2763
2728
  * @returns A {@link Promise} that will resolve once the iteration is complete.
2764
2729
  */
2765
- async forEach(n) {
2766
- let e = 0;
2730
+ async forEach(e) {
2731
+ let t = 0;
2767
2732
  for (; ; ) {
2768
- const t = await this._iterator.next();
2769
- if (t.done)
2733
+ const n = await this._iterator.next();
2734
+ if (n.done)
2770
2735
  return;
2771
- await n(t.value, e), e += 1;
2736
+ await e(n.value, t), t += 1;
2772
2737
  }
2773
2738
  }
2774
2739
  /**
@@ -2801,8 +2766,8 @@ class d {
2801
2766
  * @returns
2802
2767
  * A {@link Promise} that will resolve to the result of the iteration, containing the value of the operation.
2803
2768
  */
2804
- next(...n) {
2805
- return this._iterator.next(...n);
2769
+ next(...e) {
2770
+ return this._iterator.next(...e);
2806
2771
  }
2807
2772
  /**
2808
2773
  * An utility method that may be used to close the iterator gracefully,
@@ -2836,9 +2801,9 @@ class d {
2836
2801
  *
2837
2802
  * @returns A {@link Promise} that will resolve to the final result of the iterator.
2838
2803
  */
2839
- async return(n) {
2840
- const e = await n;
2841
- return this._iterator.return ? await this._iterator.return(e) : { done: !0, value: e };
2804
+ async return(e) {
2805
+ const t = await e;
2806
+ return this._iterator.return ? await this._iterator.return(t) : { done: !0, value: t };
2842
2807
  }
2843
2808
  /**
2844
2809
  * An utility method that may be used to close the iterator due to an error,
@@ -2881,10 +2846,10 @@ class d {
2881
2846
  *
2882
2847
  * @returns A {@link Promise} that will resolve to the final result of the iterator.
2883
2848
  */
2884
- throw(n) {
2849
+ throw(e) {
2885
2850
  if (this._iterator.throw)
2886
- return this._iterator.throw(n);
2887
- throw n;
2851
+ return this._iterator.throw(e);
2852
+ throw e;
2888
2853
  }
2889
2854
  /**
2890
2855
  * An utility method that aggregates the elements of the iterator using a given key function.
@@ -2916,8 +2881,8 @@ class d {
2916
2881
  *
2917
2882
  * @returns A new instance of the {@link AggregatedAsyncIterator} class containing the grouped elements.
2918
2883
  */
2919
- groupBy(n) {
2920
- return new M(this.map(async (e, t) => [await n(e, t), e]));
2884
+ groupBy(e) {
2885
+ return new m(this.map(async (t, n) => [await e(t, n), t]));
2921
2886
  }
2922
2887
  /**
2923
2888
  * Materializes the iterator into an array.
@@ -2945,20 +2910,18 @@ class d {
2945
2910
  toArray() {
2946
2911
  return Array.fromAsync(this);
2947
2912
  }
2948
- [(_e = Symbol.toStringTag, Symbol.asyncIterator)]() {
2913
+ [Symbol.toStringTag] = "SmartAsyncIterator";
2914
+ [Symbol.asyncIterator]() {
2949
2915
  return this;
2950
2916
  }
2951
2917
  }
2952
- var ye;
2953
- ye = Symbol.toStringTag;
2954
- const m = class m {
2955
- constructor(n) {
2956
- /**
2957
- * The internal {@link SmartIterator} object that holds the elements to aggregate.
2958
- */
2959
- a(this, "_elements");
2960
- a(this, ye, "AggregatedIterator");
2961
- this._elements = new u(n);
2918
+ class h {
2919
+ /**
2920
+ * The internal {@link SmartIterator} object that holds the elements to aggregate.
2921
+ */
2922
+ _elements;
2923
+ constructor(e) {
2924
+ this._elements = new l(e);
2962
2925
  }
2963
2926
  /**
2964
2927
  * Determines whether all elements of each group of the iterator satisfy a given condition.
@@ -2990,15 +2953,15 @@ const m = class m {
2990
2953
  *
2991
2954
  * @returns A new {@link ReducedIterator} containing the boolean results for each group.
2992
2955
  */
2993
- every(n) {
2994
- const e = /* @__PURE__ */ new Map();
2995
- for (const [t, s] of this._elements) {
2996
- const [r, o] = e.get(t) ?? [0, !0];
2997
- o && e.set(t, [r + 1, n(t, s, r)]);
2956
+ every(e) {
2957
+ const t = /* @__PURE__ */ new Map();
2958
+ for (const [n, s] of this._elements) {
2959
+ const [i, o] = t.get(n) ?? [0, !0];
2960
+ o && t.set(n, [i + 1, e(n, s, i)]);
2998
2961
  }
2999
- return new h(function* () {
3000
- for (const [t, [s, r]] of e)
3001
- yield [t, r];
2962
+ return new u(function* () {
2963
+ for (const [n, [s, i]] of t)
2964
+ yield [n, i];
3002
2965
  });
3003
2966
  }
3004
2967
  /**
@@ -3031,24 +2994,24 @@ const m = class m {
3031
2994
  *
3032
2995
  * @returns A {@link ReducedIterator} containing the boolean results for each group.
3033
2996
  */
3034
- some(n) {
3035
- const e = /* @__PURE__ */ new Map();
3036
- for (const [t, s] of this._elements) {
3037
- const [r, o] = e.get(t) ?? [0, !1];
3038
- o || e.set(t, [r + 1, n(t, s, r)]);
2997
+ some(e) {
2998
+ const t = /* @__PURE__ */ new Map();
2999
+ for (const [n, s] of this._elements) {
3000
+ const [i, o] = t.get(n) ?? [0, !1];
3001
+ o || t.set(n, [i + 1, e(n, s, i)]);
3039
3002
  }
3040
- return new h(function* () {
3041
- for (const [t, [s, r]] of e)
3042
- yield [t, r];
3003
+ return new u(function* () {
3004
+ for (const [n, [s, i]] of t)
3005
+ yield [n, i];
3043
3006
  });
3044
3007
  }
3045
- filter(n) {
3046
- const e = this._elements;
3047
- return new m(function* () {
3048
- const t = /* @__PURE__ */ new Map();
3049
- for (const [s, r] of e) {
3050
- const o = t.get(s) ?? 0;
3051
- n(s, r, o) && (yield [s, r]), t.set(s, o + 1);
3008
+ filter(e) {
3009
+ const t = this._elements;
3010
+ return new h(function* () {
3011
+ const n = /* @__PURE__ */ new Map();
3012
+ for (const [s, i] of t) {
3013
+ const o = n.get(s) ?? 0;
3014
+ e(s, i, o) && (yield [s, i]), n.set(s, o + 1);
3052
3015
  }
3053
3016
  });
3054
3017
  }
@@ -3084,32 +3047,32 @@ const m = class m {
3084
3047
  *
3085
3048
  * @returns A new {@link AggregatedIterator} containing the transformed elements.
3086
3049
  */
3087
- map(n) {
3088
- const e = this._elements;
3089
- return new m(function* () {
3090
- const t = /* @__PURE__ */ new Map();
3091
- for (const [s, r] of e) {
3092
- const o = t.get(s) ?? 0;
3093
- yield [s, n(s, r, o)], t.set(s, o + 1);
3050
+ map(e) {
3051
+ const t = this._elements;
3052
+ return new h(function* () {
3053
+ const n = /* @__PURE__ */ new Map();
3054
+ for (const [s, i] of t) {
3055
+ const o = n.get(s) ?? 0;
3056
+ yield [s, e(s, i, o)], n.set(s, o + 1);
3094
3057
  }
3095
3058
  });
3096
3059
  }
3097
- reduce(n, e) {
3098
- const t = /* @__PURE__ */ new Map();
3099
- for (const [s, r] of this._elements) {
3100
- let o, l;
3101
- if (t.has(s))
3102
- [o, l] = t.get(s);
3103
- else if (e !== void 0)
3104
- o = 0, e instanceof Function ? l = e(s) : l = e;
3060
+ reduce(e, t) {
3061
+ const n = /* @__PURE__ */ new Map();
3062
+ for (const [s, i] of this._elements) {
3063
+ let o, a;
3064
+ if (n.has(s))
3065
+ [o, a] = n.get(s);
3066
+ else if (t !== void 0)
3067
+ o = 0, t instanceof Function ? a = t(s) : a = t;
3105
3068
  else {
3106
- t.set(s, [0, r]);
3069
+ n.set(s, [0, i]);
3107
3070
  continue;
3108
3071
  }
3109
- t.set(s, [o + 1, n(s, l, r, o)]);
3072
+ n.set(s, [o + 1, e(s, a, i, o)]);
3110
3073
  }
3111
- return new h(function* () {
3112
- for (const [s, [r, o]] of t)
3074
+ return new u(function* () {
3075
+ for (const [s, [i, o]] of n)
3113
3076
  yield [s, o];
3114
3077
  });
3115
3078
  }
@@ -3149,18 +3112,18 @@ const m = class m {
3149
3112
  *
3150
3113
  * @returns A new {@link AggregatedIterator} containing the transformed elements.
3151
3114
  */
3152
- flatMap(n) {
3153
- const e = this._elements;
3154
- return new m(function* () {
3155
- const t = /* @__PURE__ */ new Map();
3156
- for (const [s, r] of e) {
3157
- const o = t.get(s) ?? 0, l = n(s, r, o);
3158
- if (l instanceof Array)
3159
- for (const k of l)
3160
- yield [s, k];
3115
+ flatMap(e) {
3116
+ const t = this._elements;
3117
+ return new h(function* () {
3118
+ const n = /* @__PURE__ */ new Map();
3119
+ for (const [s, i] of t) {
3120
+ const o = n.get(s) ?? 0, a = e(s, i, o);
3121
+ if (a instanceof Array)
3122
+ for (const y of a)
3123
+ yield [s, y];
3161
3124
  else
3162
- yield [s, l];
3163
- t.set(s, o + 1);
3125
+ yield [s, a];
3126
+ n.set(s, o + 1);
3164
3127
  }
3165
3128
  });
3166
3129
  }
@@ -3193,17 +3156,17 @@ const m = class m {
3193
3156
  *
3194
3157
  * @returns A new {@link AggregatedIterator} containing the remaining elements.
3195
3158
  */
3196
- drop(n) {
3197
- const e = this._elements;
3198
- return new m(function* () {
3199
- const t = /* @__PURE__ */ new Map();
3200
- for (const [s, r] of e) {
3201
- const o = t.get(s) ?? 0;
3202
- if (o < n) {
3203
- t.set(s, o + 1);
3159
+ drop(e) {
3160
+ const t = this._elements;
3161
+ return new h(function* () {
3162
+ const n = /* @__PURE__ */ new Map();
3163
+ for (const [s, i] of t) {
3164
+ const o = n.get(s) ?? 0;
3165
+ if (o < e) {
3166
+ n.set(s, o + 1);
3204
3167
  continue;
3205
3168
  }
3206
- yield [s, r];
3169
+ yield [s, i];
3207
3170
  }
3208
3171
  });
3209
3172
  }
@@ -3236,25 +3199,25 @@ const m = class m {
3236
3199
  *
3237
3200
  * @returns A new {@link AggregatedIterator} containing the taken elements.
3238
3201
  */
3239
- take(n) {
3240
- const e = this._elements;
3241
- return new m(function* () {
3242
- const t = /* @__PURE__ */ new Map();
3243
- for (const [s, r] of e) {
3244
- const o = t.get(s) ?? 0;
3245
- o >= n || (yield [s, r], t.set(s, o + 1));
3202
+ take(e) {
3203
+ const t = this._elements;
3204
+ return new h(function* () {
3205
+ const n = /* @__PURE__ */ new Map();
3206
+ for (const [s, i] of t) {
3207
+ const o = n.get(s) ?? 0;
3208
+ o >= e || (yield [s, i], n.set(s, o + 1));
3246
3209
  }
3247
3210
  });
3248
3211
  }
3249
- find(n) {
3250
- const e = /* @__PURE__ */ new Map();
3251
- for (const [t, s] of this._elements) {
3252
- let [r, o] = e.get(t) ?? [0, void 0];
3253
- o === void 0 && (n(t, s, r) && (o = s), e.set(t, [r + 1, o]));
3212
+ find(e) {
3213
+ const t = /* @__PURE__ */ new Map();
3214
+ for (const [n, s] of this._elements) {
3215
+ let [i, o] = t.get(n) ?? [0, void 0];
3216
+ o === void 0 && (e(n, s, i) && (o = s), t.set(n, [i + 1, o]));
3254
3217
  }
3255
- return new h(function* () {
3256
- for (const [t, [s, r]] of e)
3257
- yield [t, r];
3218
+ return new u(function* () {
3219
+ for (const [n, [s, i]] of t)
3220
+ yield [n, i];
3258
3221
  });
3259
3222
  }
3260
3223
  /**
@@ -3284,7 +3247,7 @@ const m = class m {
3284
3247
  * @returns A new {@link AggregatedIterator} containing the enumerated elements.
3285
3248
  */
3286
3249
  enumerate() {
3287
- return this.map((n, e, t) => [t, e]);
3250
+ return this.map((e, t, n) => [n, t]);
3288
3251
  }
3289
3252
  /**
3290
3253
  * Removes all duplicate elements from within each group of the iterator.
@@ -3313,12 +3276,12 @@ const m = class m {
3313
3276
  * @returns A new {@link AggregatedIterator} containing only the unique elements.
3314
3277
  */
3315
3278
  unique() {
3316
- const n = this._elements;
3317
- return new m(function* () {
3318
- const e = /* @__PURE__ */ new Map();
3319
- for (const [t, s] of n) {
3320
- const r = e.get(t) ?? /* @__PURE__ */ new Set();
3321
- r.has(s) || (r.add(s), e.set(t, r), yield [t, s]);
3279
+ const e = this._elements;
3280
+ return new h(function* () {
3281
+ const t = /* @__PURE__ */ new Map();
3282
+ for (const [n, s] of e) {
3283
+ const i = t.get(n) ?? /* @__PURE__ */ new Set();
3284
+ i.has(s) || (i.add(s), t.set(n, i), yield [n, s]);
3322
3285
  }
3323
3286
  });
3324
3287
  }
@@ -3344,14 +3307,14 @@ const m = class m {
3344
3307
  * @returns A new {@link ReducedIterator} containing the number of elements for each group.
3345
3308
  */
3346
3309
  count() {
3347
- const n = /* @__PURE__ */ new Map();
3348
- for (const [e] of this._elements) {
3349
- const t = n.get(e) ?? 0;
3350
- n.set(e, t + 1);
3310
+ const e = /* @__PURE__ */ new Map();
3311
+ for (const [t] of this._elements) {
3312
+ const n = e.get(t) ?? 0;
3313
+ e.set(t, n + 1);
3351
3314
  }
3352
- return new h(function* () {
3353
- for (const [e, t] of n)
3354
- yield [e, t];
3315
+ return new u(function* () {
3316
+ for (const [t, n] of e)
3317
+ yield [t, n];
3355
3318
  });
3356
3319
  }
3357
3320
  /**
@@ -3378,11 +3341,11 @@ const m = class m {
3378
3341
  *
3379
3342
  * @param iteratee The function to execute for each element of the iterator.
3380
3343
  */
3381
- forEach(n) {
3382
- const e = /* @__PURE__ */ new Map();
3383
- for (const [t, s] of this._elements) {
3384
- const r = e.get(t) ?? 0;
3385
- n(t, s, r), e.set(t, r + 1);
3344
+ forEach(e) {
3345
+ const t = /* @__PURE__ */ new Map();
3346
+ for (const [n, s] of this._elements) {
3347
+ const i = t.get(n) ?? 0;
3348
+ e(n, s, i), t.set(n, i + 1);
3386
3349
  }
3387
3350
  }
3388
3351
  /**
@@ -3416,13 +3379,13 @@ const m = class m {
3416
3379
  *
3417
3380
  * @returns A new {@link AggregatedIterator} containing the elements reorganized by the new keys.
3418
3381
  */
3419
- reorganizeBy(n) {
3420
- const e = this._elements;
3421
- return new m(function* () {
3422
- const t = /* @__PURE__ */ new Map();
3423
- for (const [s, r] of e) {
3424
- const o = t.get(s) ?? 0;
3425
- yield [n(s, r, o), r], t.set(s, o + 1);
3382
+ reorganizeBy(e) {
3383
+ const t = this._elements;
3384
+ return new h(function* () {
3385
+ const n = /* @__PURE__ */ new Map();
3386
+ for (const [s, i] of t) {
3387
+ const o = n.get(s) ?? 0;
3388
+ yield [e(s, i, o), i], n.set(s, o + 1);
3426
3389
  }
3427
3390
  });
3428
3391
  }
@@ -3453,11 +3416,11 @@ const m = class m {
3453
3416
  * @returns A new {@link SmartIterator} containing all the keys of the iterator.
3454
3417
  */
3455
3418
  keys() {
3456
- const n = this._elements;
3457
- return new u(function* () {
3458
- const e = /* @__PURE__ */ new Set();
3459
- for (const [t] of n)
3460
- e.has(t) || (e.add(t), yield t);
3419
+ const e = this._elements;
3420
+ return new l(function* () {
3421
+ const t = /* @__PURE__ */ new Set();
3422
+ for (const [n] of e)
3423
+ t.has(n) || (t.add(n), yield n);
3461
3424
  });
3462
3425
  }
3463
3426
  /**
@@ -3517,10 +3480,10 @@ const m = class m {
3517
3480
  * @returns A new {@link SmartIterator} containing all the values of the iterator.
3518
3481
  */
3519
3482
  values() {
3520
- const n = this._elements;
3521
- return new u(function* () {
3522
- for (const [e, t] of n)
3523
- yield t;
3483
+ const e = this._elements;
3484
+ return new l(function* () {
3485
+ for (const [t, n] of e)
3486
+ yield n;
3524
3487
  });
3525
3488
  }
3526
3489
  /**
@@ -3544,8 +3507,8 @@ const m = class m {
3544
3507
  * @returns An {@link Array} of arrays containing the elements of the iterator.
3545
3508
  */
3546
3509
  toArray() {
3547
- const n = this.toMap();
3548
- return Array.from(n.values());
3510
+ const e = this.toMap();
3511
+ return Array.from(e.values());
3549
3512
  }
3550
3513
  /**
3551
3514
  * Materializes the iterator into a map.
@@ -3568,12 +3531,12 @@ const m = class m {
3568
3531
  * @returns A {@link Map} containing the elements of the iterator.
3569
3532
  */
3570
3533
  toMap() {
3571
- const n = /* @__PURE__ */ new Map();
3572
- for (const [e, t] of this._elements) {
3573
- const s = n.get(e) ?? [];
3574
- s.push(t), n.set(e, s);
3534
+ const e = /* @__PURE__ */ new Map();
3535
+ for (const [t, n] of this._elements) {
3536
+ const s = e.get(t) ?? [];
3537
+ s.push(n), e.set(t, s);
3575
3538
  }
3576
- return n;
3539
+ return e;
3577
3540
  }
3578
3541
  /**
3579
3542
  * Materializes the iterator into an object.
@@ -3596,31 +3559,35 @@ const m = class m {
3596
3559
  * @returns An {@link Object} containing the elements of the iterator.
3597
3560
  */
3598
3561
  toObject() {
3599
- const n = {};
3600
- for (const [e, t] of this._elements) {
3601
- const s = n[e] ?? [];
3602
- s.push(t), n[e] = s;
3562
+ const e = {};
3563
+ for (const [t, n] of this._elements) {
3564
+ const s = e[t] ?? [];
3565
+ s.push(n), e[t] = s;
3603
3566
  }
3604
- return n;
3567
+ return e;
3605
3568
  }
3606
- };
3607
- let x = m;
3608
- const We = Function;
3609
- var be, ge;
3610
- class Ue extends (ge = We, be = Symbol.toStringTag, ge) {
3569
+ [Symbol.toStringTag] = "AggregatedIterator";
3570
+ }
3571
+ const N = Function;
3572
+ class O extends N {
3611
3573
  /**
3612
3574
  * Initializes a new instance of the {@link CallableObject} class.
3613
3575
  */
3614
3576
  constructor() {
3615
3577
  super("return this._invoke(...arguments);");
3616
- a(this, be, "CallableObject");
3617
3578
  const e = this.bind(this);
3618
3579
  return Object.setPrototypeOf(this, e), e;
3619
3580
  }
3581
+ [Symbol.toStringTag] = "CallableObject";
3620
3582
  }
3621
- var xe;
3622
- xe = Symbol.toStringTag;
3623
- const F = class F {
3583
+ class g {
3584
+ /**
3585
+ * A map containing all the subscribers for each event.
3586
+ *
3587
+ * The keys are the names of the events they are subscribed to.
3588
+ * The values are the arrays of the subscribers themselves.
3589
+ */
3590
+ _subscribers;
3624
3591
  /**
3625
3592
  * Initializes a new instance of the {@link Publisher} class.
3626
3593
  *
@@ -3632,39 +3599,8 @@ const F = class F {
3632
3599
  * ```
3633
3600
  */
3634
3601
  constructor() {
3635
- /**
3636
- * A map containing all the subscribers for each event.
3637
- *
3638
- * The keys are the names of the events they are subscribed to.
3639
- * The values are the arrays of the subscribers themselves.
3640
- */
3641
- a(this, "_subscribers");
3642
- a(this, xe, "Publisher");
3643
3602
  this._subscribers = /* @__PURE__ */ new Map();
3644
3603
  }
3645
- /**
3646
- * Unsubscribes all the subscribers from all the events.
3647
- *
3648
- * ---
3649
- *
3650
- * @example
3651
- * ```ts
3652
- * publisher.subscribe("player:spawn", (evt) => { [...] });
3653
- * publisher.subscribe("player:move", (coords) => { [...] });
3654
- * publisher.subscribe("player:move", () => { [...] });
3655
- * publisher.subscribe("player:move", ({ x, y }) => { [...] });
3656
- * publisher.subscribe("player:death", () => { [...] });
3657
- *
3658
- * // All these subscribers are working fine...
3659
- *
3660
- * publisher.clear();
3661
- *
3662
- * // ... but now they're all gone!
3663
- * ```
3664
- */
3665
- clear() {
3666
- this.publish("__internals__:clear"), this._subscribers.clear();
3667
- }
3668
3604
  /**
3669
3605
  * Creates a new scoped instance of the {@link Publisher} class,
3670
3606
  * which can be used to publish and subscribe events within a specific context.
@@ -3680,8 +3616,8 @@ const F = class F {
3680
3616
  * const publisher = new Publisher();
3681
3617
  * const context = publisher.createScope();
3682
3618
  *
3683
- * publisher.subscribe("player:death", () => console.log(`Player has died.`));
3684
- * context.subscribe("player:spawn", () => console.log(`Player has spawned.`));
3619
+ * publisher.subscribe("player:death", () => console.log("Player has died."));
3620
+ * context.subscribe("player:spawn", () => console.log("Player has spawned."));
3685
3621
  *
3686
3622
  * publisher.publish("player:spawn"); // "Player has spawned."
3687
3623
  * context.publish("player:death"); // * no output *
@@ -3690,102 +3626,126 @@ const F = class F {
3690
3626
  * ---
3691
3627
  *
3692
3628
  * @template U
3693
- * A map containing the names of the emittable events and the
3694
- * related callback signatures that can be subscribed to them.
3695
- * Default is `T`.
3629
+ * A map containing the additional names of the emittable events and
3630
+ * the related callback signatures that can be subscribed to them.
3631
+ * Default is `{ }`.
3696
3632
  *
3697
3633
  * @return
3698
3634
  * A new instance of the {@link Publisher} class that can be
3699
3635
  * used to publish and subscribe events within a specific context.
3700
3636
  */
3637
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
3701
3638
  createScope() {
3702
- const n = new F();
3703
- return this.subscribe("__internals__:clear", () => n.clear()), this.subscribe("*", (e, ...t) => {
3704
- n.publish(e, ...t);
3705
- }), n;
3706
- }
3707
- publish(n, ...e) {
3708
- let t, s = this._subscribers.get(n);
3709
- return s ? t = s.slice().map((r) => r(...e)) : t = [], n.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((r) => r(n, ...e))), t;
3710
- }
3711
- subscribe(n, e) {
3712
- const t = this._subscribers.get(n) ?? [];
3713
- return t.push(e), this._subscribers.set(n, t), () => {
3714
- const s = t.indexOf(e);
3639
+ const e = new g();
3640
+ return this.subscribe("__internals__:clear", () => e.clear()), this.subscribe("*", (t, ...n) => {
3641
+ e.publish(t, ...n);
3642
+ }), e;
3643
+ }
3644
+ publish(e, ...t) {
3645
+ let n, s = this._subscribers.get(e);
3646
+ return s ? n = s.slice().map((i) => i(...t)) : n = [], e.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((i) => i(e, ...t))), n;
3647
+ }
3648
+ subscribe(e, t) {
3649
+ const n = this._subscribers.get(e) ?? [];
3650
+ return n.push(t), this._subscribers.set(e, n), () => {
3651
+ const s = n.indexOf(t);
3715
3652
  if (s < 0)
3716
- throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3717
- t.splice(s, 1);
3653
+ throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3654
+ n.splice(s, 1);
3718
3655
  };
3719
3656
  }
3720
- unsubscribe(n, e) {
3721
- const t = this._subscribers.get(n);
3722
- if (!t)
3723
- throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3724
- const s = t.indexOf(e);
3657
+ unsubscribe(e, t) {
3658
+ const n = this._subscribers.get(e);
3659
+ if (!n)
3660
+ throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3661
+ const s = n.indexOf(t);
3725
3662
  if (s < 0)
3726
- throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3727
- t.splice(s, 1), t.length === 0 && this._subscribers.delete(n);
3663
+ throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3664
+ n.splice(s, 1), n.length === 0 && this._subscribers.delete(e);
3728
3665
  }
3729
- };
3730
- let v = F;
3731
- const et = () => {
3732
- };
3733
- var ve, Se;
3734
- class dt extends (Se = Ue, ve = Symbol.toStringTag, Se) {
3735
- constructor(e, t = "default") {
3736
- super();
3737
- /**
3738
- * The currently selected implementation of the callback.
3739
- */
3740
- a(this, "_callback");
3741
- /**
3742
- * All the implementations that have been registered for the callback.
3743
- *
3744
- * The keys are the names of the implementations they were registered with.
3745
- * The values are the implementations themselves.
3746
- */
3747
- a(this, "_callbacks");
3748
- /**
3749
- * A flag indicating whether the callback is enabled or not.
3750
- *
3751
- * This protected property is the only one that can be modified directly by the derived classes.
3752
- * If you're looking for the public and readonly property, use
3753
- * the {@link SwitchableCallback.isEnabled} getter instead.
3754
- */
3755
- a(this, "_isEnabled");
3756
- /**
3757
- * The key that is associated with the currently selected implementation.
3758
- *
3759
- * This protected property is the only one that can be modified directly by the derived classes.
3760
- * If you're looking for the public and readonly property, use the {@link SwitchableCallback.key} getter instead.
3761
- */
3762
- a(this, "_key");
3763
- /**
3764
- * The function that will be called by the extended class when the object is invoked as a function.
3765
- */
3766
- a(this, "_invoke");
3767
- a(this, ve, "SwitchableCallback");
3768
- this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = () => {
3769
- throw new He(
3770
- "The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
3771
- );
3772
- }), this._key = t, this._callback = e, this._invoke = (...s) => this._callback(...s);
3666
+ unsubscribeAll(e) {
3667
+ this._subscribers.delete(e);
3773
3668
  }
3774
3669
  /**
3775
- * A flag indicating whether the callback is enabled or not.
3670
+ * Unsubscribes all the subscribers from all the events.
3776
3671
  *
3777
- * It indicates whether the callback is currently able to execute the currently selected implementation.
3778
- * If it's disabled, the callback will be invoked without executing anything.
3672
+ * ---
3673
+ *
3674
+ * @example
3675
+ * ```ts
3676
+ * publisher.subscribe("player:spawn", (evt) => { [...] });
3677
+ * publisher.subscribe("player:move", (coords) => { [...] });
3678
+ * publisher.subscribe("*", () => { [...] });
3679
+ * publisher.subscribe("player:move", ({ x, y }) => { [...] });
3680
+ * publisher.subscribe("player:death", () => { [...] });
3681
+ *
3682
+ * // All these subscribers are working fine...
3683
+ *
3684
+ * publisher.clear();
3685
+ *
3686
+ * // ... but now they're all gone!
3687
+ * ```
3688
+ */
3689
+ clear() {
3690
+ this.publish("__internals__:clear"), this._subscribers.clear();
3691
+ }
3692
+ [Symbol.toStringTag] = "Publisher";
3693
+ }
3694
+ const q = () => {
3695
+ };
3696
+ class K extends O {
3697
+ /**
3698
+ * The currently selected implementation of the callback.
3699
+ */
3700
+ _callback;
3701
+ /**
3702
+ * All the implementations that have been registered for the callback.
3703
+ *
3704
+ * The keys are the names of the implementations they were registered with.
3705
+ * The values are the implementations themselves.
3706
+ */
3707
+ _callbacks;
3708
+ /**
3709
+ * A flag indicating whether the callback is enabled or not.
3710
+ *
3711
+ * This protected property is the only one that can be modified directly by the derived classes.
3712
+ * If you're looking for the public and readonly property, use
3713
+ * the {@link SwitchableCallback.isEnabled} getter instead.
3714
+ */
3715
+ _isEnabled;
3716
+ /**
3717
+ * A flag indicating whether the callback is enabled or not.
3718
+ *
3719
+ * It indicates whether the callback is currently able to execute the currently selected implementation.
3720
+ * If it's disabled, the callback will be invoked without executing anything.
3779
3721
  */
3780
3722
  get isEnabled() {
3781
3723
  return this._isEnabled;
3782
3724
  }
3725
+ /**
3726
+ * The key that is associated with the currently selected implementation.
3727
+ *
3728
+ * This protected property is the only one that can be modified directly by the derived classes.
3729
+ * If you're looking for the public and readonly property, use the {@link SwitchableCallback.key} getter instead.
3730
+ */
3731
+ _key;
3783
3732
  /**
3784
3733
  * The key that is associated with the currently selected implementation.
3785
3734
  */
3786
3735
  get key() {
3787
3736
  return this._key;
3788
3737
  }
3738
+ /**
3739
+ * The function that will be called by the extended class when the object is invoked as a function.
3740
+ */
3741
+ _invoke;
3742
+ constructor(e, t = "default") {
3743
+ super(), this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = (() => {
3744
+ throw new P(
3745
+ "The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
3746
+ );
3747
+ })), this._key = t, this._callback = e, this._invoke = (...n) => this._callback(...n);
3748
+ }
3789
3749
  /**
3790
3750
  * Enables the callback, allowing it to execute the currently selected implementation.
3791
3751
  *
@@ -3839,7 +3799,7 @@ class dt extends (Se = Ue, ve = Symbol.toStringTag, Se) {
3839
3799
  disable() {
3840
3800
  if (!this._isEnabled)
3841
3801
  throw new p("The `SwitchableCallback` is already disabled.");
3842
- this._callback = et, this._isEnabled = !1;
3802
+ this._callback = q, this._isEnabled = !1;
3843
3803
  }
3844
3804
  /**
3845
3805
  * Registers a new implementation for the callback.
@@ -3916,9 +3876,13 @@ class dt extends (Se = Ue, ve = Symbol.toStringTag, Se) {
3916
3876
  throw new _(`The key '${e}' doesn't yet have any associated callback.`);
3917
3877
  this._key !== e && (this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e)));
3918
3878
  }
3879
+ [Symbol.toStringTag] = "SwitchableCallback";
3919
3880
  }
3920
- var ke, Te;
3921
- class wt extends (Te = Map, ke = Symbol.toStringTag, Te) {
3881
+ class Q extends Map {
3882
+ /**
3883
+ * The internal {@link Publisher} instance used to publish events.
3884
+ */
3885
+ _publisher;
3922
3886
  /**
3923
3887
  * Initializes a new instance of the {@link MapView} class.
3924
3888
  *
@@ -3934,15 +3898,9 @@ class wt extends (Te = Map, ke = Symbol.toStringTag, Te) {
3934
3898
  * @param iterable An optional iterable of key-value pairs to initialize the {@link Map} with.
3935
3899
  */
3936
3900
  constructor(e) {
3937
- super();
3938
- /**
3939
- * The internal {@link Publisher} instance used to publish events.
3940
- */
3941
- a(this, "_publisher");
3942
- a(this, ke, "MapView");
3943
- if (this._publisher = new v(), e)
3944
- for (const [t, s] of e)
3945
- this.set(t, s);
3901
+ if (super(), this._publisher = new g(), e)
3902
+ for (const [t, n] of e)
3903
+ this.set(t, n);
3946
3904
  }
3947
3905
  /**
3948
3906
  * Adds a new entry with a specified key and value to the {@link Map}.
@@ -4070,9 +4028,13 @@ class wt extends (Te = Map, ke = Symbol.toStringTag, Te) {
4070
4028
  unsubscribe(e, t) {
4071
4029
  this._publisher.unsubscribe(e, t);
4072
4030
  }
4031
+ [Symbol.toStringTag] = "MapView";
4073
4032
  }
4074
- var Ee, Me;
4075
- class mt extends (Me = Set, Ee = Symbol.toStringTag, Me) {
4033
+ class H extends Set {
4034
+ /**
4035
+ * The internal {@link Publisher} instance used to publish events.
4036
+ */
4037
+ _publisher;
4076
4038
  /**
4077
4039
  * Initializes a new instance of the {@link SetView} class.
4078
4040
  *
@@ -4088,13 +4050,7 @@ class mt extends (Me = Set, Ee = Symbol.toStringTag, Me) {
4088
4050
  * @param iterable An optional iterable of values to initialize the {@link Set} with.
4089
4051
  */
4090
4052
  constructor(e) {
4091
- super();
4092
- /**
4093
- * The internal {@link Publisher} instance used to publish events.
4094
- */
4095
- a(this, "_publisher");
4096
- a(this, Ee, "SetView");
4097
- if (this._publisher = new v(), e)
4053
+ if (super(), this._publisher = new g(), e)
4098
4054
  for (const t of e)
4099
4055
  this.add(t);
4100
4056
  }
@@ -4223,10 +4179,24 @@ class mt extends (Me = Set, Ee = Symbol.toStringTag, Me) {
4223
4179
  unsubscribe(e, t) {
4224
4180
  this._publisher.unsubscribe(e, t);
4225
4181
  }
4182
+ [Symbol.toStringTag] = "SetView";
4226
4183
  }
4227
- var Re;
4228
- Re = Symbol.toStringTag;
4229
- class pt {
4184
+ class X {
4185
+ /**
4186
+ * Whether to prefer the {@link localStorage} over the {@link sessionStorage} when calling an ambivalent method.
4187
+ *
4188
+ * If `true`, the persistent storage is preferred. If `false`, the volatile storage is preferred.
4189
+ * Default is `true`.
4190
+ */
4191
+ _preferPersistence;
4192
+ /**
4193
+ * A reference to the volatile {@link sessionStorage} storage.
4194
+ */
4195
+ _volatile;
4196
+ /**
4197
+ * A reference to the persistent {@link localStorage} storage.
4198
+ */
4199
+ _persistent;
4230
4200
  /**
4231
4201
  * Initializes a new instance of the {@link JSONStorage} class.
4232
4202
  * It cannot be instantiated outside of a browser environment or an {@link EnvironmentException} is thrown.
@@ -4244,57 +4214,41 @@ class pt {
4244
4214
  * Whether to prefer the {@link localStorage} over the {@link sessionStorage} when calling an ambivalent method.
4245
4215
  * If omitted, it defaults to `true` to prefer the persistent storage.
4246
4216
  */
4247
- constructor(n = !0) {
4248
- /**
4249
- * Whether to prefer the {@link localStorage} over the {@link sessionStorage} when calling an ambivalent method.
4250
- *
4251
- * If `true`, the persistent storage is preferred. If `false`, the volatile storage is preferred.
4252
- * Default is `true`.
4253
- */
4254
- a(this, "_preferPersistence");
4255
- /**
4256
- * A reference to the volatile {@link sessionStorage} storage.
4257
- */
4258
- a(this, "_volatile");
4259
- /**
4260
- * A reference to the persistent {@link localStorage} storage.
4261
- */
4262
- a(this, "_persistent");
4263
- a(this, Re, "JSONStorage");
4264
- if (!Ye)
4265
- throw new Xe(
4217
+ constructor(e = !0) {
4218
+ if (!T)
4219
+ throw new j(
4266
4220
  "The `JSONStorage` class can only be instantiated within a browser environment."
4267
4221
  );
4268
- this._preferPersistence = n, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
4222
+ this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
4269
4223
  }
4270
- _get(n, e, t) {
4271
- const s = n.getItem(e);
4224
+ _get(e, t, n) {
4225
+ const s = e.getItem(t);
4272
4226
  if (s)
4273
4227
  try {
4274
4228
  return JSON.parse(s);
4275
4229
  } catch {
4276
4230
  console.warn(
4277
- `The "${s}" value for "${e}" property cannot be parsed. Clearing the storage...`
4278
- ), n.removeItem(e);
4231
+ `The "${s}" value for "${t}" property cannot be parsed. Clearing the storage...`
4232
+ ), e.removeItem(t);
4279
4233
  }
4280
- return t;
4234
+ return n;
4281
4235
  }
4282
- _set(n, e, t) {
4283
- const s = JSON.stringify(t);
4284
- s ? n.setItem(e, s) : n.removeItem(e);
4236
+ _set(e, t, n) {
4237
+ const s = JSON.stringify(n);
4238
+ s ? e.setItem(t, s) : e.removeItem(t);
4285
4239
  }
4286
- get(n, e, t = this._preferPersistence) {
4287
- const s = t ? this._persistent : this._volatile;
4288
- return this._get(s, n, e);
4240
+ get(e, t, n = this._preferPersistence) {
4241
+ const s = n ? this._persistent : this._volatile;
4242
+ return this._get(s, e, t);
4289
4243
  }
4290
- recall(n, e) {
4291
- return this._get(this._volatile, n, e);
4244
+ recall(e, t) {
4245
+ return this._get(this._volatile, e, t);
4292
4246
  }
4293
- retrieve(n, e) {
4294
- return this.recall(n) ?? this.read(n, e);
4247
+ retrieve(e, t) {
4248
+ return this.recall(e) ?? this.read(e, t);
4295
4249
  }
4296
- read(n, e) {
4297
- return this._get(this._persistent, n, e);
4250
+ read(e, t) {
4251
+ return this._get(this._persistent, e, t);
4298
4252
  }
4299
4253
  /**
4300
4254
  * Checks whether the value with the specified key exists within the default storage.
@@ -4318,8 +4272,8 @@ class pt {
4318
4272
  *
4319
4273
  * @returns `true` if the key exists, `false` otherwise.
4320
4274
  */
4321
- has(n, e) {
4322
- return (e ? this._persistent : this._volatile).getItem(n) !== null;
4275
+ has(e, t) {
4276
+ return (t ? this._persistent : this._volatile).getItem(e) !== null;
4323
4277
  }
4324
4278
  /**
4325
4279
  * Checks whether the value with the specified key exists within the volatile {@link sessionStorage}.
@@ -4340,8 +4294,8 @@ class pt {
4340
4294
  *
4341
4295
  * @returns `true` if the key exists, `false` otherwise.
4342
4296
  */
4343
- knows(n) {
4344
- return this._volatile.getItem(n) !== null;
4297
+ knows(e) {
4298
+ return this._volatile.getItem(e) !== null;
4345
4299
  }
4346
4300
  /**
4347
4301
  * Checks whether the value with the specified key exists looking first in the
@@ -4363,8 +4317,8 @@ class pt {
4363
4317
  *
4364
4318
  * @returns `true` if the key exists, `false` otherwise.
4365
4319
  */
4366
- find(n) {
4367
- return this.knows(n) ?? this.exists(n);
4320
+ find(e) {
4321
+ return this.knows(e) ?? this.exists(e);
4368
4322
  }
4369
4323
  /**
4370
4324
  * Checks whether the value with the specified key exists within the persistent {@link localStorage}.
@@ -4385,8 +4339,8 @@ class pt {
4385
4339
  *
4386
4340
  * @returns `true` if the key exists, `false` otherwise.
4387
4341
  */
4388
- exists(n) {
4389
- return this._persistent.getItem(n) !== null;
4342
+ exists(e) {
4343
+ return this._persistent.getItem(e) !== null;
4390
4344
  }
4391
4345
  /**
4392
4346
  * Sets the value with the specified key in the default storage.
@@ -4411,9 +4365,9 @@ class pt {
4411
4365
  * Whether to prefer the persistent {@link localStorage} over the volatile {@link sessionStorage}.
4412
4366
  * If omitted, it defaults to the `preferPersistence` value set in the constructor.
4413
4367
  */
4414
- set(n, e, t = this._preferPersistence) {
4415
- const s = t ? this._persistent : this._volatile;
4416
- this._set(s, n, e);
4368
+ set(e, t, n = this._preferPersistence) {
4369
+ const s = n ? this._persistent : this._volatile;
4370
+ this._set(s, e, t);
4417
4371
  }
4418
4372
  /**
4419
4373
  * Sets the value with the specified key in the volatile {@link sessionStorage}.
@@ -4435,8 +4389,8 @@ class pt {
4435
4389
  * @param key The key of the value to set.
4436
4390
  * @param newValue The new value to set. If it's `undefined` or omitted, the key is removed instead.
4437
4391
  */
4438
- remember(n, e) {
4439
- this._set(this._volatile, n, e);
4392
+ remember(e, t) {
4393
+ this._set(this._volatile, e, t);
4440
4394
  }
4441
4395
  /**
4442
4396
  * Sets the value with the specified key in the persistent {@link localStorage}.
@@ -4458,8 +4412,8 @@ class pt {
4458
4412
  * @param key The key of the value to set.
4459
4413
  * @param newValue The new value to set. If it's `undefined` or omitted, the key is removed instead.
4460
4414
  */
4461
- write(n, e) {
4462
- this._set(this._persistent, n, e);
4415
+ write(e, t) {
4416
+ this._set(this._persistent, e, t);
4463
4417
  }
4464
4418
  /**
4465
4419
  * Removes the value with the specified key from the default storage.
@@ -4478,8 +4432,8 @@ class pt {
4478
4432
  * Whether to prefer the persistent {@link localStorage} over the volatile {@link sessionStorage}.
4479
4433
  * If omitted, it defaults to the `preferPersistence` value set in the constructor.
4480
4434
  */
4481
- delete(n, e) {
4482
- (e ? this._persistent : this._volatile).removeItem(n);
4435
+ delete(e, t) {
4436
+ (t ? this._persistent : this._volatile).removeItem(e);
4483
4437
  }
4484
4438
  /**
4485
4439
  * Removes the value with the specified key from the volatile {@link sessionStorage}.
@@ -4495,8 +4449,8 @@ class pt {
4495
4449
  *
4496
4450
  * @param key The key of the value to remove.
4497
4451
  */
4498
- forget(n) {
4499
- this._volatile.removeItem(n);
4452
+ forget(e) {
4453
+ this._volatile.removeItem(e);
4500
4454
  }
4501
4455
  /**
4502
4456
  * Removes the value with the specified key from the persistent {@link localStorage}.
@@ -4512,8 +4466,8 @@ class pt {
4512
4466
  *
4513
4467
  * @param key The key of the value to remove.
4514
4468
  */
4515
- erase(n) {
4516
- this._persistent.removeItem(n);
4469
+ erase(e) {
4470
+ this._persistent.removeItem(e);
4517
4471
  }
4518
4472
  /**
4519
4473
  * Removes the value with the specified key from both the
@@ -4530,65 +4484,12 @@ class pt {
4530
4484
  *
4531
4485
  * @param key The key of the value to remove.
4532
4486
  */
4533
- clear(n) {
4534
- this._volatile.removeItem(n), this._persistent.removeItem(n);
4487
+ clear(e) {
4488
+ this._volatile.removeItem(e), this._persistent.removeItem(e);
4535
4489
  }
4490
+ [Symbol.toStringTag] = "JSONStorage";
4536
4491
  }
4537
- var Fe;
4538
- Fe = Symbol.toStringTag;
4539
- const P = class P {
4540
- /**
4541
- * Initializes a new instance of the {@link SmartPromise} class.
4542
- *
4543
- * ---
4544
- *
4545
- * @example
4546
- * ```ts
4547
- * const promise = new SmartPromise<string>((resolve, reject) =>
4548
- * {
4549
- * setTimeout(() => resolve("Hello, World!"), 1_000);
4550
- * });
4551
- * ```
4552
- *
4553
- * ---
4554
- *
4555
- * @param executor
4556
- * The function responsible for eventually resolving or rejecting the promise.
4557
- * Similarly to the native {@link Promise} object, it's immediately executed after the promise is created.
4558
- */
4559
- constructor(n) {
4560
- /**
4561
- * A flag indicating whether the promise is still pending or not.
4562
- *
4563
- * The protected property is the only one that can be modified directly by the derived classes.
4564
- * If you're looking for the public and readonly property, use the {@link SmartPromise.isPending} getter instead.
4565
- */
4566
- a(this, "_isPending");
4567
- /**
4568
- * A flag indicating whether the promise has been fulfilled or not.
4569
- *
4570
- * The protected property is the only one that can be modified directly by the derived classes.
4571
- * If you're looking for the public and readonly property, use the {@link SmartPromise.isFulfilled} getter instead.
4572
- */
4573
- a(this, "_isFulfilled");
4574
- /**
4575
- * A flag indicating whether the promise has been rejected or not.
4576
- *
4577
- * The protected property is the only one that can be modified directly by the derived classes.
4578
- * If you're looking for the public and readonly property, use the {@link SmartPromise.isRejected} getter instead.
4579
- */
4580
- a(this, "_isRejected");
4581
- /**
4582
- * The native {@link Promise} object wrapped by this instance.
4583
- */
4584
- a(this, "_promise");
4585
- a(this, Fe, "SmartPromise");
4586
- this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
4587
- const e = (s) => (this._isPending = !1, this._isFulfilled = !0, s), t = (s) => {
4588
- throw this._isPending = !1, this._isRejected = !0, s;
4589
- };
4590
- this._promise = new Promise(n).then(e, t);
4591
- }
4492
+ class w {
4592
4493
  /**
4593
4494
  * Wraps a new {@link SmartPromise} object around an existing native {@link Promise} object.
4594
4495
  *
@@ -4612,32 +4513,83 @@ const P = class P {
4612
4513
  *
4613
4514
  * @returns A new {@link SmartPromise} object that wraps the provided promise.
4614
4515
  */
4615
- static FromPromise(n) {
4616
- return new P((e, t) => n.then(e, t));
4516
+ static FromPromise(e) {
4517
+ return new w((t, n) => e.then(t, n));
4617
4518
  }
4519
+ /**
4520
+ * A flag indicating whether the promise is still pending or not.
4521
+ *
4522
+ * The protected property is the only one that can be modified directly by the derived classes.
4523
+ * If you're looking for the public and readonly property, use the {@link SmartPromise.isPending} getter instead.
4524
+ */
4525
+ _isPending;
4618
4526
  /**
4619
4527
  * A flag indicating whether the promise is still pending or not.
4620
4528
  */
4621
4529
  get isPending() {
4622
4530
  return this._isPending;
4623
4531
  }
4532
+ /**
4533
+ * A flag indicating whether the promise has been fulfilled or not.
4534
+ *
4535
+ * The protected property is the only one that can be modified directly by the derived classes.
4536
+ * If you're looking for the public and readonly property, use the {@link SmartPromise.isFulfilled} getter instead.
4537
+ */
4538
+ _isFulfilled;
4624
4539
  /**
4625
4540
  * A flag indicating whether the promise has been fulfilled or not.
4626
4541
  */
4627
4542
  get isFulfilled() {
4628
4543
  return this._isFulfilled;
4629
4544
  }
4545
+ /**
4546
+ * A flag indicating whether the promise has been rejected or not.
4547
+ *
4548
+ * The protected property is the only one that can be modified directly by the derived classes.
4549
+ * If you're looking for the public and readonly property, use the {@link SmartPromise.isRejected} getter instead.
4550
+ */
4551
+ _isRejected;
4630
4552
  /**
4631
4553
  * A flag indicating whether the promise has been rejected or not.
4632
4554
  */
4633
4555
  get isRejected() {
4634
4556
  return this._isRejected;
4635
4557
  }
4636
- then(n, e) {
4637
- return this._promise.then(n, e);
4558
+ /**
4559
+ * The native {@link Promise} object wrapped by this instance.
4560
+ */
4561
+ _promise;
4562
+ /**
4563
+ * Initializes a new instance of the {@link SmartPromise} class.
4564
+ *
4565
+ * ---
4566
+ *
4567
+ * @example
4568
+ * ```ts
4569
+ * const promise = new SmartPromise<string>((resolve, reject) =>
4570
+ * {
4571
+ * setTimeout(() => resolve("Hello, World!"), 1_000);
4572
+ * });
4573
+ * ```
4574
+ *
4575
+ * ---
4576
+ *
4577
+ * @param executor
4578
+ * The function responsible for eventually resolving or rejecting the promise.
4579
+ * Similarly to the native {@link Promise} object, it's immediately executed after the promise is created.
4580
+ */
4581
+ constructor(e) {
4582
+ this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
4583
+ const t = (s) => (this._isPending = !1, this._isFulfilled = !0, s), n = (s) => {
4584
+ throw this._isPending = !1, this._isRejected = !0, s;
4585
+ };
4586
+ this._promise = new Promise(e).then(t, n);
4587
+ }
4588
+ then(e, t) {
4589
+ return this._promise.then(e, t);
4638
4590
  }
4639
- catch(n) {
4640
- return this._promise.catch(n);
4591
+ catch(e) {
4592
+ return this._promise.catch(e);
4641
4593
  }
4642
4594
  /**
4643
4595
  * Attaches a callback that executes right after the promise is settled, regardless of the outcome.
@@ -4665,13 +4617,38 @@ const P = class P {
4665
4617
  *
4666
4618
  * @returns A new {@link Promise} that executes the callback once the promise is settled.
4667
4619
  */
4668
- finally(n) {
4669
- return this._promise.finally(n);
4620
+ finally(e) {
4621
+ return this._promise.finally(e);
4622
+ }
4623
+ [Symbol.toStringTag] = "SmartPromise";
4624
+ }
4625
+ class M extends w {
4626
+ /**
4627
+ * The exposed function that allows to resolve the promise.
4628
+ *
4629
+ * This protected property is the only one that can be modified directly by the derived classes.
4630
+ * If you're looking for the public and readonly property, use the {@link DeferredPromise.resolve} getter instead.
4631
+ */
4632
+ _resolve;
4633
+ /**
4634
+ * The exposed function that allows to reject the promise.
4635
+ */
4636
+ get resolve() {
4637
+ return this._resolve;
4638
+ }
4639
+ /**
4640
+ * The exposed function that allows to reject the promise.
4641
+ *
4642
+ * This protected property is the only one that can be modified directly by the derived classes.
4643
+ * If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
4644
+ */
4645
+ _reject;
4646
+ /**
4647
+ * The exposed function that allows to reject the promise.
4648
+ */
4649
+ get reject() {
4650
+ return this._reject;
4670
4651
  }
4671
- };
4672
- let S = P;
4673
- var Pe, je;
4674
- class Ve extends (je = S, Pe = Symbol.toStringTag, je) {
4675
4652
  /**
4676
4653
  * Initializes a new instance of the {@link DeferredPromise} class.
4677
4654
  *
@@ -4688,38 +4665,10 @@ class Ve extends (je = S, Pe = Symbol.toStringTag, je) {
4688
4665
  * @param onRejected The callback to execute once the promise is rejected.
4689
4666
  */
4690
4667
  constructor(e, t) {
4691
- let s, r;
4692
- super((o, l) => {
4693
- s = o, r = l;
4694
- });
4695
- /**
4696
- * The exposed function that allows to resolve the promise.
4697
- *
4698
- * This protected property is the only one that can be modified directly by the derived classes.
4699
- * If you're looking for the public and readonly property, use the {@link DeferredPromise.resolve} getter instead.
4700
- */
4701
- a(this, "_resolve");
4702
- /**
4703
- * The exposed function that allows to reject the promise.
4704
- *
4705
- * This protected property is the only one that can be modified directly by the derived classes.
4706
- * If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
4707
- */
4708
- a(this, "_reject");
4709
- a(this, Pe, "DeferredPromise");
4710
- this._promise = this._promise.then(e, t), this._resolve = s, this._reject = r;
4711
- }
4712
- /**
4713
- * The exposed function that allows to reject the promise.
4714
- */
4715
- get resolve() {
4716
- return this._resolve;
4717
- }
4718
- /**
4719
- * The exposed function that allows to reject the promise.
4720
- */
4721
- get reject() {
4722
- return this._reject;
4668
+ let n, s;
4669
+ super((i, o) => {
4670
+ n = i, s = o;
4671
+ }), this._promise = this._promise.then(e, t), this._resolve = n, this._reject = s;
4723
4672
  }
4724
4673
  /**
4725
4674
  * Watches another promise and resolves or rejects this promise when the other one is settled.
@@ -4744,9 +4693,9 @@ class Ve extends (je = S, Pe = Symbol.toStringTag, je) {
4744
4693
  watch(e) {
4745
4694
  return e.then(this.resolve, this.reject), this;
4746
4695
  }
4696
+ [Symbol.toStringTag] = "DeferredPromise";
4747
4697
  }
4748
- var Ce, Ie;
4749
- class tt extends (Ie = S, Ce = Symbol.toStringTag, Ie) {
4698
+ class $ extends w {
4750
4699
  /**
4751
4700
  * Initializes a new instance of the {@link TimedPromise} class.
4752
4701
  *
@@ -4770,31 +4719,22 @@ class tt extends (Ie = S, Ce = Symbol.toStringTag, Ie) {
4770
4719
  * @param timeout The maximum time in milliseconds that the operation can take before timing out.
4771
4720
  */
4772
4721
  constructor(e, t) {
4773
- super((s, r) => {
4774
- const o = (T) => {
4775
- clearTimeout(C), s(T);
4776
- }, l = (T) => {
4777
- clearTimeout(C), r(T);
4778
- }, C = setTimeout(() => l(new Ze("The operation has timed out.")), t);
4779
- e(o, l);
4722
+ super((n, s) => {
4723
+ const i = (v) => {
4724
+ clearTimeout(y), n(v);
4725
+ }, o = (v) => {
4726
+ clearTimeout(y), s(v);
4727
+ }, y = setTimeout(() => o(new C("The operation has timed out.")), t);
4728
+ e(i, o);
4780
4729
  });
4781
- a(this, Ce, "TimedPromise");
4782
4730
  }
4731
+ [Symbol.toStringTag] = "TimedPromise";
4783
4732
  }
4784
- var Ae, Ne;
4785
- class _t extends (Ne = S, Ae = Symbol.toStringTag, Ne) {
4733
+ class Z extends w {
4786
4734
  /**
4787
- * Initializes a new instance of the {@link PromiseQueue} class.
4735
+ * The number of promises currently in the queue.
4788
4736
  */
4789
- constructor() {
4790
- super((e) => e());
4791
- /**
4792
- * The number of promises currently in the queue.
4793
- */
4794
- a(this, "_count");
4795
- a(this, Ae, "PromiseQueue");
4796
- this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
4797
- }
4737
+ _count;
4798
4738
  /**
4799
4739
  * A flag indicating whether the promise is still pending or not.
4800
4740
  */
@@ -4816,120 +4756,74 @@ class _t extends (Ne = S, Ae = Symbol.toStringTag, Ne) {
4816
4756
  get isRejected() {
4817
4757
  throw new f("`PromiseQueue` doesn't support rejection states.");
4818
4758
  }
4759
+ /**
4760
+ * Initializes a new instance of the {@link PromiseQueue} class.
4761
+ */
4762
+ constructor() {
4763
+ super((e) => e()), this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
4764
+ }
4819
4765
  enqueue(e, t) {
4820
- if (this._count += 1, e instanceof Ve) {
4821
- const r = e;
4822
- e = () => (r.resolve(), r);
4766
+ if (this._count += 1, e instanceof M) {
4767
+ const s = e;
4768
+ e = () => (s.resolve(), s);
4823
4769
  }
4824
- const s = (r, o) => {
4825
- this._promise = this._promise.then(e).then((l) => {
4826
- this._count -= 1, r(l);
4827
- }).catch((l) => {
4828
- this._count -= 1, o(l);
4770
+ const n = (s, i) => {
4771
+ this._promise = this._promise.then(e).then((o) => {
4772
+ this._count -= 1, s(o);
4773
+ }).catch((o) => {
4774
+ this._count -= 1, i(o);
4829
4775
  });
4830
4776
  };
4831
- return t ? new tt(s, t) : new Promise(s);
4777
+ return t ? new $(n, t) : new w(n);
4832
4778
  }
4779
+ [Symbol.toStringTag] = "PromiseQueue";
4833
4780
  }
4834
- var R = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(R || {}), nt = /* @__PURE__ */ ((i) => (i[i.Sunday = 0] = "Sunday", i[i.Monday = 1] = "Monday", i[i.Tuesday = 2] = "Tuesday", i[i.Wednesday = 3] = "Wednesday", i[i.Thursday = 4] = "Thursday", i[i.Friday = 5] = "Friday", i[i.Saturday = 6] = "Saturday", i))(nt || {});
4835
- function yt(i, n, e = 864e5) {
4836
- let t;
4837
- return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
4781
+ var k = /* @__PURE__ */ ((r) => (r[r.Millisecond = 1] = "Millisecond", r[r.Second = 1e3] = "Second", r[r.Minute = 6e4] = "Minute", r[r.Hour = 36e5] = "Hour", r[r.Day = 864e5] = "Day", r[r.Week = 6048e5] = "Week", r[r.Month = 2592e6] = "Month", r[r.Year = 31536e6] = "Year", r))(k || {}), z = /* @__PURE__ */ ((r) => (r[r.Sunday = 0] = "Sunday", r[r.Monday = 1] = "Monday", r[r.Tuesday = 2] = "Tuesday", r[r.Wednesday = 3] = "Wednesday", r[r.Thursday = 4] = "Thursday", r[r.Friday = 5] = "Friday", r[r.Saturday = 6] = "Saturday", r))(z || {});
4782
+ function W(r, e, t = 864e5) {
4783
+ let n;
4784
+ return r = new Date(r), e = new Date(e), r < e ? n = Math.floor : n = Math.ceil, n((e.getTime() - r.getTime()) / t);
4838
4785
  }
4839
- function bt(i, n, e = 864e5) {
4840
- if (i = new Date(i), n = new Date(n), i >= n)
4786
+ function U(r, e, t = 864e5) {
4787
+ if (r = new Date(r), e = new Date(e), r >= e)
4841
4788
  throw new b("The end date must be greater than the start date.");
4842
- return new u(function* () {
4843
- const t = n.getTime();
4844
- let s = i.getTime();
4845
- for (; s < t; )
4846
- yield new Date(s), s += e;
4789
+ return new l(function* () {
4790
+ const n = e.getTime();
4791
+ let s = r.getTime();
4792
+ for (; s < n; )
4793
+ yield new Date(s), s += t;
4847
4794
  });
4848
4795
  }
4849
- function st(i, n = 864e5) {
4850
- if (n <= 1)
4796
+ function I(r, e = 864e5) {
4797
+ if (e <= 1)
4851
4798
  throw new b(
4852
4799
  "Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
4853
4800
  );
4854
- if (n > 864e5)
4801
+ if (e > 864e5)
4855
4802
  throw new b(
4856
4803
  "Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years."
4857
4804
  );
4858
- return i = new Date(i), new Date(Math.floor(i.getTime() / n) * n);
4805
+ return r = new Date(r), new Date(Math.floor(r.getTime() / e) * e);
4859
4806
  }
4860
- function gt(i, n = 0) {
4861
- i = new Date(i);
4862
- const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
4863
- return st(new Date(s));
4807
+ function ee(r, e = 0) {
4808
+ r = new Date(r);
4809
+ const t = 7 - e, n = (r.getUTCDay() + t) % 7, s = r.getTime() - 864e5 * n;
4810
+ return I(new Date(s));
4864
4811
  }
4865
- var Oe;
4866
- Oe = Symbol.toStringTag;
4867
- class Ge {
4812
+ class F {
4868
4813
  /**
4869
- * Initializes a new instance of the {@link GameLoop} class.
4870
- *
4871
- * ---
4872
- *
4873
- * @example
4874
- * ```ts
4875
- * const loop = new GameLoop((elapsedTime: number) => { [...] });
4876
- * ```
4877
- *
4878
- * ---
4814
+ * The handle of the interval or the animation frame, depending on the environment.
4815
+ * It's used to stop the game loop when the {@link GameLoop._stop} method is called.
4816
+ */
4817
+ _handle;
4818
+ /**
4819
+ * The time when the game loop has started.
4820
+ * In addition to indicating the {@link https://en.wikipedia.org/wiki/Unix_time|Unix timestamp}
4821
+ * of the start of the game loop, it's also used to calculate the elapsed time.
4879
4822
  *
4880
- * @param callback The function that will be executed at each iteration of the game loop.
4881
- * @param msIfNotBrowser
4882
- * The interval in milliseconds that will be used if the current environment isn't a browser. Default is `40`.
4823
+ * This protected property is the only one that can be modified directly by the derived classes.
4824
+ * If you're looking for the public and readonly property, use the {@link GameLoop.startTime} getter instead.
4883
4825
  */
4884
- constructor(n, e = 40) {
4885
- /**
4886
- * The handle of the interval or the animation frame, depending on the environment.
4887
- * It's used to stop the game loop when the {@link GameLoop._stop} method is called.
4888
- */
4889
- a(this, "_handle");
4890
- /**
4891
- * The time when the game loop has started.
4892
- * In addition to indicating the {@link https://en.wikipedia.org/wiki/Unix_time|Unix timestamp}
4893
- * of the start of the game loop, it's also used to calculate the elapsed time.
4894
- *
4895
- * This protected property is the only one that can be modified directly by the derived classes.
4896
- * If you're looking for the public and readonly property, use the {@link GameLoop.startTime} getter instead.
4897
- */
4898
- a(this, "_startTime");
4899
- /**
4900
- * A flag indicating whether the game loop is currently running or not.
4901
- *
4902
- * This protected property is the only one that can be modified directly by the derived classes.
4903
- * If you're looking for the public and readonly property, use the {@link GameLoop.isRunning} getter instead.
4904
- */
4905
- a(this, "_isRunning");
4906
- /**
4907
- * The {@link Publisher} object that will be used to publish the events of the game loop.
4908
- */
4909
- a(this, "_publisher");
4910
- /**
4911
- * The internal method actually responsible for starting the game loop.
4912
- *
4913
- * Depending on the current environment, it could use the
4914
- * {@link requestAnimationFrame} or the {@link setInterval} function.
4915
- */
4916
- a(this, "_start");
4917
- /**
4918
- * The internal method actually responsible for stopping the game loop.
4919
- *
4920
- * Depending on the current environment, it could use the
4921
- * {@link cancelAnimationFrame} or the {@link clearInterval} function.
4922
- */
4923
- a(this, "_stop");
4924
- a(this, Oe, "GameLoop");
4925
- this._startTime = 0, this._isRunning = !1, Ye ? (this._start = () => {
4926
- n(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
4927
- }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
4928
- `Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
4929
- ), this._start = () => {
4930
- this._handle = setInterval(() => n(this.elapsedTime), e);
4931
- }, this._stop = () => clearInterval(this._handle)), this._publisher = new v();
4932
- }
4826
+ _startTime;
4933
4827
  /**
4934
4828
  * The time when the game loop has started.
4935
4829
  * In addition to indicating the {@link https://en.wikipedia.org/wiki/Unix_time|Unix timestamp}
@@ -4938,6 +4832,13 @@ class Ge {
4938
4832
  get startTime() {
4939
4833
  return this._startTime;
4940
4834
  }
4835
+ /**
4836
+ * A flag indicating whether the game loop is currently running or not.
4837
+ *
4838
+ * This protected property is the only one that can be modified directly by the derived classes.
4839
+ * If you're looking for the public and readonly property, use the {@link GameLoop.isRunning} getter instead.
4840
+ */
4841
+ _isRunning;
4941
4842
  /**
4942
4843
  * A flag indicating whether the game loop is currently running or not.
4943
4844
  */
@@ -4951,6 +4852,49 @@ class Ge {
4951
4852
  get elapsedTime() {
4952
4853
  return performance.now() - this._startTime;
4953
4854
  }
4855
+ /**
4856
+ * The {@link Publisher} object that will be used to publish the events of the game loop.
4857
+ */
4858
+ _publisher;
4859
+ /**
4860
+ * The internal method actually responsible for starting the game loop.
4861
+ *
4862
+ * Depending on the current environment, it could use the
4863
+ * {@link requestAnimationFrame} or the {@link setInterval} function.
4864
+ */
4865
+ _start;
4866
+ /**
4867
+ * The internal method actually responsible for stopping the game loop.
4868
+ *
4869
+ * Depending on the current environment, it could use the
4870
+ * {@link cancelAnimationFrame} or the {@link clearInterval} function.
4871
+ */
4872
+ _stop;
4873
+ /**
4874
+ * Initializes a new instance of the {@link GameLoop} class.
4875
+ *
4876
+ * ---
4877
+ *
4878
+ * @example
4879
+ * ```ts
4880
+ * const loop = new GameLoop((elapsedTime: number) => { [...] });
4881
+ * ```
4882
+ *
4883
+ * ---
4884
+ *
4885
+ * @param callback The function that will be executed at each iteration of the game loop.
4886
+ * @param msIfNotBrowser
4887
+ * The interval in milliseconds that will be used if the current environment isn't a browser. Default is `40`.
4888
+ */
4889
+ constructor(e, t = 40) {
4890
+ this._startTime = 0, this._isRunning = !1, T ? (this._start = () => {
4891
+ e(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
4892
+ }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
4893
+ `Not a browser environment detected. Using setInterval@${t}ms instead of requestAnimationFrame...`
4894
+ ), this._start = () => {
4895
+ this._handle = setInterval(() => e(this.elapsedTime), t);
4896
+ }, this._stop = () => clearInterval(this._handle)), this._publisher = new g();
4897
+ }
4954
4898
  /**
4955
4899
  * Starts the execution of the game loop.
4956
4900
  *
@@ -4968,10 +4912,10 @@ class Ge {
4968
4912
  *
4969
4913
  * @param elapsedTime The elapsed time to set as default when the game loop starts. Default is `0`.
4970
4914
  */
4971
- start(n = 0) {
4915
+ start(e = 0) {
4972
4916
  if (this._isRunning)
4973
4917
  throw new p("The game loop has already been started.");
4974
- this._startTime = performance.now() - n, this._start(), this._isRunning = !0, this._publisher.publish("start");
4918
+ this._startTime = performance.now() - e, this._start(), this._isRunning = !0, this._publisher.publish("start");
4975
4919
  }
4976
4920
  /**
4977
4921
  * Stops the execution of the game loop.
@@ -4990,7 +4934,7 @@ class Ge {
4990
4934
  if (!this._isRunning)
4991
4935
  throw new p("The game loop had already stopped or hadn't yet started.");
4992
4936
  if (!this._handle)
4993
- throw new g();
4937
+ throw new x();
4994
4938
  this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
4995
4939
  }
4996
4940
  /**
@@ -5009,8 +4953,8 @@ class Ge {
5009
4953
  *
5010
4954
  * @returns A function that can be used to unsubscribe from the event.
5011
4955
  */
5012
- onStart(n) {
5013
- return this._publisher.subscribe("start", n);
4956
+ onStart(e) {
4957
+ return this._publisher.subscribe("start", e);
5014
4958
  }
5015
4959
  /**
5016
4960
  * Subscribes to the `stop` event of the game loop.
@@ -5028,12 +4972,12 @@ class Ge {
5028
4972
  *
5029
4973
  * @returns A function that can be used to unsubscribe from the event.
5030
4974
  */
5031
- onStop(n) {
5032
- return this._publisher.subscribe("stop", n);
4975
+ onStop(e) {
4976
+ return this._publisher.subscribe("stop", e);
5033
4977
  }
4978
+ [Symbol.toStringTag] = "GameLoop";
5034
4979
  }
5035
- var qe, $e;
5036
- class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
4980
+ class te extends F {
5037
4981
  /**
5038
4982
  * Initializes a new instance of the {@link Clock} class.
5039
4983
  *
@@ -5050,9 +4994,8 @@ class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
5050
4994
  * The interval in milliseconds at which the clock will tick if the environment is not a browser.
5051
4995
  * `TimeUnit.Second` by default.
5052
4996
  */
5053
- constructor(e = R.Second) {
4997
+ constructor(e = k.Second) {
5054
4998
  super((t) => this._publisher.publish("tick", t), e);
5055
- a(this, qe, "Clock");
5056
4999
  }
5057
5000
  /**
5058
5001
  * Starts the execution of the clock.
@@ -5093,7 +5036,7 @@ class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
5093
5036
  if (!this._isRunning)
5094
5037
  throw new p("The clock had already stopped or hadn't yet started.");
5095
5038
  if (!this._handle)
5096
- throw new g();
5039
+ throw new x();
5097
5040
  this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
5098
5041
  }
5099
5042
  /**
@@ -5125,14 +5068,38 @@ class xt extends ($e = Ge, qe = Symbol.toStringTag, $e) {
5125
5068
  throw new b("The tick step must be a non-negative number.");
5126
5069
  if (t === 0)
5127
5070
  return this._publisher.subscribe("tick", e);
5128
- let s = 0;
5129
- return this._publisher.subscribe("tick", (r) => {
5130
- r - s < t || (e(r), s = r);
5071
+ let n = 0;
5072
+ return this._publisher.subscribe("tick", (s) => {
5073
+ s - n < t || (e(s), n = s);
5131
5074
  });
5132
5075
  }
5076
+ [Symbol.toStringTag] = "Clock";
5133
5077
  }
5134
- var ze, De;
5135
- class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
5078
+ class ne extends F {
5079
+ /**
5080
+ * The total duration of the countdown in milliseconds.
5081
+ *
5082
+ * This protected property is the only one that can be modified directly by the derived classes.
5083
+ * If you're looking for the public and readonly property, use the {@link Countdown.duration} getter instead.
5084
+ */
5085
+ _duration;
5086
+ /**
5087
+ * The total duration of the countdown in milliseconds.
5088
+ */
5089
+ get duration() {
5090
+ return this._duration;
5091
+ }
5092
+ /**
5093
+ * The remaining time of the countdown in milliseconds.
5094
+ * It's calculated as the difference between the total duration and the elapsed time.
5095
+ */
5096
+ get remainingTime() {
5097
+ return this._duration - this.elapsedTime;
5098
+ }
5099
+ /**
5100
+ * The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
5101
+ */
5102
+ _deferrer;
5136
5103
  /**
5137
5104
  * Initializes a new instance of the {@link Countdown} class.
5138
5105
  *
@@ -5152,37 +5119,12 @@ class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
5152
5119
  * The interval in milliseconds at which the countdown will tick if the environment is not a browser.
5153
5120
  * `TimeUnit.Second` by default.
5154
5121
  */
5155
- constructor(e, t = R.Second) {
5156
- super(() => {
5157
- const r = this.remainingTime;
5158
- r <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", r);
5159
- }, t);
5160
- /**
5161
- * The total duration of the countdown in milliseconds.
5162
- *
5163
- * This protected property is the only one that can be modified directly by the derived classes.
5164
- * If you're looking for the public and readonly property, use the {@link Countdown.duration} getter instead.
5165
- */
5166
- a(this, "_duration");
5167
- /**
5168
- * The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
5169
- */
5170
- a(this, "_deferrer");
5171
- a(this, ze, "Countdown");
5172
- this._duration = e;
5173
- }
5174
- /**
5175
- * The total duration of the countdown in milliseconds.
5176
- */
5177
- get duration() {
5178
- return this._duration;
5179
- }
5180
- /**
5181
- * The remaining time of the countdown in milliseconds.
5182
- * It's calculated as the difference between the total duration and the elapsed time.
5183
- */
5184
- get remainingTime() {
5185
- return this._duration - this.elapsedTime;
5122
+ constructor(e, t = k.Second) {
5123
+ const n = () => {
5124
+ const s = this.remainingTime;
5125
+ s <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", s);
5126
+ };
5127
+ super(n, t), this._duration = e;
5186
5128
  }
5187
5129
  /**
5188
5130
  * The internal method actually responsible for stopping the
@@ -5200,7 +5142,7 @@ class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
5200
5142
  if (!this._isRunning)
5201
5143
  throw new p("The countdown hadn't yet started.");
5202
5144
  if (!this._deferrer)
5203
- throw new g();
5145
+ throw new x();
5204
5146
  this._stop(), this._handle = void 0, this._isRunning = !1, e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
5205
5147
  }
5206
5148
  /**
@@ -5228,8 +5170,8 @@ class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
5228
5170
  if (this._isRunning)
5229
5171
  throw new p("The countdown had already stopped or hadn't yet started.");
5230
5172
  if (this._deferrer)
5231
- throw new g();
5232
- return this._deferrer = new Ve(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
5173
+ throw new x();
5174
+ return this._deferrer = new M(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
5233
5175
  }
5234
5176
  /**
5235
5177
  * Stops the execution of the countdown.
@@ -5304,18 +5246,14 @@ class vt extends (De = Ge, ze = Symbol.toStringTag, De) {
5304
5246
  throw new b("The tick step must be a non-negative number.");
5305
5247
  if (t === 0)
5306
5248
  return this._publisher.subscribe("tick", e);
5307
- let s = this.remainingTime;
5308
- return this._publisher.subscribe("tick", (r) => {
5309
- s - r < t || (e(r), s = r);
5249
+ let n = this.remainingTime;
5250
+ return this._publisher.subscribe("tick", (s) => {
5251
+ n - s < t || (e(s), n = s);
5310
5252
  });
5311
5253
  }
5254
+ [Symbol.toStringTag] = "Countdown";
5312
5255
  }
5313
- var Be;
5314
- Be = Symbol.toStringTag;
5315
- class St {
5316
- constructor() {
5317
- a(this, Be, "Curve");
5318
- }
5256
+ class se {
5319
5257
  /**
5320
5258
  * Generates a given number of values following a linear curve.
5321
5259
  * The values are equally spaced and normalized between 0 and 1.
@@ -5336,11 +5274,11 @@ class St {
5336
5274
  *
5337
5275
  * @returns A {@link SmartIterator} object that generates the values following a linear curve.
5338
5276
  */
5339
- static Linear(n) {
5340
- const e = n - 1;
5341
- return new u(function* () {
5342
- for (let t = 0; t < n; t += 1)
5343
- yield t / e;
5277
+ static Linear(e) {
5278
+ const t = e - 1;
5279
+ return new l(function* () {
5280
+ for (let n = 0; n < e; n += 1)
5281
+ yield n / t;
5344
5282
  });
5345
5283
  }
5346
5284
  /**
@@ -5371,22 +5309,20 @@ class St {
5371
5309
  *
5372
5310
  * @returns A {@link SmartIterator} object that generates the values following an exponential curve.
5373
5311
  */
5374
- static Exponential(n, e = 2) {
5375
- if (e < 0)
5312
+ static Exponential(e, t = 2) {
5313
+ if (t < 0)
5376
5314
  throw new f("The base of the exponential curve cannot be negative.");
5377
- const t = n - 1;
5378
- return new u(function* () {
5379
- for (let s = 0; s < n; s += 1)
5380
- yield Math.pow(s / t, e);
5315
+ const n = e - 1;
5316
+ return new l(function* () {
5317
+ for (let s = 0; s < e; s += 1)
5318
+ yield Math.pow(s / n, t);
5381
5319
  });
5382
5320
  }
5383
- }
5384
- var Je;
5385
- Je = Symbol.toStringTag;
5386
- const j = class j {
5387
5321
  constructor() {
5388
- a(this, Je, "Random");
5389
5322
  }
5323
+ [Symbol.toStringTag] = "Curve";
5324
+ }
5325
+ class R {
5390
5326
  /**
5391
5327
  * Generates a random boolean value.
5392
5328
  *
@@ -5409,14 +5345,14 @@ const j = class j {
5409
5345
  *
5410
5346
  * @returns A random boolean value.
5411
5347
  */
5412
- static Boolean(n = 0.5) {
5413
- return Math.random() < n;
5348
+ static Boolean(e = 0.5) {
5349
+ return Math.random() < e;
5414
5350
  }
5415
- static Integer(n, e) {
5416
- return Math.floor(e === void 0 ? Math.random() * n : Math.random() * (e - n) + n);
5351
+ static Integer(e, t) {
5352
+ return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
5417
5353
  }
5418
- static Decimal(n, e) {
5419
- return n === void 0 ? Math.random() : e === void 0 ? Math.random() * n : Math.random() * (e - n) + n;
5354
+ static Decimal(e, t) {
5355
+ return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
5420
5356
  }
5421
5357
  /**
5422
5358
  * Picks a random valid index from a given array of elements.
@@ -5432,10 +5368,10 @@ const j = class j {
5432
5368
  *
5433
5369
  * @returns A valid random index from the given array.
5434
5370
  */
5435
- static Index(n) {
5436
- if (n.length === 0)
5371
+ static Index(e) {
5372
+ if (e.length === 0)
5437
5373
  throw new f("You must provide at least one element.");
5438
- return this.Integer(n.length);
5374
+ return this.Integer(e.length);
5439
5375
  }
5440
5376
  /**
5441
5377
  * Picks a random element from a given array of elements.
@@ -5451,187 +5387,189 @@ const j = class j {
5451
5387
  *
5452
5388
  * @returns A random element from the given array.
5453
5389
  */
5454
- static Choice(n) {
5455
- return n[j.Index(n)];
5390
+ static Choice(e) {
5391
+ return e[R.Index(e)];
5456
5392
  }
5457
- };
5458
- let I = j;
5459
- function kt(i) {
5460
- return new Promise((n) => setTimeout(n, i));
5393
+ constructor() {
5394
+ }
5395
+ [Symbol.toStringTag] = "Random";
5396
+ }
5397
+ function ie(r) {
5398
+ return new w((e) => setTimeout(e, r));
5461
5399
  }
5462
- function Tt() {
5463
- return new Promise((i) => requestAnimationFrame(() => i()));
5400
+ function re() {
5401
+ return new w((r) => requestAnimationFrame(() => r()));
5464
5402
  }
5465
- function Et() {
5466
- return new Promise((i) => setTimeout(i));
5403
+ function oe() {
5404
+ return new w((r) => setTimeout(r));
5467
5405
  }
5468
- function Mt(i, n = "text/javascript") {
5469
- return new Promise((e, t) => {
5406
+ function ae(r, e = "text/javascript") {
5407
+ return new w((t, n) => {
5470
5408
  const s = document.createElement("script");
5471
- s.async = !0, s.defer = !0, s.src = i, s.type = n, s.onload = (r) => e(), s.onerror = (r) => t(r), document.body.appendChild(s);
5409
+ s.async = !0, s.defer = !0, s.src = r, s.type = e, s.onload = (i) => t(), s.onerror = (i) => n(i), document.body.appendChild(s);
5472
5410
  });
5473
5411
  }
5474
- function Rt(...i) {
5475
- return new u(function* () {
5476
- for (const n of i)
5477
- for (const e of n)
5478
- yield e;
5412
+ function le(...r) {
5413
+ return new l(function* () {
5414
+ for (const e of r)
5415
+ for (const t of e)
5416
+ yield t;
5479
5417
  });
5480
5418
  }
5481
- function Ft(i) {
5482
- if (i instanceof Array)
5483
- return i.length;
5484
- let n = 0;
5485
- for (const e of i)
5486
- n += 1;
5487
- return n;
5419
+ function ue(r) {
5420
+ if (r instanceof Array)
5421
+ return r.length;
5422
+ let e = 0;
5423
+ for (const t of r)
5424
+ e += 1;
5425
+ return e;
5488
5426
  }
5489
- function Pt(i) {
5490
- return new u(function* () {
5491
- let n = 0;
5492
- for (const e of i)
5493
- yield [n, e], n += 1;
5427
+ function ce(r) {
5428
+ return new l(function* () {
5429
+ let e = 0;
5430
+ for (const t of r)
5431
+ yield [e, t], e += 1;
5494
5432
  });
5495
5433
  }
5496
- function jt(i, n, e = 1) {
5497
- if (e <= 0)
5434
+ function he(r, e, t = 1) {
5435
+ if (t <= 0)
5498
5436
  throw new b(
5499
5437
  "Step must be always a positive number, even when generating numbers in reverse order."
5500
5438
  );
5501
- return n === void 0 && (n = i, i = 0), i > n ? new u(function* () {
5502
- for (let t = i; t > n; t -= e)
5503
- yield t;
5504
- }) : new u(function* () {
5505
- for (let t = i; t < n; t += e)
5506
- yield t;
5439
+ return e === void 0 && (e = r, r = 0), r > e ? new l(function* () {
5440
+ for (let n = r; n > e; n -= t)
5441
+ yield n;
5442
+ }) : new l(function* () {
5443
+ for (let n = r; n < e; n += t)
5444
+ yield n;
5507
5445
  });
5508
5446
  }
5509
- function Ct(i) {
5510
- const n = Array.from(i);
5511
- for (let e = n.length - 1; e > 0; e -= 1) {
5512
- const t = Math.floor(Math.random() * (e + 1));
5513
- [n[e], n[t]] = [n[t], n[e]];
5447
+ function fe(r) {
5448
+ const e = Array.from(r);
5449
+ for (let t = e.length - 1; t > 0; t -= 1) {
5450
+ const n = Math.floor(Math.random() * (t + 1));
5451
+ [e[t], e[n]] = [e[n], e[t]];
5514
5452
  }
5515
- return n;
5453
+ return e;
5516
5454
  }
5517
- function It(i) {
5518
- return new u(function* () {
5519
- const n = /* @__PURE__ */ new Set();
5520
- for (const e of i)
5521
- n.has(e) || (n.add(e), yield e);
5455
+ function de(r) {
5456
+ return new l(function* () {
5457
+ const e = /* @__PURE__ */ new Set();
5458
+ for (const t of r)
5459
+ e.has(t) || (e.add(t), yield t);
5522
5460
  });
5523
5461
  }
5524
- function rt(i, n) {
5525
- const e = i[Symbol.iterator](), t = n[Symbol.iterator]();
5526
- return new u(function* () {
5462
+ function D(r, e) {
5463
+ const t = r[Symbol.iterator](), n = e[Symbol.iterator]();
5464
+ return new l(function* () {
5527
5465
  for (; ; ) {
5528
- const s = e.next(), r = t.next();
5529
- if (s.done || r.done)
5466
+ const s = t.next(), i = n.next();
5467
+ if (s.done || i.done)
5530
5468
  break;
5531
- yield [s.value, r.value];
5469
+ yield [s.value, i.value];
5532
5470
  }
5533
5471
  });
5534
5472
  }
5535
- function At(i, n) {
5536
- if (n === void 0) {
5537
- let r = 0, o = 0;
5538
- for (const l of i)
5539
- r += l, o += 1;
5473
+ function we(r, e) {
5474
+ if (e === void 0) {
5475
+ let i = 0, o = 0;
5476
+ for (const a of r)
5477
+ i += a, o += 1;
5540
5478
  if (o === 0)
5541
5479
  throw new f("You must provide at least one value.");
5542
- return r / o;
5480
+ return i / o;
5543
5481
  }
5544
- let e = 0, t = 0, s = 0;
5545
- for (const [r, o] of rt(i, n)) {
5482
+ let t = 0, n = 0, s = 0;
5483
+ for (const [i, o] of D(r, e)) {
5546
5484
  if (o <= 0)
5547
5485
  throw new f(`The weight for the value #${s} must be greater than zero.`);
5548
- e += r * o, t += o, s += 1;
5486
+ t += i * o, n += o, s += 1;
5549
5487
  }
5550
5488
  if (s === 0)
5551
5489
  throw new f("You must provide at least one value and weight.");
5552
- if (t <= 0)
5490
+ if (n <= 0)
5553
5491
  throw new f("The sum of weights must be greater than zero.");
5554
- return e / t;
5492
+ return t / n;
5555
5493
  }
5556
- function Nt(i) {
5557
- let n = 0;
5558
- for (let e = 0; e < i.length; e += 1) {
5559
- const t = i.charCodeAt(e);
5560
- n = (n << 5) - n + t, n |= 0;
5494
+ function me(r) {
5495
+ let e = 0;
5496
+ for (let t = 0; t < r.length; t += 1) {
5497
+ const n = r.charCodeAt(t);
5498
+ e = (e << 5) - e + n, e |= 0;
5561
5499
  }
5562
- return n;
5500
+ return e;
5563
5501
  }
5564
- function Ot(i) {
5565
- let n = 0;
5566
- for (const e of i)
5567
- n += e;
5568
- return n;
5502
+ function pe(r) {
5503
+ let e = 0;
5504
+ for (const t of r)
5505
+ e += t;
5506
+ return e;
5569
5507
  }
5570
- function qt(i) {
5571
- return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
5508
+ function _e(r) {
5509
+ return `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
5572
5510
  }
5573
- const $t = "2.1.6";
5511
+ const ye = "2.1.8";
5574
5512
  export {
5575
- M as AggregatedAsyncIterator,
5576
- x as AggregatedIterator,
5577
- Ue as CallableObject,
5578
- xt as Clock,
5579
- vt as Countdown,
5580
- St as Curve,
5581
- Ve as DeferredPromise,
5582
- Xe as EnvironmentException,
5513
+ m as AggregatedAsyncIterator,
5514
+ h as AggregatedIterator,
5515
+ O as CallableObject,
5516
+ te as Clock,
5517
+ ne as Countdown,
5518
+ se as Curve,
5519
+ M as DeferredPromise,
5520
+ j as EnvironmentException,
5583
5521
  c as Exception,
5584
- g as FatalErrorException,
5585
- Le as FileException,
5586
- lt as FileExistsException,
5587
- ut as FileNotFoundException,
5588
- Ge as GameLoop,
5589
- pt as JSONStorage,
5522
+ x as FatalErrorException,
5523
+ E as FileException,
5524
+ J as FileExistsException,
5525
+ Y as FileNotFoundException,
5526
+ F as GameLoop,
5527
+ X as JSONStorage,
5590
5528
  _ as KeyException,
5591
- wt as MapView,
5592
- ct as NetworkException,
5593
- He as NotImplementedException,
5594
- ht as PermissionException,
5595
- _t as PromiseQueue,
5596
- v as Publisher,
5597
- I as Random,
5529
+ Q as MapView,
5530
+ L as NetworkException,
5531
+ P as NotImplementedException,
5532
+ V as PermissionException,
5533
+ Z as PromiseQueue,
5534
+ g as Publisher,
5535
+ R as Random,
5598
5536
  b as RangeException,
5599
- h as ReducedIterator,
5600
- E as ReferenceException,
5537
+ u as ReducedIterator,
5538
+ S as ReferenceException,
5601
5539
  p as RuntimeException,
5602
- mt as SetView,
5540
+ H as SetView,
5603
5541
  d as SmartAsyncIterator,
5604
- u as SmartIterator,
5605
- S as SmartPromise,
5606
- dt as SwitchableCallback,
5607
- R as TimeUnit,
5608
- tt as TimedPromise,
5609
- Ze as TimeoutException,
5610
- ft as TypeException,
5611
- $t as VERSION,
5542
+ l as SmartIterator,
5543
+ w as SmartPromise,
5544
+ K as SwitchableCallback,
5545
+ k as TimeUnit,
5546
+ $ as TimedPromise,
5547
+ C as TimeoutException,
5548
+ G as TypeException,
5549
+ ye as VERSION,
5612
5550
  f as ValueException,
5613
- nt as WeekDay,
5614
- At as average,
5615
- qt as capitalize,
5616
- Rt as chain,
5617
- Ft as count,
5618
- yt as dateDifference,
5619
- bt as dateRange,
5620
- st as dateRound,
5621
- kt as delay,
5622
- Pt as enumerate,
5623
- gt as getWeek,
5624
- Nt as hash,
5625
- Ye as isBrowser,
5626
- ot as isNode,
5627
- at as isWorker,
5628
- Mt as loadScript,
5629
- Tt as nextAnimationFrame,
5630
- jt as range,
5631
- Ct as shuffle,
5632
- Ot as sum,
5633
- It as unique,
5634
- Et as yieldToEventLoop,
5635
- rt as zip
5551
+ z as WeekDay,
5552
+ we as average,
5553
+ _e as capitalize,
5554
+ le as chain,
5555
+ ue as count,
5556
+ W as dateDifference,
5557
+ U as dateRange,
5558
+ I as dateRound,
5559
+ ie as delay,
5560
+ ce as enumerate,
5561
+ ee as getWeek,
5562
+ me as hash,
5563
+ T as isBrowser,
5564
+ A as isNode,
5565
+ B as isWorker,
5566
+ ae as loadScript,
5567
+ re as nextAnimationFrame,
5568
+ he as range,
5569
+ fe as shuffle,
5570
+ pe as sum,
5571
+ de as unique,
5572
+ oe as yieldToEventLoop,
5573
+ D as zip
5636
5574
  };
5637
5575
  //# sourceMappingURL=core.esm.js.map