@byloth/core 2.0.0-rc.6 → 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;
138
- class u {
137
+ var ae;
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) {
@@ -167,7 +167,7 @@ class u {
167
167
  }
168
168
  filter(t) {
169
169
  const e = this._iterator;
170
- return new u(function* () {
170
+ return new l(function* () {
171
171
  let n = 0;
172
172
  for (; ; ) {
173
173
  const r = e.next();
@@ -179,7 +179,7 @@ class u {
179
179
  }
180
180
  map(t) {
181
181
  const e = this._iterator;
182
- return new u(function* () {
182
+ return new l(function* () {
183
183
  let n = 0;
184
184
  for (; ; ) {
185
185
  const r = e.next();
@@ -206,7 +206,7 @@ class u {
206
206
  }
207
207
  flatMap(t) {
208
208
  const e = this._iterator;
209
- return new u(function* () {
209
+ return new l(function* () {
210
210
  let n = 0;
211
211
  for (; ; ) {
212
212
  const r = e.next();
@@ -221,7 +221,7 @@ class u {
221
221
  }
222
222
  drop(t) {
223
223
  const e = this._iterator;
224
- return new u(function* () {
224
+ return new l(function* () {
225
225
  let n = 0;
226
226
  for (; n < t; ) {
227
227
  if (e.next().done)
@@ -238,7 +238,7 @@ class u {
238
238
  }
239
239
  take(t) {
240
240
  const e = this._iterator;
241
- return new u(function* () {
241
+ return new l(function* () {
242
242
  let n = 0;
243
243
  for (; n < t; ) {
244
244
  const r = e.next();
@@ -264,7 +264,7 @@ class u {
264
264
  }
265
265
  unique() {
266
266
  const t = this._iterator;
267
- return new u(function* () {
267
+ return new l(function* () {
268
268
  const e = /* @__PURE__ */ new Set();
269
269
  for (; ; ) {
270
270
  const n = t.next();
@@ -295,22 +295,22 @@ class u {
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");
313
- this._elements = new u(t);
311
+ u(this, "_elements");
312
+ u(this, ce, "ReducedIterator");
313
+ this._elements = new l(t);
314
314
  }
315
315
  every(t) {
316
316
  for (const [e, [n, r]] of this._elements.enumerate())
@@ -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]);
@@ -398,7 +398,7 @@ const _ = class _ {
398
398
  }
399
399
  keys() {
400
400
  const t = this._elements;
401
- return new u(function* () {
401
+ return new l(function* () {
402
402
  for (const [e] of t)
403
403
  yield e;
404
404
  });
@@ -408,7 +408,7 @@ const _ = class _ {
408
408
  }
409
409
  values() {
410
410
  const t = this._elements;
411
- return new u(function* () {
411
+ return new l(function* () {
412
412
  for (const [e, n] of t)
413
413
  yield n;
414
414
  });
@@ -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, l;
480
+ let o, a;
481
481
  if (n.has(r))
482
- [o, l] = n.get(r);
482
+ [o, a] = n.get(r);
483
483
  else if (e !== void 0)
484
- o = 0, l = 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, l, 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, l = await t(r, s, o);
502
- for await (const x of l)
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
  });
@@ -607,14 +607,14 @@ const m = class m {
607
607
  return t;
608
608
  }
609
609
  };
610
- let S = m;
611
- var de;
610
+ let k = m;
611
+ var he;
612
612
  class h {
613
613
  constructor(t) {
614
- a(this, "_iterator");
615
- a(this, "return");
616
- a(this, "throw");
617
- a(this, de, "SmartAsyncIterator");
614
+ u(this, "_iterator");
615
+ u(this, "return");
616
+ u(this, "throw");
617
+ u(this, he, "SmartAsyncIterator");
618
618
  if (t instanceof Function) {
619
619
  const e = t();
620
620
  Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
@@ -802,22 +802,22 @@ class h {
802
802
  return this._iterator.next(...t);
803
803
  }
804
804
  groupBy(t) {
805
- 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]));
806
806
  }
807
807
  toArray() {
808
808
  return Array.fromAsync(this);
809
809
  }
810
- [(de = Symbol.toStringTag, Symbol.asyncIterator)]() {
810
+ [(he = Symbol.toStringTag, Symbol.asyncIterator)]() {
811
811
  return this;
812
812
  }
813
813
  }
814
- var me;
815
- me = Symbol.toStringTag;
814
+ var de;
815
+ de = Symbol.toStringTag;
816
816
  const w = class w {
817
817
  constructor(t) {
818
- a(this, "_elements");
819
- a(this, me, "AggregatedIterator");
820
- this._elements = new u(t);
818
+ u(this, "_elements");
819
+ u(this, de, "AggregatedIterator");
820
+ this._elements = new l(t);
821
821
  }
822
822
  every(t) {
823
823
  const e = /* @__PURE__ */ new Map();
@@ -864,16 +864,16 @@ const w = class w {
864
864
  reduce(t, e) {
865
865
  const n = /* @__PURE__ */ new Map();
866
866
  for (const [r, s] of this._elements) {
867
- let o, l;
867
+ let o, a;
868
868
  if (n.has(r))
869
- [o, l] = n.get(r);
869
+ [o, a] = n.get(r);
870
870
  else if (e !== void 0)
871
- o = 0, l = e(r);
871
+ o = 0, a = e(r);
872
872
  else {
873
873
  n.set(r, [0, s]);
874
874
  continue;
875
875
  }
876
- n.set(r, [o + 1, t(r, l, s, o)]);
876
+ n.set(r, [o + 1, t(r, a, s, o)]);
877
877
  }
878
878
  return new f(function* () {
879
879
  for (const [r, [s, o]] of n)
@@ -885,9 +885,9 @@ const w = class w {
885
885
  return new w(function* () {
886
886
  const n = /* @__PURE__ */ new Map();
887
887
  for (const [r, s] of e) {
888
- const o = n.get(r) ?? 0, l = t(r, s, o);
889
- for (const x of l)
890
- yield [r, x];
888
+ const o = n.get(r) ?? 0, a = t(r, s, o);
889
+ for (const _ of a)
890
+ yield [r, _];
891
891
  n.set(r, o + 1);
892
892
  }
893
893
  });
@@ -960,7 +960,7 @@ const w = class w {
960
960
  }
961
961
  keys() {
962
962
  const t = this._elements;
963
- return new u(function* () {
963
+ return new l(function* () {
964
964
  const e = /* @__PURE__ */ new Set();
965
965
  for (const [n] of t)
966
966
  e.has(n) || (e.add(n), yield n);
@@ -971,7 +971,7 @@ const w = class w {
971
971
  }
972
972
  values() {
973
973
  const t = this._elements;
974
- return new u(function* () {
974
+ return new l(function* () {
975
975
  for (const [e, n] of t)
976
976
  yield n;
977
977
  });
@@ -997,18 +997,18 @@ const w = class w {
997
997
  return t;
998
998
  }
999
999
  };
1000
- let v = w;
1001
- var we;
1002
- we = Symbol.toStringTag;
1003
- class je {
1000
+ let g = w;
1001
+ var me;
1002
+ me = Symbol.toStringTag;
1003
+ class Ie {
1004
1004
  constructor(t, e = 40) {
1005
- a(this, "_handle");
1006
- a(this, "_startTime");
1007
- a(this, "_isRunning");
1008
- a(this, "_start");
1009
- a(this, "_stop");
1010
- a(this, we, "GameLoop");
1011
- 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 = () => {
1012
1012
  t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
1013
1013
  }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
1014
1014
  `Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
@@ -1034,19 +1034,19 @@ class je {
1034
1034
  if (!this._isRunning)
1035
1035
  throw new p("The game loop hadn't yet started.");
1036
1036
  if (!this._handle)
1037
- throw new g();
1037
+ throw new x();
1038
1038
  this._stop(), this._handle = void 0, this._isRunning = !1;
1039
1039
  }
1040
1040
  }
1041
- var _e;
1042
- _e = Symbol.toStringTag;
1041
+ var we;
1042
+ we = Symbol.toStringTag;
1043
1043
  class Qe {
1044
1044
  constructor(t = !0) {
1045
- a(this, "_preferPersistence");
1046
- a(this, "_volatile");
1047
- a(this, "_persistent");
1048
- a(this, _e, "JSONStorage");
1049
- 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)
1050
1050
  throw new De(
1051
1051
  "The `JSONStorage` class can only be instantiated within a browser environment."
1052
1052
  );
@@ -1182,13 +1182,13 @@ class Qe {
1182
1182
  }
1183
1183
  var ye;
1184
1184
  ye = Symbol.toStringTag;
1185
- const T = class T {
1185
+ const E = class E {
1186
1186
  constructor(t) {
1187
- a(this, "_isPending");
1188
- a(this, "_isFulfilled");
1189
- a(this, "_isRejected");
1190
- a(this, "_promise");
1191
- 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");
1192
1192
  this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
1193
1193
  const e = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
1194
1194
  throw this._isPending = !1, this._isRejected = !0, r;
@@ -1196,7 +1196,7 @@ const T = class T {
1196
1196
  this._promise = new Promise(t).then(e, n);
1197
1197
  }
1198
1198
  static FromPromise(t) {
1199
- return new T((e, n) => t.then(e, n));
1199
+ return new E((e, n) => t.then(e, n));
1200
1200
  }
1201
1201
  get isPending() {
1202
1202
  return this._isPending;
@@ -1217,17 +1217,17 @@ const T = class T {
1217
1217
  return this._promise.finally(t);
1218
1218
  }
1219
1219
  };
1220
- let b = T;
1221
- var pe, xe;
1222
- 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) {
1223
1223
  constructor(e, n) {
1224
1224
  let r, s;
1225
- super((o, l) => {
1226
- r = o, s = l;
1225
+ super((o, a) => {
1226
+ r = o, s = a;
1227
1227
  });
1228
- a(this, "_resolve");
1229
- a(this, "_reject");
1230
- a(this, pe, "DeferredPromise");
1228
+ u(this, "_resolve");
1229
+ u(this, "_reject");
1230
+ u(this, pe, "DeferredPromise");
1231
1231
  this._promise.then(e, n), this._resolve = r, this._reject = s;
1232
1232
  }
1233
1233
  get resolve() {
@@ -1240,12 +1240,12 @@ class Ne extends (xe = b, pe = Symbol.toStringTag, xe) {
1240
1240
  return e.then(this.resolve, this.reject), this;
1241
1241
  }
1242
1242
  }
1243
- var ge;
1244
- ge = Symbol.toStringTag;
1243
+ var xe;
1244
+ xe = Symbol.toStringTag;
1245
1245
  class Xe {
1246
1246
  constructor() {
1247
- a(this, "_onFulfilled");
1248
- a(this, ge, "Thenable");
1247
+ u(this, "_onFulfilled");
1248
+ u(this, xe, "Thenable");
1249
1249
  this._onFulfilled = (t) => t;
1250
1250
  }
1251
1251
  _resolve(t) {
@@ -1294,46 +1294,49 @@ class Xe {
1294
1294
  return this;
1295
1295
  }
1296
1296
  }
1297
- var ve, be;
1298
- class Ze extends (be = b, ve = Symbol.toStringTag, be) {
1297
+ var ge, ve;
1298
+ class Ze extends (ve = v, ge = Symbol.toStringTag, ve) {
1299
1299
  constructor(e, n) {
1300
1300
  super((r, s) => {
1301
- const o = (k) => {
1302
- clearTimeout(F), r(k);
1303
- }, l = (k) => {
1304
- clearTimeout(F), s(k);
1305
- }, F = setTimeout(() => l(new qe("The operation has timed out.")), n);
1306
- e(o, l);
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);
1307
1307
  });
1308
- a(this, ve, "TimedPromise");
1308
+ u(this, ge, "TimedPromise");
1309
1309
  }
1310
1310
  }
1311
- var ke;
1312
- ke = Symbol.toStringTag;
1313
- class y {
1311
+ var be;
1312
+ be = Symbol.toStringTag;
1313
+ class je {
1314
1314
  constructor() {
1315
- a(this, "_subscribers");
1316
- a(this, ke, "Publisher");
1317
- this._subscribers = [];
1318
- }
1319
- subscribe(t) {
1320
- return this._subscribers.push(t), () => {
1321
- const e = this._subscribers.indexOf(t);
1322
- 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)
1323
1325
  throw new Ce("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1324
- this._subscribers.splice(e, 1);
1326
+ n.splice(r, 1);
1325
1327
  };
1326
1328
  }
1327
- publish(...t) {
1328
- 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)) : [];
1329
1332
  }
1330
1333
  }
1331
- 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 || {});
1332
1335
  function Ue(i, t, e = 864e5) {
1333
1336
  return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
1334
1337
  }
1335
1338
  function et(i, t, e = 864e5) {
1336
- return i = new Date(i), t = new Date(t), new u(function* () {
1339
+ return i = new Date(i), t = new Date(t), new l(function* () {
1337
1340
  const n = t.getTime();
1338
1341
  let r = i.getTime();
1339
1342
  for (; r < n; )
@@ -1343,58 +1346,53 @@ function et(i, t, e = 864e5) {
1343
1346
  function tt(i, t = 864e5) {
1344
1347
  return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
1345
1348
  }
1346
- var Se, Ee;
1347
- class nt extends (Ee = je, Se = Symbol.toStringTag, Ee) {
1348
- constructor(e = E.Second) {
1349
- super((n) => this._ticker.publish(n), e);
1350
- a(this, "_starter");
1351
- a(this, "_stopper");
1352
- a(this, "_ticker");
1353
- a(this, Se, "Clock");
1354
- 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();
1355
1356
  }
1356
1357
  start(e = 0) {
1357
1358
  if (this._isRunning)
1358
1359
  throw new p("The clock has already been started.");
1359
- super.start(e), this._starter.publish();
1360
+ super.start(e), this._publisher.publish("start");
1360
1361
  }
1361
1362
  stop() {
1362
1363
  if (!this._isRunning)
1363
1364
  throw new p("The clock hadn't yet started.");
1364
- super.stop(), this._stopper.publish();
1365
+ super.stop(), this._publisher.publish("stop");
1365
1366
  }
1366
1367
  onStart(e) {
1367
- return this._starter.subscribe(e);
1368
+ return this._publisher.subscribe("start", e);
1368
1369
  }
1369
1370
  onStop(e) {
1370
- return this._stopper.subscribe(e);
1371
+ return this._publisher.subscribe("stop", e);
1371
1372
  }
1372
1373
  onTick(e, n = 0) {
1373
1374
  if (n < 0)
1374
- 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.");
1375
1376
  if (n === 0)
1376
- return this._ticker.subscribe(e);
1377
+ return this._publisher.subscribe("tick", e);
1377
1378
  let r = 0;
1378
- return this._ticker.subscribe((s) => {
1379
+ return this._publisher.subscribe("tick", (s) => {
1379
1380
  s - r < n || (e(s), r = s);
1380
1381
  });
1381
1382
  }
1382
1383
  }
1383
- var Te, Me;
1384
- class rt extends (Me = je, Te = Symbol.toStringTag, Me) {
1385
- 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) {
1386
1387
  super(() => {
1387
1388
  const s = this.remainingTime;
1388
- 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"));
1389
1390
  }, n);
1390
- a(this, "_deferrer");
1391
- a(this, "_expirer");
1392
- a(this, "_starter");
1393
- a(this, "_stopper");
1394
- a(this, "_ticker");
1395
- a(this, "_duration");
1396
- a(this, Te, "Countdown");
1397
- 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;
1398
1396
  }
1399
1397
  get duration() {
1400
1398
  return this._duration;
@@ -1406,44 +1404,44 @@ class rt extends (Me = je, Te = Symbol.toStringTag, Me) {
1406
1404
  if (!this._isRunning)
1407
1405
  throw new p("The countdown hadn't yet started.");
1408
1406
  if (!this._deferrer)
1409
- throw new g();
1407
+ throw new x();
1410
1408
  super.stop(), e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
1411
1409
  }
1412
1410
  start(e = this.duration) {
1413
1411
  if (this._isRunning)
1414
1412
  throw new p("The countdown has already been started.");
1415
1413
  if (this._deferrer)
1416
- throw new g();
1417
- 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;
1418
1416
  }
1419
1417
  stop(e) {
1420
- this._deferrerStop(e), this._stopper.publish(e);
1418
+ this._deferrerStop(e), this._publisher.publish("stop", e);
1421
1419
  }
1422
1420
  onExpire(e) {
1423
- return this._expirer.subscribe(e);
1421
+ return this._publisher.subscribe("expire", e);
1424
1422
  }
1425
1423
  onStart(e) {
1426
- return this._starter.subscribe(e);
1424
+ return this._publisher.subscribe("start", e);
1427
1425
  }
1428
1426
  onStop(e) {
1429
- return this._stopper.subscribe(e);
1427
+ return this._publisher.subscribe("stop", e);
1430
1428
  }
1431
1429
  onTick(e, n = 0) {
1432
1430
  if (n < 0)
1433
- 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.");
1434
1432
  if (n === 0)
1435
- return this._ticker.subscribe(e);
1433
+ return this._publisher.subscribe("tick", e);
1436
1434
  let r = 0;
1437
- return this._ticker.subscribe((s) => {
1435
+ return this._publisher.subscribe("tick", (s) => {
1438
1436
  r - s < n || (e(s), r = s);
1439
1437
  });
1440
1438
  }
1441
1439
  }
1442
- var Fe;
1443
- Fe = Symbol.toStringTag;
1444
- const M = class M {
1440
+ var Me;
1441
+ Me = Symbol.toStringTag;
1442
+ const T = class T {
1445
1443
  constructor() {
1446
- a(this, Fe, "Random");
1444
+ u(this, Me, "Random");
1447
1445
  }
1448
1446
  static Boolean(t = 0.5) {
1449
1447
  return Math.random() < t;
@@ -1460,10 +1458,10 @@ const M = class M {
1460
1458
  return this.Integer(t.length);
1461
1459
  }
1462
1460
  static Choice(t) {
1463
- return t[M.Index(t)];
1461
+ return t[T.Index(t)];
1464
1462
  }
1465
1463
  };
1466
- let R = M;
1464
+ let F = T;
1467
1465
  function st(i) {
1468
1466
  return new Promise((t) => setTimeout(t, i));
1469
1467
  }
@@ -1476,14 +1474,14 @@ function ot(i, t = "text/javascript") {
1476
1474
  r.async = !0, r.defer = !0, r.src = i, r.type = t, r.onload = () => e(), r.onerror = () => n(), document.body.appendChild(r);
1477
1475
  });
1478
1476
  }
1479
- function at(...i) {
1480
- return new u(function* () {
1477
+ function ut(...i) {
1478
+ return new l(function* () {
1481
1479
  for (const t of i)
1482
1480
  for (const e of t)
1483
1481
  yield e;
1484
1482
  });
1485
1483
  }
1486
- function ut(i) {
1484
+ function lt(i) {
1487
1485
  if (Array.isArray(i))
1488
1486
  return i.length;
1489
1487
  let t = 0;
@@ -1491,15 +1489,15 @@ function ut(i) {
1491
1489
  t += 1;
1492
1490
  return t;
1493
1491
  }
1494
- function lt(i) {
1495
- return new u(function* () {
1492
+ function at(i) {
1493
+ return new l(function* () {
1496
1494
  let t = 0;
1497
1495
  for (const e of i)
1498
1496
  yield [t, e], t += 1;
1499
1497
  });
1500
1498
  }
1501
1499
  function ct(i, t, e = 1) {
1502
- return new u(function* () {
1500
+ return new l(function* () {
1503
1501
  t === void 0 && (t = i, i = 0), i > t && (e = e ?? -1);
1504
1502
  for (let n = i; n < t; n += e)
1505
1503
  yield n;
@@ -1514,14 +1512,14 @@ function ft(i) {
1514
1512
  return t;
1515
1513
  }
1516
1514
  function ht(i) {
1517
- return new u(function* () {
1515
+ return new l(function* () {
1518
1516
  const t = /* @__PURE__ */ new Set();
1519
1517
  for (const e of i)
1520
1518
  t.has(e) || (t.add(e), yield e);
1521
1519
  });
1522
1520
  }
1523
1521
  function $e(i, t) {
1524
- return new u(function* () {
1522
+ return new l(function* () {
1525
1523
  const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
1526
1524
  for (; ; ) {
1527
1525
  const r = e.next(), s = n.next();
@@ -1534,8 +1532,8 @@ function $e(i, t) {
1534
1532
  function dt(i, t) {
1535
1533
  if (t === void 0) {
1536
1534
  let s = 0, o = 0;
1537
- for (const l of i)
1538
- s += l, o += 1;
1535
+ for (const a of i)
1536
+ s += a, o += 1;
1539
1537
  if (o === 0)
1540
1538
  throw new d("You must provide at least one value.");
1541
1539
  return s / o;
@@ -1566,54 +1564,54 @@ function wt(i) {
1566
1564
  t += e;
1567
1565
  return t;
1568
1566
  }
1569
- function _t(i) {
1567
+ function yt(i) {
1570
1568
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
1571
1569
  }
1572
- const yt = "2.0.0-rc.6";
1570
+ const pt = "2.0.0-rc.7";
1573
1571
  export {
1574
- S as AggregatedAsyncIterator,
1575
- v as AggregatedIterator,
1572
+ k as AggregatedAsyncIterator,
1573
+ g as AggregatedIterator,
1576
1574
  nt as Clock,
1577
1575
  rt as Countdown,
1578
1576
  Ne as DeferredPromise,
1579
1577
  c as Exception,
1580
- g as FatalErrorException,
1581
- Pe as FileException,
1578
+ x as FatalErrorException,
1579
+ Re as FileException,
1582
1580
  ze as FileExistsException,
1583
1581
  Be as FileNotFoundException,
1584
- je as GameLoop,
1582
+ Ie as GameLoop,
1585
1583
  Qe as JSONStorage,
1586
1584
  Ge as KeyException,
1587
1585
  Ke as NetworkException,
1588
1586
  Ye as NotImplementedException,
1589
1587
  He as PermissionException,
1590
- y as Publisher,
1591
- R as Random,
1592
- Ie as RangeException,
1588
+ je as Publisher,
1589
+ F as Random,
1590
+ Pe as RangeException,
1593
1591
  f as ReducedIterator,
1594
1592
  Ce as ReferenceException,
1595
1593
  p as RuntimeException,
1596
1594
  h as SmartAsyncIterator,
1597
- u as SmartIterator,
1598
- b as SmartPromise,
1595
+ l as SmartIterator,
1596
+ v as SmartPromise,
1599
1597
  Xe as Thenable,
1600
- E as TimeUnit,
1598
+ S as TimeUnit,
1601
1599
  Ze as TimedPromise,
1602
1600
  qe as TimeoutException,
1603
1601
  Le as TypeException,
1604
- yt as VERSION,
1602
+ pt as VERSION,
1605
1603
  d as ValueException,
1606
1604
  dt as average,
1607
- _t as capitalize,
1608
- at as chain,
1609
- ut as count,
1605
+ yt as capitalize,
1606
+ ut as chain,
1607
+ lt as count,
1610
1608
  Ue as dateDifference,
1611
1609
  et as dateRange,
1612
1610
  tt as dateRound,
1613
1611
  st as delay,
1614
- lt as enumerate,
1612
+ at as enumerate,
1615
1613
  mt as hash,
1616
- Re as isBrowser,
1614
+ Fe as isBrowser,
1617
1615
  Ve as isNode,
1618
1616
  We as isWebWorker,
1619
1617
  ot as loadScript,