@byloth/core 2.1.8 → 2.2.0
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.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +275 -265
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +2 -2
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -3
- package/src/models/collections/map-view.ts +49 -39
- package/src/models/collections/set-view.ts +49 -37
- package/src/models/collections/types.ts +60 -89
- package/src/models/timers/clock.ts +3 -3
- package/src/models/timers/countdown.ts +22 -25
- package/src/models/timers/game-loop.ts +2 -2
- package/src/models/types.ts +1 -1
package/dist/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const T = typeof window < "u" && typeof window.document < "u",
|
|
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.
|
|
@@ -78,7 +78,7 @@ class x extends c {
|
|
|
78
78
|
}
|
|
79
79
|
[Symbol.toStringTag] = "FatalErrorException";
|
|
80
80
|
}
|
|
81
|
-
class
|
|
81
|
+
class C extends x {
|
|
82
82
|
/**
|
|
83
83
|
* Initializes a new instance of the {@link NotImplementedException} class.
|
|
84
84
|
*
|
|
@@ -276,7 +276,7 @@ class p extends c {
|
|
|
276
276
|
}
|
|
277
277
|
[Symbol.toStringTag] = "RuntimeException";
|
|
278
278
|
}
|
|
279
|
-
class
|
|
279
|
+
class P extends p {
|
|
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
|
|
301
|
+
class j 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
|
|
536
|
-
if (
|
|
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 =
|
|
538
|
+
s = r.value, n += 1;
|
|
539
539
|
}
|
|
540
540
|
for (; ; ) {
|
|
541
|
-
const
|
|
542
|
-
if (
|
|
541
|
+
const r = this._iterator.next();
|
|
542
|
+
if (r.done)
|
|
543
543
|
return s;
|
|
544
|
-
s = e(s,
|
|
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
|
|
587
|
-
if (
|
|
588
|
-
for (const o of
|
|
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
|
|
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,
|
|
1086
|
-
e(s,
|
|
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,
|
|
1126
|
-
yield [s, e(s,
|
|
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
|
|
1133
|
-
if (
|
|
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 =
|
|
1135
|
+
s = r.value[1], n += 1;
|
|
1136
1136
|
}
|
|
1137
|
-
for (const [
|
|
1138
|
-
s = e(
|
|
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,
|
|
1178
|
-
const o = e(s,
|
|
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,
|
|
1224
|
-
n >= e && (yield [s,
|
|
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,
|
|
1265
|
+
for (const [n, [s, r]] of t) {
|
|
1266
1266
|
if (n >= e)
|
|
1267
1267
|
break;
|
|
1268
|
-
yield [s,
|
|
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,
|
|
1432
|
-
yield [e(s,
|
|
1431
|
+
for (const [n, [s, r]] of t)
|
|
1432
|
+
yield [e(s, r, n), r];
|
|
1433
1433
|
});
|
|
1434
1434
|
}
|
|
1435
1435
|
/**
|
|
@@ -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 [
|
|
1651
|
-
o && t.set(n, [
|
|
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,
|
|
1655
|
-
yield [n,
|
|
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 [
|
|
1693
|
-
o || t.set(n, [
|
|
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,
|
|
1697
|
-
yield [n,
|
|
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
1702
|
return new m(async function* () {
|
|
1703
1703
|
const n = /* @__PURE__ */ new Map();
|
|
1704
|
-
for await (const [s,
|
|
1704
|
+
for await (const [s, r] of t) {
|
|
1705
1705
|
const o = n.get(s) ?? 0;
|
|
1706
|
-
await e(s,
|
|
1706
|
+
await e(s, r, o) && (yield [s, r]), n.set(s, o + 1);
|
|
1707
1707
|
}
|
|
1708
1708
|
});
|
|
1709
1709
|
}
|
|
@@ -1743,28 +1743,28 @@ class m {
|
|
|
1743
1743
|
const t = this._elements;
|
|
1744
1744
|
return new m(async function* () {
|
|
1745
1745
|
const n = /* @__PURE__ */ new Map();
|
|
1746
|
-
for await (const [s,
|
|
1746
|
+
for await (const [s, r] of t) {
|
|
1747
1747
|
const o = n.get(s) ?? 0;
|
|
1748
|
-
yield [s, await e(s,
|
|
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,
|
|
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,
|
|
1761
|
+
n.set(s, [0, r]);
|
|
1762
1762
|
continue;
|
|
1763
1763
|
}
|
|
1764
|
-
n.set(s, [o + 1, await e(s, a,
|
|
1764
|
+
n.set(s, [o + 1, await e(s, a, r, o)]);
|
|
1765
1765
|
}
|
|
1766
1766
|
return new u(function* () {
|
|
1767
|
-
for (const [s, [
|
|
1767
|
+
for (const [s, [r, o]] of n)
|
|
1768
1768
|
yield [s, o];
|
|
1769
1769
|
});
|
|
1770
1770
|
}
|
|
@@ -1808,8 +1808,8 @@ class m {
|
|
|
1808
1808
|
const t = this._elements;
|
|
1809
1809
|
return new m(async function* () {
|
|
1810
1810
|
const n = /* @__PURE__ */ new Map();
|
|
1811
|
-
for await (const [s,
|
|
1812
|
-
const o = n.get(s) ?? 0, a = await e(s,
|
|
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];
|
|
@@ -1852,13 +1852,13 @@ class m {
|
|
|
1852
1852
|
const t = this._elements;
|
|
1853
1853
|
return new m(async function* () {
|
|
1854
1854
|
const n = /* @__PURE__ */ new Map();
|
|
1855
|
-
for await (const [s,
|
|
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,
|
|
1861
|
+
yield [s, r];
|
|
1862
1862
|
}
|
|
1863
1863
|
});
|
|
1864
1864
|
}
|
|
@@ -1895,21 +1895,21 @@ class m {
|
|
|
1895
1895
|
const t = this._elements;
|
|
1896
1896
|
return new m(async function* () {
|
|
1897
1897
|
const n = /* @__PURE__ */ new Map();
|
|
1898
|
-
for await (const [s,
|
|
1898
|
+
for await (const [s, r] of t) {
|
|
1899
1899
|
const o = n.get(s) ?? 0;
|
|
1900
|
-
o >= e || (yield [s,
|
|
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 [
|
|
1908
|
-
o === void 0 && (await e(n, s,
|
|
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,
|
|
1912
|
-
yield [n,
|
|
1911
|
+
for (const [n, [s, r]] of t)
|
|
1912
|
+
yield [n, r];
|
|
1913
1913
|
});
|
|
1914
1914
|
}
|
|
1915
1915
|
/**
|
|
@@ -1972,8 +1972,8 @@ class m {
|
|
|
1972
1972
|
return new m(async function* () {
|
|
1973
1973
|
const t = /* @__PURE__ */ new Map();
|
|
1974
1974
|
for await (const [n, s] of e) {
|
|
1975
|
-
const
|
|
1976
|
-
|
|
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
|
|
2043
|
-
await e(n, s,
|
|
2042
|
+
const r = t.get(n) ?? 0;
|
|
2043
|
+
await e(n, s, r), t.set(n, r + 1);
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
2046
|
/**
|
|
@@ -2078,9 +2078,9 @@ class m {
|
|
|
2078
2078
|
const t = this._elements;
|
|
2079
2079
|
return new m(async function* () {
|
|
2080
2080
|
const n = /* @__PURE__ */ new Map();
|
|
2081
|
-
for await (const [s,
|
|
2081
|
+
for await (const [s, r] of t) {
|
|
2082
2082
|
const o = n.get(s) ?? 0;
|
|
2083
|
-
yield [await e(s,
|
|
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
|
|
2447
|
-
if (
|
|
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 =
|
|
2449
|
+
s = r.value, n += 1;
|
|
2450
2450
|
}
|
|
2451
2451
|
for (; ; ) {
|
|
2452
|
-
const
|
|
2453
|
-
if (
|
|
2452
|
+
const r = await this._iterator.next();
|
|
2453
|
+
if (r.done)
|
|
2454
2454
|
return s;
|
|
2455
|
-
s = await e(s,
|
|
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
|
|
2498
|
-
if (
|
|
2499
|
-
for (const o of
|
|
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
|
|
2502
|
+
yield r;
|
|
2503
2503
|
n += 1;
|
|
2504
2504
|
}
|
|
2505
2505
|
});
|
|
@@ -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 [
|
|
2960
|
-
o && t.set(n, [
|
|
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,
|
|
2964
|
-
yield [n,
|
|
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 [
|
|
3001
|
-
o || t.set(n, [
|
|
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,
|
|
3005
|
-
yield [n,
|
|
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,
|
|
3012
|
+
for (const [s, r] of t) {
|
|
3013
3013
|
const o = n.get(s) ?? 0;
|
|
3014
|
-
e(s,
|
|
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,
|
|
3054
|
+
for (const [s, r] of t) {
|
|
3055
3055
|
const o = n.get(s) ?? 0;
|
|
3056
|
-
yield [s, e(s,
|
|
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,
|
|
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,
|
|
3069
|
+
n.set(s, [0, r]);
|
|
3070
3070
|
continue;
|
|
3071
3071
|
}
|
|
3072
|
-
n.set(s, [o + 1, e(s, a,
|
|
3072
|
+
n.set(s, [o + 1, e(s, a, r, o)]);
|
|
3073
3073
|
}
|
|
3074
3074
|
return new u(function* () {
|
|
3075
|
-
for (const [s, [
|
|
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,
|
|
3120
|
-
const o = n.get(s) ?? 0, a = e(s,
|
|
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,
|
|
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,
|
|
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,
|
|
3206
|
+
for (const [s, r] of t) {
|
|
3207
3207
|
const o = n.get(s) ?? 0;
|
|
3208
|
-
o >= e || (yield [s,
|
|
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 [
|
|
3216
|
-
o === void 0 && (e(n, s,
|
|
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,
|
|
3220
|
-
yield [n,
|
|
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
|
|
3284
|
-
|
|
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
|
|
3348
|
-
e(n, s,
|
|
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,
|
|
3386
|
+
for (const [s, r] of t) {
|
|
3387
3387
|
const o = n.get(s) ?? 0;
|
|
3388
|
-
yield [e(s,
|
|
3388
|
+
yield [e(s, r, o), r], n.set(s, o + 1);
|
|
3389
3389
|
}
|
|
3390
3390
|
});
|
|
3391
3391
|
}
|
|
@@ -3643,7 +3643,7 @@ class g {
|
|
|
3643
3643
|
}
|
|
3644
3644
|
publish(e, ...t) {
|
|
3645
3645
|
let n, s = this._subscribers.get(e);
|
|
3646
|
-
return s ? n = s.slice().map((
|
|
3646
|
+
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
3647
|
}
|
|
3648
3648
|
subscribe(e, t) {
|
|
3649
3649
|
const n = this._subscribers.get(e) ?? [];
|
|
@@ -3741,7 +3741,7 @@ class K extends O {
|
|
|
3741
3741
|
_invoke;
|
|
3742
3742
|
constructor(e, t = "default") {
|
|
3743
3743
|
super(), this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = (() => {
|
|
3744
|
-
throw new
|
|
3744
|
+
throw new C(
|
|
3745
3745
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3746
3746
|
);
|
|
3747
3747
|
})), this._key = t, this._callback = e, this._invoke = (...n) => this._callback(...n);
|
|
@@ -3926,7 +3926,7 @@ class Q extends Map {
|
|
|
3926
3926
|
* @returns The current instance of the {@link MapView} class.
|
|
3927
3927
|
*/
|
|
3928
3928
|
set(e, t) {
|
|
3929
|
-
return super.set(e, t), this._publisher.publish("
|
|
3929
|
+
return super.set(e, t), this._publisher.publish("add", e, t), this;
|
|
3930
3930
|
}
|
|
3931
3931
|
/**
|
|
3932
3932
|
* Removes an entry with a specified key from the {@link Map}.
|
|
@@ -3950,7 +3950,7 @@ class Q extends Map {
|
|
|
3950
3950
|
*/
|
|
3951
3951
|
delete(e) {
|
|
3952
3952
|
const t = this.get(e);
|
|
3953
|
-
return t === void 0 ? !1 : (super.delete(e), this._publisher.publish("
|
|
3953
|
+
return t === void 0 ? !1 : (super.delete(e), this._publisher.publish("remove", e, t), !0);
|
|
3954
3954
|
}
|
|
3955
3955
|
/**
|
|
3956
3956
|
* Removes all entries from the {@link Map}.
|
|
@@ -3967,66 +3967,71 @@ class Q extends Map {
|
|
|
3967
3967
|
*/
|
|
3968
3968
|
clear() {
|
|
3969
3969
|
const e = this.size;
|
|
3970
|
-
super.clear(), e > 0 && this._publisher.publish("
|
|
3970
|
+
super.clear(), e > 0 && this._publisher.publish("clear");
|
|
3971
3971
|
}
|
|
3972
3972
|
/**
|
|
3973
|
-
* Subscribes to
|
|
3973
|
+
* Subscribes to the `add` event of the map with a callback that will be executed when an entry is added.
|
|
3974
3974
|
*
|
|
3975
3975
|
* ---
|
|
3976
3976
|
*
|
|
3977
3977
|
* @example
|
|
3978
3978
|
* ```ts
|
|
3979
|
-
*
|
|
3980
|
-
* const unsubscribe = map.subscribe("entry:add", (key: string, value: number) =>
|
|
3981
|
-
* {
|
|
3982
|
-
* if (key === "answer") { unsubscribe(); }
|
|
3983
|
-
* console.log(`Added ${key}: ${value}`);
|
|
3984
|
-
* });
|
|
3979
|
+
* map.onAdd((key, value) => console.log(`Added ${key}: ${value}`));
|
|
3985
3980
|
*
|
|
3986
3981
|
* map.set("key1", 2); // "Added key1: 2"
|
|
3987
3982
|
* map.set("answer", 42); // "Added answer: 42"
|
|
3988
|
-
* map.set("key2", 4);
|
|
3989
|
-
* map.set("key3", 8);
|
|
3990
3983
|
* ```
|
|
3991
3984
|
*
|
|
3992
3985
|
* ---
|
|
3993
3986
|
*
|
|
3994
|
-
* @
|
|
3995
|
-
*
|
|
3996
|
-
* @param event The name of the event to subscribe to.
|
|
3997
|
-
* @param subscriber The callback to execute when the event is published.
|
|
3987
|
+
* @param callback The callback that will be executed when an entry is added to the map.
|
|
3998
3988
|
*
|
|
3999
|
-
* @returns A function that can be used to unsubscribe
|
|
3989
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4000
3990
|
*/
|
|
4001
|
-
|
|
4002
|
-
return this._publisher.subscribe(
|
|
3991
|
+
onAdd(e) {
|
|
3992
|
+
return this._publisher.subscribe("add", e);
|
|
4003
3993
|
}
|
|
4004
3994
|
/**
|
|
4005
|
-
*
|
|
3995
|
+
* Subscribes to the `remove` event of the map with a callback that will be executed when an entry is removed.
|
|
4006
3996
|
*
|
|
4007
3997
|
* ---
|
|
4008
3998
|
*
|
|
4009
3999
|
* @example
|
|
4010
4000
|
* ```ts
|
|
4011
|
-
*
|
|
4012
|
-
* const map = new MapView<string, number>();
|
|
4001
|
+
* map.onRemove((key, value) => console.log(`Removed ${key}: ${value}`));
|
|
4013
4002
|
*
|
|
4014
|
-
* map.
|
|
4015
|
-
* map.
|
|
4003
|
+
* map.delete("key1"); // "Removed key1: 2"
|
|
4004
|
+
* map.delete("answer"); // "Removed answer: 42"
|
|
4005
|
+
* ```
|
|
4006
|
+
*
|
|
4007
|
+
* ---
|
|
4016
4008
|
*
|
|
4017
|
-
* map.
|
|
4018
|
-
*
|
|
4009
|
+
* @param callback The callback that will be executed when an entry is removed from the map.
|
|
4010
|
+
*
|
|
4011
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4012
|
+
*/
|
|
4013
|
+
onRemove(e) {
|
|
4014
|
+
return this._publisher.subscribe("remove", e);
|
|
4015
|
+
}
|
|
4016
|
+
/**
|
|
4017
|
+
* Subscribes to the `clear` event of the map with a callback that will be executed when the map is cleared.
|
|
4018
|
+
*
|
|
4019
|
+
* ---
|
|
4020
|
+
*
|
|
4021
|
+
* @example
|
|
4022
|
+
* ```ts
|
|
4023
|
+
* map.onClear(() => console.log("The map has all been cleared."));
|
|
4024
|
+
* map.clear(); // "The map has all been cleared."
|
|
4019
4025
|
* ```
|
|
4020
4026
|
*
|
|
4021
4027
|
* ---
|
|
4022
4028
|
*
|
|
4023
|
-
* @
|
|
4029
|
+
* @param callback The callback that will be executed when the map is cleared.
|
|
4024
4030
|
*
|
|
4025
|
-
* @
|
|
4026
|
-
* @param subscriber The callback to remove from the event.
|
|
4031
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4027
4032
|
*/
|
|
4028
|
-
|
|
4029
|
-
this._publisher.
|
|
4033
|
+
onClear(e) {
|
|
4034
|
+
return this._publisher.subscribe("clear", e);
|
|
4030
4035
|
}
|
|
4031
4036
|
[Symbol.toStringTag] = "MapView";
|
|
4032
4037
|
}
|
|
@@ -4077,7 +4082,7 @@ class H extends Set {
|
|
|
4077
4082
|
* @returns The current instance of the {@link SetView} class.
|
|
4078
4083
|
*/
|
|
4079
4084
|
add(e) {
|
|
4080
|
-
return super.add(e), this._publisher.publish("
|
|
4085
|
+
return super.add(e), this._publisher.publish("add", e), this;
|
|
4081
4086
|
}
|
|
4082
4087
|
/**
|
|
4083
4088
|
* Removes the specified value from the {@link Set}.
|
|
@@ -4101,7 +4106,7 @@ class H extends Set {
|
|
|
4101
4106
|
*/
|
|
4102
4107
|
delete(e) {
|
|
4103
4108
|
const t = super.delete(e);
|
|
4104
|
-
return t && this._publisher.publish("
|
|
4109
|
+
return t && this._publisher.publish("remove", e), t;
|
|
4105
4110
|
}
|
|
4106
4111
|
/**
|
|
4107
4112
|
* Removes all entries from the {@link Set}.
|
|
@@ -4118,66 +4123,71 @@ class H extends Set {
|
|
|
4118
4123
|
*/
|
|
4119
4124
|
clear() {
|
|
4120
4125
|
const e = this.size;
|
|
4121
|
-
super.clear(), e > 0 && this._publisher.publish("
|
|
4126
|
+
super.clear(), e > 0 && this._publisher.publish("clear");
|
|
4122
4127
|
}
|
|
4123
4128
|
/**
|
|
4124
|
-
* Subscribes to
|
|
4129
|
+
* Subscribes to the `add` event of the set with a callback that will be executed when a value is added.
|
|
4125
4130
|
*
|
|
4126
4131
|
* ---
|
|
4127
4132
|
*
|
|
4128
4133
|
* @example
|
|
4129
4134
|
* ```ts
|
|
4130
|
-
*
|
|
4131
|
-
* const unsubscribe = set.subscribe("entry:add", (value: number) =>
|
|
4132
|
-
* {
|
|
4133
|
-
* if (value === 42) { unsubscribe(); }
|
|
4134
|
-
* console.log(`Added ${value}`);
|
|
4135
|
-
* });
|
|
4135
|
+
* set.onAdd((value) => console.log(`Added ${value}`));
|
|
4136
4136
|
*
|
|
4137
4137
|
* set.add(2); // "Added 2"
|
|
4138
4138
|
* set.add(42); // "Added 42"
|
|
4139
|
-
* set.add(4);
|
|
4140
|
-
* set.add(8);
|
|
4141
4139
|
* ```
|
|
4142
4140
|
*
|
|
4143
4141
|
* ---
|
|
4144
4142
|
*
|
|
4145
|
-
* @
|
|
4146
|
-
*
|
|
4147
|
-
* @param event The name of the event to subscribe to.
|
|
4148
|
-
* @param subscriber The callback to execute when the event is published.
|
|
4143
|
+
* @param callback The callback that will be executed when a value is added to the set.
|
|
4149
4144
|
*
|
|
4150
|
-
* @returns A function that can be used to unsubscribe
|
|
4145
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4151
4146
|
*/
|
|
4152
|
-
|
|
4153
|
-
return this._publisher.subscribe(
|
|
4147
|
+
onAdd(e) {
|
|
4148
|
+
return this._publisher.subscribe("add", e);
|
|
4154
4149
|
}
|
|
4155
4150
|
/**
|
|
4156
|
-
*
|
|
4151
|
+
* Subscribes to the `remove` event of the set with a callback that will be executed when a value is removed.
|
|
4157
4152
|
*
|
|
4158
4153
|
* ---
|
|
4159
4154
|
*
|
|
4160
4155
|
* @example
|
|
4161
4156
|
* ```ts
|
|
4162
|
-
*
|
|
4163
|
-
* const set = new SetView<number>();
|
|
4157
|
+
* set.onRemove((value) => console.log(`Removed ${value}`));
|
|
4164
4158
|
*
|
|
4165
|
-
* set.
|
|
4166
|
-
* set.
|
|
4159
|
+
* set.delete(2); // "Removed 2"
|
|
4160
|
+
* set.delete(42); // "Removed 42"
|
|
4161
|
+
* ```
|
|
4162
|
+
*
|
|
4163
|
+
* ---
|
|
4167
4164
|
*
|
|
4168
|
-
* set.
|
|
4169
|
-
*
|
|
4165
|
+
* @param callback The callback that will be executed when a value is removed from the set.
|
|
4166
|
+
*
|
|
4167
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4168
|
+
*/
|
|
4169
|
+
onRemove(e) {
|
|
4170
|
+
return this._publisher.subscribe("remove", e);
|
|
4171
|
+
}
|
|
4172
|
+
/**
|
|
4173
|
+
* Subscribes to the `clear` event of the set with a callback that will be executed when the set is cleared.
|
|
4174
|
+
*
|
|
4175
|
+
* ---
|
|
4176
|
+
*
|
|
4177
|
+
* @example
|
|
4178
|
+
* ```ts
|
|
4179
|
+
* set.onClear(() => console.log("The set has all been cleared."));
|
|
4180
|
+
* set.clear(); // "The set has all been cleared."
|
|
4170
4181
|
* ```
|
|
4171
4182
|
*
|
|
4172
4183
|
* ---
|
|
4173
4184
|
*
|
|
4174
|
-
* @
|
|
4185
|
+
* @param callback The callback that will be executed when the set is cleared.
|
|
4175
4186
|
*
|
|
4176
|
-
* @
|
|
4177
|
-
* @param subscriber The callback to remove from the event.
|
|
4187
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
4178
4188
|
*/
|
|
4179
|
-
|
|
4180
|
-
this._publisher.
|
|
4189
|
+
onClear(e) {
|
|
4190
|
+
return this._publisher.subscribe("clear", e);
|
|
4181
4191
|
}
|
|
4182
4192
|
[Symbol.toStringTag] = "SetView";
|
|
4183
4193
|
}
|
|
@@ -4216,7 +4226,7 @@ class X {
|
|
|
4216
4226
|
*/
|
|
4217
4227
|
constructor(e = !0) {
|
|
4218
4228
|
if (!T)
|
|
4219
|
-
throw new
|
|
4229
|
+
throw new P(
|
|
4220
4230
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
4221
4231
|
);
|
|
4222
4232
|
this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -4666,8 +4676,8 @@ class M extends w {
|
|
|
4666
4676
|
*/
|
|
4667
4677
|
constructor(e, t) {
|
|
4668
4678
|
let n, s;
|
|
4669
|
-
super((
|
|
4670
|
-
n =
|
|
4679
|
+
super((r, o) => {
|
|
4680
|
+
n = r, s = o;
|
|
4671
4681
|
}), this._promise = this._promise.then(e, t), this._resolve = n, this._reject = s;
|
|
4672
4682
|
}
|
|
4673
4683
|
/**
|
|
@@ -4720,12 +4730,12 @@ class $ extends w {
|
|
|
4720
4730
|
*/
|
|
4721
4731
|
constructor(e, t) {
|
|
4722
4732
|
super((n, s) => {
|
|
4723
|
-
const
|
|
4733
|
+
const r = (v) => {
|
|
4724
4734
|
clearTimeout(y), n(v);
|
|
4725
4735
|
}, o = (v) => {
|
|
4726
4736
|
clearTimeout(y), s(v);
|
|
4727
|
-
}, y = setTimeout(() => o(new
|
|
4728
|
-
e(
|
|
4737
|
+
}, y = setTimeout(() => o(new j("The operation has timed out.")), t);
|
|
4738
|
+
e(r, o);
|
|
4729
4739
|
});
|
|
4730
4740
|
}
|
|
4731
4741
|
[Symbol.toStringTag] = "TimedPromise";
|
|
@@ -4767,33 +4777,33 @@ class Z extends w {
|
|
|
4767
4777
|
const s = e;
|
|
4768
4778
|
e = () => (s.resolve(), s);
|
|
4769
4779
|
}
|
|
4770
|
-
const n = (s,
|
|
4780
|
+
const n = (s, r) => {
|
|
4771
4781
|
this._promise = this._promise.then(e).then((o) => {
|
|
4772
4782
|
this._count -= 1, s(o);
|
|
4773
4783
|
}).catch((o) => {
|
|
4774
|
-
this._count -= 1,
|
|
4784
|
+
this._count -= 1, r(o);
|
|
4775
4785
|
});
|
|
4776
4786
|
};
|
|
4777
4787
|
return t ? new $(n, t) : new w(n);
|
|
4778
4788
|
}
|
|
4779
4789
|
[Symbol.toStringTag] = "PromiseQueue";
|
|
4780
4790
|
}
|
|
4781
|
-
var k = /* @__PURE__ */ ((
|
|
4782
|
-
function W(
|
|
4791
|
+
var k = /* @__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))(k || {}), z = /* @__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))(z || {});
|
|
4792
|
+
function W(i, e, t = 864e5) {
|
|
4783
4793
|
let n;
|
|
4784
|
-
return
|
|
4794
|
+
return i = new Date(i), e = new Date(e), i < e ? n = Math.floor : n = Math.ceil, n((e.getTime() - i.getTime()) / t);
|
|
4785
4795
|
}
|
|
4786
|
-
function U(
|
|
4787
|
-
if (
|
|
4796
|
+
function U(i, e, t = 864e5) {
|
|
4797
|
+
if (i = new Date(i), e = new Date(e), i >= e)
|
|
4788
4798
|
throw new b("The end date must be greater than the start date.");
|
|
4789
4799
|
return new l(function* () {
|
|
4790
4800
|
const n = e.getTime();
|
|
4791
|
-
let s =
|
|
4801
|
+
let s = i.getTime();
|
|
4792
4802
|
for (; s < n; )
|
|
4793
4803
|
yield new Date(s), s += t;
|
|
4794
4804
|
});
|
|
4795
4805
|
}
|
|
4796
|
-
function I(
|
|
4806
|
+
function I(i, e = 864e5) {
|
|
4797
4807
|
if (e <= 1)
|
|
4798
4808
|
throw new b(
|
|
4799
4809
|
"Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
|
|
@@ -4802,14 +4812,14 @@ function I(r, e = 864e5) {
|
|
|
4802
4812
|
throw new b(
|
|
4803
4813
|
"Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years."
|
|
4804
4814
|
);
|
|
4805
|
-
return
|
|
4815
|
+
return i = new Date(i), new Date(Math.floor(i.getTime() / e) * e);
|
|
4806
4816
|
}
|
|
4807
|
-
function ee(
|
|
4808
|
-
|
|
4809
|
-
const t = 7 - e, n = (
|
|
4817
|
+
function ee(i, e = 0) {
|
|
4818
|
+
i = new Date(i);
|
|
4819
|
+
const t = 7 - e, n = (i.getUTCDay() + t) % 7, s = i.getTime() - 864e5 * n;
|
|
4810
4820
|
return I(new Date(s));
|
|
4811
4821
|
}
|
|
4812
|
-
class
|
|
4822
|
+
class R {
|
|
4813
4823
|
/**
|
|
4814
4824
|
* The handle of the interval or the animation frame, depending on the environment.
|
|
4815
4825
|
* It's used to stop the game loop when the {@link GameLoop._stop} method is called.
|
|
@@ -4977,7 +4987,7 @@ class F {
|
|
|
4977
4987
|
}
|
|
4978
4988
|
[Symbol.toStringTag] = "GameLoop";
|
|
4979
4989
|
}
|
|
4980
|
-
class te extends
|
|
4990
|
+
class te extends R {
|
|
4981
4991
|
/**
|
|
4982
4992
|
* Initializes a new instance of the {@link Clock} class.
|
|
4983
4993
|
*
|
|
@@ -5075,7 +5085,7 @@ class te extends F {
|
|
|
5075
5085
|
}
|
|
5076
5086
|
[Symbol.toStringTag] = "Clock";
|
|
5077
5087
|
}
|
|
5078
|
-
class ne extends
|
|
5088
|
+
class ne extends R {
|
|
5079
5089
|
/**
|
|
5080
5090
|
* The total duration of the countdown in milliseconds.
|
|
5081
5091
|
*
|
|
@@ -5197,26 +5207,6 @@ class ne extends F {
|
|
|
5197
5207
|
stop(e) {
|
|
5198
5208
|
this._deferrerStop(e), this._publisher.publish("stop", e);
|
|
5199
5209
|
}
|
|
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
5210
|
/**
|
|
5221
5211
|
* Subscribes to the `tick` event of the countdown.
|
|
5222
5212
|
*
|
|
@@ -5251,6 +5241,26 @@ class ne extends F {
|
|
|
5251
5241
|
n - s < t || (e(s), n = s);
|
|
5252
5242
|
});
|
|
5253
5243
|
}
|
|
5244
|
+
/**
|
|
5245
|
+
* Subscribes to the `expire` event of the countdown.
|
|
5246
|
+
*
|
|
5247
|
+
* ---
|
|
5248
|
+
*
|
|
5249
|
+
* @example
|
|
5250
|
+
* ```ts
|
|
5251
|
+
* countdown.onExpire(() => { [...] }); // This callback will be executed once the countdown has expired.
|
|
5252
|
+
* countdown.start();
|
|
5253
|
+
* ```
|
|
5254
|
+
*
|
|
5255
|
+
* ---
|
|
5256
|
+
*
|
|
5257
|
+
* @param callback The callback that will be executed when the countdown expires.
|
|
5258
|
+
*
|
|
5259
|
+
* @returns A function that can be used to unsubscribe from the event.
|
|
5260
|
+
*/
|
|
5261
|
+
onExpire(e) {
|
|
5262
|
+
return this._publisher.subscribe("expire", e);
|
|
5263
|
+
}
|
|
5254
5264
|
[Symbol.toStringTag] = "Countdown";
|
|
5255
5265
|
}
|
|
5256
5266
|
class se {
|
|
@@ -5322,7 +5332,7 @@ class se {
|
|
|
5322
5332
|
}
|
|
5323
5333
|
[Symbol.toStringTag] = "Curve";
|
|
5324
5334
|
}
|
|
5325
|
-
class
|
|
5335
|
+
class F {
|
|
5326
5336
|
/**
|
|
5327
5337
|
* Generates a random boolean value.
|
|
5328
5338
|
*
|
|
@@ -5388,102 +5398,102 @@ class R {
|
|
|
5388
5398
|
* @returns A random element from the given array.
|
|
5389
5399
|
*/
|
|
5390
5400
|
static Choice(e) {
|
|
5391
|
-
return e[
|
|
5401
|
+
return e[F.Index(e)];
|
|
5392
5402
|
}
|
|
5393
5403
|
constructor() {
|
|
5394
5404
|
}
|
|
5395
5405
|
[Symbol.toStringTag] = "Random";
|
|
5396
5406
|
}
|
|
5397
|
-
function
|
|
5398
|
-
return new w((e) => setTimeout(e,
|
|
5407
|
+
function re(i) {
|
|
5408
|
+
return new w((e) => setTimeout(e, i));
|
|
5399
5409
|
}
|
|
5400
|
-
function
|
|
5401
|
-
return new w((
|
|
5410
|
+
function ie() {
|
|
5411
|
+
return new w((i) => requestAnimationFrame(() => i()));
|
|
5402
5412
|
}
|
|
5403
5413
|
function oe() {
|
|
5404
|
-
return new w((
|
|
5414
|
+
return new w((i) => setTimeout(i));
|
|
5405
5415
|
}
|
|
5406
|
-
function ae(
|
|
5416
|
+
function ae(i, e = "text/javascript") {
|
|
5407
5417
|
return new w((t, n) => {
|
|
5408
5418
|
const s = document.createElement("script");
|
|
5409
|
-
s.async = !0, s.defer = !0, s.src =
|
|
5419
|
+
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
5420
|
});
|
|
5411
5421
|
}
|
|
5412
|
-
function le(...
|
|
5422
|
+
function le(...i) {
|
|
5413
5423
|
return new l(function* () {
|
|
5414
|
-
for (const e of
|
|
5424
|
+
for (const e of i)
|
|
5415
5425
|
for (const t of e)
|
|
5416
5426
|
yield t;
|
|
5417
5427
|
});
|
|
5418
5428
|
}
|
|
5419
|
-
function ue(
|
|
5420
|
-
if (
|
|
5421
|
-
return
|
|
5429
|
+
function ue(i) {
|
|
5430
|
+
if (i instanceof Array)
|
|
5431
|
+
return i.length;
|
|
5422
5432
|
let e = 0;
|
|
5423
|
-
for (const t of
|
|
5433
|
+
for (const t of i)
|
|
5424
5434
|
e += 1;
|
|
5425
5435
|
return e;
|
|
5426
5436
|
}
|
|
5427
|
-
function ce(
|
|
5437
|
+
function ce(i) {
|
|
5428
5438
|
return new l(function* () {
|
|
5429
5439
|
let e = 0;
|
|
5430
|
-
for (const t of
|
|
5440
|
+
for (const t of i)
|
|
5431
5441
|
yield [e, t], e += 1;
|
|
5432
5442
|
});
|
|
5433
5443
|
}
|
|
5434
|
-
function he(
|
|
5444
|
+
function he(i, e, t = 1) {
|
|
5435
5445
|
if (t <= 0)
|
|
5436
5446
|
throw new b(
|
|
5437
5447
|
"Step must be always a positive number, even when generating numbers in reverse order."
|
|
5438
5448
|
);
|
|
5439
|
-
return e === void 0 && (e =
|
|
5440
|
-
for (let n =
|
|
5449
|
+
return e === void 0 && (e = i, i = 0), i > e ? new l(function* () {
|
|
5450
|
+
for (let n = i; n > e; n -= t)
|
|
5441
5451
|
yield n;
|
|
5442
5452
|
}) : new l(function* () {
|
|
5443
|
-
for (let n =
|
|
5453
|
+
for (let n = i; n < e; n += t)
|
|
5444
5454
|
yield n;
|
|
5445
5455
|
});
|
|
5446
5456
|
}
|
|
5447
|
-
function fe(
|
|
5448
|
-
const e = Array.from(
|
|
5457
|
+
function fe(i) {
|
|
5458
|
+
const e = Array.from(i);
|
|
5449
5459
|
for (let t = e.length - 1; t > 0; t -= 1) {
|
|
5450
5460
|
const n = Math.floor(Math.random() * (t + 1));
|
|
5451
5461
|
[e[t], e[n]] = [e[n], e[t]];
|
|
5452
5462
|
}
|
|
5453
5463
|
return e;
|
|
5454
5464
|
}
|
|
5455
|
-
function de(
|
|
5465
|
+
function de(i) {
|
|
5456
5466
|
return new l(function* () {
|
|
5457
5467
|
const e = /* @__PURE__ */ new Set();
|
|
5458
|
-
for (const t of
|
|
5468
|
+
for (const t of i)
|
|
5459
5469
|
e.has(t) || (e.add(t), yield t);
|
|
5460
5470
|
});
|
|
5461
5471
|
}
|
|
5462
|
-
function
|
|
5463
|
-
const t =
|
|
5472
|
+
function A(i, e) {
|
|
5473
|
+
const t = i[Symbol.iterator](), n = e[Symbol.iterator]();
|
|
5464
5474
|
return new l(function* () {
|
|
5465
5475
|
for (; ; ) {
|
|
5466
|
-
const s = t.next(),
|
|
5467
|
-
if (s.done ||
|
|
5476
|
+
const s = t.next(), r = n.next();
|
|
5477
|
+
if (s.done || r.done)
|
|
5468
5478
|
break;
|
|
5469
|
-
yield [s.value,
|
|
5479
|
+
yield [s.value, r.value];
|
|
5470
5480
|
}
|
|
5471
5481
|
});
|
|
5472
5482
|
}
|
|
5473
|
-
function we(
|
|
5483
|
+
function we(i, e) {
|
|
5474
5484
|
if (e === void 0) {
|
|
5475
|
-
let
|
|
5476
|
-
for (const a of
|
|
5477
|
-
|
|
5485
|
+
let r = 0, o = 0;
|
|
5486
|
+
for (const a of i)
|
|
5487
|
+
r += a, o += 1;
|
|
5478
5488
|
if (o === 0)
|
|
5479
5489
|
throw new f("You must provide at least one value.");
|
|
5480
|
-
return
|
|
5490
|
+
return r / o;
|
|
5481
5491
|
}
|
|
5482
5492
|
let t = 0, n = 0, s = 0;
|
|
5483
|
-
for (const [
|
|
5493
|
+
for (const [r, o] of A(i, e)) {
|
|
5484
5494
|
if (o <= 0)
|
|
5485
5495
|
throw new f(`The weight for the value #${s} must be greater than zero.`);
|
|
5486
|
-
t +=
|
|
5496
|
+
t += r * o, n += o, s += 1;
|
|
5487
5497
|
}
|
|
5488
5498
|
if (s === 0)
|
|
5489
5499
|
throw new f("You must provide at least one value and weight.");
|
|
@@ -5491,24 +5501,24 @@ function we(r, e) {
|
|
|
5491
5501
|
throw new f("The sum of weights must be greater than zero.");
|
|
5492
5502
|
return t / n;
|
|
5493
5503
|
}
|
|
5494
|
-
function me(
|
|
5504
|
+
function me(i) {
|
|
5495
5505
|
let e = 0;
|
|
5496
|
-
for (let t = 0; t <
|
|
5497
|
-
const n =
|
|
5506
|
+
for (let t = 0; t < i.length; t += 1) {
|
|
5507
|
+
const n = i.charCodeAt(t);
|
|
5498
5508
|
e = (e << 5) - e + n, e |= 0;
|
|
5499
5509
|
}
|
|
5500
5510
|
return e;
|
|
5501
5511
|
}
|
|
5502
|
-
function pe(
|
|
5512
|
+
function pe(i) {
|
|
5503
5513
|
let e = 0;
|
|
5504
|
-
for (const t of
|
|
5514
|
+
for (const t of i)
|
|
5505
5515
|
e += t;
|
|
5506
5516
|
return e;
|
|
5507
5517
|
}
|
|
5508
|
-
function _e(
|
|
5509
|
-
return `${
|
|
5518
|
+
function _e(i) {
|
|
5519
|
+
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
5510
5520
|
}
|
|
5511
|
-
const ye = "2.
|
|
5521
|
+
const ye = "2.2.0";
|
|
5512
5522
|
export {
|
|
5513
5523
|
m as AggregatedAsyncIterator,
|
|
5514
5524
|
h as AggregatedIterator,
|
|
@@ -5517,22 +5527,22 @@ export {
|
|
|
5517
5527
|
ne as Countdown,
|
|
5518
5528
|
se as Curve,
|
|
5519
5529
|
M as DeferredPromise,
|
|
5520
|
-
|
|
5530
|
+
P as EnvironmentException,
|
|
5521
5531
|
c as Exception,
|
|
5522
5532
|
x as FatalErrorException,
|
|
5523
5533
|
E as FileException,
|
|
5524
5534
|
J as FileExistsException,
|
|
5525
5535
|
Y as FileNotFoundException,
|
|
5526
|
-
|
|
5536
|
+
R as GameLoop,
|
|
5527
5537
|
X as JSONStorage,
|
|
5528
5538
|
_ as KeyException,
|
|
5529
5539
|
Q as MapView,
|
|
5530
5540
|
L as NetworkException,
|
|
5531
|
-
|
|
5541
|
+
C as NotImplementedException,
|
|
5532
5542
|
V as PermissionException,
|
|
5533
5543
|
Z as PromiseQueue,
|
|
5534
5544
|
g as Publisher,
|
|
5535
|
-
|
|
5545
|
+
F as Random,
|
|
5536
5546
|
b as RangeException,
|
|
5537
5547
|
u as ReducedIterator,
|
|
5538
5548
|
S as ReferenceException,
|
|
@@ -5544,7 +5554,7 @@ export {
|
|
|
5544
5554
|
K as SwitchableCallback,
|
|
5545
5555
|
k as TimeUnit,
|
|
5546
5556
|
$ as TimedPromise,
|
|
5547
|
-
|
|
5557
|
+
j as TimeoutException,
|
|
5548
5558
|
G as TypeException,
|
|
5549
5559
|
ye as VERSION,
|
|
5550
5560
|
f as ValueException,
|
|
@@ -5556,20 +5566,20 @@ export {
|
|
|
5556
5566
|
W as dateDifference,
|
|
5557
5567
|
U as dateRange,
|
|
5558
5568
|
I as dateRound,
|
|
5559
|
-
|
|
5569
|
+
re as delay,
|
|
5560
5570
|
ce as enumerate,
|
|
5561
5571
|
ee as getWeek,
|
|
5562
5572
|
me as hash,
|
|
5563
5573
|
T as isBrowser,
|
|
5564
|
-
|
|
5574
|
+
D as isNode,
|
|
5565
5575
|
B as isWorker,
|
|
5566
5576
|
ae as loadScript,
|
|
5567
|
-
|
|
5577
|
+
ie as nextAnimationFrame,
|
|
5568
5578
|
he as range,
|
|
5569
5579
|
fe as shuffle,
|
|
5570
5580
|
pe as sum,
|
|
5571
5581
|
de as unique,
|
|
5572
5582
|
oe as yieldToEventLoop,
|
|
5573
|
-
|
|
5583
|
+
A as zip
|
|
5574
5584
|
};
|
|
5575
5585
|
//# sourceMappingURL=core.esm.js.map
|