@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 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 a = (i, t, e) => Oe(i, typeof t != "symbol" ? t + "" : t, e);
4
- const Re = typeof window < "u" && typeof window.document < "u";
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 Ve = typeof process < "u" && ((P = process.versions) == null ? void 0 : P.node);
7
- var I;
8
- const We = typeof self == "object" && ((I = self.constructor) == null ? void 0 : I.name) === "DedicatedWorkerGlobalScope";
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
- a(this, j, "Exception");
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 O, C;
31
- class g extends (C = c, O = Symbol.toStringTag, C) {
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
- a(this, O, "FatalErrorException");
35
+ u(this, A, "FatalErrorException");
36
36
  }
37
37
  }
38
- var D, q;
39
- class Ye extends (q = g, D = Symbol.toStringTag, q) {
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
- a(this, D, "NotImplementedException");
43
+ u(this, C, "NotImplementedException");
44
44
  }
45
45
  }
46
- var N, $;
47
- class Pe extends ($ = c, N = Symbol.toStringTag, $) {
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
- a(this, N, "FileException");
50
+ u(this, q, "FileException");
51
51
  }
52
52
  }
53
- var J, V;
54
- class ze extends (V = Pe, J = Symbol.toStringTag, V) {
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
- a(this, J, "FileExistsException");
57
+ u(this, $, "FileExistsException");
58
58
  }
59
59
  }
60
- var W, Y;
61
- class Be extends (Y = Pe, W = Symbol.toStringTag, Y) {
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
- a(this, W, "FileNotFoundException");
64
+ u(this, V, "FileNotFoundException");
65
65
  }
66
66
  }
67
- var z, B;
68
- class Ge extends (B = c, z = Symbol.toStringTag, B) {
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
- a(this, z, "KeyException");
71
+ u(this, Y, "KeyException");
72
72
  }
73
73
  }
74
- var G, K;
75
- class Ke extends (K = c, G = Symbol.toStringTag, K) {
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
- a(this, G, "NetworkException");
78
+ u(this, B, "NetworkException");
79
79
  }
80
80
  }
81
- var H, L;
82
- class He extends (L = c, H = Symbol.toStringTag, L) {
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
- a(this, H, "PermissionException");
85
+ u(this, K, "PermissionException");
86
86
  }
87
87
  }
88
- var Q, X;
89
- class Ce extends (X = c, Q = Symbol.toStringTag, X) {
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
- a(this, Q, "ReferenceException");
92
+ u(this, L, "ReferenceException");
93
93
  }
94
94
  }
95
- var Z, U;
96
- class p extends (U = c, Z = Symbol.toStringTag, U) {
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
- a(this, Z, "RuntimeException");
99
+ u(this, X, "RuntimeException");
100
100
  }
101
101
  }
102
- var ee, te;
103
- class De extends (te = p, ee = Symbol.toStringTag, te) {
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
- a(this, ee, "EnvironmentException");
106
+ u(this, U, "EnvironmentException");
107
107
  }
108
108
  }
109
- var ne, re;
110
- class qe extends (re = c, ne = Symbol.toStringTag, re) {
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
- a(this, ne, "TimeoutException");
113
+ u(this, te, "TimeoutException");
114
114
  }
115
115
  }
116
- var se, ie;
117
- class Le extends (ie = c, se = Symbol.toStringTag, ie) {
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
- a(this, se, "TypeException");
120
+ u(this, re, "TypeException");
121
121
  }
122
122
  }
123
- var oe, ae;
124
- class d extends (ae = c, oe = Symbol.toStringTag, ae) {
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
- a(this, oe, "ValueException");
127
+ u(this, ie, "ValueException");
128
128
  }
129
129
  }
130
130
  var ue, le;
