@byloth/core 2.1.1 → 2.1.3

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.esm.js CHANGED
@@ -65,8 +65,8 @@ Caused by ${t}`);
65
65
  return new c(`${e}`);
66
66
  }
67
67
  }
68
- var $, z;
69
- class g extends (z = c, $ = Symbol.toStringTag, z) {
68
+ var $, q;
69
+ class g extends (q = c, $ = Symbol.toStringTag, q) {
70
70
  /**
71
71
  * Initializes a new instance of the {@link FatalErrorException} class.
72
72
  *
@@ -89,8 +89,8 @@ class g extends (z = c, $ = Symbol.toStringTag, z) {
89
89
  a(this, $, "FatalErrorException");
90
90
  }
91
91
  }
92
- var q, D;
93
- class Ve extends (D = g, q = Symbol.toStringTag, D) {
92
+ var z, D;
93
+ class Ve extends (D = g, z = Symbol.toStringTag, D) {
94
94
  /**
95
95
  * Initializes a new instance of the {@link NotImplementedException} class.
96
96
  *
@@ -110,7 +110,7 @@ class Ve extends (D = g, q = Symbol.toStringTag, D) {
110
110
  constructor(e, t, s = "NotImplementedException") {
111
111
  e === void 0 && (e = "This feature isn't implemented yet. Please, try again later.");
112
112
  super(e, t, s);
113
- a(this, q, "NotImplementedException");
113
+ a(this, z, "NotImplementedException");
114
114
  }
115
115
  }
116
116
  var B, J;
@@ -228,8 +228,8 @@ class ot extends (X = c, Q = Symbol.toStringTag, X) {
228
228
  a(this, Q, "NetworkException");
229
229
  }
230
230
  }
231
- var Z, W;
232
- class at extends (W = c, Z = Symbol.toStringTag, W) {
231
+ var Z, U;
232
+ class at extends (U = c, Z = Symbol.toStringTag, U) {
233
233
  /**
234
234
  * Initializes a new instance of the {@link PermissionException} class.
235
235
  *
@@ -251,8 +251,8 @@ class at extends (W = c, Z = Symbol.toStringTag, W) {
251
251
  a(this, Z, "PermissionException");
252
252
  }
253
253
  }
254
- var U, ee;
255
- class C extends (ee = c, U = Symbol.toStringTag, ee) {
254
+ var W, ee;
255
+ class E extends (ee = c, W = Symbol.toStringTag, ee) {
256
256
  /**
257
257
  * Initializes a new instance of the {@link ReferenceException} class.
258
258
  *
@@ -271,7 +271,7 @@ class C extends (ee = c, U = Symbol.toStringTag, ee) {
271
271
  */
272
272
  constructor(e, t, s = "ReferenceException") {
273
273
  super(e, t, s);
274
- a(this, U, "ReferenceException");
274
+ a(this, W, "ReferenceException");
275
275
  }
276
276
  }
277
277
  var te, ne;
@@ -1844,8 +1844,8 @@ const w = class w {
1844
1844
  for await (const [s, r] of e) {
1845
1845
  const o = t.get(s) ?? 0, l = await n(s, r, o);
1846
1846
  if (l instanceof Array)
1847
- for (const k of l)
1848
- yield [s, k];
1847
+ for (const S of l)
1848
+ yield [s, S];
1849
1849
  else
1850
1850
  yield [s, l];
1851
1851
  t.set(s, o + 1);
@@ -2295,7 +2295,7 @@ const w = class w {
2295
2295
  return n;
2296
2296
  }
2297
2297
  };
2298
- let E = w;
2298
+ let M = w;
2299
2299
  var pe;
2300
2300
  class f {
2301
2301
  constructor(n) {
@@ -2917,7 +2917,7 @@ class f {
2917
2917
  * @returns A new instance of the {@link AggregatedAsyncIterator} class containing the grouped elements.
2918
2918
  */
2919
2919
  groupBy(n) {
2920
- return new E(this.map(async (e, t) => [await n(e, t), e]));
2920
+ return new M(this.map(async (e, t) => [await n(e, t), e]));
2921
2921
  }
2922
2922
  /**
2923
2923
  * Materializes the iterator into an array.
@@ -3156,8 +3156,8 @@ const m = class m {
3156
3156
  for (const [s, r] of e) {
3157
3157
  const o = t.get(s) ?? 0, l = n(s, r, o);
3158
3158
  if (l instanceof Array)
3159
- for (const k of l)
3160
- yield [s, k];
3159
+ for (const S of l)
3160
+ yield [s, S];
3161
3161
  else
3162
3162
  yield [s, l];
3163
3163
  t.set(s, o + 1);
@@ -3717,12 +3717,11 @@ class v {
3717
3717
  * @returns A function that can be used to unsubscribe the subscriber from the event.
3718
3718
  */
3719
3719
  subscribe(n, e) {
3720
- this._subscribers.has(n) || this._subscribers.set(n, []);
3721
- const t = this._subscribers.get(n);
3722
- return t.push(e), () => {
3720
+ const t = this._subscribers.get(n) ?? [];
3721
+ return t.push(e), this._subscribers.set(n, t), () => {
3723
3722
  const s = t.indexOf(e);
3724
3723
  if (s < 0)
3725
- throw new C("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3724
+ throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
3726
3725
  t.splice(s, 1);
3727
3726
  };
3728
3727
  }
@@ -3749,11 +3748,11 @@ class v {
3749
3748
  unsubscribe(n, e) {
3750
3749
  const t = this._subscribers.get(n);
3751
3750
  if (!t)
3752
- return;
3751
+ throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3753
3752
  const s = t.indexOf(e);
3754
3753
  if (s < 0)
3755
- throw new C("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3756
- t.splice(s, 1);
3754
+ throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");
3755
+ t.splice(s, 1), t.length === 0 && this._subscribers.delete(n);
3757
3756
  }
3758
3757
  }
3759
3758
  const Xe = () => {
@@ -3945,8 +3944,8 @@ class ut extends (ve = Qe, xe = Symbol.toStringTag, ve) {
3945
3944
  this._key !== e && (this._key = e, this._isEnabled && (this._callback = this._callbacks.get(e)));
3946
3945
  }
3947
3946
  }
3948
- var ke, Se;
3949
- class ct extends (Se = Map, ke = Symbol.toStringTag, Se) {
3947
+ var Se, ke;
3948
+ class ct extends (ke = Map, Se = Symbol.toStringTag, ke) {
3950
3949
  /**
3951
3950
  * Initializes a new instance of the {@link MapView} class.
3952
3951
  *
@@ -3967,7 +3966,7 @@ class ct extends (Se = Map, ke = Symbol.toStringTag, Se) {
3967
3966
  * The internal {@link Publisher} instance used to publish events.
3968
3967
  */
3969
3968
  a(this, "_publisher");
3970
- a(this, ke, "MapView");
3969
+ a(this, Se, "MapView");
3971
3970
  if (this._publisher = new v(), e)
3972
3971
  for (const [t, s] of e)
3973
3972
  this.set(t, s);
@@ -4019,8 +4018,8 @@ class ct extends (Se = Map, ke = Symbol.toStringTag, Se) {
4019
4018
  * @returns `true` if the entry existed and has been removed; otherwise `false` if the entry doesn't exist.
4020
4019
  */
4021
4020
  delete(e) {
4022
- const t = super.delete(e);
4023
- return t && this._publisher.publish("entry:remove", e), t;
4021
+ const t = this.get(e);
4022
+ return t === void 0 ? !1 : (super.delete(e), this._publisher.publish("entry:remove", e, t), !0);
4024
4023
  }
4025
4024
  /**
4026
4025
  * Removes all entries from the {@link Map}.
@@ -4564,7 +4563,7 @@ class ft {
4564
4563
  }
4565
4564
  var Re;
4566
4565
  Re = Symbol.toStringTag;
4567
- const R = class R {
4566
+ const F = class F {
4568
4567
  /**
4569
4568
  * Initializes a new instance of the {@link SmartPromise} class.
4570
4569
  *
@@ -4641,7 +4640,7 @@ const R = class R {
4641
4640
  * @returns A new {@link SmartPromise} object that wraps the provided promise.
4642
4641
  */
4643
4642
  static FromPromise(n) {
4644
- return new R((e, t) => n.then(e, t));
4643
+ return new F((e, t) => n.then(e, t));
4645
4644
  }
4646
4645
  /**
4647
4646
  * A flag indicating whether the promise is still pending or not.
@@ -4697,9 +4696,9 @@ const R = class R {
4697
4696
  return this._promise.finally(n);
4698
4697
  }
4699
4698
  };
4700
- let S = R;
4699
+ let k = F;
4701
4700
  var Fe, Pe;
4702
- class Ze extends (Pe = S, Fe = Symbol.toStringTag, Pe) {
4701
+ class Ze extends (Pe = k, Fe = Symbol.toStringTag, Pe) {
4703
4702
  /**
4704
4703
  * Initializes a new instance of the {@link DeferredPromise} class.
4705
4704
  *
@@ -4774,7 +4773,7 @@ class Ze extends (Pe = S, Fe = Symbol.toStringTag, Pe) {
4774
4773
  }
4775
4774
  }
4776
4775
  var Ce, je;
4777
- class dt extends (je = S, Ce = Symbol.toStringTag, je) {
4776
+ class dt extends (je = k, Ce = Symbol.toStringTag, je) {
4778
4777
  /**
4779
4778
  * Initializes a new instance of the {@link TimedPromise} class.
4780
4779
  *
@@ -4800,16 +4799,16 @@ class dt extends (je = S, Ce = Symbol.toStringTag, je) {
4800
4799
  constructor(e, t) {
4801
4800
  super((s, r) => {
4802
4801
  const o = (T) => {
4803
- clearTimeout(P), s(T);
4802
+ clearTimeout(C), s(T);
4804
4803
  }, l = (T) => {
4805
- clearTimeout(P), r(T);
4806
- }, P = setTimeout(() => l(new Ke("The operation has timed out.")), t);
4804
+ clearTimeout(C), r(T);
4805
+ }, C = setTimeout(() => l(new Ke("The operation has timed out.")), t);
4807
4806
  e(o, l);
4808
4807
  });
4809
4808
  a(this, Ce, "TimedPromise");
4810
4809
  }
4811
4810
  }
4812
- var M = /* @__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))(M || {}), We = /* @__PURE__ */ ((i) => (i[i.Sunday = 0] = "Sunday", i[i.Monday = 1] = "Monday", i[i.Tuesday = 2] = "Tuesday", i[i.Wednesday = 3] = "Wednesday", i[i.Thursday = 4] = "Thursday", i[i.Friday = 5] = "Friday", i[i.Saturday = 6] = "Saturday", i))(We || {});
4811
+ var R = /* @__PURE__ */ ((i) => (i[i.Millisecond = 1] = "Millisecond", i[i.Second = 1e3] = "Second", i[i.Minute = 6e4] = "Minute", i[i.Hour = 36e5] = "Hour", i[i.Day = 864e5] = "Day", i[i.Week = 6048e5] = "Week", i[i.Month = 2592e6] = "Month", i[i.Year = 31536e6] = "Year", i))(R || {}), Ue = /* @__PURE__ */ ((i) => (i[i.Sunday = 0] = "Sunday", i[i.Monday = 1] = "Monday", i[i.Tuesday = 2] = "Tuesday", i[i.Wednesday = 3] = "Wednesday", i[i.Thursday = 4] = "Thursday", i[i.Friday = 5] = "Friday", i[i.Saturday = 6] = "Saturday", i))(Ue || {});
4813
4812
  function wt(i, n, e = 864e5) {
4814
4813
  let t;
4815
4814
  return i = new Date(i), n = new Date(n), i < n ? t = Math.floor : t = Math.ceil, t((n.getTime() - i.getTime()) / e);
@@ -4824,7 +4823,7 @@ function mt(i, n, e = 864e5) {
4824
4823
  yield new Date(s), s += e;
4825
4824
  });
4826
4825
  }
4827
- function Ue(i, n = 864e5) {
4826
+ function We(i, n = 864e5) {
4828
4827
  if (n <= 1)
4829
4828
  throw new b(
4830
4829
  "Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead."
@@ -4838,7 +4837,7 @@ function Ue(i, n = 864e5) {
4838
4837
  function pt(i, n = 0) {
4839
4838
  i = new Date(i);
4840
4839
  const e = 7 - n, t = (i.getUTCDay() + e) % 7, s = i.getTime() - 864e5 * t;
4841
- return Ue(new Date(s));
4840
+ return We(new Date(s));
4842
4841
  }
4843
4842
  var Ie;
4844
4843
  Ie = Symbol.toStringTag;
@@ -5028,7 +5027,7 @@ class yt extends (Ne = Je, Ae = Symbol.toStringTag, Ne) {
5028
5027
  * The interval in milliseconds at which the clock will tick if the environment is not a browser.
5029
5028
  * `TimeUnit.Second` by default.
5030
5029
  */
5031
- constructor(e = M.Second) {
5030
+ constructor(e = R.Second) {
5032
5031
  super((t) => this._publisher.publish("tick", t), e);
5033
5032
  /**
5034
5033
  * The {@link Publisher} object that will be used to publish the events of the clock.
@@ -5135,7 +5134,7 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
5135
5134
  * The interval in milliseconds at which the countdown will tick if the environment is not a browser.
5136
5135
  * `TimeUnit.Second` by default.
5137
5136
  */
5138
- constructor(e, t = M.Second) {
5137
+ constructor(e, t = R.Second) {
5139
5138
  super(() => {
5140
5139
  const r = this.remainingTime;
5141
5140
  r <= 0 ? (this._deferrerStop(), this._publisher.publish("tick", 0), this._publisher.publish("expire")) : this._publisher.publish("tick", r);
@@ -5297,11 +5296,11 @@ class _t extends ($e = Je, Oe = Symbol.toStringTag, $e) {
5297
5296
  });
5298
5297
  }
5299
5298
  }
5300
- var ze;
5301
- ze = Symbol.toStringTag;
5299
+ var qe;
5300
+ qe = Symbol.toStringTag;
5302
5301
  class bt {
5303
5302
  constructor() {
5304
- a(this, ze, "Curve");
5303
+ a(this, qe, "Curve");
5305
5304
  }
5306
5305
  /**
5307
5306
  * Generates a given number of values following a linear curve.
@@ -5368,11 +5367,11 @@ class bt {
5368
5367
  });
5369
5368
  }
5370
5369
  }
5371
- var qe;
5372
- qe = Symbol.toStringTag;
5373
- const F = class F {
5370
+ var ze;
5371
+ ze = Symbol.toStringTag;
5372
+ const P = class P {
5374
5373
  constructor() {
5375
- a(this, qe, "Random");
5374
+ a(this, ze, "Random");
5376
5375
  }
5377
5376
  /**
5378
5377
  * Generates a random boolean value.
@@ -5439,10 +5438,10 @@ const F = class F {
5439
5438
  * @returns A random element from the given array.
5440
5439
  */
5441
5440
  static Choice(n) {
5442
- return n[F.Index(n)];
5441
+ return n[P.Index(n)];
5443
5442
  }
5444
5443
  };
5445
- let j = F;
5444
+ let j = P;
5446
5445
  function gt(i) {
5447
5446
  return new Promise((n) => setTimeout(n, i));
5448
5447
  }
@@ -5452,13 +5451,13 @@ function xt() {
5452
5451
  function vt() {
5453
5452
  return new Promise((i) => setTimeout(i));
5454
5453
  }
5455
- function kt(i, n = "text/javascript") {
5454
+ function St(i, n = "text/javascript") {
5456
5455
  return new Promise((e, t) => {
5457
5456
  const s = document.createElement("script");
5458
5457
  s.async = !0, s.defer = !0, s.src = i, s.type = n, s.onload = (r) => e(), s.onerror = (r) => t(r), document.body.appendChild(s);
5459
5458
  });
5460
5459
  }
5461
- function St(...i) {
5460
+ function kt(...i) {
5462
5461
  return new u(function* () {
5463
5462
  for (const n of i)
5464
5463
  for (const e of n)
@@ -5557,9 +5556,9 @@ function jt(i) {
5557
5556
  function It(i) {
5558
5557
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
5559
5558
  }
5560
- const At = "2.1.1";
5559
+ const At = "2.1.3";
5561
5560
  export {
5562
- E as AggregatedAsyncIterator,
5561
+ M as AggregatedAsyncIterator,
5563
5562
  x as AggregatedIterator,
5564
5563
  Qe as CallableObject,
5565
5564
  yt as Clock,
@@ -5583,27 +5582,27 @@ export {
5583
5582
  j as Random,
5584
5583
  b as RangeException,
5585
5584
  h as ReducedIterator,
5586
- C as ReferenceException,
5585
+ E as ReferenceException,
5587
5586
  p as RuntimeException,
5588
5587
  ht as SetView,
5589
5588
  f as SmartAsyncIterator,
5590
5589
  u as SmartIterator,
5591
- S as SmartPromise,
5590
+ k as SmartPromise,
5592
5591
  ut as SwitchableCallback,
5593
- M as TimeUnit,
5592
+ R as TimeUnit,
5594
5593
  dt as TimedPromise,
5595
5594
  Ke as TimeoutException,
5596
5595
  lt as TypeException,
5597
5596
  At as VERSION,
5598
5597
  d as ValueException,
5599
- We as WeekDay,
5598
+ Ue as WeekDay,
5600
5599
  Pt as average,
5601
5600
  It as capitalize,
5602
- St as chain,
5601
+ kt as chain,
5603
5602
  Tt as count,
5604
5603
  wt as dateDifference,
5605
5604
  mt as dateRange,
5606
- Ue as dateRound,
5605
+ We as dateRound,
5607
5606
  gt as delay,
5608
5607
  Et as enumerate,
5609
5608
  pt as getWeek,
@@ -5611,7 +5610,7 @@ export {
5611
5610
  De as isBrowser,
5612
5611
  nt as isNode,
5613
5612
  st as isWorker,
5614
- kt as loadScript,
5613
+ St as loadScript,
5615
5614
  xt as nextAnimationFrame,
5616
5615
  Mt as range,
5617
5616
  Rt as shuffle,