@byloth/core 2.0.0-rc.2 → 2.0.0-rc.4

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,464 +1,415 @@
1
- var j = Object.defineProperty;
2
- var D = (s, e, t) => e in s ? j(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var u = (s, e, t) => D(s, typeof e != "symbol" ? e + "" : e, t);
4
- const E = typeof window < "u" && typeof window.document < "u";
5
- var S;
6
- const J = typeof process < "u" && ((S = process.versions) == null ? void 0 : S.node);
7
- var k;
8
- const W = typeof self == "object" && ((k = self.constructor) == null ? void 0 : k.name) === "DedicatedWorkerGlobalScope";
9
- class h extends Error {
1
+ var Ie = Object.defineProperty;
2
+ var Ae = (i, t, e) => t in i ? Ie(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var a = (i, t, e) => Ae(i, typeof t != "symbol" ? t + "" : t, e);
4
+ const Me = typeof window < "u" && typeof window.document < "u";
5
+ var F;
6
+ const Je = typeof process < "u" && ((F = process.versions) == null ? void 0 : F.node);
7
+ var P;
8
+ const Ve = typeof self == "object" && ((P = self.constructor) == null ? void 0 : P.name) === "DedicatedWorkerGlobalScope";
9
+ var j, I;
10
+ class c extends (I = Error, j = Symbol.toStringTag, I) {
11
+ constructor(e, n, r = "Exception") {
12
+ super(e);
13
+ a(this, j, "Exception");
14
+ this.cause = n, this.name = r, n && (n instanceof Error ? this.stack += `
15
+
16
+ Caused by ${n.stack}` : this.stack += `
17
+
18
+ Caused by ${n}`);
19
+ }
10
20
  static FromUnknown(e) {
11
- if (e instanceof h)
21
+ if (e instanceof c)
12
22
  return e;
13
23
  if (e instanceof Error) {
14
- const t = new h(e.message);
15
- return t.stack = e.stack, t.name = e.name, t;
24
+ const n = new c(e.message);
25
+ return n.stack = e.stack, n.name = e.name, n;
16
26
  }
17
- return new h(`${e}`);
18
- }
19
- constructor(e, t, n = "Exception") {
20
- super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
21
-
22
- Caused by ${t.stack}` : this.stack += `
23
-
24
- Caused by ${t}`);
25
- }
26
- get [Symbol.toStringTag]() {
27
- return "Exception";
27
+ return new c(`${e}`);
28
28
  }
29
29
  }
30
- class g extends h {
31
- constructor(e, t, n = "FatalErrorException") {
32
- 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."), super(e, t, n);
33
- }
34
- get [Symbol.toStringTag]() {
35
- return "FatalErrorException";
30
+ var A, C;
31
+ class x extends (C = c, A = Symbol.toStringTag, C) {
32
+ constructor(e, n, r = "FatalErrorException") {
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
+ super(e, n, r);
35
+ a(this, A, "FatalErrorException");
36
36
  }
37
37
  }
38
- class Y extends g {
39
- constructor(e, t, n = "NotImplementedException") {
40
- e === void 0 && (e = "This feature is not implemented yet. Please, try again later."), super(e, t, n);
41
- }
42
- get [Symbol.toStringTag]() {
43
- return "NotImplementedException";
38
+ var D, O;
39
+ class We extends (O = x, D = Symbol.toStringTag, O) {
40
+ constructor(e, n, r = "NotImplementedException") {
41
+ e === void 0 && (e = "This feature is not implemented yet. Please, try again later.");
42
+ super(e, n, r);
43
+ a(this, D, "NotImplementedException");
44
44
  }
45
45
  }
46
- class T extends h {
47
- constructor(e, t, n = "FileException") {
48
- super(e, t, n);
49
- }
50
- get [Symbol.toStringTag]() {
51
- return "FileException";
46
+ var q, N;
47
+ class Re extends (N = c, q = Symbol.toStringTag, N) {
48
+ constructor(e, n, r = "FileException") {
49
+ super(e, n, r);
50
+ a(this, q, "FileException");
52
51
  }
53
52
  }
54
- class z extends T {
55
- constructor(e, t, n = "FileExistsException") {
56
- super(e, t, n);
57
- }
58
- get [Symbol.toStringTag]() {
59
- return "FileExistsException";
53
+ var $, J;
54
+ class Ye extends (J = Re, $ = Symbol.toStringTag, J) {
55
+ constructor(e, n, r = "FileExistsException") {
56
+ super(e, n, r);
57
+ a(this, $, "FileExistsException");
60
58
  }
61
59
  }
62
- class V extends T {
63
- constructor(e, t, n = "FileNotFoundException") {
64
- super(e, t, n);
65
- }
66
- get [Symbol.toStringTag]() {
67
- return "FileNotFoundException";
60
+ var V, W;
61
+ class ze extends (W = Re, V = Symbol.toStringTag, W) {
62
+ constructor(e, n, r = "FileNotFoundException") {
63
+ super(e, n, r);
64
+ a(this, V, "FileNotFoundException");
68
65
  }
69
66
  }
70
- class B extends h {
71
- constructor(e, t, n = "KeyException") {
72
- super(e, t, n);
73
- }
74
- get [Symbol.toStringTag]() {
75
- return "KeyException";
67
+ var Y, z;
68
+ class Be extends (z = c, Y = Symbol.toStringTag, z) {
69
+ constructor(e, n, r = "KeyException") {
70
+ super(e, n, r);
71
+ a(this, Y, "KeyException");
76
72
  }
77
73
  }
78
- class K extends h {
79
- constructor(e, t, n = "NetworkException") {
80
- super(e, t, n);
81
- }
82
- get [Symbol.toStringTag]() {
83
- return "NetworkException";
74
+ var B, G;
75
+ class Ge extends (G = c, B = Symbol.toStringTag, G) {
76
+ constructor(e, n, r = "NetworkException") {
77
+ super(e, n, r);
78
+ a(this, B, "NetworkException");
84
79
  }
85
80
  }
86
- class G extends h {
87
- constructor(e, t, n = "PermissionException") {
88
- super(e, t, n);
89
- }
90
- get [Symbol.toStringTag]() {
91
- return "PermissionException";
81
+ var K, H;
82
+ class Ke extends (H = c, K = Symbol.toStringTag, H) {
83
+ constructor(e, n, r = "PermissionException") {
84
+ super(e, n, r);
85
+ a(this, K, "PermissionException");
92
86
  }
93
87
  }
94
- class q extends h {
95
- constructor(e, t, n = "ReferenceException") {
96
- super(e, t, n);
97
- }
98
- get [Symbol.toStringTag]() {
99
- return "ReferenceException";
88
+ var L, Q;
89
+ class Ce extends (Q = c, L = Symbol.toStringTag, Q) {
90
+ constructor(e, n, r = "ReferenceException") {
91
+ super(e, n, r);
92
+ a(this, L, "ReferenceException");
100
93
  }
101
94
  }
102
- class m extends h {
103
- constructor(e, t, n = "RuntimeException") {
104
- super(e, t, n);
105
- }
106
- get [Symbol.toStringTag]() {
107
- return "RuntimeException";
95
+ var X, Z;
96
+ class p extends (Z = c, X = Symbol.toStringTag, Z) {
97
+ constructor(e, n, r = "RuntimeException") {
98
+ super(e, n, r);
99
+ a(this, X, "RuntimeException");
108
100
  }
109
101
  }
110
- class A extends m {
111
- constructor(e, t, n = "EnvironmentException") {
112
- super(e, t, n);
113
- }
114
- get [Symbol.toStringTag]() {
115
- return "EnvironmentException";
102
+ var U, ee;
103
+ class De extends (ee = p, U = Symbol.toStringTag, ee) {
104
+ constructor(e, n, r = "EnvironmentException") {
105
+ super(e, n, r);
106
+ a(this, U, "EnvironmentException");
116
107
  }
117
108
  }
118
- class C extends h {
119
- constructor(e, t, n = "TimeoutException") {
120
- super(e, t, n);
121
- }
122
- get [Symbol.toStringTag]() {
123
- return "TimeoutException";
109
+ var te, ne;
110
+ class Oe extends (ne = c, te = Symbol.toStringTag, ne) {
111
+ constructor(e, n, r = "TimeoutException") {
112
+ super(e, n, r);
113
+ a(this, te, "TimeoutException");
124
114
  }
125
115
  }
126
- class H extends h {
127
- constructor(e, t, n = "TypeException") {
128
- super(e, t, n);
129
- }
130
- get [Symbol.toStringTag]() {
131
- return "TypeException";
116
+ var re, se;
117
+ class He extends (se = c, re = Symbol.toStringTag, se) {
118
+ constructor(e, n, r = "TypeException") {
119
+ super(e, n, r);
120
+ a(this, re, "TypeException");
132
121
  }
133
122
  }
134
- class f extends h {
135
- constructor(e, t, n = "ValueException") {
136
- super(e, t, n);
137
- }
138
- get [Symbol.toStringTag]() {
139
- return "ValueException";
123
+ var ie, oe;
124
+ class d extends (oe = c, ie = Symbol.toStringTag, oe) {
125
+ constructor(e, n, r = "ValueException") {
126
+ super(e, n, r);
127
+ a(this, ie, "ValueException");
140
128
  }
141
129
  }
142
- class M extends f {
143
- constructor(e, t, n = "RangeException") {
144
- super(e, t, n);
145
- }
146
- get [Symbol.toStringTag]() {
147
- return "RangeException";
130
+ var ae, ue;
131
+ class Fe extends (ue = d, ae = Symbol.toStringTag, ue) {
132
+ constructor(e, n, r = "RangeException") {
133
+ super(e, n, r);
134
+ a(this, ae, "RangeException");
148
135
  }
149
136
  }
150
- class a {
151
- constructor(e) {
152
- u(this, "_iterator");
153
- u(this, "return");
154
- u(this, "throw");
155
- e instanceof Function ? this._iterator = e() : Symbol.iterator in e ? this._iterator = e[Symbol.iterator]() : this._iterator = e, this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
156
- }
157
- every(e) {
158
- let t = 0;
137
+ var le;
138
+ class l {
139
+ constructor(t) {
140
+ a(this, "_iterator");
141
+ a(this, "return");
142
+ a(this, "throw");
143
+ a(this, le, "SmartIterator");
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
+ }
146
+ every(t) {
147
+ let e = 0;
159
148
  for (; ; ) {
160
149
  const n = this._iterator.next();
161
150
  if (n.done)
162
151
  return !0;
163
- if (!e(n.value, t))
152
+ if (!t(n.value, e))
164
153
  return !1;
165
- t += 1;
154
+ e += 1;
166
155
  }
167
156
  }
168
- some(e) {
169
- let t = 0;
157
+ some(t) {
158
+ let e = 0;
170
159
  for (; ; ) {
171
160
  const n = this._iterator.next();
172
161
  if (n.done)
173
162
  return !1;
174
- if (e(n.value, t))
163
+ if (t(n.value, e))
175
164
  return !0;
176
- t += 1;
165
+ e += 1;
177
166
  }
178
167
  }
179
- filter(e) {
180
- const t = this._iterator;
181
- return new a(function* () {
168
+ filter(t) {
169
+ const e = this._iterator;
170
+ return new l(function* () {
182
171
  let n = 0;
183
172
  for (; ; ) {
184
- const r = t.next();
173
+ const r = e.next();
185
174
  if (r.done)
186
175
  return r.value;
187
- e(r.value, n) && (yield r.value), n += 1;
176
+ t(r.value, n) && (yield r.value), n += 1;
188
177
  }
189
178
  });
190
179
  }
191
- map(e) {
192
- const t = this._iterator;
193
- return new a(function* () {
180
+ map(t) {
181
+ const e = this._iterator;
182
+ return new l(function* () {
194
183
  let n = 0;
195
184
  for (; ; ) {
196
- const r = t.next();
185
+ const r = e.next();
197
186
  if (r.done)
198
187
  return r.value;
199
- yield e(r.value, n), n += 1;
188
+ yield t(r.value, n), n += 1;
200
189
  }
201
190
  });
202
191
  }
203
- reduce(e, t) {
204
- let n = 0, r = t;
192
+ reduce(t, e) {
193
+ let n = 0, r = e;
205
194
  if (r === void 0) {
206
- const i = this._iterator.next();
207
- if (i.done)
208
- throw new f("Cannot reduce an empty iterator without an initial value.");
209
- r = i.value, n += 1;
195
+ const s = this._iterator.next();
196
+ if (s.done)
197
+ throw new d("Cannot reduce an empty iterator without an initial value.");
198
+ r = s.value, n += 1;
210
199
  }
211
200
  for (; ; ) {
212
- const i = this._iterator.next();
213
- if (i.done)
201
+ const s = this._iterator.next();
202
+ if (s.done)
214
203
  return r;
215
- r = e(r, i.value, n), n += 1;
204
+ r = t(r, s.value, n), n += 1;
216
205
  }
217
206
  }
218
- enumerate() {
219
- return this.map((e, t) => [t, e]);
220
- }
221
- unique() {
207
+ flatMap(t) {
222
208
  const e = this._iterator;
223
- return new a(function* () {
224
- const t = /* @__PURE__ */ new Set();
209
+ return new l(function* () {
210
+ let n = 0;
225
211
  for (; ; ) {
226
- const n = e.next();
227
- if (n.done)
228
- return n.value;
229
- t.has(n.value) || (t.add(n.value), yield n.value);
212
+ const r = e.next();
213
+ if (r.done)
214
+ return r.value;
215
+ const s = t(r.value, n);
216
+ for (const o of s)
217
+ yield o;
218
+ n += 1;
230
219
  }
231
220
  });
232
221
  }
233
- count() {
234
- let e = 0;
235
- for (; ; ) {
236
- if (this._iterator.next().done)
237
- return e;
238
- e += 1;
239
- }
240
- }
241
- forEach(e) {
242
- let t = 0;
243
- for (; ; ) {
244
- const n = this._iterator.next();
245
- if (n.done)
246
- return;
247
- e(n.value, t), t += 1;
248
- }
249
- }
250
- next(...e) {
251
- return this._iterator.next(...e);
252
- }
253
- toArray() {
254
- return Array.from(this);
255
- }
256
- get [Symbol.toStringTag]() {
257
- return "SmartIterator";
258
- }
259
- [Symbol.iterator]() {
260
- return this;
261
- }
262
- }
263
- class d {
264
- constructor(e) {
265
- u(this, "_iterator");
266
- u(this, "return");
267
- u(this, "throw");
268
- if (e instanceof Function) {
269
- const t = e();
270
- Symbol.asyncIterator in t ? this._iterator = t : this._iterator = async function* () {
271
- let n = [];
272
- for (; ; ) {
273
- const r = t.next(...n);
274
- if (r.done)
275
- return r.value;
276
- n = [yield r.value];
277
- }
278
- }();
279
- } else if (Symbol.asyncIterator in e)
280
- this._iterator = e[Symbol.asyncIterator]();
281
- else if (Symbol.iterator in e) {
282
- const t = e[Symbol.iterator]();
283
- this._iterator = async function* () {
284
- for (; ; ) {
285
- const n = t.next();
286
- if (n.done)
287
- return n.value;
288
- yield n.value;
289
- }
290
- }();
291
- } else
292
- this._iterator = async function* () {
293
- let t = [];
294
- for (; ; ) {
295
- const n = await e.next(...t);
296
- if (n.done)
297
- return n.value;
298
- t = [yield n.value];
299
- }
300
- }();
301
- this._iterator.return && (this.return = (t) => this._iterator.return(t)), this._iterator.throw && (this.throw = (t) => this._iterator.throw(t));
302
- }
303
- async every(e) {
304
- let t = 0;
305
- for (; ; ) {
306
- const n = await this._iterator.next();
307
- if (n.done)
308
- return !0;
309
- if (!e(n.value, t))
310
- return !1;
311
- t += 1;
312
- }
313
- }
314
- async some(e) {
315
- let t = 0;
316
- for (; ; ) {
317
- const n = await this._iterator.next();
318
- if (n.done)
319
- return !1;
320
- if (e(n.value, t))
321
- return !0;
322
- t += 1;
323
- }
324
- }
325
- filter(e) {
326
- const t = this._iterator;
327
- return new d(async function* () {
222
+ drop(t) {
223
+ const e = this._iterator;
224
+ return new l(function* () {
328
225
  let n = 0;
226
+ for (; n < t; ) {
227
+ if (e.next().done)
228
+ return;
229
+ n += 1;
230
+ }
329
231
  for (; ; ) {
330
- const r = await t.next();
232
+ const r = e.next();
331
233
  if (r.done)
332
234
  return r.value;
333
- e(r.value, n) && (yield r.value), n += 1;
235
+ yield r.value;
334
236
  }
335
237
  });
336
238
  }
337
- map(e) {
338
- const t = this._iterator;
339
- return new d(async function* () {
239
+ take(t) {
240
+ const e = this._iterator;
241
+ return new l(function* () {
340
242
  let n = 0;
341
- for (; ; ) {
342
- const r = await t.next();
243
+ for (; n < t; ) {
244
+ const r = e.next();
343
245
  if (r.done)
344
246
  return r.value;
345
- yield e(r.value, n), n += 1;
247
+ yield r.value, n += 1;
346
248
  }
347
249
  });
348
250
  }
349
- async reduce(e, t) {
350
- let n = 0, r = t;
351
- if (r === void 0) {
352
- const i = await this._iterator.next();
353
- if (i.done)
354
- throw new f("Cannot reduce an empty iterator without an initial value.");
355
- r = i.value, n += 1;
356
- }
251
+ find(t) {
252
+ let e = 0;
357
253
  for (; ; ) {
358
- const i = await this._iterator.next();
359
- if (i.done)
360
- return r;
361
- r = await e(r, i.value, n), n += 1;
254
+ const n = this._iterator.next();
255
+ if (n.done)
256
+ return;
257
+ if (t(n.value, e))
258
+ return n.value;
259
+ e += 1;
362
260
  }
363
261
  }
364
262
  enumerate() {
365
- return this.map((e, t) => [t, e]);
263
+ return this.map((t, e) => [e, t]);
366
264
  }
367
265
  unique() {
368
- const e = this._iterator;
369
- return new d(async function* () {
370
- const t = /* @__PURE__ */ new Set();
266
+ const t = this._iterator;
267
+ return new l(function* () {
268
+ const e = /* @__PURE__ */ new Set();
371
269
  for (; ; ) {
372
- const n = await e.next();
270
+ const n = t.next();
373
271
  if (n.done)
374
272
  return n.value;
375
- t.has(n.value) || (t.add(n.value), yield n.value);
273
+ e.has(n.value) || (e.add(n.value), yield n.value);
376
274
  }
377
275
  });
378
276
  }
379
- async count() {
380
- let e = 0;
277
+ count() {
278
+ let t = 0;
381
279
  for (; ; ) {
382
- if ((await this._iterator.next()).done)
383
- return e;
384
- e += 1;
280
+ if (this._iterator.next().done)
281
+ return t;
282
+ t += 1;
385
283
  }
386
284
  }
387
- async forEach(e) {
388
- let t = 0;
285
+ forEach(t) {
286
+ let e = 0;
389
287
  for (; ; ) {
390
- const n = await this._iterator.next();
288
+ const n = this._iterator.next();
391
289
  if (n.done)
392
290
  return;
393
- await e(n.value, t), t += 1;
291
+ t(n.value, e), e += 1;
394
292
  }
395
293
  }
396
- next(...e) {
397
- return this._iterator.next(...e);
294
+ next(...t) {
295
+ return this._iterator.next(...t);
398
296
  }
399
- async toArray() {
400
- const e = [];
401
- for (; ; ) {
402
- const t = await this._iterator.next();
403
- if (t.done)
404
- return e;
405
- e.push(t.value);
406
- }
297
+ groupBy(t) {
298
+ return new g(this.map((e, n) => [t(e, n), e]));
407
299
  }
408
- get [Symbol.toStringTag]() {
409
- return "SmartAsyncIterator";
300
+ toArray() {
301
+ return Array.from(this);
410
302
  }
411
- [Symbol.asyncIterator]() {
303
+ [(le = Symbol.toStringTag, Symbol.iterator)]() {
412
304
  return this;
413
305
  }
414
306
  }
415
- class l {
416
- constructor(e) {
417
- u(this, "_elements");
418
- this._elements = new a(e);
307
+ var ce;
308
+ ce = Symbol.toStringTag;
309
+ const y = class y {
310
+ constructor(t) {
311
+ a(this, "_elements");
312
+ a(this, ce, "ReducedIterator");
313
+ this._elements = new l(t);
314
+ }
315
+ every(t) {
316
+ for (const [e, [n, r]] of this._elements.enumerate())
317
+ if (!t(n, r, e))
318
+ return !1;
319
+ return !0;
419
320
  }
420
- filter(e) {
421
- const t = this._elements;
422
- return new l(function* () {
423
- for (const [n, [r, i]] of t.enumerate())
424
- e(r, i, n) && (yield [r, i]);
321
+ some(t) {
322
+ for (const [e, [n, r]] of this._elements.enumerate())
323
+ if (t(n, r, e))
324
+ return !0;
325
+ return !1;
326
+ }
327
+ filter(t) {
328
+ const e = this._elements.enumerate();
329
+ return new y(function* () {
330
+ for (const [n, [r, s]] of e)
331
+ t(r, s, n) && (yield [r, s]);
425
332
  });
426
333
  }
427
- map(e) {
428
- const t = this._elements;
429
- return new l(function* () {
430
- for (const [n, [r, i]] of t.enumerate())
431
- yield [r, e(r, i, n)];
334
+ map(t) {
335
+ const e = this._elements.enumerate();
336
+ return new y(function* () {
337
+ for (const [n, [r, s]] of e)
338
+ yield [r, t(r, s, n)];
432
339
  });
433
340
  }
434
- reduce(e, t) {
435
- let n = 0, r;
436
- if (t !== void 0)
437
- r = t;
438
- else {
439
- const i = this._elements.next();
440
- if (i.done)
441
- throw new f("Cannot reduce an empty iterator without an initial value.");
442
- n += 1, r = i.value[1];
341
+ reduce(t, e) {
342
+ let n = 0, r = e;
343
+ if (r === void 0) {
344
+ const s = this._elements.next();
345
+ if (s.done)
346
+ throw new d("Cannot reduce an empty iterator without an initial value.");
347
+ r = s.value[1], n += 1;
443
348
  }
444
- for (const [i, o] of this._elements)
445
- r = e(i, r, o, n), n += 1;
349
+ for (const [s, o] of this._elements)
350
+ r = t(s, r, o, n), n += 1;
446
351
  return r;
447
352
  }
353
+ flatMap(t) {
354
+ const e = this._elements.enumerate();
355
+ return new g(function* () {
356
+ for (const [n, [r, s]] of e)
357
+ for (const o of t(r, s, n))
358
+ yield [r, o];
359
+ });
360
+ }
361
+ drop(t) {
362
+ const e = this._elements.enumerate();
363
+ return new y(function* () {
364
+ for (const [n, [r, s]] of e)
365
+ n >= t && (yield [r, s]);
366
+ });
367
+ }
368
+ take(t) {
369
+ const e = this._elements.enumerate();
370
+ return new y(function* () {
371
+ for (const [n, [r, s]] of e) {
372
+ if (n >= t)
373
+ break;
374
+ yield [r, s];
375
+ }
376
+ });
377
+ }
378
+ enumerate() {
379
+ return this.map((t, e, n) => [n, e]);
380
+ }
381
+ unique() {
382
+ const t = this._elements;
383
+ return new y(function* () {
384
+ const e = /* @__PURE__ */ new Set();
385
+ for (const [n, r] of t)
386
+ e.has(r) || (e.add(r), yield [n, r]);
387
+ });
388
+ }
389
+ count() {
390
+ let t = 0;
391
+ for (const e of this._elements)
392
+ t += 1;
393
+ return t;
394
+ }
395
+ forEach(t) {
396
+ for (const [e, [n, r]] of this._elements.enumerate())
397
+ t(n, r, e);
398
+ }
448
399
  keys() {
449
- const e = this._elements;
450
- return new a(function* () {
451
- for (const [t] of e)
452
- yield t;
400
+ const t = this._elements;
401
+ return new l(function* () {
402
+ for (const [e] of t)
403
+ yield e;
453
404
  });
454
405
  }
455
406
  items() {
456
407
  return this._elements;
457
408
  }
458
409
  values() {
459
- const e = this._elements;
460
- return new a(function* () {
461
- for (const [t, n] of e)
410
+ const t = this._elements;
411
+ return new l(function* () {
412
+ for (const [e, n] of t)
462
413
  yield n;
463
414
  });
464
415
  }
@@ -471,374 +422,624 @@ class l {
471
422
  toObject() {
472
423
  return Object.fromEntries(this.items());
473
424
  }
474
- get [Symbol.toStringTag]() {
475
- return "ReducedIterator";
476
- }
477
- }
478
- class w {
479
- constructor(e) {
480
- u(this, "_elements");
481
- this._elements = new a(e);
482
- }
483
- every(e) {
484
- const t = /* @__PURE__ */ new Map();
485
- for (const [n, r] of this._elements) {
486
- const [i, o] = t.get(n) ?? [0, !0];
487
- o && t.set(n, [i + 1, e(n, r, i)]);
425
+ };
426
+ let f = y;
427
+ var fe;
428
+ fe = Symbol.toStringTag;
429
+ const m = class m {
430
+ constructor(t) {
431
+ a(this, "_elements");
432
+ a(this, fe, "AggregatedAsyncIterator");
433
+ this._elements = new h(t);
434
+ }
435
+ async every(t) {
436
+ const e = /* @__PURE__ */ new Map();
437
+ for await (const [n, r] of this._elements) {
438
+ const [s, o] = e.get(n) ?? [0, !0];
439
+ o && e.set(n, [s + 1, await t(n, r, s)]);
488
440
  }
489
- return new l(function* () {
490
- for (const [n, [r, i]] of t)
491
- yield [n, i];
441
+ return new f(function* () {
442
+ for (const [n, [r, s]] of e)
443
+ yield [n, s];
492
444
  });
493
445
  }
494
- some(e) {
495
- const t = /* @__PURE__ */ new Map();
496
- for (const [n, r] of this._elements) {
497
- const [i, o] = t.get(n) ?? [0, !1];
498
- o || t.set(n, [i + 1, e(n, r, i)]);
446
+ async some(t) {
447
+ const e = /* @__PURE__ */ new Map();
448
+ for await (const [n, r] of this._elements) {
449
+ const [s, o] = e.get(n) ?? [0, !1];
450
+ o || e.set(n, [s + 1, await t(n, r, s)]);
499
451
  }
500
- return new l(function* () {
501
- for (const [n, [r, i]] of t)
502
- yield [n, i];
452
+ return new f(function* () {
453
+ for (const [n, [r, s]] of e)
454
+ yield [n, s];
503
455
  });
504
456
  }
505
- filter(e) {
506
- const t = this._elements;
507
- return new w(function* () {
457
+ filter(t) {
458
+ const e = this._elements;
459
+ return new m(async function* () {
508
460
  const n = /* @__PURE__ */ new Map();
509
- for (const [r, i] of t) {
461
+ for await (const [r, s] of e) {
510
462
  const o = n.get(r) ?? 0;
511
- n.set(r, o + 1), e(r, i, o) && (yield [r, i]);
463
+ await t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
512
464
  }
513
465
  });
514
466
  }
515
- map(e) {
516
- const t = this._elements;
517
- return new w(function* () {
467
+ map(t) {
468
+ const e = this._elements;
469
+ return new m(async function* () {
518
470
  const n = /* @__PURE__ */ new Map();
519
- for (const [r, i] of t) {
471
+ for await (const [r, s] of e) {
520
472
  const o = n.get(r) ?? 0;
521
- n.set(r, o + 1), yield [r, e(r, i, o)];
473
+ yield [r, await t(r, s, o)], n.set(r, o + 1);
522
474
  }
523
475
  });
524
476
  }
525
- reduce(e, t) {
477
+ async reduce(t, e) {
526
478
  const n = /* @__PURE__ */ new Map();
527
- for (const [r, i] of this._elements) {
528
- let o, c;
479
+ for await (const [r, s] of this._elements) {
480
+ let o, u;
529
481
  if (n.has(r))
530
- [o, c] = n.get(r), o += 1;
531
- else if (t !== void 0)
532
- o = 0, c = t(r);
482
+ [o, u] = n.get(r);
483
+ else if (e !== void 0)
484
+ o = 0, u = await e(r);
533
485
  else {
534
- n.set(r, [0, i]);
486
+ n.set(r, [0, s]);
535
487
  continue;
536
488
  }
537
- c = e(r, c, i, o), n.set(r, [o, c]);
489
+ n.set(r, [o + 1, await t(r, u, s, o)]);
538
490
  }
539
- return new l(function* () {
540
- for (const [r, [i, o]] of n)
491
+ return new f(function* () {
492
+ for (const [r, [s, o]] of n)
541
493
  yield [r, o];
542
494
  });
543
495
  }
544
- unique() {
496
+ flatMap(t) {
545
497
  const e = this._elements;
546
- return new w(function* () {
547
- const t = /* @__PURE__ */ new Map();
548
- for (const [n, r] of e) {
549
- const i = t.get(n) ?? /* @__PURE__ */ new Set();
550
- i.has(r) || (i.add(r), t.set(n, i), yield [n, r]);
498
+ return new m(async function* () {
499
+ const n = /* @__PURE__ */ new Map();
500
+ for await (const [r, s] of e) {
501
+ const o = n.get(r) ?? 0, u = await t(r, s, o);
502
+ for await (const _ of u)
503
+ yield [r, _];
504
+ n.set(r, o + 1);
551
505
  }
552
506
  });
553
507
  }
554
- count() {
508
+ drop(t) {
509
+ const e = this._elements;
510
+ return new m(async function* () {
511
+ const n = /* @__PURE__ */ new Map();
512
+ for await (const [r, s] of e) {
513
+ const o = n.get(r) ?? 0;
514
+ if (o < t) {
515
+ n.set(r, o + 1);
516
+ continue;
517
+ }
518
+ yield [r, s];
519
+ }
520
+ });
521
+ }
522
+ take(t) {
523
+ const e = this._elements;
524
+ return new m(async function* () {
525
+ const n = /* @__PURE__ */ new Map();
526
+ for await (const [r, s] of e) {
527
+ const o = n.get(r) ?? 0;
528
+ if (o >= t) {
529
+ if (n.values().every((u) => u >= t))
530
+ break;
531
+ continue;
532
+ }
533
+ yield [r, s], n.set(r, o + 1);
534
+ }
535
+ });
536
+ }
537
+ async find(t) {
555
538
  const e = /* @__PURE__ */ new Map();
556
- for (const [t] of this._elements) {
557
- const n = e.get(t) ?? 0;
558
- e.set(t, n + 1);
539
+ for await (const [n, r] of this._elements) {
540
+ let [s, o] = e.get(n) ?? [0, void 0];
541
+ o === void 0 && (await t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
559
542
  }
560
- return new l(function* () {
561
- for (const [t, n] of e)
562
- yield [t, n];
543
+ return new f(function* () {
544
+ for (const [n, [r, s]] of e)
545
+ yield [n, s];
563
546
  });
564
547
  }
565
- first() {
566
- const e = /* @__PURE__ */ new Map();
567
- for (const [t, n] of this._elements)
568
- e.has(t) || e.set(t, n);
569
- return new l(function* () {
570
- for (const [t, n] of e)
571
- yield [t, n];
548
+ unique() {
549
+ const t = this._elements;
550
+ return new m(async function* () {
551
+ const e = /* @__PURE__ */ new Map();
552
+ for await (const [n, r] of t) {
553
+ const s = e.get(n) ?? /* @__PURE__ */ new Set();
554
+ s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
555
+ }
572
556
  });
573
557
  }
574
- last() {
575
- const e = /* @__PURE__ */ new Map();
576
- for (const [t, n] of this._elements)
577
- e.set(t, n);
578
- return new l(function* () {
579
- for (const [t, n] of e)
580
- yield [t, n];
558
+ async count() {
559
+ const t = /* @__PURE__ */ new Map();
560
+ for await (const [e] of this._elements) {
561
+ const n = t.get(e) ?? 0;
562
+ t.set(e, n + 1);
563
+ }
564
+ return new f(function* () {
565
+ for (const [e, n] of t)
566
+ yield [e, n];
581
567
  });
582
568
  }
569
+ async forEach(t) {
570
+ const e = /* @__PURE__ */ new Map();
571
+ for await (const [n, r] of this._elements) {
572
+ const s = e.get(n) ?? 0;
573
+ t(n, r, s), e.set(n, s + 1);
574
+ }
575
+ }
583
576
  keys() {
584
- const e = this._elements;
585
- return new a(function* () {
586
- const t = /* @__PURE__ */ new Set();
587
- for (const [n] of e)
588
- t.has(n) || (t.add(n), yield n);
577
+ const t = this._elements;
578
+ return new h(async function* () {
579
+ const e = /* @__PURE__ */ new Set();
580
+ for await (const [n] of t)
581
+ e.has(n) || (e.add(n), yield n);
589
582
  });
590
583
  }
591
584
  items() {
592
585
  return this._elements;
593
586
  }
594
587
  values() {
595
- const e = this._elements;
596
- return new a(function* () {
597
- for (const [t, n] of e)
588
+ const t = this._elements;
589
+ return new h(async function* () {
590
+ for await (const [e, n] of t)
598
591
  yield n;
599
592
  });
600
593
  }
601
- toArray() {
602
- return Array.from(this.toMap().values());
594
+ async toArray() {
595
+ const t = await this.toMap();
596
+ return Array.from(t.values());
603
597
  }
604
- toMap() {
605
- const e = /* @__PURE__ */ new Map();
606
- for (const [t, n] of this._elements) {
607
- const r = e.get(t) ?? [];
608
- r.push(n), e.set(t, r);
598
+ async toMap() {
599
+ const t = /* @__PURE__ */ new Map();
600
+ for await (const [e, n] of this._elements) {
601
+ const r = t.get(e) ?? [];
602
+ r.push(n), t.set(e, r);
609
603
  }
610
- return e;
604
+ return t;
611
605
  }
612
- toObject() {
613
- const e = {};
614
- for (const [t, n] of this._elements) {
615
- const r = e[t] ?? [];
616
- r.push(n), e[t] = r;
606
+ async toObject() {
607
+ const t = {};
608
+ for await (const [e, n] of this._elements) {
609
+ const r = t[e] ?? [];
610
+ r.push(n), t[e] = r;
611
+ }
612
+ return t;
613
+ }
614
+ };
615
+ let S = m;
616
+ var he;
617
+ class h {
618
+ constructor(t) {
619
+ a(this, "_iterator");
620
+ a(this, "return");
621
+ a(this, "throw");
622
+ a(this, he, "SmartAsyncIterator");
623
+ if (t instanceof Function) {
624
+ const e = t();
625
+ Symbol.asyncIterator in e ? this._iterator = e : this._iterator = async function* () {
626
+ let n = [];
627
+ for (; ; ) {
628
+ const r = e.next(...n);
629
+ if (r.done)
630
+ return r.value;
631
+ n = [yield r.value];
632
+ }
633
+ }();
634
+ } else if (Symbol.asyncIterator in t)
635
+ this._iterator = t[Symbol.asyncIterator]();
636
+ else if (Symbol.iterator in t) {
637
+ const e = t[Symbol.iterator]();
638
+ this._iterator = async function* () {
639
+ for (; ; ) {
640
+ const n = e.next();
641
+ if (n.done)
642
+ return n.value;
643
+ yield n.value;
644
+ }
645
+ }();
646
+ } else
647
+ this._iterator = async function* () {
648
+ let e = [];
649
+ for (; ; ) {
650
+ const n = await t.next(...e);
651
+ if (n.done)
652
+ return n.value;
653
+ e = [yield n.value];
654
+ }
655
+ }();
656
+ this._iterator.return && (this.return = (e) => this._iterator.return(e)), this._iterator.throw && (this.throw = (e) => this._iterator.throw(e));
657
+ }
658
+ async every(t) {
659
+ let e = 0;
660
+ for (; ; ) {
661
+ const n = await this._iterator.next();
662
+ if (n.done)
663
+ return !0;
664
+ if (!await t(n.value, e))
665
+ return !1;
666
+ e += 1;
617
667
  }
618
- return e;
619
668
  }
620
- get [Symbol.toStringTag]() {
621
- return "AggregatedIterator";
669
+ async some(t) {
670
+ let e = 0;
671
+ for (; ; ) {
672
+ const n = await this._iterator.next();
673
+ if (n.done)
674
+ return !1;
675
+ if (await t(n.value, e))
676
+ return !0;
677
+ e += 1;
678
+ }
622
679
  }
623
- }
624
- class _ {
625
- constructor(e) {
626
- u(this, "_elements");
627
- this._elements = new a(e);
680
+ filter(t) {
681
+ const e = this._iterator;
682
+ return new h(async function* () {
683
+ let n = 0;
684
+ for (; ; ) {
685
+ const r = await e.next();
686
+ if (r.done)
687
+ return r.value;
688
+ await t(r.value, n) && (yield r.value), n += 1;
689
+ }
690
+ });
691
+ }
692
+ map(t) {
693
+ const e = this._iterator;
694
+ return new h(async function* () {
695
+ let n = 0;
696
+ for (; ; ) {
697
+ const r = await e.next();
698
+ if (r.done)
699
+ return r.value;
700
+ yield await t(r.value, n), n += 1;
701
+ }
702
+ });
703
+ }
704
+ async reduce(t, e) {
705
+ let n = 0, r = e;
706
+ if (r === void 0) {
707
+ const s = await this._iterator.next();
708
+ if (s.done)
709
+ throw new d("Cannot reduce an empty iterator without an initial value.");
710
+ r = s.value, n += 1;
711
+ }
712
+ for (; ; ) {
713
+ const s = await this._iterator.next();
714
+ if (s.done)
715
+ return r;
716
+ r = await t(r, s.value, n), n += 1;
717
+ }
718
+ }
719
+ flatMap(t) {
720
+ const e = this._iterator;
721
+ return new h(async function* () {
722
+ let n = 0;
723
+ for (; ; ) {
724
+ const r = await e.next();
725
+ if (r.done)
726
+ return r.value;
727
+ const s = await t(r.value, n);
728
+ for await (const o of s)
729
+ yield o;
730
+ n += 1;
731
+ }
732
+ });
733
+ }
734
+ drop(t) {
735
+ const e = this._iterator;
736
+ return new h(async function* () {
737
+ let n = 0;
738
+ for (; n < t; ) {
739
+ if ((await e.next()).done)
740
+ return;
741
+ n += 1;
742
+ }
743
+ for (; ; ) {
744
+ const r = await e.next();
745
+ if (r.done)
746
+ return r.value;
747
+ yield r.value;
748
+ }
749
+ });
628
750
  }
629
- filter(e) {
630
- return new _(this._elements.filter(e));
751
+ take(t) {
752
+ const e = this._iterator;
753
+ return new h(async function* () {
754
+ let n = 0;
755
+ for (; n < t; ) {
756
+ const r = await e.next();
757
+ if (r.done)
758
+ return r.value;
759
+ yield r.value, n += 1;
760
+ }
761
+ });
631
762
  }
632
- map(e) {
633
- return new _(this._elements.map(e));
763
+ async find(t) {
764
+ let e = 0;
765
+ for (; ; ) {
766
+ const n = await this._iterator.next();
767
+ if (n.done)
768
+ return;
769
+ if (await t(n.value, e))
770
+ return n.value;
771
+ e += 1;
772
+ }
773
+ }
774
+ enumerate() {
775
+ return this.map((t, e) => [e, t]);
634
776
  }
635
777
  unique() {
636
- return new _(this._elements.unique());
778
+ const t = this._iterator;
779
+ return new h(async function* () {
780
+ const e = /* @__PURE__ */ new Set();
781
+ for (; ; ) {
782
+ const n = await t.next();
783
+ if (n.done)
784
+ return n.value;
785
+ e.has(n.value) || (e.add(n.value), yield n.value);
786
+ }
787
+ });
637
788
  }
638
- groupBy(e) {
639
- return new w(this._elements.map((t, n) => [e(t, n), t]));
789
+ async count() {
790
+ let t = 0;
791
+ for (; ; ) {
792
+ if ((await this._iterator.next()).done)
793
+ return t;
794
+ t += 1;
795
+ }
640
796
  }
641
- get [Symbol.toStringTag]() {
642
- return "Aggregator";
797
+ async forEach(t) {
798
+ let e = 0;
799
+ for (; ; ) {
800
+ const n = await this._iterator.next();
801
+ if (n.done)
802
+ return;
803
+ await t(n.value, e), e += 1;
804
+ }
643
805
  }
644
- }
645
- class y {
646
- constructor(e) {
647
- u(this, "_elements");
648
- this._elements = new d(e);
806
+ next(...t) {
807
+ return this._iterator.next(...t);
649
808
  }
650
- async every(e) {
651
- const t = /* @__PURE__ */ new Map();
652
- for await (const [n, r] of this._elements) {
653
- const [i, o] = t.get(n) ?? [0, !0];
654
- o && t.set(n, [i + 1, await e(n, r, i)]);
809
+ groupBy(t) {
810
+ return new S(this.map(async (e, n) => [await t(e, n), e]));
811
+ }
812
+ toArray() {
813
+ return Array.fromAsync(this);
814
+ }
815
+ [(he = Symbol.toStringTag, Symbol.asyncIterator)]() {
816
+ return this;
817
+ }
818
+ }
819
+ var de;
820
+ de = Symbol.toStringTag;
821
+ const w = class w {
822
+ constructor(t) {
823
+ a(this, "_elements");
824
+ a(this, de, "AggregatedIterator");
825
+ this._elements = new l(t);
826
+ }
827
+ every(t) {
828
+ const e = /* @__PURE__ */ new Map();
829
+ for (const [n, r] of this._elements) {
830
+ const [s, o] = e.get(n) ?? [0, !0];
831
+ o && e.set(n, [s + 1, t(n, r, s)]);
655
832
  }
656
- return new l(function* () {
657
- for (const [n, [r, i]] of t)
658
- yield [n, i];
833
+ return new f(function* () {
834
+ for (const [n, [r, s]] of e)
835
+ yield [n, s];
659
836
  });
660
837
  }
661
- async some(e) {
662
- const t = /* @__PURE__ */ new Map();
663
- for await (const [n, r] of this._elements) {
664
- const [i, o] = t.get(n) ?? [0, !1];
665
- o || t.set(n, [i + 1, await e(n, r, i)]);
838
+ some(t) {
839
+ const e = /* @__PURE__ */ new Map();
840
+ for (const [n, r] of this._elements) {
841
+ const [s, o] = e.get(n) ?? [0, !1];
842
+ o || e.set(n, [s + 1, t(n, r, s)]);
666
843
  }
667
- return new l(function* () {
668
- for (const [n, [r, i]] of t)
669
- yield [n, i];
844
+ return new f(function* () {
845
+ for (const [n, [r, s]] of e)
846
+ yield [n, s];
670
847
  });
671
848
  }
672
- filter(e) {
673
- const t = this._elements;
674
- return new y(async function* () {
849
+ filter(t) {
850
+ const e = this._elements;
851
+ return new w(function* () {
675
852
  const n = /* @__PURE__ */ new Map();
676
- for await (const [r, i] of t) {
853
+ for (const [r, s] of e) {
677
854
  const o = n.get(r) ?? 0;
678
- n.set(r, o + 1), await e(r, i, o) && (yield [r, i]);
855
+ t(r, s, o) && (yield [r, s]), n.set(r, o + 1);
679
856
  }
680
857
  });
681
858
  }
682
- map(e) {
683
- const t = this._elements;
684
- return new y(async function* () {
859
+ map(t) {
860
+ const e = this._elements;
861
+ return new w(function* () {
685
862
  const n = /* @__PURE__ */ new Map();
686
- for await (const [r, i] of t) {
863
+ for (const [r, s] of e) {
687
864
  const o = n.get(r) ?? 0;
688
- n.set(r, o + 1), yield [r, await e(r, i, o)];
865
+ yield [r, t(r, s, o)], n.set(r, o + 1);
689
866
  }
690
867
  });
691
868
  }
692
- async reduce(e, t) {
869
+ reduce(t, e) {
693
870
  const n = /* @__PURE__ */ new Map();
694
- for await (const [r, i] of this._elements) {
695
- let o, c;
871
+ for (const [r, s] of this._elements) {
872
+ let o, u;
696
873
  if (n.has(r))
697
- [o, c] = n.get(r), o += 1;
698
- else if (t !== void 0)
699
- o = 0, c = await t(r);
874
+ [o, u] = n.get(r);
875
+ else if (e !== void 0)
876
+ o = 0, u = e(r);
700
877
  else {
701
- n.set(r, [0, i]);
878
+ n.set(r, [0, s]);
702
879
  continue;
703
880
  }
704
- c = await e(r, c, i, o), n.set(r, [o, c]);
881
+ n.set(r, [o + 1, t(r, u, s, o)]);
705
882
  }
706
- return new l(function* () {
707
- for (const [r, [i, o]] of n)
883
+ return new f(function* () {
884
+ for (const [r, [s, o]] of n)
708
885
  yield [r, o];
709
886
  });
710
887
  }
711
- unique() {
888
+ flatMap(t) {
712
889
  const e = this._elements;
713
- return new y(async function* () {
714
- const t = /* @__PURE__ */ new Map();
715
- for await (const [n, r] of e) {
716
- const i = t.get(n) ?? /* @__PURE__ */ new Set();
717
- i.has(r) || (i.add(r), t.set(n, i), yield [n, r]);
890
+ return new w(function* () {
891
+ const n = /* @__PURE__ */ new Map();
892
+ for (const [r, s] of e) {
893
+ const o = n.get(r) ?? 0, u = t(r, s, o);
894
+ for (const _ of u)
895
+ yield [r, _];
896
+ n.set(r, o + 1);
718
897
  }
719
898
  });
720
899
  }
721
- async count() {
900
+ drop(t) {
901
+ const e = this._elements;
902
+ return new w(function* () {
903
+ const n = /* @__PURE__ */ new Map();
904
+ for (const [r, s] of e) {
905
+ const o = n.get(r) ?? 0;
906
+ if (o < t) {
907
+ n.set(r, o + 1);
908
+ continue;
909
+ }
910
+ yield [r, s];
911
+ }
912
+ });
913
+ }
914
+ take(t) {
915
+ const e = this._elements;
916
+ return new w(function* () {
917
+ const n = /* @__PURE__ */ new Map();
918
+ for (const [r, s] of e) {
919
+ const o = n.get(r) ?? 0;
920
+ if (o >= t) {
921
+ if (n.values().every((u) => u >= t))
922
+ break;
923
+ continue;
924
+ }
925
+ yield [r, s], n.set(r, o + 1);
926
+ }
927
+ });
928
+ }
929
+ find(t) {
722
930
  const e = /* @__PURE__ */ new Map();
723
- for await (const [t] of this._elements) {
724
- const n = e.get(t) ?? 0;
725
- e.set(t, n + 1);
931
+ for (const [n, r] of this._elements) {
932
+ let [s, o] = e.get(n) ?? [0, void 0];
933
+ o === void 0 && (t(n, r, s) && (o = r), e.set(n, [s + 1, o]));
726
934
  }
727
- return new l(function* () {
728
- for (const [t, n] of e)
729
- yield [t, n];
935
+ return new f(function* () {
936
+ for (const [n, [r, s]] of e)
937
+ yield [n, s];
730
938
  });
731
939
  }
732
- async first() {
733
- const e = /* @__PURE__ */ new Map();
734
- for await (const [t, n] of this._elements)
735
- e.has(t) || e.set(t, n);
736
- return new l(function* () {
737
- for (const [t, n] of e)
738
- yield [t, n];
940
+ enumerate() {
941
+ return this.map((t, e, n) => [n, e]);
942
+ }
943
+ unique() {
944
+ const t = this._elements;
945
+ return new w(function* () {
946
+ const e = /* @__PURE__ */ new Map();
947
+ for (const [n, r] of t) {
948
+ const s = e.get(n) ?? /* @__PURE__ */ new Set();
949
+ s.has(r) || (s.add(r), e.set(n, s), yield [n, r]);
950
+ }
739
951
  });
740
952
  }
741
- async last() {
742
- const e = /* @__PURE__ */ new Map();
743
- for await (const [t, n] of this._elements)
744
- e.set(t, n);
745
- return new l(function* () {
746
- for (const [t, n] of e)
747
- yield [t, n];
953
+ count() {
954
+ const t = /* @__PURE__ */ new Map();
955
+ for (const [e] of this._elements) {
956
+ const n = t.get(e) ?? 0;
957
+ t.set(e, n + 1);
958
+ }
959
+ return new f(function* () {
960
+ for (const [e, n] of t)
961
+ yield [e, n];
748
962
  });
749
963
  }
964
+ forEach(t) {
965
+ const e = /* @__PURE__ */ new Map();
966
+ for (const [n, r] of this._elements) {
967
+ const s = e.get(n) ?? 0;
968
+ t(n, r, s), e.set(n, s + 1);
969
+ }
970
+ }
750
971
  keys() {
751
- const e = this._elements;
752
- return new d(async function* () {
753
- const t = /* @__PURE__ */ new Set();
754
- for await (const [n] of e)
755
- t.has(n) || (t.add(n), yield n);
972
+ const t = this._elements;
973
+ return new l(function* () {
974
+ const e = /* @__PURE__ */ new Set();
975
+ for (const [n] of t)
976
+ e.has(n) || (e.add(n), yield n);
756
977
  });
757
978
  }
758
979
  items() {
759
980
  return this._elements;
760
981
  }
761
982
  values() {
762
- const e = this._elements;
763
- return new d(async function* () {
764
- for await (const [t, n] of e)
983
+ const t = this._elements;
984
+ return new l(function* () {
985
+ for (const [e, n] of t)
765
986
  yield n;
766
987
  });
767
988
  }
768
- async toArray() {
769
- const e = await this.toMap();
770
- return Array.from(e.values());
989
+ toArray() {
990
+ const t = this.toMap();
991
+ return Array.from(t.values());
771
992
  }
772
- async toMap() {
773
- const e = /* @__PURE__ */ new Map();
774
- for await (const [t, n] of this._elements) {
775
- const r = e.get(t) ?? [];
776
- r.push(n), e.set(t, r);
993
+ toMap() {
994
+ const t = /* @__PURE__ */ new Map();
995
+ for (const [e, n] of this._elements) {
996
+ const r = t.get(e) ?? [];
997
+ r.push(n), t.set(e, r);
777
998
  }
778
- return e;
999
+ return t;
779
1000
  }
780
- async toObject() {
781
- const e = {};
782
- for await (const [t, n] of this._elements) {
783
- const r = e[t] ?? [];
784
- r.push(n), e[t] = r;
1001
+ toObject() {
1002
+ const t = {};
1003
+ for (const [e, n] of this._elements) {
1004
+ const r = t[e] ?? [];
1005
+ r.push(n), t[e] = r;
785
1006
  }
786
- return e;
787
- }
788
- get [Symbol.toStringTag]() {
789
- return "AggregatedAsyncIterator";
1007
+ return t;
790
1008
  }
1009
+ };
1010
+ let g = w;
1011
+ var b = /* @__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))(b || {});
1012
+ function Le(i, t, e = 864e5) {
1013
+ return i = new Date(i), t = new Date(t), Math.floor((t.getTime() - i.getTime()) / e);
791
1014
  }
792
- class p {
793
- constructor(e) {
794
- u(this, "_elements");
795
- this._elements = new d(e);
796
- }
797
- filter(e) {
798
- return new p(this._elements.filter(e));
799
- }
800
- map(e) {
801
- return new p(this._elements.map(e));
802
- }
803
- unique() {
804
- return new p(this._elements.unique());
805
- }
806
- groupBy(e) {
807
- return new y(this._elements.map(async (t, n) => [await e(t, n), t]));
808
- }
809
- get [Symbol.toStringTag]() {
810
- return "AsyncAggregator";
811
- }
812
- }
813
- var x = /* @__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))(x || {});
814
- function L(s, e, t = 864e5) {
815
- return s = new Date(s), e = new Date(e), Math.floor((e.getTime() - s.getTime()) / t);
816
- }
817
- function Q(s, e, t = 864e5) {
818
- return s = new Date(s), e = new Date(e), new a(function* () {
819
- const n = e.getTime();
820
- let r = s.getTime();
1015
+ function Qe(i, t, e = 864e5) {
1016
+ return i = new Date(i), t = new Date(t), new l(function* () {
1017
+ const n = t.getTime();
1018
+ let r = i.getTime();
821
1019
  for (; r < n; )
822
- yield new Date(r), r += t;
1020
+ yield new Date(r), r += e;
823
1021
  });
824
1022
  }
825
- function X(s, e = 864e5) {
826
- return s = new Date(s), new Date(Math.floor(s.getTime() / e) * e);
1023
+ function Xe(i, t = 864e5) {
1024
+ return i = new Date(i), new Date(Math.floor(i.getTime() / t) * t);
827
1025
  }
828
- class R {
829
- constructor(e, t = 30) {
830
- u(this, "_handle");
831
- u(this, "_startTime");
832
- u(this, "_isRunning");
833
- u(this, "_start");
834
- u(this, "_stop");
835
- this._startTime = 0, this._isRunning = !1, E ? (this._start = () => {
836
- e(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
1026
+ var me;
1027
+ me = Symbol.toStringTag;
1028
+ class Pe {
1029
+ constructor(t, e = 30) {
1030
+ a(this, "_handle");
1031
+ a(this, "_startTime");
1032
+ a(this, "_isRunning");
1033
+ a(this, "_start");
1034
+ a(this, "_stop");
1035
+ a(this, me, "GameLoop");
1036
+ this._startTime = 0, this._isRunning = !1, Me ? (this._start = () => {
1037
+ t(this.elapsedTime), this._handle = window.requestAnimationFrame(this._start);
837
1038
  }, this._stop = () => window.cancelAnimationFrame(this._handle)) : (console.warn(
838
- `Not a browser environment detected. Using setInterval@${t}fps instead of requestAnimationFrame...`
1039
+ `Not a browser environment detected. Using setInterval@${e}fps instead of requestAnimationFrame...`
839
1040
  ), this._start = () => {
840
- const n = x.Second / t;
841
- this._handle = setInterval(() => e(this.elapsedTime), n);
1041
+ const n = b.Second / e;
1042
+ this._handle = setInterval(() => t(this.elapsedTime), n);
842
1043
  }, this._stop = () => clearInterval(this._handle));
843
1044
  }
844
1045
  get startTime() {
@@ -850,58 +1051,61 @@ class R {
850
1051
  get elapsedTime() {
851
1052
  return performance.now() - this._startTime;
852
1053
  }
853
- start(e = 0) {
1054
+ start(t = 0) {
854
1055
  if (this._isRunning)
855
- throw new m("The game loop has already been started.");
856
- this._startTime = performance.now() - e, this._start(), this._isRunning = !0;
1056
+ throw new p("The game loop has already been started.");
1057
+ this._startTime = performance.now() - t, this._start(), this._isRunning = !0;
857
1058
  }
858
1059
  stop() {
859
1060
  if (!this._isRunning)
860
- throw new m("The game loop hadn't yet started.");
1061
+ throw new p("The game loop hadn't yet started.");
861
1062
  if (!this._handle)
862
- throw new g();
1063
+ throw new x();
863
1064
  this._stop(), this._handle = void 0, this._isRunning = !1;
864
1065
  }
865
1066
  }
866
- class Z {
867
- constructor(e = !0) {
868
- u(this, "_preferPersistence");
869
- u(this, "_volatile");
870
- u(this, "_persistent");
871
- if (this._preferPersistence = e, !E)
872
- throw new A(
1067
+ var we;
1068
+ we = Symbol.toStringTag;
1069
+ class Ze {
1070
+ constructor(t = !0) {
1071
+ a(this, "_preferPersistence");
1072
+ a(this, "_volatile");
1073
+ a(this, "_persistent");
1074
+ a(this, we, "JSONStorage");
1075
+ if (this._preferPersistence = t, !Me)
1076
+ throw new De(
873
1077
  "The `JSONStorage` class can only be instantiated within a browser environment."
874
1078
  );
875
1079
  this._volatile = window.sessionStorage, this._persistent = window.localStorage;
876
1080
  }
877
- _get(e, t, n) {
878
- const r = e.getItem(t);
1081
+ _get(t, e, n) {
1082
+ const r = t.getItem(e);
879
1083
  if (r)
880
1084
  try {
881
1085
  return JSON.parse(r);
882
1086
  } catch {
883
1087
  console.warn(
884
- `The "${r}" value for "${t}" property cannot be parsed. Clearing the storage...`
885
- ), e.removeItem(t);
1088
+ `The "${r}" value for "${e}" property cannot be parsed. Clearing the storage...`
1089
+ ), t.removeItem(e);
886
1090
  }
887
1091
  return n;
888
1092
  }
889
- _set(e, t, n) {
1093
+ _set(t, e, n) {
890
1094
  const r = JSON.stringify(n);
891
- r ? e.setItem(t, r) : e.removeItem(t);
1095
+ r ? t.setItem(e, r) : t.removeItem(e);
892
1096
  }
893
- get(e, t, n = this._preferPersistence) {
1097
+ get(t, e, n = this._preferPersistence) {
894
1098
  const r = n ? this._persistent : this._volatile;
895
- return this._get(r, e, t);
1099
+ return this._get(r, t, e);
896
1100
  }
897
- recall(e, t) {
898
- return this._get(this._volatile, e, t);
1101
+ recall(t, e) {
1102
+ return this._get(this._volatile, t, e);
899
1103
  }
900
- retrieve(e, t) {
901
- return this.recall(e) ?? this.read(e, t);
1104
+ retrieve(t, e) {
1105
+ return this.recall(t) ?? this.read(t, e);
902
1106
  }
903
- read(e, t) {
904
- return this._get(this._persistent, e, t);
1107
+ read(t, e) {
1108
+ return this._get(this._persistent, t, e);
905
1109
  }
906
1110
  /**
907
1111
  * Checks whether the property with the specified name exists in the corresponding storage.
@@ -911,8 +1115,8 @@ class Z {
911
1115
  *
912
1116
  * @returns `true` if the property exists, `false` otherwise.
913
1117
  */
914
- has(e, t) {
915
- return (t ? this._persistent : this._volatile).getItem(e) !== null;
1118
+ has(t, e) {
1119
+ return (e ? this._persistent : this._volatile).getItem(t) !== null;
916
1120
  }
917
1121
  /**
918
1122
  * Checks whether the property with the specified name exists in the volatile `sessionStorage`.
@@ -921,8 +1125,8 @@ class Z {
921
1125
  *
922
1126
  * @returns `true` if the property exists, `false` otherwise.
923
1127
  */
924
- knows(e) {
925
- return this._volatile.getItem(e) !== null;
1128
+ knows(t) {
1129
+ return this._volatile.getItem(t) !== null;
926
1130
  }
927
1131
  /**
928
1132
  * Checks whether the property with the specified name exists looking first in the
@@ -932,8 +1136,8 @@ class Z {
932
1136
  *
933
1137
  * @returns `true` if the property exists, `false` otherwise.
934
1138
  */
935
- find(e) {
936
- return this.knows(e) ?? this.exists(e);
1139
+ find(t) {
1140
+ return this.knows(t) ?? this.exists(t);
937
1141
  }
938
1142
  /**
939
1143
  * Checks whether the property with the specified name exists in the persistent `localStorage`.
@@ -942,8 +1146,8 @@ class Z {
942
1146
  *
943
1147
  * @returns `true` if the property exists, `false` otherwise.
944
1148
  */
945
- exists(e) {
946
- return this._persistent.getItem(e) !== null;
1149
+ exists(t) {
1150
+ return this._persistent.getItem(t) !== null;
947
1151
  }
948
1152
  /**
949
1153
  * Sets the value with the specified name in the corresponding storage.
@@ -953,9 +1157,9 @@ class Z {
953
1157
  * @param newValue The new value to set.
954
1158
  * @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
955
1159
  */
956
- set(e, t, n = this._preferPersistence) {
1160
+ set(t, e, n = this._preferPersistence) {
957
1161
  const r = n ? this._persistent : this._volatile;
958
- this._set(r, e, t);
1162
+ this._set(r, t, e);
959
1163
  }
960
1164
  /**
961
1165
  * Sets the value with the specified name in the volatile `sessionStorage`.
@@ -964,8 +1168,8 @@ class Z {
964
1168
  * @param propertyName The name of the property to set.
965
1169
  * @param newValue The new value to set.
966
1170
  */
967
- remember(e, t) {
968
- this._set(this._volatile, e, t);
1171
+ remember(t, e) {
1172
+ this._set(this._volatile, t, e);
969
1173
  }
970
1174
  /**
971
1175
  * Sets the value with the specified name in the persistent `localStorage`.
@@ -974,48 +1178,51 @@ class Z {
974
1178
  * @param propertyName The name of the property to set.
975
1179
  * @param newValue The new value to set.
976
1180
  */
977
- write(e, t) {
978
- this._set(this._persistent, e, t);
1181
+ write(t, e) {
1182
+ this._set(this._persistent, t, e);
979
1183
  }
980
1184
  /**
981
1185
  * Removes the value with the specified name from the volatile `sessionStorage`.
982
1186
  *
983
1187
  * @param propertyName The name of the property to remove.
984
1188
  */
985
- forget(e) {
986
- this._volatile.removeItem(e);
1189
+ forget(t) {
1190
+ this._volatile.removeItem(t);
987
1191
  }
988
1192
  /**
989
1193
  * Removes the value with the specified name from the persistent `localStorage`.
990
1194
  *
991
1195
  * @param propertyName The name of the property to remove.
992
1196
  */
993
- erase(e) {
994
- this._persistent.removeItem(e);
1197
+ erase(t) {
1198
+ this._persistent.removeItem(t);
995
1199
  }
996
1200
  /**
997
1201
  * Removes the value with the specified name from all the storages.
998
1202
  *
999
1203
  * @param propertyName The name of the property to remove.
1000
1204
  */
1001
- clear(e) {
1002
- this._volatile.removeItem(e), this._persistent.removeItem(e);
1003
- }
1004
- get [Symbol.toStringTag]() {
1005
- return "JSONStorage";
1205
+ clear(t) {
1206
+ this._volatile.removeItem(t), this._persistent.removeItem(t);
1006
1207
  }
1007
1208
  }
1008
- class F {
1009
- constructor(e) {
1010
- u(this, "_isPending");
1011
- u(this, "_isFulfilled");
1012
- u(this, "_isRejected");
1013
- u(this, "_promise");
1209
+ var ye;
1210
+ ye = Symbol.toStringTag;
1211
+ const E = class E {
1212
+ constructor(t) {
1213
+ a(this, "_isPending");
1214
+ a(this, "_isFulfilled");
1215
+ a(this, "_isRejected");
1216
+ a(this, "_promise");
1217
+ a(this, ye, "SmartPromise");
1014
1218
  this._isPending = !0, this._isFulfilled = !1, this._isRejected = !1;
1015
- const t = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
1219
+ const e = (r) => (this._isPending = !1, this._isFulfilled = !0, r), n = (r) => {
1016
1220
  throw this._isPending = !1, this._isRejected = !0, r;
1017
1221
  };
1018
- this._promise = new Promise(e).then(t, n);
1222
+ this._promise = new Promise(t).then(e, n);
1223
+ }
1224
+ static FromPromise(t) {
1225
+ return new E((e, n) => t.then(e, n));
1019
1226
  }
1020
1227
  get isPending() {
1021
1228
  return this._isPending;
@@ -1026,28 +1233,28 @@ class F {
1026
1233
  get isRejected() {
1027
1234
  return this._isRejected;
1028
1235
  }
1029
- then(e, t) {
1030
- return this._promise.then(e, t);
1236
+ then(t, e) {
1237
+ return this._promise.then(t, e);
1031
1238
  }
1032
- catch(e) {
1033
- return this._promise.catch(e);
1239
+ catch(t) {
1240
+ return this._promise.catch(t);
1034
1241
  }
1035
- finally(e) {
1036
- return this._promise.finally(e);
1242
+ finally(t) {
1243
+ return this._promise.finally(t);
1037
1244
  }
1038
- get [Symbol.toStringTag]() {
1039
- return "SmartPromise";
1040
- }
1041
- }
1042
- class O extends F {
1043
- constructor(t, n) {
1044
- let r, i;
1045
- super((o, c) => {
1046
- r = o, i = c;
1245
+ };
1246
+ let v = E;
1247
+ var pe, _e;
1248
+ class qe extends (_e = v, pe = Symbol.toStringTag, _e) {
1249
+ constructor(e, n) {
1250
+ let r, s;
1251
+ super((o, u) => {
1252
+ r = o, s = u;
1047
1253
  });
1048
- u(this, "_resolve");
1049
- u(this, "_reject");
1050
- this._promise.then(t, n), this._resolve = r, this._reject = i;
1254
+ a(this, "_resolve");
1255
+ a(this, "_reject");
1256
+ a(this, pe, "DeferredPromise");
1257
+ this._promise.then(e, n), this._resolve = r, this._reject = s;
1051
1258
  }
1052
1259
  get resolve() {
1053
1260
  return this._resolve;
@@ -1055,85 +1262,85 @@ class O extends F {
1055
1262
  get reject() {
1056
1263
  return this._reject;
1057
1264
  }
1058
- watch(t) {
1059
- return t.then(this.resolve, this.reject), this;
1060
- }
1061
- get [Symbol.toStringTag]() {
1062
- return "DeferredPromise";
1265
+ watch(e) {
1266
+ return e.then(this.resolve, this.reject), this;
1063
1267
  }
1064
1268
  }
1065
- class U extends F {
1066
- constructor(e, t) {
1067
- super((n, r) => {
1068
- const i = (v) => {
1069
- clearTimeout(b), n(v);
1070
- }, o = (v) => {
1071
- clearTimeout(b), r(v);
1072
- }, b = setTimeout(() => o(new C("The operation has timed out.")), t);
1073
- e(i, o);
1269
+ var xe, ge;
1270
+ class Ue extends (ge = v, xe = Symbol.toStringTag, ge) {
1271
+ constructor(e, n) {
1272
+ super((r, s) => {
1273
+ const o = (k) => {
1274
+ clearTimeout(M), r(k);
1275
+ }, u = (k) => {
1276
+ clearTimeout(M), s(k);
1277
+ }, M = setTimeout(() => u(new Oe("The operation has timed out.")), n);
1278
+ e(o, u);
1074
1279
  });
1075
- }
1076
- get [Symbol.toStringTag]() {
1077
- return "TimedPromise";
1280
+ a(this, xe, "TimedPromise");
1078
1281
  }
1079
1282
  }
1080
- class P {
1283
+ var ve;
1284
+ ve = Symbol.toStringTag;
1285
+ class je {
1081
1286
  constructor() {
1082
- u(this, "_subscribers");
1287
+ a(this, "_subscribers");
1288
+ a(this, ve, "Publisher");
1083
1289
  this._subscribers = [];
1084
1290
  }
1085
- subscribe(e) {
1086
- return this._subscribers.push(e), () => {
1087
- const t = this._subscribers.indexOf(e);
1088
- if (t < 0)
1089
- throw new q("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1090
- this._subscribers.splice(t, 1);
1291
+ subscribe(t) {
1292
+ return this._subscribers.push(t), () => {
1293
+ const e = this._subscribers.indexOf(t);
1294
+ if (e < 0)
1295
+ throw new Ce("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");
1296
+ this._subscribers.splice(e, 1);
1091
1297
  };
1092
1298
  }
1093
- publish(...e) {
1094
- return this._subscribers.slice().map((t) => t(...e));
1095
- }
1096
- get [Symbol.toStringTag]() {
1097
- return "Publisher";
1299
+ publish(...t) {
1300
+ return this._subscribers.slice().map((e) => e(...t));
1098
1301
  }
1099
1302
  }
1100
- class ee extends R {
1101
- constructor(t = x.Second) {
1102
- super((n) => this._publisher.publish(n), t);
1103
- u(this, "_publisher");
1104
- this._publisher = new P();
1303
+ var be, ke;
1304
+ class et extends (ke = Pe, be = Symbol.toStringTag, ke) {
1305
+ constructor(e = b.Second) {
1306
+ super((n) => this._publisher.publish(n), e);
1307
+ a(this, "_publisher");
1308
+ a(this, be, "Clock");
1309
+ this._publisher = new je();
1105
1310
  }
1106
- start(t = 0) {
1311
+ start(e = 0) {
1107
1312
  if (this._isRunning)
1108
- throw new m("The clock has already been started.");
1109
- super.start(t);
1313
+ throw new p("The clock has already been started.");
1314
+ super.start(e);
1110
1315
  }
1111
1316
  stop() {
1112
1317
  if (!this._isRunning)
1113
- throw new m("The clock hadn't yet started.");
1318
+ throw new p("The clock hadn't yet started.");
1114
1319
  super.stop();
1115
1320
  }
1116
- onTick(t, n = 0) {
1321
+ onTick(e, n = 0) {
1117
1322
  if (n < 0)
1118
- throw new M("The tick step must be a non-negative number.");
1323
+ throw new Fe("The tick step must be a non-negative number.");
1119
1324
  if (n === 0)
1120
- return this._publisher.subscribe(t);
1325
+ return this._publisher.subscribe(e);
1121
1326
  let r = 0;
1122
- return this._publisher.subscribe((i) => {
1123
- i - r < n || (t(i), r = i);
1327
+ return this._publisher.subscribe((s) => {
1328
+ s - r < n || (e(s), r = s);
1124
1329
  });
1125
1330
  }
1126
1331
  }
1127
- class te extends R {
1128
- constructor(t, n = x.Second) {
1332
+ var Se, Ee;
1333
+ class tt extends (Ee = Pe, Se = Symbol.toStringTag, Ee) {
1334
+ constructor(e, n = b.Second) {
1129
1335
  super(() => {
1130
- const i = this.remainingTime;
1131
- this._publisher.publish(i), i <= 0 && this.stop();
1336
+ const s = this.remainingTime;
1337
+ this._publisher.publish(s), s <= 0 && this.stop();
1132
1338
  }, n);
1133
- u(this, "_deferrer");
1134
- u(this, "_publisher");
1135
- u(this, "_duration");
1136
- this._publisher = new P(), this._duration = t;
1339
+ a(this, "_deferrer");
1340
+ a(this, "_publisher");
1341
+ a(this, "_duration");
1342
+ a(this, Se, "Countdown");
1343
+ this._publisher = new je(), this._duration = e;
1137
1344
  }
1138
1345
  get duration() {
1139
1346
  return this._duration;
@@ -1141,212 +1348,213 @@ class te extends R {
1141
1348
  get remainingTime() {
1142
1349
  return this._duration - this.elapsedTime;
1143
1350
  }
1144
- start(t = this.duration) {
1351
+ start(e = this.duration) {
1145
1352
  if (this._isRunning)
1146
- throw new m("The countdown has already been started.");
1353
+ throw new p("The countdown has already been started.");
1147
1354
  if (this._deferrer)
1148
- throw new g();
1149
- return this._deferrer = new O(), super.start(this.duration - t), this._deferrer;
1355
+ throw new x();
1356
+ return this._deferrer = new qe(), super.start(this.duration - e), this._deferrer;
1150
1357
  }
1151
- stop(t) {
1358
+ stop(e) {
1152
1359
  if (!this._isRunning)
1153
- throw new m("The countdown hadn't yet started.");
1360
+ throw new p("The countdown hadn't yet started.");
1154
1361
  if (!this._deferrer)
1155
- throw new g();
1156
- super.stop(), t !== void 0 ? this._deferrer.reject(t) : this._deferrer.resolve(), this._deferrer = void 0;
1362
+ throw new x();
1363
+ super.stop(), e !== void 0 ? this._deferrer.reject(e) : this._deferrer.resolve(), this._deferrer = void 0;
1157
1364
  }
1158
- onTick(t, n = 0) {
1365
+ onTick(e, n = 0) {
1159
1366
  if (n < 0)
1160
- throw new M("The tick step must be a non-negative number.");
1367
+ throw new Fe("The tick step must be a non-negative number.");
1161
1368
  if (n === 0)
1162
- return this._publisher.subscribe(t);
1369
+ return this._publisher.subscribe(e);
1163
1370
  let r = 0;
1164
- return this._publisher.subscribe((i) => {
1165
- r - i < n || (t(i), r = i);
1371
+ return this._publisher.subscribe((s) => {
1372
+ r - s < n || (e(s), r = s);
1166
1373
  });
1167
1374
  }
1168
1375
  }
1169
- class I {
1170
- static Boolean(e = 0.5) {
1171
- return Math.random() < e;
1376
+ var Te;
1377
+ Te = Symbol.toStringTag;
1378
+ const T = class T {
1379
+ constructor() {
1380
+ a(this, Te, "Random");
1172
1381
  }
1173
- static Integer(e, t) {
1174
- return Math.floor(t === void 0 ? Math.random() * e : Math.random() * (t - e) + e);
1382
+ static Boolean(t = 0.5) {
1383
+ return Math.random() < t;
1175
1384
  }
1176
- static Decimal(e, t) {
1177
- return e === void 0 ? Math.random() : t === void 0 ? Math.random() * e : Math.random() * (t - e) + e;
1385
+ static Integer(t, e) {
1386
+ return Math.floor(e === void 0 ? Math.random() * t : Math.random() * (e - t) + t);
1178
1387
  }
1179
- static Index(e) {
1180
- if (e.length === 0)
1181
- throw new f("You must provide at least one element.");
1182
- return this.Integer(e.length);
1388
+ static Decimal(t, e) {
1389
+ return t === void 0 ? Math.random() : e === void 0 ? Math.random() * t : Math.random() * (e - t) + t;
1183
1390
  }
1184
- static Choice(e) {
1185
- return e[I.Index(e)];
1391
+ static Index(t) {
1392
+ if (t.length === 0)
1393
+ throw new d("You must provide at least one element.");
1394
+ return this.Integer(t.length);
1186
1395
  }
1187
- // eslint-disable-next-line no-useless-constructor
1188
- constructor() {
1396
+ static Choice(t) {
1397
+ return t[T.Index(t)];
1189
1398
  }
1399
+ };
1400
+ let R = T;
1401
+ function nt(i) {
1402
+ return new Promise((t) => setTimeout(t, i));
1190
1403
  }
1191
- async function ne(s) {
1192
- return new Promise((e, t) => setTimeout(e, s));
1193
- }
1194
- async function re() {
1195
- return new Promise((s, e) => requestAnimationFrame(() => s()));
1404
+ function rt() {
1405
+ return new Promise((i) => requestAnimationFrame(() => i()));
1196
1406
  }
1197
- function se(s, e = "text/javascript") {
1198
- return new Promise((t, n) => {
1407
+ function st(i, t = "text/javascript") {
1408
+ return new Promise((e, n) => {
1199
1409
  const r = document.createElement("script");
1200
- r.async = !0, r.defer = !0, r.src = s, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
1410
+ r.async = !0, r.defer = !0, r.src = i, r.type = t, r.onload = () => e(), r.onerror = () => n(), document.body.appendChild(r);
1201
1411
  });
1202
1412
  }
1203
- function ie(...s) {
1204
- return new a(function* () {
1205
- for (const e of s)
1206
- for (const t of e)
1207
- yield t;
1413
+ function it(...i) {
1414
+ return new l(function* () {
1415
+ for (const t of i)
1416
+ for (const e of t)
1417
+ yield e;
1208
1418
  });
1209
1419
  }
1210
- function oe(s) {
1211
- if (Array.isArray(s))
1212
- return s.length;
1213
- let e = 0;
1214
- for (const t of s)
1215
- e += 1;
1216
- return e;
1420
+ function ot(i) {
1421
+ if (Array.isArray(i))
1422
+ return i.length;
1423
+ let t = 0;
1424
+ for (const e of i)
1425
+ t += 1;
1426
+ return t;
1217
1427
  }
1218
- function ue(s) {
1219
- return new a(function* () {
1220
- let e = 0;
1221
- for (const t of s)
1222
- yield [e, t], e += 1;
1428
+ function at(i) {
1429
+ return new l(function* () {
1430
+ let t = 0;
1431
+ for (const e of i)
1432
+ yield [t, e], t += 1;
1223
1433
  });
1224
1434
  }
1225
- function ae(s, e, t = 1) {
1226
- return new a(function* () {
1227
- e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
1228
- for (let n = s; n < e; n += t)
1435
+ function ut(i, t, e = 1) {
1436
+ return new l(function* () {
1437
+ t === void 0 && (t = i, i = 0), i > t && (e = e ?? -1);
1438
+ for (let n = i; n < t; n += e)
1229
1439
  yield n;
1230
1440
  });
1231
1441
  }
1232
- function ce(s) {
1233
- const e = Array.from(s);
1234
- for (let t = e.length - 1; t > 0; t -= 1) {
1235
- const n = Math.floor(Math.random() * (t + 1));
1236
- [e[t], e[n]] = [e[n], e[t]];
1442
+ function lt(i) {
1443
+ const t = Array.from(i);
1444
+ for (let e = t.length - 1; e > 0; e -= 1) {
1445
+ const n = Math.floor(Math.random() * (e + 1));
1446
+ [t[e], t[n]] = [t[n], t[e]];
1237
1447
  }
1238
- return e;
1448
+ return t;
1239
1449
  }
1240
- function le(s) {
1241
- return new a(function* () {
1242
- const e = /* @__PURE__ */ new Set();
1243
- for (const t of s)
1244
- e.has(t) || (e.add(t), yield t);
1450
+ function ct(i) {
1451
+ return new l(function* () {
1452
+ const t = /* @__PURE__ */ new Set();
1453
+ for (const e of i)
1454
+ t.has(e) || (t.add(e), yield e);
1245
1455
  });
1246
1456
  }
1247
- function N(s, e) {
1248
- return new a(function* () {
1249
- const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
1457
+ function Ne(i, t) {
1458
+ return new l(function* () {
1459
+ const e = i[Symbol.iterator](), n = t[Symbol.iterator]();
1250
1460
  for (; ; ) {
1251
- const r = t.next(), i = n.next();
1252
- if (r.done || i.done)
1461
+ const r = e.next(), s = n.next();
1462
+ if (r.done || s.done)
1253
1463
  break;
1254
- yield [r.value, i.value];
1464
+ yield [r.value, s.value];
1255
1465
  }
1256
1466
  });
1257
1467
  }
1258
- function he(s, e) {
1259
- if (e === void 0) {
1260
- let i = 0, o = 0;
1261
- for (const c of s)
1262
- i += c, o += 1;
1468
+ function ft(i, t) {
1469
+ if (t === void 0) {
1470
+ let s = 0, o = 0;
1471
+ for (const u of i)
1472
+ s += u, o += 1;
1263
1473
  if (o === 0)
1264
- throw new f("You must provide at least one value.");
1265
- return i / o;
1474
+ throw new d("You must provide at least one value.");
1475
+ return s / o;
1266
1476
  }
1267
- let t = 0, n = 0, r = 0;
1268
- for (const [i, o] of N(s, e)) {
1477
+ let e = 0, n = 0, r = 0;
1478
+ for (const [s, o] of Ne(i, t)) {
1269
1479
  if (o <= 0)
1270
- throw new f(`The weight for the value #${r} must be greater than zero.`);
1271
- t += i * o, n += o, r += 1;
1480
+ throw new d(`The weight for the value #${r} must be greater than zero.`);
1481
+ e += s * o, n += o, r += 1;
1272
1482
  }
1273
1483
  if (r === 0)
1274
- throw new f("You must provide at least one value and weight.");
1484
+ throw new d("You must provide at least one value and weight.");
1275
1485
  if (n > 0)
1276
- throw new f("The sum of weights must be greater than zero.");
1277
- return t / n;
1486
+ throw new d("The sum of weights must be greater than zero.");
1487
+ return e / n;
1278
1488
  }
1279
- function fe(s) {
1280
- let e = 0;
1281
- for (let t = 0; t < s.length; t += 1) {
1282
- const n = s.charCodeAt(t);
1283
- e = (e << 5) - e + n, e |= 0;
1489
+ function ht(i) {
1490
+ let t = 0;
1491
+ for (let e = 0; e < i.length; e += 1) {
1492
+ const n = i.charCodeAt(e);
1493
+ t = (t << 5) - t + n, t |= 0;
1284
1494
  }
1285
- return e;
1495
+ return t;
1286
1496
  }
1287
- function de(s) {
1288
- let e = 0;
1289
- for (const t of s)
1290
- e += t;
1291
- return e;
1497
+ function dt(i) {
1498
+ let t = 0;
1499
+ for (const e of i)
1500
+ t += e;
1501
+ return t;
1292
1502
  }
1293
- function me(s) {
1294
- return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
1503
+ function mt(i) {
1504
+ return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
1295
1505
  }
1296
- const we = "2.0.0-rc.2";
1506
+ const wt = "2.0.0-rc.4";
1297
1507
  export {
1298
- y as AggregatedAsyncIterator,
1299
- w as AggregatedIterator,
1300
- _ as Aggregator,
1301
- p as AsyncAggregator,
1302
- ee as Clock,
1303
- te as Countdown,
1304
- O as DeferredPromise,
1305
- h as Exception,
1306
- g as FatalErrorException,
1307
- T as FileException,
1308
- z as FileExistsException,
1309
- V as FileNotFoundException,
1310
- R as GameLoop,
1311
- Z as JSONStorage,
1312
- B as KeyException,
1313
- K as NetworkException,
1314
- Y as NotImplementedException,
1315
- G as PermissionException,
1316
- P as Publisher,
1317
- I as Random,
1318
- M as RangeException,
1319
- l as ReducedIterator,
1320
- q as ReferenceException,
1321
- m as RuntimeException,
1322
- d as SmartAsyncIterator,
1323
- a as SmartIterator,
1324
- F as SmartPromise,
1325
- x as TimeUnit,
1326
- U as TimedPromise,
1327
- C as TimeoutException,
1328
- H as TypeException,
1329
- we as VERSION,
1330
- f as ValueException,
1331
- he as average,
1332
- me as capitalize,
1333
- ie as chain,
1334
- oe as count,
1335
- L as dateDifference,
1336
- Q as dateRange,
1337
- X as dateRound,
1338
- ne as delay,
1339
- ue as enumerate,
1340
- fe as hash,
1341
- E as isBrowser,
1342
- J as isNode,
1343
- W as isWebWorker,
1344
- se as loadScript,
1345
- re as nextAnimationFrame,
1346
- ae as range,
1347
- ce as shuffle,
1348
- de as sum,
1349
- le as unique,
1350
- N as zip
1508
+ S as AggregatedAsyncIterator,
1509
+ g as AggregatedIterator,
1510
+ et as Clock,
1511
+ tt as Countdown,
1512
+ qe as DeferredPromise,
1513
+ c as Exception,
1514
+ x as FatalErrorException,
1515
+ Re as FileException,
1516
+ Ye as FileExistsException,
1517
+ ze as FileNotFoundException,
1518
+ Pe as GameLoop,
1519
+ Ze as JSONStorage,
1520
+ Be as KeyException,
1521
+ Ge as NetworkException,
1522
+ We as NotImplementedException,
1523
+ Ke as PermissionException,
1524
+ je as Publisher,
1525
+ R as Random,
1526
+ Fe as RangeException,
1527
+ f as ReducedIterator,
1528
+ Ce as ReferenceException,
1529
+ p as RuntimeException,
1530
+ h as SmartAsyncIterator,
1531
+ l as SmartIterator,
1532
+ v as SmartPromise,
1533
+ b as TimeUnit,
1534
+ Ue as TimedPromise,
1535
+ Oe as TimeoutException,
1536
+ He as TypeException,
1537
+ wt as VERSION,
1538
+ d as ValueException,
1539
+ ft as average,
1540
+ mt as capitalize,
1541
+ it as chain,
1542
+ ot as count,
1543
+ Le as dateDifference,
1544
+ Qe as dateRange,
1545
+ Xe as dateRound,
1546
+ nt as delay,
1547
+ at as enumerate,
1548
+ ht as hash,
1549
+ Me as isBrowser,
1550
+ Je as isNode,
1551
+ Ve as isWebWorker,
1552
+ st as loadScript,
1553
+ rt as nextAnimationFrame,
1554
+ ut as range,
1555
+ lt as shuffle,
1556
+ dt as sum,
1557
+ ct as unique,
1558
+ Ne as zip
1351
1559
  };
1352
1560
  //# sourceMappingURL=core.js.map