@byloth/core 2.1.2 → 2.1.4
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 +263 -235
- 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 +6 -6
- package/src/index.ts +1 -1
- package/src/models/aggregators/aggregated-async-iterator.ts +1 -1
- package/src/models/aggregators/aggregated-iterator.ts +1 -1
- package/src/models/aggregators/reduced-iterator.ts +1 -1
- package/src/models/callbacks/callable-object.ts +1 -2
- package/src/models/callbacks/publisher.ts +85 -13
- package/src/models/callbacks/switchable-callback.ts +1 -1
- package/src/models/callbacks/types.ts +13 -0
- package/src/models/collections/map-view.ts +6 -2
- package/src/models/collections/set-view.ts +7 -2
- package/src/models/collections/types.ts +1 -0
- package/src/models/iterators/smart-async-iterator.ts +1 -1
- package/src/models/iterators/smart-iterator.ts +1 -1
- package/src/models/json/json-storage.ts +3 -3
- package/src/models/promises/deferred-promise.ts +7 -2
- package/src/models/promises/smart-promise.ts +1 -1
- package/src/models/timers/clock.ts +2 -8
- package/src/models/timers/countdown.ts +2 -3
- package/src/models/timers/game-loop.ts +4 -8
- package/src/utils/date.ts +1 -2
package/dist/core.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (i, n, e) =>
|
|
4
|
-
const
|
|
5
|
-
var I;
|
|
6
|
-
const nt = typeof process < "u" && !!((I = process.versions) != null && I.node);
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var Ve = (i, n, e) => n in i ? Le(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
|
|
3
|
+
var a = (i, n, e) => Ve(i, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
const Be = typeof window < "u" && typeof window.document < "u";
|
|
7
5
|
var A;
|
|
8
|
-
const st = typeof
|
|
9
|
-
var N
|
|
10
|
-
|
|
6
|
+
const st = typeof process < "u" && !!((A = process.versions) != null && A.node);
|
|
7
|
+
var N;
|
|
8
|
+
const rt = typeof self == "object" && ((N = self.constructor) == null ? void 0 : N.name) === "DedicatedWorkerGlobalScope";
|
|
9
|
+
var O, $;
|
|
10
|
+
class c extends ($ = Error, O = Symbol.toStringTag, $) {
|
|
11
11
|
/**
|
|
12
12
|
* Initializes a new instance of the {@link Exception} class.
|
|
13
13
|
*
|
|
@@ -26,7 +26,7 @@ class c extends (O = Error, N = Symbol.toStringTag, O) {
|
|
|
26
26
|
*/
|
|
27
27
|
constructor(e, t, s = "Exception") {
|
|
28
28
|
super(e);
|
|
29
|
-
a(this,
|
|
29
|
+
a(this, O, "Exception");
|
|
30
30
|
this.cause = t, this.name = s, t && (t instanceof Error ? this.stack += `
|
|
31
31
|
|
|
32
32
|
Caused by ${t.stack}` : this.stack += `
|
|
@@ -65,8 +65,8 @@ Caused by ${t}`);
|
|
|
65
65
|
return new c(`${e}`);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
69
|
-
class g extends (z = c,
|
|
68
|
+
var q, z;
|
|
69
|
+
class g extends (z = c, q = Symbol.toStringTag, z) {
|
|
70
70
|
/**
|
|
71
71
|
* Initializes a new instance of the {@link FatalErrorException} class.
|
|
72
72
|
*
|
|
@@ -86,11 +86,11 @@ class g extends (z = c, $ = Symbol.toStringTag, z) {
|
|
|
86
86
|
constructor(e, t, s = "FatalErrorException") {
|
|
87
87
|
e === void 0 && (e = "The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");
|
|
88
88
|
super(e, t, s);
|
|
89
|
-
a(this,
|
|
89
|
+
a(this, q, "FatalErrorException");
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
var
|
|
93
|
-
class
|
|
92
|
+
var D, B;
|
|
93
|
+
class Ge extends (B = g, D = Symbol.toStringTag, B) {
|
|
94
94
|
/**
|
|
95
95
|
* Initializes a new instance of the {@link NotImplementedException} class.
|
|
96
96
|
*
|
|
@@ -110,11 +110,11 @@ class Ve extends (D = g, q = Symbol.toStringTag, D) {
|
|
|
110
110
|
constructor(e, t, s = "NotImplementedException") {
|
|
111
111
|
e === void 0 && (e = "This feature isn't implemented yet. Please, try again later.");
|
|
112
112
|
super(e, t, s);
|
|
113
|
-
a(this,
|
|
113
|
+
a(this, D, "NotImplementedException");
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
var
|
|
117
|
-
class
|
|
116
|
+
var J, Y;
|
|
117
|
+
class Je extends (Y = c, J = Symbol.toStringTag, Y) {
|
|
118
118
|
/**
|
|
119
119
|
* Initializes a new instance of the {@link FileException} class.
|
|
120
120
|
*
|
|
@@ -133,11 +133,11 @@ class Be extends (J = c, B = Symbol.toStringTag, J) {
|
|
|
133
133
|
*/
|
|
134
134
|
constructor(e, t, s = "FileException") {
|
|
135
135
|
super(e, t, s);
|
|
136
|
-
a(this,
|
|
136
|
+
a(this, J, "FileException");
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
var
|
|
140
|
-
class
|
|
139
|
+
var L, V;
|
|
140
|
+
class it extends (V = Je, L = Symbol.toStringTag, V) {
|
|
141
141
|
/**
|
|
142
142
|
* Initializes a new instance of the {@link FileExistsException} class.
|
|
143
143
|
*
|
|
@@ -156,11 +156,11 @@ class rt extends (L = Be, Y = Symbol.toStringTag, L) {
|
|
|
156
156
|
*/
|
|
157
157
|
constructor(e, t, s = "FileExistsException") {
|
|
158
158
|
super(e, t, s);
|
|
159
|
-
a(this,
|
|
159
|
+
a(this, L, "FileExistsException");
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
var
|
|
163
|
-
class
|
|
162
|
+
var G, K;
|
|
163
|
+
class ot extends (K = Je, G = Symbol.toStringTag, K) {
|
|
164
164
|
/**
|
|
165
165
|
* Initializes a new instance of the {@link FileNotFoundException} class.
|
|
166
166
|
*
|
|
@@ -179,11 +179,11 @@ class it extends (G = Be, V = Symbol.toStringTag, G) {
|
|
|
179
179
|
*/
|
|
180
180
|
constructor(e, t, s = "FileNotFoundException") {
|
|
181
181
|
super(e, t, s);
|
|
182
|
-
a(this,
|
|
182
|
+
a(this, G, "FileNotFoundException");
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
var
|
|
186
|
-
class
|
|
185
|
+
var H, Q;
|
|
186
|
+
class _ extends (Q = c, H = Symbol.toStringTag, Q) {
|
|
187
187
|
/**
|
|
188
188
|
* Initializes a new instance of the {@link KeyException} class.
|
|
189
189
|
*
|
|
@@ -202,11 +202,11 @@ class y extends (H = c, K = Symbol.toStringTag, H) {
|
|
|
202
202
|
*/
|
|
203
203
|
constructor(e, t, s = "KeyException") {
|
|
204
204
|
super(e, t, s);
|
|
205
|
-
a(this,
|
|
205
|
+
a(this, H, "KeyException");
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
var
|
|
209
|
-
class
|
|
208
|
+
var X, Z;
|
|
209
|
+
class at extends (Z = c, X = Symbol.toStringTag, Z) {
|
|
210
210
|
/**
|
|
211
211
|
* Initializes a new instance of the {@link NetworkException} class.
|
|
212
212
|
*
|
|
@@ -225,11 +225,11 @@ class ot extends (X = c, Q = Symbol.toStringTag, X) {
|
|
|
225
225
|
*/
|
|
226
226
|
constructor(e, t, s = "NetworkException") {
|
|
227
227
|
super(e, t, s);
|
|
228
|
-
a(this,
|
|
228
|
+
a(this, X, "NetworkException");
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
var
|
|
232
|
-
class
|
|
231
|
+
var W, U;
|
|
232
|
+
class lt extends (U = c, W = Symbol.toStringTag, U) {
|
|
233
233
|
/**
|
|
234
234
|
* Initializes a new instance of the {@link PermissionException} class.
|
|
235
235
|
*
|
|
@@ -248,11 +248,11 @@ class at extends (W = c, Z = Symbol.toStringTag, W) {
|
|
|
248
248
|
*/
|
|
249
249
|
constructor(e, t, s = "PermissionException") {
|
|
250
250
|
super(e, t, s);
|
|
251
|
-
a(this,
|
|
251
|
+
a(this, W, "PermissionException");
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
var
|
|
255
|
-
class
|
|
254
|
+
var ee, te;
|
|
255
|
+
class E extends (te = c, ee = Symbol.toStringTag, te) {
|
|
256
256
|
/**
|
|
257
257
|
* Initializes a new instance of the {@link ReferenceException} class.
|
|
258
258
|
*
|
|
@@ -271,11 +271,11 @@ class C extends (ee = c, U = Symbol.toStringTag, ee) {
|
|
|
271
271
|
*/
|
|
272
272
|
constructor(e, t, s = "ReferenceException") {
|
|
273
273
|
super(e, t, s);
|
|
274
|
-
a(this,
|
|
274
|
+
a(this, ee, "ReferenceException");
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
|
-
var
|
|
278
|
-
class p extends (
|
|
277
|
+
var ne, se;
|
|
278
|
+
class p extends (se = c, ne = Symbol.toStringTag, se) {
|
|
279
279
|
/**
|
|
280
280
|
* Initializes a new instance of the {@link RuntimeException} class.
|
|
281
281
|
*
|
|
@@ -294,11 +294,11 @@ class p extends (ne = c, te = Symbol.toStringTag, ne) {
|
|
|
294
294
|
*/
|
|
295
295
|
constructor(e, t, s = "RuntimeException") {
|
|
296
296
|
super(e, t, s);
|
|
297
|
-
a(this,
|
|
297
|
+
a(this, ne, "RuntimeException");
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
var
|
|
301
|
-
class
|
|
300
|
+
var re, ie;
|
|
301
|
+
class Ke extends (ie = p, re = Symbol.toStringTag, ie) {
|
|
302
302
|
/**
|
|
303
303
|
* Initializes a new instance of the {@link EnvironmentException} class.
|
|
304
304
|
*
|
|
@@ -317,11 +317,11 @@ class Ge extends (re = p, se = Symbol.toStringTag, re) {
|
|
|
317
317
|
*/
|
|
318
318
|
constructor(e, t, s = "EnvironmentException") {
|
|
319
319
|
super(e, t, s);
|
|
320
|
-
a(this,
|
|
320
|
+
a(this, re, "EnvironmentException");
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
var
|
|
324
|
-
class
|
|
323
|
+
var oe, ae;
|
|
324
|
+
class He extends (ae = c, oe = Symbol.toStringTag, ae) {
|
|
325
325
|
/**
|
|
326
326
|
* Initializes a new instance of the {@link TimeoutException} class.
|
|
327
327
|
*
|
|
@@ -340,11 +340,11 @@ class Ke extends (oe = c, ie = Symbol.toStringTag, oe) {
|
|
|
340
340
|
*/
|
|
341
341
|
constructor(e, t, s = "TimeoutException") {
|
|
342
342
|
super(e, t, s);
|
|
343
|
-
a(this,
|
|
343
|
+
a(this, oe, "TimeoutException");
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
var
|
|
347
|
-
class
|
|
346
|
+
var le, ue;
|
|
347
|
+
class ut extends (ue = c, le = Symbol.toStringTag, ue) {
|
|
348
348
|
/**
|
|
349
349
|
* Initializes a new instance of the {@link TypeException} class.
|
|
350
350
|
*
|
|
@@ -363,11 +363,11 @@ class lt extends (le = c, ae = Symbol.toStringTag, le) {
|
|
|
363
363
|
*/
|
|
364
364
|
constructor(e, t, s = "TypeException") {
|
|
365
365
|
super(e, t, s);
|
|
366
|
-
a(this,
|
|
366
|
+
a(this, le, "TypeException");
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
var
|
|
370
|
-
class d extends (
|
|
369
|
+
var ce, he;
|
|
370
|
+
class d extends (he = c, ce = Symbol.toStringTag, he) {
|
|
371
371
|
/**
|
|
372
372
|
* Initializes a new instance of the {@link ValueException} class.
|
|
373
373
|
*
|
|
@@ -386,11 +386,11 @@ class d extends (ce = c, ue = Symbol.toStringTag, ce) {
|
|
|
386
386
|
*/
|
|
387
387
|
constructor(e, t, s = "ValueException") {
|
|
388
388
|
super(e, t, s);
|
|
389
|
-
a(this,
|
|
389
|
+
a(this, ce, "ValueException");
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
var
|
|
393
|
-
class b extends (
|
|
392
|
+
var fe, de;
|
|
393
|
+
class b extends (de = d, fe = Symbol.toStringTag, de) {
|
|
394
394
|
/**
|
|
395
395
|
* Initializes a new instance of the {@link RangeException} class.
|
|
396
396
|
*
|
|
@@ -409,17 +409,17 @@ class b extends (fe = d, he = Symbol.toStringTag, fe) {
|
|
|
409
409
|
*/
|
|
410
410
|
constructor(e, t, s = "RangeException") {
|
|
411
411
|
super(e, t, s);
|
|
412
|
-
a(this,
|
|
412
|
+
a(this, fe, "RangeException");
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
var
|
|
415
|
+
var we;
|
|
416
416
|
class u {
|
|
417
417
|
constructor(n) {
|
|
418
418
|
/**
|
|
419
419
|
* The native {@link Iterator} object that is being wrapped by this instance.
|
|
420
420
|
*/
|
|
421
421
|
a(this, "_iterator");
|
|
422
|
-
a(this,
|
|
422
|
+
a(this, we, "SmartIterator");
|
|
423
423
|
n instanceof Function ? this._iterator = n() : Symbol.iterator in n ? this._iterator = n[Symbol.iterator]() : this._iterator = n;
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
@@ -1020,19 +1020,19 @@ class u {
|
|
|
1020
1020
|
toArray() {
|
|
1021
1021
|
return Array.from(this);
|
|
1022
1022
|
}
|
|
1023
|
-
[(
|
|
1023
|
+
[(we = Symbol.toStringTag, Symbol.iterator)]() {
|
|
1024
1024
|
return this;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
var
|
|
1028
|
-
|
|
1029
|
-
const
|
|
1027
|
+
var me;
|
|
1028
|
+
me = Symbol.toStringTag;
|
|
1029
|
+
const y = class y {
|
|
1030
1030
|
constructor(n) {
|
|
1031
1031
|
/**
|
|
1032
1032
|
* The internal {@link SmartIterator} object that holds the reduced elements.
|
|
1033
1033
|
*/
|
|
1034
1034
|
a(this, "_elements");
|
|
1035
|
-
a(this,
|
|
1035
|
+
a(this, me, "ReducedIterator");
|
|
1036
1036
|
this._elements = new u(n);
|
|
1037
1037
|
}
|
|
1038
1038
|
/**
|
|
@@ -1111,7 +1111,7 @@ const _ = class _ {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
filter(n) {
|
|
1113
1113
|
const e = this._elements.enumerate();
|
|
1114
|
-
return new
|
|
1114
|
+
return new y(function* () {
|
|
1115
1115
|
for (const [t, [s, r]] of e)
|
|
1116
1116
|
n(s, r, t) && (yield [s, r]);
|
|
1117
1117
|
});
|
|
@@ -1151,7 +1151,7 @@ const _ = class _ {
|
|
|
1151
1151
|
*/
|
|
1152
1152
|
map(n) {
|
|
1153
1153
|
const e = this._elements.enumerate();
|
|
1154
|
-
return new
|
|
1154
|
+
return new y(function* () {
|
|
1155
1155
|
for (const [t, [s, r]] of e)
|
|
1156
1156
|
yield [s, n(s, r, t)];
|
|
1157
1157
|
});
|
|
@@ -1249,7 +1249,7 @@ const _ = class _ {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
drop(n) {
|
|
1251
1251
|
const e = this._elements.enumerate();
|
|
1252
|
-
return new
|
|
1252
|
+
return new y(function* () {
|
|
1253
1253
|
for (const [t, [s, r]] of e)
|
|
1254
1254
|
t >= n && (yield [s, r]);
|
|
1255
1255
|
});
|
|
@@ -1291,7 +1291,7 @@ const _ = class _ {
|
|
|
1291
1291
|
*/
|
|
1292
1292
|
take(n) {
|
|
1293
1293
|
const e = this._elements.enumerate();
|
|
1294
|
-
return new
|
|
1294
|
+
return new y(function* () {
|
|
1295
1295
|
for (const [t, [s, r]] of e) {
|
|
1296
1296
|
if (t >= n)
|
|
1297
1297
|
break;
|
|
@@ -1361,7 +1361,7 @@ const _ = class _ {
|
|
|
1361
1361
|
*/
|
|
1362
1362
|
unique() {
|
|
1363
1363
|
const n = this._elements;
|
|
1364
|
-
return new
|
|
1364
|
+
return new y(function* () {
|
|
1365
1365
|
const e = /* @__PURE__ */ new Set();
|
|
1366
1366
|
for (const [t, s] of n)
|
|
1367
1367
|
e.has(s) || (e.add(s), yield [t, s]);
|
|
@@ -1634,16 +1634,16 @@ const _ = class _ {
|
|
|
1634
1634
|
return Object.fromEntries(this.entries());
|
|
1635
1635
|
}
|
|
1636
1636
|
};
|
|
1637
|
-
let h =
|
|
1638
|
-
var
|
|
1639
|
-
|
|
1637
|
+
let h = y;
|
|
1638
|
+
var pe;
|
|
1639
|
+
pe = Symbol.toStringTag;
|
|
1640
1640
|
const w = class w {
|
|
1641
1641
|
constructor(n) {
|
|
1642
1642
|
/**
|
|
1643
1643
|
* The internal {@link SmartAsyncIterator} object that holds the elements to aggregate.
|
|
1644
1644
|
*/
|
|
1645
1645
|
a(this, "_elements");
|
|
1646
|
-
a(this,
|
|
1646
|
+
a(this, pe, "AggregatedAsyncIterator");
|
|
1647
1647
|
this._elements = new f(n);
|
|
1648
1648
|
}
|
|
1649
1649
|
/**
|
|
@@ -2295,15 +2295,15 @@ const w = class w {
|
|
|
2295
2295
|
return n;
|
|
2296
2296
|
}
|
|
2297
2297
|
};
|
|
2298
|
-
let
|
|
2299
|
-
var
|
|
2298
|
+
let M = w;
|
|
2299
|
+
var _e;
|
|
2300
2300
|
class f {
|
|
2301
2301
|
constructor(n) {
|
|
2302
2302
|
/**
|
|
2303
2303
|
* The native {@link AsyncIterator} object that is being wrapped by this instance.
|
|
2304
2304
|
*/
|
|
2305
2305
|
a(this, "_iterator");
|
|
2306
|
-
a(this,
|
|
2306
|
+
a(this, _e, "SmartAsyncIterator");
|
|
2307
2307
|
if (n instanceof Function) {
|
|
2308
2308
|
const e = n();
|
|
2309
2309
|
Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
|
|
@@ -2917,7 +2917,7 @@ class f {
|
|
|
2917
2917
|
* @returns A new instance of the {@link AggregatedAsyncIterator} class containing the grouped elements.
|
|
2918
2918
|
*/
|
|
2919
2919
|
groupBy(n) {
|
|
2920
|
-
return new
|
|
2920
|
+
return new M(this.map(async (e, t) => [await n(e, t), e]));
|
|
2921
2921
|
}
|
|
2922
2922
|
/**
|
|
2923
2923
|
* Materializes the iterator into an array.
|
|
@@ -2945,7 +2945,7 @@ class f {
|
|
|
2945
2945
|
toArray() {
|
|
2946
2946
|
return Array.fromAsync(this);
|
|
2947
2947
|
}
|
|
2948
|
-
[(
|
|
2948
|
+
[(_e = Symbol.toStringTag, Symbol.asyncIterator)]() {
|
|
2949
2949
|
return this;
|
|
2950
2950
|
}
|
|
2951
2951
|
}
|
|
@@ -3605,22 +3605,22 @@ const m = class m {
|
|
|
3605
3605
|
}
|
|
3606
3606
|
};
|
|
3607
3607
|
let x = m;
|
|
3608
|
-
const
|
|
3609
|
-
var
|
|
3610
|
-
class
|
|
3608
|
+
const Qe = Function;
|
|
3609
|
+
var be, ge;
|
|
3610
|
+
class Xe extends (ge = Qe, be = Symbol.toStringTag, ge) {
|
|
3611
3611
|
/**
|
|
3612
3612
|
* Initializes a new instance of the {@link CallableObject} class.
|
|
3613
3613
|
*/
|
|
3614
3614
|
constructor() {
|
|
3615
3615
|
super("return this._invoke(...arguments);");
|
|
3616
|
-
a(this,
|
|
3616
|
+
a(this, be, "CallableObject");
|
|
3617
3617
|
const e = this.bind(this);
|
|
3618
3618
|
return Object.setPrototypeOf(this, e), e;
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
|
-
var
|
|
3622
|
-
|
|
3623
|
-
class
|
|
3621
|
+
var xe;
|
|
3622
|
+
xe = Symbol.toStringTag;
|
|
3623
|
+
const F = class F {
|
|
3624
3624
|
/**
|
|
3625
3625
|
* Initializes a new instance of the {@link Publisher} class.
|
|
3626
3626
|
*
|
|
@@ -3639,7 +3639,7 @@ class v {
|
|
|
3639
3639
|
* The values are the arrays of the subscribers themselves.
|
|
3640
3640
|
*/
|
|
3641
3641
|
a(this, "_subscribers");
|
|
3642
|
-
a(this,
|
|
3642
|
+
a(this, xe, "Publisher");
|
|
3643
3643
|
this._subscribers = /* @__PURE__ */ new Map();
|
|
3644
3644
|
}
|
|
3645
3645
|
/**
|
|
@@ -3663,7 +3663,44 @@ class v {
|
|
|
3663
3663
|
* ```
|
|
3664
3664
|
*/
|
|
3665
3665
|
clear() {
|
|
3666
|
-
this._subscribers.clear();
|
|
3666
|
+
this.publish("__internals__:clear"), this._subscribers.clear();
|
|
3667
|
+
}
|
|
3668
|
+
/**
|
|
3669
|
+
* Creates a new scoped instance of the {@link Publisher} class,
|
|
3670
|
+
* which can be used to publish and subscribe events within a specific context.
|
|
3671
|
+
*
|
|
3672
|
+
* It can receive all events published to the parent publisher while also allowing
|
|
3673
|
+
* the scoped publisher to handle its own events independently.
|
|
3674
|
+
* In fact, events published to the scoped publisher won't be propagated back to the parent publisher.
|
|
3675
|
+
*
|
|
3676
|
+
* ---
|
|
3677
|
+
*
|
|
3678
|
+
* @example
|
|
3679
|
+
* ```ts
|
|
3680
|
+
* const publisher = new Publisher();
|
|
3681
|
+
* const context = publisher.createScope();
|
|
3682
|
+
*
|
|
3683
|
+
* publisher.subscribe("player:death", () => { console.log(`Player has died.`); });
|
|
3684
|
+
* context.subscribe("player:spawn", () => { console.log(`Player has spawned.`); });
|
|
3685
|
+
*
|
|
3686
|
+
* publisher.publish("player:spawn"); // Player has spawned.
|
|
3687
|
+
* context.publish("player:death"); // * no output *
|
|
3688
|
+
* ```
|
|
3689
|
+
*
|
|
3690
|
+
* ---
|
|
3691
|
+
*
|
|
3692
|
+
* @template U
|
|
3693
|
+
* A map containing the names of the emittable events and the
|
|
3694
|
+
* related callback signatures that can be subscribed to them.
|
|
3695
|
+
* Default is `T`.
|
|
3696
|
+
*
|
|
3697
|
+
* @template X An utility type that extends the `U` map with a wildcard event.
|
|
3698
|
+
*/
|
|
3699
|
+
createScope() {
|
|
3700
|
+
const n = new F(), e = (t, ...s) => {
|
|
3701
|
+
n.publish(t, ...s);
|
|
3702
|
+
};
|
|
3703
|
+
return this.subscribe("__internals__:clear", () => n.clear()), this.subscribe("*", e), n;
|
|
3667
3704
|
}
|
|
3668
3705
|
/**
|
|
3669
3706
|
* Publishes an event to all the subscribers.
|
|
@@ -3689,8 +3726,8 @@ class v {
|
|
|
3689
3726
|
* @returns An array containing the return values of all the subscribers.
|
|
3690
3727
|
*/
|
|
3691
3728
|
publish(n, ...e) {
|
|
3692
|
-
|
|
3693
|
-
return
|
|
3729
|
+
let t, s = this._subscribers.get(n);
|
|
3730
|
+
return s ? t = s.slice().map((r) => r(...e)) : t = [], n.startsWith("__") || (s = this._subscribers.get("*"), s && s.slice().forEach((r) => r(n, ...e))), t;
|
|
3694
3731
|
}
|
|
3695
3732
|
/**
|
|
3696
3733
|
* Subscribes to an event and adds a subscriber to be executed when the event is published.
|
|
@@ -3717,12 +3754,11 @@ class v {
|
|
|
3717
3754
|
* @returns A function that can be used to unsubscribe the subscriber from the event.
|
|
3718
3755
|
*/
|
|
3719
3756
|
subscribe(n, e) {
|
|
3720
|
-
this._subscribers.
|
|
3721
|
-
|
|
3722
|
-
return t.push(e), () => {
|
|
3757
|
+
const t = this._subscribers.get(n) ?? [];
|
|
3758
|
+
return t.push(e), this._subscribers.set(n, t), () => {
|
|
3723
3759
|
const s = t.indexOf(e);
|
|
3724
3760
|
if (s < 0)
|
|
3725
|
-
throw new
|
|
3761
|
+
throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
|
|
3726
3762
|
t.splice(s, 1);
|
|
3727
3763
|
};
|
|
3728
3764
|
}
|
|
@@ -3749,17 +3785,18 @@ class v {
|
|
|
3749
3785
|
unsubscribe(n, e) {
|
|
3750
3786
|
const t = this._subscribers.get(n);
|
|
3751
3787
|
if (!t)
|
|
3752
|
-
|
|
3788
|
+
throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
|
|
3753
3789
|
const s = t.indexOf(e);
|
|
3754
3790
|
if (s < 0)
|
|
3755
|
-
throw new
|
|
3756
|
-
t.splice(s, 1);
|
|
3791
|
+
throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
|
|
3792
|
+
t.splice(s, 1), t.length === 0 && this._subscribers.delete(n);
|
|
3757
3793
|
}
|
|
3758
|
-
}
|
|
3759
|
-
const Xe = () => {
|
|
3760
3794
|
};
|
|
3761
|
-
|
|
3762
|
-
|
|
3795
|
+
let v = F;
|
|
3796
|
+
const Ze = () => {
|
|
3797
|
+
};
|
|
3798
|
+
var ve, Se;
|
|
3799
|
+
class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
3763
3800
|
constructor(e, t = "default") {
|
|
3764
3801
|
super();
|
|
3765
3802
|
/**
|
|
@@ -3792,9 +3829,9 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3792
3829
|
* The function that will be called by the extended class when the object is invoked as a function.
|
|
3793
3830
|
*/
|
|
3794
3831
|
a(this, "_invoke");
|
|
3795
|
-
a(this,
|
|
3832
|
+
a(this, ve, "SwitchableCallback");
|
|
3796
3833
|
this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = () => {
|
|
3797
|
-
throw new
|
|
3834
|
+
throw new Ge(
|
|
3798
3835
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3799
3836
|
);
|
|
3800
3837
|
}), this._key = t, this._callback = e, this._invoke = (...s) => this._callback(...s);
|
|
@@ -3839,14 +3876,14 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3839
3876
|
enable(e) {
|
|
3840
3877
|
if (e === void 0) {
|
|
3841
3878
|
if (!this._key)
|
|
3842
|
-
throw new
|
|
3879
|
+
throw new _(
|
|
3843
3880
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3844
3881
|
);
|
|
3845
3882
|
e = this._key;
|
|
3846
3883
|
} else if (e) {
|
|
3847
3884
|
if (!this._callbacks.has(e))
|
|
3848
|
-
throw new
|
|
3849
|
-
} else throw new
|
|
3885
|
+
throw new _(`The key '${e}' doesn't yet have any associated callback.`);
|
|
3886
|
+
} else throw new _("The key must be a non-empty string.");
|
|
3850
3887
|
if (this._isEnabled)
|
|
3851
3888
|
throw new p("The `SwitchableCallback` is already enabled.");
|
|
3852
3889
|
this._callback = this._callbacks.get(e), this._isEnabled = !0;
|
|
@@ -3867,7 +3904,7 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3867
3904
|
disable() {
|
|
3868
3905
|
if (!this._isEnabled)
|
|
3869
3906
|
throw new p("The `SwitchableCallback` is already disabled.");
|
|
3870
|
-
this._callback =
|
|
3907
|
+
this._callback = Ze, this._isEnabled = !1;
|
|
3871
3908
|
}
|
|
3872
3909
|
/**
|
|
3873
3910
|
* Registers a new implementation for the callback.
|
|
@@ -3893,7 +3930,7 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3893
3930
|
if (this._callbacks.size === 0)
|
|
3894
3931
|
this._key = e, this._callback = t;
|
|
3895
3932
|
else if (this._callbacks.has(e))
|
|
3896
|
-
throw new
|
|
3933
|
+
throw new _(`The key '${e}' has already been used for another callback.`);
|
|
3897
3934
|
this._callbacks.set(e, t);
|
|
3898
3935
|
}
|
|
3899
3936
|
/**
|
|
@@ -3916,9 +3953,9 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3916
3953
|
*/
|
|
3917
3954
|
unregister(e) {
|
|
3918
3955
|
if (this._key === e)
|
|
3919
|
-
throw new
|
|
3956
|
+
throw new _("Unable to unregister the currently selected callback.");
|
|
3920
3957
|
if (!this._callbacks.has(e))
|
|
3921
|
-
throw new
|
|
3958
|
+
throw new _(`The key '${e}' doesn't yet have any associated callback.`);
|
|
3922
3959
|
this._callbacks.delete(e);
|
|
3923
3960
|
}
|
|
3924
3961
|
/**
|
|
@@ -3941,12 +3978,12 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3941
3978
|
*/
|
|
3942
3979
|
switch(e) {
|
|
3943
3980
|
if (!this._callbacks.has(e))
|
|
3944
|
-
throw new
|
|
3981
|
+
throw new _(`The key '${e}' doesn't yet have any associated callback.`);
|
|
3945
3982
|
this._key !== e && (this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e)));
|
|
3946
3983
|
}
|
|
3947
3984
|
}
|
|
3948
|
-
var
|
|
3949
|
-
class
|
|
3985
|
+
var ke, Te;
|
|
3986
|
+
class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
3950
3987
|
/**
|
|
3951
3988
|
* Initializes a new instance of the {@link MapView} class.
|
|
3952
3989
|
*
|
|
@@ -3967,7 +4004,7 @@ class ct extends (ke = Map, Se = Symbol.toStringTag, ke) {
|
|
|
3967
4004
|
* The internal {@link Publisher} instance used to publish events.
|
|
3968
4005
|
*/
|
|
3969
4006
|
a(this, "_publisher");
|
|
3970
|
-
a(this,
|
|
4007
|
+
a(this, ke, "MapView");
|
|
3971
4008
|
if (this._publisher = new v(), e)
|
|
3972
4009
|
for (const [t, s] of e)
|
|
3973
4010
|
this.set(t, s);
|
|
@@ -4099,8 +4136,8 @@ class ct extends (ke = Map, Se = Symbol.toStringTag, ke) {
|
|
|
4099
4136
|
this._publisher.unsubscribe(e, t);
|
|
4100
4137
|
}
|
|
4101
4138
|
}
|
|
4102
|
-
var
|
|
4103
|
-
class
|
|
4139
|
+
var Ee, Me;
|
|
4140
|
+
class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
4104
4141
|
/**
|
|
4105
4142
|
* Initializes a new instance of the {@link SetView} class.
|
|
4106
4143
|
*
|
|
@@ -4121,7 +4158,7 @@ class ht extends (Ee = Set, Te = Symbol.toStringTag, Ee) {
|
|
|
4121
4158
|
* The internal {@link Publisher} instance used to publish events.
|
|
4122
4159
|
*/
|
|
4123
4160
|
a(this, "_publisher");
|
|
4124
|
-
a(this,
|
|
4161
|
+
a(this, Ee, "SetView");
|
|
4125
4162
|
if (this._publisher = new v(), e)
|
|
4126
4163
|
for (const t of e)
|
|
4127
4164
|
this.add(t);
|
|
@@ -4252,9 +4289,9 @@ class ht extends (Ee = Set, Te = Symbol.toStringTag, Ee) {
|
|
|
4252
4289
|
this._publisher.unsubscribe(e, t);
|
|
4253
4290
|
}
|
|
4254
4291
|
}
|
|
4255
|
-
var
|
|
4256
|
-
|
|
4257
|
-
class
|
|
4292
|
+
var Re;
|
|
4293
|
+
Re = Symbol.toStringTag;
|
|
4294
|
+
class dt {
|
|
4258
4295
|
/**
|
|
4259
4296
|
* Initializes a new instance of the {@link JSONStorage} class.
|
|
4260
4297
|
* It cannot be instantiated outside of a browser environment or an {@link EnvironmentException} is thrown.
|
|
@@ -4288,9 +4325,9 @@ class ft {
|
|
|
4288
4325
|
* A reference to the persistent {@link localStorage} storage.
|
|
4289
4326
|
*/
|
|
4290
4327
|
a(this, "_persistent");
|
|
4291
|
-
a(this,
|
|
4292
|
-
if (!
|
|
4293
|
-
throw new
|
|
4328
|
+
a(this, Re, "JSONStorage");
|
|
4329
|
+
if (!Be)
|
|
4330
|
+
throw new Ke(
|
|
4294
4331
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
4295
4332
|
);
|
|
4296
4333
|
this._preferPersistence = n, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -4562,9 +4599,9 @@ class ft {
|
|
|
4562
4599
|
this._volatile.removeItem(n), this._persistent.removeItem(n);
|
|
4563
4600
|
}
|
|
4564
4601
|
}
|
|
4565
|
-
var
|
|
4566
|
-
|
|
4567
|
-
const
|
|
4602
|
+
var Fe;
|
|
4603
|
+
Fe = Symbol.toStringTag;
|
|
4604
|
+
const C = class C {
|
|
4568
4605
|
/**
|
|
4569
4606
|
* Initializes a new instance of the {@link SmartPromise} class.
|
|
4570
4607
|
*
|
|
@@ -4610,7 +4647,7 @@ const R = class R {
|
|
|
4610
4647
|
* The native {@link Promise} object wrapped by this instance.
|
|
4611
4648
|
*/
|
|
4612
4649
|
a(this, "_promise");
|
|
4613
|
-
a(this,
|
|
4650
|
+
a(this, Fe, "SmartPromise");
|
|
4614
4651
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
4615
4652
|
const e = (s) => (this._isPending = !1, this._isFulfilled = !0, s), t = (s) => {
|
|
4616
4653
|
throw this._isPending = !1, this._isRejected = !0, s;
|
|
@@ -4641,7 +4678,7 @@ const R = class R {
|
|
|
4641
4678
|
* @returns A new {@link SmartPromise} object that wraps the provided promise.
|
|
4642
4679
|
*/
|
|
4643
4680
|
static FromPromise(n) {
|
|
4644
|
-
return new
|
|
4681
|
+
return new C((e, t) => n.then(e, t));
|
|
4645
4682
|
}
|
|
4646
4683
|
/**
|
|
4647
4684
|
* A flag indicating whether the promise is still pending or not.
|
|
@@ -4697,9 +4734,9 @@ const R = class R {
|
|
|
4697
4734
|
return this._promise.finally(n);
|
|
4698
4735
|
}
|
|
4699
4736
|
};
|
|
4700
|
-
let k =
|
|
4701
|
-
var
|
|
4702
|
-
class
|
|
4737
|
+
let k = C;
|
|
4738
|
+
var Ce, Pe;
|
|
4739
|
+
class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
4703
4740
|
/**
|
|
4704
4741
|
* Initializes a new instance of the {@link DeferredPromise} class.
|
|
4705
4742
|
*
|
|
@@ -4734,7 +4771,7 @@ class Ze extends (Pe = k, Fe = Symbol.toStringTag, Pe) {
|
|
|
4734
4771
|
* If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
|
|
4735
4772
|
*/
|
|
4736
4773
|
a(this, "_reject");
|
|
4737
|
-
a(this,
|
|
4774
|
+
a(this, Ce, "DeferredPromise");
|
|
4738
4775
|
this._promise = this._promise.then(e, t), this._resolve = s, this._reject = r;
|
|
4739
4776
|
}
|
|
4740
4777
|
/**
|
|
@@ -4773,8 +4810,8 @@ class Ze extends (Pe = k, Fe = Symbol.toStringTag, Pe) {
|
|
|
4773
4810
|
return e.then(this.resolve, this.reject), this;
|
|
4774
4811
|
}
|
|
4775
4812
|
}
|
|
4776
|
-
var
|
|
4777
|
-
class
|
|
4813
|
+
var je, Ie;
|
|
4814
|
+
class wt extends (Ie = k, je = Symbol.toStringTag, Ie) {
|
|
4778
4815
|
/**
|
|
4779
4816
|
* Initializes a new instance of the {@link TimedPromise} class.
|
|
4780
4817
|
*
|
|
@@ -4800,21 +4837,21 @@ class dt extends (je = k, Ce = Symbol.toStringTag, je) {
|
|
|
4800
4837
|
constructor(e, t) {
|
|
4801
4838
|
super((s, r) => {
|
|
4802
4839
|
const o = (T) => {
|
|
4803
|
-
clearTimeout(
|
|
4840
|
+
clearTimeout(j), s(T);
|
|
4804
4841
|
}, l = (T) => {
|
|
4805
|
-
clearTimeout(
|
|
4806
|
-
},
|
|
4842
|
+
clearTimeout(j), r(T);
|
|
4843
|
+
}, j = setTimeout(() => l(new He("The operation has timed out.")), t);
|
|
4807
4844
|
e(o, l);
|
|
4808
4845
|
});
|
|
4809
|
-
a(this,
|
|
4846
|
+
a(this, je, "TimedPromise");
|
|
4810
4847
|
}
|
|
4811
4848
|
}
|
|
4812
|
-
var
|
|
4813
|
-
function
|
|
4849
|
+
var R = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(R || {}), Ue = /* @__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))(Ue || {});
|
|
4850
|
+
function mt(i, n, e = 864e5) {
|
|
4814
4851
|
let t;
|
|
4815
4852
|
return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
|
|
4816
4853
|
}
|
|
4817
|
-
function
|
|
4854
|
+
function pt(i, n, e = 864e5) {
|
|
4818
4855
|
if (i = new Date(i), n = new Date(n), i >= n)
|
|
4819
4856
|
throw new b("The end date must be greater than the start date.");
|
|
4820
4857
|
return new u(function* () {
|
|
@@ -4824,7 +4861,7 @@ function mt(i, n, e = 864e5) {
|
|
|
4824
4861
|
yield new Date(s), s += e;
|
|
4825
4862
|
});
|
|
4826
4863
|
}
|
|
4827
|
-
function
|
|
4864
|
+
function et(i, n = 864e5) {
|
|
4828
4865
|
if (n <= 1)
|
|
4829
4866
|
throw new b(
|
|
4830
4867
|
"Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
|
|
@@ -4835,14 +4872,14 @@ function Ue(i, n = 864e5) {
|
|
|
4835
4872
|
);
|
|
4836
4873
|
return i = new Date(i), new Date(Math.floor(i.getTime() / n) * n);
|
|
4837
4874
|
}
|
|
4838
|
-
function
|
|
4875
|
+
function _t(i, n = 0) {
|
|
4839
4876
|
i = new Date(i);
|
|
4840
4877
|
const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
|
|
4841
|
-
return
|
|
4878
|
+
return et(new Date(s));
|
|
4842
4879
|
}
|
|
4843
|
-
var
|
|
4844
|
-
|
|
4845
|
-
class
|
|
4880
|
+
var Ae;
|
|
4881
|
+
Ae = Symbol.toStringTag;
|
|
4882
|
+
class Ye {
|
|
4846
4883
|
/**
|
|
4847
4884
|
* Initializes a new instance of the {@link GameLoop} class.
|
|
4848
4885
|
*
|
|
@@ -4899,8 +4936,8 @@ class Je {
|
|
|
4899
4936
|
* {@link cancelAnimationFrame} or the {@link clearInterval} function.
|
|
4900
4937
|
*/
|
|
4901
4938
|
a(this, "_stop");
|
|
4902
|
-
a(this,
|
|
4903
|
-
this._startTime = 0, this._isRunning = !1,
|
|
4939
|
+
a(this, Ae, "GameLoop");
|
|
4940
|
+
this._startTime = 0, this._isRunning = !1, Be ? (this._start = () => {
|
|
4904
4941
|
n(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
4905
4942
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
4906
4943
|
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
@@ -5010,8 +5047,8 @@ class Je {
|
|
|
5010
5047
|
return this._publisher.subscribe("stop", n);
|
|
5011
5048
|
}
|
|
5012
5049
|
}
|
|
5013
|
-
var
|
|
5014
|
-
class yt extends (
|
|
5050
|
+
var Ne, Oe;
|
|
5051
|
+
class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
5015
5052
|
/**
|
|
5016
5053
|
* Initializes a new instance of the {@link Clock} class.
|
|
5017
5054
|
*
|
|
@@ -5028,14 +5065,9 @@ class yt extends (Ne = Je, Ae = Symbol.toStringTag, Ne) {
|
|
|
5028
5065
|
* The interval in milliseconds at which the clock will tick if the environment is not a browser.
|
|
5029
5066
|
* `TimeUnit.Second` by default.
|
|
5030
5067
|
*/
|
|
5031
|
-
constructor(e =
|
|
5068
|
+
constructor(e = R.Second) {
|
|
5032
5069
|
super((t) => this._publisher.publish("tick", t), e);
|
|
5033
|
-
|
|
5034
|
-
* The {@link Publisher} object that will be used to publish the events of the clock.
|
|
5035
|
-
*/
|
|
5036
|
-
a(this, "_publisher");
|
|
5037
|
-
a(this, Ae, "Clock");
|
|
5038
|
-
this._publisher = new v();
|
|
5070
|
+
a(this, Ne, "Clock");
|
|
5039
5071
|
}
|
|
5040
5072
|
/**
|
|
5041
5073
|
* Starts the execution of the clock.
|
|
@@ -5114,8 +5146,8 @@ class yt extends (Ne = Je, Ae = Symbol.toStringTag, Ne) {
|
|
|
5114
5146
|
});
|
|
5115
5147
|
}
|
|
5116
5148
|
}
|
|
5117
|
-
var
|
|
5118
|
-
class
|
|
5149
|
+
var $e, qe;
|
|
5150
|
+
class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
5119
5151
|
/**
|
|
5120
5152
|
* Initializes a new instance of the {@link Countdown} class.
|
|
5121
5153
|
*
|
|
@@ -5135,15 +5167,11 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5135
5167
|
* The interval in milliseconds at which the countdown will tick if the environment is not a browser.
|
|
5136
5168
|
* `TimeUnit.Second` by default.
|
|
5137
5169
|
*/
|
|
5138
|
-
constructor(e, t =
|
|
5170
|
+
constructor(e, t = R.Second) {
|
|
5139
5171
|
super(() => {
|
|
5140
5172
|
const r = this.remainingTime;
|
|
5141
5173
|
r <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", r);
|
|
5142
5174
|
}, t);
|
|
5143
|
-
/**
|
|
5144
|
-
* The {@link Publisher} object that will be used to publish the events of the countdown.
|
|
5145
|
-
*/
|
|
5146
|
-
a(this, "_publisher");
|
|
5147
5175
|
/**
|
|
5148
5176
|
* The total duration of the countdown in milliseconds.
|
|
5149
5177
|
*
|
|
@@ -5155,8 +5183,8 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5155
5183
|
* The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
|
|
5156
5184
|
*/
|
|
5157
5185
|
a(this, "_deferrer");
|
|
5158
|
-
a(this,
|
|
5159
|
-
this.
|
|
5186
|
+
a(this, $e, "Countdown");
|
|
5187
|
+
this._duration = e;
|
|
5160
5188
|
}
|
|
5161
5189
|
/**
|
|
5162
5190
|
* The total duration of the countdown in milliseconds.
|
|
@@ -5216,7 +5244,7 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5216
5244
|
throw new p("The countdown had already stopped or hadn't yet started.");
|
|
5217
5245
|
if (this._deferrer)
|
|
5218
5246
|
throw new g();
|
|
5219
|
-
return this._deferrer = new
|
|
5247
|
+
return this._deferrer = new We(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
|
|
5220
5248
|
}
|
|
5221
5249
|
/**
|
|
5222
5250
|
* Stops the execution of the countdown.
|
|
@@ -5299,7 +5327,7 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5299
5327
|
}
|
|
5300
5328
|
var ze;
|
|
5301
5329
|
ze = Symbol.toStringTag;
|
|
5302
|
-
class
|
|
5330
|
+
class gt {
|
|
5303
5331
|
constructor() {
|
|
5304
5332
|
a(this, ze, "Curve");
|
|
5305
5333
|
}
|
|
@@ -5368,11 +5396,11 @@ class bt {
|
|
|
5368
5396
|
});
|
|
5369
5397
|
}
|
|
5370
5398
|
}
|
|
5371
|
-
var
|
|
5372
|
-
|
|
5373
|
-
const
|
|
5399
|
+
var De;
|
|
5400
|
+
De = Symbol.toStringTag;
|
|
5401
|
+
const P = class P {
|
|
5374
5402
|
constructor() {
|
|
5375
|
-
a(this,
|
|
5403
|
+
a(this, De, "Random");
|
|
5376
5404
|
}
|
|
5377
5405
|
/**
|
|
5378
5406
|
* Generates a random boolean value.
|
|
@@ -5439,33 +5467,33 @@ const F = class F {
|
|
|
5439
5467
|
* @returns A random element from the given array.
|
|
5440
5468
|
*/
|
|
5441
5469
|
static Choice(n) {
|
|
5442
|
-
return n[
|
|
5470
|
+
return n[P.Index(n)];
|
|
5443
5471
|
}
|
|
5444
5472
|
};
|
|
5445
|
-
let
|
|
5446
|
-
function
|
|
5473
|
+
let I = P;
|
|
5474
|
+
function xt(i) {
|
|
5447
5475
|
return new Promise((n) => setTimeout(n, i));
|
|
5448
5476
|
}
|
|
5449
|
-
function
|
|
5477
|
+
function vt() {
|
|
5450
5478
|
return new Promise((i) => requestAnimationFrame(() => i()));
|
|
5451
5479
|
}
|
|
5452
|
-
function
|
|
5480
|
+
function St() {
|
|
5453
5481
|
return new Promise((i) => setTimeout(i));
|
|
5454
5482
|
}
|
|
5455
|
-
function
|
|
5483
|
+
function kt(i, n = "text/javascript") {
|
|
5456
5484
|
return new Promise((e, t) => {
|
|
5457
5485
|
const s = document.createElement("script");
|
|
5458
5486
|
s.async = !0, s.defer = !0, s.src = i, s.type = n, s.onload = (r) => e(), s.onerror = (r) => t(r), document.body.appendChild(s);
|
|
5459
5487
|
});
|
|
5460
5488
|
}
|
|
5461
|
-
function
|
|
5489
|
+
function Tt(...i) {
|
|
5462
5490
|
return new u(function* () {
|
|
5463
5491
|
for (const n of i)
|
|
5464
5492
|
for (const e of n)
|
|
5465
5493
|
yield e;
|
|
5466
5494
|
});
|
|
5467
5495
|
}
|
|
5468
|
-
function
|
|
5496
|
+
function Et(i) {
|
|
5469
5497
|
if (i instanceof Array)
|
|
5470
5498
|
return i.length;
|
|
5471
5499
|
let n = 0;
|
|
@@ -5473,14 +5501,14 @@ function Tt(i) {
|
|
|
5473
5501
|
n += 1;
|
|
5474
5502
|
return n;
|
|
5475
5503
|
}
|
|
5476
|
-
function
|
|
5504
|
+
function Mt(i) {
|
|
5477
5505
|
return new u(function* () {
|
|
5478
5506
|
let n = 0;
|
|
5479
5507
|
for (const e of i)
|
|
5480
5508
|
yield [n, e], n += 1;
|
|
5481
5509
|
});
|
|
5482
5510
|
}
|
|
5483
|
-
function
|
|
5511
|
+
function Rt(i, n, e = 1) {
|
|
5484
5512
|
if (e <= 0)
|
|
5485
5513
|
throw new b(
|
|
5486
5514
|
"Step must be always a positive number, even when generating numbers in reverse order."
|
|
@@ -5493,7 +5521,7 @@ function Mt(i, n, e = 1) {
|
|
|
5493
5521
|
yield t;
|
|
5494
5522
|
});
|
|
5495
5523
|
}
|
|
5496
|
-
function
|
|
5524
|
+
function Ft(i) {
|
|
5497
5525
|
const n = Array.from(i);
|
|
5498
5526
|
for (let e = n.length - 1; e > 0; e -= 1) {
|
|
5499
5527
|
const t = Math.floor(Math.random() * (e + 1));
|
|
@@ -5501,14 +5529,14 @@ function Rt(i) {
|
|
|
5501
5529
|
}
|
|
5502
5530
|
return n;
|
|
5503
5531
|
}
|
|
5504
|
-
function
|
|
5532
|
+
function Ct(i) {
|
|
5505
5533
|
return new u(function* () {
|
|
5506
5534
|
const n = /* @__PURE__ */ new Set();
|
|
5507
5535
|
for (const e of i)
|
|
5508
5536
|
n.has(e) || (n.add(e), yield e);
|
|
5509
5537
|
});
|
|
5510
5538
|
}
|
|
5511
|
-
function
|
|
5539
|
+
function tt(i, n) {
|
|
5512
5540
|
const e = i[Symbol.iterator](), t = n[Symbol.iterator]();
|
|
5513
5541
|
return new u(function* () {
|
|
5514
5542
|
for (; ; ) {
|
|
@@ -5529,7 +5557,7 @@ function Pt(i, n) {
|
|
|
5529
5557
|
return r / o;
|
|
5530
5558
|
}
|
|
5531
5559
|
let e = 0, t = 0, s = 0;
|
|
5532
|
-
for (const [r, o] of
|
|
5560
|
+
for (const [r, o] of tt(i, n)) {
|
|
5533
5561
|
if (o <= 0)
|
|
5534
5562
|
throw new d(`The weight for the value #${s} must be greater than zero.`);
|
|
5535
5563
|
e += r * o, t += o, s += 1;
|
|
@@ -5540,7 +5568,7 @@ function Pt(i, n) {
|
|
|
5540
5568
|
throw new d("The sum of weights must be greater than zero.");
|
|
5541
5569
|
return e / t;
|
|
5542
5570
|
}
|
|
5543
|
-
function
|
|
5571
|
+
function jt(i) {
|
|
5544
5572
|
let n = 0;
|
|
5545
5573
|
for (let e = 0; e < i.length; e += 1) {
|
|
5546
5574
|
const t = i.charCodeAt(e);
|
|
@@ -5548,76 +5576,76 @@ function Ct(i) {
|
|
|
5548
5576
|
}
|
|
5549
5577
|
return n;
|
|
5550
5578
|
}
|
|
5551
|
-
function
|
|
5579
|
+
function It(i) {
|
|
5552
5580
|
let n = 0;
|
|
5553
5581
|
for (const e of i)
|
|
5554
5582
|
n += e;
|
|
5555
5583
|
return n;
|
|
5556
5584
|
}
|
|
5557
|
-
function
|
|
5585
|
+
function At(i) {
|
|
5558
5586
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
5559
5587
|
}
|
|
5560
|
-
const
|
|
5588
|
+
const Nt = "2.1.4";
|
|
5561
5589
|
export {
|
|
5562
|
-
|
|
5590
|
+
M as AggregatedAsyncIterator,
|
|
5563
5591
|
x as AggregatedIterator,
|
|
5564
|
-
|
|
5592
|
+
Xe as CallableObject,
|
|
5565
5593
|
yt as Clock,
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5594
|
+
bt as Countdown,
|
|
5595
|
+
gt as Curve,
|
|
5596
|
+
We as DeferredPromise,
|
|
5597
|
+
Ke as EnvironmentException,
|
|
5570
5598
|
c as Exception,
|
|
5571
5599
|
g as FatalErrorException,
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5600
|
+
Je as FileException,
|
|
5601
|
+
it as FileExistsException,
|
|
5602
|
+
ot as FileNotFoundException,
|
|
5603
|
+
Ye as GameLoop,
|
|
5604
|
+
dt as JSONStorage,
|
|
5605
|
+
_ as KeyException,
|
|
5606
|
+
ht as MapView,
|
|
5607
|
+
at as NetworkException,
|
|
5608
|
+
Ge as NotImplementedException,
|
|
5609
|
+
lt as PermissionException,
|
|
5582
5610
|
v as Publisher,
|
|
5583
|
-
|
|
5611
|
+
I as Random,
|
|
5584
5612
|
b as RangeException,
|
|
5585
5613
|
h as ReducedIterator,
|
|
5586
|
-
|
|
5614
|
+
E as ReferenceException,
|
|
5587
5615
|
p as RuntimeException,
|
|
5588
|
-
|
|
5616
|
+
ft as SetView,
|
|
5589
5617
|
f as SmartAsyncIterator,
|
|
5590
5618
|
u as SmartIterator,
|
|
5591
5619
|
k as SmartPromise,
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5620
|
+
ct as SwitchableCallback,
|
|
5621
|
+
R as TimeUnit,
|
|
5622
|
+
wt as TimedPromise,
|
|
5623
|
+
He as TimeoutException,
|
|
5624
|
+
ut as TypeException,
|
|
5625
|
+
Nt as VERSION,
|
|
5598
5626
|
d as ValueException,
|
|
5599
|
-
|
|
5627
|
+
Ue as WeekDay,
|
|
5600
5628
|
Pt as average,
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5629
|
+
At as capitalize,
|
|
5630
|
+
Tt as chain,
|
|
5631
|
+
Et as count,
|
|
5632
|
+
mt as dateDifference,
|
|
5633
|
+
pt as dateRange,
|
|
5634
|
+
et as dateRound,
|
|
5635
|
+
xt as delay,
|
|
5636
|
+
Mt as enumerate,
|
|
5637
|
+
_t as getWeek,
|
|
5638
|
+
jt as hash,
|
|
5639
|
+
Be as isBrowser,
|
|
5640
|
+
st as isNode,
|
|
5641
|
+
rt as isWorker,
|
|
5642
|
+
kt as loadScript,
|
|
5643
|
+
vt as nextAnimationFrame,
|
|
5644
|
+
Rt as range,
|
|
5645
|
+
Ft as shuffle,
|
|
5646
|
+
It as sum,
|
|
5647
|
+
Ct as unique,
|
|
5648
|
+
St as yieldToEventLoop,
|
|
5649
|
+
tt as zip
|
|
5622
5650
|
};
|
|
5623
5651
|
//# sourceMappingURL=core.esm.js.map
|