@byloth/core 2.1.3 → 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 +249 -220
- 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 +5 -5
- 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/publisher.ts +76 -9
- 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/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/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 (
|
|
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 (q = c, $ = Symbol.toStringTag, q) {
|
|
|
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, z = 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 (U = c, Z = Symbol.toStringTag, U) {
|
|
|
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 E extends (
|
|
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 E extends (ee = c, W = 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
|
/**
|
|
@@ -2296,14 +2296,14 @@ const w = class w {
|
|
|
2296
2296
|
}
|
|
2297
2297
|
};
|
|
2298
2298
|
let M = w;
|
|
2299
|
-
var
|
|
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* () {
|
|
@@ -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.
|
|
@@ -3754,11 +3791,12 @@ class v {
|
|
|
3754
3791
|
throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
|
|
3755
3792
|
t.splice(s, 1), t.length === 0 && this._subscribers.delete(n);
|
|
3756
3793
|
}
|
|
3757
|
-
}
|
|
3758
|
-
const Xe = () => {
|
|
3759
3794
|
};
|
|
3760
|
-
|
|
3761
|
-
|
|
3795
|
+
let v = F;
|
|
3796
|
+
const Ze = () => {
|
|
3797
|
+
};
|
|
3798
|
+
var ve, Se;
|
|
3799
|
+
class ct extends (Se = Xe, ve = Symbol.toStringTag, Se) {
|
|
3762
3800
|
constructor(e, t = "default") {
|
|
3763
3801
|
super();
|
|
3764
3802
|
/**
|
|
@@ -3791,9 +3829,9 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3791
3829
|
* The function that will be called by the extended class when the object is invoked as a function.
|
|
3792
3830
|
*/
|
|
3793
3831
|
a(this, "_invoke");
|
|
3794
|
-
a(this,
|
|
3832
|
+
a(this, ve, "SwitchableCallback");
|
|
3795
3833
|
this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, e ? this._callbacks.set(t, e) : (t = "", e = () => {
|
|
3796
|
-
throw new
|
|
3834
|
+
throw new Ge(
|
|
3797
3835
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3798
3836
|
);
|
|
3799
3837
|
}), this._key = t, this._callback = e, this._invoke = (...s) => this._callback(...s);
|
|
@@ -3838,14 +3876,14 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3838
3876
|
enable(e) {
|
|
3839
3877
|
if (e === void 0) {
|
|
3840
3878
|
if (!this._key)
|
|
3841
|
-
throw new
|
|
3879
|
+
throw new _(
|
|
3842
3880
|
"The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
|
|
3843
3881
|
);
|
|
3844
3882
|
e = this._key;
|
|
3845
3883
|
} else if (e) {
|
|
3846
3884
|
if (!this._callbacks.has(e))
|
|
3847
|
-
throw new
|
|
3848
|
-
} 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.");
|
|
3849
3887
|
if (this._isEnabled)
|
|
3850
3888
|
throw new p("The `SwitchableCallback` is already enabled.");
|
|
3851
3889
|
this._callback = this._callbacks.get(e), this._isEnabled = !0;
|
|
@@ -3866,7 +3904,7 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3866
3904
|
disable() {
|
|
3867
3905
|
if (!this._isEnabled)
|
|
3868
3906
|
throw new p("The `SwitchableCallback` is already disabled.");
|
|
3869
|
-
this._callback =
|
|
3907
|
+
this._callback = Ze, this._isEnabled = !1;
|
|
3870
3908
|
}
|
|
3871
3909
|
/**
|
|
3872
3910
|
* Registers a new implementation for the callback.
|
|
@@ -3892,7 +3930,7 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3892
3930
|
if (this._callbacks.size === 0)
|
|
3893
3931
|
this._key = e, this._callback = t;
|
|
3894
3932
|
else if (this._callbacks.has(e))
|
|
3895
|
-
throw new
|
|
3933
|
+
throw new _(`The key '${e}' has already been used for another callback.`);
|
|
3896
3934
|
this._callbacks.set(e, t);
|
|
3897
3935
|
}
|
|
3898
3936
|
/**
|
|
@@ -3915,9 +3953,9 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3915
3953
|
*/
|
|
3916
3954
|
unregister(e) {
|
|
3917
3955
|
if (this._key === e)
|
|
3918
|
-
throw new
|
|
3956
|
+
throw new _("Unable to unregister the currently selected callback.");
|
|
3919
3957
|
if (!this._callbacks.has(e))
|
|
3920
|
-
throw new
|
|
3958
|
+
throw new _(`The key '${e}' doesn't yet have any associated callback.`);
|
|
3921
3959
|
this._callbacks.delete(e);
|
|
3922
3960
|
}
|
|
3923
3961
|
/**
|
|
@@ -3940,12 +3978,12 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
|
|
|
3940
3978
|
*/
|
|
3941
3979
|
switch(e) {
|
|
3942
3980
|
if (!this._callbacks.has(e))
|
|
3943
|
-
throw new
|
|
3981
|
+
throw new _(`The key '${e}' doesn't yet have any associated callback.`);
|
|
3944
3982
|
this._key !== e && (this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e)));
|
|
3945
3983
|
}
|
|
3946
3984
|
}
|
|
3947
|
-
var
|
|
3948
|
-
class
|
|
3985
|
+
var ke, Te;
|
|
3986
|
+
class ht extends (Te = Map, ke = Symbol.toStringTag, Te) {
|
|
3949
3987
|
/**
|
|
3950
3988
|
* Initializes a new instance of the {@link MapView} class.
|
|
3951
3989
|
*
|
|
@@ -3966,7 +4004,7 @@ class ct extends (ke = Map, Se = Symbol.toStringTag, ke) {
|
|
|
3966
4004
|
* The internal {@link Publisher} instance used to publish events.
|
|
3967
4005
|
*/
|
|
3968
4006
|
a(this, "_publisher");
|
|
3969
|
-
a(this,
|
|
4007
|
+
a(this, ke, "MapView");
|
|
3970
4008
|
if (this._publisher = new v(), e)
|
|
3971
4009
|
for (const [t, s] of e)
|
|
3972
4010
|
this.set(t, s);
|
|
@@ -4098,8 +4136,8 @@ class ct extends (ke = Map, Se = Symbol.toStringTag, ke) {
|
|
|
4098
4136
|
this._publisher.unsubscribe(e, t);
|
|
4099
4137
|
}
|
|
4100
4138
|
}
|
|
4101
|
-
var
|
|
4102
|
-
class
|
|
4139
|
+
var Ee, Me;
|
|
4140
|
+
class ft extends (Me = Set, Ee = Symbol.toStringTag, Me) {
|
|
4103
4141
|
/**
|
|
4104
4142
|
* Initializes a new instance of the {@link SetView} class.
|
|
4105
4143
|
*
|
|
@@ -4120,7 +4158,7 @@ class ht extends (Ee = Set, Te = Symbol.toStringTag, Ee) {
|
|
|
4120
4158
|
* The internal {@link Publisher} instance used to publish events.
|
|
4121
4159
|
*/
|
|
4122
4160
|
a(this, "_publisher");
|
|
4123
|
-
a(this,
|
|
4161
|
+
a(this, Ee, "SetView");
|
|
4124
4162
|
if (this._publisher = new v(), e)
|
|
4125
4163
|
for (const t of e)
|
|
4126
4164
|
this.add(t);
|
|
@@ -4251,9 +4289,9 @@ class ht extends (Ee = Set, Te = Symbol.toStringTag, Ee) {
|
|
|
4251
4289
|
this._publisher.unsubscribe(e, t);
|
|
4252
4290
|
}
|
|
4253
4291
|
}
|
|
4254
|
-
var
|
|
4255
|
-
|
|
4256
|
-
class
|
|
4292
|
+
var Re;
|
|
4293
|
+
Re = Symbol.toStringTag;
|
|
4294
|
+
class dt {
|
|
4257
4295
|
/**
|
|
4258
4296
|
* Initializes a new instance of the {@link JSONStorage} class.
|
|
4259
4297
|
* It cannot be instantiated outside of a browser environment or an {@link EnvironmentException} is thrown.
|
|
@@ -4287,9 +4325,9 @@ class ft {
|
|
|
4287
4325
|
* A reference to the persistent {@link localStorage} storage.
|
|
4288
4326
|
*/
|
|
4289
4327
|
a(this, "_persistent");
|
|
4290
|
-
a(this,
|
|
4291
|
-
if (!
|
|
4292
|
-
throw new
|
|
4328
|
+
a(this, Re, "JSONStorage");
|
|
4329
|
+
if (!Be)
|
|
4330
|
+
throw new Ke(
|
|
4293
4331
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
4294
4332
|
);
|
|
4295
4333
|
this._preferPersistence = n, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
|
|
@@ -4561,9 +4599,9 @@ class ft {
|
|
|
4561
4599
|
this._volatile.removeItem(n), this._persistent.removeItem(n);
|
|
4562
4600
|
}
|
|
4563
4601
|
}
|
|
4564
|
-
var
|
|
4565
|
-
|
|
4566
|
-
const
|
|
4602
|
+
var Fe;
|
|
4603
|
+
Fe = Symbol.toStringTag;
|
|
4604
|
+
const C = class C {
|
|
4567
4605
|
/**
|
|
4568
4606
|
* Initializes a new instance of the {@link SmartPromise} class.
|
|
4569
4607
|
*
|
|
@@ -4609,7 +4647,7 @@ const F = class F {
|
|
|
4609
4647
|
* The native {@link Promise} object wrapped by this instance.
|
|
4610
4648
|
*/
|
|
4611
4649
|
a(this, "_promise");
|
|
4612
|
-
a(this,
|
|
4650
|
+
a(this, Fe, "SmartPromise");
|
|
4613
4651
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
4614
4652
|
const e = (s) => (this._isPending = !1, this._isFulfilled = !0, s), t = (s) => {
|
|
4615
4653
|
throw this._isPending = !1, this._isRejected = !0, s;
|
|
@@ -4640,7 +4678,7 @@ const F = class F {
|
|
|
4640
4678
|
* @returns A new {@link SmartPromise} object that wraps the provided promise.
|
|
4641
4679
|
*/
|
|
4642
4680
|
static FromPromise(n) {
|
|
4643
|
-
return new
|
|
4681
|
+
return new C((e, t) => n.then(e, t));
|
|
4644
4682
|
}
|
|
4645
4683
|
/**
|
|
4646
4684
|
* A flag indicating whether the promise is still pending or not.
|
|
@@ -4696,9 +4734,9 @@ const F = class F {
|
|
|
4696
4734
|
return this._promise.finally(n);
|
|
4697
4735
|
}
|
|
4698
4736
|
};
|
|
4699
|
-
let k =
|
|
4700
|
-
var
|
|
4701
|
-
class
|
|
4737
|
+
let k = C;
|
|
4738
|
+
var Ce, Pe;
|
|
4739
|
+
class We extends (Pe = k, Ce = Symbol.toStringTag, Pe) {
|
|
4702
4740
|
/**
|
|
4703
4741
|
* Initializes a new instance of the {@link DeferredPromise} class.
|
|
4704
4742
|
*
|
|
@@ -4733,7 +4771,7 @@ class Ze extends (Pe = k, Fe = Symbol.toStringTag, Pe) {
|
|
|
4733
4771
|
* If you're looking for the public and readonly property, use the {@link DeferredPromise.reject} getter instead.
|
|
4734
4772
|
*/
|
|
4735
4773
|
a(this, "_reject");
|
|
4736
|
-
a(this,
|
|
4774
|
+
a(this, Ce, "DeferredPromise");
|
|
4737
4775
|
this._promise = this._promise.then(e, t), this._resolve = s, this._reject = r;
|
|
4738
4776
|
}
|
|
4739
4777
|
/**
|
|
@@ -4772,8 +4810,8 @@ class Ze extends (Pe = k, Fe = Symbol.toStringTag, Pe) {
|
|
|
4772
4810
|
return e.then(this.resolve, this.reject), this;
|
|
4773
4811
|
}
|
|
4774
4812
|
}
|
|
4775
|
-
var
|
|
4776
|
-
class
|
|
4813
|
+
var je, Ie;
|
|
4814
|
+
class wt extends (Ie = k, je = Symbol.toStringTag, Ie) {
|
|
4777
4815
|
/**
|
|
4778
4816
|
* Initializes a new instance of the {@link TimedPromise} class.
|
|
4779
4817
|
*
|
|
@@ -4799,21 +4837,21 @@ class dt extends (je = k, Ce = Symbol.toStringTag, je) {
|
|
|
4799
4837
|
constructor(e, t) {
|
|
4800
4838
|
super((s, r) => {
|
|
4801
4839
|
const o = (T) => {
|
|
4802
|
-
clearTimeout(
|
|
4840
|
+
clearTimeout(j), s(T);
|
|
4803
4841
|
}, l = (T) => {
|
|
4804
|
-
clearTimeout(
|
|
4805
|
-
},
|
|
4842
|
+
clearTimeout(j), r(T);
|
|
4843
|
+
}, j = setTimeout(() => l(new He("The operation has timed out.")), t);
|
|
4806
4844
|
e(o, l);
|
|
4807
4845
|
});
|
|
4808
|
-
a(this,
|
|
4846
|
+
a(this, je, "TimedPromise");
|
|
4809
4847
|
}
|
|
4810
4848
|
}
|
|
4811
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 || {});
|
|
4812
|
-
function
|
|
4850
|
+
function mt(i, n, e = 864e5) {
|
|
4813
4851
|
let t;
|
|
4814
4852
|
return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
|
|
4815
4853
|
}
|
|
4816
|
-
function
|
|
4854
|
+
function pt(i, n, e = 864e5) {
|
|
4817
4855
|
if (i = new Date(i), n = new Date(n), i >= n)
|
|
4818
4856
|
throw new b("The end date must be greater than the start date.");
|
|
4819
4857
|
return new u(function* () {
|
|
@@ -4823,7 +4861,7 @@ function mt(i, n, e = 864e5) {
|
|
|
4823
4861
|
yield new Date(s), s += e;
|
|
4824
4862
|
});
|
|
4825
4863
|
}
|
|
4826
|
-
function
|
|
4864
|
+
function et(i, n = 864e5) {
|
|
4827
4865
|
if (n <= 1)
|
|
4828
4866
|
throw new b(
|
|
4829
4867
|
"Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
|
|
@@ -4834,14 +4872,14 @@ function We(i, n = 864e5) {
|
|
|
4834
4872
|
);
|
|
4835
4873
|
return i = new Date(i), new Date(Math.floor(i.getTime() / n) * n);
|
|
4836
4874
|
}
|
|
4837
|
-
function
|
|
4875
|
+
function _t(i, n = 0) {
|
|
4838
4876
|
i = new Date(i);
|
|
4839
4877
|
const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
|
|
4840
|
-
return
|
|
4878
|
+
return et(new Date(s));
|
|
4841
4879
|
}
|
|
4842
|
-
var
|
|
4843
|
-
|
|
4844
|
-
class
|
|
4880
|
+
var Ae;
|
|
4881
|
+
Ae = Symbol.toStringTag;
|
|
4882
|
+
class Ye {
|
|
4845
4883
|
/**
|
|
4846
4884
|
* Initializes a new instance of the {@link GameLoop} class.
|
|
4847
4885
|
*
|
|
@@ -4898,8 +4936,8 @@ class Je {
|
|
|
4898
4936
|
* {@link cancelAnimationFrame} or the {@link clearInterval} function.
|
|
4899
4937
|
*/
|
|
4900
4938
|
a(this, "_stop");
|
|
4901
|
-
a(this,
|
|
4902
|
-
this._startTime = 0, this._isRunning = !1,
|
|
4939
|
+
a(this, Ae, "GameLoop");
|
|
4940
|
+
this._startTime = 0, this._isRunning = !1, Be ? (this._start = () => {
|
|
4903
4941
|
n(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
4904
4942
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
4905
4943
|
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
@@ -5009,8 +5047,8 @@ class Je {
|
|
|
5009
5047
|
return this._publisher.subscribe("stop", n);
|
|
5010
5048
|
}
|
|
5011
5049
|
}
|
|
5012
|
-
var
|
|
5013
|
-
class yt extends (
|
|
5050
|
+
var Ne, Oe;
|
|
5051
|
+
class yt extends (Oe = Ye, Ne = Symbol.toStringTag, Oe) {
|
|
5014
5052
|
/**
|
|
5015
5053
|
* Initializes a new instance of the {@link Clock} class.
|
|
5016
5054
|
*
|
|
@@ -5029,12 +5067,7 @@ class yt extends (Ne = Je, Ae = Symbol.toStringTag, Ne) {
|
|
|
5029
5067
|
*/
|
|
5030
5068
|
constructor(e = R.Second) {
|
|
5031
5069
|
super((t) => this._publisher.publish("tick", t), e);
|
|
5032
|
-
|
|
5033
|
-
* The {@link Publisher} object that will be used to publish the events of the clock.
|
|
5034
|
-
*/
|
|
5035
|
-
a(this, "_publisher");
|
|
5036
|
-
a(this, Ae, "Clock");
|
|
5037
|
-
this._publisher = new v();
|
|
5070
|
+
a(this, Ne, "Clock");
|
|
5038
5071
|
}
|
|
5039
5072
|
/**
|
|
5040
5073
|
* Starts the execution of the clock.
|
|
@@ -5113,8 +5146,8 @@ class yt extends (Ne = Je, Ae = Symbol.toStringTag, Ne) {
|
|
|
5113
5146
|
});
|
|
5114
5147
|
}
|
|
5115
5148
|
}
|
|
5116
|
-
var
|
|
5117
|
-
class
|
|
5149
|
+
var $e, qe;
|
|
5150
|
+
class bt extends (qe = Ye, $e = Symbol.toStringTag, qe) {
|
|
5118
5151
|
/**
|
|
5119
5152
|
* Initializes a new instance of the {@link Countdown} class.
|
|
5120
5153
|
*
|
|
@@ -5139,10 +5172,6 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5139
5172
|
const r = this.remainingTime;
|
|
5140
5173
|
r <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", r);
|
|
5141
5174
|
}, t);
|
|
5142
|
-
/**
|
|
5143
|
-
* The {@link Publisher} object that will be used to publish the events of the countdown.
|
|
5144
|
-
*/
|
|
5145
|
-
a(this, "_publisher");
|
|
5146
5175
|
/**
|
|
5147
5176
|
* The total duration of the countdown in milliseconds.
|
|
5148
5177
|
*
|
|
@@ -5154,8 +5183,8 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5154
5183
|
* The {@link DeferredPromise} that will be resolved or rejected when the countdown expires or stops.
|
|
5155
5184
|
*/
|
|
5156
5185
|
a(this, "_deferrer");
|
|
5157
|
-
a(this,
|
|
5158
|
-
this.
|
|
5186
|
+
a(this, $e, "Countdown");
|
|
5187
|
+
this._duration = e;
|
|
5159
5188
|
}
|
|
5160
5189
|
/**
|
|
5161
5190
|
* The total duration of the countdown in milliseconds.
|
|
@@ -5215,7 +5244,7 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5215
5244
|
throw new p("The countdown had already stopped or hadn't yet started.");
|
|
5216
5245
|
if (this._deferrer)
|
|
5217
5246
|
throw new g();
|
|
5218
|
-
return this._deferrer = new
|
|
5247
|
+
return this._deferrer = new We(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
|
|
5219
5248
|
}
|
|
5220
5249
|
/**
|
|
5221
5250
|
* Stops the execution of the countdown.
|
|
@@ -5296,11 +5325,11 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
|
|
|
5296
5325
|
});
|
|
5297
5326
|
}
|
|
5298
5327
|
}
|
|
5299
|
-
var
|
|
5300
|
-
|
|
5301
|
-
class
|
|
5328
|
+
var ze;
|
|
5329
|
+
ze = Symbol.toStringTag;
|
|
5330
|
+
class gt {
|
|
5302
5331
|
constructor() {
|
|
5303
|
-
a(this,
|
|
5332
|
+
a(this, ze, "Curve");
|
|
5304
5333
|
}
|
|
5305
5334
|
/**
|
|
5306
5335
|
* Generates a given number of values following a linear curve.
|
|
@@ -5367,11 +5396,11 @@ class bt {
|
|
|
5367
5396
|
});
|
|
5368
5397
|
}
|
|
5369
5398
|
}
|
|
5370
|
-
var
|
|
5371
|
-
|
|
5399
|
+
var De;
|
|
5400
|
+
De = Symbol.toStringTag;
|
|
5372
5401
|
const P = class P {
|
|
5373
5402
|
constructor() {
|
|
5374
|
-
a(this,
|
|
5403
|
+
a(this, De, "Random");
|
|
5375
5404
|
}
|
|
5376
5405
|
/**
|
|
5377
5406
|
* Generates a random boolean value.
|
|
@@ -5441,30 +5470,30 @@ const P = class P {
|
|
|
5441
5470
|
return n[P.Index(n)];
|
|
5442
5471
|
}
|
|
5443
5472
|
};
|
|
5444
|
-
let
|
|
5445
|
-
function
|
|
5473
|
+
let I = P;
|
|
5474
|
+
function xt(i) {
|
|
5446
5475
|
return new Promise((n) => setTimeout(n, i));
|
|
5447
5476
|
}
|
|
5448
|
-
function
|
|
5477
|
+
function vt() {
|
|
5449
5478
|
return new Promise((i) => requestAnimationFrame(() => i()));
|
|
5450
5479
|
}
|
|
5451
|
-
function
|
|
5480
|
+
function St() {
|
|
5452
5481
|
return new Promise((i) => setTimeout(i));
|
|
5453
5482
|
}
|
|
5454
|
-
function
|
|
5483
|
+
function kt(i, n = "text/javascript") {
|
|
5455
5484
|
return new Promise((e, t) => {
|
|
5456
5485
|
const s = document.createElement("script");
|
|
5457
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);
|
|
5458
5487
|
});
|
|
5459
5488
|
}
|
|
5460
|
-
function
|
|
5489
|
+
function Tt(...i) {
|
|
5461
5490
|
return new u(function* () {
|
|
5462
5491
|
for (const n of i)
|
|
5463
5492
|
for (const e of n)
|
|
5464
5493
|
yield e;
|
|
5465
5494
|
});
|
|
5466
5495
|
}
|
|
5467
|
-
function
|
|
5496
|
+
function Et(i) {
|
|
5468
5497
|
if (i instanceof Array)
|
|
5469
5498
|
return i.length;
|
|
5470
5499
|
let n = 0;
|
|
@@ -5472,14 +5501,14 @@ function Tt(i) {
|
|
|
5472
5501
|
n += 1;
|
|
5473
5502
|
return n;
|
|
5474
5503
|
}
|
|
5475
|
-
function
|
|
5504
|
+
function Mt(i) {
|
|
5476
5505
|
return new u(function* () {
|
|
5477
5506
|
let n = 0;
|
|
5478
5507
|
for (const e of i)
|
|
5479
5508
|
yield [n, e], n += 1;
|
|
5480
5509
|
});
|
|
5481
5510
|
}
|
|
5482
|
-
function
|
|
5511
|
+
function Rt(i, n, e = 1) {
|
|
5483
5512
|
if (e <= 0)
|
|
5484
5513
|
throw new b(
|
|
5485
5514
|
"Step must be always a positive number, even when generating numbers in reverse order."
|
|
@@ -5492,7 +5521,7 @@ function Mt(i, n, e = 1) {
|
|
|
5492
5521
|
yield t;
|
|
5493
5522
|
});
|
|
5494
5523
|
}
|
|
5495
|
-
function
|
|
5524
|
+
function Ft(i) {
|
|
5496
5525
|
const n = Array.from(i);
|
|
5497
5526
|
for (let e = n.length - 1; e > 0; e -= 1) {
|
|
5498
5527
|
const t = Math.floor(Math.random() * (e + 1));
|
|
@@ -5500,14 +5529,14 @@ function Rt(i) {
|
|
|
5500
5529
|
}
|
|
5501
5530
|
return n;
|
|
5502
5531
|
}
|
|
5503
|
-
function
|
|
5532
|
+
function Ct(i) {
|
|
5504
5533
|
return new u(function* () {
|
|
5505
5534
|
const n = /* @__PURE__ */ new Set();
|
|
5506
5535
|
for (const e of i)
|
|
5507
5536
|
n.has(e) || (n.add(e), yield e);
|
|
5508
5537
|
});
|
|
5509
5538
|
}
|
|
5510
|
-
function
|
|
5539
|
+
function tt(i, n) {
|
|
5511
5540
|
const e = i[Symbol.iterator](), t = n[Symbol.iterator]();
|
|
5512
5541
|
return new u(function* () {
|
|
5513
5542
|
for (; ; ) {
|
|
@@ -5528,7 +5557,7 @@ function Pt(i, n) {
|
|
|
5528
5557
|
return r / o;
|
|
5529
5558
|
}
|
|
5530
5559
|
let e = 0, t = 0, s = 0;
|
|
5531
|
-
for (const [r, o] of
|
|
5560
|
+
for (const [r, o] of tt(i, n)) {
|
|
5532
5561
|
if (o <= 0)
|
|
5533
5562
|
throw new d(`The weight for the value #${s} must be greater than zero.`);
|
|
5534
5563
|
e += r * o, t += o, s += 1;
|
|
@@ -5539,7 +5568,7 @@ function Pt(i, n) {
|
|
|
5539
5568
|
throw new d("The sum of weights must be greater than zero.");
|
|
5540
5569
|
return e / t;
|
|
5541
5570
|
}
|
|
5542
|
-
function
|
|
5571
|
+
function jt(i) {
|
|
5543
5572
|
let n = 0;
|
|
5544
5573
|
for (let e = 0; e < i.length; e += 1) {
|
|
5545
5574
|
const t = i.charCodeAt(e);
|
|
@@ -5547,76 +5576,76 @@ function Ct(i) {
|
|
|
5547
5576
|
}
|
|
5548
5577
|
return n;
|
|
5549
5578
|
}
|
|
5550
|
-
function
|
|
5579
|
+
function It(i) {
|
|
5551
5580
|
let n = 0;
|
|
5552
5581
|
for (const e of i)
|
|
5553
5582
|
n += e;
|
|
5554
5583
|
return n;
|
|
5555
5584
|
}
|
|
5556
|
-
function
|
|
5585
|
+
function At(i) {
|
|
5557
5586
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
5558
5587
|
}
|
|
5559
|
-
const
|
|
5588
|
+
const Nt = "2.1.4";
|
|
5560
5589
|
export {
|
|
5561
5590
|
M as AggregatedAsyncIterator,
|
|
5562
5591
|
x as AggregatedIterator,
|
|
5563
|
-
|
|
5592
|
+
Xe as CallableObject,
|
|
5564
5593
|
yt as Clock,
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5594
|
+
bt as Countdown,
|
|
5595
|
+
gt as Curve,
|
|
5596
|
+
We as DeferredPromise,
|
|
5597
|
+
Ke as EnvironmentException,
|
|
5569
5598
|
c as Exception,
|
|
5570
5599
|
g as FatalErrorException,
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
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,
|
|
5581
5610
|
v as Publisher,
|
|
5582
|
-
|
|
5611
|
+
I as Random,
|
|
5583
5612
|
b as RangeException,
|
|
5584
5613
|
h as ReducedIterator,
|
|
5585
5614
|
E as ReferenceException,
|
|
5586
5615
|
p as RuntimeException,
|
|
5587
|
-
|
|
5616
|
+
ft as SetView,
|
|
5588
5617
|
f as SmartAsyncIterator,
|
|
5589
5618
|
u as SmartIterator,
|
|
5590
5619
|
k as SmartPromise,
|
|
5591
|
-
|
|
5620
|
+
ct as SwitchableCallback,
|
|
5592
5621
|
R as TimeUnit,
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5622
|
+
wt as TimedPromise,
|
|
5623
|
+
He as TimeoutException,
|
|
5624
|
+
ut as TypeException,
|
|
5625
|
+
Nt as VERSION,
|
|
5597
5626
|
d as ValueException,
|
|
5598
5627
|
Ue as WeekDay,
|
|
5599
5628
|
Pt as average,
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
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
|
|
5621
5650
|
};
|
|
5622
5651
|
//# sourceMappingURL=core.esm.js.map
|