@byloth/core 2.1.8 → 2.2.1

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,4 +1,4 @@
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";
1
+ const T = typeof window < "u" && typeof window.document < "u", D = typeof process < "u" && !!process.versions?.node, B = typeof self == "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
2
2
  class c extends Error {
3
3
  /**
4
4
  * A static method to convert a generic caught error, ensuring it's an instance of the {@link Exception} class.
@@ -166,7 +166,7 @@ class Y extends E {
166
166
  }
167
167
  [Symbol.toStringTag] = "FileNotFoundException";
168
168
  }
169
- class _ extends c {
169
+ class p extends c {
170
170
  /**
171
171
  * Initializes a new instance of the {@link KeyException} class.
172
172
  *
@@ -232,7 +232,7 @@ class V extends c {
232
232
  }
233
233
  [Symbol.toStringTag] = "PermissionException";
234
234
  }
235
- class S extends c {
235
+ class k extends c {
236
236
  /**
237
237
  * Initializes a new instance of the {@link ReferenceException} class.
238
238
  *
@@ -254,7 +254,7 @@ class S extends c {
254
254
  }
255
255
  [Symbol.toStringTag] = "ReferenceException";
256
256
  }
257
- class p extends c {
257
+ class _ extends c {
258
258
  /**
259
259
  * Initializes a new instance of the {@link RuntimeException} class.
260
260
  *
@@ -276,7 +276,7 @@ class p extends c {
276
276
  }
277
277
  [Symbol.toStringTag] = "RuntimeException";
278
278
  }
279
- class j extends p {
279
+ class j extends _ {
280
280
  /**
281
281
  * Initializes a new instance of the {@link EnvironmentException} class.
282
282
  *
@@ -298,7 +298,7 @@ class j extends p {
298
298
  }
299
299
  [Symbol.toStringTag] = "EnvironmentException";
300
300
  }
301
- class C extends c {
301
+ class O extends c {
302
302
  /**
303
303
  * Initializes a new instance of the {@link TimeoutException} class.
304
304
  *
@@ -532,16 +532,16 @@ class l {
532
532
  reduce(e, t) {
533
533
  let n = 0, s = t;
534
534
  if (s === void 0) {
535
- const i = this._iterator.next();
536
- if (i.done)
535
+ const r = this._iterator.next();
536
+ if (r.done)
537
537
  throw new f("Cannot reduce an empty iterator without an initial value.");
538
- s = i.value, n += 1;
538
+ s = r.value, n += 1;
539
539
  }
540
540
  for (; ; ) {
541
- const i = this._iterator.next();
542
- if (i.done)
541
+ const r = this._iterator.next();
542
+ if (r.done)
543
543
  return s;
544
- s = e(s, i.value, n), n += 1;
544
+ s = e(s, r.value, n), n += 1;
545
545
  }
546
546
  }
547
547
  /**
@@ -583,12 +583,12 @@ class l {
583
583
  const s = t.next();
584
584
  if (s.done)
585
585
  return s.value;
586
- const i = e(s.value, n);
587
- if (i instanceof Array)
588
- for (const o of i)
586
+ const r = e(s.value, n);
587
+ if (r instanceof Array)
588
+ for (const o of r)
589
589
  yield o;
590
590
  else
591
- yield i;
591
+ yield r;
592
592
  n += 1;
593
593
  }
594
594
  });
@@ -1082,8 +1082,8 @@ class u {
1082
1082
  filter(e) {
1083
1083
  const t = this._elements.enumerate();
1084
1084
  return new u(function* () {
1085
- for (const [n, [s, i]] of t)
1086
- e(s, i, n) && (yield [s, i]);
1085
+ for (const [n, [s, r]] of t)
1086
+ e(s, r, n) && (yield [s, r]);
1087
1087
  });
1088
1088
  }
1089
1089
  /**
@@ -1122,20 +1122,20 @@ class u {
1122
1122
  map(e) {
1123
1123
  const t = this._elements.enumerate();
1124
1124
  return new u(function* () {
1125
- for (const [n, [s, i]] of t)
1126
- yield [s, e(s, i, n)];
1125
+ for (const [n, [s, r]] of t)
1126
+ yield [s, e(s, r, n)];
1127
1127
  });
1128
1128
  }
1129
1129
  reduce(e, t) {
1130
1130
  let n = 0, s = t;
1131
1131
  if (s === void 0) {
1132
- const i = this._elements.next();
1133
- if (i.done)
1132
+ const r = this._elements.next();
1133
+ if (r.done)
1134
1134
  throw new f("Cannot reduce an empty iterator without an initial value.");
1135
- s = i.value[1], n += 1;
1135
+ s = r.value[1], n += 1;
1136
1136
  }
1137
- for (const [i, o] of this._elements)
1138
- s = e(i, s, o, n), n += 1;
1137
+ for (const [r, o] of this._elements)
1138
+ s = e(r, s, o, n), n += 1;
1139
1139
  return s;
1140
1140
  }
1141
1141
  /**
@@ -1174,8 +1174,8 @@ class u {
1174
1174
  flatMap(e) {
1175
1175
  const t = this._elements.enumerate();
1176
1176
  return new h(function* () {
1177
- for (const [n, [s, i]] of t) {
1178
- const o = e(s, i, n);
1177
+ for (const [n, [s, r]] of t) {
1178
+ const o = e(s, r, n);
1179
1179
  if (o instanceof Array)
1180
1180
  for (const a of o)
1181
1181
  yield [s, a];
@@ -1220,8 +1220,8 @@ class u {
1220
1220
  drop(e) {
1221
1221
  const t = this._elements.enumerate();
1222
1222
  return new u(function* () {
1223
- for (const [n, [s, i]] of t)
1224
- n >= e && (yield [s, i]);
1223
+ for (const [n, [s, r]] of t)
1224
+ n >= e && (yield [s, r]);
1225
1225
  });
1226
1226
  }
1227
1227
  /**
@@ -1262,10 +1262,10 @@ class u {
1262
1262
  take(e) {
1263
1263
  const t = this._elements.enumerate();
1264
1264
  return new u(function* () {
1265
- for (const [n, [s, i]] of t) {
1265
+ for (const [n, [s, r]] of t) {
1266
1266
  if (n >= e)
1267
1267
  break;
1268
- yield [s, i];
1268
+ yield [s, r];
1269
1269
  }
1270
1270
  });
1271
1271
  }
@@ -1428,8 +1428,8 @@ class u {
1428
1428
  reorganizeBy(e) {
1429
1429
  const t = this._elements.enumerate();
1430
1430
  return new h(function* () {
1431
- for (const [n, [s, i]] of t)
1432
- yield [e(s, i, n), i];
1431
+ for (const [n, [s, r]] of t)
1432
+ yield [e(s, r, n), r];
1433
1433
  });
1434
1434
  }
1435
1435
  /**
@@ -1605,7 +1605,7 @@ class u {
1605
1605
  }
1606
1606
  [Symbol.toStringTag] = "ReducedIterator";
1607
1607
  }
1608
- class m {
1608
+ class w {
1609
1609
  /**
1610
1610
  * The internal {@link SmartAsyncIterator} object that holds the elements to aggregate.
1611
1611
  */
@@ -1647,12 +1647,12 @@ class m {
1647
1647
  async every(e) {
1648
1648
  const t = /* @__PURE__ */ new Map();
1649
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)]);
1650
+ const [r, o] = t.get(n) ?? [0, !0];
1651
+ o && t.set(n, [r + 1, await e(n, s, r)]);
1652
1652
  }
1653
1653
  return new u(function* () {
1654
- for (const [n, [s, i]] of t)
1655
- yield [n, i];
1654
+ for (const [n, [s, r]] of t)
1655
+ yield [n, r];
1656
1656
  });
1657
1657
  }
1658
1658
  /**
@@ -1689,21 +1689,21 @@ class m {
1689
1689
  async some(e) {
1690
1690
  const t = /* @__PURE__ */ new Map();
1691
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)]);
1692
+ const [r, o] = t.get(n) ?? [0, !1];
1693
+ o || t.set(n, [r + 1, await e(n, s, r)]);
1694
1694
  }
1695
1695
  return new u(function* () {
1696
- for (const [n, [s, i]] of t)
1697
- yield [n, i];
1696
+ for (const [n, [s, r]] of t)
1697
+ yield [n, r];
1698
1698
  });
