@byloth/core 1.5.0-rc.5 → 1.5.0-rc.6

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 k = Object.defineProperty;
2
+ var S = (o, e, t) => e in o ? k(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var u = (o, e, t) => S(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,147 @@ class l {
114
114
  return this;
115
115
  }
116
116
  }
117
- class a {
117
+ class f {
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 f(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 f(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 f(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 c {
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 c(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 c(function* () {
251
+ for (const [n, [r, s]] of t.enumerate())
252
+ yield [r, e(r, s, n)];
134
253
  });
135
254
  }
136
255
  keys() {
137
256
  const e = this._elements;
138
- return new l(function* () {
257
+ return new a(function* () {
139
258
  for (const [t] of e)
140
259
  yield t;
141
260
  });
@@ -145,7 +264,7 @@ class a {
145
264
  }
146
265
  values() {
147
266
  const e = this._elements;
148
- return new l(function* () {
267
+ return new a(function* () {
149
268
  for (const [t, n] of e)
150
269
  yield n;
151
270
  });
@@ -163,79 +282,79 @@ class a {
163
282
  return "ReducedIterator";
164
283
  }
165
284
  }
166
- class h {
285
+ class d {
167
286
  constructor(e) {
168
287
  u(this, "_elements");
169
- this._elements = new l(e);
288
+ this._elements = new a(e);
170
289
  }
171
290
  every(e) {
172
291
  const t = /* @__PURE__ */ new Map();
173
292
  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)]);
293
+ const [s, i] = t.get(n) ?? [0, !0];
294
+ i && t.set(n, [s + 1, e(n, r, s)]);
176
295
  }
177
- return new a(function* () {
178
- for (const [n, [r, o]] of t)
179
- yield [n, o];
296
+ return new c(function* () {
297
+ for (const [n, [r, s]] of t)
298
+ yield [n, s];
180
299
  });
181
300
  }
182
301
  some(e) {
183
302
  const t = /* @__PURE__ */ new Map();
184
303
  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)]);
304
+ const [s, i] = t.get(n) ?? [0, !1];
305
+ i || t.set(n, [s + 1, e(n, r, s)]);
187
306
  }
188
- return new a(function* () {
189
- for (const [n, [r, o]] of t)
190
- yield [n, o];
307
+ return new c(function* () {
308
+ for (const [n, [r, s]] of t)
309
+ yield [n, s];
191
310
  });
192
311
  }
193
312
  filter(e) {
194
313
  const t = this._elements;
195
- return new h(function* () {
314
+ return new d(function* () {
196
315
  const n = /* @__PURE__ */ new Map();
197
- for (const [r, o] of t) {
316
+ for (const [r, s] of t) {
198
317
  const i = n.get(r) ?? 0;
199
- n.set(r, i + 1), e(r, o, i) && (yield [r, o]);
318
+ n.set(r, i + 1), e(r, s, i) && (yield [r, s]);
200
319
  }
201
320
  });
202
321
  }
203
322
  map(e) {
204
323
  const t = this._elements;
205
- return new h(function* () {
324
+ return new d(function* () {
206
325
  const n = /* @__PURE__ */ new Map();
207
- for (const [r, o] of t) {
326
+ for (const [r, s] of t) {
208
327
  const i = n.get(r) ?? 0;
209
- n.set(r, i + 1), yield [r, e(r, o, i)];
328
+ n.set(r, i + 1), yield [r, e(r, s, i)];
210
329
  }
211
330
  });
212
331
  }
213
332
  reduce(e, t) {
214
333
  const n = /* @__PURE__ */ new Map();
215
- for (const [r, o] of this._elements) {
216
- let i, c;
334
+ for (const [r, s] of this._elements) {
335
+ let i, l;
217
336
  if (n.has(r))
218
- [i, c] = n.get(r), i += 1;
337
+ [i, l] = n.get(r), i += 1;
219
338
  else if (t !== void 0)
220
- i = 0, c = t(r);
339
+ i = 0, l = t(r);
221
340
  else {
222
- n.set(r, [0, o]);
341
+ n.set(r, [0, s]);
223
342
  continue;
224
343
  }
225
- c = e(r, c, o, i), n.set(r, [i, c]);
344
+ l = e(r, l, s, i), n.set(r, [i, l]);
226
345
  }
227
- return new a(function* () {
228
- for (const [r, [o, i]] of n)
346
+ return new c(function* () {
347
+ for (const [r, [s, i]] of n)
229
348
  yield [r, i];
230
349
  });
231
350
  }
232
351
  unique() {
233
352
  const e = this._elements;
234
- return new h(function* () {
353
+ return new d(function* () {
235
354
  const t = /* @__PURE__ */ new Map();
236
355
  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]);
356
+ const s = t.get(n) ?? /* @__PURE__ */ new Set();
357
+ s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
239
358
  }
240
359
  });
241
360
  }
@@ -245,7 +364,7 @@ class h {
245
364
  const n = e.get(t) ?? 0;
246
365
  e.set(t, n + 1);
247
366
  }
248
- return new a(function* () {
367
+ return new c(function* () {
249
368
  for (const [t, n] of e)
250
369
  yield [t, n];
251
370
  });
@@ -254,7 +373,7 @@ class h {
254
373
  const e = /* @__PURE__ */ new Map();
255
374
  for (const [t, n] of this._elements)
256
375
  e.has(t) || e.set(t, n);
257
- return new a(function* () {
376
+ return new c(function* () {
258
377
  for (const [t, n] of e)
259
378
  yield [t, n];
260
379
  });
@@ -263,14 +382,14 @@ class h {
263
382
  const e = /* @__PURE__ */ new Map();
264
383
  for (const [t, n] of this._elements)
265
384
  e.set(t, n);
266
- return new a(function* () {
385
+ return new c(function* () {
267
386
  for (const [t, n] of e)
268
387
  yield [t, n];
269
388
  });
270
389
  }
271
390
  keys() {
272
391
  const e = this._elements;
273
- return new l(function* () {
392
+ return new a(function* () {
274
393
  for (const [t] of e)
275
394
  yield t;
276
395
  });
@@ -280,7 +399,7 @@ class h {
280
399
  }
281
400
  values() {
282
401
  const e = this._elements;
283
- return new l(function* () {
402
+ return new a(function* () {
284
403
  for (const [t, n] of e)
285
404
  yield n;
286
405
  });
@@ -308,36 +427,203 @@ class h {
308
427
  return "AggregatedIterator";
309
428
  }
310
429
  }
311
- class m {
430
+ class y {
312
431
  constructor(e) {
313
432
  u(this, "_elements");
314
- this._elements = new l(e);
433
+ this._elements = new a(e);
315
434
  }
316
435
  filter(e) {
317
- return new m(this._elements.filter(e));
436
+ return new y(this._elements.filter(e));
318
437
  }
319
438
  map(e) {
320
- return new m(this._elements.map(e));
439
+ return new y(this._elements.map(e));
321
440
  }
322
441
  unique() {
323
- return new m(this._elements.unique());
442
+ return new y(this._elements.unique());
324
443
  }
325
444
  groupBy(e) {
326
- return new h(this._elements.map((t, n) => [e(t, n), t]));
445
+ return new d(this._elements.map((t, n) => [e(t, n), t]));
327
446
  }
328
447
  get [Symbol.toStringTag]() {
329
448
  return "Aggregator";
330
449
  }
331
450
  }
332
- class f extends Error {
451
+ class w {
452
+ constructor(e) {
453
+ u(this, "_elements");
454
+ this._elements = new f(e);
455
+ }
456
+ async every(e) {
457
+ const t = /* @__PURE__ */ new Map();
458
+ for await (const [n, r] of this._elements) {
459
+ const [s, i] = t.get(n) ?? [0, !0];
460
+ i && t.set(n, [s + 1, await e(n, r, s)]);
461
+ }
462
+ return new c(function* () {
463
+ for (const [n, [r, s]] of t)
464
+ yield [n, s];
465
+ });
466
+ }
467
+ async some(e) {
468
+ const t = /* @__PURE__ */ new Map();
469
+ for await (const [n, r] of this._elements) {
470
+ const [s, i] = t.get(n) ?? [0, !1];
471
+ i || t.set(n, [s + 1, await e(n, r, s)]);
472
+ }
473
+ return new c(function* () {
474
+ for (const [n, [r, s]] of t)
475
+ yield [n, s];
476
+ });
477
+ }
478
+ filter(e) {
479
+ const t = this._elements;
480
+ return new w(async function* () {
481
+ const n = /* @__PURE__ */ new Map();
482
+ for await (const [r, s] of t) {
483
+ const i = n.get(r) ?? 0;
484
+ n.set(r, i + 1), e(r, s, i) && (yield [r, s]);
485
+ }
486
+ });
487
+ }
488
+ map(e) {
489
+ const t = this._elements;
490
+ return new w(async function* () {
491
+ const n = /* @__PURE__ */ new Map();
492
+ for await (const [r, s] of t) {
493
+ const i = n.get(r) ?? 0;
494
+ n.set(r, i + 1), yield [r, await e(r, s, i)];
495
+ }
496
+ });
497
+ }
498
+ async reduce(e, t) {
499
+ const n = /* @__PURE__ */ new Map();
500
+ for await (const [r, s] of this._elements) {
501
+ let i, l;
502
+ if (n.has(r))
503
+ [i, l] = n.get(r), i += 1;
504
+ else if (t !== void 0)
505
+ i = 0, l = t(r);
506
+ else {
507
+ n.set(r, [0, s]);
508
+ continue;
509
+ }
510
+ l = await e(r, l, s, i), n.set(r, [i, l]);
511
+ }
512
+ return new c(function* () {
513
+ for (const [r, [s, i]] of n)
514
+ yield [r, i];
515
+ });
516
+ }
517
+ unique() {
518
+ const e = this._elements;
519
+ return new w(async function* () {
520
+ const t = /* @__PURE__ */ new Map();
521
+ for await (const [n, r] of e) {
522
+ const s = t.get(n) ?? /* @__PURE__ */ new Set();
523
+ s.has(r) || (s.add(r), t.set(n, s), yield [n, r]);
524
+ }
525
+ });
526
+ }
527
+ async count() {
528
+ const e = /* @__PURE__ */ new Map();
529
+ for await (const [t] of this._elements) {
530
+ const n = e.get(t) ?? 0;
531
+ e.set(t, n + 1);
532
+ }
533
+ return new c(function* () {
534
+ for (const [t, n] of e)
535
+ yield [t, n];
536
+ });
537
+ }
538
+ async first() {
539
+ const e = /* @__PURE__ */ new Map();
540
+ for await (const [t, n] of this._elements)
541
+ e.has(t) || e.set(t, n);
542
+ return new c(function* () {
543
+ for (const [t, n] of e)
544
+ yield [t, n];
545
+ });
546
+ }
547
+ async last() {
548
+ const e = /* @__PURE__ */ new Map();
549
+ for await (const [t, n] of this._elements)
550
+ e.set(t, n);
551
+ return new c(function* () {
552
+ for (const [t, n] of e)
553
+ yield [t, n];
554
+ });
555
+ }
556
+ keys() {
557
+ const e = this._elements;
558
+ return new f(async function* () {
559
+ for await (const [t] of e)
560
+ yield t;
561
+ });
562
+ }
563
+ items() {
564
+ return this._elements;
565
+ }
566
+ values() {
567
+ const e = this._elements;
568
+ return new f(async function* () {
569
+ for await (const [t, n] of e)
570
+ yield n;
571
+ });
572
+ }
573
+ async toArray() {
574
+ const e = await this.toMap();
575
+ return Array.from(e.values());
576
+ }
577
+ async toMap() {
578
+ const e = /* @__PURE__ */ new Map();
579
+ for await (const [t, n] of this._elements) {
580
+ const r = e.get(t) ?? [];
581
+ r.push(n), e.set(t, r);
582
+ }
583
+ return e;
584
+ }
585
+ async toObject() {
586
+ const e = {};
587
+ for await (const [t, n] of this._elements) {
588
+ const r = e[t] ?? [];
589
+ r.push(n), e[t] = r;
590
+ }
591
+ return e;
592
+ }
593
+ get [Symbol.toStringTag]() {
594
+ return "AggregatedAsyncIterator";
595
+ }
596
+ }
597
+ class _ {
598
+ constructor(e) {
599
+ u(this, "_elements");
600
+ this._elements = new f(e);
601
+ }
602
+ filter(e) {
603
+ return new _(this._elements.filter(e));
604
+ }
605
+ map(e) {
606
+ return new _(this._elements.map(e));
607
+ }
608
+ unique() {
609
+ return new _(this._elements.unique());
610
+ }
611
+ groupBy(e) {
612
+ return new w(this._elements.map(async (t, n) => [await e(t, n), t]));
613
+ }
614
+ get [Symbol.toStringTag]() {
615
+ return "AsyncAggregator";
616
+ }
617
+ }
618
+ class h extends Error {
333
619
  static FromUnknown(e) {
334
- if (e instanceof f)
620
+ if (e instanceof h)
335
621
  return e;
336
622
  if (e instanceof Error) {
337
- const t = new f(e.message);
623
+ const t = new h(e.message);
338
624
  return t.stack = e.stack, t.name = e.name, t;
339
625
  }
340
- return new f(`${e}`);
626
+ return new h(`${e}`);
341
627
  }
342
628
  constructor(e, t, n = "Exception") {
343
629
  super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
@@ -350,7 +636,7 @@ Caused by ${t}`);
350
636
  return "Exception";
351
637
  }
352
638
  }
353
- class v extends f {
639
+ class b extends h {
354
640
  constructor(e, t, n = "ReferenceException") {
355
641
  super(e, t, n);
356
642
  }
@@ -358,7 +644,7 @@ class v extends f {
358
644
  return "ReferenceException";
359
645
  }
360
646
  }
361
- class x extends f {
647
+ class M extends h {
362
648
  constructor(e, t, n = "TimeoutException") {
363
649
  super(e, t, n);
364
650
  }
@@ -366,7 +652,7 @@ class x extends f {
366
652
  return "TimeoutException";
367
653
  }
368
654
  }
369
- class _ extends f {
655
+ class m extends h {
370
656
  constructor(e, t, n = "ValueException") {
371
657
  super(e, t, n);
372
658
  }
@@ -374,7 +660,7 @@ class _ extends f {
374
660
  return "ValueException";
375
661
  }
376
662
  }
377
- class T {
663
+ class E {
378
664
  constructor(e = !0) {
379
665
  u(this, "_preferPersistence");
380
666
  u(this, "_volatile");
@@ -512,7 +798,7 @@ class T {
512
798
  return "JsonStorage";
513
799
  }
514
800
  }
515
- class M {
801
+ class I {
516
802
  constructor() {
517
803
  u(this, "_subscribers");
518
804
  this._subscribers = [];
@@ -523,7 +809,7 @@ class M {
523
809
  remove(e) {
524
810
  const t = this._subscribers.indexOf(e);
525
811
  if (t < 0)
526
- throw new v("Unable to remove the requested subscriber. It was not found.");
812
+ throw new b("Unable to remove the requested subscriber. It was not found.");
527
813
  this._subscribers.splice(t, 1);
528
814
  }
529
815
  call(...e) {
@@ -533,7 +819,7 @@ class M {
533
819
  return "Subscribers";
534
820
  }
535
821
  }
536
- class w {
822
+ class v {
537
823
  constructor(e) {
538
824
  u(this, "_isPending");
539
825
  u(this, "_isFulfilled");
@@ -567,15 +853,15 @@ class w {
567
853
  return "SmartPromise";
568
854
  }
569
855
  }
570
- class j extends w {
856
+ class R extends v {
571
857
  constructor(t, n) {
572
- let r, o;
573
- super((i, c) => {
574
- r = i, o = c;
858
+ let r, s;
859
+ super((i, l) => {
860
+ r = i, s = l;
575
861
  });
576
862
  u(this, "_resolve");
577
863
  u(this, "_reject");
578
- this._promise.then(t, n), this._resolve = r, this._reject = o;
864
+ this._promise.then(t, n), this._resolve = r, this._reject = s;
579
865
  }
580
866
  get resolve() {
581
867
  return this._resolve;
@@ -590,22 +876,22 @@ class j extends w {
590
876
  return "DeferredPromise";
591
877
  }
592
878
  }
593
- class P extends w {
879
+ class q extends v {
594
880
  constructor(e, t) {
595
881
  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);
882
+ const s = (g) => {
883
+ clearTimeout(p), n(g);
884
+ }, i = (g) => {
885
+ clearTimeout(p), r(g);
886
+ }, p = setTimeout(() => i(new M("The operation has timed out.")), t);
887
+ e(s, i);
602
888
  });
603
889
  }
604
890
  get [Symbol.toStringTag]() {
605
891
  return "TimedPromise";
606
892
  }
607
893
  }
608
- class E {
894
+ class x {
609
895
  static Boolean(e = 0.5) {
610
896
  return Math.random() < e;
611
897
  }
@@ -613,150 +899,161 @@ class E {
613
899
  return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
614
900
  }
615
901
  static Decimal(e, t) {
616
- return t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
902
+ return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
903
+ }
904
+ static Index(e) {
905
+ if (e.length === 0)
906
+ throw new m("You must provide at least one element.");
907
+ return this.Integer(e.length);
617
908
  }
618
909
  static Choice(e) {
619
- return e[this.Integer(e.length)];
910
+ return e[x.Index(e)];
620
911
  }
621
912
  // eslint-disable-next-line no-useless-constructor
622
913
  constructor() {
623
914
  }
624
915
  }
625
- async function I(s) {
626
- return new Promise((e, t) => setTimeout(e, s));
916
+ async function F(o) {
917
+ return new Promise((e, t) => setTimeout(e, o));
627
918
  }
628
- async function R() {
629
- return new Promise((s, e) => requestAnimationFrame(() => s()));
919
+ async function A() {
920
+ return new Promise((o, e) => requestAnimationFrame(() => o()));
630
921
  }
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);
922
+ var T = /* @__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))(T || {});
923
+ function O(o, e, t = 864e5) {
924
+ return Math.floor((e.getTime() - o.getTime()) / t);
634
925
  }
635
- function F(s, e, t = 864e5) {
636
- return new l(function* () {
926
+ function $(o, e, t = 864e5) {
927
+ return new a(function* () {
637
928
  const n = e.getTime();
638
- let r = s.getTime();
929
+ let r = o.getTime();
639
930
  for (; r < n; )
640
931
  yield new Date(r), r += t;
641
932
  });
642
933
  }
643
- function q(s, e = 864e5) {
644
- return new Date(Math.floor(s.getTime() / e) * e);
934
+ function C(o, e = 864e5) {
935
+ return new Date(Math.floor(o.getTime() / e) * e);
645
936
  }
646
- async function C(s, e = "text/javascript") {
937
+ function V(o, e = "text/javascript") {
647
938
  return new Promise((t, n) => {
648
939
  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);
940
+ r.async = !0, r.defer = !0, r.src = o, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
650
941
  });
651
942
  }
652
- function O(s) {
653
- if (Array.isArray(s))
654
- return s.length;
943
+ function Y(o) {
944
+ if (Array.isArray(o))
945
+ return o.length;
655
946
  let e = 0;
656
- for (const t of s)
947
+ for (const t of o)
657
948
  e += 1;
658
949
  return e;
659
950
  }
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)
951
+ function z(o, e, t = 1) {
952
+ return new a(function* () {
953
+ e === void 0 && (e = o, o = 0), o > e && (t = t ?? -1);
954
+ for (let n = o; n < e; n += t)
664
955
  yield n;
665
956
  });
666
957
  }
667
- function V(s) {
668
- const e = Array.from(s);
958
+ function J(o) {
959
+ const e = Array.from(o);
669
960
  for (let t = e.length - 1; t > 0; t -= 1) {
670
961
  const n = Math.floor(Math.random() * (t + 1));
671
962
  [e[t], e[n]] = [e[n], e[t]];
672
963
  }
673
964
  return e;
674
965
  }
675
- function J(s) {
676
- return new l(function* () {
966
+ function B(o) {
967
+ return new a(function* () {
677
968
  const e = /* @__PURE__ */ new Set();
678
- for (const t of s)
969
+ for (const t of o)
679
970
  e.has(t) || (e.add(t), yield t);
680
971
  });
681
972
  }
682
- function S(s, e) {
683
- return new l(function* () {
684
- const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
973
+ function j(o, e) {
974
+ return new a(function* () {
975
+ const t = o[Symbol.iterator](), n = e[Symbol.iterator]();
685
976
  for (; ; ) {
686
- const r = t.next(), o = n.next();
687
- if (r.done || o.done)
977
+ const r = t.next(), s = n.next();
978
+ if (r.done || s.done)
688
979
  break;
689
- yield [r.value, o.value];
980
+ yield [r.value, s.value];
690
981
  }
691
982
  });
692
983
  }
693
- function Y(s, e) {
984
+ function H(o, e) {
694
985
  if (e === void 0) {
695
- let o = 0, i = 0;
696
- for (const c of s)
697
- o += c, i += 1;
986
+ let s = 0, i = 0;
987
+ for (const l of o)
988
+ s += l, i += 1;
698
989
  if (i === 0)
699
- throw new _("You must provide at least one value.");
700
- return o / i;
990
+ throw new m("You must provide at least one value.");
991
+ return s / i;
701
992
  }
702
993
  let t = 0, n = 0, r = 0;
703
- for (const [o, i] of S(s, e))
704
- t += o * i, n += i, r += 1;
994
+ for (const [s, i] of j(o, e)) {
995
+ if (i <= 0)
996
+ throw new m(`The weight for the value #${r} must be greater than zero.`);
997
+ t += s * i, n += i, r += 1;
998
+ }
705
999
  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.");
1000
+ throw new m("You must provide at least one value and weight.");
1001
+ if (n > 0)
1002
+ throw new m("The sum of weights must be greater than zero.");
709
1003
  return t / n;
710
1004
  }
711
- function z(s) {
1005
+ function W(o) {
712
1006
  let e = 0;
713
- for (let t = 0; t < s.length; t += 1) {
714
- const n = s.charCodeAt(t);
1007
+ for (let t = 0; t < o.length; t += 1) {
1008
+ const n = o.charCodeAt(t);
715
1009
  e = (e << 5) - e + n, e |= 0;
716
1010
  }
717
1011
  return e;
718
1012
  }
719
- function B(s) {
1013
+ function G(o) {
720
1014
  let e = 0;
721
- for (const t of s)
1015
+ for (const t of o)
722
1016
  e += t;
723
1017
  return e;
724
1018
  }
725
- function H(s) {
726
- return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
1019
+ function K(o) {
1020
+ return `${o.charAt(0).toUpperCase()}${o.slice(1)}`;
727
1021
  }
728
- const W = "1.5.0-rc.5";
1022
+ const L = "1.5.0-rc.6";
729
1023
  export {
730
- h as AggregatedIterator,
731
- m as Aggregator,
732
- b as DateUnit,
733
- j as DeferredPromise,
734
- 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
1024
+ w as AggregatedAsyncIterator,
1025
+ d as AggregatedIterator,
1026
+ y as Aggregator,
1027
+ _ as AsyncAggregator,
1028
+ T as DateUnit,
1029
+ R as DeferredPromise,
1030
+ h as Exception,
1031
+ E as JsonStorage,
1032
+ x as Random,
1033
+ c as ReducedIterator,
1034
+ b as ReferenceException,
1035
+ f as SmartAsyncIterator,
1036
+ a as SmartIterator,
1037
+ v as SmartPromise,
1038
+ I as Subscribers,
1039
+ q as TimedPromise,
1040
+ M as TimeoutException,
1041
+ L as VERSION,
1042
+ m as ValueException,
1043
+ H as average,
1044
+ K as capitalize,
1045
+ Y as count,
1046
+ O as dateDifference,
1047
+ $ as dateRange,
1048
+ C as dateRound,
1049
+ F as delay,
1050
+ W as hash,
1051
+ V as loadScript,
1052
+ A as nextAnimationFrame,
1053
+ z as range,
1054
+ J as shuffle,
1055
+ G as sum,
1056
+ B as unique,
1057
+ j as zip
761
1058
  };
762
1059
  //# sourceMappingURL=core.js.map