@byloth/core 1.5.0-rc.5 → 1.5.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,7 +1,7 @@
1
- var g = Object.defineProperty;
2
- var p = (s, e, t) => e in s ? g(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var u = (s, e, t) => (p(s, typeof e != "symbol" ? e + "" : e, t), t);
4
- class l {
1
+ var S = Object.defineProperty;
2
+ var k = (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) => k(o, typeof e != "symbol" ? e + "" : e, t);
4
+ class a {
5
5
  constructor(e) {
6
6
  u(this, "_iterator");
7
7
  u(this, "return");
@@ -32,7 +32,7 @@ class l {
32
32
  }
33
33
  filter(e) {
34
34
  const t = this._iterator;
35
- return new l(function* () {
35
+ return new a(function* () {
36
36
  let n = 0;
37
37
  for (; ; ) {
38
38
  const r = t.next();
@@ -44,7 +44,7 @@ class l {
44
44
  }
45
45
  map(e) {
46
46
  const t = this._iterator;
47
- return new l(function* () {
47
+ return new a(function* () {
48
48
  let n = 0;
49
49
  for (; ; ) {
50
50
  const r = t.next();
@@ -57,16 +57,16 @@ class l {
57
57
  reduce(e, t) {
58
58
  let n = 0, r = t;
59
59
  if (r === void 0) {
60
- const o = this._iterator.next();
61
- if (o.done)
60
+ const s = this._iterator.next();
61
+ if (s.done)
62
62
  throw new TypeError("Reduce of empty iterator with no initial value");
63
- r = o.value, n += 1;
63
+ r = s.value, n += 1;
64
64
  }
65
65
  for (; ; ) {
66
- const o = this._iterator.next();
67
- if (o.done)
66
+ const s = this._iterator.next();
67
+ if (s.done)
68
68
  return r;
69
- r = e(r, o.value, n), n += 1;
69
+ r = e(r, s.value, n), n += 1;
70
70
  }
71
71
  }
72
72
  enumerate() {
@@ -74,7 +74,7 @@ class l {
74
74
  }
75
75
  unique() {
76
76
  const e = this._iterator;
77
- return new l(function* () {
77
+ return new a(function* () {
78
78
  const t = /* @__PURE__ */ new Set();
79
79
  for (; ; ) {
80
80
  const n = e.next();
@@ -114,28 +114,161 @@ class l {
114
114
  return this;
115
115
  }
116
116
  }
117
- class a {
117
+ class h {
118
+ constructor(e) {
119
+ u(this, "_iterator");
120
+ u(this, "return");
121
+ u(this, "throw");
122
+ e instanceof Function ? this._iterator = e() : Symbol.asyncIterator in e ? this._iterator = e[Symbol.asyncIterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
123
+ }
124
+ async every(e) {
125
+ let t = 0;
126
+ for (; ; ) {
127
+ const n = await this._iterator.next();
128
+ if (n.done)
129
+ return !0;
130
+ if (!e(n.value, t))
131
+ return !1;
132
+ t += 1;
133
+ }
134
+ }
135
+ async some(e) {
136
+ let t = 0;
137
+ for (; ; ) {
138
+ const n = await this._iterator.next();
139
+ if (n.done)
140
+ return !1;
141
+ if (e(n.value, t))
142
+ return !0;
143
+ t += 1;
144
+ }
145
+ }
146
+ filter(e) {
147
+ const t = this._iterator;
148
+ return new h(async function* () {
149
+ let n = 0;
150
+ for (; ; ) {
151
+ const r = await t.next();
152
+ if (r.done)
153
+ return r.value;
154
+ e(r.value, n) && (yield r.value), n += 1;
155
+ }
156
+ });
157
+ }
158
+ map(e) {
159
+ const t = this._iterator;
160
+ return new h(async function* () {
161
+ let n = 0;
162
+ for (; ; ) {
163
+ const r = await t.next();
164
+ if (r.done)
165
+ return r.value;
166
+ yield e(r.value, n), n += 1;
167
+ }
168
+ });
169
+ }
170
+ async reduce(e, t) {
171
+ let n = 0, r = t;
172
+ if (r === void 0) {
173
+ const s = await this._iterator.next();
174
+ if (s.done)
175
+ throw new TypeError("Reduce of empty iterator with no initial value");
176
+ r = s.value, n += 1;
177
+ }
178
+ for (; ; ) {
179
+ const s = await this._iterator.next();
180
+ if (s.done)
181
+ return r;
182
+ r = await e(r, s.value, n), n += 1;
183
+ }
184
+ }
185
+ enumerate() {
186
+ return this.map((e, t) => [t, e]);
187
+ }
188
+ unique() {
189
+ const e = this._iterator;
190
+ return new h(async function* () {
191
+ const t = /* @__PURE__ */ new Set();
192
+ for (; ; ) {
193
+ const n = await e.next();
194
+ if (n.done)
195
+ return n.value;
196
+ t.has(n.value) || (t.add(n.value), yield n.value);
197
+ }
198
+ });
199
+ }
200
+ async count() {
201
+ let e = 0;
202
+ for (; ; ) {
203
+ if ((await this._iterator.next()).done)
204
+ return e;
205
+ e += 1;
206
+ }
207
+ }
208
+ async forEach(e) {
209
+ let t = 0;
210
+ for (; ; ) {
211
+ const n = await this._iterator.next();
212
+ if (n.done)
213
+ return;
214
+ await e(n.value, t), t += 1;
215
+ }
216
+ }
217
+ next(...e) {
218
+ return this._iterator.next(...e);
219
+ }
220
+ async toArray() {
221
+ const e = [];
222
+ for (; ; ) {
223
+ const t = await this._iterator.next();
224
+ if (t.done)
225
+ return e;
226
+ e.push(t.value);
227
+ }
228
+ }
229
+ get [Symbol.toStringTag]() {
230
+ return "SmartAsyncIterator";
231
+ }
232
+ [Symbol.asyncIterator]() {
233
+ return this;
234
+ }
235
+ }
236
+ class l {
118
237
  constructor(e) {
119
238
  u(this, "_elements");
120
- this._elements = new l(e);
239
+ this._elements = new a(e);
121
240
  }
122
241
  filter(e) {
123
242
  const t = this._elements;
124
- return new a(function* () {
125
- for (const [n, [r, o]] of t.enumerate())
126
- e(r, o, n) && (yield [r, o]);
243
+ return new l(function* () {
244
+ for (const [n, [r, s]] of t.enumerate())
245
+ e(r, s, n) && (yield [r, s]);
127
246
  });
128
247
  }
129
248
  map(e) {
130
249
  const t = this._elements;
131
- return new a(function* () {
132
- for (const [n, [r, o]] of t.enumerate())
133
- yield [r, e(r, o, n)];
250
+ return new l(function* () {
251
+ for (const [n, [r, s]] of t.enumerate())
252
+ yield [r, e(r, s, n)];
134
253
  });
135
254
  }
255
+ reduce(e, t) {
256
+ let n = 0, r;
257
+ if (t !== void 0)
258
+ r = t;
259
+ else {
260
+ const s = this._elements.next();
261
+ if (s.done)
262
+ throw new TypeError("Reduce of empty iterator with no initial value");
263
+ n += 1, r = s.value[1];
264
+ }
265
+ for (const [s, i] of this._elements)
266
+ r = e(s, r, i, n), n += 1;
267
+ return r;
268
+ }
136
269
  keys() {
137
270
  const e = this._elements;
138
- return new l(function* () {
271
+ return new a(function* () {
139
272
  for (const [t] of e)
140
273
  yield t;
141
274
  });
@@ -145,7 +278,7 @@ class a {
145
278
  }
146
279
  values() {
147
280
  const e = this._elements;
148
- return new l(function* () {
281
+ return new a(function* () {
149
282
  for (const [t, n] of e)
150
283
  yield n;
151
284
  });
@@ -163,79 +296,79 @@ class a {
163
296
  return "ReducedIterator";
164
297
  }
165
298
  }
166
- class h {
299
+ class d {
167
300
  constructor(e) {
168
301
  u(this, "_elements");
169
- this._elements = new l(e);
302
+ this._elements = new a(e);
170
303
  }
171
304
  every(e) {
172
305
  const t = /* @__PURE__ */ new Map();
173
306
  for (const [n, r] of this._elements) {
174
- const [o, i] = t.get(n) ?? [0, !0];
175
- i && t.set(n, [o + 1, e(n, r, o)]);
307
+ const [s, i] = t.get(n) ?? [0, !0];
308
+ i && t.set(n, [s + 1, e(n, r, s)]);
176
309
  }
177
- return new a(function* () {
178
- for (const [n, [r, o]] of t)
179
- yield [n, o];
310
+ return new l(function* () {
311
+ for (const [n, [r, s]] of t)
312
+ yield [n, s];
180
313
  });
181
314
  }
182
315
  some(e) {
183
316
  const t = /* @__PURE__ */ new Map();
184
317
  for (const [n, r] of this._elements) {
185
- const [o, i] = t.get(n) ?? [0, !1];
186
- i || t.set(n, [o + 1, e(n, r, o)]);
318
+ const [s, i] = t.get(n) ?? [0, !1];
319
+ i || t.set(n, [s + 1, e(n, r, s)]);
187
320
  }
188
- return new a(function* () {
189
- for (const [n, [r, o]] of t)
190
- yield [n, o];
321
+ return new l(function* () {
322
+ for (const [n, [r, s]] of t)
323
+ yield [n, s];
191
324
  });
192
325
  }
193
326
  filter(e) {
194
327
  const t = this._elements;
195
- return new h(function* () {
328
+ return new d(function* () {
196
329
  const n = /* @__PURE__ */ new Map();
197
- for (const [r, o] of t) {
330
+ for (const [r, s] of t) {
198
331
  const i = n.get(r) ?? 0;
199
- n.set(r, i + 1), e(r, o, i) && (yield [r, o]);
332
+ n.set(r, i + 1), e(r, s, i) && (yield [r, s]);
200
333
  }
201
334
  });
202
335
  }
203
336
  map(e) {
204
337
  const t = this._elements;
205
- return new h(function* () {
338
+ return new d(function* () {
206
339
  const n = /* @__PURE__ */ new Map();
207
- for (const [r, o] of t) {
340
+ for (const [r, s] of t) {
208
341
  const i = n.get(r) ?? 0;
209
- n.set(r, i + 1), yield [r, e(r, o, i)];
342
+ n.set(r, i + 1), yield [r, e(r, s, i)];
210
343
  }
211
344
  });
212
345
  }
213
346
  reduce(e, t) {
214
347
  const n = /* @__PURE__ */ new Map();
215
- for (const [r, o] of this._elements) {
348
+ for (const [r, s] of this._elements) {
216
349
  let i, c;
217
350
  if (n.has(r))
218
351
  [i, c] = n.get(r), i += 1;
219
352
  else if (t !== void 0)
220
353
  i = 0, c = t(r);
221
354
  else {
222
- n.set(r, [0, o]);
355
+ n.set(r, [0, s]);
223
356
  continue;
224
357
  }
225
- c = e(r, c, o, i), n.set(r, [i, c]);
358
+ c = e(r, c, s, i), n.set(r, [i, c]);
226
359
  }
227
- return new a(function* () {
228
- for (const [r, [o, i]] of n)
360
+ return new l(function* () {
361
+ for (const [r, [s, i]] of n)
229
362
  yield [r, i];
230
363
  });
231
364
  }
232
365
  unique() {
233
366
  const e = this._elements;
234
- return new h(function* () {
367
+ return new d(function* () {
235
368
  const t = /* @__PURE__ */ new Map();
236
369
  for (const [n, r] of e) {
237
- const o = t.get(n) ?? /* @__PURE__ */ new Set();
238
- o.has(r) || (o.add(r), t.set(n, o), yield [n, r]);
370
+ const s = t.get(n) ?? /* @__PURE__ */ new Set();
371
+ s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
239
372
  }
240
373
  });
241
374
  }
@@ -245,7 +378,7 @@ class h {
245
378
  const n = e.get(t) ?? 0;
246
379
  e.set(t, n + 1);
247
380
  }
248
- return new a(function* () {
381
+ return new l(function* () {
249
382
  for (const [t, n] of e)
250
383
  yield [t, n];
251
384
  });
@@ -254,7 +387,7 @@ class h {
254
387
  const e = /* @__PURE__ */ new Map();
255
388
  for (const [t, n] of this._elements)
256
389
  e.has(t) || e.set(t, n);
257
- return new a(function* () {
390
+ return new l(function* () {
258
391
  for (const [t, n] of e)
259
392
  yield [t, n];
260
393
  });
@@ -263,16 +396,17 @@ class h {
263
396
  const e = /* @__PURE__ */ new Map();
264
397
  for (const [t, n] of this._elements)
265
398
  e.set(t, n);
266
- return new a(function* () {
399
+ return new l(function* () {
267
400
  for (const [t, n] of e)
268
401
  yield [t, n];
269
402
  });
270
403
  }
271
404
  keys() {
272
405
  const e = this._elements;
273
- return new l(function* () {
274
- for (const [t] of e)
275
- yield t;
406
+ return new a(function* () {
407
+ const t = /* @__PURE__ */ new Set();
408
+ for (const [n] of e)
409
+ t.has(n) || (t.add(n), yield n);
276
410
  });
277
411
  }
278
412
  items() {
@@ -280,7 +414,7 @@ class h {
280
414
  }
281
415
  values() {
282
416
  const e = this._elements;
283
- return new l(function* () {
417
+ return new a(function* () {
284
418
  for (const [t, n] of e)
285
419
  yield n;
286
420
  });
@@ -308,27 +442,195 @@ class h {
308
442
  return "AggregatedIterator";
309
443
  }
310
444
  }
311
- class m {
445
+ class y {
312
446
  constructor(e) {
313
447
  u(this, "_elements");
314
- this._elements = new l(e);
448
+ this._elements = new a(e);
315
449
  }
316
450
  filter(e) {
317
- return new m(this._elements.filter(e));
451
+ return new y(this._elements.filter(e));
318
452
  }
319
453
  map(e) {
320
- return new m(this._elements.map(e));
454
+ return new y(this._elements.map(e));
321
455
  }
322
456
  unique() {
323
- return new m(this._elements.unique());
457
+ return new y(this._elements.unique());
324
458
  }
325
459
  groupBy(e) {
326
- return new h(this._elements.map((t, n) => [e(t, n), t]));
460
+ return new d(this._elements.map((t, n) => [e(t, n), t]));
327
461
  }
328
462
  get [Symbol.toStringTag]() {
329
463
  return "Aggregator";
330
464
  }
331
465
  }
466
+ class w {
467
+ constructor(e) {
468
+ u(this, "_elements");
469
+ this._elements = new h(e);
470
+ }
471
+ async every(e) {
472
+ const t = /* @__PURE__ */ new Map();
473
+ for await (const [n, r] of this._elements) {
474
+ const [s, i] = t.get(n) ?? [0, !0];
475
+ i && t.set(n, [s + 1, await e(n, r, s)]);
476
+ }
477
+ return new l(function* () {
478
+ for (const [n, [r, s]] of t)
479
+ yield [n, s];
480
+ });
481
+ }
482
+ async some(e) {
483
+ const t = /* @__PURE__ */ new Map();
484
+ for await (const [n, r] of this._elements) {
485
+ const [s, i] = t.get(n) ?? [0, !1];
486
+ i || t.set(n, [s + 1, await e(n, r, s)]);
487
+ }
488
+ return new l(function* () {
489
+ for (const [n, [r, s]] of t)
490
+ yield [n, s];
491
+ });
492
+ }
493
+ filter(e) {
494
+ const t = this._elements;
495
+ return new w(async function* () {
496
+ const n = /* @__PURE__ */ new Map();
497
+ for await (const [r, s] of t) {
498
+ const i = n.get(r) ?? 0;
499
+ n.set(r, i + 1), e(r, s, i) && (yield [r, s]);
500
+ }
501
+ });
502
+ }
503
+ map(e) {
504
+ const t = this._elements;
505
+ return new w(async function* () {
506
+ const n = /* @__PURE__ */ new Map();
507
+ for await (const [r, s] of t) {
508
+ const i = n.get(r) ?? 0;
509
+ n.set(r, i + 1), yield [r, await e(r, s, i)];
510
+ }
511
+ });
512
+ }
513
+ async reduce(e, t) {
514
+ const n = /* @__PURE__ */ new Map();
515
+ for await (const [r, s] of this._elements) {
516
+ let i, c;
517
+ if (n.has(r))
518
+ [i, c] = n.get(r), i += 1;
519
+ else if (t !== void 0)
520
+ i = 0, c = t(r);
521
+ else {
522
+ n.set(r, [0, s]);
523
+ continue;
524
+ }
525
+ c = await e(r, c, s, i), n.set(r, [i, c]);
526
+ }
527
+ return new l(function* () {
528
+ for (const [r, [s, i]] of n)
529
+ yield [r, i];
530
+ });
531
+ }
532
+ unique() {
533
+ const e = this._elements;
534
+ return new w(async function* () {
535
+ const t = /* @__PURE__ */ new Map();
536
+ for await (const [n, r] of e) {
537
+ const s = t.get(n) ?? /* @__PURE__ */ new Set();
538
+ s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
539
+ }
540
+ });
541
+ }
542
+ async count() {
543
+ const e = /* @__PURE__ */ new Map();
544
+ for await (const [t] of this._elements) {
545
+ const n = e.get(t) ?? 0;
546
+ e.set(t, n + 1);
547
+ }
548
+ return new l(function* () {
549
+ for (const [t, n] of e)
550
+ yield [t, n];
551
+ });
552
+ }
553
+ async first() {
554
+ const e = /* @__PURE__ */ new Map();
555
+ for await (const [t, n] of this._elements)
556
+ e.has(t) || e.set(t, n);
557
+ return new l(function* () {
558
+ for (const [t, n] of e)
559
+ yield [t, n];
560
+ });
561
+ }
562
+ async last() {
563
+ const e = /* @__PURE__ */ new Map();
564
+ for await (const [t, n] of this._elements)
565
+ e.set(t, n);
566
+ return new l(function* () {
567
+ for (const [t, n] of e)
568
+ yield [t, n];
569
+ });
570
+ }
571
+ keys() {
572
+ const e = this._elements;
573
+ return new h(async function* () {
574
+ const t = /* @__PURE__ */ new Set();
575
+ for await (const [n] of e)
576
+ t.has(n) || (t.add(n), yield n);
577
+ });
578
+ }
579
+ items() {
580
+ return this._elements;
581
+ }
582
+ values() {
583
+ const e = this._elements;
584
+ return new h(async function* () {
585
+ for await (const [t, n] of e)
586
+ yield n;
587
+ });
588
+ }
589
+ async toArray() {
590
+ const e = await this.toMap();
591
+ return Array.from(e.values());
592
+ }
593
+ async toMap() {
594
+ const e = /* @__PURE__ */ new Map();
595
+ for await (const [t, n] of this._elements) {
596
+ const r = e.get(t) ?? [];
597
+ r.push(n), e.set(t, r);
598
+ }
599
+ return e;
600
+ }
601
+ async toObject() {
602
+ const e = {};
603
+ for await (const [t, n] of this._elements) {
604
+ const r = e[t] ?? [];
605
+ r.push(n), e[t] = r;
606
+ }
607
+ return e;
608
+ }
609
+ get [Symbol.toStringTag]() {
610
+ return "AggregatedAsyncIterator";
611
+ }
612
+ }
613
+ class _ {
614
+ constructor(e) {
615
+ u(this, "_elements");
616
+ this._elements = new h(e);
617
+ }
618
+ filter(e) {
619
+ return new _(this._elements.filter(e));
620
+ }
621
+ map(e) {
622
+ return new _(this._elements.map(e));
623
+ }
624
+ unique() {
625
+ return new _(this._elements.unique());
626
+ }
627
+ groupBy(e) {
628
+ return new w(this._elements.map(async (t, n) => [await e(t, n), t]));
629
+ }
630
+ get [Symbol.toStringTag]() {
631
+ return "AsyncAggregator";
632
+ }
633
+ }
332
634
  class f extends Error {
333
635
  static FromUnknown(e) {
334
636
  if (e instanceof f)
@@ -350,7 +652,23 @@ Caused by ${t}`);
350
652
  return "Exception";
351
653
  }
352
654
  }
353
- class v extends f {
655
+ class P extends f {
656
+ constructor(e, t, n = "FatalErrorException") {
657
+ e === void 0 && (e = "The routine has encountered an unrecoverable error and cannot continue as expected. Please, refresh the page and try again. If the problem persists, contact the support team."), super(e, t, n);
658
+ }
659
+ get [Symbol.toStringTag]() {
660
+ return "FatalErrorException";
661
+ }
662
+ }
663
+ class F extends f {
664
+ constructor(e, t, n = "FileNotFoundException") {
665
+ super(e, t, n);
666
+ }
667
+ get [Symbol.toStringTag]() {
668
+ return "FileNotFoundException";
669
+ }
670
+ }
671
+ class b extends f {
354
672
  constructor(e, t, n = "ReferenceException") {
355
673
  super(e, t, n);
356
674
  }
@@ -358,7 +676,15 @@ class v extends f {
358
676
  return "ReferenceException";
359
677
  }
360
678
  }
361
- class x extends f {
679
+ class I extends f {
680
+ constructor(e, t, n = "RuntimeException") {
681
+ super(e, t, n);
682
+ }
683
+ get [Symbol.toStringTag]() {
684
+ return "RuntimeException";
685
+ }
686
+ }
687
+ class T extends f {
362
688
  constructor(e, t, n = "TimeoutException") {
363
689
  super(e, t, n);
364
690
  }
@@ -366,7 +692,15 @@ class x extends f {
366
692
  return "TimeoutException";
367
693
  }
368
694
  }
369
- class _ extends f {
695
+ class R extends f {
696
+ constructor(e, t, n = "TypeException") {
697
+ super(e, t, n);
698
+ }
699
+ get [Symbol.toStringTag]() {
700
+ return "TypeException";
701
+ }
702
+ }
703
+ class m extends f {
370
704
  constructor(e, t, n = "ValueException") {
371
705
  super(e, t, n);
372
706
  }
@@ -374,7 +708,7 @@ class _ extends f {
374
708
  return "ValueException";
375
709
  }
376
710
  }
377
- class T {
711
+ class q {
378
712
  constructor(e = !0) {
379
713
  u(this, "_preferPersistence");
380
714
  u(this, "_volatile");
@@ -512,7 +846,7 @@ class T {
512
846
  return "JsonStorage";
513
847
  }
514
848
  }
515
- class M {
849
+ class A {
516
850
  constructor() {
517
851
  u(this, "_subscribers");
518
852
  this._subscribers = [];
@@ -523,7 +857,7 @@ class M {
523
857
  remove(e) {
524
858
  const t = this._subscribers.indexOf(e);
525
859
  if (t < 0)
526
- throw new v("Unable to remove the requested subscriber. It was not found.");
860
+ throw new b("Unable to remove the requested subscriber. It was not found.");
527
861
  this._subscribers.splice(t, 1);
528
862
  }
529
863
  call(...e) {
@@ -533,7 +867,7 @@ class M {
533
867
  return "Subscribers";
534
868
  }
535
869
  }
536
- class w {
870
+ class x {
537
871
  constructor(e) {
538
872
  u(this, "_isPending");
539
873
  u(this, "_isFulfilled");
@@ -567,15 +901,15 @@ class w {
567
901
  return "SmartPromise";
568
902
  }
569
903
  }
570
- class j extends w {
904
+ class O extends x {
571
905
  constructor(t, n) {
572
- let r, o;
906
+ let r, s;
573
907
  super((i, c) => {
574
- r = i, o = c;
908
+ r = i, s = c;
575
909
  });
576
910
  u(this, "_resolve");
577
911
  u(this, "_reject");
578
- this._promise.then(t, n), this._resolve = r, this._reject = o;
912
+ this._promise.then(t, n), this._resolve = r, this._reject = s;
579
913
  }
580
914
  get resolve() {
581
915
  return this._resolve;
@@ -590,22 +924,22 @@ class j extends w {
590
924
  return "DeferredPromise";
591
925
  }
592
926
  }
593
- class P extends w {
927
+ class $ extends x {
594
928
  constructor(e, t) {
595
929
  super((n, r) => {
596
- const o = (d) => {
597
- clearTimeout(y), n(d);
598
- }, i = (d) => {
599
- clearTimeout(y), r(d);
600
- }, y = setTimeout(() => i(new x("The operation has timed out.")), t);
601
- e(o, i);
930
+ const s = (p) => {
931
+ clearTimeout(g), n(p);
932
+ }, i = (p) => {
933
+ clearTimeout(g), r(p);
934
+ }, g = setTimeout(() => i(new T("The operation has timed out.")), t);
935
+ e(s, i);
602
936
  });
603
937
  }
604
938
  get [Symbol.toStringTag]() {
605
939
  return "TimedPromise";
606
940
  }
607
941
  }
608
- class E {
942
+ class v {
609
943
  static Boolean(e = 0.5) {
610
944
  return Math.random() < e;
611
945
  }
@@ -613,150 +947,164 @@ class E {
613
947
  return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
614
948
  }
615
949
  static Decimal(e, t) {
616
- return t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
950
+ return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
951
+ }
952
+ static Index(e) {
953
+ if (e.length === 0)
954
+ throw new m("You must provide at least one element.");
955
+ return this.Integer(e.length);
617
956
  }
618
957
  static Choice(e) {
619
- return e[this.Integer(e.length)];
958
+ return e[v.Index(e)];
620
959
  }
621
960
  // eslint-disable-next-line no-useless-constructor
622
961
  constructor() {
623
962
  }
624
963
  }
625
- async function I(s) {
626
- return new Promise((e, t) => setTimeout(e, s));
964
+ async function C(o) {
965
+ return new Promise((e, t) => setTimeout(e, o));
627
966
  }
628
- async function R() {
629
- return new Promise((s, e) => requestAnimationFrame(() => s()));
967
+ async function Y() {
968
+ return new Promise((o, e) => requestAnimationFrame(() => o()));
630
969
  }
631
- var b = /* @__PURE__ */ ((s) => (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))(b || {});
632
- function A(s, e, t = 864e5) {
633
- return Math.floor((e.getTime() - s.getTime()) / t);
970
+ 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 || {});
971
+ function z(o, e, t = 864e5) {
972
+ return Math.floor((e.getTime() - o.getTime()) / t);
634
973
  }
635
- function F(s, e, t = 864e5) {
636
- return new l(function* () {
974
+ function J(o, e, t = 864e5) {
975
+ return new a(function* () {
637
976
  const n = e.getTime();
638
- let r = s.getTime();
977
+ let r = o.getTime();
639
978
  for (; r < n; )
640
979
  yield new Date(r), r += t;
641
980
  });
642
981
  }
643
- function q(s, e = 864e5) {
644
- return new Date(Math.floor(s.getTime() / e) * e);
982
+ function V(o, e = 864e5) {
983
+ return new Date(Math.floor(o.getTime() / e) * e);
645
984
  }
646
- async function C(s, e = "text/javascript") {
985
+ function B(o, e = "text/javascript") {
647
986
  return new Promise((t, n) => {
648
987
  const r = document.createElement("script");
649
- r.async = !0, r.defer = !0, r.src = s, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
988
+ r.async = !0, r.defer = !0, r.src = o, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
650
989
  });
651
990
  }
652
- function O(s) {
653
- if (Array.isArray(s))
654
- return s.length;
991
+ function H(o) {
992
+ if (Array.isArray(o))
993
+ return o.length;
655
994
  let e = 0;
656
- for (const t of s)
995
+ for (const t of o)
657
996
  e += 1;
658
997
  return e;
659
998
  }
660
- function $(s, e, t = 1) {
661
- return new l(function* () {
662
- e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
663
- for (let n = s; n < e; n += t)
999
+ function W(o, e, t = 1) {
1000
+ return new a(function* () {
1001
+ e === void 0 && (e = o, o = 0), o > e && (t = t ?? -1);
1002
+ for (let n = o; n < e; n += t)
664
1003
  yield n;
665
1004
  });
666
1005
  }
667
- function V(s) {
668
- const e = Array.from(s);
1006
+ function G(o) {
1007
+ const e = Array.from(o);
669
1008
  for (let t = e.length - 1; t > 0; t -= 1) {
670
1009
  const n = Math.floor(Math.random() * (t + 1));
671
1010
  [e[t], e[n]] = [e[n], e[t]];
672
1011
  }
673
1012
  return e;
674
1013
  }
675
- function J(s) {
676
- return new l(function* () {
1014
+ function K(o) {
1015
+ return new a(function* () {
677
1016
  const e = /* @__PURE__ */ new Set();
678
- for (const t of s)
1017
+ for (const t of o)
679
1018
  e.has(t) || (e.add(t), yield t);
680
1019
  });
681
1020
  }
682
- function S(s, e) {
683
- return new l(function* () {
684
- const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
1021
+ function E(o, e) {
1022
+ return new a(function* () {
1023
+ const t = o[Symbol.iterator](), n = e[Symbol.iterator]();
685
1024
  for (; ; ) {
686
- const r = t.next(), o = n.next();
687
- if (r.done || o.done)
1025
+ const r = t.next(), s = n.next();
1026
+ if (r.done || s.done)
688
1027
  break;
689
- yield [r.value, o.value];
1028
+ yield [r.value, s.value];
690
1029
  }
691
1030
  });
692
1031
  }
693
- function Y(s, e) {
1032
+ function L(o, e) {
694
1033
  if (e === void 0) {
695
- let o = 0, i = 0;
696
- for (const c of s)
697
- o += c, i += 1;
1034
+ let s = 0, i = 0;
1035
+ for (const c of o)
1036
+ s += c, i += 1;
698
1037
  if (i === 0)
699
- throw new _("You must provide at least one value.");
700
- return o / i;
1038
+ throw new m("You must provide at least one value.");
1039
+ return s / i;
701
1040
  }
702
1041
  let t = 0, n = 0, r = 0;
703
- for (const [o, i] of S(s, e))
704
- t += o * i, n += i, r += 1;
1042
+ for (const [s, i] of E(o, e)) {
1043
+ if (i <= 0)
1044
+ throw new m(`The weight for the value #${r} must be greater than zero.`);
1045
+ t += s * i, n += i, r += 1;
1046
+ }
705
1047
  if (r === 0)
706
- throw new _("You must provide at least one value and weight.");
707
- if (n === 0)
708
- throw new _("The sum of weights must be greater than zero.");
1048
+ throw new m("You must provide at least one value and weight.");
1049
+ if (n > 0)
1050
+ throw new m("The sum of weights must be greater than zero.");
709
1051
  return t / n;
710
1052
  }
711
- function z(s) {
1053
+ function N(o) {
712
1054
  let e = 0;
713
- for (let t = 0; t < s.length; t += 1) {
714
- const n = s.charCodeAt(t);
1055
+ for (let t = 0; t < o.length; t += 1) {
1056
+ const n = o.charCodeAt(t);
715
1057
  e = (e << 5) - e + n, e |= 0;
716
1058
  }
717
1059
  return e;
718
1060
  }
719
- function B(s) {
1061
+ function Q(o) {
720
1062
  let e = 0;
721
- for (const t of s)
1063
+ for (const t of o)
722
1064
  e += t;
723
1065
  return e;
724
1066
  }
725
- function H(s) {
726
- return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
1067
+ function X(o) {
1068
+ return `${o.charAt(0).toUpperCase()}${o.slice(1)}`;
727
1069
  }
728
- const W = "1.5.0-rc.5";
1070
+ const Z = "1.5.0-rc.7";
729
1071
  export {
730
- h as AggregatedIterator,
731
- m as Aggregator,
732
- b as DateUnit,
733
- j as DeferredPromise,
1072
+ w as AggregatedAsyncIterator,
1073
+ d as AggregatedIterator,
1074
+ y as Aggregator,
1075
+ _ as AsyncAggregator,
1076
+ M as DateUnit,
1077
+ O as DeferredPromise,
734
1078
  f as Exception,
735
- T as JsonStorage,
736
- E as Random,
737
- a as ReducedIterator,
738
- v as ReferenceException,
739
- l as SmartIterator,
740
- w as SmartPromise,
741
- M as Subscribers,
742
- P as TimedPromise,
743
- x as TimeoutException,
744
- W as VERSION,
745
- _ as ValueException,
746
- Y as average,
747
- H as capitalize,
748
- O as count,
749
- A as dateDifference,
750
- F as dateRange,
751
- q as dateRound,
752
- I as delay,
753
- z as hash,
754
- C as loadScript,
755
- R as nextAnimationFrame,
756
- $ as range,
757
- V as shuffle,
758
- B as sum,
759
- J as unique,
760
- S as zip
1079
+ P as FatalErrorException,
1080
+ F as FileNotFoundException,
1081
+ q as JsonStorage,
1082
+ v as Random,
1083
+ l as ReducedIterator,
1084
+ I as RuntimeException,
1085
+ h as SmartAsyncIterator,
1086
+ a as SmartIterator,
1087
+ x as SmartPromise,
1088
+ A as Subscribers,
1089
+ $ as TimedPromise,
1090
+ T as TimeoutException,
1091
+ R as TypeException,
1092
+ Z as VERSION,
1093
+ m as ValueException,
1094
+ L as average,
1095
+ X as capitalize,
1096
+ H as count,
1097
+ z as dateDifference,
1098
+ J as dateRange,
1099
+ V as dateRound,
1100
+ C as delay,
1101
+ N as hash,
1102
+ B as loadScript,
1103
+ Y as nextAnimationFrame,
1104
+ W as range,
1105
+ G as shuffle,
1106
+ Q as sum,
1107
+ K as unique,
1108
+ E as zip
761
1109
  };
762
1110
  //# sourceMappingURL=core.js.map