1699
1699
  }
1700
1700
  filter(e) {
1701
1701
  const t = this._elements;
1702
- return new m(async function* () {
1702
+ return new w(async function* () {
1703
1703
  const n = /* @__PURE__ */ new Map();
1704
- for await (const [s, i] of t) {
1704
+ for await (const [s, r] of t) {
1705
1705
  const o = n.get(s) ?? 0;
1706
- await e(s, i, o) && (yield [s, i]), n.set(s, o + 1);
1706
+ await e(s, r, o) && (yield [s, r]), n.set(s, o + 1);
1707
1707
  }
1708
1708
  });
1709
1709
  }
@@ -1741,30 +1741,30 @@ class m {
1741
1741
  */
1742
1742
  map(e) {
1743
1743
  const t = this._elements;
1744
- return new m(async function* () {
1744
+ return new w(async function* () {
1745
1745
  const n = /* @__PURE__ */ new Map();
1746
- for await (const [s, i] of t) {
1746
+ for await (const [s, r] of t) {
1747
1747
  const o = n.get(s) ?? 0;
1748
- yield [s, await e(s, i, o)], n.set(s, o + 1);
1748
+ yield [s, await e(s, r, o)], n.set(s, o + 1);
1749
1749
  }
1750
1750
  });
1751
1751
  }
1752
1752
  async reduce(e, t) {
1753
1753
  const n = /* @__PURE__ */ new Map();
1754
- for await (const [s, i] of this._elements) {
1754
+ for await (const [s, r] of this._elements) {
1755
1755
  let o, a;
1756
1756
  if (n.has(s))
1757
1757
  [o, a] = n.get(s);
1758
1758
  else if (t !== void 0)
1759
1759
  o = 0, t instanceof Function ? a = await t(s) : a = await t;
1760
1760
  else {
1761
- n.set(s, [0, i]);
1761
+ n.set(s, [0, r]);
1762
1762
  continue;
1763
1763
  }
1764
- n.set(s, [o + 1, await e(s, a, i, o)]);
1764
+ n.set(s, [o + 1, await e(s, a, r, o)]);
1765
1765
  }
1766
1766
  return new u(function* () {
1767
- for (const [s, [i, o]] of n)
1767
+ for (const [s, [r, o]] of n)
1768
1768
  yield [s, o];
1769
1769
  });
1770
1770
  }
@@ -1806,10 +1806,10 @@ class m {
1806
1806
  */
1807
1807
  flatMap(e) {
1808
1808
  const t = this._elements;
1809
- return new m(async function* () {
1809
+ return new w(async function* () {
1810
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);
1811
+ for await (const [s, r] of t) {
1812
+ const o = n.get(s) ?? 0, a = await e(s, r, o);
1813
1813
  if (a instanceof Array)
1814
1814
  for (const y of a)
1815
1815
  yield [s, y];
@@ -1850,15 +1850,15 @@ class m {
1850
1850
  */
1851
1851
  drop(e) {
1852
1852
  const t = this._elements;
1853
- return new m(async function* () {
1853
+ return new w(async function* () {
1854
1854
  const n = /* @__PURE__ */ new Map();
1855
- for await (const [s, i] of t) {
1855
+ for await (const [s, r] of t) {
1856
1856
  const o = n.get(s) ?? 0;
1857
1857
  if (o < e) {
1858
1858
  n.set(s, o + 1);
1859
1859
  continue;
1860
1860
  }
1861
- yield [s, i];
1861
+ yield [s, r];
1862
1862
  }
1863
1863
  });
1864
1864
  }
@@ -1893,23 +1893,23 @@ class m {
1893
1893
  */
1894
1894
  take(e) {
1895
1895
  const t = this._elements;
1896
- return new m(async function* () {
1896
+ return new w(async function* () {
1897
1897
  const n = /* @__PURE__ */ new Map();
1898
- for await (const [s, i] of t) {
1898
+ for await (const [s, r] of t) {
1899
1899
  const o = n.get(s) ?? 0;
1900
- o >= e || (yield [s, i], n.set(s, o + 1));
1900
+ o >= e || (yield [s, r], n.set(s, o + 1));
1901
1901
  }
1902
1902
  });
1903
1903
  }
1904
1904
  async find(e) {
1905
1905
  const t = /* @__PURE__ */ new Map();
1906
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]));
1907
+ let [r, o] = t.get(n) ?? [0, void 0];
1908
+ o === void 0 && (await e(n, s, r) && (o = s), t.set(n, [r + 1, o]));
1909
1909
  }
1910
1910
  return new u(function* () {
1911
- for (const [n, [s, i]] of t)
1912
- yield [n, i];
1911
+ for (const [n, [s, r]] of t)
1912
+ yield [n, r];
1913
1913
  });
1914
1914
  }
1915
1915
  /**
@@ -1969,11 +1969,11 @@ class m {
1969
1969
  */
1970
1970
  unique() {
1971
1971
  const e = this._elements;
1972
- return new m(async function* () {
1972
+ return new w(async function* () {
1973
1973
  const t = /* @__PURE__ */ new Map();
1974
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]);
1975
+ const r = t.get(n) ?? /* @__PURE__ */ new Set();
1976
+ r.has(s) || (r.add(s), t.set(n, r), yield [n, s]);
1977
1977
  }
1978
1978
  });
1979
1979
  }
@@ -2039,8 +2039,8 @@ class m {
2039
2039
  async forEach(e) {
2040
2040
  const t = /* @__PURE__ */ new Map();
2041
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);
2042
+ const r = t.get(n) ?? 0;
2043
+ await e(n, s, r), t.set(n, r + 1);
2044
2044
  }
2045
2045
  }
2046
2046
  /**
@@ -2076,11 +2076,11 @@ class m {
2076
2076
  */
2077
2077
  reorganizeBy(e) {
2078
2078
  const t = this._elements;
2079
- return new m(async function* () {
2079
+ return new w(async function* () {
2080
2080
  const n = /* @__PURE__ */ new Map();
2081
- for await (const [s, i] of t) {
2081
+ for await (const [s, r] of t) {
2082
2082
  const o = n.get(s) ?? 0;
2083
- yield [await e(s, i, o), i], n.set(s, o + 1);
2083
+ yield [await e(s, r, o), r], n.set(s, o + 1);
2084
2084
  }
2085
2085
  });
2086
2086
  }
@@ -2443,16 +2443,16 @@ class d {
2443
2443
  async reduce(e, t) {
2444
2444
  let n = 0, s = t;
2445
2445
  if (s === void 0) {
2446
- const i = await this._iterator.next();
2447
- if (i.done)
2446
+ const r = await this._iterator.next();
2447
+ if (r.done)
2448
2448
  throw new f("Cannot reduce an empty iterator without an initial value.");
2449
- s = i.value, n += 1;
2449
+ s = r.value, n += 1;
2450
2450
  }
2451
2451
  for (; ; ) {
2452
- const i = await this._iterator.next();
2453
- if (i.done)
2452
+ const r = await this._iterator.next();
2453
+ if (r.done)
2454
2454
  return s;
2455
- s = await e(s, i.value, n), n += 1;
2455
+ s = await e(s, r.value, n), n += 1;
2456
2456
  }
2457
2457
  }
2458
2458
  /**
@@ -2494,12 +2494,12 @@ class d {
2494
2494
  const s = await t.next();
2495
2495
  if (s.done)
2496
2496
  return s.value;
2497
- const i = await e(s.value, n);
2498
- if (i instanceof Array)
2499
- for (const o of i)
2497
+ const r = await e(s.value, n);
2498
+ if (r instanceof Array)
2499
+ for (const o of r)
2500
2500
  yield o;
2501
2501
  else
2502
- yield i;
2502
+ yield r;
2503
2503
  n += 1;
2504
2504
  }
2505
2505
  });
@@ -2882,7 +2882,7 @@ class d {
2882
2882
  * @returns A new instance of the {@link AggregatedAsyncIterator} class containing the grouped elements.
2883
2883
  */
2884
2884
  groupBy(e) {
2885
- return new m(this.map(async (t, n) => [await e(t, n), t]));
2885
+ return new w(this.map(async (t, n) => [await e(t, n), t]));
2886
2886
  }
2887
2887
  /**
2888
2888
  * Materializes the iterator into an array.
@@ -2956,12 +2956,12 @@ class h {
2956
2956
  every(e) {
2957
2957
  const t = /* @__PURE__ */ new Map();
2958
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)]);
2959
+ const [r, o] = t.get(n) ?? [0, !0];
2960
+ o && t.set(n, [r + 1, e(n, s, r)]);
2961
2961
  }
2962
2962
  return new u(function* () {
2963
- for (const [n, [s, i]] of t)
2964
- yield [n, i];
2963
+ for (const [n, [s, r]] of t)
2964
+ yield [n, r];
2965
2965
  });
2966
2966
  }
2967
2967
  /**
@@ -2997,21 +2997,21 @@ class h {
2997
2997
  some(e) {
2998
2998
  const t = /* @__PURE__ */ new Map();
2999
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)]);
3000
+ const [r, o] = t.get(n) ?? [0, !1];
3001
+ o || t.set(n, [r + 1, e(n, s, r)]);
3002
3002
  }
3003
3003
  return new u(function* () {
3004
- for (const [n, [s, i]] of t)
3005
- yield [n, i];
3004
+ for (const [n, [s, r]] of t)
3005
+ yield [n, r];
3006
3006
  });
3007
3007
  }
3008
3008
  filter(e) {
3009
3009
  const t = this._elements;
3010
3010
  return new h(function* () {
3011
3011
  const n = /* @__PURE__ */ new Map();
3012
- for (const [s, i] of t) {
3012
+ for (const [s, r] of t) {
3013
3013
  const o = n.get(s) ?? 0;
3014
- e(s, i, o) && (yield [s, i]), n.set(s, o + 1);
3014
+ e(s, r, o) && (yield [s, r]), n.set(s, o + 1);
3015
3015
  }
3016
3016
  });
3017
3017
  }
@@ -3051,28 +3051,28 @@ class h {
3051
3051
  const t = this._elements;
3052
3052
  return new h(function* () {
3053
3053
  const n = /* @__PURE__ */ new Map();
3054
- for (const [s, i] of t) {
3054
+ for (const [s, r] of t) {
3055
3055
  const o = n.get(s) ?? 0;
3056
- yield [s, e(s, i, o)], n.set(s, o + 1);
3056
+ yield [s, e(s, r, o)], n.set(s, o + 1);
3057
3057
  }
3058
3058
  });
3059
3059
  }
3060
3060
  reduce(e, t) {
3061
3061
  const n = /* @__PURE__ */ new Map();
3062
- for (const [s, i] of this._elements) {
3062
+ for (const [s, r] of this._elements) {
3063
3063
  let o, a;
3064
3064
  if (n.has(s))
3065
3065
  [o, a] = n.get(s);
3066
3066
  else if (t !== void 0)
3067
3067
  o = 0, t instanceof Function ? a = t(s) : a = t;
3068
3068
  else {
3069
- n.set(s, [0, i]);
3069
+ n.set(s, [0, r]);
3070
3070
  continue;
3071
3071
  }
3072
- n.set(s, [o + 1, e(s, a, i, o)]);
3072
+ n.set(s, [o + 1, e(s, a, r, o)]);
3073
3073
  }
3074
3074
  return new u(function* () {
3075
- for (const [s, [i, o]] of n)
3075
+ for (const [s, [r, o]] of n)
3076
3076
  yield [s, o];
3077
3077
  });
3078
3078
  }
@@ -3116,8 +3116,8 @@ class h {
3116
3116
  const t = this._elements;
3117
3117
  return new h(function* () {
3118
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);
3119
+ for (const [s, r] of t) {
3120
+ const o = n.get(s) ?? 0, a = e(s, r, o);
3121
3121
  if (a instanceof Array)
3122
3122
  for (const y of a)
3123
3123
  yield [s, y];
@@ -3160,13 +3160,13 @@ class h {
3160
3160
  const t = this._elements;
3161
3161
  return new h(function* () {
3162
3162
  const n = /* @__PURE__ */ new Map();
3163
- for (const [s, i] of t) {
3163
+ for (const [s, r] of t) {
3164
3164
  const o = n.get(s) ?? 0;
3165
3165
  if (o < e) {
3166
3166
  n.set(s, o + 1);
3167
3167
  continue;
3168
3168
  }
3169
- yield [s, i];
3169
+ yield [s, r];
3170
3170
  }
3171
3171
  });
3172
3172
  }
@@ -3203,21 +3203,21 @@ class h {
3203
3203
  const t = this._elements;
3204
3204
  return new h(function* () {
3205
3205
  const n = /* @__PURE__ */ new Map();
3206
- for (const [s, i] of t) {
3206
+ for (const [s, r] of t) {
3207
3207
  const o = n.get(s) ?? 0;
3208
- o >= e || (yield [s, i], n.set(s, o + 1));
3208
+ o >= e || (yield [s, r], n.set(s, o + 1));
3209
3209
  }
3210
3210
  });
3211
3211
  }
3212
3212
  find(e) {
3213
3213
  const t = /* @__PURE__ */ new Map();
3214
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]));
3215
+ let [r, o] = t.get(n) ?? [0, void 0];
3216
+ o === void 0 && (e(n, s, r) && (o = s), t.set(n, [r + 1, o]));
3217
3217
  }
3218
3218
  return new u(function* () {
3219
- for (const [n, [s, i]] of t)
3220
- yield [n, i];
3219
+ for (const [n, [s, r]] of t)
3220
+ yield [n, r];
3221
3221
  });
3222
3222
  }
3223
3223
  /**
@@ -3280,8 +3280,8 @@ class h {
3280
3280
  return new h(function* () {
3281
3281
  const t = /* @__PURE__ */ new Map();
3282
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]);
3283
+ const r = t.get(n) ?? /* @__PURE__ */ new Set();
3284
+ r.has(s) || (r.add(s), t.set(n, r), yield [n, s]);
3285
3285
  }
3286
3286
  });
3287
3287
  }
@@ -3344,8 +3344,8 @@ class h {
3344
3344
  forEach(e) {
3345
3345
  const t = /* @__PURE__ */ new Map();
3346
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);
3347
+ const r = t.get(n) ?? 0;
3348
+ e(n, s, r), t.set(n, r + 1);
3349
3349
  }
3350
3350
  }
3351
3351
  /**
@@ -3383,9 +3383,9 @@ class h {
3383
3383
  const t = this._elements;
3384
3384
  return new h(function* () {
3385
3385
  const n = /* @__PURE__ */ new Map();
3386
- for (const [s, i] of t) {
3386
+ for (const [s, r] of t) {
3387
3387
  const o = n.get(s) ?? 0;
3388
- yield [e(s, i, o), i], n.set(s, o + 1);
3388
+ yield [e(s, r, o), r], n.set(s, o + 1);
3389
3389
  }
3390
3390
  });
3391
3391
  }
@@ -3569,7 +3569,7 @@ class h {
3569
3569
  [Symbol.toStringTag] = "AggregatedIterator";
3570
3570
  }
3571
3571
  const N = Function;
3572
- class O extends N {
3572
+ class M extends N {
3573
3573
  /**
3574
3574
  * Initializes a new instance of the {@link CallableObject} class.
3575
3575
  */
@@ -3580,6 +3580,113 @@ class O extends N {
3580
3580
  }
3581
3581
  [Symbol.toStringTag] = "CallableObject";
3582
3582
  }
3583
+ class K extends M {
3584
+ /**
3585
+ * The array containing all the functions in the chain.
3586
+ */
3587
+ _callbacks;
3588
+ /**
3589
+ * Gets the number of functions currently in the chain.
3590
+ */
3591
+ get size() {
3592
+ return this._callbacks.length;
3593
+ }
3594
+ /**
3595
+ * Initializes a new instance of the {@link CallbackChain} class.
3596
+ *
3597
+ * ---
3598
+ *
3599
+ * @example
3600
+ * ```ts
3601
+ * const chain = new CallbackChain();
3602
+ * ```
3603
+ *
3604
+ * ---
3605
+ *
3606
+ * @param callback Optional initial functions to add to the chain.
3607
+ */
3608
+ constructor(...e) {
3609
+ super(), this._callbacks = e;
3610
+ }
3611
+ /**
3612
+ * Executes all functions in the chain sequentially with the provided arguments.
3613
+ *
3614
+ * ---
3615
+ *
3616
+ * @param args The arguments to pass to each function in the chain.
3617
+ *
3618
+ * @returns An array containing the return values of all functions.
3619
+ */
3620
+ _invoke(...e) {
3621
+ return this._callbacks.map((t) => t(...e));
3622
+ }
3623
+ /**
3624
+ * Adds a function to the chain.
3625
+ *
3626
+ * ---
3627
+ *
3628
+ * @example
3629
+ * ```ts
3630
+ * const chain = new CallbackChain();
3631
+ * const cleanup = () => console.log("Cleaning up..."));
3632
+ *
3633
+ * chain.add(cleanup);
3634
+ * ```
3635
+ *
3636
+ * ---
3637
+ *
3638
+ * @param callback The function to add to the chain.
3639
+ *
3640
+ * @returns The current instance for method chaining.
3641
+ */
3642
+ add(e) {
3643
+ return this._callbacks.push(e), this;
3644
+ }
3645
+ /**
3646
+ * Removes a specific function from the chain.
3647
+ *
3648
+ * ---
3649
+ *
3650
+ * @example
3651
+ * ```ts
3652
+ * const chain = new CallbackChain();
3653
+ * const cleanup = () => console.log("Cleaning up..."));
3654
+ *
3655
+ * chain.add(cleanup);
3656
+ * chain.remove(cleanup);
3657
+ * ```
3658
+ *
3659
+ * ---
3660
+ *
3661
+ * @param callback The function to remove from the chain.
3662
+ *
3663
+ * @returns `true` if the function was found and removed, `false` otherwise.
3664
+ */
3665
+ remove(e) {
3666
+ const t = this._callbacks.indexOf(e);
3667
+ return t < 0 ? !1 : (this._callbacks.splice(t, 1), !0);
3668
+ }
3669
+ /**
3670
+ * Removes all functions from the chain.
3671
+ *
3672
+ * ---
3673
+ *
3674
+ * @example
3675
+ * ```ts
3676
+ * const chain = new CallbackChain();
3677
+ *
3678
+ * chain.add(() => console.log("Doing something..."));
3679
+ * chain.add(() => console.log("Doing something else..."));
3680
+ * chain.add(() => console.log("Doing yet another thing..."));
3681
+ *
3682
+ * chain.clear();
3683
+ * ```
3684
+ */
3685
+ clear() {
3686
+ this._callbacks.length = 0;
3687
+ }
3688
+ [Symbol.toStringTag] = "CallbackChain";
3689
+ }
3583
3690
  class g {
3584
3691
  /**
3585
3692
  * A map containing all the subscribers for each event.
@@ -3643,24 +3750,24 @@ class g {
3643
3750
  }
3644
3751
  publish(e, ...t) {
3645
3752
  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;
3753
+ return s ? n = s.slice().map((r) => r(...t)) : n = [], e.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((r) => r(e, ...t))), n;
3647
3754
  }
3648
3755
  subscribe(e, t) {
3649
3756
  const n = this._subscribers.get(e) ?? [];
3650
3757
  return n.push(t), this._subscribers.set(e, n), () => {
3651
3758
  const s = n.indexOf(t);
3652
3759
  if (s < 0)
3653
- throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3760
+ throw new k("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3654
3761
  n.splice(s, 1);
3655
3762
  };
3656
3763
  }
3657
3764
  unsubscribe(e, t) {
3658
3765
  const n = this._subscribers.get(e);
3659
3766
  if (!n)
3660
- throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3767
+ throw new k("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3661
3768
  const s = n.indexOf(t);
3662
3769
  if (s < 0)
3663
- throw new S("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3770
+ throw new k("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3664
3771
  n.splice(s, 1), n.length === 0 && this._subscribers.delete(e);
3665
3772
  }
3666
3773
  unsubscribeAll(e) {
@@ -3693,7 +3800,7 @@ class g {
3693
3800
  }
3694
3801
  const q = () => {
3695
3802
  };
3696
- class K extends O {
3803
+ class Q extends M {
3697
3804
  /**
3698
3805
  * The currently selected implementation of the callback.
3699
3806
  */
@@ -3771,16 +3878,16 @@ class K extends O {
3771
3878
  enable(e) {
3772
3879
  if (e === void 0) {
3773
3880
  if (!this._key)
3774
- throw new _(
3881
+ throw new p(
3775
3882
  "The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
3776
3883
  );
3777
3884
  e = this._key;
3778
3885
  } else if (e) {
3779
3886
  if (!this._callbacks.has(e))
3780
- throw new _(`The key '${e}' doesn't yet have any associated callback.`);
3781
- } else throw new _("The key must be a non-empty string.");
3887
+ throw new p(`The key '${e}' doesn't yet have any associated callback.`);
3888
+ } else throw new p("The key must be a non-empty string.");
3782
3889
  if (this._isEnabled)
3783
- throw new p("The `SwitchableCallback` is already enabled.");
3890
+ throw new _("The `SwitchableCallback` is already enabled.");
3784
3891
  this._callback = this._callbacks.get(e), this._isEnabled = !0;
3785
3892
  }
3786
3893
  /**
@@ -3798,7 +3905,7 @@ class K extends O {
3798
3905
  */
3799
3906
  disable() {
3800
3907
  if (!this._isEnabled)
3801
- throw new p("The `SwitchableCallback` is already disabled.");
3908
+ throw new _("The `SwitchableCallback` is already disabled.");
3802
3909
  this._callback = q, this._isEnabled = !1;
3803
3910
  }
3804
3911
  /**
@@ -3825,7 +3932,7 @@ class K extends O {
3825
3932
  if (this._callbacks.size === 0)
3826
3933
  this._key = e, this._callback = t;
3827
3934
  else if (this._callbacks.has(e))
3828
- throw new _(`The key '${e}' has already been used for another callback.`);
3935
+ throw new p(`The key '${e}' has already been used for another callback.`);
3829
3936
  this._callbacks.set(e, t);
3830
3937
  }
3831
3938
  /**
@@ -3848,9 +3955,9 @@ class K extends O {
3848
3955
  */
3849
3956
  unregister(e) {
3850
3957
  if (this._key === e)
3851
- throw new _("Unable to unregister the currently selected callback.");
3958
+ throw new p("Unable to unregister the currently selected callback.");
3852
3959
  if (!this._callbacks.has(e))
3853
- throw new _(`The key '${e}' doesn't yet have any associated callback.`);
3960
+ throw new p(`The key '${e}' doesn't yet have any associated callback.`);
3854
3961
  this._callbacks.delete(e);
3855
3962
  }
3856
3963
  /**
@@ -3873,12 +3980,12 @@ class K extends O {
3873
3980
  */
3874
3981
  switch(e) {
3875
3982
  if (!this._callbacks.has(e))
3876
- throw new _(`The key '${e}' doesn't yet have any associated callback.`);
3983
+ throw new p(`The key '${e}' doesn't yet have any associated callback.`);
3877
3984
  this._key !== e && (this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e)));
3878
3985
  }
3879
3986
  [Symbol.toStringTag] = "SwitchableCallback";
3880
3987
  }
3881
- class Q extends Map {
3988
+ class H extends Map {
3882
3989
  /**
3883
3990
  * The internal {@link Publisher} instance used to publish events.
3884
3991
  */
@@ -3926,7 +4033,7 @@ class Q extends Map {
3926
4033
  * @returns The current instance of the {@link MapView} class.
3927
4034
  */
3928
4035
  set(e, t) {
3929
- return super.set(e, t), this._publisher.publish("entry:add", e, t), this;
4036
+ return super.set(e, t), this._publisher.publish("add", e, t), this;
3930
4037
  }
3931
4038
  /**
3932
4039
  * Removes an entry with a specified key from the {@link Map}.
@@ -3950,7 +4057,7 @@ class Q extends Map {
3950
4057
  */
3951
4058
  delete(e) {
3952
4059
  const t = this.get(e);
3953
- return t === void 0 ? !1 : (super.delete(e), this._publisher.publish("entry:remove", e, t), !0);
4060
+ return t === void 0 ? !1 : (super.delete(e), this._publisher.publish("remove", e, t), !0);
3954
4061
  }
3955
4062
  /**
3956
4063
  * Removes all entries from the {@link Map}.
@@ -3967,70 +4074,75 @@ class Q extends Map {
3967
4074
  */
3968
4075
  clear() {
3969
4076
  const e = this.size;
3970
- super.clear(), e > 0 && this._publisher.publish("collection:clear");
4077
+ super.clear(), e > 0 && this._publisher.publish("clear");
3971
4078
  }
3972
4079
  /**
3973
- * Subscribes to an event and adds a callback to be executed when the event is published.
4080
+ * Subscribes to the `add` event of the map with a callback that will be executed when an entry is added.
3974
4081
  *
3975
4082
  * ---
3976
4083
  *
3977
4084
  * @example
3978
4085
  * ```ts
3979
- * const map = new MapView<string, number>();
3980
- * const unsubscribe = map.subscribe("entry:add", (key: string, value: number) =>
3981
- * {
3982
- * if (key === "answer") { unsubscribe(); }
3983
- * console.log(`Added ${key}: ${value}`);
3984
- * });
4086
+ * map.onAdd((key, value) => console.log(`Added ${key}: ${value}`));
3985
4087
  *
3986
4088
  * map.set("key1", 2); // "Added key1: 2"
3987
4089
  * map.set("answer", 42); // "Added answer: 42"
3988
- * map.set("key2", 4);
3989
- * map.set("key3", 8);
3990
4090
  * ```
3991
4091
  *
3992
4092
  * ---
3993
4093
  *
3994
- * @template T The key of the map containing the callback signature to subscribe.
4094
+ * @param callback The callback that will be executed when an entry is added to the map.
3995
4095
  *
3996
- * @param event The name of the event to subscribe to.
3997
- * @param subscriber The callback to execute when the event is published.
3998
- *
3999
- * @returns A function that can be used to unsubscribe the callback from the event.
4096
+ * @returns A function that can be used to unsubscribe from the event.
4000
4097
  */
4001
- subscribe(e, t) {
4002
- return this._publisher.subscribe(e, t);
4098
+ onAdd(e) {
4099
+ return this._publisher.subscribe("add", e);
4003
4100
  }
4004
4101
  /**
4005
- * Unsubscribes from an event and removes a callback from being executed when the event is published.
4102
+ * Subscribes to the `remove` event of the map with a callback that will be executed when an entry is removed.
4006
4103
  *
4007
4104
  * ---
4008
4105
  *
4009
4106
  * @example
4010
4107
  * ```ts
4011
- * const callback = (key: string, value: number) => console.log(`Added ${key}: ${value}`);
4012
- * const map = new MapView<string, number>();
4108
+ * map.onRemove((key, value) => console.log(`Removed ${key}: ${value}`));
4013
4109
  *
4014
- * map.subscribe("entry:add", callback);
4015
- * map.set("key1", 2); // "Added key1: 2"
4110
+ * map.delete("key1"); // "Removed key1: 2"
4111
+ * map.delete("answer"); // "Removed answer: 42"
4112
+ * ```
4016
4113
  *
4017
- * map.unsubscribe("entry:add", callback);
4018
- * map.set("key2", 4);
4114
+ * ---
4115
+ *
4116
+ * @param callback The callback that will be executed when an entry is removed from the map.
4117
+ *
4118
+ * @returns A function that can be used to unsubscribe from the event.
4119
+ */
4120
+ onRemove(e) {
4121
+ return this._publisher.subscribe("remove", e);
4122
+ }
4123
+ /**
4124
+ * Subscribes to the `clear` event of the map with a callback that will be executed when the map is cleared.
4125
+ *
4126
+ * ---
4127
+ *
4128
+ * @example
4129
+ * ```ts
4130
+ * map.onClear(() => console.log("The map has all been cleared."));
4131
+ * map.clear(); // "The map has all been cleared."
4019
4132
  * ```
4020
4133
  *
4021
4134
  * ---
4022
4135
  *
4023
- * @template T The key of the map containing the callback signature to unsubscribe.
4136
+ * @param callback The callback that will be executed when the map is cleared.
4024
4137
  *
4025
- * @param event The name of the event to unsubscribe from.
4026
- * @param subscriber The callback to remove from the event.
4138
+ * @returns A function that can be used to unsubscribe from the event.
4027
4139
  */
4028
- unsubscribe(e, t) {
4029
- this._publisher.unsubscribe(e, t);
4140
+ onClear(e) {
4141
+ return this._publisher.subscribe("clear", e);
4030
4142
  }
4031
4143
  [Symbol.toStringTag] = "MapView";
4032
4144
  }
4033
- class H extends Set {
4145
+ class X extends Set {
4034
4146
  /**
4035
4147
  * The internal {@link Publisher} instance used to publish events.
4036
4148
  */
@@ -4077,7 +4189,7 @@ class H extends Set {
4077
4189
  * @returns The current instance of the {@link SetView} class.
4078
4190
  */
4079
4191
  add(e) {
4080
- return super.add(e), this._publisher.publish("entry:add", e), this;
4192
+ return super.add(e), this._publisher.publish("add", e), this;
4081
4193
  }
4082
4194
  /**
4083
4195
  * Removes the specified value from the {@link Set}.
@@ -4101,7 +4213,7 @@ class H extends Set {
4101
4213
  */
4102
4214
  delete(e) {
4103
4215
  const t = super.delete(e);
4104
- return t && this._publisher.publish("entry:remove", e), t;
4216
+ return t && this._publisher.publish("remove", e), t;
4105
4217
  }
4106
4218
  /**
4107
4219
  * Removes all entries from the {@link Set}.
@@ -4118,70 +4230,75 @@ class H extends Set {
4118
4230
  */
4119
4231
  clear() {
4120
4232
  const e = this.size;
4121
- super.clear(), e > 0 && this._publisher.publish("collection:clear");
4233
+ super.clear(), e > 0 && this._publisher.publish("clear");
4122
4234
  }
4123
4235
  /**
4124
- * Subscribes to an event and adds a callback to be executed when the event is published.
4236
+ * Subscribes to the `add` event of the set with a callback that will be executed when a value is added.
4125
4237
  *
4126
4238
  * ---
4127
4239
  *
4128
4240
  * @example
4129
4241
  * ```ts
4130
- * const set = new SetView<number>();
4131
- * const unsubscribe = set.subscribe("entry:add", (value: number) =>
4132
- * {
4133
- * if (value === 42) { unsubscribe(); }
4134
- * console.log(`Added ${value}`);
4135
- * });
4242
+ * set.onAdd((value) => console.log(`Added ${value}`));
4136
4243
  *
4137
4244
  * set.add(2); // "Added 2"
4138
4245
  * set.add(42); // "Added 42"
4139
- * set.add(4);
4140
- * set.add(8);
4141
4246
  * ```
4142
4247
  *
4143
4248
  * ---
4144
4249
  *
4145
- * @template K The key of the map containing the callback signature to subscribe.
4250
+ * @param callback The callback that will be executed when a value is added to the set.
4146
4251
  *
4147
- * @param event The name of the event to subscribe to.
4148
- * @param subscriber The callback to execute when the event is published.
4149
- *
4150
- * @returns A function that can be used to unsubscribe the callback from the event.
4252
+ * @returns A function that can be used to unsubscribe from the event.
4151
4253
  */
4152
- subscribe(e, t) {
4153
- return this._publisher.subscribe(e, t);
4254
+ onAdd(e) {
4255
+ return this._publisher.subscribe("add", e);
4154
4256
  }
4155
4257
  /**
4156
- * Unsubscribes from an event and removes a callback from being executed when the event is published.
4258
+ * Subscribes to the `remove` event of the set with a callback that will be executed when a value is removed.
4157
4259
  *
4158
4260
  * ---
4159
4261
  *
4160
4262
  * @example
4161
4263
  * ```ts
4162
- * const callback = (value: number) => console.log(`Added ${value}`);
4163
- * const set = new SetView<number>();
4264
+ * set.onRemove((value) => console.log(`Removed ${value}`));
4164
4265
  *
4165
- * set.subscribe("entry:add", callback);
4166
- * set.add(2); // "Added 2"
4266
+ * set.delete(2); // "Removed 2"
4267
+ * set.delete(42); // "Removed 42"
4268
+ * ```
4269
+ *
4270
+ * ---
4271
+ *
4272
+ * @param callback The callback that will be executed when a value is removed from the set.
4273
+ *
4274
+ * @returns A function that can be used to unsubscribe from the event.
4275
+ */
4276
+ onRemove(e) {
4277
+ return this._publisher.subscribe("remove", e);
4278
+ }
4279
+ /**
4280
+ * Subscribes to the `clear` event of the set with a callback that will be executed when the set is cleared.
4281
+ *
4282
+ * ---
4167
4283
  *
4168
- * set.unsubscribe("entry:add", callback);
4169
- * set.add(4);
4284
+ * @example
4285
+ * ```ts
4286
+ * set.onClear(() => console.log("The set has all been cleared."));
4287
+ * set.clear(); // "The set has all been cleared."
4170
4288
  * ```
4171
4289
  *
4172
4290
  * ---
4173
4291
  *
4174
- * @template K The key of the map containing the callback signature to unsubscribe.
4292
+ * @param callback The callback that will be executed when the set is cleared.
4175
4293
  *
4176
- * @param event The name of the event to unsubscribe from.
4177
- * @param subscriber The callback to remove from the event.
4294
+ * @returns A function that can be used to unsubscribe from the event.
4178
4295
  */
4179
- unsubscribe(e, t) {
4180
- this._publisher.unsubscribe(e, t);
4296
+ onClear(e) {
4297
+ return this._publisher.subscribe("clear", e);
4181
4298
  }
4182
4299
  [Symbol.toStringTag] = "SetView";
4183
4300
  }
4184
- class X {
4301
+ class Z {
4185
4302
  /**
4186
4303
  * Whether to prefer the {@link localStorage} over the {@link sessionStorage} when calling an ambivalent method.
4187
4304
  *
@@ -4489,7 +4606,7 @@ class X {
4489
4606
  }
4490
4607
  [Symbol.toStringTag] = "JSONStorage";
4491
4608
  }
4492
- class w {
4609
+ class m {
4493
4610
  /**
4494
4611
  * Wraps a new {@link SmartPromise} object around an existing native {@link Promise} object.
4495
4612
  *
@@ -4514,7 +4631,7 @@ class w {
4514
4631
  * @returns A new {@link SmartPromise} object that wraps the provided promise.
4515
4632
  */
4516
4633
  static FromPromise(e) {
4517
- return new w((t, n) => e.then(t, n));
4634
+ return new m((t, n) => e.then(t, n));
4518
4635
  }
4519
4636
  /**
4520
4637
  * A flag indicating whether the promise is still pending or not.
@@ -4622,7 +4739,7 @@ class w {
4622
4739
  }
4623
4740
  [Symbol.toStringTag] = "SmartPromise";
4624
4741
  }
4625
- class M extends w {
4742
+ class R extends m {
4626
4743
  /**
4627
4744
  * The exposed function that allows to resolve the promise.
4628
4745
  *
@@ -4666,8 +4783,8 @@ class M extends w {
4666
4783
  */
4667
4784
  constructor(e, t) {
4668
4785
  let n, s;
4669
- super((i, o) => {
4670
- n = i, s = o;
4786
+ super((r, o) => {
4787
+ n = r, s = o;
4671
4788
  }), this._promise = this._promise.then(e, t), this._resolve = n, this._reject = s;
4672
4789
  }
4673
4790
  /**
@@ -4695,7 +4812,7 @@ class M extends w {
4695
4812
  }
4696
4813
  [Symbol.toStringTag] = "DeferredPromise";
4697
4814
  }
4698
- class $ extends w {
4815
+ class z extends m {
4699
4816
  /**
4700
4817
  * Initializes a new instance of the {@link TimedPromise} class.
4701
4818
  *
@@ -4720,17 +4837,17 @@ class $ extends w {
4720
4837
  */
4721
4838
  constructor(e, t) {
4722
4839
  super((n, s) => {
4723
- const i = (v) => {
4840
+ const r = (v) => {
4724
4841
  clearTimeout(y), n(v);
4725
4842
  }, o = (v) => {
4726
4843
  clearTimeout(y), s(v);
4727
- }, y = setTimeout(() => o(new C("The operation has timed out.")), t);
4728
- e(i, o);
4844
+ }, y = setTimeout(() => o(new O("The operation has timed out.")), t);
4845
+ e(r, o);
4729
4846
  });
4730
4847
  }
4731
4848
  [Symbol.toStringTag] = "TimedPromise";
4732
4849
  }
4733
- class Z extends w {
4850
+ class W extends m {
4734
4851
  /**
4735
4852
  * The number of promises currently in the queue.
4736
4853
  */
@@ -4763,37 +4880,37 @@ class Z extends w {
4763
4880
  super((e) => e()), this._count = 0, this._isPending = !1, this._isFulfilled = !1, this._isRejected = !1;
4764
4881
  }
4765
4882
  enqueue(e, t) {
4766
- if (this._count += 1, e instanceof M) {
4883
+ if (this._count += 1, e instanceof R) {
4767
4884
  const s = e;
4768
4885
  e = () => (s.resolve(), s);
4769
4886
  }
4770
- const n = (s, i) => {
4887
+ const n = (s, r) => {
4771
4888
  this._promise = this._promise.then(e).then((o) => {
4772
4889
  this._count -= 1, s(o);
4773
4890
  }).catch((o) => {
4774
- this._count -= 1, i(o);
4891
+ this._count -= 1, r(o);
4775
4892
  });
4776
4893
  };
4777
- return t ? new $(n, t) : new w(n);
4894
+ return t ? new z(n, t) : new m(n);
4778
4895
  }
4779
4896
  [Symbol.toStringTag] = "PromiseQueue";
4780
4897
  }
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) {
4898
+ var S = /* @__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))(S || {}), $ = /* @__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))($ || {});
4899
+ function U(i, e, t = 864e5) {
4783
4900
  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);
4901
+ return i = new Date(i), e = new Date(e), i < e ? n = Math.floor : n = Math.ceil, n((e.getTime() - i.getTime()) / t);
4785
4902
  }
4786
- function U(r, e, t = 864e5) {
4787
- if (r = new Date(r), e = new Date(e), r >= e)
4903
+ function ee(i, e, t = 864e5) {
4904
+ if (i = new Date(i), e = new Date(e), i >= e)
4788
4905
  throw new b("The end date must be greater than the start date.");
4789
4906
  return new l(function* () {
4790
4907
  const n = e.getTime();
4791
- let s = r.getTime();
4908
+ let s = i.getTime();
4792
4909
  for (; s < n; )
4793
4910
  yield new Date(s), s += t;
4794
4911
  });
4795
4912
  }
4796
- function I(r, e = 864e5) {
4913
+ function I(i, e = 864e5) {
4797
4914
  if (e <= 1)
4798
4915
  throw new b(
4799
4916
  "Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
@@ -4802,11 +4919,11 @@ function I(r, e = 864e5) {
4802
4919
  throw new b(
4803
4920
  "Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years."
4804
4921
  );
4805
- return r = new Date(r), new Date(Math.floor(r.getTime() / e) * e);
4922
+ return i = new Date(i), new Date(Math.floor(i.getTime() / e) * e);
4806
4923
  }
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;
4924
+ function te(i, e = 0) {
4925
+ i = new Date(i);
4926
+ const t = 7 - e, n = (i.getUTCDay() + t) % 7, s = i.getTime() - 864e5 * n;
4810
4927
  return I(new Date(s));
4811
4928
  }
4812
4929
  class F {
@@ -4914,7 +5031,7 @@ class F {
4914
5031
  */
4915
5032
  start(e = 0) {
4916
5033
  if (this._isRunning)
4917
- throw new p("The game loop has already been started.");
5034
+ throw new _("The game loop has already been started.");
4918
5035
  this._startTime = performance.now() - e, this._start(), this._isRunning = !0, this._publisher.publish("start");
4919
5036
  }
4920
5037
  /**
@@ -4932,7 +5049,7 @@ class F {
4932
5049
  */
4933
5050
  stop() {
4934
5051
  if (!this._isRunning)
4935
- throw new p("The game loop had already stopped or hadn't yet started.");
5052
+ throw new _("The game loop had already stopped or hadn't yet started.");
4936
5053
  if (!this._handle)
4937
5054
  throw new x();
4938
5055
  this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
@@ -4977,7 +5094,7 @@ class F {
4977
5094
  }
4978
5095
  [Symbol.toStringTag] = "GameLoop";
4979
5096
  }
4980
- class te extends F {
5097
+ class ne extends F {
4981
5098
  /**
4982
5099
  * Initializes a new instance of the {@link Clock} class.
4983
5100
  *
@@ -4994,7 +5111,7 @@ class te extends F {
4994
5111
  * The interval in milliseconds at which the clock will tick if the environment is not a browser.
4995
5112
  * `TimeUnit.Second` by default.
4996
5113
  */
4997
- constructor(e = k.Second) {
5114
+ constructor(e = S.Second) {
4998
5115
  super((t) => this._publisher.publish("tick", t), e);
4999
5116
  }
5000
5117
  /**
@@ -5016,7 +5133,7 @@ class te extends F {
5016
5133
  */
5017
5134
  start(e = 0) {
5018
5135
  if (this._isRunning)
5019
- throw new p("The clock has already been started.");
5136
+ throw new _("The clock has already been started.");
5020
5137
  this._startTime = performance.now() - e, this._start(), this._isRunning = !0, this._publisher.publish("start");
5021
5138
  }
5022
5139
  /**
@@ -5034,7 +5151,7 @@ class te extends F {
5034
5151
  */
5035
5152
  stop() {
5036
5153
  if (!this._isRunning)
5037
- throw new p("The clock had already stopped or hadn't yet started.");
5154
+ throw new _("The clock had already stopped or hadn't yet started.");
5038
5155
  if (!this._handle)
5039
5156
  throw new x();
5040
5157
  this._stop(), this._handle = void 0, this._isRunning = !1, this._publisher.publish("stop");
@@ -5075,7 +5192,7 @@ class te extends F {
5075
5192
  }
5076
5193
  [Symbol.toStringTag] = "Clock";
5077
5194
  }
5078
- class ne extends F {
5195
+ class se extends F {
5079
5196
  /**
5080
5197
  * The total duration of the countdown in milliseconds.
5081
5198
  *
@@ -5119,7 +5236,7 @@ class ne extends F {
5119
5236
  * The interval in milliseconds at which the countdown will tick if the environment is not a browser.
5120
5237
  * `TimeUnit.Second` by default.
5121
5238
  */
5122
- constructor(e, t = k.Second) {
5239
+ constructor(e, t = S.Second) {
5123
5240
  const n = () => {
5124
5241
  const s = this.remainingTime;
5125
5242
  s <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", s);
@@ -5140,7 +5257,7 @@ class ne extends F {
5140
5257
  */
5141
5258
  _deferrerStop(e) {
5142
5259
  if (!this._isRunning)
5143
- throw new p("The countdown hadn't yet started.");
5260
+ throw new _("The countdown hadn't yet started.");
5144
5261
  if (!this._deferrer)
5145
5262
  throw new x();
5146
5263
  this._stop(), this._handle = void 0, this._isRunning = !1, e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
@@ -5168,10 +5285,10 @@ class ne extends F {
5168
5285
  */
5169
5286
  start(e = this.duration) {
5170
5287
  if (this._isRunning)
5171
- throw new p("The countdown had already stopped or hadn't yet started.");
5288
+ throw new _("The countdown had already stopped or hadn't yet started.");
5172
5289
  if (this._deferrer)
5173
5290
  throw new x();
5174
- return this._deferrer = new M(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
5291
+ return this._deferrer = new R(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
5175
5292
  }
5176
5293
  /**
5177
5294
  * Stops the execution of the countdown.
@@ -5197,26 +5314,6 @@ class ne extends F {
5197
5314
  stop(e) {
5198
5315
  this._deferrerStop(e), this._publisher.publish("stop", e);
5199
5316
  }
5200
- /**
5201
- * Subscribes to the `expire` event of the countdown.
5202
- *
5203
- * ---
5204
- *
5205
- * @example
5206
- * ```ts
5207
- * countdown.onExpire(() => { [...] }); // This callback will be executed once the countdown has expired.
5208
- * countdown.start();
5209
- * ```
5210
- *
5211
- * ---
5212
- *
5213
- * @param callback The callback that will be executed when the countdown expires.
5214
- *
5215
- * @returns A function that can be used to unsubscribe from the event.
5216
- */
5217
- onExpire(e) {
5218
- return this._publisher.subscribe("expire", e);
5219
- }
5220
5317
  /**
5221
5318
  * Subscribes to the `tick` event of the countdown.
5222
5319
  *
@@ -5251,9 +5348,29 @@ class ne extends F {
5251
5348
  n - s < t || (e(s), n = s);
5252
5349
  });
5253
5350
  }
5351
+ /**
5352
+ * Subscribes to the `expire` event of the countdown.
5353
+ *
5354
+ * ---
5355
+ *
5356
+ * @example
5357
+ * ```ts
5358
+ * countdown.onExpire(() => { [...] }); // This callback will be executed once the countdown has expired.
5359
+ * countdown.start();
5360
+ * ```
5361
+ *
5362
+ * ---
5363
+ *
5364
+ * @param callback The callback that will be executed when the countdown expires.
5365
+ *
5366
+ * @returns A function that can be used to unsubscribe from the event.
5367
+ */
5368
+ onExpire(e) {
5369
+ return this._publisher.subscribe("expire", e);
5370
+ }
5254
5371
  [Symbol.toStringTag] = "Countdown";
5255
5372
  }
5256
- class se {
5373
+ class re {
5257
5374
  /**
5258
5375
  * Generates a given number of values following a linear curve.
5259
5376
  * The values are equally spaced and normalized between 0 and 1.
@@ -5322,7 +5439,7 @@ class se {
5322
5439
  }
5323
5440
  [Symbol.toStringTag] = "Curve";
5324
5441
  }
5325
- class R {
5442
+ class C {
5326
5443
  /**
5327
5444
  * Generates a random boolean value.
5328
5445
  *
@@ -5388,102 +5505,102 @@ class R {
5388
5505
  * @returns A random element from the given array.
5389
5506
  */
5390
5507
  static Choice(e) {
5391
- return e[R.Index(e)];
5508
+ return e[C.Index(e)];
5392
5509
  }
5393
5510
  constructor() {
5394
5511
  }
5395
5512
  [Symbol.toStringTag] = "Random";
5396
5513
  }
5397
- function ie(r) {
5398
- return new w((e) => setTimeout(e, r));
5399
- }
5400
- function re() {
5401
- return new w((r) => requestAnimationFrame(() => r()));
5514
+ function ie(i) {
5515
+ return new m((e) => setTimeout(e, i));
5402
5516
  }
5403
5517
  function oe() {
5404
- return new w((r) => setTimeout(r));
5518
+ return new m((i) => requestAnimationFrame(() => i()));
5519
+ }
5520
+ function ae() {
5521
+ return new m((i) => setTimeout(i));
5405
5522
  }
5406
- function ae(r, e = "text/javascript") {
5407
- return new w((t, n) => {
5523
+ function le(i, e = "text/javascript") {
5524
+ return new m((t, n) => {
5408
5525
  const s = document.createElement("script");
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);
5526
+ s.async = !0, s.defer = !0, s.src = i, s.type = e, s.onload = (r) => t(), s.onerror = (r) => n(r), document.body.appendChild(s);
5410
5527
  });
5411
5528
  }
5412
- function le(...r) {
5529
+ function ue(...i) {
5413
5530
  return new l(function* () {
5414
- for (const e of r)
5531
+ for (const e of i)
5415
5532
  for (const t of e)
5416
5533
  yield t;
5417
5534
  });
5418
5535
  }
5419
- function ue(r) {
5420
- if (r instanceof Array)
5421
- return r.length;
5536
+ function ce(i) {
5537
+ if (i instanceof Array)
5538
+ return i.length;
5422
5539
  let e = 0;
5423
- for (const t of r)
5540
+ for (const t of i)
5424
5541
  e += 1;
5425
5542
  return e;
5426
5543
  }
5427
- function ce(r) {
5544
+ function he(i) {
5428
5545
  return new l(function* () {
5429
5546
  let e = 0;
5430
- for (const t of r)
5547
+ for (const t of i)
5431
5548
  yield [e, t], e += 1;
5432
5549
  });
5433
5550
  }
5434
- function he(r, e, t = 1) {
5551
+ function fe(i, e, t = 1) {
5435
5552
  if (t <= 0)
5436
5553
  throw new b(
5437
5554
  "Step must be always a positive number, even when generating numbers in reverse order."
5438
5555
  );
5439
- return e === void 0 && (e = r, r = 0), r > e ? new l(function* () {
5440
- for (let n = r; n > e; n -= t)
5556
+ return e === void 0 && (e = i, i = 0), i > e ? new l(function* () {
5557
+ for (let n = i; n > e; n -= t)
5441
5558
  yield n;
5442
5559
  }) : new l(function* () {
5443
- for (let n = r; n < e; n += t)
5560
+ for (let n = i; n < e; n += t)
5444
5561
  yield n;
5445
5562
  });
5446
5563
  }
5447
- function fe(r) {
5448
- const e = Array.from(r);
5564
+ function de(i) {
5565
+ const e = Array.from(i);
5449
5566
  for (let t = e.length - 1; t > 0; t -= 1) {
5450
5567
  const n = Math.floor(Math.random() * (t + 1));
5451
5568
  [e[t], e[n]] = [e[n], e[t]];
5452
5569
  }
5453
5570
  return e;
5454
5571
  }
5455
- function de(r) {
5572
+ function me(i) {
5456
5573
  return new l(function* () {
5457
5574
  const e = /* @__PURE__ */ new Set();
5458
- for (const t of r)
5575
+ for (const t of i)
5459
5576
  e.has(t) || (e.add(t), yield t);
5460
5577
  });
5461
5578
  }
5462
- function D(r, e) {
5463
- const t = r[Symbol.iterator](), n = e[Symbol.iterator]();
5579
+ function A(i, e) {
5580
+ const t = i[Symbol.iterator](), n = e[Symbol.iterator]();
5464
5581
  return new l(function* () {
5465
5582
  for (; ; ) {
5466
- const s = t.next(), i = n.next();
5467
- if (s.done || i.done)
5583
+ const s = t.next(), r = n.next();
5584
+ if (s.done || r.done)
5468
5585
  break;
5469
- yield [s.value, i.value];
5586
+ yield [s.value, r.value];
5470
5587
  }
5471
5588
  });
5472
5589
  }
5473
- function we(r, e) {
5590
+ function we(i, e) {
5474
5591
  if (e === void 0) {
5475
- let i = 0, o = 0;
5476
- for (const a of r)
5477
- i += a, o += 1;
5592
+ let r = 0, o = 0;
5593
+ for (const a of i)
5594
+ r += a, o += 1;
5478
5595
  if (o === 0)
5479
5596
  throw new f("You must provide at least one value.");
5480
- return i / o;
5597
+ return r / o;
5481
5598
  }
5482
5599
  let t = 0, n = 0, s = 0;
5483
- for (const [i, o] of D(r, e)) {
5600
+ for (const [r, o] of A(i, e)) {
5484
5601
  if (o <= 0)
5485
5602
  throw new f(`The weight for the value #${s} must be greater than zero.`);
5486
- t += i * o, n += o, s += 1;
5603
+ t += r * o, n += o, s += 1;
5487
5604
  }
5488
5605
  if (s === 0)
5489
5606
  throw new f("You must provide at least one value and weight.");
@@ -5491,32 +5608,33 @@ function we(r, e) {
5491
5608
  throw new f("The sum of weights must be greater than zero.");
5492
5609
  return t / n;
5493
5610
  }
5494
- function me(r) {
5611
+ function _e(i) {
5495
5612
  let e = 0;
5496
- for (let t = 0; t < r.length; t += 1) {
5497
- const n = r.charCodeAt(t);
5613
+ for (let t = 0; t < i.length; t += 1) {
5614
+ const n = i.charCodeAt(t);
5498
5615
  e = (e << 5) - e + n, e |= 0;
5499
5616
  }
5500
5617
  return e;
5501
5618
  }
5502
- function pe(r) {
5619
+ function pe(i) {
5503
5620
  let e = 0;
5504
- for (const t of r)
5621
+ for (const t of i)
5505
5622
  e += t;
5506
5623
  return e;
5507
5624
  }
5508
- function _e(r) {
5509
- return `${r.charAt(0).toUpperCase()}${r.slice(1)}`;
5625
+ function ye(i) {
5626
+ return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
5510
5627
  }
5511
- const ye = "2.1.8";
5628
+ const be = "2.2.1";
5512
5629
  export {
5513
- m as AggregatedAsyncIterator,
5630
+ w as AggregatedAsyncIterator,
5514
5631
  h as AggregatedIterator,
5515
- O as CallableObject,
5516
- te as Clock,
5517
- ne as Countdown,
5518
- se as Curve,
5519
- M as DeferredPromise,
5632
+ M as CallableObject,
5633
+ K as CallbackChain,
5634
+ ne as Clock,
5635
+ se as Countdown,
5636
+ re as Curve,
5637
+ R as DeferredPromise,
5520
5638
  j as EnvironmentException,
5521
5639
  c as Exception,
5522
5640
  x as FatalErrorException,
@@ -5524,52 +5642,52 @@ export {
5524
5642
  J as FileExistsException,
5525
5643
  Y as FileNotFoundException,
5526
5644
  F as GameLoop,
5527
- X as JSONStorage,
5528
- _ as KeyException,
5529
- Q as MapView,
5645
+ Z as JSONStorage,
5646
+ p as KeyException,
5647
+ H as MapView,
5530
5648
  L as NetworkException,
5531
5649
  P as NotImplementedException,
5532
5650
  V as PermissionException,
5533
- Z as PromiseQueue,
5651
+ W as PromiseQueue,
5534
5652
  g as Publisher,
5535
- R as Random,
5653
+ C as Random,
5536
5654
  b as RangeException,
5537
5655
  u as ReducedIterator,
5538
- S as ReferenceException,
5539
- p as RuntimeException,
5540
- H as SetView,
5656
+ k as ReferenceException,
5657
+ _ as RuntimeException,
5658
+ X as SetView,
5541
5659
  d as SmartAsyncIterator,
5542
5660
  l as SmartIterator,
5543
- w as SmartPromise,
5544
- K as SwitchableCallback,
5545
- k as TimeUnit,
5546
- $ as TimedPromise,
5547
- C as TimeoutException,
5661
+ m as SmartPromise,
5662
+ Q as SwitchableCallback,
5663
+ S as TimeUnit,
5664
+ z as TimedPromise,
5665
+ O as TimeoutException,
5548
5666
  G as TypeException,
5549
- ye as VERSION,
5667
+ be as VERSION,
5550
5668
  f as ValueException,
5551
- z as WeekDay,
5669
+ $ as WeekDay,
5552
5670
  we as average,
5553
- _e as capitalize,
5554
- le as chain,
5555
- ue as count,
5556
- W as dateDifference,
5557
- U as dateRange,
5671
+ ye as capitalize,
5672
+ ue as chain,
5673
+ ce as count,
5674
+ U as dateDifference,
5675
+ ee as dateRange,
5558
5676
  I as dateRound,
5559
5677
  ie as delay,
5560
- ce as enumerate,
5561
- ee as getWeek,
5562
- me as hash,
5678
+ he as enumerate,
5679
+ te as getWeek,
5680
+ _e as hash,
5563
5681
  T as isBrowser,
5564
- A as isNode,
5682
+ D as isNode,
5565
5683
  B as isWorker,
5566
- ae as loadScript,
5567
- re as nextAnimationFrame,
5568
- he as range,
5569
- fe as shuffle,
5684
+ le as loadScript,
5685
+ oe as nextAnimationFrame,
5686
+ fe as range,
5687
+ de as shuffle,
5570
5688
  pe as sum,
5571
- de as unique,
5572
- oe as yieldToEventLoop,
5573
- D as zip
5689
+ me as unique,
5690
+ ae as yieldToEventLoop,
5691
+ A as zip
5574
5692
  };
5575
5693
  //# sourceMappingURL=core.esm.js.map