@byloth/core 2.0.0-rc.5 → 2.0.0-rc.7
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.js +230 -242
- package/dist/core.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/models/aggregators/aggregated-async-iterator.ts +1 -6
- package/src/models/aggregators/aggregated-iterator.ts +1 -6
- package/src/models/publisher.ts +18 -11
- package/src/models/timers/clock.ts +19 -14
- package/src/models/timers/countdown.ts +21 -18
package/dist/core.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
var Ae = Object.defineProperty;
|
|
2
2
|
var Oe = (i, t, e) => t in i ? Ae(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var
|
|
4
|
-
const
|
|
3
|
+
var u = (i, t, e) => Oe(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
const Fe = typeof window < "u" && typeof window.document < "u";
|
|
5
|
+
var R;
|
|
6
|
+
const Ve = typeof process < "u" && ((R = process.versions) == null ? void 0 : R.node);
|
|
5
7
|
var P;
|
|
6
|
-
const
|
|
7
|
-
var I;
|
|
8
|
-
|
|
9
|
-
var j, A;
|
|
10
|
-
class c extends (A = Error, j = Symbol.toStringTag, A) {
|
|
8
|
+
const We = typeof self == "object" && ((P = self.constructor) == null ? void 0 : P.name) === "DedicatedWorkerGlobalScope";
|
|
9
|
+
var I, j;
|
|
10
|
+
class c extends (j = Error, I = Symbol.toStringTag, j) {
|
|
11
11
|
constructor(e, n, r = "Exception") {
|
|
12
12
|
super(e);
|
|
13
|
-
|
|
13
|
+
u(this, I, "Exception");
|
|
14
14
|
this.cause = n, this.name = r, n && (n instanceof Error ? this.stack += `
|
|
15
15
|
|
|
16
16
|
Caused by ${n.stack}` : this.stack += `
|
|
@@ -27,120 +27,120 @@ Caused by ${n}`);
|
|
|
27
27
|
return new c(`${e}`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
class
|
|
30
|
+
var A, O;
|
|
31
|
+
class x extends (O = c, A = Symbol.toStringTag, O) {
|
|
32
32
|
constructor(e, n, r = "FatalErrorException") {
|
|
33
33
|
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.");
|
|
34
34
|
super(e, n, r);
|
|
35
|
-
|
|
35
|
+
u(this, A, "FatalErrorException");
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
var
|
|
39
|
-
class Ye extends (
|
|
38
|
+
var C, D;
|
|
39
|
+
class Ye extends (D = x, C = Symbol.toStringTag, D) {
|
|
40
40
|
constructor(e, n, r = "NotImplementedException") {
|
|
41
41
|
e === void 0 && (e = "This feature is not implemented yet. Please, try again later.");
|
|
42
42
|
super(e, n, r);
|
|
43
|
-
|
|
43
|
+
u(this, C, "NotImplementedException");
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
var
|
|
47
|
-
class
|
|
46
|
+
var q, N;
|
|
47
|
+
class Re extends (N = c, q = Symbol.toStringTag, N) {
|
|
48
48
|
constructor(e, n, r = "FileException") {
|
|
49
49
|
super(e, n, r);
|
|
50
|
-
|
|
50
|
+
u(this, q, "FileException");
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
var J
|
|
54
|
-
class ze extends (
|
|
53
|
+
var $, J;
|
|
54
|
+
class ze extends (J = Re, $ = Symbol.toStringTag, J) {
|
|
55
55
|
constructor(e, n, r = "FileExistsException") {
|
|
56
56
|
super(e, n, r);
|
|
57
|
-
|
|
57
|
+
u(this, $, "FileExistsException");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
var
|
|
61
|
-
class Be extends (
|
|
60
|
+
var V, W;
|
|
61
|
+
class Be extends (W = Re, V = Symbol.toStringTag, W) {
|
|
62
62
|
constructor(e, n, r = "FileNotFoundException") {
|
|
63
63
|
super(e, n, r);
|
|
64
|
-
|
|
64
|
+
u(this, V, "FileNotFoundException");
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
var
|
|
68
|
-
class Ge extends (
|
|
67
|
+
var Y, z;
|
|
68
|
+
class Ge extends (z = c, Y = Symbol.toStringTag, z) {
|
|
69
69
|
constructor(e, n, r = "KeyException") {
|
|
70
70
|
super(e, n, r);
|
|
71
|
-
|
|
71
|
+
u(this, Y, "KeyException");
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
var
|
|
75
|
-
class Ke extends (
|
|
74
|
+
var B, G;
|
|
75
|
+
class Ke extends (G = c, B = Symbol.toStringTag, G) {
|
|
76
76
|
constructor(e, n, r = "NetworkException") {
|
|
77
77
|
super(e, n, r);
|
|
78
|
-
|
|
78
|
+
u(this, B, "NetworkException");
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var
|
|
82
|
-
class He extends (
|
|
81
|
+
var K, H;
|
|
82
|
+
class He extends (H = c, K = Symbol.toStringTag, H) {
|
|
83
83
|
constructor(e, n, r = "PermissionException") {
|
|
84
84
|
super(e, n, r);
|
|
85
|
-
|
|
85
|
+
u(this, K, "PermissionException");
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
var
|
|
89
|
-
class Ce extends (
|
|
88
|
+
var L, Q;
|
|
89
|
+
class Ce extends (Q = c, L = Symbol.toStringTag, Q) {
|
|
90
90
|
constructor(e, n, r = "ReferenceException") {
|
|
91
91
|
super(e, n, r);
|
|
92
|
-
|
|
92
|
+
u(this, L, "ReferenceException");
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
var
|
|
96
|
-
class p extends (
|
|
95
|
+
var X, Z;
|
|
96
|
+
class p extends (Z = c, X = Symbol.toStringTag, Z) {
|
|
97
97
|
constructor(e, n, r = "RuntimeException") {
|
|
98
98
|
super(e, n, r);
|
|
99
|
-
|
|
99
|
+
u(this, X, "RuntimeException");
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
var
|
|
103
|
-
class De extends (
|
|
102
|
+
var U, ee;
|
|
103
|
+
class De extends (ee = p, U = Symbol.toStringTag, ee) {
|
|
104
104
|
constructor(e, n, r = "EnvironmentException") {
|
|
105
105
|
super(e, n, r);
|
|
106
|
-
|
|
106
|
+
u(this, U, "EnvironmentException");
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
class qe extends (
|
|
109
|
+
var te, ne;
|
|
110
|
+
class qe extends (ne = c, te = Symbol.toStringTag, ne) {
|
|
111
111
|
constructor(e, n, r = "TimeoutException") {
|
|
112
112
|
super(e, n, r);
|
|
113
|
-
|
|
113
|
+
u(this, te, "TimeoutException");
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
var
|
|
117
|
-
class Le extends (
|
|
116
|
+
var re, se;
|
|
117
|
+
class Le extends (se = c, re = Symbol.toStringTag, se) {
|
|
118
118
|
constructor(e, n, r = "TypeException") {
|
|
119
119
|
super(e, n, r);
|
|
120
|
-
|
|
120
|
+
u(this, re, "TypeException");
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
var
|
|
124
|
-
class d extends (
|
|
123
|
+
var ie, oe;
|
|
124
|
+
class d extends (oe = c, ie = Symbol.toStringTag, oe) {
|
|
125
125
|
constructor(e, n, r = "ValueException") {
|
|
126
126
|
super(e, n, r);
|
|
127
|
-
|
|
127
|
+
u(this, ie, "ValueException");
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
var ue, le;
|
|
131
|
-
class
|
|
131
|
+
class Pe extends (le = d, ue = Symbol.toStringTag, le) {
|
|
132
132
|
constructor(e, n, r = "RangeException") {
|
|
133
133
|
super(e, n, r);
|
|
134
|
-
|
|
134
|
+
u(this, ue, "RangeException");
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
var
|
|
137
|
+
var ae;
|
|
138
138
|
class l {
|
|
139
139
|
constructor(t) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
u(this, "_iterator");
|
|
141
|
+
u(this, "return");
|
|
142
|
+
u(this, "throw");
|
|
143
|
+
u(this, ae, "SmartIterator");
|
|
144
144
|
t instanceof Function ? this._iterator = t() : Symbol.iterator in t ? this._iterator = t[Symbol.iterator]() : this._iterator = t, this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
|
|
145
145
|
}
|
|
146
146
|
every(t) {
|
|
@@ -295,21 +295,21 @@ class l {
|
|
|
295
295
|
return this._iterator.next(...t);
|
|
296
296
|
}
|
|
297
297
|
groupBy(t) {
|
|
298
|
-
return new
|
|
298
|
+
return new g(this.map((e, n) => [t(e, n), e]));
|
|
299
299
|
}
|
|
300
300
|
toArray() {
|
|
301
301
|
return Array.from(this);
|
|
302
302
|
}
|
|
303
|
-
[(
|
|
303
|
+
[(ae = Symbol.toStringTag, Symbol.iterator)]() {
|
|
304
304
|
return this;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
var
|
|
308
|
-
|
|
309
|
-
const
|
|
307
|
+
var ce;
|
|
308
|
+
ce = Symbol.toStringTag;
|
|
309
|
+
const y = class y {
|
|
310
310
|
constructor(t) {
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
u(this, "_elements");
|
|
312
|
+
u(this, ce, "ReducedIterator");
|
|
313
313
|
this._elements = new l(t);
|
|
314
314
|
}
|
|
315
315
|
every(t) {
|
|
@@ -326,14 +326,14 @@ const _ = class _ {
|
|
|
326
326
|
}
|
|
327
327
|
filter(t) {
|
|
328
328
|
const e = this._elements.enumerate();
|
|
329
|
-
return new
|
|
329
|
+
return new y(function* () {
|
|
330
330
|
for (const [n, [r, s]] of e)
|
|
331
331
|
t(r, s, n) && (yield [r, s]);
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
334
|
map(t) {
|
|
335
335
|
const e = this._elements.enumerate();
|
|
336
|
-
return new
|
|
336
|
+
return new y(function* () {
|
|
337
337
|
for (const [n, [r, s]] of e)
|
|
338
338
|
yield [r, t(r, s, n)];
|
|
339
339
|
});
|
|
@@ -352,7 +352,7 @@ const _ = class _ {
|
|
|
352
352
|
}
|
|
353
353
|
flatMap(t) {
|
|
354
354
|
const e = this._elements.enumerate();
|
|
355
|
-
return new
|
|
355
|
+
return new g(function* () {
|
|
356
356
|
for (const [n, [r, s]] of e)
|
|
357
357
|
for (const o of t(r, s, n))
|
|
358
358
|
yield [r, o];
|
|
@@ -360,14 +360,14 @@ const _ = class _ {
|
|
|
360
360
|
}
|
|
361
361
|
drop(t) {
|
|
362
362
|
const e = this._elements.enumerate();
|
|
363
|
-
return new
|
|
363
|
+
return new y(function* () {
|
|
364
364
|
for (const [n, [r, s]] of e)
|
|
365
365
|
n >= t && (yield [r, s]);
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
take(t) {
|
|
369
369
|
const e = this._elements.enumerate();
|
|
370
|
-
return new
|
|
370
|
+
return new y(function* () {
|
|
371
371
|
for (const [n, [r, s]] of e) {
|
|
372
372
|
if (n >= t)
|
|
373
373
|
break;
|
|
@@ -380,7 +380,7 @@ const _ = class _ {
|
|
|
380
380
|
}
|
|
381
381
|
unique() {
|
|
382
382
|
const t = this._elements;
|
|
383
|
-
return new
|
|
383
|
+
return new y(function* () {
|
|
384
384
|
const e = /* @__PURE__ */ new Set();
|
|
385
385
|
for (const [n, r] of t)
|
|
386
386
|
e.has(r) || (e.add(r), yield [n, r]);
|
|
@@ -423,13 +423,13 @@ const _ = class _ {
|
|
|
423
423
|
return Object.fromEntries(this.items());
|
|
424
424
|
}
|
|
425
425
|
};
|
|
426
|
-
let f =
|
|
427
|
-
var
|
|
428
|
-
|
|
426
|
+
let f = y;
|
|
427
|
+
var fe;
|
|
428
|
+
fe = Symbol.toStringTag;
|
|
429
429
|
const m = class m {
|
|
430
430
|
constructor(t) {
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
u(this, "_elements");
|
|
432
|
+
u(this, fe, "AggregatedAsyncIterator");
|
|
433
433
|
this._elements = new h(t);
|
|
434
434
|
}
|
|
435
435
|
async every(t) {
|
|
@@ -477,16 +477,16 @@ const m = class m {
|
|
|
477
477
|
async reduce(t, e) {
|
|
478
478
|
const n = /* @__PURE__ */ new Map();
|
|
479
479
|
for await (const [r, s] of this._elements) {
|
|
480
|
-
let o,
|
|
480
|
+
let o, a;
|
|
481
481
|
if (n.has(r))
|
|
482
|
-
[o,
|
|
482
|
+
[o, a] = n.get(r);
|
|
483
483
|
else if (e !== void 0)
|
|
484
|
-
o = 0,
|
|
484
|
+
o = 0, a = await e(r);
|
|
485
485
|
else {
|
|
486
486
|
n.set(r, [0, s]);
|
|
487
487
|
continue;
|
|
488
488
|
}
|
|
489
|
-
n.set(r, [o + 1, await t(r,
|
|
489
|
+
n.set(r, [o + 1, await t(r, a, s, o)]);
|
|
490
490
|
}
|
|
491
491
|
return new f(function* () {
|
|
492
492
|
for (const [r, [s, o]] of n)
|
|
@@ -498,9 +498,9 @@ const m = class m {
|
|
|
498
498
|
return new m(async function* () {
|
|
499
499
|
const n = /* @__PURE__ */ new Map();
|
|
500
500
|
for await (const [r, s] of e) {
|
|
501
|
-
const o = n.get(r) ?? 0,
|
|
502
|
-
for await (const
|
|
503
|
-
yield [r,
|
|
501
|
+
const o = n.get(r) ?? 0, a = await t(r, s, o);
|
|
502
|
+
for await (const _ of a)
|
|
503
|
+
yield [r, _];
|
|
504
504
|
n.set(r, o + 1);
|
|
505
505
|
}
|
|
506
506
|
});
|
|
@@ -525,12 +525,7 @@ const m = class m {
|
|
|
525
525
|
const n = /* @__PURE__ */ new Map();
|
|
526
526
|
for await (const [r, s] of e) {
|
|
527
527
|
const o = n.get(r) ?? 0;
|
|
528
|
-
|
|
529
|
-
if (n.values().every((u) => u >= t))
|
|
530
|
-
break;
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
yield [r, s], n.set(r, o + 1);
|
|
528
|
+
o >= t || (yield [r, s], n.set(r, o + 1));
|
|
534
529
|
}
|
|
535
530
|
});
|
|
536
531
|
}
|
|
@@ -612,14 +607,14 @@ const m = class m {
|
|
|
612
607
|
return t;
|
|
613
608
|
}
|
|
614
609
|
};
|
|
615
|
-
let
|
|
616
|
-
var
|
|
610
|
+
let k = m;
|
|
611
|
+
var he;
|
|
617
612
|
class h {
|
|
618
613
|
constructor(t) {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
614
|
+
u(this, "_iterator");
|
|
615
|
+
u(this, "return");
|
|
616
|
+
u(this, "throw");
|
|
617
|
+
u(this, he, "SmartAsyncIterator");
|
|
623
618
|
if (t instanceof Function) {
|
|
624
619
|
const e = t();
|
|
625
620
|
Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
|
|
@@ -807,21 +802,21 @@ class h {
|
|
|
807
802
|
return this._iterator.next(...t);
|
|
808
803
|
}
|
|
809
804
|
groupBy(t) {
|
|
810
|
-
return new
|
|
805
|
+
return new k(this.map(async (e, n) => [await t(e, n), e]));
|
|
811
806
|
}
|
|
812
807
|
toArray() {
|
|
813
808
|
return Array.fromAsync(this);
|
|
814
809
|
}
|
|
815
|
-
[(
|
|
810
|
+
[(he = Symbol.toStringTag, Symbol.asyncIterator)]() {
|
|
816
811
|
return this;
|
|
817
812
|
}
|
|
818
813
|
}
|
|
819
|
-
var
|
|
820
|
-
|
|
814
|
+
var de;
|
|
815
|
+
de = Symbol.toStringTag;
|
|
821
816
|
const w = class w {
|
|
822
817
|
constructor(t) {
|
|
823
|
-
|
|
824
|
-
|
|
818
|
+
u(this, "_elements");
|
|
819
|
+
u(this, de, "AggregatedIterator");
|
|
825
820
|
this._elements = new l(t);
|
|
826
821
|
}
|
|
827
822
|
every(t) {
|
|
@@ -869,16 +864,16 @@ const w = class w {
|
|
|
869
864
|
reduce(t, e) {
|
|
870
865
|
const n = /* @__PURE__ */ new Map();
|
|
871
866
|
for (const [r, s] of this._elements) {
|
|
872
|
-
let o,
|
|
867
|
+
let o, a;
|
|
873
868
|
if (n.has(r))
|
|
874
|
-
[o,
|
|
869
|
+
[o, a] = n.get(r);
|
|
875
870
|
else if (e !== void 0)
|
|
876
|
-
o = 0,
|
|
871
|
+
o = 0, a = e(r);
|
|
877
872
|
else {
|
|
878
873
|
n.set(r, [0, s]);
|
|
879
874
|
continue;
|
|
880
875
|
}
|
|
881
|
-
n.set(r, [o + 1, t(r,
|
|
876
|
+
n.set(r, [o + 1, t(r, a, s, o)]);
|
|
882
877
|
}
|
|
883
878
|
return new f(function* () {
|
|
884
879
|
for (const [r, [s, o]] of n)
|
|
@@ -890,9 +885,9 @@ const w = class w {
|
|
|
890
885
|
return new w(function* () {
|
|
891
886
|
const n = /* @__PURE__ */ new Map();
|
|
892
887
|
for (const [r, s] of e) {
|
|
893
|
-
const o = n.get(r) ?? 0,
|
|
894
|
-
for (const
|
|
895
|
-
yield [r,
|
|
888
|
+
const o = n.get(r) ?? 0, a = t(r, s, o);
|
|
889
|
+
for (const _ of a)
|
|
890
|
+
yield [r, _];
|
|
896
891
|
n.set(r, o + 1);
|
|
897
892
|
}
|
|
898
893
|
});
|
|
@@ -917,12 +912,7 @@ const w = class w {
|
|
|
917
912
|
const n = /* @__PURE__ */ new Map();
|
|
918
913
|
for (const [r, s] of e) {
|
|
919
914
|
const o = n.get(r) ?? 0;
|
|
920
|
-
|
|
921
|
-
if (n.values().every((u) => u >= t))
|
|
922
|
-
break;
|
|
923
|
-
continue;
|
|
924
|
-
}
|
|
925
|
-
yield [r, s], n.set(r, o + 1);
|
|
915
|
+
o >= t || (yield [r, s], n.set(r, o + 1));
|
|
926
916
|
}
|
|
927
917
|
});
|
|
928
918
|
}
|
|
@@ -1007,18 +997,18 @@ const w = class w {
|
|
|
1007
997
|
return t;
|
|
1008
998
|
}
|
|
1009
999
|
};
|
|
1010
|
-
let
|
|
1011
|
-
var
|
|
1012
|
-
|
|
1013
|
-
class
|
|
1000
|
+
let g = w;
|
|
1001
|
+
var me;
|
|
1002
|
+
me = Symbol.toStringTag;
|
|
1003
|
+
class Ie {
|
|
1014
1004
|
constructor(t, e = 40) {
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
this._startTime = 0, this._isRunning = !1,
|
|
1005
|
+
u(this, "_handle");
|
|
1006
|
+
u(this, "_startTime");
|
|
1007
|
+
u(this, "_isRunning");
|
|
1008
|
+
u(this, "_start");
|
|
1009
|
+
u(this, "_stop");
|
|
1010
|
+
u(this, me, "GameLoop");
|
|
1011
|
+
this._startTime = 0, this._isRunning = !1, Fe ? (this._start = () => {
|
|
1022
1012
|
t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
|
|
1023
1013
|
}, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
|
|
1024
1014
|
`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
|
|
@@ -1044,19 +1034,19 @@ class je {
|
|
|
1044
1034
|
if (!this._isRunning)
|
|
1045
1035
|
throw new p("The game loop hadn't yet started.");
|
|
1046
1036
|
if (!this._handle)
|
|
1047
|
-
throw new
|
|
1037
|
+
throw new x();
|
|
1048
1038
|
this._stop(), this._handle = void 0, this._isRunning = !1;
|
|
1049
1039
|
}
|
|
1050
1040
|
}
|
|
1051
|
-
var
|
|
1052
|
-
|
|
1041
|
+
var we;
|
|
1042
|
+
we = Symbol.toStringTag;
|
|
1053
1043
|
class Qe {
|
|
1054
1044
|
constructor(t = !0) {
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
if (this._preferPersistence = t, !
|
|
1045
|
+
u(this, "_preferPersistence");
|
|
1046
|
+
u(this, "_volatile");
|
|
1047
|
+
u(this, "_persistent");
|
|
1048
|
+
u(this, we, "JSONStorage");
|
|
1049
|
+
if (this._preferPersistence = t, !Fe)
|
|
1060
1050
|
throw new De(
|
|
1061
1051
|
"The `JSONStorage` class can only be instantiated within a browser environment."
|
|
1062
1052
|
);
|
|
@@ -1192,13 +1182,13 @@ class Qe {
|
|
|
1192
1182
|
}
|
|
1193
1183
|
var ye;
|
|
1194
1184
|
ye = Symbol.toStringTag;
|
|
1195
|
-
const
|
|
1185
|
+
const E = class E {
|
|
1196
1186
|
constructor(t) {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1187
|
+
u(this, "_isPending");
|
|
1188
|
+
u(this, "_isFulfilled");
|
|
1189
|
+
u(this, "_isRejected");
|
|
1190
|
+
u(this, "_promise");
|
|
1191
|
+
u(this, ye, "SmartPromise");
|
|
1202
1192
|
this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
|
|
1203
1193
|
const e = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
|
|
1204
1194
|
throw this._isPending = !1, this._isRejected = !0, r;
|
|
@@ -1206,7 +1196,7 @@ const T = class T {
|
|
|
1206
1196
|
this._promise = new Promise(t).then(e, n);
|
|
1207
1197
|
}
|
|
1208
1198
|
static FromPromise(t) {
|
|
1209
|
-
return new
|
|
1199
|
+
return new E((e, n) => t.then(e, n));
|
|
1210
1200
|
}
|
|
1211
1201
|
get isPending() {
|
|
1212
1202
|
return this._isPending;
|
|
@@ -1227,17 +1217,17 @@ const T = class T {
|
|
|
1227
1217
|
return this._promise.finally(t);
|
|
1228
1218
|
}
|
|
1229
1219
|
};
|
|
1230
|
-
let
|
|
1231
|
-
var pe,
|
|
1232
|
-
class Ne extends (
|
|
1220
|
+
let v = E;
|
|
1221
|
+
var pe, _e;
|
|
1222
|
+
class Ne extends (_e = v, pe = Symbol.toStringTag, _e) {
|
|
1233
1223
|
constructor(e, n) {
|
|
1234
1224
|
let r, s;
|
|
1235
|
-
super((o,
|
|
1236
|
-
r = o, s =
|
|
1225
|
+
super((o, a) => {
|
|
1226
|
+
r = o, s = a;
|
|
1237
1227
|
});
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1228
|
+
u(this, "_resolve");
|
|
1229
|
+
u(this, "_reject");
|
|
1230
|
+
u(this, pe, "DeferredPromise");
|
|
1241
1231
|
this._promise.then(e, n), this._resolve = r, this._reject = s;
|
|
1242
1232
|
}
|
|
1243
1233
|
get resolve() {
|
|
@@ -1250,12 +1240,12 @@ class Ne extends (xe = b, pe = Symbol.toStringTag, xe) {
|
|
|
1250
1240
|
return e.then(this.resolve, this.reject), this;
|
|
1251
1241
|
}
|
|
1252
1242
|
}
|
|
1253
|
-
var
|
|
1254
|
-
|
|
1243
|
+
var xe;
|
|
1244
|
+
xe = Symbol.toStringTag;
|
|
1255
1245
|
class Xe {
|
|
1256
1246
|
constructor() {
|
|
1257
|
-
|
|
1258
|
-
|
|
1247
|
+
u(this, "_onFulfilled");
|
|
1248
|
+
u(this, xe, "Thenable");
|
|
1259
1249
|
this._onFulfilled = (t) => t;
|
|
1260
1250
|
}
|
|
1261
1251
|
_resolve(t) {
|
|
@@ -1304,41 +1294,44 @@ class Xe {
|
|
|
1304
1294
|
return this;
|
|
1305
1295
|
}
|
|
1306
1296
|
}
|
|
1307
|
-
var
|
|
1308
|
-
class Ze extends (
|
|
1297
|
+
var ge, ve;
|
|
1298
|
+
class Ze extends (ve = v, ge = Symbol.toStringTag, ve) {
|
|
1309
1299
|
constructor(e, n) {
|
|
1310
1300
|
super((r, s) => {
|
|
1311
|
-
const o = (
|
|
1312
|
-
clearTimeout(
|
|
1313
|
-
},
|
|
1314
|
-
clearTimeout(
|
|
1315
|
-
},
|
|
1316
|
-
e(o,
|
|
1301
|
+
const o = (b) => {
|
|
1302
|
+
clearTimeout(M), r(b);
|
|
1303
|
+
}, a = (b) => {
|
|
1304
|
+
clearTimeout(M), s(b);
|
|
1305
|
+
}, M = setTimeout(() => a(new qe("The operation has timed out.")), n);
|
|
1306
|
+
e(o, a);
|
|
1317
1307
|
});
|
|
1318
|
-
|
|
1308
|
+
u(this, ge, "TimedPromise");
|
|
1319
1309
|
}
|
|
1320
1310
|
}
|
|
1321
|
-
var
|
|
1322
|
-
|
|
1323
|
-
class
|
|
1311
|
+
var be;
|
|
1312
|
+
be = Symbol.toStringTag;
|
|
1313
|
+
class je {
|
|
1324
1314
|
constructor() {
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
this._subscribers =
|
|
1328
|
-
}
|
|
1329
|
-
subscribe(t) {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1315
|
+
u(this, "_subscribers");
|
|
1316
|
+
u(this, be, "Publisher");
|
|
1317
|
+
this._subscribers = /* @__PURE__ */ new Map();
|
|
1318
|
+
}
|
|
1319
|
+
subscribe(t, e) {
|
|
1320
|
+
this._subscribers.has(t) || this._subscribers.set(t, []);
|
|
1321
|
+
const n = this._subscribers.get(t);
|
|
1322
|
+
return n.push(e), () => {
|
|
1323
|
+
const r = n.indexOf(e);
|
|
1324
|
+
if (r < 0)
|
|
1333
1325
|
throw new Ce("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
|
|
1334
|
-
|
|
1326
|
+
n.splice(r, 1);
|
|
1335
1327
|
};
|
|
1336
1328
|
}
|
|
1337
|
-
publish(...
|
|
1338
|
-
|
|
1329
|
+
publish(t, ...e) {
|
|
1330
|
+
const n = this._subscribers.get(t);
|
|
1331
|
+
return n ? n.slice().map((r) => r(...e)) : [];
|
|
1339
1332
|
}
|
|
1340
1333
|
}
|
|
1341
|
-
var
|
|
1334
|
+
var S = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(S || {});
|
|
1342
1335
|
function Ue(i, t, e = 864e5) {
|
|
1343
1336
|
return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
|
|
1344
1337
|
}
|
|
@@ -1353,58 +1346,53 @@ function et(i, t, e = 864e5) {
|
|
|
1353
1346
|
function tt(i, t = 864e5) {
|
|
1354
1347
|
return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
|
|
1355
1348
|
}
|
|
1356
|
-
var
|
|
1357
|
-
class nt extends (
|
|
1358
|
-
constructor(e =
|
|
1359
|
-
super((n) => this.
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
a(this, Se, "Clock");
|
|
1364
|
-
this._starter = new y(), this._stopper = new y(), this._ticker = new y();
|
|
1349
|
+
var ke, Se;
|
|
1350
|
+
class nt extends (Se = Ie, ke = Symbol.toStringTag, Se) {
|
|
1351
|
+
constructor(e = S.Second) {
|
|
1352
|
+
super((n) => this._publisher.publish("tick", n), e);
|
|
1353
|
+
u(this, "_publisher");
|
|
1354
|
+
u(this, ke, "Clock");
|
|
1355
|
+
this._publisher = new je();
|
|
1365
1356
|
}
|
|
1366
1357
|
start(e = 0) {
|
|
1367
1358
|
if (this._isRunning)
|
|
1368
1359
|
throw new p("The clock has already been started.");
|
|
1369
|
-
super.start(e), this.
|
|
1360
|
+
super.start(e), this._publisher.publish("start");
|
|
1370
1361
|
}
|
|
1371
1362
|
stop() {
|
|
1372
1363
|
if (!this._isRunning)
|
|
1373
1364
|
throw new p("The clock hadn't yet started.");
|
|
1374
|
-
super.stop(), this.
|
|
1365
|
+
super.stop(), this._publisher.publish("stop");
|
|
1375
1366
|
}
|
|
1376
1367
|
onStart(e) {
|
|
1377
|
-
return this.
|
|
1368
|
+
return this._publisher.subscribe("start", e);
|
|
1378
1369
|
}
|
|
1379
1370
|
onStop(e) {
|
|
1380
|
-
return this.
|
|
1371
|
+
return this._publisher.subscribe("stop", e);
|
|
1381
1372
|
}
|
|
1382
1373
|
onTick(e, n = 0) {
|
|
1383
1374
|
if (n < 0)
|
|
1384
|
-
throw new
|
|
1375
|
+
throw new Pe("The tick step must be a non-negative number.");
|
|
1385
1376
|
if (n === 0)
|
|
1386
|
-
return this.
|
|
1377
|
+
return this._publisher.subscribe("tick", e);
|
|
1387
1378
|
let r = 0;
|
|
1388
|
-
return this.
|
|
1379
|
+
return this._publisher.subscribe("tick", (s) => {
|
|
1389
1380
|
s - r < n || (e(s), r = s);
|
|
1390
1381
|
});
|
|
1391
1382
|
}
|
|
1392
1383
|
}
|
|
1393
|
-
var
|
|
1394
|
-
class rt extends (
|
|
1395
|
-
constructor(e, n =
|
|
1384
|
+
var Ee, Te;
|
|
1385
|
+
class rt extends (Te = Ie, Ee = Symbol.toStringTag, Te) {
|
|
1386
|
+
constructor(e, n = S.Second) {
|
|
1396
1387
|
super(() => {
|
|
1397
1388
|
const s = this.remainingTime;
|
|
1398
|
-
this.
|
|
1389
|
+
this._publisher.publish("tick", s), s <= 0 && (this._deferrerStop(), this._publisher.publish("expire"));
|
|
1399
1390
|
}, n);
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
a(this, "_duration");
|
|
1406
|
-
a(this, Te, "Countdown");
|
|
1407
|
-
this._expirer = new y(), this._starter = new y(), this._stopper = new y(), this._ticker = new y(), this._duration = e;
|
|
1391
|
+
u(this, "_deferrer");
|
|
1392
|
+
u(this, "_publisher");
|
|
1393
|
+
u(this, "_duration");
|
|
1394
|
+
u(this, Ee, "Countdown");
|
|
1395
|
+
this._publisher = new je(), this._duration = e;
|
|
1408
1396
|
}
|
|
1409
1397
|
get duration() {
|
|
1410
1398
|
return this._duration;
|
|
@@ -1416,44 +1404,44 @@ class rt extends (Me = je, Te = Symbol.toStringTag, Me) {
|
|
|
1416
1404
|
if (!this._isRunning)
|
|
1417
1405
|
throw new p("The countdown hadn't yet started.");
|
|
1418
1406
|
if (!this._deferrer)
|
|
1419
|
-
throw new
|
|
1407
|
+
throw new x();
|
|
1420
1408
|
super.stop(), e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
|
|
1421
1409
|
}
|
|
1422
1410
|
start(e = this.duration) {
|
|
1423
1411
|
if (this._isRunning)
|
|
1424
1412
|
throw new p("The countdown has already been started.");
|
|
1425
1413
|
if (this._deferrer)
|
|
1426
|
-
throw new
|
|
1427
|
-
return this._deferrer = new Ne(), super.start(this.duration - e), this.
|
|
1414
|
+
throw new x();
|
|
1415
|
+
return this._deferrer = new Ne(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
|
|
1428
1416
|
}
|
|
1429
1417
|
stop(e) {
|
|
1430
|
-
this._deferrerStop(e), this.
|
|
1418
|
+
this._deferrerStop(e), this._publisher.publish("stop", e);
|
|
1431
1419
|
}
|
|
1432
1420
|
onExpire(e) {
|
|
1433
|
-
return this.
|
|
1421
|
+
return this._publisher.subscribe("expire", e);
|
|
1434
1422
|
}
|
|
1435
1423
|
onStart(e) {
|
|
1436
|
-
return this.
|
|
1424
|
+
return this._publisher.subscribe("start", e);
|
|
1437
1425
|
}
|
|
1438
1426
|
onStop(e) {
|
|
1439
|
-
return this.
|
|
1427
|
+
return this._publisher.subscribe("stop", e);
|
|
1440
1428
|
}
|
|
1441
1429
|
onTick(e, n = 0) {
|
|
1442
1430
|
if (n < 0)
|
|
1443
|
-
throw new
|
|
1431
|
+
throw new Pe("The tick step must be a non-negative number.");
|
|
1444
1432
|
if (n === 0)
|
|
1445
|
-
return this.
|
|
1433
|
+
return this._publisher.subscribe("tick", e);
|
|
1446
1434
|
let r = 0;
|
|
1447
|
-
return this.
|
|
1435
|
+
return this._publisher.subscribe("tick", (s) => {
|
|
1448
1436
|
r - s < n || (e(s), r = s);
|
|
1449
1437
|
});
|
|
1450
1438
|
}
|
|
1451
1439
|
}
|
|
1452
|
-
var
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1440
|
+
var Me;
|
|
1441
|
+
Me = Symbol.toStringTag;
|
|
1442
|
+
const T = class T {
|
|
1455
1443
|
constructor() {
|
|
1456
|
-
|
|
1444
|
+
u(this, Me, "Random");
|
|
1457
1445
|
}
|
|
1458
1446
|
static Boolean(t = 0.5) {
|
|
1459
1447
|
return Math.random() < t;
|
|
@@ -1470,10 +1458,10 @@ const M = class M {
|
|
|
1470
1458
|
return this.Integer(t.length);
|
|
1471
1459
|
}
|
|
1472
1460
|
static Choice(t) {
|
|
1473
|
-
return t[
|
|
1461
|
+
return t[T.Index(t)];
|
|
1474
1462
|
}
|
|
1475
1463
|
};
|
|
1476
|
-
let
|
|
1464
|
+
let F = T;
|
|
1477
1465
|
function st(i) {
|
|
1478
1466
|
return new Promise((t) => setTimeout(t, i));
|
|
1479
1467
|
}
|
|
@@ -1486,14 +1474,14 @@ function ot(i, t = "text/javascript") {
|
|
|
1486
1474
|
r.async = !0, r.defer = !0, r.src = i, r.type = t, r.onload = () => e(), r.onerror = () => n(), document.body.appendChild(r);
|
|
1487
1475
|
});
|
|
1488
1476
|
}
|
|
1489
|
-
function
|
|
1477
|
+
function ut(...i) {
|
|
1490
1478
|
return new l(function* () {
|
|
1491
1479
|
for (const t of i)
|
|
1492
1480
|
for (const e of t)
|
|
1493
1481
|
yield e;
|
|
1494
1482
|
});
|
|
1495
1483
|
}
|
|
1496
|
-
function
|
|
1484
|
+
function lt(i) {
|
|
1497
1485
|
if (Array.isArray(i))
|
|
1498
1486
|
return i.length;
|
|
1499
1487
|
let t = 0;
|
|
@@ -1501,7 +1489,7 @@ function ut(i) {
|
|
|
1501
1489
|
t += 1;
|
|
1502
1490
|
return t;
|
|
1503
1491
|
}
|
|
1504
|
-
function
|
|
1492
|
+
function at(i) {
|
|
1505
1493
|
return new l(function* () {
|
|
1506
1494
|
let t = 0;
|
|
1507
1495
|
for (const e of i)
|
|
@@ -1544,8 +1532,8 @@ function $e(i, t) {
|
|
|
1544
1532
|
function dt(i, t) {
|
|
1545
1533
|
if (t === void 0) {
|
|
1546
1534
|
let s = 0, o = 0;
|
|
1547
|
-
for (const
|
|
1548
|
-
s +=
|
|
1535
|
+
for (const a of i)
|
|
1536
|
+
s += a, o += 1;
|
|
1549
1537
|
if (o === 0)
|
|
1550
1538
|
throw new d("You must provide at least one value.");
|
|
1551
1539
|
return s / o;
|
|
@@ -1576,54 +1564,54 @@ function wt(i) {
|
|
|
1576
1564
|
t += e;
|
|
1577
1565
|
return t;
|
|
1578
1566
|
}
|
|
1579
|
-
function
|
|
1567
|
+
function yt(i) {
|
|
1580
1568
|
return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
|
|
1581
1569
|
}
|
|
1582
|
-
const
|
|
1570
|
+
const pt = "2.0.0-rc.7";
|
|
1583
1571
|
export {
|
|
1584
|
-
|
|
1585
|
-
|
|
1572
|
+
k as AggregatedAsyncIterator,
|
|
1573
|
+
g as AggregatedIterator,
|
|
1586
1574
|
nt as Clock,
|
|
1587
1575
|
rt as Countdown,
|
|
1588
1576
|
Ne as DeferredPromise,
|
|
1589
1577
|
c as Exception,
|
|
1590
|
-
|
|
1591
|
-
|
|
1578
|
+
x as FatalErrorException,
|
|
1579
|
+
Re as FileException,
|
|
1592
1580
|
ze as FileExistsException,
|
|
1593
1581
|
Be as FileNotFoundException,
|
|
1594
|
-
|
|
1582
|
+
Ie as GameLoop,
|
|
1595
1583
|
Qe as JSONStorage,
|
|
1596
1584
|
Ge as KeyException,
|
|
1597
1585
|
Ke as NetworkException,
|
|
1598
1586
|
Ye as NotImplementedException,
|
|
1599
1587
|
He as PermissionException,
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1588
|
+
je as Publisher,
|
|
1589
|
+
F as Random,
|
|
1590
|
+
Pe as RangeException,
|
|
1603
1591
|
f as ReducedIterator,
|
|
1604
1592
|
Ce as ReferenceException,
|
|
1605
1593
|
p as RuntimeException,
|
|
1606
1594
|
h as SmartAsyncIterator,
|
|
1607
1595
|
l as SmartIterator,
|
|
1608
|
-
|
|
1596
|
+
v as SmartPromise,
|
|
1609
1597
|
Xe as Thenable,
|
|
1610
|
-
|
|
1598
|
+
S as TimeUnit,
|
|
1611
1599
|
Ze as TimedPromise,
|
|
1612
1600
|
qe as TimeoutException,
|
|
1613
1601
|
Le as TypeException,
|
|
1614
|
-
|
|
1602
|
+
pt as VERSION,
|
|
1615
1603
|
d as ValueException,
|
|
1616
1604
|
dt as average,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1605
|
+
yt as capitalize,
|
|
1606
|
+
ut as chain,
|
|
1607
|
+
lt as count,
|
|
1620
1608
|
Ue as dateDifference,
|
|
1621
1609
|
et as dateRange,
|
|
1622
1610
|
tt as dateRound,
|
|
1623
1611
|
st as delay,
|
|
1624
|
-
|
|
1612
|
+
at as enumerate,
|
|
1625
1613
|
mt as hash,
|
|
1626
|
-
|
|
1614
|
+
Fe as isBrowser,
|
|
1627
1615
|
Ve as isNode,
|
|
1628
1616
|
We as isWebWorker,
|
|
1629
1617
|
ot as loadScript,
|