131
- class Ie extends (le = d, ue = Symbol.toStringTag, le) {
131
+ class Pe extends (le = d, ue = Symbol.toStringTag, le) {
132
132
  constructor(e, n, r = "RangeException") {
133
133
  super(e, n, r);
134
- a(this, ue, "RangeException");
134
+ u(this, ue, "RangeException");
135
135
  }
136
136
  }
137
- var ce;
137
+ var ae;
138
138
  class l {
139
139
  constructor(t) {
140
- a(this, "_iterator");
141
- a(this, "return");
142
- a(this, "throw");
143
- a(this, ce, "SmartIterator");
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 v(this.map((e, n) => [t(e, n), e]));
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
- [(ce = Symbol.toStringTag, Symbol.iterator)]() {
303
+ [(ae = Symbol.toStringTag, Symbol.iterator)]() {
304
304
  return this;
305
305
  }
306
306
  }
307
- var fe;
308
- fe = Symbol.toStringTag;
309
- const _ = class _ {
307
+ var ce;
308
+ ce = Symbol.toStringTag;
309
+ const y = class y {
310
310
  constructor(t) {
311
- a(this, "_elements");
312
- a(this, fe, "ReducedIterator");
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 _(function* () {
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 _(function* () {
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 v(function* () {
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 _(function* () {
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 _(function* () {
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 _(function* () {
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 he;
428
- he = Symbol.toStringTag;
426
+ let f = y;
427
+ var fe;
428
+ fe = Symbol.toStringTag;
429
429
  const m = class m {
430
430
  constructor(t) {
431
- a(this, "_elements");
432
- a(this, he, "AggregatedAsyncIterator");
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, u;
480
+ let o, a;
481
481
  if (n.has(r))
482
- [o, u] = n.get(r);
482
+ [o, a] = n.get(r);
483
483
  else if (e !== void 0)
484
- o = 0, u = await e(r);
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, u, s, o)]);
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, u = await t(r, s, o);
502
- for await (const x of u)
503
- yield [r, x];
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
- if (o >= t) {
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 S = m;
616
- var de;
610
+ let k = m;
611
+ var he;
617
612
  class h {
618
613
  constructor(t) {
619
- a(this, "_iterator");
620
- a(this, "return");
621
- a(this, "throw");
622
- a(this, de, "SmartAsyncIterator");
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 S(this.map(async (e, n) => [await t(e, n), e]));
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
- [(de = Symbol.toStringTag, Symbol.asyncIterator)]() {
810
+ [(he = Symbol.toStringTag, Symbol.asyncIterator)]() {
816
811
  return this;
817
812
  }
818
813
  }
819
- var me;
820
- me = Symbol.toStringTag;
814
+ var de;
815
+ de = Symbol.toStringTag;
821
816
  const w = class w {
822
817
  constructor(t) {
823
- a(this, "_elements");
824
- a(this, me, "AggregatedIterator");
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, u;
867
+ let o, a;
873
868
  if (n.has(r))
874
- [o, u] = n.get(r);
869
+ [o, a] = n.get(r);
875
870
  else if (e !== void 0)
876
- o = 0, u = e(r);
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, u, s, o)]);
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, u = t(r, s, o);
894
- for (const x of u)
895
- yield [r, x];
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
- if (o >= t) {
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 v = w;
1011
- var we;
1012
- we = Symbol.toStringTag;
1013
- class je {
1000
+ let g = w;
1001
+ var me;
1002
+ me = Symbol.toStringTag;
1003
+ class Ie {
1014
1004
  constructor(t, e = 40) {
1015
- a(this, "_handle");
1016
- a(this, "_startTime");
1017
- a(this, "_isRunning");
1018
- a(this, "_start");
1019
- a(this, "_stop");
1020
- a(this, we, "GameLoop");
1021
- this._startTime = 0, this._isRunning = !1, Re ? (this._start = () => {
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 g();
1037
+ throw new x();
1048
1038
  this._stop(), this._handle = void 0, this._isRunning = !1;
1049
1039
  }
1050
1040
  }
1051
- var _e;
1052
- _e = Symbol.toStringTag;
1041
+ var we;
1042
+ we = Symbol.toStringTag;
1053
1043
  class Qe {
1054
1044
  constructor(t = !0) {
1055
- a(this, "_preferPersistence");
1056
- a(this, "_volatile");
1057
- a(this, "_persistent");
1058
- a(this, _e, "JSONStorage");
1059
- if (this._preferPersistence = t, !Re)
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 T = class T {
1185
+ const E = class E {
1196
1186
  constructor(t) {
1197
- a(this, "_isPending");
1198
- a(this, "_isFulfilled");
1199
- a(this, "_isRejected");
1200
- a(this, "_promise");
1201
- a(this, ye, "SmartPromise");
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 T((e, n) => t.then(e, n));
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 b = T;
1231
- var pe, xe;
1232
- class Ne extends (xe = b, pe = Symbol.toStringTag, xe) {
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, u) => {
1236
- r = o, s = u;
1225
+ super((o, a) => {
1226
+ r = o, s = a;
1237
1227
  });
1238
- a(this, "_resolve");
1239
- a(this, "_reject");
1240
- a(this, pe, "DeferredPromise");
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 ge;
1254
- ge = Symbol.toStringTag;
1243
+ var xe;
1244
+ xe = Symbol.toStringTag;
1255
1245
  class Xe {
1256
1246
  constructor() {
1257
- a(this, "_onFulfilled");
1258
- a(this, ge, "Thenable");
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 ve, be;
1308
- class Ze extends (be = b, ve = Symbol.toStringTag, be) {
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 = (k) => {
1312
- clearTimeout(F), r(k);
1313
- }, u = (k) => {
1314
- clearTimeout(F), s(k);
1315
- }, F = setTimeout(() => u(new qe("The operation has timed out.")), n);
1316
- e(o, u);
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
- a(this, ve, "TimedPromise");
1308
+ u(this, ge, "TimedPromise");
1319
1309
  }
1320
1310
  }
1321
- var ke;
1322
- ke = Symbol.toStringTag;
1323
- class y {
1311
+ var be;
1312
+ be = Symbol.toStringTag;
1313
+ class je {
1324
1314
  constructor() {
1325
- a(this, "_subscribers");
1326
- a(this, ke, "Publisher");
1327
- this._subscribers = [];
1328
- }
1329
- subscribe(t) {
1330
- return this._subscribers.push(t), () => {
1331
- const e = this._subscribers.indexOf(t);
1332
- if (e < 0)
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
- this._subscribers.splice(e, 1);
1326
+ n.splice(r, 1);
1335
1327
  };
1336
1328
  }
1337
- publish(...t) {
1338
- return this._subscribers.slice().map((e) => e(...t));
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 E = /* @__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))(E || {});
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 Se, Ee;
1357
- class nt extends (Ee = je, Se = Symbol.toStringTag, Ee) {
1358
- constructor(e = E.Second) {
1359
- super((n) => this._ticker.publish(n), e);
1360
- a(this, "_starter");
1361
- a(this, "_stopper");
1362
- a(this, "_ticker");
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._starter.publish();
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._stopper.publish();
1365
+ super.stop(), this._publisher.publish("stop");
1375
1366
  }
1376
1367
  onStart(e) {
1377
- return this._starter.subscribe(e);
1368
+ return this._publisher.subscribe("start", e);
1378
1369
  }
1379
1370
  onStop(e) {
1380
- return this._stopper.subscribe(e);
1371
+ return this._publisher.subscribe("stop", e);
1381
1372
  }
1382
1373
  onTick(e, n = 0) {
1383
1374
  if (n < 0)
1384
- throw new Ie("The tick step must be a non-negative number.");
1375
+ throw new Pe("The tick step must be a non-negative number.");
1385
1376
  if (n === 0)
1386
- return this._ticker.subscribe(e);
1377
+ return this._publisher.subscribe("tick", e);
1387
1378
  let r = 0;
1388
- return this._ticker.subscribe((s) => {
1379
+ return this._publisher.subscribe("tick", (s) => {
1389
1380
  s - r < n || (e(s), r = s);
1390
1381
  });
1391
1382
  }
1392
1383
  }
1393
- var Te, Me;
1394
- class rt extends (Me = je, Te = Symbol.toStringTag, Me) {
1395
- constructor(e, n = E.Second) {
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._ticker.publish(s), s <= 0 && (this._deferrerStop(), this._expirer.publish());
1389
+ this._publisher.publish("tick", s), s <= 0 && (this._deferrerStop(), this._publisher.publish("expire"));
1399
1390
  }, n);
1400
- a(this, "_deferrer");
1401
- a(this, "_expirer");
1402
- a(this, "_starter");
1403
- a(this, "_stopper");
1404
- a(this, "_ticker");
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 g();
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 g();
1427
- return this._deferrer = new Ne(), super.start(this.duration - e), this._starter.publish(), this._deferrer;
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._stopper.publish(e);
1418
+ this._deferrerStop(e), this._publisher.publish("stop", e);
1431
1419
  }
1432
1420
  onExpire(e) {
1433
- return this._expirer.subscribe(e);
1421
+ return this._publisher.subscribe("expire", e);
1434
1422
  }
1435
1423
  onStart(e) {
1436
- return this._starter.subscribe(e);
1424
+ return this._publisher.subscribe("start", e);
1437
1425
  }
1438
1426
  onStop(e) {
1439
- return this._stopper.subscribe(e);
1427
+ return this._publisher.subscribe("stop", e);
1440
1428
  }
1441
1429
  onTick(e, n = 0) {
1442
1430
  if (n < 0)
1443
- throw new Ie("The tick step must be a non-negative number.");
1431
+ throw new Pe("The tick step must be a non-negative number.");
1444
1432
  if (n === 0)
1445
- return this._ticker.subscribe(e);
1433
+ return this._publisher.subscribe("tick", e);
1446
1434
  let r = 0;
1447
- return this._ticker.subscribe((s) => {
1435
+ return this._publisher.subscribe("tick", (s) => {
1448
1436
  r - s < n || (e(s), r = s);
1449
1437
  });
1450
1438
  }
1451
1439
  }
1452
- var Fe;
1453
- Fe = Symbol.toStringTag;
1454
- const M = class M {
1440
+ var Me;
1441
+ Me = Symbol.toStringTag;
1442
+ const T = class T {
1455
1443
  constructor() {
1456
- a(this, Fe, "Random");
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[M.Index(t)];
1461
+ return t[T.Index(t)];
1474
1462
  }
1475
1463
  };
1476
- let R = M;
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 at(...i) {
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 ut(i) {
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 lt(i) {
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 u of i)
1548
- s += u, o += 1;
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 _t(i) {
1567
+ function yt(i) {
1580
1568
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
1581
1569
  }
1582
- const yt = "2.0.0-rc.5";
1570
+ const pt = "2.0.0-rc.7";
1583
1571
  export {
1584
- S as AggregatedAsyncIterator,
1585
- v as AggregatedIterator,
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
- g as FatalErrorException,
1591
- Pe as FileException,
1578
+ x as FatalErrorException,
1579
+ Re as FileException,
1592
1580
  ze as FileExistsException,
1593
1581
  Be as FileNotFoundException,
1594
- je as GameLoop,
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
- y as Publisher,
1601
- R as Random,
1602
- Ie as RangeException,
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
- b as SmartPromise,
1596
+ v as SmartPromise,
1609
1597
  Xe as Thenable,
1610
- E as TimeUnit,
1598
+ S as TimeUnit,
1611
1599
  Ze as TimedPromise,
1612
1600
  qe as TimeoutException,
1613
1601
  Le as TypeException,
1614
- yt as VERSION,
1602
+ pt as VERSION,
1615
1603
  d as ValueException,
1616
1604
  dt as average,
1617
- _t as capitalize,
1618
- at as chain,
1619
- ut as count,
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
- lt as enumerate,
1612
+ at as enumerate,
1625
1613
  mt as hash,
1626
- Re as isBrowser,
1614
+ Fe as isBrowser,
1627
1615
  Ve as isNode,
1628
1616
  We as isWebWorker,
1629
1617
  ot as loadScript,