@byloth/core 2.0.0-rc.10 → 2.0.0-rc.12

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
- var Ne = Object.defineProperty;
2
- var Ye = (i, t, e) => t in i ? Ne(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var a = (i, t, e) => Ye(i, typeof t != "symbol" ? t + "" : t, e);
4
- const Oe = typeof window < "u" && typeof window.document < "u";
5
- var O;
6
- const Qe = typeof process < "u" && ((O = process.versions) == null ? void 0 : O.node);
1
+ var Le = Object.defineProperty;
2
+ var Be = (i, t, e) => t in i ? Le(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var a = (i, t, e) => Be(i, typeof t != "symbol" ? t + "" : t, e);
4
+ const ze = typeof window < "u" && typeof window.document < "u";
7
5
  var A;
8
- const Xe = typeof self == "object" && ((A = self.constructor) == null ? void 0 : A.name) === "DedicatedWorkerGlobalScope";
9
- var $, q;
10
- class f extends (q = Error, $ = Symbol.toStringTag, q) {
6
+ const tt = typeof process < "u" && ((A = process.versions) == null ? void 0 : A.node);
7
+ var $;
8
+ const nt = typeof self == "object" && (($ = self.constructor) == null ? void 0 : $.name) === "DedicatedWorkerGlobalScope";
9
+ var q, N;
10
+ class f extends (N = Error, q = Symbol.toStringTag, N) {
11
11
  constructor(e, n, s = "Exception") {
12
12
  super(e);
13
- a(this, $, "Exception");
13
+ a(this, q, "Exception");
14
14
  this.cause = n, this.name = s, 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 f(`${e}`);
28
28
  }
29
29
  }
30
- var N, Y;
31
- class k extends (Y = f, N = Symbol.toStringTag, Y) {
30
+ var Y, z;
31
+ class k extends (z = f, Y = Symbol.toStringTag, z) {
32
32
  constructor(e, n, s = "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, s);
35
- a(this, N, "FatalErrorException");
35
+ a(this, Y, "FatalErrorException");
36
36
  }
37
37
  }
38
- var z, J;
39
- class ze extends (J = k, z = Symbol.toStringTag, J) {
38
+ var J, V;
39
+ class Ge extends (V = k, J = Symbol.toStringTag, V) {
40
40
  constructor(e, n, s = "NotImplementedException") {
41
41
  e === void 0 && (e = "This feature is not implemented yet. Please, try again later.");
42
42
  super(e, n, s);
43
- a(this, z, "NotImplementedException");
43
+ a(this, J, "NotImplementedException");
44
44
  }
45
45
  }
46
- var V, W;
47
- class Ae extends (W = f, V = Symbol.toStringTag, W) {
46
+ var W, L;
47
+ class Je extends (L = f, W = Symbol.toStringTag, L) {
48
48
  constructor(e, n, s = "FileException") {
49
49
  super(e, n, s);
50
- a(this, V, "FileException");
50
+ a(this, W, "FileException");
51
51
  }
52
52
  }
53
53
  var B, G;
54
- class Ze extends (G = Ae, B = Symbol.toStringTag, G) {
54
+ class st extends (G = Je, B = Symbol.toStringTag, G) {
55
55
  constructor(e, n, s = "FileExistsException") {
56
56
  super(e, n, s);
57
57
  a(this, B, "FileExistsException");
58
58
  }
59
59
  }
60
- var K, L;
61
- class Ue extends (L = Ae, K = Symbol.toStringTag, L) {
60
+ var K, H;
61
+ class rt extends (H = Je, K = Symbol.toStringTag, H) {
62
62
  constructor(e, n, s = "FileNotFoundException") {
63
63
  super(e, n, s);
64
64
  a(this, K, "FileNotFoundException");
65
65
  }
66
66
  }
67
- var H, Q;
68
- class x extends (Q = f, H = Symbol.toStringTag, Q) {
67
+ var Q, X;
68
+ class x extends (X = f, Q = Symbol.toStringTag, X) {
69
69
  constructor(e, n, s = "KeyException") {
70
70
  super(e, n, s);
71
- a(this, H, "KeyException");
71
+ a(this, Q, "KeyException");
72
72
  }
73
73
  }
74
- var X, Z;
75
- class et extends (Z = f, X = Symbol.toStringTag, Z) {
74
+ var Z, U;
75
+ class it extends (U = f, Z = Symbol.toStringTag, U) {
76
76
  constructor(e, n, s = "NetworkException") {
77
77
  super(e, n, s);
78
- a(this, X, "NetworkException");
78
+ a(this, Z, "NetworkException");
79
79
  }
80
80
  }
81
- var U, ee;
82
- class tt extends (ee = f, U = Symbol.toStringTag, ee) {
81
+ var ee, te;
82
+ class ot extends (te = f, ee = Symbol.toStringTag, te) {
83
83
  constructor(e, n, s = "PermissionException") {
84
84
  super(e, n, s);
85
- a(this, U, "PermissionException");
85
+ a(this, ee, "PermissionException");
86
86
  }
87
87
  }
88
- var te, ne;
89
- class Je extends (ne = f, te = Symbol.toStringTag, ne) {
88
+ var ne, se;
89
+ class I extends (se = f, ne = Symbol.toStringTag, se) {
90
90
  constructor(e, n, s = "ReferenceException") {
91
91
  super(e, n, s);
92
- a(this, te, "ReferenceException");
92
+ a(this, ne, "ReferenceException");
93
93
  }
94
94
  }
95
- var se, re;
96
- class m extends (re = f, se = Symbol.toStringTag, re) {
95
+ var re, ie;
96
+ class m extends (ie = f, re = Symbol.toStringTag, ie) {
97
97
  constructor(e, n, s = "RuntimeException") {
98
98
  super(e, n, s);
99
- a(this, se, "RuntimeException");
99
+ a(this, re, "RuntimeException");
100
100
  }
101
101
  }
102
- var ie, oe;
103
- class Ve extends (oe = m, ie = Symbol.toStringTag, oe) {
102
+ var oe, ae;
103
+ class Ke extends (ae = m, oe = Symbol.toStringTag, ae) {
104
104
  constructor(e, n, s = "EnvironmentException") {
105
105
  super(e, n, s);
106
- a(this, ie, "EnvironmentException");
106
+ a(this, oe, "EnvironmentException");
107
107
  }
108
108
  }
109
- var ae, le;
110
- class We extends (le = f, ae = Symbol.toStringTag, le) {
109
+ var le, ue;
110
+ class He extends (ue = f, le = Symbol.toStringTag, ue) {
111
111
  constructor(e, n, s = "TimeoutException") {
112
112
  super(e, n, s);
113
- a(this, ae, "TimeoutException");
113
+ a(this, le, "TimeoutException");
114
114
  }
115
115
  }
116
- var ue, ce;
117
- class nt extends (ce = f, ue = Symbol.toStringTag, ce) {
116
+ var ce, he;
117
+ class at extends (he = f, ce = Symbol.toStringTag, he) {
118
118
  constructor(e, n, s = "TypeException") {
119
119
  super(e, n, s);
120
- a(this, ue, "TypeException");
120
+ a(this, ce, "TypeException");
121
121
  }
122
122
  }
123
- var he, fe;
124
- class p extends (fe = f, he = Symbol.toStringTag, fe) {
123
+ var fe, de;
124
+ class p extends (de = f, fe = Symbol.toStringTag, de) {
125
125
  constructor(e, n, s = "ValueException") {
126
126
  super(e, n, s);
127
- a(this, he, "ValueException");
127
+ a(this, fe, "ValueException");
128
128
  }
129
129
  }
130
- var de, me;
131
- class $e extends (me = p, de = Symbol.toStringTag, me) {
130
+ var me, _e;
131
+ class Ve extends (_e = p, me = Symbol.toStringTag, _e) {
132
132
  constructor(e, n, s = "RangeException") {
133
133
  super(e, n, s);
134
- a(this, de, "RangeException");
134
+ a(this, me, "RangeException");
135
135
  }
136
136
  }
137
- var _e;
138
- class c {
137
+ var we;
138
+ class u {
139
139
  constructor(t) {
140
140
  a(this, "_iterator");
141
141
  a(this, "return");
142
142
  a(this, "throw");
143
- a(this, _e, "SmartIterator");
143
+ a(this, we, "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 c {
167
167
  }
168
168
  filter(t) {
169
169
  const e = this._iterator;
170
- return new c(function* () {
170
+ return new u(function* () {
171
171
  let n = 0;
172
172
  for (; ; ) {
173
173
  const s = e.next();
@@ -179,7 +179,7 @@ class c {
179
179
  }
180
180
  map(t) {
181
181
  const e = this._iterator;
182
- return new c(function* () {
182
+ return new u(function* () {
183
183
  let n = 0;
184
184
  for (; ; ) {
185
185
  const s = e.next();
@@ -206,7 +206,7 @@ class c {
206
206
  }
207
207
  flatMap(t) {
208
208
  const e = this._iterator;
209
- return new c(function* () {
209
+ return new u(function* () {
210
210
  let n = 0;
211
211
  for (; ; ) {
212
212
  const s = e.next();
@@ -221,7 +221,7 @@ class c {
221
221
  }
222
222
  drop(t) {
223
223
  const e = this._iterator;
224
- return new c(function* () {
224
+ return new u(function* () {
225
225
  let n = 0;
226
226
  for (; n < t; ) {
227
227
  if (e.next().done)
@@ -238,7 +238,7 @@ class c {
238
238
  }
239
239
  take(t) {
240
240
  const e = this._iterator;
241
- return new c(function* () {
241
+ return new u(function* () {
242
242
  let n = 0;
243
243
  for (; n < t; ) {
244
244
  const s = e.next();
@@ -264,7 +264,7 @@ class c {
264
264
  }
265
265
  unique() {
266
266
  const t = this._iterator;
267
- return new c(function* () {
267
+ return new u(function* () {
268
268
  const e = /* @__PURE__ */ new Set();
269
269
  for (; ; ) {
270
270
  const n = t.next();
@@ -300,17 +300,17 @@ class c {
300
300
  toArray() {
301
301
  return Array.from(this);
302
302
  }
303
- [(_e = Symbol.toStringTag, Symbol.iterator)]() {
303
+ [(we = Symbol.toStringTag, Symbol.iterator)]() {
304
304
  return this;
305
305
  }
306
306
  }
307
- var we;
308
- we = Symbol.toStringTag;
307
+ var pe;
308
+ pe = Symbol.toStringTag;
309
309
  const b = class b {
310
310
  constructor(t) {
311
311
  a(this, "_elements");
312
- a(this, we, "ReducedIterator");
313
- this._elements = new c(t);
312
+ a(this, pe, "ReducedIterator");
313
+ this._elements = new u(t);
314
314
  }
315
315
  every(t) {
316
316
  for (const [e, [n, s]] of this._elements.enumerate())
@@ -398,7 +398,7 @@ const b = class b {
398
398
  }
399
399
  keys() {
400
400
  const t = this._elements;
401
- return new c(function* () {
401
+ return new u(function* () {
402
402
  for (const [e] of t)
403
403
  yield e;
404
404
  });
@@ -408,7 +408,7 @@ const b = class b {
408
408
  }
409
409
  values() {
410
410
  const t = this._elements;
411
- return new c(function* () {
411
+ return new u(function* () {
412
412
  for (const [e, n] of t)
413
413
  yield n;
414
414
  });
@@ -424,12 +424,12 @@ const b = class b {
424
424
  }
425
425
  };
426
426
  let d = b;
427
- var pe;
428
- pe = Symbol.toStringTag;
427
+ var ye;
428
+ ye = Symbol.toStringTag;
429
429
  const y = class y {
430
430
  constructor(t) {
431
431
  a(this, "_elements");
432
- a(this, pe, "AggregatedAsyncIterator");
432
+ a(this, ye, "AggregatedAsyncIterator");
433
433
  this._elements = new w(t);
434
434
  }
435
435
  async every(t) {
@@ -499,8 +499,8 @@ const y = class y {
499
499
  const n = /* @__PURE__ */ new Map();
500
500
  for await (const [s, r] of e) {
501
501
  const o = n.get(s) ?? 0, l = await t(s, r, o);
502
- for await (const u of l)
503
- yield [s, u];
502
+ for await (const c of l)
503
+ yield [s, c];
504
504
  n.set(s, o + 1);
505
505
  }
506
506
  });
@@ -608,13 +608,13 @@ const y = class y {
608
608
  }
609
609
  };
610
610
  let E = y;
611
- var ye;
611
+ var ge;
612
612
  class w {
613
613
  constructor(t) {
614
614
  a(this, "_iterator");
615
615
  a(this, "return");
616
616
  a(this, "throw");
617
- a(this, ye, "SmartAsyncIterator");
617
+ a(this, ge, "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* () {
@@ -807,17 +807,17 @@ class w {
807
807
  toArray() {
808
808
  return Array.fromAsync(this);
809
809
  }
810
- [(ye = Symbol.toStringTag, Symbol.asyncIterator)]() {
810
+ [(ge = Symbol.toStringTag, Symbol.asyncIterator)]() {
811
811
  return this;
812
812
  }
813
813
  }
814
- var ge;
815
- ge = Symbol.toStringTag;
814
+ var be;
815
+ be = Symbol.toStringTag;
816
816
  const g = class g {
817
817
  constructor(t) {
818
818
  a(this, "_elements");
819
- a(this, ge, "AggregatedIterator");
820
- this._elements = new c(t);
819
+ a(this, be, "AggregatedIterator");
820
+ this._elements = new u(t);
821
821
  }
822
822
  every(t) {
823
823
  const e = /* @__PURE__ */ new Map();
@@ -886,8 +886,8 @@ const g = class g {
886
886
  const n = /* @__PURE__ */ new Map();
887
887
  for (const [s, r] of e) {
888
888
  const o = n.get(s) ?? 0, l = t(s, r, o);
889
- for (const u of l)
890
- yield [s, u];
889
+ for (const c of l)
890
+ yield [s, c];
891
891
  n.set(s, o + 1);
892
892
  }
893
893
  });
@@ -960,7 +960,7 @@ const g = class g {
960
960
  }
961
961
  keys() {
962
962
  const t = this._elements;
963
- return new c(function* () {
963
+ return new u(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 g = class g {
971
971
  }
972
972
  values() {
973
973
  const t = this._elements;
974
- return new c(function* () {
974
+ return new u(function* () {
975
975
  for (const [e, n] of t)
976
976
  yield n;
977
977
  });
@@ -998,41 +998,56 @@ const g = class g {
998
998
  }
999
999
  };
1000
1000
  let S = g;
1001
- const Be = Function;
1002
- class Ge extends Be {
1001
+ const Qe = Function;
1002
+ var xe, ve;
1003
+ class Xe extends (ve = Qe, xe = Symbol.toStringTag, ve) {
1003
1004
  constructor() {
1004
- super("return this.invoke(...arguments);");
1005
- const t = this.bind(this);
1006
- return Object.setPrototypeOf(this, t), t;
1005
+ super("return this._invoke(...arguments);");
1006
+ a(this, xe, "CallableObject");
1007
+ const e = this.bind(this);
1008
+ return Object.setPrototypeOf(this, e), e;
1007
1009
  }
1008
1010
  }
1009
- var be;
1010
- be = Symbol.toStringTag;
1011
+ var ke;
1012
+ ke = Symbol.toStringTag;
1011
1013
  class M {
1012
1014
  constructor() {
1013
1015
  a(this, "_subscribers");
1014
- a(this, be, "Publisher");
1016
+ a(this, ke, "Publisher");
1015
1017
  this._subscribers = /* @__PURE__ */ new Map();
1016
1018
  }
1019
+ clear() {
1020
+ this._subscribers.clear();
1021
+ }
1022
+ publish(t, ...e) {
1023
+ const n = this._subscribers.get(t);
1024
+ return n ? n.slice().map((s) => s(...e)) : [];
1025
+ }
1017
1026
  subscribe(t, e) {
1018
1027
  this._subscribers.has(t) || this._subscribers.set(t, []);
1019
1028
  const n = this._subscribers.get(t);
1020
1029
  return n.push(e), () => {
1021
1030
  const s = n.indexOf(e);
1022
1031
  if (s < 0)
1023
- throw new Je("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1032
+ throw new I("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1024
1033
  n.splice(s, 1);
1025
1034
  };
1026
1035
  }
1027
- publish(t, ...e) {
1036
+ unsubscribe(t, e) {
1028
1037
  const n = this._subscribers.get(t);
1029
- return n ? n.slice().map((s) => s(...e)) : [];
1038
+ if (!n)
1039
+ return;
1040
+ const s = n.indexOf(e);
1041
+ if (s < 0)
1042
+ throw new I("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
1043
+ n.splice(s, 1);
1030
1044
  }
1031
1045
  }
1032
- class st extends Ge {
1046
+ var Se, Te;
1047
+ class lt extends (Te = Xe, Se = Symbol.toStringTag, Te) {
1033
1048
  constructor() {
1034
1049
  const e = () => {
1035
- throw new ze(
1050
+ throw new Ge(
1036
1051
  "The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?"
1037
1052
  );
1038
1053
  };
@@ -1041,8 +1056,9 @@ class st extends Ge {
1041
1056
  a(this, "_callbacks");
1042
1057
  a(this, "_isEnabled");
1043
1058
  a(this, "_key");
1044
- a(this, "invoke");
1045
- this._callback = e, this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, this._key = "", this.invoke = (...n) => this._callback(...n);
1059
+ a(this, "_invoke");
1060
+ a(this, Se, "SwitchableCallback");
1061
+ this._callback = e, this._callbacks = /* @__PURE__ */ new Map(), this._isEnabled = !0, this._key = "", this._invoke = (...n) => this._callback(...n);
1046
1062
  }
1047
1063
  get isEnabled() {
1048
1064
  return this._isEnabled;
@@ -1083,17 +1099,17 @@ class st extends Ge {
1083
1099
  this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e));
1084
1100
  }
1085
1101
  }
1086
- var xe;
1087
- xe = Symbol.toStringTag;
1088
- class qe {
1102
+ var Ee;
1103
+ Ee = Symbol.toStringTag;
1104
+ class We {
1089
1105
  constructor(t, e = 40) {
1090
1106
  a(this, "_handle");
1091
1107
  a(this, "_startTime");
1092
1108
  a(this, "_isRunning");
1093
1109
  a(this, "_start");
1094
1110
  a(this, "_stop");
1095
- a(this, xe, "GameLoop");
1096
- this._startTime = 0, this._isRunning = !1, Oe ? (this._start = () => {
1111
+ a(this, Ee, "GameLoop");
1112
+ this._startTime = 0, this._isRunning = !1, ze ? (this._start = () => {
1097
1113
  t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
1098
1114
  }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
1099
1115
  `Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`
@@ -1123,16 +1139,16 @@ class qe {
1123
1139
  this._stop(), this._handle = void 0, this._isRunning = !1;
1124
1140
  }
1125
1141
  }
1126
- var ve;
1127
- ve = Symbol.toStringTag;
1128
- class rt {
1142
+ var Me;
1143
+ Me = Symbol.toStringTag;
1144
+ class ut {
1129
1145
  constructor(t = !0) {
1130
1146
  a(this, "_preferPersistence");
1131
1147
  a(this, "_volatile");
1132
1148
  a(this, "_persistent");
1133
- a(this, ve, "JSONStorage");
1134
- if (this._preferPersistence = t, !Oe)
1135
- throw new Ve(
1149
+ a(this, Me, "JSONStorage");
1150
+ if (this._preferPersistence = t, !ze)
1151
+ throw new Ke(
1136
1152
  "The `JSONStorage` class can only be instantiated within a browser environment."
1137
1153
  );
1138
1154
  this._volatile = window.sessionStorage, this._persistent = window.localStorage;
@@ -1265,15 +1281,15 @@ class rt {
1265
1281
  this._volatile.removeItem(t), this._persistent.removeItem(t);
1266
1282
  }
1267
1283
  }
1268
- var ke;
1269
- ke = Symbol.toStringTag;
1284
+ var Fe;
1285
+ Fe = Symbol.toStringTag;
1270
1286
  const R = class R {
1271
1287
  constructor(t) {
1272
1288
  a(this, "_isPending");
1273
1289
  a(this, "_isFulfilled");
1274
1290
  a(this, "_isRejected");
1275
1291
  a(this, "_promise");
1276
- a(this, ke, "SmartPromise");
1292
+ a(this, Fe, "SmartPromise");
1277
1293
  this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
1278
1294
  const e = (s) => (this._isPending = !1, this._isFulfilled = !0, s), n = (s) => {
1279
1295
  throw this._isPending = !1, this._isRejected = !0, s;
@@ -1303,8 +1319,8 @@ const R = class R {
1303
1319
  }
1304
1320
  };
1305
1321
  let T = R;
1306
- var Se, Te;
1307
- class Ke extends (Te = T, Se = Symbol.toStringTag, Te) {
1322
+ var Re, Pe;
1323
+ class Ze extends (Pe = T, Re = Symbol.toStringTag, Pe) {
1308
1324
  constructor(e, n) {
1309
1325
  let s, r;
1310
1326
  super((o, l) => {
@@ -1312,7 +1328,7 @@ class Ke extends (Te = T, Se = Symbol.toStringTag, Te) {
1312
1328
  });
1313
1329
  a(this, "_resolve");
1314
1330
  a(this, "_reject");
1315
- a(this, Se, "DeferredPromise");
1331
+ a(this, Re, "DeferredPromise");
1316
1332
  this._promise.then(e, n), this._resolve = s, this._reject = r;
1317
1333
  }
1318
1334
  get resolve() {
@@ -1325,17 +1341,17 @@ class Ke extends (Te = T, Se = Symbol.toStringTag, Te) {
1325
1341
  return e.then(this.resolve, this.reject), this;
1326
1342
  }
1327
1343
  }
1328
- function it(i) {
1344
+ function ct(i) {
1329
1345
  return new Promise((t) => setTimeout(t, i));
1330
1346
  }
1331
- function ot() {
1347
+ function ht() {
1332
1348
  return new Promise((i) => requestAnimationFrame(() => i()));
1333
1349
  }
1334
1350
  function v() {
1335
1351
  return new Promise((i) => setTimeout(i));
1336
1352
  }
1337
- var Ee;
1338
- Ee = Symbol.toStringTag;
1353
+ var Ce;
1354
+ Ce = Symbol.toStringTag;
1339
1355
  const P = class P {
1340
1356
  constructor(t, e) {
1341
1357
  a(this, "_startTime");
@@ -1348,7 +1364,7 @@ const P = class P {
1348
1364
  a(this, "_hasFailed");
1349
1365
  a(this, "_promise");
1350
1366
  a(this, "_publisher");
1351
- a(this, Ee, "LongRunningTask");
1367
+ a(this, Ce, "LongRunningTask");
1352
1368
  this._startTime = 0, this._estimatedTime = 0, this._currentStep = 0, this._percentage = 0, this._isRunning = !0, this._hasCompleted = !1, this._hasFailed = !1;
1353
1369
  const n = (o) => (this._estimatedTime = 0, this._endTime = Date.now(), this._percentage = 100, this._isRunning = !1, this._hasCompleted = !0, o), s = (o) => {
1354
1370
  throw this._endTime = Date.now(), this._isRunning = !1, this._hasFailed = !0, o;
@@ -1358,23 +1374,23 @@ const P = class P {
1358
1374
  let o;
1359
1375
  this._publisher = new M(), e.totalSteps ? e.stepIncrement ? o = (l) => {
1360
1376
  l ? this._currentStep += l : this._currentStep += e.stepIncrement, this._percentage = this._currentStep / e.totalSteps * 100;
1361
- const u = Date.now() - this._startTime, h = e.totalSteps - this._currentStep;
1362
- this._estimatedTime = u / this._currentStep * h;
1377
+ const c = Date.now() - this._startTime, h = e.totalSteps - this._currentStep;
1378
+ this._estimatedTime = c / this._currentStep * h;
1363
1379
  } : o = (l) => {
1364
1380
  if (l) {
1365
1381
  this._currentStep += l, this._percentage = this._currentStep / e.totalSteps * 100;
1366
- const u = Date.now() - this._startTime, h = e.totalSteps - this._currentStep;
1367
- this._estimatedTime = u / this._currentStep * h;
1382
+ const c = Date.now() - this._startTime, h = e.totalSteps - this._currentStep;
1383
+ this._estimatedTime = c / this._currentStep * h;
1368
1384
  }
1369
1385
  } : e.stepIncrement ? o = (l) => {
1370
1386
  l ? this._currentStep += l : this._currentStep += e.stepIncrement;
1371
1387
  } : o = (l) => {
1372
1388
  l && (this._currentStep += l);
1373
1389
  }, e.ignoreErrors ? r = async (l) => {
1374
- const u = t();
1390
+ const c = t();
1375
1391
  for (this._startTime = Date.now(); ; ) {
1376
1392
  try {
1377
- const { done: h, value: _ } = await u.next();
1393
+ const { done: h, value: _ } = await c.next();
1378
1394
  if (h)
1379
1395
  return l(_);
1380
1396
  o(_);
@@ -1383,42 +1399,42 @@ const P = class P {
1383
1399
  }
1384
1400
  this._publisher.publish("progress"), await v();
1385
1401
  }
1386
- } : r = async (l, u) => {
1402
+ } : r = async (l, c) => {
1387
1403
  try {
1388
1404
  const h = t();
1389
1405
  for (this._startTime = Date.now(); ; ) {
1390
- const { done: _, value: I } = await h.next();
1406
+ const { done: _, value: D } = await h.next();
1391
1407
  if (_)
1392
- return l(I);
1393
- o(I), this._publisher.publish("progress"), await v();
1408
+ return l(D);
1409
+ o(D), this._publisher.publish("progress"), await v();
1394
1410
  }
1395
1411
  } catch (h) {
1396
- u(h);
1412
+ c(h);
1397
1413
  }
1398
1414
  };
1399
1415
  } else e.ignoreErrors ? r = async (o) => {
1400
1416
  const l = t();
1401
1417
  for (this._startTime = Date.now(); ; ) {
1402
1418
  try {
1403
- const { done: u, value: h } = await l.next();
1404
- if (u)
1419
+ const { done: c, value: h } = await l.next();
1420
+ if (c)
1405
1421
  return o(h);
1406
- } catch (u) {
1407
- console.error(u);
1422
+ } catch (c) {
1423
+ console.error(c);
1408
1424
  }
1409
1425
  await v();
1410
1426
  }
1411
1427
  } : r = async (o, l) => {
1412
1428
  try {
1413
- const u = t();
1429
+ const c = t();
1414
1430
  for (this._startTime = Date.now(); ; ) {
1415
- const { done: h, value: _ } = await u.next();
1431
+ const { done: h, value: _ } = await c.next();
1416
1432
  if (h)
1417
1433
  return o(_);
1418
1434
  await v();
1419
1435
  }
1420
- } catch (u) {
1421
- l(u);
1436
+ } catch (c) {
1437
+ l(c);
1422
1438
  }
1423
1439
  };
1424
1440
  this._promise = new Promise(r).then(n, s);
@@ -1477,13 +1493,13 @@ const P = class P {
1477
1493
  return this._publisher.subscribe("progress", t);
1478
1494
  }
1479
1495
  };
1480
- let C = P;
1481
- var Me;
1482
- Me = Symbol.toStringTag;
1483
- class at {
1496
+ let j = P;
1497
+ var De;
1498
+ De = Symbol.toStringTag;
1499
+ class ft {
1484
1500
  constructor() {
1485
1501
  a(this, "_onFulfilled");
1486
- a(this, Me, "Thenable");
1502
+ a(this, De, "Thenable");
1487
1503
  this._onFulfilled = (t) => t;
1488
1504
  }
1489
1505
  _resolve(t) {
@@ -1532,41 +1548,41 @@ class at {
1532
1548
  return this;
1533
1549
  }
1534
1550
  }
1535
- var Fe, Re;
1536
- class lt extends (Re = T, Fe = Symbol.toStringTag, Re) {
1551
+ var Ie, je;
1552
+ class dt extends (je = T, Ie = Symbol.toStringTag, je) {
1537
1553
  constructor(e, n) {
1538
1554
  super((s, r) => {
1539
1555
  const o = (_) => {
1540
1556
  clearTimeout(h), s(_);
1541
1557
  }, l = (_) => {
1542
1558
  clearTimeout(h), r(_);
1543
- }, h = setTimeout(() => l(new We("The operation has timed out.")), n);
1559
+ }, h = setTimeout(() => l(new He("The operation has timed out.")), n);
1544
1560
  e(o, l);
1545
1561
  });
1546
- a(this, Fe, "TimedPromise");
1562
+ a(this, Ie, "TimedPromise");
1547
1563
  }
1548
1564
  }
1549
1565
  var F = /* @__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))(F || {});
1550
- function ut(i, t, e = 864e5) {
1566
+ function mt(i, t, e = 864e5) {
1551
1567
  return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
1552
1568
  }
1553
- function ct(i, t, e = 864e5) {
1554
- return i = new Date(i), t = new Date(t), new c(function* () {
1569
+ function _t(i, t, e = 864e5) {
1570
+ return i = new Date(i), t = new Date(t), new u(function* () {
1555
1571
  const n = t.getTime();
1556
1572
  let s = i.getTime();
1557
1573
  for (; s < n; )
1558
1574
  yield new Date(s), s += e;
1559
1575
  });
1560
1576
  }
1561
- function ht(i, t = 864e5) {
1577
+ function wt(i, t = 864e5) {
1562
1578
  return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
1563
1579
  }
1564
- var Pe, De;
1565
- class ft extends (De = qe, Pe = Symbol.toStringTag, De) {
1580
+ var Oe, Ae;
1581
+ class pt extends (Ae = We, Oe = Symbol.toStringTag, Ae) {
1566
1582
  constructor(e = F.Second) {
1567
1583
  super((n) => this._publisher.publish("tick", n), e);
1568
1584
  a(this, "_publisher");
1569
- a(this, Pe, "Clock");
1585
+ a(this, Oe, "Clock");
1570
1586
  this._publisher = new M();
1571
1587
  }
1572
1588
  start(e = 0) {
@@ -1587,7 +1603,7 @@ class ft extends (De = qe, Pe = Symbol.toStringTag, De) {
1587
1603
  }
1588
1604
  onTick(e, n = 0) {
1589
1605
  if (n < 0)
1590
- throw new $e("The tick step must be a non-negative number.");
1606
+ throw new Ve("The tick step must be a non-negative number.");
1591
1607
  if (n === 0)
1592
1608
  return this._publisher.subscribe("tick", e);
1593
1609
  let s = 0;
@@ -1596,8 +1612,8 @@ class ft extends (De = qe, Pe = Symbol.toStringTag, De) {
1596
1612
  });
1597
1613
  }
1598
1614
  }
1599
- var Ie, Ce;
1600
- class dt extends (Ce = qe, Ie = Symbol.toStringTag, Ce) {
1615
+ var $e, qe;
1616
+ class yt extends (qe = We, $e = Symbol.toStringTag, qe) {
1601
1617
  constructor(e, n = F.Second) {
1602
1618
  super(() => {
1603
1619
  const r = this.remainingTime;
@@ -1606,7 +1622,7 @@ class dt extends (Ce = qe, Ie = Symbol.toStringTag, Ce) {
1606
1622
  a(this, "_deferrer");
1607
1623
  a(this, "_publisher");
1608
1624
  a(this, "_duration");
1609
- a(this, Ie, "Countdown");
1625
+ a(this, $e, "Countdown");
1610
1626
  this._publisher = new M(), this._duration = e;
1611
1627
  }
1612
1628
  get duration() {
@@ -1627,7 +1643,7 @@ class dt extends (Ce = qe, Ie = Symbol.toStringTag, Ce) {
1627
1643
  throw new m("The countdown has already been started.");
1628
1644
  if (this._deferrer)
1629
1645
  throw new k();
1630
- return this._deferrer = new Ke(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
1646
+ return this._deferrer = new Ze(), super.start(this.duration - e), this._publisher.publish("start"), this._deferrer;
1631
1647
  }
1632
1648
  stop(e) {
1633
1649
  this._deferrerStop(e), this._publisher.publish("stop", e);
@@ -1643,7 +1659,7 @@ class dt extends (Ce = qe, Ie = Symbol.toStringTag, Ce) {
1643
1659
  }
1644
1660
  onTick(e, n = 0) {
1645
1661
  if (n < 0)
1646
- throw new $e("The tick step must be a non-negative number.");
1662
+ throw new Ve("The tick step must be a non-negative number.");
1647
1663
  if (n === 0)
1648
1664
  return this._publisher.subscribe("tick", e);
1649
1665
  let s = 0;
@@ -1652,11 +1668,32 @@ class dt extends (Ce = qe, Ie = Symbol.toStringTag, Ce) {
1652
1668
  });
1653
1669
  }
1654
1670
  }
1655
- var je;
1656
- je = Symbol.toStringTag;
1657
- const D = class D {
1671
+ var Ne;
1672
+ Ne = Symbol.toStringTag;
1673
+ class gt {
1658
1674
  constructor() {
1659
- a(this, je, "Random");
1675
+ a(this, Ne, "Curve");
1676
+ }
1677
+ static Linear(t) {
1678
+ const e = 1 / t;
1679
+ return new u(function* () {
1680
+ for (let n = 0; n < t; n += 1)
1681
+ yield n * e;
1682
+ });
1683
+ }
1684
+ static Exponential(t, e = 2) {
1685
+ const n = t - 1;
1686
+ return new u(function* () {
1687
+ for (let s = 0; s < t; s += 1)
1688
+ yield Math.pow(s / n, e);
1689
+ });
1690
+ }
1691
+ }
1692
+ var Ye;
1693
+ Ye = Symbol.toStringTag;
1694
+ const C = class C {
1695
+ constructor() {
1696
+ a(this, Ye, "Random");
1660
1697
  }
1661
1698
  static Boolean(t = 0.5) {
1662
1699
  return Math.random() < t;
@@ -1673,24 +1710,24 @@ const D = class D {
1673
1710
  return this.Integer(t.length);
1674
1711
  }
1675
1712
  static Choice(t) {
1676
- return t[D.Index(t)];
1713
+ return t[C.Index(t)];
1677
1714
  }
1678
1715
  };
1679
- let j = D;
1680
- function mt(i, t = "text/javascript") {
1716
+ let O = C;
1717
+ function bt(i, t = "text/javascript") {
1681
1718
  return new Promise((e, n) => {
1682
1719
  const s = document.createElement("script");
1683
1720
  s.async = !0, s.defer = !0, s.src = i, s.type = t, s.onload = () => e(), s.onerror = () => n(), document.body.appendChild(s);
1684
1721
  });
1685
1722
  }
1686
- function _t(...i) {
1687
- return new c(function* () {
1723
+ function xt(...i) {
1724
+ return new u(function* () {
1688
1725
  for (const t of i)
1689
1726
  for (const e of t)
1690
1727
  yield e;
1691
1728
  });
1692
1729
  }
1693
- function wt(i) {
1730
+ function vt(i) {
1694
1731
  if (Array.isArray(i))
1695
1732
  return i.length;
1696
1733
  let t = 0;
@@ -1698,21 +1735,21 @@ function wt(i) {
1698
1735
  t += 1;
1699
1736
  return t;
1700
1737
  }
1701
- function pt(i) {
1702
- return new c(function* () {
1738
+ function kt(i) {
1739
+ return new u(function* () {
1703
1740
  let t = 0;
1704
1741
  for (const e of i)
1705
1742
  yield [t, e], t += 1;
1706
1743
  });
1707
1744
  }
1708
- function yt(i, t, e = 1) {
1709
- return new c(function* () {
1745
+ function St(i, t, e = 1) {
1746
+ return new u(function* () {
1710
1747
  t === void 0 && (t = i, i = 0), i > t && (e = e ?? -1);
1711
1748
  for (let n = i; n < t; n += e)
1712
1749
  yield n;
1713
1750
  });
1714
1751
  }
1715
- function gt(i) {
1752
+ function Tt(i) {
1716
1753
  const t = Array.from(i);
1717
1754
  for (let e = t.length - 1; e > 0; e -= 1) {
1718
1755
  const n = Math.floor(Math.random() * (e + 1));
@@ -1720,15 +1757,15 @@ function gt(i) {
1720
1757
  }
1721
1758
  return t;
1722
1759
  }
1723
- function bt(i) {
1724
- return new c(function* () {
1760
+ function Et(i) {
1761
+ return new u(function* () {
1725
1762
  const t = /* @__PURE__ */ new Set();
1726
1763
  for (const e of i)
1727
1764
  t.has(e) || (t.add(e), yield e);
1728
1765
  });
1729
1766
  }
1730
- function Le(i, t) {
1731
- return new c(function* () {
1767
+ function Ue(i, t) {
1768
+ return new u(function* () {
1732
1769
  const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
1733
1770
  for (; ; ) {
1734
1771
  const s = e.next(), r = n.next();
@@ -1738,7 +1775,7 @@ function Le(i, t) {
1738
1775
  }
1739
1776
  });
1740
1777
  }
1741
- function xt(i, t) {
1778
+ function Mt(i, t) {
1742
1779
  if (t === void 0) {
1743
1780
  let r = 0, o = 0;
1744
1781
  for (const l of i)
@@ -1748,7 +1785,7 @@ function xt(i, t) {
1748
1785
  return r / o;
1749
1786
  }
1750
1787
  let e = 0, n = 0, s = 0;
1751
- for (const [r, o] of Le(i, t)) {
1788
+ for (const [r, o] of Ue(i, t)) {
1752
1789
  if (o <= 0)
1753
1790
  throw new p(`The weight for the value #${s} must be greater than zero.`);
1754
1791
  e += r * o, n += o, s += 1;
@@ -1759,7 +1796,7 @@ function xt(i, t) {
1759
1796
  throw new p("The sum of weights must be greater than zero.");
1760
1797
  return e / n;
1761
1798
  }
1762
- function vt(i) {
1799
+ function Ft(i) {
1763
1800
  let t = 0;
1764
1801
  for (let e = 0; e < i.length; e += 1) {
1765
1802
  const n = i.charCodeAt(e);
@@ -1767,72 +1804,73 @@ function vt(i) {
1767
1804
  }
1768
1805
  return t;
1769
1806
  }
1770
- function kt(i) {
1807
+ function Rt(i) {
1771
1808
  let t = 0;
1772
1809
  for (const e of i)
1773
1810
  t += e;
1774
1811
  return t;
1775
1812
  }
1776
- function St(i) {
1813
+ function Pt(i) {
1777
1814
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
1778
1815
  }
1779
- const Tt = "2.0.0-rc.10";
1816
+ const Ct = "2.0.0-rc.12";
1780
1817
  export {
1781
1818
  E as AggregatedAsyncIterator,
1782
1819
  S as AggregatedIterator,
1783
- Ge as CallableObject,
1784
- ft as Clock,
1785
- dt as Countdown,
1786
- Ke as DeferredPromise,
1820
+ Xe as CallableObject,
1821
+ pt as Clock,
1822
+ yt as Countdown,
1823
+ gt as Curve,
1824
+ Ze as DeferredPromise,
1787
1825
  f as Exception,
1788
1826
  k as FatalErrorException,
1789
- Ae as FileException,
1790
- Ze as FileExistsException,
1791
- Ue as FileNotFoundException,
1792
- qe as GameLoop,
1793
- rt as JSONStorage,
1827
+ Je as FileException,
1828
+ st as FileExistsException,
1829
+ rt as FileNotFoundException,
1830
+ We as GameLoop,
1831
+ ut as JSONStorage,
1794
1832
  x as KeyException,
1795
- C as LongRunningTask,
1796
- et as NetworkException,
1797
- ze as NotImplementedException,
1798
- tt as PermissionException,
1833
+ j as LongRunningTask,
1834
+ it as NetworkException,
1835
+ Ge as NotImplementedException,
1836
+ ot as PermissionException,
1799
1837
  M as Publisher,
1800
- j as Random,
1801
- $e as RangeException,
1838
+ O as Random,
1839
+ Ve as RangeException,
1802
1840
  d as ReducedIterator,
1803
- Je as ReferenceException,
1841
+ I as ReferenceException,
1804
1842
  m as RuntimeException,
1805
1843
  w as SmartAsyncIterator,
1806
- c as SmartIterator,
1844
+ u as SmartIterator,
1807
1845
  T as SmartPromise,
1808
- st as SwitchableCallback,
1809
- at as Thenable,
1846
+ lt as SwitchableCallback,
1847
+ ft as Thenable,
1810
1848
  F as TimeUnit,
1811
- lt as TimedPromise,
1812
- We as TimeoutException,
1813
- nt as TypeException,
1814
- Tt as VERSION,
1849
+ dt as TimedPromise,
1850
+ He as TimeoutException,
1851
+ at as TypeException,
1852
+ Ct as VERSION,
1815
1853
  p as ValueException,
1816
- xt as average,
1817
- St as capitalize,
1818
- _t as chain,
1819
- wt as count,
1820
- ut as dateDifference,
1821
- ct as dateRange,
1822
- ht as dateRound,
1823
- it as delay,
1824
- pt as enumerate,
1825
- vt as hash,
1826
- Oe as isBrowser,
1827
- Qe as isNode,
1828
- Xe as isWebWorker,
1829
- mt as loadScript,
1830
- ot as nextAnimationFrame,
1831
- yt as range,
1832
- gt as shuffle,
1833
- kt as sum,
1834
- bt as unique,
1854
+ Mt as average,
1855
+ Pt as capitalize,
1856
+ xt as chain,
1857
+ vt as count,
1858
+ mt as dateDifference,
1859
+ _t as dateRange,
1860
+ wt as dateRound,
1861
+ ct as delay,
1862
+ kt as enumerate,
1863
+ Ft as hash,
1864
+ ze as isBrowser,
1865
+ tt as isNode,
1866
+ nt as isWebWorker,
1867
+ bt as loadScript,
1868
+ ht as nextAnimationFrame,
1869
+ St as range,
1870
+ Tt as shuffle,
1871
+ Rt as sum,
1872
+ Et as unique,
1835
1873
  v as yieldToEventLoop,
1836
- Le as zip
1874
+ Ue as zip
1837
1875
  };
1838
1876
  //# sourceMappingURL=core.js.map