@byloth/core 1.5.0 → 1.5.2

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,6 +1,6 @@
1
1
  var S = Object.defineProperty;
2
- var b = (o, e, t) => e in o ? S(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var u = (o, e, t) => b(o, typeof e != "symbol" ? e + "" : e, t);
2
+ var b = (s, e, t) => e in s ? S(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var u = (s, e, t) => b(s, typeof e != "symbol" ? e + "" : e, t);
4
4
  class c {
5
5
  constructor(e) {
6
6
  u(this, "_iterator");
@@ -57,16 +57,16 @@ class c {
57
57
  reduce(e, t) {
58
58
  let n = 0, r = t;
59
59
  if (r === void 0) {
60
- const s = this._iterator.next();
61
- if (s.done)
60
+ const o = this._iterator.next();
61
+ if (o.done)
62
62
  throw new TypeError("Reduce of empty iterator with no initial value");
63
- r = s.value, n += 1;
63
+ r = o.value, n += 1;
64
64
  }
65
65
  for (; ; ) {
66
- const s = this._iterator.next();
67
- if (s.done)
66
+ const o = this._iterator.next();
67
+ if (o.done)
68
68
  return r;
69
- r = e(r, s.value, n), n += 1;
69
+ r = e(r, o.value, n), n += 1;
70
70
  }
71
71
  }
72
72
  enumerate() {
@@ -203,16 +203,16 @@ class h {
203
203
  async reduce(e, t) {
204
204
  let n = 0, r = t;
205
205
  if (r === void 0) {
206
- const s = await this._iterator.next();
207
- if (s.done)
206
+ const o = await this._iterator.next();
207
+ if (o.done)
208
208
  throw new TypeError("Reduce of empty iterator with no initial value");
209
- r = s.value, n += 1;
209
+ r = o.value, n += 1;
210
210
  }
211
211
  for (; ; ) {
212
- const s = await this._iterator.next();
213
- if (s.done)
212
+ const o = await this._iterator.next();
213
+ if (o.done)
214
214
  return r;
215
- r = await e(r, s.value, n), n += 1;
215
+ r = await e(r, o.value, n), n += 1;
216
216
  }
217
217
  }
218
218
  enumerate() {
@@ -312,6 +312,14 @@ class R extends f {
312
312
  }
313
313
  }
314
314
  class q extends f {
315
+ constructor(e, t, n = "KeyException") {
316
+ super(e, t, n);
317
+ }
318
+ get [Symbol.toStringTag]() {
319
+ return "KeyException";
320
+ }
321
+ }
322
+ class A extends f {
315
323
  constructor(e, t, n = "NetworkException") {
316
324
  super(e, t, n);
317
325
  }
@@ -319,7 +327,7 @@ class q extends f {
319
327
  return "NetworkException";
320
328
  }
321
329
  }
322
- class A extends f {
330
+ class O extends f {
323
331
  constructor(e, t, n = "PermissionException") {
324
332
  super(e, t, n);
325
333
  }
@@ -335,7 +343,7 @@ class k extends f {
335
343
  return "ReferenceException";
336
344
  }
337
345
  }
338
- class O extends f {
346
+ class $ extends f {
339
347
  constructor(e, t, n = "RuntimeException") {
340
348
  super(e, t, n);
341
349
  }
@@ -375,15 +383,15 @@ class a {
375
383
  filter(e) {
376
384
  const t = this._elements;
377
385
  return new a(function* () {
378
- for (const [n, [r, s]] of t.enumerate())
379
- e(r, s, n) && (yield [r, s]);
386
+ for (const [n, [r, o]] of t.enumerate())
387
+ e(r, o, n) && (yield [r, o]);
380
388
  });
381
389
  }
382
390
  map(e) {
383
391
  const t = this._elements;
384
392
  return new a(function* () {
385
- for (const [n, [r, s]] of t.enumerate())
386
- yield [r, e(r, s, n)];
393
+ for (const [n, [r, o]] of t.enumerate())
394
+ yield [r, e(r, o, n)];
387
395
  });
388
396
  }
389
397
  reduce(e, t) {
@@ -391,13 +399,13 @@ class a {
391
399
  if (t !== void 0)
392
400
  r = t;
393
401
  else {
394
- const s = this._elements.next();
395
- if (s.done)
402
+ const o = this._elements.next();
403
+ if (o.done)
396
404
  throw new E("Reduce of empty iterator with no initial value");
397
- n += 1, r = s.value[1];
405
+ n += 1, r = o.value[1];
398
406
  }
399
- for (const [s, i] of this._elements)
400
- r = e(s, r, i, n), n += 1;
407
+ for (const [o, i] of this._elements)
408
+ r = e(o, r, i, n), n += 1;
401
409
  return r;
402
410
  }
403
411
  keys() {
@@ -438,32 +446,32 @@ class d {
438
446
  every(e) {
439
447
  const t = /* @__PURE__ */ new Map();
440
448
  for (const [n, r] of this._elements) {
441
- const [s, i] = t.get(n) ?? [0, !0];
442
- i && t.set(n, [s + 1, e(n, r, s)]);
449
+ const [o, i] = t.get(n) ?? [0, !0];
450
+ i && t.set(n, [o + 1, e(n, r, o)]);
443
451
  }
444
452
  return new a(function* () {
445
- for (const [n, [r, s]] of t)
446
- yield [n, s];
453
+ for (const [n, [r, o]] of t)
454
+ yield [n, o];
447
455
  });
448
456
  }
449
457
  some(e) {
450
458
  const t = /* @__PURE__ */ new Map();
451
459
  for (const [n, r] of this._elements) {
452
- const [s, i] = t.get(n) ?? [0, !1];
453
- i || t.set(n, [s + 1, e(n, r, s)]);
460
+ const [o, i] = t.get(n) ?? [0, !1];
461
+ i || t.set(n, [o + 1, e(n, r, o)]);
454
462
  }
455
463
  return new a(function* () {
456
- for (const [n, [r, s]] of t)
457
- yield [n, s];
464
+ for (const [n, [r, o]] of t)
465
+ yield [n, o];
458
466
  });
459
467
  }
460
468
  filter(e) {
461
469
  const t = this._elements;
462
470
  return new d(function* () {
463
471
  const n = /* @__PURE__ */ new Map();
464
- for (const [r, s] of t) {
472
+ for (const [r, o] of t) {
465
473
  const i = n.get(r) ?? 0;
466
- n.set(r, i + 1), e(r, s, i) && (yield [r, s]);
474
+ n.set(r, i + 1), e(r, o, i) && (yield [r, o]);
467
475
  }
468
476
  });
469
477
  }
@@ -471,28 +479,28 @@ class d {
471
479
  const t = this._elements;
472
480
  return new d(function* () {
473
481
  const n = /* @__PURE__ */ new Map();
474
- for (const [r, s] of t) {
482
+ for (const [r, o] of t) {
475
483
  const i = n.get(r) ?? 0;
476
- n.set(r, i + 1), yield [r, e(r, s, i)];
484
+ n.set(r, i + 1), yield [r, e(r, o, i)];
477
485
  }
478
486
  });
479
487
  }
480
488
  reduce(e, t) {
481
489
  const n = /* @__PURE__ */ new Map();
482
- for (const [r, s] of this._elements) {
490
+ for (const [r, o] of this._elements) {
483
491
  let i, l;
484
492
  if (n.has(r))
485
493
  [i, l] = n.get(r), i += 1;
486
494
  else if (t !== void 0)
487
495
  i = 0, l = t(r);
488
496
  else {
489
- n.set(r, [0, s]);
497
+ n.set(r, [0, o]);
490
498
  continue;
491
499
  }
492
- l = e(r, l, s, i), n.set(r, [i, l]);
500
+ l = e(r, l, o, i), n.set(r, [i, l]);
493
501
  }
494
502
  return new a(function* () {
495
- for (const [r, [s, i]] of n)
503
+ for (const [r, [o, i]] of n)
496
504
  yield [r, i];
497
505
  });
498
506
  }
@@ -501,8 +509,8 @@ class d {
501
509
  return new d(function* () {
502
510
  const t = /* @__PURE__ */ new Map();
503
511
  for (const [n, r] of e) {
504
- const s = t.get(n) ?? /* @__PURE__ */ new Set();
505
- s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
512
+ const o = t.get(n) ?? /* @__PURE__ */ new Set();
513
+ o.has(r) || (o.add(r), t.set(n, o), yield [n, r]);
506
514
  }
507
515
  });
508
516
  }
@@ -605,32 +613,32 @@ class y {
605
613
  async every(e) {
606
614
  const t = /* @__PURE__ */ new Map();
607
615
  for await (const [n, r] of this._elements) {
608
- const [s, i] = t.get(n) ?? [0, !0];
609
- i && t.set(n, [s + 1, await e(n, r, s)]);
616
+ const [o, i] = t.get(n) ?? [0, !0];
617
+ i && t.set(n, [o + 1, await e(n, r, o)]);
610
618
  }
611
619
  return new a(function* () {
612
- for (const [n, [r, s]] of t)
613
- yield [n, s];
620
+ for (const [n, [r, o]] of t)
621
+ yield [n, o];
614
622
  });
615
623
  }
616
624
  async some(e) {
617
625
  const t = /* @__PURE__ */ new Map();
618
626
  for await (const [n, r] of this._elements) {
619
- const [s, i] = t.get(n) ?? [0, !1];
620
- i || t.set(n, [s + 1, await e(n, r, s)]);
627
+ const [o, i] = t.get(n) ?? [0, !1];
628
+ i || t.set(n, [o + 1, await e(n, r, o)]);
621
629
  }
622
630
  return new a(function* () {
623
- for (const [n, [r, s]] of t)
624
- yield [n, s];
631
+ for (const [n, [r, o]] of t)
632
+ yield [n, o];
625
633
  });
626
634
  }
627
635
  filter(e) {
628
636
  const t = this._elements;
629
637
  return new y(async function* () {
630
638
  const n = /* @__PURE__ */ new Map();
631
- for await (const [r, s] of t) {
639
+ for await (const [r, o] of t) {
632
640
  const i = n.get(r) ?? 0;
633
- n.set(r, i + 1), await e(r, s, i) && (yield [r, s]);
641
+ n.set(r, i + 1), await e(r, o, i) && (yield [r, o]);
634
642
  }
635
643
  });
636
644
  }
@@ -638,28 +646,28 @@ class y {
638
646
  const t = this._elements;
639
647
  return new y(async function* () {
640
648
  const n = /* @__PURE__ */ new Map();
641
- for await (const [r, s] of t) {
649
+ for await (const [r, o] of t) {
642
650
  const i = n.get(r) ?? 0;
643
- n.set(r, i + 1), yield [r, await e(r, s, i)];
651
+ n.set(r, i + 1), yield [r, await e(r, o, i)];
644
652
  }
645
653
  });
646
654
  }
647
655
  async reduce(e, t) {
648
656
  const n = /* @__PURE__ */ new Map();
649
- for await (const [r, s] of this._elements) {
657
+ for await (const [r, o] of this._elements) {
650
658
  let i, l;
651
659
  if (n.has(r))
652
660
  [i, l] = n.get(r), i += 1;
653
661
  else if (t !== void 0)
654
662
  i = 0, l = await t(r);
655
663
  else {
656
- n.set(r, [0, s]);
664
+ n.set(r, [0, o]);
657
665
  continue;
658
666
  }
659
- l = await e(r, l, s, i), n.set(r, [i, l]);
667
+ l = await e(r, l, o, i), n.set(r, [i, l]);
660
668
  }
661
669
  return new a(function* () {
662
- for (const [r, [s, i]] of n)
670
+ for (const [r, [o, i]] of n)
663
671
  yield [r, i];
664
672
  });
665
673
  }
@@ -668,8 +676,8 @@ class y {
668
676
  return new y(async function* () {
669
677
  const t = /* @__PURE__ */ new Map();
670
678
  for await (const [n, r] of e) {
671
- const s = t.get(n) ?? /* @__PURE__ */ new Set();
672
- s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
679
+ const o = t.get(n) ?? /* @__PURE__ */ new Set();
680
+ o.has(r) || (o.add(r), t.set(n, o), yield [n, r]);
673
681
  }
674
682
  });
675
683
  }
@@ -765,7 +773,7 @@ class _ {
765
773
  return "AsyncAggregator";
766
774
  }
767
775
  }
768
- class $ {
776
+ class C {
769
777
  constructor(e = !0) {
770
778
  u(this, "_preferPersistence");
771
779
  u(this, "_volatile");
@@ -903,7 +911,7 @@ class $ {
903
911
  return "JsonStorage";
904
912
  }
905
913
  }
906
- class C {
914
+ class N {
907
915
  constructor() {
908
916
  u(this, "_subscribers");
909
917
  this._subscribers = [];
@@ -958,15 +966,15 @@ class g {
958
966
  return "SmartPromise";
959
967
  }
960
968
  }
961
- class N extends g {
969
+ class Y extends g {
962
970
  constructor(t, n) {
963
- let r, s;
971
+ let r, o;
964
972
  super((i, l) => {
965
- r = i, s = l;
973
+ r = i, o = l;
966
974
  });
967
975
  u(this, "_resolve");
968
976
  u(this, "_reject");
969
- this._promise.then(t, n), this._resolve = r, this._reject = s;
977
+ this._promise.then(t, n), this._resolve = r, this._reject = o;
970
978
  }
971
979
  get resolve() {
972
980
  return this._resolve;
@@ -981,15 +989,15 @@ class N extends g {
981
989
  return "DeferredPromise";
982
990
  }
983
991
  }
984
- class Y extends g {
992
+ class z extends g {
985
993
  constructor(e, t) {
986
994
  super((n, r) => {
987
- const s = (p) => {
995
+ const o = (p) => {
988
996
  clearTimeout(x), n(p);
989
997
  }, i = (p) => {
990
998
  clearTimeout(x), r(p);
991
999
  }, x = setTimeout(() => i(new T("The operation has timed out.")), t);
992
- e(s, i);
1000
+ e(o, i);
993
1001
  });
994
1002
  }
995
1003
  get [Symbol.toStringTag]() {
@@ -1018,102 +1026,102 @@ class v {
1018
1026
  constructor() {
1019
1027
  }
1020
1028
  }
1021
- async function z(o) {
1022
- return new Promise((e, t) => setTimeout(e, o));
1029
+ async function J(s) {
1030
+ return new Promise((e, t) => setTimeout(e, s));
1023
1031
  }
1024
- async function J() {
1025
- return new Promise((o, e) => requestAnimationFrame(() => o()));
1032
+ async function V() {
1033
+ return new Promise((s, e) => requestAnimationFrame(() => s()));
1026
1034
  }
1027
- var M = /* @__PURE__ */ ((o) => (o[o.Second = 1e3] = "Second", o[o.Minute = 6e4] = "Minute", o[o.Hour = 36e5] = "Hour", o[o.Day = 864e5] = "Day", o[o.Week = 6048e5] = "Week", o[o.Month = 2592e6] = "Month", o[o.Year = 31536e6] = "Year", o))(M || {});
1028
- function V(o, e, t = 864e5) {
1029
- return Math.floor((e.getTime() - o.getTime()) / t);
1035
+ var M = /* @__PURE__ */ ((s) => (s[s.Millisecond = 1] = "Millisecond", s[s.Second = 1e3] = "Second", s[s.Minute = 6e4] = "Minute", s[s.Hour = 36e5] = "Hour", s[s.Day = 864e5] = "Day", s[s.Week = 6048e5] = "Week", s[s.Month = 2592e6] = "Month", s[s.Year = 31536e6] = "Year", s))(M || {});
1036
+ function B(s, e, t = 864e5) {
1037
+ return Math.floor((e.getTime() - s.getTime()) / t);
1030
1038
  }
1031
- function B(o, e, t = 864e5) {
1039
+ function K(s, e, t = 864e5) {
1032
1040
  return new c(function* () {
1033
1041
  const n = e.getTime();
1034
- let r = o.getTime();
1042
+ let r = s.getTime();
1035
1043
  for (; r < n; )
1036
1044
  yield new Date(r), r += t;
1037
1045
  });
1038
1046
  }
1039
- function H(o, e = 864e5) {
1040
- return new Date(Math.floor(o.getTime() / e) * e);
1047
+ function H(s, e = 864e5) {
1048
+ return new Date(Math.floor(s.getTime() / e) * e);
1041
1049
  }
1042
- function W(o, e = "text/javascript") {
1050
+ function W(s, e = "text/javascript") {
1043
1051
  return new Promise((t, n) => {
1044
1052
  const r = document.createElement("script");
1045
- r.async = !0, r.defer = !0, r.src = o, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
1053
+ r.async = !0, r.defer = !0, r.src = s, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
1046
1054
  });
1047
1055
  }
1048
- function G(...o) {
1056
+ function G(...s) {
1049
1057
  return new c(function* () {
1050
- for (const e of o)
1058
+ for (const e of s)
1051
1059
  for (const t of e)
1052
1060
  yield t;
1053
1061
  });
1054
1062
  }
1055
- function K(o) {
1056
- if (Array.isArray(o))
1057
- return o.length;
1063
+ function L(s) {
1064
+ if (Array.isArray(s))
1065
+ return s.length;
1058
1066
  let e = 0;
1059
- for (const t of o)
1067
+ for (const t of s)
1060
1068
  e += 1;
1061
1069
  return e;
1062
1070
  }
1063
- function L(o) {
1071
+ function Q(s) {
1064
1072
  return new c(function* () {
1065
1073
  let e = 0;
1066
- for (const t of o)
1074
+ for (const t of s)
1067
1075
  yield [e, t], e += 1;
1068
1076
  });
1069
1077
  }
1070
- function Q(o, e, t = 1) {
1078
+ function X(s, e, t = 1) {
1071
1079
  return new c(function* () {
1072
- e === void 0 && (e = o, o = 0), o > e && (t = t ?? -1);
1073
- for (let n = o; n < e; n += t)
1080
+ e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
1081
+ for (let n = s; n < e; n += t)
1074
1082
  yield n;
1075
1083
  });
1076
1084
  }
1077
- function X(o) {
1078
- const e = Array.from(o);
1085
+ function Z(s) {
1086
+ const e = Array.from(s);
1079
1087
  for (let t = e.length - 1; t > 0; t -= 1) {
1080
1088
  const n = Math.floor(Math.random() * (t + 1));
1081
1089
  [e[t], e[n]] = [e[n], e[t]];
1082
1090
  }
1083
1091
  return e;
1084
1092
  }
1085
- function Z(o) {
1093
+ function D(s) {
1086
1094
  return new c(function* () {
1087
1095
  const e = /* @__PURE__ */ new Set();
1088
- for (const t of o)
1096
+ for (const t of s)
1089
1097
  e.has(t) || (e.add(t), yield t);
1090
1098
  });
1091
1099
  }
1092
- function P(o, e) {
1100
+ function P(s, e) {
1093
1101
  return new c(function* () {
1094
- const t = o[Symbol.iterator](), n = e[Symbol.iterator]();
1102
+ const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
1095
1103
  for (; ; ) {
1096
- const r = t.next(), s = n.next();
1097
- if (r.done || s.done)
1104
+ const r = t.next(), o = n.next();
1105
+ if (r.done || o.done)
1098
1106
  break;
1099
- yield [r.value, s.value];
1107
+ yield [r.value, o.value];
1100
1108
  }
1101
1109
  });
1102
1110
  }
1103
- function D(o, e) {
1111
+ function U(s, e) {
1104
1112
  if (e === void 0) {
1105
- let s = 0, i = 0;
1106
- for (const l of o)
1107
- s += l, i += 1;
1113
+ let o = 0, i = 0;
1114
+ for (const l of s)
1115
+ o += l, i += 1;
1108
1116
  if (i === 0)
1109
1117
  throw new m("You must provide at least one value.");
1110
- return s / i;
1118
+ return o / i;
1111
1119
  }
1112
1120
  let t = 0, n = 0, r = 0;
1113
- for (const [s, i] of P(o, e)) {
1121
+ for (const [o, i] of P(s, e)) {
1114
1122
  if (i <= 0)
1115
1123
  throw new m(`The weight for the value #${r} must be greater than zero.`);
1116
- t += s * i, n += i, r += 1;
1124
+ t += o * i, n += i, r += 1;
1117
1125
  }
1118
1126
  if (r === 0)
1119
1127
  throw new m("You must provide at least one value and weight.");
@@ -1121,67 +1129,68 @@ function D(o, e) {
1121
1129
  throw new m("The sum of weights must be greater than zero.");
1122
1130
  return t / n;
1123
1131
  }
1124
- function U(o) {
1132
+ function ee(s) {
1125
1133
  let e = 0;
1126
- for (let t = 0; t < o.length; t += 1) {
1127
- const n = o.charCodeAt(t);
1134
+ for (let t = 0; t < s.length; t += 1) {
1135
+ const n = s.charCodeAt(t);
1128
1136
  e = (e << 5) - e + n, e |= 0;
1129
1137
  }
1130
1138
  return e;
1131
1139
  }
1132
- function ee(o) {
1140
+ function te(s) {
1133
1141
  let e = 0;
1134
- for (const t of o)
1142
+ for (const t of s)
1135
1143
  e += t;
1136
1144
  return e;
1137
1145
  }
1138
- function te(o) {
1139
- return `${o.charAt(0).toUpperCase()}${o.slice(1)}`;
1146
+ function ne(s) {
1147
+ return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
1140
1148
  }
1141
- const ne = "1.5.0";
1149
+ const re = "1.5.2";
1142
1150
  export {
1143
1151
  y as AggregatedAsyncIterator,
1144
1152
  d as AggregatedIterator,
1145
1153
  w as Aggregator,
1146
1154
  _ as AsyncAggregator,
1147
1155
  M as DateUnit,
1148
- N as DeferredPromise,
1156
+ Y as DeferredPromise,
1149
1157
  f as Exception,
1150
1158
  j as FatalErrorException,
1151
1159
  R as FileNotFoundException,
1152
- $ as JsonStorage,
1153
- q as NetworkException,
1160
+ C as JsonStorage,
1161
+ q as KeyException,
1162
+ A as NetworkException,
1154
1163
  F as NotImplementedException,
1155
- A as PermissionException,
1164
+ O as PermissionException,
1156
1165
  v as Random,
1157
1166
  a as ReducedIterator,
1158
1167
  k as ReferenceException,
1159
- O as RuntimeException,
1168
+ $ as RuntimeException,
1160
1169
  h as SmartAsyncIterator,
1161
1170
  c as SmartIterator,
1162
1171
  g as SmartPromise,
1163
- C as Subscribers,
1164
- Y as TimedPromise,
1172
+ N as Subscribers,
1173
+ z as TimedPromise,
1165
1174
  T as TimeoutException,
1166
1175
  E as TypeException,
1167
- ne as VERSION,
1176
+ re as VERSION,
1168
1177
  m as ValueException,
1169
- D as average,
1170
- te as capitalize,
1178
+ U as average,
1179
+ ne as capitalize,
1171
1180
  G as chain,
1172
- K as count,
1173
- V as dateDifference,
1174
- B as dateRange,
1181
+ L as count,
1182
+ B as dateDifference,
1183
+ K as dateRange,
1175
1184
  H as dateRound,
1176
- z as delay,
1177
- L as enumerate,
1178
- U as hash,
1185
+ J as delay,
1186
+ Q as enumerate,
1187
+ ee as hash,
1179
1188
  W as loadScript,
1180
- J as nextAnimationFrame,
1181
- Q as range,
1182
- X as shuffle,
1183
- ee as sum,
1184
- Z as unique,
1189
+ V as nextAnimationFrame,
1190
+ X as range,
1191
+ Z as shuffle,
1192
+ te as sum,
1193
+ D as unique,
1185
1194
  P as zip
1186
1195
  };
1187
1196
  //# sourceMappingURL=core.js.map